/* 0.5.98 — working surfaces. Screen-only layout refinements; the original DOM,
   table columns, financial values, form behaviour and print rules are retained. */
@media screen {
  /* Keep the work context legible without making it a second page header. */
  .e559-workspace .e559-breadcrumb {
    gap: 8px;
    margin-bottom: 7px;
    font-size: 11px;
  }
  .e559-workspace .e559-heading {
    gap: 12px;
    margin-bottom: 10px;
  }
  .e559-workspace .e559-heading h1 {
    font-size: clamp(23px, 1.9vw, 28px);
    line-height: 1.2;
  }
  .e559-workspace .e559-heading p {
    margin-top: 4px;
    font-size: 12px;
  }
  .e559-workspace .e559-areas {
    gap: 3px;
    margin-bottom: 8px;
    scrollbar-width: thin;
    overscroll-behavior-x: contain;
  }
  .e559-workspace .e559-area {
    min-height: 40px;
    padding: 9px 13px;
    gap: 7px;
    border-bottom-width: 2px;
  }
  .e559-workspace .e559-subnav {
    gap: 5px;
    margin-bottom: 10px;
    padding-block: 2px;
    scrollbar-width: thin;
    overscroll-behavior-x: contain;
  }
  .e559-workspace .e559-subtab {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 11px;
    border-radius: 7px;
  }
  .e559-workspace .w530-state {
    margin: 8px 0 12px;
    padding: 7px 11px;
    border-radius: 8px;
  }

  /* Match the two budget workspaces, including their filter/action rhythm. */
  .ct592-workspace,
  .commercial593-workspace {
    padding: 14px;
    border-radius: 10px;
  }
  .ct592-heading,
  .commercial593-workspace .c561-hero {
    gap: 14px;
    margin-bottom: 12px;
  }
  .ct592-heading h2,
  .commercial593-workspace .c561-hero h2 {
    margin: 3px 0 5px;
    font-size: 20px;
    line-height: 1.3;
    letter-spacing: -.3px;
  }
  .ct592-heading p,
  .commercial593-workspace .c561-hero p {
    font-size: 12px;
    line-height: 1.5;
  }
  .ct592-heading-actions,
  .commercial593-heading-actions {
    gap: 6px;
    align-items: center;
  }
  .ct592-draft-status,
  .commercial593-status {
    min-height: 26px;
    padding: 4px 9px;
    font-size: 11px;
    line-height: 1.4;
    border-radius: 6px;
  }
  .ct592-filters,
  .commercial593-filters {
    gap: 8px;
    padding: 9px 10px;
    border-radius: 8px;
  }
  .commercial593-filters { margin-top: 10px; }
  .ct592-filters > label,
  .commercial593-filters > label {
    gap: 4px;
    font-size: 11px;
    font-weight: 550;
  }
  .ct592-caption,
  .commercial593-caption,
  .commercial593-reference {
    margin: 5px 0 8px;
    line-height: 1.45;
  }
  .ct592-notice,
  .commercial593-notice {
    margin: 8px 0;
    padding: 8px 10px;
    font-size: 11px;
    line-height: 1.5;
  }
  #ct592-editor .b575-meta,
  #commercial593-editor .b574-commercial-meta {
    margin: 8px 0;
    border-radius: 7px;
  }
  #ct592-editor .b575-meta > summary,
  #commercial593-editor .b574-commercial-meta > summary {
    line-height: 1.5;
  }
  #ct592-editor .b575-summary,
  #commercial593-editor .b575-summary {
    position: relative;
    top: auto;
    margin: 10px 0 12px;
    min-height: 0;
    border-radius: 8px;
    box-shadow: none;
  }
  #ct592-editor .b575-summary > div,
  #commercial593-editor .b575-summary > div {
    height: auto;
    min-height: 76px;
    padding: 9px 10px;
  }
  #ct592-editor .b575-summary strong,
  #commercial593-editor .b575-summary strong {
    font-size: clamp(16px, 1.18vw, 19px);
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
  }
  #ct592-editor .b575-summary small,
  #commercial593-editor .b575-summary small {
    line-height: 1.35;
  }
  #ct592-editor .b575-actions,
  #commercial593-editor .c561-actions {
    gap: 8px;
    margin: 8px 0;
  }
  #ct592-editor .b575-actions h3 {
    font-size: 15px;
    line-height: 1.4;
  }
  #ct592-editor .b575-caption,
  #commercial593-editor .b575-caption {
    margin: 5px 0 8px;
    font-size: 11px;
    line-height: 1.5;
  }
  .stage597-toolbar {
    gap: 6px;
    margin: 6px 0 8px;
    min-height: 30px;
  }
  .stage597-table .stage597-toggle {
    gap: 8px;
    min-height: 34px;
    padding: 6px 10px;
    font-size: 11px;
    line-height: 1.4;
  }
  .stage597-count {
    min-width: 25px;
    padding: 1px 7px;
    border-radius: 5px;
    text-align: center;
  }
  #ct592-editor .b575-scroll,
  #commercial593-editor .b575-scroll {
    border-radius: 8px;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scroll-padding-block: 70px 65px;
  }
  #ct592-editor .b575-table,
  #commercial593-editor .b575-table,
  .wsu596-table {
    font-variant-numeric: tabular-nums;
  }
  #ct592-editor .b575-service-link {
    line-height: 1.35;
  }
  #ct592-editor .b575-note,
  #commercial593-editor .b575-note {
    margin: 7px 0;
    font-size: 11px;
    line-height: 1.5;
  }
  #ct592-editor .budget528-save {
    padding: 10px 12px;
    margin-top: 10px;
    border-radius: 8px;
  }

  /* An action dock, bounded to the actions themselves. Sticky behaviour and
     the save/reconcile/disabled states remain owned by the original editor. */
  .ct592-savebar {
    width: fit-content;
    max-width: 100%;
    box-sizing: border-box;
    justify-content: flex-end;
    gap: 7px;
    margin: 12px 0 0 auto;
    padding: 7px;
    bottom: 10px;
    border: 1px solid var(--u598-line-strong, var(--ct-line));
    border-radius: 10px;
    background: var(--u598-surface, var(--ct-paper));
    box-shadow: 0 4px 16px #00000016;
  }

  /* Shared spacing for planning, diary, measurement and consolidated inputs. */
  .ws591 { margin: 14px 0 22px; }
  .ws591-head {
    gap: 16px;
    padding-bottom: 14px;
  }
  .ws591 .ws591-head h2,
  .op592-head h2,
  .wsu596 .op592-head h2 {
    font-size: 22px;
    line-height: 1.3;
    letter-spacing: -.35px;
  }
  .ws591 .ws591-head h2 { margin-bottom: 5px; }
  .ws591-head p { line-height: 1.5; }
  .ws591-eyebrow,
  .op592-eyebrow { margin-bottom: 4px; }
  .ws591-summary {
    gap: 9px;
    margin-bottom: 12px;
  }
  .ws591-kpi {
    padding: 12px 14px;
    border-radius: 9px;
  }
  .ws591-kpi:first-child { padding-top: 10px; }
  .ws591-kpi > span { margin-bottom: 6px; }
  .ws591-kpi > strong { font-size: 24px; }
  .ws591-kpi > strong.ws591-date-value { font-size: 20px; }
  .ws591-kpi > small,
  .ws591-kpi .ws591-badge { margin-top: 6px; }
  .ws591-note,
  .op592-note {
    padding: 9px 12px;
    margin-block: 10px;
    border-radius: 7px;
    line-height: 1.5;
  }
  .ws591-card,
  .op592-card { border-radius: 10px; }
  .ws591-card-head,
  .op592-card-head,
  .wsu596 .op592-card-head {
    gap: 10px;
    padding: 11px 13px;
  }
  .ws591-toolbar,
  .op592-toolbar,
  .wsu596 .op592-toolbar {
    gap: 9px;
    padding: 10px 13px;
  }
  .ws591-status-tabs {
    gap: 5px;
    padding: 0 13px 10px;
  }
  .ws591-chart-tools {
    gap: 9px;
    padding: 9px 13px;
  }
  .op592-head,
  .wsu596 .op592-head {
    gap: 12px;
    margin: 14px 0 12px;
  }
  .op592-head p,
  .wsu596 .op592-head p {
    margin: 4px 0;
    font-size: 12px;
    line-height: 1.5;
  }
  .op592-metrics {
    gap: 9px;
    margin-bottom: 12px;
  }
  .op592-metric {
    gap: 3px;
    padding: 11px 13px;
    border-radius: 9px;
  }
  .op592-metric > strong { font-size: 24px; }
  .op592-metric > small { font-size: 10px; }
  .op592-card { margin: 11px 0; }
  .op592-card-body { padding: 14px; }
  .op592-footnote { margin: 11px 0; }
  .op592-pages { padding: 10px 13px; }
  #work-supply592 .wsu597-resource-filters {
    gap: 6px 18px;
    padding-top: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--u598-line, var(--op-line));
  }

  /* Native dialogs keep one vertical body and a separate, reachable footer. */
  .op592-dialog .op592-form-grid { gap: 12px; }
  .op592-dialog .op592-section { margin: 14px 0; }
  .op592-dialog .op592-section-head {
    gap: 10px;
    margin-bottom: 9px;
  }
  .op592-dialog .op592-row-card {
    padding: 12px;
    margin: 10px 0;
  }
  .op592-dialog .op592-row-head { margin-bottom: 10px; }
  .op592-dialog .op592-context { margin-bottom: 10px; }
  .op592-dialog .op592-steps {
    gap: 6px;
    margin-bottom: 12px;
  }
  .op592-dialog .op592-details { margin: 10px 0; }
  .op592-dialog .op592-details > summary { padding: 10px 12px; }
  .op592-dialog .op592-details > div { padding: 12px; }
  .op592-dialog .op592-review-item { padding: 12px; }
  .calendar597-summary {
    margin-block: 8px;
    padding: 9px 11px;
  }
  .calendar597-table-scroll {
    scrollbar-width: thin;
    overscroll-behavior: contain;
  }
  .ct592-composition .b574-stage-tabs,
  .ct592-cpu-picker .b574-scroll {
    scrollbar-width: thin;
    overscroll-behavior-x: contain;
  }
}

@media screen and (min-width: 761px) {
  html[data-interface567] .ct592-composition .ct592-service-fields > label > :is(input, select) {
    height: 32px;
    min-height: 32px !important;
    padding: 5px 7px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
  }
  /* Override the older global 42 px controls only on these working toolbars. */
  html[data-interface567] :is(.ct592-filters, .commercial593-filters,
    .ws591-toolbar, .op592-toolbar) :is(input:not([type=checkbox]):not([type=radio]), select) {
    height: 32px;
    min-height: 32px !important;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 12px !important;
    line-height: 1.4;
  }
  html[data-interface567] :is(.ct592-heading-actions, .commercial593-heading-actions,
    .ct592-filters, .commercial593-filters, .ct592-savebar, .stage597-toolbar,
    .ws591-head-actions, .op592-head > .op592-actions, .op592-card-head > .op592-actions,
    .e559-workspace > .e559-heading .e559-actions) .btn {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 11px;
    line-height: 1.4;
    border-radius: 7px;
  }
  html[data-interface567] :is(#ct592-editor .b575-actions, #commercial593-editor .c561-actions) .btn {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 11px;
    border-radius: 7px;
  }
  #ct592-editor .b575-table .b582-line-actions .btn {
    min-height: 28px;
    margin: 3px 0;
    padding: 5px 4px !important;
  }
  .op592-dialog .op592-steps button {
    min-height: 42px;
    padding: 8px 10px;
  }
  #modal.op592-dialog > .modal-header {
    padding: 12px 16px !important;
  }
  #modal.op592-dialog > .modal-body {
    padding: 15px 16px !important;
  }
  #modal.op592-dialog > .modal-footer {
    padding: 9px 14px !important;
  }
  html[data-interface567] #modal.op592-dialog > .modal-footer .btn {
    min-height: 34px;
    padding: 7px 11px;
    font-size: 12px;
  }
  html[data-interface567] .op592-dialog :is(input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]), select) {
    min-height: 34px;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 13px;
  }
  html[data-interface567] .op592-dialog textarea {
    min-height: 66px;
    padding: 7px 9px;
    font-size: 13px;
    line-height: 1.5;
  }
  .calendar597-dialog > header { padding: 12px 16px; }
  .calendar597-dialog > footer { padding: 10px 16px; }
}

@media screen and (min-width: 761px) and (max-width: 1100px) {
  /* Keep the reset action with the filters when the main column narrows. */
  .ct592-filters,
  .commercial593-filters {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  }
  .ct592-filters > label:first-child,
  .commercial593-filters > label:first-child { grid-column: 1 / -1; }
  .ct592-filters > .btn,
  .commercial593-filters > .btn {
    grid-column: auto;
    justify-self: stretch;
  }
}

@media screen and (max-width: 760px) {
  .e559-workspace .e559-heading {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 9px;
  }
  .e559-workspace .e559-heading .e559-actions {
    flex-wrap: wrap;
    gap: 6px;
  }
  .e559-workspace .e559-area {
    min-height: 44px;
    padding: 10px 11px;
  }
  .e559-workspace .e559-subtab {
    min-height: 44px;
    padding: 10px 11px;
  }
  .e559-workspace .e559-subnav { margin-bottom: 7px; }
  .e559-workspace .w530-state { margin-bottom: 10px; }
  .ct592-workspace,
  .commercial593-workspace { padding: 11px; }
  .ct592-heading,
  .commercial593-workspace .c561-hero { gap: 9px; }
  .ct592-heading h2,
  .commercial593-workspace .c561-hero h2 { font-size: 19px; }
  .ct592-heading-actions,
  .commercial593-heading-actions {
    justify-content: flex-start;
    max-width: 100%;
  }
  .ct592-draft-status,
  .commercial593-status { white-space: normal; }
  .ct592-filters,
  .commercial593-filters {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    padding: 9px;
  }
  #ct592-editor .b575-summary > div,
  #commercial593-editor .b575-summary > div {
    min-height: 76px;
    padding: 8px;
  }
  #ct592-editor .b575-summary strong,
  #commercial593-editor .b575-summary strong { font-size: 16px; }
  #ct592-editor .b575-actions { align-items: flex-start; }
  #ct592-editor .b575-actions > .b574-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .stage597-toolbar { gap: 6px; }
  .stage597-toolbar > span { flex-basis: 100%; }
  .stage597-table .stage597-toggle {
    min-height: 44px;
    padding: 9px 10px;
    font-size: 12px;
  }
  .ct592-savebar {
    width: 100%;
    bottom: max(6px, env(safe-area-inset-bottom));
    padding: 7px;
    gap: 6px;
    border-radius: 9px;
  }
  .ct592-savebar > .btn {
    flex: 1 1 120px;
    padding: 9px 8px;
    font-size: 11px;
  }
  .ws591-head,
  .op592-head,
  .wsu596 .op592-head { gap: 10px; }
  .ws591 .ws591-head h2,
  .op592-head h2,
  .wsu596 .op592-head h2 { font-size: 21px; }
  .ws591-head-actions { justify-content: flex-start; }
  .ws591-summary,
  .op592-metrics { gap: 8px; }
  .ws591-kpi,
  .op592-metric { padding: 10px 11px; }
  .ws591-kpi:first-child { padding-top: 8px; }
  .ws591-kpi > strong,
  .op592-metric > strong { font-size: 22px; }
  .ws591-toolbar,
  .op592-toolbar,
  .wsu596 .op592-toolbar { padding: 10px; }
  .ws591-card-head,
  .op592-card-head,
  .wsu596 .op592-card-head {
    padding: 11px;
    flex-wrap: wrap;
  }
  .ws591-chart-tools { padding: 9px 10px; }
  .ws591-status-tabs { padding: 0 10px 10px; }
  .ws591-chart-nav strong {
    min-width: 0;
    margin-left: 3px;
  }
  .op592-dialog .op592-section-head { flex-wrap: wrap; }
  .op592-dialog .op592-row-head { gap: 8px; }
  .calendar597-summary { padding: 9px 10px; }
  html[data-interface567] :is(.ct592-heading-actions, .commercial593-heading-actions,
    .ct592-filters, .commercial593-filters, .ct592-savebar, .stage597-toolbar,
    .ws591-head-actions, .op592-head > .op592-actions, .op592-card-head > .op592-actions,
    .e559-workspace > .e559-heading .e559-actions) .btn {
    min-height: 44px;
  }
  html[data-interface567] :is(.ws591-toolbar, .op592-toolbar) :is(input:not([type=checkbox]):not([type=radio]), select) {
    min-height: 44px;
    font-size: 16px;
  }
}
