*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #080A0F;
  --bg2: #0D1018;
  --bg3: #121620;
  --surface: #181D28;
  --border: rgba(255, 255, 255, 0.08);
  --border2: rgba(255, 255, 255, 0.14);
  --text: #E8EAF0;
  --muted: #7A8099;
  --dim: #3E4459;
  --gold: #C9A84C;
  --gold2: #E8C97A;
  --emerald: #2ECC8A;
  --sapphire: #4A8FE7;
  --danger: #E85D5D;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --font-mono: "DM Mono", ui-monospace, monospace;
  --radius: 14px;
  --tab-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
  touch-action: manipulation;
  overflow-x: hidden;
}
body {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  width: 100%;
  min-width: 0;
  background:
    radial-gradient(120% 80% at 10% -10%, rgba(46, 204, 138, 0.12), transparent 55%),
    radial-gradient(90% 60% at 100% 0%, rgba(201, 168, 76, 0.08), transparent 50%),
    var(--bg);
}
button, input { font: inherit; color: inherit; touch-action: manipulation; }
input { font-size: 16px; -webkit-appearance: none; appearance: none; }
.hidden { display: none !important; }

#view-auth {
  min-height: 100dvh;
  padding: calc(28px + var(--safe-top)) 24px calc(32px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.brand-logo {
  width: 88px;
  height: 88px;
  border-radius: 20px;
  border: 1px solid var(--border2);
  display: block;
  margin-bottom: 16px;
  object-fit: cover;
  background: #000;
}
.brand {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.brand span { color: var(--emerald); }
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-logo {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  object-fit: cover;
  background: #000;
  flex-shrink: 0;
}
.auth-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--emerald);
  margin: 8px 0 12px;
}
.auth-sub { color: var(--muted); font-size: 14px; margin-bottom: 28px; max-width: 300px; }
.field {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  outline: none;
}
.field:focus { border-color: var(--emerald); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 18px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-weight: 600;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; }
.btn-gold { background: var(--gold); color: #0D0A04; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text);
  margin-top: 10px;
}
.btn-danger {
  background: rgba(232, 93, 93, 0.12);
  border: 1px solid rgba(232, 93, 93, 0.35);
  color: var(--danger);
}
.power-wrap {
  display: flex;
  justify-content: center;
  margin: 18px 0 14px;
}
.btn-power {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 4px solid rgba(46, 204, 138, 0.5);
  background: #1aa65a;
  color: #fff;
  font-size: 28px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 0 0 10px rgba(46, 204, 138, 0.12);
}
.btn-power.on {
  background: #c0392b;
  border-color: rgba(232, 93, 93, 0.55);
  box-shadow: 0 0 0 10px rgba(232, 93, 93, 0.12);
}
.link-muted {
  display: block;
  text-align: center;
  margin-top: 16px;
  color: var(--sapphire);
  font-size: 13px;
  text-decoration: none;
}
.auth-err { color: var(--danger); font-size: 13px; margin: 0 0 12px; min-height: 1.2em; }
.install-hint { color: var(--muted); font-size: 12px; text-align: center; margin: 8px 0 18px; line-height: 1.5; }

#view-app { min-height: 100dvh; padding-bottom: calc(var(--tab-h) + var(--safe-bottom) + 12px); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(14px + var(--safe-top)) 16px 12px;
  background: rgba(8, 10, 15, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.topbar-brand {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}
.topbar-title { font-family: var(--font-display); font-size: 22px; font-weight: 500; }
.topbar-meta { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
#view-pick {
  min-height: 100dvh;
  padding: calc(28px + var(--safe-top)) 20px calc(32px + var(--safe-bottom));
}
.pick-list { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.pick-card {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.pick-card > div:first-child { min-width: 0; flex: 1; }
.pick-card:active { transform: scale(0.99); }
.pick-card strong { display: block; font-size: 18px; }
.pick-card span { color: var(--muted); font-size: 12px; }
.pick-card em {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--gold);
}
.pick-card.live { border-color: rgba(232, 93, 93, 0.4); }
.pick-card.live em { color: var(--danger); }
.pick-card .op-right { color: var(--text); font-size: 14px; }
.bot-switch { position: relative; flex-shrink: 0; }
.bot-switch-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: auto;
  max-width: 190px;
  padding: 7px 10px;
  border-radius: 12px;
  border: 1px solid var(--border2);
  background: var(--surface);
  cursor: pointer;
}
.bot-switch-btn strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}
.bot-switch-btn em {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--gold);
}
.bot-switch-btn.live em { color: var(--danger); }
.bot-switch-btn i { color: var(--muted); font-style: normal; font-size: 12px; }
.bot-switch-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 220px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 6px;
  z-index: 25;
}
.bot-switch-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.bot-switch-item:hover,
.bot-switch-item.active { background: rgba(46, 204, 138, 0.1); }
.bot-switch-item strong { display: block; font-size: 13px; }
.bot-switch-item span { color: var(--muted); font-size: 11px; }
.page { padding: 16px 16px 8px; min-width: 0; overflow-x: hidden; }
.greeting { font-family: var(--font-display); font-size: 28px; font-weight: 400; }
.sub { color: var(--muted); font-size: 13px; margin: 4px 0 16px; }
.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.card.wide { grid-column: 1 / -1; }
.card-label { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.card-value { font-family: var(--font-display); font-size: 22px; margin-top: 4px; }
.card-value.green { color: var(--emerald); }
.card-value.gold { color: var(--gold); }
.card-value.red { color: var(--danger); }
.section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 18px 0 8px;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 12px 10px;
  margin-bottom: 14px;
}
.chart-card canvas {
  display: block;
  width: 100%;
  height: 180px;
}
.chart-meta {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  margin-top: 8px;
}
.hoy-story {
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin: 0 0 8px;
}
.ops-list { display: flex; flex-direction: column; gap: 8px; min-width: 0; width: 100%; }
.op-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.op-row > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}
.op-row strong { display: block; font-size: 14px; }
.op-row span {
  color: var(--muted);
  font-size: 12px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.op-right {
  flex: 0 1 auto;
  max-width: 48%;
  min-width: 0;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.op-right em { font-style: normal; font-weight: 600; }
.op-right .up { color: var(--emerald); }
.op-right .down { color: var(--danger); }
.op-right .flat { color: var(--muted); }
.op-row.selected { border-color: rgba(46, 204, 138, 0.45); }
.filter-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.chip {
  width: auto;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.chip.active {
  border-color: rgba(46, 204, 138, 0.55);
  color: var(--emerald);
  background: rgba(46, 204, 138, 0.12);
}
.chip.bot-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 14px;
}
.chip.bot-chip strong { font-size: 13px; font-weight: 600; }
.chip.bot-chip em {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}
.chip.bot-chip.live em { color: var(--danger); }
.chip.bot-chip.active.live {
  border-color: rgba(232, 93, 93, 0.55);
  color: var(--text);
  background: rgba(232, 93, 93, 0.12);
}
.plan-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--emerald);
  border: 1px solid rgba(46, 204, 138, 0.35);
  border-radius: 999px;
  padding: 6px 12px;
  margin: 0 0 14px;
}
.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sync-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold);
}
.sync-dot.on { background: var(--emerald); }
.sync-dot.off { background: var(--danger); }

.tabs {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(480px, 100%);
  height: calc(var(--tab-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(13, 16, 24, 0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(16px);
  z-index: 30;
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; background: none; border: none; color: var(--muted);
  font-size: 10px; font-weight: 500; cursor: pointer; padding: 8px 2px;
}
.tab .ico { font-size: 18px; line-height: 1; }
.tab.active { color: var(--emerald); }

.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.72); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: min(480px, 100%);
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + var(--safe-bottom));
}
.sheet h2 { font-family: var(--font-display); font-size: 26px; font-weight: 400; margin-bottom: 10px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.toast {
  position: fixed; left: 50%;
  bottom: calc(var(--tab-h) + var(--safe-bottom) + 16px);
  transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border2);
  color: var(--text); padding: 10px 16px; border-radius: 999px;
  font-size: 13px; z-index: 50; opacity: 0; pointer-events: none;
  transition: opacity 0.2s; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; }
