/* Shared, approved PRIMA ONE screen palette. Category and outcome colors remain semantic.
   Existing color fallbacks keep printed documents independent of the screen theme. */
@media screen {
  :root {
    /* 60 / 30 / 10: large surfaces / structure and text / actions. */
    --prima-arctic-white: #FFFFFF;
    color-scheme: light;
    --prima-screen-surface: var(--prima-bg,#FFFFFF);
    --prima-screen-ink: var(--prima-navy,#26344A);
    --prima-screen-muted: #515E71;
    --prima-screen-line: var(--prima-line,#26344A40);
    --prima-storm-grey: #26344A;
    /* Compatibility aliases for existing components. */
    --prima-porcelain: var(--prima-arctic-white);
    --prima-navy: var(--prima-storm-grey);
    --prima-graphite: var(--prima-storm-grey);
    --prima-orange: #FF5B14;
    --prima-on-orange: #24262C;
    --prima-blue: var(--prima-storm-grey);
    --prima-blue-dark: var(--prima-storm-grey);
    --prima-ink: var(--prima-storm-grey);
    --prima-muted: #515E71;
    --prima-bg: var(--prima-arctic-white);
    --prima-soft: #C5D0DA;
    --prima-line: #26344A40;
    --prima-focus: var(--prima-orange);
    --prima-nav-accent: var(--prima-orange);
    --prima-brand-accent: var(--prima-orange);
    --action-blue: var(--prima-storm-grey);
    --ink: var(--prima-storm-grey);
    --text: var(--prima-storm-grey);
    --muted: var(--prima-muted);
    --line: var(--prima-line);
    --bg: var(--prima-arctic-white);
    --surface: var(--prima-arctic-white);
    --surface-2: var(--prima-arctic-white);
    --surface-soft: var(--prima-soft);
    --surface-strong: var(--prima-soft);
    --text-secondary: var(--prima-muted);
    --text-tertiary: var(--prima-muted);
    --line-soft: var(--prima-line);
    --blue: var(--prima-storm-grey);
    --orange: var(--prima-orange);
    --orange-dark: var(--prima-storm-grey);
    --orange-soft: #FFE1CF;
    --accent: var(--prima-orange);
    --accent-hover: #F77938;
    --accent-soft: #FFE1CF;
    --soft: var(--prima-soft);
    --ui-bg: var(--prima-arctic-white);
    --ui-surface: var(--prima-arctic-white);
    --ui-ink: var(--prima-storm-grey);
    --ui-muted: var(--prima-muted);
    --ui-line: var(--prima-line);
    --ui-orange: var(--prima-orange);
    --ui-orange-dark: var(--prima-storm-grey);
    --ui-orange-soft: #FFE1CF;
    --ui-focus: var(--prima-orange);
  }
  html, body.prima-ui { background-color: var(--prima-bg); color: var(--prima-ink); }
  html body.prima-ui :is(.btn-primary,.btn-dark,button.primary,.button.primary,.login #loginSubmit) {
    --action-blue: var(--prima-blue);
    background: var(--prima-blue); border-color: var(--prima-blue); color: #fff;
  }
  html body.prima-ui :is(.btn-primary,.btn-dark,button.primary,.button.primary,.login #loginSubmit):hover:not(:disabled) {
    background: var(--prima-blue-dark); border-color: var(--prima-blue-dark); color: #fff;
  }
  body.prima-ui :is(input, select, textarea) { accent-color: var(--prima-blue); }
  html body.prima-ui :is(input, select, textarea, button, summary, a):focus-visible {
    outline-color: var(--prima-focus);
  }
  html body .prima-page-title::after,
  body :is(.dd-heading h1, .page-heading h1, .reports-heading h1) > span { color: var(--prima-orange); }
  body .brand-title span { color: var(--prima-brand-accent); }
  body :is(.kicker, .prima-page-eyebrow, .dd-eyebrow) { color: var(--prima-muted); }

  /* Navigation uses Navy with orange active markers. */
  .app-header .app-nav .app-nav-btn,
  #mobileNav .mobile-nav-btn,
  #mobileMoreSheet .mobile-sheet-item { color: #fff; }
  .app-header .app-nav .app-nav-btn:is(.active,[aria-current="page"])::before,
  #mobileMoreSheet .mobile-sheet-item:is(.active,[aria-current="page"])::before { background: var(--prima-nav-accent); }
  .app-header .app-nav .app-nav-btn:is(.active,[aria-current="page"]) .icon,
  #mobileMoreSheet .mobile-sheet-item:is(.active,[aria-current="page"]) .icon { color: var(--prima-nav-accent); }
  #mobileNav .mobile-nav-btn:is(.active,[aria-expanded="true"]) { box-shadow: inset 3px 0 var(--prima-nav-accent); }
  .app-header .app-nav .app-nav-btn:is(.active,[aria-current="page"]),
  #mobileMoreSheet .mobile-sheet-item:is(.active,[aria-current="page"]) { background: #ffffff24; }
  .app-header .app-header-subtitle { color: #ECEEF0; }
  html body .app-header-cta { background: #fff; color: var(--prima-blue-dark); border-color: #fff; }
  html body .app-header-cta:hover { background: var(--prima-soft); }

  /* Neutral filter selections, independent of WINDTRE / VERY brand markers. */
  html body button.prima-picker-option:is([aria-selected="true"],.is-highlighted),
  html body button.prima-picker-option:hover { background: var(--prima-soft); color: var(--prima-ink); }
  html body .prima-picker-tick { color: var(--prima-blue); }
  body :is(.registry-tabs,.progress-view-switch,.list-switch,.segment-switch,.segmented) button.active {
    color: var(--prima-blue-dark); background: var(--prima-soft);
  }
  body .filter-chip.active { color: var(--prima-blue-dark); background: var(--prima-soft); border-color: var(--prima-blue); }
  body .dd-kpi.dd-hero { background: var(--prima-blue); border-color: var(--prima-blue); }
  body .dd-kpi.dd-hero :is(span,small) { color: #fff; }
  body .dd-daily-total { color: var(--prima-blue); }
  body .dd-daily-forecast { background: var(--prima-soft); border-top: 0; border-radius: 10px; padding: 14px 12px; }
  body .dd-daily-forecast > strong { color: var(--prima-blue-dark); }
  body .dd-daily-details summary { display: list-item; list-style-position: inside; width: fit-content; padding: 12px 16px; border-radius: 8px; background: var(--prima-blue); color: #fff; font-weight: 600; }
  body .dd-daily-details[open] summary { background: var(--prima-soft); color: var(--prima-blue-dark); }
  body .dd-daily-compact .dd-daily-forecast { border-left: 0; padding: 14px 12px; }
  body .dd-projection-summary { background: var(--prima-soft); border-color: var(--prima-line); }
  body .dd-projection-summary :is(span,strong) { color: var(--prima-blue-dark); }
  body .dd-projection-summary p { color: var(--prima-muted); }
  body .dd-mix-estimate strong { color: var(--prima-blue-dark); }

  /* Single-series charts use Navy; category colors stay semantic. */
  body.prima-ui svg [fill="#055c9d"]:not(.print-sheet *,#archiveReportPreview *) { fill: var(--prima-blue); }
  body.prima-ui svg [stroke="#055c9d"]:not(.print-sheet *,#archiveReportPreview *) { stroke: var(--prima-blue); }
  body.prima-ui svg [stop-color="#055c9d"]:not(.print-sheet *,#archiveReportPreview *) { stop-color: var(--prima-blue); }
}
@media screen and (max-width:760px) {
  .app-header .app-header-subtitle { color: var(--prima-muted); }
}

/* Loaded after component styles in every screen document. Geometry is unchanged. */
@media screen {
  html:root, html:root body.prima-ui {
    background:var(--prima-arctic-white); color:var(--prima-storm-grey);
  }
  html:root body.prima-ui:has(>.app) { background-image:none; }
  html:root body.prima-ui :is(.card,.panel,.home-widget,.home-stat,.home-work-area,
    .dd-panel,.dd-kpi,.er-account,.er-rule-card,.registry-item,.login,
    .g-panel,.summary,.records-pane,.detail-pane,.turni-empty-state) {
    background:var(--prima-arctic-white); border-color:var(--prima-line); color:var(--prima-storm-grey);
  }
  html:root body.prima-ui :is(.essential-heading,.page-heading,.title-row,.reports-heading,.dd-heading,.card-head) {
    color:var(--prima-storm-grey);
  }
  html:root body.prima-ui .prima-page-title::after,
  html:root body.prima-ui .essential-heading h1::after,
  html:root body.prima-ui :is(.brand-title span,.dot) {
    color:var(--prima-orange);
  }
  html:root body.prima-ui :is(.btn,.button,.mini-btn) {
    --action-fill:var(--prima-arctic-white); --action-border:var(--prima-storm-grey); --action-ink:var(--prima-storm-grey);
  }
  html:root body.prima-ui :is(.btn-primary,.btn-dark,button.primary,.button.primary,a.primary,
    input[type="submit"],.dd-button,.login #loginSubmit,.login .mfa-primary,.app-header-cta,.compact-primary-actions .compact-save) {
    --action-fill:var(--prima-navy); --action-border:var(--prima-navy); --action-ink:#fff;
    background:var(--prima-navy); border-color:var(--prima-navy); color:#fff;
  }
  html:root body.prima-ui :is(.btn-primary,.btn-dark,button.primary,.button.primary,a.primary,
    input[type="submit"],.dd-button,.login #loginSubmit,.login .mfa-primary,.app-header-cta,.compact-primary-actions .compact-save):hover:not(:disabled) {
    background:var(--prima-navy); border-color:var(--prima-navy); color:#fff; filter:brightness(.96);
  }
  /* Preserve destructive/success actions instead of giving them a brand meaning. */
  html:root body.prima-ui :is(.btn-danger,.btn-danger-soft,.button.danger,.btn.delete) {
    --action-fill:#fff5f4; --action-border:var(--action-red,#b42318); --action-ink:var(--action-red,#b42318);
  }
  html:root body.prima-ui .btn-success {
    --action-fill:var(--action-green,#187647); --action-border:var(--action-green,#187647); --action-ink:#fff;
  }
  html:root body.prima-ui :is(input,select,textarea) {accent-color:var(--prima-orange);}
  html:root body.prima-ui :is(input,select,textarea,button,summary,a):focus-visible {
    outline:3px solid var(--prima-orange); outline-offset:3px;
  }
  html:root body.prima-ui :is(.registry-tabs,.progress-view-switch,.list-switch,.segment-switch,.segmented) button.active,
  html:root body.prima-ui .filter-chip.active,
  html:root body.prima-ui .tabs button.active,
  html:root body.prima-ui .segmented button[aria-pressed="true"],
  html:root body.prima-ui.turni-integrated .view-tabs .tab.active {
    background:var(--prima-bg); color:var(--prima-navy); border-color:var(--prima-orange); box-shadow:inset 0 -2px var(--prima-orange);
  }
  /* Cassa actions use navy; category and payment filters remain light. */
  html:root body.prima-ui #cash-register-app :is(.g-primary.btn-primary,
    .g-nav button[aria-pressed="true"],.g-payment button[aria-pressed="true"],.g-category[aria-pressed="true"]) {
    --action-fill:var(--prima-navy); --action-border:var(--prima-navy); --action-ink:#fff;
    background:var(--prima-navy); border-color:var(--prima-navy); color:#fff;
  }
  html:root body.prima-ui #cash-register-app :is(.g-primary.btn-primary,
    .g-nav button[aria-pressed="true"],.g-payment button[aria-pressed="true"],.g-category[aria-pressed="true"]):hover:not(:disabled) {
    background:var(--prima-navy); border-color:var(--prima-navy); color:#fff;
  }
  html:root body.prima-ui #cash-register-app .g-category[aria-pressed="true"] :is(strong,small) {color:#fff;}
  html:root body.prima-ui #cash-register-app :is(.g-category[aria-pressed="true"],.g-payment button[aria-pressed="true"]) {box-shadow:inset 0 0 0 1px var(--prima-orange);}
  html:root body.prima-ui #cash-register-app .g-category[aria-pressed="true"] svg {stroke:currentColor;}
  html:root body.prima-ui .prima-picker-option[aria-selected="true"] {
    background:var(--prima-bg); color:var(--prima-storm-grey); box-shadow:inset 3px 0 var(--prima-orange);
  }
  html:root body.prima-ui .dd-kpi.dd-hero {
    background:var(--prima-bg); border-color:var(--prima-line); color:var(--prima-navy);
  }
  html:root body.prima-ui .dd-kpi.dd-hero :is(span,small,strong) {color:var(--prima-navy);}
  html:root body.prima-ui .home-stat-icon {background:var(--prima-soft);color:var(--prima-storm-grey);}
  html:root body.prima-ui .home-mini-day.is-selected,
  html:root body.prima-ui .calendar-day.is-today .calendar-day-number {background:var(--prima-orange);color:var(--prima-on-orange);}
  html:root body.prima-ui.turni-integrated :is(.turni-store-tile.selected,.day-selector.selected,.archive-date.selected,.attendance-employee.selected) {
    background:var(--prima-bg); border-color:var(--prima-orange); color:var(--prima-storm-grey);
  }
  html:root body.prima-ui.turni-integrated .turni-store-tile.selected {box-shadow:inset 0 3px var(--prima-orange);}
  html:root body.prima-ui.turni-integrated .turni-store-tile.selected :is(.turni-store-name,.turni-store-detail),
  html:root body.prima-ui.turni-integrated .day-selector.selected strong {color:var(--prima-storm-grey);}

  /* Both sidebar and mobile sheet establish their own readable dark context. */
  html:root body.prima-ui #appHeader,
  html:root body.prima-ui #mobileMoreSheet .mobile-sheet-panel {
    --prima-ink:#FFF; --prima-muted:#FFFFFF; --prima-soft:#FFFFFF14;
    --prima-line:#FFFFFF40; --ink:#FFF; --muted:#FFFFFF;
    background:var(--prima-storm-grey); color:#FFF; border-color:var(--prima-storm-grey);
    backdrop-filter:none; -webkit-backdrop-filter:none;
  }
  html:root body.prima-ui #appHeader .prima-brand {background:var(--prima-navy);}
  html:root body.prima-ui #appHeader .prima-wordmark img,
  html:root body.prima-ui #mobileMoreSheet .mobile-compact-brand img {
    content:url('/icons/prima-one-wordmark-light.svg?v=palette-20261113');
  }
  html:root body.prima-ui #appHeader :is(.prima-workspace-caption,.app-header-subtitle,.account-session,.shared-bar),
  html:root body.prima-ui #appHeader .app-nav-group::before,
  html:root body.prima-ui #mobileMoreSheet :is(.account-session,.shared-bar,#mobileMenuRole) {color:#FFFFFF;}
  html:root body.prima-ui #appHeader .app-nav .app-nav-btn,
  html:root body.prima-ui #mobileMoreSheet .mobile-sheet-item,
  html:root body.prima-ui #mobileMoreSheet .mobile-sheet-head,
  html:root body.prima-ui #mobileMoreSheet details.mobile-sheet-group>summary,
  html:root body.prima-ui #appNav .app-nav-folder>summary {color:#FFF;background:transparent;}
  html:root body.prima-ui #appHeader .app-nav .app-nav-btn:is(.active,[aria-current="page"],:hover),
  html:root body.prima-ui #mobileMoreSheet .mobile-sheet-item:is(.active,[aria-current="page"],:hover),
  html:root body.prima-ui #appNav .app-nav-folder>summary:hover {background:#FFFFFF14;color:#FFF;box-shadow:none;}
  html:root body.prima-ui #appHeader .app-nav .app-nav-btn:is(.active,[aria-current="page"]) .icon,
  html:root body.prima-ui #mobileMoreSheet .mobile-sheet-item:is(.active,[aria-current="page"]) .icon {color:var(--prima-orange);}
  html:root body.prima-ui #appHeader .app-nav .app-nav-btn:is(.active,[aria-current="page"])::before,
  html:root body.prima-ui #mobileMoreSheet .mobile-sheet-item:is(.active,[aria-current="page"])::before {background:var(--prima-orange);}
  html:root body.prima-ui #mobileNav {background:var(--prima-storm-grey);border-color:var(--prima-storm-grey);}
  html:root body.prima-ui #mobileNav .mobile-nav-btn {background:transparent;color:#FFF;}
  html:root body.prima-ui #mobileNav .mobile-nav-btn .icon {color:inherit;}
  html:root body.prima-ui #mobileNav .mobile-nav-btn:is(.active,[aria-expanded="true"]) {
    background:#FFFFFF14;color:#FFF;box-shadow:inset 0 -3px var(--prima-orange);
  }
  html:root body.prima-ui #mobileNav:has(#mobileMoreBtn[aria-expanded="true"]) .mobile-nav-btn.active:not(#mobileMoreBtn) {
    background:transparent;color:#FFF;box-shadow:none;
  }
  html:root body.prima-ui #mobileMoreSheet .mobile-sheet-backdrop {background:var(--prima-storm-grey);}
  html:root body.prima-ui #mobileMoreSheet :is(.btn,.mobile-sheet-head button),
  html:root body.prima-ui #appHeader :is(.shared-bar .btn,.account-session button) {
    --action-fill:var(--prima-navy); --action-ink:#FFF; --action-border:#FFFFFF66;
    background:var(--prima-navy); color:#FFF; border-color:#FFFFFF66;
  }
}

/* White/orange wordmark belongs only to the dark navigation surfaces. */
@media screen {
  html:root body.prima-ui #appHeader .prima-wordmark img,
  html:root body.prima-ui #mobileMoreSheet .mobile-compact-brand img {
    content:url('/icons/prima-one-wordmark-light.svg?v=palette-20261113');
    background-color:var(--prima-navy);
  }
  html:root body.prima-ui #appHeader .prima-brand,
  html:root body.prima-ui #mobileMoreSheet .mobile-compact-brand {background:var(--prima-navy);}
  html:root body.prima-ui .login .logo {
    content:url('/icons/prima-one-wordmark.svg?v=palette-20261113');
    background-color:#fff;
  }

  /* Light titles and filters, scoped so state/track colours remain intact. */
  html:root body.prima-ui :is(.essential-heading,.page-heading,.title-row,.reports-heading,.dd-heading) {
    background-color:var(--prima-bg);color:var(--prima-navy);
  }
  html:root body.prima-ui :is(.prima-page-title,.essential-heading h1,.page-heading h1,.reports-heading h1,.dd-heading h1) {color:var(--prima-navy);}
  html:root body.prima-ui :is(.prima-page-title,.essential-heading h1)::after,
  html:root body.prima-ui :is(.page-heading h1,.reports-heading h1,.dd-heading h1)>span {color:var(--prima-orange);}
  html:root body.prima-ui:not(#archiveReportPreview) :is([data-prima-filters],.essential-filters) :is(input:not([type=checkbox],[type=radio],[type=hidden]),select,button.prima-picker-trigger):not(.prima-picker-native),
  html:root body.prima-ui :is(.prima-picker-panel,button.prima-picker-trigger,button.prima-picker-option),
  html:root body.prima-ui :is(#homeSalesMonth,#homeChecksMonth,#eveningCompanyDate,#weekSelect,.registry-status-filter select) {
    background:var(--prima-bg);color:var(--prima-navy);border-color:var(--prima-line);color-scheme:light;
  }
  html:root body.prima-ui .prima-picker-panel :is(input,select,option),
  html:root body.prima-ui select option {background:var(--prima-bg);color:var(--prima-navy);}
  html:root body.prima-ui :is(.prima-picker-chevron,.prima-picker-close,.prima-picker-heading,.prima-picker-tick) {color:var(--prima-navy);}
  html:root body.prima-ui button.prima-picker-option[aria-selected="true"] {background:var(--prima-bg);color:var(--prima-navy);box-shadow:inset 3px 0 var(--prima-orange);}
  html:root body.prima-ui #cash-register-app :is(.g-nav button[aria-pressed="true"],.g-payment button[aria-pressed="true"],.g-category[aria-pressed="true"]) {
    --action-fill:var(--prima-bg);--action-ink:var(--prima-navy);--action-border:var(--prima-orange);
    background:var(--prima-bg);color:var(--prima-navy);border-color:var(--prima-orange);
  }
  html:root body.prima-ui #cash-register-app :is(.g-nav button[aria-pressed="true"],.g-payment button[aria-pressed="true"],.g-category[aria-pressed="true"]):hover:not(:disabled) {
    background:var(--prima-bg);color:var(--prima-navy);border-color:var(--prima-orange);
  }
  html:root body.prima-ui #cash-register-app .g-category[aria-pressed="true"] :is(strong,small) {color:var(--prima-navy);}
}

/* On phones and Folds the header is on the white page, outside the dark menu. */
@media screen and (max-width:1100px) {
  html:root body.prima-ui:not(#archiveReportPreview) #appHeader {
    --prima-ink:var(--prima-navy);
    --prima-muted:#515E71;
    --prima-soft:#C5D0DA;
    --prima-line:#26344A40;
    --ink:var(--prima-navy);
    --muted:#515E71;
    background:#fff;
    color:var(--prima-navy);
  }
  html:root body.prima-ui #appHeader .prima-brand,
  html:root body.prima-ui #appHeader .prima-wordmark img {background:#fff;}
  html:root body.prima-ui #appHeader .prima-wordmark img {
    content:url('/icons/prima-one-wordmark-mobile.svg?v=palette-20261113');
  }
}
