/* Order Panel — warm cream + yellow accent, after the reference dashboard video. */
:root {
  --bg: #F3EFE6;
  --surface: #FAF8F3;
  --card: #FFFFFF;
  --line: #ECE6DA;
  --line-strong: #DED6C6;
  --text: #1F1D1A;
  --muted: #8A8378;
  --muted-2: #B3AC9F;
  --accent: #F2B92E;
  --accent-strong: #D99A0B;
  --accent-soft: #FDF1CF;
  --accent-wash: #FFF8E6;
  --dark: #1C1B19;
  --green: #2E9E5B;
  --green-soft: #E3F4EA;
  --red: #E5484D;
  --red-soft: #FDE7E8;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(40, 32, 16, .04), 0 4px 16px rgba(40, 32, 16, .05);
  --shadow-lg: 0 12px 40px rgba(40, 32, 16, .16);
  --font: 'Hind Siliguri', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.icon { flex-shrink: 0; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 700; font-size: 18px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent-strong);
  display: grid; place-items: center;
}
.side-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 7px 10px; margin-bottom: 18px; color: var(--muted);
}
.side-search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 14px; color: var(--text); }
.nav-label { font-size: 12px; color: var(--muted-2); padding: 0 10px; margin: 6px 0 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 10px; color: #4A453D; font-weight: 500;
}
.nav a:hover { background: #F0EBE0; }
.nav a.active { background: var(--dark); color: #fff; }
.nav a.active .icon { color: var(--accent); }
.nav .count {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: var(--dark); font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
}
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.sync-card {
  background: var(--accent-wash); border: 1px solid #F5E2AE; border-radius: 12px; padding: 10px 12px; font-size: 13px;
}
.sync-card strong { display: block; font-size: 13px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; }
.user-card .who { min-width: 0; flex: 1; }
.user-card .who b { display: block; font-size: 14px; }
.user-card .who span { font-size: 12px; color: var(--muted); }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); display: grid; place-items: center; cursor: pointer; color: #4A453D;
}
.icon-btn:hover { background: #F6F2EA; }

.main { flex: 1; min-width: 0; padding: 28px 32px 48px; background: linear-gradient(180deg, #FBF9F4 0%, var(--bg) 100%); }
.mobilebar { display: none; }
.scrim { display: none; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  height: 38px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #F6F2EA; }
.btn-dark { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn-dark:hover { background: #33312C; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--dark); }
.btn-accent:hover { background: #EBAE17; }
.btn-danger { color: var(--red); }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.input, .select, .textarea {
  height: 38px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card); outline: none; font-size: 14px;
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 72px; width: 100%; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select { padding-right: 30px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A8378' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: #4A453D; }
.field .hint { font-size: 12px; color: var(--muted); }
.field .input, .field .select { width: 100%; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--dark); cursor: pointer; }

.segmented { display: inline-flex; background: #F1ECE2; border-radius: 10px; padding: 3px; }
.segmented a { white-space: nowrap; padding: 4px 12px; border-radius: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.segmented a.on { background: var(--dark); color: #fff; }

/* ---------- Cards & grid ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.card-head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.card-link { font-size: 13px; color: var(--accent-strong); font-weight: 600; white-space: nowrap; }
.card-link:hover { text-decoration: underline; }

.dash-top { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dash-mid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }

.big-number { font-size: 40px; font-weight: 700; line-height: 1.1; letter-spacing: -.5px; }
.delta { font-size: 13px; font-weight: 600; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }

.chart-wrap { position: relative; margin-top: 14px; }
.chart { display: grid; grid-template-columns: 44px 1fr; }
.chart-y { display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; color: var(--muted-2); height: 190px; padding-bottom: 2px; }
.chart-plot { position: relative; height: 190px; }
.chart-plot svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted-2); margin: 6px 0 0 44px; }
.chart-cursor { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--dark); opacity: 0; pointer-events: none; }
.chart-dot { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--dark); border: 2px solid #fff; transform: translate(-50%, -50%); opacity: 0; pointer-events: none; }
.chart-tip {
  position: absolute; top: -8px; transform: translateX(-50%); pointer-events: none; opacity: 0;
  background: var(--dark); color: #fff; border-radius: 10px; padding: 6px 10px; font-size: 12px; white-space: nowrap; z-index: 2;
}
.chart-tip b { display: block; font-size: 14px; }
.chart-plot.hover .chart-cursor, .chart-plot.hover .chart-dot, .chart-plot.hover .chart-tip { opacity: 1; }

.stat { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; }
.stat-top { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.stat-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); }
.stat-ico.dark { background: var(--dark); color: var(--accent); }
.stat-ico.red { background: var(--red-soft); color: var(--red); }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1.2; }
.stat-sub { font-size: 12px; color: var(--muted); }
.stat svg.spark { width: 100%; height: 36px; margin-top: 6px; }
.mini-list { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px; }
.mini-list li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
.mini-list li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pipeline-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: #F1ECE2; gap: 2px; margin: 8px 0 14px; }
.pipeline-bar span { display: block; height: 100%; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; font-size: 13px; }
.legend div { display: flex; align-items: center; gap: 8px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.legend b { margin-left: auto; font-weight: 600; }
.foot-note { font-size: 12px; color: var(--muted); margin-top: 12px; }

.hbar-list { display: flex; flex-direction: column; gap: 12px; }
.hbar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 13px; align-items: center; }
.hbar-row .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-row .val { text-align: right; font-weight: 600; }
.hbar-row .sub { font-size: 12px; color: var(--muted); text-align: right; }
.hbar { height: 8px; border-radius: 999px; background: #F1ECE2; overflow: hidden; }
.hbar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

.empty { text-align: center; color: var(--muted); padding: 28px 12px; font-size: 14px; }
.empty .icon { color: var(--muted-2); margin-bottom: 6px; }

/* ---------- Tables ---------- */
.table-card { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: #FCFAF6; white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:hover td { background: #FBF8F1; }
.tbl tbody tr.selected td { background: var(--accent-wash); }
.tbl .r { text-align: right; }
.cell-sub { font-size: 12px; color: var(--muted); }
.code { font-weight: 600; font-size: 13px; }
.cust { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #4A453D; flex-shrink: 0; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.c-proj { white-space: nowrap; color: #5E584E; }
.prod-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dup { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: #B4540A; background: #FFEBD9; border-radius: 6px; padding: 0 6px; margin-left: 6px; white-space: nowrap; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.s-new { background: #FFF4D2; color: #946200; }
.s-confirmed { background: #E4ECFF; color: #2A55C9; }
.s-on_hold { background: #FFE9D8; color: #B4540A; }
.s-sent_to_courier { background: #EEE6FF; color: #6D3FD8; }
.s-in_transit { background: #E7E6EF; color: #3F3D56; }
.s-delivered { background: var(--green-soft); color: #23804A; }
.s-partial_delivered { background: #DDF5F2; color: #0F8A7D; }
.s-returned { background: var(--red-soft); color: #C4373C; }
.s-cancelled { background: #EFEDEA; color: #78716C; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--green-soft); color: #23804A; }
.badge.err { background: var(--red-soft); color: #C4373C; }
.badge.off { background: #EFEDEA; color: #78716C; }

/* ---------- Orders page ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; color: #5E584E; background: transparent; border: 1px solid transparent; }
.tabs a:hover { background: #EFEAE0; }
.tabs a.on { background: var(--card); border-color: var(--line); color: var(--text); box-shadow: var(--shadow); }
.tabs a .n { font-size: 11px; color: var(--muted); font-weight: 600; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .search { position: relative; flex: 1; min-width: 200px; }
.filters .status-filter { min-width: 190px; font-weight: 600; }
.filters .search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.filters .search .input { width: 100%; padding-left: 36px; }
.date-range { display: inline-flex; align-items: center; gap: 6px; }
.date-range .input { width: 150px; }
.bulkbar {
  position: sticky; top: 12px; z-index: 5; display: none; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--dark); color: #fff; border-radius: 12px; padding: 8px 10px 8px 16px; margin-bottom: 12px; box-shadow: var(--shadow-lg);
}
.bulkbar.show { display: flex; }
.bulkbar .select { height: 32px; background-color: #2C2A26; border-color: #3B3833; color: #fff; }
.bulkbar .sp { flex: 1; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.pager .btns { display: flex; gap: 6px; }

/* ---------- Drawer ---------- */
.drawer-scrim { position: fixed; inset: 0; background: rgba(28, 27, 25, .28); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); z-index: 41;
  background: var(--card); box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .25s ease;
  display: flex; flex-direction: column;
}
.drawer-open .drawer-scrim { opacity: 1; pointer-events: auto; }
.drawer-open .drawer { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 17px; }
.drawer-head .cell-sub { margin-top: 1px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 28px; }
.drawer-loading { padding: 40px; text-align: center; color: var(--muted); }
.d-section { margin-bottom: 22px; }
.d-section h4 { margin: 0 0 10px; font-size: 13px; color: var(--muted); font-weight: 600; }
.d-cust { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.d-cust .info { flex: 1; min-width: 0; }
.d-cust .info b { display: block; font-size: 16px; }
.d-cust .info a, .d-cust .info span { font-size: 13px; color: var(--muted); }
.stepper { display: flex; align-items: flex-start; margin: 4px 0 20px; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; font-size: 11px; color: var(--muted-2); text-align: center; }
.step::before { content: ''; position: absolute; top: 8px; left: -50%; right: 50%; height: 2px; background: var(--line); z-index: 0; }
.step:first-child::before { display: none; }
.step .dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); background: #fff; position: relative; z-index: 1; }
.step.done { color: var(--text); }
.step.done .dot { background: var(--accent); border-color: var(--accent); }
.step.done::before, .step.current::before { background: var(--accent); }
.step.current { color: var(--text); font-weight: 600; }
.step.current .dot { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.notice { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }
.notice.warn { background: #FFF1E3; color: #9A4A08; }
.notice.err { background: var(--red-soft); color: #A72A2F; }
.notice.info { background: var(--accent-wash); color: #7A5600; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.kv div span { display: block; font-size: 12px; color: var(--muted); }
.kv div b { font-size: 15px; }
.kv .full { grid-column: 1 / -1; }
.prod-list { list-style: none; margin: 0; padding: 0; }
.prod-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.prod-list li:last-child { border-bottom: 0; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.chip { font-size: 11px; background: #F4F0E8; border-radius: 6px; padding: 0 6px; color: #5E584E; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.status-row { display: flex; gap: 8px; }
.status-row .select { flex: 1; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: 13px; }
.timeline li::before { content: ''; position: absolute; left: 5px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.timeline li::after { content: ''; position: absolute; left: 8.5px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .when { font-size: 12px; color: var(--muted); }
.timeline .chg { font-size: 12px; color: #5E584E; margin-top: 2px; }
.other-orders a { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; font-size: 13px; }
.other-orders a:hover { background: #FBF8F1; }
.form-error { color: var(--red); font-size: 13px; margin-bottom: 8px; min-height: 0; }
.saved-ok { color: var(--green); font-size: 13px; }
.courier-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #FCFAF6; }
.courier-box a { color: var(--accent-strong); }
fieldset.courier-own { border: 1px dashed var(--line-strong); border-radius: 12px; padding: 12px 14px 4px; margin: 0 0 14px; }
fieldset.courier-own legend { font-size: 13px; font-weight: 700; padding: 0 6px; }

/* ---------- Projects ---------- */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.proj-card { display: flex; flex-direction: column; gap: 12px; }
.proj-title { display: flex; align-items: center; gap: 10px; }
.proj-title h3 { margin: 0; font-size: 17px; }
.proj-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 13px; }
.proj-meta span { display: block; font-size: 12px; color: var(--muted); }
.proj-links { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.proj-links a { display: inline-flex; align-items: center; gap: 6px; color: #5E584E; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-links a:hover { color: var(--text); text-decoration: underline; }
.proj-actions { display: flex; gap: 8px; margin-top: auto; align-items: center; flex-wrap: wrap; }
.switch {
  display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 10px 0 3px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: #EFEBE3; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--muted);
}
.switch .knob { width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); transition: transform .15s; }
.switch.on { background: var(--green); border-color: var(--green); color: #fff; flex-direction: row-reverse; padding: 0 3px 0 10px; }
.switch:hover { filter: brightness(.97); }
.form-card { max-width: 640px; }
.code-block { background: #F7F4EE; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; overflow-x: auto; white-space: pre; }

/* ---------- Flash ---------- */
.flash { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.flash-success { background: var(--green-soft); color: #1F6F40; }
.flash-error { background: var(--red-soft); color: #A72A2F; }
.flash-info { background: var(--accent-wash); color: #7A5600; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(circle at 20% 10%, #FFF6DB 0, transparent 40%), var(--bg); }
.login-card { width: 100%; max-width: 380px; padding: 28px; }
.login-card .brand { padding: 0 0 6px; }
.login-card h1 { font-size: 22px; margin: 10px 0 2px; }
.login-card p { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.login-card .btn { width: 100%; height: 42px; margin-top: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .dash-top { grid-template-columns: 1fr; }
  .dash-mid { grid-template-columns: 1fr 1fr; }
  .dash-mid > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-lg); }
  .sidebar-open .sidebar { transform: none; }
  .sidebar-open .scrim { display: block; position: fixed; inset: 0; background: rgba(28, 27, 25, .3); z-index: 49; }
  .main { padding: 0 16px 40px; }
  .mobilebar { display: flex; align-items: center; gap: 10px; height: 56px; margin: 0 -16px 16px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); font-weight: 700; position: sticky; top: 0; z-index: 30; }
  .dash-mid { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 22px; }
  .big-number { font-size: 32px; }
  .date-range { width: 100%; }
  .date-range .input { flex: 1; width: auto; min-width: 0; }
  .filters .select { flex: 1; }
  .proj-grid { grid-template-columns: 1fr; }

  /* Orders table → cards */
  .tbl.cards thead { display: none; }
  .tbl.cards, .tbl.cards tbody, .tbl.cards tr, .tbl.cards td { display: block; width: 100%; }
  .tbl.cards tr { position: relative; padding: 12px 14px 12px 44px; border-bottom: 1px solid var(--line); }
  .tbl.cards td { border: 0; padding: 2px 0; }
  .tbl.cards td.sel { position: absolute; left: 14px; top: 14px; width: auto; }
  .tbl.cards td.c-code { display: flex; justify-content: space-between; gap: 8px; }
  .tbl.cards td.c-total { position: absolute; right: 14px; bottom: 12px; width: auto; font-weight: 700; }
  .tbl.cards td.c-proj, .tbl.cards td.c-prod { font-size: 13px; color: var(--muted); }
  .tbl.cards td.c-prod .prod-cell { max-width: 75%; }
  .tbl.cards td.c-status { margin-top: 4px; }
  .tbl.cards tr.clickable:hover td { background: transparent; }
}
@media (max-width: 520px) {
  .stat-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr 1fr; }
  .legend { grid-template-columns: 1fr; }
  .head-actions { width: 100%; }
  .head-actions .select { flex: 1; }
  .chart-x span:nth-child(even) { display: none; }
  .card-head { flex-wrap: wrap; }
}
