:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --border: #e4e6ee;
  --text: #14151f;
  --text-muted: #6b6d7c;
  --accent: #173ded;
  --accent-soft: #eaedff;
  --accent-contrast: #ffffff;
  --good: #12875c;
  --good-soft: #e6f7ef;
  --warn: #b3690a;
  --warn-soft: #fdf1e0;
  --bad: #d13438;
  --bad-soft: #fdeceb;
  --nav-bg: #ffffff;
  --nav-width: 220px;
  --topbar-height: 72px;
  --shadow-sm: 0 1px 2px rgba(20, 21, 31, 0.04), 0 1px 1px rgba(20, 21, 31, 0.03);
  --shadow-md: 0 8px 24px rgba(20, 21, 31, 0.06), 0 2px 6px rgba(20, 21, 31, 0.04);
}

[data-theme="dark"] {
  --bg: #111218;
  --surface: #191a22;
  --surface-raised: #1e2029;
  --border: #2a2c38;
  --text: #f0f0f4;
  --text-muted: #9799a8;
  --accent: #6b83ff;
  --accent-soft: #232842;
  --accent-contrast: #ffffff;
  --good: #33c481;
  --good-soft: #17301f;
  --warn: #e0a53e;
  --warn-soft: #332711;
  --bad: #ff6b6f;
  --bad-soft: #3a1f1e;
  --nav-bg: #15161d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background:
    radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 45%),
    radial-gradient(circle at 90% 30%, color-mix(in srgb, var(--good) 8%, transparent), transparent 40%),
    radial-gradient(circle at 40% 90%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 45%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

input {
  font-family: inherit;
}

/* Top bar */

.topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 1.5rem;
  background: color-mix(in srgb, var(--surface) 65%, transparent);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 10%, transparent);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__brand {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  width: calc(var(--nav-width) - 1.5rem);
}

.topbar__logo {
  height: 34px;
  width: auto;
  display: block;
}

.topbar__tagline {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: linear-gradient(
    100deg,
    #ff5f6d, #ffc371, #4fd68c, #4facfe, #a06bff, #ff5f6d
  );
  background-size: 300% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: saturate(1.15) drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 25%, transparent));
  animation: tagline-shimmer 6s linear infinite;
}

@keyframes tagline-shimmer {
  to { background-position: 300% center; }
}

.topbar__search {
  position: relative;
  flex: 1;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  color: var(--text-muted);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.topbar__search:focus-within {
  border-color: var(--accent);
  background: var(--surface);
}

.topbar__search-icon {
  flex-shrink: 0;
}

.topbar__search input {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 0.875rem;
  width: 100%;
}

.topbar__search input::placeholder {
  color: var(--text-muted);
}

.search-results {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.4rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
  max-height: 22rem;
  overflow-y: auto;
  z-index: 20;
}

.search-results__group + .search-results__group {
  border-top: 1px solid var(--border);
  padding-top: 0.25rem;
  margin-top: 0.25rem;
}

.search-results__row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}

.search-results__row:hover,
.search-results__row--active {
  background: var(--accent-soft);
}

.search-results__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.search-results__title {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-results__subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.search-results__empty {
  padding: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.search-pill {
  flex-shrink: 0;
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.search-pill--request {
  background: var(--accent-soft);
  color: var(--accent);
}

.search-pill--order {
  background: var(--good-soft);
  color: var(--good);
}

.search-pill--customer {
  background: var(--warn-soft);
  color: var(--warn);
}

.topbar__actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Shell layout */

.app-shell {
  display: flex;
  min-height: calc(100vh - var(--topbar-height));
}

.sidebar {
  width: var(--nav-width);
  flex-shrink: 0;
  background: color-mix(in srgb, var(--nav-bg) 60%, transparent);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-right: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  flex: 1;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.55rem 0.625rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: background 0.12s ease, color 0.12s ease;
}

.sidebar__icon {
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar__link:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.sidebar__link--active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.sidebar__footer {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 500;
  color: var(--text);
}

.sidebar__avatar {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-contrast);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar__logout {
  width: 100%;
  padding: 0.45rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  text-align: left;
}

.sidebar__logout:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.sidebar__select-customer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
}

.sidebar__select-customer:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.sidebar__viewing {
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.sidebar__viewing-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

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

.sidebar__viewing-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__viewing-clear {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}

.sidebar__viewing-clear:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.picker-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.picker-modal__backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, black 45%, transparent);
}

.picker-modal__panel {
  position: relative;
  width: min(420px, calc(100vw - 2rem));
  max-height: min(520px, calc(100vh - 4rem));
  display: flex;
  flex-direction: column;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 1rem;
  gap: 0.75rem;
}

.picker-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.picker-modal__header h2 {
  font-size: 0.95rem;
  margin: 0;
}

.picker-modal__close {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.picker-modal__close:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.picker-modal__search {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
}

.picker-rows {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
}

.picker-rows__item {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0.5rem 0.625rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.picker-rows__item:hover {
  background: var(--accent-soft);
  border-color: var(--border);
}

.picker-rows__name {
  font-size: 0.85rem;
  font-weight: 600;
}

.picker-rows__email {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.picker-rows__empty {
  padding: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.8rem;
}

.theme-toggle--icon {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
  border-radius: 999px;
  background: var(--bg);
}

.theme-toggle--icon:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

.main {
  flex: 1;
  min-width: 0;
  padding: 2.5rem;
}

.main > * {
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
}

/* Page header */

.page-header {
  margin-bottom: 2rem;
}

.page-eyebrow {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
  background: linear-gradient(135deg, var(--text) 0%, var(--text) 55%, var(--accent) 130%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.page-header p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.95rem;
}

/* Cards / stat tiles */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.1rem;
  margin-bottom: 2rem;
}

.card {
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
  border-radius: 16px;
  padding: 1.35rem;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 16%, transparent),
    0 0 18px color-mix(in srgb, var(--accent) 14%, transparent),
    inset 0 1px 0 color-mix(in srgb, #fff 20%, transparent),
    var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card--section {
  margin-bottom: 2rem;
}

.stat-tile {
  position: relative;
}

.stat-tile:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent),
    0 0 28px color-mix(in srgb, var(--accent) 22%, transparent),
    inset 0 1px 0 color-mix(in srgb, #fff 22%, transparent),
    var(--shadow-md);
}

.stat-tile--accent { --tile-color: var(--accent); }
.stat-tile--good { --tile-color: var(--good); }
.stat-tile--warn { --tile-color: var(--warn); }
.stat-tile--bad { --tile-color: var(--bad); }

@keyframes stat-tile-flash {
  0%, 100% {
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--tile-color) 20%, transparent), var(--shadow-sm);
  }
  50% {
    box-shadow: 0 0 0 1px var(--tile-color), 0 0 18px color-mix(in srgb, var(--tile-color) 45%, transparent), var(--shadow-sm);
  }
}

.stat-tile--flash {
  animation: stat-tile-flash 1.6s ease-in-out infinite;
}

.stat-tile--flash-strong {
  animation-duration: 1s;
}

.stat-tile--flash-urgent {
  animation-duration: 0.5s;
}

.stat-tile--loading:not(.stat-tile--flash) {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent),
    0 0 20px color-mix(in srgb, var(--accent) 18%, transparent),
    var(--shadow-sm);
}

.stat-tile--loading:not(.stat-tile--flash)::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent),
    0 0 44px color-mix(in srgb, var(--accent) 42%, transparent);
  animation: stat-tile-breathe 4.2s ease-in-out infinite;
}

.stat-tile--loading.stat-tile--loading-tinted:not(.stat-tile--flash) {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--tile-color, var(--accent)) 22%, transparent),
    0 0 20px color-mix(in srgb, var(--tile-color, var(--accent)) 18%, transparent),
    var(--shadow-sm);
}

.stat-tile--loading.stat-tile--loading-tinted:not(.stat-tile--flash)::before {
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--tile-color, var(--accent)) 55%, transparent),
    0 0 44px color-mix(in srgb, var(--tile-color, var(--accent)) 42%, transparent);
}

.stat-tile--loading.stat-tile--flash-strong:not(.stat-tile--flash)::before {
  animation-duration: 2.6s;
}

.stat-tile--loading.stat-tile--flash-urgent:not(.stat-tile--flash)::before {
  animation-duration: 1.6s;
}

@keyframes stat-tile-breathe {
  0%, 100% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}

.stat-tile__icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tile-color, var(--accent));
  background: color-mix(in srgb, var(--tile-color, var(--accent)) 14%, transparent);
  margin-bottom: 0.9rem;
}

.stat-tile__label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.stat-tile__value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.notice-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--accent-soft);
  border-color: transparent;
  box-shadow: none;
}

.notice-card__icon {
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.notice-card p {
  color: var(--text);
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Login page */

.login-page {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 12% 15%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 55%),
    radial-gradient(circle at 88% 20%, color-mix(in srgb, #7fd6ff 30%, transparent), transparent 50%),
    radial-gradient(circle at 50% 100%, color-mix(in srgb, var(--good) 14%, transparent), transparent 55%),
    linear-gradient(160deg, color-mix(in srgb, #dbeeff 65%, var(--bg)) 0%, var(--bg) 55%, color-mix(in srgb, #e3f8f1 55%, var(--bg)) 100%);
}

[data-theme="dark"] .login-page {
  background:
    radial-gradient(circle at 12% 15%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 55%),
    radial-gradient(circle at 88% 20%, color-mix(in srgb, #7fd6ff 18%, transparent), transparent 50%),
    radial-gradient(circle at 50% 100%, color-mix(in srgb, var(--good) 16%, transparent), transparent 55%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 360px;
  padding: 2.25rem 2rem;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent),
    0 0 32px color-mix(in srgb, var(--accent) 16%, transparent),
    inset 0 1px 0 color-mix(in srgb, #fff 30%, transparent),
    var(--shadow-md);
}

.login-card__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  margin: 0 auto 1.75rem;
}

.login-card__logo {
  height: 48px;
  width: auto;
  display: block;
}

.login-card__tagline {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: linear-gradient(
    100deg,
    #ff5f6d, #ffc371, #4fd68c, #4facfe, #a06bff, #ff5f6d
  );
  background-size: 300% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: saturate(1.15) drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 25%, transparent));
  animation: tagline-shimmer 6s linear infinite;
}

.login-card h1 {
  font-size: 1.125rem;
  margin: 0 0 1.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1rem;
}

.field label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.field input {
  padding: 0.6rem 0.7rem;
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.btn {
  width: 100%;
  padding: 0.65rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 42%, transparent);
}

.btn--secondary {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.65rem;
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 50%, transparent);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.btn--secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.error-banner {
  background: #fdeceb;
  color: #b3261e;
  border: 1px solid #f6c6c2;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

[data-theme="dark"] .error-banner {
  background: #3a1f1e;
  color: #ff9d97;
  border-color: #5c2b28;
}

/* Requests list */

.requests-toolbar {
  margin-bottom: 1.25rem;
}

.requests-search {
  display: flex;
  gap: 0.75rem;
}

.requests-search input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  color: var(--text);
  font-size: 0.9rem;
}

.requests-search input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.requests-search .btn {
  width: auto;
  padding: 0.6rem 1.25rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

.data-table__empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 0;
}

.status-pill {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--text-muted) 14%, transparent);
  color: var(--text-muted);
}

.status-pill--delivered,
.status-pill--completed {
  background: var(--good-soft);
  color: var(--good);
}

.status-pill--out-for-delivery,
.status-pill--received {
  background: var(--accent-soft);
  color: var(--accent);
}

.status-pill--delivery-attempted {
  background: var(--warn-soft);
  color: var(--warn);
  animation: status-pill-flash-amber 3.2s ease-in-out infinite;
}

.status-pill--unsuccessful {
  background: var(--bad-soft);
  color: var(--bad);
  animation: status-pill-flash-red 3.2s ease-in-out infinite;
}

@keyframes status-pill-flash-amber {
  0%, 100% {
    background: var(--warn-soft);
  }
  50% {
    background: color-mix(in srgb, var(--warn) 45%, var(--warn-soft));
  }
}

@keyframes status-pill-flash-red {
  0%, 100% {
    background: var(--bad-soft);
  }
  50% {
    background: color-mix(in srgb, var(--bad) 45%, var(--bad-soft));
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-pill--delivery-attempted,
  .status-pill--unsuccessful {
    animation: none;
  }
}

.status-pill--canceled,
.status-pill--cancelled-charged,
.status-pill--not-received {
  background: var(--bad-soft);
  color: var(--bad);
}

.status-pill--in-progress {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--accent-soft);
  animation: status-pill-glow-text 2.2s ease-in-out infinite;
}

.status-pill--in-progress::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background: var(--accent);
  opacity: 0;
  animation: status-pill-glow-fill 2.2s ease-in-out infinite;
}

@keyframes status-pill-glow-fill {
  0%,
  100% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}

@keyframes status-pill-glow-text {
  0%,
  100% {
    color: var(--accent);
  }
  50% {
    color: var(--bg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-pill--in-progress {
    animation: none;
    background: var(--accent-soft);
  }
}

.attempts-badge {
  display: inline-block;
  min-width: 1.4rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}

.attempts-badge--warn {
  background: var(--warn-soft);
  color: var(--warn);
}

/* Request detail */

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.detail-header__info {
  min-width: 220px;
}

.detail-header__info .page-eyebrow {
  margin-bottom: 0.4rem;
}

.detail-header__title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.3rem;
  background: linear-gradient(135deg, var(--text) 0%, var(--text) 55%, var(--accent) 130%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.detail-header__meta {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.9rem;
}

.detail-header__stats {
  display: flex;
  align-items: stretch;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.detail-stat-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
  min-width: 118px;
  padding: 0.65rem 1rem;
  border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}

.detail-stat-box__label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.detail-stat-box__value {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

@media (max-width: 720px) {
  .detail-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .detail-header__stats {
    width: 100%;
  }

  .detail-stat-box {
    flex: 1 1 calc(50% - 0.85rem);
  }
}

.card-heading {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 1rem;
}

.card-empty {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0;
}

.map-card {
  padding: 0;
  overflow: hidden;
}

.map-card__frame {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

.detail-grid--split {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 1.25rem;
}

.detail-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.detail-side {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (max-width: 960px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

/* Commercial figures strip */

.commercial-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.commercial-figure {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
  border-radius: 14px;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.commercial-figure--flags {
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.commercial-figure__icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: var(--accent-soft);
}

.commercial-figure__icon--payout { color: var(--good); background: var(--good-soft); }
.commercial-figure__icon--margin { color: var(--warn); background: var(--warn-soft); }

.commercial-figure__label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.commercial-figure__value {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.commercial-figure__value--text {
  font-size: 0.95rem;
  text-transform: capitalize;
}

/* Detail panels */

.detail-columns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.1rem;
  margin-bottom: 1.25rem;
}

.detail-panel__heading {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
}

.detail-panel__heading svg {
  color: var(--accent);
  flex-shrink: 0;
}

@media (max-width: 960px) {
  .detail-columns {
    grid-template-columns: 1fr;
  }
}

/* Journey timeline (collapsible) */

.timeline-card {
  padding: 0;
  overflow: hidden;
}

.timeline-card__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.35rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  text-align: left;
}

.timeline-card__toggle-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--accent);
}

.timeline-card__toggle-left .card-heading {
  margin: 0;
  color: var(--text);
}

.timeline-card__count {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
}

.timeline-card__chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.timeline-card__chevron--open {
  transform: rotate(180deg);
}

.timeline-card > div > .timeline {
  padding: 0 1.35rem 1.35rem;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline--scroll {
  max-height: 26rem;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.timeline__item {
  position: relative;
  display: flex;
  gap: 0.9rem;
  padding-bottom: 1.25rem;
  padding-left: 0.1rem;
}

.timeline__item::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 16px;
  bottom: -4px;
  width: 1px;
  background: var(--border);
}

.timeline__item:last-child::before {
  display: none;
}

.timeline__marker {
  flex-shrink: 0;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  margin-top: 4px;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.timeline__item--undeliverable .timeline__marker,
.timeline__item--unsuccessful .timeline__marker {
  background: var(--bad);
  box-shadow: 0 0 0 3px var(--bad-soft);
}

.timeline__item--noise .timeline__marker {
  background: var(--text-muted);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text-muted) 16%, transparent);
}

.timeline__item--noise {
  opacity: 0.55;
}

.timeline__time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

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

.timeline__title a {
  color: var(--accent);
}

.timeline__tag {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text-muted);
}

.timeline__meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.timeline__empty {
  color: var(--text-muted);
  font-size: 0.875rem;
  list-style: none;
}

.leg-group {
  margin-bottom: 1.1rem;
}

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

.leg-group__label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.leg-group__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.leg-group__list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

.leg-group__list li:last-child {
  border-bottom: none;
}

.leg-group__item--deleted {
  opacity: 0.5;
  text-decoration: line-through;
}

.leg-group__toggle {
  justify-content: flex-start !important;
  border-bottom: none !important;
  padding-top: 0.6rem !important;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

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

.stop {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.stop:last-child {
  border-bottom: none;
}

.stop__address {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.stop__contact,
.stop__window {
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.stop__status {
  font-weight: 600;
  margin-top: 0.35rem;
}

.stop__status--good { color: var(--good); }
.stop__status--bad { color: var(--bad); }

.stop__items {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
}

.kv-list {
  margin: 0;
}

.kv-list__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.kv-list__row:last-child {
  border-bottom: none;
}

.kv-list__row dt {
  color: var(--text-muted);
  flex-shrink: 0;
}

.kv-list__row dd {
  margin: 0;
  text-align: right;
}

.kv-list__mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  word-break: break-all;
}

.kv-list__mono a {
  color: var(--accent);
}

.admin-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.5rem;
  padding: 0.15rem 0.55rem;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.admin-link-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.admin-link-btn svg {
  flex-shrink: 0;
}

/* Requests — metrics strip */

[x-cloak] { display: none !important; }

.metrics-toolbar {
  margin-bottom: 1.25rem;
}

.metrics-toolbar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.metrics-toolbar__header .card-heading {
  margin: 0;
}

.metrics-toolbar__note {
  margin: -0.5rem 0 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.metrics-toolbar__controls {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.live-poll-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
}

.live-poll-toggle input {
  accent-color: var(--accent);
}

.metrics-window {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.metrics-window select,
.filter-panel select,
.filter-panel input {
  height: 2.35rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.35rem;
}

.metrics-window select,
.filter-panel select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23808080' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  padding-right: 1.75rem;
}

.metrics-window select:focus,
.filter-panel select:focus,
.filter-panel input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.metrics-strip {
  margin-bottom: 0;
}

/* Dashboard */

.dashboard-live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.1rem;
  margin-bottom: 2rem;
}

.dashboard-live-grid .metrics-toolbar {
  margin-bottom: 0;
}

.dashboard-recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.1rem;
}

.card-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-heading-row .card-heading {
  margin: 0;
}

.card-heading-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
}

.card-heading-link:hover {
  text-decoration: underline;
}

/* Requests — filter panel */

.requests-toolbar__row {
  display: flex;
}

.requests-search {
  flex: 1;
  display: flex;
  gap: 0.75rem;
}

.filter-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 50%, transparent);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.filter-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-toggle svg {
  transition: transform 0.15s ease;
}

.filter-toggle--open svg {
  transform: rotate(180deg);
}

.filter-panel {
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}

.filter-panel__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.9rem;
}

.field--inline {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
}

.field--inline span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.filter-panel__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.1rem;
}

.filter-panel__actions .btn {
  width: auto;
  padding: 0.6rem 1.25rem;
}

.filter-panel__actions .btn--secondary {
  width: auto;
  margin-top: 0;
  padding: 0.6rem 1.25rem;
}

/* Requests — pagination */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.1rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
}

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

.pagination__btn {
  padding: 0.5rem 1rem;
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 50%, transparent);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.pagination__btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

.error-page__logo {
  height: 28px;
  width: auto;
  max-width: 160px;
  margin-bottom: 32px;
}

.error-page h1 {
  font-size: 1.25rem;
  margin: 0 0 8px;
}

.error-page p {
  color: var(--text-muted);
  margin: 0 0 24px;
  max-width: 360px;
}

.error-page__retry {
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}
