/* ============================================================
   RebornPay Trader Terminal — "Liquidity Desk"
   Plum-indigo desk · rose-crimson accent · amber highlights.
   Outfit display · IBM Plex Sans body · IBM Plex Mono numerals.
   Palette: E0B4B2 · E99856 · A54055 · 622347 · 42164B · 1A1836
   ============================================================ */

:root {
  --bg:            #161029;
  --bg-grid:       rgba(224, 180, 178, 0.022);
  --panel:         #1e1838;
  --panel-2:       #271e44;
  --panel-hi:      #322554;
  --line:          rgba(233, 152, 86, 0.14);
  --line-soft:     rgba(233, 152, 86, 0.07);
  --txt:           #f5ebe6;
  --txt-dim:       #c2aaad;
  --txt-faint:     #897089;

  --accent:        #d65574;
  --accent-deep:   #a54055;
  --accent-glow:   rgba(214, 85, 116, 0.22);
  --amber:         #e99856;
  --rose:          #e0b4b2;
  --plum:          #622347;
  --cyan:          #e0b4b2;   /* repurposed → dusty rose */
  --green:         #5cc8a0;
  --violet:        #9b78d6;

  --ok:            #5cc8a0;
  --warn:          #e99856;
  --bad:           #e0707f;
  --info:          #e0b4b2;
  --mute:          #8a7c9a;

  /* theme-surfaced tokens (overridden by [data-theme="light"]) */
  --input-bg:      rgba(0,0,0,0.22);
  --track:         rgba(233,152,86,0.09);
  --ghost-hover:   #3b2c61;
  --scroll-hover:  #3e2f66;
  --overlay:       rgba(13,10,28,0.76);
  --appbar-bg:     rgba(30,24,56,0.84);

  --r-sm: 7px;
  --r:    11px;
  --r-lg: 16px;
  --shadow: 0 20px 54px -22px rgba(0,0,0,0.78);

  --font-display: 'Outfit', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'JetBrains Mono', monospace;
}

/* ---------------- LIGHT THEME ---------------- */
html[data-theme="light"] {
  --bg:            #f4edf0;
  --bg-grid:       rgba(98,35,71,0.035);
  --panel:         #ffffff;
  --panel-2:       #fbf4f7;
  --panel-hi:      #f1e6ec;
  --line:          rgba(165,64,85,0.18);
  --line-soft:     rgba(165,64,85,0.09);
  --txt:           #2a1626;
  --txt-dim:       #6c5462;
  --txt-faint:     #8c7484;

  --accent:        #c23c61;
  --accent-deep:   #9e3450;
  --accent-glow:   rgba(194,60,97,0.22);
  --amber:         #cf6f1c;
  --rose:          #a8485f;
  --plum:          #622347;
  --cyan:          #a8485f;
  --green:         #1f9d76;
  --violet:        #7a52bd;

  --ok:            #1f9d76;
  --warn:          #c0702a;
  --bad:           #c43f57;
  --info:          #9c5e84;
  --mute:          #8a7c9a;

  --shadow:        0 18px 44px -20px rgba(98,35,71,0.26);
  --input-bg:      rgba(98,35,71,0.045);
  --track:         rgba(98,35,71,0.12);
  --ghost-hover:   #ecdfe6;
  --scroll-hover:  #dbc9d3;
  --overlay:       rgba(40,20,42,0.40);
  --appbar-bg:     rgba(255,255,255,0.80);
}
/* light-mode contrast tweaks (crimson accent needs white ink) */
html[data-theme="light"] .btn-primary,
html[data-theme="light"] .user-chip .avatar { color: #fff; }

* { 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.5;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(1100px 560px at 86% -14%, rgba(214,85,116,0.12), transparent 60%),
    radial-gradient(860px 480px at 2% 104%, rgba(233,152,86,0.09), transparent 56%),
    radial-gradient(720px 460px at 50% 124%, rgba(98,35,71,0.12), transparent 60%);
  background-attachment: fixed;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--panel-hi); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-hover); }

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; }

/* ---------------- LOGIN ---------------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 412px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 38px 34px 30px; box-shadow: var(--shadow), 0 0 0 1px rgba(233,152,86,0.03) inset;
  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: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--amber), transparent); opacity: .9; }
.login-card::after {
  content: ''; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(214,85,116,0.18), transparent 70%); pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(140deg, var(--accent), var(--amber));
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 800;
  color: #2a1020; box-shadow: 0 0 24px var(--accent-glow); font-size: 19px;
}
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.brand-name b { color: var(--accent); }
.brand-sub { color: var(--txt-faint); font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase; }

.login-card h1 { font-family: var(--font-display); font-size: 22px; font-weight: 600; margin: 26px 0 4px; }
.login-card .lead { color: var(--txt-dim); font-size: 13px; margin-bottom: 22px; }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--txt-faint); margin-bottom: 7px; font-weight: 600; }
.input, .select, textarea.input {
  width: 100%; background: var(--input-bg); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 11px 13px; color: var(--txt); transition: border-color .15s, box-shadow .15s; outline: none;
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.input::placeholder { color: var(--txt-faint); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--r-sm); padding: 10px 16px; font-weight: 600;
  cursor: pointer; transition: transform .12s, background .15s, border-color .15s, opacity .15s; white-space: nowrap; user-select: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-deep)); color: #2a1020; box-shadow: 0 8px 22px -10px var(--accent-glow); }
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #e26c88, var(--accent)); }
.btn-ghost { background: var(--panel-hi); color: var(--txt); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--ghost-hover); }
.btn-danger { background: rgba(224,112,127,0.13); color: var(--bad); border-color: rgba(224,112,127,0.32); }
.btn-danger:hover:not(:disabled) { background: rgba(224,112,127,0.23); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.login-msg { margin-top: 14px; font-size: 13px; min-height: 18px; color: var(--bad); }
.api-line { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-soft); }

/* ---------------- TOP-NAV SHELL ---------------- */
.appbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--appbar-bg); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px; padding: 0 22px; height: 64px;
}
.appbar .brand { margin-right: 18px; }
.appbar nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.nav-item {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--r-sm);
  color: var(--txt-dim); cursor: pointer; font-weight: 500; white-space: nowrap;
  transition: background .14s, color .14s; position: relative;
}
.nav-item:hover { background: var(--panel-hi); color: var(--txt); }
.nav-item.active { color: var(--accent); }
.nav-item.active::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px;
  background: var(--accent); border-radius: 2px; box-shadow: 0 0 10px var(--accent); }
.nav-ico { font-size: 14px; opacity: .9; }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 12px;
  border: 1px solid var(--line); border-radius: 40px; background: var(--panel); }
.user-chip .avatar { width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-deep), var(--accent)); display: grid; place-items: center;
  font-weight: 700; color: #2a1020; font-size: 12px; }
.user-chip .uname { font-weight: 600; font-size: 13px; }
.user-chip .urole { font-size: 11px; color: var(--txt-faint); }

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

/* ---------------- PAGE PRIMITIVES ---------------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h2 { font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -.3px; }
.page-head .sub { color: var(--txt-dim); font-size: 13px; margin-top: 2px; }
.page-head .spacer { flex: 1; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.panel-pad { padding: 18px 20px; }
.panel-title { font-family: var(--font-display); font-weight: 600; font-size: 14px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line);
  border-radius: var(--r); padding: 16px 18px; position: relative; overflow: hidden; transition: transform .15s, border-color .15s; }
.kpi::after { content: ''; position: absolute; right: -30px; bottom: -30px; width: 110px; height: 110px;
  background: radial-gradient(circle, rgba(214,85,116,0.12), transparent 70%); pointer-events: none; }
.kpi:hover { transform: translateY(-2px); border-color: rgba(214,85,116,0.38); }
.kpi .k-label { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--txt-faint); font-weight: 600; }
.kpi .k-value { font-family: var(--font-mono); font-size: 26px; font-weight: 600; margin-top: 8px; letter-spacing: -.5px; }
.kpi .k-foot { font-size: 12px; color: var(--txt-dim); margin-top: 6px; }
.kpi .k-spark { position: absolute; right: 14px; top: 14px; font-size: 18px; opacity: .3; }
.kpi.accent .k-value { color: var(--accent); }
.kpi.cyan .k-value { color: var(--rose); }
.kpi.green .k-value { color: var(--green); }
.kpi.violet .k-value { color: var(--violet); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .search { flex: 1; min-width: 220px; position: relative; }
.toolbar .search input { padding-left: 36px; }
.toolbar .search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--txt-faint); }
.input.compact, .select.compact { padding: 8px 11px; }
.select.compact { min-width: 120px; }

.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid thead th { text-align: left; padding: 11px 14px; font-size: 11px; letter-spacing: .6px;
  text-transform: uppercase; color: var(--txt-faint); font-weight: 700; border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0; background: var(--panel); z-index: 1; }
table.grid tbody td { padding: 12px 14px; 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; }
.empty-row td { text-align: center; color: var(--txt-faint); padding: 38px !important; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 30px;
  font-size: 12px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 7px currentColor; }
.pill.ok   { color: var(--ok);   background: rgba(92,200,160,0.12); border-color: rgba(92,200,160,0.28); }
.pill.warn { color: var(--warn); background: rgba(233,152,86,0.12); border-color: rgba(233,152,86,0.28); }
.pill.bad  { color: var(--bad);  background: rgba(224,112,127,0.12);border-color: rgba(224,112,127,0.28); }
.pill.info { color: var(--info); background: rgba(224,180,178,0.12);border-color: rgba(224,180,178,0.28); }
.pill.mute { color: var(--mute); background: rgba(138,124,154,0.14);border-color: rgba(138,124,154,0.26); }
.pill.violet{ color: var(--violet);background:rgba(155,120,214,0.12);border-color: rgba(155,120,214,0.28); }

.tag { display: inline-block; padding: 2px 8px; border-radius: 5px; 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: 14px; 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); backdrop-filter: blur(4px);
  display: grid; place-items: center; z-index: 100; padding: 24px; animation: fade .2s ease both; }
.modal { width: 100%; max-width: 540px; max-height: 88vh; overflow-y: auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
  animation: rise .28s cubic-bezier(.2,.8,.2,1) both; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.modal-head .x { margin-left: auto; cursor: pointer; color: var(--txt-faint); font-size: 22px; line-height: 1; padding: 0 4px; }
.modal-head .x:hover { color: var(--txt); }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

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

#toasts { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--panel-hi); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--r-sm); padding: 12px 16px; min-width: 240px; max-width: 360px; box-shadow: var(--shadow);
  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: 5px; height: 120px; padding-top: 10px; }
.bars .bar { flex: 1; background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  border-radius: 4px 4px 0 0; min-height: 3px; position: relative; opacity: .85; transition: opacity .15s; }
.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: 12px; }
.bar-line { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; color: var(--txt-dim); margin-bottom: 6px; gap: 8px; }
.bar-line .bl-label { letter-spacing: .3px; text-transform: uppercase; font-weight: 600; font-size: 10px; }
.bar-line .v { font-family: var(--font-mono); color: var(--txt); white-space: nowrap; }
.bar-track { height: 6px; border-radius: 6px; background: var(--track); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--amber)); transition: width .7s cubic-bezier(.2,.8,.2,1); }

.split-bar { display: flex; height: 9px; border-radius: 6px; overflow: hidden; background: var(--track); }
.split-bar > span { display: block; height: 100%; transition: width .7s cubic-bezier(.2,.8,.2,1); }
.split-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; 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: 11px 18px; border-bottom: 1px solid var(--line-soft); }
.rank-row:last-child { border-bottom: 0; }
.rank-top { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.rank-idx { width: 20px; height: 20px; flex: 0 0 auto; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--panel-hi); color: var(--txt-dim); font-family: var(--font-mono); }
.rank-row:first-child .rank-idx { background: linear-gradient(135deg, var(--accent), var(--amber)); color: #2a1020; }
.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: 5px; border-radius: 5px; background: var(--track); overflow: hidden; }
.rank-bar > span { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--accent), var(--amber)); transition: width .7s cubic-bezier(.2,.8,.2,1); }

.gauge-row { display: flex; gap: 14px; flex-wrap: wrap; }
.gauge { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 200px; background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.gauge svg { transform: rotate(-90deg); flex: 0 0 auto; }
.gauge-track { stroke: var(--track); }
.gauge .gv { font-family: var(--font-mono); font-size: 24px; font-weight: 600; letter-spacing: -.5px; }
.gauge .gl { font-size: 11px; color: var(--txt-dim); letter-spacing: .4px; text-transform: uppercase; font-weight: 600; margin-top: 2px; }
.gauge .gsub { font-size: 12px; color: var(--txt-faint); margin-top: 3px; 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); 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: 50px; 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: 16px; align-items: start; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .form-grid { grid-template-columns: 1fr; } .appbar { flex-wrap: wrap; height: auto; padding: 10px 14px; } }

.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); } }

/* ============================================================
   PREMIUM LAYER — isometric/skeuomorphic icons · glint · sparkle
   Full-palette gradients: E0B4B2 · E99856 · A54055 · 622347 · 42164B · 1A1836
   ============================================================ */
:root {
  --grad-sunset: linear-gradient(135deg, #E0B4B2 0%, #E99856 26%, #A54055 56%, #622347 80%, #42164B 100%);
}

/* line icons — inherit currentColor */
.rp-ic { width: 1em; height: 1em; display: inline-block; vertical-align: -.16em; }
.nav-ico { display: inline-grid; place-items: center; width: 20px; height: 20px; opacity: 1; font-size: inherit; }
.nav-ico .rp-ic { width: 18px; height: 18px; }
.nav-item.active .rp-ic { color: var(--accent); filter: drop-shadow(0 0 6px var(--accent-glow)); }
.toolbar .search .ico .rp-ic { width: 16px; height: 16px; }

/* skeuomorphic gradient icon tile — glossy top, depth shadow, glint sweep */
.icon-tile {
  position: relative; width: 40px; height: 40px; border-radius: 13px;
  display: grid; place-items: center; flex: 0 0 auto; isolation: isolate; overflow: hidden;
  background: linear-gradient(150deg, var(--it-a), var(--it-b));
  box-shadow:
    0 8px 18px -8px var(--it-shadow, rgba(0,0,0,.6)),
    inset 0 1.5px 0 rgba(255,255,255,.42),
    inset 0 -8px 14px -8px rgba(0,0,0,.42);
}
/* stagger the idle glint so tiles don't sweep in unison */
.icon-tile:nth-child(3n)::after   { animation-delay: 2.1s; }
.icon-tile:nth-child(3n+1)::after { animation-delay: 4.3s; }
.kpi:nth-child(2n) .icon-tile::after { animation-delay: 3.2s; }
.kpi:nth-child(3n) .icon-tile::after { animation-delay: 5.4s; }
.icon-tile .rp-ic {
  width: 22px; height: 22px; color: var(--it-ink, #fff);
  filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.28)); position: relative; z-index: 1;
}
.icon-tile::before {                 /* glossy highlight cap */
  content: ''; position: absolute; inset: 1px 1px 52% 1px;
  border-radius: 12px 12px 50% 50% / 12px 12px 22px 22px;
  background: linear-gradient(180deg, rgba(255,255,255,.42), rgba(255,255,255,0));
  pointer-events: none; z-index: 0;
}
.icon-tile::after {                  /* travelling glint */
  content: ''; position: absolute; top: -60%; bottom: -60%; width: 42%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent);
  transform: translateX(-260%) rotate(14deg); filter: blur(1px);
  pointer-events: none; z-index: 2;
  animation: tileGlint 6.5s ease-in-out infinite;
}
.icon-tile.t-warm   { --it-a:#E99856; --it-b:#A54055; --it-shadow:rgba(165,64,85,.50); }
.icon-tile.t-rose   { --it-a:#E0B4B2; --it-b:#A54055; --it-shadow:rgba(165,64,85,.45); --it-ink:#3a1320; }
.icon-tile.t-amber  { --it-a:#E99856; --it-b:#D97E3A; --it-shadow:rgba(217,126,58,.50); --it-ink:#3a1320; }
.icon-tile.t-jewel  { --it-a:#A54055; --it-b:#42164B; --it-shadow:rgba(66,22,75,.55); }
.icon-tile.t-plum   { --it-a:#622347; --it-b:#1A1836; --it-shadow:rgba(26,24,54,.60); }
.icon-tile.t-violet { --it-a:#9b78d6; --it-b:#42164B; --it-shadow:rgba(66,22,75,.50); }
.icon-tile.t-ok     { --it-a:#5cc8a0; --it-b:#2f8f73; --it-shadow:rgba(47,143,115,.50); }

/* KPI spark slot now hosts the tile; re-trigger glint on card hover */
.kpi .k-spark { opacity: 1; font-size: 0; top: 16px; right: 16px; }
.kpi:hover .icon-tile::after { animation: tileGlint 1.05s ease-in-out; }

/* brand mark — glossy sunset gem with twinkling sparkles */
.brand-mark {
  position: relative; overflow: visible;
  background: linear-gradient(140deg, #E99856 0%, #A54055 55%, #622347 100%);
  box-shadow:
    0 8px 20px -8px var(--accent-glow),
    inset 0 1.5px 0 rgba(255,255,255,.45),
    inset 0 -9px 16px -9px rgba(0,0,0,.45);
}
.brand-mark::before, .brand-mark::after {
  content: ''; position: absolute; background: #fff7ea;
  clip-path: polygon(50% 0, 59% 41%, 100% 50%, 59% 59%, 50% 100%, 41% 59%, 0 50%, 41% 41%);
  filter: drop-shadow(0 0 4px rgba(255,236,200,.9)); pointer-events: none;
}
.brand-mark::before { width: 9px; height: 9px; top: -4px; right: -3px; animation: twinkle 3.4s ease-in-out infinite; }
.brand-mark::after  { width: 6px; height: 6px; bottom: -2px; left: -3px; animation: twinkle 3.4s ease-in-out infinite 1.7s; }

/* primary button — sweeping sheen on hover */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 38%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent);
  transform: translateX(-260%) skewX(-18deg); pointer-events: none;
}
.btn-primary:hover:not(:disabled)::after { animation: btnSheen .85s ease; }

/* login card — sunset hairline + roomier gem */
.login-card::before { background: var(--grad-sunset); height: 3px; opacity: 1; }
.login-card .brand-mark { width: 44px; height: 44px; border-radius: 13px; font-size: 21px; }

@keyframes tileGlint { 0% { transform: translateX(-260%) rotate(14deg); } 18%, 100% { transform: translateX(320%) rotate(14deg); } }
@keyframes twinkle  { 0%, 100% { opacity: 0; transform: scale(.3) rotate(0deg); } 45%, 55% { opacity: 1; transform: scale(1) rotate(35deg); } }
@keyframes btnSheen { from { transform: translateX(-260%) skewX(-18deg); } to { transform: translateX(320%) skewX(-18deg); } }

/* theme toggle */
.theme-toggle { padding: 6px 9px; }
.theme-toggle .rp-ic { display: block; }
.theme-fab { position: fixed; top: 18px; right: 18px; z-index: 50; }

@media (prefers-reduced-motion: reduce) {
  .icon-tile::after, .brand-mark::before, .brand-mark::after, .btn-primary::after { animation: none !important; }
}
