:root {
  --brand: #EF7D00;
  --brand-600: #D46F00;
  --brand-50: #FFF5EA;
  --brand-100: #FDE2C2;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6B7280;
  --line: #E5E7EB;
  --line-2: #D1D5DB;
  --bg: #F3F4F6;
  --card: #FFFFFF;
  --soft: #F8FAFC;
  --navy: #0F172A;
  --green: #16A34A;
  --blue: #0B78D0;
  --red: #DC2626;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .07);
  --nav-h: 64px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
[hidden] { display: none !important; }

.icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
.icon svg { width: 100%; height: 100%; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.pad { padding: 16px; }
.pad-b { padding-bottom: 8px; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-tight { display: flex; flex-direction: column; gap: 6px; }
.twin-hint[hidden] { display: none; }
.twin-hint .warn-box { font-size: 13px; padding: 8px 10px; }
.c-brand { color: var(--brand); }
.c-blue { color: var(--blue); }
.c-green { color: var(--green); }
.c-red { color: var(--red); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 14px; border-radius: 10px; border: 1px solid transparent;
  background: var(--card); font-weight: 600; white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn .icon { width: 18px; height: 18px; }
.btn:active { opacity: .85; }
.btn-block { width: 100%; height: 48px; }
.btn-outline { border-color: var(--line-2); background: var(--card); }
.btn-outline:hover { background: var(--soft); }
.btn-dark { background: var(--navy); color: #fff; }
.btn-brand { background: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-600); }
.btn-green { background: var(--green); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-red { background: var(--red); color: #fff; }
.btn.square { width: 46px; height: 46px; padding: 0; flex: none; }
.btn-row { display: flex; gap: 10px; justify-content: flex-end; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 10px; background: transparent; flex: none;
}
.icon-btn:hover { background: var(--bg); }
.icon-btn .icon { width: 22px; height: 22px; }

.link-btn { border: 0; background: none; padding: 0; color: var(--blue); font-size: 13px; text-align: left; }
.link-btn:hover { text-decoration: underline; }

/* ---------- header & navigation ---------- */
.app-header { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line); }
.header-inner {
  max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand-name { font-weight: 700; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-logo {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  background: var(--brand); color: #fff; flex: none;
}
.brand-logo.lg { width: 56px; height: 56px; border-radius: 14px; }
.brand-logo.lg .icon { width: 28px; height: 28px; }
.brand-logo.danger { background: var(--red); }
.avatar-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--navy); color: #fff;
  font-weight: 700; font-size: 13px; flex: none;
}

.tabs { display: flex; gap: 4px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); font-weight: 600;
}
.tab:hover { background: var(--bg); }
.tab.active { background: var(--brand-100); color: #7A3E00; }

@media (max-width: 767px) {
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0;
    background: #fff; border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tab {
    flex-direction: column; justify-content: center; gap: 4px; height: var(--nav-h);
    border-radius: 0; font-size: 12px; font-weight: 500;
  }
  .tab.active { background: #F8B47A; color: var(--ink); }
}

.demo-banner { background: var(--brand-50); color: #92400E; text-align: center; font-size: 13px; padding: 6px 16px; border-bottom: 1px solid var(--brand-100); }

.view { max-width: 1200px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + 32px + env(safe-area-inset-bottom)); }
@media (min-width: 768px) { .view { padding: 24px 24px 40px; } }

/* ---------- cards & common ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 12px; align-items: center; }

.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  background: var(--bg); color: var(--ink-2); font-size: 12px; font-weight: 600;
}
.tag .icon { width: 12px; height: 12px; }
.tag-green { background: #DCFCE7; color: #166534; }
.tag-grey { background: #E5E7EB; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }

.empty-state { grid-column: 1 / -1; text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: #E5E7EB; color: #9CA3AF; margin-bottom: 12px; }
.empty-icon .icon { width: 30px; height: 30px; }
.empty-title { font-weight: 700; color: var(--ink-2); margin-bottom: 4px; }

.loading { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 40px; color: var(--muted); }
.error-box { grid-column: 1 / -1; text-align: center; }

.spinner {
  width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line);
  border-top-color: var(--brand); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- form controls ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input {
  width: 100%; height: 46px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px;
  background: #fff; font-size: 16px;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
select.input {
  appearance: none; -webkit-appearance: none; padding-right: 36px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center / 18px;
}
.input:focus, .picker-btn:focus-visible { outline: 3px solid var(--brand-100); border-color: var(--brand); }
.input.static { display: flex; align-items: center; background: var(--soft); }

.picker-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; height: 46px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px;
  background: #fff; font-size: 16px; text-align: left;
}
.picker-btn > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.placeholder { color: var(--muted); }

.check-row { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check-row input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }

/* ---------- inventory types, seasons ---------- */
.inv-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 12px; }
.inv-filters:empty { display: none; }
.mini-field { display: flex; flex-direction: column; gap: 3px; flex: 1 1 130px; min-width: 0; }
.mini-field span { font-size: 12px; font-weight: 600; color: var(--muted); }
.mini-field .input { height: 40px; font-size: 14px; }
.view-toggle { height: 40px; flex: 1 1 150px; }
@media (min-width: 768px) { .mini-field { flex: 0 1 190px; } .view-toggle { flex: 0 0 auto; margin-left: auto; } }

.type-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important; }
.type-card {
  display: flex; flex-direction: column; text-align: left; padding: 0; overflow: hidden; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.type-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(16, 24, 40, .12); border-color: var(--brand-100); }
.tc-cover { display: grid; gap: 2px; height: 130px; background: linear-gradient(135deg, var(--brand-50), #fff); }
.tc-cover img { width: 100%; height: 100%; min-height: 0; object-fit: contain; background: #fff; padding: 8px; }
.tc-cover.n2 { grid-template-columns: 1fr 1fr; }
.tc-cover.n3 { grid-template-columns: 1fr 1fr 1fr; }
.tc-cover.empty { place-items: center; color: var(--brand); }
.tc-cover.empty .icon { width: 44px; height: 44px; opacity: .7; }
.tc-body { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.tc-body b { font-size: 16px; }

.type-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; min-width: 0; }
.type-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; min-width: 0; }
.type-chip { flex: none; border: 1px solid var(--line-2); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.type-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.grid-note { grid-column: 1 / -1; }

.pc-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.mini.season { background: #E0F2FE; color: #075985; }
.mini.season.s-winter { background: #E0E7FF; color: #3730A3; }
.mini.season.s-summer { background: #FEF3C7; color: #92400E; }
.mini.season.s-rain { background: #CCFBF1; color: #115E59; }
.mini.season.s-all-season { background: #F3F4F6; color: #374151; }

.opt-section { display: flex; flex-direction: column; gap: 8px; }
.opt-row { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
@media (min-width: 560px) { .opt-row { grid-template-columns: 1fr auto; align-items: center; } }
.opt-fields { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.opt-actions { display: flex; align-items: center; gap: 2px; }
.opt-actions .up { transform: rotate(180deg); }
.opt-add { display: flex; gap: 8px; }
.icon-btn[disabled] { opacity: .3; cursor: default; }

.footer-row { display: flex; gap: 10px; }
.footer-row .btn { height: 48px; }
.suggest-wrap { position: relative; }
.suggest-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; max-height: 220px; overflow-y: auto;
  background: #fff; border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 10px 24px rgba(0, 0, 0, .12); padding: 4px;
}
.suggest-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 8px; font-size: 15px; }
.suggest-item:hover, .suggest-item.active { background: var(--brand-50); }

.warn-box { background: #FFFBEB; border: 1px solid #FCD34D; border-left: 4px solid #F59E0B; border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.warn-title { display: flex; align-items: center; gap: 8px; font-weight: 700; color: #92400E; margin-bottom: 6px; }
.warn-title .icon { color: #D97706; flex: none; }
.warn-box ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 3px; }

.note { background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: 8px; padding: 8px 12px; font-size: 13px; }

/* ---------- inventory ---------- */
.location-pill {
  position: relative; flex: 1; display: flex; align-items: center; gap: 4px; height: 46px; padding: 0 12px;
  border-radius: 10px; background: var(--brand); color: #fff; cursor: pointer;
}
.location-native {
  appearance: none; -webkit-appearance: none; flex: 1; height: 100%; padding: 0 28px 0 8px;
  border: 0; background: transparent; color: #fff; font-weight: 700; font-size: 16px; cursor: pointer;
}
.location-native:focus { outline: none; }
.location-native option { color: var(--ink); }
.location-pill .chev { position: absolute; right: 12px; pointer-events: none; }

.cart-btn { position: relative; width: 56px; height: 46px; padding: 0; flex: none; }
.cart-btn .icon { width: 22px; height: 22px; }
.badge {
  position: absolute; top: -7px; right: -7px; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 11px; background: var(--navy); color: #fff; font-size: 12px; line-height: 22px; text-align: center;
}
.count-badge { display: inline-block; background: var(--navy); color: #fff; border-radius: 6px; padding: 0 8px; font-size: 13px; vertical-align: middle; }

.search {
  flex: 1; display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; color: var(--muted);
}
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 16px; color: var(--ink); }
.search:focus-within { border-color: var(--brand); outline: 3px solid var(--brand-100); }

.product-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.product-card { display: flex; flex-direction: column; gap: 12px; }
.pc-top { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: start; }
.pc-title h3 { font-size: 16px; font-weight: 700; }
.pc-title .tag { margin-top: 6px; white-space: normal; }
.product-card.is-hidden { background: var(--soft); border-style: dashed; }
.product-card.is-hidden .thumb, .product-card.is-hidden h3 { opacity: .6; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.hidden-toggle { grid-column: 1 / -1; justify-self: center; padding: 8px; font-size: 14px; }
.pc-counts { text-align: right; line-height: 1.1; }
.count-stock { font-size: 26px; font-weight: 800; color: var(--brand); }
.count-stock.zero { color: #9CA3AF; }
.count-cart { font-size: 18px; font-weight: 800; margin-top: 4px; }
.count-label { font-size: 11px; color: var(--muted); }

.thumb {
  width: 52px; height: 52px; border-radius: 10px; background: var(--soft); border: 1px solid var(--line);
  display: grid; place-items: center; color: #9CA3AF; overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb .icon { width: 24px; height: 24px; }

.pc-actions { display: flex; gap: 8px; align-items: center; }
.stepper { display: flex; height: 42px; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; flex: none; }
.stepper button { width: 36px; border: 0; background: #fff; display: grid; place-items: center; }
.stepper button:hover { background: var(--soft); }
.stepper button .icon { width: 16px; height: 16px; }
.stepper-input {
  width: 44px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  text-align: center; font-size: 16px; -moz-appearance: textfield;
}
.stepper-input::-webkit-outer-spin-button, .stepper-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.stock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
/* Product editor: one box per size — total in stock on top, "of which returned" in a tinted box below. */
.stock-grid .stock-cell { border: 1px solid var(--line-2); border-radius: 10px; padding: 8px; background: var(--card); gap: 6px; }
.stock-grid .sc-size-title { font-size: 15px; font-weight: 800; color: var(--ink); }
.stock-grid .sc-main { display: flex; flex-direction: column; gap: 3px; }
.stock-grid .sc-lbl { font-size: 11px; font-weight: 600; color: var(--muted); }
.stock-grid .sc-qty-input { font-size: 17px; font-weight: 700; }
.stock-grid .ret-box { display: flex; flex-direction: column; gap: 3px; padding: 6px; border-radius: 8px; background: #EFF6FF; border: 1px dashed #93C5FD; }
.stock-grid .ret-box .ret-label { margin: 0; color: #1D4ED8; font-weight: 600; }
.stock-grid .ret-box .input-sm { height: 30px; font-size: 13px; color: #1D4ED8; border-color: #BFDBFE; background: #fff; }
.stock-cell { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.stock-cell .input { height: 40px; }

/* ---------- cart / handout ---------- */
.cart-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.ci-name { font-weight: 600; }
.ci-meta { font-size: 13px; margin-top: 6px; }
.items-summary { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }

.sig-wrap { position: relative; height: 190px; border: 1.5px solid #7CB8E8; border-radius: 10px; background: #fff; }
.sig-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; border-radius: 10px; }
.sig-hint { position: absolute; inset: 0; display: grid; place-items: center; color: #CBD5E1; font-size: 20px; pointer-events: none; }
.sig-clear { position: absolute; right: 6px; bottom: 6px; }
.sig-image { width: 100%; border: 1px solid var(--line); border-radius: 10px; }

/* ---------- personnel ---------- */
.person-card { margin-bottom: 8px; }
.person-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.person-head h2 { font-size: 19px; }
.person-sizes { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 6px; margin-top: 12px; }
.person-sizes.compact { display: flex; flex-wrap: wrap; margin-top: 0; }
.size-box { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: 10px; min-width: 0; }
.person-sizes.compact .size-box { flex-direction: row; gap: 6px; padding: 4px 10px; }
.size-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.size-value { font-size: 17px; font-weight: 800; color: var(--ink); overflow-wrap: anywhere; text-align: center; }
.person-sizes.compact .size-value { font-size: 14px; }
.size-value.none { color: #CBD5E1; }
.sizes-empty { margin-top: 10px; }
.size-inputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.filters .input { height: 42px; font-size: 14px; }
.summary-line { margin: 4px 2px 10px; }
.handout-list { display: grid; gap: 10px; }
@media (min-width: 900px) { .handout-list { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); } }
.handout-card { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: start; }
.handout-card .thumb { width: 56px; height: 72px; }
.hc-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hc-title { color: var(--brand); font-weight: 700; }
.hc-actions { display: flex; flex-direction: column; justify-content: space-between; height: 100%; gap: 6px; }

/* ---------- history ---------- */
.history > .card { margin-bottom: 12px; }
.hist-filters { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.hist-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.hist-totals summary { cursor: pointer; font-weight: 700; }
.totals-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-top: 12px; }
.total-item { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.total-head { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.total-head b { color: var(--brand); }

.hist-list { display: flex; flex-direction: column; gap: 8px; }
.hist-row {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px;
  grid-template-areas: "product qty" "person date" "loc reason";
  width: 100%; padding: 10px 12px; text-align: left; font-size: 14px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
}
.hist-row:hover { background: var(--soft); }
.hr-product { grid-area: product; font-weight: 600; }
.hr-qty { grid-area: qty; text-align: right; font-weight: 700; }
.hr-person { grid-area: person; }
.hr-date { grid-area: date; text-align: right; color: var(--muted); font-size: 13px; }
.hr-loc { grid-area: loc; font-size: 13px; }
.hr-reason { grid-area: reason; text-align: right; font-size: 13px; }
.hist-head { display: none; }

.segmented { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 12px; background: #E5E7EB; border-radius: 12px; }
.seg-btn { border: 0; background: transparent; padding: 8px 16px; border-radius: 9px; font-weight: 600; color: var(--ink-2); }
.seg-btn.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
@media (max-width: 480px) {
  .personnel > .segmented, .outstanding .segmented { display: flex; }
  .personnel > .segmented .seg-btn, .outstanding .segmented .seg-btn { flex: 1; padding: 8px 6px; font-size: 13px; line-height: 1.2; }
}

.stock-row { grid-template-areas: "product change" "loc date" "type by"; cursor: default; }
.hr-change { grid-area: change; text-align: right; font-weight: 600; white-space: nowrap; }
.hr-type { grid-area: type; font-size: 13px; }
.hr-by { grid-area: by; text-align: right; font-size: 13px; }
.delta { display: inline-block; min-width: 34px; padding: 1px 6px; border-radius: 6px; font-size: 12px; text-align: center; }
.delta.up { background: #DCFCE7; color: #166534; }
.delta.down { background: #FEE2E2; color: #991B1B; }

@media (min-width: 900px) {
  .hist-list { gap: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
  .hist-row {
    grid-template-columns: 110px 1.2fr 1.6fr 60px 1.1fr 1.3fr; grid-template-areas: "date person product qty loc reason";
    align-items: center; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  }
  .stock-row { grid-template-columns: 150px 1.5fr 1fr 130px 2fr 1fr; grid-template-areas: "date product loc change type by"; }
  .hr-change, .hr-by { text-align: left; }
  .hr-type, .hr-by { font-size: 14px; }
  .hr-date { color: var(--ink); font-size: 14px; text-align: left; }
  .hr-qty, .hr-reason { text-align: left; }
  .hist-head {
    display: grid; grid-template-areas: none; background: var(--soft); cursor: default;
    font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em;
  }
  .hist-head:hover { background: var(--soft); }
  .hist-list .load-more { border: 0; border-radius: 0; }
  .hist-list .empty-state { background: #fff; }
}
@media (min-width: 768px) { .hist-filters .input { height: 42px; font-size: 14px; } }

/* ---------- users & roles ---------- */
.site-ticks { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.user-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; }
.user-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 10px 12px; border: 0; border-top: 1px solid var(--line); background: #fff; text-align: left; }
.user-row:first-child { border-top: 0; }
.user-row:hover { background: var(--soft); }
.ur-name { display: flex; flex-direction: column; min-width: 0; }
.ur-scope { grid-column: 1 / -1; }
.role-badge { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.role-admin { background: var(--navy); color: #fff; }
.role-lead { background: #DBEAFE; color: #1E40AF; }
.role-officer { background: #DCFCE7; color: #166534; }
.inventory > .note { margin-bottom: 12px; }

/* ---------- returns, rotation, orders ---------- */
.count-returned { font-size: 11px; color: var(--blue); font-weight: 600; margin-top: 2px; }
.input.input-sm { height: 36px; font-size: 14px; padding: 0 8px; }
.ret-label { font-size: 11px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.stock-grid.no-returned .ret-label, .stock-grid.no-returned .input-sm, .stock-grid.no-returned .ret-box { display: none; }
.segmented.wide { display: flex; }
.segmented.wide .seg-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
@media (min-width: 768px) { .segmented.wide { display: inline-flex; } .segmented.wide .seg-btn { flex: none; padding: 8px 20px; } }
.dash-stock { margin-bottom: 12px; }
.dash-stock > .segmented { margin: 10px 0 0; }
.seg-count.warn { background: #FEF3D7; color: #8A5A00; }
.seg-count { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 999px; background: rgba(0,0,0,.08); color: var(--ink-2); }
.handout-item { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; border-top: 1px solid var(--line); }
.handout-item:first-of-type { border-top: 0; }
.check-row.small { font-size: 13px; }
.check-row.small input { width: 18px; height: 18px; }
.btn.btn-sm { height: 34px; padding: 0 10px; font-size: 13px; }
.btn.btn-xs { height: 30px; padding: 0 8px; font-size: 12px; }
.btn-row.left { justify-content: flex-start; }
.link-like { border: 0; background: none; padding: 0; text-align: left; color: inherit; cursor: pointer; }
.link-like:hover b, .link-like:hover span:first-child { text-decoration: underline; }

.status-seg { display: inline-flex; gap: 2px; padding: 3px; margin-top: 10px; background: #E5E7EB; border-radius: 10px; }
.status-seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.status-seg.compact { margin-top: 0; }
.status-seg.compact button { padding: 5px 9px; font-size: 12px; }
.status-seg button.active { background: #fff; box-shadow: var(--shadow); }
.status-seg .seg-active.active { color: #166534; }
.status-seg .seg-rotation.active { color: #1E40AF; }
.status-seg .seg-left.active { color: #991B1B; }

.holdings { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding: 8px 10px; border-radius: 10px; background: var(--soft); border: 1px solid var(--line); font-size: 14px; }
.holdings.lost { background: #FDECEC; border-color: #F3B4B4; }
.holdings:empty { display: none; }
.return-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; }
.return-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 10px 12px; border-top: 1px solid var(--line); align-items: center; }
.return-row:first-child { border-top: 0; }
.rr-qty { display: flex; gap: 6px; align-items: center; }
.rr-qty .input { width: 64px; }
.rr-stock { grid-column: 1 / -1; }
@media (min-width: 560px) { .return-row { grid-template-columns: 1fr auto auto; } .rr-stock { grid-column: auto; } }

.crew-counts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.count-chip { border: 1px solid var(--line-2); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; }
.count-chip.active { border-color: var(--ink-2); background: var(--soft); }
.count-chip.seg-active b { color: #166534; }
.count-chip.seg-rotation b { color: #1E40AF; }
.count-chip.seg-left b { color: #991B1B; }
.bulk-bar { position: sticky; top: 64px; z-index: 5; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; padding: 8px 12px; background: var(--navy); color: #fff; border-radius: 12px; }
.bulk-bar .btn { background: #fff; color: var(--ink); border-color: #fff; }
.bulk-bar .btn.c-red { color: var(--red); }
@media (max-width: 480px) {
  .bulk-bar { flex-wrap: nowrap; gap: 6px; padding: 8px 8px 8px 12px; font-size: 13px; }
  .bulk-bar b { white-space: nowrap; }
  .bulk-bar .btn.btn-sm { padding: 0 8px; font-size: 12px; }
  .bulk-bar .icon-btn { width: 32px; height: 32px; }
}
.bulk-bar .icon-btn { color: #fff; margin-left: auto; }
.crews > .card, .outstanding .card, .orders .card { margin-bottom: 12px; }
.crew-head { display: flex; align-items: center; gap: 10px; }
.crew-group.open .crew-head { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.crew-head > input { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.crew-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 0; background: none; padding: 4px 0; text-align: left; cursor: pointer; }
.crew-toggle b { font-size: 15px; }
.crew-mini { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.mini { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--bg); }
.mini.seg-active { color: #166534; background: #DCFCE7; }
.mini.seg-rotation { color: #1E40AF; background: #DBEAFE; }
.mini.seg-left { color: #991B1B; background: #FEE2E2; }
.mini.sel { color: #7A3E00; background: var(--brand-100); }
.crew-chev { color: var(--muted); transition: transform .15s; margin-left: auto; }
.crew-group.open .crew-chev { transform: rotate(180deg); }
.crew-group { padding-top: 10px; padding-bottom: 10px; }
.crew-note { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.crew-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.crew-row:last-child { border-bottom: 0; }
.crew-row > input { width: 18px; height: 18px; accent-color: var(--brand); }
.crew-name { display: flex; flex-direction: column; min-width: 0; }
.crew-name span:first-child { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) {
  .crew-row { grid-template-columns: auto 1fr; }
  .crew-row .status-seg { grid-column: 2; justify-self: start; }
}

.rep-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.rep-head h3 { font-size: 16px; font-weight: 700; }
.rep-total { font-size: 24px; font-weight: 700; color: #0b0b0b; }
.rep-equipment { display: flex; flex-direction: column; }
.rep-line { display: grid; gap: 6px; padding: 8px 0; border-top: 1px solid var(--line); }
@media (min-width: 768px) { .rep-line { grid-template-columns: 220px 1fr; align-items: center; } }
.rep-company > .link-btn { margin-top: 8px; }
.rep-workers { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-2); }
.rep-worker .small { margin-top: 2px; }

.orders > .segmented { margin-bottom: 12px; }
.order-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 2px 10px; }
.order-card { padding-top: 10px; padding-bottom: 10px; }
.order-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; width: 100%; border: 0; background: none; padding: 4px 0; text-align: left; cursor: pointer; }
.oh-title { display: flex; flex-direction: column; flex: 1 1 200px; min-width: 0; }
.oh-title b { font-size: 15px; }
.oh-stats { display: flex; gap: 6px; flex-wrap: wrap; }
.mini.suggest { background: var(--brand-100); color: #7A3E00; }
.mini.ok { background: #DCFCE7; color: #166534; }
.order-card.open .crew-chev { transform: rotate(180deg); }
.order-body { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.order-table td.suggest { color: #7A3E00; font-weight: 700; background: var(--brand-50); }
.formula { margin-top: 4px; }
.order-table th.grp { text-align: center; border-left: 1px solid var(--line); }
.order-table tr.sub th { font-size: 11px; font-weight: 600; }
.order-table tbody td.num, .order-table tfoot td.num { text-align: right; font-variant-numeric: tabular-nums; }
.order-table td.strong { font-weight: 700; }
.order-table td.short { color: #b42318; font-weight: 700; background: #FDECEC; }
.order-table tfoot th, .order-table tfoot td { border-top: 2px solid var(--line-2); font-weight: 700; }
.warn-line { display: flex; align-items: center; gap: 4px; margin: 8px 0 0; }
.warn-line .icon { width: 16px; height: 16px; color: #c98500; }

/* ---------- incidents ---------- */
.incidents > .card { margin-bottom: 12px; }
.inc-list { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .inc-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } .inc-list > .load-more, .inc-list > .empty-state, .inc-list > .loading { grid-column: 1 / -1; } }
.inc-card { display: flex; flex-direction: column; gap: 8px; text-align: left; width: 100%; }
.inc-card:hover { border-color: var(--line-2); }
.inc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.inc-who { min-width: 0; }
.inc-name { font-weight: 700; font-size: 16px; }
.inc-title { font-size: 19px; }
.inc-desc { font-size: 14px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.inc-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tag-amber { background: #FEF3D7; color: #8A5A00; }
.act-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; flex: none; }
.act-grey { background: #E5E7EB; color: #374151; }
.act-blue { background: #DBEAFE; color: #1E40AF; }
.act-yellow { background: #FEF3C7; color: #78350F; }
.act-red { background: #FEE2E2; color: #991B1B; }
.card-chip { width: 9px; height: 12px; border-radius: 2px; background: currentColor; }
.act-yellow .card-chip { background: #EAB308; }
.act-red .card-chip { background: #DC2626; }
.filter-panel > summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.filter-panel > summary::-webkit-details-marker { display: none; }
.filter-panel > summary::after { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin-right: 4px; }
.filter-panel[open] > summary::after { transform: rotate(-135deg); }
.filter-panel[open] > summary { margin-bottom: 12px; }
.filter-chip { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 12px; padding: 2px 4px 2px 12px; border-radius: 999px; background: var(--brand-100); color: #7A3E00; font-weight: 600; font-size: 14px; }
.filter-chip .icon-btn { width: 30px; height: 30px; }
.grow-sm { flex: 1; }
@media (min-width: 768px) { .grow-sm { flex: none; } .incidents .toolbar { justify-content: space-between; } }
.person-incidents { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-top: 10px; }
.person-incidents .link-btn { font-size: 13px; }

.info-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px 16px; padding: 10px 12px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; }
@media (min-width: 560px) { .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.info-row { display: grid; grid-template-columns: 120px 1fr; gap: 8px; font-size: 14px; }
.pre { white-space: pre-wrap; margin: 4px 0 0; }
.ev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 6px; }
.ev-thumb { display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--soft); }
.ev-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ev-file { display: flex; align-items: center; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; color: var(--blue); text-decoration: none; overflow-wrap: anywhere; }
.ev-edit { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ev-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 4px 4px 6px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 13px; }
.ev-chip img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; }
.ev-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.ev-chip .icon-btn { width: 30px; height: 30px; }
.sig-image.small { max-width: 280px; display: block; }
.form-2col { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .form-2col { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.btn-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 560px) { .btn-grid { grid-template-columns: repeat(4, 1fr); } }
.btn-grid .btn { padding: 0 8px; }

/* Five tabs in the desktop header: tighter between tablet and wide desktop */
@media (min-width: 768px) and (max-width: 1150px) {
  .tab { padding: 0 10px; gap: 6px; }
  .brand-name { font-size: 16px; }
}
@media (min-width: 768px) and (max-width: 960px) {
  .tab .icon { display: none; }
  .brand-name { display: none; }
}
@media (max-width: 767px) {
  .tab { font-size: 11px; }
}

/* ---------- dashboard ---------- */
.dashboard > .card { margin-bottom: 12px; }
.dash-filters { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.stat-row { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 12px; }
@media (min-width: 900px) { .stat-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat-tile {
  display: flex; flex-direction: column; gap: 2px; padding: 14px; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.stat-tile.clickable:hover { border-color: var(--line-2); background: var(--soft); }
.stat-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #52514e; }
.stat-value { font-size: 28px; font-weight: 600; line-height: 1.15; color: #0b0b0b; }
.stat-sub { font-size: 12px; }
.status-dot { display: inline-flex; }
.status-dot .icon { width: 16px; height: 16px; }
.status-dot.critical, .status-badge.critical { color: #d03b3b; }
.status-dot.warning { color: #c98500; }
.status-badge {
  display: inline-flex; align-items: center; gap: 3px; padding: 0 6px; border-radius: 999px;
  font-size: 11px; font-weight: 700; line-height: 18px; vertical-align: middle;
}
.status-badge .icon { width: 12px; height: 12px; }
.status-badge.critical { background: #FDECEC; }
.status-badge.warning { background: #FEF3D7; color: #8A5A00; }

.dash-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.dash-grid > *, .stat-row > * { min-width: 0; }
.chart { overflow: hidden; }
@media (min-width: 900px) {
  .dash-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-wide { grid-column: 1 / -1; }
}
.dash-card h3 { font-size: 16px; font-weight: 700; }
.dash-card > .muted.small { margin: 2px 0 12px; }

.chart { position: relative; width: 100%; }
.chart svg { display: block; }
.chart .hit { cursor: pointer; }
.chart-tip {
  position: absolute; top: 0; transform: translateX(-50%); pointer-events: none;
  display: flex; flex-direction: column; gap: 1px; padding: 6px 10px; border-radius: 8px;
  background: #0b0b0b; color: #fff; font-size: 12px; white-space: nowrap; box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
}

.bar-list { display: flex; flex-direction: column; gap: 8px; }
.bl-row { display: grid; grid-template-columns: minmax(90px, 38%) 1fr; gap: 10px; align-items: center; width: 100%; padding: 0; border: 0; background: none; text-align: left; font-size: 13px; }
.bl-row.clickable { cursor: pointer; border-radius: 6px; }
.bl-row.clickable:hover { background: var(--soft); }
.bl-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #0b0b0b; }
.bl-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bl-bar { height: 14px; border-radius: 0 4px 4px 0; flex: none; max-width: calc(100% - 48px); }
.bl-value { font-size: 13px; font-weight: 600; color: #52514e; font-variant-numeric: tabular-nums; }

.dash-stock-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.stock-legend { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0 12px; }
.stock-lines { display: flex; flex-direction: column; }
.stock-line { display: grid; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
@media (min-width: 768px) { .stock-line { grid-template-columns: 220px 1fr; align-items: center; } }
.sl-name { display: flex; flex-direction: column; }
.size-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.size-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 3px 9px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 13px; }
.size-chips.big .size-chip { font-size: 15px; padding: 6px 12px; }
.sc-size { color: #52514e; }
.sc-qty { font-weight: 700; font-variant-numeric: tabular-nums; }
.size-chip.out { background: #FDECEC; border-color: #F3B4B4; }
.size-chip.out .sc-qty { color: #b42318; }
.size-chip.low { background: #FEF3D7; border-color: #F5D58A; }
.size-chip.low .sc-qty { color: #8A5A00; }
.size-chip.none { opacity: .55; }

.matrix-scroll { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }
.stock-matrix { width: 100%; border-collapse: collapse; font-size: 14px; }
.stock-matrix th, .stock-matrix td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.stock-matrix thead th { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.stock-matrix th[scope=row], .stock-matrix thead th:first-child { text-align: left; position: sticky; left: 0; background: #fff; font-weight: 600; color: var(--ink); text-transform: none; letter-spacing: 0; }
.stock-matrix thead th:first-child { color: var(--muted); text-transform: uppercase; font-size: 12px; }
.cell-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 4px 6px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.cell-btn:hover { background: var(--soft); }
.cell-btn.not-carried { color: #9CA3AF; }
.cell-num { font-weight: 600; }
.row-total { font-weight: 700; color: #52514e; }

.section-title { font-size: 15px; font-weight: 700; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.receipt-frame { width: 100%; height: 440px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .45);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease-out;
}
.modal {
  background: #fff; width: 100%; height: 100%; height: 100dvh; display: flex; flex-direction: column;
  animation: rise .2s ease-out;
}
.modal.sm { height: auto; max-height: 85dvh; border-radius: 16px 16px 0 0; }
.modal-header { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 18px; padding-top: max(12px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); }
.modal.sm .modal-header { padding-top: 12px; }
.modal-header h2 { flex: 1; font-size: 18px; font-weight: 700; min-width: 0; }
.modal-icon .icon { width: 24px; height: 24px; }
.modal-body { flex: 1; overflow: auto; padding: 18px; -webkit-overflow-scrolling: touch; }
.modal-footer { padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.confirm-text { margin: 0; font-size: 15px; }

@media (min-width: 768px) {
  .modal-backdrop { align-items: center; padding: 24px; }
  .modal, .modal.sm { width: min(560px, 100%); height: auto; max-height: 90vh; border-radius: 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, .2); }
  .modal.sm { width: min(440px, 100%); }
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(16px); opacity: .6; } }

.pick-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.pick-item { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); background: #fff; }
.pick-item:last-child { border-bottom: 0; }
.pick-item:hover { background: var(--soft); }
.pick-item.selected { background: var(--brand-50); }
.pi-label { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.pi-sub { font-size: 12px; color: var(--muted); }

.menu { display: flex; flex-direction: column; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 12px 10px; border: 0; border-radius: 10px; background: none; text-align: left; font-weight: 500; }
.menu-item:hover { background: var(--bg); }
.menu-item .icon { color: var(--muted); }

.loc-row { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.loc-row.new { border-bottom: 0; padding-top: 4px; }
.loc-actions { display: flex; gap: 8px; align-items: center; }
.loc-actions select { flex: 1; }
.loc-actions .btn { margin-left: auto; }

.country-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 38px; padding: 0 10px; flex: none;
  border: 1px solid var(--line-2); border-radius: 10px; background: #fff; font-weight: 700; font-size: 14px;
}
.country-btn .icon { width: 16px; height: 16px; color: var(--brand); }
.country-btn .chev { color: var(--muted); }

/* ---------- toasts & busy ---------- */
.toast-host {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom));
  z-index: 2000; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100% - 32px)); pointer-events: none;
}
@media (min-width: 768px) { .toast-host { bottom: 24px; } }
.toast { background: var(--navy); color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); font-size: 14px; animation: rise .2s ease-out; transition: opacity .3s; }
.toast-success { background: #166534; }
.toast-error { background: #B91C1C; }
.toast.out { opacity: 0; }

.busy { position: fixed; inset: 0; z-index: 1500; display: grid; place-items: center; background: rgba(255, 255, 255, .55); }
.busy-box { display: flex; align-items: center; gap: 12px; background: #fff; padding: 16px 20px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .15); font-weight: 600; }

/* ---------- login / setup ---------- */
.center-screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px 16px; }
.login-card { width: min(420px, 100%); padding: 28px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.login-card.left { align-items: stretch; text-align: left; }
.login-card.left .brand-logo { align-self: flex-start; }
.login-card h1 { font-size: 21px; }
.login-card p { margin: 0; }
.login-form { width: 100%; text-align: left; }
.login-form .btn[disabled] { opacity: .6; }
.form-error { margin: 0; color: var(--red); font-size: 14px; }
.link-btn.center { align-self: center; }

@media (max-width: 480px) {
  .hide-sm { display: none; }
  .brand-name { font-size: 16px; }
  .header-inner { gap: 8px; }
}
@media (max-width: 360px) { .hide-xs { display: none; } }
