/* ============================================================
   RPD Plan — design system
   Dark trading-terminal aesthetic: sharp edges, mono numerics,
   one lime accent, semantic profit/loss colour.
   ============================================================ */

:root {
  --bg:          #0a0c10;
  --panel:       #12151b;
  --panel-2:     #171b22;
  --panel-3:     #1d222b;
  --line:        #262c37;
  --line-bright: #343c49;
  --ink:         #e9ecf2;
  --ink-dim:     #99a2b1;
  --ink-faint:   #5c6471;

  --brand:       #d6f24a;
  --brand-dim:   #9aae35;
  --brand-glow:  rgba(214, 242, 74, 0.15);

  --up:          #4ed08a;
  --up-bg:       rgba(78, 208, 138, 0.12);
  --down:        #fb6f6f;
  --down-bg:     rgba(251, 111, 111, 0.12);
  --warn:        #ecb94a;
  --warn-bg:     rgba(236, 185, 74, 0.12);

  --r-sm: 4px;
  --r:    6px;
  --r-lg: 9px;

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --ui:   'Archivo', system-ui, sans-serif;
  --disp: 'Bricolage Grotesque', var(--ui);
}

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

html, body { height: 100%; }

body {
  font-family: var(--ui);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* faint dotted grid + a soft top glow */
  background-image:
    radial-gradient(900px 380px at 78% -10%, var(--brand-glow), transparent 70%),
    radial-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: auto, 26px 26px;
}

::selection { background: var(--brand); color: #0a0c10; }

button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }

/* scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-bright); border-radius: 99px; border: 3px solid var(--bg); }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------- layout */
.app {
  display: grid;
  grid-template-columns: 286px 1fr;
  height: 100vh;
}

/* ---------------------------------------------------------- sidebar */
.sidebar {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #0e1116, #0a0c10);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 11px; }
.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
  object-fit: contain;
}
.brand-mark {
  font-family: var(--disp);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: #0a0c10;
  background: var(--brand);
  padding: 7px 9px;
  border-radius: var(--r-sm);
  line-height: 1;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-family: var(--disp); font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.brand-text span { font-size: 11px; color: var(--ink-faint); letter-spacing: 0.02em; }

.list-label {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 4px 2px 0;
}

.plan-list { display: flex; flex-direction: column; gap: 6px; flex: 1; }

.plan-card {
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 11px 12px;
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s, transform 0.14s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.plan-card:hover { border-color: var(--line-bright); transform: translateY(-1px); }
.plan-card.active { border-color: var(--brand-dim); background: var(--panel-2); }
.plan-card.active::before {
  content: '';
  position: absolute;
}
.plan-card .pc-name {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.005em;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.plan-card .pc-row {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-dim);
}
.pc-bar { height: 3px; background: var(--panel-3); border-radius: 99px; overflow: hidden; }
.pc-bar > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

.sidebar-foot {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: flex; flex-direction: column; gap: 3px;
}
.foot-line { font-size: 11px; color: var(--ink-dim); }
.foot-line.dim { color: var(--ink-faint); font-family: var(--mono); font-size: 10px; }

/* ---------------------------------------------------------- buttons */
.btn {
  border: 1px solid var(--line-bright);
  background: var(--panel-2);
  color: var(--ink);
  padding: 8px 13px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  transition: background 0.14s, border-color 0.14s, transform 0.06s;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-3); border-color: var(--ink-faint); }
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #0a0c10;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary:hover { background: #e2fb63; border-color: #e2fb63; }
.btn-primary .plus { font-size: 15px; line-height: 0; margin-top: -1px; }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { background: var(--panel); }
.btn-danger { color: var(--down); border-color: rgba(251, 111, 111, 0.35); background: transparent; }
.btn-danger:hover { background: var(--down-bg); border-color: var(--down); }
.btn-sm { padding: 5px 9px; font-size: 11.5px; }
.btn-icon {
  padding: 4px 7px; font-family: var(--mono); font-size: 12px;
  border-color: var(--line); background: transparent;
}

/* ---------------------------------------------------------- main */
.main { overflow-y: auto; padding: 30px 36px 60px; }

/* empty state */
.empty {
  height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; gap: 14px;
  color: var(--ink-dim);
}
.empty .glyph {
  font-family: var(--disp); font-weight: 800; font-size: 42px;
  color: var(--brand); letter-spacing: 0.05em;
}
.empty h2 { font-family: var(--disp); font-size: 22px; color: var(--ink); font-weight: 700; }
.empty p { max-width: 420px; font-size: 13px; }

/* dashboard reveal animation */
.dash > * {
  opacity: 0;
  transform: translateY(8px);
  animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
.dash > *:nth-child(1) { animation-delay: 0.02s; }
.dash > *:nth-child(2) { animation-delay: 0.07s; }
.dash > *:nth-child(3) { animation-delay: 0.12s; }
.dash > *:nth-child(4) { animation-delay: 0.17s; }
.dash > *:nth-child(5) { animation-delay: 0.22s; }
.dash > *:nth-child(6) { animation-delay: 0.27s; }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }

/* ---------------------------------------------------------- dash header */
.dash-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; margin-bottom: 24px;
}
.eyebrow {
  font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 6px;
}
.dash-head h1 {
  font-family: var(--disp); font-size: 28px; font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.1;
}
.dash-head h1.title { font-size: 28px; }
.dash-head .subtitle {
  margin-top: 8px;
  color: var(--ink-dim);
  font-size: 14px;
  max-width: 640px;
}
.plan-meta {
  font-family: var(--mono); font-size: 12px; color: var(--ink-dim);
  margin-top: 7px;
}
.plan-meta b { color: var(--ink); font-weight: 600; }
.head-actions { display: flex; align-items: center; gap: 8px; }

.status-pill {
  font-size: 11px; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 6px 11px; border-radius: 99px;
  border: 1px solid currentColor;
  display: inline-flex; align-items: center; gap: 6px;
}
.status-pill::before {
  content: ''; width: 6px; height: 6px; border-radius: 99px;
  background: currentColor;
}
.s-ahead     { color: var(--up); background: var(--up-bg); }
.s-completed { color: var(--brand); background: var(--brand-glow); }
.s-on_track  { color: #6fb6ff; background: rgba(111, 182, 255, 0.12); }
.s-behind    { color: var(--warn); background: var(--warn-bg); }
.s-breached  { color: var(--down); background: var(--down-bg); }
.s-not_started { color: var(--ink-dim); background: var(--panel-2); }

/* ---------------------------------------------------------- hero / RPD */
.hero {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.hero-rpd {
  position: relative;
  border: 1px solid var(--line-bright);
  border-radius: var(--r-lg);
  background:
    radial-gradient(420px 200px at 0% 0%, rgba(214, 242, 74, 0.07), transparent 70%),
    var(--panel);
  padding: 22px 24px;
  overflow: hidden;
}
.hero-rpd::after {
  content: ''; position: absolute; inset: 0;
  border-radius: var(--r-lg);
  box-shadow: inset 0 0 0 1px rgba(214, 242, 74, 0.06);
  pointer-events: none;
}
.rpd-number {
  font-family: var(--disp);
  font-weight: 800;
  font-size: 58px;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--brand);
  margin: 6px 0 4px;
}
.rpd-number .cents { font-size: 30px; color: var(--brand-dim); }
.rpd-sub { font-family: var(--mono); font-size: 12px; color: var(--ink-dim); }
.rpd-sub b { color: var(--ink); }

.constraints { margin-top: 18px; display: flex; flex-direction: column; gap: 9px; }
.constraint { display: grid; grid-template-columns: 124px 1fr 78px; align-items: center; gap: 11px; }
.constraint .c-name {
  font-size: 11px; color: var(--ink-dim); letter-spacing: 0.01em;
  display: flex; align-items: center; gap: 6px;
}
.constraint.binding .c-name { color: var(--ink); font-weight: 600; }
.constraint .c-track {
  height: 7px; background: var(--panel-3); border-radius: 99px; overflow: hidden;
  border: 1px solid var(--line);
}
.constraint .c-track > i { display: block; height: 100%; background: var(--line-bright); border-radius: 99px; }
.constraint.binding .c-track > i { background: var(--brand); }
.constraint .c-val { font-family: var(--mono); font-size: 12px; text-align: right; color: var(--ink-dim); }
.constraint.binding .c-val { color: var(--ink); font-weight: 600; }
.lock {
  font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--brand); color: #0a0c10; font-weight: 700;
  padding: 2px 5px; border-radius: 3px;
}

.hero-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mini {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  padding: 13px 14px;
  display: flex; flex-direction: column; gap: 5px;
}
.mini .m-label {
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-faint);
}
.mini .m-value {
  font-family: var(--mono); font-size: 19px; font-weight: 600;
  letter-spacing: -0.01em;
}
.mini .m-foot { font-family: var(--mono); font-size: 10.5px; color: var(--ink-dim); }

/* ---------------------------------------------------------- kpi grid */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.kpi {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  padding: 13px 14px;
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color 0.14s;
}
.kpi:hover { border-color: var(--line-bright); }
.kpi .k-label {
  font-size: 10px; letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--ink-faint);
}
.kpi .k-value {
  font-family: var(--mono); font-size: 21px; font-weight: 600;
  letter-spacing: -0.015em;
}
.kpi .k-foot { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); }

.up   { color: var(--up); }
.down { color: var(--down); }
.warn { color: var(--warn); }
.brand-c { color: var(--brand); }

/* ---------------------------------------------------------- gauges */
.gauges {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.gauge {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  padding: 17px 19px;
}
.gauge-top {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 12px;
}
.gauge-top .g-title {
  font-size: 11px; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--ink-dim);
}
.gauge-top .g-num { font-family: var(--mono); font-size: 16px; font-weight: 600; }
.gauge-track {
  height: 11px; background: var(--panel-3); border-radius: 99px;
  overflow: hidden; border: 1px solid var(--line); position: relative;
}
.gauge-track > i {
  display: block; height: 100%; border-radius: 99px;
  transition: width 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.gauge-track > i.fill-up   { background: linear-gradient(90deg, var(--brand-dim), var(--brand)); }
.gauge-track > i.fill-down { background: linear-gradient(90deg, #8a3b3b, var(--down)); }
.gauge-foot {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint);
  margin-top: 8px;
}

/* ---------------------------------------------------------- panels */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  margin-bottom: 16px;
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.panel-head h3 {
  font-family: var(--disp); font-size: 14px; font-weight: 700;
  letter-spacing: 0.005em;
}
.panel-head .ph-sub {
  font-family: var(--mono); font-size: 11px; color: var(--ink-faint);
  margin-left: 10px;
}
.panel-body { padding: 18px; }

/* ---------------------------------------------------------- chart */
.chart-wrap { width: 100%; }
.chart-wrap svg { width: 100%; height: auto; display: block; }
.chart-legend {
  display: flex; gap: 18px; padding: 12px 18px 0;
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-dim);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 14px; height: 0; border-top: 2px solid; display: inline-block; }
.lg-eq    { color: var(--brand); }
.lg-eq i    { border-color: var(--brand); }
.lg-tgt   { color: var(--up); }
.lg-tgt i   { border-top-style: dashed; border-color: var(--up); }
.lg-floor { color: var(--down); }
.lg-floor i { border-top-style: dashed; border-color: var(--down); }

/* ---------------------------------------------------------- entry form */
.entry-form {
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
  padding: 16px 18px;
  display: none;
}
.entry-form.open { display: block; }
.ef-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 11px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field.wide { grid-column: span 6; }
.field label {
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-faint);
}
.field input, .field select, .field textarea {
  background: var(--bg);
  border: 1px solid var(--line-bright);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  transition: border-color 0.14s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand-dim);
}
.field textarea { font-family: var(--ui); resize: vertical; min-height: 38px; }
.field .hint { font-size: 10px; color: var(--ink-faint); font-family: var(--mono); }
.ef-actions { display: flex; gap: 8px; margin-top: 13px; }
.form-error {
  color: var(--down); font-size: 11.5px; font-family: var(--mono);
  margin-top: 10px;
}

/* ---------------------------------------------------------- table */
.log-table { width: 100%; border-collapse: collapse; }
.log-table th {
  text-align: right;
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 600;
  padding: 11px 14px; border-bottom: 1px solid var(--line);
  background: var(--panel-2);
  position: sticky; top: 0;
}
.log-table th:first-child, .log-table td:first-child { text-align: left; padding-left: 18px; }
.log-table th:last-child, .log-table td:last-child { text-align: center; padding-right: 18px; }
.log-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 12.5px;
  text-align: right;
  color: var(--ink-dim);
  vertical-align: top;
}
.log-table tr:hover td { background: var(--panel-2); }
.log-table tr:last-child td { border-bottom: none; }
.td-date { color: var(--ink) !important; font-weight: 500; }
.td-pnl { font-weight: 600; }
.td-notes {
  text-align: left !important;
  font-family: var(--ui) !important;
  color: var(--ink-dim);
  max-width: 280px; white-space: normal; line-height: 1.45;
  font-size: 12px !important;
}
.adh {
  font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 3px; font-weight: 700;
}
.adh-ok   { color: var(--up); background: var(--up-bg); }
.adh-over { color: var(--down); background: var(--down-bg); }
.adh-na   { color: var(--ink-faint); background: var(--panel-3); }
.row-actions { display: inline-flex; gap: 5px; }
.empty-row td {
  text-align: center !important; color: var(--ink-faint);
  padding: 28px !important; font-family: var(--ui) !important;
}

/* ---------------------------------------------------------- modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(5, 6, 9, 0.74);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; z-index: 50;
  animation: fade 0.16s ease;
}
/* [hidden] must win over display:flex — otherwise the backdrop stays on screen and blurs the whole app (Safari/Chrome). */
.modal-backdrop[hidden] {
  display: none !important;
  pointer-events: none;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 560px; max-width: 100%;
  max-height: 90vh; overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line-bright);
  border-radius: var(--r-lg);
  animation: pop 0.18s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.99); } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.modal-head h2 {
  font-family: var(--disp); font-size: 18px; font-weight: 700;
  letter-spacing: -0.01em;
}
.modal-head .x {
  background: transparent; border: 1px solid var(--line);
  color: var(--ink-dim); width: 28px; height: 28px; border-radius: var(--r-sm);
  cursor: pointer; font-size: 14px; line-height: 1;
}
.modal-head .x:hover { background: var(--panel-2); color: var(--ink); }
.modal-body { padding: 22px; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.modal-grid .field.wide { grid-column: span 2; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 9px;
  padding: 16px 22px; border-top: 1px solid var(--line);
  background: var(--panel-2);
}
.preview {
  grid-column: span 2;
  border: 1px dashed var(--line-bright);
  border-radius: var(--r);
  padding: 12px 14px;
  font-family: var(--mono); font-size: 11.5px;
  color: var(--ink-dim);
  display: flex; flex-wrap: wrap; gap: 4px 18px;
}
.preview b { color: var(--brand); }

/* ---------------------------------------------------------- toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--panel-3); border: 1px solid var(--line-bright);
  color: var(--ink); padding: 10px 16px; border-radius: var(--r);
  font-size: 12.5px; z-index: 80;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.2s ease;
}
.toast.err { border-color: var(--down); color: var(--down); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    flex-direction: row; flex-wrap: wrap; align-items: center;
    height: auto; position: sticky; top: 0; z-index: 20;
  }
  .app-nav {
    width: 100%;
    flex-basis: 100%;
  }
  .app-nav-btn { touch-action: manipulation; }
  .plan-list { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; }
  .plan-card { flex: 1 1 200px; }
  .sidebar-foot { display: none; }
  .hero, .gauges { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .main { padding: 22px 18px 60px; }
  .ef-grid { grid-template-columns: repeat(2, 1fr); }
  .field.wide { grid-column: span 2; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr; }
  .hero-side { grid-template-columns: 1fr; }
  .dash-head { flex-direction: column; }
}

/* ============================================================
   OtoTrade — nav, brokers, bot flow
   ============================================================ */
.main-column {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.view-panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.view-panel[hidden] {
  display: none !important;
}

.app-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.app-nav-btn {
  flex: 1;
  min-width: 72px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 6px;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}

.app-nav-btn:hover {
  border-color: var(--line-bright);
  color: var(--ink);
}

.app-nav-btn.is-active {
  background: var(--brand);
  color: #0a0c10;
  border-color: var(--brand);
}

.tl-hero {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--panel), var(--panel-2));
  padding: 22px 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 22px;
}

.tl-hero h1 {
  font-family: var(--disp);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.tl-hero p {
  color: var(--ink-dim);
  max-width: 560px;
}

.tl-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--panel);
}

.tl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.tl-table th,
.tl-table td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

.tl-table th {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: var(--panel-2);
}

.tl-table tr:last-child td { border-bottom: none; }

.tl-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 99px;
  border: 1px solid var(--line-bright);
  color: var(--ink-dim);
}

.tl-badge.ok { border-color: var(--up); color: var(--up); background: var(--up-bg); }
.tl-badge.warn { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); }

.tl-empty {
  padding: 28px;
  text-align: center;
  color: var(--ink-dim);
}

.tl-flow {
  display: flex;
  align-items: stretch;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.tl-flow-node {
  flex: 1;
  min-width: 160px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel-2);
  padding: 14px;
}

.tl-flow-node h3 {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}

.tl-flow-node .mono {
  font-family: var(--mono);
  font-size: 12px;
}

.tl-flow-arrow {
  display: flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 18px;
  color: var(--brand-dim);
}

.tl-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
  margin-top: 14px;
}

.dim { color: var(--ink-dim); }

.code {
  font-family: var(--mono);
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px;
  color: var(--ink);
  overflow: auto;
}

.tl-tv-guide .tl-step-list {
  margin: 0 0 18px 1.1em;
  padding: 0;
  color: var(--ink-dim);
  font-size: 13px;
  line-height: 1.55;
}
.tl-tv-guide .tl-step-list li { margin-bottom: 8px; }
.tl-tv-guide .tl-step-list strong { color: var(--ink); }
.tl-copy-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 16px 0 8px;
}
.tl-copy-label:first-of-type { margin-top: 0; }
.tl-copy-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.tl-copy-row .tl-copy-pre {
  flex: 1;
  margin: 0;
  min-height: 2.5em;
  font-size: 11px;
  max-height: 140px;
  overflow: auto;
}
.tl-copy-row .btn-sm { flex-shrink: 0; margin-top: 2px; }

@media (max-width: 720px) {
  .tl-field-grid { grid-template-columns: 1fr; }
  .tl-hero { grid-template-columns: 1fr; }
}

/* === main-wrap + top shell (auth dashboard) ================================= */
.main-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.main-column {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.shell-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  font-family: 'Inter', var(--ui);
}
.shell-topbar-spacer { flex: 1; }
.shell-topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-upgrade {
  background: #ff7a18;
  border: none;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-family: 'Inter', var(--ui);
}
.btn-upgrade:hover { filter: brightness(1.06); }

.shell-theme-seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--panel-2);
}
.shell-theme-seg--sm { transform: scale(0.95); }
.shell-theme-opt {
  border: none;
  background: transparent;
  color: var(--ink-dim);
  padding: 6px 12px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.shell-theme-opt.is-on {
  background: var(--panel-3);
  color: var(--ink);
}

.shell-user-wrap { position: relative; }
.shell-avatar-btn {
  border: none;
  padding: 0;
  background: transparent;
  border-radius: 999px;
  cursor: pointer;
  line-height: 0;
  box-shadow: 0 0 0 2px var(--line);
}
.shell-avatar-btn:hover { box-shadow: 0 0 0 2px var(--line-bright); }
.shell-avatar {
  display: block;
  border-radius: 999px;
  width: 36px;
  height: 36px;
  object-fit: cover;
}
.shell-avatar-lg { width: 44px; height: 44px; }

.shell-user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 280px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  z-index: 200;
  padding: 8px 0;
  font-family: 'Inter', var(--ui);
}
.shell-menu-user {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 16px 10px;
}
.shell-user-name { font-weight: 600; font-size: 15px; color: var(--ink); }
.shell-user-meta { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.shell-menu-sep { height: 1px; background: var(--line); margin: 6px 0; }
.shell-menu-item {
  display: flex;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
}
.shell-menu-item:hover { background: var(--panel-2); }
.shell-menu-danger { color: #e85555; }
.shell-menu-theme {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 10px;
}
.shell-muted { color: var(--ink-dim); }
.shell-muted.small { font-size: 12px; }

.shell-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 300;
}
.shell-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 94vw);
  height: 100vh;
  background: var(--panel);
  border-left: 1px solid var(--line);
  z-index: 310;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.25);
  font-family: 'Inter', var(--ui);
}
.shell-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.shell-drawer-title { font-size: 17px; font-weight: 600; margin: 0; }
.shell-drawer-close {
  border: none;
  background: transparent;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-dim);
  padding: 0 4px;
}
.shell-drawer-body {
  padding: 18px;
  overflow: auto;
  flex: 1;
  font-size: 14px;
  color: var(--ink);
}
.shell-stack { display: flex; flex-direction: column; gap: 12px; }
.shell-h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  margin: 8px 0 4px;
}
.shell-field label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
.shell-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
}
.shell-copy-row { display: flex; gap: 8px; align-items: center; }
.shell-field-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.shell-table-wrap { overflow: auto; max-height: 220px; border: 1px solid var(--line); border-radius: var(--r); }
.shell-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.shell-table th,
.shell-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.shell-table th { color: var(--ink-faint); font-weight: 600; text-transform: uppercase; font-size: 10px; letter-spacing: 0.08em; }
.shell-table .num { font-family: var(--mono); }
.shell-msg { font-size: 13px; color: var(--warn); min-height: 1.2em; }

.login-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(165deg, #f0f2f7 0%, #e2e6ef 100%);
  font-family: 'Inter', var(--ui);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
  text-align: center;
}
.login-card h1 {
  font-size: 26px;
  font-weight: 700;
  margin: 14px 0 6px;
  color: #0f172a;
}
.login-sub { color: #64748b; font-size: 15px; margin-bottom: 24px; line-height: 1.45; }
.login-logo { border-radius: 12px; }
.login-hint {
  margin-top: 16px;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #1e293b;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-google:hover { background: #f8fafc; }
.btn-google.is-disabled {
  opacity: 0.55;
  pointer-events: none;
  cursor: not-allowed;
}
.g-icon { display: flex; flex-shrink: 0; }

/* Light theme — dashboard reference */
:root[data-theme='light'] {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --panel-3: #eef1f6;
  --line: #e2e8f0;
  --line-bright: #cbd5e1;
  --ink: #0f172a;
  --ink-dim: #475569;
  --ink-faint: #94a3b8;
  --brand: #c8e025;
  --brand-dim: #8a9a1f;
  --brand-glow: rgba(200, 224, 37, 0.2);
}
:root[data-theme='light'] body {
  background-image:
    radial-gradient(900px 380px at 78% -10%, var(--brand-glow), transparent 70%),
    radial-gradient(rgba(15, 23, 42, 0.04) 1px, transparent 1px);
}
:root[data-theme='light'] .shell-user-menu {
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.12);
}
:root[data-theme='light'] .sidebar {
  background: linear-gradient(180deg, #fff, #f8fafc);
}
:root[data-theme='light'] .shell-drawer-backdrop {
  background: rgba(15, 23, 42, 0.35);
}
