/* ═══════════════════════════════════════════════
   SHIPWARE — Corporate WMS Theme
   Desktop-app nuance, responsive, professional
   ═══════════════════════════════════════════════ */

/* ── Reset & Variables ────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #0ea5e9;
    --sidebar-hover: rgba(255,255,255,0.06);
    --sidebar-width: 250px;
    --sidebar-collapsed: 68px;
    --topbar-h: 56px;
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --primary: #0ea5e9;
    --primary-hover: #0284c7;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --radius: 8px;
    --radius-sm: 5px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --transition: 180ms ease;
}

html { font-size: 14px; -webkit-font-smoothing: antialiased; }

body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.5; overflow: hidden; height: 100vh; height: 100dvh; }

/* ── App Shell ────────────────────────────── */
.app-shell {
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* ── Sidebar ──────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    transition: width var(--transition), min-width var(--transition);
    z-index: 100;
    border-right: 1px solid rgba(255,255,255,0.06);
}
.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed);
    min-width: var(--sidebar-collapsed);
}
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    min-height: 60px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { flex-shrink: 0; display: flex; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { color: #fff; font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em; line-height: 1.1; }
.brand-sub { color: var(--sidebar-text); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; }
.collapse-btn {
    background: none; border: none; color: var(--sidebar-text); cursor: pointer;
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    border-radius: 4px; transition: background var(--transition);
}
.collapse-btn:hover { background: var(--sidebar-hover); color: #fff; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.nav-group-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.25);
    padding: 16px 10px 4px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 450;
    transition: all var(--transition);
    margin-bottom: 1px;
    position: relative;
}
.nav-item:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.nav-item.active {
    background: rgba(14, 165, 233, 0.12);
    color: var(--sidebar-active);
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--sidebar-active);
}
.nav-icon { flex-shrink: 0; display: flex; align-items: center; opacity: 0.8; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Sidebar footer */
.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 8px;
    position: relative;
}
.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
}
.user-card:hover { background: var(--sidebar-hover); }
.user-avatar {
    width: 34px; height: 34px; border-radius: 8px;
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    color: #fff; font-weight: 700; font-size: 0.85rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-name { color: #e2e8f0; font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: var(--sidebar-text); font-size: 0.7rem; }
.user-menu {
    position: absolute;
    bottom: 100%;
    left: 8px;
    right: 8px;
    background: #1e293b;
    border-radius: var(--radius);
    padding: 4px;
    box-shadow: var(--shadow-md);
    margin-bottom: 4px;
}
.user-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 0.82rem;
    text-decoration: none;
    transition: all var(--transition);
    border: none;
    background: none;
    cursor: pointer;
    width: 100%;
    font-family: inherit;
}
.user-menu-item:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.user-menu-item.logout:hover { color: var(--danger); }

/* ── Main Content ─────────────────────────── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
}

/* ── Topbar ───────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    height: var(--topbar-h);
    padding: 0 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    gap: 16px;
    flex-shrink: 0;
}
.topbar-left { flex: 1; }
.page-title { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-search {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 12px;
    color: var(--text-muted);
}
.topbar-search input {
    border: none;
    background: none;
    outline: none;
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--text);
    width: 180px;
}
.warehouse-badge {
    background: var(--primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.03em;
}

/* ── Content Area ─────────────────────────── */
.content-area {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    padding: 24px 24px 120px 24px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

/* ── Cards ────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 0.92rem; font-weight: 650; }
.card-subtitle { font-size: 0.78rem; color: var(--text-muted); }

/* ── KPI Cards ────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.kpi-grid-3 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}
.kpi-card:hover { box-shadow: var(--shadow); }
.kpi-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.kpi-data { display: flex; flex-direction: column; }
.kpi-value { font-size: 1.4rem; font-weight: 750; line-height: 1.1; letter-spacing: -0.02em; }
.kpi-label { font-size: 0.76rem; color: var(--text-muted); margin-top: 2px; }

/* ── Dashboard ────────────────────────────── */
.dashboard { display: flex; flex-direction: column; gap: 20px; }
.dash-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }

.chart-card { overflow: hidden; max-width: 100%; }

/* Bar Chart */
.chart-area { padding: 20px; overflow: hidden; }
.bar-chart { display: flex; align-items: flex-end; gap: 12px; height: 170px; padding: 10px 0 24px 0; border-bottom: 1px solid var(--border); }
.bar-group { display: flex; flex-direction: column; align-items: center; flex: 1; }
.bars { display: flex; gap: 5px; align-items: flex-end; }
.bar { width: 18px; border-radius: 3px 3px 0 0; transition: height 0.3s ease; cursor: pointer; max-height: 130px; }
.bar.inbound { background: #3b82f6; }
.bar.outbound { background: #22c55e; }
.bar:hover { opacity: 0.8; }
.bar-label { font-size: 0.72rem; color: var(--text-muted); margin-top: 8px; }
.chart-legend { display: flex; gap: 16px; padding-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 0.76rem; color: var(--text-secondary); }
.legend-dot { width: 8px; height: 8px; border-radius: 2px; }

/* Utilization ring */
.utilization-ring { display: flex; justify-content: center; padding: 16px 0 8px; }
.zone-bars { padding: 0 20px 16px; }
.zone-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.zone-bar-label { font-size: 0.76rem; color: var(--text-secondary); width: 50px; }
.zone-bar-track { flex: 1; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.zone-bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.zone-bar-pct { font-size: 0.72rem; font-weight: 600; width: 36px; text-align: right; }

/* Activity list */
.activity-list { padding: 12px 20px; }
.activity-item { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.activity-content { flex: 1; min-width: 0; }
.activity-title { font-size: 0.82rem; font-weight: 500; display: block; }
.activity-meta { font-size: 0.72rem; color: var(--text-muted); }

/* Top products */
.top-products { padding: 12px 20px; }
.top-product-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.top-product-info { min-width: 120px; }
.top-product-name { font-size: 0.82rem; font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-product-qty { font-size: 0.7rem; color: var(--text-muted); }
.top-product-bar-track { flex: 1; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.top-product-bar-fill { height: 100%; background: var(--primary); border-radius: 3px; }
.top-product-rev { font-size: 0.82rem; font-weight: 600; min-width: 60px; text-align: right; }

/* ── Data Tables ──────────────────────────── */
.data-card { overflow: hidden; }
.data-card > table, .card > table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.data-table thead { background: #f8fafc; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1; }
.data-table th {
    padding: 10px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    white-space: nowrap;
}
.data-table td { padding: 10px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: #f8fafc; }
.td-primary { font-weight: 550; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-600 { font-weight: 600; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.table-footer { padding: 10px 16px; border-top: 1px solid var(--border); font-size: 0.78rem; color: var(--text-muted); }
.inner-table { width: 100%; margin: 8px 0; }
.inner-table th { background: none; font-size: 0.72rem; padding: 6px 10px; }
.inner-table td { padding: 6px 10px; border-bottom: 1px solid #f1f5f9; }
.row-danger { background: #fef2f2 !important; }
.row-warning { background: #fffbeb !important; }
.expanded-row td { background: #f8fafc; }
.expanded-content { padding: 8px 16px 16px; }
.detail-grid { display: flex; gap: 32px; margin-bottom: 12px; font-size: 0.84rem; }
.note-text { margin-top: 10px; font-size: 0.82rem; color: var(--text-secondary); }
.group-header-row td { background: #f1f5f9; font-weight: 650; font-size: 0.78rem; letter-spacing: 0.03em; }

/* Permission table */
.perm-check { color: var(--success); font-weight: 700; font-size: 1rem; }
.perm-x { color: #e2e8f0; }
.permission-table td, .permission-table th { padding: 7px 14px; }

/* ── Badges & Tags ────────────────────────── */
.badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 650;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #a16207; }
.badge-danger { background: #fecaca; color: #dc2626; }
.badge-info { background: #cffafe; color: #0e7490; }
.badge-primary { background: #dbeafe; color: #1d4ed8; }
.badge-muted { background: #f1f5f9; color: #64748b; }
.tag {
    display: inline-block;
    font-size: 0.74rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: #f1f5f9;
    color: var(--text-secondary);
}
.sku-code, .lot-code { font-size: 0.78rem; background: #f1f5f9; padding: 1px 6px; border-radius: 3px; color: var(--text-secondary); }
code { font-family: 'DM Mono', 'SF Mono', 'Fira Code', monospace; }

/* ── Toolbar ──────────────────────────────── */
.page-content { display: flex; flex-direction: column; gap: 16px; }
.page-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.section-title { font-size: 0.95rem; font-weight: 650; }
.search-box {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 7px 12px;
    color: var(--text-muted);
    min-width: 200px;
}
.search-box input { border: none; background: none; outline: none; font-family: inherit; font-size: 0.85rem; color: var(--text); width: 100%; }
.filter-select {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.84rem;
    color: var(--text);
    background: var(--surface);
    cursor: pointer;
    outline: none;
}
.filter-select:focus { border-color: var(--primary); }

/* ── Buttons ──────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #f8fafc; }
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border: none; background: none; border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}
.btn-icon:hover { background: #f1f5f9; color: var(--text); }
.action-btns { display: flex; gap: 2px; }

/* ── Forms ────────────────────────────────── */
.form-card { padding-bottom: 0; }
.form-card .card-header { margin-bottom: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; padding: 16px 20px; }
.form-grid-2 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-field label { font-size: 0.76rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em; }
.form-field input,
.form-field select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color var(--transition);
}
.form-field input:focus,
.form-field select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(14,165,233,0.1); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.toggle-list { padding: 12px 20px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #f1f5f9; cursor: pointer; font-size: 0.88rem; }
.toggle-row:last-child { border-bottom: none; }
.toggle-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }

/* ── Zone Grid (Warehouse) ────────────────── */
.zone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.zone-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}
.zone-card:hover { box-shadow: var(--shadow); }
.zone-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.zone-name { font-size: 0.95rem; font-weight: 600; margin-bottom: 6px; }
.zone-meta { display: flex; gap: 12px; font-size: 0.76rem; color: var(--text-muted); margin-bottom: 12px; }
.zone-code { font-size: 0.72rem; color: var(--text-muted); }
.zone-capacity { margin-top: 4px; }
.zone-cap-header { display: flex; justify-content: space-between; font-size: 0.76rem; margin-bottom: 4px; color: var(--text-secondary); }
.zone-cap-detail { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.zone-temp { display: flex; align-items: center; gap: 6px; font-size: 0.76rem; color: var(--info); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.zone-type-badge {
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 4px;
}
.zt-receiving { background: #dbeafe; color: #1d4ed8; }
.zt-storage { background: #e0e7ff; color: #4338ca; }
.zt-picking { background: #fef3c7; color: #a16207; }
.zt-packing { background: #fae8ff; color: #a21caf; }
.zt-shipping { background: #d1fae5; color: #047857; }
.zt-hazmat { background: #fecaca; color: #dc2626; }
.zt-cold { background: #cffafe; color: #0e7490; }
.zt-quarantine { background: #fee2e2; color: #b91c1c; }
.zt-returns { background: #f1f5f9; color: #475569; }
.carrier-services { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }

/* ── Progress Bar ─────────────────────────── */
.progress-bar-container { height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 3px; background: var(--primary); transition: width 0.4s ease; }
.progress-purple { background: #a855f7; }

/* ── Tracking Timeline ────────────────────── */
.tracking-card { margin-bottom: 16px; padding: 20px; }
.tracking-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tracking-header h3 { font-size: 1rem; }
.tracking-route { font-size: 0.88rem; color: var(--text-secondary); margin-bottom: 16px; }
.route-arrow { margin: 0 8px; color: var(--primary); }
.tracking-timeline { padding-left: 16px; border-left: 2px solid #e2e8f0; }
.timeline-item { position: relative; padding: 0 0 20px 20px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
    position: absolute; left: -7px; top: 4px;
    width: 12px; height: 12px; border-radius: 50%;
    background: #e2e8f0; border: 2px solid var(--surface);
}
.timeline-active .timeline-dot { background: var(--primary); box-shadow: 0 0 0 3px rgba(14,165,233,0.2); }
.timeline-status { font-weight: 600; font-size: 0.88rem; }
.timeline-desc { font-size: 0.82rem; color: var(--text-secondary); }
.timeline-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

/* ── Role Summary ─────────────────────────── */
.role-summary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; padding: 16px 20px; }
.role-summary-card { background: #f8fafc; border-radius: var(--radius); padding: 14px; }
.role-summary-card h4 { font-size: 0.92rem; margin-bottom: 2px; }
.role-perm-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }

/* ── Settings ─────────────────────────────── */
.settings-grid { display: flex; flex-direction: column; gap: 16px; }

/* ── User Avatar SM ───────────────────────── */
.user-avatar-sm {
    width: 30px; height: 30px; border-radius: 6px;
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    color: #fff; font-weight: 700; font-size: 0.72rem;
    display: flex; align-items: center; justify-content: center;
}

/* ── Login Page ───────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f172a;
    position: relative;
    overflow: hidden;
}
.login-bg {
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at 30% 20%, rgba(14,165,233,0.15), transparent 50%),
                radial-gradient(ellipse at 70% 80%, rgba(99,102,241,0.1), transparent 50%);
}
.login-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}
.login-card {
    position: relative;
    background: rgba(30,41,59,0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    margin: 20px;
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand h1 { color: #fff; font-size: 1.6rem; font-weight: 800; letter-spacing: -0.03em; margin-top: 12px; }
.login-tagline { color: var(--sidebar-text); font-size: 0.84rem; margin-top: 4px; }
.login-error {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.2);
    color: #fca5a5;
    font-size: 0.82rem;
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form .form-field label { color: #94a3b8; }
.login-form .input-wrapper {
    display: flex; align-items: center; gap: 8px;
    background: rgba(15,23,42,0.6);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: #94a3b8;
    transition: border-color var(--transition);
}
.login-form .input-wrapper:focus-within { border-color: var(--primary); }
.login-form .input-wrapper input {
    border: none; background: none; outline: none; flex: 1;
    font-family: inherit; font-size: 0.92rem; color: #e2e8f0;
}
.login-form .input-wrapper input::placeholder { color: #475569; }
.btn-login {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition);
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-login:hover { background: var(--primary-hover); }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; }
.spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.login-demo { margin-top: 24px; border-top: 1px solid rgba(255,255,255,0.06); padding-top: 20px; }
.login-demo p { font-size: 0.76rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
.demo-accounts { display: flex; flex-wrap: wrap; gap: 6px; }
.demo-chip {
    display: flex; flex-direction: column; align-items: center;
    padding: 6px 12px; border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: #cbd5e1; font-family: inherit; font-size: 0.76rem;
    cursor: pointer; transition: all var(--transition);
}
.demo-chip:hover { background: rgba(14,165,233,0.1); border-color: rgba(14,165,233,0.3); }
.chip-role { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--primary); font-weight: 700; }
.chip-user { font-weight: 500; }

/* ── Empty State ──────────────────────────── */
.page-empty { text-align: center; padding: 80px 20px; color: var(--text-secondary); }
.empty-icon { font-size: 3rem; margin-bottom: 12px; }
.page-empty h2 { font-size: 1.2rem; margin-bottom: 6px; color: var(--text); }
.page-empty p { font-size: 0.88rem; margin-bottom: 20px; }

/* ── Mobile ───────────────────────────────── */
.mobile-only { display: none; }
.sidebar-overlay { display: none; }
.mobile-menu-btn {
    display: none;
    align-items: center; justify-content: center;
    width: 36px; height: 36px; border: none; background: none;
    color: var(--text); cursor: pointer; border-radius: var(--radius-sm);
}

@media (max-width: 1024px) {
    .dash-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .mobile-only { display: flex; }
    .desktop-only { display: none; }
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 270px !important;
        min-width: 270px !important;
        z-index: 200;
        transition: left 0.25s ease;
    }
    .mobile-open .sidebar { left: 0; }
    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 150;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }
    .mobile-open .sidebar-overlay { opacity: 1; pointer-events: auto; }
    .sidebar-collapsed .sidebar {
        width: 270px !important;
        min-width: 270px !important;
    }
    .content-area {
    min-height: 0; padding: 16px; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .topbar-search { display: none; }
    .card, .chart-card { max-width: 100%; overflow: hidden; }
    .bar-chart { gap: 8px; }
    .bar { width: 14px; }
    .page-toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-left { flex-wrap: wrap; }
    .zone-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .content-area {
        padding: 16px 16px 140px 16px;
        -webkit-overflow-scrolling: touch;
    }
    .app-shell {
        height: 100dvh;
        height: -webkit-fill-available;
    }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .data-table { font-size: 0.78rem; }
    .data-table th, .data-table td { padding: 8px 10px; }
    .login-card { padding: 28px 20px; }
}
