/* Last edited: 2026-09-12 */
/* ThreadCount - Phase A stylesheet. Deliberately neutral ("refined restraint", docs/UI_UX.md):
   the style guide and the one ownable signature are Phase B deliverables. Mobile-first, every
   screen usable at 380 px, 44 px touch targets, visible focus. */

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --text: #1f1f1c;
  --muted: #66655f;
  --line: #dfddd5;
  --accent: #2f4a45;
  --accent-text: #ffffff;
  --ok: #2f6b3a;
  --ok-bg: #e3efe4;
  --bad: #a3261c;
  --bad-bg: #f6e2df;
  --radius: 10px;
  --tabbar-h: 60px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.45; }

a { color: var(--accent); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

button { font: inherit; min-height: 44px; padding: 0 18px; border-radius: var(--radius); cursor: pointer; }
button:disabled { opacity: 0.55; cursor: default; }
.primary { background: var(--accent); color: var(--accent-text); border: 1px solid var(--accent); }
.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }

.loading { padding: 40px 20px; color: var(--muted); text-align: center; }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.login-card h1 { margin: 0; font-size: 1.4rem; letter-spacing: 0.01em; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field input { font: inherit; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.check input { width: 20px; height: 20px; }
.error, .bad-text { color: var(--bad); margin: 0; }

/* Shell */
.shell { min-height: 100vh; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
.topbar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 8px 16px; padding-top: calc(8px + env(safe-area-inset-top)); background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { font-weight: 600; color: var(--text); text-decoration: none; }
.gear { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; color: var(--muted); border-radius: var(--radius); }
.gear.active { color: var(--accent); background: var(--surface); }
.content { padding: 16px; max-width: 900px; margin: 0 auto; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; display: grid; grid-template-columns: repeat(4, 1fr); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); }
.tabbar a { display: flex; align-items: center; justify-content: center; min-height: 44px; color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.tabbar a.active { color: var(--accent); font-weight: 600; }

.stub h2, .settings h2 { margin: 4px 0 12px; font-size: 1.25rem; }
.stub p { color: var(--muted); }

/* Settings */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0 0 20px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.section-title { font-size: 1rem; margin: 8px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.card h3 { margin: 0 0 4px; font-size: 1rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.meta { color: var(--muted); margin: 8px 0; font-size: 0.92rem; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.8rem; background: var(--line); color: var(--text); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.table-scroll { overflow-x: auto; }
.scores { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 0.92rem; }
.scores th, .scores td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.scores th { color: var(--muted); font-weight: 500; }
details { margin: 8px 0; }
summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.plain { margin: 6px 0; padding-left: 18px; font-size: 0.9rem; }
.photo { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; overflow-wrap: anywhere; }

@media (min-width: 900px) {
  .tabbar { top: 0; bottom: auto; left: auto; width: 180px; height: 100vh; grid-template-columns: 1fr; grid-auto-rows: 52px; align-content: start; padding-top: 64px; border-top: 0; border-left: 1px solid var(--line); }
  .shell { padding-bottom: 0; padding-right: 180px; }
}
