/* Trade Logger Lite web app. Look copied from the approved mock (mock/trade-logger-lite-mock.html). */
  /* Tokens carried over from the old app's native-app/src/shared/theme.css.
     One committed look: dark navy fintech. Font swapped Circular -> Figtree (Circular is licensed). */
  :root {
    --bg: #0b0e1a;
    --card: #12162a;
    --card-2: #171c33;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: #f5f6fa;
    --text-dim: #9099b8;
    --text-faint: #8189a9;
    --accent-a: #4c7cff;
    --accent-b: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, var(--accent-a) 0%, var(--accent-b) 100%);
    --positive: #34d399;
    --negative: #f87171;
    --warn: #fbbf24;
    --pos-bg: rgba(52, 211, 153, 0.12);
    --neg-bg: rgba(248, 113, 113, 0.12);
    --warn-bg: rgba(251, 191, 36, 0.12);
    --info-bg: rgba(76, 124, 255, 0.14);
    --shadow-card: 0 8px 24px rgba(76, 124, 255, 0.08), 0 2px 8px rgba(0, 0, 0, 0.3);
    --font: "Figtree", -apple-system, "Segoe UI", sans-serif;
    --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
    color-scheme: dark;
  }

  * { box-sizing: border-box; }
  html, body { background: var(--bg); }
  body {
    font-family: var(--font);
    font-size: 14px;
    color: var(--text);
    margin: 0;
    padding-inline: 20px;
    padding-block: 20px 64px;
  }
  .wrap { max-width: 1180px; margin: 0 auto; }

  h1 { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
  h2 { font-size: 15px; font-weight: 700; margin: 0 0 12px; letter-spacing: -0.005em; }
  h3 { font-size: 13px; font-weight: 500; margin: 0 0 10px; color: var(--text-dim); }
  p { margin: 0; }
  .num { font-variant-numeric: tabular-nums; }
  .mono { font-family: var(--mono); font-size: 12px; }
  .dim { color: var(--text-dim); }
  .faint { color: var(--text-faint); }
  .pos { color: var(--positive); }
  .neg { color: var(--negative); }

  /* Top bar */
  .topbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
  .brand { display: flex; align-items: center; gap: 10px; }
  .logo {
    width: 30px; height: 30px; border-radius: 9px; background: var(--accent-gradient);
    display: grid; place-items: center; font-weight: 900; font-size: 15px; color: #fff;
  }
  .brand small { display: block; font-size: 11px; color: var(--text-faint); font-weight: 400; margin-top: 1px; }
  .mock-tag {
    margin-left: auto; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--warn); background: var(--warn-bg); border: 1px solid rgba(251,191,36,0.25);
    padding: 5px 10px; border-radius: 999px;
  }

  nav.top-nav { display: flex; gap: 6px; margin-bottom: 20px; overflow-x: auto; padding-bottom: 4px; }
  nav.top-nav button {
    flex: none; color: var(--text-dim); background: transparent; border: 1px solid transparent;
    border-radius: 999px; padding: 7px 16px; font-size: 13px; font-weight: 500;
  }
  nav.top-nav button.active { background: var(--accent-gradient); color: #fff; }
  nav.top-nav button:hover:not(.active) { color: var(--text); }
  nav.top-nav .spacer { flex: 1; }
  nav.top-nav .frame-tab { border-color: var(--border); }

  /* Controls */
  button, input, textarea, select {
    font-family: inherit; font-size: 13px; background: var(--card-2); color: var(--text);
    border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px;
  }
  textarea { resize: vertical; line-height: 1.45; }
  input::placeholder, textarea::placeholder { color: var(--text-faint); }
  button { cursor: pointer; font-weight: 500; }
  button:hover { border-color: var(--border-strong); }
  button.primary { background: var(--accent-gradient); border: none; color: #fff; }
  button.primary:hover { filter: brightness(1.08); }
  button:disabled { opacity: 0.4; cursor: not-allowed; filter: none; }
  :focus-visible { outline: 2px solid var(--accent-a); outline-offset: 2px; }
  select { padding-right: 8px; }

  /* Layout blocks */
  .stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
  .stat { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 14px 18px; box-shadow: var(--shadow-card); }
  .stat .label { font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
  .stat .value { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
  .stat .sub { font-size: 11px; color: var(--text-faint); margin-top: 2px; }

  .card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; box-shadow: var(--shadow-card); margin-bottom: 20px; }
  .card.flat { box-shadow: none; }
  .card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
  .card-head h2 { margin: 0; }

  .table-scroll { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 4px 16px; box-shadow: var(--shadow-card); margin-bottom: 20px; }
  table { width: 100%; border-collapse: collapse; font-size: 13px; }
  th, td { text-align: left; padding: 11px 10px; white-space: nowrap; vertical-align: middle; }
  th { color: var(--text-dim); font-weight: 500; font-size: 12px; border-bottom: 1px solid var(--border); }
  td { border-bottom: 1px solid var(--border); }
  tbody tr:last-child td { border-bottom: none; }
  tbody tr:hover { background: rgba(255,255,255,0.02); }
  td.r, th.r { text-align: right; }

  /* Pills and chips */
  .pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
  .pill.pos { background: var(--pos-bg); color: var(--positive); }
  .pill.neg { background: var(--neg-bg); color: var(--negative); }
  .pill.warn { background: var(--warn-bg); color: var(--warn); }
  .pill.info { background: var(--info-bg); color: #8fabff; }
  .pill.mute { background: rgba(255,255,255,0.05); color: var(--text-dim); }
  .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
  .chain { font-size: 10px; font-weight: 700; letter-spacing: 0.05em; padding: 2px 7px; border-radius: 6px; }
  .chain.sol { background: rgba(139,92,246,0.18); color: #b79bff; }
  .chain.rhc { background: rgba(76,124,255,0.18); color: #8fabff; }
  .side-buy { color: var(--positive); font-weight: 500; }
  .side-sell { color: var(--negative); font-weight: 500; }

  button.q-btn { background: var(--warn-bg); color: var(--warn); border: 1px solid rgba(251,191,36,0.3); border-radius: 999px; padding: 3px 11px; font-size: 11px; }
  button.q-btn:hover { border-color: var(--warn); }

  /* Tooltip */
  .tip { position: relative; display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border-strong); color: var(--text-dim); font-size: 10px; font-weight: 700; cursor: help; vertical-align: middle; margin-left: 6px; background: transparent; padding: 0; }
  .tip .tip-body {
    position: absolute; z-index: 30; top: calc(100% + 8px); left: -8px; width: min(340px, 78vw);
    background: #1d2340; border: 1px solid var(--border-strong); border-radius: 12px; padding: 12px 14px;
    color: var(--text); font-size: 12px; font-weight: 400; line-height: 1.5; text-align: left;
    box-shadow: 0 12px 32px rgba(0,0,0,0.5); display: none;
  }
  .tip:hover .tip-body, .tip:focus .tip-body, .tip:focus-within .tip-body { display: block; }

  /* Forms */
  .form-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
  .form-row > label { width: 230px; flex-shrink: 0; font-size: 13px; color: var(--text-dim); }
  .form-row > input, .form-row > select, .form-row > textarea { flex: 1; min-width: 0; }
  .form-row .suffix { color: var(--text-faint); font-size: 12px; }
  .field-label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
  .field { margin-bottom: 14px; }
  .field textarea, .field input, .field select { width: 100%; }
  .hint-text { font-size: 12px; color: var(--text-faint); margin-top: 8px; line-height: 1.45; }
  .save-confirm { margin-left: 12px; color: var(--positive); font-size: 13px; }

  .status-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; font-weight: 500; margin-bottom: 16px; }
  .status-line.incomplete { color: var(--negative); }
  .status-line.complete { color: var(--positive); }
  .progress { flex: 1; min-width: 120px; max-width: 260px; height: 6px; border-radius: 99px; background: rgba(255,255,255,0.08); overflow: hidden; }
  .progress > i { display: block; height: 100%; background: var(--accent-gradient); border-radius: 99px; }

  /* Pre-trade table inputs */
  .coin-table input, .coin-table select, .coin-table textarea { width: 100%; background: transparent; border-color: transparent; padding: 6px 8px; }
  .coin-table input:hover, .coin-table textarea:hover, .coin-table select:hover { border-color: var(--border); }
  .coin-table input:focus, .coin-table textarea:focus, .coin-table select:focus { background: var(--card-2); border-color: var(--border-strong); }
  .coin-table textarea { resize: none; height: 34px; overflow: hidden; }
  .coin-table td { padding: 5px 6px; }
  .coin-table td:first-child { color: var(--text-faint); width: 28px; }
  .coin-table select.w { color: var(--positive); }
  .coin-table select.l { color: var(--negative); }
  .coin-table select option { color: var(--text); }

  /* Sub tabs, accordion, volume grid */
  .sub-tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
  .sub-tab { background: transparent; border: 1px solid var(--border); color: var(--text-dim); padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; }
  .sub-tab.active { background: var(--card-2); border-color: var(--border-strong); color: var(--text); }
  .sub-tab:hover:not(.active) { color: var(--text); }
  .sub-tabs .spacer { flex: 1; }
  .mv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; margin-bottom: 20px; }
  .mv-grid .field { margin: 0; }
  .mv-grid input { width: 100%; }
  .mv-rate { font-size: 20px; font-weight: 700; padding-top: 4px; }
  .acc { background: var(--card); border: 1px solid var(--border); border-radius: 16px; margin-bottom: 10px; box-shadow: var(--shadow-card); }
  .acc summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-radius: 16px; }
  .acc summary::-webkit-details-marker { display: none; }
  .acc summary:hover { background: rgba(255,255,255,0.02); }
  .acc .caret { color: var(--text-dim); width: 12px; transition: transform .15s; display: inline-block; }
  .acc[open] .caret { transform: rotate(90deg); }
  .acc .a-date { font-weight: 700; min-width: 96px; }
  .acc .a-x { color: var(--text-dim); font-style: italic; flex: 1; min-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .acc-body { padding: 4px 18px 18px; }
  .acc-body .mv-view { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 16px; margin: 6px 0 16px; }
  .acc-body .mv-view div { background: var(--card-2); border-radius: 10px; padding: 9px 12px; }
  .acc-body .mv-view span { display: block; font-size: 11px; color: var(--text-faint); margin-bottom: 2px; }
  .acc-body .x-view { font-size: 13px; color: var(--text); line-height: 1.5; margin-bottom: 14px; background: var(--card-2); border-radius: 10px; padding: 10px 12px; }
  .acc-body table td { white-space: normal; min-width: 90px; vertical-align: top; }
  .stat-btn { display: block; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 14px 18px; box-shadow: var(--shadow-card); cursor: pointer; font-weight: 400; }
  .stat-btn:hover { border-color: var(--accent-a); }
  .stat-btn .label { font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
  .stat-btn .value { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
  .stat-btn .sub { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
  .stat-btn .more { font-size: 11px; color: #8fabff; margin-top: 4px; }


  /* Modal */
  .scrim { position: fixed; inset: 0; background: rgba(4,6,14,0.66); display: grid; place-items: center; padding: 16px; z-index: 50; backdrop-filter: blur(3px); }
  .modal { width: min(480px, 100%); max-height: 100%; overflow-y: auto; background: var(--card); border: 1px solid var(--border-strong); border-radius: 18px; padding: 22px; box-shadow: 0 24px 64px rgba(0,0,0,0.6); }
  .modal h2 { margin-bottom: 4px; }
  .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
  .range-row { display: flex; align-items: center; gap: 12px; }
  .range-row input[type=range] { flex: 1; padding: 0; accent-color: var(--accent-a); background: transparent; border: none; }
  .range-row output { min-width: 44px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

  .two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; align-items: start; }
  .two-col > .card { margin-bottom: 0; }
  .empty { color: var(--text-faint); font-size: 13px; padding: 12px 0; }
  .rule-cell { min-width: 120px; }
  .share-btn { padding: 4px 10px; font-size: 12px; }

  /* Web app only: login, top bar user, messages */
  .login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
  .login-card { width: min(380px, 100%); }
  .login-card .brand { margin-bottom: 20px; }
  .msg-error { color: var(--negative); font-size: 13px; margin-top: 10px; }
  .topbar .spacer { flex: 1; }
  .topbar .who { font-size: 12px; color: var(--text-faint); }
  .cell-clip { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
  .tx-link { color: #8fabff; text-decoration: none; }
  .tx-link:hover { text-decoration: underline; }
  a.ca { color: var(--text-faint); text-decoration: none; }
  a.ca:hover { color: var(--text); text-decoration: underline; }
  button.linkish { background: none; border: none; color: #8fabff; padding: 0; font-size: 12px; }
  [hidden] { display: none !important; }

  @media (max-width: 800px) {
    .form-row { flex-direction: column; align-items: stretch; gap: 6px; }
    .form-row > label { width: auto; }
  }
  @media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
