/* Desktop workspace polish (27.09.2026).
   Loaded last: adds hierarchy and surface separation without changing grid geometry. */

@media (min-width: 1024px) {
  :root {
    --workspace-tint: var(--petrol-2);
    --workspace-rule: var(--stone-5);
    --workspace-panel: var(--stone-2);
    --workspace-panel-hover: var(--petrol-2);
  }

  /* Quiet section anchors make long accounting pages easier to scan. */
  .dash-section-head,
  .section-head {
    border-bottom-color: var(--workspace-rule);
  }

  .dash-section-head {
    position: relative;
    padding-left: 12px;
  }

  .dash-section-head::before {
    content: "";
    position: absolute;
    left: 0;
    top: 17px;
    width: 3px;
    height: 14px;
    border-radius: var(--radius-full);
    background: var(--accent);
  }

  /* Tasks read as six distinct destinations while retaining their compact rows. */
  .dash-task-grid {
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--workspace-rule);
    border-radius: var(--radius);
    background: var(--workspace-panel);
  }

  .dash-task,
  .dash-task:nth-child(n) {
    padding: 9px 12px;
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    transition: border-color var(--motion), background-color var(--motion), box-shadow var(--motion);
  }

  .dash-task:hover {
    border-color: var(--petrol-7);
    background: var(--workspace-panel-hover);
    box-shadow: var(--shadow-1);
  }

  .dash-task:focus-visible {
    outline-offset: 2px;
  }

  .dash-task-count {
    justify-self: start;
    min-width: 30px;
    padding-inline: 4px;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
  }

  .dash-task.is-urgent .dash-task-count { background: var(--error-bg); }
  .dash-task.is-warn .dash-task-count { background: var(--warning-bg); }
  .dash-task-count.is-done { background: var(--success-bg); }

  /* KPI figures stay one dense strip; the surrounding frame identifies the group. */
  .dash-kpis {
    overflow: hidden;
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius);
    background: var(--bg-surface);
    box-shadow: var(--shadow-1);
  }

  .dash-kpi,
  .dash-kpi:nth-child(3n + 1) {
    padding-inline: 16px;
  }

  .dash-kpi-label > .ui-icon {
    color: var(--accent-text);
  }

  .dash-kpi:hover {
    background: var(--workspace-panel-hover);
  }

  /* Navigation tabs have a clearer selected surface and stronger keyboard target. */
  .status-tabs,
  .report-nav,
  .contact-tabs {
    gap: 4px;
    padding: 3px 4px 0;
    border: 1px solid var(--border-hairline);
    border-bottom-color: var(--border-default);
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--workspace-panel);
  }

  .status-tabs a,
  .contact-tabs a,
  .report-nav button {
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  }

  .status-tabs a:hover,
  .contact-tabs a:hover,
  .report-nav button:hover {
    background: var(--bg-surface);
  }

  .status-tabs a.active,
  .contact-tabs a.active,
  .report-nav button.active {
    background: var(--bg-surface);
    box-shadow: inset 0 -3px 0 var(--accent), 0 0 0 1px var(--border-hairline);
  }

  .dash-scope {
    padding-inline: 0;
    border-width: 0 0 1px;
    border-radius: 0;
    background: transparent;
  }

  html .workspace-tabs {
    align-items: end;
    padding-top: 5px;
    border-bottom-color: var(--border-default);
    background: var(--workspace-panel);
  }

  .workspace-tabs .workspace-tab {
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .workspace-tabs .workspace-tab.is-active {
    border-color: var(--border-default);
    background: var(--bg-surface);
    box-shadow: inset 0 3px 0 var(--accent), var(--shadow-1);
  }

  /* Search, chips and view controls form one calm tool surface above dense grids. */
  .list-sheet .data-grid-toolbar,
  .contact-range {
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius);
    background: var(--workspace-panel);
  }

  .list-sheet .data-grid-toolbar {
    margin-bottom: 8px;
    padding: 6px 8px;
  }

  .data-grid-toolbar .grid-search.input {
    border-color: var(--border-default);
    background-color: var(--bg-surface);
  }

  .filter-chip {
    border-style: solid;
    border-color: var(--border-default);
    background: var(--bg-surface);
  }

  .filter-chip:hover,
  .grid-chip[open] > .filter-chip {
    border-color: var(--petrol-7);
    background: var(--workspace-tint);
  }

  /* Contact profile: labels form a quiet rail and values remain the visual focus. */
  .contact-tabs {
    margin-bottom: 8px;
  }

  .contact-range {
    margin-bottom: 10px;
    padding: 10px 12px;
  }

  .contact-applied-range {
    margin: 0 0 16px;
    padding-left: 12px;
    border-left: 3px solid var(--petrol-7);
  }

  .detail-grid > .card.card-pad,
  .contact-statements > .contact-balance-card {
    border-color: var(--border-hairline);
    box-shadow: var(--shadow-1);
  }

  .detail-grid > .card.card-pad > .section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }

  .detail-grid > .card.card-pad > .section-title::before {
    content: "";
    width: 3px;
    height: 16px;
    border-radius: var(--radius-full);
    background: var(--accent);
  }

  .detail-grid > .card.card-pad > .meta-list > .meta-row {
    align-items: flex-start;
    padding-block: 8px;
  }

  .detail-grid > .card.card-pad > .meta-list > .meta-row > span:first-child {
    flex: 0 0 148px;
    padding-right: 12px;
    color: var(--text-muted);
    font-size: var(--text-xs);
    line-height: var(--lh-xs);
    font-weight: var(--weight-medium);
  }

  .detail-grid > .card.card-pad > .meta-list > .meta-row > strong:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--text-primary);
    font-weight: var(--weight-medium);
  }

  .contact-profile-summary {
    margin-top: 20px;
    padding-top: 16px;
  }

  .contact-profile-summary h3 {
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: var(--text-xs);
    line-height: var(--lh-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: .025em;
    text-transform: uppercase;
  }

  .contact-profile-list {
    gap: 0;
  }

  .contact-profile-list li {
    padding: 9px 0 8px;
  }

  .contact-profile-list li > small {
    color: var(--accent-text);
  }

  .contact-balance-card .contact-section-head {
    padding-top: 0;
    border-bottom: 1px solid var(--workspace-rule);
  }

  .contact-balance-card .contact-facts {
    margin-top: 4px;
  }
}

@media (forced-colors: active) and (min-width: 1024px) {
  .dash-task-grid,
  .dash-task,
  .dash-kpis,
  .status-tabs,
  .report-nav,
  .contact-tabs,
  .list-sheet .data-grid-toolbar,
  .contact-range {
    border-color: CanvasText;
  }
}

@media print {
  .dash-task-grid,
  .dash-task,
  .dash-kpis,
  .detail-grid > .card.card-pad,
  .contact-statements > .contact-balance-card {
    box-shadow: none;
  }
}
