/* Signa web: los MISMOS tokens que la app de escritorio (signa/app/theme.py) y la de Android (ui/Theme.kt). */
:root {
  --bg: #f6f5f2; --side: #efede8; --card: #ffffff; --sub: #faf9f7; --line: #e4e1da; --line2: #cfcbc2;
  --tx: #1d1c1a; --mu: #625e56; --ac: #2455c3; --acbg: #e9eefa; --on: #ffffff;
  --good: #17784a; --goodbg: #e3f2e9; --bad: #b4361f; --badbg: #fbe8e3; --warn: #8a5100; --warnbg: #fbefd9;
  --bid: #1f6fd1; --ask: #d23b2f; --brand: #2455c3;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131518; --side: #0e1013; --card: #1a1d22; --sub: #16191d; --line: #2a2e35; --line2: #3a3f48;
    --tx: #e4e6e9; --mu: #959ca6; --ac: #7ea5ff; --acbg: #1d2842; --on: #0c1220;
    --good: #4cbb88; --goodbg: #142a1f; --bad: #f2806e; --badbg: #361b16; --warn: #e6ad4d; --warnbg: #33270f;
    --bid: #5a9cff; --ask: #ff6f61;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131518; --side: #0e1013; --card: #1a1d22; --sub: #16191d; --line: #2a2e35; --line2: #3a3f48;
  --tx: #e4e6e9; --mu: #959ca6; --ac: #7ea5ff; --acbg: #1d2842; --on: #0c1220;
  --good: #4cbb88; --goodbg: #142a1f; --bad: #f2806e; --badbg: #361b16; --warn: #e6ad4d; --warnbg: #33270f;
  --bid: #5a9cff; --ask: #ff6f61;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--tx); }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%; overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* --- estructura ---------------------------------------------------------------------------------- */
.top {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--line);
}
.top h1 { font-size: 20px; font-weight: 600; margin: 0; flex: 1; }
.dot { font-size: 13px; }
main { padding: 16px 16px calc(env(safe-area-inset-bottom) + 84px); max-width: 720px; margin: 0 auto; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack.big { gap: 16px; }
nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; display: flex; background: var(--side);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs button {
  flex: 1; background: none; border: 0; padding: 8px 0 7px; display: flex; flex-direction: column;
  align-items: center; gap: 3px; color: var(--mu); font-size: 11px;
}
nav.tabs button svg { width: 22px; height: 22px; padding: 2px 12px; box-sizing: content-box; border-radius: 14px; }
nav.tabs button.on { color: var(--tx); }
nav.tabs button.on svg { background: var(--acbg); color: var(--ac); }

/* --- piezas -------------------------------------------------------------------------------------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.card.click { cursor: pointer; }
.row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fill { flex: 1; min-width: 0; }
.right { text-align: right; }
.sec { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--mu); font-weight: 600;
       margin: 4px 2px 8px; }
.h2 { font-size: 20px; font-weight: 600; }
.name { font-weight: 600; }
.small { font-size: 13px; color: var(--mu); }
.body { overflow-wrap: anywhere; }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-good { color: var(--good); } .t-bad { color: var(--bad); } .t-warn { color: var(--warn); }
.t-accent { color: var(--ac); } .t-mu { color: var(--mu); } .t-tx { color: var(--tx); }
.t-bid { color: var(--bid); } .t-ask { color: var(--ask); }
.divider { height: 1px; background: var(--line); margin: 2px 0; }

.tag {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px;
  border-radius: 999px; white-space: nowrap; background: var(--sub); color: var(--mu);
}
.tag.good { background: var(--goodbg); color: var(--good); } .tag.bad { background: var(--badbg); color: var(--bad); }
.tag.warn { background: var(--warnbg); color: var(--warn); } .tag.accent { background: var(--acbg); color: var(--ac); }
.chip { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap;
        max-width: 60%; overflow: hidden; text-overflow: ellipsis; }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-width: 0; }
.kpi .v { font-size: 22px; font-weight: 600; margin: 2px 0; }

.btn {
  border: 1px solid var(--line2); background: var(--card); border-radius: 10px; padding: 10px 14px;
  font-weight: 600; cursor: pointer; text-align: center; min-height: 42px;
}
.btn:active { opacity: .75; }
.btn:disabled { opacity: .5; }
.btn.primary { background: var(--ac); border-color: var(--ac); color: var(--on); }
.btn.buy { background: var(--good); border-color: var(--good); color: var(--on); }
.btn.sell, .btn.danger { background: var(--bad); border-color: var(--bad); color: var(--on); }
.btn.quiet { background: none; border-color: transparent; color: var(--ac); padding: 6px 8px; min-height: 0; }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: 14px; }
.btn.wide { width: 100%; }
.btns { display: flex; gap: 10px; }
.btns > * { flex: 1; }

.seg { display: flex; background: var(--sub); border: 1px solid var(--line); border-radius: 10px; padding: 3px;
       gap: 3px; overflow-x: auto; }
.seg button { flex: 1; border: 0; background: none; border-radius: 8px; padding: 7px 10px; white-space: nowrap;
              color: var(--mu); font-size: 14px; font-weight: 600; }
.seg button.on { background: var(--card); color: var(--tx); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.opts { display: flex; gap: 6px; flex-wrap: wrap; }
.opts button { border: 1px solid var(--line2); background: var(--card); border-radius: 8px; padding: 7px 12px;
               font-weight: 600; font-size: 14px; }
.opts button.on { background: var(--acbg); border-color: var(--ac); color: var(--ac); }

input.field, select.field {
  width: 100%; border: 1px solid var(--line2); background: var(--card); border-radius: 10px; padding: 10px 12px;
  font-size: 16px; /* 16 px: iOS no hace zoom al escribir */ min-width: 0;
}
input.field:focus, select.field:focus { outline: 2px solid var(--ac); outline-offset: -1px; }
input.code { font-size: 24px; letter-spacing: 6px; text-align: center; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line2); border-radius: 10px;
           overflow: hidden; }
.stepper button { border: 0; background: var(--sub); width: 38px; height: 38px; font-size: 20px; }
.stepper span { min-width: 42px; text-align: center; font-weight: 600; }

.notice { border-radius: 10px; padding: 10px 12px; font-size: 14px; background: var(--warnbg); color: var(--warn); }
.notice.good { background: var(--goodbg); color: var(--good); } .notice.bad { background: var(--badbg); color: var(--bad); }
.empty { text-align: center; color: var(--mu); padding: 28px 12px; }
.empty b { display: block; color: var(--tx); margin-bottom: 6px; font-size: 16px; }
.timeline { background: var(--sub); border-radius: 8px; padding: 10px; display: flex; flex-direction: column;
            gap: 8px; user-select: text; -webkit-user-select: text; }
.prices { display: flex; align-items: flex-end; gap: 22px; }

/* --- hoja «Trade» y diálogos --------------------------------------------------------------------- */
.shade { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.45); display: flex;
         align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--bg); width: 100%; max-width: 720px; max-height: 92vh; overflow-y: auto;
  border-radius: 16px 16px 0 0; padding: 8px 16px calc(env(safe-area-inset-bottom) + 24px);
  -webkit-overflow-scrolling: touch;
}
.grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line2); margin: 4px auto 12px; }
.dialog { background: var(--card); border-radius: 14px; padding: 18px; margin: 0 16px auto; align-self: center;
          max-width: 420px; width: 100%; display: flex; flex-direction: column; gap: 12px; white-space: pre-line; }
.dialog .h2 { font-size: 18px; }

/* --- enlace -------------------------------------------------------------------------------------- */
.pair { max-width: 480px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 28px) 20px 40px;
        display: flex; flex-direction: column; gap: 22px; }
.logo { width: 36px; height: 36px; border-radius: 9px; background: var(--brand); display: inline-flex;
        align-items: center; justify-content: center; flex: none; }
.logo svg { width: 36px; height: 36px; }
.brand { font-size: 26px; font-weight: 600; }
.h1 { font-size: 26px; font-weight: 700; margin: 0; }
ol.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
