/* Plinian go — mobile shell. Builds on core/tokens.css (loaded first). */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button { font-family: inherit; cursor: pointer; color: inherit; }
input, textarea, select { font-family: inherit; }
[x-cloak] { display: none !important; }
::selection { background: var(--accent-soft); }

/* ---------- base components (subset of the desktop design system) ---------- */
.field { width: 100%; background: var(--bg-base); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); padding: 12px 13px; font-size: 16px; }
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 11px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-card); color: var(--text); font-size: 15px; font-weight: 520; min-height: 44px; }
.btn:active { transform: scale(0.99); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-sm); border: 1px solid transparent; background: none; color: var(--text-secondary); }
.icon-btn:active { background: var(--bg-hover); }
.icon-btn svg { width: 20px; height: 20px; stroke-width: 1.8; }
.av { display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent-hover); font-weight: 560; flex: none; }

/* ---------- boot + auth gate ---------- */
.boot-wrap { display: grid; place-items: center; height: 100dvh; }
.auth-wrap { display: grid; place-items: center; min-height: 100dvh; padding: 24px;
  background: radial-gradient(900px 500px at 50% -10%, rgba(59,130,246,0.12), transparent 60%), var(--bg-base); }
.auth-card { width: 100%; max-width: 380px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px 24px calc(28px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 18px; margin-bottom: 4px; }
.auth-brand img { height: 24px; width: auto; }
.auth-sub { color: var(--text-muted); font-size: 13.5px; margin-bottom: 22px; }
.auth-card label { display: block; font-size: 12.5px; color: var(--text-secondary); margin: 14px 0 6px; }
.auth-err { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 16px; }
.logo-dark { display: none; }
:root[data-theme="light"] .logo-white { display: none; }
:root[data-theme="light"] .logo-dark { display: inline-block; }

/* ---------- app shell: topbar / content / tab bar ---------- */
.app { display: grid; grid-template-rows: auto 1fr auto; height: 100dvh; max-width: 560px; margin: 0 auto; background: var(--bg-base); overflow: hidden; }
.m-topbar { display: flex; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top) + 10px) 14px 10px; border-bottom: 1px solid var(--border); background: var(--bg-surface); }
.m-topbar h1 { font-size: 17px; font-weight: 600; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-content { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px; min-height: 0; }

.tabbar { display: flex; align-items: stretch; justify-content: space-around; border-top: 1px solid var(--border); background: var(--bg-surface); padding-bottom: env(safe-area-inset-bottom); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; flex: 1; padding: 9px 0 7px; background: none; border: none; color: var(--text-muted); font-size: 10px; font-weight: 500; min-height: 52px; }
.tab svg { width: 23px; height: 23px; stroke-width: 1.8; }
.tab.on { color: var(--accent); }
.tab-fab { display: flex; align-items: center; justify-content: center; flex: 1; }
.tab-fab .fab { width: 46px; height: 46px; margin-top: -16px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; border: 4px solid var(--bg-base); box-shadow: var(--shadow-md); }
.tab-fab .fab svg { width: 24px; height: 24px; stroke-width: 2.2; }

/* ---------- list cards (records, home) ---------- */
.search-wrap { position: relative; margin-bottom: 14px; }
.search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-muted); pointer-events: none; }
.search-wrap .field { padding-left: 38px; }
.cardwrap { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.section-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 600; margin: 18px 2px 7px; }
.section-label:first-child { margin-top: 2px; }
.listcard { display: flex; align-items: center; gap: 11px; padding: 12px 13px; border-bottom: 1px solid var(--border); width: 100%; text-align: left; background: none; border-left: none; border-right: none; border-top: none; }
.listcard:last-child { border-bottom: none; }
.listcard:active { background: var(--bg-hover); }
.listcard .av { width: 34px; height: 34px; font-size: 12px; }
.lc-main { flex: 1; min-width: 0; }
.lc-title { font-size: 14.5px; font-weight: 520; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-sub { font-size: 12.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.lc-tag { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 5px; padding: 2px 6px; flex: none; }
.lc-chev { color: var(--text-muted); flex: none; }
.lc-chev svg { width: 17px; height: 17px; }

/* ---------- record detail ---------- */
.d-back { display: inline-flex; align-items: center; gap: 6px; background: none; border: none; color: var(--accent); font-size: 14.5px; padding: 4px 0; margin-bottom: 4px; }
.d-back svg { width: 18px; height: 18px; }
.d-head { display: flex; align-items: center; gap: 12px; margin: 6px 0 16px; }
.d-head .av { width: 46px; height: 46px; font-size: 16px; }
.d-title { font-size: 19px; font-weight: 620; line-height: 1.2; }
.d-sub { font-size: 13.5px; color: var(--text-muted); margin-top: 2px; }
.d-actions { display: flex; gap: 8px; margin-bottom: 18px; }
.d-act { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 11px 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-secondary); font-size: 11.5px; text-decoration: none; }
.d-act:active { background: var(--bg-hover); }
.d-act svg { width: 19px; height: 19px; color: var(--accent-hover); stroke-width: 1.8; }
.d-act.off { opacity: 0.4; pointer-events: none; }
.d-rows { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.d-row { display: flex; gap: 12px; padding: 11px 13px; border-bottom: 1px solid var(--border); font-size: 14px; }
.d-row:last-child { border-bottom: none; }
.d-row .k { color: var(--text-muted); flex: none; width: 96px; }
.d-row .v { color: var(--text); flex: 1; min-width: 0; word-break: break-word; }
.d-row .v a { color: var(--accent-hover); text-decoration: none; }
.d-note { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px; margin-top: 12px; font-size: 14px; line-height: 1.6; color: var(--text-secondary); white-space: pre-wrap; }

/* ---------- misc ---------- */
.empty { text-align: center; color: var(--text-muted); padding: 40px 16px; font-size: 14px; }
.stub { text-align: center; color: var(--text-muted); padding: 12vh 24px; }
.stub svg { width: 40px; height: 40px; stroke-width: 1.3; margin-bottom: 14px; color: var(--text-muted); }
.stub h2 { color: var(--text); font-size: 18px; margin: 0 0 6px; font-weight: 600; }
.stub p { font-size: 13.5px; margin: 0; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 6px; }
.kpi { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.kpi-label { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.kpi-val { font-family: var(--mono); font-size: 28px; font-weight: 600; margin-top: 6px; }
.toasts { position: fixed; left: 0; right: 0; bottom: calc(72px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 200; pointer-events: none; padding: 0 16px; }
.toast { background: var(--bg-elevated); border: 1px solid var(--border-strong); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 11px 15px; font-size: 13.5px; box-shadow: var(--shadow-md); max-width: 420px; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

/* ---------- M1: hub, segmented control, match review, tasks, sheet ---------- */
.hub-hi { font-size: 20px; font-weight: 600; margin: 4px 2px 12px; }
.hub-ic { width: 34px; height: 34px; border-radius: 8px; background: var(--bg-elevated); border: 1px solid var(--border); display: grid; place-items: center; flex: none; color: var(--accent-hover); }
.hub-ic svg { width: 18px; height: 18px; stroke-width: 1.8; }
.hub-count { font-family: var(--mono); font-size: 11px; font-weight: 650; background: var(--accent-soft); color: var(--accent); border-radius: 10px; min-width: 22px; height: 20px; padding: 0 6px; display: grid; place-items: center; flex: none; }

.seg { display: flex; gap: 2px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; margin-bottom: 14px; }
.seg button { flex: 1; border: none; background: none; color: var(--text-muted); font-size: 13px; font-weight: 520; padding: 8px 4px; border-radius: 5px; display: flex; align-items: center; justify-content: center; gap: 5px; }
.seg button.on { background: var(--bg-elevated); color: var(--text); box-shadow: var(--shadow-sm); }
.seg-n { font-size: 10px; background: var(--accent); color: #fff; border-radius: 9px; min-width: 16px; padding: 0 4px; font-family: var(--mono); }

.lane-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--lane, var(--text-muted)); flex: none; }
.lane-chip { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 5px; border: 1px solid var(--lane, var(--border-strong)); color: var(--lane, var(--text-secondary)); margin-right: 6px; }

.mr-person { font-size: 13.5px; color: var(--text-secondary); margin: 8px 0 2px; }
.mr-actions { display: flex; gap: 8px; margin: 16px 0 4px; }
.mr-actions .btn { flex: 1; padding: 11px 8px; }
.mr-form { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-top: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { font-size: 11.5px; color: var(--text-secondary); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 14px; padding: 6px 11px; }
.chip.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

.task-row { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--border); }
.task-row:last-child { border-bottom: none; }
.task-check { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--border-strong); background: none; color: transparent; display: grid; place-items: center; flex: none; }
.task-check svg { width: 15px; height: 15px; stroke-width: 2.6; }
.task-check:active { border-color: var(--success); color: var(--success); }
.task-row .lc-main { flex: 1; min-width: 0; }
.task-row .lc-sub { display: flex; gap: 8px; align-items: center; }
.new-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 7px; vertical-align: middle; }
.due { font-size: 11px; flex: none; }
.due.overdue { color: var(--danger); }
.due.soon { color: var(--warn); }
.task-x { background: none; border: none; color: var(--text-muted); flex: none; padding: 6px; }
.task-x svg { width: 16px; height: 16px; }
.task-tap { cursor: pointer; }
.task-tap:active { opacity: 0.6; }

.sheet-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: flex-end; z-index: 300; }
.sheet { width: 100%; max-width: 560px; margin: 0 auto; background: var(--bg-surface); border-top-left-radius: var(--radius-lg); border-top-right-radius: var(--radius-lg); border: 1px solid var(--border); padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.sheet-lbl { display: block; font-size: 12px; color: var(--text-secondary); margin: 12px 0 6px; }
