/* =========================================================================
   SPYRON SERVICE PRO — Panel theme (Admin + Vendor)
   Built on Bootstrap 5.3. Design tokens live in :root.
   ========================================================================= */
:root {
  --spy-font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --spy-primary: #2563eb;
  --spy-primary-rgb: 37, 99, 235;
  --spy-primary-soft: #eaf1ff;
  --spy-accent: #14b8a6;
  --spy-bg: #f4f6fb;
  --spy-surface: #ffffff;
  --spy-border: #e6e9f2;
  --spy-text: #0f172a;
  --spy-muted: #64748b;
  --spy-sidebar: #0b1730;
  --spy-sidebar-2: #10213f;
  --spy-sidebar-text: #aab6cf;
  --spy-radius: 14px;
  --spy-radius-sm: 10px;
  --spy-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
  --spy-shadow-lg: 0 10px 40px rgba(15, 23, 42, .12);
  --sidebar-w: 260px;
  --topbar-h: 64px;

  --bs-primary: var(--spy-primary);
  --bs-primary-rgb: var(--spy-primary-rgb);
  --bs-body-font-family: var(--spy-font);
  --bs-body-color: var(--spy-text);
  --bs-border-color: var(--spy-border);
  --bs-link-color: var(--spy-primary);
  --bs-link-color-rgb: var(--spy-primary-rgb);
}

/* Super-admin panel uses a violet accent so the two panels are never confused */
.panel-admin {
  --spy-primary: #6d28d9;
  --spy-primary-rgb: 109, 40, 217;
  --spy-primary-soft: #f1eafe;
  --spy-sidebar: #160f2e;
  --spy-sidebar-2: #21173f;
}

html, body { height: 100%; }
body {
  font-family: var(--spy-font);
  background: var(--spy-bg);
  color: var(--spy-text);
  font-size: .9rem;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; }
.text-muted { color: var(--spy-muted) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.small-caps { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--spy-muted); }

/* ------------------------------------------------------------ Buttons */
.btn { border-radius: 10px; font-weight: 600; font-size: .85rem; padding: .5rem 1rem; }
.btn-sm { padding: .35rem .7rem; font-size: .78rem; border-radius: 8px; }
.btn-primary { background: var(--spy-primary); border-color: var(--spy-primary); box-shadow: 0 4px 12px rgba(var(--spy-primary-rgb), .25); }
.btn-primary:hover, .btn-primary:focus { background: color-mix(in srgb, var(--spy-primary) 85%, #000); border-color: color-mix(in srgb, var(--spy-primary) 85%, #000); }
.btn-outline-primary { color: var(--spy-primary); border-color: rgba(var(--spy-primary-rgb), .4); }
.btn-outline-primary:hover { background: var(--spy-primary); border-color: var(--spy-primary); }
.btn-soft { background: var(--spy-primary-soft); color: var(--spy-primary); border: 0; }
.btn-soft:hover { background: var(--spy-primary); color: #fff; }
.btn-light { background: #fff; border-color: var(--spy-border); color: var(--spy-text); }
.btn-light:hover { background: #f1f4fa; border-color: #d7dcea; }
.btn-icon { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; }
.btn-icon.btn-sm { width: 30px; height: 30px; }

/* ------------------------------------------------------------ Forms */
.form-control, .form-select { border-radius: 10px; border-color: var(--spy-border); font-size: .88rem; padding: .55rem .8rem; background-color: #fff; }
.form-control:focus, .form-select:focus { border-color: rgba(var(--spy-primary-rgb), .6); box-shadow: 0 0 0 .2rem rgba(var(--spy-primary-rgb), .12); }
.form-label { font-weight: 600; font-size: .8rem; color: #334155; margin-bottom: .35rem; }
.form-label .req { color: #ef4444; }
.input-group-text { border-radius: 10px; background: #f8fafc; border-color: var(--spy-border); color: var(--spy-muted); }
.form-text { font-size: .75rem; }
.form-check-input:checked { background-color: var(--spy-primary); border-color: var(--spy-primary); }
.invalid-feedback { display: block; }

/* ------------------------------------------------------------ Layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1040;
  background: linear-gradient(180deg, var(--spy-sidebar) 0%, var(--spy-sidebar-2) 100%);
  color: var(--spy-sidebar-text); display: flex; flex-direction: column;
  transition: transform .25s ease;
}
.sidebar-brand { height: var(--topbar-h); display: flex; align-items: center; gap: .65rem; padding: 0 1.25rem; color: #fff; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--spy-primary), var(--spy-accent)); box-shadow: 0 6px 18px rgba(var(--spy-primary-rgb), .45); flex-shrink: 0; }
.brand-text { line-height: 1.1; }
.brand-text strong { display: block; font-size: .95rem; letter-spacing: .02em; }
.brand-text small { font-size: .68rem; color: var(--spy-sidebar-text); letter-spacing: .12em; text-transform: uppercase; }
.sidebar-company { margin: 1rem 1rem .25rem; padding: .7rem .8rem; border-radius: 12px; background: rgba(255,255,255,.05); display: flex; gap: .6rem; align-items: center; }
.sidebar-company .logo { width: 34px; height: 34px; border-radius: 9px; background: #fff; display: grid; place-items: center; overflow: hidden; color: var(--spy-primary); font-weight: 800; font-size: .8rem; flex-shrink: 0; }
.sidebar-company .logo img { width: 100%; height: 100%; object-fit: contain; }
.sidebar-company .name { color: #fff; font-weight: 600; font-size: .8rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sidebar-company .plan { font-size: .68rem; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .5rem .75rem 1.5rem; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-section { font-size: .65rem; text-transform: uppercase; letter-spacing: .14em; font-weight: 700; color: rgba(170,182,207,.55); padding: 1.1rem .75rem .45rem; }
.nav-link-spy { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border-radius: 10px; color: var(--spy-sidebar-text); font-weight: 500; font-size: .86rem; transition: all .15s; position: relative; }
.nav-link-spy i { font-size: 1.05rem; width: 20px; text-align: center; }
.nav-link-spy:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-link-spy.active { color: #fff; background: linear-gradient(90deg, rgba(var(--spy-primary-rgb), .9), rgba(var(--spy-primary-rgb), .55)); box-shadow: 0 6px 16px rgba(var(--spy-primary-rgb), .3); }
.nav-link-spy .nav-badge { margin-left: auto; background: #ef4444; color: #fff; font-size: .65rem; font-weight: 700; border-radius: 20px; padding: .12rem .45rem; }
.sidebar-footer { padding: 1rem; border-top: 1px solid rgba(255,255,255,.06); font-size: .72rem; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1030; height: var(--topbar-h); background: rgba(255,255,255,.85); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--spy-border); display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem; }
.topbar .page-heading { font-weight: 700; font-size: 1.05rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-search { position: relative; max-width: 340px; flex: 1; }
.topbar-search input { padding-left: 2.3rem; background: #f4f6fb; border-color: transparent; border-radius: 12px; }
.topbar-search i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--spy-muted); }
.topbar .avatar-btn { display: flex; align-items: center; gap: .55rem; border: 0; background: transparent; padding: .25rem .4rem; border-radius: 12px; }
.topbar .avatar-btn:hover { background: #f1f4fa; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: .78rem; color: var(--spy-primary);
  background: var(--spy-primary-soft); flex-shrink: 0; }
.avatar-sm { width: 30px; height: 30px; font-size: .7rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }
.content { padding: 1.5rem; flex: 1; }
.content-footer { padding: 1rem 1.5rem; font-size: .75rem; color: var(--spy-muted); }
.impersonate-bar { background: #fef3c7; color: #92400e; font-size: .8rem; padding: .5rem 1.5rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

.sidebar-backdrop { display: none; }

/* ------------------------------------------------------------ Page header */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.35rem; font-weight: 700; margin: 0; }
.page-head p { margin: .2rem 0 0; color: var(--spy-muted); font-size: .85rem; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.breadcrumb { font-size: .75rem; margin-bottom: .25rem; }
.breadcrumb a { color: var(--spy-muted); }

/* ------------------------------------------------------------ Cards */
.card { border: 1px solid var(--spy-border); border-radius: var(--spy-radius); box-shadow: var(--spy-shadow); background: var(--spy-surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--spy-border); padding: 1rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.card-header h5, .card-header h6 { margin: 0; font-weight: 700; font-size: .95rem; }
.card-body { padding: 1.25rem; }
.card-footer { background: #fafbfe; border-top: 1px solid var(--spy-border); padding: .9rem 1.25rem; border-radius: 0 0 var(--spy-radius) var(--spy-radius); }

.stat-card { padding: 1.15rem 1.25rem; display: flex; flex-direction: row; gap: 1rem; align-items: center; position: relative; overflow: hidden; height: 100%; }
.stat-card .stat-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.35rem; flex-shrink: 0; }
.stat-card .stat-label { font-size: .75rem; color: var(--spy-muted); font-weight: 600; }
.stat-card .stat-value { font-size: 1.45rem; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; }
.stat-card .stat-sub { font-size: .72rem; color: var(--spy-muted); }
.stat-card::after { content: ''; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: currentColor; opacity: .03; }
a.stat-card:hover { transform: translateY(-2px); box-shadow: var(--spy-shadow-lg); }
a.stat-card { color: inherit; transition: all .2s; }

.tone-blue   { background: #e8f0ff; color: #2563eb; }
.tone-green  { background: #e6f8f0; color: #059669; }
.tone-amber  { background: #fff4e0; color: #d97706; }
.tone-red    { background: #ffe9e9; color: #dc2626; }
.tone-violet { background: #f1eafe; color: #7c3aed; }
.tone-teal   { background: #e0f7f5; color: #0d9488; }
.tone-slate  { background: #eef1f6; color: #475569; }

.hero-card { background: linear-gradient(120deg, var(--spy-primary) 0%, color-mix(in srgb, var(--spy-primary) 60%, var(--spy-accent)) 100%); color: #fff; border: 0; position: relative; overflow: hidden; }
.hero-card::before { content: ''; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: rgba(255,255,255,.08); }
.hero-card::after { content: ''; position: absolute; right: 80px; bottom: -90px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255,255,255,.06); }
.hero-card .btn-light { border: 0; }

/* ------------------------------------------------------------ Pills */
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .22rem .6rem; border-radius: 20px; font-size: .7rem; font-weight: 700; white-space: nowrap; letter-spacing: .01em; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-primary { background: #e8f0ff; color: #2563eb; }
.pill-info { background: #e0f4fd; color: #0284c7; }
.pill-success { background: #e2f7ee; color: #059669; }
.pill-warning { background: #fff3dc; color: #c2710c; }
.pill-danger { background: #ffe8e8; color: #dc2626; }
.pill-secondary { background: #eef1f6; color: #52607a; }
.pill-dark { background: #e5e7eb; color: #1f2937; }
.pill-purple { background: #f1eafe; color: #7c3aed; }

/* ------------------------------------------------------------ Tables */
.table { --bs-table-bg: transparent; margin-bottom: 0; font-size: .85rem; }
.table > thead th { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--spy-muted); font-weight: 700; background: #f8fafd; border-bottom: 1px solid var(--spy-border); padding: .75rem 1rem; white-space: nowrap; }
.table > tbody td { padding: .8rem 1rem; vertical-align: middle; border-color: #eef1f6; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f8faff; }
.table .cell-title { font-weight: 600; color: var(--spy-text); }
.table .cell-sub { font-size: .75rem; color: var(--spy-muted); }
.table-actions { white-space: nowrap; text-align: right; }
.row-link { cursor: pointer; }

/* Filter bar */
.filter-bar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--spy-border); }
.filter-bar .form-control, .filter-bar .form-select { width: auto; min-width: 150px; }
.filter-bar .search { flex: 1; min-width: 200px; position: relative; }
.filter-bar .search input { width: 100%; padding-left: 2.2rem; }
.filter-bar .search i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--spy-muted); }
.status-tabs { display: flex; gap: .35rem; overflow-x: auto; padding: .75rem 1.25rem 0; border-bottom: 1px solid var(--spy-border); scrollbar-width: none; }
.status-tabs::-webkit-scrollbar { display: none; }
.status-tabs a { padding: .55rem .85rem; font-size: .8rem; font-weight: 600; color: var(--spy-muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.status-tabs a .count { background: #eef1f6; color: #52607a; border-radius: 20px; padding: .05rem .45rem; font-size: .68rem; margin-left: .3rem; }
.status-tabs a.active { color: var(--spy-primary); border-color: var(--spy-primary); }
.status-tabs a.active .count { background: var(--spy-primary-soft); color: var(--spy-primary); }

/* ------------------------------------------------------------ Misc blocks */
.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-state .empty-icon { width: 64px; height: 64px; border-radius: 18px; background: var(--spy-primary-soft); color: var(--spy-primary); display: grid; place-items: center; margin: 0 auto 1rem; font-size: 1.6rem; }
.empty-state h6 { font-weight: 700; }
.empty-state p { color: var(--spy-muted); font-size: .85rem; max-width: 360px; margin: 0 auto 1rem; }

.info-list { list-style: none; padding: 0; margin: 0; }
.info-list li { display: flex; gap: .75rem; padding: .55rem 0; border-bottom: 1px dashed var(--spy-border); font-size: .85rem; }
.info-list li:last-child { border-bottom: 0; }
.info-list .k { color: var(--spy-muted); min-width: 120px; flex-shrink: 0; }
.info-list .v { font-weight: 500; word-break: break-word; }

.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ''; position: absolute; left: 15px; top: 4px; bottom: 4px; width: 2px; background: var(--spy-border); }
.timeline li { position: relative; padding: 0 0 1.1rem 44px; }
.timeline .dot { position: absolute; left: 4px; top: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; background: var(--spy-primary-soft); color: var(--spy-primary); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--spy-border); }
.timeline .t-title { font-weight: 600; font-size: .83rem; }
.timeline .t-meta { font-size: .72rem; color: var(--spy-muted); }

.list-row { display: flex; gap: .85rem; align-items: center; padding: .8rem 1.25rem; border-bottom: 1px solid #eef1f6; color: inherit; }
.list-row:last-child { border-bottom: 0; }
a.list-row:hover { background: #f8faff; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 600; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .sub { font-size: .75rem; color: var(--spy-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.date-chip { width: 46px; text-align: center; border-radius: 10px; background: var(--spy-primary-soft); color: var(--spy-primary); padding: .3rem 0; flex-shrink: 0; }
.date-chip b { display: block; font-size: 1rem; line-height: 1.1; }
.date-chip small { font-size: .62rem; text-transform: uppercase; font-weight: 700; }

.progress { height: 8px; border-radius: 10px; background: #eef1f6; }
.progress-bar { background: var(--spy-primary); border-radius: 10px; }

.nav-tabs-spy { border-bottom: 1px solid var(--spy-border); gap: .25rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 0 1.25rem; }
.nav-tabs-spy .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--spy-muted); font-weight: 600; font-size: .83rem; padding: .85rem .85rem; white-space: nowrap; border-radius: 0; }
.nav-tabs-spy .nav-link.active { color: var(--spy-primary); border-color: var(--spy-primary); background: transparent; }

.doc-summary { background: #f8fafd; border-radius: 12px; padding: 1rem; }
.doc-summary .line { display: flex; justify-content: space-between; padding: .3rem 0; font-size: .85rem; }
.doc-summary .line.total { border-top: 1px solid var(--spy-border); margin-top: .4rem; padding-top: .6rem; font-weight: 800; font-size: 1.05rem; }

.items-table td { padding: .5rem !important; }
.items-table .form-control, .items-table .form-select { padding: .4rem .55rem; font-size: .82rem; }

.signature-pad-wrap { border: 2px dashed var(--spy-border); border-radius: 12px; background: #fcfdff; position: relative; }
.signature-pad-wrap canvas { width: 100%; height: 180px; display: block; touch-action: none; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .6rem; }
.photo-grid a { display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #eef1f6; border: 1px solid var(--spy-border); }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; }
.photo-grid .file { display: grid; place-items: center; height: 100%; font-size: 1.8rem; color: var(--spy-muted); }

.chart-box { position: relative; height: 280px; }
.kpi-mini { padding: .8rem 1rem; border-radius: 12px; background: #f8fafd; }
.kpi-mini .v { font-weight: 800; font-size: 1.1rem; }
.kpi-mini .l { font-size: .72rem; color: var(--spy-muted); font-weight: 600; }

/* Picker (autocomplete) */
.picker { position: relative; }
.picker-menu { display: none; position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 1060; background: #fff; border: 1px solid var(--spy-border); border-radius: 12px; box-shadow: var(--spy-shadow-lg); max-height: 300px; overflow-y: auto; padding: .35rem; }
.picker-menu.show { display: block; }
.picker-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: .5rem .7rem; border-radius: 8px; }
.picker-item b { display: block; font-size: .85rem; font-weight: 600; }
.picker-item small { color: var(--spy-muted); font-size: .75rem; }
.picker-item:hover, .picker-item.active { background: var(--spy-primary-soft); }
.picker-empty { padding: .6rem .7rem; color: var(--spy-muted); font-size: .82rem; }
.picker-create { display: block; padding: .55rem .7rem; border-top: 1px solid var(--spy-border); margin-top: .25rem; font-weight: 600; font-size: .82rem; }

/* Alerts & toasts */
.alert { border-radius: 12px; border: 0; font-size: .86rem; }
.toast-wrap { position: fixed; top: 76px; right: 1rem; z-index: 2000; display: flex; flex-direction: column; gap: .5rem; }
.spy-toast { min-width: 280px; max-width: 380px; background: #fff; border-radius: 12px; box-shadow: var(--spy-shadow-lg); padding: .85rem 1rem; display: flex; gap: .7rem; align-items: flex-start; border-left: 4px solid var(--spy-primary); animation: toastIn .3s ease; font-size: .85rem; }
.spy-toast.success { border-color: #10b981; } .spy-toast.success i { color: #10b981; }
.spy-toast.danger { border-color: #ef4444; } .spy-toast.danger i { color: #ef4444; }
.spy-toast.warning { border-color: #f59e0b; } .spy-toast.warning i { color: #f59e0b; }
.spy-toast.info i { color: var(--spy-primary); }
.spy-toast i { font-size: 1.1rem; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

.modal-content { border: 0; border-radius: 18px; box-shadow: var(--spy-shadow-lg); }
.modal-header { border-bottom: 1px solid var(--spy-border); padding: 1rem 1.25rem; }
.modal-title { font-weight: 700; font-size: 1rem; }
.modal-footer { border-top: 1px solid var(--spy-border); }
.dropdown-menu { border: 1px solid var(--spy-border); border-radius: 12px; box-shadow: var(--spy-shadow-lg); padding: .4rem; font-size: .85rem; }
.dropdown-item { border-radius: 8px; padding: .45rem .75rem; }
.dropdown-item i { width: 20px; color: var(--spy-muted); }

/* FullCalendar polish */
.fc { font-size: .8rem; }
.fc .fc-toolbar-title { font-size: 1.05rem; font-weight: 700; }
.fc .fc-button { border-radius: 8px !important; font-weight: 600; font-size: .75rem; padding: .35rem .7rem; background: #fff; color: var(--spy-text); border-color: var(--spy-border); box-shadow: none !important; text-transform: capitalize; }
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:not(:disabled):active { background: var(--spy-primary); border-color: var(--spy-primary); color: #fff; }
.fc .fc-event { border-radius: 6px; border: 0; padding: 1px 4px; font-weight: 600; cursor: pointer; }
.fc-theme-standard td, .fc-theme-standard th, .fc-theme-standard .fc-scrollgrid { border-color: var(--spy-border); }
.fc .fc-day-today { background: rgba(var(--spy-primary-rgb), .05) !important; }

/* Bottom navigation (mobile) */
.bottom-nav { display: none; }

/* Auth pages */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: #fff; }
.auth-side { background: radial-gradient(1200px 600px at -10% -10%, #1d4ed8 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #0d9488 0%, transparent 55%), #0b1730; color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side h2 { font-weight: 800; font-size: 2.1rem; line-height: 1.2; }
.auth-side .feat { display: flex; gap: .75rem; align-items: flex-start; margin-bottom: 1rem; color: #c8d3ea; font-size: .9rem; }
.auth-side .feat i { color: #5eead4; font-size: 1.15rem; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.auth-form .inner { width: 100%; max-width: 400px; }
.demo-creds { background: #f8fafd; border: 1px dashed var(--spy-border); border-radius: 12px; padding: .75rem 1rem; font-size: .78rem; }
.demo-creds button { font-size: .72rem; }

/* ------------------------------------------------------------ Responsive */
@media (max-width: 1199.98px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--spy-shadow-lg); }
  .sidebar-open .sidebar { transform: none; }
  .sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 1035; }
  .main { margin-left: 0; }
}
@media (max-width: 991.98px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}
@media (max-width: 767.98px) {
  body { font-size: .88rem; }
  .content { padding: 1rem 1rem 5.5rem; }
  .topbar { padding: 0 1rem; gap: .5rem; }
  .topbar-search { display: none; }
  .page-head h1 { font-size: 1.15rem; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .card-body { padding: 1rem; }
  .card-header { padding: .85rem 1rem; }
  .filter-bar { padding: .75rem 1rem; }
  .filter-bar .form-control, .filter-bar .form-select { min-width: 0; flex: 1 1 45%; }
  .stat-card { padding: .9rem; gap: .7rem; }
  .stat-card .stat-icon { width: 40px; height: 40px; font-size: 1.1rem; border-radius: 12px; }
  .stat-card .stat-value { font-size: 1.15rem; }
  .info-list .k { min-width: 100px; }
  .chart-box { height: 220px; }

  /* Stack tables into cards on phones */
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: .75rem 1rem; border-bottom: 1px solid var(--spy-border); position: relative; }
  .table-stack tbody td { border: 0; padding: .2rem 0; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  .table-stack tbody td::before { content: attr(data-label); font-size: .72rem; font-weight: 600; color: var(--spy-muted); text-align: left; flex-shrink: 0; }
  .table-stack tbody td.td-main { display: block; text-align: left; padding-bottom: .4rem; }
  .table-stack tbody td.td-main::before { display: none; }
  .table-stack tbody td.table-actions { justify-content: flex-end; padding-top: .5rem; }
  .table-stack tbody td.table-actions::before { display: none; }
  .table-stack tbody td[data-label=""]::before { display: none; }
  .items-table.table-stack tbody td { text-align: left; }

  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; background: #fff; border-top: 1px solid var(--spy-border);
    padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom)); box-shadow: 0 -4px 20px rgba(15,23,42,.06); }
  .bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .1rem; font-size: .65rem; font-weight: 600; color: var(--spy-muted); background: none; border: 0; padding: .3rem 0; position: relative; }
  .bottom-nav i { font-size: 1.2rem; }
  .bottom-nav a.active { color: var(--spy-primary); }
  .bottom-nav .fab { width: 48px; height: 48px; border-radius: 16px; background: var(--spy-primary); color: #fff; display: grid; place-items: center; margin-top: -22px; box-shadow: 0 8px 20px rgba(var(--spy-primary-rgb), .45); }
  .bottom-nav .fab i { font-size: 1.4rem; }
  .bottom-nav .b-badge { position: absolute; top: 0; right: calc(50% - 20px); background: #ef4444; color: #fff; border-radius: 10px; font-size: .58rem; padding: 0 .3rem; }
  .toast-wrap { left: 1rem; right: 1rem; top: 70px; }
  .spy-toast { max-width: none; }
}

/* ------------------------------------------------------------ Print */
@media print {
  .sidebar, .topbar, .bottom-nav, .no-print, .content-footer, .impersonate-bar { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; }
}
