/* Presets affect shared controls and surfaces. Calendar and payment statuses use their own colors. */
[data-theme-preset="forest"] {
  --forest: #173d31;
  --ink: #202a28;
  --theme-hover: #255542;
  --theme-accent: #cddfb2;
  --theme-soft: #edf3ec;
  --theme-border: #c8dac9;
  --theme-focus: #39765a;
  --paper: #faf9f6;
  --mist: #f3f5f4;
  --line: #e0e6e1;
  --muted: #546760;
}

[data-theme-preset="navy"] {
  --forest: #203755;
  --ink: #202a36;
  --theme-hover: #2e4c71;
  --theme-accent: #c5d9f3;
  --theme-soft: #eaf0f8;
  --theme-border: #c5d3e4;
  --theme-focus: #496b97;
  --paper: #f8fafc;
  --mist: #f0f3f7;
  --line: #dce3ed;
  --muted: #505f72;
}

[data-theme-preset="teal"] {
  --forest: #146b68;
  --ink: #1c3434;
  --theme-hover: #0c5452;
  --theme-accent: #bce5df;
  --theme-soft: #e7f4f1;
  --theme-border: #bcdad5;
  --theme-focus: #197a77;
  --paper: #f8fbfa;
  --mist: #eff5f4;
  --line: #d9e7e4;
  --muted: #4c6765;
}

[data-theme-preset="graphite"] {
  --forest: #303941;
  --ink: #24292d;
  --theme-hover: #444f58;
  --theme-accent: #d5dce3;
  --theme-soft: #eceff2;
  --theme-border: #cdd4dc;
  --theme-focus: #566572;
  --paper: #fafafa;
  --mist: #f2f3f5;
  --line: #e0e3e6;
  --muted: #52616c;
}

[data-theme-preset="custom"] {
  --forest: var(--custom-primary, #173d31);
  --ink: #24292d;
  --theme-hover: color-mix(in srgb, var(--forest), #000 13%);
  --theme-accent: color-mix(in srgb, var(--custom-accent, #cddfb2) 15%, #fff);
  --theme-soft: color-mix(in srgb, var(--custom-accent, #cddfb2) 9%, #fff);
  --theme-border: color-mix(in srgb, var(--custom-accent, #cddfb2) 24%, #fff);
  --theme-focus: var(--forest);
  --paper: var(--custom-background, #faf9f6);
  --mist: var(--paper);
  --line: #dfe3e7;
  --muted: #46535d;
}

body[data-theme-preset] {
  --lime: var(--theme-accent);
  --sage: var(--theme-border);
  --surface-soft: var(--mist);
  --surface-hover: var(--theme-soft);
  --text-secondary: var(--muted);
  color: var(--ink);
}

body.app-public[data-theme-preset] { background-color: var(--paper); }
body.app-work[data-theme-preset] { background-color: var(--mist); }
body[data-theme-preset] ::selection { background-color: var(--theme-accent); color: var(--ink); }
body[data-theme-preset] :where(button, a, input, textarea, select, summary):focus-visible { outline-color: var(--theme-focus); }
body[data-theme-preset] .eyebrow { color: var(--forest); }
body[data-theme-preset] .site-header { background-color: var(--paper); }
body[data-theme-preset] .site-header nav a:where(:not(.button)) { color: var(--muted); }
body[data-theme-preset] .site-header nav a:where(:not(.button)):is(:hover, [aria-current="page"]) { color: var(--forest); }
body[data-theme-preset] .site-footer { color: var(--muted); }
body[data-theme-preset] :is(.genqi-hero, .home-booking-section) { background-color: var(--mist); }

body[data-theme-preset] .button:where(:not(.button-outline, .button-danger)):hover {
  background-color: var(--theme-hover);
  border-color: var(--theme-hover);
  color: #fff;
}
body[data-theme-preset] :is(.button-outline, .icon-button):hover {
  background-color: var(--theme-soft);
  border-color: var(--theme-border);
  color: var(--forest);
}

body.app-work[data-theme-preset] .site-header { background-color: #fff; }
body[data-theme-preset] .sidebar-navigation :is(a, .ui-icon) { color: var(--muted); }
body[data-theme-preset] .sidebar-navigation a:hover { background-color: var(--mist); color: var(--forest); }
body[data-theme-preset] .sidebar-navigation a[aria-current="page"] {
  background-color: var(--theme-soft);
  border-color: var(--theme-border);
  color: var(--forest);
}
body[data-theme-preset] .sidebar-navigation a[aria-current="page"] .ui-icon { color: var(--forest); }
body[data-theme-preset] :is(.accounting-tabs, .work-section-tabs) { background-color: var(--theme-soft); border-color: var(--theme-border); }
body[data-theme-preset] :is(.work-section-tabs > button, .accounting-tabs > a) { color: var(--forest); }
body[data-theme-preset] .work-section-tabs > button:hover { background-color: var(--theme-border); }
body[data-theme-preset] .work-section-tabs > button:is([aria-current="true"], [aria-pressed="true"]) { background-color: var(--forest); color: #fff; }
body[data-theme-preset] .clinic-overview { --overview-ink: var(--forest); --overview-line: var(--line); --overview-soft: var(--mist); }
body[data-theme-preset] .overview-shortcut-icon { background-color: var(--theme-soft); color: var(--forest); }
body[data-theme-preset] :is(.work-table, .gs-table, .ch-table) th { background-color: var(--mist); color: var(--muted); }
body[data-theme-preset] .work-table { color: var(--ink); }
body[data-theme-preset] .work-table td { border-bottom-color: var(--line); }
body[data-theme-preset] .work-table td strong { color: var(--ink); }
body[data-theme-preset] .work-table td small { color: var(--muted); }
body[data-theme-preset] .work-table tbody tr:hover { background-color: var(--paper); }
body[data-theme-preset] .work-table tbody tr:has([data-grid-select]:checked) { background-color: var(--theme-soft); }
body[data-theme-preset] :is(.bulk-actions, .table-delete-toolbar) { background-color: var(--paper); border-color: var(--line); }
body[data-theme-preset] .table-delete-views button[aria-pressed="true"] { background-color: var(--forest); border-color: var(--forest); }
body[data-theme-preset] .table-delete-toolbar input[type="checkbox"],
body[data-theme-preset] .table-delete-check input[type="checkbox"] { accent-color: var(--forest); }

.theme-settings .theme-back { display: inline-block; margin-bottom: .75rem; color: var(--forest); font-size: .8125rem; font-weight: 650; }
.theme-scopes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 355px), 1fr)); gap: 1.1rem; }
.theme-scope { min-width: 0; display: grid; gap: 1.25rem; padding: clamp(1rem, 2.5vw, 1.75rem); border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: var(--shadow-card); }
.theme-scope h2 { margin: 0; font-size: 1.15rem; }
.theme-scope-heading p { margin: .2rem 0 0; color: var(--muted); font-size: .83rem; }
.theme-demo { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); font-size: .72rem; }
.theme-demo-header { display: flex; align-items: center; gap: .65rem 1.05rem; flex-wrap: wrap; padding: .65rem .9rem; border-bottom: 1px solid var(--line); background: #fff; }
.theme-demo-header strong { margin-inline-end: auto; color: var(--forest); font-size: .875rem; }
.theme-demo-header span { color: var(--muted); }
.theme-demo-hero { min-height: 114px; display: grid; justify-items: start; align-content: center; gap: .55rem; padding: .85rem 1rem; }
.theme-demo-hero strong { font-size: clamp(.9rem, 2.2vw, 1.15rem); }
.theme-demo-button { display: inline-flex; width: fit-content; padding: .28rem .6rem; border-radius: 5px; background: var(--forest); color: #fff; font-weight: 650; font-size: .69rem; }
.theme-demo-workspace { min-height: 114px; display: grid; grid-template-columns: auto minmax(0, 1fr); background: var(--mist); }
.theme-demo-sidebar { display: grid; align-content: start; gap: .35rem; padding: .55rem; border-right: 1px solid var(--line); background: #fff; }
.theme-demo-sidebar > * { padding: .25rem .45rem; border-radius: 5px; }
.theme-demo-sidebar strong { background: var(--theme-soft); color: var(--forest); }
.theme-demo-table { min-width: 0; margin: .65rem; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.theme-demo-row { display: flex; align-items: center; justify-content: space-between; gap: .3rem; flex-wrap: wrap; padding: .4rem .55rem; }
.theme-demo-row + .theme-demo-row { border-top: 1px solid var(--line); color: var(--muted); }
.theme-options { min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; margin: 0; padding: 0; border: 0; }
.theme-options legend { padding: 0; margin-bottom: .55rem; font-size: .78rem; font-weight: 700; }
.theme-option { min-width: 0; min-height: 44px; display: flex; align-items: center; gap: .45rem; padding: .55rem; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); font-size: .76rem; font-weight: 600; cursor: pointer; }
.theme-settings .theme-options input[type="radio"] { flex: none; width: 16px; min-width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; accent-color: var(--forest); }
.theme-option:has(:checked) { background: var(--theme-soft); border-color: var(--theme-border); }
.theme-option:has(:focus-visible) { outline: 2px solid var(--theme-focus); outline-offset: 2px; }
.theme-swatch { flex: none; width: 19px; height: 19px; border: 1px solid var(--theme-border); border-radius: 50%; background: var(--forest); }
.theme-swatch[data-theme-preset="custom"] { background: conic-gradient(#315b82 0 33%, #a25973 33% 66%, #40816e 66%); }
.theme-option > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.theme-custom { min-width: 0; margin: 0; padding: .85rem; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.theme-custom legend { padding: 0 .25rem; font-size: .78rem; font-weight: 700; }
.theme-color-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 117px), 1fr)); gap: .65rem; }
.theme-color { min-width: 0; font-size: .75rem; font-weight: 650; }
.theme-color > div { display: flex; align-items: stretch; gap: .35rem; margin-top: .3rem; }
.theme-settings .theme-color input[type="color"] { flex: 0 0 37px; width: 37px; min-height: 38px; padding: 4px; cursor: pointer; }
.theme-settings .theme-color input[type="text"] { flex: 1; min-height: 38px; padding: .3rem .35rem; font-size: .75rem; font-variant-numeric: tabular-nums; text-transform: uppercase; }
.theme-settings .theme-color input[aria-invalid="true"] { border-color: #a83f42; }
.theme-custom p { margin: .6rem 0 0; color: var(--muted); font-size: .71rem; }
.theme-save { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .8rem; margin-top: 1.15rem; }
.theme-save p { color: var(--muted); margin: 0; font-size: .83rem; }
.theme-save p[data-error="true"] { color: #a83f42; }
.theme-save-actions { display: flex; gap: .65rem; flex-wrap: wrap; }
