/* Diário de Pressão 25.7.5.3 — Ocean Design System I01
   Contrato visual semântico. Não altera lógica clínica, schema ou Sync. */
:root{
  /* Brand */
  --ods-brand-700:#541B32;
  --ods-brand-600:#782C47;
  --ods-brand-500:#963C5C;
  --ods-accent-500:#A54A68;
  --ods-accent-400:#C78098;

  /* Neutral / surfaces */
  --ods-bg:#FAF6ED;
  --ods-surface:#FFFCF5;
  --ods-surface-raised:#FFFCF5;
  --ods-surface-soft:#F5EDE2;
  --ods-surface-muted:#EADFD2;
  --ods-text-strong:#31111d;
  --ods-text:#65233b;
  --ods-text-muted:#ae3d66;
  --ods-border:#D8C1BA;
  --ods-border-soft:#E8DCD2;
  --ods-border-strong:#B68B91;

  /* Semantic states: intentionally separate from the pressure traffic-light palette. */
  --ods-success:#067647;
  --ods-success-soft:#ECFDF3;
  --ods-warning:#B54708;
  --ods-warning-soft:#FFFAEB;
  --ods-danger:#B42318;
  --ods-danger-soft:#FEF3F2;
  --ods-info:#782C47;
  --ods-info-soft:#F5EDE2;

  /* Typography */
  --ods-font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
  --ods-fs-11:.6875rem;
  --ods-fs-12:.75rem;
  --ods-fs-13:.8125rem;
  --ods-fs-14:.875rem;
  --ods-fs-16:1rem;
  --ods-fs-18:1.125rem;
  --ods-fs-22:1.375rem;
  --ods-fs-26:1.625rem;
  --ods-lh-tight:1.2;
  --ods-lh-body:1.5;

  /* Spacing */
  --ods-space-1:4px;
  --ods-space-2:8px;
  --ods-space-3:12px;
  --ods-space-4:16px;
  --ods-space-5:20px;
  --ods-space-6:24px;
  --ods-space-8:32px;

  /* Shape */
  --ods-radius-sm:10px;
  --ods-radius-md:12px;
  --ods-radius-lg:16px;
  --ods-radius-xl:20px;
  --ods-radius-2xl:24px;
  --ods-radius-pill:999px;

  /* Elevation */
  --ods-shadow-1:0 2px 8px rgba(84,27,50,.06);
  --ods-shadow-2:0 8px 24px rgba(84,27,50,.09);
  --ods-shadow-3:0 16px 42px rgba(84,27,50,.13);

  /* Interaction */
  --ods-control-h:44px;
  --ods-control-h-lg:48px;
  --ods-focus:0 0 0 4px rgba(165,74,104,.20);
  --ods-transition:140ms ease;

  /* Compatibility aliases consumed by legacy screens while migration is incremental. */
  --theme-primary:var(--ods-brand-600)!important;
  --theme-secondary:var(--ods-brand-700)!important;
  --theme-primary-soft:var(--ods-info-soft)!important;
  --bg:var(--ods-bg)!important;
  --card:var(--ods-surface-raised)!important;
  --ink:var(--ods-text-strong)!important;
  --muted:var(--ods-text-muted)!important;
  --line:var(--ods-border-soft)!important;
  --surface:var(--ods-surface-raised)!important;
  --surface-soft:var(--ods-surface-soft)!important;
  --primary:var(--ods-brand-600)!important;
  --primary-soft:var(--ods-info-soft)!important;
  --green:var(--ods-success)!important;
  --amber:var(--ods-warning)!important;
  --red:var(--ods-danger)!important;
  --app-font:var(--ods-font)!important;
  --radius:var(--ods-radius-xl)!important;
  --shadow:var(--ods-shadow-2)!important;

  --dp-surface-app:var(--ods-bg)!important;
  --dp-surface-card:var(--ods-surface-raised)!important;
  --dp-surface-raised:var(--ods-surface)!important;
  --dp-surface-soft:var(--ods-surface-soft)!important;
  --dp-ink-strong:var(--ods-text-strong)!important;
  --dp-ink:var(--ods-text)!important;
  --dp-muted:var(--ods-text-muted)!important;
  --dp-line:var(--ods-border-soft)!important;
  --dp-line-strong:var(--ods-border)!important;
}

html[data-theme="dark"]{
  --ods-bg:#18090e;
  --ods-surface:#290e18;
  --ods-surface-raised:#33121e;
  --ods-surface-soft:#431727;
  --ods-surface-muted:#4b1b2c;
  --ods-text-strong:#FAF6ED;
  --ods-text:#E8DCD2;
  --ods-text-muted:#dda0b6;
  --ods-border:#842f4e;
  --ods-border-soft:#68253d;
  --ods-border-strong:#b23e69;
  --ods-info-soft:#431727;
  --ods-success-soft:#153524;
  --ods-warning-soft:#3B2416;
  --ods-danger-soft:#3A2023;
  --ods-shadow-1:0 2px 8px rgba(0,0,0,.18);
  --ods-shadow-2:0 10px 28px rgba(0,0,0,.24);
  --ods-shadow-3:0 18px 48px rgba(0,0,0,.34);
  --ods-focus:0 0 0 4px rgba(165,74,104,.28);
}

html{font-family:var(--ods-font);text-rendering:optimizeLegibility}
body{color:var(--ods-text-strong);font-family:var(--ods-font);line-height:var(--ods-lh-body)}

/* Typography contract */
:where(h1,h2,h3,h4,strong,.screen-title,.section-title){color:var(--ods-text-strong)}
:where(.section-sub,.muted,.helper-text,.field-help,small){text-wrap:pretty}
:where(.section-sub,.helper-text,.field-help){color:var(--ods-text-muted)!important;line-height:var(--ods-lh-body)}

/* Surface contract */
:where(.card,.analytics-panel,.study-info,.timeline-row,.feature-card,.system-card,.report-card,.analysis-section,.weekly-panel,.settings-panel,.history-panel,.sync-card,.notification-item,.native-sheet,.native-sheet-card,.pressure-guide-modal,.medication-question-card){
  background:var(--ods-surface-raised)!important;
  border-color:var(--ods-border-soft)!important;
  color:var(--ods-text-strong)!important;
}
:where(.card,.analytics-panel,.feature-card,.system-card,.report-card,.analysis-section,.weekly-panel){box-shadow:var(--ods-shadow-1)}
:where(.stat,.smart-metric,.agenda-item,.recent-mini-item,.home-favorite-chip,.profile-summary-item,.dashboard-config-row,.care-metric,.care-row,.care-change){
  background:var(--ods-surface)!important;
  border-color:var(--ods-border-soft)!important;
  color:var(--ods-text-strong)!important;
}

/* Form controls */
:where(input:not([type="checkbox"]):not([type="radio"]),select,textarea){
  min-height:var(--ods-control-h)!important;
  background:var(--ods-surface-raised)!important;
  color:var(--ods-text-strong)!important;
  border:1px solid var(--ods-border)!important;
  border-radius:var(--ods-radius-md)!important;
  transition:border-color var(--ods-transition),box-shadow var(--ods-transition),background var(--ods-transition)!important;
}
:where(input,textarea)::placeholder{color:var(--ods-text-muted)!important;opacity:.92}
:where(input:not([type="checkbox"]):not([type="radio"]),select,textarea):focus{
  border-color:var(--ods-accent-500)!important;
  box-shadow:var(--ods-focus)!important;
  outline:0!important;
}
:where(input,select,textarea):disabled{background:var(--ods-surface-soft)!important;color:var(--ods-text-muted)!important;cursor:not-allowed;opacity:.78}
label{color:var(--ods-text)!important}

/* Buttons */
:where(button,.btn){min-height:var(--ods-control-h);border-radius:var(--ods-radius-md)!important;transition:transform var(--ods-transition),background var(--ods-transition),border-color var(--ods-transition),box-shadow var(--ods-transition),opacity var(--ods-transition)}
:where(.primary){background:var(--ods-brand-600)!important;color:#FAF6ED!important;border:1px solid transparent!important;box-shadow:0 6px 16px rgba(100,35,59,.18)!important}
:where(.secondary){background:var(--ods-surface-soft)!important;color:var(--ods-brand-700)!important;border:1px solid var(--ods-border-soft)!important}
:where(.ghost){background:transparent!important;color:var(--ods-text)!important;border:1px solid var(--ods-border)!important}
:where(.danger){background:var(--ods-danger-soft)!important;color:var(--ods-danger)!important;border:1px solid color-mix(in srgb,var(--ods-danger) 28%,var(--ods-border-soft))!important}
html[data-theme="dark"] :where(.secondary){color:var(--ods-text-strong)!important}
html[data-theme="dark"] :where(.danger){color:#FECDCA!important}
:where(button,.btn):disabled{opacity:.48!important;cursor:not-allowed!important;transform:none!important;box-shadow:none!important}
@media (hover:hover){
  :where(.primary):hover{background:var(--ods-brand-700)!important;transform:translateY(-1px)}
  :where(.secondary,.ghost):hover{background:var(--ods-surface-soft)!important;border-color:var(--ods-border-strong)!important}
}

/* Focus visibility — keyboard/assistive navigation */
:where(button,a,input,select,textarea,[role="button"],[tabindex]):focus-visible{
  outline:3px solid var(--ods-accent-500)!important;
  outline-offset:2px!important;
  box-shadow:var(--ods-focus)!important;
}

/* Hub/navigation component contract */
:where(.section-hub-button,.settings-hub-button){
  background:var(--ods-surface)!important;
  border-color:var(--ods-border-soft)!important;
  border-radius:var(--ods-radius-lg)!important;
  box-shadow:var(--ods-shadow-1)!important;
}
:where(.section-hub-button,.settings-hub-button) > :where(.section-hub-icon,.settings-hub-icon){background:var(--ods-info-soft)!important;color:var(--ods-brand-600)!important}
:where(.section-hub-button,.settings-hub-button) strong{color:var(--ods-text-strong)!important}
:where(.section-hub-button,.settings-hub-button) span{color:var(--ods-text-muted)}
.bottom-nav{background:var(--ods-brand-700)!important}
.bottom-nav a.active{background:#FAF6ED!important;color:var(--ods-brand-700)!important}
.bottom-nav a.active .nav-label{color:var(--ods-brand-700)!important}
.bottom-nav a.active .nav-icon-box{background:linear-gradient(145deg,var(--ods-brand-600),var(--ods-brand-700))!important;color:#FAF6ED!important}

/* Sheets / dialogs */
:where(.native-sheet,.medication-question-card,.pressure-guide-modal,.assisted-measurement-sheet){
  border-radius:var(--ods-radius-2xl)!important;
  box-shadow:var(--ods-shadow-3)!important;
}
:where(.native-sheet-handle){background:var(--ods-border)!important}

/* Tables */
:where(.table-wrap,.trend-table-wrap){border-color:var(--ods-border-soft)!important;border-radius:var(--ods-radius-lg)!important;background:var(--ods-surface-raised)!important}
:where(th){background:var(--ods-surface-soft)!important;color:var(--ods-text)!important;border-bottom-color:var(--ods-border)!important}
:where(td){color:var(--ods-text)!important;border-bottom-color:var(--ods-border-soft)!important}

/* Chips and neutral badges. Clinical status chips keep their own semantic/traffic-light classes. */
:where(.pill,.tag-chip,.medication-chip,.optional-badge){background:var(--ods-info-soft)!important;color:var(--ods-brand-700)!important;border-color:var(--ods-border)!important}
html[data-theme="dark"] :where(.pill,.tag-chip,.medication-chip,.optional-badge){color:var(--ods-text-strong)!important}

/* Alerts and generic semantic state utilities. */
.ods-state-success{background:var(--ods-success-soft)!important;color:var(--ods-success)!important;border-color:color-mix(in srgb,var(--ods-success) 28%,var(--ods-border-soft))!important}
.ods-state-warning{background:var(--ods-warning-soft)!important;color:var(--ods-warning)!important;border-color:color-mix(in srgb,var(--ods-warning) 28%,var(--ods-border-soft))!important}
.ods-state-danger{background:var(--ods-danger-soft)!important;color:var(--ods-danger)!important;border-color:color-mix(in srgb,var(--ods-danger) 28%,var(--ods-border-soft))!important}
.ods-state-info{background:var(--ods-info-soft)!important;color:var(--ods-info)!important;border-color:var(--ods-border)!important}

/* Motion & accessibility */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
}
@media (prefers-contrast:more){
  :root{--ods-border:var(--ods-brand-600);--ods-border-soft:var(--ods-border);--ods-focus:0 0 0 4px rgba(165,74,104,.34)}
  :where(input,select,textarea,.card,.native-sheet,.medication-question-card){border-width:2px!important}
}

/* Mobile density: keep 44px targets while trimming excess chrome. */
@media (max-width:560px){
  :root{--ods-radius-xl:18px;--ods-radius-2xl:20px;--ods-space-6:20px;--ods-space-8:28px}
  :where(.card,.analytics-panel,.analysis-section,.report-card){padding:14px!important}
}
