/* R168 — shared administrative identity and top navigation. Public chat is separate. */
.app-shell { display: block; }
.admin-header {
  display: grid;
  grid-template-columns: minmax(150px, 180px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px 24px;
  min-height: 68px;
  padding: 8px clamp(18px, 3vw, 42px);
  color: #f4f8ff;
  background: #12315a;
  border-bottom: 1px solid #2b5284;
  box-shadow: 0 3px 12px #16376114;
}
.admin-header .brand--sidebar { min-width: 0; gap: 6px; }
.admin-header .brand--sidebar .brand__logo,
.admin-header .brand--sidebar.is-clinic-brand .brand__logo {
  width: auto; max-width: 164px; max-height: 38px; object-fit: contain;
}
.admin-header .brand--sidebar.is-clinic-brand .brand__logo { border: 0; }
.admin-header .brand__descriptor { font-size: 9px; line-height: 1.4; color: #bdd3f4; }
.admin-header .sidebar-clinic-name { font-size: 17px; line-height: 1.2; }
.admin-header .sidebar {
  position: static; display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: center;
  width: auto; height: auto; min-width: 0; margin: 0; padding: 0; gap: 4px;
  overflow: visible; transform: none; background: none;
}
.admin-header .nav-item {
  display: inline-flex; justify-content: center; gap: 7px;
  min-height: 42px; padding: 10px 12px; border-radius: 9px;
  font-size: 13px; font-weight: 650; line-height: 1.25; color: #cadbf4;
}
.admin-header .nav-item__icon { font-size: 16px; color: #9fc3ff; }
.admin-header .nav-item:hover { background: #204778; color: #fff; }
.admin-header .nav-item.is-active {
  color: #fff; background: #264f83; border-color: #527baf;
  box-shadow: inset 0 -2px 0 #a6caff;
}
.admin-header .nav-item__badge { color: #173d6d; background: #d9e9ff; min-width: 20px; padding: 3px 5px; }
.admin-account { display: flex; align-items: center; gap: 12px; min-width: 0; }
.admin-header .user-chip { margin: 0; gap: 9px; min-width: 0; }
.admin-header .user-chip__avatar { width: 36px; height: 36px; background: #315d98; color: #fff; border: 1px solid #587eaf; }
.admin-header .user-chip strong { color: #fff; max-width: 130px; overflow-wrap: anywhere; }
.admin-header .user-chip small { color: #bfd0e9; max-width: 130px; line-height: 1.35; }
.admin-header .sidebar__footer { display: grid; gap: 5px; padding: 0; margin: 0; }
.admin-header .system-pill { border: 0; padding: 0 2px; gap: 8px; background: none; }
.admin-header .system-pill small { display: none; }
.admin-header .system-pill strong { font-size: 10px; color: #c8d9f1; margin: 0; }
.admin-header .status-dot { width: 6px; height: 6px; box-shadow: none; }
.admin-header #logout-button { min-height: 30px; padding: 4px 10px; font-size: 11px; border-color: #50729c; border-radius: 7px; color: #e7f0ff; box-shadow: none; }
.admin-header #logout-button:hover { background: #284f82; }
.admin-header .platform-attribution { padding: 0; justify-items: start; }
.admin-header .platform-attribution img { max-width: 80px; height: auto; opacity: .7; }
.admin-header .menu-button { display: none; }
.workspace { margin: 0; width: 100%; min-width: 0; }
.workspace:has(#patients-section:not([hidden]) #patient-detail-page:not([hidden])) > .topbar { display: none; }
.topbar { position: static; min-height: 68px; padding-block: 15px; background: #fff; backdrop-filter: none; }
.topbar h1 { font-size: 21px; letter-spacing: -.025em; }
.topbar .eyebrow { font-size: 9px; color: #537196; }
.content { max-width: 1680px; padding-top: 24px; }
.view-section, .panel, .toolbar, .section-heading, .panel__header { min-width: 0; }
.panel { border-color: var(--admin-line); box-shadow: 0 2px 8px #244f7910; }
.panel__header { background: #fbfcff; }
.section-heading h2 { font-size: clamp(24px, 2.1vw, 32px); letter-spacing: -.03em; }
.section-heading > div > p:last-child { font-size: 14px; line-height: 1.55; }
.button { border-radius: 9px; font-weight: 650; }
.button--primary { background: var(--admin-primary); border-color: var(--admin-primary); box-shadow: 0 3px 8px #245fbc20; }
.button--primary:hover:not(:disabled) { background: var(--admin-primary-hover); border-color: var(--admin-primary-hover); box-shadow: 0 4px 10px #245fbc28; }
.button--secondary { color: #275b9d; border-color: #c1d3ea; background: #fff; }
.button--secondary:hover:not(:disabled) { border-color: #6d95cd; color: #174883; background: #f0f5ff; }
.field input, .field select, .field textarea { border-color: #c8d6e7; border-radius: 8px; color: #203d5f; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #3974d6; box-shadow: 0 0 0 3px #3974d620; }
.field input[readonly], .field textarea[readonly], .field select:disabled { background: #f4f7fc; }
.field input.sr-only { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: -1px; border: 0; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--admin-primary); }
.form-stack { gap: 16px; }
.help-trigger, .help-trigger--inline { border-color: #c9d9ee; color: #245fbc; background: #f0f5ff; }
.help-tooltip { border-color: #c1d3ea; box-shadow: 0 12px 32px #193b6726; }
.help-tooltip__section--objective { border-color: #c5d8f1; border-left-color: #3974d6; background: #f1f6ff; }
.help-tooltip__section--objective strong { color: #245fbc; }
.help-tooltip__section--example { background: #f4f7fc; }
.lia-notice-dialog, .confirm-dialog, dialog.patient-dialog { color: #203d5f; border-radius: 16px; box-shadow: 0 22px 65px #17395f30; }
dialog::backdrop { background: #122b4c99; }
.lia-notice-dialog .button--ghost, .lia-notice-card .button--ghost,
.lia-plan-payments .button--ghost, .lia-catalog-card .button--ghost { color: #275b9d; border-color: #b8cde8; background: white; }
.lia-notice-dialog .button--ghost:hover:not(:disabled), .lia-notice-card .button--ghost:hover:not(:disabled),
.lia-plan-payments .button--ghost:hover, .lia-catalog-card .button--ghost:hover { color: #174883; border-color: #6d95cd; background: #f0f5ff; }
.lia-notice-dialog button:focus-visible, .lia-notice-dialog a:focus-visible,
.lia-notice-card .button--ghost:focus-visible, .lia-notice-card a:focus-visible,
.lia-plan-payments button:focus-visible { outline-color: #3974d6; }
.lia-notice-field input, .lia-notice-field select, .lia-notice-field textarea { color: #203d5f; border-color: #c8d6e7; border-radius: 8px; }
.lia-notice-detail, .lia-notice-card .lia-notice-detail { color: #52677f; }
.lia-notice-card { box-shadow: none; }
.conversation-layout { grid-template-columns: minmax(290px, .7fr) minmax(0, 1.3fr); gap: 20px; }
.conversation-item { padding: 16px 20px; }
.conversation-item.is-active { background: #edf4ff; box-shadow: inset 3px 0 0 #3974d6; }
.transcript__header, .conversation-access { background: #f9fbff; border-color: var(--admin-line); }
.transcript .message-list { background: #f4f7fc; }
.message--assistant .message__bubble, .message--user .message__bubble { border-color: #315d98; background: #315d98; color: white; }
.message--visitor .message__bubble { border-color: #dce6f3; background: white; }
.conversation-access small, .conversation-access-row small { color: #52677f; }
.lia-layout { grid-template-columns: minmax(230px, .26fr) minmax(0, 1fr); gap: 20px; }
.lia-clinic-picker, .clinic-picker { top: 20px; }
.lia-form-card > .panel__header { border-left: 3px solid #3974d6; }
.lia-collapsible > .panel__header { background: #f7faff; }
.lia-collapsible > .panel__header:hover,
.lia-collapsible.is-expanded > .panel__header,
.lia-collapsible:has(.lia-section-toggle[aria-expanded="true"]) > .panel__header { background: #eef4ff; }
.lia-collapsible > .panel__header .lia-section-toggle { border-color: #df8b35; color: #7b3508; background: linear-gradient(180deg, #fff1df, #ffd5a6); box-shadow: 0 1px 2px rgba(110,57,10,.08); letter-spacing: 0; }
.lia-collapsible > .panel__header .lia-section-toggle:hover { border-color: #d47d2b; color: #642600; background: #ffd09b; }
.lia-collapsible > .panel__header .lia-section-toggle:focus-visible { outline-color: #8a3700; }
.lia-form-card__body { padding: 22px; gap: 20px; }
.lia-status-grid article { min-width: 0; }
.lia-service-card, .lia-care-professional, .staff-card, .lia-payment-editor, .lia-payment-method { border-color: var(--admin-line); border-radius: 11px; }
.lia-service-card { background: #fbfcff; }
.lia-form-actions { border-color: var(--admin-line); }
.lia-service-preparation, .switch-field--featured:has(input:checked), .lia-service-price-toggle:has(input:checked) { border-color: #c5d8f1; background: #f1f6ff; }
.lia-progress progress::-webkit-progress-value { background: #3974d6; }
.lia-progress progress::-moz-progress-bar { background: #3974d6; }
.appointment-detail { top: 20px; }
.appointment-day.is-today { box-shadow: inset 0 0 0 2px #6994d3; }
.appointment-pill { border-color: #bcd1ee; color: #254f88; background: #edf4ff; }
.appointment-pill:hover, .appointment-pill:focus-visible { border-color: #3974d6; background: #dceaff; }
.access-table th { color: #365981; background: #f4f7fd; }
.access-table th, .access-table td { border-bottom-color: var(--admin-line); }
.access-table tbody tr:hover { background: #f8faff; }
#access-section small, .conversation-block-dialog .field small, .conversation-block-note { color: #52677f; }
.auth-panel { background: #fff; }
.auth-panel__security { color: #52677f; }
.auth-panel__security .status-dot { background: #3974d6; box-shadow: 0 0 0 4px #3974d617; }
#forgot-password-button { color: #245fbc; }
#forgot-password-button:hover { background: #edf4ff; }
.auth-visual { background: radial-gradient(circle at 82% 18%, #3e72ba55, transparent 40%), #12315a; }
.auth-visual__glow { background: #3974d620; }
.auth-visual__tag { color: #c4dbff; }

@media (max-width: 1150px) {
  .admin-header { grid-template-columns: minmax(0, 1fr) auto; gap: 12px 24px; }
  .admin-header .brand--sidebar { grid-column: 1; grid-row: 1; }
  .admin-header .admin-account { grid-column: 2; grid-row: 1; }
  .admin-header .main-nav { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; border-top: 1px solid #31547f; padding-top: 10px; }
  .admin-header .brand--sidebar .brand__logo, .admin-header .brand--sidebar.is-clinic-brand .brand__logo { max-height: 43px; }
  .admin-header .sidebar__footer { grid-template-columns: auto auto; align-items: center; gap: 4px 12px; }
  .admin-header .platform-attribution { grid-column: 1; }
  .admin-header #logout-button { grid-column: 2; grid-row: 1 / span 2; }
}
@media (max-width: 1100px) {
  .lia-layout { grid-template-columns: 1fr; }
  .lia-clinic-picker { position: static; display: grid; grid-template-columns: minmax(210px, .6fr) minmax(0, 1fr); max-height: none; }
  .lia-clinic-picker .panel__header { grid-column: 1; grid-row: 1; border-bottom: 0; align-items: end; }
  .lia-clinic-picker > .field { grid-column: 1; grid-row: 2; padding-top: 0; }
  .lia-clinic-picker .clinic-list { grid-column: 2; grid-row: 1 / span 2; max-height: 190px; border-left: 1px solid var(--admin-line); }
}
@media (max-width: 920px) {
  .admin-header { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 18px; gap: 10px 14px; }
  .admin-header .brand--sidebar { max-width: 210px; }
  .admin-header .menu-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: auto; min-width: 78px; padding: 0 12px; grid-column: 2; grid-row: 1; background: #244a7b; border-color: #6585b0; color: white; font-size: 13px; }
  .admin-header .admin-account { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; padding-top: 10px; border-top: 1px solid #31547f; }
  .admin-header .sidebar { display: none; grid-column: 1 / -1; grid-row: 3; }
  .app-shell.menu-open .admin-header .sidebar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); box-shadow: none; transform: none; }
  .admin-header .nav-item { justify-content: flex-start; min-width: 0; min-height: 44px; }
  .admin-header .user-chip > span:last-child { display: block; }
  .admin-header .user-chip strong, .admin-header .user-chip small { max-width: 230px; }
  .admin-header .platform-attribution { display: none; }
  .admin-header .sidebar__footer { display: flex; gap: 12px; }
  .conversation-layout { grid-template-columns: 1fr; }
  .conversation-list-panel, .transcript-panel { min-height: auto; }
  .conversation-list { max-height: 330px; }
}
@media (max-width: 600px) {
  .admin-header { padding-inline: 14px; }
  .admin-header .sidebar__footer { display: grid; gap: 6px; }
  .admin-header #logout-button { grid-column: auto; grid-row: auto; }
  .admin-header .user-chip strong, .admin-header .user-chip small { max-width: 165px; }
  .admin-header .user-chip__avatar { width: 32px; height: 32px; }
  .app-shell.menu-open .admin-header .sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-header .nav-item { padding: 10px 8px; font-size: 12px; }
  .admin-header .brand--sidebar .brand__logo, .admin-header .brand--sidebar.is-clinic-brand .brand__logo { max-width: 160px; max-height: 40px; }
  .topbar { padding: 12px 16px; min-height: 64px; }
  .topbar h1 { font-size: 20px; }
  .content { padding: 18px 14px 36px; }
  .lia-clinic-picker { display: block; }
  .lia-clinic-picker .clinic-list { border-left: 0; border-top: 1px solid var(--admin-line); max-height: 220px; }
  .lia-clinic-picker .panel__header { min-height: 60px; }
  .lia-clinic-picker > .field { padding-top: 8px; }
  .lia-form-card__body { padding: 16px; }
  .lia-service-fields, .access-grid { grid-template-columns: 1fr; }
  .lia-service-price-toggle { margin-top: 0; justify-content: flex-start; }
  .appointment-toolbar { grid-template-columns: minmax(0, 1fr); }
  .appointment-search__row { display: grid; grid-template-columns: minmax(0, 1fr); }
  .appointment-search__row input { min-width: 0; flex-basis: 100%; }
  .appointment-search__row .button { flex: 1; }
  .panel__header { gap: 12px; }
  .panel__header h3 { overflow-wrap: anywhere; }
  .confirm-dialog { padding: 18px; }
}

.team-tabs,.team-actions,.team-shortcuts{display:flex;gap:10px;flex-wrap:wrap;margin:14px 0}.team-tabs{padding:5px;background:#e6eef9;border-radius:11px}.team-tabs .button[aria-pressed=true]{background:#194b86;color:white;border-color:#194b86}.team-tabs .button[aria-pressed=false]{background:transparent;color:#234f80;border-color:transparent}.team-clinic-bar,.team-intro{display:flex;align-items:center;justify-content:space-between;gap:20px}.team-clinic-bar .field{flex:1;max-width:420px}.team-clinic-bar p,.team-intro p,.team-permissions-intro{color:#536c87;font-size:13px;line-height:1.6}.team-intro h2{font-size:20px;margin:0 0 8px}.team-actions{justify-content:flex-end}.team-users{display:grid;gap:12px}.team-user-card{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:20px;border:1px solid #dbe5f0;border-radius:12px;background:white}.team-user-card p{margin:6px 0;color:#58708a;font-size:13px}.team-user-card .team-actions{margin:0}.team-user-status{font-size:12px;color:#47617d}.team-empty{padding:24px;text-align:center;background:white;border-radius:12px}.team-shortcuts .button{font-size:12px}#team-permissions .patient-access-row{margin-bottom:12px}#team-status{min-height:20px;color:#536c87;font-size:13px}#team-recovery{margin-top:18px}@media(max-width:750px){.team-clinic-bar,.team-intro,.team-user-card{align-items:stretch;flex-direction:column}.team-tabs{gap:4px}.team-tabs .button{flex:1;font-size:12px;padding:9px}.team-actions{justify-content:flex-start}.team-actions .button,.team-shortcuts .button{flex:1 1 auto}.team-clinic-bar{gap:4px}.team-clinic-bar p{margin:0}}

/* R174: dialogs remain inside the viewport, independently of document scroll. */
html body dialog[open] { position:fixed; inset:0; margin:auto !important; max-height:calc(100dvh - 32px); max-width:calc(100vw - 28px); overflow:auto; box-sizing:border-box; }
html body dialog:not([open]) { display:none; }
html body :is(.field,.schedule-field,.patient-field,.clinical-field) :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea) { border:1px solid #c9d9ef; border-radius:7px; color:#173d66; background:#fff; font:inherit; font-size:14px; min-height:42px; padding:10px 12px; box-sizing:border-box; max-width:100%; }
html body :is(.field,.schedule-field,.patient-field,.clinical-field) :is(input,select,textarea):focus-visible { outline:2px solid #88b5ff; outline-offset:2px; }
.team-health-fields { grid-template-columns:repeat(2,minmax(0,1fr)); }
.team-health-fields .field { min-width:0; }
.team-health-fields .field[hidden], .team-health-fields[hidden] { display:none; }
.team-health-wide { grid-column:1/-1; }
.team-health-fields .team-toggle { display:flex; align-items:center; gap:9px; font-size:14px; min-height:34px; }
.team-health-fields .team-toggle input { width:17px; height:17px; min-height:0; }
#team-detail-dialog:has(.team-health-fields:not([hidden])),#clinic-user-dialog:has(.team-health-fields:not([hidden])) { width:min(860px,calc(100vw - 28px)); }
.team-health-fields .muted-copy { grid-column:1/-1; }
.team-public-fields,.team-author-fields { grid-column:1/-1; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; border-top:1px solid #d9e5f4; padding-top:14px; }
.team-public-fields[hidden],.team-author-fields[hidden] { display:none; }
.team-document-options { display:flex; flex-wrap:wrap; gap:8px 18px; }
@media(max-width:600px) { .team-health-fields,.team-public-fields,.team-author-fields { grid-template-columns:minmax(0,1fr); } html body dialog[open] { max-height:calc(100dvh - 20px); } }

.service-professionals { display:grid; gap:10px; padding:16px; border:1px solid #d3e2f5; border-radius:10px; background:#fff; }
.service-professionals select { width:100%; min-height:42px; border:1px solid #c9d9ef; border-radius:7px; padding:10px 12px; color:#173d66; font:inherit; }
.service-professionals-list { display:flex; gap:8px 20px; flex-wrap:wrap; }
.service-professionals-list[hidden],.service-professionals .team-actions[hidden] { display:none; }
body>.appointment-detail-dialog { width:min(800px,calc(100vw - 28px)); padding:24px; border:1px solid #c5d6ed; border-radius:16px; color:#173d66; box-shadow:0 25px 100px #162f5360; }
body>.appointment-detail-dialog .appointment-detail-list { grid-template-columns:repeat(2,minmax(0,1fr)); }
body>.appointment-detail-dialog .appointment-detail-text { grid-column:span 2; }
@media(max-width:600px) { body>.appointment-detail-dialog .appointment-detail-list { grid-template-columns:minmax(0,1fr); } body>.appointment-detail-dialog .appointment-detail-text { grid-column:auto; } }

.team-modal-close { position:sticky; top:0; float:right; z-index:3; }

/* R175: navigation back uses the same warm accent as section expansion. */
html body .button--back{
  display:inline-flex;align-items:center;justify-content:center;gap:10px;
  min-height:44px;padding:10px 14px;border:1px solid #df8b35;border-radius:10px;
  color:#7b3508;background:linear-gradient(180deg,#fff1df,#ffd5a6);
  box-shadow:0 1px 2px rgba(110,57,10,.08),inset 0 1px 0 rgba(255,255,255,.7);
  font:750 13px/1.4 "Segoe UI",Arial,sans-serif;letter-spacing:0;cursor:pointer;
}
html body .button--back::before{content:"";flex:0 0 7px;width:7px;height:7px;border-left:2px solid currentColor;border-bottom:2px solid currentColor;transform:rotate(45deg)}
html body .button--back>span[aria-hidden=true]{display:none}
html body .button--back:hover{color:#642600;border-color:#d47d2b;background:#ffd09b}
html body .button--back:focus-visible{outline:3px solid #8a3700;outline-offset:3px}
html body #patient-detail-page .patients-back.button--back{min-height:44px;padding:10px 14px;border:1px solid #df8b35;background:linear-gradient(180deg,#fff1df,#ffd5a6);box-shadow:0 1px 2px rgba(110,57,10,.08);font-size:13px;font-weight:750}
html body #patient-detail-page .patients-back.button--back:hover{background:#ffd09b;border-color:#d47d2b}
