/* DCWWG Kit & Equipment – colours from the group's logo */
:root {
  --blue: #2a46ad;
  --blue-dark: #1d3285;
  --blue-soft: #e8ecfa;
  --gold: #e0b050;
  --gold-soft: #fbf1db;
  --green: #2f8a6a;
  --green-soft: #e1f2ea;
  --bg: #f3f5fb;
  --card: #ffffff;
  --ink: #18213d;
  --muted: #5d6685;
  --line: #dde2f0;
  --warn: #93600a;
  --warn-soft: #fcf0d6;
  --bad: #b3261e;
  --bad-soft: #fde6e3;
  --grey-soft: #eceef4;
  --brand: var(--blue);
  --brand-ink: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(24,33,61,.06), 0 2px 8px rgba(24,33,61,.04);
  --tabbar-h: 0px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --blue: #8ea2f2; --blue-dark: #c3cdfa; --blue-soft: #1e2647;
    --gold: #f0c463; --gold-soft: #3a2f16;
    --green: #6cc9a2; --green-soft: #173329;
    --bg: #10142a; --card: #181d38; --ink: #e8ebf7; --muted: #9aa2c2; --line: #2b3256;
    --warn: #f0c463; --warn-soft: #3a2f16; --bad: #f29a90; --bad-soft: #3d1c1a; --grey-soft: #252b4a;
    --brand-ink: #10142a; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--blue); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: .2rem 0 1rem; letter-spacing: -.01em; color: var(--blue-dark); }
@media (prefers-color-scheme: dark) { h1 { color: var(--ink); } }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1rem 0 .3rem; }
code { font-size: .85em; background: var(--grey-soft); padding: .1em .35em; border-radius: 4px; word-break: break-all; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }

/* ---------- header ---------- */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.stripe { height: 4px; background: linear-gradient(90deg, var(--blue) 0 70%, var(--gold) 70% 85%, var(--green) 85%); }
.top-in { max-width: 1140px; margin: 0 auto; padding: .45rem 16px; display: flex; align-items: center; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .65rem; color: var(--blue); text-decoration: none; flex-shrink: 0; }
.logo { height: 52px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 1.05rem; letter-spacing: .02em; }
.brand-sub { color: var(--muted); font-size: .85rem; }
.top-find { flex: 1; max-width: 300px; margin-left: auto; }
.top-find input { min-height: 38px; background: var(--bg); border-radius: 999px; padding-left: 1rem; }
.nav { display: flex; align-items: center; gap: .1rem; }
.nav a { color: var(--ink); text-decoration: none; padding: .45rem .7rem; border-radius: 8px; font-weight: 500; white-space: nowrap; }
.nav a:hover { background: var(--blue-soft); }
.nav a.on { background: var(--blue); color: #fff; font-weight: 600; }
@media (prefers-color-scheme: dark) { .nav a.on { color: var(--brand-ink); } }
@media (max-width: 1020px) { .top-find { display: none; } .nav { margin-left: auto; } }
.devbar { background: var(--gold-soft); color: var(--warn); text-align: center; font-size: .85rem; padding: .3rem; }

/* ---------- phone tab bar ---------- */
.tabbar { display: none; }
@media (max-width: 760px) {
  :root { --tabbar-h: 64px; }
  .top-in { padding: .35rem 14px; }
  .logo { height: 44px; }
  .nav { display: none; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--card); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 10px rgba(24,33,61,.06);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--tabbar-h); color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600; }
  .tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a.on { color: var(--blue); }
  .tabbar a.on svg { stroke-width: 2.3; }
  body.signed-in { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .top { position: static; }
}

/* ---------- layout ---------- */
.wrap { max-width: 1140px; width: 100%; margin: 0 auto; padding: 1.25rem 16px 2.5rem; flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.card.narrow { max-width: 460px; margin: 1.5rem auto; }
.center { text-align: center; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.page-head h1 { margin: 0; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
.span2 { grid-column: span 2; }
@media (max-width: 760px) {
  .wrap { padding: 1rem 14px 1.5rem; }
  h1 { font-size: 1.35rem; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .grid4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .page-head .row-btns { width: 100%; }
  .page-head .row-btns .btn { flex: 1 1 auto; }
  .span2 { grid-column: auto; }
  .card { padding: 1rem; }
}
.crumbs { margin: 0 0 .3rem; font-size: .9rem; }
.crumbs a { text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { margin-left: auto; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; margin: 0; }

/* ---------- messages ---------- */
.flash, .alert { border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; font-weight: 500; }
.flash { background: var(--green-soft); color: var(--green); border: 1px solid color-mix(in srgb, var(--green) 25%, transparent); }
.alert { background: var(--bad-soft); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 25%, transparent); }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
  font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2;
  padding: .6rem 1rem; min-height: 44px; border-radius: 10px; cursor: pointer;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: var(--blue); }
.btn.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
@media (prefers-color-scheme: dark) { .btn.primary { color: var(--brand-ink); } }
.btn.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.row-btns { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.row-btns form { margin: 0; }
.form { display: flex; flex-direction: column; gap: .85rem; }
.form > .btn { align-self: flex-start; }
.form > .btn.wide { align-self: stretch; }
@media (max-width: 760px) { .form > .btn { align-self: stretch; } }
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; }
label .muted { font-weight: 400; }
.opt { display: inline; font-weight: 400; color: var(--muted); font-size: .8rem; }
.opt::before { content: "("; } .opt::after { content: ")"; }
label > .opt { display: block; margin-top: -.25rem; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
input, select, textarea {
  min-width: 0; max-width: 100%;
  font: inherit; font-weight: 400; font-size: 1rem; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; min-height: 44px; width: 100%;
}
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; }
input[type=file] { padding: .4rem; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
textarea { resize: vertical; }
.pound { position: relative; display: block; }
.pound::before { content: "£"; position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 400; }
.pound input { padding-left: 1.6rem; }
.inline-form { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
.inline-form label { flex: 1 1 180px; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .9rem; }
.filters input { flex: 2 1 220px; width: auto; }
.filters select { flex: 1 1 150px; width: auto; }
@media (max-width: 760px) {
  .filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .filters select:last-of-type:nth-of-type(odd) { grid-column: 1 / -1; }
  .filters input { grid-column: 1 / -1; }
  .filters .btn { grid-column: 1 / -1; }
}
.seg { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.seg label { font-weight: 600; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: .55rem .85rem; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: .9rem; background: var(--card); }
.seg input:checked + span { background: var(--blue); color: #fff; border-color: var(--blue); }
@media (prefers-color-scheme: dark) { .seg input:checked + span { color: var(--brand-ink); } }
.seg input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

/* find */
.find-big { margin-bottom: 1rem; }
.find-row { display: flex; gap: .5rem; }
.find-row input { flex: 1; }
.dash-find { background: none; border: 0; padding: 0; }
@media (min-width: 1021px) { .dash-find { display: none; } }

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 1rem; }
@media (max-width: 760px) { .tiles { grid-template-columns: 1fr 1fr; gap: .6rem; } }
.tile { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--blue); border-radius: var(--radius); padding: .85rem 1rem; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; box-shadow: var(--shadow); }
.tile b { font-size: 1.9rem; line-height: 1.1; color: var(--blue); font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: .9rem; line-height: 1.35; }
.tile.warn { border-top-color: var(--gold); background: var(--gold-soft); }
.tile.warn b { color: var(--warn); }
.tile:hover { border-color: var(--blue); }

/* ---------- lists & tables ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: .5rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list a { text-decoration: none; color: var(--ink); font-weight: 600; }
.tbl { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tbl th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: .45rem .5rem; border-bottom: 1px solid var(--line); }
.tbl td { padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl a { color: var(--ink); text-decoration: none; }
.tbl a:hover { color: var(--blue); text-decoration: underline; }
.tbl tr.off { opacity: .6; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--bad); font-weight: 600; }
.pos { color: var(--green); font-weight: 600; }
table.cards { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
@media (max-width: 760px) {
  .hide-sm { display: none; }
  .card .tbl { font-size: .9rem; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; }
  table.cards thead { display: none; }
  table.cards { background: none; border: 0; }
  table.cards tr { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .6rem; padding: .5rem .8rem; }
  table.cards td { border: 0; padding: .2rem 0; text-align: left; display: flex; gap: .5rem; }
  table.cards td[data-l]:not(:first-child)::before { content: attr(data-l); color: var(--muted); font-size: .85rem; min-width: 6.5rem; }
}
.tag { display: inline-block; font: 600 .78rem/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--blue-soft); color: var(--blue); border-radius: 6px; padding: 0 .4rem; letter-spacing: .02em; white-space: nowrap; vertical-align: middle; }
.tag.big { font-size: .95rem; padding: .1rem .5rem; }
.spec { color: var(--muted); font-weight: 400; }
h1 .spec { font-size: .7em; }

/* row cards (equipment & bikes lists) */
.rows { display: flex; flex-direction: column; gap: .5rem; }
.row-card { display: flex; align-items: center; gap: 1rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); min-height: 64px; }
.row-card:hover { border-color: var(--blue); }
.rc-main { flex: 1; min-width: 0; }
.rc-main b { font-weight: 600; }
.rc-sub { display: block; color: var(--muted); font-size: .85rem; margin-top: .1rem; }
.rc-side { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; text-align: right; flex-shrink: 0; }
.rc-qty { font-size: 1.25rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.rc-price { font-size: .8rem; color: var(--muted); }

/* ---------- badges ---------- */
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .12rem .55rem; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.cond-good, .st-ok, .bk-in-stock { background: var(--green-soft); color: var(--green); }
.cond-needs-attention, .st-low, .bk-being-repaired { background: var(--warn-soft); color: var(--warn); }
.cond-broken, .cond-missing, .st-out { background: var(--bad-soft); color: var(--bad); }
.cond-retired, .bk-sold, .bk-scrapped { background: var(--grey-soft); color: var(--muted); }
.bk-for-sale { background: var(--gold); color: #3a2a05; }
.bk-on-loan { background: var(--blue-soft); color: var(--blue); }

/* ---------- stock list ---------- */
.stock-list { display: flex; flex-direction: column; gap: .5rem; }
.stock-row { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--green); border-radius: var(--radius); padding: .6rem .8rem; display: grid; grid-template-columns: 1fr auto auto; gap: .8rem; align-items: center; box-shadow: var(--shadow); scroll-margin-top: 90px; }
.stock-row.st-row-low { border-left-color: var(--gold); }
.stock-row.st-row-out { border-left-color: var(--bad); }
.stock-row:target { outline: 2px solid var(--blue); }
.stock-name a { color: var(--ink); text-decoration: none; }
.stock-qty { text-align: right; line-height: 1.3; }
.stock-qty b { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.quick { display: flex; gap: .4rem; margin: 0; }
.qbtn { min-width: 54px; min-height: 50px; font-size: 1.15rem; }
@media (max-width: 520px) {
  .stock-row { grid-template-columns: 1fr auto auto; gap: .5rem; padding: .55rem .6rem; }
  .stock-name .small { font-size: .78rem; }
  .stock-qty b { font-size: 1.15rem; }
  .qbtn { min-width: 46px; min-height: 46px; padding: .4rem; }
  .quick { flex-direction: column; gap: .3rem; }
}
.bigqty { font-size: 1.05rem; margin-bottom: .6rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.bigqty b { font-size: 2.3rem; color: var(--blue); font-variant-numeric: tabular-nums; }
.cost { font-size: 1.05rem; }
.cost b { color: var(--blue); font-size: 1.3rem; }

/* ---------- details ---------- */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
.dl dt { color: var(--muted); font-size: .9rem; }
.dl dd { margin: 0; }
.photo { width: 100%; max-height: 360px; object-fit: contain; background: var(--grey-soft); border-radius: 10px; margin-bottom: .8rem; }

/* ---------- more / find menu ---------- */
.menu-list { list-style: none; margin: 0 0 1rem; padding: 0; overflow: hidden; }
.menu-list li + li { border-top: 1px solid var(--line); }
.menu-list a { display: flex; flex-direction: column; padding: .85rem 1.1rem; text-decoration: none; color: var(--ink); }
.menu-list a:hover { background: var(--blue-soft); }
.menu-list a span { color: var(--muted); font-size: .85rem; }
.menu-list.card { padding: 0; }

/* ---------- admin ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .55rem .85rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--blue); font-weight: 600; }
.roles { margin: .8rem 0 0; padding-left: 1.1rem; }
.actions summary { list-style: none; }
.actions summary::-webkit-details-marker { display: none; }
.small-btn { min-height: 36px; padding: .3rem .75rem; font-size: .85rem; }
.action-pop { margin-top: .5rem; display: flex; flex-direction: column; gap: .9rem; padding: .8rem; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; min-width: 240px; }
.linkbox { border-color: var(--blue); background: var(--blue-soft); }
.linkbox.inner { border: 1px solid var(--blue); border-radius: 10px; padding: .8rem; margin-bottom: .8rem; }
.copyrow { display: flex; gap: .5rem; }
.copyrow input { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.logo-now img { max-height: 90px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px; }

/* ---------- stocktake ---------- */
.take .tbl + .tbl { margin-top: .8rem; }
.count { width: 90px; text-align: right; min-height: 40px; }
.sticky-save { position: sticky; bottom: var(--tabbar-h); padding: .8rem 0; background: linear-gradient(transparent, var(--bg) 35%); text-align: right; }
.printonly { display: none; }

/* ---------- tag labels ---------- */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; }
.label { display: flex; gap: .6rem; align-items: center; background: #fff; color: #18213d; border: 1.5px dashed #9aa5cc; border-radius: 10px; padding: .55rem .7rem; break-inside: avoid; }
.label img { height: 58px; width: auto; }
.label div { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.ltag { font: 700 1.35rem/1.1 ui-monospace, "Cascadia Mono", Consolas, monospace; color: #2a46ad; letter-spacing: .02em; }
.lname { font-weight: 600; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lsub { font-size: .75rem; color: #5d6685; }
.lprop { font-size: .65rem; color: #5d6685; text-transform: uppercase; letter-spacing: .05em; margin-top: .15rem; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); padding: 1rem 16px; display: flex; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; max-width: 1140px; width: 100%; margin: 0 auto; color: var(--muted); font-size: .85rem; }
.powered b { color: var(--blue); }

@media print {
  :root { --bg: #fff; --card: #fff; --ink: #000; --muted: #444; --line: #bbb; --tabbar-h: 0px; }
  .tabbar, .nav, .top-find, .noprint, .flash, .alert, .devbar, .filters, .foot { display: none !important; }
  body.signed-in { padding-bottom: 0; }
  .top { position: static; border-bottom: 2px solid #000; }
  .stripe { display: none; }
  .printonly { display: table-cell; }
  span.printonly, h1 .printonly { display: inline; }
  .box { width: 70px; border: 1px solid #000 !important; }
  .box.wide { width: 140px; }
  .card { box-shadow: none; break-inside: avoid; }
  .wrap { padding: 0; max-width: none; }
  a { color: #000; text-decoration: none; }
  .labels { grid-template-columns: repeat(3, 1fr); gap: 4mm; }
  .label { border: 1px dashed #777; }
}

/* sale / buyer */
.sale-card { border-top: 4px solid var(--gold); scroll-margin-top: 90px; }
.sale-edit { margin-top: 1rem; }
.sale-edit summary { list-style: none; display: inline-flex; }
.sale-edit summary::-webkit-details-marker { display: none; }
.sale-edit[open] summary { margin-bottom: 1rem; }
.erase { margin-top: 1rem; }
