:root {
  --ink: #1e272e;
  --muted: #667085;
  --line: #d8dee4;
  --panel: #ffffff;
  --page: #f5f7f9;
  --nav: #23313f;
  --nav-2: #2f4050;
  --teal: #17766b;
  --green: #2f855a;
  --amber: #a15c15;
  --rose: #8a3d55;
  --blue: #2d5b87;
  --purple: #695c9f;
  --soft-teal: #e8f4f2;
  --soft-amber: #fff3df;
  --soft-rose: #f8eaf0;
  --soft-blue: #eaf1f8;
  --shadow: 0 12px 24px rgba(35, 49, 63, 0.10);
}

* {
  box-sizing: border-box;
}

html {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
  scrollbar-color: rgba(64, 82, 75, 0.58) transparent;
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(64, 82, 75, 0.44);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(64, 82, 75, 0.64);
  border: 3px solid transparent;
  background-clip: padding-box;
}

body {
  margin: 0;
  min-width: 320px;
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
.is-disabled {
  cursor: not-allowed;
  opacity: 0.64;
}

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

.sidebar {
  background: var(--nav);
  color: #f9fbfc;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 4px 4px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand strong {
  display: block;
  line-height: 1.2;
}

.brand span,
.role-picker span,
.sidebar-note span {
  display: block;
  color: #c7d0d9;
  font-size: 12px;
  line-height: 1.4;
  margin-top: 3px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f1c66b;
  color: #24313f;
  font-weight: 800;
}

.role-picker {
  display: grid;
  gap: 6px;
}

.role-picker select {
  width: 100%;
  min-height: 38px;
  color: #f9fbfc;
  background: var(--nav-2);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  padding: 0 10px;
}

.main-nav {
  display: grid;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 38px;
  padding: 7px 10px;
  color: #e9eef3;
  text-decoration: none;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 650;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.12);
}

.nav-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #dbe7ef;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-icon svg {
  width: 17px;
  height: 17px;
  overflow: visible;
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.20);
}

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

.workspace {
  min-width: 0;
}

.topbar {
  min-height: 74px;
  padding: 14px 22px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 3;
  backdrop-filter: blur(12px);
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: 24px;
  line-height: 1.18;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions,
.button-row,
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.icon-button,
.ghost-button,
.primary-button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  line-height: 1;
  padding: 0 12px;
  text-decoration: none;
}

.primary-button {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.link-button {
  color: var(--blue);
  background: #f8fbfd;
}

.export-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.button-row > .export-button,
.toolbar > .export-button {
  min-height: 36px;
}

.export-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.content {
  padding: 20px;
}

.content:focus {
  outline: none;
}

.route-shell {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.welcome-shell {
  min-height: calc(100vh - 116px);
  align-items: center;
}

.welcome-panel {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.welcome-header {
  align-items: flex-start;
  margin-bottom: 14px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.95fr);
  gap: 16px;
}

.panel,
.stat-card,
.route-card,
.detail-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
  min-width: 0;
}

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

.panel-header h2,
.panel-header h3,
.route-card h3,
.detail-card h3 {
  margin: 0;
  font-size: 16px;
}

.panel-header p,
.route-card p,
.detail-card p,
.muted {
  color: var(--muted);
}

.panel-header p,
.route-card p,
.detail-card p {
  margin: 4px 0 0;
  line-height: 1.45;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
}

.stat-card {
  padding: 13px;
  display: grid;
  gap: 8px;
  min-height: 112px;
}

.stat-card strong {
  font-size: 28px;
  line-height: 1;
}

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

.stat-card[data-tone="teal"] {
  border-top: 4px solid var(--teal);
}

.stat-card[data-tone="amber"] {
  border-top: 4px solid var(--amber);
}

.stat-card[data-tone="rose"] {
  border-top: 4px solid var(--rose);
}

.stat-card[data-tone="blue"] {
  border-top: 4px solid var(--blue);
}

.queue-list,
.activity-list,
.checklist,
.module-grid,
.route-grid,
.parent-stack {
  display: grid;
  gap: 10px;
}

.queue-item,
.activity-item,
.check-item,
.form-row,
.student-row,
.ledger-row,
.report-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(120px, 0.7fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
}

.activity-item,
.check-item {
  grid-template-columns: minmax(0, 1fr) auto;
}

.check-item {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.item-title {
  display: block;
  font-weight: 700;
}

.item-subtitle {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  margin-top: 3px;
}

.badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  width: fit-content;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge.teal,
.status-pill.ready {
  color: #0f5a51;
  background: var(--soft-teal);
  border-color: #b9dad5;
}

.badge.amber,
.status-pill.pending {
  color: #80510e;
  background: var(--soft-amber);
  border-color: #ead19e;
}

.badge.rose,
.status-pill.blocked {
  color: #7a2e48;
  background: var(--soft-rose);
  border-color: #e7c6d3;
}

.badge.blue {
  color: #245175;
  background: var(--soft-blue);
  border-color: #bfd4e7;
}

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

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

.route-card .button-row {
  justify-content: space-between;
}

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

.panel > .surface-grid + .surface-grid {
  margin-top: 12px;
}

.panel > .surface-grid + .disabled-strip {
  margin-top: 12px;
}

.detail-card {
  padding: 14px;
}

.panel > .detail-card + .detail-card {
  margin-top: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
}

.table-scroll {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: #475467;
  background: #f8fafc;
  font-size: 12px;
}

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

.data-table.export-table {
  table-layout: auto;
}

.data-table .export-cell {
  width: 1%;
  white-space: nowrap;
}

.data-table .text-cell {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
  white-space: normal;
}

.data-table .text-cell .muted,
.data-table .text-cell .item-subtitle {
  overflow-wrap: anywhere;
}

.data-table .status-cell {
  width: 112px;
  white-space: nowrap;
}

.data-table .action-cell {
  width: 88px;
  white-space: nowrap;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: #475467;
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.form-actions {
  margin-top: 14px;
}

.compact-form {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.demo-access-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.demo-access-button {
  display: grid;
  gap: 5px;
  min-height: 82px;
  padding: 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf3;
  color: var(--ink);
}

.demo-access-button strong {
  line-height: 1.25;
}

.demo-access-button:hover,
.demo-access-button.active {
  border-color: var(--teal);
  box-shadow: inset 4px 0 0 var(--teal);
}

.demo-access-button span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.compact-form label {
  display: grid;
  gap: 6px;
  color: #475467;
  font-size: 12px;
  font-weight: 700;
}

.compact-form input,
.compact-form textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.compact-form textarea {
  min-height: 78px;
  resize: vertical;
}

.message-strip {
  border-color: #b9dad5;
  background: var(--soft-teal);
}

.disabled-strip {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 8px;
  border: 1px dashed #c9d4de;
  background: #f8fafc;
}

.pulse-route {
  display: grid;
  gap: 16px;
  max-width: 1440px;
  margin: 0 auto;
  min-width: 0;
}

.pulse-hero {
  display: grid;
  grid-template-columns: minmax(320px, 0.78fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  min-width: 0;
}

.pulse-live-card,
.pulse-timeline-card,
.pulse-panel {
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.pulse-live-card {
  color: #f8fbfd;
  background:
    linear-gradient(135deg, rgba(23, 118, 107, 0.24), transparent 42%),
    #203642;
  padding: 20px;
  display: grid;
  gap: 16px;
  align-content: space-between;
  min-height: 320px;
}

.pulse-live-top,
.pulse-live-actions,
.pulse-command-card > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pulse-live-top > span {
  font-size: 13px;
  font-weight: 800;
  color: #c8d7df;
}

.pulse-live-card h2 {
  margin: 0;
  color: #ffffff;
  font-size: 48px;
  line-height: 1;
}

.pulse-live-card p {
  margin: 0;
  color: #dbe8ee;
  line-height: 1.5;
}

.pulse-insight {
  display: grid;
  gap: 5px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.pulse-insight span {
  color: #e6eff4;
  line-height: 1.45;
}

.pulse-icon-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pulse-icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pulse-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.pulse-metric-card {
  display: grid;
  align-content: space-between;
  gap: 10px;
  min-height: 154px;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.pulse-metric-card span,
.pulse-command-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pulse-metric-card strong {
  font-size: 30px;
  line-height: 1.1;
}

.pulse-metric-card small,
.pulse-command-card p,
.pulse-now-item span {
  color: #55616d;
  line-height: 1.45;
}

.pulse-metric-card.teal,
.pulse-command-card.teal,
.pulse-now-item.teal {
  border-color: #b9dad5;
  background: var(--soft-teal);
}

.pulse-metric-card.blue,
.pulse-command-card.blue,
.pulse-now-item.blue {
  border-color: #c6d8e8;
  background: var(--soft-blue);
}

.pulse-metric-card.purple,
.pulse-command-card.purple,
.pulse-now-item.purple {
  border-color: #d4cdeb;
  background: #f1eef9;
}

.pulse-metric-card.amber,
.pulse-command-card.amber,
.pulse-now-item.amber {
  border-color: #e8cfaa;
  background: var(--soft-amber);
}

.pulse-command-card.rose,
.pulse-now-item.rose {
  border-color: #e7c4d0;
  background: var(--soft-rose);
}

.pulse-timeline-card,
.pulse-panel {
  background: #ffffff;
  padding: 16px;
}

.pulse-range {
  width: 100%;
  accent-color: var(--teal);
  margin: 4px 0 14px;
}

.pulse-track {
  display: flex;
  gap: 6px;
  min-width: 0;
}

.pulse-segment {
  min-height: 62px;
  min-width: 86px;
  padding: 9px;
  text-align: left;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--ink);
  display: grid;
  align-content: space-between;
}

.pulse-segment span {
  font-size: 12px;
  font-weight: 800;
}

.pulse-segment small {
  color: var(--muted);
  font-size: 11px;
}

.pulse-segment.active {
  color: #ffffff;
  background: var(--nav);
  border-color: var(--nav);
}

.pulse-segment.active small {
  color: #dbe7ef;
}

.pulse-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
}

.pulse-now-list,
.pulse-command-grid {
  display: grid;
  gap: 10px;
}

.pulse-now-item {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 5px;
  padding: 13px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fbfcfd;
}

.pulse-now-item:hover,
.pulse-command-card:hover {
  border-color: var(--teal);
}

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

.pulse-command-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.pulse-command-card strong {
  text-align: right;
}

.parent-shell {
  max-width: 1020px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
}

.child-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 12px;
  box-shadow: var(--shadow);
}

.child-card h2 {
  margin: 0;
  font-size: 22px;
}

.priority-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.priority-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  background: #fbfcfd;
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.priority-card strong {
  display: inline;
}

.parent-module {
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
}

.parent-module.active {
  border-color: var(--teal);
  box-shadow: inset 4px 0 0 var(--teal);
}

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

.timeline-item {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-item:last-child {
  border-bottom: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .pulse-hero {
    grid-template-columns: 1fr;
  }

  .pulse-workspace {
    grid-template-columns: 1fr;
  }

  .pulse-live-card {
    min-height: 260px;
  }

  .pulse-live-card h2 {
    font-size: 38px;
  }

  .pulse-track {
    overflow-x: auto;
    padding-bottom: 4px;
  }
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 236px minmax(0, 1fr);
  }

  .dashboard-grid,
  .parent-shell {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(86vw, 300px);
    z-index: 8;
    transform: translateX(-102%);
    transition: transform 160ms ease;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .topbar {
    padding: 12px 14px;
    align-items: flex-start;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .content {
    padding: 12px;
  }

  .stat-grid,
  .module-grid,
  .route-grid,
  .surface-grid,
  .form-grid,
  .demo-access-grid,
  .priority-grid,
  .pulse-metric-grid,
  .pulse-command-grid {
    grid-template-columns: 1fr;
  }

  .queue-item,
  .check-item,
  .student-row,
  .ledger-row,
  .report-row {
    grid-template-columns: 1fr;
  }

  .data-table {
    min-width: 620px;
  }

  .table-scroll {
    overflow-x: auto;
  }

  .parent-shell {
    gap: 12px;
  }
}

@media (min-width: 761px) {
  #navToggle {
    display: none;
  }
}
