/* CERRAHI 069D — Binance Bot Trade mobile console (navy / white identity) */
:root {
  --navy-950: #071428;
  --navy-900: #0b1f3a;
  --navy-800: #122b4f;
  --navy-700: #1a3a66;
  --navy-600: #244a7a;
  --surface: #15345c;
  --surface-2: #1c4270;
  --line: rgba(255, 255, 255, 0.12);
  --text: #ffffff;
  --muted: #b7c5d9;
  --accent: #6eb6ff;
  --accent-soft: rgba(110, 182, 255, 0.16);
  --ok: #2fce8a;
  --warn: #f0a24a;
  --bad: #ef5b6a;
  --shadow: 0 10px 28px rgba(3, 12, 28, 0.35);
  --radius: 16px;
  --radius-sm: 12px;
  --pad: 16px;
  --nav-h: 72px;
  --touch: 48px;
  --sans: "Segoe UI", "SF Pro Text", "Helvetica Neue", sans-serif;
  --mono: "Cascadia Mono", "Consolas", monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  overflow-x: hidden;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.4;
  background:
    radial-gradient(900px 420px at 0% -10%, #1a4a86 0%, transparent 55%),
    linear-gradient(180deg, var(--navy-900) 0%, var(--navy-950) 100%);
}

body {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 14px calc(var(--nav-h) + 18px);
}

body.login-body {
  max-width: none;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

a { color: var(--accent); }

/* Header */
.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: 0 -14px;
  padding: 14px 14px 12px;
  backdrop-filter: blur(14px);
  background: rgba(11, 31, 58, 0.92);
  border-bottom: 1px solid var(--line);
}
.appbar h1 {
  margin: 0;
  font-size: 1.28rem;
  letter-spacing: 0.04em;
  font-weight: 750;
}
.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.meta-sub {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}
.header-actions button {
  min-height: 36px;
  min-width: 64px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem;
}

.offline-banner {
  display: none;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(240, 162, 74, 0.15);
  color: #ffd7a8;
  border: 1px solid rgba(240, 162, 74, 0.35);
  font-size: 0.85rem;
}
.offline-banner.show { display: block; }

/* Views */
.view { display: none; padding-top: 4px; }
.view.active { display: block; }

.page-title {
  margin: 16px 0 10px;
  font-size: 1.15rem;
  font-weight: 700;
}
.page-sub {
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 0.88rem;
}

/* Cards / sections */
.card, section.panel {
  margin-top: 12px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--pad);
  box-shadow: var(--shadow);
}
.card h2, section.panel h2 {
  margin: 0 0 12px;
  font-size: 0.78rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.summary-tile {
  background: rgba(7, 20, 40, 0.35);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  min-height: 78px;
}
.summary-tile .k {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.summary-tile .v {
  margin-top: 6px;
  font-size: 1.05rem;
  font-weight: 700;
  word-break: break-word;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
}
.kv .k {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kv .v {
  margin-top: 2px;
  font-size: 0.95rem;
  word-break: break-word;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(7, 20, 40, 0.28);
  font-size: 0.78rem;
}
.chip .lab { color: var(--muted); }
.chip .val { font-weight: 650; }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid var(--line);
}
.pill.ok { color: var(--ok); border-color: rgba(47,206,138,0.45); background: rgba(47,206,138,0.12); }
.pill.warn { color: var(--warn); border-color: rgba(240,162,74,0.45); background: rgba(240,162,74,0.12); }
.pill.bad { color: #ffb3bc; border-color: rgba(239,91,106,0.45); background: rgba(239,91,106,0.14); }
.pill.muted { color: var(--muted); }

.pos-card, .opp-card, .action-card, .profile-card, .asset-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 8px;
  background: rgba(7, 20, 40, 0.28);
}
.pos-card h3, .opp-card h3, .action-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}
.pos-card .row, .opp-card .row, .asset-row .row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.88rem;
  padding: 3px 0;
}
.pos-card .row span:first-child,
.opp-card .row span:first-child,
.asset-row .row span:first-child { color: var(--muted); }
.pos-up { color: var(--ok); }
.pos-down { color: #ffb3bc; }

.reason {
  margin-top: 10px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 10px 10px 0;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.horizon-detail { display: none; margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 8px; }
.horizon-detail.open { display: block; }
.horizon-row {
  display: grid;
  grid-template-columns: 48px 1fr 1fr 1fr;
  gap: 4px;
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 3px 0;
  color: var(--muted);
}
.horizon-row.head { color: var(--text); font-weight: 650; }

.chart { width: 100%; height: 88px; margin-top: 8px; display: block; }
.chart-empty { color: var(--muted); font-size: 0.85rem; padding: 12px 0; }

.controls, .stack { display: flex; flex-direction: column; gap: 10px; }
.controls button, .btn, .action-card button, .tabs button, .profile-card button {
  appearance: none;
  min-height: var(--touch);
  border: 1px solid var(--line);
  background: rgba(7, 20, 40, 0.35);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.95rem;
  font-weight: 650;
  width: 100%;
  text-align: center;
}
.controls button.danger, .btn.danger { border-color: rgba(239,91,106,0.5); color: #ffc0c7; background: rgba(239,91,106,0.12); }
.controls button.primary, .btn.primary { border-color: rgba(47,206,138,0.5); color: #baf8d8; background: rgba(47,206,138,0.12); }
.controls button:disabled, .btn:disabled, .action-card.disabled {
  opacity: 0.55;
}
.action-card.center { text-align: center; }
.action-card .soon {
  display: inline-block;
  margin-top: 8px;
  color: var(--warn);
  font-size: 0.82rem;
  font-weight: 650;
}
.action-card.trade-primary {
  border-color: rgba(110,182,255,0.45);
  background: linear-gradient(180deg, rgba(110,182,255,0.18), rgba(21,52,92,0.9));
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.tabs button {
  width: auto;
  flex: 0 0 auto;
  min-width: 96px;
  padding: 10px 12px;
  font-size: 0.82rem;
}
.tabs button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #fff;
}

.empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 8px 0;
}

.asset-row {
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.asset-row:active { border-color: var(--accent); background: rgba(110,182,255,0.1); }
.asset-row .coin {
  font-weight: 750;
  margin-bottom: 4px;
}

.profile-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: var(--touch);
  cursor: pointer;
}
.profile-card .left { text-align: left; }
.profile-card .left .t { font-weight: 700; }
.profile-card .left .s { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.profile-card .chev { color: var(--muted); }

/* Bottom nav */
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(720px, 100%);
  height: var(--nav-h);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  background: rgba(7, 20, 40, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
  z-index: 40;
}
.bottom-nav button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  min-height: 56px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  padding: 6px 2px;
}
.bottom-nav button .ico {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  border: 1px solid transparent;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  line-height: 1;
}
.bottom-nav button.active { color: #fff; }
.bottom-nav button.active .ico {
  background: var(--accent-soft);
  border-color: rgba(110,182,255,0.35);
  color: var(--accent);
}
.bottom-nav button.nav-trade .ico {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(110,182,255,0.18);
  border-color: rgba(110,182,255,0.35);
  color: #fff;
  font-weight: 800;
}
.bottom-nav button.nav-trade.active .ico {
  background: var(--accent);
  color: var(--navy-950);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 10, 22, 0.66);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
.modal.open { display: flex; }
.modal .sheet {
  width: min(480px, 100%);
  background: var(--navy-800);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 8px; }
.modal p { margin: 0 0 14px; color: var(--muted); }
.modal .actions { display: flex; gap: 8px; }
.modal .actions button { flex: 1; }

/* Login */
.login-shell { width: min(420px, 100%); }
.login-brand h1 {
  margin: 0;
  font-size: 1.7rem;
  letter-spacing: 0.05em;
}
.login-brand p {
  margin: 8px 0 18px;
  color: var(--muted);
}
.login-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.login-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.login-card input {
  border: 1px solid var(--line);
  background: rgba(7, 20, 40, 0.55);
  color: var(--text);
  border-radius: 12px;
  padding: 14px 12px;
  font-size: 1rem;
  min-height: var(--touch);
}
.login-card button {
  margin-top: 4px;
  border: 1px solid rgba(110,182,255,0.45);
  background: linear-gradient(180deg, #3d7ec4, #2a5f9a);
  color: #fff;
  border-radius: 14px;
  padding: 14px;
  font-weight: 750;
  font-size: 1rem;
  min-height: var(--touch);
}
.login-card button:disabled { opacity: 0.5; }
.login-error { margin: 0; color: #ffb3bc; font-size: 0.88rem; }
.login-footnote {
  margin-top: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
}

@media (min-width: 720px) {
  body { max-width: 980px; }
  .desk-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .desk-grid .span2 { grid-column: 1 / -1; }
}
