/* My Finance Records · V15.1.0 · Desktop UI hierarchy phase 1
   Desktop/tablet-workspace refinement only. Phone rules remain owned by mobile-v14-0-23.css. */

@media (min-width:851px) {
  /* Header hierarchy: preserve the existing 64px contract while reducing secondary noise. */
  .topbar-left,
  .topbar-left > div { min-width:0; }
  #topTitle { font-size:1rem; line-height:1.15; }
  #todayLabel { margin-top:1px; color:var(--muted); font-size:.64rem; line-height:1.2; }
  #buildBadge { opacity:.72; font-size:.58rem; }
  .topbar-actions { gap:6px; }

  /* Workspace pages already identify themselves in the top bar and segmented workspace switcher. */
  #income > .page-heading,
  #money > .page-heading,
  #paid-expenses > .page-heading,
  #projects > .page-heading,
  #payments > .page-heading { display:none; }

  .page-heading { margin-bottom:10px; }
  .page-heading h2 { font-size:1.28rem; line-height:1.15; }
  .page-heading p { max-width:780px; font-size:.72rem; line-height:1.4; }

  /* Keep meaningful metadata readable without increasing overall component height. */
  .dashboard-week-marquee-heading span,
  .dashboard-week-date span,
  .dashboard-week-copy small { font-size:.60rem; }
  .dashboard-week-copy strong { font-size:.64rem; }

  .report-insights-note,
  .report-insight-panel-heading p,
  .report-insights-kpis span,
  .report-insights-kpis small,
  .insight-legend,
  .insight-bar-line > span,
  .insight-bar-line > b,
  .insight-history-values span,
  .insight-budget-header,
  .insight-budget-row span,
  .insight-utility-list,
  .insight-mini-kpis span,
  .insight-muted,
  .insight-change-list small,
  .insight-change-chip,
  .insight-savings-change span,
  .insight-savings-change small,
  .insight-goal-list > div > div,
  .insight-goal-list small,
  .insight-comparison-label,
  .insight-ytd-grid span,
  .insight-ytd-grid small,
  .insight-ytd-grid em { font-size:.62rem; }

  .pc-count,
  .pc-agenda-heading small,
  .pc-event-type,
  .pc-event-date-state,
  .pc-event-card small,
  .pc-message,
  .pc-full-header small,
  .pc-full-section-heading small { font-size:.62rem; }

  /* Component roles: badge stays rectangular; statuses stay pill-shaped; metadata tags stay compact. */
  .ui-badge {
    min-height:20px;
    padding:2px 6px;
    border-radius:var(--talaan-control-radius);
    font-size:.64rem;
  }
  :is(.status-chip,.v13-chip,.settings-state-chip,.report-lifecycle-chip,.insight-change-chip,.pc-event-date-state,.status-pill,.ui-pill) {
    box-sizing:border-box;
    min-height:23px;
    padding:3px 8px;
    border-radius:999px;
    font-size:.64rem;
    line-height:1;
  }
  .ui-tag {
    min-height:20px;
    padding:2px 6px;
    border-radius:var(--talaan-control-radius);
    font-size:.62rem;
  }

  /* Formal desktop control tiers: 38px normal, 35px compact, 32px row action. */
  #settings .settings-panel :is(.input,.select),
  #settings .settings-search-field .input,
  .profile-switch-row .select,
  .profile-inline-fields .input { min-height:38px; height:38px; }

  :is(.income-toolbar,.paid-toolbar-compact,.project-toolbar-compact,.report-insights-filters) :is(.input,.select),
  :is(.income-clear-filters,.paid-clear-filters,.project-clear-filters),
  .report-insights-filter-actions .button { min-height:35px; height:35px; }

  :is(.record-actions,.pc-event-actions,.report-status-actions) .button { min-height:32px; }

  /* Dashboard: primary financial summary first, analytical cards second, utility cards quieter. */
  #dashboard > .kpi-grid .kpi-card {
    border-color:color-mix(in srgb,var(--primary) 14%,var(--line));
    box-shadow:var(--workspace-soft-shadow,0 5px 14px rgba(16,24,40,.05));
  }
  #dashboard .month-insights-card {
    box-shadow:none;
    background:var(--surface-soft);
  }
  #dashboard .dashboard-detail-card { box-shadow:none; }
  #dashboard :is(.dashboard-chart-card,.dashboard-calendar-card) {
    border-color:color-mix(in srgb,var(--primary) 12%,var(--line));
  }

  /* Income summary uses the same compact density as the rest of Finance. */
  #income .income-kpi-card {
    min-height:82px;
    padding:9px 10px;
  }
  #income .income-kpi-card .kpi-label { font-size:.69rem; }
  #income .income-kpi-card .kpi-value { font-size:1rem; }
  #income .income-kpi-card .kpi-meta { margin-top:3px; font-size:.64rem; line-height:1.25; }

  /* Finance hierarchy: summary first; planning and transaction surfaces remain calmer. */
  #money :is(.legend-item,.period-card),
  #moneySummary .summary-item { box-shadow:none; }
  #availableMoneySection {
    border-color:var(--line);
  }

  /* Projects: make Search the wide anchor and visually group the filter set. */
  #projects .project-toolbar-compact {
    grid-template-columns:minmax(220px,1.45fr) minmax(125px,.72fr) minmax(135px,.78fr) minmax(145px,.82fr) auto;
    padding:8px;
    border:1px solid var(--line);
    border-radius:var(--talaan-card-radius);
    background:var(--surface-soft);
  }

  /* Reports: keep analytical density, but reduce export-action competition. */
  #reports .report-insights-card,
  #reports .report-insight-panel { box-shadow:none; }
  .report-export-actions { align-items:center; gap:6px; }
  .report-export-menu { position:relative; }
  .report-export-menu > .overflow-menu-trigger { min-height:32px; }
  .report-export-menu-panel {
    position:absolute;
    right:0;
    bottom:calc(100% + 6px);
    z-index:45;
    min-width:220px;
    padding:5px;
    border:1px solid var(--line);
    border-radius:var(--talaan-popover-radius);
    background:var(--surface);
    box-shadow:var(--shadow);
  }
  .report-export-menu-panel > button {
    width:100%;
    min-height:34px;
    display:flex;
    align-items:center;
    padding:6px 9px;
    border:0;
    border-radius:var(--talaan-control-radius);
    background:transparent;
    color:var(--text);
    text-align:left;
    font:inherit;
    font-size:.7rem;
    cursor:pointer;
  }
  .report-export-menu-panel > button:hover,
  .report-export-menu-panel > button:focus-visible { background:var(--surface-soft); }

  /* Calendar: use edge + pill for routine states; reserve card tint for overdue urgency. */
  .pc-date-near,
  .pc-date-soon,
  .pc-date-completed { background:var(--surface); }
  .pc-date-overdue { background:color-mix(in srgb,var(--red-soft) 46%,var(--surface)); }
  html[data-theme="dark"] .pc-date-soon { background:var(--surface); }

  /* Paid-expense behavior note is contextual instead of living in the page heading. */
  .paid-expenses-info-note {
    margin:10px 0 0;
    padding:8px 10px;
    border:1px solid color-mix(in srgb,var(--blue) 20%,var(--line));
    border-radius:var(--talaan-card-radius);
    background:color-mix(in srgb,var(--blue-soft) 52%,var(--surface));
    color:var(--muted);
    font-size:.68rem;
    line-height:1.4;
  }

  /* Settings: keep status visible; put technical connection fields behind native disclosure. */
  #settings .settings-status-card,
  #settings .settings-overview-panel .card { box-shadow:none; }
  .advanced-settings-disclosure {
    margin-top:10px;
    border-top:1px solid var(--line);
  }
  .advanced-settings-disclosure > summary {
    min-height:38px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding:8px 2px 0;
    color:var(--text);
    font-size:.72rem;
    font-weight:800;
    cursor:pointer;
  }
  .advanced-settings-disclosure > summary small {
    color:var(--muted);
    font-size:.64rem;
    font-weight:650;
  }
  .advanced-settings-content { padding-top:9px; }

  /* Normal desktop dialogs share one compact shell; intentionally large dialogs keep their own geometry. */
  dialog:not(.pc-full-dialog):not(.cloud-conflict-review-dialog) { border-radius:var(--talaan-dialog-radius); }
  dialog:not(.pc-full-dialog):not(.cloud-conflict-review-dialog) > .modal-header,
  dialog:not(.pc-full-dialog):not(.cloud-conflict-review-dialog) > .modal-footer { padding:11px 13px; }
  dialog:not(.pc-full-dialog):not(.cloud-conflict-review-dialog) > .modal-body { padding:13px; }

  /* Empty-state anatomy is consistent without changing semantic borders/backgrounds. */
  :is(.empty-state,.pc-empty,.v13-empty,.report-insights-empty) {
    min-height:0;
    padding:18px 14px;
    border-radius:var(--talaan-card-radius);
    font-size:.72rem;
    line-height:1.45;
  }
  :is(.empty-state,.pc-empty,.v13-empty,.report-insights-empty) strong {
    font-size:.76rem;
    line-height:1.3;
  }

  /* Toasts use theme surfaces with semantic edge color instead of a separate hard-coded palette. */
  .toast {
    border-radius:var(--talaan-popover-radius);
    border-color:var(--line);
    background:var(--surface);
    color:var(--text);
    box-shadow:var(--shadow);
  }
  .toast-icon { background:var(--surface-soft); }
  .toast.toast-success { background:var(--surface); color:var(--text); border-inline-start:3px solid var(--green); }
  .toast.toast-info { background:var(--surface); color:var(--text); border-inline-start:3px solid var(--blue); }
  .toast.toast-warning { background:var(--surface); color:var(--text); border-inline-start:3px solid var(--orange); }
  .toast.toast-error { background:var(--surface); color:var(--text); border-inline-start:3px solid var(--red); }
  .toast-dismiss:hover { background:var(--surface-soft); }

  /* Help remains subtle but discoverable with a mouse; keyboard focus still uses the native ring. */
  .context-help-button,
  .section-help-button {
    opacity:.28;
    pointer-events:auto;
  }
  .context-help-button:hover,
  .section-help-button:hover,
  .context-help-button:focus-visible,
  .section-help-button:focus-visible { opacity:1; }
}

@media (min-width:851px) and (max-width:1180px) {
  /* Protect the month/action controls before compressing primary desktop actions. */
  #todayLabel,
  #buildBadge { display:none; }
  .topbar-left > div { display:flex; align-items:center; }
}

@media (min-width:1600px) {
  /* Constrain reading/form-heavy Settings content only; data workspaces retain full width. */
  #settings .settings-panels,
  #settings .settings-search-panel { max-width:1320px; }
}
