:root {
  --navy: #15324a;
  --blue: #125aa7;
  --blue-deep: #0b4687;
  --cyan: #e62e3b;
  --red: #e62e3b;
  --ink: #15304b;
  --muted: #6d7f92;
  --line: #dce6ef;
  --surface: #ffffff;
  --background: #f5f8fb;
  --danger: #b42318;
  --success: #08795b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--background);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input { font: inherit; }
svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 1.08fr) minmax(440px, .92fr); }
.welcome-panel { position: relative; isolation: isolate; overflow: hidden; color: white; background: linear-gradient(145deg, #073b79 2%, #0867a8 58%, #30bbb6 140%); }
.welcome-panel::before, .welcome-panel::after { content: ""; position: absolute; z-index: -1; transform: rotate(-15deg); border-radius: 24px; }
.welcome-panel::before { width: 70%; height: 55%; right: -18%; top: -17%; background: linear-gradient(135deg, rgba(103,229,217,.44), rgba(255,255,255,.03)); }
.welcome-panel::after { width: 72%; height: 58%; left: -24%; bottom: -31%; background: rgba(3,42,91,.38); }
.welcome-inner { width: min(720px, 100%); height: 100%; min-height: 720px; margin-left: auto; padding: clamp(32px, 6vw, 76px); display: flex; flex-direction: column; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; font-size: 1.45rem; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand > span:last-child { display: grid; line-height: 1.05; }
.brand small { margin-top: 4px; font-size: .56rem; font-weight: 650; letter-spacing: .09em; opacity: .66; text-transform: uppercase; }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.48); border-radius: 12px; background: rgba(255,255,255,.1); }
.brand-mark svg { width: 22px; height: 22px; }
.welcome-copy { margin: auto 0; max-width: 580px; }
.eyebrow { display: inline-block; color: var(--cyan); font-size: .75rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.welcome-copy h1 { margin: 18px 0 20px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.75rem, 5vw, 4.75rem); font-weight: 500; line-height: 1.04; letter-spacing: -.045em; }
.welcome-copy h1 em { color: #75e2d9; font-style: normal; }
.welcome-copy p { max-width: 480px; margin: 0; color: rgba(255,255,255,.74); font-size: 1.06rem; line-height: 1.7; }
.trust-line { display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,.7); font-size: .84rem; }
.trust-line svg { color: #75e2d9; }

.form-panel { display: grid; place-items: center; padding: 48px clamp(32px, 6vw, 88px); background: #fff; }
.auth-card { width: min(100%, 450px); }
.mobile-brand { display: none; color: var(--navy); margin-bottom: 48px; }
.mobile-brand .brand-mark { border-color: #b9d9ee; background: #ecf7fb; color: var(--blue); }
.auth-heading { margin-bottom: 30px; }
.auth-heading h2 { margin: 9px 0 9px; color: #102e4b; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.1rem, 4vw, 3rem); font-weight: 600; letter-spacing: -.035em; }
.auth-heading p { margin: 0; color: var(--muted); line-height: 1.6; }
.auth-form { display: grid; gap: 11px; }
.auth-form > label, .label-row label { color: #28435d; font-size: .86rem; font-weight: 700; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 7px; }
.label-row a { font-size: .8rem; font-weight: 700; }
.field { position: relative; display: flex; align-items: center; }
.field > svg { position: absolute; left: 15px; color: #8395a7; pointer-events: none; }
.field input { width: 100%; min-height: 50px; padding: 0 47px; border: 1px solid var(--line); border-radius: 9px; outline: none; color: var(--ink); background: #fff; transition: border .2s, box-shadow .2s; }
.field input::placeholder { color: #9aa9b7; }
.field input:focus { border-color: #3286ca; box-shadow: 0 0 0 4px rgba(50,134,202,.12); }
.password-toggle { position: absolute; right: 8px; width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 7px; color: #6c8092; background: transparent; cursor: pointer; }
.password-toggle:hover { background: #eef5fa; }
.check-row { display: flex; align-items: center; gap: 9px; margin: 6px 0 11px; color: var(--muted) !important; font-weight: 500 !important; cursor: pointer; }
.check-row input { width: 17px; height: 17px; accent-color: var(--blue); }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 9px; min-height: 48px; padding: 0 22px; border: 0; border-radius: 9px; color: #fff; background: linear-gradient(100deg, var(--navy), var(--blue)); box-shadow: 0 10px 24px rgba(8,79,153,.18); font-weight: 750; cursor: pointer; transition: transform .18s, box-shadow .18s; }
.button svg { width: 18px; height: 18px; stroke-width: 2; }
.button:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 14px 28px rgba(8,79,153,.25); }
.button-wide { width: 100%; }
.support { margin: 30px 0 0; padding-top: 25px; border-top: 1px solid #edf1f5; color: #8796a5; text-align: center; font-size: .78rem; }
.support a { font-weight: 700; }
.alert { margin: -10px 0 20px; padding: 12px 14px; border-radius: 8px; font-size: .84rem; line-height: 1.45; }
.alert-error { color: var(--danger); border: 1px solid #fecdca; background: #fff4f2; }
.alert-success { color: var(--success); border: 1px solid #a9e7d6; background: #effcf7; }
.back-link { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 10px; color: #526b82; font-size: .84rem; font-weight: 700; }
.back-link svg { width: 17px; }
.demo-note { margin-top: 18px; display: grid; grid-template-columns: 1fr auto; gap: 3px 15px; padding: 13px 15px; border-radius: 9px; color: #586f84; background: #f1f7fb; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .73rem; }
.demo-note strong { grid-row: span 2; align-self: center; color: #254d70; font-family: inherit; }

.dashboard-page { background: #f4f7fa; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(24px, 5vw, 72px); color: white; background: var(--navy); box-shadow: 0 5px 24px rgba(7,52,106,.12); }
.topbar .brand-mark { width: 35px; height: 35px; }
.user-area { display: flex; align-items: center; gap: 11px; }
.user-area > div { display: grid; }
.user-area strong { font-size: .82rem; }
.user-area small { color: rgba(255,255,255,.65); font-size: .7rem; }
.avatar { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 50%; background: #48c7c1; color: #07346a; font-size: .72rem; font-weight: 850; }
.logout { margin-left: 10px; padding: 8px 12px; border: 1px solid rgba(255,255,255,.27); border-radius: 7px; color: white; background: transparent; cursor: pointer; font-size: .78rem; }
.dashboard { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 50px 0 70px; }
.dashboard-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.dashboard-heading h1 { margin: 8px 0 5px; font-family: Georgia, "Times New Roman", serif; color: #102e4b; font-size: 2.45rem; letter-spacing: -.035em; }
.dashboard-heading p { margin: 0; color: var(--muted); }
.date-chip { padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; color: #667d90; background: white; font-size: .78rem; text-transform: capitalize; }
.stat-grid { margin-top: 35px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.stat-card { display: flex; gap: 18px; align-items: center; padding: 23px; border: 1px solid #e3eaf0; border-radius: 13px; background: white; box-shadow: 0 8px 24px rgba(28,66,99,.04); }
.stat-icon { flex: 0 0 auto; width: 51px; height: 51px; display: grid; place-items: center; border-radius: 12px; }
.stat-icon.blue { color: #176fba; background: #e6f3fd; }
.stat-icon.green { color: #168076; background: #e7f8f5; }
.stat-icon.coral { color: #c85355; background: #fceced; }
.stat-card div { display: grid; }
.stat-card span { color: #647b8f; font-size: .79rem; }
.stat-card strong { margin: 3px 0; color: #173855; font-size: 1.7rem; }
.stat-card small { color: #91a0ad; font-size: .72rem; }
.welcome-card { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 30px; margin-top: 22px; padding: 42px; border-radius: 15px; color: white; background: linear-gradient(110deg, #07346a, #0a68a9); }
.welcome-card::after { content: ""; position: absolute; width: 320px; height: 320px; right: -130px; top: -170px; border-radius: 50%; background: rgba(78,208,201,.22); }
.welcome-card .eyebrow { color: #70ded8; }
.welcome-card h2 { margin: 8px 0; font-family: Georgia, "Times New Roman", serif; font-size: 2rem; }
.welcome-card p { max-width: 680px; margin: 0; color: rgba(255,255,255,.72); line-height: 1.65; }
.welcome-heart { z-index: 1; width: 88px; height: 88px; display: grid; flex: 0 0 auto; place-items: center; border: 1px solid rgba(255,255,255,.25); border-radius: 24px; color: #75e2d9; background: rgba(255,255,255,.08); }
.welcome-heart svg { width: 45px; height: 45px; }

.simple-page { display: grid; place-items: center; background: #f4f8fb; }
.not-found { text-align: center; }
.not-found > span { color: #9fcadd; font: 700 6rem/1 Georgia, serif; }
.not-found h1 { color: var(--navy); font-family: Georgia, serif; }
.not-found p { margin-bottom: 28px; color: var(--muted); }

@media (max-width: 880px) {
  .auth-layout { display: block; }
  .welcome-panel { display: none; }
  .form-panel { min-height: 100vh; padding: 35px 24px; background: linear-gradient(155deg, #f5fbfe, #fff 38%); }
  .mobile-brand { display: block; }
  .stat-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .topbar { padding: 0 17px; }
  .topbar .brand { font-size: 1.1rem; }
  .topbar .user-area > div { display: none; }
  .dashboard { width: min(100% - 30px, 1180px); padding-top: 35px; }
  .dashboard-heading { align-items: flex-start; flex-direction: column; }
  .dashboard-heading h1 { font-size: 2rem; }
  .welcome-card { padding: 28px; }
  .welcome-heart { display: none; }
  .demo-note { grid-template-columns: 1fr; }
  .demo-note strong { grid-row: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Portal asistencial */
.app-page { background: #f4f7f9; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 18px 18px; color: #dcebf4; background: linear-gradient(180deg, #073b66, #052d51); box-shadow: 8px 0 30px rgba(8, 50, 84, .08); z-index: 20; }
.sidebar-brand { padding: 0 11px 34px; color: #fff; }
.sidebar .brand { font-size: 1.2rem; }
.sidebar .brand-mark { width: 36px; height: 36px; }
.sidebar nav { display: grid; gap: 5px; }
.nav-link { display: flex; align-items: center; gap: 13px; min-height: 45px; padding: 0 13px; border-radius: 9px; color: #bcd1df; font-size: .82rem; font-weight: 650; }
.nav-link svg { width: 18px; height: 18px; }
.nav-link:hover { color: white; background: rgba(255,255,255,.07); text-decoration: none; }
.nav-link.active { color: white; background: linear-gradient(95deg, rgba(78,205,196,.26), rgba(52,140,181,.2)); box-shadow: inset 3px 0 #63d8cf; }
.sidebar-profile { margin-top: auto; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 16px 8px 2px; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar-profile > div { min-width: 0; display: grid; }
.sidebar-profile strong, .sidebar-profile small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-profile strong { color: white; font-size: .72rem; }
.sidebar-profile small { margin-top: 3px; color: #8fafc3; font-size: .65rem; }
.sidebar-profile form button { width: 31px; height: 31px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 7px; color: #9fb9ca; background: transparent; cursor: pointer; }
.sidebar-profile form button:hover { color: white; background: rgba(255,255,255,.08); }
.avatar { width: 36px; height: 36px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 10px; color: #075264; background: #88ded5; font-size: .7rem; font-weight: 800; }
.avatar-purple { color: #683da0; background: #eee3ff; }.avatar-red { color: #a43b40; background: #fde8e9; }.avatar-green { color: #187263; background: #dff6ed; }.avatar-blue { color: #216b9b; background: #e0f0fa; }.avatar-amber { color: #8b6113; background: #fff1d2; }.avatar-slate { color: #4b6276; background: #e7edf1; }
.avatar svg { width: 17px; height: 17px; }
.app-main { min-width: 0; }
.mobile-header { display: none; }
.page-wrap { width: min(1280px, calc(100% - 70px)); margin: 0 auto; padding: 42px 0 70px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-header h1 { margin: 7px 0 6px; color: #143652; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 3vw, 2.7rem); line-height: 1; letter-spacing: -.035em; }
.page-header p { margin: 0; color: #728697; font-size: .9rem; }
.page-actions { display: flex; gap: 10px; }
.button svg { width: 17px; height: 17px; }
.button.secondary { border: 1px solid #d6e1e8; color: #526b7e; background: white; box-shadow: none; }
.panel { overflow: hidden; border: 1px solid #e0e8ed; border-radius: 13px; background: white; box-shadow: 0 8px 25px rgba(27,67,97,.045); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 24px 17px; border-bottom: 1px solid #edf1f4; }
.panel-heading h2 { margin: 0 0 4px; color: #1c3c56; font-family: Georgia, serif; font-size: 1.1rem; }
.panel-heading p { margin: 0; color: #8a99a5; font-size: .72rem; }
.panel-heading > a { font-size: .74rem; font-weight: 750; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 17px; margin-bottom: 20px; }
.metric { display: flex; align-items: center; gap: 15px; min-width: 0; padding: 20px; border: 1px solid #e1e9ee; border-radius: 12px; background: #fff; box-shadow: 0 7px 20px rgba(27,67,97,.04); }
.metric-icon { width: 45px; height: 45px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 11px; }
.metric-icon.blue { color: #1674ac; background: #e4f2f9; }.metric-icon.red { color: #bd5158; background: #fdebed; }.metric-icon.green { color: #248273; background: #e4f5f1; }.metric-icon.amber { color: #a27216; background: #fff3dc; }
.metric > div { min-width: 0; display: grid; }
.metric small { overflow: hidden; color: #778b9b; font-size: .69rem; text-overflow: ellipsis; white-space: nowrap; }
.metric strong { margin: 1px 0; color: #173b58; font-size: 1.75rem; }
.metric div span { color: #9aa8b3; font-size: .65rem; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 20px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 18px; color: #8495a2; background: #f8fafb; font-size: .65rem; letter-spacing: .06em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 15px 18px; border-top: 1px solid #edf1f4; color: #526b7e; font-size: .77rem; vertical-align: middle; }
td strong, td small { display: block; }
td strong { color: #29475f; font-size: .78rem; }
td small { margin-top: 4px; color: #94a1ab; font-size: .67rem; }
.badge { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: 999px; font-size: .62rem; font-weight: 800; white-space: nowrap; }
.badge-success { color: #14735f; background: #ddf4ed; }.badge-warning { color: #946815; background: #fff1d3; }.badge-danger { color: #a84047; background: #fde8e9; }.badge-neutral { color: #597084; background: #eaf0f4; }
.activity-list { margin: 0; padding: 9px 24px 17px; list-style: none; }
.activity-list li { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid #edf1f4; }
.activity-list li:last-child { border-bottom: 0; }
.activity-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: #15727e; background: #e4f5f3; }
.activity-icon svg { width: 16px; }
.activity-list div { display: grid; }
.activity-list strong { color: #3d566b; font-size: .72rem; }
.activity-list small { margin-top: 3px; color: #9aa7b1; font-size: .64rem; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; }
.toolbar > span { color: #8695a1; font-size: .72rem; }
.search { position: relative; display: flex; align-items: center; width: min(330px, 100%); }
.search svg { position: absolute; left: 12px; width: 17px; color: #8ea0ad; }
.search input { width: 100%; height: 40px; padding: 0 13px 0 38px; border: 1px solid #dce5eb; border-radius: 8px; outline: 0; }
.search input:focus { border-color: #3e92ba; box-shadow: 0 0 0 3px rgba(62,146,186,.1); }
.person { display: flex; align-items: center; gap: 10px; min-width: 185px; }
.table-action { display: inline-flex; min-height: 34px; align-items: center; gap: 7px; padding: 4px 10px 4px 6px; border: 1px solid #d6e4ec; border-radius: 9px; color: #12678f; background: linear-gradient(180deg, #fff, #f3f8fb); box-shadow: 0 2px 7px rgba(28,75,104,.05); font-size: .66rem; font-weight: 800; cursor: pointer; white-space: nowrap; transition: color .16s, border-color .16s, background .16s, box-shadow .16s, transform .16s; }
.table-action:hover { color: #0d5880; border-color: #9fc8d9; background: #edf7fb; box-shadow: 0 5px 12px rgba(24,91,126,.11); text-decoration: none; transform: translateY(-1px); }
.table-action:focus-visible { outline: 3px solid rgba(35,137,177,.2); outline-offset: 2px; }
.table-action svg { width: 23px; height: 23px; margin: -1px 0 -1px -1px; padding: 4px; border-radius: 6px; color: #0f719b; background: #e3f1f6; stroke-width: 2; }
.table-action.action-edit { color: #185f88; border-color: #cbdfea; }
.table-action.action-edit svg { color: #126c99; background: #e1f0f6; }
.table-action.action-manage { color: #55508f; border-color: #d9d6ed; }
.table-action.action-manage svg { color: #625ca0; background: #eceafa; }
.table-action.action-view { color: #267064; border-color: #cce3de; }
.table-action.action-view svg { color: #1f796b; background: #e3f4ef; }
.table-action.action-send svg { color: #166da2; background: #e3eff9; }
.table-action.action-download svg { color: #33705e; background: #e5f3ed; }
.table-action.action-add { color: #765719; border-color: #e7d9b9; }
.table-action.action-add svg { color: #8a641d; background: #f8efd8; }
.patient-row-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.patient-row-actions button { font: inherit; }
.summary-strip { display: flex; gap: 32px; margin-bottom: 17px; padding: 17px 20px; border: 1px solid #e1e9ee; border-radius: 11px; color: #7a8c9a; background: #fff; font-size: .75rem; }
.summary-strip strong { margin-right: 5px; color: #1a4966; font-size: 1rem; }
.result-list { display: grid; gap: 14px; }
.result-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 21px 23px; border: 1px solid #dfe8ed; border-radius: 13px; background: white; box-shadow: 0 8px 22px rgba(27,67,97,.035); }
.result-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; color: #a6434b; background: #fdebed; }
.result-top { display: flex; justify-content: space-between; gap: 15px; }
.result-top h2 { margin: 4px 0 0; color: #25455e; font-family: Georgia, serif; font-size: 1.05rem; }
.result-content > p { margin: 9px 0; color: #718492; font-size: .77rem; line-height: 1.55; }
.result-meta { display: flex; gap: 18px; color: #96a4ae; font-size: .66rem; }
.download-button { display: inline-flex; min-height: 40px; align-items: center; gap: 8px; padding: 8px 13px 8px 9px; border: 1px solid #cfe3ed; border-radius: 9px; color: #106c9a; background: linear-gradient(180deg, #fbfeff, #eef7fa); box-shadow: 0 3px 10px rgba(27,91,123,.06); font-size: .68rem; font-weight: 800; white-space: nowrap; cursor: pointer; transition: transform .16s, box-shadow .16s, background .16s; }
.download-button:hover { background: #e8f4f8; box-shadow: 0 6px 14px rgba(27,91,123,.1); text-decoration: none; transform: translateY(-1px); }
.download-button svg { width: 24px; height: 24px; padding: 4px; border-radius: 6px; color: #176e97; background: #dceef5; }
.download-button.validate-button { color: #19715f; border-color: #c7e4da; background: linear-gradient(180deg, #fbfffd, #edf8f4); }
.download-button.validate-button svg { color: #187764; background: #def3ec; }
.muted-action { color: #9aa8b2; font-size: .68rem; white-space: nowrap; }
.history-timeline { position: relative; display: grid; gap: 18px; padding-left: 25px; }
.history-timeline::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px; background: #d9e6eb; }
.history-entry { position: relative; }
.timeline-dot { position: absolute; left: -24px; top: 25px; width: 13px; height: 13px; border: 3px solid #f4f7f9; border-radius: 50%; background: #36aaa7; box-shadow: 0 0 0 1px #8fd2cf; }
.history-card { padding: 24px; border: 1px solid #dfe8ed; border-radius: 13px; background: white; }
.history-heading { display: flex; justify-content: space-between; gap: 18px; }
.history-heading h2 { margin: 4px 0; color: #24445e; font-family: Georgia, serif; font-size: 1.15rem; }
.history-heading p { margin: 0; color: #718491; font-size: .76rem; }
.history-heading > span { color: #718491; font-size: .7rem; }
.vitals { margin: 17px 0; padding: 10px 13px; border-left: 3px solid #52bdb7; color: #396278; background: #f0f8f8; font: 700 .7rem ui-monospace, monospace; }
.clinical-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px 25px; }
.clinical-grid .span-2 { grid-column: span 2; }
.clinical-grid strong { color: #3d576b; font-size: .72rem; }
.clinical-grid p { margin: 6px 0 0; color: #768793; font-size: .75rem; line-height: 1.55; }
.role-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.role-card { display: flex; gap: 13px; padding: 18px; border: 1px solid #e0e8ed; border-radius: 11px; background: white; }
.role-card strong { color: #304d63; font-size: .78rem; }
.role-card p { margin: 4px 0; color: #8594a0; font-size: .67rem; line-height: 1.4; }
.role-card small { color: #a0abb3; font-size: .62rem; }
.modal { width: min(620px, calc(100% - 30px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: 15px; color: var(--ink); box-shadow: 0 25px 80px rgba(4,35,57,.3); }
.modal-wide { width: min(760px, calc(100% - 30px)); }
.modal::backdrop { background: rgba(5,32,53,.62); backdrop-filter: blur(3px); }
.modal form { padding: 27px; }
.modal-heading { display: flex; justify-content: space-between; align-items: start; margin-bottom: 23px; }
.modal-heading h2 { margin: 5px 0 0; font-family: Georgia, serif; }
.modal-heading p { margin: 5px 0 0; color: #8796a1; font-size: .7rem; }
.modal-heading button { width: 33px; height: 33px; border: 0; border-radius: 8px; color: #718492; background: #eef3f6; font-size: 1.35rem; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid label { display: grid; gap: 7px; color: #435e72; font-size: .71rem; font-weight: 750; }
.form-grid [hidden] { display: none !important; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #d9e3e9; border-radius: 8px; color: #25445c; background: white; outline: 0; }
.form-grid textarea { min-height: 75px; resize: vertical; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { border-color: #3e92ba; box-shadow: 0 0 0 3px rgba(62,146,186,.1); }
.field-help { color: #8b9aa6; font-size: .6rem; font-weight: 500; }
.appointment-patient-picker { position: relative; }
.appointment-patient-picker > svg { position: absolute; z-index: 2; top: 12px; left: 12px; width: 17px; color: #879aa8; pointer-events: none; }
.appointment-patient-picker > input[type="search"] { padding-left: 38px; }
.appointment-patient-picker > input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.appointment-patient-options { position: absolute; z-index: 12; top: calc(100% + 6px); right: 0; left: 0; max-height: 245px; overflow-y: auto; display: none; padding: 6px; border: 1px solid #d6e2ea; border-radius: 10px; background: #fff; box-shadow: 0 16px 35px rgba(22,59,86,.18); }
.appointment-patient-options.open { display: grid; gap: 3px; }
.appointment-patient-options button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px; border: 0; border-radius: 8px; color: #3d596d; background: transparent; text-align: left; cursor: pointer; }
.appointment-patient-options button:hover, .appointment-patient-options button:focus { outline: 0; background: #edf6fb; }
.appointment-patient-options .avatar { width: 33px; height: 33px; border-radius: 9px; }
.appointment-patient-options button > span:last-child { min-width: 0; display: grid; }
.appointment-patient-options strong { overflow: hidden; color: #284a62; font-size: .69rem; text-overflow: ellipsis; white-space: nowrap; }
.appointment-patient-options small { overflow: hidden; margin-top: 2px; color: #8999a5; font-size: .59rem; text-overflow: ellipsis; white-space: nowrap; }
.appointment-patient-options > p { margin: 0; padding: 17px 10px; color: #8d9ba5; font-size: .65rem; text-align: center; }
.professional-availability { padding: 14px; border: 1px solid #cfe4eb; border-radius: 10px; background: #f4fafb; }
.professional-availability[hidden] { display: none; }
.professional-availability > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.professional-availability > div:first-child strong { color: #22516d; font-size: .75rem; }
.professional-availability > div:first-child small { color: #718a98; font-size: .59rem; }
.professional-availability > p { margin: 7px 0 11px; color: #69808f; font-size: .64rem; }
.availability-slots { display: flex; flex-wrap: wrap; gap: 7px; max-height: 154px; overflow-y: auto; }
.availability-slot { min-width: 82px; display: grid; gap: 2px; padding: 8px 10px; border: 1px solid #c8dfe7; border-radius: 8px; color: #27607e; background: #fff; text-align: left; cursor: pointer; }
.availability-slot:hover, .availability-slot:focus, .availability-slot.selected { border-color: #2587ad; outline: 0; color: #0b678e; background: #e8f6fa; box-shadow: 0 0 0 2px rgba(37,135,173,.1); }
.availability-slot small { color: #78909e; font-size: .55rem; text-transform: capitalize; }
.availability-slot strong { font-size: .72rem; }
.availability-slot.compact { min-width: 67px; display: block; text-align: center; font-size: .68rem; font-weight: 800; }
.availability-layout { display: grid; grid-template-columns: 255px minmax(0, 1fr); align-items: start; gap: 20px; }
.availability-doctors { position: sticky; top: 24px; overflow: hidden; padding: 18px; border: 1px solid #dfe8ed; border-radius: 13px; background: white; box-shadow: 0 8px 22px rgba(27,67,97,.035); }
.availability-doctors > div { margin-bottom: 14px; }
.availability-doctors h2 { margin: 5px 0; color: #24455e; font-family: Georgia, serif; font-size: 1rem; }
.availability-doctors p { margin: 0; color: #8495a1; font-size: .65rem; line-height: 1.45; }
.availability-doctor { display: flex; align-items: center; gap: 10px; margin-top: 7px; padding: 10px; border: 1px solid transparent; border-radius: 9px; color: #456276; }
.availability-doctor:hover { background: #f5f9fb; text-decoration: none; }
.availability-doctor.active { border-color: #bcdde8; color: #155e80; background: #edf8fa; }
.availability-doctor .avatar { width: 35px; height: 35px; flex: 0 0 auto; border-radius: 9px; }
.availability-doctor > span:last-child { min-width: 0; display: grid; }
.availability-doctor strong { overflow: hidden; font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.availability-doctor small { margin-top: 2px; color: #8ba0ac; font-size: .56rem; }
.availability-editor { min-width: 0; }
.availability-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.availability-summary article { display: grid; padding: 15px 17px; border: 1px solid #dfe8ed; border-radius: 11px; background: white; }
.availability-summary small { color: #7e919e; font-size: .61rem; }
.availability-summary strong { margin: 3px 0; color: #184966; font-size: 1.2rem; }
.availability-summary span { color: #9aa7b0; font-size: .57rem; }
.availability-config { overflow: hidden; }
.availability-editor-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 23px 24px; border-bottom: 1px solid #e8eef2; }
.availability-editor-heading h2 { margin: 5px 0; color: #24445e; font-family: Georgia, serif; font-size: 1.2rem; }
.availability-editor-heading p, .section-heading p { margin: 0; color: #82939f; font-size: .67rem; }
.availability-editor-heading > label { min-width: 160px; display: grid; gap: 6px; color: #536c7e; font-size: .65rem; font-weight: 750; }
.availability-editor-heading select { min-height: 40px; padding: 8px 10px; border: 1px solid #d5e1e7; border-radius: 8px; color: #28506a; background: white; }
.monthly-availability { padding: 23px 24px; }
.monthly-calendar-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.monthly-calendar-heading h3 { margin: 5px 0; color: #284b64; font-size: .9rem; }
.monthly-calendar-heading p { margin: 0; color: #82939f; font-size: .65rem; }
.calendar-navigation { display: flex; align-items: center; gap: 6px; }
.calendar-navigation button { min-width: 34px; height: 34px; padding: 0 9px; border: 1px solid #d6e3e9; border-radius: 7px; color: #42657a; background: white; font-weight: 750; cursor: pointer; }
.calendar-navigation button:hover { border-color: #9ccbd9; background: #f0f8fa; }
.calendar-navigation strong { min-width: 135px; color: #284c64; font-size: .71rem; text-align: center; text-transform: capitalize; }
.calendar-weekdays, .monthly-calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.calendar-weekdays { margin-bottom: 6px; }
.calendar-weekdays span { color: #8699a5; font-size: .58rem; font-weight: 800; text-align: center; text-transform: uppercase; }
.calendar-day, .calendar-day-spacer { min-height: 76px; }
.calendar-day { display: grid; align-content: space-between; padding: 8px; border: 1px solid #e0e8ed; border-radius: 9px; color: #4d687a; background: #fafcfd; text-align: left; cursor: pointer; transition: border-color .16s, transform .16s, box-shadow .16s; }
.calendar-day:hover, .calendar-day:focus { z-index: 1; border-color: #78bad0; outline: 0; transform: translateY(-1px); box-shadow: 0 5px 13px rgba(27,91,122,.1); }
.calendar-day strong { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; font-size: .68rem; }
.calendar-day small { overflow: hidden; color: #8497a2; font-size: .52rem; text-overflow: ellipsis; white-space: nowrap; }
.calendar-day.available { border-color: #cce7df; background: #f1faf7; }
.calendar-day.available small { color: #378270; }
.calendar-day.special { border-color: #a9d6e5; background: #eaf7fb; }
.calendar-day.special small { color: #167797; font-weight: 750; }
.calendar-day.blocked { border-color: #f0d4d7; background: #fff5f5; }
.calendar-day.blocked small { color: #a85a61; }
.calendar-day.off { color: #9ba8b0; background: #fafbfc; }
.calendar-day.today strong { color: white; background: #185f8c; }
.calendar-day.selected { border-color: #176f99; box-shadow: 0 0 0 2px rgba(23,111,153,.14); }
.calendar-day.week-selected { border-color: #6faec4; }
.calendar-day.week-selected:not(.selected) { box-shadow: inset 0 0 0 1px rgba(44,135,166,.12); }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; color: #778c99; font-size: .57rem; }
.calendar-legend span { display: inline-flex; align-items: center; gap: 5px; }
.calendar-legend i { width: 9px; height: 9px; border: 1px solid #d6e1e6; border-radius: 3px; background: #fafbfc; }
.calendar-legend i.available { border-color: #b9dfd4; background: #e5f6f0; }
.calendar-legend i.special { border-color: #91cadd; background: #dff3f8; }
.calendar-legend i.blocked { border-color: #e8c5c9; background: #fbe8ea; }
.calendar-date-editor { display: grid; grid-template-columns: minmax(180px, 1fr) 210px; align-items: end; gap: 15px; margin-top: 16px; padding: 15px; border: 1px solid #c8dfe8; border-radius: 10px; background: #f3f9fb; }
.calendar-date-editor[hidden], .date-special-schedule[hidden] { display: none; }
.calendar-date-editor h4 { margin: 4px 0; color: #204f6c; font-family: Georgia, serif; font-size: 1rem; text-transform: capitalize; }
.calendar-date-editor p { margin: 0; color: #78909d; font-size: .61rem; }
.calendar-date-editor > label { display: grid; gap: 5px; color: #536f81; font-size: .6rem; font-weight: 750; }
.calendar-date-editor select { min-height: 39px; padding: 8px; border: 1px solid #d2e0e7; border-radius: 7px; color: #2d536b; background: white; }
.selected-week-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px; border: 1px solid #d5e6ec; border-radius: 9px; background: white; }
.selected-week-actions > div:first-child { display: grid; }
.selected-week-actions strong { color: #345c73; font-size: .65rem; text-transform: capitalize; }
.selected-week-actions small { margin-top: 3px; color: #8497a3; font-size: .56rem; }
.selected-week-actions > div:last-child { display: flex; gap: 7px; }
.selected-week-actions .button { min-height: 37px; padding: 0 12px; font-size: .6rem; }
.date-special-schedule { grid-column: 1 / -1; padding-top: 12px; border-top: 1px solid #d9e7ec; }
.date-special-heading { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.date-special-heading strong { color: #466477; font-size: .64rem; }
.date-special-schedule > div:last-child { display: flex; flex-wrap: wrap; gap: 8px; }
.weekly-template { border-top: 1px solid #e8eef2; }
.weekly-template > summary { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 18px 24px; color: #36586e; background: #fafcfd; cursor: pointer; list-style: none; }
.weekly-template > summary::-webkit-details-marker { display: none; }
.weekly-template > summary > span:first-child { display: grid; }
.weekly-template > summary strong { font-size: .72rem; }
.weekly-template > summary small { margin-top: 3px; color: #8a9ba6; font-size: .58rem; }
.weekly-template > summary > span:last-child { color: #14779d; font-size: .62rem; font-weight: 800; }
.weekly-template[open] > summary { border-bottom: 1px solid #e8eef2; }
.weekly-schedule, .absence-section { padding: 23px 24px; }
.absence-section { border-top: 1px solid #e8eef2; }
.weekly-schedule > .section-heading, .absence-section > .section-heading { margin-bottom: 15px; padding: 0; border: 0; }
.weekly-schedule h3, .absence-section h3 { margin: 0 0 4px; color: #284b64; font-size: .82rem; }
.schedule-day { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 14px; margin-top: 8px; padding: 11px 12px; border: 1px solid #e2e9ed; border-radius: 9px; background: #f8fafb; opacity: .72; }
.schedule-day.enabled { border-color: #d3e6ec; background: #f4fafb; opacity: 1; }
.schedule-day header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.schedule-day-toggle { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.schedule-day-toggle input { width: 17px; height: 17px; accent-color: #1784a7; }
.schedule-day-toggle span { display: grid; }
.schedule-day-toggle strong { color: #36596f; font-size: .7rem; }
.schedule-day-toggle small { margin-top: 2px; color: #90a0aa; font-size: .55rem; }
.schedule-day header .text-button { font-size: .58rem; }
.schedule-intervals { display: flex; flex-wrap: wrap; gap: 8px; }
.schedule-interval { display: flex; align-items: end; gap: 6px; padding: 7px; border: 1px solid #dbe6eb; border-radius: 8px; background: white; }
.schedule-interval label, .absence-row label { display: grid; gap: 4px; color: #718692; font-size: .54rem; font-weight: 700; }
.schedule-interval input { width: 93px; height: 34px; padding: 6px 7px; border: 1px solid #d8e3e8; border-radius: 6px; color: #31546a; background: white; }
.schedule-interval button, .absence-row > button { width: 31px; height: 31px; border: 0; border-radius: 6px; color: #9a5860; background: #faecee; cursor: pointer; }
.absence-list { display: grid; gap: 8px; }
.absence-row { display: grid; grid-template-columns: 145px 145px minmax(180px, 1fr) auto; align-items: end; gap: 9px; padding: 10px; border: 1px solid #e0e8ed; border-radius: 9px; background: #fafcfd; }
.absence-row input { width: 100%; height: 36px; padding: 7px 8px; border: 1px solid #d7e2e8; border-radius: 7px; color: #31546a; background: white; }
.absence-row > button { margin-bottom: 2px; }
.absence-empty { margin: 0; padding: 18px; border: 1px dashed #d7e3e9; border-radius: 9px; color: #8a9ba6; background: #fafcfd; font-size: .65rem; text-align: center; }
.availability-save { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 24px; border-top: 1px solid #e8eef2; background: #f8fafb; }
.availability-save p { margin: 0; color: #788d9a; font-size: .65rem; }
.availability-save .button { min-height: 43px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.forbidden, .empty-state { padding: 55px 30px; text-align: center; }
.forbidden > svg, .empty-state > svg { width: 38px; height: 38px; color: #6bbdb7; }
.forbidden p, .empty-state p { color: #788b99; }
.user-modal { width: min(820px, calc(100% - 30px)); }
.user-modal form { max-height: calc(100vh - 40px); overflow-y: auto; }
.form-grid label > small { color: #9a7b3c; font-size: .62rem; font-weight: 500; }
.status-control { align-content: start; }
.switch-row { min-height: 42px; display: flex; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid #d9e3e9; border-radius: 8px; color: #4e687b; font-weight: 600; }
.switch-row input { width: 17px; min-height: auto; height: 17px; padding: 0; accent-color: #168378; }
.permissions-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 27px 0 13px; padding-top: 20px; border-top: 1px solid #e6edf1; }
.permissions-heading h3 { margin: 0 0 4px; color: #294b64; font-family: Georgia, serif; font-size: 1rem; }
.permissions-heading p { margin: 0; color: #8a99a4; font-size: .68rem; }
.text-button { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; color: #0c719e; background: transparent; font-size: .68rem; font-weight: 800; cursor: pointer; }
.text-button:hover { text-decoration: underline; }
.text-button svg { width: 16px; height: 16px; }
.permission-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 12px; }
.permission-grid h3 { grid-column: span 2; margin: 12px 0 2px; color: #708493; font-size: .64rem; letter-spacing: .08em; text-transform: uppercase; }
.permission-grid h3:first-child { margin-top: 0; }
.permission-check { display: flex; align-items: center; gap: 9px; min-height: 45px; padding: 8px 10px; border: 1px solid #e2e9ed; border-radius: 8px; background: #fbfcfd; cursor: pointer; }
.permission-check:has(input:checked) { border-color: #9bd4d0; background: #f0faf8; }
.permission-check input { width: 17px; height: 17px; flex: 0 0 auto; accent-color: #168378; }
.permission-check > span { display: grid; }
.permission-check strong { color: #456176; font-size: .68rem; }
.permission-check small { margin-top: 2px; color: #98a5ae; font: .57rem ui-monospace, monospace; }
.security-note { margin: 14px 0 0; padding: 10px 12px; border-radius: 7px; color: #826014; background: #fff6df; font-size: .67rem; }
.history-directory { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.patient-history-card { display: grid; gap: 19px; padding: 22px; border: 1px solid #dde7ec; border-radius: 13px; background: white; box-shadow: 0 8px 24px rgba(27,67,97,.04); }
.patient-card-main { display: flex; align-items: center; gap: 13px; }
.patient-card-main .avatar { width: 46px; height: 46px; border-radius: 12px; }
.patient-card-main h2 { margin: 3px 0; color: #26475f; font-family: Georgia, serif; font-size: 1.15rem; }
.patient-card-main p { margin: 0; color: #8494a0; font-size: .69rem; }
.patient-card-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.patient-card-summary span { display: grid; padding: 10px; border-radius: 8px; color: #83929d; background: #f5f8fa; font-size: .61rem; text-align: center; }
.patient-card-summary strong { color: #27516a; font-size: 1rem; }
.patient-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding-top: 14px; border-top: 1px solid #edf1f4; }
.patient-card-footer > span { color: #8997a2; font-size: .65rem; }
.patient-card-footer .button { min-height: 36px; padding: 0 13px; font-size: .68rem; }
.clinical-alerts { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; padding: 12px 14px; border: 1px solid #dfe7ec; border-radius: 10px; background: white; }
.clinical-alert { display: inline-flex; gap: 4px; padding: 7px 10px; border-radius: 7px; font-size: .66rem; }
.alert-critical { color: #a53c43; background: #fde8e9; }.alert-warning { color: #8c6417; background: #fff2d8; }.alert-info { color: #166b8e; background: #e7f4f9; }
.clinical-alerts .text-button { margin-left: auto; }
.no-alerts { color: #698395; font-size: .7rem; }
.longitudinal-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 20px; }
.longitudinal-grid article { display: grid; gap: 5px; padding: 15px; border: 1px solid #e0e8ed; border-radius: 10px; background: white; }
.longitudinal-grid small { color: #82929e; font-size: .62rem; }
.longitudinal-grid strong { color: #17415c; font-size: .9rem; }
.clinical-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(270px, .7fr); gap: 20px; align-items: start; }
.section-heading { display: flex; justify-content: space-between; margin-bottom: 16px; }
.section-heading h2 { margin: 5px 0 0; color: #26475f; font-family: Georgia, serif; font-size: 1.25rem; }
.clinical-sidebar { display: grid; gap: 13px; position: sticky; top: 20px; }
.clinical-box { padding: 18px; border: 1px solid #dfe8ed; border-radius: 11px; background: white; }
.clinical-box h3 { margin: 0 0 13px; color: #315168; font-family: Georgia, serif; font-size: .95rem; }
.clinical-box ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.clinical-box li { display: flex; align-items: center; justify-content: space-between; gap: 9px; padding-bottom: 8px; border-bottom: 1px solid #edf1f3; color: #6f8290; font-size: .65rem; }
.clinical-box li:last-child { padding-bottom: 0; border-bottom: 0; }
.clinical-box li > span { display: grid; }
.clinical-box li strong { margin-bottom: 2px; color: #3d5a6f; font-size: .68rem; }
.clinical-box p { color: #728592; font-size: .68rem; line-height: 1.5; }
.clinical-box p strong { color: #405f75; }
.clinical-signature { display: flex; align-items: center; gap: 7px; margin-top: 17px; padding-top: 13px; border-top: 1px solid #e7edef; color: #668090; font-size: .63rem; }
.clinical-signature svg { width: 15px; color: #188277; }
.history-heading > div:last-child { display: flex; align-items: center; gap: 8px; }
.addendum { margin-top: 14px; padding: 12px; border-left: 3px solid #d9a53f; border-radius: 0 7px 7px 0; background: #fff9ea; }
.addendum strong { color: #7c5b19; font-size: .68rem; }
.addendum p { margin: 5px 0; color: #675f50; font-size: .7rem; }
.addendum small { color: #9b8b69; font-size: .58rem; }
.audit-panel { margin-top: 22px; }
.clinical-modal { width: min(930px, calc(100% - 30px)); }
.clinical-modal form { max-height: calc(100vh - 30px); overflow-y: auto; }
.clinical-form-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid #e6edf1; }
.clinical-form-section h3 { margin: 0 0 13px; color: #37576e; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.vital-form-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.vital-form-grid label { display: grid; gap: 6px; color: #486376; font-size: .65rem; font-weight: 700; }
.vital-form-grid input { width: 100%; min-height: 40px; padding: 8px; border: 1px solid #d9e3e9; border-radius: 7px; outline: none; }
.vital-form-grid input:focus { border-color: #3e92ba; box-shadow: 0 0 0 3px rgba(62,146,186,.1); }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .role-grid { grid-template-columns: 1fr 1fr; }
  .availability-summary { grid-template-columns: 1fr 1fr; }
  .longitudinal-grid { grid-template-columns: repeat(3, 1fr); }
  .vital-form-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1180px) and (min-width: 821px) {
  .app-main:has(.assistant-layout) .page-wrap { width: min(100% - 36px, 1280px); padding: 36px 0 70px; }
  .assistant-overview { display: none; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; width: 260px; left: -280px; transition: left .2s; }
  body.menu-open .sidebar { left: 0; }
  .mobile-header { height: 67px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; color: white; background: #073b66; }
  .mobile-header .brand { font-size: 1rem; }
  .mobile-header .brand-mark { width: 32px; height: 32px; }
  .menu-toggle { border: 0; color: white; background: transparent; font-size: 1.3rem; }
  .page-wrap { width: min(100% - 30px, 1280px); padding-top: 30px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .clinical-layout { grid-template-columns: 1fr; }
  .clinical-sidebar { position: static; grid-template-columns: 1fr 1fr; }
  .history-directory { grid-template-columns: 1fr; }
  .availability-layout { grid-template-columns: 1fr; }
  .availability-doctors { position: static; display: flex; align-items: center; overflow-x: auto; }
  .availability-doctors > div { min-width: 210px; margin: 0 10px 0 0; }
  .availability-doctor { min-width: 195px; margin: 0; }
  .result-card { grid-template-columns: auto 1fr; }
  .download-button, .muted-action { grid-column: 2; justify-self: start; }
}
@media (max-width: 600px) {
  .page-header { align-items: flex-start; flex-direction: column; }
  .metric-grid, .role-grid { grid-template-columns: 1fr; }
  .summary-strip { align-items: flex-start; flex-direction: column; gap: 9px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .clinical-grid { grid-template-columns: 1fr; }
  .clinical-grid .span-2 { grid-column: auto; }
  .result-card { grid-template-columns: 1fr; }
  .result-icon { display: none; }
  .download-button, .muted-action { grid-column: 1; }
  .permission-grid { grid-template-columns: 1fr; }
  .permission-grid h3 { grid-column: auto; }
  .permissions-heading { align-items: flex-start; flex-direction: column; }
  .availability-summary { grid-template-columns: 1fr 1fr; }
  .availability-editor-heading { align-items: flex-start; flex-direction: column; }
  .availability-editor-heading > label { width: 100%; }
  .monthly-availability { padding: 18px 12px; }
  .monthly-calendar-heading { align-items: flex-start; flex-direction: column; }
  .calendar-navigation { width: 100%; justify-content: space-between; }
  .calendar-navigation strong { min-width: auto; }
  .calendar-day, .calendar-day-spacer { min-height: 58px; }
  .calendar-day { padding: 5px; }
  .calendar-day small { font-size: .45rem; }
  .calendar-date-editor { grid-template-columns: 1fr; }
  .selected-week-actions { grid-column: auto; align-items: stretch; flex-direction: column; }
  .selected-week-actions > div:last-child { flex-direction: column; }
  .date-special-schedule { grid-column: auto; }
  .calendar-legend { gap: 8px; }
  .weekly-schedule, .absence-section { padding: 18px 14px; }
  .schedule-day { grid-template-columns: 1fr; }
  .absence-section > .section-heading { align-items: flex-start; flex-direction: column; }
  .absence-row { grid-template-columns: 1fr 1fr auto; }
  .absence-row label:nth-child(3) { grid-column: span 2; }
  .availability-save { align-items: stretch; flex-direction: column; }
  .longitudinal-grid { grid-template-columns: 1fr 1fr; }
  .clinical-sidebar { grid-template-columns: 1fr; }
  .vital-form-grid { grid-template-columns: 1fr 1fr; }
  .patient-card-summary { grid-template-columns: 1fr; }
  .patient-card-footer { align-items: flex-start; flex-direction: column; }
}

/* Identidad CMI del Corazón + Liquid Glass */
body {
  background-color: #edf4fb;
  background-image:
    radial-gradient(circle at 8% 8%, rgba(18, 90, 167, .18), transparent 31%),
    radial-gradient(circle at 92% 5%, rgba(230, 46, 59, .13), transparent 27%),
    radial-gradient(circle at 78% 92%, rgba(18, 90, 167, .1), transparent 30%),
    linear-gradient(145deg, #f7faff 0%, #eaf2fa 46%, #f8f4f5 100%);
  background-attachment: fixed;
}

.brand {
  width: 100%;
  max-width: 230px;
  display: inline-flex;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 14px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 9px 30px rgba(10, 43, 75, .12), inset 0 1px 0 rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
}

.brand-logo {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.welcome-panel {
  background:
    radial-gradient(circle at 83% 15%, rgba(255,255,255,.17), transparent 23%),
    radial-gradient(circle at 16% 82%, rgba(230,46,59,.32), transparent 29%),
    linear-gradient(145deg, #082f5f 0%, #125aa7 58%, #15324a 100%);
}

.welcome-panel::before {
  border: 1px solid rgba(255,255,255,.16);
  background: linear-gradient(135deg, rgba(255,255,255,.2), rgba(255,255,255,.035));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 30px 80px rgba(0,0,0,.13);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.welcome-panel::after { background: linear-gradient(135deg, rgba(230,46,59,.27), rgba(8,47,95,.25)); }
.welcome-copy h1 em, .trust-line svg { color: #ff7680; }
.eyebrow { color: var(--red); }
.welcome-panel .eyebrow { color: #ff8991; }

.form-panel {
  background: linear-gradient(150deg, rgba(255,255,255,.5), rgba(241,247,252,.3));
}

.auth-card {
  max-width: 480px;
  padding: clamp(25px, 4vw, 40px);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 25px;
  background: linear-gradient(145deg, rgba(255,255,255,.78), rgba(255,255,255,.52));
  box-shadow: 0 30px 75px rgba(20,61,98,.14), inset 0 1px 0 #fff;
  -webkit-backdrop-filter: blur(30px) saturate(165%);
  backdrop-filter: blur(30px) saturate(165%);
}

.auth-card::before {
  content: "";
  width: 72px;
  height: 7px;
  display: block;
  margin: -40px auto 30px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--red));
  box-shadow: 0 5px 18px rgba(18,90,167,.2);
}

.field input, .search input, .form-grid input, .form-grid select, .form-grid textarea, .vital-form-grid input {
  border-color: rgba(148, 174, 195, .38);
  background: rgba(255,255,255,.62);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.field input:focus, .search input:focus, .form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus, .vital-form-grid input:focus {
  border-color: rgba(18,90,167,.68);
  box-shadow: 0 0 0 4px rgba(18,90,167,.1), inset 0 1px 0 #fff;
}

.button {
  background: linear-gradient(112deg, #0d4c92 0%, #125aa7 70%, #e62e3b 140%);
  box-shadow: 0 12px 28px rgba(18,90,167,.2), inset 0 1px 0 rgba(255,255,255,.25);
}

.button:hover { box-shadow: 0 16px 32px rgba(18,90,167,.25), 0 4px 12px rgba(230,46,59,.1), inset 0 1px 0 rgba(255,255,255,.3); }
.button.secondary { border-color: rgba(255,255,255,.82); background: rgba(255,255,255,.58); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }

.app-page { background: transparent; }
.sidebar {
  border-right: 1px solid rgba(255,255,255,.22);
  background:
    linear-gradient(180deg, rgba(8,47,95,.9), rgba(21,50,74,.88)),
    radial-gradient(circle at top, rgba(18,90,167,.55), transparent 55%);
  box-shadow: 12px 0 40px rgba(15,48,79,.13), inset -1px 0 0 rgba(255,255,255,.1);
  -webkit-backdrop-filter: blur(26px) saturate(145%);
  backdrop-filter: blur(26px) saturate(145%);
}

.sidebar-brand { padding: 0 4px 30px; }
.sidebar .brand { max-width: 100%; padding: 8px; border-radius: 13px; }
.nav-link { color: rgba(229,240,249,.75); }
.nav-link:hover { background: rgba(255,255,255,.1); }
.nav-link.active {
  color: #fff;
  background: linear-gradient(100deg, rgba(18,90,167,.5), rgba(230,46,59,.24));
  box-shadow: inset 3px 0 #ff5a66, 0 9px 24px rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.12);
}

.mobile-header {
  border-bottom: 1px solid rgba(255,255,255,.25);
  background: rgba(8,47,95,.86);
  box-shadow: 0 8px 30px rgba(15,48,79,.13);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  backdrop-filter: blur(24px) saturate(150%);
}
.mobile-header .brand { width: 165px; padding: 4px 7px; }

.panel, .metric, .result-card, .history-card, .clinical-box, .patient-history-card,
.longitudinal-grid article, .role-card, .summary-strip {
  border-color: rgba(255,255,255,.72);
  background: linear-gradient(145deg, rgba(255,255,255,.72), rgba(247,251,255,.52));
  box-shadow: 0 14px 38px rgba(25,65,99,.075), inset 0 1px 0 rgba(255,255,255,.92);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
  backdrop-filter: blur(22px) saturate(145%);
}

.metric:hover, .patient-history-card:hover, .result-card:hover {
  border-color: rgba(18,90,167,.2);
  box-shadow: 0 20px 46px rgba(25,65,99,.11), inset 0 1px 0 #fff;
  transform: translateY(-2px);
  transition: transform .2s ease, box-shadow .2s ease;
}

.panel-heading, td, .sidebar-profile { border-color: rgba(141,168,188,.18); }
th { background: rgba(238,245,250,.56); }
.toolbar, .clinical-alerts { border-color: rgba(255,255,255,.72); background: rgba(255,255,255,.57); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.metric-icon.red, .result-icon { color: var(--red); background: rgba(230,46,59,.11); }
.metric-icon.blue { color: var(--blue); background: rgba(18,90,167,.11); }
.timeline-dot { background: var(--red); box-shadow: 0 0 0 1px rgba(230,46,59,.35), 0 0 18px rgba(230,46,59,.28); }
.history-timeline::before { background: linear-gradient(var(--blue), var(--red)); opacity: .35; }
.vitals { border-color: var(--blue); background: rgba(18,90,167,.075); }

.modal {
  border: 1px solid rgba(255,255,255,.9);
  background: linear-gradient(145deg, rgba(255,255,255,.9), rgba(240,247,252,.76));
  box-shadow: 0 35px 100px rgba(5,35,62,.34), inset 0 1px 0 #fff;
  -webkit-backdrop-filter: blur(32px) saturate(160%);
  backdrop-filter: blur(32px) saturate(160%);
}
.modal::backdrop { background: rgba(8,29,48,.5); -webkit-backdrop-filter: blur(9px); backdrop-filter: blur(9px); }
.permission-check { background: rgba(255,255,255,.54); }
.permission-check:has(input:checked) { border-color: rgba(18,90,167,.3); background: linear-gradient(120deg, rgba(18,90,167,.09), rgba(230,46,59,.045)); }
.clinical-alert.alert-critical { color: #a8232e; background: rgba(230,46,59,.11); }
.download-button { color: var(--blue); border-color: rgba(18,90,167,.2); background: rgba(255,255,255,.55); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }

.history-overview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 18px; }
.history-overview article { min-width: 0; display: flex; align-items: center; gap: 13px; padding: 17px; border: 1px solid rgba(255,255,255,.72); border-radius: 12px; background: linear-gradient(145deg, rgba(255,255,255,.72), rgba(247,251,255,.52)); box-shadow: 0 12px 32px rgba(25,65,99,.065), inset 0 1px 0 rgba(255,255,255,.94); -webkit-backdrop-filter: blur(20px) saturate(145%); backdrop-filter: blur(20px) saturate(145%); }
.history-overview article > div { min-width: 0; display: grid; }
.history-overview small { overflow: hidden; color: #738997; font-size: .65rem; text-overflow: ellipsis; white-space: nowrap; }
.history-overview strong { color: #173f5a; font-size: 1.45rem; line-height: 1.15; }
.history-overview article div span { color: #98a6af; font-size: .59rem; }
.history-directory-panel { overflow: visible; }
.history-filters { display: grid; grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(125px, .65fr)) auto auto; gap: 9px; align-items: center; padding: 17px; border-bottom: 1px solid rgba(141,168,188,.18); }
.history-search { position: relative; display: flex; align-items: center; }
.history-search > svg { position: absolute; left: 12px; width: 17px; color: #7b91a1; pointer-events: none; }
.history-search input, .history-filters select { width: 100%; height: 40px; border: 1px solid rgba(148,174,195,.38); border-radius: 8px; color: #3f5d73; background: rgba(255,255,255,.62); outline: none; }
.history-search input { padding: 0 54px 0 38px; }
.history-filters select { padding: 0 28px 0 10px; font-size: .67rem; }
.history-search input:focus, .history-filters select:focus { border-color: rgba(18,90,167,.68); box-shadow: 0 0 0 4px rgba(18,90,167,.09); }
.history-search kbd { position: absolute; right: 9px; padding: 3px 6px; border: 1px solid #d9e2e8; border-radius: 5px; color: #94a2ac; background: rgba(255,255,255,.72); font: .57rem ui-monospace, monospace; }
.history-filters .button { min-height: 40px; padding: 0 17px; font-size: .7rem; }
.clear-filters { color: #7b8f9d; font-size: .66rem; font-weight: 750; white-space: nowrap; }
.history-result-bar { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 11px 18px; color: #718795; background: rgba(245,249,252,.48); font-size: .67rem; }
.history-result-bar small { color: #9aa7b0; font-size: .6rem; }
.history-directory-table { min-width: 1050px; }
.history-directory-table thead { position: sticky; top: 0; z-index: 2; }
.history-directory-table th { padding-top: 10px; padding-bottom: 10px; }
.history-directory-table tbody tr { transition: background .16s ease; }
.history-directory-table tbody tr:hover { background: rgba(18,90,167,.035); }
.history-directory-table td { height: 78px; }
.history-patient-cell { min-width: 220px; display: flex; align-items: center; gap: 11px; }
.history-patient-cell .avatar { width: 39px; height: 39px; border-radius: 11px; }
.history-patient-cell > div { min-width: 0; display: grid; }
.history-patient-cell a { overflow: hidden; color: #23465f; font-size: .78rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.history-patient-cell small, .history-patient-cell span { margin-top: 2px; color: #8d9aa4; font-size: .59rem; }
.risk-cell { min-width: 110px; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.mini-alert { max-width: 95px; overflow: hidden; padding: 4px 6px; border-radius: 5px; font-size: .54rem; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.no-mini-alert { color: #9ba7af; font-size: .57rem; }
.problem-list { min-width: 190px; display: grid; gap: 4px; }
.problem-chip { max-width: 230px; overflow: hidden; color: #617988; font-size: .61rem; text-overflow: ellipsis; white-space: nowrap; }
.problem-chip strong { display: inline; margin-right: 3px; color: #125a89; font-size: .59rem; }
.history-directory-table td > span, .history-directory-table td > small { display: block; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-directory-table td > span { margin-top: 3px; color: #83939e; font-size: .59rem; }
.empty-cell { color: #a0abb3 !important; font-style: italic; }
.history-row-actions { min-width: 105px; display: grid; justify-items: end; gap: 6px; }
.history-row-actions > span { color: #9aa6ae; font-size: .57rem; }
.open-history-button { display: inline-flex; min-height: 34px; align-items: center; gap: 7px; padding: 5px 11px 5px 7px; border: 1px solid #cfe0ea; border-radius: 9px; color: #185f88; background: linear-gradient(180deg, #fff, #f1f7fa); box-shadow: 0 2px 7px rgba(28,75,104,.05); font-size: .66rem; font-weight: 800; white-space: nowrap; transition: color .16s, border-color .16s, box-shadow .16s, transform .16s; }
.open-history-button:hover { color: #174f73; border-color: #9fc6d8; box-shadow: 0 5px 12px rgba(24,91,126,.1); text-decoration: none; transform: translateY(-1px); }
.open-history-button svg { width: 23px; height: 23px; padding: 4px; border-radius: 6px; color: #126c99; background: #e1f0f6; transform: rotate(180deg); }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 14px 18px; border-top: 1px solid rgba(141,168,188,.18); color: #718695; font-size: .65rem; }
.pagination a { padding: 7px 10px; border: 1px solid rgba(18,90,167,.14); border-radius: 7px; background: rgba(255,255,255,.48); font-weight: 750; }
.pagination a.disabled { color: #aab4bb; border-color: transparent; pointer-events: none; }
.pagination.single { justify-content: flex-end; }
.history-directory-panel.is-loading { cursor: progress; }
.history-directory-panel.is-loading .table-scroll { opacity: .48; transition: opacity .15s ease; }
.history-directory-panel.is-loading [data-history-status] { color: var(--blue); }
.patient-chat-fab { position: fixed; right: 25px; bottom: 24px; z-index: 15; display: inline-flex; align-items: center; gap: 8px; min-height: 47px; padding: 0 16px; border: 1px solid rgba(255,255,255,.65); border-radius: 999px; color: white; background: linear-gradient(120deg, rgba(18,90,167,.94), rgba(230,46,59,.92)); box-shadow: 0 15px 38px rgba(18,57,91,.24), inset 0 1px 0 rgba(255,255,255,.3); font-size: .72rem; font-weight: 800; -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.patient-chat-fab:hover { color: white; text-decoration: none; transform: translateY(-2px); }
.patient-chat-fab svg { width: 18px; }
.patient-assistant { width: min(980px, 100%); overflow: hidden; margin: 0 auto; border: 1px solid #dfe8ef; border-radius: 20px; background: #fff; box-shadow: 0 22px 65px rgba(20,60,94,.11); }
.assistant-hero { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 17px 22px; color: white; background: radial-gradient(circle at 86% 0, rgba(230,46,59,.3), transparent 34%), linear-gradient(120deg, #0b4d8d, #15324a); }
.assistant-orb { position: relative; width: 49px; height: 49px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.27); border-radius: 50%; background: rgba(255,255,255,.14); box-shadow: inset 0 1px 0 rgba(255,255,255,.23); }
.assistant-orb svg { width: 23px; height: 23px; }
.assistant-orb i { position: absolute; right: 0; bottom: 2px; width: 12px; height: 12px; border: 2px solid #164361; border-radius: 50%; background: #46d7a6; }
.assistant-hero .eyebrow { color: #a7cbe7; font-size: .58rem; }
.assistant-hero h2 { margin: 1px 0 2px; font-size: 1rem; }
.assistant-hero p { margin: 0; color: rgba(255,255,255,.72); font-size: .65rem; }
.assistant-online { width: 6px; height: 6px; display: inline-block; margin-right: 2px; border-radius: 50%; background: #46d7a6; }
.assistant-secure { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid rgba(255,255,255,.19); border-radius: 999px; color: rgba(255,255,255,.82); background: rgba(255,255,255,.08); font-size: .61rem; white-space: nowrap; }
.assistant-secure svg { width: 14px; }
.assistant-shell { display: flex; min-height: 560px; max-height: 680px; flex-direction: column; background: linear-gradient(180deg, #f8fafc, #f4f7fa); }
.assistant-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; padding: 27px clamp(18px, 6vw, 62px); scroll-behavior: smooth; }
.chat-message { width: fit-content; max-width: min(78%, 650px); display: flex; align-items: flex-start; gap: 9px; }
.chat-avatar { width: 32px; height: 32px; display: grid; flex: 0 0 auto; place-items: center; margin-top: 18px; border: 1px solid rgba(230,46,59,.12); border-radius: 50%; color: var(--red); background: #fff; box-shadow: 0 4px 12px rgba(30,66,94,.08); }
.chat-avatar svg { width: 15px; }
.chat-content { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.chat-author { margin: 0 0 5px 3px; color: #6d8192; font-size: .6rem; font-weight: 800; }
.chat-bubble { padding: 12px 15px; border: 1px solid #e0e8ee; border-radius: 5px 17px 17px 17px; color: #38566d; background: #fff; box-shadow: 0 6px 18px rgba(30,66,94,.05); font-size: .74rem; line-height: 1.65; white-space: pre-wrap; }
.chat-bubble p { margin: 0; }
.chat-content time { margin: 5px 3px 0; color: #9ba8b2; font-size: .54rem; }
.chat-message.user { align-self: flex-end; }
.chat-message.user .chat-content { align-items: flex-end; }
.chat-message.user .chat-author { margin-right: 3px; }
.chat-message.user .chat-bubble { color: white; border: 0; border-radius: 17px 5px 17px 17px; background: linear-gradient(120deg, #1262ad, #0c4d8e); box-shadow: 0 8px 20px rgba(18,90,167,.17); }
.chat-message.error .chat-bubble { color: #a72c36; border-color: rgba(230,46,59,.18); background: #fff2f3; }
.chat-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chat-links a { padding: 6px 9px; border: 1px solid #d3e3ef; border-radius: 7px; color: var(--blue); background: #f8fbfd; font-size: .62rem; font-weight: 750; }
.chat-typing .chat-bubble { display: flex; gap: 4px; padding: 14px 17px; }
.chat-typing .chat-bubble i { width: 6px; height: 6px; border-radius: 50%; background: #8299aa; animation: assistantTyping 1.1s infinite ease-in-out; }
.chat-typing .chat-bubble i:nth-child(2) { animation-delay: .16s; }
.chat-typing .chat-bubble i:nth-child(3) { animation-delay: .32s; }
@keyframes assistantTyping { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }
.assistant-starters { width: min(690px, 100%); align-self: center; padding: 10px 0 4px; text-align: center; }
.assistant-starters h3 { margin: 0; color: #254760; font-size: .85rem; }
.assistant-starters > p { margin: 5px 0 14px; color: #8192a0; font-size: .66rem; }
.assistant-prompts { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.assistant-prompts button { min-width: 0; display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid #dee7ee; border-radius: 12px; color: #31536b; background: rgba(255,255,255,.82); text-align: left; cursor: pointer; transition: border-color .18s, box-shadow .18s, transform .18s; }
.assistant-prompts button:hover { border-color: #9fc3dd; background: #fff; box-shadow: 0 7px 18px rgba(30,66,94,.07); transform: translateY(-1px); }
.assistant-prompts button > svg { width: 19px; flex: 0 0 auto; color: var(--blue); }
.assistant-prompts button > span { min-width: 0; display: grid; gap: 2px; }
.assistant-prompts strong { overflow: hidden; font-size: .67rem; text-overflow: ellipsis; white-space: nowrap; }
.assistant-prompts small { overflow: hidden; color: #8999a5; font-size: .56rem; text-overflow: ellipsis; white-space: nowrap; }
.assistant-composer { padding: 13px clamp(18px, 6vw, 62px) 12px; border-top: 1px solid #e1e9ef; background: rgba(255,255,255,.96); }
.assistant-input { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 8px; padding: 7px 7px 7px 15px; border: 1px solid #cddbe5; border-radius: 17px; background: #fff; box-shadow: 0 7px 22px rgba(30,66,94,.08); transition: border-color .18s, box-shadow .18s; }
.assistant-input:focus-within { border-color: #78add3; box-shadow: 0 0 0 3px rgba(18,90,167,.08), 0 7px 22px rgba(30,66,94,.08); }
.assistant-input textarea { min-height: 42px; max-height: 120px; padding: 11px 0 8px; border: 0; outline: 0; resize: none; color: #294b64; background: transparent; font: inherit; font-size: .73rem; line-height: 1.5; }
.assistant-input textarea::placeholder { color: #95a3ae; }
.assistant-input .button { width: 42px; min-height: 42px; align-self: end; padding: 0; border-radius: 12px; }
.assistant-input .button:disabled { cursor: wait; opacity: .55; transform: none; }
.assistant-composer > small { display: block; margin-top: 7px; color: #98a5ae; font-size: .55rem; text-align: center; }
.assistant-emergency { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 12px 20px; color: #8a3a40; background: rgba(230,46,59,.07); font-size: .61rem; text-align: center; }
.assistant-emergency span { color: #7b6c6d; }

/* Asistente en panel lateral */
.app-main:has(.assistant-layout) .page-wrap { width: auto; margin: 0; padding: 42px 500px 70px 36px; }
.assistant-layout { min-height: calc(100vh - 185px); }
.assistant-overview { max-width: 820px; }
.assistant-overview-intro { padding: 28px 30px; border: 1px solid #dfe8ef; border-radius: 18px; background: linear-gradient(125deg, #fff, #eef7fb); box-shadow: 0 10px 30px rgba(26,65,95,.05); }
.assistant-overview-intro h2 { margin: 7px 0 8px; color: #173c59; font-family: Georgia, serif; font-size: 1.65rem; }
.assistant-overview-intro p { max-width: 620px; margin: 0; color: #708493; font-size: .78rem; line-height: 1.65; }
.assistant-overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-top: 16px; }
.assistant-overview-grid article { min-width: 0; display: grid; grid-template-columns: auto 1fr; column-gap: 12px; padding: 19px; border: 1px solid #e0e8ee; border-radius: 14px; background: #fff; box-shadow: 0 7px 22px rgba(27,67,97,.04); }
.assistant-overview-grid article > span { grid-row: span 3; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; color: var(--blue); background: #eaf3fb; }
.assistant-overview-grid article > span svg { width: 19px; }
.assistant-overview-grid small { color: #8394a1; font-size: .62rem; }
.assistant-overview-grid strong { overflow: hidden; margin-top: 3px; color: #254760; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.assistant-overview-grid p { margin: 4px 0 0; color: #91a0aa; font-size: .59rem; line-height: 1.4; }
.assistant-guide { display: flex; gap: 13px; margin-top: 16px; padding: 20px; border: 1px solid #dce7ee; border-radius: 14px; color: #49697e; background: #f5f9fc; }
.assistant-guide > span { width: 38px; height: 38px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 10px; color: #fff; background: linear-gradient(135deg, var(--blue), #17a9b4); }
.assistant-guide strong { color: #294d66; font-size: .73rem; }
.assistant-guide p { margin: 5px 0 0; font-size: .66rem; line-height: 1.55; }
.patient-assistant { position: fixed; z-index: 40; top: 18px; right: 18px; bottom: 18px; width: 460px; display: flex; overflow: hidden; flex-direction: column; margin: 0; border: 1px solid rgba(216,226,237,.9); border-radius: 22px; background: rgba(249,251,255,.97); box-shadow: 0 26px 75px rgba(28,50,84,.22); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.patient-assistant .assistant-hero { grid-template-columns: auto minmax(0,1fr) auto; gap: 12px; padding: 18px 19px 15px; color: #18273c; background: rgba(255,255,255,.78); }
.patient-assistant .assistant-orb { width: 49px; height: 49px; color: #fff; border: 0; background: linear-gradient(145deg, #1769db, #12a8bd); box-shadow: 0 10px 25px rgba(22,105,219,.22); }
.patient-assistant .assistant-orb i { right: -1px; bottom: 1px; border-color: #fff; }
.patient-assistant .assistant-hero h2 { margin: 0 0 3px; color: #18273c; font-size: 1rem; }
.patient-assistant .assistant-hero p { color: #53697d; font-size: .66rem; }
.patient-assistant .assistant-hero p strong { color: #168167; }
.assistant-header-actions { display: flex; gap: 7px; }
.assistant-header-actions button, .assistant-header-actions a { width: 39px; height: 39px; display: grid; place-items: center; padding: 0; border: 1px solid #e0e7ef; border-radius: 12px; color: #526980; background: rgba(247,249,252,.92); font: 500 1.2rem/1 inherit; cursor: pointer; }
.assistant-header-actions button:hover, .assistant-header-actions a:hover { color: var(--blue); border-color: #b9d2e7; background: #fff; text-decoration: none; }
.assistant-patient-context { display: flex; align-items: center; gap: 10px; margin: 0 17px 13px; padding: 12px 13px; border: 1px solid #e8edf3; border-radius: 13px; color: #5d7185; background: rgba(255,255,255,.76); font-size: .64rem; line-height: 1.45; }
.assistant-patient-context i { width: 4px; height: 28px; flex: 0 0 auto; border-radius: 999px; background: linear-gradient(#2679ed, #19b5b6); }
.assistant-patient-context strong { color: #334f68; }
.patient-assistant .assistant-shell { min-height: 0; max-height: none; flex: 1; border-top: 1px solid #e6ebf2; background: linear-gradient(145deg, rgba(249,251,255,.95), rgba(240,244,251,.96)); }
.patient-assistant .assistant-messages { gap: 16px; padding: 20px 18px; }
.patient-assistant .chat-message { max-width: 92%; }
.patient-assistant .chat-avatar { width: 29px; height: 29px; margin-top: 17px; color: #fff; border: 0; background: linear-gradient(145deg, #2671df, #18a9b8); }
.patient-assistant .chat-bubble { padding: 12px 14px; color: #354e66; border-color: #e1e7ef; border-radius: 5px 17px 17px 17px; background: rgba(255,255,255,.91); font-size: .7rem; line-height: 1.65; box-shadow: 0 7px 20px rgba(40,61,91,.06); }
.patient-assistant .chat-message.user .chat-bubble { border-radius: 17px 5px 17px 17px; background: linear-gradient(135deg, #316fd8, #4e84d7); }
.patient-assistant .assistant-starters { padding: 3px 0; text-align: left; }
.patient-assistant .assistant-starters h3 { margin: 0 0 8px 2px; color: #6c7f92; font-size: .63rem; }
.patient-assistant .assistant-prompts { display: flex; overflow-x: auto; gap: 7px; padding-bottom: 3px; }
.patient-assistant .assistant-prompts button { flex: 0 0 auto; padding: 8px 10px; border-radius: 999px; }
.patient-assistant .assistant-prompts button > svg, .patient-assistant .assistant-prompts small { display: none; }
.patient-assistant .assistant-prompts strong { font-size: .6rem; }
.patient-assistant .assistant-composer { padding: 12px 17px 11px; border-top-color: #e0e6ef; background: rgba(255,255,255,.94); }
.assistant-question-label { display: block; margin: 0 2px 8px; color: #657a8e; font-size: .61rem; font-weight: 750; }
.patient-assistant .assistant-input { grid-template-columns: minmax(0,1fr) auto; padding: 7px 7px 7px 13px; border: 1.5px solid #b8cdf5; border-radius: 17px; box-shadow: 0 0 0 4px rgba(72,113,232,.06); }
.patient-assistant .assistant-input textarea { min-height: 55px; padding-top: 8px; font-size: .68rem; }
.patient-assistant .assistant-input .button { width: auto; min-width: 90px; padding: 0 14px; border-radius: 12px; background: linear-gradient(125deg, #6688e5, #168fa5); }
.patient-assistant .assistant-input .button span { display: inline; }
.patient-assistant .assistant-composer > small { display: flex; justify-content: space-between; color: #91a0af; text-align: left; }
.patient-assistant .assistant-emergency { align-items: flex-start; flex-direction: column; gap: 2px; padding: 9px 17px 11px; text-align: left; }
.patient-assistant .assistant-emergency strong { font-size: .58rem; }
.patient-assistant .assistant-emergency span { font-size: .55rem; }

.rda-connection { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 18px; padding: 16px 18px; border: 1px solid; border-radius: 12px; }
.rda-connection > svg { width: 22px; flex: 0 0 auto; }
.rda-connection strong { color: #294c64; font-size: .77rem; }
.rda-connection p { margin: 4px 0 0; color: #6f8391; font-size: .67rem; line-height: 1.5; }
.rda-connection code { padding: 2px 5px; border-radius: 4px; background: rgba(255,255,255,.6); font-size: .61rem; }
.rda-connection.connected { color: #14735f; border-color: #bfe5d8; background: rgba(226,247,239,.75); }
.rda-connection.preparation { color: #946815; border-color: #ecd79f; background: rgba(255,247,224,.78); }
.rda-generator { display: grid; grid-template-columns: minmax(260px,1fr) minmax(360px,1fr); align-items: end; gap: 24px; margin-bottom: 18px; padding: 22px 24px; }
.rda-generator h2 { margin: 5px 0; color: #1c3c56; font-family: Georgia, serif; font-size: 1.15rem; }
.rda-generator p { margin: 0; color: #82929e; font-size: .69rem; line-height: 1.5; }
.rda-generator form { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 10px; }
.rda-generator label, .rda-filter label { display: grid; gap: 5px; color: #587084; font-size: .63rem; font-weight: 750; }
.rda-generator select, .rda-filter select { min-height: 42px; padding: 0 34px 0 11px; border: 1px solid rgba(148,174,195,.38); border-radius: 8px; color: #34536a; background: rgba(255,255,255,.75); }
.rda-generator .button { min-height: 42px; padding: 0 16px; font-size: .67rem; white-space: nowrap; }
.rda-outbox .panel-heading { align-items: end; }
.rda-filter { display: flex; align-items: end; gap: 8px; }
.rda-filter select { min-width: 145px; min-height: 36px; }
.rda-filter .button { min-height: 36px; padding: 0 12px; font-size: .62rem; }
.rda-outbox table { min-width: 1120px; }
.rda-issues summary { color: #9a6a13; font-size: .61rem; font-weight: 750; cursor: pointer; white-space: nowrap; }
.rda-issues ul { width: 290px; margin: 8px 0 0; padding: 9px 9px 9px 25px; border-radius: 7px; background: #fff8e8; }
.rda-issues li { margin: 4px 0; color: #765f32; font-size: .58rem; line-height: 1.4; }
.rda-issues li strong { display: inline; margin-right: 3px; color: #72500e; font: 600 .55rem ui-monospace, monospace; }
.rda-valid { color: #18806b; font-size: .62rem; font-weight: 750; }
.rda-error { max-width: 220px; color: #a84b52; line-height: 1.35; white-space: normal; }
.rda-actions { min-width: 125px; display: grid; gap: 7px; }
.rda-actions .inline-form { margin: 0; }
.rda-actions .table-action { width: 100%; justify-content: flex-start; }

.billing-metrics .metric strong { font-size: 1.22rem; white-space: nowrap; }
.billing-dialog { overflow-y: auto; }
.billing-rips-details { overflow: hidden; border: 1px solid #dbe6ec; border-radius: 10px; background: #f8fbfc; }
.billing-rips-details summary { padding: 12px 14px; color: #2d5872; font-size: .69rem; font-weight: 800; cursor: pointer; }
.billing-rips-details[open] summary { border-bottom: 1px solid #e3ebef; background: #f1f7f9; }
.billing-rips-details > .form-grid { padding: 15px; }
.billing-overview { display: grid; gap: 18px; }
.billing-list table { min-width: 820px; }
.billing-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 18px; padding: 15px 20px; border-bottom: 1px solid #edf1f4; }
.billing-toolbar > span { color: #8a9aa6; font-size: .67rem; white-space: nowrap; }
.billing-filters { display: flex; align-items: end; gap: 10px; width: min(720px, 100%); }
.billing-filters .search { flex: 1; width: auto; min-width: 250px; }
.billing-filters > label:not(.search) { display: grid; gap: 5px; color: #587084; font-size: .62rem; font-weight: 750; }
.billing-filters select { min-width: 150px; height: 40px; padding: 0 30px 0 10px; border: 1px solid #dce5eb; border-radius: 8px; color: #34536a; background: #fff; }
.billing-filters .button { min-height: 40px; padding: 0 15px; font-size: .66rem; }
.aging-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: #e8eef2; }
.aging-row { position: relative; overflow: hidden; min-width: 0; padding: 17px 18px 23px; background: #fff; }
.aging-row > div { display: grid; }
.aging-row strong { color: #466176; font-size: .69rem; }
.aging-row span { margin-top: 4px; color: #96a4ae; font-size: .6rem; }
.aging-row b { display: block; overflow: hidden; margin-top: 12px; color: #1e405b; font-size: .83rem; text-overflow: ellipsis; white-space: nowrap; }
.aging-row progress { position: absolute; left: 18px; bottom: 10px; width: calc(100% - 36px); height: 4px; overflow: hidden; border: 0; border-radius: 99px; background: #edf1f4; appearance: none; }
.aging-row progress::-webkit-progress-bar { border-radius: 99px; background: #edf1f4; }
.aging-row progress::-webkit-progress-value { border-radius: 99px; background: linear-gradient(90deg, #1a72b0, #26a8a6); }
.aging-row progress::-moz-progress-bar { border-radius: 99px; background: linear-gradient(90deg, #1a72b0, #26a8a6); }
.billing-back { justify-content: flex-start; width: fit-content; margin: -6px 0 18px; }
.billing-flow { display: grid; grid-template-columns: repeat(4, 1fr); overflow: hidden; margin-bottom: 18px; border: 1px solid #e0e8ed; border-radius: 13px; background: #fff; box-shadow: 0 8px 25px rgba(27,67,97,.04); }
.billing-flow > div { position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 11px; padding: 19px; }
.billing-flow > div:not(:last-child)::after { content: ''; position: absolute; top: 50%; right: -9px; z-index: 2; width: 18px; height: 18px; transform: translateY(-50%) rotate(45deg); border-top: 1px solid #e0e8ed; border-right: 1px solid #e0e8ed; background: #fff; }
.billing-flow span { grid-row: span 2; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: #6f8494; background: #eaf0f4; font-size: .7rem; font-weight: 850; }
.billing-flow strong { color: #35536a; font-size: .72rem; }
.billing-flow small { margin-top: 3px; color: #91a0ab; font-size: .61rem; }
.billing-flow .done span { color: #fff; background: #1b8a77; }
.billing-flow .attention span { color: #fff; background: #c95359; }
.billing-detail-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.billing-detail-summary article { min-width: 0; display: grid; padding: 18px 20px; border: 1px solid #e0e8ed; border-radius: 12px; background: #fff; }
.billing-detail-summary small { color: #7e909f; font-size: .64rem; }
.billing-detail-summary strong { overflow: hidden; margin: 5px 0; color: #173c59; font-size: 1.2rem; text-overflow: ellipsis; white-space: nowrap; }
.billing-detail-summary span { overflow: hidden; color: #98a5ae; font-size: .59rem; text-overflow: ellipsis; white-space: nowrap; }
.billing-detail-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr); gap: 18px; }
.billing-validation .panel-heading { align-items: flex-start; }
.validation-content { padding: 19px 21px; }
.validation-content ul { display: grid; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; }
.validation-content li { display: grid; gap: 3px; padding: 10px 12px; border-radius: 8px; font-size: .64rem; }
.validation-content li strong { font: 700 .57rem ui-monospace, monospace; }
.validation-content li.warning { color: #805e1f; background: #fff7e5; }
.validation-content li.error { color: #9a4047; background: #fff0f1; }
.validation-ok { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; padding: 12px; border-radius: 8px; color: #19735f; background: #eaf8f3; font-size: .69rem; font-weight: 700; }
.validation-ok svg { width: 18px; }
.billing-error { margin: 0 0 15px; padding: 10px 12px; border-radius: 8px; color: #8b5f16; background: #fff6df; font-size: .64rem; line-height: 1.45; }
.billing-document-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.billing-document-actions form { display: contents; }
.billing-document-actions .button { min-height: 38px; padding: 0 12px; gap: 7px; font-size: .62rem; }
.billing-bottom-grid { display: grid; grid-template-columns: minmax(280px, .72fr) minmax(0, 1.28fr); gap: 18px; margin-top: 18px; }
.billing-management-grid { display: grid; grid-template-columns: 1fr 1fr; }
.billing-management-grid form { display: grid; align-content: start; gap: 11px; padding: 20px 22px 23px; }
.billing-management-grid form + form { border-left: 1px solid #edf1f4; }
.billing-management-grid h3 { margin: 0 0 3px; color: #294b64; font: 700 .83rem Georgia, serif; }
.billing-management-grid label { display: grid; gap: 5px; color: #587084; font-size: .61rem; font-weight: 750; }
.billing-management-grid input, .billing-management-grid select, .billing-management-grid textarea { width: 100%; min-height: 39px; padding: 8px 10px; border: 1px solid #d9e3e9; border-radius: 8px; color: #25445c; background: #fff; resize: vertical; }
.billing-management-grid .button { min-height: 40px; margin-top: 3px; font-size: .65rem; }
.button:disabled { cursor: not-allowed; opacity: .48; transform: none; }

.settings-state { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 18px; padding: 16px 18px; border: 1px solid; border-radius: 12px; }
.settings-state > svg { width: 22px; flex: 0 0 auto; }
.settings-state strong { color: #294c64; font-size: .77rem; }
.settings-state p { margin: 4px 0 0; color: #6f8391; font-size: .67rem; line-height: 1.5; }
.settings-state code { padding: 2px 5px; border-radius: 4px; background: rgba(255,255,255,.65); font-size: .61rem; }
.settings-state.ready { color: #14735f; border-color: #bfe5d8; background: rgba(226,247,239,.75); }
.settings-state.temporary { color: #946815; border-color: #ecd79f; background: rgba(255,247,224,.78); }
.settings-card { max-width: 900px; }
.settings-card .panel-heading { align-items: flex-start; }
.settings-card .panel-heading h2 { margin-top: 5px; }
.settings-card .panel-heading p { max-width: 560px; }
.settings-complete, .settings-pending { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 99px; font-size: .6rem; font-weight: 800; white-space: nowrap; }
.settings-complete { color: #14735f; background: #e7f7f1; }
.settings-pending { color: #946815; background: #fff4d8; }
.settings-complete svg, .settings-pending svg { width: 15px; }
.settings-form { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 24px; }
.settings-form label { display: grid; align-content: start; gap: 7px; color: #405f74; font-size: .67rem; font-weight: 800; }
.settings-form input { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid #d7e2e9; border-radius: 8px; color: #24455d; background: #fff; font-family: inherit; font-size: .77rem; font-weight: 500; }
.settings-form input:focus { outline: 2px solid rgba(36,143,170,.18); border-color: #4d9fb5; }
.settings-form label small { color: #8798a4; font-size: .59rem; font-weight: 500; line-height: 1.45; }
.settings-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 17px; border-top: 1px solid #e8eef2; }
.settings-actions p { display: flex; align-items: center; gap: 7px; margin: 0; color: #718592; font-size: .62rem; }
.settings-actions p svg { width: 16px; color: #208b78; }
.settings-actions .button { min-height: 42px; font-size: .66rem; white-space: nowrap; }
.alert ul { margin: 7px 0 0; padding-left: 18px; }

@media (max-width: 880px) {
  .form-panel { background: linear-gradient(145deg, rgba(242,248,253,.82), rgba(250,243,245,.8)); }
  .mobile-brand .brand { width: 220px; }
  .auth-card::before { margin-top: -25px; }
  .history-overview { grid-template-columns: 1fr 1fr; }
  .history-filters { grid-template-columns: 1fr 1fr; }
  .history-search { grid-column: span 2; }
  .assistant-hero { grid-template-columns: auto 1fr; }
  .assistant-secure { grid-column: span 2; justify-self: start; }
  .assistant-shell { min-height: 520px; }
  .app-main:has(.assistant-layout) .page-wrap { padding-right: 480px; padding-left: 24px; }
  .rda-generator { grid-template-columns: 1fr; }
  .billing-metrics { grid-template-columns: 1fr 1fr; }
  .aging-list { grid-template-columns: repeat(2, 1fr); }
  .billing-detail-grid, .billing-bottom-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .auth-card { padding: 27px 20px; border-radius: 20px; }
  .page-wrap { width: min(100% - 22px, 1280px); }
  .history-overview { grid-template-columns: 1fr; }
  .history-filters { grid-template-columns: 1fr; }
  .history-search { grid-column: auto; }
  .history-search kbd { display: none; }
  .history-result-bar { align-items: flex-start; flex-direction: column; }
  .history-directory-table { min-width: 950px; }
  .patient-chat-fab span { display: none; }
  .patient-chat-fab { width: 48px; padding: 0; justify-content: center; }
  .assistant-hero { grid-template-columns: 1fr; padding: 21px; }
  .assistant-orb { width: 44px; height: 44px; }
  .assistant-secure { grid-column: auto; }
  .assistant-shell { min-height: calc(100vh - 330px); max-height: none; }
  .assistant-messages { padding: 20px 14px; }
  .chat-message { max-width: 91%; }
  .assistant-prompts { grid-template-columns: 1fr; }
  .assistant-composer { padding-right: 12px; padding-left: 12px; }
  .assistant-emergency { align-items: flex-start; flex-direction: column; text-align: left; }
  .rda-generator form { grid-template-columns: 1fr; }
  .rda-outbox .panel-heading { align-items: flex-start; flex-direction: column; }
  .rda-outbox .table-scroll { overflow: visible; }
  .rda-outbox table, .rda-outbox tbody { display: block; min-width: 0; width: 100%; }
  .rda-outbox thead { display: none; }
  .rda-outbox tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; padding: 12px 18px 17px; border-top: 1px solid #e4ebf1; }
  .rda-outbox tbody td { display: block; min-width: 0; padding: 9px 0; border: 0; white-space: normal; }
  .rda-outbox tbody td::before { content: attr(data-label); display: block; margin-bottom: 5px; color: #8a9baa; font-size: .55rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
  .rda-outbox tbody td:nth-child(n+3) { grid-column: 1 / -1; }
  .rda-outbox tbody td[colspan] { grid-column: 1 / -1; }
  .rda-outbox tbody td[colspan]::before { display: none; }
  .rda-error { max-width: none; }
  .rda-issues summary { white-space: normal; }
  .rda-issues ul { width: auto; }
  .rda-actions { display: flex; min-width: 0; gap: 10px; }
  .rda-actions > * { flex: 1; }
  .rda-actions .table-action { display: flex; width: 100%; min-height: 38px; align-items: center; justify-content: center; padding: 8px 10px; border: 1px solid #dce7ef; border-radius: 8px; background: rgba(255,255,255,.72); }
  .billing-metrics, .billing-detail-summary { grid-template-columns: 1fr; }
  .billing-toolbar { align-items: stretch; flex-direction: column; }
  .billing-filters { align-items: stretch; flex-direction: column; }
  .billing-filters .search { min-width: 0; }
  .billing-filters select, .billing-filters .button { width: 100%; }
  .aging-list { grid-template-columns: 1fr; }
  .billing-flow { grid-template-columns: 1fr 1fr; }
  .billing-flow > div:nth-child(2)::after { display: none; }
  .billing-flow > div { padding: 14px; }
  .billing-flow > div::after { display: none; }
  .billing-list .table-scroll { overflow: visible; }
  .billing-list table, .billing-list tbody { display: block; min-width: 0; width: 100%; }
  .billing-list thead { display: none; }
  .billing-list tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; padding: 12px 18px 17px; border-top: 1px solid #e4ebf1; }
  .billing-list tbody td { display: block; min-width: 0; padding: 9px 0; border: 0; white-space: normal; }
  .billing-list tbody td::before { content: attr(data-label); display: block; margin-bottom: 5px; color: #8a9baa; font-size: .53rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
  .billing-list tbody td:nth-child(n+3) { grid-column: 1 / -1; }
  .billing-list tbody td[colspan] { grid-column: 1 / -1; }
  .billing-list tbody td[colspan]::before { display: none; }
  .billing-list .table-action { min-height: 38px; justify-content: center; width: 100%; border: 1px solid #dce7ef; border-radius: 8px; background: #fff; }
  .billing-management-grid { grid-template-columns: 1fr; }
  .billing-management-grid form + form { border-top: 1px solid #edf1f4; border-left: 0; }
  .billing-services .table-scroll { overflow: visible; }
  .billing-services table, .billing-services tbody { display: block; width: 100%; }
  .billing-services thead { display: none; }
  .billing-services tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; padding: 12px 18px 17px; }
  .billing-services tbody td { display: block; min-width: 0; padding: 9px 0; border: 0; white-space: normal; }
  .billing-services tbody td::before { content: attr(data-label); display: block; margin-bottom: 5px; color: #8a9baa; font-size: .53rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
  .billing-services tbody td:nth-child(2) { grid-column: 1 / -1; }
  .settings-card .panel-heading, .settings-actions { align-items: flex-start; flex-direction: column; }
  .settings-form { grid-template-columns: 1fr; padding: 18px; }
  .settings-form .span-2 { grid-column: auto; }
  .settings-actions .button { width: 100%; }
}

@media (max-width: 820px) {
  .app-main:has(.assistant-layout) .page-wrap { width: min(100% - 30px, 1280px); padding: 30px 0 70px; }
  .assistant-overview { display: none; }
  .patient-assistant { top: 78px; right: 10px; bottom: 10px; width: min(460px, calc(100% - 20px)); }
}

@media (max-width: 520px) {
  .app-main:has(.assistant-layout) .page-header { display: none; }
  .app-main:has(.assistant-layout) .page-wrap { width: 100%; padding: 0; }
  .patient-assistant { top: 0; right: 0; bottom: 0; width: 100%; border: 0; border-radius: 0; }
  .patient-assistant .assistant-hero { padding: 14px; }
  .assistant-header-actions button, .assistant-header-actions a { width: 36px; height: 36px; }
  .assistant-patient-context { margin: 0 12px 10px; }
  .patient-assistant .assistant-messages { padding: 16px 12px; }
  .patient-assistant .assistant-composer { padding: 10px 11px 8px; }
  .patient-assistant .assistant-input .button { min-width: 44px; padding: 0 12px; }
  .patient-assistant .assistant-input .button span { display: none; }
  .patient-assistant .assistant-emergency { padding-right: 12px; padding-left: 12px; }
}
