/* ============================================================
   AssetPulse v2 — "Yard Board" design language
   Cryo Air Fluid · Cylinder Management Platform
   Bolder evolution of the existing AssetPulse brand.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700;800&family=Sora:wght@300;400;500;600;700;800&display=swap');

/* ---------- Tokens : LIGHT (default) ---------- */
:root {
  --bg:            #eef2f7;
  --bg-grad:       radial-gradient(1200px 600px at 80% -10%, rgba(0,168,107,0.06), transparent 60%),
                   radial-gradient(1000px 500px at -10% 10%, rgba(0,117,204,0.06), transparent 55%);
  --surface:       #ffffff;
  --surface-2:     #f3f6fa;
  --surface-3:     #e9eef4;
  --border:        #e2e8f1;
  --border-strong: #cdd6e3;
  --text:          #141c2c;
  --text-2:        #51607a;
  --text-3:        #8493aa;

  --brand:         #00a86b;
  --brand-deep:    #00794e;
  --brand-soft:    rgba(0,168,107,0.12);
  --info:          #0075cc;
  --info-soft:     rgba(0,117,204,0.12);
  --warn:          #e2620c;
  --warn-soft:     rgba(226,98,12,0.12);
  --amber:         #b97e00;
  --amber-soft:    rgba(185,126,0,0.14);
  --danger:        #d92d20;
  --danger-soft:   rgba(217,45,32,0.12);
  --violet:        #6938ef;
  --violet-soft:   rgba(105,56,239,0.12);

  --shadow-sm: 0 1px 2px rgba(20,28,44,0.06), 0 1px 3px rgba(20,28,44,0.04);
  --shadow:    0 4px 14px rgba(20,28,44,0.07), 0 2px 4px rgba(20,28,44,0.04);
  --shadow-lg: 0 18px 48px rgba(20,28,44,0.13), 0 6px 16px rgba(20,28,44,0.06);
  --shadow-xl: 0 34px 80px rgba(20,28,44,0.18);

  --ring: 0 0 0 4px rgba(0,117,204,0.16);

  --r-xs: 8px; --r-sm: 11px; --r: 15px; --r-lg: 20px; --r-xl: 26px; --r-pill: 999px;

  --sidebar-w: 250px;
  --topbar-h: 70px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg:            #090c11;
  --bg-grad:       radial-gradient(1200px 600px at 80% -10%, rgba(0,224,160,0.07), transparent 60%),
                   radial-gradient(1000px 500px at -10% 10%, rgba(43,155,255,0.06), transparent 55%);
  --surface:       #12171f;
  --surface-2:     #181f29;
  --surface-3:     #1f2632;
  --border:        #232c39;
  --border-strong: #313c4c;
  --text:          #e9eef6;
  --text-2:        #97a4b8;
  --text-3:        #69768b;

  --brand:         #00e0a0;
  --brand-deep:    #14b683;
  --brand-soft:    rgba(0,224,160,0.14);
  --info:          #2b9bff;
  --info-soft:     rgba(43,155,255,0.16);
  --warn:          #ff8344;
  --warn-soft:     rgba(255,131,68,0.16);
  --amber:         #ffce5c;
  --amber-soft:    rgba(255,206,92,0.16);
  --danger:        #ff6b6b;
  --danger-soft:   rgba(255,107,107,0.16);
  --violet:        #a78bfa;
  --violet-soft:   rgba(167,139,250,0.16);

  --shadow-sm: none;
  --shadow:    0 6px 18px rgba(0,0,0,0.4);
  --shadow-lg: 0 24px 60px rgba(0,0,0,0.55);
  --shadow-xl: 0 40px 90px rgba(0,0,0,0.65);
  --ring: 0 0 0 4px rgba(43,155,255,0.22);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body, #root { height: 100%; }

body {
  font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 15px;
  line-height: 1.45;
  transition: background .25s, color .25s;
}

.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font-family: inherit; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
}
.app.collapsed { --sidebar-w: 84px; }

/* ---- Sidebar ---- */
.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 60;
  transition: width .2s;
}
.sb-head {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 18px;
  min-height: var(--topbar-h);
}
.sb-logo {
  width: 42px; height: 42px; flex: 0 0 42px;
  border-radius: 13px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand), var(--brand-deep));
  color: #fff;
  box-shadow: 0 8px 20px var(--brand-soft);
  position: relative; overflow: hidden;
}
.sb-logo svg { width: 24px; height: 24px; }
.sb-wordmark { display: flex; flex-direction: column; line-height: 1; min-width: 0; }
.sb-wordmark b { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.sb-wordmark span { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); margin-top: 3px; }
.collapsed .sb-wordmark, .collapsed .sb-section-label, .collapsed .sb-link span, .collapsed .sb-foot-text, .collapsed .scan-cta span { display: none; }
.collapsed .sb-head { justify-content: center; padding: 20px 0; }

.sb-scroll { flex: 1; overflow-y: auto; padding: 6px 14px 14px; }
.collapsed .sb-scroll { padding: 6px 12px 14px; }

.scan-cta {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 4px 0 16px;
  padding: 15px 16px;
  border-radius: var(--r);
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: #fff;
  font-size: 15px; font-weight: 700;
  box-shadow: 0 10px 22px var(--brand-soft);
  transition: transform .15s, box-shadow .15s;
}
.scan-cta:hover { transform: translateY(-2px); box-shadow: 0 16px 30px var(--brand-soft); }
.scan-cta svg { width: 20px; height: 20px; flex: 0 0 20px; }
.collapsed .scan-cta { padding: 14px 0; }

.sb-section-label {
  font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase;
  color: var(--text-3); padding: 16px 12px 7px;
}
.sb-link {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 13px; margin-bottom: 2px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 14.5px; font-weight: 600;
  position: relative;
  transition: background .14s, color .14s;
}
.sb-link svg { width: 21px; height: 21px; flex: 0 0 21px; }
.sb-link:hover { background: var(--surface-2); color: var(--text); }
.sb-link.active { background: var(--info-soft); color: var(--info); }
.sb-link.active::before {
  content:''; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; border-radius: 0 4px 4px 0; background: var(--info);
}
.collapsed .sb-link { justify-content: center; padding: 12px 0; }
.collapsed .sb-link.active::before { left: -12px; }
.sb-pill {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: 99px; background: var(--warn); color: #fff;
  font-size: 11px; font-weight: 800; display: grid; place-items: center;
}
.collapsed .sb-pill { position: absolute; top: 6px; right: 10px; min-width: 18px; height: 18px; font-size: 10px; }

.sb-foot { border-top: 1px solid var(--border); padding: 12px 14px; }
.sb-user { display: flex; align-items: center; gap: 11px; padding: 8px; border-radius: var(--r-sm); }
.sb-user:hover { background: var(--surface-2); }
.avatar {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 800; font-size: 16px; color: #fff;
  background: linear-gradient(140deg, var(--info), #4aa3e8);
}
.sb-foot-text { min-width: 0; }
.sb-foot-text b { display: block; font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-foot-text span { font-size: 11px; color: var(--text-3); text-transform: capitalize; }
.collapsed .sb-user { justify-content: center; padding: 8px 0; }

/* ---- Main column ---- */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.tb-toggle {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  color: var(--text-2); border: 1px solid var(--border);
}
.tb-toggle:hover { background: var(--surface-2); color: var(--text); }
.tb-toggle svg { width: 20px; height: 20px; }
.tb-title { display: flex; flex-direction: column; }
.tb-title b { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.tb-title span { font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.tb-spacer { flex: 1; }

.tb-search {
  display: flex; align-items: center; gap: 10px;
  width: min(360px, 32vw); height: 44px; padding: 0 14px;
  border-radius: var(--r-pill); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-3);
}
.tb-search svg { width: 18px; height: 18px; flex: 0 0 18px; }
.tb-search input { flex: 1; border: none; outline: none; background: none; color: var(--text); font-size: 14px; }
.tb-search kbd {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700;
  padding: 3px 7px; border-radius: 6px; background: var(--surface-3); color: var(--text-3); border: 1px solid var(--border);
}
.tb-icon-btn {
  position: relative; width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  color: var(--text-2); border: 1px solid var(--border); background: var(--surface);
  transition: all .15s;
}
.tb-icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.tb-icon-btn svg { width: 20px; height: 20px; }
.tb-dot { position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 99px; background: var(--warn); border: 2px solid var(--surface); }

.page { padding: 26px 28px 60px; max-width: 1480px; width: 100%; margin: 0 auto; flex: 1; }
.page-wide { max-width: none; }

/* ---- Mobile bottom nav (hidden on desktop) ---- */
.bottomnav { display: none; }
.mobile-only { display: none; }

/* ============================================================
   PRIMITIVES
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 22px; }
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 12px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--text-2); }
.card-head .sub { font-size: 12.5px; color: var(--text-3); font-weight: 500; text-transform: none; letter-spacing: 0; }
.card-head .spacer { flex: 1; }

.link-more { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; color: var(--info); }
.link-more svg { width: 14px; height: 14px; }
.link-more:hover { gap: 8px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 44px; padding: 0 18px; border-radius: var(--r-sm);
  font-size: 14.5px; font-weight: 700; letter-spacing: -.01em;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: all .15s; white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn-primary {
  border: none; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  box-shadow: 0 8px 18px var(--brand-soft);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 24px var(--brand-soft); background: linear-gradient(135deg, var(--brand), var(--brand-deep)); }
.btn-info { border: none; color: #fff; background: linear-gradient(135deg, var(--info), #2b9bff); box-shadow: 0 8px 18px var(--info-soft); }
.btn-info:hover { transform: translateY(-1px); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-danger { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.btn-lg { height: 56px; padding: 0 26px; font-size: 16px; border-radius: var(--r); }
.btn-xl { height: 72px; padding: 0 32px; font-size: 19px; border-radius: var(--r-lg); font-weight: 800; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; }

/* Status badge */
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  height: 26px; padding: 0 11px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 99px; background: currentColor; }
.badge svg { width: 14px; height: 14px; }
.badge-lg { height: 34px; padding: 0 15px; font-size: 14px; }
.b-full,.b-instorage,.b-accepted,.b-online,.b-active { background: var(--brand-soft); color: var(--brand-deep); }
[data-theme="dark"] .b-full,[data-theme="dark"] .b-instorage,[data-theme="dark"] .b-accepted,[data-theme="dark"] .b-online,[data-theme="dark"] .b-active { color: var(--brand); }
.b-empty,.b-cancelled,.b-offline,.b-retired { background: var(--surface-3); color: var(--text-2); }
.b-dispatched,.b-defective { background: var(--warn-soft); color: var(--warn); }
.b-customer,.b-vendor,.b-intransit { background: var(--info-soft); color: var(--info); }
.b-test,.b-pending,.b-partial { background: var(--amber-soft); color: var(--amber); }
.b-danger,.b-rejected,.b-overdue { background: var(--danger-soft); color: var(--danger); }

/* Chips / segmented */
.seg { display: inline-flex; padding: 4px; gap: 3px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); }
.seg button {
  height: 38px; padding: 0 16px; border-radius: var(--r-sm); font-size: 13.5px; font-weight: 700; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 7px; transition: all .14s;
}
.seg button svg { width: 16px; height: 16px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
[data-theme="dark"] .seg button.on { background: var(--surface-3); }

.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--text-2); transition: all .14s;
}
.chip svg { width: 15px; height: 15px; }
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.on { background: var(--info-soft); border-color: transparent; color: var(--info); font-weight: 700; }

/* Inputs */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
.input, .select {
  height: 50px; padding: 0 15px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s; width: 100%;
}
.input::placeholder { color: var(--text-3); }
.input:focus, .select:focus { border-color: var(--info); box-shadow: var(--ring); }
textarea.input { height: auto; padding: 13px 15px; resize: vertical; min-height: 90px; }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl thead th {
  text-align: left; font-size: 10.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-3); padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--surface-2); cursor: pointer; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .num { font-family: 'JetBrains Mono', monospace; font-weight: 700; }

/* Section title */
.sec-title { display: flex; align-items: center; gap: 12px; margin: 28px 0 14px; }
.sec-title h2 { font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.sec-title .spacer { flex: 1; }

/* ---- Cylinder motif ---- */
.cyl {
  position: relative; display: inline-block;
  border-radius: 9px 9px 6px 6px;
  background: var(--cyl-color, var(--brand));
  box-shadow: inset 0 -7px 0 rgba(0,0,0,0.12), inset 0 3px 0 rgba(255,255,255,0.22);
}
.cyl::before {
  content:''; position: absolute; top: -19%; left: 50%; transform: translateX(-50%);
  width: 34%; height: 24%; border-radius: 4px 4px 2px 2px;
  background: var(--text-3); opacity: .55;
}
.cyl-cap { position: absolute; top: -7%; left: 18%; right: 18%; height: 9%; border-radius: 99px; background: rgba(255,255,255,.5); }

/* Progress ring uses inline svg */
.ring-wrap { position: relative; display: grid; place-items: center; }
.ring-center { position: absolute; text-align: center; }

/* KPI / stat */
.kpi {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 20px; box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.kpi-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; }
.kpi-ico svg { width: 23px; height: 23px; }
.kpi-label { font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--text-3); }
.kpi-value { font-family: 'JetBrains Mono', monospace; font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -.02em; margin-top: 6px; }
.kpi-delta { display: inline-flex; align-items: center; gap: 5px; margin-top: 12px; font-size: 12.5px; font-weight: 700; }
.kpi-delta svg { width: 14px; height: 14px; }
.kpi-up { color: var(--brand-deep); } [data-theme="dark"] .kpi-up { color: var(--brand); }
.kpi-down { color: var(--danger); }
.kpi-foot { font-size: 12px; color: var(--text-3); font-weight: 500; margin-top: 12px; }
.kpi-spark { position: absolute; right: 16px; bottom: 14px; opacity: .9; }

.tone-brand .kpi-ico { background: var(--brand-soft); color: var(--brand-deep); } [data-theme="dark"] .tone-brand .kpi-ico { color: var(--brand); }
.tone-info  .kpi-ico { background: var(--info-soft);  color: var(--info); }
.tone-warn  .kpi-ico { background: var(--warn-soft);  color: var(--warn); }
.tone-amber .kpi-ico { background: var(--amber-soft); color: var(--amber); }
.tone-danger .kpi-ico{ background: var(--danger-soft);color: var(--danger); }
.tone-violet .kpi-ico{ background: var(--violet-soft);color: var(--violet); }
.tone-brand .kpi-value { color: var(--brand-deep);} [data-theme="dark"] .tone-brand .kpi-value{ color: var(--brand);}
.tone-info  .kpi-value { color: var(--info);}
.tone-warn  .kpi-value { color: var(--warn);}
.tone-amber .kpi-value { color: var(--amber);}
.tone-danger .kpi-value{ color: var(--danger);}

/* grids */
.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2,1fr); }
.g-3 { grid-template-columns: repeat(3,1fr); }
.g-4 { grid-template-columns: repeat(4,1fr); }
.row { display: flex; gap: 18px; }
.col { display: flex; flex-direction: column; gap: 18px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.center { display: flex; align-items: center; gap: 10px; }

/* page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; font-weight: 800; letter-spacing: -.025em; }
.page-head p { font-size: 14px; color: var(--text-3); margin-top: 4px; }
.page-head .actions { display: flex; gap: 10px; align-items: center; }

/* branch strip */
.branch-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }

/* live feed row */
.feed-row {
  display: flex; align-items: center; gap: 16px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface); transition: background .3s, border-color .3s;
}
.feed-row.fresh { border-color: var(--brand); background: var(--brand-soft); animation: pop .5s ease; }
@keyframes pop { from { transform: scale(.97); opacity: .4; } to { transform: scale(1); opacity: 1; } }
.feed-ico { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 13px; display: grid; place-items: center; background: var(--info-soft); color: var(--info); }
.feed-ico svg { width: 22px; height: 22px; }

/* toast */
.toast-wrap { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 13px; padding: 14px 20px 14px 16px;
  border-radius: var(--r); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); font-size: 14.5px; font-weight: 600; animation: toastIn .35s cubic-bezier(.2,1.3,.4,1);
}
@keyframes toastIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.toast .ti { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: 0 0 36px; }
.toast.ok .ti { background: var(--brand-soft); color: var(--brand-deep); } [data-theme="dark"] .toast.ok .ti { color: var(--brand); }
.toast.err .ti { background: var(--danger-soft); color: var(--danger); }
.toast.info .ti { background: var(--info-soft); color: var(--info); }

/* modal */
.modal-back { position: fixed; inset: 0; z-index: 150; background: rgba(8,12,18,.5); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { width: min(560px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-xl); animation: modalIn .28s cubic-bezier(.2,1.1,.4,1); max-height: 90vh; overflow: auto; }
@keyframes modalIn { from { transform: translateY(16px) scale(.98); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 22px 24px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 19px; font-weight: 800; }
.modal-body { padding: 24px; }
.modal-foot { display: flex; gap: 12px; padding: 18px 24px; border-top: 1px solid var(--border); justify-content: flex-end; }
.x-btn { margin-left: auto; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: var(--text-3); }
.x-btn:hover { background: var(--surface-2); color: var(--text); }

/* misc helpers */
.muted { color: var(--text-3); }
.t2 { color: var(--text-2); }
.num { font-family: 'JetBrains Mono', monospace; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty svg { width: 44px; height: 44px; margin-bottom: 12px; opacity: .6; }
.tag-soft { display:inline-flex; align-items:center; height: 24px; padding: 0 10px; border-radius: 7px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 700; }
.progress { height: 9px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; }

/* avatar groups for users etc */
.dot-online { width: 9px; height: 9px; border-radius: 99px; background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.dot-offline { width: 9px; height: 9px; border-radius: 99px; background: var(--text-3); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1080px) {
  .g-4 { grid-template-columns: repeat(2,1fr); }
  .g-3 { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .bottomnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 80;
    background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(16px);
    border-top: 1px solid var(--border); padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
  }
  .bn-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 7px 4px; border-radius: 12px; color: var(--text-3); font-size: 10.5px; font-weight: 700; }
  .bn-item svg { width: 24px; height: 24px; }
  .bn-item.active { color: var(--info); }
  .bn-scan {
    margin-top: -26px; width: 60px; height: 60px; border-radius: 20px; flex: 0 0 60px;
    background: linear-gradient(135deg, var(--brand), var(--brand-deep)); color: #fff;
    box-shadow: 0 10px 24px var(--brand-soft); justify-content: center;
  }
  .bn-scan svg { width: 28px; height: 28px; }
  .bn-scan span { display: none; }
  .main { padding-bottom: 84px; }
  .topbar { padding: 0 16px; }
  .tb-search { display: none; }
  .page { padding: 18px 16px 40px; }
  .page-head h1 { font-size: 23px; }
  .g-2 { grid-template-columns: 1fr; }
  .desktop-only { display: none !important; }
  .mobile-only { display: revert; }
  .kpi-value { font-size: 34px; }
}
@media (max-width: 520px) {
  .g-4, .g-3 { grid-template-columns: 1fr; }
  .row { flex-direction: column; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
