:root {
  --brand: #001755;
  --accent: #ff2c3b;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --panel: #ffffff;
  --page: #f5f6f8;
  --dark: #111827;
  --dark-2: #1f2937;
  --dark-line: #374151;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.screen {
  min-height: 100vh;
}

.center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.dark-page {
  min-height: 100vh;
  background: #0b1020;
  color: white;
  padding: 24px;
}

.wrap {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.wrap.narrow {
  width: min(760px, calc(100% - 32px));
}

.topbar {
  background: var(--brand);
  color: white;
  border-bottom: 1px solid #0d2c75;
  padding: 16px 0;
}

.topbar-inner {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-block;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand-line {
  height: 2px;
  background: var(--accent);
  margin-top: 3px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.panel-dark {
  background: #111827;
  border: 1px solid #273244;
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #f9fafb;
}

.panel-title {
  color: #4b5563;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.content {
  padding: 24px 0;
}

.stack {
  display: grid;
  gap: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 18px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

.dark-page .input,
.dark-page .select,
.dark-page .textarea,
.panel-dark .input,
.panel-dark .select,
.panel-dark .textarea {
  border-color: var(--dark-line);
  background: var(--dark-2);
  color: white;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--brand);
}

.textarea {
  min-height: 72px;
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 13px;
  background: white;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  min-height: 38px;
}

.btn.primary {
  background: var(--brand);
  color: white;
}

.btn.accent {
  background: var(--accent);
  color: white;
}

.btn.danger {
  background: var(--bad);
  color: white;
}

.btn.success {
  background: var(--ok);
  color: white;
}

.btn.ghost {
  border-color: #d1d5db;
  background: white;
  color: #374151;
}

.btn.dark {
  background: #1f2937;
  color: #d1d5db;
  border-color: #374151;
}

.btn.small {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
}

.btn.full {
  width: 100%;
}

.muted {
  color: var(--muted);
}

.tiny {
  font-size: 12px;
}

.error {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: var(--bad);
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 14px;
}

.notice {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 14px;
}

.success-note {
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 14px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.tab {
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f3f4f6;
  color: #4b5563;
  padding: 8px 10px;
  font-weight: 700;
  font-size: 13px;
}

.tab.active {
  background: var(--brand);
  color: white;
}

.tab.danger.active {
  background: var(--bad);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  border-radius: 999px;
  padding: 2px 7px;
  background: #e5e7eb;
  color: #374151;
  font-size: 12px;
  font-weight: 800;
}

.tab.active .badge {
  background: rgba(255, 255, 255, 0.18);
  color: white;
}

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
}

.chip.red {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.chip.green {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid #eef0f3;
  vertical-align: top;
}

th {
  background: #f9fafb;
  color: #6b7280;
  font-weight: 700;
}

tr.clickable {
  cursor: pointer;
}

tr.clickable:hover {
  background: #eff6ff;
}

tr.rejected {
  background: #fef2f2;
}

.login-shell {
  width: min(460px, 100%);
  margin: 0 auto;
}

.login-logo {
  text-align: center;
  margin-bottom: 22px;
}

.logo-block {
  display: inline-block;
  background: var(--brand);
  border-radius: 8px;
  padding: 16px 34px;
}

.pin-dots {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 18px 0;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid #4b5563;
}

.pin-dot.filled {
  border-color: var(--accent);
  background: var(--accent);
}

.pinpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pinpad button {
  min-height: 58px;
  border-radius: 8px;
  border: 1px solid #374151;
  background: #1f2937;
  color: white;
  font-size: 20px;
  font-weight: 800;
}

.location-list {
  max-height: 420px;
  overflow: auto;
  display: grid;
  gap: 16px;
  padding-right: 4px;
}

.location-button {
  width: 100%;
  border: 1px solid #374151;
  border-radius: 8px;
  background: #1f2937;
  color: white;
  text-align: left;
  padding: 12px;
}

.state-title {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 8px 0;
}

.qty-control {
  display: inline-grid;
  grid-template-columns: 30px 44px 30px;
  align-items: center;
  gap: 4px;
}

.qty-control button {
  width: 30px;
  height: 30px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #f9fafb;
  color: #374151;
  font-weight: 800;
}

.qty-control span {
  text-align: center;
  font-weight: 800;
}

.side-box {
  padding: 16px;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0;
  font-size: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal {
  width: min(430px, 100%);
  background: #111827;
  border: 1px solid #273244;
  border-radius: 8px;
  padding: 20px;
  color: white;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.metric {
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  background: white;
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}

.metric strong {
  display: block;
  font-size: 28px;
}

.print-page {
  background: white;
  min-height: 100vh;
  color: #111827;
}

.print-sheet {
  width: min(780px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0;
}

.print-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 3px solid var(--brand);
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.print-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.sig-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
  margin-top: 34px;
}

.sig-line {
  height: 34px;
  border-bottom: 1px solid #111827;
}

.no-print {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
}

@media (max-width: 860px) {
  .topbar-inner,
  .grid-2,
  .grid-4,
  .print-grid {
    grid-template-columns: 1fr;
  }

  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }
}

@media print {
  @page {
    margin: 0.75in;
    size: letter;
  }

  body {
    background: white;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .no-print {
    display: none !important;
  }

  .print-sheet {
    width: 100%;
    padding: 0;
  }
}
