:root {
  --bg: #f2f4fb;
  --ink: #1f2733;
  --muted: #6a7484;
  --card: #fdfdff;
  --stroke: #d8dfeb;
  --accent: #9fc3fa;
  --accent-2: #faca8e;
  --good: #8de0c8;
  --bad: #fbb7b8;
  --purple: #c294f8;
  --filter-control-width: 100%;
  --button-blue: #b7cff8;
  --font-ui: "Poppins";
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Poppins", sans-serif;
  color: var(--ink);
  background: #f3f4fa;
}

.layout {
  max-width: 1249px;
  margin: 0 auto;
  padding: 1.25rem clamp(0.75rem, 2vw, 1.2rem) 4rem;
  display: grid;
  gap: 1rem;
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 120;
  background: #ffffff;
  border-bottom: 1px solid #e8edf6;
  box-shadow: 0 8px 20px #18274b14;
}

.top-nav-inner {
  max-width: 1249px;
  margin: 0 auto;
  padding: 0 clamp(0.7rem, 2vw, 1rem);
  min-height: 85px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: relative;
}

.top-nav-logo {
  display: inline-flex;
  align-items: center;
}

.top-nav-logo-image {
  width: 257px;
  height: 45px;
  display: block;
  object-fit: contain;
}

.top-nav-menu {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

/* ── Dropdown submenu ─────────────────────────────────────── */

.top-nav-dropdown {
  position: relative;
}

.top-nav-submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.4rem 0;
  background: #fff;
  border: 1px solid #e8edf6;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(24, 39, 75, 0.12);
  min-width: 150px;
  z-index: 140;
  flex-direction: column;
}

.top-nav-dropdown:hover .top-nav-submenu {
  display: flex;
}

.top-nav-subitem {
  display: block;
  width: 100%;
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: #1f2a3b;
  text-decoration: none;
  cursor: pointer;
  font-family: "Poppins", sans-serif;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.top-nav-subitem:hover {
  background: #f4f7fc;
  color: #9fc3fa;
}

.top-nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: none !important;
  border-radius: 10px;
  background: #fff;
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  color: #364157;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.top-nav-toggle:focus,
.top-nav-toggle:focus-visible {
  border: none !important;
  outline: none;
  box-shadow: none;
}

.top-nav-toggle span {
  width: 16px;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
  display: block;
}

.top-nav-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 0.9rem;
  border-radius: 0;
  border: 1px solid transparent;
  background: transparent;
  color: #1f2a3b;
  text-decoration: none;
  cursor: pointer;
  font-family: "Poppins", sans-serif;
  font-size: 16px;
  font-weight: 500;
}

.top-nav-item:hover {
  background: transparent;
  border-color: transparent;
  color: #9fc3fa;
}

.top-nav-item.is-active {
  background: transparent;
  border-color: transparent;
  color: #9fc3fa;
}

header h1 {
  margin: 0.3rem 0;
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.75rem;
}

.intro {
  margin: 0;
  max-width: 70ch;
  color: var(--muted);
}

.card {
  background: var(--card);
  border: none;
  border-radius: 22px;
  padding: 1.1rem;
  box-shadow: none;
  min-width: 0;
  overflow: hidden;
}

.controls {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: end;
}

#analyzeBtn {
  grid-column: 1 / 2;
  width: 100%;
}

.controls,
.controls * {
  font-family: "Poppins", sans-serif;
  font-weight: 400;
}

.controls-head {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.controls-head h2 {
  margin: 0;
}

.card > h2,
.section-title-row h2,
.controls-head h2 {
  font-family: "Poppins", sans-serif;
  font-weight: 600;
}

.field {
  display: grid;
  gap: 0.3rem;
}

label {
  font-weight: 600;
  font-size: 0.88rem;
}

input[type="file"] {
  border: 1px solid var(--stroke);
  background: #fff;
  padding: 0.55rem 0.6rem;
  border-radius: 14px;
}

select {
  border: 1px solid #b8cdf4;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10'%3E%3Cpath d='M2 2.2L7 7.2L12 2.2' fill='none' stroke='%23606b80' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  background-size: 14px 10px;
  padding: 0.6rem 2.25rem 0.6rem 0.78rem;
  border-radius: 999px;
  font: inherit;
  color: inherit;
  width: 100%;
  appearance: none;
  min-height: 44px;
  box-shadow: 0 1px 5px rgba(79, 103, 146, 0.08);
}

select:focus {
  outline: none;
  border-color: #91afe6;
  box-shadow: 0 0 0 3px rgba(159, 195, 250, 0.35);
}

.dropzone {
  border: 1px dashed #b8c9ea;
  border-radius: 14px;
  background: #f7faff;
  color: var(--muted);
  padding: 1rem;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
}

.dropzone.drag-over {
  border-color: #8fb3f5;
  background: #edf4ff;
  color: #4269ac;
}

.filters {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
}

.export-actions {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.filters-breadcrumb {
  margin: 0.2rem 0 0.65rem;
  color: var(--muted);
  font-weight: 600;
}

.filters-titles {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 0.4rem;
  font-weight: 700;
  font-family: "Poppins", sans-serif;
}

.filters-titles.is-collapsed {
  display: none;
}

.branch-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.branch-btn {
  border: 1px solid #c3cede;
  background: #edf1f8;
  color: #3e495b;
  border-radius: 12px;
  padding: 0.42rem 0.68rem;
  font-family: "Poppins", sans-serif;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.1;
}

.branch-btn:hover {
  filter: brightness(1.02);
}

.branch-btn.is-active {
  background: #9eb9e8;
  border-color: #8cabdf;
  color: #fff;
}

.flow-step {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.flow-step.is-hidden {
  display: none;
  opacity: 0;
  transform: translateY(-4px);
}

.compare-builder {
  margin-top: 0.65rem;
  display: grid;
  gap: 0.55rem;
  font-family: "Poppins", sans-serif;
}

.compare-builder-label {
  font-family: "Poppins", sans-serif;
  font-weight: 600;
}

.compare-builder-controls {
  display: grid;
  grid-template-columns: minmax(0, 260px) 160px;
  gap: 0.55rem;
  align-items: center;
}

.add-compare-btn {
  padding: 0.5rem 0.8rem;
  border-radius: 12px;
}

.compare-chips {
  min-height: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.compare-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  border: 1px solid #b7c7e9;
  background: #eef3ff;
  color: #445376;
  border-radius: 999px;
  padding: 0.18rem 0.52rem 0.18rem 0.58rem;
  font-family: "Poppins", sans-serif;
  font-size: 12px;
  font-weight: 400;
}

.compare-chip-remove {
  border: 0;
  background: transparent;
  color: inherit;
  width: 18px;
  height: 18px;
  min-width: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.compare-chip-remove:hover {
  background: rgba(68, 83, 118, 0.14);
}

#loadField {
  display: flex;
  align-items: start;
}

#loadField button {
  width: 100%;
}

#yearSelect,
#quarterSelect,
#monthSelect {
  width: var(--filter-control-width);
  min-width: var(--filter-control-width);
  border: 1px solid var(--button-blue);
  height: 38px;
  color: var(--ink);
  box-shadow: none;
  cursor: pointer;
  appearance: none;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-ui), "Poppins", "Helvetica Neue", Arial, sans-serif;
  background:
    #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10'%3E%3Cpath d='M2 2.2L7 7.2L12 2.2' fill='none' stroke='%23606b80' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    right 16px center / 12px 8px no-repeat;
  border-radius: 999px;
  padding: 0 42px 0 16px;
}

#compareCandidateSelect {
  font-family: "Poppins", sans-serif;
  font-weight: 400;
  font-size: 13px;
}

button {
  border: 1px solid #b7cff8;
  background: #a9c8fb;
  color: #fff;
  border-radius: 14px;
  padding: 0.72rem 1rem;
  font-family: "Poppins", sans-serif;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.05);
}

button:disabled {
  background: #d4dae6;
  border-color: #c4cbd9;
  color: #f8f9fc;
  cursor: not-allowed;
  filter: none;
}

.view-switch {
  display: inline-flex;
  gap: 0.35rem;
  background: #eef3fd;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 0.2rem;
}

#viewDirectorBtn {
  order: 1;
}

#viewFinancialBtn {
  order: 2;
}

#viewCashBtn {
  order: 3;
}

.view-btn {
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0.38rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.view-btn.is-active {
  background: #fff;
  border-color: #c6d8fa;
  color: var(--ink);
  box-shadow: 0 1px 6px rgba(96, 119, 170, 0.16);
}

.status {
  margin: 0;
  color: var(--muted);
  grid-column: 1 / -1;
  min-height: 1.2rem;
}

.selection-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.selection-notice {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
  font-family: "Poppins", sans-serif;
  font-size: 0.9rem;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.selection-notice::before {
  content: "i";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  min-width: 16px;
  border-radius: 999px;
  border: 1px solid #b7c1d7;
  color: #56627a;
  font-size: 0.7rem;
  line-height: 1;
  margin-top: 0;
}

.selection-notice:empty::before {
  content: none;
}

.notice-card {
  padding: 0.75rem 1.1rem;
}

.ghost-btn {
  border: 1px solid #c3cede;
  background: #edf1f8;
  color: #3e495b;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
}

.ghost-btn:hover {
  filter: brightness(1.02);
}

.info-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
}

.info-modal.is-hidden {
  display: none;
}

.info-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 39, 51, 0.4);
}

.info-modal-panel {
  position: relative;
  width: min(520px, calc(100vw - 2rem));
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 16px 32px rgba(20, 30, 50, 0.18);
  overscroll-behavior: contain;
}

.info-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.info-modal-head h3 {
  margin: 0;
}

.info-modal-close {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: #f7f9fd;
  color: var(--ink);
  padding: 0;
  font-size: 1.05rem;
  line-height: 1;
}

.info-modal-body {
  margin: 0.75rem 0 0;
  color: var(--muted);
  line-height: 1.45;
  font-weight: 400;
  max-height: min(70vh, 680px);
  overflow-y: auto;
  padding-right: 0.25rem;
}

.info-modal-body-heading {
  margin: 0 0 0.22rem;
  color: #111111;
  font-weight: 600;
}

.info-modal-body-line {
  margin: 0 0 0.2rem;
  font-weight: 400;
  color: var(--muted);
}

.info-modal-body-gap {
  margin: 0;
  height: 0.85rem;
}

.data-manage-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
}

.data-manage-modal.is-hidden {
  display: none;
}

.data-manage-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 39, 51, 0.45);
}

.data-manage-panel {
  position: relative;
  width: min(860px, calc(100vw - 2rem));
  max-height: min(80vh, 760px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 16px 32px rgba(20, 30, 50, 0.2);
  overscroll-behavior: contain;
}

.upload-modal-panel {
  position: relative;
  width: min(560px, calc(100vw - 2rem));
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 16px 32px rgba(20, 30, 50, 0.2);
  display: grid;
  gap: 0.8rem;
  overscroll-behavior: contain;
}

.data-manage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.data-manage-head h3 {
  margin: 0;
}

.data-manage-actions {
  display: flex;
  gap: 0.5rem;
  margin: 0.65rem 0 0.75rem;
}

.data-manage-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.data-manage-bulk {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0 0 0.45rem;
}

.danger-btn {
  border: 1px solid #e7b3ba;
  background: #fff0f2;
  color: #c86c74;
}

.danger-btn:disabled {
  opacity: 0.6;
}

.snapshot-list {
  display: grid;
  gap: 0.55rem;
}

.snapshot-year-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 0.65rem;
}

.snapshot-year-tab {
  border: 1px solid #c3cede;
  background: #edf1f8;
  color: #3e495b;
  border-radius: 999px;
  padding: 0.34rem 0.72rem;
  font-family: "Poppins", sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
}

.snapshot-year-tab.is-active {
  background: #9eb9e8;
  border-color: #8cabdf;
  color: #fff;
}

.snapshot-item {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: #fff;
  padding: 0.62rem 0.72rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.85rem;
}

.snapshot-item--missing {
  border-color: #e8aeb6;
  background: #fff7f8;
}

.snapshot-item--stale {
  background: #f4f5f8;
  border-color: #d5d9e3;
}

.snapshot-item--stale .snapshot-item-title,
.snapshot-item--stale .snapshot-item-meta {
  color: #586170;
}

.snapshot-item-main {
  min-width: 0;
  flex: 1;
}

.snapshot-select {
  display: inline-flex;
  align-items: center;
  margin-right: 0.15rem;
}

.snapshot-select--placeholder {
  width: 22px;
  min-width: 22px;
  height: 22px;
}

.snapshot-item-title {
  margin: 0;
  font-weight: 700;
  word-break: break-word;
}

.snapshot-item-meta {
  margin: 0.16rem 0 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.snapshot-delete-btn {
  margin-left: auto;
  width: 34px;
  min-width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #e7b3ba;
  background: #fff0f2;
  color: #c86c74;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
}

.snapshot-delete-btn:hover {
  filter: brightness(0.98);
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.chart-card .section-title-row {
  align-items: flex-start;
}

.chart-controls {
  display: grid;
  gap: 0.4rem;
  justify-content: flex-end;
  width: 100%;
}

.chart-card .chart-controls {
  width: auto;
  margin-left: auto;
}

.chart-controls-row {
  display: inline-flex;
  gap: 0.45rem;
  justify-content: flex-end;
  flex-wrap: wrap;
  width: 100%;
}

.chart-card .chart-controls-row {
  width: auto;
}

.chart-controls-row--metrics {
  margin-top: 0.08rem;
}

#compareMetricIncomeBtn {
  background: #8de0c8;
  border-color: #71ccb2;
  color: #fff;
}

#compareMetricCostBtn {
  background: #fbb7b8;
  border-color: #eea0a2;
  color: #fff;
}

#compareMetricIncomeBtn.is-active,
#compareMetricCostBtn.is-active {
  filter: brightness(0.96);
}

.chart-type-toggle {
  border: 1px solid #b7cff8;
  background: #fff;
  color: #8cabdf;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-weight: 400;
}

.chart-type-toggle:hover {
  filter: brightness(1.02);
}

.chart-type-toggle.is-active {
  background: #a9c8fb;
  border-color: #b7cff8;
  color: #fff;
}

.chart-type-toggle:disabled {
  background: #d4dae6;
  border-color: #c4cbd9;
  color: #f8f9fc;
  cursor: not-allowed;
}

.compare-toggle-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 999px;
  border: 1px solid #c3cede;
  background: #edf1f8;
  color: #5d6a81;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.compare-toggle-btn.is-active {
  background: #9eb9e8;
  border-color: #8cabdf;
  color: #fff;
}

.compare-toggle-btn:disabled {
  background: #d4dae6;
  border-color: #c4cbd9;
  color: #f8f9fc;
  cursor: not-allowed;
}

.compare-years {
  margin: 0.55rem 0 0.15rem;
}

.is-hidden {
  display: none !important;
}

.badge {
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 0.24rem 0.78rem;
  font-size: 0.8rem;
  color: var(--muted);
  background: #fff;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
}

.stat {
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 0.8rem;
  background: #fff;
}

.summary-grid .stat:nth-child(5n + 1) {
  background: #ecfbf5;
}

.summary-grid .stat:nth-child(5n + 2) {
  background: #fff5e8;
}

.summary-grid .stat:nth-child(5n + 3) {
  background: #edf4ff;
}

.summary-grid .stat:nth-child(5n + 4) {
  background: #f6ecff;
}

.summary-grid .stat:nth-child(5n + 5) {
  background: #ffeef0;
}

.stat p {
  margin: 0;
}

.stat .label {
  color: var(--muted);
  font-size: 0.82rem;
}

.stat .value {
  margin-top: 0.3rem;
  font-weight: 700;
  font-size: 1.2rem;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: #fff;
}

.period-chart-wrap {
  height: 280px;
  min-height: 280px;
  max-height: 280px;
  position: relative;
}

.period-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

th,
td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid #ede7dc;
  font-size: 0.9rem;
  vertical-align: top;
}

td.num,
th.num {
  text-align: right;
  white-space: nowrap;
}

th {
  background: #f5f7fc;
  position: sticky;
  top: 0;
}

.amount-list {
  margin: 0;
  padding-left: 1rem;
}

.category-list {
  display: grid;
  gap: 0.65rem;
}

#rowsByCategory,
#rowsByCategory * {
  font-family: "Poppins", sans-serif;
  font-weight: 400;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.6rem;
}

.kpi {
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: #fff;
  padding: 0.7rem;
  position: relative;
}

.kpi-grid .kpi:nth-child(5n + 1) {
  background: #ecfbf5;
}

.kpi-grid .kpi:nth-child(5n + 2) {
  background: #fff5e8;
}

.kpi-grid .kpi:nth-child(5n + 3) {
  background: #edf4ff;
}

.kpi-grid .kpi:nth-child(5n + 4) {
  background: #f6ecff;
}

.kpi-grid .kpi:nth-child(5n + 5) {
  background: #ffeef0;
}

.kpi.kpi--operationele-omzet {
  background: #8de0c8;
}

.kpi.kpi--brutomarge {
  background: #9fc3fa;
}

.kpi.kpi--operationeel-resultaat {
  background: #faca8e;
}

.kpi.kpi--personeelsratio {
  background: #c294f8;
}

.kpi.kpi--vaste-lasten {
  background: #fbb7b8;
}

.kpi-title {
  margin: 0;
  font-family: "Poppins", sans-serif;
  font-size: 0.78rem;
  color: var(--muted);
}

.kpi-value {
  margin: 0.2rem 0 0;
  font-size: 1.08rem;
  font-weight: 700;
}

.kpi-info-btn {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid #b7c1d7;
  background: #f6f8fd;
  color: #4a5873;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.kpi-info-btn:hover {
  filter: brightness(1.03);
}

.director-block {
  display: grid;
  gap: 0.65rem;
}

.overview-block {
  border: 1px solid #d7deea;
  border-radius: 14px;
  overflow: hidden;
  background: #ffffff;
}

.overview-block-summary {
  list-style: none;
  cursor: pointer;
  padding: 0.68rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #f2f6fd;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
}

.overview-block-summary::-webkit-details-marker {
  display: none;
}

.overview-block-title {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.overview-block-title::before {
  content: "▸";
  color: #7aa7f4;
}

.overview-block[open] .overview-block-title::before {
  content: "▾";
}

.overview-block-body {
  display: grid;
  gap: 0.65rem;
  padding: 0.72rem;
}

.overview-block-total {
  margin-left: auto;
  font-family: "Poppins", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #1f2a3b;
  white-space: nowrap;
}

.overview-block[open] .overview-block-total {
  display: none;
}

.director-result {
  margin-top: 0.1rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  align-items: baseline;
  color: #4a5668;
}

.director-result-label {
  font-size: 0.88rem;
  color: var(--muted);
}

.director-result-value {
  font-size: 1rem;
}

.overview-result-row {
  margin-top: 0.2rem;
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.35rem 0.2rem 0;
}

.category {
  border: 1px solid var(--stroke);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.category > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.7rem 0.8rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7.2rem 10.2rem 11.2rem;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  background: #f7f9ff;
}

.category > summary::-webkit-details-marker {
  display: none;
}

.category > summary::before {
  content: none;
}

.category-name {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.category-name::before {
  content: "▸";
  color: #7aa7f4;
}

.category[open] .category-name::before {
  content: "▾";
}

.category-meta {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
  text-align: left;
  justify-self: start;
}

.category-total {
  font-weight: 700;
  white-space: nowrap;
  justify-self: end;
  text-align: right;
}

.category-compare-btn {
  border: 1px solid #b7c7e9;
  background: #eef3ff;
  color: #445376;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-family: "Poppins", sans-serif;
  font-size: 0.73rem;
  font-weight: 600;
  line-height: 1.2;
  width: 100%;
  min-width: 0;
  text-align: center;
  justify-self: stretch;
}

.category-compare-btn:hover {
  filter: brightness(1.02);
}

.director-block--income .category > summary {
  background: #ecfbf5;
}

.director-block--cost .category > summary {
  background: #fdecec;
}

.director-block--balance .category > summary {
  background: #fff8de;
}

.director-block--balance .category--cash > summary {
  background: #fff3b8;
}

.director-block--balance .category--cash .category-name::before {
  color: #b38b00;
}

.director-block--balance .category--asset-yellow > summary {
  background: #fff7cf;
}

.director-block--balance .category--asset-yellow .category-name::before {
  color: #9b8121;
}

.director-block--balance .category--verplichtingen > summary {
  background: #dfeeff;
}

.director-block--balance .category--verplichtingen .category-name::before {
  color: #2d6fbe;
}

.director-block--balance .category--administratief > summary {
  background: #eceff3;
}

.director-block--balance .category--administratief .category-name::before {
  color: #5f6b7a;
}

.director-block--cash-now .category > summary {
  background: #fff3b8;
}

.director-block--cash-in .category > summary {
  background: #ebf7df;
}

.director-block--cash-out .category > summary {
  background: #dfeeff;
}

.director-block--cash-info .category > summary {
  background: #eceff3;
}

.cash-warning {
  margin: 0.25rem 0 0;
  color: #8b5f00;
  font-size: 0.88rem;
  font-weight: 600;
}

.category table {
  min-width: 540px;
}

.category tbody tr:last-child td {
  border-bottom: none;
}

.category-compare-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
}

.category-compare-modal.is-hidden {
  display: none;
}

.category-compare-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 39, 51, 0.45);
}

.category-compare-panel {
  position: relative;
  width: min(1100px, calc(100vw - 2rem));
  max-height: min(84vh, 920px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 16px 32px rgba(20, 30, 50, 0.2);
  display: grid;
  gap: 0.8rem;
  overscroll-behavior: contain;
}

.category-compare-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.category-compare-head h3 {
  margin: 0;
}

.category-compare-chart-wrap {
  height: min(56vh, 520px);
}

.pos {
  color: #2f8d75;
  font-weight: 700;
}

.neg {
  color: #c86c74;
  font-weight: 700;
}

@media (max-width: 1024px) {
  .top-nav-inner {
    min-height: 74px;
  }

  .top-nav-logo-image {
    width: 226px;
    height: 40px;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters-titles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-title-row {
    align-items: flex-start;
  }

  .chart-controls,
  .chart-controls-row {
    justify-content: flex-start;
  }

  table {
    min-width: 560px;
  }

  .category table {
    min-width: 520px;
  }
}

@media (max-width: 900px) {
  .top-nav-inner {
    min-height: 70px;
  }

  .top-nav-logo-image {
    width: 210px;
    height: 37px;
  }

  .top-nav-toggle {
    display: inline-flex;
    margin-left: auto;
    width: 44px;
    height: 44px;
  }

  .top-nav-menu {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 1px);
    margin: 0;
    padding: 0.65rem 0.9rem 0.85rem;
    background: #fff;
    border-bottom: 1px solid #e8edf6;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    z-index: 130;
    transform: none;
  }

  .top-nav.is-open .top-nav-menu {
    display: flex;
  }

  .top-nav-item {
    width: 100%;
    justify-content: flex-start;
    min-height: 44px;
    padding: 0.4rem 0.1rem;
    font-size: 16px;
  }

  .top-nav-dropdown {
    width: 100%;
  }

  .top-nav-submenu {
    display: flex;
    position: static;
    transform: none;
    border: none;
    box-shadow: none;
    padding: 0 0 0 1rem;
    min-width: 0;
  }

  .top-nav-subitem {
    min-height: 40px;
    padding: 0.3rem 0.1rem;
    font-size: 15px;
  }
}

@media (max-width: 768px) {
  .layout {
    padding: 1rem 0.75rem 2.4rem;
  }

  .card {
    padding: 0.9rem;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .filters-titles {
    display: none;
  }

  .compare-builder-controls {
    grid-template-columns: 1fr;
  }

  .add-compare-btn {
    width: 100%;
  }

  .section-title-row {
    gap: 0.7rem;
  }

  .chart-controls-row {
    justify-content: flex-start;
  }

  .view-switch {
    width: 100%;
  }

  .view-btn {
    flex: 1;
    text-align: center;
  }

  .period-chart-wrap {
    height: clamp(220px, 38vh, 260px);
    min-height: 220px;
    max-height: 260px;
  }

  .snapshot-item {
    align-items: flex-start;
    flex-wrap: wrap;
    row-gap: 0.52rem;
  }

  .snapshot-item-main {
    flex: 1 1 100%;
    order: 2;
  }

  .snapshot-select {
    order: 1;
  }

  .snapshot-delete-btn {
    order: 3;
    margin-left: 0;
    min-width: 38px;
    width: 38px;
    height: 38px;
  }

  .info-modal-panel,
  .data-manage-panel,
  .upload-modal-panel,
  .category-compare-panel {
    width: min(100vw - 1.2rem, 860px);
    max-height: calc(100dvh - 1.2rem);
    border-radius: 14px;
    padding: 0.85rem;
  }

  .info-modal-close {
    width: 36px;
    height: 36px;
  }

  .info-modal-body {
    max-height: min(64dvh, 580px);
  }

  .data-manage-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .data-manage-actions > button {
    width: 100%;
  }

  .data-manage-head,
  .category-compare-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  table {
    min-width: 500px;
  }

  .category table {
    min-width: 480px;
  }

  th,
  td {
    padding: 0.48rem 0.58rem;
    font-size: 0.84rem;
  }

  .category > summary {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "name total"
      "meta compare";
    align-items: start;
    row-gap: 0.38rem;
    column-gap: 0.55rem;
  }

  .category-name {
    grid-area: name;
  }

  .category-total {
    grid-area: total;
    justify-self: end;
    text-align: right;
  }

  .category-meta {
    grid-area: meta;
    white-space: normal;
    font-size: 0.78rem;
  }

  .category-compare-btn {
    grid-area: compare;
    justify-self: end;
    width: auto;
    min-width: 6.4rem;
    min-height: 34px;
    padding: 0.3rem 0.7rem;
    font-size: 0.72rem;
  }
}

@media (max-width: 480px) {
  .top-nav-inner {
    min-height: 64px;
    padding: 0 0.7rem;
  }

  .top-nav-logo-image {
    width: 176px;
    height: 31px;
  }

  .layout {
    padding: 0.9rem 0.65rem 2rem;
    gap: 0.75rem;
  }

  .card {
    border-radius: 16px;
    padding: 0.75rem;
  }

  .chart-type-toggle {
    min-height: 40px;
  }

  .view-btn {
    min-height: 40px;
  }

  table {
    min-width: 440px;
  }

  .category table {
    min-width: 430px;
  }

  th,
  td {
    padding: 0.42rem 0.5rem;
    font-size: 0.8rem;
  }

  .category > summary {
    padding: 0.62rem 0.64rem;
  }

  .category-total {
    font-size: 0.94rem;
  }

  .category-meta {
    font-size: 0.75rem;
  }

  .category-compare-btn {
    min-height: 32px;
    min-width: 5.8rem;
    font-size: 0.7rem;
  }

  .info-modal-panel,
  .data-manage-panel,
  .upload-modal-panel,
  .category-compare-panel {
    width: calc(100vw - 0.8rem);
    max-height: calc(100dvh - 0.8rem);
    border-radius: 12px;
    padding: 0.72rem;
  }

  .data-manage-actions {
    grid-template-columns: 1fr;
  }

  .snapshot-item {
    padding: 0.54rem 0.62rem;
  }

  .snapshot-delete-btn {
    width: 36px;
    min-width: 36px;
    height: 36px;
  }

  .category-compare-chart-wrap {
    height: min(46dvh, 360px);
  }
}

/* Migration banner */
.migration-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: var(--accent);
  color: var(--ink);
  font-size: 0.9rem;
  font-family: var(--font-ui);
}

.migration-banner.is-hidden {
  display: none;
}

.migration-banner p {
  margin: 0;
  flex: 1;
}

.migration-banner .btn-sm {
  padding: 6px 16px;
  font-size: 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  font-family: var(--font-ui);
}

.migration-banner .btn-primary {
  background: var(--ink);
  color: #fff;
}

.migration-banner .btn-ghost {
  background: transparent;
  color: var(--ink);
  text-decoration: underline;
}

/* Sync status bar */
.sync-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  font-family: var(--font-ui);
  margin-bottom: 16px;
}

.sync-status-bar button {
  flex-shrink: 0;
}

/* ── Facturen pagina ─────────────────────────────────────── */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.kpi-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.2rem 0.8rem;
  background: var(--bg);
  border-radius: 8px;
  text-align: center;
}

.kpi-value {
  font-family: "Space Grotesk", monospace;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

.invoice-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.invoice-table th,
.invoice-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--stroke);
  white-space: nowrap;
}

.invoice-table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  background: var(--card);
}

.invoice-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.invoice-table th.sortable:hover {
  color: var(--ink);
}

.sort-arrow {
  font-size: 0.7rem;
}

.invoice-table tbody tr:hover {
  background: var(--bg);
}

.amount-cell {
  font-family: "Space Grotesk", monospace;
  text-align: right;
}

.invoice-table th:nth-child(4) {
  text-align: right;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-verstuurd {
  background: rgba(141, 224, 200, 0.25);
  color: #1a7a5a;
}

.status-gepland {
  background: rgba(159, 195, 250, 0.25);
  color: #2a5fa8;
}

.status-on_hold {
  background: rgba(250, 202, 142, 0.25);
  color: #8a6520;
}

.status-geannuleerd {
  background: rgba(251, 183, 184, 0.25);
  color: #a33;
}

/* Offerte statussen */
.status-won {
  background: rgba(141, 224, 200, 0.25);
  color: #1a7a5a;
}

.status-open {
  background: rgba(159, 195, 250, 0.25);
  color: #2a5fa8;
}

.status-lost {
  background: rgba(251, 183, 184, 0.25);
  color: #a33;
}

.status-closed {
  background: rgba(110, 110, 117, 0.2);
  color: #6E6E75;
}

/* Offerte CRM statussen */
.status-offerte {
  background: rgba(159, 195, 250, 0.25);
  color: #2a5fa8;
}

.status-loopt {
  background: rgba(141, 224, 200, 0.25);
  color: #1a7a5a;
}

.status-afgerond {
  background: rgba(250, 202, 142, 0.25);
  color: #8a6520;
}

.status-gearchiveerd {
  background: rgba(110, 110, 117, 0.2);
  color: #6E6E75;
}

.status-afgewezen {
  background: rgba(251, 183, 184, 0.25);
  color: #a33;
}

/* ── Medewerkers pagina ───────────────────────────────────── */

.user-card {
  align-items: flex-start;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.user-total {
  font-family: "Space Grotesk", monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
}

.kpi-sub {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
  font-size: 0.75rem;
}

.user-sub-good {
  color: #8DE0C8;
  font-weight: 600;
}

.user-sub-expected {
  color: #faca8e;
  font-weight: 600;
}

.total-row {
  background: var(--bg);
  border-top: 2px solid var(--stroke);
}

.total-row td {
  font-weight: 600;
}

/* ── Sub-navigatie tabs ─────────────────────────────────────── */

.sub-nav {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.sub-nav-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 1.2rem;
  border-radius: 10px;
  font-family: "Poppins", sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  background: transparent;
  border: 1px solid var(--stroke);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sub-nav-item:hover {
  color: var(--ink);
  background: var(--bg);
}

.sub-nav-item.is-active {
  color: #fff;
  background: #9fc3fa;
  border-color: #9fc3fa;
}

@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .kpi-value {
    font-size: 1.1rem;
  }
}
