html { font-size: 15px; }
body {
  min-height: 100vh;
  background: #f6f7fb;
  color: #172033;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}
a { text-decoration: none; }
.btn, .form-control, .form-select, .alert, .badge { border-radius: 8px; }
.btn:focus, .form-control:focus, .form-select:focus, .form-check-input:focus {
  box-shadow: 0 0 0 .18rem rgba(18, 120, 114, .18);
  border-color: #127872;
}
.app-shell { display: grid; grid-template-columns: 268px 1fr; min-height: 100vh; }
.app-sidebar {
  background: #111827;
  color: #fff;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 800;
  padding: 10px 12px 20px;
}
.sidebar-toggle {
  display: none;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid #4b5563;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
}
.sidebar-toggle:focus-visible {
  outline: 3px solid rgba(24, 169, 153, .45);
  outline-offset: 2px;
}
.brand-mark {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: #18a999;
  color: #fff;
}
.sidebar-nav,
.sidebar-nav.collapse { display: grid; gap: 4px; }
.sidebar-nav a {
  color: #dbe4f0;
  padding: 11px 12px;
  border-radius: 8px;
  font-weight: 600;
}
.sidebar-nav a:hover { background: #263244; color: #fff; }
.app-main { min-width: 0; }
.topbar {
  min-height: 70px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: #fff;
  border-bottom: 1px solid #e6e9ef;
  position: sticky;
  top: 0;
  z-index: 5;
}
.content-wrap { padding: 24px; }
.page-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.work-surface {
  background: #fff;
  border: 1px solid #e6e9ef;
  border-radius: 8px;
  padding: 18px;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.metric-card {
  background: #fff;
  border: 1px solid #e6e9ef;
  border-radius: 8px;
  padding: 16px;
  min-height: 112px;
}
.metric-card small { color: #6b7280; font-weight: 700; }
.metric-card strong { display: block; font-size: 1.55rem; margin-top: 10px; }
.metric-card .accent { width: 42px; height: 4px; border-radius: 4px; margin-top: 14px; background: #18a999; }
.metric-card.revenue .accent { background: #d97706; }
.metric-card.delivery .accent { background: #2563eb; }
.metric-card.risk .accent { background: #dc2626; }
.table { vertical-align: middle; }
.table thead th { color: #4b5563; font-size: .86rem; }
.filters-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.form-grid .wide { grid-column: span 3; }
.timeline { display: grid; gap: 10px; }
.timeline-item {
  border-inline-start: 4px solid #18a999;
  background: #f8fafc;
  padding: 12px;
  border-radius: 8px;
}
.split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.table form { margin: 0; }
.border-success { border-color: #16a34a !important; }
.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.option-check {
  background: #f8fafc;
  border: 1px solid #e6e9ef;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0;
}
.print-label {
  width: 102mm;
  min-height: 148mm;
  background: #fff;
  color: #111827;
  padding: 18px;
  border: 1px dashed #111827;
}
.barcode-box {
  letter-spacing: 4px;
  font-family: Consolas, monospace;
  border: 1px solid #111827;
  padding: 12px;
  text-align: center;
}
.label-code-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 12px;
  align-items: center;
}
.label-barcode,
.label-qr {
  border: 1px solid #111827;
  background: #fff;
}
.label-barcode {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}
.label-qr {
  padding: 8px;
}
.label-qr svg,
.code39-svg {
  display: block;
  width: 100%;
  height: auto;
}
.live-notification-host {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 1080;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 36px));
}
.live-notification {
  background: #0f172a;
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 14px 38px rgba(15, 23, 42, .22);
}
.live-notification strong,
.live-notification span {
  display: block;
}
.live-notification span {
  color: #cbd5e1;
  font-size: .875rem;
  margin-top: 4px;
}
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef2f7;
}
.login-panel {
  width: min(430px, 100%);
  background: #fff;
  border: 1px solid #e6e9ef;
  border-radius: 8px;
  padding: 26px;
}
@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters-grid, .form-grid, .split-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .wide { grid-column: span 2; }
}
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar { position: static; height: auto; padding-block: 10px; }
  .brand { padding-block: 8px; }
  .sidebar-toggle { display: inline-flex; }
  .sidebar-nav.collapse:not(.show) { display: none; }
  .sidebar-nav.collapse.show { display: grid; }
  .sidebar-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { position: static; }
  .content-wrap { padding: 16px; }
  .metric-grid, .filters-grid, .form-grid, .split-grid { grid-template-columns: 1fr; }
  .option-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: span 1; }
  .page-actions { align-items: stretch; flex-direction: column; }
}
@media print {
  .app-sidebar, .topbar, .btn, .no-print { display: none !important; }
  .app-shell { display: block; }
  .content-wrap { padding: 0; }
  body { background: #fff; }
}
