/*
 * Purple Logistics — Logistics app stylesheet
 * ============================================
 * Must stay aligned with the main site canonical reference (site/styles.css).
 *
 * LAYOUT
 *   Top shell:  .top-shell — carries utility-links + navbar (above hero)
 *   Page shell: .page-shell — carries hero + content below
 *   Hero:       .hero — pad 32px, radius 28px, blur(16px), bg --card
 *   Cards:      auth card, tracking card — pad 24px, radius 24px
 *   Footer:     .footer — "Purple Industries © 2026"
 *               KNOWN DEPARTURE: should be <footer class="site-footer">, 0.78rem, pad 1.5rem 1rem
 *               Currently: <div class="footer">, 0.75rem, pad 2rem
 *
 * UTILITY-LINKS ROW (above hero, inside .top-shell)
 *   Same pattern: Purple Industries + Privacy Policy left, theme toggle right.
 *   0.88rem, weight 400, color --ink-soft.
 *
 * COLOURS — purple accent in BOTH modes, no orange
 *   --brand #a78bfa dark / #7c3aed light
 *   --accent-text #a78bfa dark / #7a2bc0 light
 *   --ink #f4f7fb / #1b2430    --ink-soft #c7d2df / #5c6472
 *   CTA gradient: #a78bfa→#8b5cf6 dark / #7c3aed→#6d28d9 light
 *
 * TYPOGRAPHY
 *   Font stack:  "Avenir Next", "Segoe UI", sans-serif
 *   Theme toggle: 0.88rem, weight 700, letter-spacing 0.08em, uppercase
 *   Eyebrow:     0.78rem, weight 700, letter-spacing 0.16em, uppercase
 *   Hero h1:     clamp(2.4rem, 7vw, 4.8rem), line-height 0.95, letter-spacing -0.05em, weight 800
 *   Hero copy:   1.06rem
 *   Body/muted:  0.85rem
 *
 * SHADOW
 *   --shadow: 0 24px 60px rgba(0,0,0,0.38) dark / rgba(22,35,45,0.14) light
 *
 * THEME: dark default (:root). Light via :root[data-theme="light"]. Uses local theme.js.
 *
 * VARIABLE NAMING: logistics uses --card/--card-border (not --paper/--paper-border).
 * MAGIC LINK AUTH: emailed sign-in link (no password/PIN). See routers/auth.py and mailer.py.
 */
:root {
  color-scheme: dark;
  --bg: #0d131b;
  --bg-accent: #18222f;
  --card: rgba(14, 22, 31, 0.92);
  --card-strong: rgba(17, 27, 39, 0.98);
  --card-border: rgba(182, 205, 226, 0.16);
  --surface: rgba(255, 255, 255, 0.05);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --ink: #f4f7fb;
  --ink-soft: #c7d2df;
  --ink-faint: #8d9aaa;
  --line: rgba(199, 210, 223, 0.16);
  --line-strong: rgba(199, 210, 223, 0.28);
  --brand: #a78bfa;
  --brand-strong: #8b5cf6;
  --accent-text: #a78bfa;
  --accent-text-strong: #8b5cf6;
  --mint: #7fe5b8;
  --danger: #ff9d87;
  --warning: #ffd36f;
  --info: #9fc8ff;
  --hero-input: rgba(255, 255, 255, 0.96);
  --hero-input-text: #111827;
  --radius: 16px;
  --shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.38);
  --page-background:
    radial-gradient(circle at top left, rgba(255, 155, 105, 0.18), transparent 35%),
    radial-gradient(circle at top right, rgba(127, 229, 184, 0.12), transparent 34%),
    linear-gradient(180deg, var(--bg-accent) 0%, var(--bg) 44%, #090d12 100%);

  /* Compatibility aliases for existing logistics markup and inline styles. */
  --purple-900: #14202c;
  --purple-800: #1a2836;
  --purple-700: var(--brand-strong);
  --purple-600: var(--brand);
  --purple-500: var(--brand);
  --purple-400: rgba(167, 139, 250, 0.72);
  --purple-300: rgba(167, 139, 250, 0.24);
  --purple-100: rgba(167, 139, 250, 0.14);
  --purple-50: rgba(255, 255, 255, 0.05);
  --gray-900: var(--ink);
  --gray-700: var(--ink-soft);
  --gray-500: var(--ink-faint);
  --gray-300: var(--line);
  --gray-100: var(--bg);
  --green-600: var(--mint);
  --green-100: rgba(127, 229, 184, 0.14);
  --red-600: var(--danger);
  --red-100: rgba(255, 157, 135, 0.14);
  --yellow-600: var(--warning);
  --yellow-100: rgba(255, 211, 111, 0.14);
  --blue-600: var(--info);
  --blue-100: rgba(159, 200, 255, 0.16);
  --surface-0: var(--card);
  --surface-1: var(--card-strong);
  --surface-2: var(--surface);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4efe6;
  --bg-accent: #d8e7ef;
  --card: rgba(255, 252, 247, 0.92);
  --card-strong: rgba(255, 255, 255, 0.98);
  --card-border: rgba(255, 255, 255, 0.55);
  --surface: rgba(255, 255, 255, 0.65);
  --surface-strong: rgba(255, 255, 255, 0.88);
  --ink: #1b2430;
  --ink-soft: #5c6472;
  --ink-faint: #708091;
  --line: rgba(22, 50, 70, 0.12);
  --line-strong: rgba(22, 50, 70, 0.26);
  --brand: #7c3aed;
  --brand-strong: #6d28d9;
  --accent-text: #7a2bc0;
  --accent-text-strong: #61209d;
  --mint: #1a7d69;
  --danger: #9d3d2d;
  --warning: #aa6e11;
  --info: #3167c7;
  --hero-input: rgba(255, 255, 255, 0.98);
  --hero-input-text: #163246;
  --shadow: 0 10px 24px rgba(22, 35, 45, 0.1);
  --shadow-lg: 0 24px 60px rgba(22, 35, 45, 0.14);
  --page-background:
    radial-gradient(circle at top left, rgba(217, 96, 53, 0.14), transparent 35%),
    radial-gradient(circle at top right, rgba(26, 125, 105, 0.12), transparent 34%),
    linear-gradient(180deg, var(--bg-accent) 0%, var(--bg) 44%, #f7f2ea 100%);

  --purple-900: #d8e7ef;
  --purple-800: #e8f0f4;
  --purple-700: var(--brand-strong);
  --purple-600: var(--brand);
  --purple-500: var(--brand);
  --purple-400: rgba(124, 58, 237, 0.6);
  --purple-300: rgba(124, 58, 237, 0.22);
  --purple-100: rgba(124, 58, 237, 0.12);
  --purple-50: rgba(255, 255, 255, 0.72);
  --gray-900: var(--ink);
  --gray-700: var(--ink-soft);
  --gray-500: var(--ink-faint);
  --gray-300: var(--line);
  --gray-100: var(--bg);
  --green-600: var(--mint);
  --green-100: rgba(26, 125, 105, 0.14);
  --red-600: var(--danger);
  --red-100: rgba(157, 61, 45, 0.14);
  --yellow-600: var(--warning);
  --yellow-100: rgba(170, 110, 17, 0.14);
  --blue-600: var(--info);
  --blue-100: rgba(49, 103, 199, 0.12);
  --surface-0: var(--card);
  --surface-1: var(--card-strong);
  --surface-2: var(--surface);
}

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

html {
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  overflow-y: scroll;
}

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

body {
  min-height: 100vh;
  background: var(--page-background);
  background-attachment: fixed;
  color: var(--ink);
}

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

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

body,
.navbar,
.hero,
.card,
.auth-card,
.modal,
.stat-card,
.form-group input,
.form-group select,
.form-group textarea,
.field input,
.field select,
.btn,
.primary-button,
.secondary-button,
.ghost-button,
.notice-banner,
.theme-toggle {
  transition:
    background-color 120ms ease,
    color 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.top-shell,
.page-shell,
.container {
  width: min(1120px, calc(100vw - 24px));
  margin: 0 auto;
  position: relative;
  left: -6px;
}

.top-shell {
  padding-top: 24px;
}

.theme-row {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  width: 100%;
  margin: 0;
  padding: 0;
}

.navbar-left {
  display: none;
}

.navbar nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.theme-toggle {
  padding: 0;
  border: none;
  background: none;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--accent-text);
  text-decoration: none;
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 4px;
  border-radius: 999px;
}

.navbar nav a,
.navbar nav button {
  color: var(--ink-soft);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  transition:
    background 0.15s,
    color 0.15s;
}

.navbar nav a:hover,
.navbar nav button:hover {
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.nav-role {
  font-size: 0.7rem;
  background: rgba(167, 139, 250, 0.16);
  color: var(--accent-text);
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.hero {
  width: 100%;
  margin: 0;
  padding: 32px;
  border-radius: 28px;
  border: 1px solid var(--card-border);
  background: var(--card);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg);
  color: var(--ink);
  text-align: left;
}

.hero-eyebrow,
.section-label {
  margin: 0 0 10px;
  color: var(--accent-text);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  margin-bottom: 0.5rem;
  font-size: clamp(2.4rem, 7vw, 4.8rem);
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.hero-copy {
  margin-bottom: 2rem;
  color: var(--ink-soft);
  font-size: 1.06rem;
  max-width: 700px;
}

.track-form {
  max-width: 640px;
  margin: 0;
  display: flex;
  gap: 0.5rem;
}

.track-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.85fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.panel-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.track-form input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--hero-input);
  color: var(--hero-input-text);
  font-size: 1rem;
  outline: none;
}

.track-form input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.18);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.04);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.btn-secondary:hover {
  background: var(--surface-strong);
}

.btn-danger {
  background: rgba(157, 61, 45, 0.12);
  color: var(--danger);
  border-color: rgba(157, 61, 45, 0.22);
}

.btn-danger:hover {
  background: rgba(157, 61, 45, 0.18);
}

.btn-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn-outline:hover {
  background: var(--surface);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.container {
  padding: 16px 0 0;
}

.card {
  margin-bottom: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--card-border);
  border-radius: 24px;
  background: var(--card);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-lg);
}

.card h2 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.card h3 {
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.empty-state-card,
.action-card {
  min-height: 100%;
}

.action-card .btn {
  margin-top: 0.5rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--card-strong);
  color: var(--ink);
  font-size: 0.875rem;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.18);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ── Login page — operator-console style ─────────────────────── */
.auth-card {
  margin-top: 16px;
  padding: 24px;
  border-radius: 24px;
  border: 1px solid var(--card-border);
  background: var(--card);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg);
}

.track-login-card {
  margin-top: 0;
  padding: 1.5rem;
}

.track-login-card .primary-button {
  width: 100%;
}

.auth-card h2 {
  margin: 0 0 12px;
}

.body-copy {
  margin: 0;
  color: var(--ink-soft);
}

.stack {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.92rem;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  font: inherit;
  color: var(--ink);
  background: var(--card-strong);
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.16);
}

.field input[readonly] {
  opacity: 0.7;
  cursor: default;
}

.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 16px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff;
}

.secondary-button {
  background: rgba(167, 139, 250, 0.12);
  border-color: rgba(167, 139, 250, 0.26);
  color: var(--brand);
}

.ghost-button {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.notice-banner {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  font-size: 0.92rem;
  border: 1px solid transparent;
}

.notice-banner.hidden {
  display: none;
}

.notice-banner.success {
  background: rgba(127, 229, 184, 0.12);
  border-color: rgba(127, 229, 184, 0.24);
  color: var(--mint);
}

.notice-banner.error {
  background: rgba(255, 157, 135, 0.12);
  border-color: rgba(255, 157, 135, 0.24);
  color: var(--danger);
}

/* Inline feedback used in admin/employee panels */
.login-error {
  display: none;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  background: rgba(157, 61, 45, 0.12);
  color: var(--danger);
  font-size: 0.8rem;
}

.login-notice {
  display: none;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  background: rgba(159, 200, 255, 0.16);
  color: var(--info);
  font-size: 0.8rem;
}

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-green {
  background: rgba(127, 229, 184, 0.14);
  color: var(--mint);
}

.badge-yellow {
  background: rgba(255, 211, 111, 0.14);
  color: var(--warning);
}

.badge-red {
  background: rgba(255, 157, 135, 0.14);
  color: var(--danger);
}

.badge-blue {
  background: rgba(159, 200, 255, 0.16);
  color: var(--info);
}

.badge-purple {
  background: rgba(167, 139, 250, 0.14);
  color: var(--accent-text);
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

thead {
  background: var(--surface);
}

th {
  padding: 0.6rem 0.75rem;
  font-weight: 600;
  text-align: left;
  color: var(--ink-soft);
}

td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

tbody tr:hover {
  background: var(--surface);
  cursor: pointer;
}

.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--line);
}

.tab-btn {
  padding: 0.5rem 1rem;
  margin-bottom: -2px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--ink-faint);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s;
}

.tab-btn.active {
  color: var(--accent-text);
  border-bottom-color: var(--accent-text);
}

.timeline {
  padding-left: 1.5rem;
  border-left: 2px solid rgba(167, 139, 250, 0.28);
}

.timeline-item {
  position: relative;
  padding: 0.5rem 0 1rem 1rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.65rem;
  top: 0.65rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--card);
  background: var(--brand);
}

.timeline-status {
  font-weight: 600;
  font-size: 0.9rem;
}

.timeline-time {
  font-size: 0.75rem;
  color: var(--ink-faint);
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  background: rgba(15, 28, 38, 0.45);
}

.modal-overlay.active {
  display: flex;
}

.modal {
  width: 100%;
  max-width: 550px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  border: 1px solid var(--card-border);
  border-radius: 24px;
  background: var(--card-strong);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-lg);
}

.modal h2 {
  margin-bottom: 1rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr) minmax(240px, 0.75fr);
  gap: 16px;
}

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

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

.warranty-links-card {
  grid-column: 1 / -1;
}

.stat-card {
  padding: 1.25rem;
  text-align: center;
  border: 1px solid var(--card-border);
  border-radius: 22px;
  background: var(--card);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-lg);
}

.stat-card .stat-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-text);
}

.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.text-center {
  text-align: center;
}

.text-muted {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.mt-1 {
  margin-top: 0.5rem;
}

.mt-2 {
  margin-top: 1rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--ink-soft);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.utility-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  font-size: 0.88rem;
}

.utility-links a {
  color: var(--ink-soft);
  text-decoration: none;
}

.utility-links a:hover,
.utility-links a:focus-visible {
  color: var(--ink);
  text-decoration: underline;
}

.utility-links .theme-toggle {
  margin-left: auto;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.footer {
  margin-top: 3rem;
  padding: 2rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.75rem;
}

/* ── Shipping Slip ──────────────────────────────────────────────── */

.slip-modal-content {
  max-width: 650px;
}

.shipping-slip {
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 1.5rem;
  background: #fff;
  color: #111;
  font-size: 0.85rem;
  max-width: 640px;
  margin: 0 auto;
}

.slip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}

.slip-header::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 50%;
  border-bottom: 2px solid #111;
}

.slip-header .slip-logo {
  font-size: 1.1rem;
  font-weight: 800;
  color: #7c3aed;
}

.slip-tracking {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-family: monospace;
}

.slip-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.slip-section h4 {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #666;
  margin-bottom: 0.25rem;
}

.slip-section p {
  margin: 0.15rem 0;
  line-height: 1.4;
}

.slip-field-line {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  margin: 0.2rem 0;
  line-height: 1.35;
  font-size: 0.78rem;
}

.slip-field-label {
  font-size: 0.72rem;
  color: #666;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.slip-field-value {
  display: inline-block;
  min-width: 120px;
  width: 100%;
  border-bottom: 1px solid #bbb;
  padding: 0 0.15rem 0.08rem;
  min-height: 1.1em;
}

.slip-field-value.is-empty {
  min-height: 1.25em;
}

.slip-field-block {
  margin-top: 0.35rem;
  width: 100%;
}

.slip-field-box {
  margin-top: 0.15rem;
  border: 1px solid #bbb;
  border-radius: 6px;
  min-height: 2.4rem;
  padding: 0.4rem 0.5rem;
  line-height: 1.35;
}

.slip-field-box.is-empty {
  background-image: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 1.2em,
    rgba(0, 0, 0, 0.12) 1.2em,
    rgba(0, 0, 0, 0.12) calc(1.2em + 1px)
  );
}

.slip-qr-area {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.6rem;
  padding-top: 1rem;
  border-top: 1px dashed #ccc;
  margin-top: 0.75rem;
}

.slip-qr-layout {
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.slip-qr-block {
  display: flex;
  align-items: center;
  justify-content: center;
}

.slip-notes-block {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}

.slip-notes-block .slip-field-block {
  margin-top: 0;
}

.slip-notes-block .slip-field-box {
  min-height: 5.25rem;
}

.slip-qr-area canvas {
  border: 1px solid #ddd;
  border-radius: 8px;
}

#slip-qr-code svg {
  display: block;
  width: min(100%, 300px);
  height: auto;
  margin: 0 auto;
}

.slip-service-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  background: #7c3aed;
  color: #fff;
}

.slip-meta {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
  font-size: 0.68rem;
  color: #666;
}

.slip-meta-spread {
  margin-top: 0;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1rem;
}

.slip-meta-spread span {
  flex: 1 1 180px;
}

/* ── Warranty Links Card ───────────────────────────────────────── */

.warranty-links-card {
  overflow-y: visible;
  max-height: none;
}

.warranty-group {
  margin-bottom: 0.85rem;
}

.warranty-group:last-child {
  margin-bottom: 0;
}

.warranty-group-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #888;
  margin: 0 0 0.3rem;
}

.warranty-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.warranty-list li a {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--violet);
  text-decoration: none;
  padding: 0.22rem 0.35rem;
  border-radius: 6px;
  transition: background 100ms;
}

.warranty-list li a:hover {
  background: rgba(124, 58, 237, 0.07);
  text-decoration: underline;
}

.warranty-note {
  font-size: 0.7rem;
  font-weight: 400;
  color: #888;
}

/* ── Shipping Aggregator Blueprint Card ─────────────────────────── */

.shipping-blueprint-card {
  grid-column: 1 / -1;
}

.shipping-blueprint-card details {
  margin-top: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.shipping-blueprint-card summary {
  cursor: pointer;
  list-style: none;
  padding: 0.55rem 0.7rem;
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--ink);
}

.shipping-blueprint-card summary::-webkit-details-marker {
  display: none;
}

.shipping-blueprint-card details[open] > summary {
  border-bottom: 1px solid var(--line);
}

.blueprint-list {
  margin: 0;
  padding: 0.65rem 1rem 0.8rem 1.6rem;
  display: grid;
  gap: 0.4rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.blueprint-list p {
  margin: 0.25rem 0 0;
  color: var(--ink-faint);
  font-size: 0.8rem;
}

.blueprint-code {
  margin: 0;
  padding: 0.7rem 0.8rem 0.8rem;
  white-space: pre-wrap;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.blueprint-code code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.blueprint-footnotes {
  margin-top: 0.85rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--line);
}

/* ── QR Scanner ────────────────────────────────────────────────── */

.scanner-modal-content {
  max-width: 480px;
}

#scanner-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-height: 360px;
  overflow: hidden;
  border-radius: 16px;
  background: #000;
}

#scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.scanner-crosshair {
  width: 60%;
  aspect-ratio: 1;
  border: 2px solid rgba(167, 139, 250, 0.7);
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
}

.scanner-crosshair.found {
  border-color: #7fe5b8;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.2), 0 0 20px rgba(127, 229, 184, 0.4);
}

#scanner-result {
  margin-top: 1rem;
}

.scan-shipment-card {
  padding: 1rem;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: var(--card);
}

.scan-shipment-card h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.scan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.scan-location-info {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  background: rgba(167, 139, 250, 0.08);
  font-size: 0.78rem;
  color: var(--ink-soft);
}

/* ── Print styles ──────────────────────────────────────────────── */

/* Hidden on screen — only visible when printing QR-only label */
#qr-only-label {
  display: none;
}

@page {
  margin: 0.5cm;
}

@media print {
  html,
  body {
    width: 100%;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body > *:not(#slip-modal) {
    display: none !important;
  }

  body {
    background: #fff !important;
  }

  #slip-modal {
    position: static !important;
    display: block !important;
    background: none !important;
    inset: auto !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  #slip-modal .modal {
    position: static !important;
    max-width: none !important;
    max-height: none !important;
    padding: 0 !important;
    border: none !important;
    background: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    overflow: visible !important;
    margin: 0 !important;
  }

  #slip-modal .flex-between {
    display: none !important;
  }

  /* ── Full label print (default) ── */
  .shipping-slip {
    border: 1.2px solid #000;
    border-radius: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0.26rem 0.34rem;
    font-size: 0.58rem;
    page-break-inside: avoid;
    break-inside: avoid;
    box-sizing: border-box;
  }

  .slip-header {
    padding-bottom: 0.12rem;
    margin-bottom: 0.16rem;
    flex-direction: row;
    align-items: center;
  }

  .slip-header::after {
    width: 50%;
    border-bottom-width: 1.2px;
  }

  .slip-tracking {
    font-size: 0.74rem;
  }

  .slip-body {
    grid-template-columns: 1fr 1fr;
    gap: 0.14rem;
  }

  .slip-section h4 {
    margin-bottom: 0.03rem;
    font-size: 0.56rem;
  }

  .slip-section p,
  .slip-field-line {
    margin: 0.015rem 0;
    line-height: 1.12;
  }

  .slip-qr-area {
    flex-direction: row;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.2rem;
    padding-top: 0.14rem;
    margin-top: 0.14rem;
  }

  #slip-qr-code svg {
    width: 56px !important;
    height: 56px !important;
    flex-shrink: 0;
  }

  .slip-meta {
    display: flex;
    flex-direction: column;
    gap: 0.03rem;
    font-size: 0.54rem;
    margin-top: 0;
    flex: 1;
    line-height: 1.08;
  }

  #qr-only-label {
    display: none !important;
  }

  /* ── QR-only 2×2 inch print ── */
  body.print-qr-only .shipping-slip {
    display: none !important;
  }

  body.print-qr-only #qr-only-label {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 2in;
    height: 2in;
    padding: 0;
    box-sizing: border-box;
    margin: 0;
    gap: 0;
    overflow: hidden;
    page-break-inside: avoid;
    break-inside: avoid;
    background: #fff;
  }

  body.print-qr-only #qr-only-code svg {
    display: block;
    width: 0.49in !important;
    height: 0.49in !important;
  }

  body.print-qr-only #qr-only-tracking {
    font-family: monospace;
    font-size: 3.8pt;
    font-weight: 700;
    letter-spacing: 0;
    text-align: center;
    color: #111;
    word-break: break-all;
    max-width: 1.45in;
    line-height: 1;
    margin: 0;
  }

  body.print-qr-only #slip-modal {
    width: 2in !important;
    height: 2in !important;
    min-height: 2in !important;
    max-height: 2in !important;
    overflow: hidden !important;
  }

  body.print-qr-only #slip-modal .modal {
    width: 2in !important;
    height: 2in !important;
    min-height: 2in !important;
    max-height: 2in !important;
    overflow: hidden !important;
    padding: 0 !important;
  }
}

@media (max-width: 720px) {
  .top-shell,
  .page-shell,
  .container {
    width: calc(100vw - 16px);
    left: 0;
  }

  .top-shell {
    padding-top: 16px;
  }

  .hero {
    padding: 32px 24px 2.5rem;
  }

  .track-form {
    flex-direction: column;
  }

  .track-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .container {
    width: calc(100vw - 16px);
    padding: 1rem 0 0;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .modal-overlay {
    align-items: flex-start;
    padding: 10px;
  }

  .modal {
    margin: auto;
    width: min(100%, 550px);
    max-height: none;
    padding: 1rem;
  }

  .slip-modal-content {
    width: min(100%, 650px);
    max-width: min(100%, 650px);
  }

  .shipping-slip {
    padding: 1rem 0.85rem;
    font-size: 0.78rem;
  }

  .slip-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .slip-tracking {
    font-size: 1rem;
    word-break: break-word;
  }

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

  .slip-field-line {
    flex-wrap: wrap;
  }

  .slip-field-label {
    white-space: normal;
  }

  .slip-field-value {
    min-width: 0;
  }

  .slip-qr-layout {
    grid-template-columns: 1fr;
  }

  #slip-qr-code svg {
    width: min(100%, 240px);
  }

  .slip-meta {
    gap: 0.35rem 0.75rem;
  }

  .slip-meta-spread {
    justify-content: flex-start;
  }
}
