/* Kingfisher SOP admin.
   Layout and components follow the ShortStack admin; colours are Kingfisher's own
   (#019dda / #183D6A / #1FA7BD, taken from the website's stylesheets).
   Everything themeable sits in :root - change it there, not further down. */
:root {
  --side: #11263f; --side-2: #183d6a;
  --accent: #019dda; --accent-2: #1fa7bd; --accent-mid: #0e9bc9;
  --brand: var(--accent); --brand-dark: #0e75b0;
  --bg: #f1f4f7; --card: #fff;
  --ink: #1f2a33; --muted: #667883; --line: #dde5ea;
  --bad: #b3261e; --ok: #1d6b3a; --warn: #9a6610; --radius: 8px;
  --gradient: linear-gradient(135deg, var(--accent), var(--accent-2));
}
*, *::before, *::after { box-sizing: border-box; }
body.admin, body.login-page { margin: 0; font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand-dark); }
h1 { font-size: 26px; margin: 0 0 .2em; }
h2 { font-size: 18px; margin: 0 0 .6em; }
code, .mono { font-family: ui-monospace, Consolas, monospace; }
code { background: #eef3f6; padding: 1px 6px; border-radius: 4px; font-size: 13px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
/* A figure that is wrong rather than merely low - negative stock, say. Bold as well as
   coloured, so it does not rely on someone distinguishing red in a column of numbers. */
.is-bad { color: var(--bad); font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; z-index: 200; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent-mid); outline-offset: 2px; }

/* layout */
body.admin { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.side { background: radial-gradient(ellipse at 50% -10%, var(--side-2) 0%, var(--side) 70%); color: #fff; display: flex; flex-direction: column; padding: 18px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
/* The logo is dark blue artwork on white, so on the navy sidebar it sits in a white
   panel. It is roughly square, so it is held well short of the full panel width or
   it eats the menu. */
.side-brand { display: block; text-decoration: none; padding: 0 18px 16px; }
.side-brand img { display: block; width: 124px; max-width: 100%; height: auto; margin: 0 auto; background: #fff; border-radius: 10px; padding: 8px; }
.side-brand-sub { display: block; margin-top: 9px; color: #b9c9d8; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; text-align: center; }
.side-brand:hover .side-brand-sub { color: #fff; }
.side nav a { display: flex; justify-content: space-between; align-items: center; color: #b9c9d8; text-decoration: none; padding: 8px 22px; border-left: 3px solid transparent; }
.side nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side nav a.is-active { background: rgba(255, 255, 255, .08); color: #fff; border-left-color: var(--accent); font-weight: 600; }
.side-h { margin: 16px 22px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #7c93a8; }
.side-foot { margin-top: auto; padding: 16px 22px 0; font-size: 13px; display: grid; gap: 8px; }
.side-foot a, .linkish { color: #b9c9d8; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; text-align: left; }
.side-foot a:hover, .linkish:hover { color: #fff; text-decoration: underline; }
.main { padding: 28px 34px 80px; max-width: 1180px; width: 100%; }
@media (max-width: 860px) {
  body.admin { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .main { padding: 20px 16px 80px; }
}

/* common bits */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 20px; }
.card.empty { text-align: center; padding: 40px; }
.card-note { border-left: 4px solid var(--accent); }
.flash { padding: 11px 16px; border-radius: var(--radius); margin: 0 0 16px; font-weight: 500; }
.flash-ok { background: #e1f3e7; color: var(--ok); border: 1px solid #bfe3cb; }
.flash-bad { background: #fbe7e5; color: var(--bad); border: 1px solid #f1c5c0; }
.btn { display: inline-block; border: 1px solid #c3d2db; background: #fff; color: var(--ink); border-radius: 6px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2; }
/* background-COLOR, not the background shorthand. The shorthand also resets
   background-image, which wiped .btn-primary's gradient on hover and left its
   white text on a near-white panel - the button looked like it had vanished. */
.btn:hover { background-color: #eef4f8; }
.btn-primary { background: var(--gradient); border-color: transparent; color: #fff; }
.btn-primary:hover { filter: brightness(1.07); }
.btn-danger { color: var(--bad); border-color: #e7b9b5; }
.btn-danger:hover { background: #fbe7e5; }
.btn-small { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; padding: 12px; }
.pill { background: #e7eef3; border-radius: 999px; padding: 1px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; display: inline-block; }
.pill.ok { background: #e1f3e7; color: var(--ok); }
.filter select { padding: 8px 10px; border: 1px solid #b6c6d0; border-radius: 6px; font: inherit; background: #fff; }

/* tables */
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #f8fbfc; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table td.strong { font-weight: 600; white-space: nowrap; }
/* break-word, not anywhere: "anywhere" lets the column collapse to one character
   per line when the table is squeezed. min-width keeps it readable. */
.table td.was, .table td.now { min-width: 130px; max-width: 260px; overflow-wrap: break-word; }
.table td.was { color: var(--muted); text-decoration: line-through; }
.table td.now { color: var(--ink); }

/* forms */
.form-card { max-width: 880px; }
.form-card.narrow { max-width: 520px; }
.field { margin-bottom: 20px; }
.field > label:not(.check) { display: block; font-weight: 600; margin-bottom: 6px; }
.field input[type=text], .field input[type=password], .field input[type=email], .field input[type=number], .field input[type=date], .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #b6c6d0; border-radius: 6px; font: inherit; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: 2px solid #c9e9f7; }
.help { color: var(--muted); font-size: 13px; margin: 5px 0 0; }
.error { color: var(--bad); font-weight: 600; margin: 6px 0 0; font-size: 14px; }
.has-error input, .has-error textarea, .has-error select { border-color: var(--bad); }
/* The save bar is the card's footer, so it spans the card edge to edge: the negative
   margins cancel .card's padding (20px 22px) and the bar puts that padding back inside
   itself. Set with `padding: 14px 0` instead, the button sits hard against the left
   edge of the grey band and the band stops short of the card's corners. */
.savebar {
  position: sticky; bottom: 0; z-index: 1;
  display: flex; gap: 10px; align-items: center;
  background: rgba(241, 244, 247, .96);
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  margin: 22px -22px -20px;
  padding: 16px 22px;
}

/* Live password requirements. Each rule is listed whether or not it is met, so the
   list never changes length as you type - a list that grows and shrinks moves the
   button out from under the cursor. Colour alone does not carry the state: the mark
   changes from a dot to a tick, which also survives a colour-blind reader and a
   black-and-white print. */
.pw-rules { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; color: var(--muted); }
.pw-rules li { display: flex; align-items: flex-start; gap: 8px; padding: 2px 0; }
.pw-rules li::before { content: "\00b7"; font-weight: 700; width: 1em; text-align: center; flex: none; }
.pw-rules li.met { color: var(--ok); font-weight: 600; }
.pw-rules li.met::before { content: "\2713"; }

/* dashboard */
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin: 18px 0 24px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--ink); display: grid; gap: 2px; }
.tile:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(1, 157, 218, .14); }
.tile strong { font-size: 30px; color: var(--brand-dark); line-height: 1.1; }
.tile span { font-weight: 700; } .tile small { color: var(--muted); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.plainlist { list-style: none; margin: 0; padding: 0; }
.plainlist li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; }
.plainlist li:last-child { border: 0; } .plainlist small { color: var(--muted); white-space: nowrap; }
.codelist { list-style: none; margin: 14px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.codelist li { font-family: ui-monospace, Consolas, monospace; font-size: 15px; letter-spacing: .04em; background: #f3f8fb; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; text-align: center; }

/* sign in */
/* body.login-page, not .login-page: the base rule above is also body-qualified and
   would otherwise win on specificity and leave this flat grey. */
body.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; background: radial-gradient(ellipse at 50% 15%, var(--side-2), var(--side) 78%); }
.login-card { background: #fff; border-radius: 12px; padding: 34px 32px 26px; width: min(400px, 100%); text-align: center; box-shadow: 0 12px 40px rgba(0, 0, 0, .35); }
.login-card-wide { width: min(520px, 100%); }
.login-logo { display: block; width: 150px; max-width: 55%; height: auto; margin: 0 auto; }
.login-card h1 { margin: 10px 0 10px; font-size: 20px; color: var(--side-2); }
.login-lead { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.login-card form { text-align: left; display: grid; gap: 14px; }
.login-card label { display: grid; gap: 5px; font-weight: 600; }
.login-card input { padding: 11px 12px; border: 1px solid #b6c6d0; border-radius: 6px; font: inherit; }
.login-card input:focus { border-color: var(--accent); outline: 2px solid #c9e9f7; }
.login-foot { margin: 18px 0 0; font-size: 13px; color: var(--muted); }
.code-input { font-family: ui-monospace, Consolas, monospace; font-size: 24px; letter-spacing: .32em; text-align: center; }

/* two-factor enrolment */
.enrol { display: flex; gap: 20px; align-items: center; text-align: left; margin: 4px 0 20px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #f8fbfc; }
.enrol-qr { flex: none; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 6px; }
.enrol-qr svg { display: block; width: 170px; height: 170px; }
.enrol-key { flex: 1; min-width: 0; }
.enrol-key p { margin: 0 0 6px; }
.enrol-step { font-size: 14px; color: var(--ink); }
.keyblock { font-family: ui-monospace, Consolas, monospace; font-size: 15px; font-weight: 600; letter-spacing: .06em; overflow-wrap: anywhere; color: var(--ink); }
@media (max-width: 520px) { .enrol { flex-direction: column; } }

/* ---- catalogue and price feed ---- */
.filterbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 18px; }
.filterbar input[type=search], .filterbar select { padding: 9px 11px; border: 1px solid #b6c6d0; border-radius: 6px; font: inherit; background: #fff; }
.filterbar input[type=search] { flex: 1; min-width: 200px; }
.filterbar .check { font-weight: 400; font-size: 14px; white-space: nowrap; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: #e7eef3; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 18px; }

.section-h { font-size: 15px; margin: 10px 0 2px; padding-top: 16px; border-top: 1px solid var(--line); }
.resolved { background: var(--surface-2, #f3f8fb); border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 14px; margin: 0 0 20px; font-size: 14px; }
.resolved strong { display: block; margin-bottom: 3px; }
.row-buttons { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

.pill.warn { background: #fdf2dc; color: var(--warn); }
.pill.bad { background: #fbe7e5; color: var(--bad); }
.crumb a { text-decoration: none; }
td .mono, .mono { font-family: ui-monospace, Consolas, monospace; }
.table td.right, .table th.right { text-align: right; }

/* ---- accounts ---- */
.inline-form { display: inline-flex; gap: 6px; align-items: center; }
.inline-form select { padding: 5px 8px; border: 1px solid #b6c6d0; border-radius: 6px; font: inherit; font-size: 13px; background: #fff; max-width: 220px; }
.adder { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.adder > summary { cursor: pointer; font-weight: 600; color: var(--brand-dark); }
.adder > summary:hover { text-decoration: underline; }
.stack { margin-top: 14px; }
.stack .field { margin-bottom: 14px; }
.stack label { display: block; font-weight: 600; margin-bottom: 4px; }
.stack input[type=text], .stack input[type=email] { width: 100%; padding: 9px 11px; border: 1px solid #b6c6d0; border-radius: 6px; font: inherit; }
.stack .check { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.stack .check input { width: 18px; height: 18px; }

/* ---- orders and documents ---- */
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pill-big { font-size: 13px; padding: 4px 12px; }
.qty-in { width: 90px; padding: 6px 8px; border: 1px solid #b6c6d0; border-radius: 6px; font: inherit; text-align: right; }
.docframe { width: 100%; height: 760px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.stack select { width: 100%; padding: 9px 11px; border: 1px solid #b6c6d0; border-radius: 6px; font: inherit; background: #fff; }
.stack textarea { width: 100%; padding: 9px 11px; border: 1px solid #b6c6d0; border-radius: 6px; font: inherit; }

/* ---- channel ingest ---- */
.field-row { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.field-row .field { margin-bottom: 0; }
.field-row .field > span { display: block; font-weight: 600; margin-bottom: 6px; }
.field-row .field input { width: 100%; padding: 9px 11px; border: 1px solid #b6c6d0; border-radius: 6px; font: inherit; }
/* Full fields side by side. A modifier rather than a change to .field-row itself, which
   elsewhere holds checkboxes that must stay at their natural width. */
.field-row.cols .field { flex: 1 1 180px; min-width: 0; }
.field-row.cols .field select { width: 100%; }
.table tr.row-warn > td { background: #fffaf0; }
.table tr.row-detail > td { background: #fffaf0; border-top: 0; padding-top: 0; font-size: 13px; }
.table tr.row-detail p { margin: 0 0 4px; }
.warn-text { color: var(--warn); }
.table td.wrap { white-space: normal; min-width: 260px; }

/* ---- reports ---- */
.report-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.report-card { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); background: #fff; }
.report-card:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(1, 157, 218, .14); }
.report-card strong { color: var(--brand-dark); }
.report-card span { font-size: 13px; }
.report-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.report-notes { margin: 0 0 16px; padding-left: 18px; color: var(--muted); font-size: 13px; }
.report-notes li { margin-bottom: 3px; }
.inline-label { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; white-space: nowrap; }
.inline-label input, .inline-label select { padding: 9px 11px; border: 1px solid #b6c6d0; border-radius: 6px; font: inherit; font-weight: 400; background: #fff; }
.table tfoot th { border-top: 2px solid var(--line); font-weight: 700; background: #f3f8fb; }

@media print {
  .side, .no-print, .head-actions, .crumb, .flash { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .card { border: 0 !important; box-shadow: none !important; padding: 0 !important; }
  .table-wrap { overflow: visible !important; }
}

/* ---- settings ---- */
.field-bad input, .field-bad select { border-color: var(--bad); }
.error { color: var(--bad); display: block; margin-top: 4px; }
.stack.grid-2 .field { margin-bottom: 16px; }
.stack .check + .check { margin-top: 8px; }

/* ---- quick filter chips ---- */
.viewchips { display: flex; gap: 7px; flex-wrap: wrap; margin: 0 0 12px; }
.chip {
  font-size: 13px; padding: 5px 11px; border-radius: 20px; text-decoration: none;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* ---- global search ---- */
.topsearch { margin: 0 0 14px; }
.topsearch input {
  width: 100%; padding: 8px 11px; border-radius: 7px; font: inherit;
  border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff;
}
.topsearch input::placeholder { color: rgba(255,255,255,.55); }
.topsearch input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.hitgroup { margin: 0 0 14px; }
.hitgroup h2 { font-size: 15px; margin: 0 0 8px; }
.hit { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.hit:last-child { border-bottom: 0; }
.hit:hover { background: rgba(127,127,127,.05); }
.hit .t { font-weight: 600; }
.hit .s { color: var(--muted); font-size: 13px; }
