:root {
  --bg: #11172d;
  --surface: rgba(29, 36, 67, 0.88);
  --surface-strong: rgba(37, 46, 82, 0.96);
  --surface-deep: rgba(74, 88, 148, 0.22);
  --sidebar: #171d38;
  --text: #eef2ff;
  --muted: #aab3d0;
  --line: rgba(120, 136, 214, 0.24);
  --accent: #6e79ff;
  --accent-soft: rgba(110, 121, 255, 0.16);
  --success: #76d7a8;
  --warning: #f1c27d;
  --danger: #ff8b9e;
  --shadow: 0 24px 60px rgba(5, 10, 30, 0.34);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.is-hidden {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(112, 127, 255, 0.16), transparent 24%),
    radial-gradient(circle at bottom right, rgba(154, 112, 255, 0.12), transparent 26%),
    linear-gradient(180deg, #141a33, #11172d 58%, #151a35),
    var(--bg);
}

body.app-mode {
  background:
    radial-gradient(circle at top right, rgba(111, 136, 255, 0.18), transparent 20%),
    radial-gradient(circle at bottom left, rgba(166, 107, 255, 0.14), transparent 24%),
    linear-gradient(180deg, #0f142b, #141a33 45%, #11172d);
}

body.modal-open {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

.login-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 40px;
}

.login-scene {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 36px;
  align-items: stretch;
}

.login-story,
.login-card,
.hero,
.panel,
.metric-card,
.topbar,
.tabbar {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.login-story,
.login-card {
  border-radius: 32px;
  padding: 40px;
}

.login-story {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(circle at top left, rgba(117, 131, 255, 0.18), transparent 24%),
    linear-gradient(135deg, rgba(26, 33, 63, 0.98), rgba(18, 22, 43, 0.9)),
    var(--sidebar);
  color: #f6f2eb;
}

.login-story .hero-copy,
.login-story .section-label,
.login-story p {
  color: rgba(246, 242, 235, 0.88);
}

.login-story .eyebrow {
  color: rgba(246, 242, 235, 0.68);
}

.login-card h2,
.login-story h1,
.sidebar h1,
.topbar h2,
.panel h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.login-story h1 {
  font-size: clamp(2.6rem, 4vw, 4.4rem);
  line-height: 0.98;
  max-width: 9ch;
  margin-bottom: 12px;
}

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

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

.sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  padding: 28px 24px;
  color: #f6f2eb;
  background:
    radial-gradient(circle at top center, rgba(111, 125, 255, 0.12), transparent 22%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent),
    var(--sidebar);
}

.sidebar-top {
  display: grid;
  gap: 28px;
}

.sidebar-nav {
  display: grid;
  gap: 12px;
}

.eyebrow,
.section-label,
.pill {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
}

.eyebrow,
.section-label {
  margin: 0 0 10px;
  color: var(--muted);
}

.sidebar .eyebrow,
.sidebar .section-label {
  color: rgba(246, 242, 235, 0.7);
}

.sidebar-copy,
.hero-copy {
  margin: 14px 0 0;
  line-height: 1.6;
  color: var(--muted);
}

.sidebar-copy {
  color: rgba(215, 223, 255, 0.82);
}

.sidebar-section {
  padding-top: 18px;
  border-top: 1px solid rgba(246, 242, 235, 0.12);
}

.menu-button,
.tab-button {
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.menu-button {
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: #d7deff;
  background: rgba(71, 81, 133, 0.34);
  text-align: left;
  width: 100%;
  display: block;
  text-decoration: none;
}

.menu-button.active,
.menu-button:hover {
  transform: translateY(-1px);
  background: linear-gradient(90deg, #5378ea, #8e63f7);
  border-color: rgba(142, 99, 247, 0.9);
  color: #f7f8ff;
}

.compliance-note ul {
  margin: 0;
  padding-left: 18px;
  line-height: 1.6;
  color: rgba(246, 242, 235, 0.84);
}

.workspace-shell {
  padding: 28px;
  display: grid;
  gap: 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 22px 24px;
  border-radius: 24px;
  background:
    radial-gradient(circle at left center, rgba(102, 120, 255, 0.08), transparent 24%),
    var(--surface);
}

.topbar-actions,
.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.top-menu {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 24px 24px;
  border-radius: 24px;
}

.hero-tight {
  padding-top: 20px;
  padding-bottom: 20px;
}

.hero-copy {
  max-width: 760px;
  margin-top: 0;
}

.tabbar {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 18px;
  overflow-x: auto;
}

.tab-button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 16px;
  background: transparent;
  color: #c2ccf6;
}

.tab-button.active,
.tab-button:hover {
  background: linear-gradient(90deg, rgba(83, 120, 234, 0.28), rgba(142, 99, 247, 0.2));
  border-color: rgba(130, 144, 226, 0.38);
  color: #f1f3ff;
}

.button {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.button.primary {
  background: linear-gradient(90deg, #5378ea, #8e63f7);
  color: #f7f8ff;
  box-shadow: 0 10px 28px rgba(93, 110, 255, 0.28);
}

.button.secondary {
  background: var(--accent-soft);
  color: #dbe3ff;
  border: 1px solid rgba(128, 142, 228, 0.26);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin: 0;
}

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

.metric-card {
  padding: 20px;
  border-radius: 20px;
}

.metric-card-action {
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.metric-card-action:hover,
.metric-card-action:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(130, 144, 226, 0.5);
  background:
    radial-gradient(circle at top right, rgba(110, 121, 255, 0.14), transparent 32%),
    var(--surface);
  outline: none;
}

.overview-modal-shell {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 28px;
}

.overview-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 10, 26, 0.68);
  backdrop-filter: blur(8px);
}

.overview-modal {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  max-height: calc(100vh - 56px);
  display: grid;
  gap: 16px;
  overflow: auto;
}

.overview-detail-compliance {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(23, 29, 56, 0.82);
}

.overview-detail-compliance p {
  margin: 0;
}

.metric-label,
.metric-detail,
.table-meta,
.audit-meta,
.field span,
.clinic-subtitle,
.small-copy,
.policy-version,
.error-copy {
  color: var(--muted);
}

.metric-label,
.metric-detail,
.field span,
.small-copy {
  margin: 0;
}

.metric-value {
  margin: 4px 0;
  font-size: 1.8rem;
}

.metric-value-small {
  font-size: 1.1rem;
}

.chart-panel,
.heatmap-panel {
  display: grid;
  gap: 22px;
}

.chart-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.92rem;
}

.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  margin-right: 8px;
}

.legend-answered {
  background: #6e79ff;
}

.legend-missed {
  background: #ff8b9e;
}

.legend-accepted {
  background: #76d7a8;
}

.bar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
  gap: 12px;
  align-items: end;
  min-height: 190px;
}

.bar-group {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.bar-stack {
  width: 100%;
  display: flex;
  gap: 6px;
  align-items: end;
  justify-content: center;
  min-height: 150px;
}

.bar {
  width: 11px;
  border-radius: 999px 999px 4px 4px;
}

.bar.answered {
  background: linear-gradient(180deg, #8d97ff, #5e69f6);
}

.bar.missed {
  background: linear-gradient(180deg, #ffb0bd, #ff728c);
}

.bar.accepted {
  background: linear-gradient(180deg, #a6f0c6, #59c88f);
}

.chart-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.trend-row {
  display: grid;
  gap: 10px;
}

.trend-copy {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.trend-bar {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.trend-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #5378ea, #8e63f7);
}

.heatmap-grid {
  display: grid;
  grid-template-columns: 72px repeat(6, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}

.heatmap-header {
  margin-bottom: 6px;
}

.heatmap-slot-label,
.heatmap-day-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.heatmap-cell {
  min-height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #f7f8ff;
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.9rem;
}

.tab-panel,
.content-grid {
  display: grid;
  gap: 24px;
}

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

.panel {
  padding: 24px;
  border-radius: 20px;
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

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

.pill {
  padding: 8px 10px;
  border-radius: 999px;
  color: #d5dcff;
  background: rgba(111, 125, 255, 0.16);
}

.pill.warning {
  color: #ffd4dd;
  background: rgba(255, 139, 158, 0.12);
}

.transfer-table,
.info-list {
  display: grid;
  gap: 16px;
}

.custom-constraint-box {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

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

.lane-card {
  padding: 20px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.lane-card h4,
.lane-card p {
  margin: 0;
}

.lane-card h4 {
  font-size: 1rem;
}

.quote-card {
  margin: 0;
  padding: 20px;
  border-radius: 18px;
  background: rgba(23, 29, 56, 0.82);
  border: 1px solid var(--line);
  line-height: 1.55;
}

.drilldown-card {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 22px;
  padding: 20px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.drilldown-card-main,
.drilldown-card-meta {
  display: grid;
  gap: 8px;
}

.drilldown-card p {
  margin: 0;
}

.transfer-row,
.audit-row,
.enrollment-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-strong);
}

.transfer-row {
  grid-template-columns: 1.3fr 1.2fr 1fr 1fr 1.1fr;
  align-items: center;
}

.transfer-row-6 {
  grid-template-columns: 1.1fr 1.2fr 1fr 1fr 1fr 1.2fr;
}

.status-badge {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.84rem;
}

.status-pending {
  color: #ffe1a8;
  background: rgba(241, 194, 125, 0.12);
}

.status-progress {
  color: #b5d5ff;
  background: rgba(83, 120, 234, 0.18);
}

.status-ready,
.status-complete {
  color: #bdf4d3;
  background: rgba(118, 215, 168, 0.12);
}

.status-review,
.status-blocked {
  color: #ffd0da;
  background: rgba(255, 139, 158, 0.12);
}

.form {
  gap: 22px;
}

.checkbox {
  display: flex;
  gap: 16px;
  align-items: start;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.checkbox input {
  margin-top: 3px;
}

.custom-constraint-box {
  display: grid;
  gap: 14px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

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

.script-toolbox {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(27, 34, 64, 0.78);
  align-items: end;
}

.script-toolbox .button,
.script-toolbox .field,
.script-toolbox p,
.script-toolbox audio,
.recording-controls {
  grid-column: span 2;
}

.script-toolbox .field {
  min-width: 0;
}

.script-toolbox select,
.script-toolbox input[type="file"] {
  min-width: 0;
}

.recording-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.media-list {
  gap: 18px;
}

.media-card {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 20px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(24, 30, 58, 0.92);
}

.media-card h4,
.media-card p {
  margin: 0;
}

.media-card-copy {
  display: grid;
  gap: 12px;
}

.media-card-meta {
  display: grid;
  gap: 16px;
  justify-items: end;
  align-content: start;
}

.media-card audio {
  width: min(280px, 100%);
}

textarea,
input[type="text"],
input[type="password"],
select {
  width: 100%;
  padding: 13px 15px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(20, 26, 54, 0.86);
  color: #eef2ff;
}

.audit-log {
  display: grid;
  gap: 14px;
  max-height: 380px;
  overflow: auto;
}

.security-drawer {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.security-drawer summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  cursor: pointer;
  list-style: none;
}

.security-drawer summary::-webkit-details-marker {
  display: none;
}

.security-panel {
  margin: 0 14px 14px;
}

.security-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.audit-row {
  grid-template-columns: 160px 1fr;
}

.user-card p,
.enrollment-card h4,
.audit-row p,
.transfer-row p,
.info-list p {
  margin: 0;
}

.error-copy {
  min-height: 1.2em;
  color: #ffb3c2;
}

@media (max-width: 1100px) {
  .login-scene,
  .app-shell,
  .content-grid {
    grid-template-columns: 1fr;
  }

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

  .span-2 {
    grid-column: span 1;
  }

  .transfer-row,
  .audit-row,
  .topbar,
  .script-toolbox,
  .media-card,
  .drilldown-card {
    grid-template-columns: 1fr;
  }

  .script-toolbox .button,
  .script-toolbox .field,
  .script-toolbox p,
  .script-toolbox audio,
  .recording-controls {
    grid-column: span 1;
  }

  .topbar {
    display: grid;
    align-items: start;
  }

  .media-card {
    display: grid;
  }

  .top-menu {
    justify-content: start;
  }
}

@media (max-width: 700px) {
  .login-screen,
  .workspace-shell,
  .sidebar {
    padding: 22px;
  }

  .overview-modal-shell {
    padding: 22px;
  }

  .login-story,
  .login-card,
  .hero,
  .panel,
  .topbar {
    padding: 22px;
  }

  .story-grid,
  .metrics,
  .mini-grid,
  .compact-grid {
    grid-template-columns: 1fr;
  }

  .heatmap-grid {
    grid-template-columns: 56px repeat(6, minmax(0, 1fr));
  }
}
