:root {
  --ink: #17211c;
  --muted: #66756d;
  --line: #dfe8e1;
  --soft: #f5f7f2;
  --panel: #ffffff;
  --green: #128447;
  --green-dark: #0a6031;
  --yellow: #f1b83b;
  --red: #cc4b3c;
  --blue: #2f6fbd;
  --shadow: 0 18px 50px rgba(19, 39, 29, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #eef3ee;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

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

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  background: #102219;
  color: white;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--yellow);
  color: #102219;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #b7c7bd;
  font-size: 13px;
  margin-top: 3px;
}

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

.nav-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: #d9e6dd;
  cursor: pointer;
  text-align: left;
}

.nav-tab span {
  width: 22px;
  color: var(--yellow);
  font-size: 18px;
}

.nav-tab.active,
.nav-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.sidebar-note {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.whatsapp-link {
  display: flex;
  align-items: center;
  min-height: 42px;
  border-radius: 8px;
  padding: 0 12px;
  background: #128447;
  color: white;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.whatsapp-link:hover {
  background: #0a6031;
}

.legal-links {
  display: flex;
  gap: 12px;
  font-size: 12px;
}

.legal-links a {
  color: #c8d6ce;
  text-decoration: none;
  font-weight: 700;
}

.legal-links a:hover {
  color: white;
}

.sidebar-note strong,
.sidebar-note span {
  display: block;
}

.sidebar-note span {
  margin-top: 8px;
  color: #c8d6ce;
  line-height: 1.5;
}

.main {
  padding: 28px;
  overflow-x: hidden;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 20px;
  line-height: 1.2;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  background: white;
  box-shadow: var(--shadow);
  color: var(--green-dark);
  font-weight: 700;
  white-space: nowrap;
}

.rolebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: white;
  box-shadow: var(--shadow);
}

.tracking-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: white;
  box-shadow: var(--shadow);
}

.tracking-panel strong,
.tracking-panel span {
  display: block;
}

.tracking-panel span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.tracking-actions {
  display: flex;
  gap: 8px;
}

.rolebar strong,
.rolebar span {
  display: block;
}

.rolebar span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.login-form,
.password-form,
.session-panel,
.role-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.login-form,
.password-form {
  flex: 1;
  flex-wrap: wrap;
}

.login-form label,
.password-form label {
  min-width: 190px;
  flex: 1;
}

.login-form .secondary-action,
.password-form .secondary-action {
  align-self: end;
}

.password-form {
  flex-basis: 100%;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.password-form[hidden] {
  display: none;
}

.login-help {
  flex-basis: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.login-help.error {
  color: var(--red);
  font-weight: 800;
}

.login-help.success {
  color: var(--green-dark);
  font-weight: 800;
}

.session-panel {
  justify-content: space-between;
  flex: 1;
}

.app-state {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border-radius: 999px;
  padding: 0 10px;
  background: #edf3ee;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pulse {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(18, 132, 71, 0.15);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-heading {
  margin-bottom: 16px;
}

.panel-heading p {
  color: var(--muted);
  margin-bottom: 0;
  line-height: 1.45;
}

.panel-heading.split {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

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

label {
  display: grid;
  gap: 7px;
  color: #314239;
  font-size: 13px;
  font-weight: 700;
}

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

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--soft);
}

.checkline input {
  width: auto;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfdbd3;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfa;
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(18, 132, 71, 0.12);
}

.quote-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.quote-row div,
.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--soft);
}

.quote-row span,
.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.quote-row strong,
.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.primary-action,
.secondary-action,
.small-action {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.primary-action {
  width: 100%;
  min-height: 48px;
  background: var(--green);
  color: white;
}

.batch-actions {
  display: grid;
  grid-template-columns: 0.7fr 1fr;
  gap: 10px;
}

.batch-panel {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.primary-action:hover {
  background: var(--green-dark);
}

.secondary-action {
  min-height: 40px;
  padding: 0 12px;
  background: #edf3ee;
  color: var(--green-dark);
}

.small-action {
  min-height: 34px;
  padding: 0 10px;
  background: #102219;
  color: white;
}

.small-action.alt {
  background: #e8efe9;
  color: var(--green-dark);
}

.small-action.warn {
  background: var(--red);
}

.order-list,
.rider-list,
.notification-list {
  display: grid;
  gap: 12px;
}

.order-card,
.rider-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.card-head strong {
  display: block;
  line-height: 1.25;
}

.card-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: #eef3ee;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.transit {
  background: #e8f0ff;
  color: var(--blue);
}

.badge.done {
  background: #f4ead0;
  color: #805600;
}

.badge.pay {
  background: #fbe8e5;
  color: var(--red);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.map-preview {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  aspect-ratio: 16 / 9;
}

.map-preview iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.map-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.map-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 8px;
  padding: 0 10px;
  background: #e8efe9;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.map-link.primary {
  background: var(--green);
  color: white;
}

.chat-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 8px;
  padding: 0 11px;
  background: #102219;
  color: white;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.chat-link.primary {
  background: #128447;
}

.legal-page {
  background: #eef3ee;
}

.legal-wrap {
  width: min(860px, calc(100% - 32px));
  margin: 32px auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: white;
  box-shadow: var(--shadow);
}

.legal-wrap h1 {
  margin: 18px 0;
}

.legal-wrap h2 {
  margin-top: 24px;
}

.legal-wrap p {
  color: var(--muted);
  line-height: 1.6;
}

.form-map {
  margin: 16px 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.pilot-panel {
  margin-bottom: 20px;
}

.pilot-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 18px;
}

.pilot-grid h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.checklist {
  display: grid;
  gap: 8px;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--soft);
  color: #314239;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.check-item input {
  width: auto;
  margin-top: 2px;
}

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

.issue-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.issue-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
}

.admin-table {
  display: grid;
  gap: 10px;
}

.admin-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.7fr 0.8fr 1fr;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.admin-row.header {
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.empty-state {
  border: 1px dashed #c9d8cf;
  border-radius: 8px;
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.notification-panel {
  margin-top: 20px;
}

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

  .sidebar {
    position: static;
  }

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

  .grid.two,
  .pilot-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .admin-row {
    grid-template-columns: 1fr;
  }

  .admin-row.header {
    display: none;
  }
}

@media (max-width: 620px) {
  .main,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .rolebar,
  .tracking-panel,
  .panel-heading.split,
  .card-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-grid,
  .login-form,
  .password-form,
  .session-panel,
  .role-controls,
  .quote-row,
  .batch-actions,
  .nav-tabs {
    grid-template-columns: 1fr;
  }

  .login-form,
  .password-form,
  .session-panel,
  .tracking-actions,
  .role-controls {
    align-items: stretch;
    width: 100%;
    flex-direction: column;
  }
}
