:root {
  --bg: #f4f7fb;
  --surface: rgba(255, 255, 255, 0.96);
  --surface-alt: #eef2fa;
  --text: #0f1d35;
  --muted: #64748b;
  --border: #dde4f0;
  --primary: #1a47c9;
  --accent: #00c8dc;
  --brand-dark: #0c1b3d;
  --shadow: 0 18px 48px rgba(15, 29, 53, 0.09);
  --radius: 24px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 15px;
  background:
    radial-gradient(circle at top right, rgba(0, 200, 220, 0.07), transparent 32%),
    radial-gradient(circle at bottom left, rgba(26, 71, 201, 0.05), transparent 38%),
    linear-gradient(180deg, #f7f9ff 0%, var(--bg) 100%);
  color: var(--text);
}

body.modal-open-custom {
  position: fixed;
  inset: 0;
  width: 100%;
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }
.container-app { width: min(1120px, calc(100% - 1.5rem)); margin: 0 auto; }
.container-app--messages { width: min(1120px, calc(100% - 1.5rem)); }
.page-shell { padding: 1rem 0 2rem; }
.app-content { padding-bottom: 2rem; }
.message-stack {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 1.5rem));
  z-index: 2000;
  display: grid;
  gap: 0.75rem;
  pointer-events: none;
}

.message-stack .alert {
  margin: 0;
  border-radius: 18px;
  border: 1px solid rgba(216, 225, 219, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 42px rgba(20, 40, 29, 0.12);
  pointer-events: auto;
}

.message-stack .alert-success {
  background: rgba(15, 52, 120, 0.92);
  color: #e8f0ff;
  border-color: rgba(26, 71, 201, 0.9);
}

.message-stack .alert-danger {
  background: rgba(126, 36, 36, 0.9);
  color: #fff5f5;
  border-color: rgba(126, 36, 36, 0.96);
}

.shell-layout {
  min-height: 100vh;
}

.shell-main {
  min-width: 0;
}

.shell-sidebar {
  width: 260px;
  min-height: 100vh;
  position: sticky;
  top: 0;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.25rem 1rem;
  background: linear-gradient(180deg, #0c1b3d 0%, #0f2554 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.shell-sidebar__brand {
  display: grid;
  gap: 0.15rem;
  padding: 0.25rem 0.5rem 0 0.5rem;
}

.shell-sidebar__brand strong {
  color: #ffffff;
  font-size: 0.95rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.shell-sidebar__brand span,
.shell-sidebar__profile span {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.8rem;
}

.shell-sidebar__brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.shell-sidebar__nav {
  display: grid;
  gap: 0.35rem;
  align-content: start;
  margin-top: 2rem;
  flex: 1 1 auto;
}

.shell-sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.52);
  font-weight: 600;
  font-size: 0.82rem;
  transition: background 0.15s, color 0.15s;
}

.shell-sidebar__link:hover {
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.08);
}

.shell-sidebar__link.is-active {
  background: rgba(26, 71, 201, 0.82);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(26, 71, 201, 0.25);
}

.shell-sidebar__link.is-disabled {
  opacity: 0.32;
  cursor: default;
}

.shell-sidebar__profile {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.shell-sidebar__profile-meta {
  min-width: 0;
  flex: 1 1 auto;
}

.shell-sidebar__profile strong {
  display: block;
  color: #ffffff;
  font-size: 0.9rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shell-sidebar__avatar {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  border-radius: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--brand-dark);
  font-weight: 800;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  text-transform: uppercase;
}

.shell-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1rem;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(221, 228, 240, 0.75);
  position: sticky;
  top: 0;
  z-index: 100;
}

.shell-topbar__title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--primary);
  font-weight: 700;
  white-space: nowrap;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.shell-topbar__search {
  flex: 1 1 auto;
  max-width: 430px;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.85rem;
  background: var(--surface-alt);
  border-radius: 12px;
  margin-left: auto;
  border: 1px solid var(--border);
}

.shell-topbar__search span {
  color: var(--muted);
  font-size: 0.9rem;
}

.shell-topbar__search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  font-family: "IBM Plex Mono", monospace;
}

.shell-topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.shell-topbar__icon {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.shell-topbar__icon:hover {
  background: var(--surface-alt);
  color: var(--primary);
}

.app-navbar {
  background: rgba(248, 251, 247, 0.9);
  border-bottom: 1px solid rgba(216, 225, 219, 0.8);
  backdrop-filter: blur(14px);
  margin-bottom: 0.5rem;
}

.navbar-inner, .navbar-brand-custom, .hero-copy, .metric-card, .field, .activity-row, .summary-list div { display: grid; }
.navbar-inner { gap: 1rem; padding-top: 0.75rem; padding-bottom: 0.75rem; }
.navbar-brand-custom { align-items: center; gap: 0.9rem; }
.navbar-brand-custom span:last-child { display: grid; }
.navbar-brand-custom small, .metric-card span, .patient-card p, .patient-details dd, .timeline-author, .activity-row span, .summary-list span, .section-heading p, .state-card p { color: var(--muted); }

.brand-mark {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a47c9 0%, #00c8dc 100%);
  color: #fff;
  font-weight: 700;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(26, 71, 201, 0.3);
}

.nav-links-custom { gap: 0.35rem; margin-top: 1rem; }
.nav-links-custom .nav-link {
  color: var(--muted);
  border-radius: 999px;
  padding: 0.7rem 1rem;
  font-weight: 700;
}

.nav-links-custom .nav-link.active,
.nav-links-custom .nav-link:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.navbar-actions { display: grid; gap: 0.75rem; margin-top: 1rem; }
.user-pill {
  display: grid;
  gap: 0.1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 18px;
}

.user-pill__label, .patient-details dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  padding: 0;
  background: #ffffff;
}

.login-panel, .auth-form, .form-grid, .stats-grid, .panel-grid, .toolbar-grid, .patient-grid, .patient-actions, .modal-actions, .timeline-list, .activity-list, .summary-list {
  display: grid;
  gap: 1rem;
}

.login-hero, .login-card, .hero-card, .metric-card, .panel-card, .state-card, .patient-card, .timeline-item, .table-card, .modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-card, .panel-card, .state-card, .modal-card { padding: 1.25rem; }
.hero-card h1 { margin: 0.35rem 0 0.7rem; line-height: 1.08; font-size: clamp(2rem, 8vw, 3.6rem); }

/* ── Login page layout ─────────────────────────────────────── */
.login-page .login-panel {
  display: grid;
  gap: 0;
  width: 100%;
  min-height: 100vh;
  grid-template-rows: auto 1fr;
}

@media (min-width: 992px) {
  .login-page .login-panel {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
  }
}

.login-hero {
  background: linear-gradient(160deg, #0c1b3d 0%, #1a3a7c 55%, #0e2c6a 100%);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: #fff;
  padding: 2.25rem 2rem;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 300px;
}

.login-hero::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -15%;
  width: 55%;
  padding-top: 55%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 200, 220, 0.14) 0%, transparent 70%);
  pointer-events: none;
}

.login-hero::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 40%;
  padding-top: 40%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(26, 71, 201, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.login-hero .eyebrow {
  color: var(--accent);
  position: relative;
  z-index: 1;
}

.login-hero h1 {
  color: #ffffff;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin: 0.35rem 0 0.7rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
  position: relative;
  z-index: 1;
}

.login-hero > p {
  color: rgba(255, 255, 255, 0.62);
  margin: 0 0 1.25rem;
  font-size: 0.85rem;
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

.login-hero .hero-points {
  position: relative;
  z-index: 1;
}

.login-hero .hero-points span {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.7rem;
  margin-bottom: 2.1rem;
  position: relative;
  z-index: 1;
}

.login-brand__logo {
  width: clamp(118px, 20vw, 156px);
  height: auto;
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.14));
}

.login-brand__text {
  display: grid;
  gap: 0.2rem;
  justify-items: center;
}

.login-brand strong {
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.login-brand__text span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.9rem;
  font-weight: 600;
}

.login-hero h1,
.login-hero > p,
.login-hero .hero-points {
  text-align: center;
}

.login-hero .hero-points {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.login-card {
  background: #ffffff;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2.25rem 2rem;
  max-width: 440px;
  margin: 0 auto;
  width: 100%;
}

.eyebrow {
  display: inline-flex;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  font-size: 0.62rem;
  color: var(--primary);
}

.hero-points, .badge-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.hero-points span, .soft-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  background: var(--surface-alt);
  font-size: 0.88rem;
}

.soft-badge--success { background: var(--accent); }
.soft-badge--warning { background: #f8ecd0; }

.field { gap: 0.35rem; }
.field span, .field label { font-weight: 600; font-size: 0.75rem; }
.field .form-control, .field .form-select {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  padding: 0.62rem 0.8rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
}

.field .form-control:focus, .field .form-select:focus {
  border-color: rgba(26, 71, 201, 0.5);
  box-shadow: 0 0 0 4px rgba(26, 71, 201, 0.1);
}

.button, .btn { border-radius: 10px; padding: 0.65rem 1rem; font-weight: 600; font-size: 0.82rem; }
.button {
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.button-primary, .hero-action { background: linear-gradient(135deg, #1a47c9 0%, #2d5ee0 100%); color: #fff; box-shadow: 0 4px 14px rgba(26, 71, 201, 0.25); }
.button-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.button-ghost { background: var(--surface-alt); color: var(--text); }
.button-small { padding: 0.7rem 0.95rem; }
.button-block { width: 100%; }

.clinic-shell {
  background: #f8f9fa;
  min-height: calc(100vh - 72px);
}

.clinic-page {
  max-width: 1100px;
  padding: 1.25rem 0 3rem;
}

.clinic-page--detail {
  max-width: 860px;
}

.clinic-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0 1rem;
}

.clinic-topbar h1 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--primary);
  font-weight: 800;
}

.clinic-topbar p {
  margin: 0.2rem 0 0;
  color: #7b8699;
  font-size: 0.94rem;
}

.clinic-topbar__back {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.clinic-back-link,
.clinic-icon-btn {
  width: 2.35rem;
  height: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 0;
  background: rgba(255, 255, 255, 0.92);
  color: var(--primary);
  font-size: 1.15rem;
  box-shadow: 0 6px 18px rgba(26, 71, 201, 0.1);
}

.clinic-icon-btn--muted {
  color: #9aa5b5;
}

.clinic-search {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.clinic-search__field {
  position: relative;
}

.clinic-search__field .form-control {
  border: 0;
  border-radius: 18px;
  background: #e7e8e9;
  padding: 1rem 1rem 1rem 2.75rem;
  box-shadow: none;
}

.clinic-search__field .form-control:focus,
.clinic-entry-form__textarea:focus {
  box-shadow: 0 0 0 3px rgba(0, 71, 141, 0.12);
  background: #fff;
}

.clinic-search__icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #727783;
  font-size: 1rem;
}

.clinic-search__actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.clinic-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: #5f6876;
  font-weight: 600;
}

.clinic-group {
  margin-bottom: 2rem;
}

.clinic-group--table {
  margin-bottom: 2.4rem;
}

.clinic-group__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.clinic-group__header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: #29303d;
}

.clinic-group__header span {
  background: #e1e3e4;
  border-radius: 999px;
  color: #6a7483;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.42rem 0.75rem;
}

.clinic-group__header--table {
  align-items: end;
}

.clinic-group__header--table p {
  margin: 0.35rem 0 0;
  color: #7b8699;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.clinic-list-card {
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
}

.clinic-list-card--desktop {
  display: none;
}

.clinic-list-card--mobile {
  display: block;
}

.clinic-patient-table {
  margin: 0;
}

.clinic-patient-table thead th {
  background: #eceef1;
  color: #5f6876;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 0;
  padding: 1rem 1.2rem;
}

.clinic-patient-table tbody td {
  border: 0;
  border-top: 1px solid rgba(194, 198, 212, 0.35);
  padding: 1.1rem 1.2rem;
  vertical-align: middle;
  color: #2f3642;
  font-size: 0.94rem;
}

.clinic-patient-table__identity {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.clinic-patient-table__identity strong {
  display: block;
  color: #222b39;
  font-size: 0.96rem;
  line-height: 1.2;
}

.clinic-patient-table__identity span {
  display: block;
  margin-top: 0.15rem;
  color: #7b8699;
  font-size: 0.78rem;
}

.clinic-patient-table__avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 0.75rem;
  background: #dce8ff;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
}

.clinic-inline-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.28rem 0.6rem;
  background: #dce8ff;
  color: #1a47c9;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.clinic-inline-status--warning {
  background: #ffdad6;
  color: #93000a;
}

.clinic-inline-status__dot {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.85;
}

.clinic-action-eye {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: transparent;
  color: var(--primary);
  font-size: 0.9rem;
}

.clinic-mobile-list {
  display: grid;
  gap: 0;
}

.clinic-mobile-row {
  padding: 1rem 1.05rem;
  display: grid;
  gap: 0.8rem;
  border-top: 1px solid rgba(194, 198, 212, 0.35);
}

.clinic-mobile-row:first-child {
  border-top: 0;
}

.clinic-mobile-row__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.clinic-mobile-row p {
  margin: 0;
  color: #5f6876;
  font-size: 0.9rem;
}

.clinic-link {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--primary);
  font-weight: 800;
  font-size: 0.92rem;
}

.clinic-link--muted {
  color: var(--primary);
  font-size: 0.84rem;
  opacity: 0.75;
}

.clinic-link span {
  font-size: 1.1rem;
  line-height: 1;
}

.clinic-patient-hero {
  background: #f3f4f5;
  border-radius: 0 0 28px 28px;
  padding: 1.5rem 1.25rem;
  margin-bottom: 1rem;
}

.clinic-mini-badge {
  display: inline-flex;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: var(--primary);
  color: #dce8ff;
  font-size: 0.64rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.clinic-patient-hero h2 {
  margin: 0.55rem 0 0.2rem;
  font-size: clamp(1.75rem, 4vw, 2.45rem);
  line-height: 1.05;
  color: #212834;
  font-weight: 800;
}

.clinic-patient-hero__intro p {
  margin: 0;
  color: #6d7787;
  font-size: 0.95rem;
  font-weight: 500;
}

.clinic-patient-hero__intro p span {
  color: var(--primary);
  font-weight: 800;
}

.clinic-detail-grid {
  display: grid;
  gap: 0.85rem;
  margin-top: 1.1rem;
}

.clinic-info-box--detail {
  background: #fff;
}

.clinic-vitals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.clinic-vital-box {
  background: #fff;
  border-radius: 14px;
  padding: 0.9rem 1rem;
}

.clinic-vital-box strong {
  color: var(--primary);
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 800;
}

.clinic-tabs {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  padding: 0 0 0.35rem;
  margin-bottom: 1.25rem;
}

.clinic-tabs a {
  padding: 0.8rem 0 0.65rem;
  color: #a1a7b1;
  font-weight: 700;
  font-size: 0.92rem;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}

.clinic-tabs a.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.clinic-detail-content,
.clinic-history-stack,
.clinic-summary-stack {
  display: grid;
  gap: 1rem;
}

.clinic-section {
  display: grid;
  gap: 0.9rem;
}

.clinic-section__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.clinic-section__header h3 {
  margin: 0;
  color: #222b39;
  font-size: 1.1rem;
  font-weight: 800;
}

.clinic-section__header span {
  color: #98a1af;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.clinic-entry-form {
  display: grid;
  gap: 1rem;
}

.clinic-entry-form .form-control,
.clinic-entry-form .form-select {
  border: 0;
  border-radius: 16px;
  background: #e7e8e9;
  padding: 0.95rem 1rem;
}

.clinic-entry-form__textarea {
  background: #e7e8e9;
  border-radius: 18px;
  border: 0;
  min-height: 180px;
  resize: vertical;
}

.clinic-primary-btn {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 0.95rem 1.1rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(90deg, #1a47c9 0%, #2d5ee0 100%);
  box-shadow: 0 10px 24px rgba(26, 71, 201, 0.22);
  font-family: "IBM Plex Mono", monospace;
  cursor: pointer;
}

.clinic-history-card {
  background: #fff;
  border-radius: 18px;
  padding: 1rem;
  box-shadow: 0 6px 18px rgba(18, 44, 73, 0.04);
}

.clinic-history-card__meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.clinic-history-card__time {
  margin: 0 0 0.2rem;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 800;
}

.clinic-history-card__author {
  margin: 0;
  color: #344052;
  font-size: 0.9rem;
  font-weight: 700;
}

.clinic-history-card__text {
  margin: 0;
  color: #556172;
  font-size: 0.94rem;
  line-height: 1.65;
}

.clinic-history-card__tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #dce8ff;
  color: var(--primary);
  padding: 0.3rem 0.65rem;
  font-size: 0.64rem;
  font-weight: 800;
  text-transform: uppercase;
}

.clinic-history-card__tag--soft {
  background: #e7f4ea;
  color: #467a55;
}

.clinic-empty {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  padding: 1rem;
  color: #687484;
}

.clinic-empty--soft {
  background: #f3f4f5;
}

.app-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(216, 225, 219, 0.9);
  border-radius: 22px;
  box-shadow: 0 10px 28px rgba(20, 40, 29, 0.06);
  overflow: hidden;
}

.app-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(216, 225, 219, 0.8);
  background: rgba(247, 249, 246, 0.95);
}

.app-card__header--section {
  padding: 1.25rem 1.25rem 1rem;
  background: transparent;
}

.app-card__title {
  margin: 0.35rem 0 0.25rem;
  font-size: clamp(1.45rem, 3vw, 1.8rem);
  line-height: 1.15;
}

.app-card__title--sm {
  font-size: 1.2rem;
}

.app-card__subtitle {
  margin: 0;
  color: var(--muted);
}

.table-card__badge {
  font-weight: 600;
}

.patient-toolbar {
  padding: 1.5rem;
}

.patient-toolbar__actions {
  display: grid;
  gap: 0.75rem;
}

.patient-table th,
.patient-table td {
  vertical-align: middle;
}

.patient-table__group td {
  background: rgba(247, 249, 246, 0.98);
  color: var(--primary);
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.patient-table__group span {
  color: var(--muted);
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  margin-left: 0.35rem;
}

.patient-table__name {
  display: grid;
  gap: 0.15rem;
}

.patient-table__name span {
  font-size: 0.88rem;
  color: var(--muted);
}

.patient-list-mobile {
  display: block;
}

.patient-list-desktop {
  display: none;
}

.patient-mobile-list {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.patient-mobile-card {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
  border: 1px solid rgba(216, 225, 219, 0.88);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
}

.patient-mobile-card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.patient-mobile-card__top h3 {
  margin: 0;
  font-size: 1.05rem;
}

.patient-mobile-card__top p,
.patient-mobile-card__meta,
.patient-mobile-card__details dd {
  margin: 0;
  color: var(--muted);
}

.patient-mobile-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.patient-mobile-card__meta span {
  display: inline-flex;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--surface-alt);
}

.patient-mobile-card__details {
  margin: 0;
  display: grid;
  gap: 0.8rem;
}

.patient-mobile-card__details dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.detail-header__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.detail-header__actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.detail-summary {
  display: grid;
  gap: 1rem;
  padding: 1.5rem;
}

.detail-summary__card {
  border: 1px solid rgba(216, 225, 219, 0.85);
  border-radius: 18px;
  padding: 1rem;
  background: rgba(247, 249, 246, 0.8);
}

.detail-grid {
  display: grid;
  gap: 1rem;
}

.detail-form {
  display: grid;
  gap: 1rem;
  padding: 0 1.25rem 1.25rem;
}

.detail-form__actions {
  display: flex;
  justify-content: flex-end;
}

.hero-card { display: grid; gap: 1rem; margin-bottom: 1rem; }
.hero-card--compact h1 { font-size: clamp(1.8rem, 7vw, 3rem); }
.hero-toolbar {
  display: grid;
  gap: 0.85rem;
}

.hero-toolbar__actions {
  display: flex;
  gap: 0.75rem;
  align-items: end;
  justify-content: flex-start;
}

.filter-status {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 46px;
  padding: 0.75rem 0.95rem;
  border-radius: 16px;
  color: var(--muted);
  background: rgba(238, 244, 237, 0.85);
  border: 1px solid transparent;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.hero-toolbar.is-loading .filter-status {
  opacity: 1;
  transform: translateY(0);
  border-color: rgba(216, 225, 219, 0.95);
}

.filter-status__dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 0 rgba(26, 71, 201, 0.42);
  animation: filterPulse 1.2s infinite;
}

@keyframes filterPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(26, 71, 201, 0.42);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(26, 71, 201, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(26, 71, 201, 0);
  }
}

.metric-card { padding: 0.9rem 1rem; gap: 0.25rem; border-radius: 16px !important; }
.metric-card strong { font-size: 1.5rem; line-height: 1; }
.metric-card span { font-size: 0.72rem; }
.metric-card small { font-size: 0.65rem; }
.metric-card--highlight {
  background: linear-gradient(135deg, #1a47c9 0%, #2d5ee0 100%);
  color: #fff;
}

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

.toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1rem;
  background: var(--surface-alt);
}

.toggle-card--compact {
  padding: 0.95rem 1rem;
}

.toggle-card--compact strong {
  display: block;
  margin-bottom: 0.15rem;
}

.toggle-card--compact small {
  color: var(--muted);
}

.toolbar-actions { align-self: end; }

.hospital-accordion .accordion-item { border: 0; background: transparent; margin-bottom: 0.85rem; }
.hospital-item .accordion-button, .hospital-item .accordion-button:not(.collapsed) {
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  border-radius: 22px !important;
  box-shadow: var(--shadow);
  border: 1px solid rgba(216, 225, 219, 0.9);
}

.hospital-item .accordion-body { padding: 1rem 0.25rem 0.25rem; }
.accordion-title-wrap { display: grid; gap: 0.2rem; }

.patient-grid {
  align-items: stretch;
}

.patient-card {
  padding: 1rem;
  gap: 1rem;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.patient-card__header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.patient-card__header h3 { margin: 0; font-size: 1.1rem; }
.icon-button {
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  text-transform: uppercase;
  color: var(--muted);
}

.patient-details {
  margin: 0;
  display: grid;
  gap: 0.85rem;
  align-content: start;
  flex: 1 1 auto;
}
.patient-details dd { margin: 0; }
.patient-actions {
  margin-top: auto;
  align-items: start;
}

.patient-actions .button {
  align-self: start;
}
.state-card { text-align: center; display: grid; gap: 0.4rem; justify-items: center; }
.state-card--compact { padding: 1rem; border-radius: 18px; box-shadow: none; }
.table-card { padding: 0.5rem; }

.table-modern thead th {
  color: var(--muted);
  border-bottom-color: var(--border);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table-modern tbody td { vertical-align: middle; border-bottom-color: rgba(216, 225, 219, 0.8); }
.activity-row > div:first-child, .timeline-item__meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.timeline-item__actions {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.timeline-item {
  padding: 1rem 1.1rem;
}

.timeline-item__editor {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(216, 225, 219, 0.8);
}

.timeline-item__meta {
  margin-bottom: 0.65rem;
}

.timeline-item p {
  margin: 0 0 0.75rem;
}

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

.activity-bar {
  height: 0.7rem;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
}

.activity-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--primary) 0%, #67b091 100%);
}

.summary-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.summary-list div {
  background: var(--surface-alt);
  border-radius: 18px;
  padding: 1rem;
  gap: 0.25rem;
}

.summary-list strong { font-size: 1.6rem; }

.app-modal .modal-content {
  border: 1px solid rgba(216, 225, 219, 0.9);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.app-modal .modal-header,
.app-modal .modal-footer {
  padding: 1rem 1.25rem;
  border-color: rgba(216, 225, 219, 0.8);
}

.app-modal .modal-body {
  padding: 1rem 1.25rem 1.25rem;
}

@media (min-width: 768px) {
  .page-shell { padding: 1.5rem 0 3rem; }
  /* login-panel layout moved to .login-page .login-panel with 992px breakpoint */
  .nav-links-custom, .navbar-actions { margin-top: 0; }
  .navbar-actions { grid-auto-flow: column; align-items: center; }
  .clinic-page {
    padding-top: 2rem;
  }
  .clinic-list-card--desktop {
    display: block;
  }
  .clinic-list-card--mobile {
    display: none;
  }
  .clinic-detail-grid {
    grid-template-columns: 1.4fr 1fr;
    align-items: stretch;
  }
  .hero-card { grid-template-columns: 1fr auto; align-items: end; }
  .hero-toolbar {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr) auto;
    align-items: end;
  }
  .patient-list-mobile {
    display: none;
  }
  .patient-list-desktop {
    display: block;
  }
  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar-grid, .panel-grid, .patient-grid, .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .patient-actions, .modal-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-span-2 { grid-column: span 2; }
}

@media (min-width: 1024px) {
  .shell-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
  }
  .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .patient-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ═══════════════════════════════════════════════════════════════
   REDESIGN COMPLETO — Plantão Nefro
   ═══════════════════════════════════════════════════════════════ */

/* ── Mobile bottom nav ──────────────────────────────────────── */
.mobile-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  align-items: stretch;
  height: 60px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  z-index: 300;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.18rem;
  padding: 0.4rem 0;
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  transition: color 0.12s;
  position: relative;
}

.mobile-nav__item.is-active {
  color: var(--primary);
}

.mobile-nav__item.is-active::before {
  content: '';
  position: absolute;
  top: 0; left: 25%; right: 25%;
  height: 2px;
  background: var(--primary);
  border-radius: 0 0 4px 4px;
}

.mobile-nav__icon {
  font-size: 1rem;
  line-height: 1;
}

.mobile-nav__label {
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}

@media (max-width: 991px) {
  .app-content {
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0) + 0.5rem);
  }
}

/* ── Dashboard ──────────────────────────────────────────────── */
.dash-page {
  padding: 0 0 2rem;
}

.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1rem 0;
}

.dash-header__text h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.dash-header__text p {
  margin: 0.18rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.dash-add-btn {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 0;
  background: var(--primary);
  color: white;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(26, 71, 201, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}

.dash-add-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(26, 71, 201, 0.38);
}

.dash-search {
  padding: 0.85rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.dash-search__field {
  position: relative;
  margin-bottom: 0.6rem;
}

.dash-search__icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1rem;
  pointer-events: none;
}

.dash-search__input {
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: rgba(255,255,255,0.9);
  padding: 0.62rem 0.85rem 0.62rem 2.3rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(15,29,53,0.06);
  outline: 0;
  transition: box-shadow 0.15s;
  border: 1px solid var(--border);
}

.dash-search__input:focus {
  box-shadow: 0 0 0 3px rgba(26,71,201,0.12), 0 2px 8px rgba(15,29,53,0.06);
  border-color: rgba(26,71,201,0.35);
}

.dash-search__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dash-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.dash-filter-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.18s;
  pointer-events: none;
}

.dash-search-form.is-loading .dash-filter-status { opacity: 1; }

.dash-filter-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 0 rgba(26,71,201,0.4);
  animation: filterPulse 1.2s infinite;
}

/* ── Hospital groups — accordion ─────────────────────────────── */
.hospital-section {
  margin: 0.5rem 0.85rem 0;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: white;
  box-shadow: 0 2px 8px rgba(15, 29, 53, 0.05);
  overflow: hidden;
}

.hospital-label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1.25rem;
  width: 100%;
  background: white;
  border: 0;
  border-bottom: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s;
}

.hospital-label:hover {
  background: var(--surface-alt);
}

.hospital-label:active { background: #eef2fa; }

.hospital-label[aria-expanded="true"] {
  background: var(--surface-alt);
  border-bottom-color: var(--border);
}

.hospital-label__name {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text);
  margin: 0;
  flex: 1;
}

.hospital-label[aria-expanded="true"] .hospital-label__name {
  color: var(--primary);
}

.hospital-label__count {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.5rem;
  border-radius: 4px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 700;
  transition: background 0.15s, color 0.15s;
}

.hospital-label[aria-expanded="true"] .hospital-label__count {
  background: #dce8ff;
  color: var(--primary);
}

.hospital-label__chevron {
  font-size: 1rem;
  color: var(--border);
  line-height: 1;
  display: inline-block;
  transition: transform 0.22s ease, color 0.15s;
  transform: rotate(0deg);
}

.hospital-label[aria-expanded="true"] .hospital-label__chevron {
  transform: rotate(90deg);
  color: var(--primary);
}

/* ── Accordion body ──────────────────────────────────────────── */
.hospital-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.28s ease;
  padding: 0;
}

/* .hospital-body.is-open — max-height set dynamically via JS */

.hospital-card {
  background: white;
  border-radius: 14px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(15,29,53,0.05);
}

.patient-card__avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  background: linear-gradient(135deg, #d4fff0, #bfeee6);
  color: #0e8b96;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
}

.patient-card__avatar--discharged {
  background: linear-gradient(135deg, #ffe2e2, #ffd1d1);
  color: #a12626;
}

.patient-chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.55rem;
  padding: 0.14rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  max-width: 100%;
}

.patient-chip--sector {
  background: #e9f7f3;
  color: #117a71;
}

.patient-chip--plan {
  background: #eef3ff;
  color: #2d5bd1;
}

.patient-chip--diagnosis {
  background: #fff2dc;
  color: #b46906;
}

.patient-chip--danger {
  background: #fde8e8;
  color: #a12626;
}

.patient-card__footer {
  padding: 0.75rem 1.15rem 1rem;
  border-top: 1px solid rgba(218,226,238,0.9);
  background: rgba(255,255,255,0.52);
}

.patient-card__evolution {
  margin: 0;
  color: #7f94bb;
  font-size: 0.94rem;
  font-style: italic;
  line-height: 1.45;
}

/* ── Patient row (mobile list) ──────────────────────────────── */
.patient-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.85rem;
  padding: 0.8rem 0.95rem;
  border-top: 1px solid rgba(221,228,240,0.7);
  transition: background 0.12s;
}

.patient-row:first-child { border-top: 0; }

.patient-row:hover {
  background: linear-gradient(180deg, rgba(247, 250, 255, 0.92), rgba(241, 246, 255, 0.96));
}

.patient-row__main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.85rem;
  min-width: 0;
  text-decoration: none;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

.patient-row__main:active {
  opacity: 0.92;
}

.patient-card__avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 9px;
  background: #dce8ff;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.patient-row__avatar--discharged {
  background: #fce8e8;
  color: #93000a;
}

.patient-row__body {
  flex: 1;
  min-width: 0;
}

.patient-row__headline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.patient-row__name {
  font-weight: 700;
  font-size: 0.94rem;
  letter-spacing: 0.02em;
  margin: 0;
}

.patient-row__status {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #e7f7ee;
  color: #128647;
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
}

.patient-row__status--discharged {
  background: #fde8e8;
  color: #a12626;
}

.patient-row__edit-tag {
  display: inline-flex;
  align-items: center;
  align-self: start;
  gap: 0.28rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: #fff3d4;
  color: #a96200;
  font-size: 0.64rem;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(210, 142, 0, 0.18);
  line-height: 1;
  border: 0;
  cursor: pointer;
}

.patient-row__edit-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.78rem;
  height: 0.78rem;
  font-size: 0.72rem;
  line-height: 1;
  flex-shrink: 0;
}

.patient-row__edit-tag:hover {
  background: #ffedbf;
}

.patient-row__facts {
  display: flex;
  gap: 0.38rem 0.9rem;
  flex-wrap: wrap;
  margin-top: 0.28rem;
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.45;
}

.patient-row__facts strong {
  color: #0f172a;
  font-weight: 700;
}

.patient-row__tags {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  flex-wrap: wrap;
  margin-top: 0.7rem;
}

/* ── Status badges ───────────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.status-pill--active {
  background: #dce8ff;
  color: var(--primary);
}

.status-pill--discharged {
  background: #fde8e8;
  color: #93000a;
}

.status-pill__dot {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ── Desktop patient table (improved) ───────────────────────── */
.pt-table {
  width: 100%;
  border-collapse: collapse;
}

.pt-table thead th {
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.85rem 1.1rem;
  border: 0;
}

.pt-table thead th:first-child { border-radius: 0; }

.pt-table tbody tr {
  border-top: 1px solid rgba(221,228,240,0.6);
  transition: background 0.1s;
  cursor: pointer;
}

.pt-table tbody tr:first-child { border-top: 0; }
.pt-table tbody tr:hover { background: #f7f9ff; }

.pt-table tbody td {
  padding: 0.9rem 1.1rem;
  vertical-align: middle;
  font-size: 0.92rem;
  color: var(--text);
  border: 0;
}

.pt-cell-patient {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pt-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  background: #dce8ff;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 800;
  flex-shrink: 0;
}

.pt-avatar--discharged {
  background: #fde8e8;
  color: #93000a;
}

.pt-name {
  font-weight: 700;
  font-size: 0.92rem;
  display: block;
  line-height: 1.2;
}

.pt-age {
  font-size: 0.78rem;
  color: var(--muted);
  display: block;
}

.pt-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--primary);
  font-size: 0.8rem;
  text-decoration: none;
  transition: background 0.12s;
}

.pt-action:hover {
  background: #dce8ff;
  color: var(--primary);
}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--muted);
}

.empty-state__icon {
  font-size: 2.5rem;
  margin-bottom: 0.85rem;
  opacity: 0.4;
}

.empty-state h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  color: var(--text);
}

.empty-state p {
  margin: 0;
  font-size: 0.9rem;
}

/* ── Patient detail — hero ───────────────────────────────────── */
.patient-hero {
  background: linear-gradient(145deg, #0c1b3d, #1a3a7c);
  color: white;
  padding: 1.1rem 1rem 1.35rem;
  border-radius: 24px;
  margin: 0 0 0.75rem;
  position: relative;
  overflow: hidden;
}

.patient-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -15%;
  width: 50%;
  padding-top: 50%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,200,220,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.patient-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background: rgba(255,255,255,0.1);
  color: var(--accent);
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1px solid rgba(255,255,255,0.14);
  margin-bottom: 0.65rem;
  position: relative;
  z-index: 1;
}

.patient-hero h2 {
  color: white;
  font-size: clamp(1.25rem, 4vw, 1.65rem);
  margin: 0 0 0.25rem;
  letter-spacing: -0.01em;
  line-height: 1.15;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.patient-hero__meta {
  color: rgba(255,255,255,0.62);
  font-size: 0.75rem;
  margin: 0 0 0.85rem;
  position: relative;
  z-index: 1;
}

.patient-hero__stats {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}

.hero-stat__label {
  font-size: 0.58rem;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.hero-stat__value {
  font-size: 0.82rem;
  font-weight: 700;
  color: white;
}

.hero-stat--accent .hero-stat__value {
  color: var(--accent);
}

.hero-divider {
  width: 1px;
  height: 2rem;
  background: rgba(255,255,255,0.15);
  flex-shrink: 0;
}

/* ── Patient detail — info boxes ────────────────────────────── */
.detail-info-bar {
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}

.info-box {
  background: white;
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
}

.info-box__label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 0.2rem;
}

.info-box__value {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  line-height: 1.45;
}

.info-vitals {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}

/* ── Detail tabs ─────────────────────────────────────────────── */
.detail-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  padding: 0 1rem;
  overflow-x: auto;
  scrollbar-width: none;
  background: white;
  position: sticky;
  top: 54px;
  z-index: 9;
}

.detail-tabs::-webkit-scrollbar { display: none; }

.detail-tab {
  padding: 0.72rem 0.85rem;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  text-decoration: none;
  transition: color 0.15s;
  flex-shrink: 0;
  letter-spacing: 0.01em;
}

.detail-tab.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.detail-tab:hover:not(.is-active) {
  color: var(--text);
}

/* ── Detail content area ─────────────────────────────────────── */
.detail-body {
  padding: 0.85rem;
  display: grid;
  gap: 0.85rem;
}

.detail-section {
  display: grid;
  gap: 0.85rem;
}

.detail-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.detail-section__title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  letter-spacing: 0.01em;
}

.detail-section__hint {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Entry form (evolution / production) ─────────────────────── */
.entry-card {
  background: white;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 0.85rem;
  box-shadow: 0 2px 8px rgba(15,29,53,0.04);
}

.entry-card .form-grid {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.entry-card .field span,
.entry-card .field label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
}

.entry-card .form-control,
.entry-card .form-select {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-alt);
  padding: 0.58rem 0.75rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
}

.entry-card .form-control:focus,
.entry-card .form-select:focus {
  border-color: rgba(26,71,201,0.4);
  box-shadow: 0 0 0 3px rgba(26,71,201,0.1);
  background: white;
  outline: 0;
}

.entry-card textarea.form-control {
  min-height: 130px;
  resize: vertical;
  border-radius: 9px;
  line-height: 1.65;
}

.entry-submit {
  width: 100%;
  border: 0;
  border-radius: 9px;
  padding: 0.7rem 1rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(90deg, #1a47c9 0%, #2d5ee0 100%);
  box-shadow: 0 4px 14px rgba(26,71,201,0.22);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.entry-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(26,71,201,0.3);
}

/* ── Timeline history ────────────────────────────────────────── */
.timeline {
  display: grid;
  gap: 0.75rem;
}

.timeline-entry {
  background: white;
  border-radius: 12px;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  box-shadow: 0 2px 8px rgba(15,29,53,0.04);
}

.timeline-entry--alt {
  border-left-color: var(--accent);
}

.timeline-entry--first {
  border-left-color: #1a47c9;
  background: #f7f9ff;
}

.timeline-entry__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.timeline-entry__date {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.08rem;
}

.timeline-entry__author {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.timeline-entry__tag {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  background: #dce8ff;
  color: var(--primary);
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  flex-shrink: 0;
}

.timeline-entry__tag--muted {
  background: var(--surface-alt);
  color: var(--muted);
}

.timeline-entry__tag--current {
  background: var(--primary);
  color: white;
}

.timeline-entry__text {
  margin: 0;
  font-size: 0.8rem;
  color: #475569;
  line-height: 1.7;
}

.timeline-empty {
  background: var(--surface-alt);
  border-radius: 16px;
  padding: 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.shell-topbar__icon svg,
.patient-detail-back__icon svg,
.patient-stat-card__icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

.shell-topbar__icon--edit {
  color: #d99a12;
}

.shell-topbar__icon--edit:hover {
  background: #fff4d6;
  color: #b77900;
}

.shell-topbar__icon--logout {
  color: #5d6f8b;
}

.shell-topbar__icon--logout:hover {
  background: #eef3fb;
  color: #1a47c9;
}

.patient-detail-shell {
  min-height: 100vh;
}

.patient-detail-page {
  max-width: 780px;
  padding: 0.95rem 0.9rem 2.2rem;
}

.patient-detail-topbar {
  margin-bottom: 0.75rem;
}

.patient-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: #425b7c;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
}

.patient-detail-back:hover {
  color: var(--primary);
}

.patient-detail-back__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.8);
  border: 1px solid rgba(214,224,238,0.95);
}

.patient-hero--clean {
  background: #fff;
  color: var(--text);
  padding: 0.95rem 1rem 1rem;
  border-radius: 20px;
  border: 1px solid rgba(217,226,238,0.95);
  box-shadow: 0 12px 32px rgba(15,29,53,0.06);
  overflow: hidden;
}

.patient-hero--clean::before {
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 4px;
  padding-top: 0;
  border-radius: 0;
  background: linear-gradient(90deg, #1ca29c 0%, #2d6df0 100%);
}

.patient-hero__identity {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 0.8rem;
  position: relative;
  z-index: 1;
}

.patient-hero__avatar {
  width: 3.65rem;
  height: 3.65rem;
  border-radius: 16px;
  background: linear-gradient(135deg, #d8fff0, #bff1ea);
  color: #0c8f96;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.65rem;
  font-weight: 700;
  flex-shrink: 0;
}

.patient-hero__avatar--discharged {
  background: linear-gradient(135deg, #ffe6e6, #ffd3d3);
  color: #a12626;
}

.patient-hero__intro {
  min-width: 0;
}

.patient-hero__title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.9rem;
}

.patient-hero__intro h1 {
  margin: 0 0 0.18rem;
  color: #091b3d;
  font-size: clamp(1.28rem, 2.5vw, 1.7rem);
  line-height: 1.08;
}

.patient-hero__edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.42rem 0.82rem;
  border: 0;
  border-radius: 999px;
  background: #fff3d4;
  color: #a96200;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(210, 142, 0, 0.18);
}

.patient-hero__edit-btn:hover {
  background: #ffedbf;
}

.patient-hero__registro {
  margin: 0 0 0.75rem;
  color: #7d8eab;
  font-size: 0.82rem;
}

.patient-hero__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
}

.patient-hero__chips--secondary {
  margin-top: 0.55rem;
}

.patient-hero__chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.65rem;
  padding: 0.18rem 0.6rem;
  border-radius: 9px;
  font-size: 0.67rem;
  font-weight: 700;
  white-space: nowrap;
}

.patient-hero__chip--hospital,
.patient-hero__chip--diagnosis {
  background: #edf3ff;
  color: #2353d6;
}

.patient-hero__chip--sector {
  background: #f7eefe;
  color: #923af7;
}

.patient-hero__chip--plan {
  background: #fff4df;
  color: #c77a09;
}

.patient-hero__chip--age {
  background: #eef1f5;
  color: #4d617e;
}

.patient-hero__chip--location {
  background: #e8f7f2;
  color: #0f7f73;
}

.patient-hero__chip--birth {
  background: #f4efff;
  color: #6c46c6;
}

.patient-hero__chip--active {
  background: #e8f7ee;
  color: #109548;
}

.patient-hero__chip--discharged {
  background: #fde8e8;
  color: #a12626;
}

.patient-hero__stats--cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.patient-stat-card {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.72rem 0.8rem;
  border-radius: 14px;
  background: #f1f5fb;
}

.patient-stat-card__icon {
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.patient-stat-card__icon--mint {
  background: #d3faf0;
  color: #0e9f97;
}

.patient-stat-card__icon--blue {
  background: #e7efff;
  color: #2962ef;
}

.patient-stat-card strong {
  display: block;
  font-size: 1.2rem;
  line-height: 1;
  color: #091b3d;
}

.patient-stat-card span {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.82rem;
  color: #7d8eab;
}

.detail-tabs--pills {
  margin: 0.85rem 0 0.95rem;
  padding: 0.24rem;
  background: #fff;
  border: 1px solid rgba(217,226,238,0.95);
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(15,29,53,0.04);
  top: 66px;
}

.detail-tabs--pills .detail-tab {
  flex: 1 1 0;
  text-align: center;
  margin-bottom: 0;
  border-bottom: 0;
  border-radius: 12px;
  padding: 0.72rem 0.75rem;
  color: #425b7c;
  font-size: 0.82rem;
}

.detail-tabs--pills .detail-tab.is-active {
  background: linear-gradient(90deg, #19998f 0%, #19998f 100%);
  color: #fff;
  box-shadow: 0 8px 18px rgba(25,153,143,0.24);
}

.detail-body--clean {
  padding: 0;
  gap: 0.85rem;
}

.detail-heading h2 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  color: #091b3d;
}

.detail-heading p {
  margin: 0;
  color: #5f7495;
  font-size: 0.82rem;
}

.detail-stack {
  display: grid;
  gap: 0.75rem;
}

.detail-panel {
  background: #fff;
  border: 1px solid rgba(217,226,238,0.95);
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(15,29,53,0.04);
}

.detail-panel--compact {
  padding: 0.85rem 0.95rem;
}

.detail-panel__label {
  margin: 0 0 0.55rem;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8c9fbd;
}

.detail-panel__text {
  margin: 0;
  color: #112649;
  font-size: 0.9rem;
  line-height: 1.55;
}

.detail-panel--facts {
  background: linear-gradient(180deg, #fbfdff, #f4f8ff);
}

.detail-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.9rem;
  color: #51627d;
  font-size: 0.86rem;
  line-height: 1.55;
}

.detail-facts strong {
  color: #0f172a;
}

.entry-card--compact {
  border-radius: 20px;
  padding: 1rem;
  box-shadow: 0 10px 24px rgba(15,29,53,0.04);
}

.field--switch {
  display: flex;
  align-items: flex-end;
}

.field--switch .form-check {
  margin: 0;
  padding-left: 2.3rem;
}

.detail-textarea {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-alt);
  min-height: 160px;
  resize: vertical;
  padding: 0.85rem 1rem;
  font-size: 0.92rem;
  line-height: 1.65;
  width: 100%;
  margin-bottom: 0.85rem;
}

.detail-textarea:focus {
  border-color: rgba(26,71,201,0.4);
  box-shadow: 0 0 0 3px rgba(26,71,201,0.1);
  background: #fff;
  outline: 0;
}

.timeline--clean {
  gap: 0.9rem;
}

.timeline--clean .timeline-entry {
  border-radius: 20px;
  border-left-width: 4px;
  padding: 1rem 1.05rem;
  box-shadow: 0 10px 24px rgba(15,29,53,0.04);
}

@media (max-width: 767.98px) {
  .patient-detail-page {
    padding: 0.8rem 0.8rem 2rem;
  }

  .patient-hero--clean {
    padding: 1rem;
    border-radius: 20px;
  }

  .patient-hero__identity {
    gap: 0.8rem;
    margin-bottom: 0.85rem;
  }

  .patient-hero__avatar {
    width: 3.45rem;
    height: 3.45rem;
    border-radius: 15px;
    font-size: 1.45rem;
  }

  .patient-hero__registro {
    margin-bottom: 0.7rem;
    font-size: 0.88rem;
  }

  .patient-hero__stats--cards {
    grid-template-columns: 1fr;
  }

  .detail-tabs--pills .detail-tab {
    min-width: 8.5rem;
    flex: 0 0 auto;
  }

  .detail-panel--compact,
  .entry-card--compact,
  .timeline--clean .timeline-entry {
    padding: 0.9rem;
    border-radius: 18px;
  }
}

/* ── Monthly report ──────────────────────────────────────────── */
.report-hero {
  background: linear-gradient(145deg, #0c1b3d, #1a3a7c);
  color: white;
  padding: 1.35rem 1.25rem;
  border-radius: 18px;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
}

.report-hero::after {
  content: '';
  position: absolute;
  top: -40%;
  right: -8%;
  width: 45%;
  padding-top: 45%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,200,220,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.report-hero .eyebrow { color: var(--accent); }

.report-hero h1 {
  color: white;
  font-size: clamp(1.2rem, 3.5vw, 1.6rem);
  margin: 0.25rem 0 0.45rem;
  letter-spacing: -0.01em;
}

.report-hero p {
  color: rgba(255,255,255,0.62);
  margin: 0 0 1rem;
  font-size: 0.78rem;
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

.month-selector {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  padding: 0.6rem 1rem;
  backdrop-filter: blur(8px);
  position: relative;
  z-index: 1;
}

.month-selector__label {
  color: rgba(255,255,255,0.6);
  font-size: 0.8rem;
  font-weight: 700;
}

.month-selector select {
  background: transparent;
  border: 0;
  color: white;
  font-weight: 700;
  font-size: 0.92rem;
  font-family: "IBM Plex Mono", monospace;
  cursor: pointer;
  outline: 0;
  -webkit-appearance: none;
  appearance: none;
}

.month-selector select option { background: #1a3a7c; }

/* ── Metric cards (report) ───────────────────────────────────── */
.metric-card:not(.metric-card--highlight) {
  background: white;
  border: 1px solid var(--border);
  box-shadow: 0 3px 10px rgba(15,29,53,0.04);
}

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

.metric-card span { font-size: 0.82rem; }

/* ── Activity bars (report) ──────────────────────────────────── */
.activity-bar span {
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%) !important;
}

.activity-row {
  padding: 0.6rem 0;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 0.5rem;
}

.activity-row:first-child { border-top: 0; }

.activity-row > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.activity-row strong { font-size: 0.9rem; }
.activity-row span { font-size: 0.82rem; color: var(--muted); }

/* ── Panel cards (report) ─────────────────────────────────────── */
.panel-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 4px 14px rgba(15,29,53,0.04);
}

/* ── Table (report daily) ────────────────────────────────────── */
.report-table th {
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 0;
  padding: 0.85rem 1rem;
}

.report-table td {
  border-color: var(--border);
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  vertical-align: middle;
}

.report-table tbody tr:hover { background: #f7f9ff; }

/* ── Modal improvements ──────────────────────────────────────── */
.app-modal .modal-content {
  border: 0;
  border-radius: 24px;
  box-shadow: 0 24px 64px rgba(15,29,53,0.18);
  overflow: hidden;
}

.app-modal .modal-content > form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

.app-modal .modal-header {
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  padding: 1.1rem 1.25rem;
}

.app-modal .modal-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}

.app-modal .modal-footer {
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
  padding: 0.85rem 1.25rem;
  gap: 0.65rem;
}

.app-modal .btn-primary {
  background: linear-gradient(135deg, #1a47c9 0%, #2d5ee0 100%);
  border: 0;
  border-radius: 12px;
  font-weight: 700;
  padding: 0.65rem 1.25rem;
  box-shadow: 0 4px 14px rgba(26,71,201,0.25);
}

.app-modal .btn-light {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-weight: 700;
  color: var(--text);
  padding: 0.65rem 1.25rem;
}

.app-modal .modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  min-height: 0;
}

.app-modal .form-grid {
  gap: 0.85rem;
}

.app-modal .field .form-control,
.app-modal .field .form-select {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-alt);
  padding: 0.7rem 0.85rem;
  font-family: "IBM Plex Mono", monospace;
}

.app-modal .field .form-control:focus,
.app-modal .field .form-select:focus {
  border-color: rgba(26,71,201,0.4);
  box-shadow: 0 0 0 3px rgba(26,71,201,0.1);
  background: white;
  outline: 0;
}

/* ── Summary list (report) ───────────────────────────────────── */
.summary-list div {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.summary-list strong {
  color: var(--primary);
  font-size: 1.6rem;
}

/* ── Responsive adjustments ──────────────────────────────────── */
@media (min-width: 768px) {
  .dash-header { padding: 1.5rem 0 0; }
  .dash-search { padding: 0.85rem 0; border-bottom: 0; }
  .hospital-label { padding: 0.6rem 1.25rem 0.5rem; }
  .hospital-section { margin-left: 0; margin-right: 0; border-radius: 16px; }
  .patient-hero { padding: 2rem 1.5rem 2.25rem; border-radius: 20px; margin: 0 0 0.75rem; }
  .detail-body { padding: 1.25rem; }
  .detail-info-bar { grid-template-columns: 1fr auto; padding: 1.25rem; }
  .info-vitals { grid-template-columns: repeat(2, 1fr); }
  .detail-tabs { padding: 0 1.25rem; position: sticky; }
  .entry-card .form-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-page { padding: 0 0 3rem; }
}

@media (min-width: 768px) {
  .clinic-list-card--desktop { display: block; }
  .clinic-list-card--mobile { display: none; }
}

@media (min-width: 992px) {
  .patient-hero { border-radius: 24px; margin: 0 0 0.75rem; }
  .detail-tabs { top: 50px; }
  .dash-header__text h1 { font-size: 1.45rem; }
}

/* ── IBM Plex Mono tuning ─────────────────────────────────── */
/* Mono fonts render slightly wider — compensate with tighter spacing */
h1, h2, h3, h4, h5 {
  letter-spacing: -0.01em;
}

/* Inputs: mono font looks better at slightly larger size */
input, select, textarea, button {
  font-family: "IBM Plex Mono", monospace;
}

/* Tables: mono makes columns feel aligned by default */
.pt-table, .report-table {
  font-variant-numeric: tabular-nums;
}

/* Ensure avatar letters look correct in mono */
.patient-row__avatar,
.pt-avatar,
.shell-sidebar__avatar,
.clinic-patient-table__avatar {
  font-variant-numeric: normal;
  letter-spacing: 0;
}

/* Settings */
.settings-panel .form-control,
.settings-procedure-row .form-control {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-alt);
  padding: 0.7rem 0.85rem;
  font-family: "IBM Plex Mono", monospace;
}

.settings-panel .form-control:focus,
.settings-procedure-row .form-control:focus {
  border-color: rgba(26,71,201,0.4);
  box-shadow: 0 0 0 3px rgba(26,71,201,0.1);
  background: white;
  outline: 0;
}

.settings-inline-grid,
.settings-procedure-grid,
.settings-history-grid {
  display: grid;
  gap: 0.85rem;
}

.settings-inline-actions {
  display: flex;
  align-items: end;
  justify-content: flex-start;
}

.settings-list {
  display: grid;
  gap: 1px;
  background: var(--border);
}

.settings-card-grid {
  display: grid;
  gap: 1.25rem;
}

.settings-hub-grid {
  display: grid;
  gap: 1.25rem;
}

.settings-entry-card {
  display: grid;
  gap: 0.75rem;
  padding: 1.4rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 8px 24px rgba(15, 29, 53, 0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.settings-entry-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(15, 29, 53, 0.09);
  border-color: rgba(26, 71, 201, 0.22);
}

.settings-entry-card h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
}

.settings-entry-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.65;
}

.settings-entry-meta {
  display: grid;
  gap: 0.1rem;
}

.settings-entry-meta strong {
  font-size: 1.8rem;
  line-height: 1;
  color: var(--primary);
}

.settings-entry-meta span,
.settings-entry-note {
  color: var(--muted);
  font-size: 0.82rem;
}

.settings-page-actions {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 1rem;
}

.settings-create-form {
  padding: 1rem 1.25rem 1.1rem;
  background: #f8fbff;
}

.settings-create-grid {
  display: grid;
  gap: 0.85rem;
}

.settings-check-field {
  display: flex;
  align-items: end;
}

.settings-simple-list {
  display: grid;
  gap: 1px;
  background: var(--border);
}

.settings-simple-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.95rem 1.25rem;
  background: white;
}

.settings-simple-row strong {
  display: block;
  font-size: 0.94rem;
}

.settings-simple-row span {
  color: var(--muted);
  font-size: 0.8rem;
}

.settings-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.settings-badge.is-active {
  background: #dff7ea;
  color: #127a47;
}

.settings-subsection + .settings-subsection {
  border-top: 1px solid var(--border);
}

.settings-history-row {
  background: white;
  padding: 1rem 1.25rem;
}

.settings-history-row--new {
  background: #f8fbff;
}

.settings-history-header {
  display: grid;
  gap: 0.2rem;
  margin-bottom: 0.9rem;
}

.settings-history-header strong {
  font-size: 0.94rem;
}

.settings-history-header span {
  color: var(--muted);
  font-size: 0.8rem;
}

.settings-procedure-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.settings-procedure-main strong {
  display: block;
  font-size: 0.95rem;
}

.settings-procedure-main span {
  color: var(--muted);
  font-size: 0.8rem;
}

.settings-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--text);
}

.settings-toggle .form-check-input {
  margin: 0;
}

.settings-procedure-list {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  background: #f8fbff;
}

.settings-procedure-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  background: white;
}

.settings-toggle-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.settings-delete-form {
  margin: 0;
}

.settings-row-actions {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
}

.settings-transfer-list {
  display: grid;
  gap: 0.65rem;
}

.settings-transfer-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: start;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-alt);
  cursor: pointer;
}

.settings-transfer-option .form-check-input {
  margin-top: 0.15rem;
}

.settings-transfer-option strong {
  display: block;
  font-size: 0.92rem;
}

.settings-transfer-option small {
  color: var(--muted);
  font-size: 0.78rem;
}

.settings-history-stack {
  display: grid;
  gap: 1px;
  background: var(--border);
}

.field-error {
  color: #b42318;
  font-size: 0.78rem;
  margin-top: 0.35rem;
}

@media (min-width: 768px) {
  .settings-hub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-card-grid {
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    align-items: start;
  }

  .settings-create-grid {
    grid-template-columns: minmax(180px, 1.7fr) minmax(110px, 0.7fr) minmax(130px, 0.8fr) auto;
    align-items: end;
  }

  .settings-create-grid--procedure {
    grid-template-columns: minmax(220px, 1.6fr) minmax(100px, 0.5fr) minmax(130px, 0.7fr) minmax(160px, 0.8fr) minmax(160px, 0.8fr) minmax(110px, 0.6fr) auto;
  }

  .settings-inline-grid {
    grid-template-columns: minmax(220px, 320px) auto;
  }

  .settings-procedure-grid {
    grid-template-columns: minmax(180px, 220px) minmax(180px, 220px) minmax(180px, 220px) auto;
    align-items: end;
  }

  .settings-history-grid {
    display: grid;
    grid-template-columns: minmax(180px, 220px) minmax(180px, 220px) minmax(180px, 220px) auto;
    gap: 0.85rem;
    align-items: end;
  }

  .settings-history-grid--hospital {
    grid-template-columns: minmax(220px, 1.7fr) minmax(110px, 0.7fr) minmax(120px, 0.8fr) auto;
  }
}
