@font-face {
  font-family: "Nunito";
  src: url("/assets/nunito.woff2") format("woff2");
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  font-family: "Nunito", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
  background: #f3f4f6;
  --blue: #024f8d;
  --blue-hover: #0062a7;
  --indigo: #4f46e5;
  --indigo-hover: #3730a3;
  --danger: #dc2626;
  --success: #15803d;
  --border: #e5e7eb;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: #f3f4f6; line-height: 1.5; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.auth-shell { width: min(672px, 100%); margin: 0 auto; padding: 13px 0 32px; }
.auth-logo {
  min-height: 148px; display: grid; place-items: center; background: #fff;
  border-radius: 8px; margin: 0 0 16px; padding: 16px;
}
.auth-logo img { width: min(264px, 80%); height: auto; display: block; }
.auth-card, .card {
  background: #fff; border-radius: 8px; box-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);
}
.auth-card { padding: 40px; }
.field { margin-bottom: 24px; }
.field label { display: block; margin-bottom: 4px; font-weight: 700; color: #374151; }
.input, .select {
  width: 100%; min-height: 40px; border: 2px solid #e5e7eb; border-radius: 8px;
  background: #fff; padding: 6px 12px; color: #111827; outline: none;
}
.input::placeholder { color: #9ca3af; }
.input:focus, .select:focus { border-color: #60a5fa; box-shadow: 0 0 0 3px rgb(96 165 250 / .18); }
.separator { border: 0; border-top: 1px solid #e5e7eb; margin: 18px 0; }
.link { color: #2563eb; text-decoration: underline; text-underline-offset: 2px; }
.link:hover { color: #1d4ed8; }

.btn {
  border: 0; border-radius: 6px; padding: 8px 16px; cursor: pointer; text-decoration: none;
  box-shadow: 0 1px 3px rgb(0 0 0 / .1); transition: background-color .15s, transform .15s, box-shadow .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgb(0 0 0 / .12); }
.btn:active { transform: none; }
.btn:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-indigo { background: var(--indigo); color: #fff; }
.btn-indigo:hover { background: var(--indigo-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: #16a34a; color: #fff; }
.btn-muted { background: #e5e7eb; color: #111827; }
.btn-sm { padding: 5px 10px; font-size: 14px; }

.site-header { height: 65px; background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / .08); }
.header-inner { height: 100%; max-width: 1280px; margin: auto; padding: 8px 18px; display: flex; align-items: center; justify-content: space-between; }
.header-brand { flex: 0 0 auto; }
.header-brand img { width: 112px; height: auto; display: block; }
.header-user { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.logout { color: #a33b3b; text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; }
.main { max-width: 1280px; margin: auto; padding: 16px 12px 64px; }
.code-panel { background: #fff; border: 1px solid var(--border); padding: 9px 16px; margin-bottom: 12px; min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.code-button { border: 0; background: transparent; color: var(--blue); padding: 2px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.toolbar { display: flex; gap: 12px; margin-bottom: 16px; }
.toolbar .btn { flex: 1; }
.search { margin-bottom: 36px; }
.search .input { min-height: 36px; box-shadow: 0 1px 3px rgb(0 0 0 / .06); }
.empty { font-size: 16px; }
.tracks-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.track-card { background: #fff; border-radius: 8px; box-shadow: 0 5px 14px rgb(0 0 0 / .10); padding: 18px; position: relative; overflow: hidden; }
.track-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.track-barcode { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.track-title { color: #4b5563; margin: 5px 0 18px; overflow-wrap: anywhere; }
.icon-button { border: 0; background: #fff; cursor: pointer; padding: 3px; border-radius: 5px; }
.icon-button:hover { background: #fee2e2; }
.icon-button img { width: 24px; height: 24px; display: block; }
.status-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 10px; background: #dbeafe; color: #1e3a8a; font-weight: 700; font-size: 13px; }
.timeline { margin: 18px 0 0; display: grid; gap: 11px; }
.timeline-step { display: grid; grid-template-columns: 18px 1fr; gap: 9px; align-items: start; color: #9ca3af; font-size: 13px; }
.timeline-step.active { color: #1f2937; }
.timeline-step img { width: 16px; height: 16px; margin-top: 2px; }
.track-date { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 10px; color: #6b7280; font-size: 12px; }

.modal-backdrop { position: fixed; inset: 0; background: rgb(55 65 81 / .82); display: grid; place-items: center; padding: 18px; z-index: 20; }
.modal { width: min(560px, 100%); background: #fff; border-radius: 8px; padding: 24px; box-shadow: 0 24px 60px rgb(0 0 0 / .3); }
.modal h2 { margin-top: 0; font-size: 21px; }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.address-box { background: #dcfce7; border: 1px solid #4ade80; border-radius: 6px; padding: 14px; }
.address-box p { white-space: pre-wrap; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: min(440px, calc(100vw - 48px)); padding: 12px 18px; border-radius: 12px; color: #fff; box-shadow: 0 16px 36px rgb(0 0 0 / .25); z-index: 30; }
.toast.success { background: #15803d; }
.toast.error { background: #b91c1c; }

.admin-layout { display: grid; gap: 16px; }
.admin-card { background: #fff; border-radius: 8px; padding: 18px; box-shadow: 0 4px 12px rgb(0 0 0 / .08); }
.admin-card h1 { margin: 0 0 6px; font-size: 24px; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 820px; }
.admin-table th, .admin-table td { text-align: left; padding: 10px; border-bottom: 1px solid #e5e7eb; vertical-align: middle; }
.admin-table th { color: #4b5563; font-size: 13px; }
.admin-table .select { min-width: 190px; min-height: 36px; padding: 4px 8px; }
.muted { color: #6b7280; }

.timeline { list-style: none; padding: 0; }
.timeline-step { color: #64748b; }
.timeline-step small { display: block; font-size: 12px; }
.stage-dot { width: 11px; height: 11px; border-radius: 50%; background: #d1d5db; margin: 4px 0 0 2px; }
.timeline-step.active .stage-dot { background: #267657; }
.imported-history { color: #4b5563; font-size: 13px; margin-top: 12px; }
.notice { background: #ecfdf5; color: #174c38; padding: 12px; border-radius: 6px; margin: 0 0 16px; }
.notice.error, .form-error, .result-conflict, .result-invalid { color: #9f241d; }
.result-accepted { color: #146144; font-weight: 700; }
.staff { display: grid; gap: 16px; }
.staff h1, .staff h2, .staff h3, .staff p { margin: 0; }
.staff h1 { font-size: 28px; }
.staff h2, .staff-dialog h2 { font-size: 20px; }
.staff .admin-table { min-width: 580px; }
.staff .admin-card { min-width: 0; }
.staff-nav, .staff-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.staff-nav a { background: #fff; padding: 7px 12px; border-radius: 6px; color: #124534; text-decoration: none; }
.staff-nav a[aria-current="page"] { background: #124534; color: #fff; }
.warehouse-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.warehouse-layout .admin-card { display: grid; gap: 16px; }
.warehouse-layout .admin-table { min-width: 0; }
.stack { display: grid; gap: 12px; }
.stack label :is(.input, .select) { margin-top: 4px; }
.staff-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; max-width: 550px; }
.staff-search label { grid-column: 1 / -1; }
.queue-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 5px; }
.queue-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: #f5f7f6; padding: 6px 10px; }
.staff code { overflow-wrap: anywhere; }
.staff-dialog { width: min(520px, calc(100vw - 32px)); border: 0; border-radius: 10px; padding: 22px; max-height: calc(100dvh - 32px); }
.staff-dialog::backdrop { background: rgb(17 24 39 / .66); }
.staff-dialog h2 { margin-top: 0; }
.form-error:empty, #issue-result:empty { display: none; }

@media (max-width: 900px) { .tracks-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 840px) { .warehouse-layout { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .auth-shell { padding-top: 13px; }
  .auth-logo, .auth-card { border-radius: 7px; }
  .auth-card { padding: 40px; }
  .site-header { height: 60px; }
  .header-inner { padding-inline: 12px; }
  .header-brand img { width: 91.2px; }
  .main { padding-top: 16px; }
  .toolbar { gap: 10px; }
  .tracks-grid { grid-template-columns: 1fr; }
  .modal { padding: 20px; }
}

@media (max-width: 420px) {
  .auth-card { padding: 40px; }
  .auth-logo { min-height: 132px; }
  .auth-logo img { width: min(204.8px, 80%); }
  .header-user { font-size: 14px; }
  .code-panel { align-items: flex-start; flex-direction: column; }
}
