:root {
  --charcoal: #1a2229;
  --charcoal-deep: #10151a;
  --charcoal-soft: #2a333c;
  --blue: #2155d6;
  --blue-deep: #1843b0;
  --blue-soft: #edf2fc;
  --grey-green: #3d6b5e;
  --grey-green-deep: #2a5348;
  --grey-green-soft: #e4efe9;
  --paper: #f3f5f7;
  --paper-2: #e8ecef;
  --card: #ffffff;
  --ink: #141b21;
  --ink-2: #3a4650;
  --muted: #66737d;
  --line: #e3e8ed;
  --white: #ffffff;
  --surface: #ffffff;
  --on-accent: #ffffff;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #8a5a00;
  --warn-soft: #fdf3d8;
  --info: #1d4f91;
  --info-soft: #e7eef8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 21, 26, 0.04), 0 8px 20px rgba(16, 21, 26, 0.04);
  --shadow-lg: 0 16px 40px rgba(16, 21, 26, 0.12);
  --sidebar-w: 248px;
  --topbar-h: 60px;
  --font: "Outfit", sans-serif;
  --display: "Outfit", sans-serif;
  --ease: 160ms ease;
}

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

html,
body {
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 420, "GRAD" 0, "opsz" 24;
  font-size: 22px;
  line-height: 1;
  user-select: none;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ========== LOGIN ========== */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--paper);
  color: var(--ink);
}

.login-body:not(.dispatch-page) {
  background: #f4f6f8;
}

.login-theme {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(400px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px 24px 24px;
  box-shadow: var(--shadow);
}

.login-body:not(.dispatch-page) .login-card {
  width: min(380px, 100%);
  padding: 36px 32px 28px;
  box-shadow: none;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.login-card .brand-mark {
  margin-bottom: 22px;
}

.login-card h1,
.login-card h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.login-card .sub,
.sub {
  margin: 6px 0 22px;
  color: var(--muted);
  font-size: 14px;
}

.login-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.login-hint {
  margin-top: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.login-hint code {
  font-family: inherit;
  font-weight: 600;
  color: var(--ink-2);
}

.report-card .sub,
.cat-card p,
.wh-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.brand-mark,
.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand-copy {
  min-width: 0;
  line-height: 1.15;
}

.brand-copy small,
.app-logo small {
  display: block;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--muted);
}

canvas {
  max-width: 100%;
}

.sidebar .app-logo small {
  color: #9aa6b0;
}

.logo-box {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--charcoal);
  color: var(--on-accent);
  flex-shrink: 0;
}

.logo-box .material-symbols-outlined {
  font-size: 22px;
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24;
}

.logo-box:has(.logo-img) {
  background: transparent;
  padding: 0;
  overflow: hidden;
}

.logo-box .logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.back-link .material-symbols-outlined {
  font-size: 20px;
}

.back-link:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  outline: none;
  transition: border-color var(--ease), box-shadow var(--ease);
}

.textarea {
  min-height: 84px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(33, 85, 214, 0.12);
}

.password-wrap {
  position: relative;
}

.password-wrap .input {
  padding-right: 44px;
}

.toggle-pass {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--muted);
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
}

.check input {
  accent-color: var(--blue);
}

.link {
  color: var(--blue);
  font-size: 13px;
  font-weight: 500;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 560;
  transition: background var(--ease), box-shadow var(--ease), border-color var(--ease);
}

.btn-primary {
  background: var(--charcoal);
  color: var(--on-accent);
}

.login-body:not(.dispatch-page) .btn-primary {
  background: var(--charcoal);
  box-shadow: none;
}

.btn-primary:hover {
  background: var(--charcoal-deep);
}

.app-body .btn-primary {
  background: var(--blue);
}

.app-body .btn-primary:hover {
  background: var(--blue-deep);
}

.btn-dark {
  background: var(--charcoal);
  color: var(--on-accent);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-2);
}

.btn-soft {
  background: var(--blue-soft);
  color: var(--blue-deep);
}

.btn-sage {
  background: var(--grey-green);
  color: var(--on-accent);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-block {
  width: 100%;
}

.demo-box {
  margin-top: 16px;
  padding: 11px 12px;
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink-2);
  font-size: 13px;
}

.demo-box code {
  font-family: inherit;
  font-weight: 600;
  color: var(--ink);
}

.form-error {
  display: none;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}

.form-error.show {
  display: block;
}

.form-error.ok {
  background: var(--ok-soft, #e7f6ee);
  color: var(--ok, #1b7a4a);
}

.install-card {
  width: min(560px, 100%) !important;
}

.install-steps {
  margin: 0 0 18px;
  padding-left: 18px;
  color: var(--ink-2);
  font-size: 14px;
}

.install-steps li {
  margin: 8px 0;
}

.install-steps li.done {
  color: var(--ink);
}

.install-details summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 15px;
}

.install-details summary strong {
  font-weight: 600;
}

.form-grid .check.span-2 {
  grid-column: span 2;
}

.dispatch-photo {
  margin: 0 0 16px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.dispatch-photo img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  object-position: center center;
}

/* ========== APP SHELL ========== */
.app-body {
  background: var(--paper);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #12171c;
  color: #e8eef3;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  z-index: 20;
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar .app-logo {
  padding: 4px 8px 16px;
}

.sidebar .logo-box {
  background: #2155d6;
}

.nav-scroll {
  overflow: auto;
  padding-right: 2px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.nav-group {
  margin-bottom: 16px;
}

.nav-label {
  padding: 8px 12px 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8b97a1;
}

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: #b7c2cb;
  text-align: left;
  margin-bottom: 2px;
  font-size: 14px;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.nav-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  box-shadow: inset 2px 0 0 #7aa2ff;
}

.nav-btn .material-symbols-outlined {
  font-size: 20px;
}

.nav-btn .count {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  display: grid;
  place-items: center;
}

.sidebar-foot {
  margin-top: auto;
  padding: 12px;
  border-radius: 12px;
  background: var(--charcoal);
}

.user-mini {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--grey-green);
  color: #fff;
  font-weight: 650;
  font-size: 13px;
}

.user-mini small {
  display: block;
  color: #9aa6b0;
}

.content {
  min-width: 0;
  position: relative;
}

.topbar {
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 15;
}

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.search-box {
  flex: 1;
  max-width: 460px;
  position: relative;
}

.search-box .material-symbols-outlined {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 20px;
}

.search-box input {
  width: 100%;
  height: 42px;
  padding: 0 46px 0 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.search-scan {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.search-scan .material-symbols-outlined {
  position: static;
  transform: none;
  color: inherit;
  font-size: 20px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  position: relative;
  display: grid;
  place-items: center;
  color: var(--ink-2);
}

.icon-btn .dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
}

.page {
  padding: 22px 24px 40px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.page-head h1 {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.page-head p {
  color: var(--muted);
  margin-top: 4px;
}

.head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.toolbar .search-inline {
  min-width: min(220px, 100%);
  flex: 1;
}

.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.filter-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 220px;
  min-width: 180px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
}

.filter-search .material-symbols-outlined {
  color: var(--muted);
  font-size: 20px;
}

.filter-search .input {
  width: auto;
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 10px 4px;
  box-shadow: none;
}

.filter-search .input:focus {
  box-shadow: none;
}

.filter-bar .filter-select,
.filter-bar .select.filter-select {
  width: auto;
  flex: 0 1 168px;
  min-width: 140px;
  max-width: 220px;
  padding: 10px 12px;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

@media (max-width: 860px) {
  .filter-bar {
    padding: 8px;
  }

  .filter-search {
    flex: 1 1 100%;
  }

  .filter-bar .filter-select,
  .filter-bar .select.filter-select {
    flex: 1 1 calc(33.33% - 8px);
    min-width: 0;
    max-width: none;
  }

  .filter-actions {
    width: 100%;
    margin-left: 0;
  }
}

.modal-photo {
  cursor: pointer;
  position: relative;
}

.modal-photo:hover {
  border-color: var(--blue);
}

.thumb.empty {
  overflow: hidden;
}

.thumb-logo {
  width: 70%;
  height: 70%;
  object-fit: contain;
}

#printEditForm .print-modal-ink {
  display: none;
}

#printEditForm.kind-ink .print-modal-roll {
  display: none;
}

#printEditForm.kind-ink .print-modal-ink {
  display: block;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.kpi {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  overflow: hidden;
}

.kpi-ico {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue);
  flex-shrink: 0;
}

.kpi-ico .material-symbols-outlined {
  font-size: 20px;
}

.kpi .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.kpi .value {
  margin: 4px 0 4px;
  font-size: 26px;
  letter-spacing: -0.04em;
  font-weight: 650;
}

.kpi .delta {
  font-size: 12px;
  font-weight: 560;
}

.delta.up {
  color: var(--grey-green-deep);
}

.delta.down {
  color: var(--danger);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.section-title h2,
.section-title h3,
.card h3 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sec-ico {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--paper-2);
  color: var(--ink-2);
  flex-shrink: 0;
}

.sec-ico .material-symbols-outlined {
  font-size: 16px;
}

.table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.card > .table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.card.table-wrap {
  padding: 0;
  overflow: auto;
}

.card.table-wrap .pager {
  padding: 12px 16px 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #f6f8fa;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr:nth-child(even) td {
  background: #fafbfc;
}

tr:hover td {
  background: var(--blue-soft);
}

td:first-child,
th:first-child {
  font-weight: 560;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 560;
}

.badge.ok {
  background: var(--grey-green-soft);
  color: var(--grey-green-deep);
}

.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.info {
  background: var(--info-soft);
  color: var(--info);
}

.badge.neutral {
  background: var(--paper-2);
  color: var(--ink-2);
}

.sku {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.activity {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  gap: 10px;
}

.activity-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue);
  flex-shrink: 0;
}

.activity-item small {
  color: var(--muted);
}

.capacity {
  margin-bottom: 14px;
}

.capacity .meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: var(--paper-2);
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--grey-green));
}

.chart-box {
  width: 100%;
  height: 220px;
}

.category-grid,
.warehouse-grid,
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.cat-card,
.wh-card,
.report-card {
  cursor: pointer;
  transition: transform var(--ease);
}

.cat-card:hover,
.wh-card:hover,
.report-card:hover {
  transform: translateY(-2px);
}

.cat-ico {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue);
  margin-bottom: 12px;
}

.icon-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-2);
}

.icon-pick {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}

.icon-pick:hover,
.icon-pick.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.icon-pick .material-symbols-outlined {
  font-size: 22px;
}

.segments {
  display: inline-flex;
  flex-wrap: wrap;
  padding: 4px;
  border-radius: 12px;
  background: var(--paper-2);
  margin-bottom: 14px;
}

.segments button {
  padding: 8px 14px;
  border-radius: 9px;
  color: var(--ink-2);
}

.segments button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.alert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
}

.alert-item.danger { border-left: 3px solid var(--danger); }
.alert-item.warn { border-left: 3px solid var(--warn); }
.alert-item.info { border-left: 3px solid var(--info); }

.alert-ico {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--paper-2);
  color: var(--ink-2);
  flex-shrink: 0;
}

.alert-item.danger .alert-ico { background: var(--danger-soft); color: var(--danger); }
.alert-item.warn .alert-ico { background: var(--warn-soft); color: var(--warn); }
.alert-item.info .alert-ico { background: var(--info-soft); color: var(--info); }

.alert-copy { min-width: 0; flex: 1; }
.alert-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.alert-copy strong { display: block; margin-bottom: 2px; }
.alert-copy small { color: var(--muted); font-size: 12px; }

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.settings-panel {
  display: none;
}

.settings-panel.active {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.span-2 {
  grid-column: 1 / -1;
}

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(27, 32, 37, 0.48);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 40;
}

.modal-back.open {
  display: flex;
}

.modal {
  width: min(640px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: var(--card);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow-lg);
}

.modal.wide {
  width: min(820px, 100%);
}

.modal h2 {
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.toast-wrap {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
  max-width: calc(100% - 32px);
}

.toast {
  min-width: min(260px, 100%);
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--charcoal);
  color: #f3f6f8;
  box-shadow: var(--shadow-lg);
}

.dropdown {
  position: absolute;
  right: 16px;
  top: 64px;
  width: min(320px, calc(100vw - 24px));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 25;
  overflow: hidden;
}

.dropdown.open {
  display: block;
}

.dropdown header,
.dropdown-item {
  padding: 12px 14px;
}

.dropdown header {
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}

.dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.dropdown-item:hover {
  background: var(--paper);
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.sidebar-backdrop {
  display: none;
}

.row-actions {
  display: flex;
  gap: 6px;
}

.tiny {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
}

.tiny .material-symbols-outlined {
  font-size: 18px;
}

a.tiny {
  color: inherit;
}

.tiny[data-edit-sku] {
  border-color: var(--blue);
  color: var(--blue);
}

/* Dispatch + scan */
.scan-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.scan-frame {
  border: 1px dashed #b7c4d0;
  border-radius: 14px;
  background:
    linear-gradient(180deg, #f7f9fb, #eef3f7);
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  gap: 10px;
}

.viewfinder {
  width: min(220px, 100%);
  aspect-ratio: 1;
  border-radius: 16px;
  border: 2px solid var(--blue);
  box-shadow: inset 0 0 0 8px rgba(47, 111, 237, 0.08);
  display: grid;
  place-items: center;
  color: var(--blue);
  background: rgba(255, 255, 255, 0.7);
}

.scan-or {
  color: var(--muted);
  font-size: 12px;
}

.lookup-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.scan-back {
  z-index: 80;
}

.scan-modal {
  width: min(420px, 100%);
}

.dispatch-scan-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 20px 24px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
}

.dispatch-scan-hero h1,
.dispatch-scan-hero h2,
.dispatch-scan-hero .sub {
  font-family: var(--font);
  letter-spacing: 0;
  word-spacing: normal;
  white-space: normal;
  font-feature-settings: normal;
}

.dispatch-scan-hero h1,
.dispatch-scan-hero h2 {
  margin: 0;
  font-size: 22px;
}

.dispatch-scan-hero .sub {
  margin: 8px 0 20px;
  max-width: 28em;
}

.dispatch-scan-hero .form-error {
  width: 100%;
  max-width: 320px;
  text-align: left;
}

.dispatch-scan-hero .btn {
  width: 100%;
  max-width: 320px;
  min-height: 48px;
  font-size: 16px;
}

.dispatch-scan-hero-ico {
  width: 72px;
  height: 72px;
  margin-bottom: 16px;
  border-radius: 20px;
  background: var(--blue-soft);
  color: var(--blue);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.dispatch-scan-hero-ico .material-symbols-outlined {
  font-size: 36px;
}

.card.dispatch-scan-hero {
  padding: 28px 20px 22px;
}

.scan-stage {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #111;
  aspect-ratio: 3 / 4;
  max-height: 62vh;
}

.scan-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-stage .scan-frame {
  position: absolute;
  inset: 16%;
  min-height: 0;
  padding: 0;
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 16px;
  box-shadow: 0 0 0 200vmax rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.scan-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.scan-btn .material-symbols-outlined {
  font-size: 18px;
}

.qr-modal {
  width: min(400px, 100%);
  text-align: center;
}

.qr-box {
  display: grid;
  place-items: center;
  margin: 8px auto 12px;
  padding: 12px;
  background: #fff;
  border-radius: 12px;
  width: 244px;
}

.qr-box img,
.qr-box canvas {
  display: block;
}

.qr-link {
  word-break: break-all;
  font-size: 12px;
  color: var(--muted);
}

.scanned-chip {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--grey-green-soft);
  color: var(--grey-green-deep);
  font-size: 13px;
}

.scanned-chip.show {
  display: inline-flex;
}

.dropzone {
  border: 1.5px dashed #b7c4d0;
  border-radius: 14px;
  padding: 28px 16px;
  text-align: center;
  background: #f7fafb;
  color: var(--muted);
  margin-bottom: 16px;
}

.dropzone strong {
  display: block;
  color: var(--ink);
  margin-bottom: 4px;
}

.file-name {
  margin-top: 10px;
  color: var(--blue-deep);
  font-weight: 560;
}

.sheet-note {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.desktop-only {
  display: inline-flex;
}

@media (max-width: 1100px) {
  .kpi-grid,
  .grid-2,
  .grid-3,
  .form-grid,
  .scan-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-105%);
    transition: transform 200ms ease;
    width: min(280px, 88vw);
  }

  .sidebar.open {
    transform: none;
  }

  .sidebar-backdrop.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(27, 32, 37, 0.4);
    z-index: 18;
  }

  .menu-toggle {
    display: grid;
    place-items: center;
  }

  .kpi-grid,
  .grid-2,
  .grid-3,
  .form-grid,
  .scan-grid {
    grid-template-columns: 1fr;
  }

  .page,
  .topbar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .head-actions {
    justify-content: flex-start;
  }

  .desktop-only {
    display: none;
  }

  .page-title {
    display: block;
    flex: 1;
  }

  .search-toggle {
    display: grid;
    place-items: center;
  }

  .search-box {
    display: none;
    max-width: none;
  }

  .topbar.search-open .search-box {
    display: block;
    order: 5;
    flex-basis: 100%;
  }

  .mobile-dock {
    gap: 2px;
  }

  .dock-btn {
    font-size: 10px;
    padding: 4px 2px;
  }

  .mobile-tiles {
    grid-template-columns: 1fr 1fr;
  }

  .tile {
    min-height: 96px;
    padding: 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .tile h3 {
    font-size: 15px;
  }

  .tile p {
    font-size: 12px;
    color: var(--muted);
  }

  .week-strip {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .today-card {
    margin-bottom: 14px;
  }

  .dispatch-work-head {
    flex-direction: column;
    align-items: stretch;
  }

  .dispatch-work-head .btn {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .login-body:not(.dispatch-page) .login-card,
  .login-card {
    padding: 28px 20px 22px;
  }

  .mobile-tiles {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .search-box {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }

  th,
  td {
    padding: 10px 8px;
    font-size: 13px;
  }

  .btn {
    padding: 10px 12px;
  }
}

/* ========== DARK MODE ========== */
[data-theme="dark"] {
  color-scheme: dark;
  --paper: #101418;
  --paper-2: #1a2026;
  --card: #171d23;
  --surface: #222a32;
  --ink: #eef3f7;
  --ink-2: #c9d3db;
  --muted: #93a0aa;
  --line: #2d363e;
  --blue-soft: #1d334f;
  --grey-green-soft: #24332f;
  --info-soft: #243044;
  --danger-soft: #3a2220;
  --warn-soft: #3a3218;
  --blue-deep: #8eb4ff;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] body,
[data-theme="dark"] .app-body,
[data-theme="dark"] .login-body {
  color: var(--ink);
  background: var(--paper);
}

[data-theme="dark"] .login-body,
[data-theme="dark"] .login-body:not(.dispatch-page) {
  background: #101418;
}

[data-theme="dark"] th,
[data-theme="dark"] .peek-table th {
  background: #1a2026;
}

[data-theme="dark"] tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .login-theme {
  background: var(--card);
  border-color: var(--line);
  color: var(--ink-2);
}

[data-theme="dark"] .login-card,
[data-theme="dark"] .card,
[data-theme="dark"] .note-card,
[data-theme="dark"] .task-row,
[data-theme="dark"] .peek-eye-btn,
[data-theme="dark"] .modal,
[data-theme="dark"] .dropdown,
[data-theme="dark"] .mobile-dock {
  background: var(--card);
  border-color: var(--line);
  color: var(--ink);
}

[data-theme="dark"] .topbar {
  background: rgba(18, 22, 26, 0.92);
  border-color: var(--line);
}

[data-theme="dark"] .page-peek-bar,
[data-theme="dark"] .dispatch-appbar {
  background: var(--paper);
  border-color: var(--line);
}

[data-theme="dark"] .dispatch-scan-hero,
[data-theme="dark"] .dispatch-work {
  background: var(--card);
  border-color: var(--line);
}

[data-theme="dark"] .dropzone,
[data-theme="dark"] .scan-frame,
[data-theme="dark"] .demo-box,
[data-theme="dark"] .gallery-slot,
[data-theme="dark"] .qr-hint,
[data-theme="dark"] .result-pill {
  background: var(--paper-2);
  color: var(--ink-2);
}

[data-theme="dark"] tr:hover td {
  background: rgba(47, 111, 237, 0.12);
}

[data-theme="dark"] .tiny {
  border-color: var(--line);
  color: var(--ink-2);
}

[data-theme="dark"] .page-title {
  color: var(--ink);
}

/* ========== MOBILE DOCK + SIMPLE HOME ========== */
.mobile-only {
  display: none;
}

.mobile-dock {
  display: none;
}

.page-title {
  display: none;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.02em;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-toggle {
  display: none;
}

.notes-panel {
  display: none;
}

.notes-panel.active {
  display: block;
}

.color-row {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 42px;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}

.swatch.on {
  box-shadow: 0 0 0 2px var(--ink);
}

.swatch[data-color="blue"] { background: #2f6fed; }
.swatch[data-color="green"] { background: #5c7d73; }
.swatch[data-color="amber"] { background: #d4a017; }
.swatch[data-color="red"] { background: #c44b3c; }
.swatch[data-color="slate"] { background: #5d6b76; }

.note-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.note-card {
  border-radius: 14px;
  padding: 14px 14px 12px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  position: relative;
}

.note-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  border-radius: 14px 0 0 14px;
}

.note-card.blue::before { background: #2f6fed; }
.note-card.green::before { background: #5c7d73; }
.note-card.amber::before { background: #d4a017; }
.note-card.red::before { background: #c44b3c; }
.note-card.slate::before { background: #5d6b76; }

.note-card h3 {
  padding-left: 8px;
  margin-bottom: 6px;
}

.note-card p {
  padding-left: 8px;
  color: var(--ink-2);
  white-space: pre-wrap;
}

.note-card small {
  display: block;
  padding-left: 8px;
  margin-top: 10px;
  color: var(--muted);
}

.todo-wrap {
  display: grid;
  gap: 12px;
}

.todo-card .todo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.todo-card .todo-item:has(input:checked) span {
  text-decoration: line-through;
  color: var(--muted);
}

.todo-add {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.task-list {
  display: grid;
  gap: 8px;
}

.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
}

.task-row.done {
  opacity: 0.55;
  text-decoration: line-through;
}

.task-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.task-dot.blue { background: #2f6fed; }
.task-dot.green { background: #5c7d73; }
.task-dot.amber { background: #d4a017; }
.task-dot.red { background: #c44b3c; }
.task-dot.slate { background: #5d6b76; }

.dispatch-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0 0 24px;
  background: var(--paper);
  color: var(--ink);
}

.dispatch-appbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
  min-height: 56px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.dispatch-appbar-title {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.dispatch-appbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dispatch-appbar .icon-btn:disabled {
  opacity: 0.4;
}

.dispatch-sheet {
  width: min(480px, 100%);
  margin: 0 auto;
  padding: 16px 16px 28px;
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
}

.dispatch-work {
  display: none;
  padding: 20px 18px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.dispatch-page.is-loaded .dispatch-scan-hero {
  display: none;
}

.dispatch-page.is-loaded .dispatch-work,
.dispatch-page.is-unknown .dispatch-scan-hero {
  display: flex;
}

.dispatch-page.is-loaded .dispatch-work {
  display: block;
}

.dispatch-work-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.dispatch-work-head h2 {
  margin: 0;
}

.dispatch-work-head .sub {
  margin: 6px 0 0;
}

.dispatch-work-head .btn {
  flex-shrink: 0;
}

.dispatch-work-links {
  margin-top: 14px;
}

.page-peek-bar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.peek-eye-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow);
}

.peek-eye-btn .material-symbols-outlined {
  font-size: 22px;
  color: var(--blue);
}

.peek-eye-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.peek-modal {
  width: min(680px, 100%);
  padding: 20px 22px 18px;
}

.peek-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.peek-ident {
  min-width: 0;
}

.peek-code {
  display: inline-block;
  margin-bottom: 6px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--paper-2);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.peek-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.peek-body {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 18px;
  align-items: start;
  margin-bottom: 14px;
}

.peek-photo {
  position: relative;
  width: 168px;
  height: 168px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  overflow: hidden;
  display: block;
  flex-shrink: 0;
}

.peek-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
}

.peek-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.peek-empty .material-symbols-outlined {
  font-size: 28px;
  opacity: 0.55;
}

.peek-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.peek-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.peek-table th,
.peek-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  white-space: normal;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
}

.peek-table tr:last-child th,
.peek-table tr:last-child td {
  border-bottom: 0;
}

.peek-table th {
  width: 38%;
  background: #f6f8fa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.peek-table td {
  font-weight: 550;
  background: var(--card);
}

.peek-notes {
  color: var(--ink-2);
  font-size: 13px;
  padding: 10px 12px;
  margin: 0 0 4px;
  border-radius: 8px;
  background: var(--paper);
}

.peek-modal .modal-actions {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.pos-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.pos-stat h3 {
  font-size: 15px;
  margin-bottom: 6px;
}

.pos-stat p {
  color: var(--ink-2);
  font-size: 13px;
}

.pos-stat small {
  color: var(--muted);
}

.input-locked {
  background: var(--paper-2);
  cursor: not-allowed;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 2px 2px;
  color: var(--muted);
  font-size: 13px;
}

.pager-btns {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pager-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 6px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.pager-size .select {
  width: auto;
  min-width: 64px;
  padding: 6px 28px 6px 10px;
  font-size: 13px;
}

/* Item search inside modals (Record movement) */
.search-pick {
  position: relative;
}

.search-pick-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.search-pick-row {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 14px;
  cursor: pointer;
}

.search-pick-row:last-child {
  border-bottom: 0;
}

.search-pick-row:hover {
  background: var(--paper-2);
}

.search-pick-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.search-pick-row strong {
  font-weight: 600;
}

.search-pick-new strong {
  color: var(--blue);
}

.print-panel {
  display: none;
}

.print-panel.active {
  display: block;
}

.print-in-ink {
  display: none;
}

#printInForm.kind-ink .print-in-ink {
  display: block;
}

#printInForm.kind-ink .print-in-roll {
  display: none;
}

.print-edit-ink {
  display: none;
}

#view-print-item.kind-ink .print-edit-ink {
  display: block;
}

#view-print-item.kind-ink .print-edit-roll {
  display: none;
}

.print-mast,
.print-foot,
.count-print {
  display: none;
}

.mobile-tiles {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  min-height: 88px;
  text-align: left;
}

.tile .cat-ico {
  margin: 0;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.gallery.single {
  grid-template-columns: minmax(180px, 280px);
}

.gallery-slot {
  position: relative;
  aspect-ratio: 1;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--paper);
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.gallery-slot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
}

.gallery-slot input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.thumb {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
  object-position: center center;
  background: var(--paper-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--muted);
  flex-shrink: 0;
}

.thumb.empty .material-symbols-outlined {
  font-size: 18px;
}

.result-pills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.result-pill {
  padding: 14px;
  border-radius: 12px;
  background: var(--blue-soft);
}

.result-pill strong {
  display: block;
  font-size: 26px;
  letter-spacing: -0.03em;
}

.die-box {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.die {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--charcoal);
  color: #fff;
  font-size: 26px;
  font-weight: 700;
}

.qr-hint {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--blue-soft);
  color: var(--ink-2);
  font-size: 13px;
  margin-bottom: 14px;
}

.qr-hint code {
  font-weight: 600;
}

.slim-page {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px 32px;
}

.slim-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}

@media (max-width: 860px) {
  .mobile-only {
    display: block;
  }

  .mobile-only.mobile-tiles {
    display: grid;
  }

  .desktop-panel {
    display: none !important;
  }

  .nav-desktop-only {
    display: none !important;
  }

  .mobile-dock {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    background: var(--card);
    border-top: 1px solid var(--line);
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    justify-content: space-around;
    gap: 8px;
  }

  .dock-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-height: 52px;
    color: var(--ink-2);
    font-size: 11px;
    font-weight: 560;
  }

  .dock-btn.active,
  .dock-btn:hover {
    color: var(--blue);
  }

  .app-body,
  .login-body.has-dock,
  .dispatch-page.has-dock {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .gallery {
    grid-template-columns: 1fr;
  }

  .gallery.single {
    grid-template-columns: minmax(160px, 1fr);
  }

  .peek-modal {
    max-height: calc(100dvh - 16px);
    overflow: auto;
  }

  .peek-body {
    grid-template-columns: 1fr;
  }

  .peek-photo {
    width: 100%;
    height: auto;
    min-height: 220px;
    max-height: 46vh;
    aspect-ratio: 4 / 3;
  }

  .gallery.single .gallery-slot,
  .gallery-slot {
    aspect-ratio: 4 / 3;
  }
}

@media print {
  @page {
    size: A4;
    margin: 0;
  }

  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    color: #111 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .sidebar,
  .topbar,
  .mobile-dock,
  .toolbar,
  .filter-bar,
  .head-actions,
  .btn,
  .sidebar-backdrop,
  .toast-wrap,
  .dropdown,
  .modal-back,
  .nav-scroll,
  .sidebar-foot,
  .icon-btn,
  .menu-toggle,
  .dropzone,
  .search-box,
  .mobile-only,
  .page-peek-bar,
  .dispatch-appbar,
  .pager,
  .print-hide,
  .page-head p,
  .qr-hint,
  .sheet-note,
  .segments,
  .die-box,
  .row-actions,
  .section-title .input,
  .section-title .badge,
  .section-title .link {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .content,
  .page {
    padding: 0 !important;
    margin: 0 !important;
  }

  .view {
    display: none !important;
  }

  .view.print-active,
  .print-root {
    display: block !important;
  }

  .print-sheet {
    min-height: 297mm;
    padding: 3mm 3mm 8mm;
    box-sizing: border-box;
  }

  .print-mast {
    display: flex !important;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    background: #1b2025 !important;
    color: #fff !important;
    margin: -3mm -3mm 8mm;
    padding: 8mm 12mm 6mm;
  }

  .print-mast strong {
    display: block;
    font-size: 16px;
  }

  .print-mast small,
  .print-mast span {
    color: #c5ced6;
    font-size: 11px;
  }

  .print-foot {
    display: block !important;
    margin-top: 10mm;
    padding-top: 3mm;
    border-top: 0.4pt solid #bbb;
    font-size: 10px;
    color: #555;
  }

  body,
  .app-body,
  .card {
    background: #fff !important;
    color: #111 !important;
    box-shadow: none !important;
    border-color: #ccc !important;
  }

  .card {
    break-inside: avoid;
    padding: 0 9mm;
    border: 0;
  }

  .page-head {
    margin: 0 9mm 4mm;
  }

  .page-head h1 {
    font-size: 18pt;
  }

  table {
    font-size: 10pt;
  }

  th,
  td {
    white-space: normal;
    border-bottom-color: #ccc !important;
  }

  body[data-print="spot"] .print-counts,
  body[data-print="counts"] .print-spot,
  body[data-print="reports"] .print-skip-report {
    display: none !important;
  }

  body[data-print="sheet"] table th:last-child,
  body[data-print="sheet"] table td:last-child,
  body[data-print="analytics"] table th:last-child,
  body[data-print="analytics"] table td:last-child {
    display: none !important;
  }

  body[data-print="inventory"] .print-mast,
  body[data-print="print"] .print-mast,
  body[data-print="moves-in"] .print-mast,
  body[data-print="moves-out"] .print-mast,
  body[data-print="moves-adjust"] .print-mast,
  body[data-print="inventory"] .print-foot,
  body[data-print="print"] .print-foot,
  body[data-print="moves-in"] .print-foot,
  body[data-print="moves-out"] .print-foot,
  body[data-print="moves-adjust"] .print-foot,
  body[data-print="inventory"] .view,
  body[data-print="print"] .view,
  body[data-print="moves-in"] .view,
  body[data-print="moves-out"] .view,
  body[data-print="moves-adjust"] .view {
    display: none !important;
  }

  body[data-print="inventory"] #movePrint,
  body[data-print="print"] #movePrint,
  body[data-print="moves-in"] #countPrint,
  body[data-print="moves-out"] #countPrint,
  body[data-print="moves-adjust"] #countPrint {
    display: none !important;
  }

  .count-print.print-active {
    display: block !important;
    padding: 8mm 10mm 10mm;
    color: #111;
  }

  .count-print .count-biz {
    display: block;
    margin: 0 0 2.5mm;
    font-size: 9pt;
    color: #333;
  }

  .count-print h1 {
    font-size: 16pt;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 4mm;
  }

  .count-head {
    margin-bottom: 5mm;
  }

  .count-by {
    display: flex;
    gap: 8mm;
  }

  .count-by .count-line {
    flex: 1;
    margin-bottom: 0;
  }

  .count-line {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 3.5mm;
  }

  .count-line label {
    font-size: 10pt;
    font-weight: 600;
    min-width: 26mm;
  }

  .pen-field {
    flex: 1;
    min-width: 50mm;
    height: 7mm;
    border-bottom: 0.8pt solid #111;
  }

  .pen-field.wide {
    min-width: 70mm;
  }

  .count-grid {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    font-size: 9pt;
  }

  .count-grid thead {
    display: table-header-group;
  }

  .count-grid th,
  .count-grid td {
    border: 0.5pt solid #111 !important;
    padding: 1.8mm 2mm !important;
    background: #fff !important;
    color: #111 !important;
    vertical-align: middle;
    white-space: nowrap;
  }

  .count-grid th {
    font-size: 8pt;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    text-align: center;
  }

  body[data-print="inventory"] .count-grid td:nth-child(2),
  body[data-print="print"] .count-grid td:nth-child(2),
  body[data-print="print"] .count-grid td:nth-child(4),
  .move-grid td:nth-child(3),
  .move-grid td:nth-child(8) {
    white-space: normal;
    word-break: break-word;
  }

  .count-grid .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
  }

  .count-grid .count-blank {
    width: 22mm;
    min-height: 7mm;
  }

  body[data-print="inventory"] .count-grid th:nth-child(1),
  body[data-print="inventory"] .count-grid td:nth-child(1) { width: 28mm; }
  body[data-print="inventory"] .count-grid th:nth-child(3),
  body[data-print="inventory"] .count-grid td:nth-child(3) { width: 22mm; }
  body[data-print="inventory"] .count-grid th:nth-child(4),
  body[data-print="inventory"] .count-grid td:nth-child(4) { width: 18mm; }
  body[data-print="inventory"] .count-grid th:nth-child(5),
  body[data-print="inventory"] .count-grid td:nth-child(5) { width: 14mm; }
  body[data-print="inventory"] .count-grid th:nth-child(6),
  body[data-print="inventory"] .count-grid td:nth-child(6) { width: 22mm; }

  body[data-print="print"] .count-grid {
    font-size: 8pt;
  }

  .move-grid {
    font-size: 8pt;
  }

  .move-grid th:nth-child(1),
  .move-grid td:nth-child(1) { width: 24mm; }
  .move-grid th:nth-child(2),
  .move-grid td:nth-child(2) { width: 16mm; }
  .move-grid th:nth-child(4),
  .move-grid td:nth-child(4) { width: 14mm; }
  .move-grid th:nth-child(7),
  .move-grid td:nth-child(7) { width: 22mm; }

  .count-grid tr {
    break-inside: avoid;
  }
}

/* ========== SCHEDULE + ALERT EXTRAS ========== */
.week-strip {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.week-day {
  flex: 1;
  min-width: 56px;
  padding: 10px 6px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  text-align: center;
  color: var(--ink-2);
  position: relative;
}

.week-day small {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.week-day strong {
  display: block;
  font-size: 18px;
  margin-top: 2px;
}

.week-day.on {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--ink);
}

.week-day.is-today strong {
  color: var(--blue);
}

.week-dot {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  margin-top: 4px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--charcoal);
  color: #fff;
  font-size: 10px;
}

.schedule-list {
  display: grid;
  gap: 12px;
}

.schedule-group {
  padding-bottom: 8px;
}

.sched-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.sched-row.done {
  opacity: 0.5;
}

.sched-ico {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--paper-2);
  color: var(--ink-2);
  flex-shrink: 0;
}

.sched-copy {
  min-width: 0;
  flex: 1;
}

.sched-copy strong {
  display: block;
}

.sched-copy div {
  color: var(--muted);
  font-size: 13px;
}

.today-card {
  margin-bottom: 16px;
}

.today-rows {
  display: grid;
  gap: 6px;
}

.today-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  text-align: left;
}

.today-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.today-time {
  width: 64px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-2);
}

.today-copy {
  min-width: 0;
  flex: 1;
}

.today-copy strong {
  display: block;
}

.today-copy small {
  color: var(--muted);
  font-size: 12px;
}

.empty-inline {
  color: var(--muted);
  font-size: 14px;
}

.push-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}

.push-banner.show {
  display: flex;
}

.push-banner p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.pref-row {
  margin-bottom: 12px;
}

.pref-status {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.dropdown-foot {
  font-weight: 600;
  color: var(--blue);
}

.dropdown-item.muted {
  color: var(--muted);
}

.toast-alert {
  background: var(--charcoal);
  border-left: 3px solid #7aa2ff;
}

@media (max-width: 860px) {
  .push-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .sched-row {
    flex-wrap: wrap;
  }

  .sched-row .row-actions {
    margin-left: auto;
  }

  .page {
    padding-bottom: 28px;
  }
}

/* ========== SHEET + CHART TIP + NEGATIVES ========== */
.chart-wrap {
  position: relative;
}

.chart-tip {
  position: fixed;
  z-index: 60;
  min-width: 160px;
  max-width: 260px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}

.chart-tip strong {
  display: block;
  font-size: 13px;
}

.chart-tip span {
  display: block;
  color: var(--ink-2);
  font-size: 13px;
  margin-top: 2px;
}

.chart-tip em {
  display: block;
  margin-top: 6px;
  font-style: normal;
  font-size: 12px;
  color: var(--muted);
}

.neg-row td,
tr.neg-row .sheet-cell {
  background: var(--danger-soft) !important;
}

.neg-row td:nth-child(3),
.sheet-qty {
  font-variant-numeric: tabular-nums;
}

.neg-field {
  color: var(--danger);
  font-weight: 600;
}

.sheet-card {
  padding: 0;
  overflow: hidden;
}

.sheet-scroll {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.sheet-table {
  border-collapse: collapse;
  min-width: 720px;
}

.sheet-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f1f3f5;
  border-right: 1px solid var(--line);
}

.sheet-table td {
  padding: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.sheet-num {
  width: 44px;
  text-align: center;
  color: var(--muted);
  background: #f6f8fa;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.sheet-cell {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 0;
  padding: 8px 10px;
  min-height: 36px;
  outline: none;
}

.sheet-cell.on {
  box-shadow: inset 0 0 0 2px var(--blue);
  background: #fff;
}

.sheet-qty {
  font-weight: 600;
  text-align: right;
}

[data-theme="dark"] .sheet-table th,
[data-theme="dark"] .sheet-num {
  background: #1a2026;
}

[data-theme="dark"] .sheet-cell.on {
  background: var(--surface);
}

.hp-wrap {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.error-card .error-code {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--blue);
  line-height: 1;
  margin: 0 0 8px;
}

.error-body .error-card h1 {
  margin-bottom: 0;
}
