:root {
  --bg: #f6f3ef;
  --surface: #ffffff;
  --surface-soft: #f3f1ec;
  --ink: #202124;
  --muted: #68717d;
  --line: rgba(148, 163, 184, 0.32);
  --accent: #0f7f83;
  --accent-dark: #075d65;
  --danger: #b42318;
  --warn: #9a6700;
  --radius-xl: 2.5rem;
  --radius-lg: 1.6rem;
  --shadow-diffuse: 0 20px 45px -24px rgba(15, 23, 42, 0.28);
}

* {
  box-sizing: border-box;
}

* {
  min-width: 0;
}

html {
  min-height: 100%;
  background: var(--bg);
  overflow-x: hidden;
}

body {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "Outfit", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 10% 0%, rgba(15, 127, 131, 0.10), transparent 32rem),
    radial-gradient(circle at 84% 18%, rgba(245, 158, 11, 0.08), transparent 26rem),
    var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

p,
h1,
h2,
h3,
strong,
small,
span,
dt,
dd,
label,
input,
select,
textarea,
button,
a {
  overflow-wrap: anywhere;
}

button,
input,
select,
textarea {
  font: inherit;
  max-width: 100%;
}

button {
  cursor: pointer;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image: linear-gradient(115deg, rgba(255,255,255,0.16), transparent 38%), repeating-radial-gradient(circle at 12% 18%, rgba(32,33,36,0.08) 0 1px, transparent 1px 5px);
  mix-blend-mode: multiply;
}

.topbar {
  width: min(1400px, calc(100% - 32px));
  margin: 18px auto 0;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(20px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.88), var(--shadow-diffuse);
}

.portal-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 292px;
  min-height: 100dvh;
  padding: 28px 22px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 34px;
  border-right: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(24px);
  box-shadow: 28px 0 70px -58px rgba(15, 23, 42, 0.4);
}

.portal-brand {
  align-items: flex-start;
}

.portal-sidebar .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #e9f8f6, #075d65);
}

.portal-sidebar .nav-links {
  align-self: start;
  display: grid;
  justify-content: stretch;
  gap: 8px;
  padding: 0;
  background: transparent;
}

.portal-sidebar .nav-links a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 12px;
  font-weight: 700;
}

.portal-sidebar .nav-links a.active,
.portal-sidebar .nav-links a:hover {
  color: var(--accent-dark);
  background: #eef6f5;
  transform: translateX(2px);
}

.portal-sidebar .nav-links span {
  width: 22px;
  color: var(--accent-dark);
  text-align: center;
}

.sidebar-footer {
  display: grid;
  gap: 16px;
}

.sidebar-new {
  width: 100%;
  justify-content: center;
  min-height: 46px;
  border-radius: 10px;
}

.portal-topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  width: calc(100% - 292px);
  margin: 0 0 0 292px;
  padding: 16px 34px;
  grid-template-columns: auto minmax(220px, 420px) minmax(0, 1fr);
  border-width: 0 0 1px;
  border-radius: 0;
  background: rgba(255,255,255,0.76);
  box-shadow: none;
}

.topbar-title {
  color: var(--accent-dark);
  font-size: 1.12rem;
  font-weight: 800;
}

.top-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 16px;
  background: rgba(255,255,255,0.86);
}

.mini-avatar {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  font-weight: 800;
}

.brand,
.account-pill,
.nav-links {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand {
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.brand > span {
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 14px;
  background: conic-gradient(from 120deg, var(--accent), #d7ebe8, #233134, var(--accent));
  box-shadow: inset 0 0 0 6px rgba(255,255,255,0.82);
}

.brand strong,
.brand small,
.account-pill span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.brand strong {
  font-size: 0.95rem;
}

.brand small,
.account-pill span,
.muted {
  color: var(--muted);
}

.nav-links {
  justify-content: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(244, 246, 248, 0.86);
  max-width: 100%;
}

.nav-links a {
  padding: 9px 15px;
  border-radius: 999px;
  color: var(--muted);
  transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1), background 280ms cubic-bezier(0.16, 1, 0.3, 1), color 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--ink);
  background: #ffffff;
  transform: translateY(-1px);
}

.account-pill {
  justify-self: end;
  gap: 10px;
  max-width: 100%;
}

.link-button {
  border: 0;
  padding: 0;
  background: none;
  color: var(--accent-dark);
  font-weight: 700;
}

.danger-link {
  border: 0;
  padding: 0;
  background: none;
  color: var(--danger);
  font-weight: 800;
}

.locked-action {
  font-size: 0.88rem;
  font-weight: 700;
}

.center-link {
  justify-self: center;
}

.billing-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 10px;
  color: var(--accent-dark);
  background: rgba(215, 235, 232, 0.72);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.page-shell,
.public-shell {
  width: min(1400px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 80px;
}

body:has(.portal-sidebar) .page-shell {
  width: auto;
  margin-left: 292px;
  padding: 34px 34px 80px;
}

.page-shell.narrow {
  width: min(980px, calc(100% - 32px));
}

.auth-shell {
  width: min(1200px, calc(100% - 32px));
  min-height: 100dvh;
  margin: 0 auto;
  padding: 52px 0;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(min(100%, 340px), 0.85fr);
  align-items: center;
  gap: clamp(28px, 7vw, 96px);
}

.compact-auth {
  grid-template-columns: minmax(0, 1fr) minmax(min(100%, 340px), 420px);
}

.auth-copy {
  padding-left: clamp(0px, 9vw, 120px);
}

.auth-copy h1,
.hero-copy h1,
.list-header h1,
.form-heading h1,
.case-hero h1,
.public-hero h1,
.empty-state h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(2.45rem, 5.6vw, 5.8rem);
  line-height: 0.92;
  letter-spacing: -0.065em;
  font-weight: 700;
}

.auth-copy p,
.hero-copy p,
.list-header p,
.form-heading p,
.case-hero p,
.public-hero p,
.empty-state p {
  max-width: 65ch;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.7;
}

.landing-copy h1,
.billing-lock h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(2.6rem, 6vw, 6.2rem);
  line-height: 0.9;
  letter-spacing: -0.07em;
}

.landing-copy p,
.billing-lock p {
  max-width: 66ch;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.7;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-panel,
.panel-xl,
.panel-side,
.panel-soft,
.metric-tile,
.identity-panel,
.record-form,
.filter-panel,
.case-card,
.empty-state {
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(255, 255, 255, 0.82);
  border-radius: var(--radius-xl);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.92), var(--shadow-diffuse);
}

.auth-panel,
.record-form,
.panel-xl,
.panel-side,
.panel-soft,
.metric-tile,
.identity-panel,
.empty-state {
  padding: clamp(24px, 4vw, 42px);
  max-width: 100%;
  overflow: clip;
}

.stack-form,
.mini-form {
  display: grid;
  gap: 18px;
}

.stack-form h2,
.section-head h2,
.panel-side h2,
.panel-soft h2,
.empty-inline h3,
.timeline-entry h3,
.case-card h2,
.form-heading h1 {
  margin: 0;
  letter-spacing: -0.035em;
}

.field-block {
  display: grid;
  gap: 8px;
}

.field-block span {
  font-weight: 700;
}

.field-block input,
.field-block select,
.field-block textarea,
.link-list input {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: 18px;
  padding: 13px 15px;
  color: var(--ink);
  background: rgba(249, 250, 251, 0.92);
  outline: none;
  transition: border-color 240ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 240ms cubic-bezier(0.16, 1, 0.3, 1), transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

.field-block input:focus,
.field-block select:focus,
.field-block textarea:focus,
.link-list input:focus {
  border-color: rgba(15, 118, 110, 0.62);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.10);
}

.field-block small,
.field-block b,
.form-error {
  font-size: 0.86rem;
}

.field-block small,
.case-row small,
.case-card small,
.timeline-entry small,
.link-list small,
.user-row small,
.public-note {
  color: var(--muted);
}

.field-block b,
.form-error {
  color: var(--danger);
  font-weight: 700;
}

.form-error,
.flash {
  border: 1px solid rgba(180, 35, 24, 0.24);
  border-radius: 18px;
  padding: 12px 14px;
  background: rgba(255, 241, 239, 0.82);
}

.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  color: var(--ink);
}

.flash.success {
  border-color: rgba(15, 118, 110, 0.26);
  background: rgba(231, 246, 243, 0.88);
}

.status-dot,
.breathing-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  animation: pulse 2.4s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 999px;
  padding: 0 20px;
  border: 1px solid transparent;
  font-weight: 700;
  max-width: 100%;
  text-align: center;
  white-space: normal;
  transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 240ms cubic-bezier(0.16, 1, 0.3, 1), background 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

.primary-action {
  color: #ffffff;
  background: var(--accent-dark);
  box-shadow: 0 14px 24px -18px rgba(15, 118, 110, 0.65);
}

.secondary-action {
  color: var(--ink);
  background: #ffffff;
  border-color: rgba(148, 163, 184, 0.38);
}

.primary-action:hover,
.secondary-action:hover {
  transform: translateY(-2px);
}

.primary-action:active,
.secondary-action:active,
.link-button:active {
  transform: translateY(1px) scale(0.98);
}

.signal-board,
.action-row,
.form-actions,
.card-actions,
.link-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.signal-board {
  margin-top: 28px;
}

.signal-board span,
.status-badge,
.role-chip,
.visibility-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 11px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(255,255,255,0.76);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  max-width: 100%;
  text-align: center;
}

.hero-grid,
.case-hero,
.public-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(min(100%, 300px), 0.55fr);
  gap: 28px;
  align-items: stretch;
}

.metric-tile,
.live-tile {
  min-height: 260px;
  display: grid;
  align-content: end;
  position: relative;
  overflow: hidden;
}

.metric-tile::before {
  content: "";
  position: absolute;
  width: 190px;
  height: 190px;
  right: -52px;
  top: -52px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(15, 118, 110, 0.18), transparent 70%);
  animation: float 7s cubic-bezier(0.16, 1, 0.3, 1) infinite alternate;
}

.metric-tile strong {
  font-size: clamp(4rem, 10vw, 8rem);
  line-height: 0.82;
}

.mono-number {
  font-family: "JetBrains Mono", monospace;
}

.metrics-strip {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1.15fr 0.75fr 1fr;
  gap: 14px;
}

.portal-greeting {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.portal-greeting h1 {
  max-width: 760px;
  margin: 0 0 8px;
  font-size: clamp(2.1rem, 5vw, 3.8rem);
  letter-spacing: -0.055em;
}

.portal-greeting p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.portal-greeting aside {
  text-align: right;
}

.portal-greeting aside span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.portal-greeting aside strong {
  display: block;
  margin-top: 8px;
  font-size: 1.25rem;
}

.portal-cards {
  display: grid;
  grid-template-columns: 1.08fr 1fr 1fr;
  gap: 22px;
  margin-bottom: 26px;
}

.portal-card {
  min-height: 320px;
  padding: 22px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 16px;
  background: rgba(255,255,255,0.82);
  box-shadow: 0 20px 45px -36px rgba(15, 23, 42, 0.45);
}

.agenda-list {
  display: grid;
  gap: 12px;
}

.agenda-item {
  display: grid;
  grid-template-columns: minmax(70px, auto) minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  background: #eefafa;
}

.agenda-item.escuela {
  border-left-color: #5f6368;
  background: #f2f0eb;
}

.agenda-item.interno {
  border-left-color: #9a6700;
  background: #fff7e0;
}

.agenda-item time {
  color: var(--accent-dark);
  font-family: "JetBrains Mono", monospace;
  font-weight: 800;
}

.agenda-item strong,
.agenda-item small {
  display: block;
}

.agenda-item small {
  color: var(--muted);
}

.agenda-item a {
  color: var(--accent-dark);
  font-weight: 800;
}

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

.compact-agenda .agenda-item a {
  justify-self: start;
}

.connection-form {
  display: grid;
  gap: 12px;
}

.quick-patient-list {
  display: grid;
  gap: 14px;
  margin-bottom: 20px;
}

.quick-patient-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 18px;
  transition: background 220ms cubic-bezier(0.16, 1, 0.3, 1), transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.quick-patient-list a:hover {
  background: rgba(236, 253, 245, 0.74);
  transform: translateX(3px);
}

.quick-patient-list strong,
.quick-patient-list small {
  display: block;
}

.quick-patient-list small {
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}

.full-button {
  width: 100%;
  justify-content: center;
}

.event-quick-form {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(180px, 1fr) repeat(3, minmax(120px, 0.6fr)) minmax(160px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.calendar-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(min(100%, 340px), 0.42fr);
  gap: 28px;
  align-items: start;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
}

.calendar-grid > strong {
  padding: 14px 10px;
  color: var(--muted);
  background: #f2f0eb;
  font-size: 0.78rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.calendar-cell {
  min-height: 132px;
  padding: 12px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: rgba(255,255,255,0.72);
}

.calendar-cell.muted-cell {
  background: rgba(242, 240, 235, 0.56);
}

.calendar-cell:nth-child(7n + 7) {
  border-right: 0;
}

.calendar-cell > span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 800;
}

.calendar-cell.has-events > span {
  color: #ffffff;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-dark);
}

.calendar-pill {
  display: block;
  margin-top: 6px;
  padding: 7px 8px;
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: #dcf7f6;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 800;
}

.calendar-pill.escuela {
  border-left-color: #5f6368;
  background: #ece9e2;
  color: var(--ink);
}

.calendar-pill.interno {
  border-left-color: #9a6700;
  background: #fff1c2;
  color: #6b4b00;
}

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

.account-security-panel {
  padding: 22px;
  border: 1px solid rgba(15, 93, 101, 0.14);
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(239, 246, 245, 0.68));
}

.metrics-strip article {
  min-height: 136px;
  padding: 24px;
  border-top: 1px solid var(--line);
}

.metrics-strip span,
.metrics-strip strong {
  display: block;
}

.metrics-strip span {
  color: var(--muted);
  margin-bottom: 12px;
}

.metrics-strip strong {
  font-size: clamp(2.4rem, 5vw, 4.6rem);
}

.asymmetric-grid,
.case-workbench,
.team-grid,
.public-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(min(100%, 300px), 0.55fr);
  gap: 28px;
  align-items: start;
}

.case-workbench {
  grid-template-columns: minmax(0, 1.18fr) minmax(min(100%, 380px), 0.82fr);
}

.team-grid {
  grid-template-columns: minmax(min(100%, 300px), 0.55fr) minmax(0, 1.45fr);
}

.split-lower {
  margin-top: 28px;
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 28px;
}

.section-head,
.list-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.section-head a,
.card-actions a,
.link-actions a {
  color: var(--accent-dark);
  font-weight: 700;
}

.tight {
  margin-bottom: 18px;
}

.case-list,
.timeline-list,
.clinical-timeline,
.user-table,
.link-list {
  display: grid;
  gap: 12px;
}

.case-row,
.timeline-list a,
.timeline-entry,
.user-row,
.link-list article {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 24px;
  background: rgba(249, 250, 251, 0.72);
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1), background 260ms cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 0;
  max-width: 100%;
}

.case-row > *,
.timeline-list a > *,
.timeline-entry > *,
.user-row > *,
.link-list article > *,
.case-card > *,
.panel-xl > *,
.panel-side > *,
.panel-soft > *,
.identity-panel > *,
.record-form > * {
  min-width: 0;
}

.case-row {
  grid-template-columns: auto minmax(0, 1fr) minmax(min(100%, 120px), 0.45fr);
  align-items: center;
}

.case-row em {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 4px;
  color: var(--accent-dark);
  font-size: 0.85rem;
  font-style: normal;
  font-weight: 700;
}

.case-row:hover,
.timeline-list a:hover,
.case-card:hover {
  transform: translateY(-3px);
  background: #ffffff;
}

.avatar-chip,
.avatar-large {
  display: inline-grid;
  place-items: center;
  border-radius: 18px;
  color: var(--accent-dark);
  background: linear-gradient(145deg, #d7ebe8, #ffffff);
  font-family: "JetBrains Mono", monospace;
  font-weight: 800;
}

.avatar-chip {
  width: 44px;
  height: 44px;
}

.avatar-large {
  width: 82px;
  height: 82px;
  font-size: 1.5rem;
}

.progress-line {
  display: block;
  width: 100%;
  height: 9px;
  border-radius: 999px;
  overflow: hidden;
  background: #e8eef2;
}

.progress-line.tall {
  height: 12px;
}

.progress-line i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent));
  animation: growIn 800ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.bar-chart {
  display: grid;
  gap: 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 0.55fr) minmax(80px, 1fr) auto;
  align-items: center;
  gap: 10px;
  animation: slideUp 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--index) * 80ms);
}

.bar-row div {
  height: 10px;
  border-radius: 999px;
  background: #e8eef2;
  overflow: hidden;
}

.bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.column-chart {
  min-height: 240px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(52px, 1fr));
  gap: 14px;
  align-items: end;
}

.column-chart span {
  min-height: 30px;
  border-radius: 18px 18px 8px 8px;
  display: grid;
  align-content: end;
  justify-items: center;
  padding: 10px 6px;
  color: #ffffff;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
}

.column-chart b,
.column-chart small {
  display: block;
}

.filter-panel {
  margin: 26px 0;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(min(100%, 180px), 260px) auto;
  gap: 14px;
  align-items: end;
}

.import-panel {
  margin: 22px 0;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(min(100%, 420px), 0.6fr);
  gap: 20px;
  align-items: center;
  border: 1px solid rgba(15, 93, 101, 0.14);
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(239, 246, 245, 0.68));
  box-shadow: 0 22px 55px -44px rgba(15, 23, 42, 0.45);
}

.import-panel h2,
.import-panel p {
  margin: 0;
}

.import-panel p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.55;
}

.import-panel form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.file-drop {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px dashed rgba(15, 93, 101, 0.34);
  border-radius: 18px;
  background: rgba(255,255,255,0.72);
}

.file-drop span {
  color: var(--accent-dark);
  font-weight: 800;
}

.file-drop input {
  font-size: 0.9rem;
}

.field-block.compact {
  gap: 6px;
}

.case-masonry {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}

.case-card {
  grid-column: span 4;
  min-height: 310px;
  padding: 24px;
  display: grid;
  align-content: space-between;
  gap: 18px;
  max-width: 100%;
}

.case-card:nth-child(5n + 1),
.case-card:nth-child(5n + 4) {
  grid-column: span 5;
}

.case-card:nth-child(5n + 2) {
  grid-column: span 7;
}

.case-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}

.case-card p {
  color: var(--muted);
  line-height: 1.55;
}

.case-note-preview {
  position: relative;
  display: grid;
  gap: 5px;
  padding: 13px 14px 13px 18px;
  border: 1px solid rgba(15, 93, 101, 0.12);
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(15, 127, 131, 0.10), transparent 42%),
    rgba(255,255,255,0.76);
}

.case-note-preview::before {
  content: "";
  position: absolute;
  inset: 13px auto 13px 8px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent-dark), var(--accent));
}

.case-note-preview time {
  color: var(--accent-dark);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  font-weight: 800;
}

.case-note-preview strong {
  font-size: 0.88rem;
  letter-spacing: -0.01em;
}

.case-note-preview p {
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.9rem;
  line-height: 1.45;
}

.case-card dl,
.identity-panel dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.case-card dl div,
.identity-panel dl div {
  display: grid;
  grid-template-columns: minmax(74px, 96px) minmax(0, 1fr);
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  font-weight: 700;
  min-width: 0;
}

.status-badge.active {
  color: var(--accent-dark);
  background: rgba(215, 235, 232, 0.72);
}

.status-badge.paused {
  color: var(--warn);
  background: rgba(255, 247, 224, 0.82);
}

.status-badge.closed {
  color: var(--muted);
  background: rgba(226, 232, 240, 0.62);
}

.record-form {
  display: grid;
  gap: 18px;
}

.form-heading {
  margin-bottom: 28px;
}

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

.full {
  width: 100%;
}

.form-actions {
  justify-content: flex-end;
}

.identity-panel {
  display: grid;
  gap: 24px;
}

.patient-note-strip {
  position: relative;
  overflow: hidden;
  margin: 26px 0;
  padding: clamp(16px, 2.4vw, 24px);
  display: grid;
  grid-template-columns: minmax(210px, 0.34fr) minmax(0, 1fr);
  gap: clamp(18px, 3vw, 34px);
  align-items: center;
  border: 1px solid rgba(15, 93, 101, 0.14);
  border-radius: 30px;
  background:
    radial-gradient(circle at 8% 10%, rgba(15, 127, 131, 0.15), transparent 18rem),
    linear-gradient(135deg, rgba(255,255,255,0.94), rgba(239, 246, 245, 0.72));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.94), 0 24px 60px -46px rgba(15, 23, 42, 0.48);
}

.patient-note-strip::after {
  content: "";
  position: absolute;
  left: 30%;
  right: clamp(18px, 4vw, 44px);
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(15, 93, 101, 0.28), transparent);
  pointer-events: none;
}

.note-strip-head {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
}

.note-strip-head h2 {
  margin: 4px 0 0;
  letter-spacing: -0.045em;
}

.note-strip-head a {
  justify-self: start;
  padding: 9px 12px;
  border: 1px solid rgba(15, 93, 101, 0.16);
  border-radius: 999px;
  color: var(--accent-dark);
  background: rgba(255,255,255,0.68);
  font-weight: 800;
}

.note-ribbon {
  position: relative;
  z-index: 1;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(190px, 1fr);
  grid-template-columns: none;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}

.note-ribbon-item,
.note-strip-empty {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 22px;
  background: rgba(255,255,255,0.82);
  box-shadow: 0 18px 36px -32px rgba(15, 23, 42, 0.5);
}

.note-ribbon-item {
  position: relative;
  min-height: 128px;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 15px;
  scroll-snap-align: start;
  animation: slideUp 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--index) * 80ms);
}

.note-ribbon-item::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: var(--accent-dark);
  box-shadow: 0 0 0 5px rgba(15, 127, 131, 0.12);
}

.note-ribbon-item time {
  color: var(--accent-dark);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  font-weight: 800;
}

.note-ribbon-item strong {
  font-size: 1rem;
}

.note-ribbon-item p {
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
  line-height: 1.48;
}

.note-strip-empty {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 5px;
  padding: 20px;
  grid-column: 2;
}

.note-strip-empty span {
  color: var(--muted);
}

.clinical-sheet-form,
.sheet-panel {
  position: relative;
  overflow: hidden;
  padding: 26px;
  border: 1px solid rgba(15, 93, 101, 0.13);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(250, 251, 250, 0.88));
  box-shadow: 0 24px 60px -46px rgba(15, 23, 42, 0.45);
}

.clinical-sheet-form::after,
.sheet-panel::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-dark), rgba(15,127,131,0.2));
}

.clinical-sheet-view {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin: 28px 0;
}

.sheet-panel h2 {
  margin-top: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  text-align: left;
  letter-spacing: -0.04em;
}

.sheet-profile dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  border: 0;
  background: transparent;
}

.sheet-profile dl div {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.72);
}

.sheet-profile dt,
.sheet-lines strong,
.indicator-grid strong {
  color: #111827;
  font-weight: 900;
}

.sheet-profile dd,
.sheet-lines p,
.indicator-grid p {
  color: var(--muted);
  font-weight: 600;
  line-height: 1.55;
}

.sheet-lines {
  min-height: 92px;
  padding: 16px 0;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.sheet-lines p,
.indicator-grid p {
  margin: 8px 0 0;
  white-space: pre-wrap;
}

.sheet-two-cols,
.indicator-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.indicator-grid div {
  min-height: 130px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.74);
}

.indicator-grid small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.coordination-sheet {
  grid-column: 1 / -1;
}

.case-insight-board {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.insight-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(255,255,255,0.92), rgba(241, 245, 249, 0.72));
}

.insight-card.highlight {
  color: #ffffff;
  border: 0;
  background: radial-gradient(circle at 18% 18%, rgba(255,255,255,0.28), transparent 28%), linear-gradient(135deg, var(--accent-dark), #164e63);
}

.insight-card span,
.insight-card small,
.case-trend-panel .eyebrow {
  display: block;
}

.insight-card span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.insight-card.highlight span,
.insight-card.highlight small {
  color: rgba(255,255,255,0.78);
}

.insight-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 0.95;
}

.insight-card small {
  color: var(--muted);
  line-height: 1.4;
}

.case-trend-panel {
  display: grid;
  gap: 16px;
  margin-bottom: 26px;
  padding: 20px;
  border: 1px solid rgba(15, 118, 110, 0.12);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.64), rgba(255,255,255,0.84));
}

.case-trend-panel h2 {
  margin: 4px 0 0;
}

.case-trend-chart {
  height: 190px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
  gap: 12px;
  align-items: end;
  padding-top: 10px;
}

.case-trend-chart span {
  min-height: 28px;
  display: grid;
  align-content: space-between;
  justify-items: center;
  gap: 8px;
  padding: 10px 6px;
  border-radius: 18px 18px 10px 10px;
  color: #ffffff;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  box-shadow: 0 16px 28px rgba(15, 118, 110, 0.14);
  animation: growIn 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.case-trend-chart b,
.case-trend-chart small {
  display: block;
}

.case-trend-chart small {
  color: rgba(255,255,255,0.78);
  font-size: 0.72rem;
}

.trend-empty {
  padding: 18px;
  border: 1px dashed rgba(15, 118, 110, 0.28);
  border-radius: 20px;
  color: var(--muted);
  background: rgba(255,255,255,0.62);
}

.side-stack {
  display: grid;
  gap: 24px;
}

.case-support-board {
  display: grid;
  gap: 18px;
}

.support-card,
.session-composer {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 30px;
  background: rgba(255,255,255,0.86);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.92), 0 28px 55px -42px rgba(15, 23, 42, 0.45);
}

.support-card {
  padding: 22px;
}

.support-card h2,
.session-composer h2 {
  margin: 0;
  letter-spacing: -0.04em;
}

.note-card {
  background:
    linear-gradient(90deg, rgba(15,127,131,0.08), transparent 28%),
    repeating-linear-gradient(180deg, transparent 0 45px, rgba(49, 168, 223, 0.18) 46px 47px),
    rgba(255,255,255,0.88);
}

.note-card textarea {
  min-height: 160px;
  border-color: rgba(15, 127, 131, 0.24);
  background: rgba(255,255,255,0.68);
}

.family-card {
  background: linear-gradient(145deg, rgba(255,255,255,0.94), rgba(236,253,245,0.68));
}

.session-composer {
  margin-top: 28px;
  padding: clamp(24px, 4vw, 38px);
  background:
    radial-gradient(circle at 0% 0%, rgba(15, 127, 131, 0.13), transparent 34%),
    linear-gradient(135deg, rgba(255,255,255,0.96), rgba(248, 250, 252, 0.84));
}

.session-composer-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 22px;
  margin-bottom: 24px;
}

.session-composer-head p:not(.eyebrow) {
  max-width: 68ch;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.session-date-chip {
  flex: 0 0 auto;
  padding: 10px 13px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: rgba(215, 235, 232, 0.76);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  font-weight: 800;
}

.session-form-grid {
  display: grid;
  grid-template-columns: minmax(150px, 0.55fr) minmax(220px, 1fr) minmax(180px, 0.8fr);
  gap: 16px;
  align-items: end;
}

.session-form-grid .full-span {
  grid-column: 1 / -1;
}

.session-form-grid .visibility-field {
  grid-column: 1 / span 2;
}

.progress-field small {
  color: var(--accent-dark);
  font-weight: 800;
}

.timeline-entry header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.entry-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.entry-actions a {
  color: var(--accent-dark);
  font-weight: 700;
}

.timeline-entry time,
.timeline-list time {
  color: var(--accent-dark);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  font-weight: 700;
}

.timeline-entry p,
.timeline-list p,
.public-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.link-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.link-actions > *,
.link-actions form,
.enable-form,
.org-admin-row form {
  min-width: 0;
  max-width: 100%;
}

.link-actions a,
.link-actions button {
  overflow-wrap: anywhere;
}

.link-actions form {
  margin: 0;
}

.user-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}

.user-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.user-row-actions form {
  margin: 0;
}

.user-identity {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.user-identity strong,
.user-identity small {
  display: block;
  min-width: 0;
  line-height: 1.25;
}

.user-identity strong {
  color: var(--ink);
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.user-identity small {
  color: var(--muted);
  font-size: 0.88rem;
}

.empty-state,
.empty-inline {
  text-align: left;
}

.empty-state {
  min-height: 420px;
  display: grid;
  align-content: center;
  justify-items: start;
}

.empty-inline,
.empty-mini {
  padding: 24px;
  border: 1px dashed rgba(148, 163, 184, 0.42);
  border-radius: 28px;
  background: rgba(249, 250, 251, 0.68);
}

.empty-orbit {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: inline-block;
  margin-bottom: 14px;
  background: radial-gradient(circle at 50% 50%, var(--accent) 0 12%, transparent 13%), conic-gradient(from 0deg, transparent, rgba(15, 118, 110, 0.72), transparent 62%);
  animation: rotate 5.5s linear infinite;
}

.skeleton-stack {
  display: grid;
  gap: 12px;
}

.skeleton-stack span {
  height: 46px;
  border-radius: 18px;
  background: linear-gradient(90deg, #eef2f5, #ffffff, #eef2f5);
  background-size: 220% 100%;
  animation: shimmer 1.8s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

.public-shell {
  padding-top: 40px;
}

.public-hero {
  margin-bottom: 28px;
}

.public-list .timeline-entry {
  background: #ffffff;
}

.report-custom-panel {
  display: grid;
  gap: 18px;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 32px;
  background:
    linear-gradient(135deg, rgba(215, 235, 232, 0.48), rgba(255, 255, 255, 0.86)),
    #ffffff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.94), 0 18px 38px -30px rgba(15, 118, 110, 0.42);
}

.public-hero {
  position: relative;
  padding: clamp(18px, 3vw, 34px);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 16% 18%, rgba(15, 118, 110, 0.12), transparent 20rem),
    rgba(255,255,255,0.62);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.88), var(--shadow-diffuse);
}

.public-hero::after {
  content: "";
  position: absolute;
  right: clamp(18px, 6vw, 80px);
  bottom: -1px;
  width: min(220px, 42vw);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(15, 118, 110, 0.56), transparent);
}

.recommendation-note {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
  padding: 20px;
  border-radius: 28px;
  color: var(--ink);
  background:
    linear-gradient(145deg, rgba(215, 235, 232, 0.62), rgba(255,255,255,0.9)),
    #ffffff;
  border: 1px solid rgba(15, 118, 110, 0.18);
}

.recommendation-note h2,
.recommendation-note p {
  margin: 0;
}

.recommendation-note p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.65;
}

.report-signature {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--accent-dark);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.clinical-timeline.public-list {
  position: relative;
}

.clinical-timeline.public-list::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 8px;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(15,118,110,0.28), transparent);
}

.public-list .timeline-entry {
  margin-left: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(249,250,251,0.78)),
    #ffffff;
}

.landing-shell {
  width: min(1400px, calc(100% - 32px));
  min-height: 100dvh;
  margin: 0 auto;
  padding: 20px 0 72px;
}

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0;
}

.landing-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.landing-hero {
  min-height: calc(100dvh - 138px);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(min(100%, 340px), 0.85fr);
  gap: clamp(28px, 6vw, 90px);
  align-items: center;
}

.landing-copy {
  padding-left: clamp(0px, 8vw, 108px);
}

.landing-board {
  min-height: 520px;
  padding: 26px;
  display: grid;
  align-content: space-between;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, rgba(255,255,255,0.92), rgba(244,246,248,0.72));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.92), var(--shadow-diffuse);
  overflow: hidden;
  position: relative;
  max-width: 100%;
}

.landing-board::before {
  content: "";
  position: absolute;
  inset: auto -90px -100px auto;
  width: 260px;
  height: 260px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.11);
  animation: float 7s cubic-bezier(0.16, 1, 0.3, 1) infinite alternate;
}

.board-header,
.board-main,
.board-list,
.mini-bars {
  position: relative;
  display: flex;
}

.board-header {
  gap: 8px;
}

.board-header span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #cbd5e1;
}

.board-main {
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.board-main strong {
  display: block;
  font-size: 7rem;
  line-height: 0.85;
  letter-spacing: -0.08em;
}

.board-main small {
  color: var(--muted);
  font-weight: 800;
}

.mini-bars {
  height: 190px;
  min-width: 170px;
  align-items: end;
  gap: 12px;
}

.mini-bars i {
  flex: 1;
  border-radius: 16px 16px 6px 6px;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
}

.board-list {
  display: grid;
  gap: 12px;
}

.board-list span {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 22px;
  background: rgba(255,255,255,0.76);
}

.board-list b,
.board-list i {
  display: block;
  border-radius: 999px;
  background: #d7e2e7;
}

.board-list b {
  width: 44px;
  height: 44px;
}

.board-list i {
  height: 12px;
}

.landing-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr 1fr;
  gap: 18px;
}

.landing-grid article,
.billing-lock,
.org-admin-row {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: var(--radius-xl);
  background: rgba(255,255,255,0.82);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.92), var(--shadow-diffuse);
}

.landing-grid article {
  padding: 28px;
}

.landing-grid span {
  color: var(--accent-dark);
  font-family: "JetBrains Mono", monospace;
  font-weight: 800;
}

.landing-grid h2 {
  margin-bottom: 8px;
  letter-spacing: -0.04em;
}

.landing-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.billing-lock {
  padding: clamp(26px, 5vw, 54px);
}

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

.billing-facts div {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(249, 250, 251, 0.72);
}

.billing-facts span,
.billing-facts strong {
  display: block;
}

.billing-facts span {
  color: var(--muted);
  margin-bottom: 6px;
}

.org-admin-list {
  display: grid;
  gap: 16px;
}

.org-admin-list + .org-admin-list {
  margin-top: 34px;
}

.org-admin-row {
  padding: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(min(100%, 220px), 0.85fr) minmax(min(100%, 170px), 0.45fr) auto;
  gap: 18px;
  align-items: center;
}

.org-admin-row h2 {
  margin: 10px 0 6px;
  letter-spacing: -0.04em;
}

.org-admin-row p {
  margin: 0;
  color: var(--muted);
}

.org-admin-row dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.org-admin-row dl div {
  display: grid;
  grid-template-columns: minmax(74px, 96px) minmax(0, 1fr);
  gap: 8px;
}

.enable-form {
  display: grid;
  gap: 10px;
}

.platform-user-row {
  grid-template-columns: minmax(0, 1fr) minmax(min(100%, 260px), 0.8fr) auto auto;
}

.platform-user-row .danger-link {
  padding: 12px 14px;
  border: 1px solid rgba(180, 35, 24, 0.18);
  border-radius: 999px;
  background: rgba(255, 241, 239, 0.72);
}

.reveal,
.reveal-item {
  animation: slideUp 640ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.reveal.delayed {
  animation-delay: 110ms;
}

.reveal.delayed-more {
  animation-delay: 190ms;
}

.reveal-item {
  animation-delay: calc(var(--index) * 70ms);
}

@keyframes slideUp {
  from { opacity: 0; transform: translate3d(0, 18px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.72; }
  50% { transform: scale(1.55); opacity: 0.28; }
}

@keyframes float {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-16px, 24px, 0) scale(1.08); }
}

@keyframes growIn {
  from { transform: scaleX(0); transform-origin: left; }
  to { transform: scaleX(1); transform-origin: left; }
}

@keyframes rotate {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr;
    border-radius: 30px;
  }

  .nav-links,
  .account-pill {
    width: 100%;
    justify-content: space-between;
  }

  .auth-shell,
  .landing-hero,
  .hero-grid,
  .case-hero,
  .patient-note-strip,
  .clinical-sheet-view,
  .public-hero,
  .portal-cards,
  .calendar-workbench,
  .asymmetric-grid,
  .case-workbench,
  .team-grid,
  .public-grid,
  .split-lower {
    grid-template-columns: 1fr;
  }

  .auth-copy,
  .landing-copy {
    padding-left: 0;
  }

  .metrics-strip,
  .import-panel,
  .import-panel form,
  .filter-panel,
  .event-quick-form,
  .session-form-grid,
  .form-grid,
  .sheet-profile dl,
  .sheet-two-cols,
  .indicator-grid,
  .landing-grid,
  .billing-facts,
  .case-insight-board,
  .org-admin-row {
    grid-template-columns: 1fr;
  }

  .patient-note-strip {
    align-items: stretch;
    gap: 16px;
  }

  .patient-note-strip::after {
    left: clamp(18px, 5vw, 34px);
    right: clamp(18px, 5vw, 34px);
    top: auto;
    bottom: 102px;
  }

  .note-strip-head {
    display: flex;
    justify-content: space-between;
    align-items: start;
  }

  .note-strip-empty {
    grid-column: 1;
  }

  .portal-sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    min-height: auto;
    padding: 14px 18px;
    grid-template-rows: auto auto auto;
    gap: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .portal-sidebar .nav-links {
    display: flex;
    overflow-x: auto;
  }

  .portal-sidebar .nav-links a {
    flex: 0 0 auto;
  }

  .sidebar-footer {
    display: none;
  }

  .portal-topbar {
    width: 100%;
    margin-left: 0;
    grid-template-columns: 1fr;
    padding: 14px 18px;
  }

  body:has(.portal-sidebar) .page-shell {
    margin-left: 0;
    padding: 28px 18px 72px;
  }

  .portal-greeting {
    display: grid;
    align-items: start;
  }

  .portal-greeting aside {
    text-align: left;
  }

  .agenda-item {
    grid-template-columns: 1fr;
  }

  .session-composer-head {
    display: grid;
  }

  .session-form-grid .visibility-field {
    grid-column: 1;
  }

  .calendar-grid {
    min-width: 760px;
  }

  .calendar-workbench .panel-xl {
    overflow-x: auto;
  }

  .landing-hero {
    min-height: auto;
    padding: 44px 0 28px;
  }

  .landing-board {
    min-height: 420px;
  }

  .case-card,
  .case-card:nth-child(5n + 1),
  .case-card:nth-child(5n + 2),
  .case-card:nth-child(5n + 4) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .page-shell,
  .page-shell.narrow,
  .public-shell,
  .auth-shell,
  .landing-shell {
    width: min(100% - 24px, 1400px);
    padding-top: 28px;
  }

  .topbar {
    width: min(100% - 18px, 1400px);
    margin-top: 10px;
    padding: 10px;
    gap: 10px;
    border-radius: 26px;
  }

  .brand {
    width: 100%;
  }

  .brand-mark {
    flex: 0 0 34px;
  }

  .landing-nav {
    display: grid;
    gap: 14px;
  }

  .landing-actions {
    justify-content: stretch;
  }

  .landing-actions a,
  .action-row a,
  .form-actions a,
  .form-actions button {
    width: 100%;
  }

  .nav-links {
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }

  .nav-links::-webkit-scrollbar {
    display: none;
  }

  .nav-links a {
    flex: 0 0 auto;
  }

  .account-pill {
    display: grid;
    width: 100%;
    justify-items: start;
    gap: 8px;
  }

  .account-pill span {
    max-width: 100%;
    white-space: normal;
  }

  .billing-chip {
    width: 100%;
    justify-content: center;
  }

  .auth-copy h1,
  .landing-copy h1,
  .billing-lock h1,
  .hero-copy h1,
  .list-header h1,
  .form-heading h1,
  .case-hero h1,
  .public-hero h1,
  .empty-state h1 {
    font-size: clamp(2.25rem, 13vw, 3.6rem);
  }

  .auth-panel,
  .record-form,
  .panel-xl,
  .panel-side,
  .panel-soft,
  .metric-tile,
  .identity-panel,
  .empty-state {
    padding: 20px;
    border-radius: 26px;
  }

  .case-card,
  .landing-grid article,
  .org-admin-row {
    padding: 20px;
    border-radius: 26px;
  }

  .case-row,
  .user-row {
    grid-template-columns: 1fr;
  }

  .user-row {
    justify-items: start;
    gap: 12px;
  }

  .user-identity {
    width: 100%;
  }

  .user-row-actions {
    justify-content: flex-start;
  }

  .case-row .avatar-chip,
  .user-row .avatar-chip {
    justify-self: start;
  }

  .progress-line {
    min-width: 100%;
  }

  .section-head,
  .list-header,
  .note-strip-head,
  .timeline-entry header {
    display: grid;
  }

  .patient-note-strip {
    margin: 18px 0;
    padding: 16px;
    border-radius: 24px;
  }

  .patient-note-strip::after {
    display: none;
  }

  .note-ribbon {
    grid-auto-columns: minmax(238px, 82vw);
    gap: 10px;
    margin-inline: -4px;
    padding: 2px 4px 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .note-ribbon-item {
    min-height: 118px;
    padding: 14px;
  }

  .case-card dl div,
  .identity-panel dl div,
  .bar-row,
  .org-admin-row dl div {
    grid-template-columns: 1fr;
  }

  .board-main {
    display: grid;
  }

  .board-main strong {
    font-size: 5.4rem;
  }

  .mini-bars {
    width: 100%;
    min-width: 0;
  }

  .auth-shell {
    align-items: start;
  }
}

@media (max-width: 460px) {
  .page-shell,
  .page-shell.narrow,
  .public-shell,
  .auth-shell,
  .landing-shell {
    width: min(100% - 16px, 1400px);
  }

  .auth-copy h1,
  .landing-copy h1,
  .billing-lock h1,
  .hero-copy h1,
  .list-header h1,
  .form-heading h1,
  .case-hero h1,
  .public-hero h1,
  .empty-state h1 {
    font-size: clamp(2rem, 12vw, 2.85rem);
    line-height: 0.96;
    letter-spacing: -0.055em;
  }

  .auth-copy p,
  .landing-copy p,
  .billing-lock p,
  .hero-copy p,
  .list-header p,
  .form-heading p,
  .case-hero p,
  .public-hero p,
  .empty-state p {
    font-size: 0.98rem;
    line-height: 1.58;
  }

  .auth-panel,
  .record-form,
  .panel-xl,
  .panel-side,
  .panel-soft,
  .metric-tile,
  .identity-panel,
  .empty-state,
  .case-card,
  .landing-grid article,
  .org-admin-row {
    padding: 16px;
    border-radius: 22px;
  }

  .field-block input,
  .field-block select,
  .field-block textarea,
  .link-list input {
    border-radius: 14px;
    padding: 12px;
  }

  .primary-action,
  .secondary-action {
    min-height: 44px;
    padding: 0 14px;
  }

  .metric-tile {
    min-height: 210px;
  }

  .metric-tile strong {
    font-size: clamp(3.4rem, 22vw, 5rem);
  }

  .board-main strong {
    font-size: 4.4rem;
  }

  .landing-board {
    min-height: 360px;
  }

  .mini-bars {
    height: 140px;
  }
}
