:root {
  --ink: #17312e;
  --ink-soft: #48615e;
  --green-950: #102f2c;
  --green-800: #174a44;
  --green-700: #1f625a;
  --green-100: #dff0eb;
  --green-50: #eef7f4;
  --cream: #f8f7f2;
  --paper: #fffefa;
  --line: #dfe8e4;
  --muted: #748783;
  --coral: #d97863;
  --coral-soft: #f8e7e1;
  --amber: #c48a3a;
  --amber-soft: #fbf0d9;
  --red: #b64e4e;
  --red-soft: #f9e6e4;
  --shadow: 0 14px 40px rgba(20, 63, 58, .08);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --sidebar: 244px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--cream);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: -.035em; }
h1 { margin-bottom: 8px; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.05; }
h2 { margin-bottom: 4px; font-size: 1.35rem; }
h3 { margin-bottom: 4px; font-size: 1rem; }
.muted { color: var(--muted); }
.eyebrow { display: block; margin-bottom: 8px; color: var(--green-700); font-size: .72rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 13px;
  color: #fff;
  background: var(--green-700);
  font-family: Arial, serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.06em;
  box-shadow: 0 7px 18px rgba(31, 98, 90, .22);
}
.brand-mark--large { width: 64px; height: 64px; border-radius: 19px; font-size: 1.4rem; background: rgba(255,255,255,.14); box-shadow: none; }

.login-view { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, .9fr) 1.1fr; background: var(--paper); }
.login-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: clamp(42px, 6vw, 86px);
  color: #fff;
  background:
    radial-gradient(circle at 82% 15%, rgba(107, 178, 163, .25), transparent 32%),
    radial-gradient(circle at 5% 95%, rgba(217, 120, 99, .2), transparent 28%),
    var(--green-950);
}
.login-brand::after { content: ""; position: absolute; right: -130px; bottom: 10%; width: 360px; height: 360px; border: 1px solid rgba(255,255,255,.1); border-radius: 50%; box-shadow: 0 0 0 60px rgba(255,255,255,.025), 0 0 0 120px rgba(255,255,255,.018); }
.login-brand .eyebrow { margin-top: auto; padding-top: 14vh; color: #91c9bd; }
.login-brand h1 { max-width: 650px; margin: 0 0 24px; font-family: Arial, "Times New Roman", serif; font-size: clamp(3rem, 5vw, 5rem); font-weight: 400; line-height: .98; }
.login-brand > div > p { max-width: 520px; color: #bad0ca; font-size: 1.1rem; line-height: 1.7; }
.login-quote { position: relative; z-index: 1; display: flex; align-items: flex-start; gap: 14px; max-width: 430px; padding-top: 30px; border-top: 1px solid rgba(255,255,255,.13); }
.login-quote span { color: var(--coral); font-family: Arial, serif; font-size: 3rem; line-height: .8; }
.login-quote p { color: #d3e1dd; line-height: 1.6; }
.login-panel { display: grid; place-items: center; padding: 40px; }
.auth-card { width: min(440px, 100%); }
.auth-card h2 { margin-bottom: 10px; font-family: Arial, serif; font-size: 2.3rem; font-weight: 400; }
.auth-card > .muted { margin-bottom: 34px; line-height: 1.6; }
.mobile-brand { display: none; }
.security-note { margin: 22px 0 0; color: var(--muted); font-size: .78rem; text-align: center; }

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.field > span:first-child, .compact-field > span { font-size: .78rem; font-weight: 750; }
.field input, .field textarea, .field select, .compact-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  outline: none;
  color: var(--ink);
  background: #fff;
  transition: border .2s, box-shadow .2s, background .2s;
}
.field input, .field select { height: 48px; padding: 0 14px; }
.field textarea { resize: vertical; min-height: 86px; padding: 13px 14px; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus, .compact-field select:focus, .search-box:focus-within { border-color: var(--green-700); box-shadow: 0 0 0 4px rgba(31, 98, 90, .09); }
.field input::placeholder, .field textarea::placeholder { color: #a5b1ae; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 58px; }
.password-field .icon-button { position: absolute; top: 4px; right: 4px; color: var(--green-700); font-size: .72rem; font-weight: 750; }
.form-error { margin: -5px 0 14px; color: var(--red); font-size: .82rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.field--full { grid-column: 1 / -1; }

.button { min-height: 44px; padding: 0 18px; border: 0; border-radius: var(--radius-md); cursor: pointer; font-size: .85rem; font-weight: 750; transition: transform .18s, box-shadow .18s, opacity .18s, background .18s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.button--primary { color: #fff; background: var(--green-700); box-shadow: 0 8px 18px rgba(31, 98, 90, .18); }
.button--primary:hover { background: var(--green-800); box-shadow: 0 10px 22px rgba(31, 98, 90, .25); }
.button--ghost { border: 1px solid var(--line); background: #fff; }
.button--danger { color: #fff; background: var(--red); }
.button--wide { display: flex; width: 100%; align-items: center; justify-content: space-between; height: 52px; padding-inline: 20px; }
.icon-button { display: grid; width: 40px; height: 40px; padding: 0; place-items: center; border: 0; border-radius: 11px; cursor: pointer; background: transparent; }
.icon-button:hover { background: var(--green-50); }
.icon-button--accent { color: #fff; background: var(--green-700); }
.text-button, .back-button { padding: 6px 0; border: 0; cursor: pointer; color: var(--green-700); background: none; font-size: .82rem; font-weight: 750; }
.back-button { margin-bottom: 25px; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; width: var(--sidebar); flex-direction: column; padding: 26px 18px 18px; color: #e4efec; background: var(--green-950); }
.brand { display: flex; align-items: center; gap: 12px; margin: 0 8px 44px; color: inherit; text-decoration: none; }
.brand strong, .brand small { display: block; }
.brand strong { color: #fff; font-family: Arial, serif; font-size: 1.14rem; font-weight: 500; }
.brand small { margin-top: 3px; color: #87a6a0; font-size: .68rem; letter-spacing: .04em; }
.main-nav { display: flex; flex-direction: column; gap: 6px; }
.nav-link { display: flex; min-height: 46px; align-items: center; gap: 12px; padding: 0 14px; border: 0; border-radius: 12px; cursor: pointer; color: #9fb8b2; background: transparent; font-size: .87rem; text-align: left; transition: color .2s, background .2s; }
.nav-link:hover, .nav-link.is-active { color: #fff; background: rgba(255,255,255,.09); }
.nav-link.is-active { box-shadow: inset 3px 0 var(--coral); }
.nav-icon { width: 22px; font-size: 1.1rem; text-align: center; }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding-top: 18px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 0 8px 14px; }
.user-chip strong, .user-chip small { display: block; max-width: 128px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip strong { color: #fff; font-size: .78rem; }
.user-chip small { margin-top: 2px; color: #7f9d97; font-size: .68rem; }
.avatar { display: grid; width: 34px; height: 34px; place-items: center; flex: 0 0 auto; border-radius: 50%; color: var(--green-950); background: #acd2c9; font-size: .72rem; font-weight: 800; }
.nav-link--logout { width: 100%; }

.main-content { min-height: 100vh; margin-left: var(--sidebar); }
.mobile-header { display: none; }
.page { display: none; max-width: 1480px; margin: 0 auto; padding: 48px clamp(28px, 4.5vw, 72px) 70px; animation: pageIn .32s ease both; }
.page.is-active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(5px); } }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.page-heading--dashboard { align-items: center; }
.page-heading p { margin-bottom: 0; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 24px; }
.stat-card { display: flex; min-height: 132px; align-items: center; gap: 18px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); box-shadow: 0 6px 22px rgba(20, 63, 58, .035); }
.stat-card--accent { color: #fff; border-color: var(--green-700); background: var(--green-700); }
.stat-icon { display: grid; width: 48px; height: 48px; place-items: center; flex: 0 0 auto; border-radius: 15px; color: var(--green-700); background: var(--green-50); font-size: 1.3rem; }
.stat-card--accent .stat-icon { color: #fff; background: rgba(255,255,255,.13); }
.stat-card small, .stat-card strong, .stat-card div > span { display: block; }
.stat-card small { margin-bottom: 4px; color: var(--muted); font-size: .75rem; font-weight: 700; }
.stat-card--accent small, .stat-card--accent div > span { color: #c5ded8; }
.stat-card strong { font-family: Arial, serif; font-size: 2rem; font-weight: 500; }
.stat-card div > span { color: var(--muted); font-size: .72rem; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr); gap: 24px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--paper); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 24px 26px 18px; }
.panel-heading h2 { font-family: Arial, serif; font-weight: 500; }
.appointment-list { padding: 0 26px 18px; }
.appointment-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 17px 0; border-top: 1px solid var(--line); }
.appointment-time { font-family: Arial, serif; font-size: 1.08rem; }
.appointment-main { min-width: 0; }
.appointment-main strong, .appointment-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appointment-main strong { margin-bottom: 4px; font-size: .9rem; }
.appointment-main small { color: var(--muted); font-size: .75rem; }
.quick-panel { padding-bottom: 12px; }
.quick-action { display: grid; width: calc(100% - 28px); min-height: 66px; grid-template-columns: 38px 1fr auto; align-items: center; gap: 12px; margin: 0 14px 8px; padding: 10px 12px; border: 0; border-radius: 14px; cursor: pointer; background: transparent; text-align: left; }
.quick-action:hover { background: var(--green-50); }
.quick-action > span { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; color: var(--green-700); background: var(--green-100); }
.quick-action strong, .quick-action small { display: block; }
.quick-action strong { font-size: .82rem; }
.quick-action small { margin-top: 3px; color: var(--muted); font-size: .69rem; }
.quick-action b { color: var(--muted); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.toolbar--filters { justify-content: flex-start; }
.search-box { display: flex; width: min(520px, 100%); height: 46px; align-items: center; gap: 9px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; }
.search-box span { color: var(--muted); font-size: 1.2rem; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; }
.result-count { color: var(--muted); font-size: .76rem; }
.compact-field { display: flex; align-items: center; gap: 10px; }
.compact-field select { height: 46px; padding: 0 34px 0 12px; }
.patient-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.patient-card { position: relative; overflow: hidden; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); cursor: pointer; background: var(--paper); transition: transform .2s, box-shadow .2s, border-color .2s; }
.patient-card:hover { transform: translateY(-3px); border-color: #b9d1ca; box-shadow: var(--shadow); }
.patient-card:focus-visible { outline: 3px solid rgba(31, 98, 90, .25); outline-offset: 3px; border-color: var(--green-700); }
.patient-card-header { display: flex; align-items: center; gap: 13px; margin-bottom: 20px; }
.patient-card .avatar { width: 46px; height: 46px; color: var(--green-700); background: var(--green-100); font-size: .85rem; }
.patient-card h3 { font-family: Arial, serif; font-size: 1.16rem; font-weight: 500; }
.patient-card small { color: var(--muted); }
.patient-meta { display: grid; gap: 9px; min-height: 64px; margin-bottom: 18px; }
.patient-meta span { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: .78rem; }
.patient-card-actions { display: flex; align-items: center; justify-content: space-between; padding-top: 15px; border-top: 1px solid var(--line); }
.action-menu { display: flex; gap: 2px; }
.small-action { padding: 6px 8px; border: 0; border-radius: 8px; cursor: pointer; color: var(--muted); background: transparent; font-size: .72rem; }
.small-action:hover { color: var(--green-700); background: var(--green-50); }
.small-action--danger:hover { color: var(--red); background: var(--red-soft); }

.profile-hero { display: grid; grid-template-columns: 1fr auto; gap: 24px; margin-bottom: 24px; padding: 28px; border-radius: var(--radius-xl); color: #fff; background: linear-gradient(125deg, var(--green-950), var(--green-700)); box-shadow: var(--shadow); }
.profile-identity { display: flex; align-items: center; gap: 18px; }
.profile-identity .avatar { width: 66px; height: 66px; color: var(--green-950); background: #b9ded5; font-size: 1.2rem; }
.profile-identity h1 { margin-bottom: 6px; font-family: Arial, serif; font-size: 2rem; font-weight: 400; }
.profile-identity p { margin: 0; color: #bdd5cf; }
.profile-actions { display: flex; align-items: center; gap: 8px; }
.profile-actions .button--ghost { color: #fff; border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.08); }
.profile-grid { display: grid; grid-template-columns: minmax(250px, .7fr) minmax(0, 1.6fr); gap: 24px; }
.info-panel { padding: 25px; }
.info-list { display: grid; gap: 17px; margin-top: 22px; }
.info-item small, .info-item strong { display: block; }
.info-item small { margin-bottom: 4px; color: var(--muted); font-size: .69rem; text-transform: uppercase; letter-spacing: .07em; }
.info-item strong { font-size: .85rem; font-weight: 600; overflow-wrap: anywhere; }
.clinical-panel { min-width: 0; }
.tabs { display: flex; gap: 4px; padding: 12px 18px 0; border-bottom: 1px solid var(--line); }
.tab-button { padding: 12px 15px; border: 0; border-bottom: 2px solid transparent; cursor: pointer; color: var(--muted); background: transparent; font-size: .78rem; font-weight: 750; }
.tab-button.is-active { color: var(--green-700); border-bottom-color: var(--green-700); }
.tab-content { padding: 22px; }
.tab-pane { display: none; }
.tab-pane.is-active { display: block; }
.section-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.section-toolbar h2 { font-family: Arial, serif; font-weight: 500; }
.record-list { display: grid; gap: 13px; }
.record-card { position: relative; padding: 19px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.record-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 12px; }
.record-date { display: inline-flex; margin-bottom: 7px; padding: 4px 8px; border-radius: 6px; color: var(--green-700); background: var(--green-50); font-size: .68rem; font-weight: 800; }
.record-card p { margin: 7px 0 0; color: var(--ink-soft); font-size: .8rem; line-height: 1.55; white-space: pre-line; }
.record-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
.record-card dt { color: var(--muted); font-size: .66rem; text-transform: uppercase; }
.record-card dd { margin: 4px 0 0; font-size: .78rem; line-height: 1.5; }
.record-images { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.record-image { position: relative; width: 62px; height: 62px; overflow: hidden; border-radius: 10px; background: var(--green-50); }
.record-image img { width: 100%; height: 100%; object-fit: cover; }
.record-image-preview { display: block; width: 100%; height: 100%; padding: 0; border: 0; cursor: zoom-in; background: transparent; }
.record-image-preview img { display: block; transition: transform .2s ease; }
.record-image-preview:hover img, .record-image-preview:focus-visible img { transform: scale(1.08); }
.record-image > [data-action="delete-image"] { position: absolute; top: 2px; right: 2px; z-index: 1; display: grid; width: 18px; height: 18px; padding: 0; place-items: center; border: 0; border-radius: 50%; color: #fff; cursor: pointer; background: rgba(20,30,28,.68); font-size: .65rem; }
.price { color: var(--green-700); font-weight: 800; }

.schedule-list { display: grid; gap: 14px; }
.day-group { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); }
.day-group-title { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); background: var(--green-50); }
.day-group-title h2 { margin: 0; font-family: Arial, serif; font-size: 1.05rem; font-weight: 500; }
.day-group-title span { color: var(--muted); font-size: .7rem; }
.schedule-row { display: grid; grid-template-columns: 74px minmax(160px, 1fr) minmax(150px, .8fr) auto auto; align-items: center; gap: 16px; min-height: 72px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.schedule-row:last-child { border-bottom: 0; }
.schedule-row .appointment-time { color: var(--green-700); }
.schedule-notes { overflow: hidden; color: var(--muted); font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.status { display: inline-flex; align-items: center; gap: 6px; width: max-content; padding: 5px 9px; border-radius: 99px; font-size: .66rem; font-weight: 800; text-transform: capitalize; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status--pendiente { color: var(--amber); background: var(--amber-soft); }
.status--confirmada { color: var(--green-700); background: var(--green-100); }
.status--realizada { color: #5d6d8f; background: #e9edf6; }
.status--cancelada { color: var(--red); background: var(--red-soft); }

.calendar-view-toggle { display: none; }
.calendar-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .65fr); gap: 24px; }
.calendar-panel { padding: 20px; }
.calendar-header { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; margin-bottom: 16px; }
.calendar-header h2 { margin: 0; font-family: Arial, serif; font-weight: 500; text-align: center; text-transform: capitalize; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendar-weekdays span { padding: 10px 4px; color: var(--muted); font-size: .65rem; font-weight: 800; text-align: center; text-transform: uppercase; }
.calendar-grid { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; }
.calendar-day { position: relative; min-height: 92px; padding: 10px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; background: #fff; text-align: left; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day:hover { background: var(--green-50); }
.calendar-day.is-outside { color: #b5c0bd; background: #fbfcfa; }
.calendar-day.is-today .day-number { color: #fff; background: var(--green-700); }
.calendar-day.is-selected { z-index: 1; background: var(--green-50); box-shadow: inset 0 0 0 2px var(--green-700); }
.day-number { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 50%; font-size: .75rem; font-weight: 750; }
.calendar-dots { display: flex; gap: 3px; margin-top: 13px; }
.calendar-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--green-700); }
.calendar-dots i.is-cancelled { background: var(--red); }
.calendar-count { display: block; margin-top: 5px; color: var(--muted); font-size: .62rem; }
.day-panel { align-self: start; }
.day-panel .empty-state { padding-top: 15px; }
.calendar-mobile-list { display: none; }

.empty-state { padding: 46px 24px; color: var(--muted); text-align: center; }
.empty-state-icon { display: grid; width: 52px; height: 52px; margin: 0 auto 15px; place-items: center; border-radius: 17px; color: var(--green-700); background: var(--green-50); font-size: 1.3rem; }
.empty-state h3 { color: var(--ink); font-family: Arial, serif; font-size: 1.1rem; font-weight: 500; }
.empty-state p { max-width: 340px; margin: 6px auto 0; font-size: .78rem; line-height: 1.6; }

.modal { width: min(690px, calc(100% - 32px)); max-height: min(860px, calc(100vh - 40px)); padding: 0; border: 0; border-radius: var(--radius-xl); color: var(--ink); background: var(--paper); box-shadow: 0 26px 80px rgba(10, 35, 32, .28); }
.modal::backdrop { background: rgba(10, 35, 32, .6); backdrop-filter: blur(4px); }
.modal form { padding: 26px; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.modal-header h2 { font-family: Arial, serif; font-size: 1.7rem; font-weight: 500; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; padding-top: 20px; border-top: 1px solid var(--line); }
.modal--small { width: min(520px, calc(100% - 32px)); }
.modal--confirm { width: min(430px, calc(100% - 32px)); text-align: center; }
.modal--confirm form { padding: 34px; }
.modal--confirm h2 { font-family: Arial, serif; font-weight: 500; }
.modal--confirm .modal-actions { justify-content: center; }
.confirm-icon { display: grid; width: 50px; height: 50px; margin: 0 auto 17px; place-items: center; border-radius: 16px; color: var(--red); background: var(--red-soft); font-family: Arial, serif; font-size: 1.5rem; }
.upload-zone { display: grid; min-height: 180px; margin-bottom: 18px; place-items: center; align-content: center; gap: 5px; border: 1px dashed #a8c3bc; border-radius: 16px; cursor: pointer; background: var(--green-50); text-align: center; }
.upload-zone:hover { border-color: var(--green-700); }
.upload-zone input { position: absolute; opacity: 0; pointer-events: none; }
.upload-zone small { color: var(--muted); }
.upload-icon { font-size: 1.6rem; color: var(--green-700); }

.image-preview-dialog { width: min(1080px, calc(100% - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: var(--radius-xl); overflow: hidden; color: #fff; background: #0b1d1b; box-shadow: 0 30px 90px rgba(5, 20, 18, .45); }
.image-preview-dialog::backdrop { background: rgba(5, 18, 16, .82); backdrop-filter: blur(7px); }
.image-preview-content { display: flex; max-height: calc(100vh - 32px); flex-direction: column; }
.image-preview-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 22px; border-bottom: 1px solid rgba(255,255,255,.1); }
.image-preview-header .eyebrow { color: #91c9bd; }
.image-preview-header h2 { margin: 0; color: #fff; font-family: Arial, serif; font-weight: 500; }
.image-preview-close { display: grid; width: 42px; height: 42px; padding: 0; place-items: center; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; color: #fff; cursor: pointer; background: rgba(255,255,255,.08); font-size: 1.5rem; }
.image-preview-close:hover { background: rgba(255,255,255,.16); }
.image-preview-dialog figure { display: flex; min-height: 0; flex: 1; flex-direction: column; align-items: center; justify-content: center; margin: 0; padding: 22px; }
.image-preview-dialog figure img { display: block; max-width: 100%; max-height: calc(100vh - 190px); object-fit: contain; border-radius: 10px; }
.image-preview-dialog figcaption { min-height: 22px; margin-top: 15px; color: #c5d7d2; font-size: .82rem; text-align: center; }

.loading-overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; gap: 12px; color: #fff; background: rgba(16, 47, 44, .72); backdrop-filter: blur(3px); }
.spinner { width: 24px; height: 24px; border: 3px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 110; display: grid; width: min(360px, calc(100vw - 32px)); gap: 10px; }
.toast { padding: 14px 16px; border-left: 4px solid var(--green-700); border-radius: 12px; color: var(--ink); background: #fff; box-shadow: 0 15px 35px rgba(15, 46, 43, .18); animation: toastIn .3s ease both; font-size: .82rem; }
.toast--error { border-left-color: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

@media (max-width: 1120px) {
  .patient-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .schedule-row { grid-template-columns: 66px 1fr auto auto; }
  .schedule-notes { display: none; }
  .profile-grid { grid-template-columns: 1fr; }
  .info-list { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 860px) {
  :root { --sidebar: 78px; }
  .sidebar { padding-inline: 11px; }
  .sidebar .brand { justify-content: center; margin-inline: 0; }
  .sidebar .brand > div:last-child, .nav-link span:last-child, .user-chip div, .sidebar-footer .avatar { display: none; }
  .nav-link { justify-content: center; padding: 0; }
  .nav-link.is-active { box-shadow: inset 0 -3px var(--coral); }
  .dashboard-grid, .calendar-layout { grid-template-columns: 1fr; }
  .quick-panel { display: none; }
  .calendar-layout .day-panel { display: none; }
}

@media (max-width: 640px) {
  :root { --sidebar: 0px; --radius-xl: 19px; }
  .action-menu { flex-direction: column;}
  .login-view { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-panel { min-height: 100vh; padding: 28px 22px; background: linear-gradient(180deg, var(--green-50), var(--paper) 38%); }
  .mobile-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 54px; font-family: Arial, serif; }
  .auth-card h2 { font-size: 2rem; }
  .sidebar { inset: auto 0 0; width: 100%; height: 68px; flex-direction: row; align-items: center; padding: 7px 12px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255,255,255,.1); }
  .sidebar > .brand, .sidebar-footer .user-chip, .nav-link--logout { display: none; }
  .main-nav { width: 100%; flex-direction: row; justify-content: space-around; gap: 3px; }
  .nav-link { min-width: 62px; height: 54px; flex-direction: column; gap: 2px; border-radius: 11px; font-size: .63rem; }
  .nav-link span:last-child { display: block; }
  .nav-icon { font-size: 1rem; }
  .sidebar-footer { display: none; }
  .main-content { margin-left: 0; }
  .mobile-header { position: sticky; top: 0; z-index: 15; display: flex; height: 66px; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid var(--line); background: rgba(248,247,242,.94); backdrop-filter: blur(12px); }
  .mobile-header .brand { gap: 9px; margin: 0; color: var(--ink); }
  .mobile-header .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
  .mobile-header .brand strong { color: var(--ink); }
  .page { padding: 28px 17px 35px; }
  .page-heading { align-items: flex-start; margin-bottom: 23px; }
  .page-heading h1 { font-size: 2rem; }
  .page-heading > .button { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 11px; }
  .stat-card { min-height: 112px; gap: 11px; padding: 17px; }
  .stat-card:first-child { grid-column: 1 / -1; }
  .stat-icon { width: 40px; height: 40px; border-radius: 12px; }
  .stat-card strong { font-size: 1.55rem; }
  .dashboard-grid { gap: 15px; }
  .panel-heading { padding: 20px 18px 15px; }
  .appointment-list { padding: 0 18px 12px; }
  .appointment-row { grid-template-columns: 52px 1fr; gap: 10px; }
  .appointment-row > .status { grid-column: 2; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar--filters { flex-direction: column; }
  .compact-field { justify-content: space-between; }
  .patient-grid { grid-template-columns: 1fr; }
  .patient-card { padding: 19px; }
  .profile-hero { grid-template-columns: 1fr; padding: 21px; }
  .profile-identity { align-items: flex-start; }
  .profile-identity .avatar { width: 52px; height: 52px; }
  .profile-identity h1 { font-size: 1.5rem; }
  .profile-actions { justify-content: flex-end; }
  .info-list { grid-template-columns: 1fr 1fr; }
  .clinical-panel { overflow: hidden; }
  .tabs { overflow-x: auto; padding-inline: 10px; }
  .tab-button { flex: 0 0 auto; }
  .tab-content { padding: 15px; }
  .record-card dl { grid-template-columns: 1fr; }
  .schedule-row { grid-template-columns: 55px minmax(0,1fr) auto; gap: 8px; padding: 13px 14px; }
  .schedule-row .status { grid-column: 2; }
  .schedule-row .action-menu { grid-column: 3; grid-row: 1 / span 2; }
  .day-group-title { padding-inline: 14px; }
  .calendar-view-toggle { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 14px; padding: 4px; border-radius: 12px; background: var(--green-100); }
  .calendar-view-toggle button { height: 37px; border: 0; border-radius: 9px; cursor: pointer; color: var(--green-700); background: transparent; font-size: .76rem; font-weight: 750; }
  .calendar-view-toggle button.is-active { background: #fff; box-shadow: 0 3px 10px rgba(20,63,58,.1); }
  .calendar-panel { padding: 11px; }
  .calendar-weekdays span { font-size: .57rem; }
  .calendar-day { min-height: 58px; padding: 5px; }
  .day-number { width: 23px; height: 23px; font-size: .66rem; }
  .calendar-dots { margin-top: 6px; }
  .calendar-count { display: none; }
  .calendar-layout.is-list .calendar-panel { display: none; }
  .calendar-layout.is-list .calendar-mobile-list { display: grid; gap: 11px; }
  .calendar-mobile-list .schedule-row { background: #fff; }
  .form-grid { grid-template-columns: 1fr; }
  .field--full { grid-column: auto; }
  .modal { width: calc(100% - 18px); max-height: calc(100vh - 18px); border-radius: 18px; }
  .modal form { padding: 20px 17px; }
  .modal-actions .button { flex: 1; }
  .toast-region { right: 16px; bottom: 86px; }
  .image-preview-dialog { width: calc(100% - 16px); max-height: calc(100vh - 16px); border-radius: 18px; }
  .image-preview-content { max-height: calc(100vh - 16px); }
  .image-preview-header { padding: 14px 15px; }
  .image-preview-dialog figure { padding: 12px; }
  .image-preview-dialog figure img { max-height: calc(100vh - 155px); }
}

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