/* ============================================================
   Epsopay Trader Terminal — "Liquid Glass"
   Modern glassmorphism system: frosted translucent panels float
   over a soft aurora of the brand forest-green & brass on cool
   pearl. Skeuomorphic glossy icon chips with a sweeping glint.
   Top-nav glass shell. Sora display · Inter body · JetBrains Mono.
   Brand: 1F7A5C forest · B07D2A brass · cool ink
   ============================================================ */

:root {
  --bg:            #e6eaf3;
  --bg-tint:       #dde2ee;
  --panel:         rgba(255, 255, 255, 0.60);
  --panel-2:       rgba(255, 255, 255, 0.40);
  --panel-hi:      rgba(255, 255, 255, 0.80);
  --line:          rgba(255, 255, 255, 0.65);
  --line-soft:     rgba(28, 35, 64, 0.07);
  --rule:          rgba(28, 35, 64, 0.16);

  --txt:           #161b2b;
  --txt-dim:       #515a72;
  --txt-faint:     #8b93a8;

  --accent:        #1f7a5c;
  --accent-deep:   #145d46;
  --accent-bright: #2eab80;
  --accent-soft:   rgba(31, 122, 92, 0.12);
  --accent-glow:   rgba(31, 122, 92, 0.28);
  --brass:         #b07d2a;
  --brass-soft:    rgba(176, 125, 42, 0.14);

  --ok:            #1f9d6b;
  --warn:          #c08a1e;
  --bad:           #d8453d;
  --info:          #2f87a8;
  --mute:          #8b93a8;

  --rose:          #d8453d;
  --crimson:       #b07d2a;
  --plum:          #7a5bc4;
  --amber:         #c08a1e;
  --cyan:          #2f87a8;
  --violet:        #7a5bc4;
  --green:         #1f9d6b;

  --input-bg:      rgba(255, 255, 255, 0.55);
  --track:         rgba(28, 35, 64, 0.10);
  --ghost-hover:   rgba(255, 255, 255, 0.55);
  --scroll-hover:  rgba(28, 35, 64, 0.26);
  --overlay:       rgba(18, 24, 44, 0.42);
  --appbar-bg:     rgba(255, 255, 255, 0.55);
  --thead-bg:      rgba(255, 255, 255, 0.72);

  --blur:          22px;
  --blur-sm:       12px;
  --glass-hi:      rgba(255, 255, 255, 0.70);

  --r-sm: 9px;
  --r:    16px;
  --r-lg: 22px;
  --shadow:    0 26px 60px -28px rgba(18, 24, 44, 0.45), 0 6px 20px -12px rgba(18, 24, 44, 0.20);
  --shadow-sm: 0 8px 22px -14px rgba(18, 24, 44, 0.32);

  --font-display: 'Sora', system-ui, -apple-system, sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;
}

/* ---------------- DARK THEME — "smoked glass" ---------------- */
html[data-theme="dark"] {
  --bg:            #0b0e16;
  --bg-tint:       #10141f;
  --panel:         rgba(30, 37, 54, 0.55);
  --panel-2:       rgba(255, 255, 255, 0.05);
  --panel-hi:      rgba(48, 57, 80, 0.62);
  --line:          rgba(255, 255, 255, 0.12);
  --line-soft:     rgba(255, 255, 255, 0.07);
  --rule:          rgba(255, 255, 255, 0.18);

  --txt:           #eef1f8;
  --txt-dim:       #aab2c6;
  --txt-faint:     #6f7890;

  --accent:        #35c490;
  --accent-deep:   #23a376;
  --accent-bright: #4cdba6;
  --accent-soft:   rgba(53, 196, 144, 0.14);
  --accent-glow:   rgba(53, 196, 144, 0.30);
  --brass:         #dcae65;
  --brass-soft:    rgba(220, 174, 101, 0.16);

  --ok:            #35c490;
  --warn:          #dcae65;
  --bad:           #f0766c;
  --info:          #5cb6d4;
  --mute:          #8b93a8;

  --rose:          #f0766c;
  --crimson:       #dcae65;
  --plum:          #b095ec;
  --amber:         #dcae65;
  --cyan:          #5cb6d4;
  --violet:        #b095ec;
  --green:         #35c490;

  --input-bg:      rgba(255, 255, 255, 0.06);
  --track:         rgba(255, 255, 255, 0.10);
  --ghost-hover:   rgba(255, 255, 255, 0.08);
  --scroll-hover:  rgba(255, 255, 255, 0.20);
  --overlay:       rgba(4, 7, 13, 0.66);
  --appbar-bg:     rgba(16, 21, 33, 0.55);
  --thead-bg:      rgba(34, 42, 60, 0.78);
  --glass-hi:      rgba(255, 255, 255, 0.16);

  --shadow:    0 28px 64px -26px rgba(0, 0, 0, 0.78), 0 6px 22px -12px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 10px 26px -16px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--txt);
  font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-image:
    radial-gradient(820px 620px at 8% -10%, rgba(46, 171, 128, 0.30), transparent 60%),
    radial-gradient(760px 560px at 98% 4%, rgba(176, 125, 42, 0.22), transparent 58%),
    radial-gradient(900px 700px at 52% 118%, rgba(47, 135, 168, 0.24), transparent 60%),
    radial-gradient(700px 560px at 78% 60%, rgba(122, 91, 196, 0.16), transparent 60%);
  background-attachment: fixed;
}
html[data-theme="dark"] body {
  background-image:
    radial-gradient(820px 620px at 8% -10%, rgba(53, 196, 144, 0.20), transparent 60%),
    radial-gradient(760px 560px at 98% 4%, rgba(220, 174, 101, 0.12), transparent 58%),
    radial-gradient(900px 700px at 52% 118%, rgba(47, 135, 168, 0.18), transparent 60%),
    radial-gradient(700px 560px at 78% 60%, rgba(122, 91, 196, 0.16), transparent 60%);
}

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-hover); background-clip: padding-box; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
.mono { font-family: var(--font-mono); font-feature-settings: 'tnum' 1; letter-spacing: -.2px; }

.field label, .k-label, table.grid thead th, .brand-sub, .bar-line .bl-label, .gauge .gl {
  font-family: var(--font-body); letter-spacing: 1.2px; text-transform: uppercase;
}

/* ---------------- LOGIN ---------------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 440px; background: var(--panel);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(150%); backdrop-filter: blur(var(--blur)) saturate(150%);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 46px 42px 36px; box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
  position: relative; overflow: hidden; animation: rise .5s cubic-bezier(.2,.8,.2,1) both;
}
.login-card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--accent-bright), var(--accent) 55%, var(--brass)); opacity: .95;
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  position: relative; width: 46px; height: 46px; border-radius: 14px; overflow: hidden;
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 700;
  color: #fff; font-size: 22px; line-height: 1;
  background: linear-gradient(155deg, var(--accent-bright), var(--accent-deep));
  box-shadow: inset 0 1px 1px rgba(255,255,255,.55), inset 0 -3px 6px rgba(0,0,0,.22), 0 8px 18px -6px var(--accent-glow);
  text-shadow: 0 1px 2px rgba(0,0,0,.28);
}
.brand-mark::before { content: ''; position: absolute; inset: 0 0 48% 0; background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,0)); border-radius: 14px 14px 44% 44%; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 21px; letter-spacing: -.5px; }
.brand-name b { color: var(--accent); font-weight: 700; }
.brand-sub { color: var(--txt-faint); font-size: 10px; letter-spacing: 2.4px; margin-top: 2px; font-weight: 600; }

.login-card h1 { font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -.8px; margin: 30px 0 6px; }
.login-card .lead { color: var(--txt-dim); font-size: 14px; margin-bottom: 26px; max-width: 36ch; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 10.5px; color: var(--txt-faint); margin-bottom: 7px; font-weight: 700; }
.input, .select, textarea.input {
  width: 100%; background: var(--input-bg);
  -webkit-backdrop-filter: blur(var(--blur-sm)); backdrop-filter: blur(var(--blur-sm));
  border: 1px solid var(--rule); border-radius: var(--r-sm);
  padding: 11px 13px; color: var(--txt); transition: border-color .16s, box-shadow .16s, background .16s; outline: none;
  box-shadow: inset 0 1px 2px rgba(18,24,44,0.06);
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--accent); background: var(--panel-hi); box-shadow: 0 0 0 4px var(--accent-glow), inset 0 1px 2px rgba(18,24,44,0.05); }
.input::placeholder { color: var(--txt-faint); }
.select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%238b93a8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}

.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--r-sm); padding: 10px 17px;
  font-weight: 600; font-size: 13.5px; cursor: pointer;
  transition: transform .12s, box-shadow .16s, background .16s, border-color .16s, opacity .15s, color .15s;
  white-space: nowrap; user-select: none;
}
.btn::after { content: ''; position: absolute; top: -50%; left: -60%; width: 40%; height: 200%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent); transform: rotate(22deg); pointer-events: none; transition: left .55s ease; }
.btn:hover::after { left: 130%; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { color: #fff; background: linear-gradient(160deg, var(--accent-bright), var(--accent-deep)); box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 8px 18px -8px var(--accent-glow); text-shadow: 0 1px 1px rgba(0,0,0,.2); }
.btn-primary:hover:not(:disabled) { box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 12px 24px -8px var(--accent-glow); }
.btn-ghost { background: var(--panel); -webkit-backdrop-filter: blur(var(--blur-sm)); backdrop-filter: blur(var(--blur-sm)); color: var(--txt); border-color: var(--line); box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow-sm); }
.btn-ghost:hover:not(:disabled) { background: var(--panel-hi); }
.btn-danger { background: rgba(216,69,61,0.12); color: var(--bad); border-color: rgba(216,69,61,0.40); }
.btn-danger:hover:not(:disabled) { background: rgba(216,69,61,0.20); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.login-msg { margin-top: 16px; font-size: 13px; min-height: 18px; color: var(--bad); }
.api-line { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-soft); }

/* ---------------- TOP-NAV GLASS SHELL ---------------- */
.appbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--appbar-bg);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(150%); backdrop-filter: blur(var(--blur)) saturate(150%);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px; padding: 0 26px; height: 72px;
  box-shadow: var(--shadow-sm);
}
.appbar .brand { margin-right: 22px; }
.appbar .brand-mark { width: 40px; height: 40px; border-radius: 12px; font-size: 20px; }
.appbar .brand-name { font-size: 19px; }
.appbar nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav-item {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 11px;
  color: var(--txt-dim); cursor: pointer; font-weight: 500; white-space: nowrap;
  transition: background .14s, color .14s, box-shadow .14s; position: relative;
}
.nav-item:hover { background: var(--panel-2); color: var(--txt); }
.nav-item.active {
  color: var(--accent-deep); font-weight: 600; background: var(--panel-hi);
  box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow-sm);
}
html[data-theme="dark"] .nav-item.active { color: var(--accent); }
.nav-item.active::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2.5px;
  background: linear-gradient(90deg, var(--accent-bright), var(--accent)); border-radius: 2px;
}
.nav-ico { display: inline-grid; place-items: center; width: 20px; height: 20px; }
.nav-ico .rp-ic { width: 18px; height: 18px; }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 5px 13px 5px 5px;
  border: 1px solid var(--line); border-radius: 40px; background: var(--panel);
  -webkit-backdrop-filter: blur(var(--blur-sm)); backdrop-filter: blur(var(--blur-sm));
  box-shadow: inset 0 1px 0 var(--glass-hi); }
.user-chip .avatar { position: relative; overflow: hidden; width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(155deg, var(--accent-bright), var(--accent-deep));
  display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 12px;
  font-family: var(--font-display); box-shadow: inset 0 1px 1px rgba(255,255,255,.5), inset 0 -2px 4px rgba(0,0,0,.2); }
.user-chip .uname { font-weight: 600; font-size: 13px; }
.user-chip .urole { font-size: 11px; color: var(--txt-faint); }

.content { padding: 32px 26px 48px; max-width: 1300px; margin: 0 auto; }
.content > * { animation: rise .35s ease both; }

/* ---------------- PAGE PRIMITIVES ---------------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head h2 { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -.9px; line-height: 1.05; }
.page-head .sub { color: var(--txt-dim); font-size: 14px; margin-top: 6px; }
.page-head .spacer { flex: 1; }

.panel {
  background: var(--panel);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(150%); backdrop-filter: blur(var(--blur)) saturate(150%);
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--glass-hi);
}
.panel-pad { padding: 22px 24px; }
.panel-title { font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: -.3px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi {
  background: var(--panel);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(150%); backdrop-filter: blur(var(--blur)) saturate(150%);
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 20px 22px; position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--glass-hi);
  transition: transform .18s, box-shadow .18s;
}
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(180deg, var(--accent-bright), var(--accent)); opacity: .9; }
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi); }
.kpi .k-label { font-size: 10.5px; color: var(--txt-faint); font-weight: 700; letter-spacing: 1.2px; }
.kpi .k-value { font-family: var(--font-display); font-size: 33px; font-weight: 700; margin-top: 10px;
  letter-spacing: -1.2px; line-height: 1; font-feature-settings: 'tnum' 1; }
.kpi .k-foot { font-size: 12.5px; color: var(--txt-dim); margin-top: 8px; }
.kpi .k-spark { position: absolute; right: 18px; top: 18px; }
.kpi.accent .k-value { color: var(--accent); }
.kpi.cyan   .k-value { color: var(--cyan); }   .kpi.cyan::before   { background: linear-gradient(180deg, var(--cyan), #1f6f8c); }
.kpi.green  .k-value { color: var(--green); }  .kpi.green::before  { background: linear-gradient(180deg, var(--green), #178a5d); }
.kpi.amber  .k-value { color: var(--brass); }  .kpi.amber::before  { background: linear-gradient(180deg, var(--brass), #8a5f17); }
.kpi.violet .k-value { color: var(--violet); } .kpi.violet::before { background: linear-gradient(180deg, var(--violet), #5a3f8a); }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px;
  padding: 12px; border-radius: var(--r);
  background: var(--panel);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(150%); backdrop-filter: blur(var(--blur)) saturate(150%);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm), inset 0 1px 0 var(--glass-hi);
}
.toolbar .search { flex: 1; min-width: 220px; position: relative; }
.toolbar .search input { padding-left: 38px; }
.toolbar .search .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--txt-faint); pointer-events: none; }
.input.compact, .select.compact { padding: 8px 11px; }
.select.compact { min-width: 120px; padding-right: 30px; }

.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid thead th { text-align: left; padding: 13px 16px; font-size: 10.5px; color: var(--txt-faint);
  font-weight: 700; border-bottom: 1px solid var(--rule); white-space: nowrap; position: sticky; top: 0; z-index: 1;
  background: var(--thead-bg); -webkit-backdrop-filter: blur(var(--blur-sm)); backdrop-filter: blur(var(--blur-sm)); }
table.grid tbody td { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
table.grid tbody tr { transition: background .12s; }
table.grid tbody tr:hover { background: var(--panel-2); }
table.grid tbody tr.clickable { cursor: pointer; }
table.grid .num { font-family: var(--font-mono); text-align: right; font-feature-settings: 'tnum' 1; }
.empty-row td { text-align: center; color: var(--txt-faint); padding: 46px !important; font-family: var(--font-display); font-size: 14px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 30px;
  font-size: 11.5px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; letter-spacing: .2px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.pill.ok   { color: var(--ok);   background: rgba(31,157,107,0.14);  border-color: rgba(31,157,107,0.30); }
.pill.warn { color: var(--warn); background: var(--brass-soft);      border-color: rgba(176,125,42,0.32); }
.pill.bad  { color: var(--bad);  background: rgba(216,69,61,0.13);   border-color: rgba(216,69,61,0.30); }
.pill.info { color: var(--info); background: rgba(47,135,168,0.13);  border-color: rgba(47,135,168,0.30); }
.pill.mute { color: var(--mute); background: rgba(139,147,168,0.14); border-color: rgba(139,147,168,0.28); }
.pill.violet{color: var(--violet);background: rgba(122,91,196,0.13); border-color: rgba(122,91,196,0.30); }

.tag { display: inline-block; padding: 2px 9px; border-radius: 30px; font-size: 11px;
  background: var(--panel-hi); border: 1px solid var(--line); color: var(--txt-dim); margin-right: 4px; }

.pager { display: flex; align-items: center; gap: 12px; padding: 16px; justify-content: flex-end; color: var(--txt-dim); font-size: 13px; }
.pager .pginfo { margin-right: auto; }

.modal-overlay { position: fixed; inset: 0; background: var(--overlay);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: grid; place-items: center; z-index: 100; padding: 24px; animation: fade .2s ease both; }
.modal { width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; background: var(--panel);
  -webkit-backdrop-filter: blur(28px) saturate(160%); backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
  animation: rise .28s cubic-bezier(.2,.8,.2,1) both; }
.modal.wide { max-width: 780px; }
.modal-head { display: flex; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: -.4px; }
.modal-head .x { margin-left: auto; cursor: pointer; color: var(--txt-faint); font-size: 24px; line-height: 1; padding: 0 4px; }
.modal-head .x:hover { color: var(--txt); }
.modal-body { padding: 22px 24px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 24px; border-top: 1px solid var(--line-soft); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }

.dl { display: grid; grid-template-columns: 176px 1fr; gap: 0; }
.dl > div { padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.dl .dt { color: var(--txt-faint); font-size: 12px; letter-spacing: .3px; }
.dl .dd { font-weight: 500; }

#toasts { position: fixed; right: 24px; bottom: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--panel);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%); backdrop-filter: blur(var(--blur)) saturate(160%);
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 14px; padding: 13px 17px; min-width: 250px; max-width: 370px; box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
  animation: slidein .28s cubic-bezier(.2,.8,.2,1) both; font-size: 13px; }
.toast.error { border-left-color: var(--bad); }
.toast.warn { border-left-color: var(--warn); }
.toast .tt { font-weight: 600; margin-bottom: 2px; }
.toast .tm { color: var(--txt-dim); }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 10px; }
.bars .bar { flex: 1; background: linear-gradient(180deg, var(--accent-bright), var(--accent-deep));
  border-radius: 4px 4px 0 0; min-height: 3px; position: relative; opacity: .92; transition: opacity .15s; box-shadow: inset 0 1px 0 rgba(255,255,255,.3); }
.bars .bar:hover { opacity: 1; }
.bars .bar .lbl { position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: 9px; color: var(--txt-faint); }

/* ---------------- DATA-VIZ PRIMITIVES ---------------- */
.metric-spark { margin-top: 14px; }
.bar-line { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; color: var(--txt-dim); margin-bottom: 7px; gap: 8px; }
.bar-line .bl-label { font-weight: 700; font-size: 10px; }
.bar-line .v { font-family: var(--font-mono); color: var(--txt); white-space: nowrap; }
.bar-track { height: 7px; border-radius: 6px; background: var(--track); overflow: hidden; box-shadow: inset 0 1px 2px rgba(18,24,44,0.10); }
.bar-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--brass)); transition: width .7s cubic-bezier(.2,.8,.2,1); box-shadow: inset 0 1px 0 rgba(255,255,255,.3); }

.split-bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--track); box-shadow: inset 0 1px 2px rgba(18,24,44,0.10); }
.split-bar > span { display: block; height: 100%; transition: width .7s cubic-bezier(.2,.8,.2,1); }
.split-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; color: var(--txt-dim); }
.split-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.split-legend .sw { width: 9px; height: 9px; border-radius: 3px; }
.split-legend .lv { font-family: var(--font-mono); color: var(--txt); font-weight: 600; }

.cell-split { min-width: 130px; }
.cell-split .split-bar { height: 6px; }
.cell-split .cs-cap { display: flex; justify-content: space-between; font-size: 10px; color: var(--txt-faint); margin-top: 4px; font-family: var(--font-mono); }
.cell-util { min-width: 110px; }
.cell-util .bar-track { height: 5px; }
.cell-util .cu-cap { font-size: 11px; color: var(--txt-dim); margin-top: 4px; font-family: var(--font-mono); }

.rank { display: flex; flex-direction: column; }
.rank-row { padding: 13px 22px; border-bottom: 1px solid var(--line-soft); }
.rank-row:last-child { border-bottom: 0; }
.rank-top { display: flex; align-items: center; gap: 11px; margin-bottom: 8px; }
.rank-idx { width: 24px; height: 24px; flex: 0 0 auto; border-radius: 8px; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--panel-hi); color: var(--txt-dim); font-family: var(--font-mono); box-shadow: inset 0 1px 0 var(--glass-hi); }
.rank-row:first-child .rank-idx { background: linear-gradient(155deg, var(--accent-bright), var(--accent-deep)); color: #fff; box-shadow: inset 0 1px 1px rgba(255,255,255,.4); }
.rank-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-val { margin-left: auto; font-family: var(--font-mono); font-weight: 600; white-space: nowrap; }
.rank-bar { height: 6px; border-radius: 5px; background: var(--track); overflow: hidden; box-shadow: inset 0 1px 2px rgba(18,24,44,0.10); }
.rank-bar > span { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--accent), var(--brass)); transition: width .7s cubic-bezier(.2,.8,.2,1); }

.gauge-row { display: flex; gap: 16px; flex-wrap: wrap; }
.gauge { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 200px; background: var(--panel);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(150%); backdrop-filter: blur(var(--blur)) saturate(150%);
  border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow-sm), inset 0 1px 0 var(--glass-hi); }
.gauge svg { transform: rotate(-90deg); flex: 0 0 auto; }
.gauge-track { stroke: var(--track); }
.gauge .gv { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -.6px; }
.gauge .gl { font-size: 10.5px; color: var(--txt-dim); font-weight: 700; margin-top: 3px; }
.gauge .gsub { font-size: 12px; color: var(--txt-faint); margin-top: 4px; font-family: var(--font-mono); }

.area-wrap { position: relative; }
.area-chart { width: 100%; height: auto; display: block; overflow: visible; }
.area-chart .ac-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.area-chart .ac-dot { fill: var(--panel-hi); stroke: var(--accent); stroke-width: 2; }
.area-chart .ac-base { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.area-x { display: flex; justify-content: space-between; margin-top: 8px; font-size: 10px; color: var(--txt-faint); font-family: var(--font-mono); }

.loading { display: grid; place-items: center; padding: 56px; color: var(--txt-dim); }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }

.split { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }

/* on desktop the menu wrapper is transparent — children flex straight into .appbar */
.appbar-menu { display: contents; }
.nav-toggle { display: none; padding: 8px 10px; }
.nav-toggle .rp-ic { display: block; }

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 820px) {
  .appbar { position: relative; height: 64px; padding: 0 16px; gap: 8px; }
  .appbar .brand { margin-right: 0; }
  .nav-toggle { display: inline-grid; place-items: center; margin-left: auto; }
  /* collapse nav + controls into a compact slide-down sheet (no scroll) */
  .appbar-menu {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-flow: row wrap; align-items: center; gap: 10px;
    padding: 14px 16px 16px;
    background: var(--appbar-bg);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(150%); backdrop-filter: blur(var(--blur)) saturate(150%);
    border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
  }
  .appbar.nav-open .appbar-menu { display: flex; }
  /* nav items as a 2-column grid → fits without scrolling */
  .appbar-menu nav { flex: 1 1 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; overflow: visible; }
  .appbar-menu .nav-item { width: 100%; }
  .appbar-menu .nav-item.active::after { display: none; }
  /* account + actions share one row at the bottom */
  .appbar-menu .user-chip { flex: 1 1 auto; }
  .appbar-menu .btn { margin-left: 0 !important; }
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 24px 16px 40px; }
  .page-head h2 { font-size: 24px; }
  .modal-overlay { padding: 14px; }
}

@media (max-width: 560px) {
  .appbar { padding: 0 12px; }
  .content { padding: 18px 13px 36px; }
  .page-head h2 { font-size: 21px; }
  .kpi .k-value { font-size: 27px; }
  .dl { grid-template-columns: 104px 1fr; }
  table.grid thead th, table.grid tbody td { padding: 10px 12px; }
  .panel-pad { padding: 18px 16px; }
}

.help { color: var(--txt-faint); font-size: 12px; }
.row-actions { display: flex; gap: 6px; }
.muted { color: var(--txt-faint); }
.accent-txt { color: var(--accent); }
.right { text-align: right; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   ICONOGRAPHY — skeuomorphic glossy chips with a sweeping glint
   ============================================================ */
.rp-ic { width: 1em; height: 1em; display: inline-block; vertical-align: -.16em; }
.nav-ico .rp-ic { width: 18px; height: 18px; }
.nav-item.active .rp-ic { color: var(--accent); }
.toolbar .search .ico .rp-ic { width: 16px; height: 16px; }

.icon-tile {
  position: relative; width: 44px; height: 44px; border-radius: 13px;
  display: grid; place-items: center; flex: 0 0 auto; overflow: hidden;
  background: linear-gradient(155deg, var(--it-2, var(--accent-bright)), var(--it-1, var(--accent-deep)));
  box-shadow: inset 0 1px 1px rgba(255,255,255,.55), inset 0 -3px 6px rgba(0,0,0,.20), 0 8px 16px -6px var(--it-shadow, var(--accent-glow));
}
.icon-tile::before { content: ''; position: absolute; inset: 0 0 50% 0; background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,0)); border-radius: 13px 13px 42% 42%; }
.icon-tile::after { content: ''; position: absolute; top: -60%; left: -120%; width: 55%; height: 220%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); transform: rotate(20deg); pointer-events: none; transition: left .55s ease; }
.icon-tile:hover::after { left: 130%; }
.icon-tile .rp-ic { position: relative; z-index: 1; width: 22px; height: 22px; color: #fff; filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.30)); }
.icon-tile.t-warm   { --it-1: #155d46; --it-2: #34c08e; --it-shadow: rgba(31,122,92,.55); }
.icon-tile.t-rose   { --it-1: #ad332c; --it-2: #f0766c; --it-shadow: rgba(216,69,61,.55); }
.icon-tile.t-amber  { --it-1: #8a5f17; --it-2: #e0aa48; --it-shadow: rgba(176,125,42,.55); }
.icon-tile.t-jewel  { --it-1: #1c6c89; --it-2: #4fc0df; --it-shadow: rgba(47,135,168,.55); }
.icon-tile.t-plum   { --it-1: #5a3f2a; --it-2: #b08a5e; --it-shadow: rgba(122,80,40,.50); }
.icon-tile.t-violet { --it-1: #543098; --it-2: #a884e6; --it-shadow: rgba(122,91,196,.55); }
.icon-tile.t-ok     { --it-1: #157a51; --it-2: #3fce98; --it-shadow: rgba(31,157,107,.55); }

.kpi .k-spark { opacity: 1; font-size: 0; top: 18px; right: 18px; }

.theme-toggle { padding: 8px 10px; }
.theme-toggle .rp-ic { display: block; }
.theme-fab { position: fixed; top: 20px; right: 20px; z-index: 50; }

@media (prefers-reduced-motion: reduce) {
  .content > *, .login-card, .modal, .toast { animation: none !important; }
  .btn::after, .icon-tile::after { transition: none; display: none; }
}
