/* Goodminton Stringing – brand colours live here. Change these two to match your branding. */
:root {
  --brand: #0b2545;
  --accent: #c6f432;
  --ink: #14181f;
  --muted: #5d6673;
  --line: #e3e7ed;
  --bg: #f4f6f9;
  --card: #ffffff;
  --error: #b42318;
  --ok: #067647;
  --rush: #c2410c;
  --rush-bg: #fff1e6;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .5rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1280px; }
main.wrap { padding-top: 20px; padding-bottom: 48px; }

.topbar { background: var(--brand); color: #fff; border-bottom: 4px solid var(--accent); padding-top: env(safe-area-inset-top); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; font-weight: 800; letter-spacing: .08em; font-size: 1.1rem; display: flex; align-items: center; gap: 10px; }
.brand small { font-weight: 500; letter-spacing: .02em; opacity: .8; font-size: .85rem; margin-left: 2px; }
.shuttle { width: 22px; height: 22px; border-radius: 50% 50% 50% 50% / 30% 30% 70% 70%; background: var(--accent); display: inline-block; transform: rotate(-30deg); }
.adminnav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.adminnav a, .linkbtn { color: #fff; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: .95rem; background: none; border: 0; font: inherit; cursor: pointer; }
.adminnav a.active, .adminnav a:hover, .linkbtn:hover { background: rgba(255,255,255,.14); }

.hero { margin: 4px 0 16px; }
.hero p { color: var(--muted); margin: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 0 0 16px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
fieldset.card { min-width: 0; }
legend { font-weight: 700; font-size: 1.05rem; padding: 0; float: left; width: 100%; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
legend + * { clear: both; }
.step { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: var(--accent); font-size: .9rem; }
.center { text-align: center; }
.narrow { max-width: 440px; margin: 20px auto; }

.field { display: block; margin: 0 0 14px; font-weight: 600; font-size: .95rem; }
.field .label { display: block; margin-bottom: 6px; }
input, select, textarea { font: inherit; font-size: 16px; /* prevents iOS zoom */ width: 100%; margin-top: 6px; padding: 12px; border: 1.5px solid #cfd5de; border-radius: 10px; background: #fff; color: var(--ink); font-weight: 400; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11,37,69,.15); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
input[type=checkbox], input[type=radio] { width: auto; margin: 0; }
.has-error input, .has-error select, .has-error .upload { border-color: var(--error); }
.err { display: block; color: var(--error); font-weight: 500; font-size: .9rem; margin-top: 6px; }
.hint, .muted { color: var(--muted); font-weight: 400; }
.hint { display: block; font-size: .88rem; margin-top: 6px; }
.small { font-size: .85rem; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.options { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.option { position: relative; display: block; cursor: pointer; }
.option input { position: absolute; opacity: 0; inset: 0; }
.option-body { display: flex; flex-direction: column; gap: 2px; border: 1.5px solid #cfd5de; border-radius: 12px; padding: 12px; height: 100%; font-weight: 400; }
.option-body strong { font-size: .95rem; }
.option .price { font-size: 1.5rem; font-weight: 800; color: var(--brand); }
.option small { color: var(--muted); font-size: .8rem; line-height: 1.3; }
.option input:checked + .option-body { border-color: var(--brand); background: #eef3fa; box-shadow: 0 0 0 2px var(--brand) inset; }
.option.rush input:checked + .option-body { border-color: var(--rush); background: var(--rush-bg); box-shadow: 0 0 0 2px var(--rush) inset; }
.option.rush .price { color: var(--rush); }
.option input:focus-visible + .option-body { outline: 3px solid rgba(11,37,69,.3); }

.amount { background: var(--brand); color: #fff; border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.amount strong { color: var(--accent); font-size: 1.3rem; }
.pricelist { margin: 0 0 12px; padding-left: 18px; font-size: .92rem; }
.payid { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1.5px dashed var(--brand); border-radius: 10px; padding: 12px; }
.payid > div { display: flex; flex-direction: column; min-width: 0; }
.payid strong { font-size: 1.1rem; word-break: break-all; }
.payid .muted { font-size: .82rem; }
.instructions { font-size: .92rem; margin: 12px 0 0; }

.upload { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 2px dashed #b9c2cf; border-radius: 12px; padding: 22px 14px; text-align: center; cursor: pointer; background: #fafbfc; font-weight: 400; }
.upload input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-cta { display: flex; flex-direction: column; }
.upload-cta strong { color: var(--brand); }
.upload-cta small { color: var(--muted); }
.upload img { max-width: 100%; max-height: 320px; border-radius: 8px; border: 1px solid var(--line); }
.upload.has-file { border-style: solid; border-color: var(--ok); background: #f3fbf6; }

button, .btn-primary, .btn-secondary, .btn-small { font: inherit; cursor: pointer; text-decoration: none; display: inline-block; text-align: center; }
.btn-primary { width: 100%; background: var(--brand); color: #fff; border: 0; border-radius: 12px; padding: 16px; font-size: 1.1rem; font-weight: 700; }
.btn-primary:hover { filter: brightness(1.15); }
.btn-primary[disabled] { opacity: .6; cursor: wait; }
.btn-secondary { border: 1.5px solid var(--brand); color: var(--brand); border-radius: 12px; padding: 12px 18px; font-weight: 600; margin-top: 8px; }
.btn-small { background: var(--brand); color: #fff; border: 1.5px solid var(--brand); border-radius: 8px; padding: 7px 12px; font-size: .9rem; font-weight: 600; white-space: nowrap; }
.btn-small.ghost { background: #fff; color: var(--brand); }
.btn-small.danger { background: #fff; color: var(--error); border-color: #f1b5ae; }
.fineprint { text-align: center; color: var(--muted); font-size: .82rem; }

.flash { padding: 12px 14px; border-radius: 10px; margin: 0 0 14px; font-weight: 500; }
.flash-error { background: #fef3f2; color: var(--error); border: 1px solid #fecdca; }
.flash-ok { background: #ecfdf3; color: var(--ok); border: 1px solid #abefc6; }
.notice { background: #fffaeb; border: 1px solid #fedf89; color: #7a2e0e; padding: 12px 14px; border-radius: 10px; margin: 0 0 14px; }

.thanks .tick { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: var(--brand); font-size: 2.2rem; font-weight: 900; display: grid; place-items: center; margin: 4px auto 10px; }
.refline { margin-bottom: 0; }
.ref { font-size: 2.2rem; font-weight: 800; letter-spacing: .06em; color: var(--brand); margin: 0 0 10px; }
.summary { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; text-align: left; max-width: 340px; margin: 0 auto 16px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 600; }

/* ---- admin ---- */
.titlebar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.titlebar h1 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; text-decoration: none; color: var(--muted); font-size: .9rem; }
.stat b { display: block; font-size: 1.7rem; color: var(--brand); line-height: 1.1; }
.stat-rush b { color: var(--rush); }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 12px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; font-weight: 600; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.filters input, .filters select { width: auto; margin: 0; padding: 8px 10px; }
.filters input[name=q] { flex: 1 1 220px; }
.filters .datelbl { font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.spacer { flex: 1; }
.tablewrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f8fafc; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
tr.is-rush td { background: var(--rush-bg); }
tr.is-rush td:first-child { box-shadow: inset 4px 0 0 var(--rush); }
tr.is-hidden td { opacity: .55; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.neg { color: var(--error); } td.pos { color: var(--ok); }
td.actions { white-space: nowrap; }
.statusform select, .row select, .row input { width: auto; margin: 0; padding: 7px 10px; font-size: .9rem; }
.row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.row input.qty { width: 90px; }
.inline { display: inline; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: #eef2f6; color: var(--brand); }
.badge-rush { background: var(--rush); color: #fff; }
.badge-in-stock, .badge-sent { background: #dcfae6; color: var(--ok); }
.badge-low-stock, .badge-pending, .badge-sending { background: #fef0c7; color: #93370d; }
.badge-out-of-stock, .badge-failed, .badge-gave_up { background: #fee4e2; color: var(--error); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.grid2 > .card { margin: 0; }
.grid2 + .card, .card + .grid2, .grid2 + .grid2 { margin-top: 16px; }
.span2 { grid-column: 1 / -1; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 14px; }
.check { display: flex; gap: 10px; align-items: center; margin: 0 0 14px; }
.evidence { max-width: 100%; max-height: 520px; border: 1px solid var(--line); border-radius: 8px; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: .92rem; }
.timeline li { padding: 4px 0; border-left: 2px solid var(--line); padding-left: 10px; }
.error-text { white-space: pre-wrap; background: #fef3f2; color: var(--error); padding: 8px; border-radius: 8px; font-size: .8rem; }
.pager { display: flex; gap: 16px; justify-content: center; margin-top: 12px; }
.qrpreview { max-width: 420px; width: 100%; border: 1px solid var(--line); border-radius: 8px; }
code { background: #eef2f6; padding: 1px 5px; border-radius: 4px; }

@media (max-width: 380px) {
  .options { grid-template-columns: 1fr; }
}
body.admin .topbar .wrap { max-width: 1280px; }
