[hidden] { display: none !important; }
:root {
  --bg: #f7f7f5; --card: #fff; --ink: #1c1c1a; --muted: #6b6b66; --line: #e3e2dd;
  --accent: #0f766e; --accent-soft: #e6f2f0; --danger: #b42318; --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151514; --card: #1f1f1d; --ink: #ecebe6; --muted: #a09f98; --line: #34332f;
    --accent: #2bb3a3; --accent-soft: #1d3330; --danger: #f97066; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 640px; margin: 0 auto; padding: 12px 16px 120px; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.2; }
h2 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 14px; margin-top: 12px; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); }
textarea { resize: vertical; margin-top: 10px; }
label { display: block; font-size: 14px; color: var(--muted); margin-top: 10px; }
label > input, label > select, label > textarea { margin-top: 4px; color: var(--ink); }
button { cursor: pointer; border: 0; border-radius: 10px; padding: 10px 14px; background: none; }
.primary { background: var(--accent); color: #fff; font-weight: 600; }
.secondary { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.link { color: var(--accent); padding: 6px 0; }
.big { width: 100%; padding: 16px; font-size: 18px; border-radius: 14px; }
button:disabled { opacity: .55; cursor: default; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.error { color: var(--danger); font-size: 14px; }
.row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.row.space { justify-content: space-between; margin-top: 0; }
.row > input { flex: 1; }
.grow { flex: 1; margin-top: 0; }
.stack > * + * { margin-top: 10px; }
.step { display: inline grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 13px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--bg); border-bottom: 1px solid var(--line); }
.top nav { display: flex; gap: 2px; }
.top nav button { padding: 8px 10px; color: var(--muted); font-size: 15px; }
.top nav button.active { color: var(--accent); font-weight: 600; }
.banner { margin: 0; padding: 10px 16px; background: #fff4e5; color: #7a4100; font-size: 14px; text-align: center; }

.photo-drop { display: grid; place-items: center; min-height: 180px; border: 2px dashed var(--line); border-radius: 12px;
  text-align: center; color: var(--muted); margin: 0; cursor: pointer; overflow: hidden; }
.photo-drop img { width: 100%; max-height: 360px; object-fit: contain; display: block; }

.voice { display: flex; align-items: center; gap: 12px; }
.rec { display: inline-flex; align-items: center; gap: 8px; background: var(--accent-soft); color: var(--accent);
  font-weight: 600; padding: 12px 18px; border-radius: 999px; }
.rec .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); }
.rec.on { background: var(--danger); color: #fff; }
.rec.on .dot { background: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
audio { flex: 1; height: 40px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 7px 12px; border: 1px solid var(--line);
  border-radius: 999px; font-size: 14px; color: var(--ink); cursor: pointer; user-select: none; }
.chip input { display: none; }
.chip:has(input:checked), .chip.custom { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip button { padding: 0 2px; color: inherit; }

.segmented { display: flex; gap: 6px; flex-wrap: wrap; }
.segmented button { flex: 1; min-width: 120px; border: 1px solid var(--line); font-size: 14px; }
.segmented button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

.sticky { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 30%); }
.sticky > * { max-width: 608px; margin-left: auto; margin-right: auto; }

.result-photo { width: 100%; max-height: 260px; object-fit: cover; border-radius: 10px; margin: 8px 0; }
.label { font-size: 14px; color: var(--muted); margin-top: 12px; }
.editor { border: 1px solid var(--line); border-radius: 10px; padding: 4px 14px; margin-top: 4px; min-height: 200px; }
.editor:focus { outline: 2px solid var(--accent); }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.actions .primary { flex-basis: 100%; padding: 14px; }
details summary { cursor: pointer; font-weight: 600; }

.history { list-style: none; padding: 0; margin: 0; }
.history li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.history img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex: none; background: var(--line); }
.logout { margin-top: 24px; }

body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
body.login form { width: 100%; max-width: 360px; text-align: center; }
body.login form > * + * { margin-top: 12px; }
body.login button { width: 100%; padding: 12px; }

.loading { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 85%, transparent);
  text-align: center; padding: 16px; }
.spinner { width: 40px; height: 40px; margin: 0 auto 12px; border: 4px solid var(--accent-soft); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.disclaimer { margin-top: 12px; }

/* v0.2: accounts, plans, landing, legal, admin */
a { color: var(--accent); }
a.button { display: inline-block; text-align: center; text-decoration: none; padding: 10px 14px; border-radius: 10px; }
.danger { background: none; border: 1px solid var(--danger); color: var(--danger); font-weight: 600; }
.center { text-align: center; }
.badge { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft);
  color: var(--accent); font-size: 12px; font-weight: 600; vertical-align: 2px; }
.badge.low { background: #fdecea; color: var(--danger); }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.plan { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.plan h3 { margin: 0 0 4px; font-size: 16px; }
.plan .price { font-size: 20px; font-weight: 700; margin: 0 0 8px; }
.plan ul { margin: 0 0 10px; padding-left: 18px; }
.plan.current { border-color: var(--accent); background: var(--accent-soft); }
.plan button { width: 100%; }

body.landing main { padding-bottom: 32px; }
.brand { display: inline-flex; align-items: center; gap: 8px; }
.hero { text-align: center; padding: 28px 4px 20px; }
.hero h1 { font-size: clamp(28px, 7vw, 40px); }
.lead { font-size: 18px; color: var(--muted); }
.cta { display: inline-block; width: auto; padding: 14px 28px; text-decoration: none; margin-top: 8px; }
.steps { padding-left: 20px; margin: 0; }
.steps li + li { margin-top: 8px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs button { flex: 1; border: 1px solid var(--line); }
.tabs button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.check { display: flex; gap: 8px; align-items: flex-start; color: var(--ink); }
.check input { width: auto; margin-top: 4px; }
.footer { text-align: center; padding: 0 16px 32px; }

body.legal main { max-width: 720px; padding-bottom: 48px; }
body.legal h2 { margin-top: 24px; }
body.legal table { width: 100%; border-collapse: collapse; font-size: 14px; }
body.legal th, body.legal td { text-align: left; border-top: 1px solid var(--line); padding: 8px 6px; vertical-align: top; }

body.admin main { max-width: 1100px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat .v { font-size: 24px; font-weight: 700; }
.stat .k { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; }
table.data th, table.data td { padding: 8px 6px; border-top: 1px solid var(--line); white-space: nowrap; }
table.data td.wrap { white-space: normal; min-width: 240px; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover { background: var(--accent-soft); }
.pill { padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--line); }
.pill.ok { background: var(--accent-soft); color: var(--accent); }
.pill.bad { background: #fdecea; color: var(--danger); }
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); max-width: 560px; width: calc(100% - 32px); }
dialog::backdrop { background: rgb(0 0 0 / .35); }
#settings-form > .row { margin-bottom: 12px; }
.top nav .nav-link { padding: 8px 10px; color: var(--muted); font-size: 15px; text-decoration: none; }
.social-post { margin-top: 12px; }
.social-post textarea { width: 100%; }
#publish-card h2 { margin-bottom: 4px; }
