/* Cabinet-only typography; forms and public pages do not load this stylesheet. */
body {
  --cabinet-text: calc(14px * var(--ui-text-scale, 1));
  --cabinet-small: calc(12px * var(--ui-text-scale, 1));
  --cabinet-control-text: calc(16px * var(--ui-text-scale, 1));
  --cabinet-title: calc(22px * var(--ui-text-scale, 1));
  --cabinet-section: calc(18px * var(--ui-text-scale, 1));
  font-size: var(--cabinet-text);
}
.cabinet-heading h1, .welcome-row h2, .view-heading h2,
.cabinet-view > .view-heading h2, .appointment-dialog h2, #journalFileDialog h2 {
  font-size: var(--cabinet-title); line-height: 1.3;
}
.panel-title h2, .panel-title h3, .workspace-panel h3 {
  font-size: var(--cabinet-section); line-height: 1.35;
}
.welcome-row p, .view-heading p, .panel-title p, .today-label,
.table-row, .table-row strong, .journal-table-row, .journal-table-row > *, .journal-table-row strong,
.appointment-person h3, .appointment-person p, .appointment-person small,
.appointment-time, .appointment-time strong, .appointment-time small,
.template-row strong, .template-row p, .template-row small,
.button-primary, .button-secondary, .mobile-home-toggle,
.appointment-dialog label, .journal-periods select, #journalFileDialog {
  font-size: var(--cabinet-text); line-height: 1.45;
}
.table-row small, .journal-table-row small, .cabinet-eyebrow,
.panel-eyebrow, .panel-kicker, .retention-availability, .appointment-time .retention-availability {
  font-size: var(--cabinet-small); line-height: 1.45;
}
.appointment-time .retention-availability { color: var(--muted); font-weight: 400; }
.appointment-time { min-width: 0; }
.appointment-dialog input, .appointment-dialog select {
  font-size: calc(16px * var(--ui-text-scale, 1));
}
.journal-table-row .journal-date-info {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  font-size: var(--cabinet-small); line-height: 1.35;
}
.journal-date-info > span { white-space: nowrap; }
.journal-table-row .journal-info-button {
  display: inline-grid; width: 28px; height: 28px; min-width: 28px;
  padding: 4px; border: 0; border-radius: 4px; background: transparent;
  color: var(--muted); box-shadow: none;
}
.journal-info-button svg { width: 16px; height: 16px; }
.journal-info-button:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.journal-info-button:hover { color: var(--green-dark); }
#journalFileDialog footer { display: flex; flex-wrap: wrap; gap: 10px; }
#journalFileDownload { text-decoration: none; }
#journalFileName { overflow-wrap: anywhere; }
.reference-search input { font-size: calc(16px * var(--ui-text-scale, 1)); }
.journal-summary strong { font-size: var(--cabinet-title); }
/* Keep the three totals comparable instead of mixing tiles with a wide row. */
body[data-page="cabinet"] .journal-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
}
body[data-page="cabinet"] .journal-summary article {
  grid-column: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: calc(80px * var(--ui-text-scale, 1));
  padding: 12px;
}
body[data-page="cabinet"] .journal-summary span {
  font-size: var(--cabinet-small);
  line-height: 1.4;
}
body[data-page="cabinet"] .journal-summary strong {
  min-width: 0;
  margin: 0;
  font-size: var(--cabinet-title);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
@media (max-width: 700px) {
  body[data-page="cabinet"] .journal-summary {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  body[data-page="cabinet"] .journal-summary article {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: calc(58px * var(--ui-text-scale, 1));
  }
  body[data-page="cabinet"] .journal-summary strong { text-align: right; }
}
@media (min-width: 901px) {
  .journal-table-head, .journal-table-row { grid-template-columns: 140px 130px 180px 180px 190px minmax(230px,1fr) 110px 50px; }
  .journal-table { min-width: 1320px; }
}
@media (max-width: 900px), (pointer: coarse) and (orientation: landscape) and (max-height: 600px) {
  .mobile-home-ready .mobile-home-toggle { justify-content: flex-start; text-align: left; gap: 10px; }
  .mobile-home-toggle span { margin-left: 0; text-align: left; }
  .mobile-home-toggle svg { flex: 0 0 18px; }
  .journal-table-row .journal-info-button { width: 36px; height: 36px; min-width: 36px; }
  .journal-table-row > :nth-child(7) { font-size: var(--cabinet-text); }
}

/* One cabinet dismissal control, including dynamically created dialogs. */
html[data-ui-theme] body[data-page="cabinet"]{
  --cabinet-dismiss-ink:#258bd4;--cabinet-dismiss-surface:#fff;--cabinet-dismiss-edge:#c7d3db;--cabinet-dismiss-focus:#7e909c;
}
html[data-ui-theme="dark"] body[data-page="cabinet"]{
  --cabinet-dismiss-ink:#79c2ff;--cabinet-dismiss-surface:#293438;--cabinet-dismiss-edge:#65767e;--cabinet-dismiss-focus:#b5c4cb;
}
html[data-ui-theme] body[data-page="cabinet"] :is(button[aria-label^="Закрыть"],.modal-close,[data-library-refresh]){
  box-sizing:border-box;place-items:center;flex:0 0 44px;width:44px;height:44px;min-width:44px;min-height:44px;
  padding:10px;border:1px solid var(--cabinet-dismiss-edge);border-radius:6px;
  background:var(--cabinet-dismiss-surface);color:var(--cabinet-dismiss-ink);box-shadow:none;outline:none;cursor:pointer;
  transition:transform 120ms cubic-bezier(.23,1,.32,1),background-color 120ms ease,border-color 120ms ease;
}
html[data-ui-theme] body[data-page="cabinet"] :is(button[aria-label^="Закрыть"],.modal-close,[data-library-refresh]):not(.expert-sidebar-close):not([hidden]){display:inline-grid}
html[data-ui-theme] body[data-page="cabinet"] :is(button[aria-label^="Закрыть"],.modal-close,[data-library-refresh]) svg{width:18px;height:18px;flex-shrink:0}
html[data-ui-theme] body[data-page="cabinet"] :is(button[aria-label^="Закрыть"],.modal-close,[data-library-refresh]):focus{outline:none;box-shadow:none}
html[data-ui-theme] body[data-page="cabinet"] :is(button[aria-label^="Закрыть"],.modal-close,[data-library-refresh]):focus-visible{outline:none;box-shadow:none}
html[data-ui-theme][data-cabinet-keyboard-navigation] body[data-page="cabinet"] :is(button[aria-label^="Закрыть"],.modal-close,[data-library-refresh]):focus-visible{outline:2px solid var(--cabinet-dismiss-focus);outline-offset:-3px;box-shadow:none}
html[data-ui-theme]:not([data-cabinet-keyboard-navigation]) body[data-page="cabinet"] :is(button[aria-label^="Закрыть"],.modal-close,[data-library-refresh]):active{transform:scale(.94);background:var(--soft)}
@media(hover:hover){
  html[data-ui-theme] body[data-page="cabinet"] :is(button[aria-label^="Закрыть"],.modal-close,[data-library-refresh]):hover{background:var(--soft);border-color:var(--cabinet-dismiss-focus);box-shadow:none}
}
body[data-page="cabinet"] .expert-library-dialog>header{display:grid;grid-template-columns:minmax(0,1fr) 44px 44px;gap:12px;align-items:start}
body[data-page="cabinet"] .expert-library-dialog h2{font-size:var(--cabinet-title);line-height:1.3;overflow-wrap:anywhere}
body[data-page="cabinet"] :is(.expert-library-dialog,.support-center){font-size:var(--cabinet-text);background:var(--white);color:var(--ink)}
body[data-page="cabinet"] .support-center h2{font-size:var(--cabinet-title);line-height:1.3;overflow-wrap:anywhere}
html[data-ui-theme="dark"] body[data-page="cabinet"] .support-center{background:var(--white);color:var(--ink)}
html[data-ui-theme="dark"] body[data-page="cabinet"] :is(.support-center,.expert-library-dialog) [role="alert"]{color:#ffb4ba}
@media(prefers-reduced-motion:reduce){
  html[data-ui-theme] body[data-page="cabinet"] :is(button[aria-label^="Закрыть"],.modal-close,[data-library-refresh]),
  html[data-ui-theme]:not([data-cabinet-keyboard-navigation]) body[data-page="cabinet"] :is(button[aria-label^="Закрыть"],.modal-close,[data-library-refresh]):active{transition:none;transform:none}
}
/* Older hover/focus rules must not restore a green ring on dismissal controls. */
html[data-ui-theme] body[data-page="cabinet"] :is(button[aria-label^="Закрыть"],.modal-close,[data-library-refresh]):not(:disabled):not([aria-disabled="true"]):is(:hover,:focus,:focus-visible,:active){box-shadow:none}
@media(hover:hover){
  html[data-ui-theme] body[data-page="cabinet"] :is(button[aria-label^="Закрыть"],.modal-close,[data-library-refresh]):not(:disabled):not([aria-disabled="true"]):hover{background:var(--soft);border-color:var(--cabinet-dismiss-focus)}
}
html[data-ui-theme] body[data-page="cabinet"] #appointmentEditor header [data-appointment-close]:focus-visible{outline:none;box-shadow:none}
html[data-ui-theme][data-cabinet-keyboard-navigation] body[data-page="cabinet"] #appointmentEditor header [data-appointment-close]:focus-visible{outline:2px solid var(--cabinet-dismiss-focus);outline-offset:-3px;box-shadow:none}
body[data-page="cabinet"] #programModal .selection-modal{box-sizing:border-box;align-self:center;width:min(560px,100%);margin:0;border-radius:8px;max-height:calc(100dvh - 40px);overflow:auto}
body[data-page="cabinet"] #programModal .modal-heading>div{min-width:0;overflow-wrap:anywhere}
body[data-page="cabinet"] #programModal .modal-heading{padding-right:56px}
body[data-page="cabinet"] .journal-form-actions button{min-width:0;max-width:100%;padding-inline:6px;white-space:normal;overflow-wrap:anywhere}
html[data-ui-theme] body[data-page="cabinet"] :is(.button-primary,.primary-command,.profile-dialog button[type="submit"],.support-center [type="submit"],.expert-library-dialog [type="submit"],.personal-plan-dialog [type="submit"]){background:#087f6f;border-color:#087f6f;color:#fff}
body[data-page="cabinet"] .calendar-day-name{color:#526572}
html[data-ui-theme="dark"] body[data-page="cabinet"] :is(.journal-form-grid label>span,.insurance-kind-options label>span,.journal-services legend,.calendar-day-name){color:#c0cdd3}
html[data-ui-theme="dark"] body[data-page="cabinet"] .profile-detail-buttons svg{color:#afc3ce}
html[data-ui-theme="light"] body[data-page="cabinet"]{--muted:#5b6e7c}
html[data-ui-theme] body[data-page="cabinet"] :is(.today-label,.cabinet-eyebrow,.profile-detail-buttons span,.month-chart-summary dt,.month-chart-note,.table-head){color:var(--muted)}
html[data-ui-theme] body[data-page="cabinet"] .mobile-bottom-nav button:not(.is-active):not(.mobile-create){color:var(--muted)}
html[data-ui-theme="dark"] body[data-page="cabinet"] .mobile-bottom-nav .mobile-create span{color:#80dfbc}
html[data-ui-theme="dark"] body[data-page="cabinet"] .mobile-bottom-nav .mobile-create svg{background:#087f6f}
body[data-page="cabinet"] .program-monogram:not(.is-blue){background:#087f6f}
body[data-page="cabinet"] .program-option>svg{color:var(--muted)}
html[data-ui-theme="dark"] body[data-page="cabinet"] .insurance-kind-options input:checked+span{background:#154d40;border-color:#45bc9e;color:#a5f3d6}

/* No fill mode: finished entrances release their transforms and stacking contexts. */
html[data-cabinet-motion="pointer"] body[data-page="cabinet"] .cabinet-view.is-active {
  animation: cabinet-motion-view-in 160ms cubic-bezier(.23,1,.32,1);
}
html[data-cabinet-motion="pointer"] body[data-page="cabinet"] :is(
  dialog[open]:not(:where(.support-center, #signatureFullscreen, #profileSignatureFullscreen)),
  .modal-backdrop:not([hidden]) > .selection-modal,
  .reference-atlas:not([hidden]) > .reference-atlas-shell,
  dialog.support-center[open] > [data-sc-content]
) {
  animation: cabinet-motion-dialog-in 160ms cubic-bezier(.23,1,.32,1);
}
@keyframes cabinet-motion-view-in {
  from { opacity: .72; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}
@keyframes cabinet-motion-dialog-in {
  from { opacity: .72; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
html[data-cabinet-motion]:not([data-cabinet-motion="pointer"]) body[data-page="cabinet"] :is(
  .cabinet-view.is-active, dialog[open],
  .modal-backdrop:not([hidden]) > .selection-modal,
  .reference-atlas:not([hidden]) > .reference-atlas-shell,
  dialog.support-center[open] > [data-sc-content]
) { animation: none; }
@media (prefers-reduced-motion: reduce) {
  html[data-cabinet-motion] body[data-page="cabinet"] :is(
    .cabinet-view.is-active, dialog[open],
    .modal-backdrop:not([hidden]) > .selection-modal,
    .reference-atlas:not([hidden]) > .reference-atlas-shell,
    dialog.support-center[open] > [data-sc-content]
  ) { animation: none; }
}
