/* ============================================================
   Bagan Bilashi — Business Portal
   Light, editorial, civic-clean. White surface + green/red accents.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@300;400;500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Surfaces */
  --bg:            #f6f7f6;
  --surface:       #ffffff;
  --surface-2:     #fafbfa;
  --surface-3:     #f1f3f1;
  --border:        #e4e7e4;
  --border-strong: #d2d7d2;

  /* Ink */
  --text:          #14181a;
  --text-dim:      #5b6560;
  --text-muted:    #8b948f;
  --text-inv:      #ffffff;

  /* Green — primary brand */
  --green-50:      #eaf5ef;
  --green-100:     #d3ebdd;
  --green-200:     #a8d7bc;
  --green-300:     #6dbc93;
  --green-400:     #34a06d;
  --green-500:     #128a56;
  --green-600:     #0d7048;
  --green-700:     #0a583a;
  --green-800:     #07422c;

  /* Red — accent / danger */
  --red-50:        #fdecec;
  --red-100:       #fbd9d9;
  --red-200:       #f5b0b0;
  --red-300:       #ec7c7c;
  --red-400:       #e14f4f;
  --red-500:       #d22f2f;
  --red-600:       #b52222;
  --red-700:       #8f1a1a;

  /* Support */
  --amber:         #b7791f;
  --amber-bg:      #fdf3e0;
  --blue:          #2563a8;
  --blue-bg:       #e8f0fa;
  --violet:        #6d4aa8;
  --violet-bg:     #f0eafa;

  --radius:        10px;
  --radius-sm:     7px;
  --radius-lg:     14px;

  --shadow-xs:     0 1px 2px rgba(20, 24, 26, 0.04);
  --shadow-sm:     0 1px 3px rgba(20, 24, 26, 0.06), 0 1px 2px rgba(20, 24, 26, 0.04);
  --shadow-md:     0 4px 14px rgba(20, 24, 26, 0.08);
  --shadow-lg:     0 12px 34px rgba(20, 24, 26, 0.12);

  --font-body:  'Hind Siliguri', 'Inter', system-ui, -apple-system, sans-serif;
  --font-head:  'Hind Siliguri', 'Inter', system-ui, sans-serif;
  --mono:       'JetBrains Mono', 'DM Mono', ui-monospace, monospace;

  --sidebar-w:  256px;
}

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

html { font-size: 14px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; line-height: 1.25; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d5dad6; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #b9c0ba; }

/* ============================================================
   LAYOUT
   ============================================================ */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 60;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: transform .25s ease;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(140deg, var(--green-500), var(--green-700));
  display: grid; place-items: center;
  color: #fff; font-size: 17px;
  box-shadow: 0 2px 8px rgba(13, 112, 72, .28);
}
.brand-text .brand-name {
  font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.2;
  letter-spacing: -.01em;
}
.brand-text .brand-sub {
  font-size: 9.5px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase;
  color: var(--green-600); margin-top: 1px;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }

.nav-group { margin-bottom: 14px; }
.nav-group-title {
  font-size: 9.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--text-muted); padding: 6px 10px 5px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 11px; border: none; background: none;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; color: var(--text-dim);
  cursor: pointer; text-align: left; position: relative;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--green-50); color: var(--green-700); font-weight: 600; }
.nav-item.active::before {
  content: ''; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--green-500);
}
.nav-icon { width: 17px; text-align: center; font-size: 13.5px; flex-shrink: 0; opacity: .85; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-badge {
  background: var(--red-500); color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 9px; line-height: 1.5; font-family: var(--mono);
}
.nav-badge.is-green { background: var(--green-500); }
.nav-caret { font-size: 9px; color: var(--text-muted); transition: transform .2s; }
.nav-item[aria-expanded="true"] .nav-caret { transform: rotate(180deg); }

.nav-sub { overflow: hidden; max-height: 0; transition: max-height .25s ease; }
.nav-sub.open { max-height: 520px; }
.nav-sub-item {
  display: flex; align-items: center; gap: 9px;
  padding: 6.5px 11px 6.5px 32px; margin: 1px 0;
  border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-dim);
  transition: background .15s, color .15s;
}
.nav-sub-item:hover { background: var(--surface-3); color: var(--text); }
.nav-sub-item.active { color: var(--green-700); font-weight: 600; background: var(--green-50); }
.nav-dot {
  width: 5px; height: 5px; border-radius: 50%; background: currentColor;
  opacity: .4; flex-shrink: 0;
}
.nav-sub-item.active .nav-dot { opacity: 1; }

.sidebar-foot {
  flex-shrink: 0; padding: 12px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(140deg, var(--green-400), var(--green-700));
  color: #fff; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
.avatar.sm { width: 28px; height: 28px; font-size: 10.5px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.is-red { background: linear-gradient(140deg, var(--red-400), var(--red-700)); }
.avatar.is-blue { background: linear-gradient(140deg, #5b9bd5, var(--blue)); }

.foot-name { font-size: 13px; font-weight: 600; line-height: 1.25; }
.foot-role { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }

/* ── Main ────────────────────────────────────────────────── */
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 11px 22px;
  display: flex; align-items: center; gap: 12px;
}
.topbar-title { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.topbar-spacer { flex: 1; }
.topbar-date { font-family: var(--mono); font-size: 11.5px; color: var(--text-muted); }

.icon-btn {
  position: relative; width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; color: var(--text-dim);
  cursor: pointer; font-size: 13.5px; transition: all .15s;
}
.icon-btn:hover { background: var(--green-50); color: var(--green-600); border-color: var(--green-200); }
.icon-btn .dot {
  position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--red-500); color: #fff;
  font-size: 9.5px; font-weight: 700; font-family: var(--mono);
  display: grid; place-items: center; border: 2px solid var(--surface);
}

.page { padding: 22px; flex: 1; }
.page-wide { max-width: 1560px; }

.burger { display: none; }

/* ============================================================
   PRIMITIVES
   ============================================================ */

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 18px;
}
.page-title { font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
.page-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-xs);
}
.card-head {
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.card-title { font-size: 13.5px; font-weight: 650; letter-spacing: -.005em; }
.card-body { padding: 16px; }
.card-pad { padding: 16px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: all .15s; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--green-600); color: #fff; box-shadow: 0 1px 2px rgba(13,112,72,.25); }
.btn-primary:hover { background: var(--green-700); }
.btn-danger { background: var(--red-500); color: #fff; }
.btn-danger:hover { background: var(--red-600); }
.btn-ghost { background: var(--surface); color: var(--text-dim); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-soft { background: var(--green-50); color: var(--green-700); }
.btn-soft:hover { background: var(--green-100); }
.btn-soft-red { background: var(--red-50); color: var(--red-600); }
.btn-soft-red:hover { background: var(--red-100); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 11px 20px; font-size: 14px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }

/* ── Forms ───────────────────────────────────────────────── */
.field { margin-bottom: 13px; }
.label {
  display: block; font-size: 11.5px; font-weight: 650; color: var(--text-dim);
  margin-bottom: 5px; letter-spacing: .01em;
}
.input, .select, .textarea {
  width: 100%; padding: 8.5px 11px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font-size: 13.5px; color: var(--text);
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--green-400);
  box-shadow: 0 0 0 3px var(--green-50);
}
.textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
.select {
  appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b948f' d='M6 8.5 2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }
.err { font-size: 11.5px; color: var(--red-600); margin-top: 4px; font-weight: 500; }
.input.is-err, .select.is-err, .textarea.is-err { border-color: var(--red-300); }

.check { display: inline-flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: 13px; }
.check input { width: 15px; height: 15px; accent-color: var(--green-600); margin-top: 2px; flex-shrink: 0; }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 38px; height: 21px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; cursor: pointer; border-radius: 11px;
  background: var(--border-strong); transition: background .2s;
}
.switch .track::before {
  content: ''; position: absolute; left: 2.5px; top: 2.5px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform .2s; box-shadow: var(--shadow-sm);
}
.switch input:checked + .track { background: var(--green-500); }
.switch input:checked + .track::before { transform: translateX(17px); }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  background: var(--surface-2); color: var(--text-muted);
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { font-family: var(--mono); font-size: 12.5px; text-align: right; white-space: nowrap; }
.table th.num { text-align: right; }

.empty { padding: 46px 20px; text-align: center; color: var(--text-muted); }
.empty i { font-size: 30px; opacity: .3; margin-bottom: 10px; display: block; }
.empty p { font-size: 13px; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2.5px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 650; letter-spacing: .01em; white-space: nowrap;
}
.badge-green  { background: var(--green-50);  color: var(--green-700); }
.badge-red    { background: var(--red-50);    color: var(--red-600); }
.badge-amber  { background: var(--amber-bg);  color: var(--amber); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue); }
.badge-violet { background: var(--violet-bg); color: var(--violet); }
.badge-gray   { background: var(--surface-3); color: var(--text-dim); }

/* Order status */
.st-pending    { background: var(--amber-bg);  color: var(--amber); }
.st-processing { background: var(--blue-bg);   color: var(--blue); }
.st-delivery   { background: var(--violet-bg); color: var(--violet); }
.st-hold       { background: var(--surface-3); color: var(--text-dim); }
.st-complete   { background: var(--green-50);  color: var(--green-700); }
.st-cancel     { background: var(--red-50);    color: var(--red-600); }
.st-refund     { background: var(--amber-bg);  color: var(--amber); }

.dot-live {
  width: 6px; height: 6px; border-radius: 50%; background: var(--green-500);
  box-shadow: 0 0 0 3px var(--green-100); flex-shrink: 0;
}
.dot-live.is-off { background: var(--text-muted); box-shadow: 0 0 0 3px var(--surface-3); }
.dot-live.is-red { background: var(--red-500); box-shadow: 0 0 0 3px var(--red-100); }

/* ── Stat cards ──────────────────────────────────────────── */
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 16px;
  transition: box-shadow .18s, transform .18s;
}
.stat:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.stat-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-muted);
}
.stat-chip {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  font-size: 12.5px;
}
.chip-green  { background: var(--green-50);  color: var(--green-600); }
.chip-red    { background: var(--red-50);    color: var(--red-500); }
.chip-amber  { background: var(--amber-bg);  color: var(--amber); }
.chip-blue   { background: var(--blue-bg);   color: var(--blue); }
.chip-violet { background: var(--violet-bg); color: var(--violet); }
.stat-value {
  font-family: var(--mono); font-size: 22px; font-weight: 500;
  letter-spacing: -.02em; line-height: 1.15;
}
.stat-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.trend-up   { color: var(--green-600); font-weight: 600; }
.trend-down { color: var(--red-500);   font-weight: 600; }

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 15px; border: 1px solid transparent;
}
.alert i { margin-top: 2px; flex-shrink: 0; }
.alert-success { background: var(--green-50); color: var(--green-700); border-color: var(--green-100); }
.alert-error   { background: var(--red-50);   color: var(--red-600);   border-color: var(--red-100); }
.alert-warn    { background: var(--amber-bg); color: var(--amber);     border-color: #f2e2c4; }
.alert-info    { background: var(--blue-bg);  color: var(--blue);      border-color: #d4e3f5; }

/* ── Tabs / segmented ────────────────────────────────────── */
.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab {
  padding: 8px 13px; font-size: 13px; font-weight: 550; color: var(--text-dim);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap; cursor: pointer; transition: all .15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--green-700); border-bottom-color: var(--green-500); font-weight: 650; }

.seg { display: inline-flex; background: var(--surface-3); border-radius: 8px; padding: 3px; gap: 2px; }
.seg a, .seg button {
  padding: 5px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 600;
  color: var(--text-dim); border: none; background: none; cursor: pointer; transition: all .15s;
}
.seg a.active, .seg button.active { background: var(--surface); color: var(--green-700); box-shadow: var(--shadow-xs); }

/* ── Pagination ──────────────────────────────────────────── */
.pagination { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: center; margin-top: 16px; }
.pagination svg { width: 13px; height: 13px; }
.pagination a, .pagination span {
  min-width: 32px; height: 32px; padding: 0 9px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 12.5px; color: var(--text-dim);
  transition: all .15s;
}
.pagination a:hover { background: var(--green-50); color: var(--green-700); border-color: var(--green-200); }
.pagination .active span, .pagination span[aria-current] {
  background: var(--green-600); color: #fff; border-color: var(--green-600); font-weight: 650;
}
.pagination .disabled span { opacity: .4; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0; background: rgba(20, 24, 26, .45);
  backdrop-filter: blur(2px); z-index: 200;
  display: grid; place-items: center; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
}
.modal-head { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 18px; }
.modal-foot { padding: 13px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ── Utility ─────────────────────────────────────────────── */
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.row { display: flex; align-items: center; gap: 9px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.row-wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 9px; }
.spacer { flex: 1; }

.mono { font-family: var(--mono); }
.t-xs { font-size: 11px; } .t-sm { font-size: 12.5px; } .t-md { font-size: 13.5px; } .t-lg { font-size: 16px; }
.fw-6 { font-weight: 600; } .fw-7 { font-weight: 700; }
.c-green { color: var(--green-600); } .c-red { color: var(--red-500); }
.c-dim { color: var(--text-dim); } .c-muted { color: var(--text-muted); }
.c-amber { color: var(--amber); } .c-blue { color: var(--blue); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.center { text-align: center; } .right { text-align: right; }
.mt-0{margin-top:0}.mt-1{margin-top:6px}.mt-2{margin-top:12px}.mt-3{margin-top:18px}.mt-4{margin-top:24px}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:6px}.mb-2{margin-bottom:12px}.mb-3{margin-bottom:18px}.mb-4{margin-bottom:24px}
.hidden { display: none !important; }
.divider { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

.filters {
  display: flex; gap: 9px; flex-wrap: wrap; align-items: flex-end;
  padding: 13px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 15px;
}
.filters .field { margin-bottom: 0; }
.filters .input, .filters .select { min-width: 130px; }

/* Progress */
.bar { height: 6px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--green-500); border-radius: 4px; transition: width .4s; }
.bar.is-red > span { background: var(--red-500); }
.bar.is-amber > span { background: var(--amber); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .burger { display: grid; }
  .scrim { position: fixed; inset: 0; background: rgba(20,24,26,.4); z-index: 55; }
  .g3, .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .page { padding: 14px; }
  .topbar { padding: 10px 14px; }
  .g2, .g3, .g4, .g5 { grid-template-columns: 1fr; }
  .page-title { font-size: 18px; }
  .topbar-date { display: none; }
  .filters { padding: 11px 12px; }
  .filters .input, .filters .select { min-width: 0; flex: 1; }
}

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main { margin-left: 0; }
  .page { padding: 0; }
  body { background: #fff; }
  .card { border: none; box-shadow: none; }
}

/* Order list: a parcel id that has not been filled in yet. */
.input.is-missing {
    border-color: var(--red-300);
    background: var(--red-50);
}

/* Radio cards — used for the product bottom type. */
.pick-card {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.pick-card:hover   { border-color: var(--green-600); }
.pick-card.is-on   { border-color: var(--green-600); background: var(--green-50); }
.pick-card input   { margin-top: 3px; accent-color: var(--green-600); }
.pick-card strong  { display: block; font-size: 13px; }
.pick-card small   { display: block; margin-top: 2px; font-size: 11.5px; color: var(--text-muted); }

/* Colour chips — pick from the colours set up in Settings → Products. */
.color-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.color-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px 6px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    transition: border-color .15s, background .15s;
}
.color-chip:hover { border-color: var(--green-600); }
.color-chip input { position: absolute; opacity: 0; pointer-events: none; }
.color-chip:has(input:checked) { border-color: var(--green-600); background: var(--green-50); font-weight: 600; }
.color-chip .dot {
    width: 14px; height: 14px; border-radius: 50%;
    border: 1px solid rgba(0,0,0,.18); flex-shrink: 0;
}
.color-chip .x { margin-left: 2px; color: var(--text-muted); cursor: pointer; }
.color-chip .x:hover { color: #c0392b; }

/* Products list — one-click filter chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-right: 2px; min-width: 64px; }
.fchip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-dim);
  font-size: 13px; text-decoration: none; transition: border-color .15s, background .15s;
}
.fchip b { font-weight: 600; color: var(--text-muted); font-size: 12px; }
.fchip:hover { border-color: var(--green-500); color: var(--text); }
.fchip.is-on { background: var(--green-600); border-color: var(--green-600); color: #fff; }
.fchip.is-on b { color: rgba(255,255,255,.75); }

/* Products list — edit side panel */
.side-panel-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 20, .35); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 80; }
.side-panel-backdrop.is-open { opacity: 1; pointer-events: auto; }
.side-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface-2);
  border-left: 1px solid var(--border); box-shadow: -12px 0 40px rgba(0,0,0,.12);
  transform: translateX(100%); transition: transform .25s cubic-bezier(.22,1,.36,1); z-index: 81;
  display: flex; flex-direction: column;
}
.side-panel.is-open { transform: translateX(0); }
.side-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.side-panel-body { padding: 16px; overflow-y: auto; flex: 1; }
.side-panel-body .btn-block { position: sticky; bottom: 0; box-shadow: 0 -8px 16px var(--surface-2); }
tr.is-editing td { background: var(--green-50); }
tr.just-saved td { animation: rowSaved 1.6s ease-out; }
@keyframes rowSaved { from { background: var(--green-50); } to { background: transparent; } }
.side-panel .grid, .side-panel .col { min-width: 0; width: 100%; }
.side-panel .grid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.side-panel .grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.side-panel .card, .side-panel .field, .side-panel .input, .side-panel .select, .side-panel .textarea { min-width: 0; max-width: 100%; }
.side-panel .pick-card { min-width: 0; }

/* Media library + "Choose from library" window */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.media-tile { display: block; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-align: left; min-width: 0; }
.media-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; display: block; background: var(--surface-3); }
.media-tile.is-pickable { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.media-tile.is-pickable:hover { border-color: var(--green-500); }
.media-tile.is-picked { border-color: var(--green-600); box-shadow: 0 0 0 2px var(--green-600); }
.media-picker { position: fixed; inset: 0; z-index: 90; background: rgba(15, 23, 20, .45); display: none; align-items: center; justify-content: center; padding: 20px; }
.media-picker.is-open { display: flex; }
.media-picker-box { width: min(900px, 100%); max-height: 88vh; display: flex; flex-direction: column; background: var(--surface-2); border-radius: 14px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.media-picker-body { padding: 16px; overflow-y: auto; flex: 1; }
.picked-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.picked-strip span { position: relative; width: 64px; height: 64px; }
.picked-strip img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.picked-strip button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--red-500, #d33); color: #fff; font-size: 11px; cursor: pointer; }

/* Top bar — live website visitors */
.live-pill { position: relative; margin-right: 6px; }
.live-btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--green-100, #cfe8da); background: var(--green-50); color: var(--green-700, #0b5c3b); font-size: 13px; cursor: pointer; }
.live-btn b { font-variant-numeric: tabular-nums; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-500); box-shadow: 0 0 0 0 rgba(18,138,86,.5); animation: livePulse 2s infinite; }
.live-pill.is-quiet .live-btn { background: var(--surface-3); border-color: var(--border); color: var(--text-muted); }
.live-pill.is-quiet .live-dot { background: var(--text-muted); animation: none; }
.live-menu { display: none; position: absolute; right: 0; top: calc(100% + 6px); width: 280px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 30px rgba(0,0,0,.12); padding: 12px; z-index: 70; }
.live-pill.is-open .live-menu { display: block; }
.live-menu ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.live-menu li { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.live-menu li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(18,138,86,.45); } 70% { box-shadow: 0 0 0 7px rgba(18,138,86,0); } 100% { box-shadow: 0 0 0 0 rgba(18,138,86,0); } }
@media (max-width: 640px) { .live-label { display: none; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
