:root {
  --blue: #3d8df1;
  --blue-deep: #277bdb;
  --ink: #263746;
  --muted: #73808b;
  --line: #dbe1e5;
  --soft-line: #edf0f2;
  --pale-green: #ebf9e9;
  --green: #78c777;
  --side-width: 230px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #eff1f3;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #eff1f3; }
button, select, input { font: inherit; }
button { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 5; inset: 0 auto 0 0; width: var(--side-width); color: #4b5258; background: #fff; border-right: 1px solid #dde1e5; overflow-y: auto; transition: transform .22s ease; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 29px; font-weight: 750; letter-spacing: -.8px; color: var(--blue); }
.brand-side { height: 65px; padding: 0 15px; border-bottom: 1px solid #ddd; }
.brand-mark { font-size: 30px; line-height: 1; letter-spacing: -9px; width: 25px; overflow: hidden; }
.nav { padding: 10px 0 24px; }
.nav-item { display: flex; align-items: center; gap: 10px; min-height: 45px; padding: 0 15px; color: #4f565d; text-decoration: none; font-size: 15px; }
.nav-item > span { width: 14px; color: #7a848c; font-size: 18px; text-align: center; }
.nav-item b { margin-left: auto; color: #818b93; font-size: 17px; font-weight: 400; }
.nav-item:hover { background: #f6f9fe; }
.nav-item.active { color: #fff; background: var(--blue); box-shadow: inset -3px 0 #2879d4; }
.nav-item.active > span { color: #fff; }
.nav-label { margin: 11px 0 10px; padding: 0 15px; font-weight: 700; font-size: 14px; }

.main { min-width: 0; padding-left: var(--side-width); }
.topbar { height: 50px; display: flex; align-items: center; gap: 15px; padding: 0 14px; background: var(--blue); color: #fff; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 5px; background: transparent; color: inherit; font-size: 19px; }
.icon-button:hover { background: rgba(255,255,255,.16); }
.workspace-label { font-size: 13px; flex: 1; }
.workspace-label span { opacity: .9; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.user-button { display: flex; align-items: center; gap: 7px; border: 0; color: #fff; background: transparent; }
.avatar { display: inline-grid; place-items: center; width: 38px; height: 38px; background: #f0dfbd; border-radius: 50%; color: #8d8068; font-weight: 700; }

.planning-card { min-height: calc(100vh - 50px); margin: 15px 13px 0; background: #fff; border: 1px solid #dfe2e4; border-radius: 4px 4px 0 0; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.02); }
.toolbar { min-height: 71px; display: flex; align-items: center; gap: 5px; padding: 13px 20px; border-bottom: 1px solid var(--line); }
.calendar-button, .date-nav button { border: 0; height: 28px; min-width: 31px; color: #fff; background: var(--blue); font-size: 14px; }
.calendar-button { border-radius: 3px; background: #69bf78; }
.date-nav { display: flex; gap: 2px; }
.date-nav button:first-child { border-radius: 3px 0 0 3px; }
.date-nav button:last-child { border-radius: 0 3px 3px 0; }
.date-nav button:hover, .calendar-button:hover { filter: brightness(.93); }
.view-select { height: 28px; min-width: 98px; margin-right: 0; padding: 0 9px; color: #4c5860; background: #fff; border: 1px solid #d4d9dd; border-radius: 2px; }
.resource-filters { display: flex; align-items: center; gap: 5px; margin-left: 9px; }
.resource-filters.rooms { border-left: 1px solid #dfe2e4; padding-left: 11px; }
.resource-dot { display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 2px solid #1e252a; border-radius: 50%; background: var(--dot); box-shadow: inset 0 0 0 2px #fff; transition: transform .12s, opacity .12s; }
.resource-dot:hover { transform: scale(1.15); }
.resource-dot.off { opacity: .22; }
.resource-dot.rooms-dot { width: 17px; height: 17px; border-color: #65717a; }
.toolbar h1 { margin: 0 0 0 auto; min-width: 115px; text-align: center; font-size: 22px; font-weight: 450; color: #70777c; }

.planner-layout { display: grid; grid-template-columns: 278px minmax(0, 1fr); }
.planner-aside { border-right: 1px solid var(--line); padding: 8px 10px; }
.planner-aside select { width: 100%; height: 29px; padding: 0 9px; color: #586269; border: 1px solid #cbd1d5; border-radius: 2px; background: white; }
.mini-calendar { margin-top: 9px; text-align: center; }
.mini-head { display: grid; grid-template-columns: 31px 1fr 31px; align-items: center; margin-bottom: 4px; color: #40484f; font-weight: 700; }
.mini-head button { height: 28px; color: #fff; border: 0; border-radius: 2px; background: var(--blue); }
.mini-month-name { font-size: 16px; }
.weekdays, .days-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.weekdays { margin-bottom: 3px; color: #323b42; font-weight: 750; font-size: 14px; }
.mini-day { height: 31px; border: 0; border-radius: 5px; color: #fff; background: #b5b5b5; font-weight: 700; font-size: 14px; }
.mini-day.current-month.workday { background: #5ebae5; }
.mini-day.weekend { background: #484c4e; }
.mini-day.muted { opacity: .08; pointer-events: none; }
.mini-day.selected { outline: 3px solid #1b242a; outline-offset: -3px; }
.mini-day:hover { filter: brightness(.93); }
.mini-next { margin-top: 8px; }
.planner-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 12px 0; }
.planner-actions button { min-height: 27px; padding: 0 4px; color: #2981da; border: 1px solid #3c91e6; background: white; font-size: 10px; }
.planner-actions .full { grid-column: 1 / -1; }

.schedule-wrap { position: relative; min-width: 0; overflow: auto; background: #fff; }
.schedule { --cols: 5; position: relative; min-width: 900px; display: grid; grid-template-columns: 40px repeat(var(--cols), minmax(140px, 1fr)) 40px; grid-template-rows: 38px 27px 27px auto; }
.day-head { grid-row: 1; height: 38px; display: flex; align-items: center; justify-content: center; border-right: 2px solid #363b3e; color: #70777b; font-size: 17px; font-weight: 700; }
.day-head.today { color: white; background: #355e81; }
.resource-head { grid-row: 2; display: grid; grid-template-columns: repeat(3, 1fr); border-right: 2px solid #363b3e; overflow: hidden; }
.resource-head span { display: flex; align-items: center; justify-content: center; padding: 0 2px; border-right: 1px solid #33383a; color: #1e2e36; background: var(--resource); font-size: 13px; white-space: nowrap; overflow: hidden; }
.room-head { grid-row: 3; display: grid; grid-template-columns: repeat(3, 1fr); border-right: 2px solid #363b3e; overflow: hidden; }
.room-head span { display: flex; align-items: center; justify-content: center; padding: 0 2px; border-right: 1px solid #33383a; color: #28343b; background: var(--room); font-size: 11px; font-weight: 700; white-space: nowrap; }
.time-labels { grid-row: 4; height: 1008px; display: grid; grid-template-rows: repeat(48, 21px); background: #fff; }
.time-label { padding: 2px 2px 0 0; text-align: right; color: #3f484e; border-bottom: 1px solid #e4e8ea; font-size: 11px; font-weight: 700; }
.time-label.right { padding: 2px 0 0 2px; text-align: left; }
.day-column { grid-row: 4; position: relative; height: 1008px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(48, 21px); border-right: 2px solid #363b3e; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 20px, #e3e7e9 20px, #e3e7e9 21px); }
.slot { position: relative; grid-column: var(--resource); grid-row: var(--slot) / span 1; z-index: 1; min-width: 0; border: 0; border-right: 1px solid rgba(102,134,105,.15); border-bottom: 1px solid rgba(102,134,105,.15); background: var(--pale-green); }
.slot:nth-child(4n), .slot:nth-child(4n-1) { background: white; }
.slot:hover { outline: 2px solid #5bafdd; outline-offset: -2px; z-index: 2; background: #e1f2fb; }
.appointment { z-index: 3; margin: 1px 2px; padding: 3px 4px; min-height: 19px; overflow: hidden; color: #17242b; background: var(--appt); border-left: 1px solid rgba(0,0,0,.15); border-radius: 1px; box-shadow: 0 1px 1px rgba(0,0,0,.12); font-size: 10px; cursor: pointer; }
.appointment:hover, .appointment:focus { outline: 2px solid #263f51; z-index: 4; }
.appointment-handle { display: block; height: 10px; font-size: 12px; line-height: 8px; }
.appointment-service { display: block; font-size: 10px; font-weight: 700; }
.appointment-name { display: block; margin-top: 3px; font-size: 13px; }
.appointment-note { display: block; margin-top: 2px; font-size: 10px; white-space: nowrap; }
.empty-state { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); background: rgba(255,255,255,.9); }

dialog { width: min(440px, calc(100vw - 32px)); border: 0; border-radius: 12px; box-shadow: 0 18px 55px rgba(22,48,69,.27); }
dialog::backdrop { background: rgba(26,43,56,.42); backdrop-filter: blur(2px); }
#appointment-form { display: grid; gap: 17px; }
.dialog-header { display: flex; justify-content: space-between; align-items: start; }
.eyebrow { margin: 0 0 3px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .09em; }
.dialog-header h2 { margin: 0; font-size: 22px; }
.close-dialog { border: 0; color: #66737d; background: transparent; font-size: 28px; line-height: .7; }
#appointment-form label { display: grid; gap: 7px; color: #4a555d; font-size: 13px; font-weight: 700; }
#appointment-form input, #appointment-form select { width: 100%; height: 38px; padding: 0 10px; color: #263746; border: 1px solid #cbd4db; border-radius: 5px; background: #fff; font-weight: 400; }
.form-row { display: grid; grid-template-columns: 1.5fr 1fr; gap: 12px; }
.slot-summary { margin: -5px 0 0; padding: 10px; border-radius: 5px; color: #477087; background: #edf8ff; font-size: 13px; }
.dialog-actions { display: flex; justify-content: end; gap: 9px; }
.dialog-actions button { height: 37px; padding: 0 15px; border-radius: 5px; font-weight: 700; }
.button-secondary { color: #53616b; border: 1px solid #cfd6da; background: #fff; }
.button-primary { color: #fff; border: 1px solid var(--blue); background: var(--blue); }

.clinical-page { min-height: calc(100vh - 50px); padding: 24px; background: #f4f7f9; }
.clinical-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; max-width: 1440px; margin: 0 auto 17px; }
.back-link { padding: 0; color: #397ed2; border: 0; background: none; font-size: 13px; font-weight: 700; }
.breadcrumb { margin: 10px 0 9px; color: #82909b; font-size: 12px; }
.breadcrumb span { margin: 0 5px; color: #b7c0c7; }
.clinical-heading { display: flex; align-items: center; gap: 12px; }
.clinical-heading h1 { margin: 0; color: #223645; font-size: 27px; letter-spacing: -.4px; }
.clinical-heading p { margin: 4px 0 0; color: #72818d; font-size: 14px; }
.patient-avatar { display: grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; color: #306ea9; border: 1px solid #b9d9ef; border-radius: 50%; background: #e2f3ff; font-size: 13px; font-weight: 800; }
.patient-avatar.large { width: 48px; height: 48px; font-size: 15px; }
.clinical-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; padding-top: 18px; }
.clinical-actions button { height: 37px; padding: 0 14px; border-radius: 5px; font-size: 13px; font-weight: 750; }
.draft-status { color: #758590; font-size: 12px; white-space: nowrap; }
.draft-status.saved { color: #27875b; }
.prototype-notice { display: flex; align-items: flex-start; gap: 10px; max-width: 1440px; margin: 0 auto 17px; padding: 11px 14px; color: #705c21; border: 1px solid #eedfa5; border-radius: 6px; background: #fff9e9; font-size: 12px; line-height: 1.45; }
.prototype-notice > span { color: #ac8531; font-size: 16px; }
.prototype-notice p { margin: 0; }
.clinical-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 18px; max-width: 1440px; margin: 0 auto; align-items: start; }
.patient-panel { position: sticky; top: 12px; display: grid; gap: 12px; }
.patient-card, .clinical-nav, .history-note, .clinical-section { border: 1px solid #dde5ea; border-radius: 7px; background: #fff; box-shadow: 0 1px 2px rgba(31,55,74,.025); }
.patient-card { padding: 15px; }
.patient-card-top { display: flex; align-items: center; gap: 10px; }
.patient-card-top strong { display: block; color: #2c3f4e; font-size: 15px; }
.patient-card-top span { color: #5d9b77; font-size: 12px; }
.patient-details { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 8px; margin: 17px 0 0; }
.patient-details div { min-width: 0; }
.patient-details dt { margin-bottom: 3px; color: #8a97a0; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.patient-details dd { margin: 0; overflow: hidden; color: #465563; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.clinical-nav { padding: 6px; }
.clinical-nav a { display: block; padding: 8px 9px; color: #65737e; border-radius: 4px; font-size: 12px; font-weight: 650; text-decoration: none; }
.clinical-nav a:hover, .clinical-nav a.active { color: #2b79c8; background: #eef7ff; }
.history-note { display: flex; gap: 9px; padding: 12px; color: #536876; }
.history-note > span { color: #67a7d9; font-size: 18px; }
.history-note strong { display: block; color: #3f5666; font-size: 12px; }
.history-note p { margin: 4px 0 0; font-size: 11px; line-height: 1.4; }
.clinical-form { display: grid; gap: 15px; min-width: 0; }
.clinical-section { padding: 20px; scroll-margin-top: 15px; }
.section-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 15px; }
.section-title h2 { margin: 0; color: #293e4e; font-size: 18px; letter-spacing: -.2px; }
.section-hint { margin-top: 5px; color: #8a979f; font-size: 11px; white-space: nowrap; }
.session-intro { border-top: 3px solid #438be0; }
.modality-switch, .condition-picker { display: flex; flex-wrap: wrap; gap: 5px; }
.modality, .condition { min-height: 29px; padding: 0 9px; color: #61717d; border: 1px solid #d6e0e6; border-radius: 4px; background: #fff; font-size: 11px; font-weight: 700; }
.modality.active { color: #fff; border-color: #3d8df1; background: #3d8df1; }
.condition.active { color: #246bb0; border-color: #8dc7ec; background: #eaf7ff; }
.approach-note { margin: -3px 0 17px; padding: 9px 11px; color: #4d7083; border-left: 3px solid #6bb2e6; background: #f0f9fe; font-size: 12px; line-height: 1.45; }
.form-grid { display: grid; gap: 13px; margin-top: 13px; }
.form-grid:first-of-type { margin-top: 0; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.clinical-form label { display: grid; gap: 6px; color: #536472; font-size: 12px; font-weight: 750; }
.clinical-form input, .clinical-form select, .clinical-form textarea { width: 100%; color: #263845; border: 1px solid #ccd8df; border-radius: 5px; background: #fff; font: inherit; font-size: 13px; font-weight: 400; }
.clinical-form input, .clinical-form select { height: 37px; padding: 0 10px; }
.clinical-form textarea { min-height: 76px; padding: 10px; line-height: 1.43; resize: vertical; }
.clinical-form input:focus, .clinical-form select:focus, .clinical-form textarea:focus { outline: 2px solid #94cbf2; border-color: #54a5df; }
.compact-fields { padding-top: 1px; }
.red-flag-section { border-color: #ecd5c2; background: linear-gradient(180deg, #fffdfa, #fff); }
.safety-copy, .support-copy { margin: -4px 0 14px; color: #667680; font-size: 12px; line-height: 1.48; }
.flag-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.check-card { display: flex !important; grid-template-columns: auto 1fr; align-items: start; gap: 9px !important; min-height: 65px; padding: 10px; color: #54636d !important; border: 1px solid #e4e7e9; border-radius: 5px; background: #fff; cursor: pointer; }
.check-card:hover { border-color: #dfa38e; background: #fffaf7; }
.check-card input { width: 15px; height: 15px; margin: 1px 0 0; accent-color: #ce6543; }
.check-card strong { display: block; color: #475761; font-size: 12px; }
.check-card small { display: block; margin-top: 3px; color: #77848d; font-size: 11px; line-height: 1.3; font-weight: 500; }
.safety-warning { margin-top: 11px; padding: 11px; color: #9a3f28; border: 1px solid #efb5a2; border-radius: 5px; background: #fff0eb; font-size: 12px; line-height: 1.4; }
.support-section { border-color: #cbdced; background: #fcfeff; }
.support-badge { padding: 4px 7px; color: #467191; border-radius: 12px; background: #e6f3fc; font-size: 10px; font-weight: 800; white-space: nowrap; }
.guide-card { display: grid; grid-template-columns: 1.08fr 1fr 1fr; gap: 0; margin-top: 13px; overflow: hidden; border: 1px solid #d7e5ef; border-radius: 6px; background: #fff; }
.guide-intro, .guide-column { padding: 14px; }
.guide-intro { color: #fff; background: #407eaf; }
.guide-intro h3 { margin: 0 0 7px; font-size: 15px; }
.guide-intro p { margin: 0; color: #e8f4fc; font-size: 11px; line-height: 1.45; }
.guide-column { border-left: 1px solid #e2ebf1; }
.guide-column h4 { margin: 0 0 8px; color: #466174; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.guide-column ul { display: grid; gap: 7px; margin: 0; padding-left: 15px; color: #62737f; font-size: 11px; line-height: 1.38; }
.referral-note { margin-top: 12px; padding: 10px 11px; color: #667680; border-radius: 5px; background: #f2f6f8; font-size: 11px; line-height: 1.45; }

@media (max-width: 1080px) {
  .clinical-layout { grid-template-columns: 200px minmax(0, 1fr); }
  .clinical-header { flex-direction: column; }
  .clinical-actions { width: 100%; justify-content: flex-start; padding-top: 0; }
  .guide-card { grid-template-columns: 1fr; }
  .guide-column { border-top: 1px solid #e2ebf1; border-left: 0; }
}

@media (max-width: 900px) {
  :root { --side-width: 0px; }
  .sidebar { transform: translateX(-100%); width: 230px; box-shadow: 4px 0 22px rgba(0,0,0,.15); }
  body.menu-open .sidebar { transform: translateX(0); }
  .planning-card { margin: 0; border-left: 0; border-right: 0; }
  .toolbar { flex-wrap: wrap; padding: 10px; }
  .toolbar h1 { order: -1; width: 100%; min-width: 0; text-align: left; }
  .planner-layout { grid-template-columns: 226px minmax(0, 1fr); }
  .planner-aside { padding: 8px; }
  .clinical-page { padding: 16px; }
  .clinical-layout { grid-template-columns: 1fr; }
  .patient-panel { position: static; grid-template-columns: 1.2fr 1fr; }
  .history-note { display: none; }
}
@media (max-width: 620px) {
  .workspace-label { display: none; }
  .top-actions { margin-left: auto; }
  .top-actions .icon-button { display: none; }
  .resource-filters { margin-left: 0; }
  .planner-layout { grid-template-columns: 1fr; }
  .planner-aside { display: none; }
  .schedule { min-width: 780px; }
  .clinical-page { padding: 12px; }
  .clinical-actions { flex-wrap: wrap; }
  .clinical-actions .draft-status { width: 100%; }
  .patient-panel { grid-template-columns: 1fr; }
  .clinical-nav { display: none; }
  .form-grid.two, .form-grid.three, .flag-grid { grid-template-columns: 1fr; }
  .section-title { display: block; }
  .section-hint, .support-badge { display: inline-block; margin-top: 7px; }
  .modality-switch { margin-top: 12px; }
}

/* Connected workspace */
.access-page { display:grid; place-items:center; min-height:100vh; padding:24px; background:radial-gradient(at 20% 0%,#e8f2ff,transparent 60%),#f4f7fb; }
.access-card { width:min(100%,460px); padding:38px; border:1px solid #dce5ef; background:white; border-radius:16px; box-shadow:0 15px 60px #31527910; }
.access-card .brand { margin-bottom:34px; }.access-card h1 { font-size:25px; letter-spacing:-.6px; }.access-card p { line-height:1.6; color:#78889d; font-size:12px; }
.access-card label { display:block; margin-top:20px; color:#506780; font-size:13px; }.access-card input { display:block; width:100%; margin-top:8px; padding:12px; border:1px solid #cad8e7; border-radius:7px; }
.access-card .button-primary { width:100%; margin-top:16px; }.access-card #access-error { color:#a54438; }.access-foot { border-top:1px solid #e4ebf3; padding-top:20px; margin-top:25px; }
[hidden] { display:none !important; }
:root { --blue:#327bd2; --blue-deep:#2465ae; --ink:#23384e; --muted:#708196; --line:#e1e8f0; --side-width:224px; background:#f5f7fb; }
body { background:#f5f7fb; font-size:14px; }
button, input, select, textarea { font:inherit; }
button:focus-visible, a:focus-visible { outline:3px solid #92bced; outline-offset:3px; }
button:disabled { opacity:.5; cursor:wait; }
.brand-side { height:72px; font-size:26px; padding-left:22px; border-bottom:1px solid var(--line); }
.nav { padding:14px 10px; }
.nav-item { border-radius:8px; min-height:43px; padding:0 12px; font-size:14px; }
.nav-item.active { box-shadow:none; background:#e8f1ff; color:#2467b6; font-weight:650; }
.nav-item.active > span { color:inherit; }
.nav details { margin:2px 0; }
.nav summary { display:flex; align-items:center; gap:11px; padding:12px; cursor:pointer; list-style:none; font-size:13px; color:#55667a; border-radius:8px; }
.nav summary::-webkit-details-marker { display:none; }
.nav summary::after { content:'⌄'; margin-left:auto; color:#9ba8b8; }
.nav details[open] summary { color:#2467b6; background:#f1f6fc; }
.nav summary:hover { background:#f1f6fc; }
.nav summary > span { width:16px; text-align:center; font-size:17px; }
.nav summary i { border-radius:9px; padding:0 5px; background:#dcecff; font-style:normal; font-size:11px; }
.sub-nav { display:block; padding:9px 10px 9px 39px; font-size:12px; text-decoration:none; color:#748196; border-left:2px solid transparent; }
.sub-nav.selected { color:#2467b6; border-left-color:#327bd2; background:#f2f7fe; font-weight:650; }
.sub-nav:hover { color:#2467b6; }
.sidebar-foot { padding:22px 12px 6px; font-size:10px; color:#8b99aa; }
.status-dot { display:inline-block; width:7px; height:7px; background:#40a985; border-radius:50%; margin-right:5px; }
.topbar { height:72px; padding:0 26px; background:#fff; color:#52647a; border-bottom:1px solid var(--line); gap:12px; }
.workspace-label { font-size:12px; }
.workspace-label span { color:#98a4b2; }
.user-button { color:#5e6e83; font-size:12px; }
.avatar { width:32px; height:32px; background:#e5eef9; color:#43709f; font-size:11px; }
.demo-label { padding:5px 8px; font-size:9px; font-weight:750; letter-spacing:.07em; color:#947944; background:#fbf4e6; border-radius:5px; }
.workspace { min-height:calc(100vh - 72px); }
.page-content { padding:28px 30px 42px; max-width:1800px; margin:auto; }
.module-tabs { display:flex; gap:5px; flex-wrap:wrap; padding:12px 30px 0; background:#fff; border-bottom:1px solid var(--line); }
.module-tabs a { text-decoration:none; padding:11px 12px 13px; color:#718196; font-size:12px; border-bottom:2px solid transparent; }
.module-tabs a.selected { color:var(--blue); border-bottom-color:var(--blue); font-weight:700; }
.page-heading { display:flex; align-items:center; justify-content:space-between; gap:20px; margin-bottom:24px; }
.page-heading h1 { font-size:29px; letter-spacing:-1px; margin:6px 0; font-weight:700; color:#20354d; }
.page-heading p:not(.eyebrow) { color:var(--muted); font-size:12px; margin:7px 0 0; }
.eyebrow { font-size:9px; letter-spacing:.12em; }
.heading-actions,.quick-actions { display:flex; flex-wrap:wrap; gap:8px; }
.button-primary,.button-secondary { min-height:36px; border-radius:7px; padding:8px 13px; font-size:12px; font-weight:600; white-space:nowrap; }
.button-primary { background:var(--blue); border:1px solid var(--blue); color:white; box-shadow:0 2px 3px #327bd218; }
.button-primary:hover { background:var(--blue-deep); }
.button-secondary { background:#fff; border:1px solid #dbe3ed; color:#526780; }
.button-secondary:hover { background:#f2f7fd; border-color:#b8cde5; }
.panel { border:1px solid var(--line); background:#fff; border-radius:11px; box-shadow:0 3px 12px #293e5603; margin-bottom:18px; overflow:hidden; }
.padded { padding:24px; }
.panel h2 { font-size:17px; margin:0 0 14px; letter-spacing:-.2px; }
.panel h3 { font-size:14px; }
.panel p { line-height:1.65; }
.panel-title { padding:20px 22px 0; }
.panel-footer { padding:13px 20px; border-top:1px solid var(--line); color:#7c8ba0; font-size:11px; }
.metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; margin-bottom:24px; }
.metric { border:1px solid var(--line); border-radius:10px; background:#fff; padding:18px 20px; }
.metric > span { display:block; color:#7b8ba0; font-size:11px; }
.metric strong { display:block; color:#294968; font-size:26px; letter-spacing:-.7px; margin-top:7px; }
.metric small { font-size:10px; color:#97a4b4; }
.compact .metric { padding:15px 18px; }
.compact .metric strong { font-size:24px; }
.calendar-toolbar,.list-toolbar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding:18px; border-bottom:1px solid var(--line); }
.calendar-toolbar input,.calendar-toolbar select { height:35px; max-width:230px; padding:6px 9px; color:#566d86; border:1px solid #dce4ee; background:#fff; border-radius:6px; font-size:11px; }
.calendar-toolbar label { display:flex; align-items:center; gap:7px; color:#738399; font-size:11px; }
.button-group { display:flex; gap:4px; }
.agenda-scroll { overflow:auto; max-height:720px; }
.week-grid { --slot-h:72px; display:grid; grid-template-columns:54px repeat(var(--days),minmax(120px,1fr)); }
.day-label { position:sticky; top:0; z-index:3; height:66px; background:#fff; border-bottom:1px solid var(--line); display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; color:#8090a5; font-size:10px; text-transform:uppercase; }
.day-label strong { font-size:20px; font-weight:500; color:#4b627c; }
.day-label.is-today { background:#edf5ff; color:var(--blue); }
.day-label.is-today strong { color:var(--blue); font-weight:750; }
.agenda-day { min-width:0; border-left:1px solid var(--line); }
.hour-label { height:var(--slot-h,72px); font-size:10px; text-align:center; padding-top:calc(var(--slot-h,72px) * .11); color:#9ca9b9; border-bottom:1px solid #edf1f6; }
.hour-label:not(.is-hour) { font-size:8px; color:#b6c0cc; }
.hour-label.is-hour { color:#7d8b9c; font-weight:600; }
.day-slots { height:936px; position:relative; }
.hour-slot { display:block; width:100%; height:var(--slot-h,72px); border:0; border-bottom:1px solid #e8eef5; background:#fff; }
.hour-slot.is-hour { border-bottom-color:#dbe4ee; }
.week-grid.grid-60 .hour-slot { background:linear-gradient(#fff 49%,#f3f6fa 50%,#fff 51%); }
.hour-slot:hover { background:#f0f7ff; }
.calendar-event { position:absolute; z-index:2; display:flex; flex-direction:column; text-align:left; padding:7px; gap:4px; border:0; border-left:3px solid var(--event-color); border-radius:5px; background:color-mix(in srgb,var(--event-color) 14%,white); color:#39536c; overflow:hidden; line-height:1.25; }
.calendar-event:hover { box-shadow:0 3px 12px #36577825; filter:brightness(.97); }
.calendar-event span { font-size:9px; }
.calendar-event strong { font-size:12px; }
.calendar-event small { font-size:9px; opacity:.85; }
.calendar-event.cancelled { opacity:.45; text-decoration:line-through; }
.search-label { display:flex; align-items:center; gap:10px; padding:8px 12px; background:#f6f8fc; border:1px solid #e5eaf2; border-radius:7px; min-width:240px; color:#8c9eb1; }
.search-label input { background:none; border:0; outline:0; width:100%; font-size:12px; color:var(--ink); }
.archive-check { display:flex; gap:7px; align-items:center; color:#7b899b; font-size:11px; margin-left:auto; }
.muted { color:#8391a4; font-size:12px; }
.table-scroll { overflow:auto; }
table { width:100%; border-collapse:collapse; text-align:left; font-size:12px; }
th { padding:13px 17px; color:#8391a4; font-size:10px; font-weight:600; background:#fafbfd; border-bottom:1px solid var(--line); white-space:nowrap; }
td { padding:15px 17px; border-bottom:1px solid #eef2f6; vertical-align:middle; max-width:300px; overflow-wrap:anywhere; }
tr:last-child td { border-bottom:0; }
tbody tr:hover { background:#fbfdff; }
.row-actions { display:flex; gap:5px; flex-wrap:wrap; min-width:155px; }
.row-actions button { font-size:10px; padding:5px 8px; min-height:28px; }
.text-button { color:#2c73c4; padding:0; background:none; border:0; font-size:12px; font-weight:600; text-align:left; }
.pill { display:inline-block; padding:4px 8px; font-size:10px; border-radius:5px; color:#728399; background:#edf2f7; white-space:nowrap; }
.pill.good { color:#35876d; background:#e8f6ef; }
.pill.amber { color:#a27c3e; background:#fbf3e4; }
/* Aviso destacado en la Cola de envíos: la confirmación recién preparada al
   aceptar una solicitud, lista para abrir en Mensajes. */
.queue-highlight { border-color:#8fd0bd; box-shadow:0 0 0 2px #e2f4ee; background:#f6fcfa; }
.queue-highlight .pill.good { margin:0; }
.blank { padding:55px 24px; text-align:center; color:#8090a4; }
.blank > span { font-size:32px; color:#becde0; }
.blank h3 { color:#536b84; font-size:16px; }
.blank p { font-size:12px; }
.notice { padding:13px 16px; margin-bottom:18px; color:#718399; background:#ecf3fb; border:1px solid #dfeaf6; border-radius:7px; font-size:11px; line-height:1.65; }
/* Aviso de teléfono ya registrado y candidatos por nombre (crear, editar o
   vincular pacientes). La decisión es siempre de Leire: la app no fusiona. */
.phone-warning { color:#7a5a17; background:#fff7e6; border-color:#f0dcae; }
.phone-warning-text { margin:0; font-size:13px; font-weight:700; color:#8a5a12; }
.phone-warning .dialog-actions { margin-top:12px; }
.phone-choice { margin:8px 0 0; font-weight:700; }
.phone-warning-slot:empty { display:none; }
.name-suggestions { margin:4px 0 14px; padding:10px 13px; background:#f5f8fc; border:1px dashed #d7e3f2; border-radius:7px; }
.name-suggestions ul { margin:6px 0; padding-left:18px; }
.name-suggestions li { margin:4px 0; font-size:12px; }
.name-suggestions button { height:auto; padding:3px 9px; font-size:11px; }
dialog#editor { width:min(670px,calc(100vw - 28px)); max-height:90vh; padding:27px; color:var(--ink); }
.dialog-header { margin-bottom:22px; }
.dialog-header h2 { margin:6px 0 0; font-size:22px; }
.fields-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; }
.fields-grid label { display:block; font-size:12px; font-weight:600; color:#5d738b; }
.fields-grid input,.fields-grid select,.fields-grid textarea { display:block; width:100%; margin-top:7px; border:1px solid #d8e2ed; border-radius:6px; padding:10px; color:#314b65; background:#fff; font-weight:400; font-size:13px; }
.fields-grid .wide { grid-column:1/-1; }
.required { color:#c48651; }
.form-error { color:#b64f3b; font-size:12px; }
.dialog-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:24px; }
.close-dialog { width:28px; height:28px; border:0; background:#f3f6fa; border-radius:6px; color:#7b8da3; font-size:22px; }
.toast { position:fixed; z-index:30; bottom:24px; right:24px; max-width:440px; padding:15px 20px; border-radius:9px; background:#244c69; color:white; box-shadow:0 4px 24px #16344b30; font-size:13px; }
.toast.error { background:#a54438; }
.detail-grid,.patient-overview,.help-grid { display:grid; grid-template-columns:1fr 1fr; gap:18px; }
.detail-grid div { border:1px solid var(--line); border-radius:8px; padding:15px; }
.detail-grid small,.detail-grid strong { display:block; margin:4px 0; }
.detail-grid small { color:var(--muted); }
.quick-actions { margin-top:24px; }
.info-list { margin:18px 0; }
.info-list > div { display:grid; grid-template-columns:140px 1fr; gap:15px; padding:12px 0; border-bottom:1px solid #eef2f6; font-size:12px; }
.info-list dt { color:#8a98aa; }
.info-list dd { margin:0; overflow-wrap:anywhere; white-space:pre-wrap; }
.prewrap { white-space:pre-wrap; overflow-wrap:anywhere; }
.patient-tabs { display:flex; gap:8px; margin-bottom:20px; border-bottom:1px solid var(--line); overflow:auto; }
.patient-tabs button { border:0; border-bottom:2px solid transparent; background:none; padding:12px; color:#7c8ca1; font-size:12px; white-space:nowrap; }
.patient-tabs button.selected { color:var(--blue); border-color:var(--blue); font-weight:650; }
.appointment-row { display:flex; flex-direction:column; gap:7px; width:100%; text-align:left; padding:12px; margin:7px 0; border:1px solid #dfe9f5; border-radius:7px; background:#f6faff; color:#4f7496; font-size:12px; }
.appointment-row span { color:#8c9aad; font-size:10px; }
.timeline-card { background:#f2f7fd; padding:18px; border-radius:8px; }
.timeline-card small { color:#7c92a9; }
.settings-panel { max-width:950px; }
.big-number { font-size:38px; color:var(--blue); }
.hermes-layout { display:grid; grid-template-columns:1.5fr 1fr; gap:18px; }
.integration-heading { display:flex; align-items:center; gap:17px; margin-bottom:28px; }
.integration-heading h2 { margin:0; }
.integration-icon { display:inline-grid; place-items:center; width:58px; height:58px; border-radius:15px; background:#eaf2fe; color:#4985cb; font-size:24px; }
.integration-steps article { display:flex; gap:17px; margin-bottom:22px; }
.integration-steps article > span,.step-number { display:inline-grid; place-items:center; background:#edf4ff; color:#5088c8; min-width:28px; height:28px; border-radius:50%; font-size:12px; }
.integration-steps h3 { margin:4px 0; }
.integration-steps p { margin:5px 0; color:#8491a2; font-size:12px; }
.connection-card { max-width:750px; padding:40px; }
.connection-card h2 { margin-top:20px; }
.portal-hero { background:linear-gradient(110deg,#edf5ff,#fff); padding:44px; }
.portal-hero h2 { font-size:30px; }
.guide-intro a { color:#fff; }
.clinical-page { background:#f5f7fb; }
.clinical-header { padding-top:6px; }
.clinical-section { border-radius:10px; }
.clinical-actions { flex-wrap:wrap; }
@media(min-width:901px) { .menu-button { display:none; } }
@media(max-width:1100px) { .page-content { padding:23px 20px; }.page-heading { align-items:flex-start; }.metrics { gap:9px; }.metric { padding:15px; }.hermes-layout { grid-template-columns:1fr; }.heading-actions { justify-content:flex-end; }.workspace-label span { display:none; } }
@media(max-width:900px) { :root { --side-width:0px; }.sidebar { width:224px; }.topbar { padding:0 16px; }.page-heading { flex-wrap:wrap; }.patient-overview { grid-template-columns:1fr; }.module-tabs { padding-left:12px; padding-right:12px; }.sidebar { z-index:20; } }
@media(max-width:600px) { .page-content { padding:20px 13px; }.page-heading h1 { font-size:25px; }.metrics { grid-template-columns:1fr 1fr; }.metric strong { font-size:23px; }.heading-actions { justify-content:flex-start; }.fields-grid,.detail-grid,.help-grid { grid-template-columns:1fr; }.archive-check { margin-left:0; }.search-label { width:100%; }.calendar-toolbar { padding:12px; gap:6px; }.calendar-toolbar select { max-width:180px; }.topbar { height:60px; }.user-button > span:not(.avatar) { display:none; }.toast { bottom:12px; right:12px; left:12px; }.info-list > div { grid-template-columns:100px 1fr; }.padded { padding:19px; } }
@media print { .sidebar,.topbar,.module-tabs,.heading-actions,.calendar-toolbar,.list-toolbar,.row-actions,.clinical-actions,.patient-panel,.patient-tabs,.toast { display:none!important; }.main { padding:0; }.page-content { padding:0; }.agenda-scroll { max-height:none; overflow:visible; }.week-grid { grid-template-columns:40px repeat(var(--days),minmax(0,1fr)); }.panel { break-inside:avoid; box-shadow:none; }.metrics { margin:12px 0; }body:has(dialog[open]) .app-shell { display:none; }dialog[open] { position:static; max-height:none!important; width:100%!important; box-shadow:none; }dialog .dialog-actions,dialog .close-dialog { display:none; } }

/* Patient originals and consent snapshots */
.document-item{display:flex;justify-content:space-between;gap:1rem;padding:1rem 0;border-bottom:1px solid #e2e8f0;align-items:center}.document-item p{margin:.35rem 0;overflow-wrap:anywhere}.document-item>div:last-child{display:flex;gap:.5rem;flex-wrap:wrap}.consent-create{margin-top:1.5rem}.consent-create summary{cursor:pointer;font-weight:600;padding:1rem 0}.consent-attestation{display:block;margin:1rem 0}#consent-signature{display:block;width:100%;max-width:1000px;height:auto;border:1px solid #64748b;border-radius:8px;touch-action:none;margin:1rem 0;background:white}.signature-record{max-width:100%;width:500px;height:auto}.consent-print .muted{overflow-wrap:anywhere}@media(max-width:700px){.document-item{align-items:flex-start;flex-direction:column}}@media print{body:has(.consent-print) .sidebar,body:has(.consent-print) .topbar,body:has(.consent-print) .page-heading,body:has(.consent-print) .metrics,body:has(.consent-print) .patient-tabs,body:has(.consent-print) #patient-documents>section{display:none!important}.consent-print button{display:none!important}.consent-print{border:0;box-shadow:none}}.revoke-form{flex-basis:100%;display:flex;flex-direction:column;gap:.5rem;margin-top:.5rem;padding:.75rem;border:1px solid #dbe3ed;border-radius:7px;background:#f7fafc}.revoke-form label{display:flex;flex-direction:column;gap:.4rem;font-size:12px;font-weight:600;color:#526780}.revoke-form textarea{width:100%;min-height:60px;resize:vertical;font:inherit;padding:.5rem;border:1px solid #cfd6da;border-radius:7px;box-sizing:border-box}.revoke-actions{display:flex;gap:.5rem;flex-wrap:wrap}

.booking-public{display:block;background:#f3f6fa;min-height:100vh;padding:24px}.booking-public main{max-width:800px;margin:24px auto}.booking-public label{display:flex;flex-direction:column;gap:8px}.booking-public .consent-attestation{display:block}.booking-public input[type=checkbox]{width:auto}.booking-public input[readonly]{width:100%}

/* Biblioteca docente: formularios legibles y páginas consultables. */
#library-panel .panel{min-width:0}#library-form{display:grid;gap:16px}#library-form label{display:block;font-size:13px;font-weight:600}#library-form input:not([type=checkbox]),#library-form select,#library-form textarea{display:block;width:100%;max-width:100%;margin-top:7px;padding:10px;border:1px solid #d8e2ed;border-radius:6px;background:#fff;color:#314b65;font:inherit;box-sizing:border-box}#library-form input[type=checkbox]{width:auto;margin-right:7px}#library-panel details{margin:12px 0;overflow-wrap:anywhere}#library-panel summary{cursor:pointer;font-weight:600}#library-panel [data-results] article{margin-bottom:15px}#library-panel .prewrap{overflow-wrap:anywhere}#library-panel [data-image]{margin-top:20px}#library-form .muted{margin:0}

/* Planning y páginas principales en pantalla estrecha (móvil) */
.week-grid:not(.grid-60) .hour-label.is-hour { border-bottom-color:#dbe4ee; }
@media(max-width:600px){
  .week-grid { grid-template-columns:44px repeat(var(--days),minmax(104px,1fr)); }
  .calendar-toolbar input, .calendar-toolbar select { flex:1 1 140px; max-width:none; }
  .calendar-toolbar .button-group { flex:0 0 auto; }
  .day-label { height:58px; }
  .day-label strong { font-size:17px; }
  .hour-label { font-size:9px; }
  .calendar-event { padding:5px; gap:2px; }
  .calendar-event strong { font-size:11px; }
  .calendar-event small { font-size:8px; }
  th, td { padding:11px 12px; }
  td { max-width:220px; }
  .row-actions { min-width:0; }
  .patient-tabs button { padding:10px 9px; }
  .info-list dd, .prewrap, .panel p { overflow-wrap:anywhere; }
}

/* Cobros y contabilidad: orden por columna, filtros, totales y previsión */
.th-sort { display:inline-flex; align-items:center; gap:5px; padding:0; border:0; background:none; color:inherit; font:inherit; font-weight:600; cursor:pointer; text-align:left; }
.th-sort:hover { color:var(--blue-deep); }
.th-sort.sorted { color:var(--blue-deep); }
.sort-arrow { font-size:9px; color:#b8c5d4; }
.th-sort.sorted .sort-arrow { color:var(--blue); }
.filters-row th { padding:7px 10px; background:#fdfefe; }
.col-filter { width:100%; min-width:84px; height:30px; padding:4px 7px; border:1px solid #dce4ee; border-radius:6px; background:#fff; color:#4f6a85; font-size:11px; }
.col-filter:focus { outline:2px solid #cfe2fa; outline-offset:0; }
.payments-table tfoot td { padding:11px 17px; border-top:1px solid var(--line); background:#fafbfd; color:#6d7f93; font-size:11px; }
.chips { display:flex; gap:6px; flex-wrap:wrap; align-items:center; }
.chip { border:1px solid #dbe4ee; background:#fff; color:#6b7f96; border-radius:999px; padding:7px 13px; font-size:11px; cursor:pointer; }
.chip.selected { background:#eaf2fd; border-color:#bcd7f7; color:var(--blue-deep); font-weight:650; }
.split-panels { display:grid; grid-template-columns:1fr 1fr; gap:18px; }
.split-panels > * { min-width:0; }
.split-panels h3 { font-size:13px; color:#5d738b; margin:0 0 10px; }
.assumptions { border:1px solid var(--line); border-radius:9px; background:#fbfcfe; padding:14px 17px; margin-top:14px; }
.assumptions summary { cursor:pointer; color:#5d738b; font-size:12px; font-weight:650; }
.assumptions ul, .assumption-list { margin:12px 0 0; padding-left:19px; color:#71839b; font-size:11.5px; line-height:1.7; }
@media(max-width:900px) { .split-panels { grid-template-columns:1fr; } }
@media(max-width:600px) { .split-panels { grid-template-columns:1fr; } .col-filter { min-width:0; } .chips { width:100%; } }
@media print { .filters-row, .chips, .sort-arrow { display:none!important; } }

/* Accesos rápidos: «Cola de envíos» y «Solicitudes» siempre a la vista */
.nav .nav-label { margin:4px 0 8px; }
.nav-quick-list { display:flex; flex-direction:column; gap:6px; margin:0 0 12px; padding:8px; border:1px solid #d6e4f7; border-radius:11px; background:linear-gradient(180deg,#f3f8ff,#e8f1fd); }
.nav-quick { display:flex; align-items:center; gap:9px; min-height:42px; padding:0 11px; border-radius:8px; background:#fff; color:#1f5da8; font-size:13.5px; font-weight:700; text-decoration:none; box-shadow:0 1px 2px rgba(36,103,182,.14); }
.nav-quick > span { width:16px; color:#3f7fce; font-size:16px; text-align:center; }
.nav-quick:hover { background:#f8fbff; color:#174c8c; }
.nav-quick.active { background:var(--blue); color:#fff; box-shadow:inset -3px 0 #2879d4; }
.nav-quick.active > span { color:#fff; }
.quick-count { min-width:24px; margin-left:auto; padding:2px 7px; border-radius:999px; background:#dcecff; color:#1f5da8; font-size:12px; font-weight:750; text-align:center; }
.nav-quick.active .quick-count { background:#fff; color:#2467b6; }
.quick-count.is-zero { background:#eef1f5; color:#8d99a8; font-weight:600; }
/* Ficha del paciente · pestaña «Citas»: programadas y pasadas con sus filtros */
.patient-appointments .panel-title { padding:18px 20px 0; }
.patient-appointments .panel-title h2 { margin:0; font-size:15px; }
.patient-appointments .panel-title p { margin:4px 0 0; }
.patient-appointments .list-toolbar label { display:flex; align-items:center; gap:6px; color:#6f7f92; font-size:12px; }
@media(max-width:600px) { .nav-quick { font-size:12.5px; } }

/* Justificantes de asistencia · vista del documento y salida en PDF */
.justificante-document{background:#fff;color:#0f172a;border:1px solid #cbd5e1;border-radius:12px;padding:2rem 2.25rem;max-width:820px;line-height:1.55}
.justificante-letterhead{display:flex;flex-direction:column;gap:.15rem;padding-bottom:.9rem;border-bottom:2px solid #0f172a;margin-bottom:1.4rem}
.justificante-letterhead strong{font-size:1.15rem;letter-spacing:.01em}
.justificante-letterhead span{font-size:.8rem;color:#475569}
.justificante-document h3{margin:0 0 1rem;font-size:1.05rem;text-transform:uppercase;letter-spacing:.06em}
.justificante-rows{margin:0 0 1.2rem;display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:.35rem 1.5rem}
.justificante-rows div{display:flex;gap:.5rem;border-bottom:1px dotted #cbd5e1;padding:.2rem 0}
.justificante-rows dt{min-width:7.5rem;font-weight:600;color:#475569;font-size:.85rem}
.justificante-rows dd{margin:0;font-size:.9rem}
.justificante-body{font-size:.98rem}
.justificante-issue{margin-top:1.5rem}
.justificante-signature{margin-top:3rem;display:flex;flex-direction:column;gap:.25rem;max-width:320px}
.justificante-signature span{font-size:.78rem;color:#475569}
.justificante-signature i{display:block;height:1px;background:#0f172a;margin:.4rem 0 .5rem}
.justificante-note{margin-top:1.5rem;font-size:.78rem;color:#64748b}
#justificante-print-root{display:none}
@media print{
 body.justificante-printing > .app-shell{display:none!important}
 body.justificante-printing #justificante-print-root{display:block}
 #justificante-print-root .justificante-document{border:0;border-radius:0;padding:0;max-width:none}
 #justificante-print-root .justificante-note{color:#334155}
}

/* Inspección fiscal TicketBAI · marca en la agenda de siempre y vista aparte.
   Todo es ADITIVO: la cita conserva su color de profesional y su contenido; el
   distintivo se suma por encima. No se oculta ni se cambia ninguna cita. */
.calendar-event.tbai-marked { outline:2px solid #0d9488; outline-offset:-2px; }
.calendar-event.tbai-marked strong { color:#0f766e; }
.calendar-event.tbai-marked::after { content:''; position:absolute; top:4px; right:4px; width:8px; height:8px; border-radius:50%; background:#0d9488; box-shadow:0 0 0 2px #fff; }
.agenda-legend { display:flex; align-items:center; gap:7px; margin:0 0 16px; color:#5d7186; font-size:11.5px; line-height:1.5; }
.agenda-legend .tbai-key { display:inline-block; width:11px; height:11px; border-radius:50%; background:#0d9488; flex:0 0 auto; }
.agenda-legend a { color:#0f766e; font-weight:600; }
.tbai-qr { display:block; width:72px; height:72px; background:#fff; }
.tbai-badge { display:inline-block; margin-left:6px; padding:2px 8px; border-radius:999px; background:#e6f7f2; color:#0f766e; font-size:11px; font-weight:650; white-space:nowrap; }
.tbai-warning { display:inline-block; margin-left:6px; color:#b45309; font-size:11px; font-weight:650; white-space:nowrap; }
.tbai-sent-list .search-label { max-width:340px; margin:6px 0 12px; }
.tbai-sent-list td code { overflow-wrap:anywhere; font-size:10.5px; }
.tbai-report-toolbar { display:flex; flex-wrap:wrap; align-items:flex-end; gap:10px; margin:14px 0 6px; }
.tbai-report-toolbar label { display:flex; flex-direction:column; gap:4px; font-size:11px; color:#6f7f92; }
.tbai-report-toolbar input[type=date] { padding:8px 10px; border:1px solid var(--line); border-radius:7px; background:#fff; color:inherit; }
.pill.bad { color:#a13d3d; background:#fbeaea; }
.tbai-patient .section-title { align-items:flex-start; }
.tbai-patient code { overflow-wrap:anywhere; font-size:10.5px; }
@media(max-width:700px) { .tbai-report-toolbar { flex-direction:column; align-items:stretch; } }

/* ── Biblioteca · panel de consulta con citas (estilo tarjeta) ─────────── */
.bib-hero textarea{width:100%;box-sizing:border-box;font:inherit;line-height:1.55;padding:.7em;border:1px solid var(--border,#d7dbe0);border-radius:10px;resize:vertical;background:var(--card,#fff);color:var(--foreground,#222)}
.bib-hero input[type=text],.bib-hero select{max-width:100%}
.bib-row{display:flex;gap:1rem;flex-wrap:wrap;margin:.6em 0}
.bib-row label{display:flex;flex-direction:column;gap:.3em;flex:1;min-width:12em}
.bib-approve{display:flex;gap:.6em;align-items:flex-start;margin:.7em 0;font-size:.92em;color:var(--muted-foreground,#5b6470)}
.bib-advanced{margin:.5em 0;font-size:.92em;color:var(--muted-foreground,#5b6470)}
.bib-advanced summary{cursor:pointer}
.bib-ask{font-size:1.02em}
.bib-searchbar{display:flex;gap:.6em;align-items:end;flex-wrap:wrap;margin:.6em 0}
.bib-searchbar label{display:flex;flex-direction:column;gap:.3em;font-size:.92em;min-width:13em;flex:1}
.bib-searchbar input{flex:2;min-width:12em;font:inherit;padding:.55em;border:1px solid var(--border,#d7dbe0);border-radius:8px;background:var(--card,#fff);color:var(--foreground,#222)}
.bib-answer{margin-top:.9em;border:1px solid var(--border,#d7dbe0);border-left:4px solid var(--accent,#2563eb);border-radius:10px;padding:1em;background:var(--card,#fff)}
.bib-answer h3{margin-top:0}
.bib-sources{display:grid;gap:.7em;margin-top:.7em}
.bib-source{border:1px solid var(--border,#d7dbe0);border-radius:10px;padding:.8em .9em;background:var(--card,#fff)}
.bib-source header{display:flex;flex-direction:column;gap:.25em;margin-bottom:.3em}
.bib-source h4{margin:0;font-size:1em}
.bib-source .bib-loc{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.85em;color:var(--muted-foreground,#5b6470);margin:.15em 0}
.bib-source details{margin:.3em 0}
.bib-source details summary{cursor:pointer;color:var(--accent,#2563eb);font-size:.92em}
.bib-source .prewrap{font-size:.93em;max-height:14em;overflow:auto;border-left:3px solid var(--border,#d7dbe0);padding-left:.6em}
.bib-links{display:flex;gap:.9em;flex-wrap:wrap;font-size:.92em}
.bib-links button{background:none;border:none;color:var(--accent,#2563eb);cursor:pointer;padding:0;font:inherit}
.bib-badge{display:inline-block;font-size:.72em;font-weight:600;letter-spacing:.02em;padding:.2em .6em;border-radius:999px;width:fit-content}
.bib-badge-warn{background:#fdf3d7;color:#8a6d1a;border:1px solid #ecd98f}
.bib-badge-ok{background:#e4f5e7;color:#1e7a34;border:1px solid #b5e2bf}
.bib-badge-muted{background:#eef1f4;color:#4b5563;border:1px solid #d7dbe0}
.bib-badge-warn{background:#fdf3d7;color:#8a6d1a;border:1px solid #ecd98f}

/* Buscador de pacientes: escribe y aparecen solo las coincidencias */
.patient-picker{position:relative}
.patient-search{width:100%;box-sizing:border-box;font:inherit;padding:.55em .6em;border:1px solid var(--border,#d7dbe0);border-radius:8px;background:var(--card,#fff)}
.patient-results{position:absolute;z-index:40;left:0;right:0;top:calc(100% + 4px);max-height:264px;overflow:auto;background:var(--card,#fff);border:1px solid var(--border,#d7dbe0);border-radius:10px;box-shadow:0 10px 28px rgba(35,56,78,.18);display:none}
.patient-picker.open .patient-results{display:block}
.patient-option{display:flex;width:100%;align-items:baseline;justify-content:space-between;gap:.6em;padding:.5em .7em;border:none;background:none;text-align:left;font:inherit;color:var(--ink,#23384e);cursor:pointer}
.patient-option:hover{background:var(--accent,#2563eb);color:#fff}
.patient-option:hover small{color:#eef4ff}
.patient-option small{color:var(--muted,#708196);font-size:.85em}
.patient-option.patient-new{font-weight:600;border-bottom:1px solid var(--border,#d7dbe0);color:var(--accent,#2563eb)}
.patient-none{padding:.5em .7em;margin:0;color:var(--muted,#708196)}
