:root {
  --bg: #eef2e9;
  --bg-deep: #dfe9dc;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-strong: #ffffff;
  --ink: #182432;
  --muted: #5d6b78;
  --line: rgba(101, 119, 134, 0.18);
  --accent: #1f7a4d;
  --accent-soft: #e8f7ee;
  --warning: #c57d14;
  --warning-soft: #fff5df;
  --danger: #b93f32;
  --danger-soft: #fff0ee;
  --info: #2a5fd0;
  --info-soft: #edf3ff;
  --shadow-lg: 0 30px 70px rgba(22, 35, 49, 0.14);
  --shadow-md: 0 18px 40px rgba(22, 35, 49, 0.1);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    radial-gradient(circle at top left, rgba(31, 122, 77, 0.12), transparent 24rem),
    radial-gradient(circle at bottom right, rgba(42, 95, 208, 0.08), transparent 28rem),
    linear-gradient(180deg, var(--bg) 0%, #f6f8f4 100%);
  color: var(--ink);
  font-family: Aptos, "Segoe UI", "Trebuchet MS", sans-serif;
  line-height: 1.4;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(100%, 520px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 247, 0.98));
  border: 1px solid rgba(31, 122, 77, 0.12);
  border-radius: 32px;
  box-shadow: var(--shadow-lg);
  padding: 32px;
}

.auth-card__eyebrow,
.surface-eyebrow,
.topbar-copy__eyebrow,
.brand-label {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-card h1,
.brand-title,
.topbar-copy h1 {
  margin: 0;
}

.auth-card__copy,
.topbar-copy p,
.sidebar-footnote p,
.hero-surface p,
.section-meta {
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.ops-form {
  display: grid;
  gap: 14px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

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

.auth-label,
.field span {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.auth-input,
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid rgba(101, 119, 134, 0.22);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 16px;
  padding: 14px 16px;
  outline: none;
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.auth-input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(31, 122, 77, 0.45);
  box-shadow: 0 0 0 4px rgba(31, 122, 77, 0.12);
}

.auth-error,
.form-error {
  border-radius: 14px;
  background: var(--danger-soft);
  border: 1px solid rgba(185, 63, 50, 0.18);
  color: var(--danger);
  font-size: 13px;
  padding: 12px 14px;
}

.form-note {
  border-radius: 16px;
  border: 1px solid rgba(42, 95, 208, 0.12);
  background: rgba(42, 95, 208, 0.07);
  color: var(--info);
  font-size: 13px;
  padding: 12px 14px;
}

.form-note strong {
  display: block;
  margin-bottom: 4px;
}

.auth-footer {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.primary-btn {
  background: linear-gradient(135deg, #1f7a4d, #245b94);
  color: #ffffff;
  box-shadow: 0 14px 28px rgba(31, 122, 77, 0.24);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(101, 119, 134, 0.2);
  color: var(--ink);
}

.ghost-btn {
  background: transparent;
  color: var(--muted);
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
}

.auth-submit {
  margin-top: 4px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: linear-gradient(180deg, rgba(17, 37, 31, 0.94), rgba(28, 55, 44, 0.94));
  color: rgba(255, 255, 255, 0.96);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
}

.brand-badge {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08));
  font-weight: 800;
  letter-spacing: 0.04em;
}

.brand-label {
  color: rgba(196, 255, 220, 0.92);
}

.brand-title {
  font-size: 24px;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.nav-link,
.mobile-nav__link {
  border: 0;
  text-align: left;
  padding: 14px 16px;
  border-radius: 16px;
  background: transparent;
  color: inherit;
  font-weight: 700;
}

.nav-link:hover,
.mobile-nav__link:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.sidebar-footnote {
  margin-top: auto;
  padding: 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.07);
}

.sidebar-footnote strong {
  display: block;
  margin-bottom: 6px;
}

.app-main {
  min-width: 0;
  padding: 24px 24px 96px;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  padding: 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: var(--radius-xl);
  background: rgba(248, 250, 247, 0.9);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-md);
}

.topbar-copy h1 {
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.04;
}

.topbar-copy p {
  margin: 8px 0 0;
  max-width: 54ch;
}

.topbar-actions {
  position: relative;
  display: grid;
  gap: 12px;
  min-width: min(100%, 420px);
}

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

.topbar-chip {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(101, 119, 134, 0.14);
}

.topbar-chip span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.topbar-chip strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.topbar-action-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.icon-btn {
  position: relative;
}

.button-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
}

.notification-drawer {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(420px, calc(100vw - 48px));
}

.top-alert-region {
  margin-top: 16px;
}

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

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

.hero-surface,
.surface-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.hero-surface {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 24px;
}

.hero-surface h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.05;
}

.hero-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 12px;
}

.hero-kpi {
  min-width: 0;
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(31, 122, 77, 0.1), rgba(255, 255, 255, 0.9));
  border: 1px solid rgba(31, 122, 77, 0.14);
}

.hero-kpi--warning {
  background: linear-gradient(180deg, rgba(197, 125, 20, 0.12), rgba(255, 255, 255, 0.9));
  border-color: rgba(197, 125, 20, 0.14);
}

.hero-kpi span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.hero-kpi strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
}

.surface-card {
  padding: 20px;
}

.surface-card__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 18px;
}

.surface-card__header h3 {
  margin: 0;
  font-size: 22px;
}

.section-meta {
  font-size: 13px;
  text-align: right;
}

.area-stat-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.dashboard-alert-strip,
.feed-list,
.approval-list,
.stack-list {
  display: grid;
  gap: 12px;
}

.feed-item,
.approval-card,
.list-card,
.queue-card,
.detail-card,
.mini-card {
  border-radius: 20px;
  border: 1px solid rgba(101, 119, 134, 0.14);
  background: rgba(255, 255, 255, 0.98);
  padding: 16px;
}

.feed-item {
  display: grid;
  gap: 10px;
}

.feed-item__top,
.card-row,
.queue-card__top,
.detail-card__row,
.approval-card__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.feed-item strong,
.queue-card strong,
.approval-card strong,
.list-card strong,
.detail-card strong {
  color: var(--ink);
}

.feed-item p,
.queue-card p,
.approval-card p,
.list-card p,
.detail-card p,
.list-card small,
.approval-card small {
  margin: 0;
  color: var(--muted);
}

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

.filter-chip {
  border: 1px solid rgba(101, 119, 134, 0.18);
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
}

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.queue-board {
  display: grid;
  gap: 18px;
}

.queue-section {
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-md);
  padding: 18px;
}

.queue-section--urgent {
  background: linear-gradient(180deg, rgba(255, 245, 223, 0.98), rgba(255, 255, 255, 0.94));
  border-color: rgba(197, 125, 20, 0.16);
}

.queue-section__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.queue-section__header h3 {
  margin: 0;
}

.queue-list {
  display: grid;
  gap: 12px;
}

.queue-card {
  display: grid;
  gap: 12px;
}

.queue-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.queue-card__actions,
.approval-card__actions,
.detail-action-row,
.suggestion-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-btn,
.action-btn-muted,
.action-btn-danger {
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
}

.action-btn {
  background: var(--accent-soft);
  color: var(--accent);
}

.action-btn-muted {
  background: rgba(42, 95, 208, 0.1);
  color: var(--info);
}

.action-btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.approval-card {
  display: grid;
  gap: 10px;
}

.approval-card__meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.approval-card__meta span,
.detail-card__label {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.approval-card__meta strong,
.detail-card__value {
  display: block;
  margin-top: 2px;
}

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

.list-card {
  display: grid;
  gap: 10px;
}

.delivery-agent-form {
  align-content: start;
}

.delivery-agent-card,
.delivery-signal-card {
  border-left: 4px solid var(--accent);
}

.delivery-signal-card--warning {
  border-left-color: var(--warning);
}

.delivery-signal-card--error,
.delivery-signal-card--failed {
  border-left-color: var(--danger);
}

.delivery-signal-card--success {
  border-left-color: var(--accent);
}

.delivery-ops-grid {
  align-items: start;
}

.list-card__row,
.mini-grid {
  display: grid;
  gap: 10px;
}

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

.list-card__footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.detail-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.3);
  z-index: 49;
}

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(520px, 100vw);
  height: 100vh;
  z-index: 50;
  background: linear-gradient(180deg, rgba(250, 251, 248, 0.98), rgba(244, 247, 241, 0.98));
  box-shadow: -24px 0 48px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
}

.detail-panel__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding: 22px 20px 16px;
  border-bottom: 1px solid rgba(101, 119, 134, 0.12);
}

.detail-panel__header h3 {
  margin: 0;
  font-size: 28px;
}

.detail-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: grid;
  gap: 14px;
}

.detail-card {
  display: grid;
  gap: 12px;
}

.detail-card__grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-card__timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(101, 119, 134, 0.12);
}

.timeline-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.compat-note {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(42, 95, 208, 0.08);
  border: 1px solid rgba(42, 95, 208, 0.12);
  color: var(--info);
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(30px);
  opacity: 0;
  pointer-events: none;
  z-index: 60;
  background: rgba(24, 36, 50, 0.94);
  color: #ffffff;
  padding: 12px 16px;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  transition: opacity 140ms ease, transform 140ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.mobile-nav {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 35;
  display: none;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border-radius: 22px;
  background: rgba(24, 36, 50, 0.95);
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.2);
}

.mobile-nav__link {
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
  font-size: 12px;
  padding: 10px 8px;
}

.mobile-nav__link.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    display: none;
  }

  .app-main {
    padding-bottom: 118px;
  }

  .mobile-nav {
    display: grid;
  }

  .topbar-actions {
    min-width: 0;
  }
}

@media (max-width: 960px) {
  .app-topbar,
  .hero-surface,
  .two-column-grid,
  .topbar-chip-grid {
    grid-template-columns: 1fr;
  }

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

  .detail-card__grid,
  .approval-card__meta,
  .mini-grid,
  .form-grid--two {
    grid-template-columns: 1fr;
  }

  .topbar-action-row {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .auth-layout,
  .app-main {
    padding: 14px;
  }

  .auth-card,
  .surface-card,
  .hero-surface,
  .app-topbar {
    border-radius: 24px;
  }

  .surface-card,
  .hero-surface {
    padding: 18px;
  }

  .app-topbar {
    padding: 16px;
  }

  .topbar-copy h1 {
    font-size: 28px;
  }

  .topbar-chip-grid,
  .area-stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  .mobile-nav {
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
}
