:root {
  --blue: #0b2f5b;
  --blue-light: #123f73;
  --bg: #f5f8fc;
  --border: #d8e1ec;
  --text: #162233;
  --muted: #627086;
  --white: #ffffff;
  --soft: #eef4fb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 68px;
  padding: 0 32px;
  color: var(--white);
  background: var(--blue);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--blue);
  background: var(--white);
  border-radius: 8px;
  font-size: 13px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.nav-link {
  color: rgba(255, 255, 255, 0.82);
  background: transparent;
  border-radius: 8px;
  padding: 10px 14px;
}

.nav-link.active,
.nav-link:hover {
  color: var(--white);
  background: var(--blue-light);
}

.hidden {
  display: none !important;
}

.role-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 14px;
}

.role-switch select {
  min-width: 120px;
  padding: 9px 12px;
  color: var(--text);
  background: var(--white);
  border: 0;
  border-radius: 8px;
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 30px auto 48px;
}

.container.narrow {
  width: min(980px, calc(100% - 32px));
}

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

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

.lead {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.1;
}

h2 {
  font-size: 18px;
  margin-bottom: 18px;
}

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

.two-column {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.three-column {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.compact-top {
  margin-top: 20px;
}

.role-view {
  display: none;
}

.role-view.active {
  display: block;
}

.card,
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 14px 32px rgba(16, 40, 75, 0.06);
}

.card {
  padding: 22px;
}

.muted-card {
  background: #fbfdff;
}

.form-card {
  display: grid;
  gap: 15px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  color: var(--text);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 12px;
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(11, 47, 91, 0.12);
}

.split-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.primary-btn,
.secondary-btn,
.slot {
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}

.primary-btn,
.secondary-btn {
  padding: 12px 16px;
  font-weight: 700;
}

.primary-btn {
  color: var(--white);
  background: var(--blue);
}

.secondary-btn {
  color: var(--blue);
  background: #e9f0f8;
}

.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

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

.slot {
  min-height: 54px;
  color: var(--blue);
  background: var(--soft);
  border: 1px solid #cbd9e8;
  font-weight: 700;
}

.slot.selected {
  color: var(--white);
  background: var(--blue);
}

.slot.booked {
  color: #8995a6;
  background: #f0f2f5;
  cursor: not-allowed;
  text-decoration: line-through;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 12px;
  color: var(--blue);
  background: #e9f0f8;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.small {
  min-height: 26px;
  padding: 4px 9px;
  font-size: 12px;
}

.status-pill.muted {
  color: var(--muted);
  background: #f0f2f5;
}

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

.section-head h2 {
  margin: 0;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  padding: 13px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

tr.selected-row {
  background: #f0f6fc;
}

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

.stats-grid.wide {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card {
  padding: 20px;
}

.stat-card span,
.stat-card small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stat-card span {
  margin-bottom: 8px;
}

.stat-card small {
  margin-top: 8px;
}

.stat-card strong {
  font-size: 25px;
}

.timeline,
.alert-list,
.metric-list,
.statement {
  display: grid;
  gap: 13px;
}

.timeline div,
.alert-list div,
.metric-list div,
.statement div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 15px;
}

.timeline div {
  justify-content: flex-start;
}

.timeline strong {
  display: inline-grid;
  place-items: center;
  flex: 0 0 28px;
  height: 28px;
  color: var(--white);
  background: var(--blue);
  border-radius: 999px;
  font-size: 13px;
}

.alert-list div {
  display: grid;
  justify-content: stretch;
  gap: 4px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--border);
}

.alert-list div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.alert-list strong,
.metric-list strong,
.statement strong {
  color: var(--text);
}

.statement .total {
  padding-top: 14px;
  color: var(--blue);
  border-top: 1px solid var(--border);
  font-weight: 800;
}

.simple-bars {
  display: grid;
  gap: 18px;
}

.simple-bars div {
  display: grid;
  grid-template-columns: 120px 1fr 44px;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.simple-bars b {
  display: block;
  height: 10px;
  background: var(--blue);
  border-radius: 99px;
}

.simple-bars strong {
  color: var(--text);
}

.prescription-editor {
  display: grid;
  gap: 10px;
}

.prescription-line {
  display: grid;
  grid-template-columns: 1.2fr 0.5fr 0.7fr;
  gap: 10px;
}

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

.dispatch-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfdff;
}

.dispatch-card h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.dispatch-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.item-list {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.item-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.bill-total {
  display: flex;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-weight: 800;
}

@media (max-width: 920px) {
  .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
  }

  .nav {
    overflow-x: auto;
    flex: none;
  }

  .role-switch {
    justify-content: space-between;
  }

  .two-column,
  .three-column,
  .stats-grid,
  .stats-grid.wide,
  .statement-grid {
    grid-template-columns: 1fr;
  }

  .page-head,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .split-fields,
  .slot-list,
  .prescription-line {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar {
    gap: 12px;
    padding: 14px;
  }

  .brand {
    font-size: 15px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    overflow: visible;
  }

  .nav-link {
    padding: 10px;
    text-align: center;
    background: rgba(255, 255, 255, 0.08);
    font-size: 13px;
  }

  .role-switch {
    display: grid;
    grid-template-columns: auto 1fr;
  }

  .role-switch select {
    width: 100%;
  }

  .container,
  .container.narrow {
    width: min(100% - 24px, 1180px);
    margin: 20px auto 36px;
  }

  .page-head {
    gap: 12px;
    margin-bottom: 16px;
  }

  h1 {
    font-size: 26px;
  }

  h2 {
    font-size: 17px;
    margin-bottom: 14px;
  }

  .lead {
    font-size: 14px;
  }

  .card,
  .stat-card {
    border-radius: 12px;
  }

  .card {
    padding: 16px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-card strong {
    font-size: 22px;
  }

  .grid,
  .stack,
  .stats-grid,
  .statement-grid {
    gap: 14px;
  }

  .primary-btn,
  .secondary-btn {
    width: 100%;
  }

  .status-pill {
    white-space: normal;
  }

  .table-wrap {
    margin: 0 -4px;
    padding-bottom: 4px;
  }

  table {
    min-width: 720px;
  }

  th,
  td {
    padding: 11px 10px;
    font-size: 13px;
  }

  .simple-bars div {
    grid-template-columns: 1fr 42px;
    gap: 8px;
  }

  .simple-bars span {
    grid-column: 1 / -1;
  }

  .statement div,
  .metric-list div,
  .item-list li,
  .bill-total {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .timeline div {
    align-items: flex-start;
  }
}
