/* Shared screen surfaces follow the Android contrast palette. Keep row density,
   semantic status colors, focus behavior and printed documents in their own CSS. */
@media screen {
  :root {
    --box-page: #e9eef3;
    --box-outline: #6f8395;
    --box-inner-outline: #8c9cab;
    --box-heading: #e1e8f0;
    --box-subtle: #f5f8fb;
    --box-shadow: 0 3px 12px rgb(19 39 56 / 9%), 0 1px 2px rgb(19 39 56 / 7%);
    --box-inner-shadow: 0 1px 4px rgb(19 39 56 / 7%);
  }

  #app-shell,
  #app-shell .workspace-main,
  #operations-shell,
  #operations-shell .main-shell {
    background: var(--box-page);
  }

  /* Main cards have a visible frame even when the page is viewed on a phone. */
  :is(#app-shell, #modal-root) :is(
    .card, .stat-card, .metric-card, .drilldown-group, .nested-disclosure,
    .ana-card, .ana-kpi, .ana-toolbar
  ):not(.note, .notice, .info-banner, .alert, .invoice-packet-notice, .invoice-document-compact) {
    border: 1.5px solid var(--box-outline);
    box-shadow: var(--box-shadow);
  }

  :is(#app-shell, #modal-root) :is(.card-header, .recipe-card-top, .ana-card-head) {
    background: var(--box-heading);
    border-bottom: 1px solid var(--box-inner-outline);
  }

  :is(#app-shell, #modal-root) :is(.card-header, .recipe-card-top, .ana-card-head) :is(p, .eyebrow, .ana-eyebrow),
  :is(#app-shell, #modal-root) .invoice-review-fold > summary > span {
    color: #405565;
  }

  :is(#app-shell, #modal-root) :is(.drilldown-group, .nested-disclosure)[open] > summary {
    border-bottom: 1px solid var(--box-inner-outline);
  }

  /* Keep distinct sections within a form visible without boxing every row. */
  :is(#app-shell, #modal-root) :is(
    .cul-line, .event-invoice-line, .recipe-component-picker, .recipe-component-results
  ) {
    border-color: var(--box-inner-outline);
    box-shadow: var(--box-inner-shadow);
  }

  #modal-root .cul-inventory-link-card {
    border: 1.5px solid #71925d;
    box-shadow: var(--box-inner-shadow);
  }

  #modal-root .cul-recipe-ingredients {
    border: 1.5px solid #5d9390;
    box-shadow: var(--box-inner-shadow);
  }

  /* Invoice fields, review groups and totals remain easy to distinguish. */
  :is(#app-shell, #modal-root) .invoice-review-page :is(
    .invoice-review-line, .invoice-review-fold, .invoice-review-toolbar,
    .invoice-review-footer, .invoice-comparison-all
  ),
  :is(#app-shell, #modal-root) .invoice-review-flow #supplier-reviewed-source-lines,
  #supplier-invoice-list .invoice-history-record {
    border: 1.5px solid var(--box-outline);
    box-shadow: var(--box-inner-shadow);
  }

  :is(#app-shell, #modal-root) .invoice-review-flow #supplier-reviewed-source-lines {
    border-width: 2px;
  }

  :is(#app-shell, #modal-root) .invoice-review-flow #supplier-reviewed-source-lines > summary,
  :is(#app-shell, #modal-root) .invoice-review-fold > summary {
    background: var(--box-heading);
  }

  :is(#app-shell, #modal-root) :is(
    .invoice-review-totals, .invoice-comparison-summary, .event-invoice-totals
  ) {
    border: 1.5px solid var(--box-outline);
    background: #e8f0f5;
    box-shadow: var(--box-inner-shadow);
  }

  /* Colored insight boxes keep their meaning while gaining a firmer edge. */
  :is(#app-shell, #modal-root) .ana-insight {
    border-color: #729686;
    box-shadow: var(--box-inner-shadow);
  }
  :is(#app-shell, #modal-root) .ana-insight.orange { border-color: #bd8c52; }
  :is(#app-shell, #modal-root) .ana-insight.blue { border-color: #7e9aaa; }

  #modal-root :is(.modal, .dialog),
  #operations-confirm {
    border: 1.5px solid var(--box-outline);
    box-shadow: 0 18px 60px rgb(19 39 56 / 24%);
  }
  #modal-root :is(.modal-header, .dialog-header) {
    background: var(--box-heading);
    border-bottom-color: var(--box-inner-outline);
  }
  #modal-root :is(.modal-footer, .dialog-footer) {
    background: var(--box-subtle);
    border-top-color: var(--box-inner-outline);
  }

  /* Neutral input edges only; focus, validation and disabled states stay intact. */
  :is(#app-shell, #modal-root) :is(input, select, textarea):not(
    [type=checkbox], [type=radio], [type=range], [type=hidden], [type=color],
    [type=button], [type=submit], [type=reset], [aria-invalid=true], :disabled, :focus
  ),
  #operations-shell :is(input, select, textarea):not(
    [type=checkbox], [type=radio], [type=hidden], [type=range],
    [aria-invalid=true], :disabled, :focus
  ) {
    border-color: var(--box-outline);
  }

  /* Operations is a separate page and shares the same surface treatment. */
  #operations-shell :is(.panel, .metric-card, .support-bucket) {
    border: 1.5px solid var(--box-outline);
    box-shadow: var(--box-shadow);
  }
  #operations-shell :is(.ticket-row, .message, .invoice-provider-status, .invoice-provider-confirm) {
    border-color: var(--box-inner-outline);
    box-shadow: var(--box-inner-shadow);
  }
  #operations-shell .ticket-row.active {
    border-color: #284e70;
    box-shadow: inset 3px 0 #284e70, var(--box-inner-shadow);
  }
}
