:root {
    color-scheme: dark;
    --bg: #07101c;
    --panel: rgba(15, 29, 47, .9);
    --panel-soft: rgba(18, 36, 58, .76);
    --line: rgba(174, 205, 226, .13);
    --text: #f4f7fb;
    --muted: #90a4b8;
    --cyan: #20d3c2;
    --blue: #4aa8ff;
    --gold: #efb84b;
    --danger: #ff6f78;
    --radius: 22px;
    --shadow: 0 24px 70px rgba(0, 0, 0, .25);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 86% 8%, rgba(32, 211, 194, .1), transparent 28rem),
        radial-gradient(circle at 12% 92%, rgba(74, 168, 255, .08), transparent 28rem),
        var(--bg);
}

body::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    content: "";
    opacity: .15;
    background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: linear-gradient(to bottom, black, transparent 82%);
}

a { color: inherit; text-decoration: none; }

button, input, select { font: inherit; }

.dashboard-shell { min-height: 100vh; display: grid; grid-template-columns: 258px minmax(0, 1fr); }

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 34px 24px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--line);
    background: rgba(5, 14, 25, .82);
    backdrop-filter: blur(18px);
}

.product-mark { display: flex; align-items: center; gap: 13px; }
.product-mark > span {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(32, 211, 194, .35);
    border-radius: 15px;
    color: var(--cyan);
    background: linear-gradient(145deg, rgba(32,211,194,.15), rgba(74,168,255,.05));
    box-shadow: inset 0 0 18px rgba(32,211,194,.1);
    font-weight: 850;
    letter-spacing: -.04em;
}
.product-mark strong { display: block; font-size: 1.05rem; letter-spacing: .01em; }
.product-mark small { display: block; margin-top: 3px; color: var(--muted); font-size: .7rem; letter-spacing: .13em; text-transform: uppercase; }

.sidebar nav { display: grid; gap: 8px; margin-top: 64px; }
.sidebar nav a { padding: 13px 14px; color: var(--muted); border: 1px solid transparent; border-radius: 13px; transition: .2s ease; }
.sidebar nav a:hover, .sidebar nav a.active { color: var(--text); border-color: var(--line); background: rgba(255,255,255,.045); transform: translateX(2px); }
.sidebar nav i { display: inline-block; width: 7px; height: 7px; margin-right: 10px; border: 1px solid currentColor; border-radius: 50%; }
.sidebar nav .active i { border-color: var(--cyan); background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }

.sidebar-footer { margin-top: auto; display: grid; gap: 12px; }
.sidebar-footer small { color: #63778c; }
.sidebar-footer a { color: var(--muted); font-size: .88rem; transition: color .2s ease; }
.sidebar-footer a:hover { color: var(--cyan); }

.dashboard-main { width: min(1440px, 100%); margin-inline: auto; padding: 38px clamp(24px, 4vw, 62px) 64px; }
.topbar { display: flex; justify-content: space-between; align-items: end; gap: 28px; margin-bottom: 35px; animation: rise .55s ease both; }
.eyebrow { margin: 0 0 7px; color: var(--cyan); font-size: .7rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(2rem, 4vw, 3.8rem); letter-spacing: -.055em; line-height: 1; }
h2 { margin-bottom: 0; font-size: 1.12rem; letter-spacing: -.015em; }

.topbar-controls { display: grid; grid-template-columns: auto auto; align-items: end; gap: 8px 12px; }
.topbar-controls label { grid-column: 1 / -1; color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
select, .login-card input {
    min-width: 220px;
    padding: 12px 42px 12px 14px;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 12px;
    outline: none;
    background-color: #101f31;
}
select:focus, .login-card input:focus { border-color: rgba(32,211,194,.65); box-shadow: 0 0 0 3px rgba(32,211,194,.1); }

.status-pill { min-width: 112px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: .79rem; text-align: center; background: rgba(255,255,255,.035); }
.status-pill span { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: currentColor; }
.status-pill.is-online { color: var(--cyan); border-color: rgba(32,211,194,.25); background: rgba(32,211,194,.08); }
.status-pill.is-online span { box-shadow: 0 0 11px var(--cyan); }
.status-pill.is-offline, .status-pill.is-error { color: var(--danger); border-color: rgba(255,111,120,.25); background: rgba(255,111,120,.08); }
.status-pill.is-loading { color: var(--gold); }
.status-pill.is-loading span { animation: pulse 1.1s infinite; }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.metric-card, .panel {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(19,37,59,.92), rgba(10,23,38,.88));
    box-shadow: var(--shadow);
}
.metric-card { min-height: 178px; padding: 22px; animation: rise .55s ease both; }
.metric-card:nth-child(2) { animation-delay: .06s; }
.metric-card:nth-child(3) { animation-delay: .12s; }
.metric-card:nth-child(4) { animation-delay: .18s; }
.metric-card::after { position: absolute; right: -40px; bottom: -55px; width: 130px; height: 130px; content: ""; border-radius: 50%; background: currentColor; filter: blur(55px); opacity: .11; }
.metric-card p { margin: 16px 0 5px; color: var(--muted); font-size: .84rem; }
.metric-card strong { display: block; font-variant-numeric: tabular-nums; font-size: 2.8rem; line-height: 1; letter-spacing: -.06em; }
.metric-card small { display: block; margin-top: 9px; color: #65798e; }
.metric-icon { width: 33px; height: 33px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 10px; font-weight: 800; }
.metric-in { color: var(--cyan); }
.metric-out { color: var(--blue); }
.metric-onboard { color: var(--gold); }
.metric-total { color: #bc9cff; }
.metric-card p, .metric-card strong, .metric-card small { color: var(--text); }
.metric-card p { color: var(--muted); }
.metric-card small { color: #65798e; }

.panel { padding: 24px; }
.flow-panel { margin-top: 16px; min-height: 370px; animation: rise .55s .2s ease both; }
.panel-heading { min-height: 44px; display: flex; justify-content: space-between; align-items: start; gap: 20px; margin-bottom: 22px; }
.chart-legend { display: flex; gap: 18px; color: var(--muted); font-size: .78rem; }
.chart-legend span::before { display: inline-block; width: 8px; height: 8px; margin-right: 7px; content: ""; border-radius: 50%; }
.legend-in::before { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.legend-out::before { background: var(--blue); box-shadow: 0 0 8px var(--blue); }
#flowChart { display: block; width: 100%; height: 270px; }

.lower-grid { display: grid; grid-template-columns: .78fr 1.22fr; gap: 16px; margin-top: 16px; }
.lower-grid .panel { animation: rise .55s .28s ease both; }
.health-list { display: grid; gap: 0; margin: 0; }
.health-list > div { padding: 16px 0; display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); }
.health-list dt { color: var(--muted); }
.health-list dd { margin: 0; text-align: right; font-weight: 700; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 10px; border-top: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: #64798d; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; }
td { color: #b9c7d5; font-size: .87rem; }
.direction-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.direction-badge.in { color: var(--cyan); background: rgba(32,211,194,.09); }
.direction-badge.out { color: var(--blue); background: rgba(74,168,255,.09); }

.empty-state, .error-message { padding: 22px; border: 1px solid rgba(239,184,75,.25); border-radius: var(--radius); color: #e7c981; background: rgba(239,184,75,.07); }

.login-page { display: grid; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); padding: clamp(28px, 7vw, 44px); border: 1px solid var(--line); border-radius: 26px; background: rgba(12,27,44,.9); box-shadow: var(--shadow); animation: rise .5s ease both; }
.login-mark { width: 56px; height: 56px; margin: 0 auto 25px; display: grid; place-items: center; border: 1px solid rgba(32,211,194,.38); border-radius: 17px; color: var(--cyan); background: rgba(32,211,194,.08); box-shadow: inset 0 0 20px rgba(32,211,194,.08); font-size: 1.05rem; font-weight: 900; }
.login-card > .eyebrow { text-align: center; }
.login-card h1 { margin-bottom: 10px; font-size: 2.2rem; text-align: center; }
.login-copy { margin-bottom: 30px; color: var(--muted); text-align: center; }
.login-card label { display: block; margin: 17px 0 7px; color: #b6c5d4; font-size: .8rem; font-weight: 700; }
.login-card input { width: 100%; min-width: 0; padding-right: 14px; }
.login-card button { width: 100%; margin-top: 22px; padding: 13px 18px; border: 0; border-radius: 12px; color: #031817; background: linear-gradient(135deg, #31dfcd, #66b9ff); cursor: pointer; font-weight: 850; transition: transform .2s ease, box-shadow .2s ease; }
.login-card button:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(32,211,194,.17); }
.login-error { margin-bottom: 18px; padding: 11px 13px; border: 1px solid rgba(255,111,120,.25); border-radius: 11px; color: #ffadb2; background: rgba(255,111,120,.08); font-size: .83rem; }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 50% { opacity: .35; transform: scale(.72); } }

@media (max-width: 1050px) {
    .dashboard-shell { grid-template-columns: 86px minmax(0, 1fr); }
    .sidebar { padding-inline: 18px; align-items: center; }
    .product-mark > div, .sidebar nav a { font-size: 0; }
    .sidebar nav a { width: 48px; height: 48px; display: grid; place-items: center; padding: 0; }
    .sidebar nav i { width: 9px; height: 9px; margin: 0; }
    .sidebar-footer small { display: none; }
    .sidebar-footer a { font-size: .7rem; }
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    .dashboard-shell { display: block; }
    .sidebar { position: static; width: auto; height: auto; padding: 16px 20px; flex-direction: row; justify-content: space-between; border-right: 0; border-bottom: 1px solid var(--line); }
    .product-mark > div { display: block; }
    .product-mark strong { font-size: .95rem; }
    .product-mark small { font-size: .57rem; }
    .product-mark > span { width: 40px; height: 40px; }
    .sidebar nav { display: none; }
    .sidebar-footer { margin: 0; align-self: center; }
    .dashboard-main { padding: 28px 16px 45px; }
    .topbar { display: block; }
    .topbar-controls { margin-top: 24px; grid-template-columns: 1fr auto; }
    select { min-width: 0; width: 100%; }
    .summary-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .metric-card { min-height: 152px; padding: 17px; }
    .metric-card strong { font-size: 2.25rem; }
    .lower-grid { grid-template-columns: 1fr; }
    .panel { padding: 19px; }
    .chart-legend { display: none; }
}

@media (max-width: 430px) {
    .topbar-controls { grid-template-columns: 1fr; }
    .status-pill { justify-self: start; }
    .summary-grid { grid-template-columns: 1fr; }
    .metric-card { min-height: 138px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.bytebox-admin { max-width: 1500px; }
.admin-link, .box-actions a { display: inline-flex; align-items: center; justify-content: center; padding: 10px 13px; border-radius: 10px; color: #fff; background: #ff650b; font-size: .78rem; font-weight: 800; text-decoration: none; }
.admin-intro { max-width: 780px; margin: -15px 0 30px; color: #7d899a; line-height: 1.6; }
.admin-notice { margin-bottom: 20px; padding: 13px 16px; border-radius: 10px; font-size: .85rem; }
.admin-notice.success { color: #12653f; background: #e9f8ef; }.admin-notice.error { color: #9f3f29; background: #fff0eb; }
.add-box-panel { margin-bottom: 22px; }.box-admin-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }.box-admin-form label { display: grid; gap: 6px; color: #8e99a7; font-size: .7rem; font-weight: 800; }.box-admin-form input, .box-admin-form textarea { width: 100%; padding: 10px; border: 1px solid #24354d; border-radius: 8px; color: #e8eef8; background: #0e1a2b; font: inherit; }.box-admin-form textarea { resize: vertical; line-height: 1.45; }.box-admin-form .contents-input { grid-column: span 2; }.box-admin-form button { align-self: end; min-height: 42px; border: 0; border-radius: 8px; color: #fff; background: #ff650b; cursor: pointer; font-weight: 800; }.box-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(305px, 1fr)); gap: 16px; }.box-card { padding: 20px; }.box-card.is-inactive { opacity: .6; }.box-card-head { display: flex; justify-content: space-between; gap: 12px; }.box-card-head h2 { margin: 0; font-size: 1.25rem; }.box-card-head span { height: fit-content; padding: 5px 8px; border-radius: 999px; color: #1ed189; background: rgba(30,209,137,.1); font-size: .64rem; font-weight: 800; }.is-inactive .box-card-head span { color: #e8a35c; }.box-price { color: #bbc7d8; font-size: .78rem; }.box-contents { min-height: 62px; color: #e3eaf5; font-size: .8rem; line-height: 1.6; }.box-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 17px 0; }.box-actions a:last-child { color: #afc0d5; background: #1a2b43; }.box-card details { border-top: 1px solid #26384f; padding-top: 13px; }.box-card summary { cursor: pointer; color: #afc0d5; font-size: .78rem; font-weight: 800; }.box-card details form { margin-top: 14px; }.active-toggle { grid-column: span 2; display: flex !important; align-items: center; grid-template-columns: auto 1fr; }.active-toggle input { width: auto !important; }
@media (max-width: 760px) { .box-admin-form { grid-template-columns: 1fr; }.box-admin-form .contents-input, .active-toggle { grid-column: span 1; } }
.seat-layout{display:grid;grid-template-columns:repeat(4,minmax(68px,1fr));gap:12px;margin:20px 0}.seat-tile{padding:16px 8px;border:1px solid #26384f;border-radius:12px;text-align:center;color:#e8eef8;text-decoration:none;background:#0e1a2b}.seat-tile strong,.seat-tile small{display:block}.seat-tile small{margin-top:4px;color:#8e99a7}.seat-tile.is-inactive{opacity:.48}.product-assignment{display:grid;gap:10px;max-width:560px}.product-assignment label{padding:10px 12px;background:#0e1a2b;border:1px solid #26384f;border-radius:8px}.product-assignment button{margin-top:8px}.orders-table{overflow:auto}.orders-table table{width:100%;border-collapse:collapse;min-width:760px}.orders-table th,.orders-table td{padding:12px;text-align:left;border-bottom:1px solid #26384f;font-size:.9rem}.box-actions form{display:inline}.box-actions button{border:0;background:#1a2b43;color:#afc0d5;border-radius:10px;padding:10px 13px;font:inherit;cursor:pointer}
