:root {
  --blue: #087ea4;
  --blue-dark: #075d79;
  --blue-soft: #e7f7fc;
  --ink: #18313d;
  --muted: #607884;
  --line: #d8e4e9;
  --surface: #ffffff;
  --background: #f3f8fa;
  --danger: #a72c35;
  --success: #16714c;
  --shadow: 0 16px 44px rgba(18, 56, 72, .12);
  --initials-badge-width: 58px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--background);
}
* { box-sizing: border-box; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--background); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--blue-dark); }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(1.65rem, 3vw, 2.35rem); line-height: 1.12; letter-spacing: -.035em; }
h2 { font-size: 1.15rem; }

.login-stage { min-height: 100vh; display: grid; place-items: center; padding: 28px 18px; background: radial-gradient(circle at 15% 10%, #d9f6ff 0, transparent 34%), linear-gradient(145deg, #f9fcfd, #eaf4f7); }
.login-card { width: min(100%, 460px); padding: clamp(28px, 6vw, 46px); border: 1px solid rgba(8, 126, 164, .16); border-radius: 24px; background: rgba(255,255,255,.96); box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-login { justify-content: center; margin-bottom: 30px; }
.brand h1, .brand strong { margin: 0; color: var(--blue-dark); }
.brand h1 { font-size: 1.65rem; }
.brand p, .brand small { display: block; margin: 2px 0 0; color: var(--muted); font-size: .8rem; letter-spacing: .025em; }
.brand-logo { width: 62px; height: 62px; flex: 0 0 auto; object-fit: contain; filter: drop-shadow(0 8px 16px rgba(8,126,164,.18)); }
.brand-logo.small { width: 46px; height: 46px; filter: drop-shadow(0 5px 10px rgba(0,0,0,.16)); }
.eyebrow { margin-bottom: 7px; color: var(--blue); font-size: .74rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.stack { display: grid; gap: 17px; }
label { display: grid; gap: 7px; color: #294653; font-size: .86rem; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; color: var(--ink); border: 1px solid #b9ccd4; border-radius: 10px; background: white; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(8,126,164,.12); }
.password-field { display: flex; align-items: stretch; }
.password-field input { border-radius: 10px 0 0 10px; }
.password-field button { min-width: 82px; padding: 0 10px; border: 1px solid #b9ccd4; border-left: 0; border-radius: 0 10px 10px 0; color: var(--blue-dark); background: #f2f8fa; cursor: pointer; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 16px; border: 1px solid transparent; border-radius: 10px; text-decoration: none; font-weight: 750; cursor: pointer; transition: transform .12s, background .15s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button.primary { color: white; background: var(--blue); }
.button.primary:hover { background: var(--blue-dark); }
.button.secondary { color: var(--blue-dark); border-color: #b8d2dc; background: white; }
.button.danger { color: var(--danger); border-color: #e5b8bd; background: #fff7f8; }
.button.wide { width: 100%; }
.button.tiny { min-height: 32px; padding: 5px 9px; font-size: .76rem; }
.center-link { justify-self: center; font-size: .88rem; }
.form-message, .section-message { min-height: 1.25em; margin: 0; font-size: .86rem; }
.form-message:not(:empty), .section-message:not(:empty) { padding: 10px 12px; border-radius: 9px; color: var(--danger); background: #fff0f1; }
.form-message.success, .section-message.success { color: var(--success); background: #eaf9f2; }
.intro, .password-hint { color: var(--muted); line-height: 1.55; }
.password-hint { margin: 0; font-size: .83rem; }

.app-shell { min-height: 100vh; }
.app-header { position: relative; min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 13px clamp(18px, 4vw, 52px); color: white; background: linear-gradient(110deg, #075d79, #087ea4); box-shadow: 0 6px 22px rgba(7,93,121,.18); }
.app-header .brand strong, .app-header .brand small { color: white; }
.app-header .brand small { opacity: .8; }
.app-version { position: absolute; top: 4px; right: 8px; color: rgba(255,255,255,.72); font-size: .58rem; font-weight: 650; letter-spacing: .035em; }
.account { display: flex; align-items: center; gap: 14px; text-align: right; }
.account span, .account small { display: block; }
.account small { margin-top: 2px; font-size: .75rem; opacity: .78; }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.35); border-radius: 11px; color: inherit; background: rgba(255,255,255,.12); font-size: 1.25rem; cursor: pointer; }
.icon-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.preview-banner { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 10px clamp(14px, 4vw, 52px); color: #173b48; background: #fff4c7; border-bottom: 1px solid #eadb9c; }
.preview-banner .button { flex: 0 0 auto; min-height: 38px; }
.tabs { display: flex; gap: 4px; padding: 0 clamp(12px, 4vw, 52px); overflow-x: auto; border-bottom: 1px solid var(--line); background: white; box-shadow: 0 3px 12px rgba(25,56,70,.04); }
.tab { min-height: 52px; padding: 0 17px; border: 0; border-bottom: 3px solid transparent; color: var(--muted); background: none; font-weight: 720; white-space: nowrap; cursor: pointer; }
.tab:hover { color: var(--blue-dark); background: #f5fafb; }
.tab.active { color: var(--blue-dark); border-bottom-color: var(--blue); }
.tab-right { margin-left: auto; }
.scroll-zone { position: relative; min-width: 0; }
.scroll-zone-tabs { background: white; }
.scroll-zone-table { border-radius: 15px; }
.scroll-zone > .tabs, .scroll-zone > .table-wrap { scrollbar-width: none; -ms-overflow-style: none; }
.scroll-zone > .tabs::-webkit-scrollbar, .scroll-zone > .table-wrap::-webkit-scrollbar { width: 0; height: 0; }
.scroll-edge { position: absolute; z-index: 4; top: 0; bottom: 0; display: flex; width: 42px; padding: 0; flex-direction: column; align-items: center; justify-content: space-around; overflow: hidden; border: 0; color: #e07b17; background: transparent; cursor: pointer; }
.scroll-edge[hidden] { display: none; }
.scroll-edge-left { left: 0; background: linear-gradient(to right, #fff 35%, rgba(255,255,255,0)); }
.scroll-edge-right { right: 0; background: linear-gradient(to left, #fff 35%, rgba(255,255,255,0)); }
.scroll-edge span { display: grid; width: 100%; flex: 1 1 0; place-items: center; font-size: 1rem; line-height: 1; }
.scroll-edge-left span::before { content: "\25C0"; }
.scroll-edge-right span::before { content: "\25B6"; }
.scroll-edge:focus-visible { outline: 2px solid var(--blue); outline-offset: -3px; }
.page-area { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 70px; }
.page { display: none; }
.page.active { display: block; animation: appear .18s ease-out; }
.page[data-panel="planning"] { width: 90vw; margin-left: 50%; translate: -50% 0; }
@keyframes appear { from { opacity: 0; transform: translateY(4px); } }
.hero-card { position: relative; overflow: hidden; padding: clamp(27px, 5vw, 48px); border-radius: 22px; color: white; background: linear-gradient(125deg, #075d79, #0d9ac5); box-shadow: var(--shadow); }
.hero-card::after { content: ""; position: absolute; width: 240px; height: 240px; right: -85px; top: -95px; border: 38px solid rgba(255,255,255,.1); border-radius: 50%; }
.hero-card h1 { max-width: 720px; margin-bottom: 14px; }
.hero-card p:last-child { max-width: 760px; margin: 0; color: rgba(255,255,255,.88); line-height: 1.6; }
.hero-card .eyebrow { color: #aeeaff; }
.card-grid, .role-grid { display: grid; gap: 18px; margin-top: 20px; }
.card-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.role-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
.card { padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 8px 26px rgba(25,56,70,.06); }
.card h2 { margin-bottom: 8px; }
.card p { margin-bottom: 0; color: var(--muted); line-height: 1.5; }
.card-icon { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 15px; border-radius: 10px; color: var(--blue-dark); background: var(--blue-soft); font-size: 1.25rem; }
.dashboard-card { display: flex; width: 100%; flex-direction: column; align-items: flex-start; justify-content: flex-start; color: var(--ink); text-align: left; cursor: pointer; }
.dashboard-card:hover { transform: translateY(-2px); border-color: #b8d2dc; }
.application-card { display: flex; flex-direction: column; align-items: flex-start; }
.application-card .button { width: 100%; margin-top: 18px; }
.application-actions { display: grid; width: 100%; gap: 10px; margin-top: 18px; }
.application-card .application-actions .button { margin-top: 0; }
.ics-copy-status { min-height: 1.2em; margin-top: 9px; color: var(--blue-dark) !important; font-size: .78rem; font-weight: 700; }
.ics-note { margin-top: 14px; padding: 11px 12px; border-radius: 10px; color: #3c5d6a !important; background: #f1f8fa; font-size: .84rem; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.page-heading h1 { margin: 0; }
.empty-state { padding: 62px 24px; text-align: center; border: 1px dashed #abc5d0; border-radius: 18px; background: rgba(255,255,255,.6); }
.empty-state strong { display: block; margin-bottom: 8px; font-size: 1.2rem; }
.empty-state p { max-width: 580px; margin: 0 auto; color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 15px; background: white; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 16px; text-align: left; border-bottom: 1px solid #e6eef1; vertical-align: middle; }
th { color: var(--muted); background: #f7fafb; font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; }
.table-sort { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; color: inherit; background: transparent; font: inherit; font-weight: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.table-sort span { width: 1em; color: var(--blue); font-size: .78rem; text-align: center; }
.table-sort:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; border-radius: 3px; }
tr:last-child td { border-bottom: 0; }
td small { display: block; margin-top: 3px; color: var(--muted); }
.table-actions { display: table-cell; padding-block: 12px; white-space: nowrap; }
.table-actions .button { width: 145px; min-height: 46px; padding-inline: 10px; text-align: center; line-height: 1.15; }
.table-actions .button + .button { margin-left: 10px; }
.user-action-rows { display: grid; gap: 8px; }
.user-action-row { display: flex; gap: 10px; }
.table-actions .user-action-row .button + .button { margin-left: 0; }
.doctor-actions .button, .office-actions .button { width: 110px; }
.office-identity-head { display: flex; align-items: center; gap: 9px; }
.office-code { display: inline-flex; min-width: 64px; padding: 5px 8px; justify-content: center; border-radius: 8px; color: white; background: var(--blue); font-size: .76rem; letter-spacing: .04em; }
.office-kind { color: var(--muted); font-size: .7rem; font-weight: 750; text-transform: uppercase; }
.office-name { display: block; margin-top: 6px; }
.office-notes { white-space: pre-line; }
.office-schedule { min-width: 240px; color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.office-schedule span { display: block; line-height: 1.45; }
.status, .pill { display: inline-flex; padding: 4px 8px; border-radius: 999px; color: var(--blue-dark); background: var(--blue-soft); font-size: .74rem; font-weight: 800; }
.status.suspended { color: #885b00; background: #fff5d8; }
.status.archived { color: #666; background: #eee; }
.role-card .pill { margin-top: 16px; }
.role-card { display: flex; flex-direction: column; }
.role-card .button { margin-top: 16px; }
.permission-summary-groups { flex: 1; display: grid; align-content: start; gap: 13px; }
.permission-summary-group h3, .permission-group h3 { margin: 0 0 7px; color: var(--blue-dark); font-size: .82rem; letter-spacing: .035em; text-transform: uppercase; }
.permission-summary { margin: 0; padding-left: 18px; color: var(--muted); font-size: .84rem; line-height: 1.45; }
.permission-summary li + li { margin-top: 5px; }
.role-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.role-card-footer small { color: var(--muted); font-size: .76rem; }
.permission-list { display: grid; gap: 14px; }
.permission-group { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdfe; }
.permission-group-options { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.permission-option { display: flex; grid-template-columns: none; align-items: flex-start; gap: 10px; min-height: 48px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: #f8fbfc; }
.permission-option input { width: 19px; min-height: 19px; margin: 1px 0 0; accent-color: var(--blue); }
.permission-option span { line-height: 1.35; }
.permission-option small { color: var(--muted); font-weight: 600; }
.profile-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.profile-card { max-width: 650px; }
.profile-actions { display: grid; gap: 12px; margin: 20px 0 14px; }
dl { display: grid; grid-template-columns: 120px 1fr; gap: 13px 18px; margin: 0 0 24px; }
dt { color: var(--muted); font-size: .82rem; font-weight: 700; }
dd { margin: 0; font-weight: 650; }
.list-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.list-toolbar label { width: min(100%, 270px); }
.list-toolbar .section-message { flex: 1; }
.profile-preview-panel { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; padding: 17px; border: 1px solid #bcd7e0; border-radius: 15px; background: #f3fafc; }
.profile-preview-panel h2 { margin: 0 0 4px; font-size: 1rem; }
.profile-preview-panel p { margin: 0; color: var(--muted); font-size: .86rem; }
.profile-preview-actions { display: grid; grid-template-columns: minmax(190px, 1fr) auto; gap: 8px; flex: 0 1 560px; align-items: end; }
.profile-preview-actions .button { width: 100%; }
.calendar-rules-card, .pdsa-rule-card { margin-bottom: 18px; padding: 18px; border: 1px solid #bfd6de; border-radius: 15px; background: white; }
.calendar-rules-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 20px; align-items: center; }
.calendar-rules-card p, .pdsa-rule-card p { margin: 5px 0 0; color: var(--muted); line-height: 1.5; }
.calendar-rules-card > p { grid-column: 1 / -1; margin: 0; font-size: .83rem; }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 9px; }
.calendar-chip { display: inline-flex; padding: 6px 10px; border-radius: 999px; font-size: .76rem; font-weight: 800; }
.calendar-chip.weekend { color: #5d3c84; background: #eee3ff; }
.calendar-chip.holiday { color: #8a2632; background: #ffe4e7; }
.calendar-chip.bridge { color: #805600; background: #fff1c6; }
.planning-heading { align-items: center; }
.planning-title-cluster { display: flex; align-items: center; }
.planning-inline-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-left: max(15vw, 28px); }
.planning-heading-controls { display: grid; justify-items: end; gap: 7px; }
.planning-month-heading { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.planning-month-heading h2 { margin: 0; text-transform: capitalize; }
.planning-help-chip { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; padding: 0; border: 1px solid #c3cdd2; border-radius: 50%; color: #607884; background: #e7ecef; font-size: .82rem; font-weight: 750; cursor: pointer; }
.planning-order-chip { font-size: .92rem; }
.planning-doctor-filter { display: flex; gap: 8px; align-items: center; }
.planning-doctor-filter[hidden] { display: none; }
.planning-doctor-filter select { width: auto; max-width: 210px; min-height: 34px; padding: 5px 30px 5px 9px; border-color: #c3cdd2; color: #607884; background: #e7ecef; font-size: .78rem; }
.planning-doctor-filter .planning-doctor-filter-button { min-width: 0; min-height: 34px; padding: 6px 11px; border-color: #c3cdd2; color: #607884; background: #e7ecef; white-space: nowrap; font-size: .78rem; }
.planning-doctor-filter select:hover, .planning-doctor-filter .planning-doctor-filter-button:hover { background: #dbe3e7; }
.planning-doctor-filter .planning-doctor-filter-button[aria-pressed="true"] { border-color: #087ea4; color: #fff; background: #087ea4; }
.planning-nav { display: flex; gap: 9px; }
.planning-nav .button { min-width: 48px; }
.exchange-dot { display: inline-block; width: 12px; height: 12px; flex: 0 0 auto; border-radius: 50%; }
.exchange-dot.red { background: #dc3545; }
.exchange-dot.blue { background: #1677d2; }
.exchange-dot.neutral { border: 1px solid #aab7bf; background: #c7d1d8; }
.special-day-key { padding: 3px 7px; border-radius: 6px; background: #e8ecef; }
.school-holiday-key { display: block; width: 38px; height: 30px; border-right: 28px solid #f59e0b; background: #f8fbfc; }
.planning-scroll { position: relative; display: flex; justify-content: center; }
.planning-table-wrap { width: fit-content; max-width: 100%; overflow-x: hidden; overflow-y: auto; max-height: calc(100vh - 245px); min-height: 420px; border: 1px solid #b9c7d3; border-radius: 12px; background: white; box-shadow: 0 8px 24px rgba(31,54,78,.08); }
.planning-table { --schedule-column-width: 104px; --schedule-date-min-width: 160px; --schedule-date-max-width: 176px; --schedule-date-width: var(--schedule-date-min-width); --schedule-grid-line: #7894aa; --special-day-background: #c9cfd4; --special-day-stripe: #b5bec5; width: max-content; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.planning-table .schedule-date-column { width: var(--schedule-date-width); }
.planning-table .schedule-office-column { width: var(--schedule-column-width); }
.planning-table th, .planning-table td { width: var(--schedule-column-width); min-width: var(--schedule-column-width); max-width: var(--schedule-column-width); height: 56px; padding: 4px; border-right: 1px solid var(--schedule-grid-line); border-bottom: 1px solid var(--schedule-grid-line); text-align: center; }
.planning-table thead { position: sticky; z-index: 20; top: 0; background: #17395f; isolation: isolate; }
.planning-table thead th { height: auto; color: #fff; background: #17395f; background-clip: padding-box; }
.planning-table thead tr:first-child th { padding-top: 10px; padding-bottom: 7px; }
.planning-table thead tr:first-child th:not([rowspan="2"]) { border-bottom: 2px solid var(--schedule-grid-line); }
.planning-table thead tr:last-child th { padding-top: 5px; padding-bottom: 7px; }
.planning-table .schedule-date-head, .planning-table .schedule-date { position: sticky; z-index: 4; left: 0; min-width: var(--schedule-date-width); width: var(--schedule-date-width); max-width: var(--schedule-date-width); box-shadow: 4px 0 8px rgba(26,63,77,.06); }
.planning-table tbody .schedule-date { z-index: 12; isolation: isolate; }
.planning-table .schedule-date-head { z-index: 21; color: #fff; background: #17395f; }
.planning-table .schedule-date { padding: 7px 9px; text-align: left; background: #f8fbfc; text-transform: none; letter-spacing: 0; }
.planning-table .schedule-date strong { display: block; color: var(--ink); font-size: 1.1rem; line-height: 1.05; text-transform: capitalize; white-space: nowrap; }
.planning-table .schedule-date small { display: block; margin-top: 3px; color: var(--muted); font-size: .9rem; font-weight: 650; line-height: 1.05; white-space: nowrap; }
.schedule-office-code { display: block; color: #aeeaff; font-size: .65rem; letter-spacing: .04em; }
.schedule-office-subtitle { display: block; margin-top: 3px; color: #fff; font-size: .57rem; font-weight: 650; letter-spacing: 0; text-transform: none; }
.planning-table thead strong { display: block; margin-top: 2px; color: #fff; font-size: .78rem; text-transform: none; letter-spacing: 0; }
.schedule-segment { color: #fff !important; border-bottom-color: var(--schedule-grid-line); background: #2c5279 !important; background-clip: padding-box !important; font-size: .66rem !important; }
.planning-table .office-group-start { border-left: 4px solid var(--schedule-grid-line); }
.planning-table tbody tr:nth-child(even) > td { background: #f4f7fa; }
.planning-table tbody tr.special-day > td, .planning-table tbody tr.special-day > .schedule-date { background-color: var(--special-day-background); }
.planning-table tr.today-row > th, .planning-table tr.today-row > td { box-shadow: inset 0 3px #f59e0b, inset 0 -3px #f59e0b; }
.planning-table tr.today-row > :first-child { border-left: 3px solid #f59e0b; background-color: #fff1b8; }
.planning-table tr.today-row > :last-child { border-right: 3px solid #f59e0b; }
.planning-table tr.special-day.today-row > :first-child { background-color: var(--special-day-background); }
.planning-table tr.school-holiday-week > .schedule-date { padding-right: 47px; }
.planning-table tr.school-holiday-start > .schedule-date { z-index: 13; overflow: visible; }
.school-holiday-band { position: absolute; z-index: 8; top: 0; right: 0; display: flex; width: 38px; height: calc(var(--school-holiday-span, 1) * 56px); align-items: center; justify-content: center; overflow: hidden; color: #5d3a00; background: #f59e0b; writing-mode: vertical-rl; transform: rotate(180deg); font-size: .87rem; font-weight: 850; letter-spacing: .025em; line-height: 1; text-align: center; }
.school-holiday-band span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schedule-cell { position: relative; z-index: 0; isolation: isolate; overflow: visible; padding: 4px 8px !important; color: var(--ink); background: #eef2f5; }
.schedule-cell { transition: opacity .8s ease, transform .8s ease, background-color .8s ease; }
.special-day .schedule-cell { background-color: var(--special-day-background); }
.planning-table tbody td.schedule-cell.unavailable { background: repeating-linear-gradient(135deg, #eef2f5 0, #eef2f5 7px, #e2e8ed 7px, #e2e8ed 9px); }
.planning-table tbody tr.special-day td.schedule-cell.unavailable { background: repeating-linear-gradient(135deg, var(--special-day-background) 0, var(--special-day-background) 7px, var(--special-day-stripe) 7px, var(--special-day-stripe) 9px); }
.schedule-cell.editable { cursor: pointer; }
.schedule-cell.editable:hover { box-shadow: inset 0 0 0 3px rgba(8,142,181,.34); }
.planning-table td.schedule-cell.merged { width: calc(var(--schedule-column-width) * 2); min-width: calc(var(--schedule-column-width) * 2); max-width: calc(var(--schedule-column-width) * 2); }
.schedule-cell.merged .schedule-entry { width: calc(var(--schedule-column-width) - 16px); margin-inline: auto; }
.schedule-entry { position: relative; display: flex; width: 100%; min-height: 48px; align-items: center; justify-content: center; padding: 0 21px 0 5px; border-radius: 5px; color: #fff; background: var(--entry-doctor-color); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08), 0 1px 3px rgba(23,57,95,.14); transition: opacity .8s ease, transform .8s ease, box-shadow .8s ease; }
.schedule-entry.exchange-red, .schedule-entry.exchange-blue { box-shadow: inset 0 0 0 1px rgba(0,0,0,.08), 0 1px 3px rgba(23,57,95,.14); }
.schedule-entry.exchange-red::before, .schedule-entry.exchange-blue::before { content: ""; position: absolute; z-index: 1; inset: 0; border: 4px solid; border-radius: inherit; box-shadow: inset 0 0 0 2px #fff, 0 0 0 3px #fff; pointer-events: none; transition: opacity .8s ease; }
.schedule-entry.exchange-red::before { border-color: #dc3545; }
.schedule-entry.exchange-blue::before { border-color: #1677d2; }
.schedule-assignment { display: flex; min-width: 0; align-items: center; justify-content: center; color: inherit; }
.schedule-doctor-label { display: inline-flex; align-items: center; justify-content: center; gap: 4px; color: inherit; font-size: 1.35rem; font-weight: 400; line-height: 1; white-space: nowrap; text-shadow: 0 1px 2px rgba(0,0,0,.18); }
.schedule-doctor-label.replacement { align-self: center; flex-direction: column; justify-content: center; gap: 1px; }
.schedule-doctor-label strong { font: inherit; }
.schedule-doctor-label.replacement strong { line-height: .82; }
.schedule-doctor-label small { color: inherit; margin-top: 0; font-size: .98rem; font-weight: 400; line-height: .78; }
.schedule-empty { display: grid; width: 100%; min-height: 48px; place-items: center; color: #c62828; font-size: 1.3rem; font-weight: 900; line-height: 1; }
.schedule-available { display: grid; min-width: 54px; min-height: 32px; padding: 5px 8px; place-items: center; border: 2px solid #d32f2f; border-radius: 6px; color: #b71c1c; background: #fff5f5; font-size: .82rem; font-weight: 850; line-height: 1; letter-spacing: .04em; }
.schedule-cell > .schedule-available { width: calc(100% - 16px); min-height: 48px; margin: 4px 8px; }
.schedule-doctor-chip { display: inline-flex; width: 64px; min-width: 64px; min-height: 32px; padding: 4px 5px; align-items: center; justify-content: center; border-radius: 6px; color: #fff; background: var(--doctor-color); font-size: .8rem; font-weight: 900; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08), 0 2px 5px rgba(23,57,95,.16); }
.schedule-doctor-chip.small { width: auto; min-width: 27px; min-height: 24px; padding: 3px 5px; font-size: .62rem; }
.exchange-state { position: absolute; z-index: 2; top: 50%; right: 2px; width: 16px; height: 16px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: #c7d1d8; box-shadow: 0 1px 4px rgba(23,57,95,.35); cursor: pointer; transform: translateY(-50%); transition: opacity .267s ease, transform .267s ease, background-color .267s ease; }
.exchange-state::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; }
.exchange-state.red, .exchange-state.blue { right: 1px; width: 22px; height: 22px; border-width: 4px; }
.exchange-state.red { border-color: #fff; background: #dc3545; }
.exchange-state.blue { border-color: #fff; background: #1677d2; }
.exchange-state:disabled { cursor: default; opacity: .75; }
.exchange-state.is-updating { opacity: .28; transform: translateY(-50%) scale(.55); }
.schedule-entry.is-updating { opacity: .32; transform: scale(.94); }
.schedule-selection-preview { display: flex; min-height: 48px; align-items: center; gap: 11px; margin-top: 8px; padding: 7px 10px; border: 1px solid #cbd9e0; border-radius: 10px; background: #eef2f5; }
.schedule-selection-preview > span:not(.schedule-doctor-chip) { display: grid; gap: 2px; }
.schedule-selection-preview strong { color: #17395f; font-size: .86rem; }
.schedule-selection-preview small { color: var(--muted); font-size: .72rem; }
.schedule-selection-empty { color: var(--muted); font-size: .8rem; font-weight: 650; }
.history-dialog-content { padding: 26px; }
.planning-help-content { padding: 26px; }
.column-order-content { padding: 26px; }
.column-order-list { display: grid; gap: 9px; }
.column-order-item { display: grid; grid-template-columns: 1fr 42px 42px; gap: 8px; align-items: center; padding: 9px 10px; border: 1px solid var(--line); border-radius: 11px; background: #f8fbfc; }
.column-order-item strong { color: var(--ink); }
.column-order-item .button { min-width: 0; padding: 5px; }
.planning-help-list { display: grid; gap: 12px; margin: 4px 0 18px; }
.planning-help-list p { display: flex; align-items: center; gap: 12px; margin: 0; padding: 11px 12px; border-radius: 10px; background: #f3f7f9; }
.planning-help-list p > span:not(.special-day-key) { display: grid; gap: 2px; color: var(--muted); font-size: .83rem; }
.planning-help-list strong { color: var(--ink); }
.planning-help-empty { display: grid; width: 20px; height: 20px; flex: 0 0 20px; place-items: center; color: #c62828; font-size: 1.3rem; font-style: normal; font-weight: 900; line-height: 1; }
.history-list { display: grid; gap: 10px; max-height: 55vh; overflow-y: auto; }
.history-entry { padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #f8fbfc; }
.history-entry > div { display: flex; justify-content: space-between; gap: 12px; }
.history-entry time, .history-entry small { color: var(--muted); font-size: .75rem; }
.history-entry p { margin: 7px 0 4px; font-weight: 750; }
.history-pagination { display: flex; min-height: 36px; align-items: center; justify-content: center; gap: 5px; margin-top: 14px; }
.history-pagination[hidden] { display: none; }
.history-page-button { display: inline-grid; width: 34px; height: 34px; padding: 0; place-items: center; border: 1px solid #bfd2db; border-radius: 8px; color: var(--blue-dark); background: #fff; font: inherit; font-weight: 800; cursor: pointer; }
.history-page-button:hover, .history-page-button:focus-visible { border-color: var(--blue); background: var(--blue-soft); }
.history-page-button.active { color: #fff; border-color: var(--blue); background: var(--blue); }
.history-page-button:disabled { opacity: .38; cursor: default; }
.history-page-ellipsis { display: inline-grid; width: 24px; height: 34px; place-items: center; color: var(--muted); font-weight: 800; }
#others-history-dialog { overflow: hidden; }
#others-history-dialog .history-dialog-content { display: grid; max-height: min(90vh, 880px); grid-template-rows: auto auto auto auto auto; overflow: hidden; }
#others-history-dialog .history-list { max-height: none; overflow: visible; }
.restore-preview { min-height: 48px; margin: 0; padding: 13px; border-radius: 10px; color: var(--blue-dark); background: var(--blue-soft); font-weight: 750; }
.pdsa-rule-card { border-color: #9dcbd9; background: #eef9fc; }
.doctor-name { display: flex; align-items: flex-start; gap: 10px; min-width: 190px; }
.doctor-name small { max-width: 320px; line-height: 1.35; }
.doctor-dot { width: 12px; height: 12px; margin-top: 4px; flex: 0 0 auto; border-radius: 50%; background: #b9ccd4; box-shadow: 0 0 0 3px #e7eef2; }
.doctor-swatch { display: inline-flex; align-items: center; justify-content: center; width: var(--initials-badge-width); min-width: var(--initials-badge-width); min-height: 36px; padding: 6px; border-radius: 9px; color: var(--ink); background: #e7eef2; font-weight: 850; letter-spacing: .04em; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.user-role-link { display: inline-flex; align-items: center; gap: 8px; }
.doctor-swatch.user-doctor-link { width: 40px; min-width: 40px; min-height: 26px; padding: 3px 5px; border-radius: 999px; font-size: .68rem; }
.user-doctor-unlinked { font-size: .72rem; white-space: nowrap; }

dialog { width: min(92vw, 560px); max-height: min(92vh, 900px); padding: 0; overflow-y: auto; border: 0; border-radius: 20px; box-shadow: 0 26px 80px rgba(14,42,54,.25); }
dialog[open] { animation: dialog-appear .8s ease both; }
@keyframes dialog-appear { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
#doctor-dialog, #office-dialog { width: min(94vw, 720px); }
#schedule-dialog { width: min(94vw, 760px); }
dialog::backdrop { background: rgba(45,52,57,.72); backdrop-filter: blur(4px); }
dialog form { padding: 26px; }
.dialog-heading { display: flex; justify-content: space-between; gap: 20px; }
.dialog-heading h2 { margin-bottom: 16px; }
.dialog-heading .icon-button { color: #b4232e; border-color: #e3a6ad; background: #fff1f2; font-weight: 900; }
.dialog-heading .icon-button:hover, .dialog-heading .icon-button:focus-visible { color: #fff; border-color: #b4232e; background: #b4232e; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; padding-top: 4px; }
.check-field { display: flex; align-items: center; gap: 10px; }
.check-field input { width: 20px; min-height: 20px; margin: 0; accent-color: var(--blue); }
.schedule-fieldset { display: grid; gap: 14px; min-width: 0; margin: 0; padding: 15px; border: 1px solid var(--line); border-radius: 13px; }
.schedule-fieldset legend { padding: 0 6px; color: #294653; font-size: .86rem; font-weight: 750; }
[data-schedule-mode-choice] { gap: 8px; padding: 0; border: 0; border-radius: 0; }
[data-schedule-mode-choice] legend { padding: 0; }
.schedule-mode-options { display: flex; flex-wrap: nowrap; align-items: center; gap: 10px 24px; }
.schedule-mode-options label { display: flex; min-width: 0; align-items: center; gap: 8px; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; cursor: pointer; white-space: nowrap; }
.schedule-mode-options input { width: 18px; min-width: 18px; min-height: 18px; margin: 0; flex: 0 0 18px; accent-color: var(--blue); }
.schedule-mode-hint { color: var(--muted); line-height: 1.4; }
.schedule-period-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: 14px; min-height: 430px; }
.schedule-period-grid > .schedule-fieldset { height: 100%; align-content: start; border-color: #aac9d5; background: #edf6f9; box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 2px 8px rgba(23,57,95,.08); }
.schedule-dynamic-field { max-height: 420px; opacity: 1; overflow: hidden; transform: translateY(0) scale(1); transform-origin: top center; transition: max-height .24s ease, opacity .2s ease, transform .24s ease, padding .24s ease, border-color .2s ease; }
label.schedule-dynamic-field { max-height: 86px; }
.schedule-dynamic-field.is-collapsed { max-height: 0; padding-top: 0 !important; padding-bottom: 0 !important; border-color: transparent; opacity: 0; pointer-events: none; transform: translateY(-7px) scale(.985); }
.schedule-dynamic-field[hidden] { display: none !important; }
.exchange-choice { min-width: 0; margin: 0; padding: 11px; border: 1px solid var(--line); border-radius: 11px; }
.exchange-choice legend { padding: 0 5px; color: var(--muted); font-size: .76rem; font-weight: 750; }
.exchange-choice > div { display: grid; grid-template-columns: 1fr; gap: 8px; }
.exchange-choice label { display: flex; grid-template-columns: none; align-items: center; justify-content: flex-start; gap: 8px; min-height: 32px; margin: 0; padding: 4px 2px; border: 0; border-radius: 0; background: transparent; cursor: pointer; text-align: left; line-height: 1.25; transition: color .267s ease, opacity .267s ease; }
.exchange-choice input { appearance: none; width: 20px; min-width: 20px; height: 20px; min-height: 20px; margin: 0; border: 2px solid #9aaab2; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 4px #fff; transition: background-color .8s ease, border-color .8s ease, transform .8s ease; }
.schedule-dialog select, #schedule-dialog select { font-weight: 750; transition: color .8s ease, background-color .8s ease, border-color .8s ease, box-shadow .8s ease; }
.exchange-choice [data-exchange-choice="red"] input:checked { border-color: #dc3545; background: #dc3545; }
.exchange-choice [data-exchange-choice="blue"] input:checked { border-color: #1677d2; background: #1677d2; }
.exchange-choice input:checked { transform: scale(1.08); }
.exchange-choice label:has(input:checked) { color: #075e78; background: transparent; }
.exchange-choice [data-exchange-choice="red"], .exchange-choice [data-exchange-choice="red"]:has(input:checked) { color: #c62828; }
.exchange-choice [data-exchange-choice="blue"], .exchange-choice [data-exchange-choice="blue"]:has(input:checked) { color: #1565c0; }
.vacancy-choice { min-width: 0; margin: 0; padding: 11px; border: 1px solid var(--line); border-radius: 11px; }
.vacancy-choice legend { padding: 0 5px; color: var(--muted); font-size: .76rem; font-weight: 750; }
.vacancy-choice > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.vacancy-choice label { display: flex; align-items: center; gap: 7px; min-height: 38px; margin: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; font-size: .8rem; }
.vacancy-choice input { width: 18px; min-width: 18px; height: 18px; min-height: 18px; margin: 0; accent-color: #c62828; }
.vacancy-choice strong { margin-left: auto; color: #c62828; }
.vacancy-choice label:has(input:checked) { border-color: #d32f2f; background: #fff5f5; }
.check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.check-grid .check-field { min-height: 44px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: #f8fbfc; }
.install-dialog-content { padding: 26px; }
.install-dialog-content [data-install-message] { color: var(--muted); line-height: 1.55; }
.color-fieldset { display: grid; gap: 13px; min-width: 0; margin: 0; padding: 15px; border: 1px solid var(--line); border-radius: 13px; }
.color-fieldset legend { padding: 0 6px; color: #294653; font-size: .86rem; font-weight: 750; }
.color-preview { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 14px; border-radius: 11px; background: #0EA5E9; color: white; }
.color-preview span { width: var(--initials-badge-width); min-width: var(--initials-badge-width); padding-right: 11px; border-right: 1px solid currentColor; font-weight: 850; letter-spacing: .04em; }
.color-palette { display: grid; grid-template-columns: repeat(12, 1fr); gap: 7px; }
.color-choice { width: 100%; aspect-ratio: 1; min-width: 0; padding: 0; border: 2px solid white; border-radius: 8px; background: #e7eef2; box-shadow: 0 0 0 1px #b9ccd4; cursor: pointer; }
.color-choice.selected { box-shadow: 0 0 0 3px var(--blue-dark); }
.custom-color { grid-template-columns: 1fr 64px; align-items: center; }
.custom-color input { min-height: 40px; padding: 3px; cursor: pointer; }
.transfer-status-card { display: grid; gap: 5px; margin-bottom: 18px; padding: 16px 18px; border: 1px solid var(--line); border-left: 6px solid #7b929d; border-radius: 14px; background: #f7fafb; }
.transfer-status-card strong { color: #17394a; }
.transfer-status-card p { margin: 0; color: var(--muted); }
.transfer-status-card small { display: block; overflow-wrap: anywhere; color: #4f6874; }
.transfer-status-card.success { border-left-color: #11876d; background: #f0fbf7; }
.transfer-status-card.warning { border-left-color: #e49a18; background: #fff9eb; }
.transfer-settings { margin-bottom: 18px; padding: 20px; }
.transfer-settings h2, .transfer-grid h2 { margin: 2px 0 6px; }
.transfer-sheet-card > div:first-child p:last-child { margin-bottom: 0; color: var(--muted); line-height: 1.5; }
.transfer-sheet-card input[readonly] { background: #eef4f6; color: #36535f; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .82rem; }
.transfer-sheet-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-top: 3px; }
.transfer-sheet-actions .button { min-width: 180px; }
.transfer-address-settings form { margin-top: 14px; }
.google-connection-card > div:first-child p:last-child { margin-bottom: 0; color: var(--muted); line-height: 1.5; }
.google-account-actions { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 3px; }
.google-button { border-color: #b8c6cc; background: #fff; color: #263238; box-shadow: 0 2px 7px rgba(16,42,56,.08); }
.google-button::before { content: "G"; display: inline-grid; width: 22px; height: 22px; margin-right: 8px; place-items: center; border-radius: 50%; background: conic-gradient(from -45deg, #4285f4 0 25%, #34a853 0 50%, #fbbc05 0 75%, #ea4335 0); color: #fff; font-weight: 850; }
.google-account-note { margin: 0; padding: 10px 12px; border-radius: 9px; background: #f0f6f8; color: #405d69; font-size: .88rem; }
.google-connection-card input[readonly] { background: #eef4f6; color: #48636f; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .8rem; }
.google-setup-help { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #f8fbfc; color: #405d69; }
.google-setup-help summary { cursor: pointer; color: #183d4d; font-weight: 800; }
.google-setup-help ol { display: grid; gap: 7px; margin: 12px 0; padding-left: 22px; font-size: .88rem; line-height: 1.4; }
.google-setup-help p { margin: 0 0 11px; font-size: .82rem; line-height: 1.4; }
.google-setup-help a { color: #087ea4; font-weight: 750; }
.transfer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.transfer-grid > .card { min-width: 0; padding: 22px; }
.transfer-grid .card > div > p:last-child { margin-bottom: 0; color: var(--muted); line-height: 1.5; }
.transfer-preview { display: grid; gap: 13px; margin-top: 8px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #f8fbfc; }
.transfer-preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.transfer-preview-heading span { padding: 4px 9px; border-radius: 999px; background: #e1f3f8; color: #056783; font-size: .78rem; font-weight: 800; }
.transfer-preview-heading.error strong { color: #a7212a; }
.transfer-preview-heading.error span { background: #fdebed; color: #a7212a; }
.transfer-preview p { margin: 0; color: var(--muted); }
.transfer-errors { display: grid; gap: 8px; max-height: 330px; margin: 0; padding-left: 25px; overflow: auto; color: #7d1c24; font-size: .88rem; line-height: 1.4; }
.transfer-cleanup-warning { display: grid; gap: 10px; padding: 13px; border: 1px solid #e7b9bd; border-radius: 10px; background: #fff3f4; color: #8c2028; }
.transfer-cleanup-warning label { display: flex; align-items: flex-start; gap: 9px; margin: 0; color: #5e252a; font-size: .88rem; }
.transfer-cleanup-warning input { width: 19px; min-width: 19px; height: 19px; min-height: 19px; margin-top: 1px; accent-color: #b32630; }
.transfer-cleanup-ok { padding: 10px 12px; border-radius: 9px; background: #edf9f5; color: #176851 !important; }

@media (max-width: 760px) {
  .app-header { align-items: flex-start; padding: 12px 14px; }
  .app-header .brand small { max-width: 150px; }
  .account > span { display: none; }
  .tabs { padding: 0 8px; }
  .tab { min-height: 48px; padding: 0 12px; font-size: .86rem; }
  .tab-right { margin-left: 0; }
  .page-area { width: min(100% - 22px, 1180px); padding-top: 22px; }
  .page[data-panel="planning"] { width: calc(100vw - 22px); }
  .card-grid, .role-grid, .profile-layout { grid-template-columns: 1fr; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading .button { width: 100%; }
  .planning-heading .planning-nav { display: grid; grid-template-columns: 48px 1fr 48px; width: 100%; }
  .planning-title-cluster { align-items: flex-start; flex-direction: column; gap: 14px; }
  .planning-inline-tools { margin-left: 0; align-self: flex-end; }
  .planning-heading .planning-nav .button { width: 100%; }
  .planning-heading-controls { width: 100%; justify-items: stretch; }
  .planning-month-heading { justify-content: flex-end; }
  .planning-table-wrap { overflow: auto; max-height: calc(100vh - 280px); min-height: 460px; }
  .planning-table { --schedule-column-width: 96px; --schedule-date-min-width: 150px; --schedule-date-max-width: 160px; }
  .planning-table th, .planning-table td { width: var(--schedule-column-width); min-width: var(--schedule-column-width); max-width: var(--schedule-column-width); }
  .planning-table .schedule-date-head, .planning-table .schedule-date { min-width: var(--schedule-date-width); width: var(--schedule-date-width); max-width: var(--schedule-date-width); }
  .field-row { grid-template-columns: 1fr; }
  #schedule-dialog form { padding-inline: 14px; }
  .schedule-mode-options { gap: 6px; justify-content: space-between; }
  .schedule-mode-options label { gap: 4px; font-size: .68rem; }
  .schedule-mode-options input { width: 16px; min-width: 16px; min-height: 16px; flex-basis: 16px; }
  .schedule-period-grid { grid-template-columns: 1fr; min-height: 0; }
  .schedule-period-grid > .schedule-fieldset { height: auto; }
  th, td { padding: 12px 10px; }
  .users-table, .doctors-table, .offices-table { overflow: visible; border: 0; border-radius: 0; background: transparent; }
  .users-table table, .users-table tbody, .doctors-table table, .doctors-table tbody, .offices-table table, .offices-table tbody { display: block; }
  .users-table thead, .doctors-table thead, .offices-table thead { display: none; }
  .users-table tbody, .doctors-table tbody, .offices-table tbody { display: grid; gap: 12px; }
  .users-table tr, .doctors-table tr, .offices-table tr { display: grid; gap: 7px 10px; overflow: hidden; padding: 13px 0; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: 0 5px 18px rgba(25,56,70,.05); }
  .users-table tr.has-actions, .doctors-table tr.has-actions, .offices-table tr.has-actions { padding-bottom: 0; }
  .users-table td, .doctors-table td, .offices-table td { display: block; min-width: 0; padding: 0 12px; border: 0; }
  .users-table tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "identity role" "identity status" "actions actions"; }
  .users-table td:nth-child(1) { grid-area: identity; overflow-wrap: anywhere; }
  .users-table td:nth-child(2) { grid-area: role; justify-self: end; color: var(--muted); font-size: .82rem; font-weight: 700; }
  .users-table td:nth-child(3) { grid-area: status; justify-self: end; }
  .users-table td:nth-child(4) { grid-area: actions; }
  .doctors-table tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name initials" "contact initials" "type status" "actions actions"; }
  .doctors-table tr:not(.has-actions) { grid-template-areas: "name initials" "contact initials" "type status"; }
  .doctors-table td:nth-child(1) { grid-area: name; }
  .doctors-table td:nth-child(2) { grid-area: contact; color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
  .doctors-table td:nth-child(3) { grid-area: type; }
  .doctors-table td:nth-child(4) { grid-area: status; justify-self: end; }
  .doctors-table td:nth-child(5) { grid-area: initials; justify-self: end; align-self: start; }
  .doctors-table td:nth-child(6) { grid-area: actions; }
  .offices-table tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name status" "schedule schedule" "days days" "linked linked" "actions actions"; }
  .offices-table td:nth-child(1) { grid-area: name; }
  .offices-table td:nth-child(2) { grid-area: schedule; min-width: 0; font-size: .78rem; font-weight: 650; text-align: right; }
  .offices-table td:nth-child(3) { grid-area: days; color: var(--muted); font-size: .83rem; }
  .offices-table td:nth-child(4) { grid-area: linked; }
  .offices-table td:nth-child(5) { grid-area: status; justify-self: end; }
  .offices-table td:nth-child(6) { grid-area: actions; }
  .doctor-name { min-width: 0; }
  .table-actions { display: flex; width: 100%; min-width: 0; gap: 7px; padding: 10px 12px 12px !important; border-top: 1px solid #e6eef1 !important; }
  .table-actions .button { min-width: 0; min-height: 44px; flex: 1 1 0; padding-inline: 6px; font-size: .75rem; }
  .users-table .table-actions { display: block; }
  .user-action-rows { width: 100%; gap: 7px; }
  .user-action-row { width: 100%; gap: 7px; }
  .list-toolbar { align-items: stretch; flex-direction: column; }
  .list-toolbar label { width: 100%; }
  .preview-banner, .profile-preview-panel { align-items: stretch; flex-direction: column; }
  .preview-banner .button { width: 100%; }
  .profile-preview-actions { width: 100%; flex-basis: auto; grid-template-columns: 1fr; }
  .calendar-rules-card { grid-template-columns: 1fr; }
  .calendar-rules-card > p { grid-column: auto; }
  .calendar-legend { margin-top: 4px; }
  .check-grid { grid-template-columns: 1fr; }
  .color-palette { grid-template-columns: repeat(8, 1fr); }
  .permission-group-options { grid-template-columns: 1fr; }
  .transfer-grid { grid-template-columns: 1fr; }
  .transfer-grid > .card, .transfer-settings { padding: 16px; }
  .transfer-preview-heading { align-items: flex-start; flex-direction: column; }
  .transfer-sheet-actions .button { width: 100%; }
  .google-account-actions .button { width: 100%; }
  .dialog-actions .button { flex: 1; }
  dl { grid-template-columns: 1fr; gap: 4px; }
  dd { margin-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }

.transfer-tabs-card { margin-top: 18px; padding: 20px; }
.transfer-tabs-card h2 { margin: 2px 0 6px; }
.transfer-tabs { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.transfer-tabs li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.transfer-tabs li > div { display: grid; gap: 2px; min-width: 0; }
.transfer-tabs li strong { overflow-wrap: anywhere; }
.transfer-tabs li small { color: var(--muted); overflow-wrap: anywhere; }
.transfer-tabs .button.small { flex: none; padding: 6px 12px; font-size: .85rem; }
.transfer-tabs-list .muted { margin: 0; color: var(--muted); }

.planning-link-button { min-height: 32px; padding: 4px 12px; font-size: .82rem; white-space: nowrap; }
.mirror-status { margin: 0; color: var(--muted); line-height: 1.5; }
.mirror-status.error { color: var(--danger); }
.legal-card h3 { margin: 16px 0 4px; font-size: 1rem; }

.giveaway-table td { vertical-align: middle; }
td.giveaway-status { display: table-cell; vertical-align: middle; }
td.giveaway-status > * { margin: 2px 6px 2px 0; vertical-align: middle; }
.giveaway-doctor { display: inline-block; box-sizing: border-box; width: 52px; padding: 2px 4px; border-radius: 6px; font-weight: 700; text-align: center; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.giveaway-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .82rem; font-weight: 700; }
.giveaway-badge.red { color: #fff; background: #dc3545; }
.giveaway-badge.blue { color: #fff; background: #1d6fd8; }
.giveaway-badge.dispo { color: #dc3545; background: #e0f4f8; }
.giveaway-badge.available { color: #0d6b53; background: #e3f6ef; }
.giveaway-conflict { color: #9a5b00; font-size: .82rem; font-weight: 700; }
.schedule-conflict { position: absolute; z-index: 3; top: 50%; left: 2px; display: grid; width: 28px; height: 28px; place-items: center; color: #e67800; font-size: 1.55rem; font-weight: 900; line-height: 1; filter: drop-shadow(0 1px 1px #fff) drop-shadow(0 1px 2px rgba(0,0,0,.35)); transform: translateY(-50%); animation: schedule-conflict-blink 1s ease-in-out infinite; }
@keyframes schedule-conflict-blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .schedule-conflict, .planning-conflict-icon { animation: none; } }
.planning-conflict-alert { display: flex; gap: 8px; align-items: center; margin-top: 8px; padding: 8px 14px; border: 2px solid #e67800; border-radius: 10px; background: #fff7e8; color: #9a4e00; font: inherit; font-size: .9rem; font-weight: 700; text-align: left; cursor: pointer; }
.planning-conflict-alert[hidden] { display: none; }
.planning-conflict-alert strong { font-size: 1.15rem; }
.planning-conflict-icon { display: grid; flex: none; width: 28px; height: 28px; place-items: center; color: #e67800; font-size: 1.55rem; line-height: 1; filter: drop-shadow(0 1px 1px #fff); animation: schedule-conflict-blink 1s ease-in-out infinite; }
#giveaway-date-dialog { max-width: 460px; }

.giveaway-table tr.giveaway-special td { background: #dfe4e8; }
.giveaway-table tr.giveaway-limit td { padding: 6px 12px; border-top: 5px solid #7c3aed; border-bottom: 5px solid #7c3aed; background: #f3ecff; color: #5b21b6; font-weight: 800; text-align: center; }
.giveaway-table tr.giveaway-limit-after td { border-color: #f59e0b; background: #fff7ed; color: #c2410c; }
.giveaway-limit-box { display: grid; justify-items: end; gap: 2px; }
.giveaway-limit-caption { margin-top: 6px; color: var(--muted); font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.giveaway-limit-date { color: #5b21b6; font-size: 1.6rem; line-height: 1.1; }
@media (max-width: 760px) { .giveaway-limit-box { justify-items: start; } }

.giveaway-badge { box-sizing: border-box; text-align: center; }
.giveaway-badge.red, .giveaway-badge.blue { width: 64px; }
.giveaway-badge.dispo { width: 122px; }
.giveaway-table table.giveaway-anonymous th:nth-child(4) { display: none; }

.planning-tools-stack { display: flex; flex-direction: column; align-items: flex-start; margin-left: max(15vw, 28px); }
.planning-tools-stack .planning-inline-tools { margin-left: 0; }
.schedule-entry:has(.schedule-conflict) { padding-left: 31px; }
@media (max-width: 760px) { .planning-tools-stack { margin-left: 0; align-self: flex-end; } }
.giveaway-badge.dispo { box-shadow: inset 0 0 0 2px #dc3545; }

.planning-table tbody .schedule-date { padding-right: 37px; text-align: right; }

.giveaway-limit-content { display: grid; grid-template-columns: 26px minmax(0, 1fr) 26px; gap: 14px; align-items: center; width: 100%; }
.giveaway-limit-arrow { display: grid; flex: none; width: 26px; height: 26px; place-items: center; border: 2px solid #7c3aed; border-radius: 50%; background: #fff; color: #7c3aed; font-size: .8rem; line-height: 1; }
.giveaway-limit-after .giveaway-limit-arrow { border-color: #f59e0b; color: #c2410c; }

.giveaway-table td.giveaway-date-group { position: relative; padding-right: 30px; vertical-align: top; }
.giveaway-brace { position: absolute; top: 10px; right: 4px; bottom: 10px; width: 10px; border: 3px solid #8fa9bf; border-right: 0; border-radius: 12px 0 0 12px; }
.giveaway-brace::after { content: ""; position: absolute; top: 7px; left: -9px; width: 7px; border-top: 3px solid #8fa9bf; }
.giveaway-table tr.giveaway-day-next td { border-top-color: transparent; }

.share-status { display: grid; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.share-status h3 { margin: 0; font-size: 1rem; }
.share-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.share-list li { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.share-list li small { color: var(--muted); overflow-wrap: anywhere; }
.share-list .share-detail { flex-basis: 100%; }
.share-state { padding: 2px 10px; border-radius: 999px; background: #eef2f5; font-size: .8rem; font-weight: 700; }
.share-state.ok { color: #0d6b53; background: #e3f6ef; }
.share-state.pending { color: #9a5b00; background: #fff4e0; }
.share-list .share-warning { border-color: #f1c38a; background: #fff8ec; color: #8a4b00; }

.doctor-account { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap; }
.doctor-account.open { color: #0d6b53; background: #e3f6ef; }
.doctor-account.suspended, .doctor-account.other { color: #9a5b00; background: #fff4e0; }
.doctor-account.none { color: #6b7c88; background: #eef2f5; }
td > .doctor-account { display: table; }

details.collapsible-card { display: block; }
details.collapsible-card > summary, details.share-status > summary { position: relative; min-height: 30px; padding-right: 44px; cursor: pointer; list-style: none; }
details.collapsible-card > summary::-webkit-details-marker, details.share-status > summary::-webkit-details-marker { display: none; }
details.collapsible-card > summary::after, details.share-status > summary::after { content: "▸"; position: absolute; top: 0; right: 0; display: grid; width: 30px; height: 30px; place-items: center; border: 2px solid #f97316; border-radius: 50%; background: #fff7ed; color: #ea580c; font-size: 1.15rem; line-height: 1; transition: transform .15s; }
details.collapsible-card[open] > summary::after, details.share-status[open] > summary::after { transform: rotate(90deg); }
details.collapsible-card > .collapsible-body { margin-top: 14px; }
details.share-status { display: block; }
details.share-status > summary h3 { display: inline; }
details.share-status[open] > summary { margin-bottom: 6px; }
details.share-status > * + * { margin-top: 6px; }

.share-title { margin: 4px 0 0; font-size: .95rem; }
details.share-status .transfer-address-settings { margin-top: 10px; }

.upcoming-heading { align-items: flex-end; }
.upcoming-doctor-picker label { display: grid; gap: 4px; font-weight: 700; }
.upcoming-doctor-picker select { min-width: 240px; }
.upcoming-identity { display: grid; justify-items: start; gap: 6px; margin: 4px 0 16px; }
.upcoming-chip { display: grid; min-width: 86px; height: 58px; padding: 0 14px; place-items: center; border-radius: 14px; font-size: 1.8rem; font-weight: 800; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12), 0 2px 6px rgba(23,57,95,.15); }
.upcoming-name { font-size: 1.15rem; }
.upcoming-role { display: inline-block; min-width: 76px; font-weight: 700; color: var(--ink); }

.giveaway-badge.upcoming-exchange { width: auto; padding: 2px 12px; }

.giveaway-badge.red, .giveaway-badge.blue { width: 168px; white-space: nowrap; }
.giveaway-badge.dispo { width: 226px; }
.giveaway-badge.upcoming-exchange { width: 168px; }

.accounting-toolbar { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; margin-bottom: 10px; }
.accounting-month { margin: 0; font-size: 1.4rem; }
.accounting-status { padding: 4px 12px; border-radius: 999px; font-size: .82rem; font-weight: 800; }
.accounting-status.forecast { color: #1d4ed8; background: #e0ecff; }
.accounting-status.to-close { color: #9a5b00; background: #fff1d6; }
.accounting-status.closed { color: #0d6b53; background: #e3f6ef; }
.accounting-bulk { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 12px; }
.accounting-table small { display: block; color: var(--muted); font-size: .76rem; }
.accounting-table tfoot th { text-align: left; }
.accounting-missing { color: #b45309; font-weight: 800; }
.accounting-details > td { background: #f6f9fb; }
.accounting-details table { width: 100%; font-size: .85rem; }
.accounting-details tr.missing td { color: #b45309; }
.accounting-rates-dialog { width: min(980px, 96vw); }
.accounting-period { margin: 0 0 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.accounting-period-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; justify-content: space-between; margin-bottom: 8px; }
.accounting-rates-table { width: 100%; }
.accounting-rates-table th { text-align: left; font-size: .82rem; }
.accounting-rates-table input { width: 90px; text-align: right; }

.email-choice-dialog { width: min(520px, 94vw); }
.email-choice-dialog h2 { margin: 0; }
.email-choice-dialog .button { width: 100%; white-space: normal; text-align: left; }
.email-choice-dialog small { color: var(--muted); }

article.dashboard-card { cursor: default; }
article.dashboard-card:hover { transform: none; }
.card-grid > .card { display: flex; flex-direction: column; align-items: flex-start; }
.card-grid > .card > .application-actions { margin-top: auto; padding-top: 12px; }

.button.accounting-rates-button { border-color: #c81e2b; background: #dc2626; color: #fff; }
.button.accounting-rates-button:hover, .button.accounting-rates-button:focus-visible { border-color: #a5161f; background: #b91c1c; color: #fff; }

.card-grid > .card { position: relative; }
.card-grid > .card .ics-copy-status { position: absolute; right: 22px; bottom: 3px; left: 22px; min-height: 0; margin: 0; }

.accounting-period legend { padding: 0 6px; font-weight: 800; }
.accounting-period.current { border-color: #2f855a; box-shadow: inset 4px 0 0 #2f855a; }
.accounting-period.current legend { color: #22663f; }
.accounting-rate-none { color: #a8b5bf; text-align: center; background: repeating-linear-gradient(135deg, #f4f6f8 0, #f4f6f8 6px, #e9edf1 6px, #e9edf1 8px); }

.accounting-amount-cell { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.accounting-adjust-note { display: block; color: #9a5b00; font-size: .76rem; }
.accounting-details tr.adjusted td { background: #fff8ec; }
.accounting-adjust-dialog { width: min(480px, 94vw); }

.accounting-rates-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.accounting-rate-field { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.accounting-rate-field span { color: var(--muted); font-weight: 700; }
.accounting-old-amount { color: #8a99a6; font-weight: 400; }
.accounting-actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }

.section-message:not(:empty) { margin: 12px 0 14px; }
.list-toolbar .section-message:not(:empty) { margin: 0; }
.section-message.info { color: var(--ink); background: #eef4f8; }

.mail-test-banner { margin: 6px 0 14px; padding: 10px 14px; border-radius: 10px; font-size: .88rem; }
.mail-test-banner.on { border: 2px dashed #dc2626; background: #fff5f5; color: #9b1c1c; }
.mail-test-banner.off { border: 1px solid var(--line); background: #f6f9fb; color: var(--muted); }
.mail-test-banner .button { margin-left: 8px; }

.ledger-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.ledger-toolbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; margin-bottom: 12px; }
.ledger-toolbar label { display: grid; gap: 4px; font-weight: 700; font-size: .85rem; }
.ledger-doctor select { min-width: 240px; }
.ledger-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 6px 0 14px; }
.ledger-card { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.ledger-card span { color: var(--muted); font-size: .8rem; font-weight: 700; }
.ledger-card strong { font-size: 1.35rem; }
.ledger-card small { color: var(--muted); font-size: .76rem; }
.ledger-card.main { border-width: 2px; }
.ledger-card.negative strong, .ledger-amount.negative { color: #b91c1c; }
.ledger-card.positive strong, .ledger-amount.positive { color: #0d6b53; }
.ledger-card.main.negative { border-color: #f1a5a5; background: #fff6f6; }
.ledger-card.main.positive { border-color: #9fd9c3; background: #f2fbf7; }
.ledger-table small { display: block; color: var(--muted); font-size: .76rem; }
.ledger-amount { text-align: right; white-space: nowrap; font-weight: 700; }
.ledger-table tr.ledger-initial td { background: #f4f6fb; }
.ledger-table tr.ledger-closure_reversal td { background: #fff8ec; }
.ledger-direction { display: grid; gap: 8px; }
.ledger-dir { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border: 2px solid var(--line); border-radius: 10px; cursor: pointer; }
.ledger-dir input { width: 18px; height: 18px; margin: 0; }
.ledger-dir span { font-weight: 800; }
.ledger-dir small { color: var(--muted); }
.ledger-dir.credit span { color: #0d6b53; }
.ledger-dir.debit span { color: #b91c1c; }
.ledger-dir.credit input { accent-color: #0d8a63; }
.ledger-dir.debit input { accent-color: #dc2626; }
.ledger-dir.credit:has(input:checked) { border-color: #0d8a63; background: #ecfaf4; }
.ledger-dir.debit:has(input:checked) { border-color: #dc2626; background: #fff1f1; }
.ledger-to-pay { margin-top: 6px; color: #b91c1c; font-size: .8rem; font-style: normal; font-weight: 800; }
.ledger-to-pay b { display: block; margin: 4px 0; font-size: 1.5rem; line-height: 1.1; color: #b91c1c; }
.ledger-as-doctor { display: flex !important; gap: 8px; align-items: center; align-self: center; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 10px; font-weight: 700; }
.ledger-as-doctor input { width: 18px; height: 18px; }
.ledger-to-pay.due { color: #b91c1c; font-size: .9rem; }
.ledger-to-pay.ok { color: #0d6b53; font-size: .9rem; }
.ledger-card.main.positive strong { color: #0d6b53; }
.accounting-table small.accounting-balance { font-weight: 800; color: var(--ink); }
.accounting-table small.accounting-balance.negative { color: #b91c1c; }
.accounting-table small.accounting-balance.positive { color: #0d6b53; }
.accounting-mail-amount { font-weight: 700; white-space: nowrap; }
.collaborator-of { display: grid; gap: 4px; margin-left: 30px; font-weight: 700; }
.collaborator-of[hidden] { display: none; }
.accounting-table small.accounting-paid-by { color: #7c3aed; font-weight: 700; }
.ledger-month-line { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 6px; align-items: baseline; margin-top: 2px; }
.ledger-month-line b { color: #b91c1c; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.ledger-month-label { min-width: 0; text-align: left; }
.ledger-sep { width: 100%; margin: 6px 0 4px; border: 0; border-top: 1px solid var(--line); }

.invitations-panel { margin-top: 28px; }
.invitations-panel h2 { margin: 0 0 8px; font-size: 1.15rem; }
.invitations-table td small { display: block; color: var(--muted); font-size: .78rem; }
.invitations-table tr.invitation-expired td { color: var(--muted); }

.cell-contact-dialog { width: min(420px, calc(100vw - 32px)); padding: 22px; }
.cell-contact-dialog h3 { margin: 10px 0 4px; font-size: .95rem; color: var(--muted); }
.cell-contact { display: flex; gap: 12px; align-items: center; padding: 8px 0; }
.cell-contact .doctor-swatch { flex: none; min-width: 48px; }
.cell-contact > div { display: grid; gap: 2px; }
.cell-contact small { color: var(--muted); }
.cell-contact-phone { font-size: 1.15rem; font-weight: 800; }
.schedule-cell.assigned { cursor: pointer; }
