:root {
    --sidebar: #07131f;
    --sidebar-2: #0c1d2e;
    --accent: #2ee6d6;
    --accent-2: #3b82f6;
    --accent-dim: rgba(46, 230, 214, .14);
    --bg: #eef3f8;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --danger: #ef4444;
    --shadow: 0 10px 30px rgba(15, 23, 42, .06);
    --radius: 16px;
}

* { box-sizing: border-box; }

body.app-body {
    background: radial-gradient(1200px 500px at 10% -10%, #dbeafe 0%, transparent 50%), var(--bg);
    color: var(--text);
    font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
    min-height: 100vh;
}

.sidebar {
    width: 268px;
    background: linear-gradient(180deg, var(--sidebar) 0%, #061018 100%);
    color: #dbe7f3;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,.06);
}

.brand {
    padding: 22px 20px 18px;
    display: flex;
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: grid;
    place-items: center;
    color: #04201d;
    font-weight: 800;
    box-shadow: 0 8px 20px rgba(46, 230, 214, .25);
}

.brand small { color: #7f93a8; letter-spacing: .08em; text-transform: uppercase; font-size: 10px; }
.brand strong { display: block; color: #fff; font-size: 14px; }

.nav-scroll { overflow: auto; padding: 14px 12px 24px; flex: 1; }
.nav-label {
    color: #6d8298;
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: 16px 12px 6px;
}

.side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #c5d4e3;
    text-decoration: none;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 2px;
}
.side-link i { width: 18px; text-align: center; opacity: .85; }
.side-link:hover, .side-link.active {
    background: var(--accent-dim);
    color: #fff;
}
.side-link.active { box-shadow: inset 3px 0 0 var(--accent); }

.app-main { margin-left: 268px; min-height: 100vh; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: rgba(238,243,248,.86);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    padding: 14px 22px;
}
.search-wrap { position: relative; max-width: 460px; }
.search-wrap input {
    border-radius: 999px;
    border: 1px solid #d7e0ea;
    padding-left: 40px;
    background: #fff;
    height: 42px;
}
.search-wrap i { position: absolute; left: 14px; top: 13px; color: #94a3b8; }
.search-results {
    position: absolute;
    left: 0; right: 0; top: 48px;
    background: #fff;
    border-radius: 14px;
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
    display: none;
    overflow: hidden;
    z-index: 30;
}
.search-results a {
    display: block;
    padding: 10px 14px;
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid #f1f5f9;
}
.search-results a:hover { background: #f8fafc; }

.page { padding: 22px; }
.page-title { font-weight: 700; letter-spacing: -.03em; }
.card-soft {
    background: var(--card);
    border: 1px solid #e8eef5;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.stat-card {
    padding: 18px;
    border-radius: var(--radius);
    background: #fff;
    border: 1px solid #e8eef5;
    box-shadow: var(--shadow);
    height: 100%;
}
.stat-card .label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .value { font-size: 28px; font-weight: 800; letter-spacing: -.04em; margin-top: 4px; }
.stat-ico {
    width: 40px; height: 40px; border-radius: 12px;
    display: grid; place-items: center; background: var(--accent-dim); color: #0f766e;
}

.table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.table td, .table th { vertical-align: middle; }
.tag-pill {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: #0f172a;
    color: var(--accent);
    border-radius: 8px;
    padding: 3px 8px;
    font-size: 12px;
}

.btn-accent {
    background: linear-gradient(135deg, #14b8a6, #0ea5e9);
    border: 0;
    color: #fff;
    font-weight: 600;
}
.btn-accent:hover { color: #fff; filter: brightness(1.05); }

.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(900px 400px at 80% 0%, rgba(46,230,214,.18), transparent 50%),
        linear-gradient(160deg, #07131f, #0b2740);
}
.auth-card {
    width: min(440px, calc(100% - 32px));
    background: #fff;
    border-radius: 22px;
    padding: 32px;
    box-shadow: 0 30px 80px rgba(0,0,0,.28);
}
.rack-frame {
    background: linear-gradient(180deg, #111827, #020617);
    border-radius: 18px;
    padding: 16px 14px 18px;
    box-shadow: inset 0 0 0 2px #334155, 0 20px 50px rgba(2,6,23,.25);
    max-width: 520px;
}
.rack-rail {
    width: 18px;
    background: repeating-linear-gradient(#64748b 0 6px, #1e293b 6px 12px);
    border-radius: 4px;
}
.u-row {
    display: grid;
    grid-template-columns: 48px 1fr;
    min-height: 22px;
    border-bottom: 1px solid rgba(148,163,184,.15);
}
.u-num { color: #94a3b8; font-size: 11px; font-family: ui-monospace, monospace; display: grid; place-items: center; }
.u-slot {
    margin: 1px 0;
    border-radius: 4px;
    background: rgba(148,163,184,.08);
    color: #64748b;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: .08em;
}
.u-slot.filled {
    background: linear-gradient(90deg, #134e4a, #155e75);
    color: #ecfeff;
    cursor: pointer;
    justify-content: flex-start;
    padding: 0 10px;
    gap: 10px;
    box-shadow: inset 0 0 0 1px rgba(45,212,191,.4);
}
.u-slot.filled.span-start { border-radius: 4px 4px 0 0; }
.u-slot.filled.span-mid { border-radius: 0; min-height: 22px; }
.u-slot.filled.span-end { border-radius: 0 0 4px 4px; }
.u-slot .dev-tag { font-weight: 700; font-family: ui-monospace, monospace; }

.hw-block { border: 1px dashed #cbd5e1; border-radius: 14px; padding: 14px; background: #f8fafc; }
.mobile-toggle { display: none; }

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-110%);
        transition: transform .25s ease;
        width: min(300px, 86vw);
    }
    .sidebar.open { transform: none; }
    .app-main { margin-left: 0; }
    .mobile-toggle { display: inline-flex; }
    .page { padding: 16px; }
    .stat-card .value { font-size: 22px; }
}

@media print {
    .no-print { display: none !important; }
    body { background: #fff; }
}

.label-sheet { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.label-card {
    border: 1px solid #111;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    gap: 12px;
    align-items: center;
    break-inside: avoid;
}
.map-rack {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    color: inherit;
}
.map-rack:hover { border-color: #94a3b8; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.u-slot.drop-u.dragover, .u-slot.drop-u:hover { background: rgba(46,230,214,.18); color: #ecfeff; }
.u-slot.filled[draggable="true"] { cursor: grab; }
.rack-frame.occ-success { box-shadow: inset 0 0 0 2px #15803d, 0 20px 50px rgba(2,6,23,.25); }
.rack-frame.occ-info { box-shadow: inset 0 0 0 2px #0369a1, 0 20px 50px rgba(2,6,23,.25); }
.rack-frame.occ-warning { box-shadow: inset 0 0 0 2px #ca8a04, 0 20px 50px rgba(2,6,23,.25); }
.rack-frame.occ-danger { box-shadow: inset 0 0 0 2px #be123c, 0 20px 50px rgba(2,6,23,.25); }
.label-card h3 { margin: 0; font-family: ui-monospace, monospace; font-size: 20px; }
@media (max-width: 700px) { .label-sheet { grid-template-columns: 1fr; } }
