/* One palette behind variables; `html.dark` is the admin's dark mode (staff pages only). */
:root {
  --bg: #f5f6f8; --card: #ffffff; --fg: #1d2330; --muted: #6b7280; --line: #e3e6eb;
  --accent: #1f6feb; --accent-fg: #ffffff; --ok: #1a7f4b; --ok-bg: #e5f5ec;
  --todo: #b45309; --todo-bg: #fdf1e3; --bad: #b42318; --bad-bg: #fdecea; --field: #ffffff;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
:root.dark {
  --bg: #26282c; --card: #2e3035; --fg: #eceef1; --muted: #a0a6b0; --line: #43464d;
  --accent: #4d8ff5; --ok: #52c68a; --ok-bg: #1f3a2c; --todo: #f0a64a; --todo-bg: #3d2f1c;
  --bad: #f07a6e; --bad-bg: #432522; --field: #26282c; --shadow: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 24px; margin: 0 0 6px; }
h2 { font-size: 18px; margin: 0 0 16px; display: flex; align-items: center; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px 110px; }
.is-customer .wrap { max-width: 860px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 24px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card.narrow { max-width: 620px; margin: 24px auto; }
.card.empty { text-align: center; color: var(--muted); }
.brand { font-weight: 700; }
.brand span { font-weight: 400; color: var(--muted); }
.brand.big { font-size: 22px; margin-bottom: 8px; }
.custbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.custbar form { margin: 0; }
.staffnav { display: flex; gap: 4px; padding: 10px 16px 0; border-bottom: 1px solid var(--line); background: var(--card); }
.staffnav a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.staffnav a.on { color: var(--fg); border-color: var(--accent); }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--fg); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 11px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: wait; }
.linkbtn { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 13px; padding: 0 4px; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--fg); font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { resize: vertical; }
label { display: block; }
.field { display: block; border: 0; padding: 0; margin: 0 0 18px; }
.label { display: block; font-weight: 600; margin-bottom: 6px; }
.hint { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.req { color: var(--bad); font-weight: 600; }
.radio, .check { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; font-weight: 400; }
.radio input, .check input { width: auto; margin-top: 4px; }
.check { margin-bottom: 18px; }
.toggle { display: flex; align-items: center; gap: 10px; margin: -6px 0 22px; font-weight: 600; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 1px; }
.toggle .sw { width: 38px; height: 22px; border-radius: 11px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.toggle .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle input:checked + .sw { background: var(--accent); }
.toggle input:checked + .sw::after { left: 19px; }
.toggle input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; }
.counter { display: block; text-align: right; font-size: 12px; color: var(--muted); margin-top: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.actions.center { justify-content: center; }
.alert { background: var(--bad-bg); color: var(--bad); border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; }
.alert ul { margin: 6px 0; padding-left: 20px; }
.back { display: inline-block; margin-bottom: 10px; text-decoration: none; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 8px; z-index: 10; }
.toast.bad { background: var(--bad); color: #fff; }

/* sign in */
.loginwrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.card.login { width: 100%; max-width: 400px; }
.card.login label { margin-bottom: 14px; font-weight: 600; }
.card.login input { margin-top: 6px; }

/* wizard */
.wizhead { margin-bottom: 16px; }
.steps { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 0; margin: 0 0 18px; }
.steps button { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--fg); font: inherit; cursor: pointer; text-align: left; }
.steps button.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.steps .num { font-size: 12px; color: var(--muted); }
.steps .t { font-weight: 600; font-size: 14px; line-height: 1.25; }
.steps .state { font-size: 12px; font-weight: 600; }
.steps .ok .state { color: var(--ok); }
.steps .ok .state::before { content: "\2713  Complete"; }
.steps .todo .state { color: var(--todo); }
.steps .todo .state::before { content: "Incomplete"; }
.intro { background: var(--bg); border-radius: 8px; padding: 10px 14px; color: var(--muted); }
.fwrap.proposed .field, .fwrap.proposed.upload { opacity: .5; }
.fwrap.proposed .label::after { content: " (optional - Zappter will propose)"; font-weight: 400; color: var(--muted); }
.upload .files { list-style: none; padding: 0; margin: 8px 0; }
.upload .files li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.upload .template { margin: 8px 0; }
.uperr { color: var(--bad); font-size: 13px; margin-top: 6px; }
.reprow { display: grid; grid-template-columns: 1fr 1.3fr 1fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.stepnav { display: flex; justify-content: space-between; margin-top: 10px; }
.savebar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 12px 16px; background: var(--card); border-top: 1px solid var(--line); }
.done { text-align: center; }
.done .check { display: inline-flex; width: 56px; height: 56px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); font-size: 28px; align-items: center; justify-content: center; margin: 0 auto 10px; }

/* read-only view */
.viewhead { margin-bottom: 18px; }
.answers dl { display: grid; grid-template-columns: 240px 1fr; gap: 10px 18px; margin: 0; }
.answers dt { color: var(--muted); }
.answers dd { margin: 0; }
.pre { white-space: pre-wrap; }
.problems { color: var(--todo); margin: -6px 0 14px; padding-left: 20px; font-size: 14px; }
.pill { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.todo { background: var(--todo-bg); color: var(--todo); }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb { display: flex; flex-direction: column; width: 120px; font-size: 12px; text-decoration: none; }
.thumb img { width: 120px; height: 120px; object-fit: contain; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.thumb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filechip { display: inline-block; padding: 4px 10px; border: 1px solid var(--line); border-radius: 14px; font-size: 13px; text-decoration: none; }
table.mini { border-collapse: collapse; font-size: 14px; }
table.mini th, table.mini td { text-align: left; padding: 4px 14px 4px 0; border-bottom: 1px solid var(--line); }

/* staff lists */
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.filters .tab { padding: 6px 12px; border-radius: 16px; border: 1px solid var(--line); text-decoration: none; color: var(--fg); background: var(--card); font-size: 14px; }
.filters .tab.on { border-color: var(--accent); color: var(--accent); }
.filters .count { color: var(--muted); font-size: 12px; margin-left: 4px; }
.search { margin-left: auto; }
.search input { width: 240px; }
.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.list td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
.rowactions { display: flex; flex-wrap: wrap; gap: 6px; }
.rowactions form { margin: 0; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 10px; vertical-align: middle; white-space: nowrap; }
.badge.draft { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.badge.completed { background: var(--todo-bg); color: var(--todo); }
.badge.released { background: var(--ok-bg); color: var(--ok); }
.badge.archived { background: var(--line); color: var(--muted); }
.progress { display: inline-block; width: 70px; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.progress span { display: block; height: 100%; background: var(--ok); }
form.alt { margin-top: 10px; }

@media (max-width: 720px) {
  .steps { grid-template-columns: 1fr; }
  .steps button { flex-direction: row; align-items: center; gap: 10px; }
  .steps .state { margin-left: auto; }
  .reprow { grid-template-columns: 1fr; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
  .answers dl { grid-template-columns: 1fr; }
  .answers dt { margin-top: 8px; }
  .search, .search input { width: 100%; margin-left: 0; }
  .card { padding: 18px; }
}
