:root {
  --gaba-blue: #015989;
  --gaba-cyan: #009dc3;
  --gaba-sky: #78cfe9;
  --gaba-slate: #7b90a1;
  --gaba-yellow: #fad000;
  --ink: #07364d;
  --muted: #657d8e;
  --paper: #f7fafb;
  --panel: #ffffff;
  --line: #d7e2e8;
  --teal: var(--gaba-blue);
  --teal-soft: #e7f6fb;
  --coral: #d75d53;
  --violet: #006b8e;
  --gold: var(--gaba-yellow);
  --mist: #edf5f8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 78% 0%, rgba(120, 207, 233, 0.2), transparent 30rem),
    var(--paper);
  font-family: "Gilroy", "Aptos", "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

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

.header-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: hidden;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  color: white;
  background:
    linear-gradient(155deg, rgba(1, 89, 137, 0.98), rgba(0, 157, 195, 0.88) 62%, rgba(1, 89, 137, 0.98)),
    var(--gaba-blue);
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
}

.sidebar::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
}

.brand-lockup img {
  display: block;
  width: 190px;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 42px rgba(0, 39, 67, 0.18);
}

.brand-lockup p {
  margin: 14px 0 28px;
  font-size: 1.35rem;
  line-height: 1.1;
  font-weight: 800;
}

.sidebar nav {
  display: grid;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 4px 32px 0;
  scrollbar-gutter: stable;
}

.sidebar nav::-webkit-scrollbar {
  width: 8px;
}

.sidebar nav::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.sidebar nav::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
}

nav a {
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  padding: 12px 10px;
  border: 1px solid transparent;
  font-weight: 750;
}

nav a.active,
nav a:hover {
  color: white;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
}

.secure-note {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
}

.secure-note p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.88rem;
  line-height: 1.35;
}

.work-area {
  min-width: 0;
  padding: 28px;
}

.admin-topbar,
.top-actions,
.case-head,
.detail-head,
.detail-actions,
.row-between {
  display: flex;
  align-items: center;
}

.admin-topbar {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gaba-cyan);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.9rem, 3vw, 2.55rem);
  line-height: 1.02;
}

.top-actions {
  gap: 10px;
}

.session-user {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

button {
  min-height: 42px;
  border: 0;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 850;
  border-radius: 8px;
}

button.danger {
  color: #9b2c2c;
  border: 1px solid #efb5b5;
  background: #fff5f5;
}

.case-view {
  color: var(--gaba-blue);
  font-weight: 850;
}

.admission-alert {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  max-width: 380px;
  padding: 16px 20px;
  border-left: 5px solid var(--gaba-yellow);
  border-radius: 8px;
  color: white;
  background: var(--gaba-blue);
  box-shadow: 0 16px 44px rgba(0, 45, 72, 0.28);
  font-weight: 800;
}

.primary {
  color: white;
  background: linear-gradient(135deg, var(--gaba-blue), var(--gaba-cyan));
  box-shadow: 0 12px 26px rgba(1, 89, 137, 0.18);
}

.secondary {
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
}

.icon-btn {
  width: 42px;
  padding: 0;
  color: var(--gaba-blue);
  background: white;
  border: 1px solid var(--line);
}

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

.metric-row div {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(1, 89, 137, 0.06);
}

.metric-row span {
  display: block;
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--gaba-blue);
}

.metric-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.admission-state-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.admission-state-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 12px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 850;
}

.admission-state-tab span {
  display: inline-flex;
  min-width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  color: var(--gaba-blue);
  background: var(--mist);
  border-radius: 999px;
  font-size: 0.78rem;
}

.admission-state-tab.active {
  color: white;
  background: var(--gaba-blue);
  box-shadow: 0 8px 20px rgba(1, 89, 137, 0.18);
}

.admission-state-tab.active span {
  color: var(--gaba-blue);
  background: white;
}

.retention-notice {
  margin-top: 16px;
  padding: 16px 18px;
  color: #744d00;
  background: #fff8e6;
  border: 1px solid #efd18a;
  border-left: 5px solid #e6a400;
  border-radius: 9px;
}

.retention-notice strong {
  display: block;
  margin-bottom: 5px;
  color: #684300;
}

.retention-notice p {
  margin: 0;
  line-height: 1.5;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 250px 180px;
  gap: 12px;
  margin-bottom: 18px;
  padding: 16px;
  background: var(--mist);
  border: 1px solid var(--line);
  border-radius: 8px;
}

label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 7px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gaba-cyan);
  box-shadow: 0 0 0 3px rgba(0, 157, 195, 0.13);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.95fr) minmax(420px, 1.25fr);
  gap: 18px;
  align-items: start;
}

.case-list {
  display: grid;
  gap: 10px;
}

.case-item {
  display: grid;
  gap: 10px;
  width: 100%;
  min-height: 116px;
  padding: 15px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 10px 28px rgba(1, 89, 137, 0.05);
  transition: border 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.case-item.active {
  border-color: var(--gaba-blue);
  box-shadow: inset 0 0 0 1px var(--gaba-blue), 0 14px 34px rgba(1, 89, 137, 0.1);
}

.case-item:hover {
  border-color: rgba(0, 157, 195, 0.58);
  transform: translateY(-1px);
}

.case-head {
  justify-content: space-between;
  gap: 12px;
}

.case-name {
  font-size: 1rem;
  font-weight: 900;
}

.case-meta,
.case-reason,
.muted {
  color: var(--muted);
}

.case-meta {
  font-size: 0.82rem;
}

.case-reason {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.35;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 26px;
  padding: 0 9px;
  color: white;
  background: var(--violet);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 900;
}

.badge.high,
.badge.inmediata {
  color: #07364d;
  background: var(--gaba-yellow);
}

.badge.media {
  color: #07364d;
  background: var(--gold);
}

.badge.regular {
  background: var(--teal);
}

.case-detail {
  position: sticky;
  top: 24px;
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 14px 38px rgba(1, 89, 137, 0.07);
}

.empty-state {
  min-height: 560px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 8px;
  padding: 26px;
}

.empty-state span {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: white;
  border-radius: 8px;
  background: var(--gaba-blue);
  font-weight: 950;
}

.empty-state p {
  max-width: 390px;
  color: var(--muted);
}

.detail-inner {
  padding: 24px;
}

.detail-head {
  align-items: flex-start;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.detail-head > div:first-child {
  width: 100%;
  min-width: 0;
}

.detail-head h2 {
  margin-bottom: 6px;
  font-size: 1.7rem;
  line-height: 1.08;
}

.detail-actions {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: stretch;
  gap: 8px;
  flex: none;
}

.detail-actions > button,
.detail-actions > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 76px;
  height: 100%;
  padding: 10px 12px;
  line-height: 1.15;
  text-align: center;
}

.detail-actions a.secondary {
  text-decoration: none;
}

#restoreCase {
  grid-column: span 2;
}

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

.info-grid div,
.clinical-block,
.timeline {
  padding: 14px;
  background: var(--mist);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.info-grid span,
.timeline span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.info-grid strong {
  line-height: 1.25;
}

.clinical-block h3,
.timeline h3 {
  margin-bottom: 10px;
}

.clinical-block ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.clinical-block li + li {
  margin-top: 6px;
}

.timeline {
  margin-top: 14px;
}

.timeline-item {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

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

.row-between {
  justify-content: space-between;
  gap: 14px;
}

.status-select {
  max-width: 210px;
}

.no-results {
  padding: 22px;
  color: var(--muted);
  background: white;
  border: 1px solid var(--line);
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(237, 245, 248, 0.88)),
    url("assets/neuropsychology-clinic.png") center / cover no-repeat;
}

.login-shell {
  width: min(430px, 100%);
}

.login-card {
  padding: 28px;
  border: 1px solid rgba(1, 89, 137, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 70px rgba(1, 89, 137, 0.16);
}

.login-card img {
  display: block;
  width: min(250px, 100%);
  margin-bottom: 22px;
}

.login-card h1 {
  margin-bottom: 10px;
}

.login-copy {
  color: var(--muted);
  line-height: 1.4;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: #b6423a;
  font-weight: 850;
}

.admission-dialog,
.discard-dialog {
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(1, 89, 137, 0.2);
}

.admission-dialog::backdrop,
.discard-dialog::backdrop {
  background: rgba(7, 54, 77, 0.42);
}

.admission-dialog form,
.discard-dialog form {
  padding: 24px;
}

.discard-dialog {
  width: min(560px, calc(100vw - 32px));
}

.discard-explanation {
  margin: 18px 0;
  color: var(--muted);
  line-height: 1.55;
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-head {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.wizard-progress {
  display: flex;
  gap: 8px;
  margin: 18px 0;
}

.wizard-progress span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: white;
  font-weight: 900;
}

.wizard-progress span.active,
.wizard-progress span.done {
  color: white;
  border-color: var(--gaba-blue);
  background: var(--gaba-blue);
}

.wizard-step {
  display: none;
  min-height: 360px;
}

.wizard-step.active {
  display: block;
}

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

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

.choice-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  cursor: pointer;
}

.choice-card input {
  width: auto;
  margin: 0;
}

.choice-card:has(input:checked) {
  border-color: var(--gaba-blue);
  box-shadow: inset 0 0 0 1px var(--gaba-blue);
}

.existing-patient-panel,
.insurance-grid {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--mist);
}

.patient-results {
  display: grid;
  gap: 8px;
  max-height: 220px;
  margin-top: 12px;
  overflow: auto;
}

.patient-result {
  min-height: auto;
  padding: 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

.patient-result.active {
  border-color: var(--gaba-blue);
  box-shadow: inset 0 0 0 1px var(--gaba-blue);
}

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

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

.admission-summary div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--mist);
}

.admission-summary span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dialog-actions {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.form-status {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 850;
}

.login-help-link {
  display: block;
  margin-top: 12px;
  color: var(--blue, #006a9b);
  font-weight: 800;
  text-align: center;
}

.recovery-heading {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

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

  .sidebar,
  .case-detail {
    position: relative;
    height: auto;
    top: auto;
  }

  .sidebar {
    min-height: auto;
    max-height: none;
    overflow: visible;
  }

  .sidebar nav {
    flex: initial;
    min-height: auto;
    overflow: visible;
    padding: 0;
  }

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

@media (max-width: 1180px) {
  .detail-head {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-head > div:first-child {
    min-width: 0;
  }

  .detail-actions {
    width: 100%;
    max-width: none;
    flex: none;
  }
}

@media (max-width: 760px) {
  .work-area,
  .sidebar {
    padding: 20px;
  }

  .admin-topbar,
  .detail-head,
  .row-between {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-row,
  .toolbar,
  .info-grid,
  .choice-grid,
  .wizard-grid,
  .service-choice-grid,
  .admission-summary,
  nav {
    grid-template-columns: 1fr;
  }

  .top-actions,
  .detail-actions {
    justify-content: flex-start;
  }

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

  .detail-actions > button,
  .detail-actions > a {
    min-height: 56px;
  }
}
