@font-face {
  font-family: 'Caveat Camille';
  src: url('/fonts/caveat-600.ttf') format('truetype');
  font-display: swap;
  font-weight: 600;
}
:root {
  --ink: #171416;
  --paper: #fffdf8;
  --berry: #77143e;
  --raspberry: #a91f57;
  --blush: #f4dfe4;
  --gold: #e4aa2c;
  --line: rgba(23, 20, 22, 0.16);
  --muted: #665d62;
}
* {
  box-sizing: border-box;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
body {
  margin: 0;
  background: #f6f1eb;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
.we-skip-link {
  position: fixed;
  top: -100px;
  left: 1rem;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1rem;
}
.we-skip-link:focus {
  top: 1rem;
}
.login-shell {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: linear-gradient(135deg, var(--berry), var(--raspberry));
}
.login-card {
  width: min(430px, 100%);
  background: var(--paper);
  padding: clamp(1.5rem, 5vw, 3rem);
  box-shadow: 18px 18px 0 rgba(23, 20, 22, 0.25);
}
.section-heading h1 {
  font:
    400 clamp(2.5rem, 6vw, 5.5rem)/0.95 Georgia,
    serif;
  letter-spacing: -0.05em;
  margin: 1.5rem 0 0.5rem;
}
.login-card h1 {
  font:
    400 clamp(2.25rem, 4vw, 3.5rem)/1 Georgia,
    serif;
  letter-spacing: -0.04em;
  margin: 1.5rem 0 0.5rem;
}
.admin-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.admin-brand > span {
  width: 2.8rem;
  height: 2.8rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--raspberry);
  color: #fff;
  font:
    600 1.45rem 'Caveat Camille',
    cursive;
  transform: rotate(-7deg);
}
.admin-brand div {
  display: flex;
  flex-direction: column;
}
.admin-brand strong {
  font:
    500 1.1rem Georgia,
    serif;
}
.admin-brand small,
.eyebrow {
  font-size: 0.67rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
.admin-version {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.08em;
}
label {
  display: grid;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 750;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0.8rem 0.9rem;
  border-radius: 0;
}
input,
select {
  min-height: 46px;
  line-height: 1.25;
}
textarea {
  min-height: 7rem;
  line-height: 1.5;
  resize: vertical;
}
.login-card label {
  margin-top: 1rem;
}
.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.icon-button {
  border: 0;
  cursor: pointer;
  min-height: 44px;
  padding: 0.75rem 1.1rem;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.primary-button {
  background: var(--raspberry);
  color: #fff;
}
.primary-button:hover {
  background: var(--berry);
}
.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled,
.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}
.secondary-button {
  background: var(--ink);
  color: #fff;
}
.button-loader {
  width: 1rem;
  height: 1rem;
  margin-right: 0.65rem;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: admin-button-spin 0.7s linear infinite;
}
@keyframes admin-button-spin {
  to {
    transform: rotate(360deg);
  }
}
.ghost-button {
  background: transparent;
  color: inherit;
  border: 1px solid currentColor;
}
.icon-button {
  min-width: 44px;
  background: transparent;
  font-size: 1.5rem;
}
.compact-button {
  min-height: 38px;
  padding: 0.45rem 0.7rem;
  font-size: 0.75rem;
  white-space: nowrap;
}
.login-card .primary-button {
  width: 100%;
  margin-top: 1.5rem;
}
.muted {
  color: var(--muted);
}
.form-message {
  min-height: 1.25rem;
  color: var(--berry);
  font-weight: 700;
}
.form-message.error {
  color: #9f1239;
}
.form-message.success {
  color: #166534;
}
.admin-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.header-actions a {
  color: var(--berry);
  font-weight: 800;
}
.admin-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.75rem clamp(1rem, 4vw, 3rem);
  overflow-x: auto;
  background: var(--ink);
  position: sticky;
  top: 76px;
  z-index: 20;
}
.tab-button {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  padding: 0.8rem 1rem;
  font-weight: 800;
  cursor: pointer;
}
.tab-button.active {
  color: #fff;
  background: var(--raspberry);
}
.admin-main {
  width: min(1450px, 100%);
  margin: auto;
  padding: clamp(1.25rem, 4vw, 3rem);
}
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}
.section-heading h1 {
  margin: 0.25rem 0 0;
}
.eyebrow {
  color: var(--raspberry);
  margin: 0;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}
.metric-card,
.content-card {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: clamp(1rem, 3vw, 1.6rem);
}
.metric-card strong {
  display: block;
  font:
    400 2.6rem Georgia,
    serif;
  color: var(--berry);
}
.metric-card span {
  color: var(--muted);
  font-size: 0.85rem;
}
.split-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.5fr);
  gap: 1.25rem;
  align-items: start;
}
.split-layout > *,
.content-card,
.patient-sheet-workspace,
.patient-sheet-shell,
.patient-sheet-form,
.patient-sheet-section,
.patient-sheet-section-body {
  min-width: 0;
}
.content-card p {
  overflow-wrap: anywhere;
}
.content-card h2 {
  font:
    500 1.7rem Georgia,
    serif;
  margin: 0 0 1rem;
}
.section-intro {
  margin: 0.75rem 0 0;
  color: var(--muted);
}
.filter-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 0.3fr);
  align-items: end;
  gap: 1rem;
  padding: clamp(1rem, 2.5vw, 1.5rem);
  background: var(--paper);
  border: 1px solid var(--line);
}
.filter-search-field {
  min-width: 0;
}
.invoice-filter-toolbar {
  grid-template-columns: minmax(240px, 720px);
}
.filter-summary {
  min-height: 1.15rem;
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}
.empty-list-state {
  min-height: 120px;
  display: grid;
  place-items: center;
  text-align: center;
}
.overview-request-table td:last-child {
  width: 1%;
}
.overview-request-table .request-actions {
  margin-top: 0;
  flex-wrap: nowrap;
}
.overview-request-table .status-badge,
.overview-request-table .invoice-document-button,
.overview-request-table .patient-record-button,
.overview-request-table .request-actions button,
.overview-request-table .invoice-create-button {
  min-height: 44px;
  padding: 0.55rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.1;
}
.overview-request-table .patient-record-button,
.overview-request-table .invoice-create-button,
.overview-request-table .request-treatment-button {
  min-width: 8.5rem;
}
.overview-request-table .invoice-create-button,
.overview-request-table .invoice-document-button {
  width: 10.75rem;
  min-width: 10.75rem;
  justify-content: center;
}
.invoice-document-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 44px;
  border: 1px solid var(--raspberry);
  background: #fff;
  color: var(--berry);
  cursor: pointer;
  white-space: nowrap;
}
.invoice-document-button:hover {
  background: var(--blush);
}
.invoice-document-icon {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 1.05rem;
  color: var(--raspberry);
}
.invoice-document-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.item-list {
  display: grid;
  gap: 0.55rem;
  max-height: 68vh;
  overflow: auto;
}
.item-button {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.9rem;
  cursor: pointer;
}
.item-button:hover,
.item-button.active {
  border-color: var(--raspberry);
  background: var(--blush);
}
.item-button strong,
.item-button small {
  display: block;
}
.item-button small {
  color: var(--muted);
  margin-top: 0.25rem;
}
.blog-heading-actions,
.blog-editor-block-heading,
.blog-pane-heading,
.blog-section-actions,
.blog-podcast-actions,
.blog-suggestion-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.blog-metrics {
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  margin-bottom: 1.5rem;
}
.blog-metrics .metric-card {
  padding: 1.1rem;
}
.blog-metrics .metric-card strong {
  font-size: clamp(2rem, 3vw, 2.7rem);
}
.blog-filter-toolbar {
  grid-template-columns: repeat(2, minmax(190px, 280px));
  justify-content: start;
}
.blog-list {
  display: grid;
  gap: 1rem;
}
.blog-list-item {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 22rem;
  align-items: start;
  gap: clamp(1rem, 2vw, 1.5rem);
  padding: 1rem;
}
.blog-list-image {
  width: 150px;
  height: 105px;
  object-fit: cover;
  background: var(--blush);
}
.blog-list-content,
.blog-list-content h2 {
  min-width: 0;
}
.blog-list-content h2 {
  margin: 0;
  font-size: clamp(1.3rem, 2vw, 1.7rem);
}
.blog-list-content > p {
  margin: 0.45rem 0;
  color: var(--muted);
  font-size: 0.82rem;
}
.blog-list-stats,
.blog-list-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.blog-list-stats {
  color: var(--muted);
  font-size: 0.75rem;
}
.blog-list-actions {
  justify-content: flex-end;
}
.blog-list-controls {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}
.blog-list-statuses {
  display: grid;
  grid-template-columns: 8.5rem 10rem;
  justify-content: end;
  gap: 0.65rem;
}
.blog-list-statuses > span {
  justify-content: center;
}
.blog-status,
.blog-podcast-badge,
.blog-image-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.3rem 0.55rem;
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.blog-status.published,
.blog-podcast-badge.published {
  background: #dcfce7;
  color: #166534;
}
.blog-status.draft,
.blog-podcast-badge {
  background: var(--blush);
  color: var(--berry);
}
.blog-status.archived,
.blog-podcast-badge.stale {
  background: #eee9e4;
  color: var(--muted);
}
.blog-image-badge {
  background: #fff0d5;
  color: #7a4312;
}
.blog-dialog {
  width: min(820px, calc(100% - 2rem));
}
.blog-generate-card {
  display: grid;
  gap: 1.5rem;
}
.blog-generate-card > p,
.blog-suggestion-heading h3,
.blog-generation-state p {
  margin: 0;
}
.blog-suggestion-list {
  display: grid;
  gap: 0.55rem;
}
.blog-suggestion-button {
  display: grid;
  gap: 0.2rem;
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.blog-suggestion-button:hover {
  border-color: var(--raspberry);
  background: var(--blush);
}
.blog-suggestion-button small {
  color: var(--berry);
  font-weight: 750;
}
.blog-generation-state {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem;
  background: var(--ink);
  color: #fff;
}
.blog-generation-state[hidden] {
  display: none;
}
.blog-generation-state .muted {
  color: rgba(255, 255, 255, 0.75);
}
.blog-editor-dialog {
  width: min(1180px, calc(100% - 2rem));
  height: min(920px, calc(100svh - 2rem));
  max-height: calc(100svh - 2rem);
}
.blog-editor-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.blog-editor-heading {
  flex: 0 0 auto;
  padding: 1.4rem clamp(1rem, 3vw, 2rem) 1rem;
  border-bottom: 1px solid var(--line);
}
.blog-editor-heading h2 {
  margin: 0.25rem 0 0.35rem;
}
.autosave-indicator {
  display: block;
  min-height: 1rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}
.autosave-dirty,
.autosave-saving {
  color: #92400e;
}
.autosave-saved {
  color: #166534;
}
.autosave-error {
  color: #9f1239;
}
.blog-editor-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 0.25rem;
  padding: 0.75rem clamp(1rem, 3vw, 2rem) 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: #f6f1eb;
}
.blog-editor-tab {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0.65rem 0.9rem;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}
.blog-editor-tab.active {
  border-bottom-color: var(--raspberry);
  color: var(--berry);
  background: var(--paper);
}
.blog-editor-form {
  min-height: 0;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}
.blog-editor-pane {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: clamp(1rem, 3vw, 2rem);
  overscroll-behavior: contain;
}
.blog-editor-pane[hidden] {
  display: none;
}
.blog-editor-block,
.blog-structured-editor {
  margin-top: 1.5rem;
  padding: clamp(1rem, 2.5vw, 1.5rem);
  border: 1px solid var(--line);
  background: #fff;
}
.blog-editor-block-heading,
.blog-pane-heading {
  align-items: flex-start;
  margin-bottom: 1rem;
}
.blog-editor-block-heading h3,
.blog-editor-block-heading p,
.blog-pane-heading h3,
.blog-pane-heading p,
.blog-section-actions,
.blog-podcast-panel h3,
.blog-podcast-panel p {
  margin: 0;
}
.blog-image-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 0.75rem;
}
.blog-image-card {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  background: var(--paper);
}
.blog-image-card > div {
  height: 105px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #eee9e4;
}
.blog-image-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.blog-image-card figcaption {
  display: grid;
  gap: 0.45rem;
  padding: 0.65rem;
}
.blog-image-card figcaption > strong {
  margin-bottom: 0.1rem;
}
.blog-image-card figcaption label {
  font-size: 0.72rem;
}
.blog-image-search-input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.75rem;
}
.blog-image-regenerate-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  min-height: 44px;
}
.blog-image-regenerate-button svg {
  flex: 0 0 auto;
}
.blog-image-card-actions {
  display: grid;
  gap: 0.45rem;
}
.blog-image-delete-button {
  width: 100%;
  min-height: 44px;
}
.blog-image-warning {
  grid-column: 1 / -1;
  margin: 0;
}
.blog-image-card.is-missing {
  border-color: #b42318;
}
.blog-image-missing {
  padding: 0.75rem;
  color: #8d1f17;
  font-size: 0.75rem;
  font-weight: 800;
  text-align: center;
}
.blog-image-upload-form {
  margin-top: 1rem;
}
.blog-section-list,
.blog-pair-list {
  display: grid;
  gap: 1rem;
}
.blog-section-editor {
  border: 1px solid var(--line);
  background: var(--paper);
}
.blog-section-heading {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem;
  border-bottom: 1px solid var(--line);
}
.blog-section-heading > span {
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  background: var(--raspberry);
  color: #fff;
  font-weight: 850;
}
.blog-section-heading input {
  border: 0;
  background: transparent;
  font:
    500 1.25rem Georgia,
    serif;
}
.blog-rich-toolbar {
  display: flex;
  gap: 0.35rem;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
  background: #f6f1eb;
}
.blog-rich-toolbar button {
  min-height: 34px;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}
.blog-rich-editor {
  min-height: 210px;
  padding: 1rem;
  background: #fff;
  line-height: 1.65;
  overflow: auto;
}
.blog-rich-editor:focus {
  outline: 3px solid var(--gold);
  outline-offset: -3px;
}
.blog-rich-editor table {
  width: 100%;
  border-collapse: collapse;
}
.blog-rich-editor td,
.blog-rich-editor th {
  border: 1px solid var(--line);
  padding: 0.5rem;
  white-space: normal;
}
.blog-section-actions {
  justify-content: flex-end;
  padding: 0.75rem;
  border-top: 1px solid var(--line);
}
.blog-structured-editor > summary {
  cursor: pointer;
  font:
    500 1.45rem Georgia,
    serif;
}
.blog-structured-body {
  margin-top: 1.25rem;
}
.blog-pair-row {
  display: grid;
  grid-template-columns: minmax(190px, 0.75fr) minmax(0, 1.5fr) auto;
  align-items: end;
  gap: 0.75rem;
  padding: 0.9rem;
  background: #f6f1eb;
}
.blog-slug-field,
.blog-read-time-field {
  display: flex;
  align-items: stretch;
}
.blog-slug-field span {
  display: flex;
  align-items: center;
  padding: 0 0.8rem;
  border: 1px solid var(--line);
  border-right: 0;
  background: #f6f1eb;
  color: var(--muted);
}
.blog-read-time-field input {
  min-width: 0;
}
.blog-read-time-field button {
  flex: 0 0 auto;
}
.blog-search-preview {
  display: grid;
  gap: 0.25rem;
  padding: 1.25rem;
  border-left: 4px solid var(--raspberry);
  background: #fff;
}
.blog-search-preview small {
  color: #166534;
}
.blog-search-preview strong {
  color: #1a0dab;
  font:
    500 1.25rem Georgia,
    serif;
}
.blog-search-preview p {
  margin: 0;
  color: var(--muted);
}
.blog-preview {
  width: 100%;
  min-height: 620px;
  border: 1px solid var(--line);
  background: #fff;
}
.blog-podcast-panel {
  display: grid;
  gap: 1.5rem;
}
.blog-podcast-quota {
  align-self: end;
  padding: 0.8rem 0;
  line-height: 1.5;
}
.blog-podcast-audio,
#blog-podcast-audio audio {
  width: 100%;
}
.blog-editor-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 3vw, 2rem);
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.blog-editor-footer .dialog-actions {
  margin: 0;
}
.blog-checkbox {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1rem;
}
.blog-checkbox input {
  width: auto;
}
.empty-state {
  min-height: 250px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.security-heading {
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}
.configuration-card {
  padding: clamp(1.5rem, 3vw, 2.5rem);
}
.configuration-settings-card {
  width: min(100%, 980px);
}
.optional-label {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
}
.invoice-archive-card {
  padding: clamp(1rem, 2.5vw, 1.5rem);
}
.invoice-archive-list {
  max-height: none;
  overflow: visible;
}
.invoice-archive-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.invoice-archive-item > span:first-child {
  min-width: 0;
}
.invoice-archive-amount {
  flex: 0 0 auto;
  display: grid;
  justify-items: end;
  color: var(--berry);
  font-weight: 850;
}
.invoice-archive-amount small {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
}
.security-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.5rem, 3vw, 2.5rem);
  align-items: stretch;
}
.security-card {
  padding: clamp(1.75rem, 4vw, 3rem);
}
.security-card h2 {
  font-size: clamp(1.9rem, 3vw, 2.5rem);
  line-height: 1.05;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}
.security-card-content {
  display: grid;
  justify-items: start;
  gap: 1.25rem;
}
.security-card-content > *,
.security-card-content p,
.security-password-intro p {
  margin: 0;
}
.security-state,
.security-password-intro p {
  color: var(--muted);
  line-height: 1.65;
}
.security-backup-list {
  max-height: none;
  gap: 0.9rem;
}
.security-password-card {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) minmax(0, 1.5fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
  margin-top: clamp(1.5rem, 3vw, 2.5rem);
}
.security-password-intro h2 {
  margin-bottom: 1rem;
}
.security-password-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  align-items: start;
}
.security-password-form .primary-button {
  grid-column: 1 / -1;
  justify-self: start;
  min-width: 220px;
}
.form-grid {
  display: grid;
  gap: 1rem;
  align-items: end;
}
.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.three-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.wide {
  grid-column: span 2;
}
.record-list {
  padding: 0;
  margin: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}
.record-list li {
  border-top: 1px solid var(--line);
  padding-top: 0.6rem;
}
.patient-sheet-workspace {
  margin-top: 2rem;
}
.patient-sheet-shell {
  border-top: 3px solid var(--raspberry);
  padding-top: 1.5rem;
}
.patient-sheet-toolbar,
.patient-sheet-toolbar-actions,
.patient-sheet-actions {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.patient-sheet-toolbar h3 {
  font:
    500 clamp(1.8rem, 3vw, 2.8rem) Georgia,
    serif;
  margin: 0.25rem 0;
}
.patient-sheet-toolbar-actions label {
  min-width: 180px;
}
.patient-sheet-form {
  display: grid;
  gap: 1rem;
}
.patient-sheet-section {
  border: 1px solid var(--line);
  background: #fff;
}
.patient-sheet-section > summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  font-weight: 850;
  cursor: pointer;
  list-style: none;
}
.patient-sheet-section > summary::-webkit-details-marker {
  display: none;
}
.patient-sheet-section > summary::after {
  content: '+';
  margin-left: auto;
  color: var(--raspberry);
  font-size: 1.25rem;
}
.patient-sheet-section[open] > summary::after {
  content: '−';
}
.patient-sheet-section > summary > span {
  width: 1.8rem;
  height: 1.8rem;
  display: inline-grid;
  place-items: center;
  background: var(--raspberry);
  color: #fff;
  font-size: 0.78rem;
}
.patient-sheet-section-body {
  border-top: 1px solid var(--line);
  padding: 1.15rem;
}
.patient-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.patient-result-grid article {
  min-height: 105px;
  padding: 1rem;
  background: var(--blush);
  border-left: 3px solid var(--raspberry);
}
.patient-result-grid article > span,
.patient-result-grid article > strong,
.patient-result-grid article > small {
  display: block;
}
.patient-result-grid article > span,
.patient-result-grid article > small {
  color: var(--muted);
  font-size: 0.76rem;
}
.patient-result-grid article > strong {
  color: var(--berry);
  font:
    500 1.45rem Georgia,
    serif;
  margin: 0.35rem 0;
}
.patient-toggle {
  grid-template-columns: auto 1fr;
  align-items: center;
  justify-content: start;
  margin: 0.75rem 0;
}
.patient-toggle input,
.patient-radio-group input {
  width: auto;
}
.patient-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  border: 1px solid var(--line);
  padding: 1rem;
}
.patient-radio-group label {
  grid-template-columns: auto 1fr;
  align-items: center;
}
.patient-inline-result,
.patient-main-result {
  padding: 0.75rem 1rem;
  background: #f6f1eb;
}
.patient-main-result {
  border-left: 3px solid var(--gold);
  font-size: 1.05rem;
}
.patient-food-table-wrap {
  margin-top: 0;
}
.patient-food-table input {
  min-width: 110px;
}
.patient-nutrient-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
  margin: 1rem 0;
}
.patient-nutrient-totals > span {
  padding: 0.75rem;
  border: 1px solid var(--line);
  background: var(--paper);
}
.patient-nutrient-totals strong,
.patient-nutrient-totals small {
  display: block;
}
.patient-nutrient-totals small {
  color: var(--muted);
}
.patient-warning {
  padding: 0.9rem 1rem;
  color: #7c2d12;
  background: #ffedd5;
  border-left: 3px solid var(--gold);
}
.patient-subheading {
  margin: 1.5rem 0 1rem;
}
.patient-subheading h4 {
  margin: 0;
}
.patient-custom-food-list {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.patient-custom-food {
  display: grid;
  grid-template-columns: 1fr 1fr 150px auto;
  align-items: end;
  gap: 0.75rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  background: #f6f1eb;
}
.patient-custom-nutrients {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 0.75rem;
}
.patient-macro-comparison {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0 0 1rem;
}
.patient-macro-comparison > span {
  display: grid;
  gap: 0.2rem;
  padding: 0.75rem;
  border-left: 3px solid var(--line);
  background: #f6f1eb;
}
.patient-macro-comparison > .in-range {
  border-left-color: #15803d;
  color: #166534;
}
.patient-macro-comparison > .out-of-range {
  border-left-color: #b91c1c;
  color: #991b1b;
}
.patient-child-curve {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.patient-child-curve-canvas {
  position: relative;
  width: min(100%, 900px);
  margin: 0 auto;
  cursor: crosshair;
}
.patient-child-curve-canvas img {
  display: block;
  width: 100%;
  height: auto;
}
.patient-child-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  color: #dc2626;
  font-size: 1.8rem;
  line-height: 1;
  font-weight: 900;
  text-shadow: 0 0 2px #fff;
  pointer-events: none;
}
.patient-child-coordinates {
  margin-top: 0.75rem;
}
.patient-sheet-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0.5rem;
}
.patient-sheet-actions > * {
  width: 100%;
}
.patient-history-link {
  border: 0;
  background: transparent;
  color: var(--berry);
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}
.patient-history-chart {
  margin-bottom: 1rem;
}
.patient-history-chart svg {
  width: 100%;
  max-height: 230px;
  background: #f6f1eb;
  border: 1px solid var(--line);
}
.patient-history-chart line {
  stroke: var(--line);
  stroke-width: 2;
}
.patient-history-chart polyline {
  fill: none;
  stroke: var(--raspberry);
  stroke-width: 4;
}
.patient-history-chart .macro-protein {
  stroke: var(--raspberry);
}
.patient-history-chart .macro-lipid {
  stroke: var(--gold);
}
.patient-history-chart .macro-carbohydrate {
  stroke: #2563eb;
}
.patient-history-chart circle {
  fill: var(--gold);
  stroke: var(--ink);
  stroke-width: 2;
}
.request-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}
.status-badge {
  align-items: center;
  display: inline-flex;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.status-new {
  background: var(--gold);
  color: var(--ink);
}
.status-treated {
  background: var(--ink);
  color: #fff;
}
.table-scroll {
  overflow: auto;
  margin-top: 1.25rem;
}
.table-scroll:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  padding: 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}
dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(760px, calc(100% - 2rem));
  max-height: calc(100svh - 2rem);
  border: 0;
  padding: 0;
  overflow: hidden;
  background: var(--paper);
}
dialog::backdrop {
  background: rgba(23, 20, 22, 0.7);
}
.dialog-card {
  padding: clamp(1rem, 4vw, 2rem);
  max-height: calc(100svh - 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.patient-dialog-card,
.confirmation-dialog-card {
  padding: clamp(1.5rem, 4vw, 2.5rem);
}
.patient-form-grid > label {
  min-width: 0;
  align-content: start;
}
.patient-source-summary,
.confirmation-dialog-summary {
  margin: 1.25rem 0;
  padding: 1rem;
  border-left: 4px solid var(--raspberry);
  background: var(--blush);
  color: var(--berry);
  font-weight: 750;
  line-height: 1.5;
}
#request-treatment-dialog {
  width: min(620px, calc(100% - 2rem));
}
.dialog-heading,
.dialog-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.dialog-heading h2 {
  font:
    500 2rem Georgia,
    serif;
}
.dialog-actions {
  justify-content: flex-end;
  margin-top: 1.5rem;
}
.accounting-detail-card {
  padding: clamp(1.5rem, 4vw, 2.5rem);
}
.accounting-supplier-dialog-card {
  padding: clamp(1.5rem, 4vw, 2.5rem);
}
.accounting-supplier-dialog-card > label {
  display: grid;
  gap: 0.45rem;
  margin-top: 1.5rem;
}
.accounting-supplier-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.75rem;
}
.accounting-supplier-control label {
  min-width: 0;
}
.accounting-supplier-control .ghost-button {
  min-height: 48px;
  white-space: nowrap;
}
.invoice-dialog-card {
  padding: clamp(1.5rem, 4vw, 2.5rem);
}
.invoice-client-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 1rem;
  margin: 1.25rem 0;
  padding: 1rem;
  border-left: 4px solid var(--raspberry);
  background: var(--blush);
}
.invoice-client-summary strong,
.invoice-client-summary span {
  overflow-wrap: anywhere;
}
.invoice-address-fieldset {
  margin: 1.5rem 0 0;
  padding: 1.25rem;
  border: 1px solid var(--line);
}
.invoice-address-fieldset legend {
  padding: 0 0.5rem;
  font-weight: 850;
}
.invoice-address-choice {
  display: flex;
  grid-column: 1 / -1;
  grid-template-columns: none;
  align-items: flex-start;
  gap: 0.7rem;
  margin-bottom: 1.25rem;
  line-height: 1.45;
}
.invoice-address-choice input {
  width: auto;
  flex: 0 0 auto;
  margin-top: 0.15rem;
}
.invoice-immutable-note {
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}
.accounting-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.35rem 2rem;
  margin: 2rem 0 0;
}
.accounting-detail-grid > div {
  min-width: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.accounting-detail-grid dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.accounting-detail-grid dd {
  margin: 0.45rem 0 0;
  font-weight: 700;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.accounting-detail-grid .wide {
  grid-column: 1 / -1;
}
.patient-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.danger-button {
  border: 1px solid #9f1239;
  color: #9f1239;
  background: #fff;
}
@media (max-width: 900px) {
  .split-layout {
    grid-template-columns: 1fr;
  }
  .three-columns {
    grid-template-columns: 1fr 1fr;
  }
  .admin-tabs {
    top: 76px;
  }
  .patient-custom-food {
    grid-template-columns: 1fr 1fr;
  }
  .patient-custom-nutrients {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .security-password-card {
    grid-template-columns: 1fr;
  }
  .blog-metrics {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
  }
  .blog-admin-heading {
    align-items: stretch;
    flex-direction: column;
  }
  .blog-admin-heading .blog-heading-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    margin-left: 0;
  }
  .blog-admin-heading .blog-heading-actions > button {
    width: 100%;
    min-height: 52px;
    white-space: normal;
  }
  .blog-list-item {
    grid-template-columns: 120px minmax(0, 1fr);
  }
  .blog-list-image {
    width: 120px;
    height: 90px;
  }
  .blog-list-controls {
    grid-column: 1 / -1;
    width: 22rem;
    max-width: 100%;
    justify-self: end;
  }
  .blog-image-grid {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }
}
@media (max-width: 620px) {
  .admin-header {
    position: static;
    align-items: flex-start;
  }
  .header-actions {
    flex-direction: column;
    align-items: flex-end;
  }
  .admin-tabs {
    top: 0;
  }
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .two-columns,
  .three-columns {
    grid-template-columns: 1fr;
  }
  .filter-toolbar,
  .invoice-filter-toolbar {
    grid-template-columns: 1fr;
  }
  .invoice-archive-item {
    align-items: flex-start;
    flex-direction: column;
  }
  .invoice-archive-amount {
    justify-items: start;
  }
  .wide {
    grid-column: auto;
  }
  .accounting-detail-grid {
    grid-template-columns: 1fr;
  }
  .accounting-detail-grid .wide {
    grid-column: auto;
  }
  .accounting-supplier-control {
    grid-template-columns: 1fr;
  }
  .accounting-supplier-control .ghost-button {
    width: 100%;
  }
  dialog {
    width: calc(100% - 1rem);
    max-height: calc(100svh - 1rem);
  }
  .dialog-card {
    max-height: calc(100svh - 1rem);
  }
  .admin-brand small {
    font-size: 0.58rem;
    letter-spacing: 0.1em;
  }
  .patient-sheet-toolbar,
  .patient-sheet-toolbar-actions,
  .patient-sheet-actions {
    align-items: stretch;
  }
  .patient-sheet-actions {
    grid-template-columns: 1fr;
  }
  .patient-sheet-toolbar-actions label,
  .patient-sheet-actions > * {
    width: 100%;
  }
  .patient-custom-food,
  .patient-custom-nutrients {
    grid-template-columns: 1fr;
  }
  .patient-macro-comparison {
    grid-template-columns: 1fr;
  }
  .security-grid,
  .security-password-form {
    grid-template-columns: 1fr;
  }
  .security-card {
    padding: 1.5rem;
  }
  .security-password-form .primary-button {
    width: 100%;
    min-width: 0;
  }
  .overview-request-table,
  .overview-request-table tbody,
  .overview-request-table tr,
  .overview-request-table td {
    display: block;
    width: 100%;
  }
  .overview-request-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .overview-request-table tbody {
    display: grid;
    gap: 1rem;
  }
  .overview-request-table tr {
    padding: 0.5rem 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
  .overview-request-table td,
  .overview-request-table td:last-child {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(6.75rem, 0.7fr) minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .overview-request-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .overview-request-table .request-actions {
    width: 100%;
    align-items: stretch;
    justify-content: flex-start;
    flex-direction: column;
    flex-wrap: nowrap;
  }
  .overview-request-table .request-actions > button {
    width: 100%;
    white-space: normal;
  }
  .overview-request-table .status-badge {
    justify-self: start;
  }
  .invoice-document-button {
    justify-self: start;
  }
  .overview-request-table .patient-record-button,
  .overview-request-table .invoice-create-button,
  .overview-request-table .request-treatment-button,
  .overview-request-table .invoice-document-button {
    width: 100%;
    justify-content: center;
  }
  .blog-admin-heading .blog-heading-actions,
  .blog-heading-actions,
  .blog-editor-block-heading,
  .blog-pane-heading {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }
  .blog-heading-actions > *,
  .blog-editor-block-heading > button,
  .blog-pane-heading > button {
    width: 100%;
  }
  .blog-admin-heading .blog-heading-actions {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-left: 0;
  }
  .blog-metrics {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
  .blog-filter-toolbar {
    grid-template-columns: 1fr;
  }
  .blog-list-item {
    grid-template-columns: 1fr;
  }
  .blog-list-image {
    width: 100%;
    height: 180px;
  }
  .blog-list-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .blog-list-actions > * {
    width: 100%;
  }
  .blog-list-controls {
    width: 100%;
  }
  .blog-list-statuses {
    grid-template-columns: 1fr;
  }
  .blog-editor-dialog {
    width: calc(100% - 0.5rem);
    height: calc(100svh - 0.5rem);
    max-height: calc(100svh - 0.5rem);
  }
  .blog-editor-heading {
    padding: 1rem;
  }
  .blog-editor-tabs {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  .blog-editor-pane {
    padding: 1rem;
  }
  .blog-image-grid {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
  }
  .blog-pair-row {
    grid-template-columns: 1fr auto;
  }
  .blog-pair-row label {
    grid-column: 1 / -1;
  }
  .blog-pair-row .icon-button {
    grid-column: 2;
  }
  .blog-editor-footer {
    align-items: stretch;
    flex-direction: column-reverse;
  }
  .blog-editor-footer > *,
  .blog-editor-footer .dialog-actions,
  .blog-editor-footer .dialog-actions > * {
    width: 100%;
  }
  .blog-editor-footer .dialog-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .blog-preview {
    min-height: 520px;
  }
}
@media print {
  .print-preview-instruction {
    display: none !important;
  }
  body.patient-sheet-printing .admin-header,
  body.patient-sheet-printing .admin-tabs,
  body.patient-sheet-printing .patient-sheet-toolbar-actions,
  body.patient-sheet-printing .patient-sheet-actions,
  body.patient-sheet-printing #patient-list-panel,
  body.patient-sheet-printing #edit-patient-button {
    display: none !important;
  }
  body.patient-sheet-printing .admin-main,
  body.patient-sheet-printing .content-card,
  body.patient-sheet-printing .patient-sheet-workspace {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
  }
  body.patient-sheet-printing .split-layout {
    display: block;
  }
  body.patient-sheet-printing .patient-sheet-section {
    break-inside: avoid;
  }
}
.patient-print-preview {
  background: var(--paper);
  padding: 1.5rem;
}
.print-preview-instruction {
  max-width: 1100px;
  margin: 0 auto 1rem;
  padding: 0.9rem 1rem;
  border-left: 4px solid var(--mustard);
  background: var(--white);
  font-weight: 700;
}
.print-preview-content {
  max-width: 1100px;
  margin: 0 auto;
  background: var(--white);
  padding: clamp(1rem, 3vw, 2.5rem);
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .button-loader {
    animation: none;
  }
}

/* A stopped generation must not retain its busy indicator. */
.blog-generation-state .button-loader[hidden] {
  display: none;
}
