:root {
  color-scheme: light;
  --ink: #14211f;
  --muted: #61746f;
  --faint: #eef7f4;
  --line: #d7e8e2;
  --surface: rgba(255, 255, 255, 0.92);
  --white: #ffffff;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --teal-soft: #d9f4ef;
  --violet: #6d5bd0;
  --violet-soft: #ede9fe;
  --amber: #b45309;
  --amber-soft: #fff7ed;
  --red: #b91c1c;
  --red-soft: #fff1f2;
  --shadow: 0 24px 70px rgba(21, 63, 56, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(140deg, rgba(15, 118, 110, 0.12), rgba(109, 91, 208, 0.1) 46%, rgba(244, 250, 248, 0.95)),
    #f6fbf9;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: rgba(255, 255, 255, 0.78);
  border-right: 1px solid rgba(215, 232, 226, 0.9);
  backdrop-filter: blur(22px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

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

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--teal), var(--violet));
  color: #fff;
  font-weight: 950;
  box-shadow: 0 14px 34px rgba(15, 118, 110, 0.24);
}

.brand strong,
.brand span,
.session-card span,
.policy-grid span,
.install-steps span {
  display: block;
}

.brand span,
.session-card span,
.helper-text,
.eyebrow,
.muted,
.policy-grid span,
.install-steps span {
  color: var(--muted);
}

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

.nav-button,
.install-button {
  width: 100%;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 0 14px;
  font-weight: 800;
}

.nav-button:hover,
.nav-button.active,
.install-button {
  background: var(--faint);
  border-color: var(--line);
}

.session-card,
.panel,
.notice-card,
.comfort-card,
.result-card,
.token-card,
.staff-token,
.queue-row,
.policy-grid article,
.install-steps article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.session-card {
  margin-top: auto;
  padding: 16px;
}

.workspace {
  padding: 28px;
}

.hero {
  min-height: 240px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 20px;
  padding: 30px;
  margin-bottom: 20px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.7)),
    radial-gradient(circle at 18% 12%, rgba(15, 118, 110, 0.18), transparent 34%),
    radial-gradient(circle at 76% 18%, rgba(109, 91, 208, 0.14), transparent 30%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero h1 {
  max-width: 880px;
  margin: 0 0 14px;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  line-height: 0.98;
}

.hero p {
  max-width: 740px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.06rem;
}

.hero-status {
  min-width: 260px;
  display: grid;
  gap: 10px;
  justify-items: end;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h2,
p {
  margin-top: 0;
}

h2 {
  margin-bottom: 18px;
  font-size: 1.65rem;
  line-height: 1.1;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.login-grid,
.request-grid,
.desk-grid,
.doctor-layout,
.admin-layout,
.install-grid {
  display: grid;
  gap: 20px;
}

.login-grid,
.doctor-layout,
.admin-layout,
.install-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.request-grid,
.desk-grid {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.panel,
.notice-card,
.comfort-card,
.result-card {
  padding: 24px;
}

.result-card {
  margin-top: 16px;
  background: var(--teal-soft);
  border-color: rgba(15, 118, 110, 0.3);
  box-shadow: none;
}

.result-card strong {
  display: block;
  font-size: 1.35rem;
}

.notice-card {
  margin-bottom: 20px;
  border-color: rgba(180, 83, 9, 0.28);
  background: var(--amber-soft);
}

.patient-panel {
  background: linear-gradient(145deg, rgba(237, 233, 254, 0.92), rgba(255, 255, 255, 0.92));
}

.form-grid,
.control-panel,
.token-stage {
  display: grid;
  gap: 14px;
}

label,
fieldset {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

input,
select {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
}

input:focus,
select:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--teal);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented span {
  min-height: 50px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.segmented input:checked + span {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.primary-action,
.secondary-action,
.danger-action {
  min-height: 50px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 900;
}

.primary-action {
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: #fff;
}

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

.danger-action {
  background: var(--red-soft);
  color: var(--red);
  border-color: rgba(185, 28, 28, 0.2);
}

.text-button {
  margin-top: 10px;
  border: 0;
  background: transparent;
  color: var(--teal-dark);
  font-weight: 900;
  padding: 0;
}

.status-pill,
.lane-badge,
.token-badge {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 12px;
  font-weight: 900;
}

.status-pill.ready {
  color: var(--teal-dark);
  background: var(--teal-soft);
  border-color: rgba(15, 118, 110, 0.24);
}

.status-pill.warning {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: rgba(180, 83, 9, 0.24);
}

.lane-badge.patient {
  color: var(--teal-dark);
  background: var(--teal-soft);
  border-color: rgba(15, 118, 110, 0.24);
}

.lane-badge.medical_rep {
  color: var(--violet);
  background: var(--violet-soft);
  border-color: rgba(109, 91, 208, 0.24);
}

.token-card {
  padding: 28px;
}

.token-hero {
  display: grid;
  gap: 14px;
  justify-items: start;
}

.token-number {
  font-size: clamp(4.4rem, 15vw, 9rem);
  line-height: 0.9;
  font-weight: 950;
  color: var(--teal-dark);
}

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

.metric {
  min-height: 78px;
  padding: 14px;
  border-radius: 8px;
  background: var(--faint);
}

.metric span {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.metric strong {
  font-size: 1.2rem;
}

.section-head,
.action-row,
.staff-token,
.queue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-head {
  margin-bottom: 16px;
}

.staff-list,
.doctor-queue,
.audit-log {
  display: grid;
  gap: 12px;
}

.staff-token,
.queue-row {
  padding: 16px;
  background: #fff;
  box-shadow: none;
}

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

.next-token-card {
  min-height: 210px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--faint);
  padding: 22px;
  text-align: center;
}

.next-token-card strong {
  display: block;
  font-size: 4rem;
  line-height: 1;
}

.policy-grid article,
.install-steps article {
  padding: 18px;
}

.install-steps {
  display: grid;
  gap: 12px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100vw - 48px));
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  font-weight: 800;
  z-index: 20;
}

.toggle-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.toggle-row input {
  width: 22px;
  min-height: 22px;
}

@media (max-width: 1000px) {
  .app-shell,
  .hero,
  .login-grid,
  .request-grid,
  .desk-grid,
  .doctor-layout,
  .admin-layout,
  .install-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

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

  .nav-button,
  .install-button {
    text-align: center;
  }

  .session-card {
    margin-top: 0;
  }

  .workspace {
    padding: 16px;
  }

  .hero-status {
    justify-items: start;
  }
}

@media (max-width: 640px) {
  .nav-list,
  .segmented,
  .metric-grid,
  .policy-grid {
    grid-template-columns: 1fr;
  }

  .section-head,
  .staff-token,
  .queue-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero {
    padding: 22px;
  }

  .hero h1 {
    font-size: 2.3rem;
  }
}
