:root {
  --bg: #f3f5f1;
  --surface: #ffffff;
  --surface-muted: #f7f9f5;
  --ink: #17221d;
  --muted: #66746c;
  --line: #d8dfd7;
  --accent: #176b4d;
  --accent-soft: #e7f4ee;
  --warning: #bc6c25;
  --warning-soft: #fff1df;
  --danger: #b33a3a;
  --danger-soft: #fff0ef;
  --info: #22577a;
  --info-soft: #e8f2f7;
  --shadow: 0 18px 48px rgba(23, 34, 29, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Aptos, "Segoe UI", "Noto Sans Devanagari", Arial, sans-serif;
  line-height: 1.4;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

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

.hidden {
  display: none !important;
}

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

.auth-panel {
  width: min(100%, 480px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 22px;
}

.auth-panel__top,
.ops-topbar,
.section-heading,
.card-top,
.detail-panel__header,
.modal-header,
.route-row,
.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.auth-panel h1,
.identity-block h1,
.section-heading h2,
.modal-header h2,
.detail-panel__header h2 {
  margin: 0;
}

.auth-panel h1,
.identity-block h1 {
  font-size: clamp(26px, 7vw, 38px);
  line-height: 1.05;
}

.section-heading h2 {
  font-size: clamp(20px, 5vw, 28px);
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.muted-copy,
.small-meta,
.runtime-note,
.sync-copy,
.card-copy,
.meta-text,
.detail-copy,
.form-help {
  color: var(--muted);
}

.muted-copy {
  margin: 12px 0 0;
}

.auth-form,
.modal-form,
.content-stack,
.assignment-list,
.panel-list,
.detail-stack {
  display: grid;
  gap: 12px;
}

.auth-form {
  margin-top: 22px;
}

.field-label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.text-input,
.text-area,
.select-input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  outline: none;
  padding: 12px 13px;
}

.text-area {
  min-height: 96px;
  resize: vertical;
}

.text-input:focus,
.text-area:focus,
.select-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 77, 0.14);
}

.form-error {
  border: 1px solid rgba(179, 58, 58, 0.22);
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  padding: 10px 12px;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.utility-btn,
.link-btn {
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  font-weight: 800;
}

.primary-btn {
  background: var(--accent);
  color: #ffffff;
}

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

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

.utility-btn {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

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

.full-width {
  width: 100%;
}

.runtime-note {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.delivery-shell {
  min-height: 100vh;
  padding: 14px 14px calc(94px + env(safe-area-inset-bottom, 0px));
}

.ops-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border: 1px solid rgba(216, 223, 215, 0.88);
  border-radius: var(--radius);
  background: rgba(247, 249, 245, 0.96);
  box-shadow: 0 12px 28px rgba(23, 34, 29, 0.08);
  padding: 14px;
}

.identity-block {
  min-width: 0;
}

.identity-block p:last-child {
  margin: 7px 0 0;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.status-toggle {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-weight: 800;
}

.status-toggle.offline .status-dot {
  background: var(--muted);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #1f9d62;
  box-shadow: 0 0 0 4px rgba(31, 157, 98, 0.14);
}

.content-stack {
  margin-top: 14px;
}

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

.metric-card,
.primary-task,
.queue-card,
.info-panel,
.detail-card,
.notice-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.metric-card {
  min-height: 82px;
  padding: 12px;
}

.metric-card span,
.field-value span,
.detail-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  line-height: 1;
}

.metric-card.warning {
  border-color: rgba(188, 108, 37, 0.34);
  background: var(--warning-soft);
}

.metric-card.danger {
  border-color: rgba(179, 58, 58, 0.34);
  background: var(--danger-soft);
}

.metric-card.info {
  border-color: rgba(34, 87, 122, 0.24);
  background: var(--info-soft);
}

.priority-section,
.queue-section,
.info-panel {
  display: grid;
  gap: 12px;
}

.priority-section,
.queue-section {
  padding: 0;
}

.section-heading {
  align-items: flex-end;
}

.section-heading.compact {
  align-items: flex-start;
}

.small-meta {
  font-size: 12px;
  text-align: right;
}

.primary-task {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-left: 5px solid var(--accent);
}

.primary-task.urgent {
  border-left-color: var(--danger);
}

.primary-task.cod {
  border-left-color: var(--warning);
}

.primary-task h3,
.queue-card h3,
.notice-card h3,
.detail-card h3 {
  margin: 0;
}

.task-main {
  display: grid;
  gap: 8px;
}

.task-main h3 {
  font-size: clamp(22px, 6vw, 34px);
  line-height: 1.08;
}

.route-grid {
  display: grid;
  gap: 10px;
}

.route-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 12px;
}

.route-row strong,
.field-value strong {
  display: block;
  margin-top: 2px;
}

.action-row,
.contact-row,
.filter-tabs,
.quick-rail-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-row > *,
.contact-row > * {
  flex: 1 1 150px;
}

.quick-rail-grid > * {
  flex: 1 1 120px;
}

.button-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-block;
  border: 2px solid currentColor;
  position: relative;
}

.button-icon::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: currentColor;
}

.filter-tabs {
  overflow-x: auto;
  padding-bottom: 2px;
}

.filter-tab {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--muted);
  flex: 0 0 auto;
  font-weight: 800;
  padding: 9px 12px;
}

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

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

.queue-card.issue {
  border-color: rgba(179, 58, 58, 0.28);
}

.queue-card.cod {
  border-color: rgba(188, 108, 37, 0.3);
}

.card-top {
  align-items: flex-start;
}

.card-meta-grid,
.detail-grid,
.secondary-grid {
  display: grid;
  gap: 10px;
}

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

.field-value {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 10px;
  min-width: 0;
}

.field-value strong {
  overflow-wrap: anywhere;
}

.status-pill {
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 10px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.info {
  background: var(--info-soft);
  color: var(--info);
}

.status-pill.success {
  background: var(--accent-soft);
  color: var(--accent);
}

.status-pill.warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-pill.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.info-panel {
  padding: 14px;
}

.panel-list {
  margin-top: 2px;
}

.notice-card {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.notice-card.warning {
  border-color: rgba(188, 108, 37, 0.28);
  background: var(--warning-soft);
}

.notice-card.danger {
  border-color: rgba(179, 58, 58, 0.28);
  background: var(--danger-soft);
}

.notice-card.info {
  border-color: rgba(34, 87, 122, 0.2);
  background: var(--info-soft);
}

.notice-card p {
  margin: 0;
  color: var(--muted);
}

.detail-backdrop,
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 48;
  background: rgba(23, 34, 29, 0.34);
}

.detail-panel,
.action-modal {
  position: fixed;
  z-index: 50;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.detail-panel {
  top: 0;
  right: 0;
  width: min(560px, 100vw);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.detail-panel__header {
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.detail-panel__body {
  overflow-y: auto;
  padding: 14px;
}

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

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

.timeline-list {
  display: grid;
  gap: 8px;
}

.timeline-item {
  border-left: 3px solid var(--line);
  padding: 8px 0 8px 12px;
}

.timeline-item strong {
  display: block;
}

.timeline-item small {
  color: var(--muted);
}

.action-modal {
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 28px));
  border-radius: var(--radius);
  padding: 16px;
}

.modal-header {
  margin-bottom: 12px;
}

.image-placeholder {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--muted);
  padding: 12px;
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 70;
  transform: translateX(-50%) translateY(26px);
  max-width: min(520px, calc(100vw - 28px));
  border-radius: 999px;
  background: #17221d;
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  padding: 12px 16px;
  text-align: center;
  transition: opacity 140ms ease, transform 140ms ease;
}

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

.mobile-nav {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 36;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  border: 1px solid rgba(23, 34, 29, 0.18);
  border-radius: var(--radius);
  background: rgba(23, 34, 29, 0.96);
  padding: 7px;
}

.mobile-nav__link {
  min-height: 46px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 800;
  padding: 6px 4px;
}

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

@media (min-width: 720px) {
  .delivery-shell {
    padding: 20px 20px 110px;
  }

  .metric-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

@media (min-width: 1040px) {
  .delivery-shell {
    max-width: 1280px;
    margin: 0 auto;
    padding-bottom: 32px;
  }

  .content-stack {
    grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
    align-items: start;
  }

  .metric-strip,
  .priority-section,
  .action-rail,
  .queue-section {
    grid-column: 1 / -1;
  }

  .secondary-grid {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

  .mobile-nav {
    display: none;
  }
}

@media (max-width: 680px) {
  .ops-topbar,
  .auth-panel__top,
  .section-heading,
  .card-top {
    display: grid;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .topbar-actions > * {
    flex: 1 1 auto;
  }

  .card-meta-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .route-row {
    display: grid;
  }

  .action-row > *,
  .contact-row > * {
    flex-basis: 100%;
  }
}
