:root {
  /* Brand palette (lightened): Deep Teal #195A5F · Care Teal #12B8B0 · Coral #D97F6C · Warm White #F3EDE6 */
  --deep-teal: #195A5F;
  --heading: #2A6E73;          /* lighter deep teal for headings */
  --care-teal: #12B8B0;
  --coral: #D97F6C;
  --coral-light: #E8988A;
  --bg: #FBF8F4;               /* lighter warm white */
  --warm: #F3EDE6;
  --surface: #ffffff;
  --surface-1: #fffdfa;
  --border: #ECE4DA;
  --text: #1E3B3E;
  --text-2: #4D6668;
  --muted: #5C7B7E;
  --primary: #12B8B0;          /* buttons: care teal with dark ink */
  --primary-hover: #0FA59E;
  --primary-ink: #0F3F42;
  --primary-soft: #E6F5F4;
  --link: #1F7F80;
  --topbar: #E9F5F4;
  --ipm: #12B8B0;
  --medworks: #D97F6C;
  --good: #1D7A4E; --good-bg: #E5F4EC;
  --warn: #8A5A00; --warn-bg: #FCF1D9;
  --bad: #B03A2E; --bad-bg: #FBEAE7;
  --info: #1F6F72; --info-bg: #E6F5F4;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(25,90,95,.05), 0 2px 6px rgba(25,90,95,.06);
  font-family: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}
@font-face { font-family: "Geist"; src: url("/fonts/Geist-Variable.woff2") format("woff2-variations"), url("/fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
h1, h2, h3 { color: var(--heading); letter-spacing: -0.01em; }
button, input, select, textarea { font-family: inherit; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 15px; line-height: 1.45; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
a { color: var(--link); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
#topbar {
  position: sticky; top: 0; z-index: 20; background: var(--topbar);
  border-bottom: 1px solid #D3EBE9; display: flex; align-items: center; gap: 16px;
  padding: 0 16px; height: 56px;
}
.brand { color: var(--deep-teal); font-weight: 700; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.logo { color: var(--care-teal); font-size: 20px; }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--coral-light); color: var(--primary-ink); font-weight: 700; font-size: 12px; text-align: center; margin-left: 4px; }
.user-menu { position: relative; }
.dropdown {
  position: absolute; right: 0; top: 44px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 8px; min-width: 200px; display: flex; flex-direction: column;
}
.dropdown .muted { padding: 4px 10px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.dropdown button { text-align: left; background: none; border: 0; padding: 10px; border-radius: 6px; font: inherit; cursor: pointer; }
.dropdown button:hover { background: var(--bg); }

main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 120px; }

/* ---------- controls ---------- */
button, .btn {
  font: inherit; font-weight: 600; border-radius: 10px; border: 1px solid transparent; cursor: pointer;
  padding: 10px 16px; background: var(--primary); color: var(--primary-ink); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; min-height: 42px;
}
button:hover, .btn:hover { background: var(--primary-hover); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary, .btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
button.secondary:hover { background: var(--bg); }
button.ghost { background: none; color: var(--text-2); border: 0; }
button.ghost:hover { background: var(--warm); }
button.danger { background: #F6D5CF; color: #8A2A20; }
button.danger:hover { background: #F0C2B9; }
button.good { background: #CDEFDD; color: #165C3B; }
button.good:hover { background: #B7E6CD; }
button.coral, .btn.coral { background: var(--coral-light); color: var(--primary-ink); }
button.coral:hover, .btn.coral:hover { background: #E28775; }
button.sm { padding: 6px 10px; min-height: 32px; font-size: 13px; border-radius: 8px; }
input, select, textarea {
  font: inherit; font-size: 16px; /* 16px stops iOS zoom */ padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); color: var(--text); width: 100%; min-height: 42px;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
textarea { min-height: 70px; resize: vertical; }
label { display: block; font-weight: 600; font-size: 13px; color: var(--text-2); margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); font-size: 15px; margin: 0; }
.check input { width: 20px; height: 20px; min-height: 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: flex-end; }
.filters > * { flex: 0 1 190px; }
.filters .field { margin: 0; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st-pending { background: var(--warn-bg); color: var(--warn); }
.st-approved { background: var(--info-bg); color: var(--info); }
.st-ordered { background: #EEEAF8; color: #4F4392; }
.st-received { background: var(--good-bg); color: var(--good); }
.st-rejected { background: var(--bad-bg); color: var(--bad); }
.div-tag { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
.div-tag::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--ipm); }
.div-tag.MEDWORKS::before { background: var(--medworks); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
tr.click { cursor: pointer; }
tr.click:hover td { background: #FAF6F1; }
td input, td select { min-height: 36px; padding: 6px 8px; font-size: 15px; }

/* ---------- login ---------- */
.login-wrap { min-height: 80vh; display: grid; place-items: center; }
.login { width: 100%; max-width: 380px; }
.login .context { background: var(--primary-soft); color: var(--deep-teal); border-radius: 10px; padding: 12px; margin-bottom: 16px; font-weight: 600; }

/* ---------- home tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.tile h3 { margin-bottom: 10px; }
.tile .row button { flex: 1; }
.btn-ipm { background: var(--ipm); } .btn-ipm:hover { background: #0FA59E; }
.btn-mw { background: var(--coral-light); } .btn-mw:hover { background: #E28775; }

/* ---------- order form (mobile-first) ---------- */
.order-head { margin-bottom: 12px; }
.review-banner { background: var(--info-bg); color: var(--info); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }
.search-sticky { position: sticky; top: 56px; z-index: 10; background: var(--bg); padding: 8px 0; margin: 0 -2px; }
.search-sticky input { box-shadow: var(--shadow); }
details.cat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
details.cat > summary { list-style: none; padding: 14px 16px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
details.cat > summary::-webkit-details-marker { display: none; }
details.cat > summary::after { transition: transform .15s; }
details.cat:not([open]) > summary::after { transform: rotate(-90deg); }
.cat-count { margin-left: auto; margin-right: 10px; }
.item { border-top: 1px solid var(--border); padding: 10px 16px; }
.item.on { background: #F3FAFA; }
.item-main { display: flex; align-items: center; gap: 10px; }
.item-name { flex: 1; min-width: 0; }
.item-name b { font-weight: 600; display: block; }
.stepper { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); flex-shrink: 0; }
.stepper button { background: none; color: var(--link); border: 0; border-radius: 0; width: 44px; height: 44px; min-height: 44px; padding: 0; font-size: 22px; }
.stepper button:hover { background: var(--primary-soft); }
.stepper input { width: 48px; border: 0; text-align: center; padding: 0; min-height: 44px; border-radius: 0; -moz-appearance: textfield; font-weight: 700; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.item-extra { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.item-extra input[type=text] { min-height: 36px; padding: 6px 10px; font-size: 15px; }
.monthly-toggle { white-space: nowrap; font-size: 13px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.monthly-toggle input { width: 18px; height: 18px; min-height: 0; }
.special-row { border-top: 1px solid var(--border); padding: 12px 16px; display: grid; grid-template-columns: 1fr 90px 40px; gap: 8px; }
.special-row .reason { grid-column: 1 / 3; }
.special-row .rm { grid-row: 1; grid-column: 3; }
.special-actions { padding: 12px 16px; border-top: 1px solid var(--border); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { background: var(--bg); color: var(--text-2); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; min-height: 32px; font-weight: 500; font-size: 13px; }
.chip:hover { background: var(--primary-soft); color: var(--deep-teal); }
.submit-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: var(--surface); border-top: 1px solid var(--border);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(0,0,0,.06);
}
.submit-bar .inner { max-width: 1180px; margin: 0 auto; display: flex; gap: 12px; align-items: center; }
.submit-bar button.primary { background: var(--coral-light); color: var(--primary-ink); flex: 1; max-width: 420px; margin-left: auto; min-height: 50px; font-size: 16px; }
.success { text-align: center; padding: 40px 16px; }
.success .big { font-size: 56px; color: var(--good); line-height: 1; }

/* ---------- request detail ---------- */
.meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 8px; }
.meta div span { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.line-actions { display: flex; gap: 4px; }
.line-actions button { white-space: nowrap; min-height: 34px; padding: 4px 10px; font-size: 13px; }
.seg-off { background: var(--surface) !important; color: var(--text-2) !important; border-color: var(--border) !important; }
tr.rejected td { color: var(--muted); }
tr.rejected td.name { text-decoration: line-through; }
.star { color: #c98500; }
.list-cards { display: none; }

/* ---------- reports ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi span { color: var(--text-2); font-size: 13px; font-weight: 600; }
.kpi b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.viz-root { --surface-1: #ffffff; --text-primary: #1E3B3E; --text-secondary: #4D6668; --grid: #EFE8DF; --series-1: #12B8B0; --series-2: #D97F6C; position: relative; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-svg text { fill: var(--text-secondary); font-size: 12px; font-family: inherit; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tooltip {
  position: absolute; pointer-events: none; background: var(--deep-teal); color: #fff; border-radius: 8px; padding: 8px 10px;
  font-size: 13px; box-shadow: 0 6px 18px rgba(0,0,0,.2); white-space: nowrap; z-index: 5; transform: translate(-50%, -100%);
}
.tooltip .t-row { display: flex; gap: 10px; justify-content: space-between; }
.tooltip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.bar-cell { display: flex; align-items: center; gap: 8px; }
.bar-cell .track { flex: 1; height: 8px; background: #F1EBE3; border-radius: 4px; overflow: hidden; min-width: 60px; }
.bar-cell .fill { height: 100%; background: var(--care-teal); border-radius: 0 4px 4px 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tabs button { background: none !important; color: var(--text-2); border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 12px; min-height: 0; }
.tabs button.active { color: var(--deep-teal); border-bottom-color: var(--coral); }

/* ---------- QR ---------- */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.qr-card { background: #fff; border: 2px solid var(--deep-teal); border-radius: 16px; padding: 20px; text-align: center; break-inside: avoid; }
.qr-card img { width: 100%; max-width: 240px; aspect-ratio: 1; }
.qr-card .qr-title { font-size: 20px; font-weight: 800; margin: 6px 0 0; }
.qr-card .qr-div { font-size: 16px; font-weight: 700; }
.qr-card.IPM .qr-div { color: #0E8F89; } .qr-card.MEDWORKS .qr-div { color: #B85A47; }
.qr-card .qr-title { color: var(--deep-teal); }
.qr-url { font-size: 11px; word-break: break-all; color: var(--muted); margin-top: 6px; }

/* ---------- modal & toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(15,20,30,.45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: var(--surface); border-radius: 16px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-card .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.review-list { list-style: none; padding: 0; margin: 0; }
.review-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--deep-teal); color: var(--warm) !important; color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 90vw; }
.toast.error { background: var(--bad); }
.secret { font-family: ui-monospace, Menlo, monospace; font-size: 18px; background: var(--bg); padding: 10px; border-radius: 8px; text-align: center; user-select: all; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.loc-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }

/* ---------- mobile ---------- */
@media (max-width: 720px) {
  main { padding: 14px 12px 120px; }
  #topbar { padding: 0 10px; gap: 8px; }
  .brand .txt, .brand { font-size: 0; } .brand .logo { font-size: 22px; }
  .modal { align-items: flex-end; padding: 0; }
  .modal-card { border-radius: 16px 16px 0 0; max-height: 92vh; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .hide-sm { display: none; }
  .filters > * { flex: 1 1 140px; }
  .list-table { display: none; }
  .list-cards { display: block; }
  .card { padding: 14px; }
}
.req-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; display: block; text-decoration: none; color: inherit; }
.req-card .row { gap: 6px; }

@media print {
  #topbar, .no-print, .submit-bar { display: none !important; }
  body { background: #fff; }
  main { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; }
  .qr-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- picture catalog (order form) ---------- */
.order-tools { position: sticky; top: 56px; z-index: 10; background: var(--bg); padding: 8px 0 6px; margin-bottom: 6px; }
.search-box { position: relative; }
.search-box input { padding-left: 40px; padding-right: 40px; min-height: 48px; border-radius: 12px; box-shadow: var(--shadow); font-size: 16px; }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 20px; color: var(--muted); pointer-events: none; }
.search-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; color: var(--muted); min-height: 36px; width: 36px; padding: 0; }
.search-clear:hover { background: var(--bg); }
.cat-chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.cat-chips::-webkit-scrollbar { display: none; }
.cchip { flex-shrink: 0; background: var(--surface); color: var(--text-2); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; min-height: 36px; font-weight: 600; font-size: 14px; }
.cchip span { color: var(--muted); font-weight: 500; margin-left: 2px; }
.cchip:hover { background: var(--primary-soft); color: var(--deep-teal); }
.cchip.active { background: var(--deep-teal); color: var(--warm); border-color: var(--deep-teal); }
.cchip.active span { color: #A9D9D6; }
.cat-head { margin: 18px 2px 10px; font-size: 16px; }
.results-head { margin: 8px 2px 10px; font-weight: 600; color: var(--text-2); }
.notfound { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; padding: 18px 0 8px; }
.igrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.icard {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 14px; padding: 10px; display: flex; flex-direction: column;
  gap: 6px; cursor: pointer; transition: border-color .12s, box-shadow .12s; position: relative; -webkit-tap-highlight-color: transparent;
}
.icard:hover { border-color: #BFE3E0; }
.icard.on { border-color: var(--care-teal); box-shadow: 0 0 0 3px var(--primary-soft); background: #FBFEFE; }
.icard.on::after { content: ""; position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--care-teal); color: #fff; font-size: 14px; font-weight: 700; display: grid; place-items: center; }
.ithumb { aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: var(--warm); }
.ithumb svg { width: 100%; height: 100%; display: block; }
.ithumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.iname { font-weight: 650; font-size: 14.5px; line-height: 1.25; min-height: 2.5em; }
.iname mark { background: #fff1a8; color: inherit; border-radius: 3px; padding: 0 1px; }
.idet { font-size: 12px; color: var(--muted); line-height: 1.3; margin-top: -4px; flex: 1; }
.icard .stepper { align-self: stretch; justify-content: space-between; }
.icard .stepper input { flex: 1; width: auto; min-width: 0; }
.icard .stepper button { width: 44px; }
.iextra { display: flex; gap: 6px; }
.mini { flex: 1; background: var(--bg); color: var(--text-2); border: 1px solid var(--border); min-height: 30px; padding: 2px 6px; font-size: 12px; border-radius: 8px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini:hover { background: var(--primary-soft); }
.mini.act { background: #FBEAE5; border-color: #F0C2B6; color: #8A3B2C; }
.rthumb, .lthumb { width: 44px; height: 44px; flex-shrink: 0; border-radius: 8px; overflow: hidden; }
.rthumb svg, .lthumb svg, .rthumb img, .lthumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.review-list li { align-items: center; }
.line-item { display: flex; gap: 10px; align-items: center; }
.sthumb { width: 32px; height: 32px; flex-shrink: 0; border-radius: 6px; overflow: hidden; }
.sthumb svg, .sthumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
@media (max-width: 720px) {
  .igrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .icard { padding: 8px; gap: 4px; }
  .ithumb { aspect-ratio: 16 / 10; }
  .ithumb svg { width: auto; height: 100%; }
  .iname { font-size: 14px; min-height: 0; }
  .idet { margin-top: -2px; }
  .icard .stepper button, .icard .stepper input { min-height: 40px; height: 40px; }
}
@media (max-width: 340px) { .igrid { grid-template-columns: 1fr; } }

/* ---------- admin catalog ---------- */
.cat-admin td .lthumb { width: 40px; height: 40px; }
.icon-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; max-height: 180px; overflow-y: auto; padding: 4px; border: 1px solid var(--border); border-radius: 10px; }
.icon-pick button { padding: 2px; min-height: 0; background: #fff; border: 2px solid transparent; border-radius: 10px; }
.icon-pick button.sel { border-color: var(--primary); }
.icon-pick svg { width: 100%; display: block; }
.photo-row { display: flex; gap: 14px; align-items: center; }
.photo-row .ithumb { width: 120px; flex-shrink: 0; }

.submit-bar button.primary:hover { background: #E28775; }
/* coral accent line next to section labels */
.cat-head, .page-head h1 { display: flex; align-items: center; gap: 10px; }
.cat-head::before { content: ""; width: 22px; height: 3px; border-radius: 2px; background: var(--coral); flex-shrink: 0; }
.review-banner { border: 1px solid #D3EBE9; }
.kpi b { color: var(--deep-teal); }
.empty { color: var(--muted); }
th { color: var(--muted); }

/* ================= left sidebar layout ================= */
:root { --side-w: 236px; --top-offset: 0px; }
#sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--side-w); z-index: 40; background: var(--topbar);
  border-right: 1px solid #D3EBE9; display: flex; flex-direction: column; padding: 18px 12px; gap: 6px;
}
.side-name { font-weight: 650; color: var(--deep-teal); }
body.has-shell { padding-left: var(--side-w); }
body.has-shell .submit-bar, body.has-shell .chat-bar { left: var(--side-w); }
#mobilebar { display: none; }
#scrim { position: fixed; inset: 0; background: rgba(15, 40, 42, .35); z-index: 35; }
.order-tools { top: var(--top-offset); }

@media (max-width: 860px) {
  :root { --top-offset: 52px; }
  body.has-shell { padding-left: 0; }
  body.has-shell .submit-bar, body.has-shell .chat-bar { left: 0; }
  #mobilebar:not([hidden]) {
    display: flex; position: sticky; top: 0; z-index: 30; height: 52px; align-items: center; gap: 6px;
    padding: 0 8px; background: var(--topbar); border-bottom: 1px solid #D3EBE9;
  }
  #mobilebar .brand { font-size: 16px !important; color: var(--deep-teal); font-weight: 700; display: flex; gap: 8px; align-items: center; }
  #mobilebar .brand .logo { font-size: 20px; }
  #menuBtn { font-size: 22px; width: 44px; padding: 0; color: var(--deep-teal); }
  #sidebar { transform: translateX(-102%); transition: transform .2s ease; box-shadow: 4px 0 24px rgba(0,0,0,.12); width: min(280px, 84vw); }
  body.menu-open #sidebar { transform: none; }
}

/* ================= smaller item pictures ================= */
.igrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.ithumb { aspect-ratio: 2 / 1; }
.ithumb svg { width: auto; height: 100%; margin: 0 auto; }
.icard { gap: 5px; }
.iname { min-height: 0; }
@media (max-width: 720px) {
  .ithumb { aspect-ratio: 5 / 2; }
  .icard .stepper button, .icard .stepper input { min-height: 38px; height: 38px; }
}

/* ================= chat / browse switch ================= */
.seg { display: inline-flex; background: var(--warm); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { background: none; color: var(--text-2); min-height: 38px; padding: 6px 14px; border-radius: 9px; font-size: 14px; }
.seg button:hover { background: rgba(255,255,255,.6); }
.seg button.active { background: #fff; color: var(--deep-teal); box-shadow: 0 1px 2px rgba(25,90,95,.12); }
.linkish { background: none; color: var(--link); padding: 0; min-height: 0; font-weight: 600; text-decoration: underline; }
.linkish:hover { background: none; }

/* ================= chat ================= */
.chat-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); gap: 16px; align-items: start; padding-bottom: 90px; }
.chat-log { display: flex; flex-direction: column; gap: 12px; min-height: 200px; }
.msg { display: flex; gap: 8px; align-items: flex-end; }
.msg.me { justify-content: flex-end; }
.msg .bubble { max-width: min(560px, 86%); padding: 10px 14px; border-radius: 16px; line-height: 1.45; }
.msg.me .bubble { background: var(--deep-teal); color: var(--warm); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.bot .bubble { background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; box-shadow: var(--shadow); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--care-teal); display: grid; place-items: center; flex-shrink: 0; font-size: 15px; }
.chat-actions { margin-top: 10px; }
.bot-lines { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 8px; }
.bot-lines li { display: flex; gap: 10px; align-items: flex-start; }
.bl-ico { width: 32px; text-align: center; font-size: 20px; flex-shrink: 0; }
.opt-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.chip.sel { background: var(--deep-teal); color: var(--warm); border-color: var(--deep-teal); }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chat-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: var(--surface); border-top: 1px solid var(--border);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(25,90,95,.06);
}
.chat-bar .inner { max-width: 1180px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; }
.chat-bar textarea { flex: 1; min-height: 46px; max-height: 120px; resize: none; border-radius: 23px; padding: 11px 16px; line-height: 1.4; }
.chat-bar button { width: 46px; height: 46px; min-height: 46px; padding: 0; border-radius: 50%; font-size: 18px; flex-shrink: 0; }
.mic { background: var(--coral-light) !important; color: var(--primary-ink); font-size: 20px !important; }
.mic.rec { background: #C94F3D !important; color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(201,79,61,.5); } 70% { box-shadow: 0 0 0 12px rgba(201,79,61,0); } 100% { box-shadow: 0 0 0 0 rgba(201,79,61,0); } }
.list-card { position: sticky; top: calc(var(--top-offset) + 12px); margin: 0; }
.list-rows { display: flex; flex-direction: column; }
.lrow { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.lrow .grow { min-width: 0; }
.lrow.special .grow input { min-height: 34px; padding: 5px 8px; font-size: 15px; margin-bottom: 4px; }
.lrow .rm { width: 32px; min-height: 32px; padding: 0; }
.stepper.sm button { width: 34px; height: 36px; min-height: 36px; font-size: 18px; }
.stepper.sm input { width: 40px; min-height: 36px; height: 36px; font-size: 15px; }
@media (max-width: 1000px) {
  .chat-wrap { grid-template-columns: 1fr; }
  .list-card { position: static; }
}

/* ================= duplicate warnings ================= */
.warn-box { background: #FCF1D9; border: 1px solid #EED6A0; color: #6B4A06; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: 14px; }
.warn-box ul { margin: 6px 0; padding-left: 20px; }
.warn-inline { font-size: 12.5px; color: #7A5205; background: #FCF1D9; border-radius: 6px; padding: 2px 6px; display: inline-block; margin-top: 3px; }
.wk-badge { font-size: 11.5px; font-weight: 600; color: #7A5205; background: #FCF1D9; border-radius: 6px; padding: 2px 6px; align-self: flex-start; }

/* ================= weekly approvals ================= */
.week-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 8px; }
.week-card { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); text-decoration: none; color: inherit; transition: border-color .12s; }
.week-card:hover { border-color: var(--care-teal); }
.week-total { font-size: 20px; font-weight: 700; color: var(--deep-teal); font-variant-numeric: tabular-nums; }
/* Requested by: one straight column, name on the left and how many on the right */
.who { display: flex; flex-direction: column; align-items: stretch; gap: 3px; width: 190px; }
.who-chip { background: var(--warm); border-radius: 8px; padding: 3px 8px; font-size: 12.5px; }
.who-row { display: flex; justify-content: space-between; gap: 10px; }
.who-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-qty { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.who-note { display: block; white-space: normal; color: var(--text-2); font-style: italic; }
.req-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.req-chips .chip { text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
@media print { #sidebar, #mobilebar, .chat-bar { display: none !important; } body.has-shell { padding-left: 0; } }
#lines td.name { min-width: 210px; }

/* ================= line icons ================= */
.ic { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ic-sm { width: 15px; height: 15px; vertical-align: -2px; }
.ic-inline { width: 15px; height: 15px; vertical-align: -2px; color: var(--link); }
.ic-star { width: 14px; height: 14px; fill: #E2A93B; stroke: #C98F24; stroke-width: 1.4; vertical-align: -2px; }
.star .ic-star { margin-left: 2px; }
.mini .ic, .chip .ic, .cchip .ic { width: 14px; height: 14px; vertical-align: -2px; }
.mini.act .ic-star { fill: #E2A93B; }
button .ic + *, .btn .ic { margin-right: 0; }
.stepper button .ic { width: 18px; height: 18px; stroke-width: 2.2; }
.rm .ic, .search-clear .ic { width: 16px; height: 16px; }
.search-ico .ic { width: 19px; height: 19px; color: var(--muted); }
.search-ico { display: flex; }
.back-link { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; text-decoration: none; color: var(--link); }
.back-link:hover { text-decoration: underline; }
.seg button { display: inline-flex; align-items: center; gap: 6px; }
.review-banner { display: flex; gap: 10px; align-items: flex-start; }
.ic-banner { width: 20px; height: 20px; margin-top: 1px; color: var(--deep-teal); }
.warn-head { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.warn-head .ic { color: #B07A0A; }
.warn-inline .ic, .wk-badge .ic { width: 13px; height: 13px; vertical-align: -2px; }
.tip { display: flex; gap: 6px; align-items: flex-start; }
.tip .ic { margin-top: 2px; }
.bl-ico { color: var(--coral); display: grid; place-items: center; height: 32px; }
.bl-ico .ic { width: 22px; height: 22px; }
.avatar .ic { width: 16px; height: 16px; color: var(--deep-teal); }
.chat-bar button .ic { width: 20px; height: 20px; }
.success .big .ic { width: 64px; height: 64px; color: var(--good); stroke-width: 1.6; }
th.sortable .ic { vertical-align: -3px; }
#menuBtn .ic { width: 24px; height: 24px; }
#mobilebar .logo { width: 30px; height: 30px; border-radius: 9px; background: #6CCBBE; color: #fff; display: grid; place-items: center; }
#mobilebar .logo .ic { width: 18px; height: 18px; }
details.cat > summary::after {
  content: ""; width: 18px; height: 18px; background: currentColor; color: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.icard.on::after {
  content: ""; background: var(--care-teal) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") center / 14px no-repeat;
}

/* ================= icon rail sidebar ================= */
:root { --side-w: 92px; }
#sidebar {
  width: var(--side-w); background: #ffffff; border-right: 1px solid var(--border); padding: 18px 8px 16px;
  align-items: stretch; gap: 0;
}
.rail-logo {
  width: 52px; height: 52px; border-radius: 14px; background: #6CCBBE; color: #fff; display: grid; place-items: center;
  margin: 0 auto 22px; box-shadow: 0 2px 6px rgba(18,184,176,.25);
}
.rail-logo .ic { width: 26px; height: 26px; stroke-width: 1.8; }
.rail-nav { display: flex; flex-direction: column; gap: 6px; flex: 0 0 auto; }
#nav.rail-nav { flex: 1 1 auto; }
.rail-item {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 12px 4px 10px; border-radius: 18px;
  text-decoration: none; color: #4B5A5C; font-size: 12.5px; font-weight: 500; text-align: center; line-height: 1.15;
}
.rail-item:hover { background: #F3F8F7; color: var(--deep-teal); }
.rail-item.active { background: var(--primary-soft); color: var(--deep-teal); font-weight: 700; }
.rail-ic { position: relative; display: grid; place-items: center; }
.rail-ic .ic { width: 27px; height: 27px; stroke-width: 1.7; }
.rail-item.active .rail-ic .ic { stroke-width: 2; }
.rail-badge {
  position: absolute; top: -6px; right: -12px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--coral); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff;
}
.rail-bottom { margin-top: 8px; }
.rail-sep { height: 1px; background: var(--border); margin: 12px 10px 14px; }
.avatar-btn {
  width: 48px; height: 48px; min-height: 48px; border-radius: 50%; padding: 0; margin: 0 auto; background: #6CCBBE; color: #fff;
  font-weight: 700; font-size: 16px; letter-spacing: .02em;
}
.avatar-btn:hover { background: var(--care-teal); }
.user-pop {
  position: absolute; left: calc(100% + 8px); bottom: 14px; width: 220px; background: #fff; border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 10px 30px rgba(25,90,95,.16); padding: 12px; z-index: 60;
}
.user-pop .side-name { font-weight: 650; color: var(--deep-teal); }
.user-pop .muted { margin-bottom: 8px; }
.pop-item {
  display: flex; width: 100%; align-items: center; gap: 8px; background: none; color: var(--text); min-height: 38px;
  padding: 6px 8px; border-radius: 8px; font-weight: 500; font-size: 14px; justify-content: flex-start;
}
.pop-item:hover { background: var(--warm); }
@media (max-width: 860px) {
  #sidebar { width: var(--side-w); }
  .user-pop { left: 8px; bottom: 80px; width: calc(100vw - 32px); max-width: 260px; }
}

/* dropdowns: custom chevron with breathing room from the right edge */
select {
  -webkit-appearance: none; appearance: none; padding-right: 44px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235C7B7E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; background-size: 16px 16px;
}
td select { padding-right: 36px; background-position: right 10px center; }

/* ================= urgent orders ================= */
.urgent-tag { display: inline-flex; align-items: center; gap: 4px; background: var(--bad-bg); color: var(--bad); border-radius: 999px;
  padding: 2px 9px; font-size: 12px; font-weight: 700; white-space: nowrap; vertical-align: middle; }
.urgent-tag .ic { width: 13px; height: 13px; }
.urgent-box { margin-top: 12px; border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface-1); }
.urgent-box.on { border-color: #EBB9AE; background: #FDF3F0; }
.urgent-toggle { align-items: flex-start; cursor: pointer; }
.urgent-toggle input { margin-top: 2px; }
.urgent-toggle .ic { color: var(--bad); width: 15px; height: 15px; }
.urgent-fields { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.urgent-fields .field { margin: 0; min-width: 150px; }
.urgent-fields .field.grow { flex: 1 1 220px; }
.urgent-note { display: flex; gap: 10px; align-items: flex-start; background: #FDF3F0; border: 1px solid #EBB9AE; color: #7A2E22;
  border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: 14px; }
.urgent-note .ic { color: var(--bad); margin-top: 2px; }
.week-card.urgent { border-color: #EBB9AE; background: #FFFAF8; }
.week-card.urgent:hover { border-color: var(--bad); }
.cat-head.urgent-head::before { background: var(--bad); }
.rail-badge.urgent { background: var(--bad); }

/* ================= public QR page ================= */
.gate-ic { width: 48px; height: 48px; border-radius: 12px; background: var(--primary-soft); color: var(--care-teal); display: grid; place-items: center; margin-bottom: 10px; }
.gate-ic .ic { width: 26px; height: 26px; }
.as-who { font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
.as-who .ic { width: 14px; height: 14px; }
.as-who a { margin-left: 6px; }

/* "+N more" / "Show less" on the Requested by chips */
.who-more { align-self: flex-start; min-height: 0; padding: 3px 9px; border-radius: 8px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  background: var(--primary-soft); color: var(--link); border: 1px solid #CDEAE7; cursor: pointer; }
.who-more:hover { background: #D6EFEC; }

/* In-app confirm dialog */
.ask { display: flex; gap: 14px; align-items: flex-start; }
.ask h2 { margin: 2px 0 6px; }
.ask p { margin: 0; }
.ask-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--warn-bg); color: var(--warn); display: grid; place-items: center; flex-shrink: 0; }
.ask-ic.danger { background: var(--bad-bg); color: var(--bad); }
.ask-ic .ic { width: 22px; height: 22px; }
button.danger-solid { background: var(--bad); color: #fff; }
button.danger-solid:hover { background: #962F25; }

/* Cloud Nine name on the sign-in, staff email and QR screens */
.brand-mark { display: inline-flex; align-items: center; gap: 8px; color: var(--deep-teal); font-weight: 700; font-size: 17px; margin-bottom: 14px; }
.brand-mark .ic { width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: var(--primary-soft); color: var(--care-teal); box-sizing: border-box; }
.qr-card .qr-brand { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; font-weight: 700; color: var(--deep-teal); font-size: 14px; }
.qr-card .qr-brand .ic { color: var(--care-teal); }
