:root {
      /* ── Dark mode (default) — true black ── */
      --bg:           #000000;
      --bg-mid:       #0a0a0a;
      --bg-raised:    #111111;
      --bg-hover:     #181818;
      --line:         rgba(255,255,255,0.07);
      --line-strong:  rgba(255,255,255,0.13);
      --line-accent:  rgba(200,185,140,0.20);

      --text:         #e8e6e0;
      --text-2:       #9d9b94;
      --text-3:       #4e4c47;

      --gold:         #c8b98c;
      --gold-dim:     rgba(200,185,140,0.12);
      --gold-glow:    rgba(200,185,140,0.06);

      --green:        #6db384;
      --green-bg:     rgba(109,179,132,0.10);
      --green-line:   rgba(109,179,132,0.20);
      --red:          #c46a6a;
      --red-bg:       rgba(196,106,106,0.10);
      --red-line:     rgba(196,106,106,0.20);
      --amber:        #c8934a;
      --amber-bg:     rgba(200,147,74,0.10);
      --amber-line:   rgba(200,147,74,0.20);
      --blue:         #6a9fc4;
      --blue-bg:      rgba(106,159,196,0.10);
      --blue-line:    rgba(106,159,196,0.20);

      --topbar-bg:    rgba(0,0,0,0.92);

      --radius-xl:    20px;
      --radius-lg:    14px;
      --radius-md:    10px;
      --radius-sm:    7px;
      --sidebar-w:    260px;
      --font:         'DM Sans', system-ui, sans-serif;
      --mono:         'DM Mono', ui-monospace, monospace;
    }

    /* ── Light mode overrides ── */
    body.light {
      --bg:           #f5f4f0;
      --bg-mid:       #ffffff;
      --bg-raised:    #fafaf8;
      --bg-hover:     #eeede9;
      --line:         rgba(0,0,0,0.07);
      --line-strong:  rgba(0,0,0,0.13);
      --line-accent:  rgba(160,140,90,0.25);

      --text:         #18170f;
      --text-2:       #6b6960;
      --text-3:       #a8a69e;

      --gold:         #8a7540;
      --gold-dim:     rgba(138,117,64,0.10);
      --gold-glow:    rgba(138,117,64,0.06);

      --green:        #3a8c57;
      --green-bg:     rgba(58,140,87,0.08);
      --green-line:   rgba(58,140,87,0.20);
      --red:          #a84040;
      --red-bg:       rgba(168,64,64,0.08);
      --red-line:     rgba(168,64,64,0.20);
      --amber:        #9e6820;
      --amber-bg:     rgba(158,104,32,0.08);
      --amber-line:   rgba(158,104,32,0.20);
      --blue:         #2e6e96;
      --blue-bg:      rgba(46,110,150,0.08);
      --blue-line:    rgba(46,110,150,0.20);

      --topbar-bg:    rgba(245,244,240,0.92);
    }

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

    body {
      font-family: var(--font);
      background: var(--bg);
      color: var(--text);
      min-height: 100vh;
      overflow-x: hidden;
      font-size: 14px;
      line-height: 1.5;
      -webkit-font-smoothing: antialiased;
    }

    button, input, select { font: inherit; }
    button { border: 0; cursor: pointer; background: transparent; color: inherit; }
    input, select { outline: none; }

    /* ─── Layout ─────────────────────────────────────── */
    .app {
      display: grid;
      grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
      min-height: 100vh;
    }

    /* ─── Sidebar ────────────────────────────────────── */
    .sidebar {
      position: sticky;
      top: 0;
      height: 100vh;
      display: flex;
      flex-direction: column;
      background: var(--bg-mid);
      border-right: 1px solid var(--line);
      overflow-y: auto;
      overflow-x: hidden;
    }

    .brand {
      padding: 28px 20px 22px;
      border-bottom: 1px solid var(--line);
    }

    .brand-wordmark {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .brand-icon {
      width: 32px;
      height: 32px;
      border-radius: 9px;
      background: var(--gold-dim);
      border: 1px solid var(--line-accent);
      display: grid;
      place-items: center;
      color: var(--gold);
    }

    .brand-name {
      font-size: 17px;
      font-weight: 500;
      letter-spacing: -0.02em;
      color: var(--text);
    }

    .brand-sub {
      margin-top: 6px;
      font-size: 11px;
      color: var(--text-3);
      letter-spacing: 0.06em;
      text-transform: uppercase;
      font-weight: 400;
    }

    .nav {
      padding: 16px 12px;
      display: flex;
      flex-direction: column;
      gap: 2px;
      flex: 1;
    }

    .nav-section-label {
      font-size: 10px;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--text-3);
      font-weight: 500;
      padding: 14px 10px 6px;
    }

    .nav-btn {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 9px 10px;
      border-radius: var(--radius-md);
      color: var(--text-2);
      font-size: 13.5px;
      font-weight: 400;
      transition: background 0.15s, color 0.15s;
      white-space: nowrap;
    }

    .nav-btn:hover { background: var(--bg-hover); color: var(--text); }

    .nav-btn.active {
      background: var(--gold-dim);
      color: var(--gold);
      border: 1px solid var(--line-accent);
    }

    .nav-icon {
      width: 16px;
      height: 16px;
      flex: 0 0 16px;
      stroke: currentColor;
      stroke-width: 1.75;
      fill: none;
      stroke-linecap: round;
      stroke-linejoin: round;
      opacity: 0.8;
    }

    .sidebar-footer {
      padding: 16px;
      border-top: 1px solid var(--line);
      margin-top: auto;
    }

    .fleet-pill {
      background: var(--bg-raised);
      border: 1px solid var(--line);
      border-radius: var(--radius-lg);
      padding: 14px 16px;
    }

    .fleet-pill .label {
      font-size: 10px;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--text-3);
    }

    .fleet-pill .value {
      font-size: 22px;
      font-weight: 500;
      letter-spacing: -0.04em;
      color: var(--text);
      margin-top: 4px;
    }

    .fleet-pill .note {
      font-size: 11.5px;
      color: var(--text-3);
      margin-top: 5px;
      line-height: 1.5;
    }

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

    .topbar {
      position: sticky;
      top: 0;
      z-index: 20;
      padding: 0 28px;
      height: 60px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      background: var(--topbar-bg);
      backdrop-filter: blur(16px);
      border-bottom: 1px solid var(--line);
    }

    .topbar-left {
      display: flex;
      align-items: baseline;
      gap: 12px;
    }

    .topbar-left h2 {
      font-size: 16px;
      font-weight: 500;
      letter-spacing: -0.02em;
      color: var(--text);
    }

    .topbar-left p {
      font-size: 12.5px;
      color: var(--text-3);
    }

    .topbar-right {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .status-dot {
      display: flex;
      align-items: center;
      gap: 7px;
      padding: 6px 12px;
      border-radius: 999px;
      border: 1px solid var(--green-line);
      background: var(--green-bg);
      font-size: 12px;
      color: var(--green);
    }

    .pulse {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--green);
      position: relative;
    }

    .pulse::after {
      content: '';
      position: absolute;
      inset: -3px;
      border-radius: 50%;
      border: 1px solid var(--green);
      animation: pulseRing 2s ease infinite;
    }

    @keyframes pulseRing {
      0%   { opacity: 0.6; transform: scale(0.8); }
      60%  { opacity: 0; transform: scale(1.8); }
      100% { opacity: 0; transform: scale(1.8); }
    }

    .topbar-btn {
      display: flex;
      align-items: center;
      gap: 7px;
      padding: 6px 14px;
      border-radius: 999px;
      border: 1px solid var(--line-strong);
      font-size: 12.5px;
      color: var(--text-2);
      transition: border-color 0.15s, color 0.15s, background 0.15s;
    }

    .topbar-btn:hover {
      border-color: var(--line-accent);
      color: var(--text);
      background: var(--bg-raised);
    }

    .avatar-pill {
      display: flex;
      align-items: center;
      gap: 9px;
      padding: 5px 12px 5px 5px;
      border-radius: 999px;
      border: 1px solid var(--line);
      cursor: pointer;
      transition: border-color 0.15s, background 0.15s;
    }

    .avatar-pill:hover { border-color: var(--line-strong); background: var(--bg-raised); }

    .avatar {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: var(--gold-dim);
      border: 1px solid var(--line-accent);
      display: grid;
      place-items: center;
      font-size: 10px;
      font-weight: 600;
      color: var(--gold);
      letter-spacing: 0;
    }

    .avatar-name {
      font-size: 12.5px;
      color: var(--text-2);
    }

    /* ─── Content area ───────────────────────────────── */
    .content {
      padding: 28px;
      flex: 1;
    }

    /* ─── Pages ──────────────────────────────────────── */
    .page { display: none; }
    .page.active {
      display: block;
      animation: fadeUp 0.2s ease both;
    }

    @keyframes fadeUp {
      from { opacity: 0; transform: translateY(6px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    /* ─── Grid ───────────────────────────────────────── */
    .grid         { display: grid; gap: 16px; }
    .g2           { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .g3           { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .g4           { grid-template-columns: repeat(4, minmax(0,1fr)); }
    .g-main       { grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr); }

    /* ─── Cards ──────────────────────────────────────── */
    .card {
      background: var(--bg-raised);
      border: 1px solid var(--line);
      border-radius: var(--radius-xl);
      overflow: hidden;
    }

    .card-p { padding: 22px; }

    /* ─── Hero card ──────────────────────────────────── */
    .hero-card {
      background: var(--bg-raised);
      border: 1px solid var(--line);
      border-radius: var(--radius-xl);
      padding: 36px;
      position: relative;
      overflow: hidden;
    }

    /* Subtle matte texture overlay — no glow, just depth */
    .hero-card::before {
      content: '';
      position: absolute;
      inset: 0;
      background: radial-gradient(ellipse at 70% 110%, rgba(200,185,140,0.06) 0%, transparent 55%);
      pointer-events: none;
    }

    .hero-card::after {
      content: '';
      position: absolute;
      top: -60px; right: -60px;
      width: 260px; height: 260px;
      border-radius: 50%;
      background: radial-gradient(circle, rgba(200,185,140,0.05), transparent 70%);
      pointer-events: none;
    }

    .hero-eyebrow {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      font-size: 11px;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--text-3);
      margin-bottom: 20px;
    }

    .hero-eyebrow-line {
      width: 24px;
      height: 1px;
      background: var(--line-strong);
    }

    .hero-headline {
      font-size: clamp(30px, 4vw, 52px);
      font-weight: 300;
      letter-spacing: -0.05em;
      line-height: 1.05;
      color: var(--text);
      max-width: 580px;
      margin-bottom: 14px;
    }

    .hero-headline em {
      font-style: italic;
      color: var(--gold);
      font-weight: 300;
    }

    .hero-body {
      font-size: 14px;
      color: var(--text-2);
      max-width: 480px;
      line-height: 1.7;
      margin-bottom: 28px;
    }

    .hero-actions {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
    }

    /* ─── Buttons ────────────────────────────────────── */
    .btn {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 11px 18px;
      border-radius: var(--radius-lg);
      font-size: 13px;
      font-weight: 500;
      border: 1px solid var(--line-strong);
      color: var(--text-2);
      transition: all 0.15s ease;
    }

    .btn:hover { border-color: var(--line-accent); color: var(--text); background: var(--bg-hover); }

    .btn.primary {
      background: var(--gold-dim);
      border-color: var(--line-accent);
      color: var(--gold);
    }

    .btn.primary:hover { background: rgba(200,185,140,0.20); }

    .btn.danger {
      background: var(--red-bg);
      border-color: var(--red-line);
      color: var(--red);
    }

    .btn.danger:hover { background: rgba(196,106,106,0.16); }

    /* ─── Metric tiles ───────────────────────────────── */
    .metric {
      background: var(--bg-raised);
      border: 1px solid var(--line);
      border-radius: var(--radius-xl);
      padding: 20px;
    }

    .metric-label {
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--text-3);
    }

    .metric-value {
      font-size: 32px;
      font-weight: 300;
      letter-spacing: -0.05em;
      color: var(--text);
      margin-top: 10px;
      line-height: 1;
      font-family: var(--mono);
    }

    .metric-sub {
      font-size: 12px;
      color: var(--text-3);
      margin-top: 8px;
    }

    .positive { color: var(--green); }
    .negative { color: var(--red); }
    .warning-text { color: var(--amber); }

    /* ─── Section head ───────────────────────────────── */
    .section-head {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 12px;
      margin-bottom: 18px;
    }

    .section-title {
      font-size: 15px;
      font-weight: 500;
      letter-spacing: -0.02em;
      color: var(--text);
    }

    .section-sub {
      font-size: 12.5px;
      color: var(--text-3);
      margin-top: 3px;
    }

    /* ─── Badges ─────────────────────────────────────── */
    .badge {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 4px 10px;
      border-radius: 999px;
      font-size: 11.5px;
      font-weight: 500;
      border: 1px solid var(--line);
      color: var(--text-3);
      background: transparent;
    }

    .badge.green { color: var(--green); background: var(--green-bg); border-color: var(--green-line); }
    .badge.red   { color: var(--red);   background: var(--red-bg);   border-color: var(--red-line); }
    .badge.amber { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }
    .badge.blue  { color: var(--blue);  background: var(--blue-bg);  border-color: var(--blue-line); }
    .badge.gold  { color: var(--gold);  background: var(--gold-dim); border-color: var(--line-accent); }

    /* ─── Bot rows ───────────────────────────────────── */
    .bot-row {
      display: grid;
      grid-template-columns: 1.3fr 0.7fr 0.8fr auto;
      gap: 10px;
      align-items: center;
      padding: 14px 16px;
      border: 1px solid var(--line);
      border-radius: var(--radius-lg);
      background: var(--bg-mid);
      margin-bottom: 8px;
      transition: border-color 0.15s;
    }

    .bot-row:hover { border-color: var(--line-strong); }
    .bot-row:last-child { margin-bottom: 0; }

    .coin {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .coin-logo {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      display: grid;
      place-items: center;
      font-size: 10px;
      font-weight: 600;
      color: var(--gold);
      background: var(--gold-dim);
      border: 1px solid var(--line-accent);
      font-family: var(--mono);
    }

    .coin-name {
      font-size: 13.5px;
      font-weight: 500;
      letter-spacing: -0.02em;
    }

    .coin-sub {
      font-size: 11.5px;
      color: var(--text-3);
      margin-top: 1px;
    }

    .data-label {
      font-size: 10.5px;
      color: var(--text-3);
      text-transform: uppercase;
      letter-spacing: 0.06em;
      margin-bottom: 4px;
    }

    .data-value {
      font-size: 13.5px;
      font-family: var(--mono);
      font-weight: 500;
    }

    /* ─── Progress bar ───────────────────────────────── */
    .bar-track {
      height: 4px;
      background: var(--bg);
      border-radius: 999px;
      overflow: hidden;
      margin-top: 6px;
    }

    .bar-fill {
      height: 100%;
      border-radius: 999px;
      background: linear-gradient(90deg, var(--gold), rgba(200,185,140,0.6));
    }

    /* ─── Table ──────────────────────────────────────── */
    .table {
      width: 100%;
      border-collapse: collapse;
    }

    .table th {
      font-size: 10.5px;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--text-3);
      font-weight: 500;
      padding: 0 12px 12px;
      text-align: left;
      border-bottom: 1px solid var(--line);
    }

    .table td {
      padding: 13px 12px;
      font-size: 13px;
      border-bottom: 1px solid var(--line);
      vertical-align: middle;
      white-space: nowrap;
      color: var(--text-2);
    }

    .table td:first-child { color: var(--text); font-weight: 500; }
    .table tr:last-child td { border-bottom: 0; }
    .table tr:hover td { background: var(--bg-hover); }

    /* ─── Form ───────────────────────────────────────── */
    .form-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 14px;
    }

    .field {
      display: grid;
      gap: 7px;
      font-size: 12px;
      color: var(--text-3);
      letter-spacing: 0.04em;
    }

    .input, select {
      width: 100%;
      padding: 11px 14px;
      border-radius: var(--radius-md);
      color: var(--text);
      background: var(--bg-mid);
      border: 1px solid var(--line);
      font-size: 13.5px;
      transition: border-color 0.15s;
    }

    .input:focus, select:focus { border-color: var(--line-accent); }

    select option { background: var(--bg-raised); color: var(--text); }

    /* ─── Seg controls ───────────────────────────────── */
    .seg-group {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
    }

    .seg {
      padding: 8px 14px;
      border-radius: var(--radius-md);
      border: 1px solid var(--line);
      color: var(--text-3);
      font-size: 13px;
      transition: all 0.15s;
    }

    .seg:hover { border-color: var(--line-strong); color: var(--text-2); }

    .seg.active {
      background: var(--gold-dim);
      border-color: var(--line-accent);
      color: var(--gold);
    }

    /* ─── Exchange grid ──────────────────────────────── */
    .exchange-grid {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 10px;
      margin-bottom: 22px;
    }

    .exchange-btn {
      padding: 14px;
      border-radius: var(--radius-lg);
      border: 1px solid var(--line);
      background: var(--bg-mid);
      color: var(--text-2);
      text-align: left;
      transition: all 0.15s;
      min-height: 82px;
    }

    .exchange-btn:hover, .exchange-btn.active {
      border-color: var(--line-accent);
      color: var(--text);
      background: var(--gold-dim);
    }

    .exchange-btn strong { display: block; font-size: 13px; margin-top: 8px; }
    .exchange-btn span   { display: block; font-size: 11px; color: var(--text-3); margin-top: 3px; }

    /* ─── Trading Calendar ───────────────────────────── */
    .cal-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 18px;
      flex-wrap: wrap;
      gap: 12px;
    }

    .cal-nav {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .cal-nav-btn {
      width: 32px;
      height: 32px;
      border-radius: var(--radius-md);
      border: 1px solid var(--line);
      color: var(--text-2);
      display: grid;
      place-items: center;
      transition: border-color 0.15s, color 0.15s, background 0.15s;
    }

    .cal-nav-btn:hover { border-color: var(--line-strong); color: var(--text); background: var(--bg-hover); }

    .cal-month-label {
      font-size: 17px;
      font-weight: 500;
      letter-spacing: -0.03em;
      color: var(--text);
    }

    .cal-this-month {
      padding: 6px 13px;
      border-radius: var(--radius-md);
      border: 1px solid var(--line);
      font-size: 12px;
      color: var(--text-2);
      background: var(--bg-hover);
      cursor: pointer;
      transition: border-color 0.15s;
    }

    .cal-this-month:hover { border-color: var(--line-strong); color: var(--text); }

    .cal-summary {
      display: flex;
      align-items: center;
      gap: 14px;
      font-size: 13px;
      color: var(--text-3);
    }

    .cal-summary strong { color: var(--green); font-family: var(--mono); font-size: 15px; }

    /* Calendar grid: 7 day cols + 1 week summary col */
    .cal-grid {
      display: grid;
      grid-template-columns: repeat(7, minmax(0,1fr)) 110px;
      gap: 5px;
    }

    .cal-dow {
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--text-3);
      text-align: center;
      padding: 0 0 8px;
      font-weight: 500;
    }

    .cal-dow.week-col { color: var(--text-3); }

    .cal-cell {
      border: 1px solid var(--line);
      border-radius: var(--radius-lg);
      background: var(--bg-mid);
      min-height: 90px;
      padding: 10px;
      position: relative;
      transition: border-color 0.15s;
      cursor: default;
    }

    .cal-cell:hover { border-color: var(--line-strong); }

    .cal-cell.empty {
      background: transparent;
      border-color: transparent;
      cursor: default;
    }

    .cal-cell.profit {
      background: rgba(23, 60, 38, 0.55);
      border-color: rgba(109, 179, 132, 0.18);
    }

    .cal-cell.profit-strong {
      background: rgba(12, 72, 36, 0.75);
      border-color: rgba(109, 179, 132, 0.28);
    }

    .cal-cell.loss {
      background: rgba(72, 16, 16, 0.65);
      border-color: rgba(196, 106, 106, 0.22);
    }

    .cal-cell.today {
      border-color: var(--line-accent) !important;
      box-shadow: 0 0 0 1px var(--line-accent);
    }

    .cal-cell.week-cell {
      background: var(--bg-raised);
      border-color: var(--line);
      text-align: right;
    }

    .cal-day-num {
      font-size: 11px;
      color: var(--text-3);
      font-family: var(--mono);
      margin-bottom: 6px;
    }

    .cal-cell.week-cell .cal-day-num {
      color: var(--text-3);
      font-size: 10px;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      font-family: var(--font);
    }

    .cal-pnl {
      font-size: 15px;
      font-weight: 600;
      font-family: var(--mono);
      letter-spacing: -0.02em;
      margin-bottom: 4px;
    }

    .cal-cell.profit .cal-pnl,
    .cal-cell.profit-strong .cal-pnl { color: #6db384; }
    .cal-cell.loss .cal-pnl           { color: #c46a6a; }
    .cal-cell.week-cell .cal-pnl      { font-size: 18px; }

    .cal-meta {
      font-size: 11px;
      color: var(--text-3);
      line-height: 1.55;
      font-family: var(--mono);
    }

    .cal-cell.profit .cal-meta,
    .cal-cell.profit-strong .cal-meta { color: rgba(109,179,132,0.55); }
    .cal-cell.loss .cal-meta           { color: rgba(196,106,106,0.55); }

    .cal-week-days {
      font-size: 11px;
      color: var(--text-3);
      margin-top: 4px;
    }

    /* ─── Notice block ───────────────────────────────── */
    .notice {
      padding: 14px 16px;
      border-radius: var(--radius-lg);
      border: 1px solid var(--amber-line);
      background: var(--amber-bg);
      font-size: 12.5px;
      color: var(--text-2);
      line-height: 1.6;
    }

    /* ─── Row panel (checklist items, etc) ──────────────*/
    .row-panel {
      display: grid;
      grid-template-columns: auto 1fr;
      gap: 10px;
      align-items: center;
      padding: 14px 16px;
      border: 1px solid var(--line);
      border-radius: var(--radius-lg);
      background: var(--bg-mid);
      margin-bottom: 8px;
      transition: border-color 0.15s;
    }

    .row-panel:last-child { margin-bottom: 0; }
    .row-panel:hover { border-color: var(--line-strong); }

    .row-panel-title { font-size: 13.5px; font-weight: 500; color: var(--text); }
    .row-panel-sub   { font-size: 12px; color: var(--text-3); margin-top: 2px; }

    /* ─── Profile ────────────────────────────────────── */
    .profile-header {
      display: flex;
      align-items: center;
      gap: 20px;
      flex-wrap: wrap;
    }

    .profile-avatar {
      width: 72px;
      height: 72px;
      border-radius: 20px;
      background: var(--gold-dim);
      border: 1px solid var(--line-accent);
      display: grid;
      place-items: center;
      font-size: 22px;
      font-weight: 500;
      color: var(--gold);
    }

    /* ─── Divider ────────────────────────────────────── */
    .divider {
      height: 1px;
      background: var(--line);
      margin: 20px 0;
    }

    /* ─── Performance bars ───────────────────────────── */
    .perf-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 14px;
    }

    .perf-label { font-size: 12.5px; color: var(--text-2); }
    .perf-val   { font-size: 13px; font-family: var(--mono); color: var(--text); min-width: 42px; text-align: right; }

    /* ─── Subscription price ─────────────────────────── */
    .price-display {
      font-size: 48px;
      font-weight: 300;
      letter-spacing: -0.06em;
      font-family: var(--mono);
      color: var(--text);
      margin: 14px 0;
    }

    .price-display sup {
      font-size: 20px;
      vertical-align: super;
      font-weight: 400;
    }

    .price-display span {
      font-size: 15px;
      color: var(--text-3);
      letter-spacing: 0;
      font-family: var(--font);
    }


    /* ─── Profile + install settings ─────────────────── */
    .settings-profile-grid { margin-bottom: 0; }

    .profile-mini {
      display: flex;
      align-items: center;
      gap: 14px;
    }

    .profile-mini-avatar {
      width: 50px;
      height: 50px;
      border-radius: 15px;
      display: grid;
      place-items: center;
      background: var(--gold-dim);
      border: 1px solid var(--line-accent);
      color: var(--gold);
      font-size: 15px;
      font-weight: 500;
      letter-spacing: -0.02em;
    }

    .profile-mini-name {
      color: var(--text);
      font-size: 15px;
      font-weight: 500;
      letter-spacing: -0.02em;
    }

    .profile-mini-sub {
      color: var(--text-3);
      font-size: 12px;
      margin-top: 3px;
    }

    .install-device-row {
      display: grid;
      grid-template-columns: repeat(2, minmax(0,1fr));
      gap: 10px;
    }

    .install-device {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 12px;
      border: 1px solid var(--line);
      border-radius: var(--radius-lg);
      background: var(--bg-mid);
    }

    .install-device-icon {
      width: 30px;
      height: 30px;
      border-radius: 10px;
      display: grid;
      place-items: center;
      border: 1px solid var(--line-accent);
      color: var(--gold);
      background: var(--gold-dim);
      font-size: 18px;
      line-height: 1;
    }

    .install-device b {
      display: block;
      color: var(--text);
      font-size: 12.5px;
      font-weight: 500;
    }

    .install-device span:not(.install-device-icon) {
      display: block;
      color: var(--text-3);
      font-size: 11.5px;
      margin-top: 1px;
    }

    .install-help {
      margin-top: 10px;
      color: var(--text-3);
      font-size: 12px;
      line-height: 1.55;
    }

    .install-card.installed #installAppBtn {
      pointer-events: none;
      opacity: 0.55;
    }

    /* ─── Mobile nav ─────────────────────────────────── */
    .mobile-nav {
      display: none;
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 50;
      padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
      background: var(--topbar-bg);
      backdrop-filter: blur(20px);
      border-top: 1px solid var(--line);
      border-left: 0;
      border-right: 0;
      border-bottom: 0;
      border-radius: 0;
      justify-content: space-around;
    }

    .mobile-nav .nav-btn {
      flex-direction: column;
      gap: 4px;
      padding: 8px 10px;
      font-size: 10px;
      min-width: 50px;
      text-align: center;
      border-radius: var(--radius-md);
    }

    .mobile-nav .nav-icon { width: 18px; height: 18px; }

    /* ─── Responsive ─────────────────────────────────── */
    @media (max-width: 1200px) {
      .g4 { grid-template-columns: repeat(2, 1fr); }
      .g-main { grid-template-columns: 1fr; }
      .exchange-grid { grid-template-columns: repeat(3, 1fr); }
    }

    @media (max-width: 860px) {
      .app { display: block; }
      .sidebar { display: none; }
      .content { padding: 18px 14px 110px; }
      .mobile-nav { display: flex; }
      .topbar { padding: 0 16px; }
      .topbar-right { display: none; }
      .g2, .g3, .g4, .form-grid { grid-template-columns: 1fr; }
      .exchange-grid { grid-template-columns: repeat(2, 1fr); }
      .hero-card { padding: 24px; }
      .hero-headline { font-size: 32px; }
      .bot-row { grid-template-columns: 1fr; gap: 8px; }
      .table-wrap { overflow-x: auto; }
      .journal-bars { gap: 4px; }
    }

    @media (max-width: 480px) {
      .exchange-grid { grid-template-columns: 1fr; }
      .metric-value { font-size: 26px; }
      .price-display { font-size: 38px; }
    }

    .hide-desktop { display: none !important; }

    @media (max-width: 860px) {
      .hide-desktop { display: inline-flex !important; }
    }


/* ─── Mobile More menu ─────────────────────────────── */
.more-list {
  display: grid;
  gap: 8px;
}

.more-row {
  width: 100%;
  display: grid;
  grid-template-columns: 38px minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-mid);
  transition: border-color 0.15s, background 0.15s;
}

.more-row:hover { border-color: var(--line-strong); background: var(--bg-hover); }
.more-row-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--gold-dim);
  border: 1px solid var(--line-accent);
  color: var(--gold);
}
.more-row-icon .nav-icon { width: 17px; height: 17px; }
.more-row-text b {
  display: block;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
}
.more-row-text small {
  display: block;
  color: var(--text-3);
  font-size: 12px;
  margin-top: 2px;
}
.more-row-chev {
  color: var(--text-3);
  font-size: 24px;
  line-height: 1;
}

@media (max-width: 860px) {
  /* Journal summary cards should not become huge full-width blocks on phone. */
  #journal > .grid.g4 {
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 10px;
  }
  #journal > .grid.g4 .metric {
    padding: 16px;
    min-height: 122px;
  }
  #journal > .grid.g4 .metric-value {
    font-size: 21px !important;
    line-height: 1.08;
    white-space: nowrap;
  }

  .cal-header {
    align-items: flex-start;
  }
  .cal-nav {
    width: 100%;
    display: grid;
    grid-template-columns: 44px minmax(0,1fr) 44px;
  }
  .cal-nav .cal-this-month {
    grid-column: 1 / -1;
    justify-self: start;
    margin-top: 8px;
  }
  .cal-month-label {
    text-align: center;
    align-self: center;
    font-size: 22px;
  }
  .cal-summary {
    width: 100%;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12.5px;
  }
  .cal-summary strong {
    font-size: 18px;
  }

  /* Native mobile calendar: compact day cards, not 8 squeezed columns. */
  .cal-grid {
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 10px;
  }
  .cal-dow,
  .cal-cell.empty {
    display: none;
  }
  .cal-cell {
    min-height: 116px;
    padding: 13px;
    border-radius: 18px;
  }
  .cal-day-num {
    font-size: 12px;
    margin-bottom: 10px;
  }
  .cal-pnl {
    font-size: 18px;
    line-height: 1.1;
    white-space: nowrap;
  }
  .cal-meta {
    font-size: 12px;
    line-height: 1.45;
  }
  .cal-cell.week-cell {
    grid-column: 1 / -1;
    min-height: 82px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    text-align: left;
  }
  .cal-cell.week-cell .cal-day-num {
    margin: 0;
  }
  .cal-cell.week-cell .cal-pnl {
    font-size: 24px;
    margin: 0;
  }
  .cal-week-days {
    grid-column: 1 / -1;
    margin-top: 2px;
  }

  .more-quick-grid { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  #journal > .grid.g4 .metric-value { font-size: 19px !important; }
  .cal-cell { padding: 12px 10px; }
  .cal-pnl { font-size: 16px; }
}


/* ─── Mobile compact polish v4 ─────────────────────────
   Keeps the approved matte/native direction but fixes cramped pages,
   exchange selector sizing, and the oversized Read + Trade pill. */
.badge { white-space: nowrap; }
.connect-permission-badge { flex: 0 0 auto; }

@media (max-width: 860px) {
  .content { padding: 14px 12px 92px; }
  .topbar { height: 54px; padding: 0 14px; }
  .topbar-left { align-items: center; min-width: 0; }
  .topbar-left h2 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-left p { display: none; }

  .card,
  .metric,
  .hero-card,
  .exchange-btn,
  .row-panel { border-radius: 16px; }
  .card-p { padding: 16px; }
  .hero-card { padding: 22px; }
  .hero-eyebrow { margin-bottom: 14px; font-size: 10px; }
  .hero-headline { font-size: 30px; line-height: 1.08; margin-bottom: 12px; }
  .hero-body { font-size: 13px; line-height: 1.55; margin-bottom: 18px; }
  .hero-actions { gap: 8px; }
  .hero-actions .btn { flex: 1 1 calc(50% - 4px); justify-content: center; }
  .hero-actions .btn.danger { flex-basis: 100%; }

  .grid { gap: 10px; }
  .g-main,
  .g2,
  .g3,
  .g4,
  .form-grid { grid-template-columns: 1fr; }
  .metric { padding: 15px; }
  .metric-label { font-size: 10px; letter-spacing: 0.075em; }
  .metric-value { font-size: 22px; margin-top: 8px; }
  .metric-sub { font-size: 11.5px; margin-top: 6px; }

  /* Compact section headers and prevent small pills becoming circular. */
  .section-head { gap: 10px; margin-bottom: 14px; align-items: flex-start; }
  .section-head > div { min-width: 0; }
  .section-title { font-size: 14px; }
  .section-sub { font-size: 12px; line-height: 1.45; }
  .section-head .badge { align-self: flex-start; padding: 5px 9px; font-size: 11px; line-height: 1; white-space: nowrap; max-width: none; }
  .connect-permission-badge { margin-left: auto; }

  /* Exchange picker: exactly 2 columns on phones, compact native cards. */
  .exchange-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; margin-bottom: 16px; }
  .exchange-btn { min-height: 104px; padding: 14px 12px; display: flex; flex-direction: column; justify-content: space-between; }
  .exchange-btn .nav-icon { width: 17px; height: 17px; }
  .exchange-btn strong { font-size: 13px; margin-top: 8px; line-height: 1.2; }
  .exchange-btn span { font-size: 11px; line-height: 1.25; }

  .field { font-size: 11px; gap: 6px; }
  .input,
  select { padding: 10px 12px; font-size: 13px; }
  .btn { min-height: 40px; padding: 9px 13px; border-radius: 12px; font-size: 12.5px; }
  .seg { padding: 8px 12px; font-size: 12.5px; }

  .bot-row { padding: 12px; gap: 8px; }
  .coin-logo { width: 32px; height: 32px; font-size: 9px; }
  .coin-name,
  .data-value { font-size: 13px; }
  .coin-sub,
  .data-label { font-size: 10.5px; }
  .row-panel { padding: 12px; gap: 9px; }
  .row-panel-title { font-size: 13px; }
  .row-panel-sub { font-size: 11.5px; line-height: 1.4; }
  .notice { padding: 12px 13px; font-size: 12px; line-height: 1.45; }

  .table th { font-size: 10px; padding: 0 10px 10px; }
  .table td { padding: 11px 10px; font-size: 12px; }
  .price-display { font-size: 34px; margin: 10px 0; }

  .mobile-nav { padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
  .mobile-nav .nav-btn { padding: 7px 6px; min-width: 0; font-size: 9.5px; }
  .mobile-nav .nav-icon { width: 17px; height: 17px; }
}

@media (max-width: 480px) {
  /* Keep 2x2 exchange cards even on smaller screens. */
  .exchange-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .exchange-btn { min-height: 96px; padding: 12px 10px; }
  .exchange-btn strong { font-size: 12.5px; }
  .exchange-btn span { font-size: 10.5px; }

  .content { padding-left: 10px; padding-right: 10px; }
  .card-p { padding: 15px; }
  .metric { padding: 14px; }
  .metric-value { font-size: 20px; }
  .hero-headline { font-size: 28px; }
  .section-head { flex-wrap: nowrap; }
  .section-head .badge { font-size: 10.5px; padding: 5px 8px; }
  .connect-permission-badge { transform: none; }
}

@media (max-width: 360px) {
  .exchange-btn { min-height: 90px; padding: 10px 9px; }
  .exchange-btn strong { font-size: 12px; }
  .exchange-btn span { font-size: 10px; }
  .btn { font-size: 12px; padding-left: 11px; padding-right: 11px; }
  .section-head .badge { display: none; }
}

/* ─── Crypto payment UI ───────────────────────────── */
.payment-method-list {
  display: grid;
  gap: 10px;
}
.payment-method-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-mid);
}
.payment-method-row b {
  display: block;
  font-size: 13.5px;
  color: var(--text);
  font-weight: 500;
}
.payment-method-row small {
  display: block;
  margin-top: 2px;
  color: var(--text-3);
  font-size: 11px;
  font-family: var(--mono);
  overflow-wrap: anywhere;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0,0,0,0.74);
  backdrop-filter: blur(14px);
}
.modal-backdrop.open { display: flex; }
.modal-card {
  width: min(520px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  padding: 22px;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text-2);
  background: var(--bg-mid);
  font-size: 18px;
  line-height: 1;
}
.invoice-box {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}
.invoice-kv {
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--bg-mid);
}
.invoice-kv span {
  display: block;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 5px;
}
.invoice-kv b {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow-wrap: anywhere;
}
.invoice-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
@media (max-width: 860px) {
  .payment-method-row { padding: 11px 12px; }
  .modal-card { padding: 18px; }
  .invoice-actions .btn { width: 100%; justify-content: center; }
}
