/* Shared Team / Project visual language. Keep page layout and data styles separate. */
:root {
  --font-ui: "Poppins", "Helvetica Neue", Arial, sans-serif;
  --bg: #f5f7fb;
  --ink: #1d2433;
  --muted: #6e6e75;
  --card: #fff;
  --stroke: #dfe7f3;
  --accent: #9fc3fa;
  --accent-2: #faca8e;
  --good: #8de0c8;
  --bad: #fbb7b8;
  --purple: #c294f8;
  --pink: #ed80ee;
  --button-blue: var(--accent);
  --type-page-title: 26px;
  --type-section: 18px;
  --type-card: 15px;
  --type-body: 14px;
  --type-label: 13px;
  --type-meta: 12px;
  --type-kpi: 28px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --control-height: 38px;
  --radius-control: 8px;
  --radius-card: 16px;
  --radius-panel: 24px;
  --radius-pill: 999px;
  --focus-ring: 0 0 0 3px rgb(159 195 250 / 42%);
  --team-ink: var(--ink);
  --team-muted: var(--muted);
  --team-surface: var(--card);
  --team-border-soft: #edf1f6;
  --team-border-panel: var(--stroke);
  --team-blue: var(--accent);
  --team-shadow-subtle: 0 4px 12px rgb(24 39 75 / 6%);
  --team-shadow-panel: 0 12px 28px rgb(24 39 75 / 8%);
  --team-shadow-modal: 0 24px 48px rgb(24 39 75 / 14%);
}

/* Primary navigation follows Team / Project, including the active bottom rule.
   Use ::before for the rule: ::after already contains the dropdown chevron. */
body .top-nav {
  border-bottom-color: var(--stroke);
  box-shadow: var(--team-shadow-panel);
}

body .top-nav-item,
body .top-nav-subitem {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-decoration: none;
  filter: none;
}

body .top-nav-item {
  position: relative;
  padding-inline: 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  white-space: nowrap;
}

body .top-nav-item:is(:hover, .is-active, [aria-current="page"]) {
  color: var(--accent);
  background: transparent;
}

body .top-nav-item:is(.is-active, [aria-current="page"])::before {
  content: "";
  position: absolute;
  inset: auto 16px 0;
  height: 2px;
  border-radius: 999px 999px 0 0;
  background: var(--accent);
  pointer-events: none;
}

body .top-nav-item--has-submenu::after {
  font-size: 10px;
  margin-left: 4px;
}

body .top-nav-submenu {
  border-color: var(--stroke);
  border-radius: 12px;
  box-shadow: var(--team-shadow-panel);
}

body .top-nav-subitem:is(:hover, .is-active, [aria-current="page"]) {
  background: var(--bg);
  color: var(--ink);
  font-weight: 500;
}

body .nav-logout { color: var(--muted); }

@media (min-width: 901px) {
  body .top-nav-inner { min-height: 85px; }
  body .top-nav-menu {
    top: 0;
    min-height: 85px;
    gap: 0;
    align-items: stretch;
  }
  body .top-nav-dropdown { display: flex; align-items: stretch; }
  body .top-nav-item { min-height: 85px; }
}

@media (max-width: 900px) {
  /* Older pages toggle the header; newer pages toggle the menu itself. */
  body .top-nav.is-open .top-nav-menu,
  body .top-nav-menu.is-open { display: flex; }
  body .top-nav-item {
    width: fit-content;
    min-height: 44px;
    padding: 8px 12px;
  }
  body .top-nav-item:is(.is-active, [aria-current="page"])::before {
    inset-inline: 12px;
  }
  body .top-nav-submenu { border: 0; border-radius: 0; box-shadow: none; }
  body .top-nav-subitem { min-height: 44px; padding-block: 12px; }
}

html { font-size: 16px; }

body {
  font-family: var(--font-ui), sans-serif;
  font-size: var(--type-body);
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color: var(--ink);
  background: var(--bg);
}

/* Typography roles, including the older pages' more specific heading rules. */
body h1,
body .scenario-hero-card h1,
body .devices-heading h1 {
  font-size: var(--type-page-title);
  line-height: 1.1;
}

body h2,
body :is(.section-title-row, .controls-head, .team-overview-section-heading,
  .dashboard-test-forecast-head, .dashboard-test-column-head, .devices-table-heading,
  .devices-dialog, .forecast-info-dialog, .renewal-details-head) h2,
body .dashboard-panel .section-title-row h2,
body .dashboard-test-column h2 {
  font-size: var(--type-section);
  line-height: 1.3;
}

body h3,
body :is(.section-title-row, .licenties-sector-card, .forecast-info-dialog) h3,
body .devices-summary-card h2 {
  font-size: var(--type-card);
  line-height: 1.35;
}

body :is(.kpi-value, .costs-total-value, .devices-summary-card .devices-total) {
  font-family: var(--font-ui);
  font-size: var(--type-kpi);
  font-weight: 600;
  line-height: 1.1;
}

body :is(.field, .devices-dialog, .cost-plan-fields) label,
body :is(.costs-filter-label, .costs-total-label) {
  font-size: var(--type-label);
  font-weight: 500;
  line-height: 1.3;
}

body :is(.devices-help, #inventoryStatus, #inventoryCount, .devices-heading p,
  .devices-summary-card p, .devices-summary-card li small, .devices-cell small,
  .devices-dialog small, .cost-plan-help, .cost-plan-summary, .forecast-period-label,
  .forecast-result-pair span, .forecast-info-source) {
  color: var(--muted);
}

/* Action controls only: chart legends, status pills, icon buttons and list rows
   retain their own shape and semantic colors. Never change display here: hidden
   retry/save buttons must stay hidden. */
body :is(button[type="submit"], .primary-btn, .secondary-btn, .ghost-btn,
  .danger-btn, .btn-primary, .btn-ghost, .nav-sync-btn, .renewal-details-close) {
  min-height: var(--control-height);
  padding: 8px 12px;
  border-radius: var(--radius-control);
  font-family: var(--font-ui);
  font-size: var(--type-label);
  font-weight: 500;
  line-height: 1.3;
}

body button[type="submit"],
body :is(.devices-page, .devices-dialog) .primary-btn,
body .btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}

body :is(#loadSelectionBtn, #exportCsvBtn, #importCsvBtn, #analyzeBtn) {
  min-height: var(--control-height);
  padding: 8px 12px;
  border-radius: var(--radius-control);
  border-color: var(--accent);
  background: var(--accent);
  color: var(--ink);
  font: 500 var(--type-label)/1.3 var(--font-ui);
}

body :is(.ghost-btn, .secondary-btn, .btn-ghost, .renewal-details-close),
body :is(.devices-page, .devices-dialog) .secondary-btn {
  background: var(--card);
  border-color: var(--stroke);
  color: var(--ink);
  box-shadow: var(--team-shadow-subtle);
}

body .nav-sync-btn {
  border-color: var(--stroke);
  color: var(--ink);
  background: var(--card);
}

body button[hidden] { display: none !important; }

body :is(button[type="submit"], .primary-btn, .secondary-btn, .ghost-btn,
  .danger-btn, .btn-primary, .btn-ghost, .nav-sync-btn):disabled,
body :is(.devices-page, .devices-dialog) :is(.primary-btn, .secondary-btn):disabled,
body :is(#loadSelectionBtn, #exportCsvBtn, #importCsvBtn, #analyzeBtn):disabled {
  background: var(--bg);
  border-color: var(--stroke);
  color: var(--muted);
  opacity: 0.65;
  cursor: not-allowed;
}

/* Keep native select arrows and give all editable fields the same geometry. */
body :is(.field, .devices-dialog, .cost-plan-fields, .scenario-row,
  .scenario-inline-form, .scenario-cost-form) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea),
body :is(#yearSelect, #quarterSelect, #monthSelect, #compareCandidateSelect,
  #forecastYearSelect, #forecastQuarterSelect, #forecastMonthSelect),
body.page-vooruitblik :is(#forecastYearSelect, #forecastQuarterSelect, #forecastMonthSelect),
body.page-offertes-medewerkers .filters--activity-assignments :is(input, select) {
  min-height: var(--control-height);
  height: auto;
  min-width: 0;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-control);
  background-color: var(--card);
  color: var(--ink);
  padding: 8px 12px;
  font-family: var(--font-ui);
  font-size: var(--type-label);
  font-weight: 400;
  line-height: 1.5;
  box-shadow: none;
}

body :is(.field, .cost-plan-fields) select,
body :is(#yearSelect, #quarterSelect, #monthSelect, #compareCandidateSelect,
  #forecastYearSelect, #forecastQuarterSelect, #forecastMonthSelect),
body.page-vooruitblik :is(#forecastYearSelect, #forecastQuarterSelect, #forecastMonthSelect),
body.page-offertes-medewerkers .filters--activity-assignments select {
  padding-right: 36px;
}

body :is(button, a, input, select, textarea, summary):focus-visible,
body .forecast-info-button:focus-visible,
body .devices-cell:focus-visible,
body .devices-summary button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

body :is(.card, .team-overview-section, .devices-table-card) {
  padding: var(--space-6);
  border-color: var(--stroke);
  border-radius: var(--radius-panel);
  box-shadow: var(--team-shadow-panel);
}

body :is(.section-title-row, .team-overview-section-heading, .devices-table-heading) {
  gap: var(--space-4);
}

body :is(.info-modal-panel, .devices-dialog, .forecast-info-dialog, .renewal-details-dialog) {
  padding: var(--space-6);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-panel);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--team-shadow-modal);
}

body .devices-summary { gap: var(--space-4); }
body .devices-summary-card {
  padding: var(--space-4);
  border-color: var(--stroke);
  border-radius: var(--radius-card);
  background: var(--card);
}
body .devices-summary-card--due { border-top: 4px solid var(--bad); }
body .devices-summary-card--soon { border-top: 4px solid var(--accent-2); }
body .devices-summary-card--unknown { border-top: 4px solid var(--accent); }
body :is(.devices-cell, .devices-person) { color: var(--ink); }
body .devices-cell:hover { background: var(--bg); }
body .devices-table thead th { background: var(--bg); font-size: var(--type-label); }
body .devices-preview { background: var(--bg); }
body .devices-badge { color: var(--ink); background: var(--good); }
body .devices-badge--due { background: var(--bad); }
body .devices-badge--soon { background: var(--accent-2); }
body :is(.devices-badge--unknown, .devices-badge--future) { background: var(--bg); }

@media (max-width: 620px) {
  :root { --type-page-title: 23px; --control-height: 44px; }
  body :is(.card, .team-overview-section, .devices-table-card,
    .info-modal-panel, .devices-dialog, .forecast-info-dialog, .renewal-details-dialog) {
    padding: var(--space-4);
  }
  body :is(.field, .devices-dialog, .cost-plan-fields, .scenario-row,
    .scenario-inline-form, .scenario-cost-form) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea),
  body :is(#yearSelect, #quarterSelect, #monthSelect, #compareCandidateSelect,
    #forecastYearSelect, #forecastQuarterSelect, #forecastMonthSelect),
  body.page-vooruitblik :is(#forecastYearSelect, #forecastQuarterSelect, #forecastMonthSelect),
  body.page-offertes-medewerkers .filters--activity-assignments :is(input, select) {
    font-size: 16px;
  }
}

body .card {
  border: 1px solid var(--team-border-panel);
  border-radius: 24px;
  background: var(--team-surface);
  box-shadow: var(--team-shadow-panel);
}

body :is(h1, h2, h3) {
  font-family: var(--font-ui), sans-serif;
  font-weight: 600;
  letter-spacing: normal;
}

body .kpi-card {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body .sub-nav {
  flex-wrap: wrap;
  gap: 3px;
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--team-border-panel);
  border-radius: 24px;
  background: var(--team-surface);
}

body .sub-nav-item,
body .chart-type-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 11px;
  border-color: var(--team-border-panel);
  border-radius: 999px;
  color: var(--team-ink);
  background: var(--team-surface);
  font-family: var(--font-ui), sans-serif;
  font-size: 13px;
  font-weight: 500;
}

body .sub-nav-item { border-color: transparent; }

body .sub-nav-item.is-active,
body .chart-type-toggle.is-active {
  color: #fff;
  border-color: var(--team-blue);
  background: var(--team-blue);
  box-shadow: var(--team-shadow-subtle);
}

body .sub-nav-item:focus-visible,
body .chart-type-toggle:focus-visible {
  outline: 2px solid var(--ink);
  box-shadow: var(--focus-ring);
  outline-offset: 2px;
}

body .chart-type-toggle:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* One segmented control for target periods, chart modes and list filters. */
body .view-switch,
body .team-overview-view-switch,
body.page-dashboard-test .dashboard-test-chart-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--team-border-panel);
  border-radius: 999px;
  background: var(--team-surface);
}

body .view-switch .view-btn,
body .team-overview-view-switch button,
body.page-dashboard-test .dashboard-test-chart-switch .view-btn {
  min-height: 38px;
  padding: 0 11px;
  border: 0;
  border-radius: 999px;
  font-family: var(--font-ui), sans-serif;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--team-ink);
  background: transparent;
  box-shadow: none;
}

body .view-switch .view-btn.is-active,
body .team-overview-view-switch button.is-active {
  color: #fff;
  background: var(--team-blue);
  box-shadow: var(--team-shadow-subtle);
}

body .view-switch .view-btn:not(.is-active):not(:disabled):hover,
body .team-overview-view-switch button:not(.is-active):not(:disabled):hover {
  background: var(--bg);
}

body .view-switch .view-btn:disabled,
body .team-overview-view-switch button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

body .view-switch .view-btn:focus-visible,
body .team-overview-view-switch button:focus-visible {
  outline: 2px solid var(--ink);
  box-shadow: var(--focus-ring);
  outline-offset: 2px;
}

/* Plain rows inside each compartment; only targets use individual cards. */
.page-dashboard-test .dashboard-sales-list {
  gap: 18px;
  padding: 2px 6px 8px 0;
  scrollbar-width: thin;
  scrollbar-color: #ccd5e2 transparent;
}

body .dashboard-list-item,
body .dashboard-prognosis-item,
.page-dashboard-test .dashboard-test-column .dashboard-list-item,
.page-dashboard-test .dashboard-equipment-item {
  padding: 8px 0;
  border: 0;
  border-radius: 0;
  color: var(--team-ink);
  background: transparent;
  box-shadow: none;
}

.page-dashboard-test .dashboard-test-column .dashboard-item-main {
  gap: 8px;
}

.page-dashboard-test .dashboard-test-column .dashboard-item-row strong,
.page-dashboard-test .dashboard-test-column .dashboard-item-value {
  font-family: var(--font-ui), sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.page-dashboard-test .dashboard-test-column .dashboard-item-row--muted,
.page-dashboard-test .dashboard-test-column .dashboard-split-label {
  color: var(--team-muted);
  font-size: 12px;
  line-height: 1.5;
}

.page-dashboard-test .dashboard-test-column .budget-bar {
  height: 8px;
  min-height: 8px;
  margin: 4px 0;
  border-radius: 999px;
  background: #e8ebef;
}

.page-dashboard-test .budget-bar-realized { background: var(--good); }
.page-dashboard-test .budget-bar-planned { background: var(--accent-2); }
.page-dashboard-test .budget-bar-remaining { background: #e8ebef; }

.page-dashboard-test .dashboard-test-column .status-badge {
  font-size: 11px;
  font-weight: 500;
}

@media (max-width: 620px) {
  body .sub-nav-item,
  body .chart-type-toggle,
  body .view-switch .view-btn,
  body .team-overview-view-switch button,
  body.page-dashboard-test .dashboard-test-chart-switch .view-btn {
    min-height: 44px;
  }

  .page-dashboard-test .dashboard-test-column .dashboard-item-row {
    gap: 8px;
  }
}

@media (max-width: 430px) {
  body .view-switch .view-btn,
  body.page-dashboard-test .dashboard-test-chart-switch .view-btn,
  body .team-overview-view-switch button {
    font-size: 12px;
  }

  body .team-overview-view-switch button {
    padding-inline: 2px;
  }

  .page-dashboard-test .dashboard-test-column .dashboard-item-row:not(.dashboard-item-row--muted) {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
}

/* Admin controls remain hidden until the server confirms the account role. */
[data-admin-only][hidden] { display: none !important; }
