:root {
  --bg: #f1f5f5;
  --surface: #ffffff;
  --surface-alt: #f7fafa;
  --surface-strong: #eaf1f0;
  --panel-dark: #081b1b;
  --line: #d7e2e1;
  --line-strong: #b9ccca;
  --text: #172321;
  --muted: #61706d;
  --green: #076c70;
  --teal: #076c70;
  --cyan: #19999d;
  --green-weak: #dceee9;
  --blue: #3d6c73;
  --blue-weak: #e0ebec;
  --amber: #806019;
  --amber-weak: #f3ead3;
  --red: #9a433d;
  --red-weak: #f2e0dd;
  --shadow: 0 22px 48px rgba(18, 51, 48, 0.12);
  --shadow-soft: 0 1px 2px rgba(18, 51, 48, 0.04);
  font-family: "Segoe UI Variable Text", "Aptos", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

html {
  scroll-behavior: smooth;
}

body {
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(7, 108, 112, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(7, 108, 112, 0.03) 1px, transparent 1px),
    var(--bg);
  background-size: 64px 64px;
  font-feature-settings: "kern" 1, "liga" 1;
}

h1,
h2,
h3,
h4,
strong,
button {
  font-family: "Segoe UI Variable Display", "Aptos Display", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0;
}

h1,
h2,
h3,
h4 {
  text-wrap: balance;
}

p,
small,
dd,
td {
  text-wrap: pretty;
}

.summary-card strong,
.priority-card strong,
.status-meta dd,
td,
.account-status,
.directory-count,
.pagination-bar {
  font-variant-numeric: tabular-nums;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 70;
  transform: translateY(-160%);
  border-radius: 6px;
  padding: 10px 14px;
  color: #ffffff;
  background: var(--panel-dark);
  font-weight: 700;
  transition: transform 180ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

:where(button, input, select, textarea, summary, a):focus-visible {
  outline: 3px solid rgba(25, 153, 157, 0.34);
  outline-offset: 2px;
}

:where(button, summary, a) {
  transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

:where(button:not(:disabled), summary):active {
  transform: translateY(1px);
}

input,
select,
textarea {
  border-color: var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #91aaa7;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(7, 108, 112, 0.12);
}

.primary-button,
.secondary-button,
.danger-button {
  border-radius: 6px;
  font-weight: 650;
}

.primary-button {
  background: var(--teal);
  box-shadow: 0 7px 16px rgba(7, 108, 112, 0.18);
}

.primary-button:hover:not(:disabled) {
  background: #075b5e;
  box-shadow: 0 9px 20px rgba(7, 108, 112, 0.22);
  transform: translateY(-1px);
}

.secondary-button:hover:not(:disabled) {
  border-color: #91aaa7;
  background: var(--surface-alt);
}

.danger-button:hover:not(:disabled) {
  background: var(--red-weak);
}

.login-shell {
  grid-template-columns: minmax(560px, 1fr) minmax(420px, 520px);
  min-height: 100dvh;
  background: var(--bg);
}

.login-brand {
  position: relative;
  overflow: hidden;
  place-content: center;
  justify-items: start;
  gap: 28px;
  min-height: 100dvh;
  padding: 64px;
  background: var(--panel-dark);
}

.login-brand::after {
  content: "";
  position: absolute;
  right: -72px;
  bottom: -54px;
  width: 320px;
  height: 320px;
  background: url("../../assets/brand/gesthor-symbol-white.svg") center / contain no-repeat;
  opacity: 0.045;
  pointer-events: none;
}

.login-brand > * {
  position: relative;
  z-index: 1;
}

.login-brand-top {
  display: grid;
  gap: 22px;
}

.login-brand-top img {
  width: min(392px, 74vw);
  height: auto;
}

.login-brand-top span {
  width: fit-content;
  border-left: 4px solid #36afb1;
  padding-left: 14px;
  color: #8ee4df;
  font-size: clamp(1.35rem, 2vw, 1.95rem);
  font-weight: 820;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.login-brand-copy {
  max-width: 540px;
}

.login-brand-copy p {
  margin: 0;
  color: #d8f4f2;
  font-size: clamp(1.1rem, 1.6vw, 1.55rem);
  font-weight: 760;
  line-height: 1.35;
  text-wrap: balance;
}

.login-panel {
  width: calc(100% - 48px);
  max-width: 460px;
  margin: 24px;
  border-color: var(--line);
  padding: 32px;
  box-shadow: var(--shadow);
}

.login-panel h1 {
  font-size: 2rem;
  font-weight: 720;
}

.demo-credentials {
  border: 0;
  border-left: 3px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
}

.app-shell {
  grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
  border-right-color: rgba(255, 255, 255, 0.07);
  background: var(--panel-dark);
  width: 264px;
  padding: 24px 18px;
}

.sidebar::after {
  opacity: 0.04;
}

.brand {
  gap: 18px;
  margin-bottom: 20px;
  border-bottom-color: rgba(185, 204, 202, 0.16);
  padding-bottom: 18px;
}

.eyebrow {
  letter-spacing: 0;
  text-transform: none;
}

.brand-logo {
  width: 176px;
}

.product-identity {
  border-left-color: #36afb1;
}

.product-identity span {
  color: #8ee4df;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.product-identity strong {
  color: #f3fffd;
  font-size: 0.84rem;
  font-weight: 680;
}

.module-group {
  overflow: hidden;
}

.module-group summary {
  min-height: 0;
  padding: 12px;
}

.module-group summary small {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
}

.module-button {
  min-height: 42px;
  border-radius: 6px;
  color: #b9d0cd;
}

.module-button:hover:not(:disabled) {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.055);
}

.module-button.active {
  border-color: rgba(25, 153, 157, 0.5);
  background: rgba(25, 153, 157, 0.14);
  box-shadow: inset 3px 0 0 #36afb1;
}

.workspace {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  gap: 20px;
  padding: 28px 30px 42px;
}

.topbar {
  align-items: center;
  min-height: 86px;
  border-bottom: 1px solid rgba(185, 204, 202, 0.76);
  padding-bottom: 18px;
}

.topbar h1 {
  font-size: 2rem;
  font-weight: 730;
  line-height: 1.08;
}

.page-subtitle {
  max-width: 68ch;
  line-height: 1.5;
}

.user-card {
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
}

.user-card > span {
  border-radius: 6px;
  background: var(--teal);
}

.status-band,
.toolbar,
.panel,
.summary-card,
.priority-panel,
.priority-card,
.filter-panel,
.health-card {
  border-color: var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.panel,
.priority-panel,
.filter-panel {
  background: rgba(255, 255, 255, 0.94);
}

.toolbar,
.priority-panel,
.filter-panel {
  background-image: none;
}

.status-band {
  border-left: 3px solid var(--teal);
  background: rgba(255, 255, 255, 0.94);
}

.summary-grid {
  gap: 10px;
}

.summary-card {
  min-height: 116px;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 0 0 1px rgba(215, 226, 225, 0.86);
}

.summary-card::after,
.summary-card.ok::after,
.summary-card.info::after {
  width: 34px;
  height: 2px;
  border-radius: 0;
  background: var(--teal);
  opacity: 0.65;
}

.summary-card.warn::after {
  background: var(--amber);
}

.summary-card strong {
  font-size: 1.75rem;
  font-weight: 690;
}

.priority-card {
  border-left-width: 3px;
  box-shadow: none;
}

.panel-header {
  padding: 17px 18px;
}

.chart-panel {
  box-shadow: none;
}

.hospital-list,
.hospital-directory-tools,
.access-filter-bar {
  background: var(--surface-alt);
}

.tenant-access-card {
  border-color: var(--line);
  border-radius: 7px;
}

.tenant-access-card[open] {
  border-color: rgba(7, 108, 112, 0.5);
  box-shadow: 0 12px 28px rgba(18, 51, 48, 0.08);
}

.tenant-summary:hover,
.check-card:hover,
.agent-create-disclosure > summary:hover,
.agent-history > summary:hover,
.tenant-settings > summary:hover {
  background-color: var(--surface-alt);
}

.tenant-avatar,
.agent-count {
  border-radius: 5px;
}

.account-status {
  border-radius: 5px;
}

.check-card,
.permission-fieldset,
.agent-create-disclosure,
.agent-history,
.tenant-create-review {
  border-radius: 7px;
  background: #ffffff;
}

.credential-modal-backdrop {
  background: rgba(8, 27, 27, 0.62);
  backdrop-filter: blur(3px);
}

.credential-modal {
  border-radius: 8px;
  box-shadow: 0 28px 72px rgba(8, 27, 27, 0.28);
}

tbody tr {
  transition: background-color 160ms ease;
}

tbody tr:hover {
  background: rgba(7, 108, 112, 0.045);
}

th {
  letter-spacing: 0;
  text-transform: none;
  font-weight: 700;
}

.table-sort:focus-visible {
  border-radius: 3px;
}

.toast {
  z-index: 60;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: #19302d;
  box-shadow: 0 14px 30px rgba(8, 27, 27, 0.2);
}

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

  .sidebar {
    position: static;
    width: 100%;
    min-width: 0;
    height: auto;
    flex-direction: row;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .brand {
    min-height: 0;
    margin: 0;
  }

  .product-identity {
    display: none;
  }

  .module-nav {
    align-items: flex-start;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    grid-auto-flow: column;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
  }

  .module-button {
    white-space: nowrap;
  }

  .workspace {
    max-width: none;
  }
}

@media (max-width: 820px) {
  .login-shell {
    grid-template-columns: 1fr;
    background: var(--bg);
  }

  .login-brand {
    align-content: center;
    min-height: 0;
    gap: 20px;
    padding: 28px;
  }

  .login-brand::after {
    width: 190px;
    height: 190px;
  }

  .login-panel {
    width: auto;
    margin: 18px;
  }

  .login-brand-top img {
    width: min(280px, 82vw);
  }
}

@media (max-width: 640px) {
  .sidebar {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
    padding: 14px;
  }

  .brand-logo {
    width: 132px;
  }

  .product-identity {
    display: grid;
  }

  .module-nav {
    display: grid;
    grid-auto-flow: row;
    grid-auto-rows: max-content;
    align-content: start;
    gap: 6px;
    max-height: 320px;
    overflow-x: hidden;
    overflow-y: auto;
    padding-bottom: 4px;
    padding-right: 4px;
  }

  .module-group,
  .module-button {
    width: 100%;
    min-width: 0;
    flex: none;
  }

  .workspace {
    padding: 18px 14px 32px;
  }

  .topbar {
    align-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
