:root {
  --bg: #0f1115; --card: #171b22; --line: #262c36;
  --text: #e8ecf1; --muted: #9aa3b2; --accent: #6ea8fe; --good: #4ade80;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 520px; margin: 0 auto; padding: 16px 16px 48px; }
.hidden { display: none !important; }
.view { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
}
.card.hero { margin-top: 15vh; text-align: center; }
.logo { font-size: 32px; font-weight: 700; letter-spacing: -0.5px; }
.logo.small { font-size: 20px; }
.sub { color: var(--muted); margin: 8px 0 18px; }
h2 { font-size: 16px; margin: 0 0 12px; }

.field { display: block; text-align: left; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 12px; border-radius: 10px; font-size: 16px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.field.inline { margin: 0; flex: 1; }

.btn {
  display: inline-block; padding: 12px 18px; border-radius: 10px; font-size: 15px;
  font-weight: 600; border: 1px solid var(--line); background: #222936; color: var(--text);
  cursor: pointer; width: 100%;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0b1220; }
.btn:disabled { opacity: 0.5; cursor: default; }
.linklike { background: none; border: none; color: var(--accent); font-size: 13px; cursor: pointer; padding: 0; }

.msg { min-height: 20px; font-size: 14px; color: var(--muted); margin: 12px 0 0; }
.msg.ok { color: var(--good); }
.msg.err { color: #f87171; }

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.userbox { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.stat-value { font-size: 28px; font-weight: 700; }
.fineprint { font-size: 13px; color: var(--muted); margin: 8px 0 0; line-height: 1.5; }
.badge {
  font-size: 11px; font-weight: 600; color: #0a7d44;
  background: #e6f6ec; border-radius: 999px; padding: 2px 8px;
  margin-left: 6px; white-space: nowrap;
}

.packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.btn.pack { display: flex; flex-direction: column; gap: 2px; padding: 14px 8px; }
.btn.pack span { font-size: 12px; font-weight: 400; color: var(--muted); }

.row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.row:last-child { margin-bottom: 0; }
.row-title { font-weight: 600; font-size: 15px; }

.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; border-radius: 26px; background: #2c3442;
  transition: .2s; cursor: pointer;
}
.slider:before {
  content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider:before { transform: translateX(20px); }

.tx-list { list-style: none; margin: 0; padding: 0; }
.tx-list li {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.tx-list li:last-child { border-bottom: none; }
.tx-kind { color: var(--muted); font-size: 12px; display: block; }
.tx-amt.pos { color: var(--good); font-weight: 600; }
.tx-amt.neg { color: var(--text); font-weight: 600; }

/* tabs */
.tabs {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-bottom: 14px;
}
.tab {
  padding: 10px 0; border-radius: 10px; font-size: 14px; font-weight: 600;
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  cursor: pointer;
}
.tab.active { background: #222936; color: var(--text); border-color: var(--accent); }

/* badges */
.badge.b-ok { color: #0a7d44; background: #e6f6ec; }
.badge.b-err { color: #b42318; background: #fdecec; }
.badge.b-warn { color: #92580a; background: #fdf3e3; }
.badge.b-muted { color: var(--muted); background: #2c3442; }

/* jobs */
.job-card .job-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.job-actions { display: flex; gap: 8px; margin-top: 12px; }
.btn.small { width: auto; padding: 8px 14px; font-size: 13px; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: #5b2b28; color: #f87171; background: transparent; }
.run-detail { white-space: pre-wrap; word-break: break-word; }
.run-history { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.email-item { border-bottom: 1px solid var(--line); padding: 8px 0; font-size: 14px; }
.email-item summary { cursor: pointer; list-style: none; }
.email-item summary::-webkit-details-marker { display: none; }
.email-body {
  white-space: pre-wrap; word-break: break-word; font-size: 13px;
  background: var(--bg); border-radius: 8px; padding: 10px; margin: 8px 0 0;
  font-family: inherit; color: var(--text); max-height: 300px; overflow: auto;
}
.run-item { border-bottom: 1px solid var(--line); padding: 8px 0; font-size: 14px; }
.run-item:last-child { border-bottom: none; }

/* links */
.link-filters { display: flex; flex-direction: column; gap: 10px; }
.link-filters input[type="search"] {
  width: 100%; padding: 12px; border-radius: 10px; font-size: 16px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.link-dates { display: flex; gap: 10px; }
.link-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.link-main { flex: 1; min-width: 0; }
.link-main a { color: var(--accent); font-weight: 600; font-size: 15px; word-break: break-word; }

/* calls */
.call-card { cursor: pointer; }
.call-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.call-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.call-sum { font-size: 14px; margin: 10px 0 0; line-height: 1.5; }
.call-detail { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; cursor: default; }
.call-detail h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin: 16px 0 8px; }
.call-detail h3:first-child { margin-top: 0; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: #222936; border: 1px solid var(--line); color: var(--text);
}
.blist { list-style: none; margin: 0; padding: 0; }
.blist li { font-size: 14px; padding: 8px 0; border-bottom: 1px solid var(--line); line-height: 1.5; }
.blist li:last-child { border-bottom: none; }
.action-item { display: flex; align-items: flex-start; gap: 10px; }
.action-item input[type="checkbox"] { width: 20px; height: 20px; margin: 1px 0 0; flex-shrink: 0; accent-color: var(--accent); }
.action-item.done .ai-text { text-decoration: line-through; color: var(--muted); }
.ai-owner { font-size: 12px; color: var(--muted); }
.transcript {
  max-height: 320px; overflow-y: auto; font-size: 13.5px; line-height: 1.55;
  background: var(--bg); border-radius: 10px; padding: 12px;
}
.tline { margin-bottom: 10px; }
.tline:last-child { margin-bottom: 0; }
.tline .who { font-weight: 700; font-size: 12px; color: var(--muted); display: block; margin-bottom: 2px; }
.tline.bot .who { color: var(--accent); }
audio { width: 100%; margin-top: 6px; }
.score-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; text-align: center; }
.score-grid .sc { background: var(--bg); border-radius: 8px; padding: 8px 4px; }
.score-grid .sv { font-size: 18px; font-weight: 700; }
.score-grid .sl { font-size: 10px; color: var(--muted); margin-top: 2px; }
.table-wrap { overflow-x: auto; margin-top: 10px; }
.data-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.data-table th, .data-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table thead th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); border-bottom: 2px solid var(--line); }
.data-table tbody tr:last-child td { border-bottom: none; }
/* My Games tab */
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-btn.active { background: var(--accent, #1a73e8); color: #fff; }
.moves { font-family: ui-monospace, monospace; line-height: 1.7; white-space: normal; }

/* ---- Trips tab (shared itinerary UI) ---- */
.trip-card { cursor: pointer; transition: border-color .15s; }
.trip-card:hover { border-color: var(--accent); }
.trip-title { font-size: 17px; font-weight: 700; letter-spacing: -0.2px; }
.trip-meta { color: var(--muted); font-size: 13.5px; margin-top: 6px; line-height: 1.5; }
.chips { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.chip {
  font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: #222936; color: var(--text);
  white-space: nowrap;
}
.chip.active { color: var(--good); }
.chip.cancelled { color: #f87171; }
.chip.draft { color: var(--muted); }
#trip-frame { width: 100%; height: 70vh; min-height: 480px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.btn-row .btn { width: auto; flex: 1; min-width: 150px; }
.trips-empty { text-align: center; color: var(--muted); padding: 48px 20px; }
