:root {
  --blue: #004899;
  --blue-light: #005bb5;
  --blue-dark: #002b5c;
  --navy: #002247;
  --navy-deep: #001f3f;
  --yellow: #ffb800;
  --yellow-hover: #e6a600;
  --red: #d92d3a;
  --red-dark: #b91c2b;
  --green: #16834f;
  --teal: #147b80;
  --orange: #c66a08;
  --page: #f5f7fa;
  --surface: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #d7dee7;
  --border-soft: #e8edf3;
  --focus: rgba(0, 72, 153, 0.18);
  --header-height: 74px;
  --sidebar-width: 250px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--page);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 1.3;
}

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 3000;
  padding: 9px 14px;
  transform: translateY(-150%);
  border-radius: 4px;
  background: #ffffff;
  color: var(--blue-dark);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 650;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.button {
  gap: 7px;
  padding: 8px 18px;
  white-space: nowrap;
}

.button-small {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 12px;
}

.button-primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.button-primary:hover {
  border-color: var(--blue-light);
  background: var(--blue-light);
}

.button-outline {
  border-color: #b8c4d2;
  background: #ffffff;
  color: #334155;
}

.button-outline:hover {
  border-color: #8293a7;
  background: #f7f9fb;
}

.button-ghost {
  border-color: rgba(255, 255, 255, 0.42);
  background: transparent;
  color: #ffffff;
}

.button-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

.button-danger {
  border-color: var(--red);
  background: var(--red);
  color: #ffffff;
}

.button-danger:hover {
  border-color: var(--red-dark);
  background: var(--red-dark);
}

.button-danger-soft {
  border-color: #f0b8be;
  background: #fff5f6;
  color: #a91e2d;
}

.button-danger-soft:hover {
  border-color: #dc7f8a;
  background: #fee9eb;
}

.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button:focus-visible,
.icon-button:focus-visible,
.input:focus-visible,
.file-picker:focus-within,
.side-nav-item:focus-visible,
.switch-control input:focus-visible + span {
  outline: 0;
  box-shadow: 0 0 0 3px var(--focus);
}

.input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #bdc8d5;
  border-radius: 6px;
  outline: 0;
  background: #ffffff;
  line-height: 1.45;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

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

.input:hover {
  border-color: #91a1b3;
}

.input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--focus);
}

.boot-screen,
.login-screen {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #edf2f7;
}

.boot-screen {
  flex-direction: column;
  gap: 16px;
  color: var(--muted);
  font-weight: 600;
}

.boot-screen p {
  margin: 0;
}

.boot-mark {
  display: inline-flex;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--blue);
  color: var(--yellow);
  font-size: 17px;
  font-weight: 800;
}

.login-card {
  width: min(440px, 100%);
  padding: 34px;
  border: 1px solid var(--border);
  border-top: 5px solid var(--blue);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 42px rgba(15, 35, 58, 0.1);
}

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

.login-brand p {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 13px;
}

.login-brand h1 {
  margin: 0;
  color: var(--blue-dark);
  font-size: 21px;
}

.login-submit {
  width: 100%;
  margin-top: 6px;
}

.back-link {
  display: block;
  margin-top: 22px;
  color: var(--blue);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.field {
  min-width: 0;
  margin-bottom: 18px;
}

.field > label:not(.switch-control) {
  display: block;
  margin-bottom: 6px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.required-mark {
  margin-left: 3px;
  color: var(--red);
  font-weight: 800;
}

.field-help {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.field-error {
  margin: 5px 0 0;
  color: #a61b29;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

.input.input-error {
  border-color: var(--red);
  background: #fffafa;
}

.input.input-error:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(217, 45, 58, 0.15);
}

.form-error {
  margin: 2px 0 14px;
  padding: 10px 12px;
  border: 1px solid #f2bbc1;
  border-radius: 6px;
  background: #fff4f5;
  color: #a61b29;
}

.form-error-summary {
  margin: 0 0 18px;
}

.form-error-summary:focus {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(217, 45, 58, 0.15);
}

.form-error-summary strong {
  display: block;
  margin-bottom: 5px;
}

.form-error-summary ul {
  margin: 0;
  padding-left: 20px;
}

.form-error-summary a {
  color: inherit;
  font-weight: 650;
}

.noscript-message {
  margin: 24px;
  padding: 18px;
  border: 1px solid #f2bbc1;
  background: #fff4f5;
  color: #8f1d28;
  text-align: center;
}

.admin-app {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 900;
  display: flex;
  min-height: var(--header-height);
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 11px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--navy);
  color: #ffffff;
}

.header-brand,
.header-actions,
.user-summary {
  display: flex;
  align-items: center;
}

.header-brand {
  min-width: 0;
  gap: 13px;
}

.header-brand > div {
  min-width: 0;
}

.header-brand h1 {
  max-width: 520px;
  margin: 0;
  overflow: hidden;
  color: #ffffff;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-brand p {
  margin: 2px 0 0;
  color: #cbd8e8;
  font-size: 12px;
}

.admin-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--yellow);
  color: #1a1a1a;
  font-size: 12px;
  font-weight: 800;
}

.header-actions {
  flex: 0 0 auto;
  gap: 10px;
}

.user-summary {
  gap: 8px;
  margin-right: 4px;
}

.user-name {
  max-width: 150px;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-badge {
  padding: 2px 7px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 4px;
  color: #dbe7f3;
  font-size: 11px;
}

.icon-button {
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 21px;
}

.menu-toggle {
  display: none;
}

.app-body {
  display: grid;
  min-height: calc(100vh - var(--header-height));
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: var(--header-height);
  z-index: 500;
  align-self: start;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  border-right: 1px solid #dbe2ea;
  background: #ffffff;
  padding: 20px 14px 28px;
}

.nav-group + .nav-group {
  margin-top: 20px;
}

.nav-group-title {
  margin: 0 10px 6px;
  color: #8a99aa;
  font-size: 11px;
  font-weight: 800;
}

.side-nav-item {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border-radius: 6px;
  background: transparent;
  color: #435266;
  cursor: pointer;
  font-weight: 650;
  text-align: left;
}

.side-nav-item:hover {
  background: #f1f5f9;
  color: var(--blue-dark);
}

.side-nav-item.active {
  background: #e8f1fb;
  color: var(--blue);
}

.nav-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border: 1px solid #8fa1b5;
  border-radius: 50%;
  background: #ffffff;
}

.side-nav-item.active .nav-dot {
  border-color: var(--blue);
  background: var(--blue);
}

.nav-scrim {
  display: none;
}

.main-content {
  min-width: 0;
  padding: 32px clamp(20px, 3vw, 46px) 52px;
  outline: 0;
}

#page-content {
  width: min(100%, 1450px);
  margin: 0 auto;
}

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

.page-header > div:first-child {
  min-width: 0;
}

.page-eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.page-header h2 {
  margin: 0;
  color: var(--blue-dark);
  font-size: 25px;
  overflow-wrap: anywhere;
}

.page-description {
  max-width: 760px;
  margin: 7px 0 0;
  color: var(--muted);
}

.page-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.surface {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 3px 12px rgba(15, 35, 58, 0.035);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.metric-card {
  min-width: 0;
  min-height: 126px;
  padding: 20px;
  border: 1px solid var(--border);
  border-top: 4px solid var(--blue);
  border-radius: 8px;
  background: #ffffff;
}

.metric-card p {
  margin: 0 0 10px;
  color: var(--muted);
  font-weight: 650;
}

.metric-card strong {
  display: block;
  overflow: hidden;
  color: var(--blue-dark);
  font-size: 28px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-orange { border-top-color: var(--orange); }
.metric-green { border-top-color: var(--green); }
.metric-teal { border-top-color: var(--teal); }
.metric-red { border-top-color: var(--red); }
.metric-navy { border-top-color: var(--navy-deep); }

.quick-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 24px;
  padding: 24px;
  border-left: 4px solid var(--yellow);
  background: #ffffff;
}

.quick-section h3 {
  margin: 0;
  color: var(--blue-dark);
  font-size: 18px;
}

.quick-section p {
  margin: 3px 0 0;
  color: var(--muted);
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.loading-state,
.state-panel,
.empty-state {
  display: flex;
  min-height: 250px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
}

.loading-state {
  gap: 12px;
  font-weight: 650;
}

.spinner {
  width: 23px;
  height: 23px;
  border: 3px solid #d8e0e8;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.state-panel,
.empty-state {
  flex-direction: column;
  gap: 12px;
  padding: 36px 20px;
  text-align: center;
}

.state-panel h3,
.empty-state h3 {
  margin: 0;
  color: #334155;
  font-size: 17px;
}

.state-panel p {
  max-width: 600px;
  margin: 0;
}

.state-error {
  border-color: #edc3c7;
  background: #fffafa;
}

.logo-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.logo-section h3 {
  margin: 0 0 10px;
  color: var(--blue-dark);
  font-size: 16px;
}

.logo-preview {
  display: flex;
  width: 124px;
  height: 64px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f7f9fb;
}

.logo-preview img {
  display: block;
  max-width: 110px;
  max-height: 52px;
  object-fit: contain;
}

.logo-preview span {
  display: inline-flex;
  width: 46px;
  height: 46px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: var(--blue);
  color: var(--yellow);
  font-size: 15px;
  font-weight: 800;
}

.logo-upload {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.file-picker {
  position: relative;
  display: flex;
  width: min(280px, 60vw);
  min-width: 180px;
  max-width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px dashed #98a8ba;
  border-radius: 6px;
  background: #f8fafc;
  color: #435266;
  cursor: pointer;
  font-weight: 650;
}

.file-picker span {
  display: block;
  max-width: calc(100% - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-picker input {
  position: absolute;
  inset: 0;
  cursor: pointer;
  opacity: 0;
}

.settings-form {
  padding-bottom: 0;
}

.settings-group {
  min-width: 0;
  margin: 0;
  padding: 0 0 12px;
  border: 0;
}

.settings-group + .settings-group {
  padding-top: 22px;
  border-top: 1px solid var(--border-soft);
}

.settings-group legend {
  width: 100%;
  margin-bottom: 18px;
  color: var(--blue-dark);
  font-size: 17px;
  font-weight: 750;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 20px;
}

.field-wide {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin: 0 -24px;
  padding: 18px 24px;
  border-top: 1px solid var(--border-soft);
  background: #fafbfd;
}

.color-control {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 9px;
}

.color-control input[type="color"] {
  width: 54px;
  height: 42px;
  padding: 4px;
  border: 1px solid #bdc8d5;
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
}

.switch-control {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.switch-control input {
  position: absolute;
  opacity: 0;
}

.switch-control span {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 42px;
  border-radius: 12px;
  background: #b7c2ce;
  transition: background-color 150ms ease;
}

.switch-control span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  content: "";
  transition: transform 150ms ease;
}

.switch-control input:checked + span {
  background: var(--blue);
}

.switch-control input:checked + span::after {
  transform: translateX(18px);
}

.switch-control b {
  font-size: 13px;
}

.field-switch {
  display: flex;
  align-items: flex-end;
}

.filter-bar {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.filter-search {
  width: min(430px, 100%);
  min-width: 220px;
}

.filter-select {
  width: auto;
  min-width: 145px;
}

.table-wrap {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  color: #334155;
}

.orders-table {
  min-width: 1460px;
}

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f5f8fb;
  color: #526174;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

tbody tr:hover {
  background: #fafcff;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td strong {
  color: #24364c;
}

td small {
  display: block;
  max-width: 220px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-number-cell {
  width: 185px;
  max-width: 185px;
  overflow-wrap: anywhere;
}

.order-payment-summary {
  width: 165px;
  min-width: 165px;
}

.cell-kicker {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.freight-amount {
  display: block;
  color: #1f4f79;
  font-size: 16px;
}

.order-admin-summary-cell {
  width: 250px;
  min-width: 250px;
}

.order-admin-summary {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.tracking-kicker {
  margin-top: 10px;
}

.carrier-name {
  overflow-wrap: anywhere;
  color: #24364c;
  font-size: 13px;
}

.cell-clamp {
  display: -webkit-box;
  max-width: 230px;
  overflow: hidden;
  color: #334155;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.cell-truncate {
  display: inline-block;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.nowrap {
  white-space: nowrap;
}

.row-actions {
  display: flex;
  min-width: max-content;
  align-items: center;
  gap: 7px;
}

.money-danger {
  color: #af2432;
  font-weight: 750;
}

.status {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-success { background: #e2f5e9; color: #146b3e; }
.status-info { background: #e3f1fb; color: #0b6396; }
.status-warning { background: #fff2cd; color: #895305; }
.status-danger { background: #fde6e8; color: #a51d2b; }
.status-muted { background: #edf1f5; color: #637184; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 18px;
  color: var(--muted);
  font-size: 13px;
}

.inline-empty {
  padding: 15px;
  border: 1px dashed #c7d1dc;
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  text-align: center;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(1, 22, 45, 0.66);
  cursor: default;
}

.modal {
  position: relative;
  display: flex;
  width: min(680px, 100%);
  max-height: calc(100vh - 40px);
  flex-direction: column;
  overflow: hidden;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(0, 20, 42, 0.28);
}

.modal-order-create {
  width: min(920px, 100%);
}

.modal-header {
  display: flex;
  min-height: 66px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
}

.modal-header h2 {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--blue-dark);
  font-size: 19px;
}

.modal-close {
  flex: 0 0 40px;
  color: #475569;
  font-size: 28px;
}

#modal-form {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.modal-body {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 22px 22px 4px;
}

.modal-form-grid {
  align-items: start;
}

.order-form-intro {
  margin: 0 0 20px;
  padding: 12px 14px;
  border-left: 3px solid var(--yellow);
  background: #f8fafc;
  color: #526174;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.order-form-intro p {
  margin: 0;
}

.order-form-intro p + p {
  margin-top: 3px;
}

.order-form-section {
  min-width: 0;
  margin: 0;
  padding: 0 0 4px;
  border: 0;
}

.order-form-section + .order-form-section {
  margin-top: 4px;
  padding-top: 20px;
  border-top: 1px solid var(--border-soft);
}

.order-form-section legend {
  width: 100%;
  margin-bottom: 16px;
  color: var(--blue-dark);
  font-size: 15px;
  font-weight: 750;
}

.order-address-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 30px;
}

.order-address-group {
  min-width: 0;
}

.order-address-group h3 {
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid #dbe7f3;
  color: #334155;
  font-size: 13px;
}

.carrier-detect-status {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 7px 9px;
  border: 1px solid #d7e0e9;
  border-left-width: 3px;
  border-radius: 5px;
  background: #f8fafc;
  color: #526174;
  font-size: 12px;
  line-height: 1.5;
}

.carrier-detect-status [data-carrier-detect-message] {
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
}

.carrier-detect-status.state-loading {
  border-color: #a9caeb;
  border-left-color: var(--blue);
  background: #eef6ff;
  color: #003f86;
}

.carrier-detect-status.state-success {
  border-color: #add9bf;
  border-left-color: var(--green);
  background: #edf9f2;
  color: #12613d;
}

.carrier-detect-status.state-error {
  border-color: #efb9bf;
  border-left-color: var(--red);
  background: #fff4f5;
  color: #941e2b;
}

.carrier-detect-status.state-manual {
  border-color: #cbd5e1;
  border-left-color: var(--teal);
  background: #f3f6f9;
  color: #3f4f61;
}

.carrier-detect-spinner {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  border: 2px solid #b9cee4;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.carrier-detect-retry {
  min-height: 32px;
  flex: 0 0 auto;
  padding: 4px 10px;
  border: 1px solid #d3848e;
  border-radius: 5px;
  background: #ffffff;
  color: #8b1d2a;
  cursor: pointer;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  touch-action: manipulation;
}

.carrier-detect-retry:hover {
  border-color: #bd5965;
  background: #fffafa;
}

.carrier-detect-retry:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px var(--focus);
}

.modal-order-create #modal-submit {
  min-width: 112px;
}

.modal-footer {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 10px;
  padding: 15px 20px;
  border-top: 1px solid var(--border-soft);
  background: #fafbfd;
}

#modal-error {
  margin: 0 20px 14px;
}

.confirm-message {
  margin: 8px 0 24px;
  color: #334155;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.timeline-history {
  margin-bottom: 18px;
  padding: 15px 16px;
  border-left: 3px solid var(--blue);
  background: #f7f9fc;
}

.timeline-history h3 {
  margin: 0 0 12px;
  color: #334155;
  font-size: 14px;
}

.timeline-entry {
  position: relative;
  padding: 0 0 13px 16px;
  border-left: 1px solid #c6d1dc;
}

.timeline-entry:last-child {
  padding-bottom: 0;
  border-left-color: transparent;
}

.timeline-entry::before {
  position: absolute;
  top: 5px;
  left: -4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
  content: "";
}

.timeline-entry time,
.timeline-entry small {
  color: var(--muted);
  font-size: 11px;
}

.timeline-entry p {
  margin: 2px 0;
  color: #334155;
  overflow-wrap: anywhere;
}

.detail-list {
  margin: 0 0 20px;
  padding: 14px 16px;
  border-left: 3px solid var(--yellow);
  background: #f8fafc;
}

.detail-list > div {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 12px;
  padding: 5px 0;
}

.detail-list dt {
  color: var(--muted);
  font-weight: 700;
}

.detail-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.toast-region {
  position: fixed;
  top: calc(var(--header-height) + 16px);
  right: 18px;
  z-index: 2600;
  width: min(380px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  padding: 13px 16px;
  border: 1px solid #add9bf;
  border-left: 4px solid var(--green);
  border-radius: 6px;
  background: #f1fbf5;
  color: #145d39;
  box-shadow: 0 12px 32px rgba(15, 35, 58, 0.15);
  font-weight: 650;
  overflow-wrap: anywhere;
}

.toast-error {
  border-color: #efb9bf;
  border-left-color: var(--red);
  background: #fff5f6;
  color: #941e2b;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 1080px) {
  .user-summary {
    display: none;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .menu-toggle {
    display: inline-flex;
  }

  .app-body {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    z-index: 1050;
    height: auto;
    transform: translateX(-102%);
    box-shadow: 12px 0 28px rgba(0, 31, 63, 0.16);
    transition: transform 180ms ease;
  }

  .nav-scrim {
    position: fixed;
    inset: var(--header-height) 0 0;
    z-index: 1000;
    display: block;
    visibility: hidden;
    width: 100%;
    height: calc(100vh - var(--header-height));
    background: rgba(0, 25, 51, 0.45);
    opacity: 0;
    transition: opacity 180ms ease, visibility 180ms ease;
  }

  .nav-open .sidebar {
    transform: translateX(0);
  }

  .nav-open .nav-scrim {
    visibility: visible;
    opacity: 1;
  }

  .main-content {
    padding: 28px 22px 44px;
  }
}

@media (max-width: 720px) {
  :root {
    --header-height: 66px;
  }

  .app-header {
    min-height: var(--header-height);
    padding: 9px 14px;
  }

  .header-brand {
    gap: 8px;
  }

  .header-brand h1 {
    max-width: 230px;
    font-size: 15px;
  }

  .header-brand p,
  .admin-badge,
  .header-link {
    display: none;
  }

  .main-content {
    padding: 22px 14px 38px;
  }

  .page-header {
    align-items: flex-start;
  }

  .page-actions .button {
    min-height: 44px;
  }

  .page-header h2 {
    font-size: 22px;
  }

  .surface {
    padding: 18px;
  }

  .quick-section,
  .logo-section {
    align-items: flex-start;
    flex-direction: column;
  }

  .quick-actions,
  .logo-upload {
    width: 100%;
    justify-content: flex-start;
  }

  .logo-upload {
    flex-wrap: wrap;
  }

  .file-picker {
    min-width: 0;
    flex: 1 1 180px;
  }

  .form-actions {
    margin: 0 -18px;
    padding: 16px 18px;
  }

  .filter-bar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .filter-search {
    width: 100%;
    min-width: 0;
  }

  .filter-select {
    min-width: 0;
    flex: 1 1 150px;
  }

  .modal-layer {
    padding: 10px;
  }

  .modal {
    max-height: calc(100vh - 20px);
  }

  .modal-order-create {
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
  }

  .modal-order-create .input {
    max-width: 100%;
    min-height: 44px;
    font-size: 16px;
  }

  .modal-order-create .modal-close {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .order-address-columns {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .order-address-group + .order-address-group {
    padding-top: 18px;
    border-top: 1px dashed #cbd5e1;
  }

  .toast-region {
    top: calc(var(--header-height) + 10px);
    right: 10px;
    width: calc(100vw - 20px);
  }
}

@media (max-width: 600px) {
  .login-screen {
    padding: 14px;
  }

  .login-card {
    padding: 26px 20px;
  }

  .page-header {
    flex-direction: column;
    gap: 14px;
  }

  .page-actions,
  .page-actions .button {
    width: 100%;
  }

  .metrics-grid,
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .field-wide {
    grid-column: auto;
  }

  .modal-order-create .modal-body {
    padding: 18px 16px 2px;
  }

  .modal-order-create .modal-header,
  .modal-order-create .modal-footer {
    padding-right: 16px;
    padding-left: 16px;
  }

  .modal-order-create .modal-footer .button {
    min-height: 44px;
    flex: 1 1 0;
  }

  .modal-order-create .modal-footer {
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }

  .carrier-detect-status {
    flex-wrap: wrap;
  }

  .carrier-detect-retry {
    width: 100%;
    min-height: 44px;
    margin-top: 2px;
  }

  .metric-card {
    min-height: 106px;
  }

  .quick-actions {
    flex-direction: column;
  }

  .quick-actions .button {
    width: 100%;
  }

  .filter-bar > .button {
    flex: 1 1 calc(50% - 5px);
  }

  .pagination {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .pagination span {
    width: 100%;
    order: -1;
    text-align: center;
  }

  .modal-body {
    padding: 18px 16px 2px;
  }

  .modal-header,
  .modal-footer {
    padding-right: 16px;
    padding-left: 16px;
  }

  #modal-error {
    margin-right: 16px;
    margin-left: 16px;
  }

  .detail-list > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 1px;
  }
}

@media (max-width: 420px) {
  .header-actions .button-danger {
    min-width: 58px;
    padding-right: 9px;
    padding-left: 9px;
  }

  .header-brand h1 {
    max-width: 165px;
  }

  .metrics-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .logo-upload .button,
  .file-picker {
    width: 100%;
    flex-basis: 100%;
  }

  .modal-footer .button {
    flex: 1;
    padding-right: 10px;
    padding-left: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .carrier-detect-spinner {
    animation: none !important;
    border-right-color: var(--blue);
  }
}
