/* ==========================================================================
   Meridian Capital — client portal & admin application shell
   Mobile-first. Themes: [data-theme="dark"] (portal default) and "light".
   ========================================================================== */

:root, [data-theme="light"] {
  --bg: #F3F6FB;
  --bg-2: #EAF0F8;
  --surface: #FFFFFF;
  --surface-2: #F7FAFD;
  --line: #E1E8F2;
  --line-2: #D2DCEA;
  --text: #0B1A33;
  --text-2: #42526B;
  --muted: #6B7C95;
  --side-bg: #081326;
  --side-text: #9DB0CA;
  --side-active: #FFFFFF;
  --input-bg: #FFFFFF;
  --shadow: 0 1px 2px rgba(11, 26, 51, .04), 0 10px 30px -18px rgba(11, 26, 51, .22);
  --tv-theme: light;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #060E1C;
  --bg-2: #0A1628;
  --surface: #0C1A30;
  --surface-2: #10213B;
  --line: rgba(148, 178, 220, .12);
  --line-2: rgba(148, 178, 220, .2);
  --text: #EAF1FB;
  --text-2: #B3C3D9;
  --muted: #7F93AE;
  --side-bg: #050B16;
  --side-text: #8EA3C0;
  --side-active: #FFFFFF;
  --input-bg: #0A172B;
  --shadow: 0 1px 0 rgba(255, 255, 255, .02) inset, 0 16px 40px -24px rgba(0, 0, 0, .8);
  color-scheme: dark;
}
:root {
  --cyan: #22D3EE; --cyan-300: #67E8F9; --blue: #3B82F6; --blue-600: #2563EB; --indigo: #6366F1;
  --up: #10C98F; --down: #F43F5E; --warn: #F59E0B; --info: #38BDF8;
  --grad: linear-gradient(135deg, #22D3EE 0%, #3B82F6 55%, #6366F1 100%);
  --r: 16px; --r-sm: 12px;
  --side-w: 264px; --top-h: 64px; --bottom-h: 64px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-d: 'Sora', 'Inter', system-ui, sans-serif;
}

* { -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); }
body { font-family: var(--font); color: var(--text-2); font-size: .94rem; -webkit-font-smoothing: antialiased; min-height: 100vh; overflow-x: hidden;
  --bs-body-color: var(--text-2); --bs-body-bg: var(--bg); --bs-border-color: var(--line); --bs-emphasis-color: var(--text); --bs-secondary-color: var(--muted); --bs-heading-color: var(--text); }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-d); color: var(--text); letter-spacing: -.02em; font-weight: 700; }
a { color: var(--blue); text-decoration: none; }
[data-theme="dark"] a { color: var(--cyan-300); }
.tabular, .num { font-variant-numeric: tabular-nums; }
.text-up { color: var(--up) !important; } .text-down { color: var(--down) !important; } .text-muted-2 { color: var(--muted) !important; }
.text-strong { color: var(--text) !important; }
.fw-600 { font-weight: 600; }
hr { border-color: var(--line); opacity: 1; }

/* ---------- Logo ---------- */
.mc-logo { display: inline-flex; align-items: center; gap: .6rem; color: #F1F6FD !important; }
.mc-logo-word { display: flex; flex-direction: column; line-height: 1; }
.mc-logo-name { font-family: var(--font-d); font-weight: 700; font-size: 1.15rem; letter-spacing: -.02em; }
.mc-logo-sub { font-family: var(--font-d); font-size: .55rem; font-weight: 600; letter-spacing: .38em; text-transform: uppercase; color: var(--cyan-300); margin-top: .25rem; }
.mc-logo.ink { color: var(--text) !important; }
.mc-logo.ink .mc-logo-sub { color: var(--blue); }

/* ---------- Shell ---------- */
.app { min-height: 100vh; }
.side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side-bg); z-index: 1045; display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); border-right: 1px solid rgba(255, 255, 255, .05); }
.side.open { transform: none; box-shadow: 20px 0 60px -20px rgba(0, 0, 0, .6); }
.side-head { height: var(--top-h); display: flex; align-items: center; justify-content: space-between; padding: 0 1.1rem; flex: none; }
.side-close { color: var(--side-text); background: transparent; border: 0; font-size: 1.2rem; width: 40px; height: 40px; border-radius: 10px; }
.side-scroll { flex: 1; overflow-y: auto; padding: .5rem .75rem 1rem; scrollbar-width: thin; scrollbar-color: #1A3157 transparent; }
.side-label { font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #4E6384; padding: 1.1rem .75rem .45rem; }
.side-link { display: flex; align-items: center; gap: .8rem; padding: .66rem .8rem; border-radius: 11px; color: var(--side-text) !important; font-weight: 500; font-size: .92rem; position: relative; transition: background .15s ease, color .15s ease; }
.side-link i { width: 20px; text-align: center; font-size: 1rem; opacity: .9; }
.side-link:hover { background: rgba(255, 255, 255, .05); color: #fff !important; }
.side-link.active { background: linear-gradient(90deg, rgba(34, 211, 238, .16), rgba(59, 130, 246, .08)); color: var(--side-active) !important; }
.side-link.active::before { content: ""; position: absolute; left: -.75rem; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
.side-link .badge { margin-left: auto; font-size: .68rem; font-weight: 700; background: rgba(34, 211, 238, .15); color: var(--cyan-300); border-radius: 999px; padding: .25rem .5rem; }
.side-group > .side-link .caret { margin-left: auto; font-size: .7rem; transition: transform .2s ease; }
.side-group > .side-link[aria-expanded="true"] .caret { transform: rotate(180deg); }
.side-sub { padding: .15rem 0 .35rem 2.55rem; display: grid; gap: .1rem; }
.side-sub a { display: block; padding: .45rem .7rem; border-radius: 9px; color: var(--side-text) !important; font-size: .87rem; }
.side-sub a:hover { color: #fff !important; background: rgba(255, 255, 255, .04); }
.side-sub a.active { color: #fff !important; background: rgba(255, 255, 255, .06); }
.side-foot { padding: 1rem; flex: none; border-top: 1px solid rgba(255, 255, 255, .06); }
.side-promo { border-radius: 14px; padding: 1rem; background: linear-gradient(135deg, rgba(34, 211, 238, .14), rgba(99, 102, 241, .18)); border: 1px solid rgba(148, 178, 220, .14); color: #CFE0F5; font-size: .82rem; }
.side-promo strong { display: block; color: #fff; font-size: .95rem; margin-bottom: .2rem; }
.backdrop { position: fixed; inset: 0; background: rgba(2, 6, 14, .6); backdrop-filter: blur(2px); z-index: 1040; opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease; }
.backdrop.show { opacity: 1; visibility: visible; }

.main { min-width: 0; padding-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom) + 1rem); }
.top { position: sticky; top: 0; z-index: 1030; height: var(--top-h); display: flex; align-items: center; gap: .6rem; padding: 0 1rem;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--line); }
.top-title { min-width: 0; }
.top-title h1 { font-size: 1.05rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-title small { display: none; color: var(--muted); font-size: .78rem; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); flex: none; transition: background .15s ease, color .15s ease, border-color .15s ease; }
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.user-chip { display: flex; align-items: center; gap: .6rem; padding: .25rem .25rem .25rem .25rem; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text) !important; }
.user-chip .who { display: none; line-height: 1.15; padding-right: .5rem; }
.user-chip .who b { display: block; font-size: .85rem; color: var(--text); font-weight: 600; }
.user-chip .who small { font-size: .74rem; color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 700; font-size: .8rem; font-family: var(--font-d); flex: none; }
.avatar.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 1.3rem; }
.avatar.md { width: 44px; height: 44px; border-radius: 13px; font-size: .95rem; }
.avatar.a1 { background: linear-gradient(135deg, #22D3EE, #0EA5E9); } .avatar.a2 { background: linear-gradient(135deg, #3B82F6, #6366F1); } .avatar.a3 { background: linear-gradient(135deg, #14B8A6, #3B82F6); }

.content { padding: 1rem; max-width: 1480px; margin: 0 auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-head h2 { font-size: 1.35rem; margin: 0; }
.page-head p { margin: .2rem 0 0; color: var(--muted); }

/* Bottom tab bar (phones) */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; height: calc(var(--bottom-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem; color: var(--muted) !important; font-size: .68rem; font-weight: 600; }
.tabbar a i { font-size: 1.08rem; }
.tabbar a.active { color: var(--text) !important; }
.tabbar a.active i { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tabbar a.tab-fab i { width: 44px; height: 44px; margin-top: -18px; border-radius: 15px; display: grid; place-items: center; color: #fff; background: var(--grad); -webkit-background-clip: border-box; background-clip: border-box; box-shadow: 0 10px 22px -8px rgba(59, 130, 246, .8); }

.foot { padding: 1.5rem 1rem 1rem; color: var(--muted); font-size: .8rem; text-align: center; }

@media (min-width: 576px) {
  .content { padding: 1.25rem; }
  .top { padding: 0 1.25rem; }
  .top-title small { display: block; }
  .user-chip .who { display: block; }
}
@media (min-width: 992px) {
  .side { transform: none; }
  .side-close, .menu-btn { display: none !important; }
  .main { margin-left: var(--side-w); padding-bottom: 0; }
  .tabbar { display: none; }
  .backdrop { display: none; }
  .content { padding: 1.5rem 1.75rem; }
  .top { padding: 0 1.75rem; }
  .top-title h1 { font-size: 1.15rem; }
}

/* ---------- Panels & KPIs ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.1rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h3 { font-size: 1rem; margin: 0; }
.panel-head p { margin: .15rem 0 0; font-size: .82rem; color: var(--muted); }
.panel-body { padding: 1.1rem; }
.panel-foot { padding: .85rem 1.1rem; border-top: 1px solid var(--line); }
@media (min-width: 768px) { .panel-head { padding: 1.1rem 1.35rem; } .panel-body { padding: 1.35rem; } .panel-foot { padding: .9rem 1.35rem; } }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
@media (min-width: 768px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; } }
@media (min-width: 1400px) { .kpis.six { grid-template-columns: repeat(6, minmax(0, 1fr)); } .kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 992px) { .kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .95rem; box-shadow: var(--shadow); min-width: 0; }
.kpi .lbl { display: flex; align-items: center; gap: .45rem; font-size: .76rem; font-weight: 500; color: var(--muted); }
.kpi .val { font-family: var(--font-d); font-weight: 700; color: var(--text); font-size: 1.2rem; letter-spacing: -.02em; margin-top: .45rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .74rem; color: var(--muted); margin-top: .15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .ic { width: 30px; height: 30px; border-radius: 9px; display: inline-grid; place-items: center; font-size: .8rem; color: var(--blue); background: rgba(59, 130, 246, .12); flex: none; }
[data-theme="dark"] .kpi .ic { color: var(--cyan-300); background: rgba(34, 211, 238, .1); }
.kpi.hero { grid-column: span 2; color: #CFE0F5; border: 0; background: radial-gradient(120% 140% at 100% 0%, rgba(99, 102, 241, .55), transparent 55%), linear-gradient(135deg, #0B1A33, #0F2D5C 60%, #0E4A7A); }
.kpi.hero .lbl { color: #9DB5D5; }
.kpi.hero .val { color: #fff; font-size: 1.75rem; }
.kpi.hero .ic { color: #fff; background: rgba(255, 255, 255, .12); }
.kpi.hero .sub { color: #9DB5D5; }
.kpi.hero::after { content: ""; position: absolute; right: -40px; bottom: -60px; width: 180px; height: 180px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .08); }
.kpi.hero .actions { display: flex; gap: .5rem; margin-top: .9rem; position: relative; z-index: 1; }
@media (min-width: 768px) { .kpi { padding: 1.15rem 1.2rem; } .kpi .val { font-size: 1.4rem; } .kpi.hero .val { font-size: 2rem; } }
/* Six-KPI grid: hero + five cards, laid out without orphans at every width. */
@media (max-width: 767.98px) { .kpis.six .kpi:last-child { grid-column: span 2; } }
@media (min-width: 768px) and (max-width: 1399.98px) { .kpis.six .kpi.hero { grid-column: span 3; } .kpis.six .kpi:last-child { grid-column: span 2; } }
@media (min-width: 1400px) { .kpis.six { grid-template-columns: 1.7fr repeat(5, minmax(0, 1fr)); } .kpis.six .kpi.hero { grid-column: auto; } }

/* ---------- Buttons ---------- */
.btn { --bs-btn-font-weight: 600; --bs-btn-border-radius: 12px; --bs-btn-padding-y: .62rem; --bs-btn-padding-x: 1.1rem; --bs-btn-font-size: .9rem; transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease, border-color .15s ease; }
.btn-sm { --bs-btn-padding-y: .38rem; --bs-btn-padding-x: .75rem; --bs-btn-font-size: .8rem; --bs-btn-border-radius: 9px; }
.btn-lg { --bs-btn-padding-y: .85rem; --bs-btn-font-size: 1rem; --bs-btn-border-radius: 14px; }
.btn:focus-visible { box-shadow: 0 0 0 .22rem rgba(59, 130, 246, .35); }
.btn-mc { color: #fff !important; border: 0; background: var(--grad); background-size: 140% 140%; box-shadow: 0 10px 22px -12px rgba(59, 130, 246, .9); }
.btn-mc:hover { transform: translateY(-1px); background-position: 100% 0; }
.btn-soft { color: var(--text) !important; background: var(--surface-2); border: 1px solid var(--line); }
.btn-soft:hover { border-color: var(--line-2); background: var(--surface); }
.btn-glass { color: #fff !important; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16); }
.btn-glass:hover { background: rgba(255, 255, 255, .18); }
.btn-buy { color: #fff !important; background: linear-gradient(135deg, #10C98F, #0EA573); border: 0; box-shadow: 0 10px 22px -12px rgba(16, 201, 143, .9); }
.btn-sell { color: #fff !important; background: linear-gradient(135deg, #FB7185, #E11D48); border: 0; box-shadow: 0 10px 22px -12px rgba(244, 63, 94, .9); }
.btn-buy:hover, .btn-sell:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-danger-soft { color: var(--down) !important; background: rgba(244, 63, 94, .1); border: 1px solid rgba(244, 63, 94, .2); }
.btn-danger-soft:hover { background: rgba(244, 63, 94, .16); }
.btn-success-soft { color: var(--up) !important; background: rgba(16, 201, 143, .1); border: 1px solid rgba(16, 201, 143, .22); }
.btn-success-soft:hover { background: rgba(16, 201, 143, .16); }
.btn-warn-soft { color: var(--warn) !important; background: rgba(245, 158, 11, .1); border: 1px solid rgba(245, 158, 11, .22); }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; }

/* ---------- Chips / badges ---------- */
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .6rem; border-radius: 999px; font-size: .73rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.plain::before { display: none; }
.chip.up { color: var(--up); background: rgba(16, 201, 143, .1); border-color: rgba(16, 201, 143, .2); }
.chip.down { color: var(--down); background: rgba(244, 63, 94, .1); border-color: rgba(244, 63, 94, .2); }
.chip.warn { color: var(--warn); background: rgba(245, 158, 11, .1); border-color: rgba(245, 158, 11, .22); }
.chip.info { color: var(--info); background: rgba(56, 189, 248, .1); border-color: rgba(56, 189, 248, .22); }
.chip.muted { color: var(--muted); background: var(--surface-2); border-color: var(--line); }
.chip.brand { color: #fff; background: var(--grad); }

/* ---------- Forms ---------- */
.form-label { font-weight: 600; font-size: .82rem; color: var(--text); margin-bottom: .4rem; }
.form-control, .form-select { background-color: var(--input-bg); border: 1px solid var(--line-2); color: var(--text); border-radius: 12px; padding: .7rem .9rem; font-size: 1rem; }
@media (min-width: 768px) { .form-control, .form-select { font-size: .92rem; } }
.form-control::placeholder { color: var(--muted); opacity: .8; }
.form-control:focus, .form-select:focus { background-color: var(--input-bg); color: var(--text); border-color: var(--blue); box-shadow: 0 0 0 .2rem rgba(59, 130, 246, .18); }
.form-control:disabled, .form-control[readonly] { background-color: var(--surface-2); color: var(--text-2); }
.form-select { --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%237F93AE' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); }
.form-text { color: var(--muted); font-size: .78rem; }
.input-group-text { background: var(--surface-2); border-color: var(--line-2); color: var(--muted); border-radius: 12px; }
.form-check-input { background-color: var(--input-bg); border-color: var(--line-2); }
.form-check-input:checked { background-color: var(--blue); border-color: var(--blue); }
.form-control-sm, .form-select-sm { padding: .4rem .65rem; font-size: .85rem !important; border-radius: 9px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .35rem; padding: .3rem; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { text-align: center; padding: .5rem .25rem; border-radius: 10px; font-weight: 600; font-size: .82rem; color: var(--text-2); cursor: pointer; user-select: none; transition: background .15s ease, color .15s ease; }
.seg input:checked + label { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
[data-theme="dark"] .seg input:checked + label { background: #1A3157; color: #fff; }
.seg input:focus-visible + label { outline: 2px solid var(--blue); }
.chips-pick { display: flex; gap: .4rem; }
.chips-pick button { flex: 1; padding: .45rem 0; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); font-weight: 600; font-size: .8rem; transition: all .15s ease; }
.chips-pick button:hover, .chips-pick button.on { color: var(--text); border-color: var(--blue); background: rgba(59, 130, 246, .1); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem .9rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.toggle-row .form-switch .form-check-input { width: 2.6em; height: 1.4em; cursor: pointer; }
.drop { position: relative; display: grid; place-items: center; text-align: center; gap: .35rem; padding: 1.6rem 1rem; border: 1.5px dashed var(--line-2); border-radius: 14px; background: var(--surface-2); color: var(--muted); cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.drop:hover, .drop.drag { border-color: var(--blue); background: rgba(59, 130, 246, .06); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop i { font-size: 1.5rem; color: var(--blue); }
.drop b { color: var(--text); font-size: .9rem; }
.drop .fname { color: var(--text); font-weight: 600; font-size: .85rem; word-break: break-all; }

/* ---------- Alerts ---------- */
.alert { border-radius: 14px; border: 1px solid var(--line); display: flex; gap: .7rem; align-items: flex-start; font-size: .9rem; }
.alert > i { margin-top: .15rem; }
.alert-success { background: rgba(16, 201, 143, .1); border-color: rgba(16, 201, 143, .25); color: var(--text); }
.alert-success > i { color: var(--up); }
.alert-danger { background: rgba(244, 63, 94, .1); border-color: rgba(244, 63, 94, .25); color: var(--text); }
.alert-danger > i { color: var(--down); }
.alert-warning { background: rgba(245, 158, 11, .1); border-color: rgba(245, 158, 11, .25); color: var(--text); }
.alert-warning > i { color: var(--warn); }
.alert-info { background: rgba(56, 189, 248, .1); border-color: rgba(56, 189, 248, .25); color: var(--text); }
.alert-info > i { color: var(--info); }
.alert .btn-close { margin-left: auto; padding: .35rem; }
[data-theme="dark"] .btn-close { filter: invert(1) grayscale(1) brightness(1.6); }

/* ---------- Tables (stack into cards on phones) ---------- */
.table-app { --bs-table-bg: transparent; --bs-table-color: var(--text-2); --bs-table-border-color: var(--line); --bs-table-hover-bg: var(--surface-2); --bs-table-hover-color: var(--text); margin: 0; font-size: .87rem; }
.table-app thead th { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); padding: .75rem 1rem; white-space: nowrap; border-bottom-width: 1px; }
.table-app tbody td { padding: .85rem 1rem; vertical-align: middle; }
.table-app tbody tr:last-child td { border-bottom: 0; }
.table-app .strong { color: var(--text); font-weight: 600; }
.table-app .cell-user { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.table-app .cell-user b { color: var(--text); font-weight: 600; display: block; line-height: 1.25; }
.table-app .cell-user small { color: var(--muted); display: block; word-break: break-all; }
.actions-inline { display: inline-flex; flex-wrap: wrap; gap: .35rem; justify-content: flex-end; }
.actions-inline form { display: inline; margin: 0; }
@media (max-width: 767.98px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
  .table-stack tr:last-child { border-bottom: 0; }
  .table-stack tbody td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .3rem 0; border: 0; text-align: right; }
  .table-stack tbody td::before { content: attr(data-label); flex: none; text-align: left; font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
  .table-stack tbody td.td-main { display: block; text-align: left; padding-bottom: .5rem; }
  .table-stack tbody td.td-main::before { display: none; }
  .table-stack tbody td.td-actions { justify-content: flex-start; padding-top: .6rem; }
  .table-stack tbody td.td-actions::before { display: none; }
  .table-stack tbody td.td-actions .actions-inline { justify-content: flex-start; }
  .table-stack tbody td.dt-empty { display: block; text-align: center; }
  .table-stack tbody td.dt-empty::before { display: none; }
}
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty i { font-size: 1.6rem; color: var(--line-2); margin-bottom: .6rem; display: block; }
.empty b { display: block; color: var(--text); font-size: .95rem; margin-bottom: .2rem; }

/* DataTables 2 */
div.dt-container { font-size: .85rem; color: var(--text-2); }
div.dt-container .dt-layout-row { padding: .75rem 1rem; margin: 0 !important; }
div.dt-container .dt-layout-row.dt-layout-table { padding: 0; }
div.dt-container .dt-search input, div.dt-container .dt-length select { background: var(--input-bg); border: 1px solid var(--line-2); color: var(--text); border-radius: 10px; padding: .4rem .7rem; }
div.dt-container .dt-search input { width: 100%; max-width: 240px; margin-left: .4rem; }
div.dt-container .dt-info { color: var(--muted); font-size: .8rem; }
div.dt-container .dt-paging .pagination { gap: .25rem; margin: 0; flex-wrap: wrap; }
div.dt-container .page-link { background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); border-radius: 9px !important; font-size: .8rem; padding: .35rem .7rem; }
div.dt-container .page-item.active .page-link { background: var(--blue); border-color: var(--blue); color: #fff; }
div.dt-container .page-item.disabled .page-link { background: transparent; color: var(--muted); opacity: .6; }
table.dataTable thead > tr > th.dt-orderable-asc span.dt-column-order, table.dataTable thead > tr > th.dt-orderable-desc span.dt-column-order { opacity: .5; }
table.dataTable > tbody > tr.selected > * { box-shadow: none; }
@media (max-width: 767.98px) { div.dt-container .dt-layout-row:not(.dt-layout-table) { flex-direction: column; gap: .5rem; align-items: stretch; } div.dt-container .dt-search input { max-width: none; margin: .3rem 0 0; } div.dt-container .dt-layout-cell { text-align: left !important; } }

/* ---------- Misc components ---------- */
.list-kv { display: grid; gap: 0; margin: 0; }
.list-kv > div { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem 0; border-bottom: 1px dashed var(--line); }
.list-kv > div:last-child { border-bottom: 0; }
.list-kv dt { font-weight: 500; color: var(--muted); font-size: .85rem; }
.list-kv dd { margin: 0; color: var(--text); font-weight: 600; text-align: right; word-break: break-word; }
.copy-field { display: flex; align-items: center; gap: .5rem; padding: .6rem .6rem .6rem .9rem; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); }
.copy-field code { flex: 1; min-width: 0; color: var(--text); font-size: .85rem; word-break: break-all; background: none; }
.tile { display: flex; flex-direction: column; gap: .75rem; padding: 1.1rem; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); height: 100%; color: var(--text-2) !important; transition: transform .2s ease, border-color .2s ease; }
a.tile:hover { transform: translateY(-2px); border-color: var(--line-2); }
.btn-check + .tile { transition: border-color .15s ease, box-shadow .15s ease; }
.btn-check:checked + .tile { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59, 130, 246, .2); }
.btn-check:focus-visible + .tile { outline: 2px solid var(--blue); outline-offset: 2px; }
.logo-box { width: 46px; height: 46px; border-radius: 13px; background: #fff; display: grid; place-items: center; border: 1px solid var(--line); flex: none; overflow: hidden; }
.logo-box img { width: 30px; height: 30px; object-fit: contain; }
.tile .logo { width: 46px; height: 46px; border-radius: 13px; background: #fff; display: grid; place-items: center; border: 1px solid var(--line); flex: none; overflow: hidden; }
.tile .logo img { width: 30px; height: 30px; object-fit: contain; }
.tile .logo.txt { background: rgba(59, 130, 246, .1); color: var(--blue); font-weight: 700; font-size: .8rem; border: 0; }
.tile .nm { color: var(--text); font-weight: 600; line-height: 1.2; }
.tile .px { font-family: var(--font-d); color: var(--text); font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; border-top: 1px solid var(--line); padding-top: .85rem; }
.stat-row > div + div { border-left: 1px solid var(--line); }
.stat-row b { display: block; color: var(--text); font-size: .98rem; }
.stat-row small { color: var(--muted); font-size: .72rem; }
.tv-wrap { border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.tv-wrap > div { height: 420px; }
@media (min-width: 992px) { .tv-wrap.tall > div { height: 620px; } }
.ticker-wrap { border-bottom: 1px solid var(--line); background: var(--surface); min-height: 44px; }
/* Third-party widget iframes are light-scheme documents; matching the scheme keeps them transparent. */
.ticker-wrap iframe, .tv-wrap iframe { color-scheme: light; }
.qr { width: 172px; height: 172px; padding: 10px; border-radius: 16px; background: #fff; border: 1px solid var(--line); }
.step-dot { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; font-size: .78rem; font-weight: 700; color: #fff; background: var(--grad); flex: none; }
.video-card { border-radius: var(--r); overflow: hidden; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); height: 100%; display: flex; flex-direction: column; }
.video-card .ratio { background: #000; }
.video-card .body { padding: .9rem 1rem 1rem; }
.video-card .body b { color: var(--text); font-size: .92rem; line-height: 1.35; display: block; }
.dropdown-menu { --bs-dropdown-bg: var(--surface); --bs-dropdown-border-color: var(--line); --bs-dropdown-link-color: var(--text-2); --bs-dropdown-link-hover-bg: var(--surface-2); --bs-dropdown-link-hover-color: var(--text); --bs-dropdown-divider-bg: var(--line); border-radius: 14px; padding: .4rem; box-shadow: var(--shadow); font-size: .9rem; }
.dropdown-item { border-radius: 9px; padding: .5rem .75rem; display: flex; align-items: center; gap: .6rem; }
.dropdown-item i { width: 18px; text-align: center; color: var(--muted); }
.modal-content { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; color: var(--text-2); }
.modal-header, .modal-footer { border-color: var(--line); }
.progress { background: var(--surface-2); height: 8px; border-radius: 99px; }
.progress-bar { background: var(--grad); }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr; background: var(--bg); }
.auth-brand { display: none; position: relative; overflow: hidden; isolation: isolate; background: #081326; color: #A9B9CF; padding: 2.5rem; }
.auth-brand::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(rgba(148, 178, 220, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(148, 178, 220, .07) 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(ellipse 80% 70% at 40% 40%, #000 30%, transparent 75%); -webkit-mask-image: radial-gradient(ellipse 80% 70% at 40% 40%, #000 30%, transparent 75%); }
.auth-brand .glow { position: absolute; z-index: -1; width: 460px; height: 460px; border-radius: 50%; filter: blur(80px); opacity: .5; background: #1D4ED8; top: -140px; right: -140px; }
.auth-brand .glow.b { background: #0891B2; bottom: -200px; left: -120px; top: auto; right: auto; opacity: .35; }
.auth-brand h2 { color: #F1F6FD; font-size: 2.2rem; line-height: 1.12; letter-spacing: -.03em; }
.auth-brand ul { list-style: none; padding: 0; display: grid; gap: .9rem; margin: 2rem 0 0; }
.auth-brand li { display: flex; gap: .75rem; align-items: flex-start; }
.auth-brand li i { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: rgba(34, 211, 238, .12); color: var(--cyan-300); flex: none; font-size: .8rem; }
.auth-brand li b { color: #F1F6FD; display: block; font-size: .92rem; }
.auth-main { display: flex; flex-direction: column; padding: 1.25rem; min-height: 100vh; }
.auth-top { display: flex; justify-content: space-between; align-items: center; }
.auth-card { width: 100%; max-width: 440px; margin: auto; padding: 2rem 0; }
.auth-card.wide { max-width: 560px; }
.auth-card h1 { font-size: 1.7rem; margin-bottom: .35rem; }
.auth-card .lead { color: var(--muted); font-size: .95rem; margin-bottom: 1.75rem; }
.pw-wrap { position: relative; }
.pw-wrap .form-control { padding-right: 2.8rem; }
.pw-toggle { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; background: transparent; color: var(--muted); border-radius: 9px; }
.pw-meter { height: 4px; border-radius: 4px; background: var(--line); margin-top: .5rem; overflow: hidden; }
.pw-meter span { display: block; height: 100%; width: 0; background: var(--down); transition: width .25s ease, background .25s ease; }
@media (min-width: 992px) { .auth { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .auth-brand { display: flex; flex-direction: column; justify-content: space-between; } .auth-main { padding: 2rem 3rem; } }
@media (min-width: 1400px) { .auth { grid-template-columns: 5fr 6fr; } }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; right: 1rem; left: 1rem; bottom: calc(var(--bottom-h) + 1rem); z-index: 1090; display: grid; gap: .5rem; justify-items: end; pointer-events: none; }
@media (min-width: 992px) { .toast-stack { left: auto; bottom: 1.25rem; } }
.toast-x { pointer-events: auto; display: flex; gap: .6rem; align-items: flex-start; max-width: 380px; width: 100%; padding: .85rem 1rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--line-2); box-shadow: 0 20px 40px -20px rgba(0, 0, 0, .5); color: var(--text); font-size: .88rem; animation: toast-in .25s ease; }
.toast-x i { margin-top: .12rem; }
.toast-x.success i { color: var(--up); } .toast-x.danger i { color: var(--down); } .toast-x.info i { color: var(--info); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Loading state for buttons */
.btn.loading { pointer-events: none; opacity: .8; }
.btn.loading::after { content: ""; width: 14px; height: 14px; margin-left: .5rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; vertical-align: -2px; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

.min-w-0 { min-width: 0; }
