/* Diet Planner — Official Design System
   Shared visual tokens and safe global foundations.
   Page-specific layout and behavior remain in their own files. */
html,body{min-height:100%;background:var(--dp-bg)}
body{
  background:var(--dp-bg)!important;
  color:var(--dp-text)!important;
  font-family:var(--dp-font);
  text-rendering:optimizeLegibility;
  -webkit-font-smoothing:auto;
  -moz-osx-font-smoothing:auto;
  font-synthesis:none;
  font-size:14px;
  line-height:1.65;
}
button,input,select,textarea{font-family:var(--dp-font)}
h1,h2,h3,h4,h5,h6{color:var(--dp-text)}

.title h1,.page-header h1,.page-title{
  font-size:clamp(22px,2.2vw,26px);
  line-height:1.35;
  font-weight:800;
}
.dashboard-section-heading h3,.measurements-table-heading h3,.section-title{
  font-size:17px;
  line-height:1.45;
  font-weight:800;
}
.text-slate-400,.text-gray-400{color:var(--dp-muted)}
.text-slate-500,.text-gray-500{color:var(--dp-text-2)}
.bg-slate-50,.bg-gray-50{background-color:var(--dp-surface-2)}
.bg-slate-100,.bg-gray-100{background-color:var(--dp-surface-3)}
.border-slate-100,.border-slate-200,.border-gray-100,.border-gray-200{border-color:var(--dp-border)}
a{ -webkit-tap-highlight-color:transparent }
:where(input,select,textarea){
  color:var(--dp-text);
  border-color:var(--dp-input-border);
}
:where(input,select,textarea):focus-visible{
  border-color:var(--dp-primary);
  outline:2px solid var(--dp-focus-ring);
  outline-offset:1px;
}
:where(button,a,[role="button"]):focus-visible{
  outline:2px solid var(--dp-focus-ring-strong);
  outline-offset:2px;
}

/* Central table-row interaction state.
   Rows opt in with .dp-themed-table-row; no page-specific hover colors. */
table tbody tr.dp-themed-table-row{
  background-color:var(--dp-surface);
  color:var(--dp-text);
  transition:background-color .14s ease;
}
table tbody tr.dp-themed-table-row > td{
  background-color:transparent;
  color:inherit;
  border-color:var(--dp-border);
}
table tbody tr.dp-themed-table-row:hover,
table tbody tr.dp-themed-table-row:focus-within{
  background-color:var(--dp-surface-3);
}
table tbody tr.dp-themed-table-row > td:is(.text-slate-800,.text-slate-700,.text-slate-600,.text-gray-800,.text-gray-700,.text-gray-600){
  color:var(--dp-text);
}
@media(prefers-reduced-motion:reduce){
  table tbody tr.dp-themed-table-row{transition:none}
}

/* Shared content surfaces: retain each page's geometry, unify finish. */
:where(.glass,.card,.main-container,.patient-name-bar,.dashboard-panel,.section-card,.toolbar,.tabs){
  border-color:var(--dp-border);
}
:where(.glass,.card,.main-container,.patient-name-bar,.dashboard-panel,.section-card,.toolbar,.tabs){
  box-shadow:0 2px 12px var(--dp-shadow);
}

/* Consistent primary action colors for shared action components. */
:is(.btn-primary,.dashboard-primary-btn,.followup-add-button,.measurements-add-button,.patient-save-actions button:first-child){
  background-color:var(--dp-primary);
}
:is(.btn-primary,.dashboard-primary-btn,.followup-add-button,.measurements-add-button,.patient-save-actions button:first-child):hover{
  background-color:var(--dp-primary-hover);
}
.bg-brand-500,.bg-brand-600,.bg-brand-700{background-color:var(--dp-primary)}
.text-brand-600,.text-brand-700{color:var(--dp-primary)}
.border-brand-500,.border-brand-600{border-color:var(--dp-primary)}

/* Branded application headers share one restrained green gradient. */
.patient-profile-page-header,
.profile-page-header,
.finance-page-header,
.about-branded-header,
.patient-page-header,
.feedback-branded-header,
.food-page-header,
.recipe-page-header,
.support-header{
  background:var(--dp-brand-gradient);
  color:#fff;
}
.patient-profile-page-header :where(h1,h2,h3),
.profile-page-header :where(h1,h2,h3),
.finance-page-header :where(h1,h2,h3),
.about-branded-header :where(h1,h2,h3),
.patient-page-header :where(h1,h2,h3),
.feedback-branded-header :where(h1,h2,h3),
.food-page-header :where(h1,h2,h3),
.recipe-page-header :where(h1,h2,h3),
.support-header :where(h1,h2,h3){color:#fff}

/* Quick calculator keeps its page-title treatment; the application header is
   rendered independently by css/app-header.css. */
body:has(#sub-content-quick-calc) .page-header{
  background:linear-gradient(118deg,#174D43 0%,#087F6B 68%,#066B5B 100%)!important;
  color:#fff!important;
  border-color:transparent!important;
}
body:has(#sub-content-quick-calc) .page-header :is(h1,h2,h3){color:#fff!important}
body:has(#sub-content-quick-calc) .page-header p{color:var(--dp-brand-subtle)!important}

/* =========================================================
   Readability normalization — centralized application layer
   Keep page layouts intact; normalize shared text contrast.
   ========================================================= */

/* Clinical text on light surfaces must remain clearly readable. */
.patient-fields label,
.dashboard-card-head p,
.patient-finance-heading small,
.patient-data-title small,
.patient-module-tab-copy small,
.measurements-table-heading p,
.measurements-table th span,
.measurements-table td,
.patient-finance-empty,
.patient-finance-access-note,
.finance-state,
.profile-plans-heading p,
.profile-plans-loading,
.profile-plans-empty,
.profile-subscribe-help,
.profile-detail-line strong,
.profile-confirm-message,
.dashboard-notification-action,
.dashboard-notification-date,
.dashboard-announcement-card p,
.dashboard-announcement-card-footer,
.articles-heading p,
.article-card-meta,
.article-card-footer,
.announcement-admin-meta,
.formula-section-title small,
.formula-title-wrap span,
.metric small,
.qc-tab small,
.field-hint,
.auth-bottom-note,
.editor:empty::before{
  color:var(--dp-text-2);
}

/* The dashboard hero is a branded surface: headings must not inherit
   the dark body heading color on its green gradient. */
body:has(.dashboard-services-section) main section .bg-gradient-to-l h1,
body:has(.dashboard-services-section) main section .bg-gradient-to-l h2,
body:has(.dashboard-services-section) main section .bg-gradient-to-l h3{
  color:#FFFFFF;
}
body:has(.dashboard-services-section) main section .bg-gradient-to-l p{
  color:#EAF5F2;
}



/* =========================================================
   Central semantic surfaces — patient workspace & plan editor
   Geometry stays page-owned; color, contrast and elevation
   are controlled only by the shared theme tokens.
   ========================================================= */
:where(
  .patient-name-bar,
  .dashboard-card,
  .patient-module-tab,
  .patient-module-panel,
  .measurements-table-wrap,
  .followup-days-card,
  .visit-embedded-panel,
  .assessment-section,
  .calc-card,
  .calc-result-neutral,
  .calc-result-bmr,
  .calc-result-tdee,
  .calc-result-group,
  .day-card,
  .day-panel,
  .day-summary-card,
  .support-day-delete-box
){
  background-color:var(--dp-surface);
  color:var(--dp-text);
  border-color:var(--dp-border);
}
:where(
  .dashboard-card-head h3,
  .patient-finance-heading strong,
  .patient-data-title strong,
  .patient-module-tab-copy strong,
  .measurements-table-heading h3,
  .followup-days-heading strong,
  .day-summary-heading strong,
  .day-card-title,
  .assessment-section h3,
  .assessment-section h4
){color:var(--dp-text)}
:where(
  .dashboard-card-head p,
  .patient-finance-heading small,
  .patient-data-title small,
  .patient-module-tab-copy small,
  .measurements-access-status,
  .measurements-table td,
  .followup-state,
  .day-card-meta,
  .day-summary-heading span
){color:var(--dp-text-2)}
:where(
  .patient-fields input,.patient-fields select,.patient-fields textarea,
  .patient-data-fields input,.patient-data-fields select,.patient-data-fields textarea,
  .patient-finance-fields input,.patient-finance-fields select,
  .inline-measurement-row input,.inline-measurement-row select,
  #daysContainer .day-title-input,
  #daysContainer input,#daysContainer select,#daysContainer textarea
){
  background:var(--dp-input);
  color:var(--dp-text);
  border-color:var(--dp-input-border);
}
:where(.patient-module-tab,.patient-module-panel,.dashboard-card,.followup-days-card,.assessment-section,.calc-card,.day-card){
  box-shadow:0 2px 12px var(--dp-shadow);
}
:where(.measurements-table th,#daysContainer .day-table th){
  background:var(--dp-surface-3);
  color:var(--dp-text-2);
  border-color:var(--dp-border);
}
:where(.measurements-table td,#daysContainer .day-table td){
  border-color:var(--dp-border);
}
:where(.patient-module-tab:hover,.dashboard-details>summary:hover,.dashboard-details[open]>summary){
  background:var(--dp-surface-2);
}
.patient-module-tab.is-active{
  background:color-mix(in srgb,var(--dp-primary) 14%,var(--dp-surface));
  border-color:var(--dp-primary);
}
