/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #eaecf0;
  --paper:    #f5f6f8;
  --ink:      #1a2744;
  --muted:    #7a6f60;
  --border:   #ddd3bb;
  --red:      #c0392b;
  --red-bg:   #fdf0ef;
  --yellow:   #d4940a;
  --yel-bg:   #fefae8;
  --green:    #27674a;
  --accent:   #3a5c3a;
  --header-h: 56px;
}

body {
  background: var(--bg);
  font-family: 'IBM Plex Sans', sans-serif;
  color: #1a2744;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ── Fullscreen centre ───────────────────────────────────── */
.fullscreen-center {
  position: fixed; inset: 0;
  background: #1a2744;
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}

/* ── Splash / sign-in card ───────────────────────────────── */
.splash { text-align: center; }
.splash-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 42px; letter-spacing: 3px;
  color: #f0c040; margin-bottom: 8px;
}
.splash-sub { color: #8a9dbf; font-family: 'IBM Plex Mono', monospace; font-size: 13px; }

.signin-card {
  background: #1e2f52; border-radius: 18px;
  padding: 34px 30px; width: 100%; max-width: 360px;
  box-shadow: 0 32px 100px rgba(0,0,0,.7);
}
.signin-card .splash-title { margin-bottom: 4px; }
.signin-card .splash-sub   { margin-bottom: 20px; }

.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.chip {
  background: #243058; color: #ccc; border: 1px solid #3a5080;
  border-radius: 20px; padding: 7px 16px; font-size: 13px;
  cursor: pointer; font-family: 'IBM Plex Mono', monospace;
  transition: all .15s;
}
.chip:hover { background: #2e3f72; color: #fff; border-color: #666; }

.or-divider {
  text-align: center; color: #5a7299; font-size: 11px;
  text-transform: uppercase; letter-spacing: 1px;
  font-family: 'IBM Plex Mono', monospace;
  margin: 14px 0 10px;
}

.dark-input {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid #3a5080; border-radius: 8px;
  background: #151f3a; color: #fff;
  font-family: 'IBM Plex Mono', monospace; font-size: 14px;
  outline: none; margin-bottom: 14px;
}
.dark-input:focus { border-color: #f0c040; }

.yellow-btn {
  width: 100%; padding: 13px;
  background: #f0c040; color: #1a2744;
  border: none; border-radius: 9px;
  font-weight: 800; font-size: 15px;
  cursor: pointer; font-family: 'IBM Plex Sans', sans-serif;
  transition: background .15s;
}
.yellow-btn:hover { background: #e6b800; }

/* ── Header ─────────────────────────────────────────────── */
header {
  background: #1a2744; color: #fff;
  height: var(--header-h);
  padding: 0 18px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.35);
  gap: 10px;
}
.header-left { display: flex; align-items: center; gap: 14px; }
.header-logo {
  height: 36px; width: auto;
  filter: brightness(0) invert(1);
  flex-shrink: 0;
}
.header-title-block {
  display: flex; flex-direction: column; gap: 2px;
}
.header-biz {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 11px; color: #b0bcd4; font-weight: 500;
  letter-spacing: .3px; white-space: nowrap;
}
.sync-badge { display: flex; align-items: center; gap: 5px; }
.sync-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #555; flex-shrink: 0;
  transition: background .3s, box-shadow .3s;
}
.sync-dot.ok     { background: #4caf50; box-shadow: 0 0 6px #4caf50; }
.sync-dot.err    { background: var(--red); }
.sync-dot.saving { background: #f0c040; animation: pulse 1s infinite; }
#syncLabel { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: #8a9dbf; }

.header-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.nav-btn {
  background: transparent; border: 1px solid #3a5080;
  color: #b0bcd4; border-radius: 6px;
  padding: 5px 12px; font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: 'IBM Plex Sans', sans-serif;
  transition: all .15s; white-space: nowrap;
}
.nav-btn:hover  { background: #243058; color: #fff; }
.nav-btn.active { background: #f0c040; color: #1a2744; border-color: #f0c040; }

.user-pill {
  background: #2a3d6b; border: 1px solid #3a5080;
  border-radius: 20px; padding: 5px 14px;
  font-size: 12px; font-weight: 600; cursor: pointer; color: #fff;
  white-space: nowrap; font-family: 'IBM Plex Sans', sans-serif;
}
.user-pill:hover { background: #3a3a3a; }

/* ── Legend bar ─────────────────────────────────────────── */
.legend-bar {
  display: flex; gap: 14px; padding: 8px 18px;
  background: #fff; border-bottom: 2px solid var(--border);
  font-family: 'IBM Plex Mono', monospace; font-size: 13px;
  font-weight: 600; flex-wrap: wrap; align-items: center;
}
.legend-item { display: flex; align-items: center; gap: 5px; }
.leg-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.leg-dot.plain  { background: #c0392b; }
.leg-dot.red    { background: #b8620a; }
.leg-dot.yellow { background: #1e7e3e; }

.legend-stats { margin-left: auto; display: flex; gap: 14px; flex-wrap: wrap; }
.stat-muted  { color: #c0392b; }
.stat-red    { color: #b8620a; }
.stat-yellow { color: #1e7e3e; }
.stat-total  { color: #1a2744; font-weight: 700; }

/* ── Toolbar ────────────────────────────────────────────── */
.toolbar {
  padding: 10px 18px; display: flex; gap: 8px; flex-wrap: wrap;
  align-items: center; border-bottom: 1px solid var(--border);
  background: var(--paper);
}
.search-input {
  flex: 1; min-width: 150px; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: 7px;
  font-family: 'IBM Plex Mono', monospace; font-size: 13px;
  background: #fff; outline: none; color: #1a2744;
}
.search-input:focus { border-color: var(--accent); }
.filter-sel {
  padding: 9px 10px; border: 1.5px solid var(--border);
  border-radius: 7px; font-family: 'IBM Plex Mono', monospace;
  font-size: 13px; background: #fff; cursor: pointer; color: #1a2744;
  outline: none;
}
.add-btn {
  padding: 9px 16px; background: #1a2744; color: #f0c040;
  border: none; border-radius: 7px; font-weight: 700; font-size: 15px;
  cursor: pointer; white-space: nowrap; font-family: 'IBM Plex Sans', sans-serif;
  transition: background .15s;
}
.add-btn:hover { background: #243058; }

/* ── Date section ───────────────────────────────────────── */
.date-section { margin-bottom: 2px; }
.date-header {
  background: #1a2744; color: #f0c040;
  padding: 9px 18px; font-family: 'Bebas Neue', sans-serif;
  font-size: 21px; letter-spacing: 2px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
  transition: background .15s;
}
.date-header:hover { background: #2a3d6b; }
.date-count { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: #999; letter-spacing: 0; }

/* ── Order grid ─────────────────────────────────────────── */
.orders-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px; background: var(--border);
}
@media (min-width: 768px) {
  .orders-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Order card ─────────────────────────────────────────── */
.order-card {
  padding: 13px 15px; background: var(--paper);
  border-left: 6px solid #b0a090;
  display: flex; flex-direction: column; gap: 6px;
  position: relative;
}

/* Plain = RED — not delivered */
.order-card.st-plain {
  background: #fcd5d2;
  border-left: 6px solid #c0392b;
  box-shadow: inset 3px 0 0 #c0392b;
}
.order-card.st-plain .card-customer,
.order-card.st-plain .card-items { color: #5a0a04; }

/* Red = AMBER — loaded on route */
.order-card.st-red {
  background: #fdebc8;
  border-left: 6px solid #b8620a;
  box-shadow: inset 3px 0 0 #b8620a;
}
.order-card.st-red .card-customer,
.order-card.st-red .card-items { color: #3d1f00; }

/* Yellow = GREEN — invoiced & checked */
.order-card.st-yellow {
  background: #d4f0dc;
  border-left: 6px solid #1e7e3e;
  box-shadow: inset 3px 0 0 #1e7e3e;
}
.order-card.st-yellow .card-customer,
.order-card.st-yellow .card-items { color: #0a2e16; }

/* Status badge — big pill at top right of card */
.status-badge {
  position: absolute; top: 10px; right: 10px;
  font-size: 12px; font-weight: 800; letter-spacing: .5px;
  text-transform: uppercase; padding: 3px 9px;
  border-radius: 10px; font-family: 'IBM Plex Mono', monospace;
}
.badge-plain  { background: #c0392b; color: #fff; }
.badge-red    { background: #b8620a; color: #fff; }
.badge-yellow { background: #1e7e3e; color: #fff; }

.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card-customer { font-weight: 700; font-size: 17px; line-height: 1.2; flex: 1; cursor: pointer; }
.card-customer:hover { text-decoration: underline; color: var(--accent); }
.card-meta { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: var(--muted); text-align: right; flex-shrink: 0; }
.card-items { font-family: 'IBM Plex Mono', monospace; font-size: 14px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.card-notes { font-family: 'IBM Plex Mono', monospace; font-size: 13px; color: var(--muted); }

.card-footer { display: flex; justify-content: space-between; align-items: center; }
.card-status-by { font-size: 13px; color: var(--muted); font-style: italic; }

.status-btns { display: flex; gap: 4px; align-items: center; }
.st-btn {
  width: 38px; height: 38px; border-radius: 50%;
  border: 2px solid; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; transition: all .15s;
}
.st-btn.s-plain  { border-color: #b0a090; color: #b0a090; }
.st-btn.s-red    { border-color: var(--red);    color: var(--red); }
.st-btn.s-yellow { border-color: #b8860b; color: #b8860b; }
.st-btn.active.s-plain  { background: #b0a090; color: #fff; }
.st-btn.active.s-red    { background: var(--red);    color: #fff; }
.st-btn.active.s-yellow { background: #b8860b; color: #fff; }
.st-btn:hover { transform: scale(1.15); }

.icon-btn {
  background: transparent; border: none; color: #c0b8ac;
  cursor: pointer; font-size: 14px; padding: 2px 5px;
  border-radius: 4px; transition: all .15s;
}
.icon-btn:hover        { color: #1a2744; background: var(--border); }
.icon-btn.del:hover    { color: var(--red); background: var(--red-bg); }

/* ── Modal ──────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-card {
  background: var(--paper); border-radius: 14px; padding: 24px;
  width: 100%; max-width: 460px; max-height: 92vh; overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,.4);
}
.modal-title {
  font-family: 'Bebas Neue', sans-serif; font-size: 24px;
  letter-spacing: 1.5px; margin-bottom: 16px;
}
.form-group { margin-bottom: 13px; }
.form-group label {
  display: block; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); margin-bottom: 4px;
  font-family: 'IBM Plex Mono', monospace;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid var(--border); border-radius: 7px;
  font-family: 'IBM Plex Mono', monospace; font-size: 13px;
  background: #fff; outline: none; resize: vertical; color: #1a2744;
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { min-height: 88px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

.ghost-btn {
  padding: 10px 18px; background: transparent;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-weight: 600; font-size: 14px; cursor: pointer;
  color: #1a2744; font-family: 'IBM Plex Sans', sans-serif;
  transition: background .15s;
}
.ghost-btn:hover { background: var(--border); }

/* ── Customer history view ──────────────────────────────── */
.cust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1px; background: var(--border); margin: 0;
}
.cust-card {
  background: var(--paper); padding: 14px 16px; cursor: pointer;
  border-left: 4px solid var(--border); transition: background .15s;
}
.cust-card:hover { background: #f0ece3; }
.cust-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.cust-meta { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--muted); line-height: 1.5; }
.cust-badge {
  display: inline-block; font-size: 10px; padding: 2px 7px;
  border-radius: 10px; font-weight: 700; margin-top: 5px;
  font-family: 'IBM Plex Mono', monospace;
}
.badge-plain  { background: #ece8e2; color: var(--muted); }
.badge-red    { background: var(--red-bg); color: var(--red); }
.badge-yellow { background: var(--yel-bg); color: var(--yellow); }

.hist-order {
  border-left: 3px solid var(--border); padding: 10px 14px; margin-bottom: 8px;
  border-radius: 0 6px 6px 0;
}
.hist-order.st-plain  { border-left-color: #b0a090; background: var(--paper); }
.hist-order.st-red    { border-left-color: var(--red);    background: var(--red-bg); }
.hist-order.st-yellow { border-left-color: var(--yellow); background: var(--yel-bg); }
.hist-date { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.hist-items { font-family: 'IBM Plex Mono', monospace; font-size: 12px; line-height: 1.55; white-space: pre-wrap; }

/* ── Summary / print view ───────────────────────────────── */
.summary-wrap { padding: 20px 18px; max-width: 900px; margin: 0 auto; }
.summary-title { font-family: 'Bebas Neue', sans-serif; font-size: 32px; letter-spacing: 2px; margin-bottom: 4px; }
.summary-date-str { font-family: 'IBM Plex Mono', monospace; font-size: 15px; color: var(--muted); margin-bottom: 20px; }
.summary-stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px;
}
.sum-stat {
  background: #fff; border: 1.5px solid var(--border); border-radius: 8px;
  padding: 12px 14px; text-align: center;
}
.sum-stat-num { font-family: 'Bebas Neue', sans-serif; font-size: 38px; line-height: 1; }
.sum-stat-lbl { font-family: 'IBM Plex Mono', monospace; font-size: 13px; color: var(--muted); margin-top: 2px; }
.sum-section-title { font-size: 18px !important;
  font-family: 'Bebas Neue', sans-serif; font-size: 18px; letter-spacing: 1px;
  padding: 6px 0; border-bottom: 2px solid var(--border); margin: 18px 0 10px;
}
.sum-order-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 12px; margin-bottom: 2px;
  border-radius: 6px; font-size: 13px;
}
.sum-order-row.st-plain  { background: var(--paper); border-left: 3px solid #b0a090; }
.sum-order-row.st-red    { background: var(--red-bg); border-left: 3px solid var(--red); }
.sum-order-row.st-yellow { background: var(--yel-bg); border-left: 3px solid var(--yellow); }
.sum-cust { font-weight: 700; min-width: 160px; flex-shrink: 0; }
.sum-items { font-family: 'IBM Plex Mono', monospace; font-size: 12px; flex: 1; white-space: pre-wrap; }
.sum-by { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--muted); min-width: 80px; text-align: right; flex-shrink: 0; }
.sum-empty { color: var(--muted); font-family: 'IBM Plex Mono', monospace; font-size: 13px; padding: 20px 0; }

/* ── Empty states ───────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--muted); font-family: 'IBM Plex Mono', monospace; font-size: 13px;
}
.empty-icon { font-size: 44px; margin-bottom: 12px; }

/* ── Animations ─────────────────────────────────────────── */
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── Print styles ───────────────────────────────────────── */


/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .orders-grid { grid-template-columns: 1fr; }
  .header-right .nav-btn { padding: 4px 8px; font-size: 11px; }
  .legend-stats { display: none; }
  .summary-stats-row { grid-template-columns: repeat(2, 1fr); }
  .app-title { font-size: 20px; }
}

/* ── Order line inputs ──────────────────────────────────── */
.order-lines { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.order-line {
  display: grid; grid-template-columns: 110px 1fr 32px;
  gap: 6px; align-items: center;
}
.order-line input {
  padding: 9px 10px; border: 1.5px solid var(--border); border-radius: 7px;
  font-family: 'IBM Plex Mono', monospace; font-size: 13px;
  background: #fff; outline: none; color: #1a2744; width: 100%;
}
.order-line input:focus { border-color: var(--accent); }
.order-line input.qty { font-weight: 600; }
.remove-line-btn {
  background: transparent; border: none; color: #ccc;
  cursor: pointer; font-size: 18px; line-height: 1;
  border-radius: 4px; padding: 2px 4px;
}
.remove-line-btn:hover { color: var(--red); background: var(--red-bg); }
.add-line-btn {
  background: transparent; border: 1.5px dashed var(--border);
  border-radius: 7px; padding: 7px 14px; font-size: 13px;
  font-weight: 600; color: var(--muted); cursor: pointer; width: 100%;
  font-family: 'IBM Plex Sans', sans-serif; transition: all .15s;
}
.add-line-btn:hover { border-color: var(--accent); color: var(--accent); background: #f5f0e8; }
.line-header {
  display: grid; grid-template-columns: 110px 1fr 32px;
  gap: 6px; margin-bottom: 2px;
}
.line-header span {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
}

/* ── PIN screen ─────────────────────────────────────────── */
.splash-logo {
  height: 52px; width: auto; margin: 0 auto 6px;
  display: block;
  /* Blue logo on dark bg - invert to white */
  filter: brightness(0) invert(1);
}
.splash-biz {
  color: #8a9dbf; font-size: 12px; margin-bottom: 22px;
  font-family: 'IBM Plex Mono', monospace; text-align: center;
}
.pin-label {
  color: #ccc; font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
  font-family: 'IBM Plex Mono', monospace; margin-bottom: 12px;
}
.pin-input {
  text-align: center; font-size: 22px; letter-spacing: 8px;
  margin-bottom: 8px;
}
.pin-error {
  color: #e74c3c; font-size: 12px; min-height: 18px;
  font-family: 'IBM Plex Mono', monospace; margin-bottom: 10px;
}
.pin-hint {
  color: #5a7299; font-size: 11px; margin-top: 14px;
  font-family: 'IBM Plex Mono', monospace;
}

/* ── Header logo (blue on dark — keep colour) ───────────── */
.header-logo {
  height: 36px; width: auto; flex-shrink: 0;
  /* Keep blue colour on dark header */
  filter: brightness(0) invert(1);
}

/* ── User name display — orange accent ──────────────────── */
.card-user {
  color: #1a2744;
  font-weight: 800;
  font-size: 14px;
  font-family: 'IBM Plex Mono', monospace;
}
.card-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  flex-shrink: 0;
  line-height: 1.6;
}
.status-user {
  color: #1a2744;
  font-weight: 800;
  font-size: 14px;
}
.sum-by {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 15px;
  color: #1a2744;
  font-weight: 800;
  min-width: 80px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Summary table columns ──────────────────────────────── */
.sum-table-header {
  display: grid;
  grid-template-columns: 180px 100px 1fr 100px;
  gap: 0;
  padding: 5px 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid rgba(0,0,0,.1);
  margin-bottom: 2px;
}
.sum-order-block {
  border-radius: 4px;
  margin-bottom: 3px;
  overflow: hidden;
}
.sum-order-row-main,
.sum-order-row-extra {
  display: grid;
  grid-template-columns: 180px 100px 1fr 100px;
  gap: 0;
  padding: 7px 12px;
  align-items: baseline;
}
.sum-order-row-extra {
  padding-top: 2px;
  padding-bottom: 4px;
}
.sum-cust-name {
  font-weight: 700;
  font-size: 15px;
}
.sum-qty-cell {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  font-weight: 700;
}
.sum-detail-cell {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
}
.sum-col-by {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 15px;
  font-weight: 800;
  color: #1a2744;
  text-align: right;
}
.sum-order-notes {
  padding: 2px 14px 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  opacity: .75;
}

@media print {
  /* ── Hide everything except the print sheet ── */
  header, .legend-bar, .toolbar, .nav-btn, .user-pill,
  .sync-badge, #viewOrders, #viewCustomers,
  #viewSummary .toolbar, .add-btn,
  .fullscreen-center, #loadingScreen,
  #signinScreen, #pinScreen { display: none !important; }

  #viewSummary { display: block !important; }
  body { background: #fff; margin: 0; }

  /* ── Page setup ── */
  @page {
    size: A4 portrait;
    margin: 14mm 12mm 14mm 12mm;
  }

  /* ── Print header with logo ── */
  .print-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid #1a2744;
    padding-bottom: 10px;
    margin-bottom: 14px;
  }
  .print-logo { height: 42px; width: auto; }
  .print-header-right { text-align: right; }
  .print-biz { font-size: 13px; color: #1a2744; font-weight: 700; }
  .print-date-lbl { font-size: 11px; color: #555; font-family: 'IBM Plex Mono', monospace; }

  /* ── Summary stats boxes ── */
  .summary-wrap { padding: 0; }
  .summary-title { font-size: 22px !important; margin-bottom: 2px; }
  .summary-date-str { font-size: 13px !important; margin-bottom: 12px; }
  .summary-stats-row {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 16px !important;
  }
  .sum-stat { padding: 8px 10px !important; }
  .sum-stat-num { font-size: 28px !important; }
  .sum-stat-lbl { font-size: 10px !important; }

  /* ── Section headings ── */
  .sum-section-title {
    font-size: 14px !important;
    padding: 5px 0 !important;
    margin: 14px 0 5px !important;
    break-after: avoid;
  }

  /* ── Column headers ── */
  .sum-table-header {
    grid-template-columns: 150px 90px 1fr 80px !important;
    font-size: 10px !important;
    padding: 4px 10px !important;
    background: #f0f2f5;
    border-radius: 3px;
  }

  /* ── Order blocks ── */
  .sum-order-block { break-inside: avoid; margin-bottom: 2px !important; }
  .sum-order-row-main,
  .sum-order-row-extra {
    grid-template-columns: 150px 90px 1fr 80px !important;
    padding: 5px 10px !important;
  }
  .sum-cust-name { font-size: 12px !important; }
  .sum-qty-cell  { font-size: 11px !important; }
  .sum-detail-cell { font-size: 11px !important; }
  .sum-col-by { font-size: 12px !important; color: #1a2744 !important; }
  .sum-order-notes { font-size: 10px !important; padding: 1px 10px 5px !important; }

  /* ── Backgrounds print correctly ── */
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  /* ── Footer ── */
  .print-footer {
    display: block !important;
    position: fixed;
    bottom: 0;
    left: 0; right: 0;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    color: #999;
    text-align: center;
    border-top: 1px solid #ddd;
    padding-top: 4px;
  }
}

@media (max-width: 600px) {
  .sum-table-header,
  .sum-order-row-main,
  .sum-order-row-extra {
    grid-template-columns: 110px 70px 1fr 60px;
  }
  .sum-cust-name { font-size: 12px; }
  .sum-qty-cell, .sum-detail-cell { font-size: 11px; }
}

/* ── Uppercase names everywhere ─────────────────────────── */
.card-customer,
.cust-name,
.sum-cust-name,
.card-user,
.status-user,
.sum-col-by,
.sum-by,
.card-status-by { text-transform: uppercase; }

/* ── Staff management ───────────────────────────────────── */
#navSettings {
  background: transparent;
  border: 1px solid #3a5080;
  color: #b0bcd4;
}
#navSettings.active {
  background: #f0c040;
  color: #1a2744;
  border-color: #f0c040;
}
