/* picnest OMS. Brand: Teal #0F4C5C, Sun #F2B33D, Coral #E86A50, Ink #1B2A33, Mist #EEF3F4; Sora. */
:root {
  --teal: #0F4C5C; --teal-dark: #0A3540; --teal-tint: #E3EEF0;
  --sun: #F2B33D; --sun-tint: #FDF1D8; --sun-ink: #6B4A00;
  --coral: #E86A50; --coral-tint: #FBE5E0; --coral-ink: #9A2F1A;
  --green-tint: #E2F2E7; --green-ink: #1E6B3A;
  --grey-tint: #ECEFF1; --grey-ink: #4A5A63;
  --ink: #1B2A33; --slate: #4A5A63; --mist: #EEF3F4; --line: #DCE3E6; --white: #fff;
  --font: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--mist); color: var(--ink); font: 14px/1.45 var(--font); }
a { color: var(--teal); }
button, input, select { font: inherit; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px;
  padding: 8px 20px; background: var(--teal); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.word { font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
.word span { color: var(--sun); }
.word small { font-weight: 600; font-size: 12px; letter-spacing: 0.08em; color: #CFE1E5; margin-left: 2px; }
.mode { background: var(--sun); color: var(--ink); font-weight: 700; font-size: 11px; letter-spacing: .08em;
  padding: 3px 8px; border-radius: 4px; }
nav { display: flex; gap: 4px; }
nav a { color: #CFE1E5; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 600; }
nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
nav a.on { color: #fff; background: rgba(255,255,255,.16); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--sun);
  color: var(--ink); font-size: 11px; text-align: center; margin-left: 4px; }
.count[hidden] { display: none; }
.spacer { flex: 1; }
.version { color: #CFE1E5; font-size: 12px; }

main { padding: 16px 20px 40px; max-width: 1500px; margin: 0 auto; }
h1 { font-size: 20px; margin: 4px 0 12px; }
h2 { font-size: 15px; margin: 18px 0 8px; }
.sub { color: var(--slate); margin: -6px 0 12px; }

.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.bar .grow { flex: 1; }
.muted { color: var(--slate); font-size: 13px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px;
  border: 1px solid var(--teal); background: var(--teal); color: #fff; font-weight: 600; cursor: pointer;
  text-decoration: none; font-size: 13px; }
.btn:hover { background: var(--teal-dark); }
.btn.secondary { background: #fff; color: var(--teal); }
.btn.secondary:hover { background: var(--teal-tint); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.ghost-light { background: transparent; border-color: rgba(255,255,255,.5); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--sun); outline-offset: 1px; }

.chips { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.chips button { border: 0; background: #fff; padding: 6px 12px; cursor: pointer; color: var(--slate); font-weight: 600; font-size: 13px; }
.chips button + button { border-left: 1px solid var(--line); }
.chips button[aria-pressed="true"] { background: var(--teal); color: #fff; }
input[type=search], input[type=text], input[type=password], input[type=url], input[type=email], select {
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: #fff; color: var(--ink); }
input[type=search] { min-width: 220px; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { position: sticky; top: 50px; background: #F7FAFB; font-size: 12px; color: var(--slate); font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; z-index: 1; }
tbody tr:hover { background: #FAFCFC; }
tr.attention { background: #FFFAEE; }
tr.attention:hover { background: #FFF5DD; }
td.num, th.num { text-align: right; white-space: nowrap; }
.code { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-green { background: var(--green-tint); color: var(--green-ink); }
.b-amber { background: var(--sun-tint); color: var(--sun-ink); }
.b-red { background: var(--coral-tint); color: var(--coral-ink); }
.b-grey { background: var(--grey-tint); color: var(--grey-ink); }
.b-teal { background: var(--teal-tint); color: var(--teal); }

.pack { margin-bottom: 6px; }
.pack:last-child { margin-bottom: 0; }
.pack-title { font-weight: 600; }
.slots { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.slot { display: inline-flex; gap: 4px; align-items: baseline; padding: 1px 7px; border-radius: 6px;
  background: var(--mist); border: 1px solid var(--line); font-size: 12px; }
.slot b { font-weight: 600; }
.problems { margin: 4px 0 0; padding-left: 16px; color: var(--coral-ink); font-size: 12.5px; }

.empty { padding: 36px 20px; text-align: center; color: var(--slate); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 6px; }

.cols { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.school-list button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line);
  background: #fff; padding: 10px 12px; cursor: pointer; }
.school-list button:last-child { border-bottom: 0; border-radius: 0 0 10px 10px; }
.school-list button:first-child { border-radius: 10px 10px 0 0; }
.school-list button[aria-current="true"] { background: var(--teal-tint); box-shadow: inset 3px 0 0 var(--teal); }
.school-list .name { font-weight: 600; }

.form { display: grid; grid-template-columns: 200px minmax(0, 520px); gap: 10px 16px; align-items: center; padding: 16px; }
.form label { font-weight: 600; }
.form .hint { grid-column: 2; color: var(--slate); font-size: 12.5px; margin-top: -6px; }
.form input { width: 100%; }

.toast { position: fixed; right: 20px; bottom: 20px; z-index: 10; max-width: 460px; padding: 12px 16px;
  border-radius: 10px; background: var(--ink); color: #fff; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.toast.error { background: var(--coral-ink); }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid rgba(255,255,255,.5);
  border-top-color: #fff; border-radius: 50%; animation: s 0.8s linear infinite; }
.btn.secondary .spin { border-color: var(--teal-tint); border-top-color: var(--teal); }
@keyframes s { to { transform: rotate(360deg); } }

.ok-note { background: var(--green-tint); color: var(--green-ink); border-radius: 8px; padding: 8px 12px; }
.stack { display: grid; gap: 8px; margin-top: 10px; }
.stack label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
label.btn { cursor: pointer; }
.meter { height: 10px; background: var(--mist); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin: 10px 0 6px; }
.meter span { display: block; height: 100%; background: var(--teal); transition: width .3s; }
.thumbs { display: flex; gap: 4px; flex-wrap: wrap; }
.thumbs img, .thumbs .nothumb { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; background: var(--mist); }
.nothumb { display: inline-flex; align-items: center; justify-content: center; font-size: 9px; color: var(--slate); text-align: center; }
.problem { padding: 12px 14px; margin-bottom: 12px; border-left: 4px solid var(--sun); }
.problem.blocking { border-left-color: var(--coral); }
.fixgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.fixgrid figure { margin: 0; background: var(--mist); border-radius: 8px; padding: 6px; }
.fixgrid img, .fixgrid .nothumb { width: 100%; height: 110px; object-fit: contain; border-radius: 6px; background: #fff; display: flex; }
.fixgrid figcaption { font-size: 12px; margin: 4px 0; word-break: break-all; }
.fixbtns { display: flex; flex-wrap: wrap; gap: 4px; }
button.link { background: none; border: 0; color: var(--teal); text-decoration: underline; cursor: pointer; font-size: 13px; padding: 0 4px; }
.spin.dark { border-color: var(--teal-tint); border-top-color: var(--teal); vertical-align: middle; }

@media (max-width: 900px) {
  .panel { overflow-x: auto; }
  th { position: static; }
  .cols { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr; }
  .form .hint { grid-column: 1; }
  .top { flex-wrap: wrap; }
}

/* Cloud: tick boxes, one per line, box beside its label */
.checks { display: grid; gap: 6px; }
.checks label { display: flex; gap: 8px; align-items: center; font-weight: 400; justify-self: start; }
.checks input[type=checkbox] { width: auto; min-height: 0; margin: 0; }

/* Products */
table.products input.wide { width: 100%; min-width: 220px; }
.scroll-x { overflow-x: auto; }
input.money { width: 64px; text-align: right; }
table.products td { vertical-align: top; }
table.products .badge { margin-top: 4px; }

.defs { white-space: nowrap; }
.defs .def { display: block; font-size: 12px; color: var(--slate); }
.defs select { font-size: 12px; padding: 2px 4px; margin-left: 4px; }
.pool-h { margin: 18px 0 8px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.pool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.pool-card { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.pool-top { display: flex; gap: 8px; align-items: center; justify-content: space-between; width: 100%; }
.pool-price { font-size: 13px; font-weight: 600; }

/* Class & group photos */
.class-photos td { vertical-align: top; }
.cp-thumb img { display: block; width: 150px; border-radius: 6px; }
.cp-thumb .nothumb { display: flex; align-items: center; justify-content: center; width: 150px; height: 96px; border-radius: 6px; background: var(--teal-tint); color: var(--slate); font-size: 12px; }
#cp-group fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
#cp-group[hidden] { display: none; }
.cp-check { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-weight: 500; }
.digitals { margin: 0 0 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
/* Offers */
.offer { padding: 12px 14px; margin-bottom: 12px; }
.offer-grid { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr); gap: 10px 16px; align-items: start; }
.offer-grid fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; }
.offer-params { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; }
@media (max-width: 700px) { .offer-grid { grid-template-columns: 1fr; } }
#dv-form fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; }
#dv-form label.check { display: inline-flex; gap: 6px; align-items: center; margin-right: 16px; min-height: 32px; }
.delivery { margin-bottom: 4px; }
/* A table that scrolls sideways inside its panel can't use the page-level sticky header
   (it would stick 50px down inside the panel, over the first row). */
.scroll-x th { position: static; }
/* Fulfilment (0.24.0) */
.fl-school > span { display: block; }
.fl-school .badge { margin-top: 3px; }
.pack-card.packed { border-color: var(--green-ink); box-shadow: inset 4px 0 0 var(--green-ink); }
.chip-count { display: inline-block; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-weight: 700; font-size: 16px; background: #fff; }
.pk-child { margin: 10px 0; }
.pk-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.pk-thumb { margin: 0; width: 110px; text-align: center; font-size: 12px; color: var(--slate); opacity: .45; border: 2px solid transparent; border-radius: 8px; padding: 3px; }
span.pk-thumb { display: inline-flex; align-items: center; justify-content: center; height: 60px; background: var(--mist); }
.pk-thumb.on { opacity: 1; border-color: var(--teal); background: var(--teal-tint); color: var(--ink); font-weight: 700; }
.pk-thumb img { width: 100%; height: 130px; object-fit: contain; border-radius: 5px; background: #fff; display: block; }
.pk-thumb figcaption { margin-top: 2px; }
#pp-labels label.check { display: inline-flex; gap: 6px; align-items: center; }
@media (max-width: 760px) { .pk-thumb { width: 90px; } .pk-thumb img { height: 105px; } }
/* Phone: the header wraps and the screen tabs scroll sideways inside it, not the whole page. */
@media (max-width: 900px) {
  .top { flex-wrap: wrap; gap: 6px 12px; padding: 8px 12px; }
  .top nav { order: 5; flex: 1 0 100%; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .top nav a { white-space: nowrap; padding: 6px 10px; }
  .top .spacer { flex: 1; }
}

/* ------------------------------------------------------------------ phones (0.26.0)
   Same screens, same order of work; laid out for one hand on a small screen. */
.cols > *, .bar > *, .stack > * { min-width: 0; }   /* a wide table scrolls inside its box, never widens the page */
@media (max-width: 700px) {
  main { padding: 12px 12px 88px; }
  h1 { font-size: 19px; }
  .sub { font-size: 14px; margin-top: -4px; }
  /* Tap targets and no zoom-on-focus (iPhone zooms into text boxes under 16px). */
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px; min-height: 40px; max-width: 100%; }
  .btn { min-height: 42px; padding: 8px 14px; }
  .btn.small { min-height: 36px; padding: 6px 10px; font-size: 13px; }
  label.check, .checks label { min-height: 36px; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; }
  .bar { gap: 8px; }
  .bar > select, .bar > input[type=search] { flex: 1 1 100%; min-width: 0; }
  .bar .grow { flex-basis: 100%; height: 0; }
  /* Tabs: one row that scrolls sideways, never squashed into tall columns. */
  .chips { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .chips button { white-space: nowrap; min-height: 40px; }
  .panel { overflow-x: visible; }
  .school-list { max-height: none; }
  /* Packing: the main actions stay under the thumb at the bottom of the screen. */
  .pack-actions { position: sticky; bottom: 0; z-index: 4; background: #fff; margin: 14px -18px -16px !important;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; }
  .pack-actions .btn { flex: 1 1 0; justify-content: center; min-height: 48px; font-size: 16px; }
  .pack-actions .btn .muted { display: none; }   /* "(Enter)": no keyboard on a phone */
  .pack-card h2 { font-size: 22px !important; }
  .pack-card .chip-count { font-size: 15px; }
  .toast { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

/* Tablets and phones: tables become a list of cards, one card per row, each value with its heading. */
@media (max-width: 900px) {
  table.rt, .rt thead, .rt tbody, .rt tr, .rt td { display: block; width: auto; }
  .rt thead { display: none; }
  .rt tbody tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .rt tbody tr:last-child { border-bottom: 0; }
  .rt td { position: relative; border: 0; padding: 3px 0 3px min(36%, 190px); min-height: 32px; text-align: left !important; overflow-wrap: anywhere; }
  .rt td::before { content: attr(data-label); position: absolute; left: 0; top: 5px; width: min(33%, 175px); color: var(--slate);
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; line-height: 1.2; }
  .rt td[data-label=""] { padding-left: 0; }
  .rt td[data-label=""]::before { display: none; }
  .rt td:empty { display: none; }
  .rt td input.wide, .rt td input, .rt td select { max-width: 100%; }
  .rt td input.wide { min-width: 0; width: 100%; }
  .rt td.nowrap, .rt td .nowrap, .rt .badge { white-space: normal; }
  .rt td .btn { margin: 2px 0; }
}

/* Loading (0.27.0): a thin bar at the top while anything loads, and a plain
   note if it takes more than 3 seconds (the database waking up). */
body.loading::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 50;
  background: linear-gradient(90deg, transparent, var(--sun), transparent); background-size: 50% 100%;
  animation: pn-load 1s linear infinite; }
@keyframes pn-load { from { background-position: -50% 0; } to { background-position: 150% 0; } }
.slow-note { position: fixed; left: 50%; transform: translateX(-50%); top: 64px; z-index: 40; max-width: min(92vw, 520px);
  background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
@media (prefers-reduced-motion: reduce) { body.loading::before { animation: none; background: var(--sun); } }

/* Pupils & headshots (0.27.0) */
.pupils .stack { gap: 14px; margin-top: 0; }
.pad { padding: 14px 16px; }
.pad h2, .pad-x h2 { margin: 0 0 8px; }
.pad-x { padding: 12px 16px 0; }
.pad > p { margin: 0 0 10px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 6px 0 10px; }
.form-grid label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
.form-grid input[type=file] { font-size: 13px; max-width: 100%; }
.panel.inner { padding: 12px 14px; margin-top: 10px; background: var(--mist); }
.panel.inner details { margin: 8px 0; }
.panel.inner summary { cursor: pointer; font-weight: 600; }
ul.tight { margin: 6px 0; padding-left: 18px; }
p.hint { margin-top: 0; }
table.compact td { padding: 6px 8px; }
@media (max-width: 900px) { .pad-x .chips { overflow-x: auto; max-width: 100%; } }
