:root {
  --bg: #f5f7f5;
  --surface: #ffffff;
  --surface-soft: #f0f5f2;
  --surface-strong: #e4eee9;
  --text: #18312c;
  --text-soft: #62736f;
  --line: #dce5e1;
  --primary: #285f55;
  --primary-strong: #19483f;
  --primary-soft: #e3f0eb;
  --accent: #b78051;
  --danger: #a44343;
  --danger-soft: #f8e9e8;
  --warning: #8b651d;
  --warning-soft: #fbf2dc;
  --success: #326a4c;
  --success-soft: #e5f3e9;
  --info: #356783;
  --info-soft: #e7f1f7;
  --shadow-sm: 0 1px 2px rgba(15, 40, 34, .05), 0 8px 22px rgba(15, 40, 34, .04);
  --shadow-md: 0 16px 45px rgba(20, 54, 45, .10);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --sidebar: 268px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.55; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid rgba(40, 95, 85, .35); outline-offset: 2px; }
.skip-link { position: fixed; z-index: 999; top: 10px; left: 10px; padding: 10px 14px; background: var(--text); color: white; border-radius: 8px; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 18px; background: #173e37; color: #eef7f3; z-index: 40; }
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: linear-gradient(145deg, #d8efe6, #ffffff); color: var(--primary-strong); font-weight: 800; font-size: 20px; box-shadow: 0 8px 24px rgba(0, 0, 0, .12); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; letter-spacing: -.02em; }
.brand small { margin-top: 1px; color: rgba(238, 247, 243, .66); font-size: 12px; }
.sidebar-nav { display: grid; gap: 5px; margin-top: 36px; }
.nav-link { min-height: 44px; display: flex; align-items: center; gap: 11px; padding: 10px 12px; color: rgba(238, 247, 243, .78); border-radius: 11px; font-weight: 600; transition: .18s ease; }
.nav-link > span:first-child { width: 22px; text-align: center; opacity: .85; }
.nav-link:hover { background: rgba(255, 255, 255, .08); color: white; }
.nav-link.is-active { background: rgba(227, 240, 235, .14); color: white; box-shadow: inset 3px 0 0 #cfe8df; }
.count-badge { margin-left: auto; min-width: 23px; height: 23px; display: inline-grid; place-items: center; padding: 0 6px; border-radius: 999px; background: #eef7f3; color: var(--primary-strong); font-size: 11px; }
.sidebar-footer { margin-top: auto; display: grid; gap: 9px; padding-top: 22px; border-top: 1px solid rgba(255, 255, 255, .11); }
.sidebar-footer .text-link { color: rgba(238, 247, 243, .68); font-size: 13px; }
.sidebar-footer .text-link:hover { color: white; }
.main-content { min-width: 0; padding: 32px clamp(20px, 4vw, 54px) 56px; }
.mobile-bar, .sidebar-backdrop { display: none; }
.demo-banner { margin-bottom: 16px; padding: 9px 14px; border: 1px solid #e7d4aa; border-radius: 10px; background: #fff8e8; color: #6f541e; font-size: 13px; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin: 2px 0 26px; }
.page-header h1 { margin: 3px 0 5px; font-size: clamp(28px, 4vw, 40px); line-height: 1.14; letter-spacing: -.035em; }
.page-header p { max-width: 720px; margin: 0; color: var(--text-soft); }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.eyebrow { display: block; color: var(--primary); font-size: 12px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.muted { color: var(--text-soft); }
.text-small { font-size: 13px; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }

.btn { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border: 1px solid transparent; border-radius: 11px; cursor: pointer; font-weight: 700; transition: transform .12s ease, background .18s ease, border-color .18s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { color: white; background: var(--primary); box-shadow: 0 8px 18px rgba(40, 95, 85, .17); }
.btn-primary:hover { background: var(--primary-strong); }
.btn-secondary { color: var(--primary-strong); background: var(--surface); border-color: var(--line); }
.btn-secondary:hover { border-color: #b8cec5; background: var(--surface-soft); }
.btn-danger { color: var(--danger); background: var(--danger-soft); border-color: #efcac7; }
.btn-quiet { min-height: 38px; padding: 7px 11px; color: inherit; background: transparent; border-color: currentColor; opacity: .82; }
.btn-small { min-height: 34px; padding: 6px 10px; border-radius: 9px; font-size: 13px; }
.btn-full { width: 100%; }
.icon-button { width: 42px; height: 42px; display: inline-grid; place-items: center; border: 0; border-radius: 11px; background: transparent; color: inherit; cursor: pointer; }
.text-link { color: var(--primary); font-weight: 700; }
.text-link:hover { text-decoration: underline; }

.panel { padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel + .panel { margin-top: 18px; }
.panel-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 17px; }
.panel-header h2, .panel-header h3 { margin: 0; }
.panel-header p { margin: 4px 0 0; color: var(--text-soft); }
.panel h2 { font-size: 20px; letter-spacing: -.02em; }
.narrow-panel { max-width: 680px; }
.surface-soft { background: var(--surface-soft); }

.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { min-height: 128px; padding: 18px; position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.stat-card::after { content: ""; position: absolute; right: -24px; bottom: -35px; width: 92px; height: 92px; border-radius: 50%; background: var(--primary-soft); opacity: .8; }
.stat-card .stat-label { display: block; min-height: 42px; color: var(--text-soft); font-size: 13px; font-weight: 650; }
.stat-card strong { display: block; font-size: 32px; line-height: 1; letter-spacing: -.04em; }
.stat-card small { display: block; margin-top: 8px; color: var(--text-soft); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); gap: 18px; align-items: start; }
.quick-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.quick-action { min-height: 76px; display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--surface-soft); border: 1px solid transparent; border-radius: 13px; font-weight: 750; }
.quick-action:hover { border-color: #bfd3cb; background: var(--primary-soft); }
.quick-action b { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--surface); color: var(--primary); }
.alert-list { display: grid; gap: 10px; }
.alert-item { display: grid; grid-template-columns: 7px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.alert-dot { width: 7px; height: 100%; min-height: 38px; border-radius: 99px; background: var(--text-soft); }
.alert-item.warning .alert-dot { background: var(--warning); }
.alert-item.danger .alert-dot { background: var(--danger); }
.alert-item.info .alert-dot { background: var(--info); }
.alert-item strong, .alert-item span { display: block; }
.alert-item span { color: var(--text-soft); font-size: 13px; }

.flash { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; padding: 13px 15px; border: 1px solid; border-radius: 12px; box-shadow: var(--shadow-sm); }
.flash button { border: 0; background: transparent; cursor: pointer; font-size: 20px; }
.flash-success { background: var(--success-soft); color: var(--success); border-color: #c2dfca; }
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: #efc7c3; }
.flash-warning { background: var(--warning-soft); color: var(--warning); border-color: #ead7a9; }
.flash-info { background: var(--info-soft); color: var(--info); border-color: #c6ddea; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-stack { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field > span:first-child { font-size: 13px; font-weight: 750; color: #304c45; }
.field em { color: var(--danger); font-style: normal; }
.field-wide { grid-column: 1 / -1; }
.field input, .field select, .field textarea, .input { width: 100%; min-height: 43px; padding: 10px 12px; color: var(--text); background: white; border: 1px solid #cfdcd7; border-radius: 10px; transition: border-color .15s ease, box-shadow .15s ease; }
.field textarea { resize: vertical; min-height: 100px; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(40, 95, 85, .12); outline: 0; }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 12px; font-weight: 650; }
.field-help { margin: -7px 0 0; color: var(--text-soft); font-size: 12px; }
.checkbox { display: flex; align-items: flex-start; gap: 9px; color: var(--text-soft); }
.checkbox input { margin-top: 4px; accent-color: var(--primary); }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 4px; }
.form-error-summary { margin-bottom: 16px; padding: 12px 14px; color: var(--danger); background: var(--danger-soft); border: 1px solid #efc7c3; border-radius: 10px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 14px; font-weight: 800; font-size: 17px; }
.form-section + .form-section { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 18px; }
.toolbar .field { flex: 1 1 160px; }
.toolbar .search-field { flex-basis: 280px; }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 13px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--text-soft); background: #f8faf9; font-size: 12px; letter-spacing: .035em; text-transform: uppercase; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdfc; }
.clickable-row { cursor: pointer; }
.clickable-row:hover, .clickable-row:focus { background: #f5faf7; }
.clickable-row:focus-visible { outline: 3px solid rgba(40, 95, 85, .25); outline-offset: -3px; }
.patient-name-link { color: var(--primary-strong); text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; transition: text-decoration-color .15s ease; }
.patient-name-link:hover, .patient-name-link:focus-visible { text-decoration-color: currentColor; }
.table-person { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.avatar { flex: 0 0 auto; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: var(--primary-soft); color: var(--primary-strong); font-weight: 850; }
.avatar.large { width: 62px; height: 62px; border-radius: 19px; font-size: 20px; }
.table-person strong, .table-person small { display: block; }
.table-person small { color: var(--text-soft); }
.badge { display: inline-flex; align-items: center; gap: 5px; min-height: 25px; padding: 3px 9px; border-radius: 999px; background: var(--surface-soft); color: var(--text-soft); font-size: 12px; font-weight: 750; white-space: nowrap; }
.badge-ACTIVE, .badge-PAID, .badge-CONFIRMED, .badge-COMPLETED, .badge-SHARED { background: var(--success-soft); color: var(--success); }
.badge-ARCHIVED, .badge-CANCELLED, .badge-NO_SHOW { background: #eee; color: #656565; }
.badge-EXPIRED, .badge-UNPAID, .badge-URGENT { background: var(--danger-soft); color: var(--danger); }
.badge-PARTIALLY_PAID, .badge-PAUSED, .badge-IMPORTANT, .badge-POSTPONED { background: var(--warning-soft); color: var(--warning); }
.badge-UPCOMING, .badge-SCHEDULED, .badge-DRAFT { background: var(--info-soft); color: var(--info); }
.pagination { display: flex; justify-content: center; gap: 7px; margin-top: 20px; }
.pagination a, .pagination span { min-width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: white; }
.pagination .current { background: var(--primary); color: white; border-color: var(--primary); }

.patient-hero { display: flex; align-items: center; gap: 16px; }
.patient-hero h1 { margin: 0; }
.patient-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--text-soft); font-size: 13px; }
.tabs { display: flex; gap: 7px; overflow-x: auto; margin: 0 0 19px; padding: 5px; background: var(--surface-strong); border-radius: 13px; scrollbar-width: thin; }
.tab-link { flex: 0 0 auto; padding: 9px 12px; border-radius: 9px; color: var(--text-soft); font-weight: 700; font-size: 13px; white-space: nowrap; }
.tab-link:hover { color: var(--text); background: rgba(255, 255, 255, .6); }
.tab-link.is-active { color: var(--primary-strong); background: white; box-shadow: var(--shadow-sm); }
.info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.info-card { padding: 16px; background: var(--surface-soft); border-radius: 12px; }
.info-card span, .info-card strong { display: block; }
.info-card span { color: var(--text-soft); font-size: 12px; }
.info-card strong { margin-top: 4px; }
.info-card-wide { grid-column: 1 / -1; }
.preserve-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
.split-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr); gap: 18px; align-items: start; }
.card-list { display: grid; gap: 12px; }
.record-card { padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.record-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.record-card h3 { margin: 0; font-size: 17px; }
.record-card p { white-space: pre-wrap; }
.record-meta { display: flex; flex-wrap: wrap; gap: 7px 13px; margin-top: 7px; color: var(--text-soft); font-size: 12px; }
details.inline-edit { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
details.inline-edit > summary { cursor: pointer; color: var(--primary); font-weight: 750; }
details.inline-edit[open] > summary { margin-bottom: 14px; }
.private-banner { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; padding: 13px; border-radius: 11px; background: #f4eef8; color: #5c3f70; }

.chart-shell { min-height: 320px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.chart-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.chart-toolbar select { min-height: 38px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: white; }
.chart-svg { width: 100%; height: 250px; overflow: visible; }
.chart-grid-line { stroke: #e8eeeb; stroke-width: 1; }
.chart-axis-label { fill: var(--text-soft); font-size: 11px; }
.chart-path { fill: none; stroke: var(--primary); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: rgba(40, 95, 85, .08); }
.chart-point { fill: white; stroke: var(--primary); stroke-width: 2.5; }
.chart-empty { min-height: 250px; display: grid; place-items: center; color: var(--text-soft); }
.metric-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric-card { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.metric-card span, .metric-card strong { display: block; }
.metric-card span { color: var(--text-soft); font-size: 12px; }
.metric-card strong { font-size: 21px; }
.delta { font-size: 12px; font-weight: 750; }
.delta.positive { color: var(--info); }
.delta.negative { color: var(--accent); }

.message-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); min-height: 640px; padding: 0; overflow: hidden; }
.conversation-list { border-right: 1px solid var(--line); background: #f8faf9; }
.conversation-search { padding: 15px; border-bottom: 1px solid var(--line); }
.conversation-search input { width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; }
.conversation-row { display: flex; gap: 10px; padding: 14px 15px; border-bottom: 1px solid var(--line); }
.conversation-row:hover, .conversation-row.is-active { background: white; }
.conversation-row-content { min-width: 0; flex: 1; }
.conversation-row strong { display: block; }
.conversation-row p { margin: 3px 0 0; color: var(--text-soft); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-row time { color: var(--text-soft); font-size: 11px; }
.chat-panel { min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: white; }
.chat-header { display: flex; align-items: center; gap: 11px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.messages-thread { height: 480px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 20px; background: linear-gradient(180deg, #fbfdfc, #f5f8f6); }
.message-bubble { max-width: min(76%, 640px); padding: 11px 13px; border-radius: 15px 15px 15px 4px; background: white; border: 1px solid var(--line); box-shadow: 0 4px 12px rgba(20, 54, 45, .04); white-space: pre-wrap; }
.message-bubble.mine { align-self: flex-end; color: white; background: var(--primary); border-color: var(--primary); border-radius: 15px 15px 4px 15px; }
.message-bubble time { display: block; margin-top: 5px; opacity: .68; font-size: 10px; text-align: right; }
.message-attachment { display: inline-flex; margin-top: 7px; padding: 5px 8px; border-radius: 7px; background: rgba(255, 255, 255, .18); font-size: 12px; text-decoration: underline; }
.chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; padding: 13px; border-top: 1px solid var(--line); }
.chat-form textarea { min-height: 45px; max-height: 150px; resize: vertical; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; }
.chat-form-tools { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chat-form-tools input[type=file] { max-width: 260px; color: var(--text-soft); font-size: 12px; }

.calendar-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: white; }
.calendar-weekday { padding: 9px; color: var(--text-soft); background: #f8faf9; border-right: 1px solid var(--line); text-align: center; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.calendar-day { min-height: 118px; padding: 8px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.is-outside { background: #fafafa; color: #adb7b3; }
.calendar-day.is-today { box-shadow: inset 0 0 0 2px var(--primary); }
.calendar-date { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 800; }
.calendar-event { display: block; margin: 4px 0; padding: 5px 6px; border-radius: 7px; background: var(--primary-soft); color: var(--primary-strong); font-size: 10px; line-height: 1.25; }
.request-card { padding: 14px; border: 1px solid #ead7a9; border-radius: 12px; background: var(--warning-soft); }

.empty-state { padding: 34px 20px; text-align: center; color: var(--text-soft); }
.empty-state strong { display: block; margin-bottom: 4px; color: var(--text); font-size: 17px; }
.state-page { min-height: 70vh; display: grid; place-content: center; justify-items: center; text-align: center; }
.state-code { color: var(--primary-soft); font-size: clamp(90px, 20vw, 180px); font-weight: 900; line-height: .8; }
.state-page h1 { margin: 10px 0 4px; }
.prose { max-width: 900px; }
.prose h2 { margin-top: 28px; }
.prose p { color: var(--text-soft); }

.public-body { background: radial-gradient(circle at 15% 15%, #e4f0eb 0, transparent 35%), #f4f7f5; }
.public-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.auth-layout { width: min(1120px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) 430px; gap: clamp(34px, 8vw, 100px); align-items: center; }
.auth-layout.single { display: block; width: min(480px, 100%); }
.auth-intro h1 { max-width: 720px; margin: 10px 0 16px; font-size: clamp(40px, 6vw, 68px); line-height: 1.02; letter-spacing: -.055em; }
.auth-intro > p { max-width: 610px; color: var(--text-soft); font-size: 18px; }
.professional-signature { margin-top: 35px; display: grid; }
.professional-signature strong { font-size: 17px; }
.professional-signature span { color: var(--text-soft); }
.auth-card { padding: 30px; background: rgba(255, 255, 255, .95); border: 1px solid rgba(210, 224, 218, .9); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.auth-brand { margin-bottom: 30px; }
.auth-brand small { color: var(--text-soft); }
.auth-card h1, .auth-card h2 { margin: 0 0 5px; font-size: 29px; letter-spacing: -.03em; }
.auth-link { display: block; margin-top: 18px; text-align: center; }
.legal-note { margin: 22px 0 0; color: var(--text-soft); font-size: 11px; text-align: center; }
.dev-reset { display: grid; gap: 4px; margin: 14px 0; padding: 11px; background: var(--warning-soft); border-radius: 9px; font-size: 12px; }
.dev-reset a { color: var(--primary); font-weight: 800; word-break: break-all; }
.public-document { width: min(950px, 100%); }
.public-document > .brand { margin-bottom: 22px; }
.public-document .brand small { color: var(--text-soft); }

.notification-list { display: grid; gap: 10px; }
.notification-item { display: grid; grid-template-columns: 11px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.notification-item.is-unread { border-color: #b8d2c8; background: #fbfffd; }
.notification-item .indicator { width: 9px; height: 9px; margin-top: 7px; border-radius: 50%; background: #c9d3cf; }
.notification-item.is-unread .indicator { background: var(--primary); }
.notification-item p { margin: 3px 0 0; color: var(--text-soft); }
.notification-item time { color: var(--text-soft); font-size: 11px; white-space: nowrap; }

@media (max-width: 1260px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .app-shell { display: block; padding-top: 64px; }
  .sidebar { position: fixed; left: 0; top: 0; width: min(300px, 86vw); transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow-md); }
  .app-shell.menu-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 35; display: block; background: rgba(10, 28, 24, .44); opacity: 0; visibility: hidden; transition: .22s ease; }
  .app-shell.menu-open .sidebar-backdrop { opacity: 1; visibility: visible; }
  .mobile-bar { position: fixed; inset: 0 0 auto 0; z-index: 30; height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; background: rgba(255, 255, 255, .94); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
  .mobile-brand { font-weight: 850; }
  .notification-button { position: relative; }
  .notification-button span { position: absolute; right: 2px; top: 2px; min-width: 18px; height: 18px; display: grid; place-items: center; border-radius: 99px; background: var(--danger); color: white; font-size: 10px; }
  .main-content { padding: 24px 18px 45px; }
  .dashboard-grid, .split-grid { grid-template-columns: 1fr; }
  .message-layout { grid-template-columns: 280px minmax(0, 1fr); }
  .auth-layout { grid-template-columns: 1fr; max-width: 560px; }
  .auth-intro { display: none; }
  .calendar-day { min-height: 95px; }
}

@media (max-width: 720px) {
  body { font-size: 14px; }
  .main-content { padding-inline: 13px; }
  .page-header { display: grid; gap: 14px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .stat-card { min-height: 112px; padding: 14px; }
  .stat-card .stat-label { min-height: 37px; }
  .stat-card strong { font-size: 27px; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .panel { padding: 16px; border-radius: 13px; }
  .form-grid, .form-grid.three, .info-grid, .metric-cards { grid-template-columns: 1fr; }
  .field-wide, .info-card-wide { grid-column: auto; }
  .toolbar { display: grid; grid-template-columns: 1fr 1fr; }
  .toolbar .field, .toolbar .search-field { flex: auto; }
  .toolbar .search-field { grid-column: 1 / -1; }
  .toolbar .btn { width: 100%; }
  .table-wrap.mobile-cards { border: 0; overflow: visible; }
  .mobile-cards table, .mobile-cards tbody, .mobile-cards tr, .mobile-cards td { display: block; width: 100%; }
  .mobile-cards thead { display: none; }
  .mobile-cards tr { margin-bottom: 11px; padding: 12px; background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-sm); }
  .mobile-cards td { display: grid; grid-template-columns: minmax(100px, 38%) 1fr; gap: 8px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
  .mobile-cards td:last-child { border-bottom: 0; }
  .mobile-cards td::before { content: attr(data-label); color: var(--text-soft); font-size: 11px; font-weight: 750; text-transform: uppercase; }
  .mobile-cards td:first-child { display: block; }
  .mobile-cards td:first-child::before { display: none; }
  .tabs { margin-inline: -4px; }
  .patient-hero { align-items: flex-start; }
  .patient-meta { display: grid; gap: 3px; }
  .message-layout { display: block; min-height: 0; }
  .conversation-list { border-right: 0; border-bottom: 1px solid var(--line); max-height: 250px; overflow-y: auto; }
  .messages-thread { height: 430px; padding: 14px; }
  .message-bubble { max-width: 88%; }
  .chat-form { grid-template-columns: 1fr; }
  .chat-form .btn { width: 100%; }
  .chat-form-tools { display: grid; }
  .calendar-grid { display: block; border: 0; background: transparent; }
  .calendar-weekday { display: none; }
  .calendar-day { min-height: 0; margin-bottom: 8px; padding: 11px; border: 1px solid var(--line) !important; border-radius: 10px; background: white; }
  .calendar-day.is-outside:empty, .calendar-day.is-outside:not(:has(.calendar-event)) { display: none; }
  .calendar-date { margin-bottom: 4px; }
  .auth-card { padding: 22px; }
  .public-shell { padding: 16px; }
}

@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .quick-actions { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 28px; }
  .btn { width: 100%; }
  .record-card-header { display: grid; }
}

@media print {
  .sidebar, .mobile-bar, .demo-banner, .page-actions, .btn, form, .tabs { display: none !important; }
  .app-shell { display: block; }
  .main-content { padding: 0; }
  .panel { box-shadow: none; break-inside: avoid; }
}

/* Composants de contenu métier complémentaires */
.record-list { display: grid; gap: 14px; }
.status-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.record-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.record-section h3, .record-section h4 { margin: 0 0 5px; font-size: 14px; }
.record-section p { margin: 0; color: var(--text-soft); }
.record-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 9px; margin-top: 14px; }
.record-actions details.inline-edit { flex: 1 1 100%; }
.attachment-list { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 14px; padding: 12px; background: var(--surface-soft); border-radius: 10px; }
.privacy-callout { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-bottom: 18px; padding: 14px 16px; color: #5c3f70; background: #f4eef8; border: 1px solid #dfcfea; border-radius: 12px; }
.privacy-callout strong, .privacy-callout span { display: block; }
.privacy-inline { padding: 10px 12px; color: #5c3f70; background: #f7f2fa; border-radius: 9px; }
.note-important { border-left: 4px solid var(--warning); }
.note-urgent { border-left: 4px solid var(--danger); }
.panel-flush { padding: 0; overflow: hidden; }
.panel-header.padded { padding: 20px 20px 0; }
.stacked-aside { display: grid; gap: 18px; }
.stacked-aside .panel + .panel { margin-top: 0; }
.info-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.info-grid.compact > div { padding: 10px; background: var(--surface-soft); border-radius: 9px; }
.info-grid.compact span, .info-grid.compact strong { display: block; }
.info-grid.compact span { color: var(--text-soft); font-size: 11px; }
.info-grid.single { grid-template-columns: 1fr; }
.mini-metric { min-width: 0; padding: 14px; background: var(--surface-soft); border: 1px solid transparent; border-radius: 12px; }
.mini-metric span, .mini-metric strong, .mini-metric small { display: block; }
.mini-metric span { color: var(--text-soft); font-size: 12px; }
.mini-metric strong { margin-top: 3px; font-size: 19px; line-height: 1.2; }
.mini-metric small { margin-top: 4px; color: var(--text-soft); }
.quick-actions.vertical { grid-template-columns: 1fr; }
.quick-action span strong, .quick-action span small { display: block; }
.quick-action span small { color: var(--text-soft); font-weight: 500; }
.soft-panel { background: var(--primary-soft); }
.soft-panel p { color: var(--text-soft); }
.report-document { max-width: 920px; }
.patient-stats .stat-text { position: relative; z-index: 1; max-width: 100%; font-size: 22px; line-height: 1.15; overflow-wrap: anywhere; }

@media (max-width: 720px) {
  .status-row { justify-content: flex-start; }
  .record-actions { display: grid; }
  .record-actions form, .record-actions .btn { width: 100%; }
  .info-grid.compact { grid-template-columns: 1fr 1fr; }
  .attachment-list { display: grid; }
}
