:root {
  color-scheme: light;
  --green: #00c578;
  --green-strong: #07965f;
  --ink: #0b1510;
  --deep: #071009;
  --panel: rgba(255, 255, 252, 0.9);
  --line: rgba(14, 31, 24, 0.12);
  --muted: #68756e;
  --warning: #936600;
  --shadow: 0 24px 58px rgba(7, 16, 9, 0.14);
}

@media (max-width: 760px) {
  .onboarding-shell { grid-template-columns: 1fr; }
  .onboarding-aside { min-height: 260px; gap: 30px; }
  .onboarding-grid { grid-template-columns: 1fr; }
  .onboarding-full { grid-column: auto; }
  .registration-grid { grid-template-columns: 1fr; }
  .registration-wide { grid-column: auto; }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.onboarding { position: fixed; inset: 0; z-index: 50; overflow: auto; background: #f5f8f5; }
.onboarding-shell { min-height: 100%; display: grid; grid-template-columns: minmax(280px, 36%) minmax(0, 1fr); }
.onboarding-aside { background: var(--ink); color: white; padding: clamp(32px, 6vw, 72px); display: flex; flex-direction: column; justify-content: space-between; gap: 64px; }
.onboarding-brand { padding: 0; }
.onboarding-aside h1 { font-size: clamp(38px, 5vw, 66px); line-height: 1; margin: 0 0 18px; max-width: 520px; }
.onboarding-aside p:not(.label) { color: rgba(255, 255, 255, .72); max-width: 500px; font-size: 17px; line-height: 1.55; }
.onboarding-main { display: grid; place-items: center; padding: clamp(28px, 6vw, 72px); }
.wizard { width: min(660px, 100%); }
.wizard-progress { display: flex; gap: 8px; margin-bottom: 28px; }
.wizard-progress span { height: 5px; flex: 1; border-radius: 99px; background: #dce4df; }
.wizard-progress span.done { background: var(--green); }
.wizard-step { display: none; }
.wizard-step.active { display: block; animation: onboarding-enter .18s ease; }
.wizard-step h2 { font-size: clamp(30px, 4vw, 44px); margin: 8px 0 14px; }
.wizard-step > p:not(.label) { color: var(--muted); font-size: 17px; line-height: 1.55; margin: 0 0 24px; }
.onboarding-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.onboarding-full { grid-column: 1 / -1; }
.trust-note { border: 1px solid rgba(0, 197, 120, .35); background: rgba(0, 197, 120, .09); padding: 16px; border-radius: 14px; line-height: 1.5; }
.summary-list { display: grid; gap: 10px; margin-bottom: 28px; }
.summary-list div { display: grid; grid-template-columns: 120px 1fr; gap: 12px; border-bottom: 1px solid var(--line); padding: 12px 0; }
.summary-list span { color: var(--muted); font-size: 13px; font-weight: 800; }
.summary-list strong { overflow-wrap: anywhere; }
.registration-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.registration-wide { grid-column: 1 / -1; }
.check-row { display: flex; gap: 8px; align-items: center; margin: 16px 0; font-weight: 750; }
@keyframes onboarding-enter { from { opacity: .25; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 4%, rgba(0, 197, 120, 0.18), transparent 28%),
    linear-gradient(135deg, #f9faf5 0%, #eef4ee 100%);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr);
  background: #f6f8f5;
}

.login-visual {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(32px, 6vw, 76px);
  overflow: hidden;
  position: relative;
  color: #fff;
  background:
    radial-gradient(circle at 82% 18%, rgba(0, 197, 120, .34), transparent 30%),
    radial-gradient(circle at 12% 90%, rgba(0, 197, 120, .18), transparent 34%),
    var(--deep);
}

.login-visual::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -190px;
  bottom: -170px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 50%;
  box-shadow: 0 0 0 58px rgba(255, 255, 255, .025), 0 0 0 116px rgba(255, 255, 255, .02);
}

.login-brand { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.login-brand img { width: 66px; height: 66px; object-fit: contain; }
.login-brand strong { font-size: 23px; }
.login-promise { max-width: 720px; position: relative; z-index: 1; }
.login-promise .label { color: var(--green); }
.login-promise h1 { margin: 12px 0 22px; max-width: 680px; font-size: clamp(44px, 6vw, 82px); line-height: .98; letter-spacing: -.045em; }
.login-promise > p:last-child { max-width: 610px; margin: 0; color: rgba(255, 255, 255, .68); font-size: clamp(16px, 1.5vw, 20px); line-height: 1.55; }
.login-highlights { display: flex; flex-wrap: wrap; gap: 10px; position: relative; z-index: 1; }
.login-highlights span { padding: 9px 13px; border: 1px solid rgba(255, 255, 255, .13); border-radius: 999px; color: rgba(255, 255, 255, .72); font-size: 13px; font-weight: 800; }
.login-entry { min-height: 100vh; display: grid; place-items: center; padding: clamp(24px, 6vw, 72px); }
.login-card { width: min(480px, 100%); padding: clamp(28px, 5vw, 52px); border: 1px solid var(--line); border-radius: 30px; background: rgba(255, 255, 252, .94); box-shadow: var(--shadow); }
.login-card h2 { margin: 8px 0 12px; font-size: clamp(32px, 4vw, 46px); letter-spacing: -.035em; }
.login-card > p:not(.label, .login-message, .login-privacy) { margin: 0 0 28px; color: var(--muted); font-size: 16px; line-height: 1.55; }
.login-email-field { margin-bottom: 14px; }
.login-email-field input { min-height: 56px; font-size: 16px; }
.login-submit { width: 100%; min-height: 56px; margin-top: 6px; }
.login-message { margin: 0 0 10px; padding: 11px 13px; border-radius: 12px; color: #8a2c20; background: #fff0ed; font-size: 13px; line-height: 1.4; }
.login-privacy { margin: 18px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; }
.login-signup { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); text-align: center; }
.login-signup p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.login-signup-link { display: flex; align-items: center; justify-content: center; min-height: 48px; text-decoration: none; }
.login-signup small { display: block; margin-top: 12px; color: var(--muted); font-size: 12px; line-height: 1.5; }

@media (max-width: 860px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-visual { min-height: 42vh; padding: 28px 24px 38px; gap: 54px; }
  .login-promise h1 { font-size: clamp(38px, 11vw, 60px); }
  .login-highlights { display: none; }
  .login-entry { min-height: auto; padding: 24px 18px 44px; }
  .login-card { margin-top: -42px; position: relative; z-index: 2; border-radius: 24px; }
}

.app-shell {
  width: min(1360px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 20px 0 42px;
}

.pillbar,
.panel,
.next-card,
.assist-panel,
.metrics article,
.settings-hero {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.pillbar {
  position: relative;
  z-index: 30;
  display: flex;
  width: min(1120px, calc(100% - 48px));
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 78px;
  margin: 0 auto 26px;
  padding: 14px 18px;
  border-radius: 999px;
  background: rgba(7, 16, 9, 0.93);
  color: #fff;
}

.panel[data-panel="agenda"] {
  width: calc(100vw - 24px);
  min-height: calc(100vh - 230px);
  margin-left: 50%;
  padding: 26px;
  transform: translateX(-50%);
  border-radius: 26px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 190px;
  gap: 14px;
}

.brand img {
  width: 62px;
  height: 62px;
  object-fit: contain;
  filter:
    drop-shadow(0 0 3px rgba(0, 255, 154, 0.3))
    drop-shadow(0 0 8px rgba(0, 197, 120, 0.18));
  transition: filter 180ms ease, transform 180ms ease;
}

.brand:hover img {
  filter:
    drop-shadow(0 0 7px rgba(82, 255, 187, 0.82))
    drop-shadow(0 0 20px rgba(0, 197, 120, 0.52));
  transform: scale(1.04);
}

.brand strong,
.brand span,
.connection-box span,
.connection-box strong,
.event-title,
.event-meta,
.activity strong,
.activity p {
  display: block;
}

.brand strong {
  font-size: 21px;
}

.brand span {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.pill-links {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}

.pill-links button {
  min-height: auto;
  padding: 12px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font: inherit;
  font-weight: 800;
  white-space: nowrap;
}

.pill-links button.active,
.pill-links button:hover {
  background: var(--green);
  color: #04120b;
}

.nav-more { position: relative; }
.nav-more summary {
  padding: 12px 16px;
  border-radius: 999px;
  color: rgba(255, 255, 255, .72);
  font-weight: 800;
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more summary::after { content: " ▾"; font-size: 11px; }
.nav-more[open] summary,
.nav-more.has-active summary,
.nav-more summary:hover { background: var(--green); color: #04120b; }
.nav-more-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 10px);
  right: 0;
  display: grid;
  min-width: 190px;
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 18px;
  background: rgba(7, 16, 9, .98);
  box-shadow: var(--shadow);
}
.pill-links .nav-more-menu button { width: 100%; text-align: left; }
.pill-links .nav-more-menu button:disabled { color: rgba(255, 255, 255, .38); cursor: not-allowed; }

.menu-button {
  display: grid;
  width: 52px;
  height: 52px;
  min-height: 52px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 22px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.hero p,
.label,
.next-card p,
.assist-panel p,
.activity p {
  margin: 0;
}

.hero p {
  color: var(--muted);
  font-weight: 700;
}

.hero h1 {
  margin: 6px 0 0;
  font-size: 44px;
  line-height: 1.05;
  letter-spacing: 0;
}

.actions,
.card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary {
  border-color: transparent;
  background: var(--green);
  color: #04120b;
  box-shadow: 0 14px 30px rgba(0, 197, 120, 0.24);
}

.secondary {
  background: rgba(255, 255, 255, 0.72);
}

.focus {
  display: grid;
  grid-template-columns: 1.55fr 0.9fr;
  gap: 18px;
  margin-bottom: 14px;
}

.next-card,
.assist-panel,
.panel,
.metrics article,
.settings-hero {
  border-radius: 22px;
  background: var(--panel);
}

.next-card {
  min-height: 240px;
  padding: 26px;
  background:
    linear-gradient(135deg, rgba(7, 16, 9, 0.98), rgba(12, 64, 41, 0.96)),
    var(--deep);
  color: #fff;
}

.label {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.next-time {
  margin-top: 20px;
  color: var(--green);
  font-size: 18px;
  font-weight: 900;
}

.next-card h2,
.assist-panel h2,
.panel h2 {
  margin: 8px 0 8px;
}

.next-card h2 {
  font-size: 32px;
}

.next-card p {
  color: rgba(255, 255, 255, 0.68);
}

.card-actions {
  margin-top: 24px;
}

.card-actions button {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.14);
}

.assist-panel {
  padding: 26px;
}

.assist-panel h2 {
  font-size: 28px;
}

.assist-panel p:not(.label) {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.connection-box {
  margin-top: 22px;
  padding: 14px;
  border: 1px solid rgba(0, 197, 120, 0.28);
  border-radius: 16px;
  background: rgba(0, 197, 120, 0.1);
}

.connection-box span {
  color: var(--green-strong);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.connection-box strong {
  margin-top: 8px;
}

.connection-box.disconnected {
  border-color: rgba(147, 102, 0, 0.28);
  background: rgba(255, 247, 223, 0.82);
}

.connection-box.disconnected span {
  color: var(--warning);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.metrics article {
  padding: 18px 22px;
}

.metrics strong {
  display: block;
  font-size: 36px;
}

.metrics span {
  color: var(--muted);
  font-weight: 700;
}

.grid {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 18px;
}

.panel {
  padding: 22px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel h2 {
  font-size: 26px;
}

.message {
  margin: 12px 0;
  color: var(--muted);
  font-weight: 700;
}

.timeline,
.activity,
.provider-strip,
.patient-list,
.task-list,
.slot-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li,
.activity li,
.patient-list li,
.task-list li,
.slot-list li {
  display: grid;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.timeline li {
  grid-template-columns: 94px 1fr auto;
}

.event-time {
  color: var(--green-strong);
  font-weight: 900;
}

.event-title {
  font-weight: 900;
}

.event-meta,
.activity p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.event-pill {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(0, 197, 120, 0.14);
  color: var(--green-strong);
  font-weight: 900;
  white-space: nowrap;
}

.timeline li.has-provider-color { border-left: 5px solid var(--provider-color); }
.event-pill.provider-category { background: var(--provider-color); color: var(--provider-foreground, var(--ink)); }

.activity li {
  grid-template-columns: 12px 1fr;
}

.patient-list li {
  grid-template-columns: 1fr auto;
}

.patient-search {
  display: grid;
  gap: 6px;
  max-width: 420px;
  margin: 14px 0;
}
.patient-search span { color: var(--muted); font-size: 12px; font-weight: 800; }
.patient-search input { min-height: 42px; }

.task-list li {
  grid-template-columns: 1fr auto;
}

.task-list strong { display: block; }
.task-list span { display: block; margin-top: 4px; color: var(--muted); font-size: 14px; }
.task-actions { display: flex; align-items: center; gap: 8px; }
.task-completed { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.task-completed li { opacity: .7; }
.today-tasks { grid-column: 1 / -1; }

.patient-summary {
  display: grid;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.patient-summary:hover strong,
.patient-summary:focus-visible strong {
  color: var(--green-strong);
}

.patient-summary:focus-visible {
  outline: 3px solid rgba(0, 197, 120, 0.36);
  outline-offset: 5px;
  border-radius: 8px;
}

.patient-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.slot-planner {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.46);
}

.slot-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.mini-field {
  display: grid;
  gap: 6px;
}

.mini-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.mini-field select {
  min-height: 42px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.slot-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.slot-list li {
  grid-template-columns: 1fr auto;
}

.slot-list strong,
.slot-list span {
  display: block;
}

.slot-list span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.slot-list button {
  min-height: 38px;
  padding-inline: 12px;
  border-radius: 10px;
}

.calendar-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(190px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding: 10px;
  border: 0;
  background: transparent;
}

.compact-day {
  min-width: 190px;
  min-height: clamp(440px, calc(100vh - 390px), 680px);
  overflow: hidden;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
}

.compact-day.today { border-color: rgba(0, 197, 120, 0.62); box-shadow: inset 0 0 0 1px rgba(0, 197, 120, 0.22); }
.compact-event-card.has-patient-response { position: relative; padding-right: 88px; }
.compact-event-card .patient-response { position: absolute; top: 7px; right: 6px; max-width: 76px; margin: 0; text-align: center; }
.patient-response { padding: 4px 6px; border-radius: 7px; background: #edf1ef; color: #34473e; font-size: 10px; line-height: 1.3; font-weight: 750; }
.patient-response-accepted { background: #dff9ed; color: #075c3d; }
.patient-response-declined { background: #fde8e7; color: #8b2521; }
.patient-response-tentative { background: #fff4d8; color: #725000; }
.timeline .patient-response { justify-self: end; }
.event-pill .patient-response { display: block; margin-top: 5px; }

.agenda-toolbar .agenda-now { margin-left: auto; padding: 7px 10px; border-radius: 10px; background: #dff9ed; color: #075c3d; font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.compact-event-card.appointment-current,
.timeline li.appointment-current { outline: 2px solid #075c3d; outline-offset: -2px; box-shadow: 0 0 0 3px rgba(0, 197, 120, .16); }
.compact-event-card .current-appointment-label,
.timeline .current-appointment-label { width: fit-content; padding: 3px 6px; border-radius: 6px; background: #075c3d; color: #fff; font-size: 11px; font-weight: 800; }

.compact-day-head {
  display: grid;
  width: 100%;
  min-height: 48px;
  padding: 6px;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: rgba(7, 16, 9, 0.04);
}

.compact-day-head span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.compact-day-head strong { font-size: 18px; font-weight: 700; }
.compact-day.today .compact-day-head { background: rgba(0, 197, 120, 0.12); color: var(--green-strong); }
.compact-day-summary { padding: 7px 4px; color: var(--muted); font-size: 12px; text-align: center; }
.compact-visit-list { display: grid; min-width: 0; gap: 6px; }

.compact-event-card,
.compact-free-block {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  padding: 7px 9px;
  border-radius: 10px;
  text-align: left;
}

.compact-event-card {
  overflow: hidden;
  border: 0;
  border-left: 4px solid #7986cb;
  background: #eeedfc;
  color: var(--ink);
}

.compact-event-card:hover { background: #e4e2fa; transform: translateY(-1px); }
.compact-event-card.event-online { border-left-color: #d89a20; background: #fff4d8; }
.compact-event-card.event-online:hover { background: #ffedbd; }
.compact-event-card.event-cancelled { border-left-color: var(--danger); background: #fde8e7; }
.compact-event-card.event-cancelled:hover { background: #f9dcda; }
.compact-event-card.has-provider-color {
  border-left-color: var(--provider-color);
  background: color-mix(in srgb, var(--provider-color) 23%, white);
  color: var(--provider-foreground, var(--ink));
}
.compact-event-card.has-provider-color:hover { background: color-mix(in srgb, var(--provider-color) 34%, white); }
.compact-event-card.has-provider-color span { color: currentColor; opacity: .72; }

.compact-event-card strong,
.compact-event-card span { display: block; }
.compact-event-card strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.compact-event-card span { margin-top: 3px; color: var(--brand-text); font-size: 11px; font-weight: 700; line-height: 1.2; }
.compact-event-card small { display: block; margin-top: 3px; color: rgba(4, 18, 11, 0.68); font-size: 10px; font-weight: 650; line-height: 1.15; }

.compact-free-block {
  border: 2px solid rgba(0, 197, 120, 0.78);
  background: transparent;
  color: var(--green-strong);
  font-size: 14px;
  font-weight: 800;
}

.compact-free-block:hover { background: rgba(0, 197, 120, 0.1); transform: translateY(-1px); }

.agenda-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.agenda-toolbar > strong { font-size: 18px; }
.agenda-toolbar > span { color: var(--muted); font-size: 15px; font-weight: 700; }

.icon-button { width: 44px; padding: 0; font-size: 24px; }

.agenda-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.agenda-main { min-width: 0; }

.mini-calendar {
  position: sticky;
  top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
}

.mini-calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.mini-calendar-head strong { text-transform: capitalize; }
.mini-calendar-head div { display: flex; gap: 5px; }
.mini-calendar-head .icon-button { width: 34px; min-height: 34px; font-size: 19px; }

.mini-calendar-weekdays,
.mini-calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.mini-calendar-weekdays { margin-bottom: 5px; }
.mini-calendar-weekdays span { color: var(--muted); font-size: 11px; font-weight: 900; text-align: center; }

.mini-calendar-day {
  min-height: 31px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-size: 12px;
}

.mini-calendar-day.outside { color: rgba(104, 117, 110, 0.38); }
.mini-calendar-day.selected-week { background: rgba(0, 197, 120, 0.12); color: var(--green-strong); }
.mini-calendar-day.today { background: var(--green); color: #04120b; }
.mini-calendar-day:hover { background: rgba(0, 197, 120, 0.24); transform: translateY(-1px); }

.calendar-corner,
.calendar-day-head {
  display: grid;
  place-items: center;
  min-width: 132px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.calendar-corner {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 76px;
  background: rgba(249, 250, 245, 0.96);
}

.calendar-day-head.today {
  color: var(--green-strong);
}

.calendar-hour-rail {
  position: sticky;
  left: 0;
  z-index: 2;
  display: grid;
  grid-template-rows: repeat(var(--calendar-hours), 1fr) 0;
  min-width: 76px;
  border-right: 1px solid var(--line);
  background: rgba(249, 250, 245, 0.96);
}

.calendar-hour-rail time {
  display: block;
  padding: 8px 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.calendar-day-column {
  position: relative;
  min-width: 132px;
  border-right: 1px solid var(--line);
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(14, 31, 24, 0.08) 0,
      rgba(14, 31, 24, 0.08) 1px,
      transparent 1px,
      transparent calc(100% / var(--calendar-hours))
    );
}

.calendar-day-column:last-child {
  border-right: 0;
}

.calendar-hour-line {
  display: none;
}

.calendar-event-block,
.calendar-slot-block {
  position: absolute;
  left: 8px;
  right: 8px;
  overflow: hidden;
  border-radius: 8px;
}

.calendar-event-block {
  padding: 8px 9px;
  border: 1px solid rgba(7, 150, 95, 0.24);
  background: linear-gradient(135deg, rgba(0, 197, 120, 0.92), rgba(7, 150, 95, 0.92));
  color: #04120b;
  box-shadow: 0 12px 26px rgba(0, 197, 120, 0.18);
}

.calendar-event-block strong,
.calendar-event-block span {
  display: block;
}

.calendar-event-block strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event-block span {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 700;
  opacity: 0.72;
}

.calendar-slot-block {
  display: grid;
  min-height: 28px;
  padding: 0 6px;
  place-items: center;
  border: 1px dashed rgba(7, 150, 95, 0.48);
  background: rgba(0, 197, 120, 0.08);
  color: var(--green-strong);
  font-size: 12px;
  box-shadow: none;
}

.calendar-slot-block:disabled {
  opacity: 0.35;
}

.patient-list strong,
.patient-meta {
  display: block;
}

.patient-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.patient-list em {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(0, 197, 120, 0.14);
  color: var(--green-strong);
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.patient-actions button {
  min-height: 38px;
  padding-inline: 12px;
  border-radius: 10px;
}

.patient-profile-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(0, 197, 120, 0.28);
  border-radius: 14px;
  background: rgba(0, 197, 120, 0.08);
}

.patient-profile-status span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.patient-profile-status strong {
  color: var(--green-strong);
}

.patient-profile {
  display: grid;
  gap: 18px;
}

.profile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.profile-head h2,
.profile-section h3 { margin: 0; }

.profile-contact,
.profile-module-note p { margin: 6px 0 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }

.profile-contact { display: flex; gap: 8px; align-items: center; }
.profile-contact-action { display: inline-grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 12px; background: #fff; transition: border-color 160ms ease, background 160ms ease, transform 160ms ease; }
.profile-contact-action:hover { transform: translateY(-1px); }
.profile-contact-action svg { width: 24px; height: 24px; }
.profile-contact-whatsapp { border-color: #BFE9D0; }
.profile-contact-whatsapp:hover { border-color: #25D366; background: #F2FCF6; }
.profile-contact-email { border-color: #D9E0F2; }
.profile-contact-email:hover { border-color: #7B91D0; background: #F7F9FE; }

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.profile-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.profile-summary-grid > div,
.profile-list {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7, 16, 9, 0.025);
}

.profile-summary-grid span { color: var(--muted); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.profile-summary-grid strong { overflow-wrap: anywhere; }

.profile-data-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(147, 102, 0, 0.28);
  border-radius: 14px;
  background: rgba(255, 201, 52, 0.12);
  color: #74510a;
  font-weight: 750;
}

.profile-section { padding-top: 4px; }
.profile-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.profile-section h3 { font-size: 18px; }
.profile-notes { min-height: 62px; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(7, 16, 9, 0.025); white-space: pre-wrap; line-height: 1.45; }
.profile-detail-grid { margin: 0; }
.profile-list { color: var(--ink); line-height: 1.45; }
.profile-list.muted { color: var(--muted); }
.payment-history { gap: 0; padding: 0 14px; overflow: hidden; }
.payment-history-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.payment-history-row:last-child { border-bottom: 0; }
.payment-history-details { display: grid; gap: 1px; min-width: 0; }
.payment-history-details strong { font-size: 14px; font-weight: 750; }
.payment-history-details span { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.payment-history-amount { flex: 0 0 auto; color: var(--green-strong); font-size: 15px; font-variant-numeric: tabular-nums; }
.profile-module-note { border-top: 1px solid var(--line); }
.profile-close-action { padding-top: 4px; }

.agenda-context {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(0, 197, 120, 0.28);
  border-radius: 16px;
  background: rgba(0, 197, 120, 0.1);
}

.agenda-context strong,
.agenda-context span {
  display: block;
}

.agenda-context span {
  margin-top: 4px;
  color: var(--muted);
}

.provider-strip {
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 16px;
}

.provider-card {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.68);
}

.provider-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--provider-color);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--provider-color) 18%, transparent);
}

.provider-card strong,
.provider-card p {
  display: block;
}

.provider-card strong {
  font-size: 14px;
}

.provider-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.provider-card em {
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(104, 117, 110, 0.12);
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.provider-card.connected em {
  background: rgba(0, 197, 120, 0.14);
  color: var(--green-strong);
}

.activity li span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 7px rgba(0, 197, 120, 0.12);
}

.module-panel {
  min-height: 340px;
}

.module-panel p:not(.label) {
  max-width: 680px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}

.module-copy {
  margin: -4px 0 16px;
}

.patient-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.import-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0; }
.import-summary article { padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: rgba(0,197,120,.06); }
.import-summary span, .import-summary strong { display: block; }
.import-summary span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.import-summary strong { margin-top: 4px; font-size: 22px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.file-picker { display: flex; align-items: center; gap: 13px; min-height: 74px; margin-top: 8px; padding: 12px 14px; border: 1px dashed rgba(7, 150, 95, .48); border-radius: 16px; background: linear-gradient(135deg, rgba(0,197,120,.09), rgba(255,255,255,.82)); cursor: pointer; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.file-picker:hover { border-color: var(--green-strong); background: linear-gradient(135deg, rgba(0,197,120,.15), rgba(255,255,255,.95)); transform: translateY(-1px); }
.visually-hidden:focus + .file-picker { outline: 3px solid rgba(0,197,120,.35); outline-offset: 3px; }
.file-picker-icon { display: grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; border-radius: 13px; background: var(--deep); color: var(--green); font-size: 24px; font-weight: 900; }
.file-picker-copy { display: grid; min-width: 0; gap: 3px; }
.file-picker-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-picker-copy small { overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.file-picker-action { margin-left: auto; padding: 8px 10px; border-radius: 999px; background: rgba(7,16,9,.08); font-size: 12px; font-weight: 850; }
.file-picker-icon { border: 1px solid rgba(7,150,95,.2); background: rgba(0,197,120,.14); color: var(--green-strong); font-size: 11px; letter-spacing: .04em; }
#patientImportDialog { overflow-x: hidden; }

.reactivation-view { min-height: 520px; }
.reactivation-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 14px 0; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.62); }
.reactivation-controls .field { min-width: 175px; margin: 0; }
.reactivation-controls button { min-height: 42px; }
.billing-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 14px 0; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.62); }
.billing-controls .field { min-width: 170px; margin: 0; }
.billing-controls button { min-height: 42px; }
.billing-range { margin: 8px 0 12px; color: var(--muted); font-size: 13px; }
.billing-list li { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.billing-list li span { color: var(--muted); font-size: 13px; }
.dashboard-trend { margin-top: 18px; }
.dashboard-trend h3 { margin-bottom: 10px; }
.dashboard-trend li { display: flex; justify-content: space-between; gap: 12px; }
.reactivation-explainer { margin: 8px 0 18px; padding: 18px 20px; border: 1px solid rgba(0, 197, 120, .25); border-radius: 18px; background: rgba(0, 197, 120, .06); }
.reactivation-explainer h3 { margin: 0 0 8px; }
.reactivation-explainer p, .reactivation-explainer ul { margin: 0; color: var(--muted); line-height: 1.5; }
.reactivation-explainer ul { margin-top: 10px; padding-left: 20px; }
.reactivation-summary { display: grid; grid-template-columns: repeat(7, minmax(105px, 1fr)); gap: 7px; margin: 12px 0; }
.reactivation-summary article { padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.65); }
.reactivation-summary span, .reactivation-summary strong { display: block; }
.reactivation-summary span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.reactivation-summary strong { margin-top: 3px; font-size: 16px; }
.reactivation-board { display: grid; grid-template-columns: 1fr; gap: 9px; padding-bottom: 8px; }
.reactivation-column { min-height: 0; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: rgba(7,16,9,.035); }
.reactivation-column-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.reactivation-column-head h3 { margin: 0; font-size: 13px; }
.reactivation-column-head span { display: grid; min-width: 21px; min-height: 21px; place-items: center; border-radius: 999px; background: rgba(0,197,120,.16); color: var(--green-strong); font-size: 10px; font-weight: 900; }
.reactivation-column-list { display: grid; grid-template-columns: 1fr; gap: 5px; margin-top: 7px; }
.reactivation-card { display: grid; grid-template-columns: minmax(125px, .8fr) minmax(150px, 1fr) minmax(150px, 1.2fr) minmax(120px, .8fr) auto; grid-template-areas: "select name visit contact actions"; gap: 8px; align-items: center; padding: 7px 9px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.86); font-size: 12px; }
.reactivation-card[data-mode="prepared"], .reactivation-card[data-mode="sent"], .reactivation-card[data-mode="recovered"] { grid-template-areas: "name visit contact status actions"; }
.reactivation-card strong, .reactivation-card span { display: block; overflow-wrap: anywhere; }
.reactivation-card.selected { border-color: var(--green-strong); box-shadow: inset 0 0 0 1px var(--green-strong); }
.reactivation-select { grid-area: select; display: flex; gap: 5px; align-items: center; margin: 0; color: var(--muted); font-size: 10px; font-weight: 750; }
.reactivation-select input { accent-color: var(--green-strong); }
.reactivation-name { grid-area: name; font-size: 12px; }
.reactivation-card p.reactivation-visit { grid-area: visit; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.25; }
.reactivation-contact { grid-area: contact; color: var(--muted); font-size: 10px; }
.reactivation-status { grid-area: status; color: var(--muted); font-size: 10px; }
.reactivation-actions { grid-area: actions; display: flex; flex-wrap: nowrap; gap: 4px; margin: 0; }
.reactivation-actions button { min-height: 28px; padding: 5px 7px; font-size: 10px; white-space: nowrap; }
.reactivation-discarded { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }

.settings-view {
  display: grid;
  gap: 18px;
}

.settings-hero {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  padding: 26px;
  background:
    linear-gradient(135deg, rgba(255, 255, 252, 0.92), rgba(234, 247, 240, 0.92)),
    var(--panel);
}

.settings-hero h2 {
  margin: 8px 0;
  font-size: 34px;
}

.settings-hero p:not(.label) {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}

.settings-status {
  min-width: 250px;
  align-self: stretch;
  padding: 18px;
  border: 1px solid rgba(0, 197, 120, 0.24);
  border-radius: 18px;
  background: rgba(0, 197, 120, 0.1);
}

.settings-status span,
.settings-status strong {
  display: block;
}

.settings-status span {
  color: var(--green-strong);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.settings-status strong {
  margin-top: 10px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}

.settings-tabs {
  position: sticky;
  top: 10px;
  z-index: 8;
  display: flex;
  gap: 7px;
  padding: 8px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(248, 250, 247, .94);
  box-shadow: 0 10px 28px rgba(20, 45, 34, .08);
  backdrop-filter: blur(12px);
  scrollbar-width: thin;
}

.settings-tabs button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 14px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
  cursor: pointer;
}

.settings-tabs button.active {
  background: var(--ink);
  color: white;
}

.settings-panel[hidden] { display: none; }

.settings-panel {
  min-height: 320px;
}

.settings-wide {
  grid-column: 1 / -1;
  min-height: auto;
}

.service-catalog { display: grid; gap: 12px; margin-top: 18px; }
.service-catalog-row { display: grid; grid-template-columns: 1.3fr .8fr .8fr .65fr .65fr auto auto; gap: 10px; align-items: end; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 252, .58); }
.service-catalog-row .check-row { margin: 0 0 10px; white-space: nowrap; }
@media (max-width: 1000px) { .service-catalog-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 620px) { .service-catalog-row { grid-template-columns: 1fr 1fr; } }

.module-settings-index { min-height: auto; }
.module-settings-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.module-settings-item { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 252, .58); }
.module-settings-item strong, .module-settings-item span:not(.module-state) { display: block; }
.module-settings-item span:not(.module-state) { margin-top: 3px; color: var(--muted); font-size: 13px; line-height: 1.35; }
.module-settings-item button { grid-column: 1 / -1; justify-self: start; }
.module-state { justify-self: end; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 900; text-transform: uppercase; }
.module-state.ready { color: #08734a; background: rgba(0, 197, 120, .14); }
.module-state.pending { color: #936600; background: rgba(246, 191, 38, .18); }
.module-dependency { display: block; margin-top: 6px; color: #936600; font-size: 12px; line-height: 1.35; }
.module-settings-item.is-locked { opacity: .72; }
.payment-method-catalog { display: grid; gap: 10px; margin: 18px 0; }
.reactivation-heading-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.reactivation-heading-actions button { white-space: nowrap; }
.payment-method-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 252, .58); }
.payment-method-row .check-row { margin: 0 0 10px; }
@media (max-width: 620px) { .payment-method-row { grid-template-columns: 1fr 1fr; } .payment-method-row button { grid-column: 1 / -1; justify-self: start; } }
@media (max-width: 1000px) { .module-settings-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .module-settings-list { grid-template-columns: 1fr; } }

.settings-provider-list,
.privacy-list {
  display: grid;
  gap: 12px;
}

.session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: -6px 0 16px;
}

.settings-provider-list .provider-card {
  grid-template-columns: 12px 1fr auto auto;
}

.settings-provider-list button {
  min-height: 38px;
  padding-inline: 14px;
  border-radius: 10px;
}

.provider-connection {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.muted-action {
  color: var(--muted);
}

.setting-row,
.privacy-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.setting-row:first-of-type {
  padding-top: 10px;
}

.setting-row:last-child,
.privacy-list div:last-child {
  border-bottom: 0;
}

.setting-row strong,
.privacy-list strong {
  display: block;
}

.setting-row p,
.privacy-list span {
  display: block;
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.segmented-control {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
}

.segmented-control button {
  min-height: 36px;
  padding-inline: 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
}

.segmented-control button.active {
  background: var(--green);
}

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 54px;
  height: 32px;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: rgba(104, 117, 110, 0.22);
}

.switch span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 12px rgba(7, 16, 9, 0.18);
  transition: transform 160ms ease;
}

.switch input:checked + span {
  background: var(--green);
}

.switch input:checked + span::after {
  transform: translateX(22px);
}

.color-source-toggle { display: block; margin: 14px 0; font-weight: 750; }
.color-mapping-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.color-mapping-grid select { width: 100%; }

dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: min(88vh, 820px);
  overflow: auto;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: transparent;
  scrollbar-width: thin;
  scrollbar-color: var(--green) transparent;
}

#patientProfileDialog { width: min(860px, calc(100vw - 32px)); }

dialog::-webkit-scrollbar { width: 14px; }
dialog::-webkit-scrollbar-track { margin: 18px 3px 18px 0; background: transparent; }
dialog::-webkit-scrollbar-thumb { min-height: 64px; border: 4px solid transparent; border-radius: 999px; background: linear-gradient(180deg, var(--green), #08a765) padding-box; box-shadow: 0 2px 8px rgba(0, 197, 120, 0.3); }
dialog::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #14df93, var(--green-strong)) padding-box; }
dialog::-webkit-scrollbar-button { display: none; }

dialog::backdrop {
  background: rgba(7, 16, 9, 0.42);
  backdrop-filter: blur(6px);
}

.dialog-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fffefa;
  box-shadow: var(--shadow);
}

.dialog-card p:not(.label) {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.field span,
.field > label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.field input,
.field select {
  min-height: 44px;
  width: 100%;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font: inherit;
}

.form-draft { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 22px; }
.form-draft-wide { grid-column: 1 / -1; }
.form-draft-options { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.form-draft-options legend { padding: 0 5px; color: var(--muted); font-size: 12px; font-weight: 900; }
.form-draft-options .check-row { margin: 0; }
.form-draft-note { margin-top: 18px; }
.drive-documents { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 18px; }
.form-publications { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 18px; }
.form-publications-list { display: grid; gap: 10px; color: var(--muted); }
.form-publication { align-items: center; border: 1px solid var(--line); border-radius: 14px; display: flex; gap: 14px; justify-content: space-between; padding: 12px 14px; }
.form-publication > div:first-child { align-items: center; display: flex; gap: 9px; }
.form-publication-status { background: #e8f8f0; border-radius: 999px; color: #087e54; font-size: 12px; font-weight: 800; padding: 4px 8px; }
.form-publication-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.form-question-section { border-top: 1px solid var(--line); padding-top: 18px; }
.form-question-section h3 { margin: 4px 0 0; }
.form-questions { display: grid; gap: 12px; }
.form-question { margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.form-question-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.form-question-grid { display: grid; grid-template-columns: minmax(160px, .7fr) minmax(0, 1.3fr) auto; gap: 12px; align-items: end; }
.form-question-grid .check-row { margin: 0 0 12px; white-space: nowrap; }

.dialog-note {
  margin: 10px 0 16px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.appointment-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 8px;
}

.appointment-detail-grid > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7, 16, 9, 0.025);
}

.appointment-detail-grid span { color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.appointment-detail-grid strong { overflow-wrap: anywhere; }
.appointment-detail-wide { grid-column: 1 / -1; }
.appointment-linker { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(235, 246, 239, .7); }
.appointment-linker[hidden] { display: none; }
.appointment-linker .field { margin: 0; }
@media (max-width: 620px) { .appointment-linker { grid-template-columns: 1fr; } }

@media (max-width: 1100px) {
  .app-shell {
    width: min(980px, calc(100vw - 24px));
  }

  .pillbar {
    border-radius: 26px;
  }

  .pill-links {
    overflow: hidden;
  }

  .pill-links button {
    padding-inline: 12px;
  }

  .focus,
  .grid,
  .provider-strip,
  .agenda-layout,
  .slot-controls,
  .slot-list,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-wide {
    grid-column: auto;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .mini-calendar { position: static; }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 520px);
    padding-top: 10px;
  }

  .pillbar,
  .hero,
  .panel-head {
    align-items: flex-start;
  }

  .pillbar,
  .hero {
    display: grid;
  }

  .agenda-toolbar { flex-wrap: wrap; }

  .pillbar {
    width: 100%;
    border-radius: 24px;
  }

  .panel[data-panel="agenda"] {
    width: calc(100vw - 10px);
    min-height: auto;
    padding: 16px 10px;
    border-radius: 20px;
  }

  .pill-links {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .pill-links:has(.nav-more[open]) { overflow: visible; }

  .nav-more-menu {
    position: fixed;
    z-index: 40;
    top: 92px;
    right: 18px;
    left: 18px;
  }

  .menu-button {
    position: absolute;
    right: 28px;
    top: 28px;
  }

  .hero h1 {
    font-size: 34px;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .reactivation-summary { grid-template-columns: repeat(2, 1fr); }
  .reactivation-card,
  .reactivation-card[data-mode="prepared"],
  .reactivation-card[data-mode="sent"] {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "select actions" "name actions" "visit actions" "contact actions" "status actions";
    gap: 3px 8px;
  }
  .reactivation-actions { align-self: center; flex-direction: column; }
  .import-summary { grid-template-columns: repeat(2, 1fr); }

  .timeline li {
    grid-template-columns: 1fr;
  }

  .calendar-board {
    grid-template-columns: repeat(5, minmax(176px, 1fr));
  }

  .compact-day { min-width: 176px; min-height: 420px; }

  .calendar-corner,
  .calendar-hour-rail {
    min-width: 62px;
  }

  .patient-list li,
  .task-list li,
  .patient-actions {
    align-items: stretch;
  }

  .patient-list li,
  .task-list li,
  .patient-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .patient-actions em {
    justify-self: start;
  }

  .profile-head,
  .profile-actions,
  .profile-data-alert { align-items: stretch; }

  .profile-head,
  .profile-summary-grid { display: grid; grid-template-columns: 1fr; }

  .profile-actions { justify-content: stretch; }

  .settings-hero,
  .setting-row,
  .privacy-list div {
    display: grid;
  }

  .settings-status {
    min-width: 0;
  }

  .settings-provider-list .provider-card {
    grid-template-columns: 12px 1fr;
  }

  .settings-provider-list .provider-card em,
  .settings-provider-list .provider-card button {
    grid-column: 2;
    justify-self: start;
  }
}

/* Keep desktop typography and spacing at the density of familiar browser UI. */
@media (min-width: 761px) {
  body { font-size: 13px; }
  .app-shell { padding-top: 10px; padding-bottom: 24px; }
  .pillbar { min-height: 54px; margin-bottom: 14px; padding: 6px 10px; }
  .brand { min-width: 150px; gap: 8px; }
  .brand img { width: 38px; height: 38px; }
  .brand strong { font-size: 16px; }
  .pill-links { padding: 4px; }
  .pill-links button, .nav-more summary { padding: 7px 11px; font-size: 13px; }
  .menu-button { width: 36px; height: 36px; min-height: 36px; font-size: 16px; }
  .hero { margin-bottom: 12px; }
  .hero h1 { margin-top: 3px; font-size: 28px; }
  button { min-height: 34px; padding-inline: 12px; font-size: 13px; }
  .focus { gap: 12px; margin-bottom: 10px; }
  .next-card, .assist-panel { min-height: 154px; padding: 16px; }
  .next-time { margin-top: 10px; font-size: 14px; }
  .next-card h2 { font-size: 22px; }
  .assist-panel h2 { font-size: 20px; }
  .assist-panel p:not(.label) { font-size: 13px; }
  .connection-box { margin-top: 12px; padding: 9px 10px; }
  .connection-box strong { margin-top: 5px; }
  .card-actions { margin-top: 13px; }
  .metrics { gap: 9px; margin-bottom: 10px; }
  .metrics article { padding: 10px 14px; }
  .metrics strong { font-size: 23px; }
  .grid { gap: 12px; }
  .panel { padding: 14px; }
  .panel-head { margin-bottom: 10px; }
  .panel h2 { font-size: 19px; }
  .timeline li, .activity li, .patient-list li, .task-list li, .slot-list li {
    gap: 9px;
    padding: 8px 10px;
    border-radius: 11px;
  }
  .event-meta, .activity p, .task-list span { font-size: 12px; }
  .event-pill { padding: 6px 9px; }
  .settings-view { gap: 14px; }
  .settings-hero { padding: 16px; }
  .settings-hero h2 { font-size: 23px; }
  .settings-hero p:not(.label) { font-size: 13px; }
  .settings-status { min-width: 200px; padding: 11px; }
  .settings-grid { gap: 14px; }
  .setting-row, .privacy-list div { padding-block: 12px; }
  .dialog-card { padding: 16px; }
  .dialog-card p:not(.label) { font-size: 13px; }
  .field input, .field select { min-height: 36px; }
  .onboarding-aside { padding: clamp(28px, 4vw, 54px); gap: 44px; }
  .onboarding-aside h1 { font-size: clamp(30px, 3.5vw, 44px); }
  .onboarding-aside p:not(.label), .wizard-step > p:not(.label) { font-size: 13px; }
  .onboarding-main { padding: clamp(24px, 4vw, 54px); }
  .wizard-step h2 { font-size: clamp(24px, 2.6vw, 32px); }
  .login-brand img { width: 44px; height: 44px; }
  .login-brand strong { font-size: 17px; }
  .login-promise h1 { font-size: clamp(34px, 4.3vw, 54px); }
  .login-promise > p:last-child { font-size: 14px; }
  .login-card { padding: clamp(22px, 3vw, 34px); border-radius: 20px; }
  .login-card h2 { font-size: clamp(25px, 2.6vw, 32px); }
}

@media (min-width: 900px) and (max-width: 1100px) {
  .focus { grid-template-columns: 1.55fr .9fr; }
  .grid { grid-template-columns: 1.35fr .85fr; }
  .settings-grid { grid-template-columns: 1.2fr .8fr; }
}

/* Typography hierarchy: lighter, narrower desktop-style interface text. */
body {
  font-family: "Segoe UI Variable Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 400;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

button,
.pill-links button,
.nav-more summary,
.settings-tabs button,
.segmented-control button,
.event-title,
.activity strong,
.task-list strong,
.patient-summary strong {
  font-weight: 600;
}

.brand strong,
.hero h1,
.next-card h2,
.assist-panel h2,
.panel h2,
.settings-hero h2,
.wizard-step h2,
.login-card h2,
.login-promise h1 {
  font-weight: 650;
}

.hero p,
.metrics span,
.message,
.event-time,
.slot-list span,
.mini-field select,
.check-row,
.setting-row,
.privacy-list {
  font-weight: 500;
}

.label,
.connection-box span,
.field span,
.field > label,
.mini-field span,
.summary-list span,
.next-time,
.event-pill,
.metrics strong,
.module-state,
.appointment-detail-grid span {
  font-weight: 700;
}

/* Agenda uses the same restrained hierarchy as the rest of the application. */
.agenda-toolbar > strong,
.compact-day-head strong,
.mini-calendar-head strong,
.calendar-event-block strong {
  font-weight: 600;
}

.agenda-toolbar > span,
.compact-day-head span,
.compact-event-card span,
.compact-event-card small,
.mini-calendar-weekdays span,
.mini-calendar-day,
.calendar-day-head,
.calendar-corner,
.calendar-hour-rail time,
.calendar-event-block span {
  font-weight: 500;
}

.compact-event-card strong {
  font-weight: 550;
}

.compact-free-block,
.calendar-slot-block {
  font-weight: 600;
}

/* Normalize remaining interface copy that previously inherited display weights. */
.login-highlights span,
.patient-search span,
.patient-list em,
.patient-profile-status span,
.profile-summary-grid span,
.payment-history-details strong,
.import-summary span,
.file-picker-action,
.reactivation-summary span,
.reactivation-column-head span,
.reactivation-select,
.color-source-toggle,
.form-draft-options legend,
.form-publication-status {
  font-weight: 600;
}

/* Responsive primary navigation fills the pill and overflows into Más. */
.pill-links {
  flex: 1 1 auto;
  min-width: 0;
}

.pill-links > [data-nav-item] {
  flex: 1 1 auto;
  text-align: center;
}

.nav-more {
  flex: 0 0 auto;
}

.nav-more[hidden] {
  display: none;
}

.pill-links .nav-more-menu button {
  flex: none;
}

#campaignsDialog { width: min(900px, calc(100vw - 28px)); max-width: 900px; max-height: 92vh; }
#campaignsDialog .dialog-card { width: 100%; max-width: none; box-sizing: border-box; }
.campaign-controls { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
#campaignPatientList { max-height: 270px; overflow-y: auto; border: 1px solid #dfe5e1; border-radius: 12px; padding: 8px 12px; margin-bottom: 18px; }
.campaign-patient { padding: 8px 0; margin: 0; font-size: 13px; align-items: flex-start; }
#campaignsDialog fieldset { border: 1px solid #dfe5e1; border-radius: 12px; padding: 14px; margin-top: 16px; }
#campaignsDialog .check-row { align-items: flex-start; font-size: 13px; }
#campaignsDialog details { margin: 14px 0; }
#campaignsDialog summary { cursor: pointer; margin-bottom: 12px; }
@media (max-width: 620px) { .campaign-controls { grid-template-columns: 1fr; } #campaignsDialog .dialog-actions { flex-wrap: wrap; } }

.drive-workspace-actions { display:flex; align-items:center; flex-wrap:wrap; gap:12px; margin:16px 0; }
.drive-folder-link { display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:0 18px; border:1px solid var(--line); border-radius:12px; color:var(--ink); font:inherit; font-weight:700; text-decoration:none; }
.drive-folder-link:hover { border-color:var(--green); }
.drive-folder-link:focus-visible { outline:3px solid var(--green); outline-offset:3px; }
.drive-folder-guide { margin-top:16px; color:var(--muted); line-height:1.6; }
.drive-folder-guide summary { cursor:pointer; color:var(--ink); font-weight:700; }
.drive-folder-guide li { margin:6px 0; }
@media(max-width:620px) { .drive-workspace-actions > * { width:100%; } }
