/* Subs — phone-first. Everything sized for a thumb, nothing for a mouse. */

:root {
  --bg:      #0d0f14;
  --card:    #161a22;
  --card2:   #1d222c;
  --line:    #262d3a;
  --ink:     #e8ecf3;
  --dim:     #8e98ab;
  --accent:  #5b9cff;
  --green:   #35c07a;
  --amber:   #e5a13a;
  --red:     #e5544a;
  --tab-h:   58px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  overscroll-behavior-y: none;
}

/* ── layout ─────────────────────────────────────────────────────────── */

#views { height: 100%; }

.view { display: flex; flex-direction: column; height: 100%; }
.view[hidden] { display: none; }

.hd {
  padding: max(env(safe-area-inset-top), 12px) 20px 12px;
  border-bottom: 1px solid var(--line);
}
.hd h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.hd .sub { margin: 4px 0 0; color: var(--dim); font-size: 14px; }

.body {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(var(--tab-h) + env(safe-area-inset-bottom) + 24px);
}

/* ── bottom tab bar ─────────────────────────────────────────────────── */

#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; background: rgba(13,15,20,.94);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabs button {
  flex: 1; height: var(--tab-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; background: none; border: 0; color: var(--dim);
  font: 500 11px/1 inherit; cursor: pointer;
}
#tabs button span { font-size: 19px; line-height: 1; }
#tabs button.on { color: var(--accent); }

/* ── totals ─────────────────────────────────────────────────────────── */

.totals { display: flex; gap: 28px; margin-top: 10px; }
.totals div { display: flex; flex-direction: column; }
.totals b { font-size: 24px; font-weight: 650; letter-spacing: -.02em; }
.totals span { color: var(--dim); font-size: 12px; }

/* ── cards & rows ───────────────────────────────────────────────────── */

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px; margin-bottom: 14px;
}
.card h2 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }

.sec { margin: 4px 0 8px; color: var(--dim); font-size: 12px;
       font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }

.row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 16px; margin-bottom: 10px;
  color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.row:active { background: var(--card2); }
.row .grow { flex: 1; min-width: 0; }
.row .nm { font-weight: 600; display: flex; align-items: center; gap: 7px; }
.row .meta { color: var(--dim); font-size: 13px; margin-top: 2px; }
.row .amt { text-align: right; white-space: nowrap; }
.row .amt b { display: block; font-weight: 600; }
.row .amt span { display: block; color: var(--dim); font-size: 12px; margin-top: 2px; }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.due { background: var(--amber); }
.dot.now { background: var(--red); }

.pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
}
.pill.trial { background: rgba(229,161,58,.16); color: var(--amber); }
.pill.warn  { background: rgba(229,84,74,.16);  color: var(--red); }

.empty { text-align: center; padding: 56px 20px; }
.empty p { margin: 4px 0; }
.dim { color: var(--dim); font-size: 13px; }

/* ── buttons & inputs ───────────────────────────────────────────────── */

button, input, select, textarea {
  font: inherit; color: var(--ink);
}
input, select, textarea {
  width: 100%; background: var(--card2); border: 1px solid var(--line);
  border-radius: 11px; padding: 12px 14px; margin-top: 6px;
}
textarea { resize: vertical; font-size: 13px; font-family: ui-monospace, monospace; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--dim); }

.btn, #exportBtn, #importBtn, #qBtn {
  background: var(--accent); border: 0; border-radius: 11px;
  padding: 13px 18px; font-weight: 600; cursor: pointer; color: #fff;
}
.btn.ghost, #exportBtn, #importBtn {
  background: var(--card2); border: 1px solid var(--line); color: var(--ink);
}
.btn.danger { background: rgba(229,84,74,.14); color: var(--red);
              border: 1px solid rgba(229,84,74,.3); }
.btn.wide { display: block; width: 100%; margin-top: 10px; }
.row2 { display: flex; gap: 10px; }
.row2 > * { flex: 1; }

.fab {
  position: fixed; right: 18px;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 18px);
  width: 56px; height: 56px; border-radius: 50%; border: 0; z-index: 30;
  background: var(--accent); color: #fff; font-size: 30px; line-height: 1;
  box-shadow: 0 6px 20px rgba(0,0,0,.45); cursor: pointer;
}

.searchbar { display: flex; gap: 8px; margin-bottom: 16px; }
.searchbar input { margin-top: 0; }
.searchbar button { flex: none; }

/* ── find results ───────────────────────────────────────────────────── */

.hit { display: flex; gap: 12px; align-items: center; }
.hit img { width: 44px; height: 66px; border-radius: 6px; object-fit: cover;
           background: var(--card2); flex: none; }

.band { border-radius: 14px; padding: 15px 16px; margin-bottom: 12px;
        border: 1px solid var(--line); background: var(--card); }
.band.g { border-color: rgba(53,192,122,.4);  background: rgba(53,192,122,.07); }
.band.a { border-color: rgba(229,161,58,.38); background: rgba(229,161,58,.06); }
.band h3 { margin: 0 0 10px; font-size: 14px; font-weight: 650;
           display: flex; align-items: center; gap: 8px; }
.band.g h3 { color: var(--green); }
.band.a h3 { color: var(--amber); }

.opt { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
       padding: 9px 0; border-top: 1px solid var(--line); }
.opt:first-of-type { border-top: 0; }
.opt .svc { font-weight: 600; }
.opt .kind { color: var(--dim); font-size: 12px; }
.opt a { color: var(--accent); text-decoration: none; font-size: 13px;
         margin-left: auto; font-weight: 600; }
.countries { color: var(--dim); font-size: 12px; width: 100%;
             margin-top: 2px; word-break: break-word; }

.verdict { margin-top: 10px; padding: 10px 12px; border-radius: 10px;
           background: rgba(0,0,0,.28); font-size: 12.5px; color: var(--dim); }
.verdict b { color: var(--ink); font-weight: 600; }

.spinner { text-align: center; color: var(--dim); padding: 32px; }

/* ── cancel steps ───────────────────────────────────────────────────── */

.steps { margin: 10px 0 0; padding-left: 20px; font-size: 13.5px; color: var(--dim); }
.steps li { margin: 6px 0; }
.headline { font-size: 13.5px; font-weight: 600; margin-top: 8px; }
.headline.warn { color: var(--amber); }

/* ── bottom sheet ───────────────────────────────────────────────────── */

.sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; }
.sheet[hidden] { display: none; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.sheet-card {
  position: relative; width: 100%; max-height: 92%; overflow-y: auto;
  background: var(--bg); border-radius: 18px 18px 0 0;
  border-top: 1px solid var(--line);
  padding: 8px 18px calc(env(safe-area-inset-bottom) + 22px);
  animation: up .22s cubic-bezier(.2,.8,.3,1);
}
@keyframes up { from { transform: translateY(14px); opacity: .6 } }
.grip { width: 38px; height: 4px; border-radius: 2px; background: var(--line);
        margin: 4px auto 14px; }
.sheet-card h2 { margin: 0 0 4px; font-size: 21px; letter-spacing: -.01em; }
.sheet-card .sub { color: var(--dim); font-size: 14px; margin: 0 0 16px; }

@media (prefers-reduced-motion: reduce) { .sheet-card { animation: none } }
