*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  /* Brand + neutrals */
  --bg: #f5f7fb;
  --bg-soft: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5f5;
  --text-main: #0f172a;
  --text-muted: #475569;

  /* Accent + status */
  --blue: #1d4ed8;
  --blue-soft: #e0e7ff;
  --primary: var(--blue);
  --primary-soft: var(--blue-soft);
  --green: #16a34a;
  --red: #dc2626;
  --orange: #f97316;
  --orange-dark: #ea580c;

  /* Typography */
  --font-sans: "IBM Plex Sans", "Source Sans 3", "Public Sans", "Segoe UI", sans-serif;
  --text-xs: 12px;
  --text-sm: 14px;
  --text-md: 16px;
  --text-lg: 18px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 28px;
  --line-tight: 1.25;
  --line-base: 1.5;
  --h1-size: 24px;
  --h1-line: 1.2;
  --h1-weight: 600;
  --h1-letter: -0.01em;
  --h2-size: 18px;
  --h2-line: 1.3;
  --h2-weight: 600;
  --h2-letter: -0.005em;
  --h3-size: 16px;
  --h3-line: 1.35;
  --h3-weight: 600;
  --h3-letter: 0;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* Radius + shadows */
  --radius-sm: 8px;
  --radius-md: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.12);

  /* Icons */
  --icon-btn-size: 36px;
  --icon-size: 16px;
  --icon-size-lg: 18px;

  /* Sticky offsets */
  --sticky-offset: 58px;
}

@media (pointer: coarse) {
  :root {
    --icon-btn-size: 40px;
    --icon-size: 18px;
    --icon-size-lg: 20px;
  }
}

@media (min-width: 768px) {
  :root {
    --h1-size: 28px;
    --h2-size: 20px;
    --h3-size: 18px;
  }
}

@media (min-width: 1280px) {
  :root {
    --h1-size: 32px;
    --h2-size: 22px;
    --h3-size: 18px;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--line-base);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.app-loading .app-shell {
  visibility: hidden;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
  width: 100%;
}

.sidebar {
  width: 280px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  height: 100vh;
  height: 100svh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-brand {
  padding: 1.15rem 1rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-company {
  font-size: var(--text-lg);
  font-weight: 700;
}

.sidebar-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.sidebar-actions {
  margin-top: auto;
  padding: 0.9rem 1rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
}

.sidebar-actions .btn {
  flex: 1;
  justify-content: center;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: 280px;
}

.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 2rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
}

.mobile-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 950;
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid var(--border);
  padding: 0.6rem 1rem calc(env(safe-area-inset-bottom, 0px) + 0.8rem);
  display: none;
  gap: 0.75rem;
  justify-content: space-between;
  box-shadow: 0 -12px 24px rgba(15, 23, 42, 0.08);
}

.mobile-actions .btn {
  flex: 1;
  justify-content: center;
}

.mobile-actions .btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

body.sidebar-open .mobile-actions {
  display: none;
}

.brand-meta{
  display:flex;
  align-items:center;
  gap:.75rem;
  margin-left:auto;
}

.lang-label{
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 600;
}

.lang-select{
  border:1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  background: var(--surface);
  font-size: var(--text-sm);
  color: var(--text-main);
}

.lang-select:focus{
  outline: none;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.18);
  border-color: rgba(29, 78, 216, 0.6);
}

.brand{
  display:flex;
  flex-direction:column;
  min-width:0;
  flex:1;
}

.sidebar-toggle{display:none;}
.sidebar-overlay{display:none;}
body.sidebar-open{overflow:hidden;}

.btn{
  background: var(--surface);
  border:1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  color:var(--text-main);
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  gap:.4rem;
  font-weight:600;
  min-height: 36px;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.btn:hover{
  background: var(--bg-soft);
}

.btn.primary{
  background: var(--primary);
  border-color: var(--primary);
  color:#fff;
}
.btn.primary:hover{
  background: #1e40af;
}
.btn.primary:disabled{
  opacity:.65;
  cursor:not-allowed;
}

.btn.danger{
  background:#fee2e2;
  border-color:#fecaca;
  color:#991b1b;
}


.btn.success{
  background: var(--green);
  border-color: var(--green);
  color:#fff;
}
.btn.success:hover{filter:brightness(0.95)}
.btn.danger:hover{
  background:#fecaca;
}


.brand-title {
  font-size: var(--text-xl);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-title,
.section-title,
.subsection-title,
.dialog-title {
  color: var(--text-main);
  max-width: 48ch;
  text-wrap: balance;
}

.page-title {
  font-size: var(--h1-size);
  line-height: var(--h1-line);
  font-weight: var(--h1-weight);
  letter-spacing: var(--h1-letter);
  margin: 0 0 var(--space-3);
}

.section-title {
  font-size: var(--h2-size);
  line-height: var(--h2-line);
  font-weight: var(--h2-weight);
  letter-spacing: var(--h2-letter);
  margin: var(--space-5) 0 var(--space-2);
}

.subsection-title {
  font-size: var(--h3-size);
  line-height: var(--h3-line);
  font-weight: var(--h3-weight);
  letter-spacing: var(--h3-letter);
  margin: var(--space-4) 0 var(--space-2);
}

.dialog-title {
  font-size: var(--h2-size);
  line-height: var(--h2-line);
  font-weight: var(--h2-weight);
  letter-spacing: var(--h2-letter);
  margin: 0;
}

.heading-help {
  margin: 0 0 var(--space-4);
  color: var(--text-muted);
  font-size: var(--text-sm);
  max-width: 60ch;
}

.brand-title.page-title {
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header .page-title {
  margin-bottom: 0;
}

.page-header {
  margin-bottom: var(--space-5);
}

@media (max-width: 430px) {
  .page-title,
  .section-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}
.brand-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag {
  font-size: 0.8rem;
  color: var(--blue);
  background: var(--blue-soft);
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
}

.top-nav {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 2rem;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.nav-link {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--text-muted);
  white-space: nowrap;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
}

.nav-link:hover {
  background: var(--bg-soft);
  color: var(--text-main);
}

.nav-link.active {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: var(--blue);
}


/* Sidebar navigation (e-boekhouden stijl) */
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.85rem 0.85rem 1rem;
  background: transparent;
  border-bottom: none;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-nav .nav-link {
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-md);
  color: var(--text-main);
  border: 1px solid transparent;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  min-height: 44px;
}

.sidebar-nav .nav-label {
  flex: 1;
}

.sidebar-nav .nav-link:hover {
  background: var(--bg-soft);
  color: var(--text-main);
}

.sidebar-nav .nav-link.active {
  background: var(--blue-soft);
  color: var(--primary);
  border-color: rgba(29, 78, 216, 0.25);
}

.sidebar-nav .nav-link--primary {
  font-weight: 750;
}

.nav-section {
  margin-top: 0.4rem;
}

.nav-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-sm);
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  min-height: 44px;
}

.nav-caret {
  display: none;
}

.nav-section-toggle:hover {
  background: var(--bg-soft);
}

.nav-sub {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: 0.15rem;
  margin-left: 0;
  padding-left: 0;
  border-left: none;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-nav .nav-sub .nav-link {
  font-size: var(--text-sm);
  color: var(--text-main);
  padding-left: 1.4rem;
}

.sidebar-nav .nav-group > .nav-link {
  font-weight: 700;
}

.nav-sub--nested {
  margin-left: 0.2rem;
  padding-left: 0.45rem;
  border-left: 1px solid var(--border-soft);
}

.sidebar-nav .nav-sub--nested .nav-link {
  padding-left: 2.2rem;
  font-size: var(--text-xs);
}

.sidebar-nav .nav-sub .nav-link.active {
  color: var(--primary);
}

/* Make sure the main header scrolls with content in this layout */
.app-header--main {
  position: sticky;
  top: 0;
  z-index: 20;
}

@media (max-width: 900px) {
  .sidebar-toggle{display:inline-flex;}
  .sidebar {
    width: min(86vw, 320px);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    transform: translateX(-110%);
    transition: transform 0.2s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    will-change: transform;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 900;
  }
  .sidebar-overlay[hidden] { display: none; }
  .app-main {
    margin-left: 0;
  }
  .app-header { padding: 0.75rem 1rem; }
  .page { padding: 1rem 1rem 2rem; }
}
.page {
  flex: 1;
  padding: 1rem 2rem 2.5rem;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}

.page-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 12px;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.breadcrumbs-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
}

.breadcrumbs-link:hover {
  color: var(--text-main);
}

.breadcrumbs-link.is-current {
  color: var(--text-main);
  pointer-events: none;
}

.breadcrumbs-sep {
  color: var(--text-muted);
}

.breadcrumbs-current {
  color: var(--text-main);
  font-weight: 600;
}

#breadcrumbSepYear,
#breadcrumbYear {
  display: none;
}

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

.summary-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.95rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.summary-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.summary-amount {
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: var(--line-tight);
}

.summary-card.income .summary-amount {
  color: var(--green);
}

.summary-card.expense .summary-amount {
  color: var(--red);
}

@media (max-width: 820px) {
  .summary-row {
    grid-template-columns: unset;
    grid-auto-flow: column;
    grid-auto-columns: minmax(210px, 1fr);
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }
  .summary-row::-webkit-scrollbar {
    height: 6px;
  }
  .summary-row::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.2);
    border-radius: 999px;
  }
}

/*
 * Jaarfilter styling.  De jaarfilter staat direct onder de samenvatting en
 * laat de gebruiker een specifiek jaar of 'Alle jaren' kiezen.  Door de
 * select te stylen past deze mooi in de lay-out zonder op te vallen.
 */
.year-filter {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: var(--text-sm);
}

.year-filter label {
  color: var(--text-muted);
}

.year-filter select {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--text-sm);
  color: var(--text-main);
}

.year-block-picker {
  display: none;
  width: 100%;
}

.year-filter.is-blocks {
  align-items: stretch;
}

.year-filter.is-blocks label,
.year-filter.is-blocks select {
  display: none;
}

.year-filter.is-blocks .year-block-picker {
  display: block;
}

.year-filter.is-blocks .jr-year-picker {
  margin: 0;
}

/*
 * Layout edit mode styles.  When layout editing is enabled via the settings,
 * navigation links and panels become draggable.  These styles provide a
 * dashed border and move cursor to indicate their draggable state.  The
 * .layout-edit-actions container is hidden by default and becomes visible
 * during edit mode.
 */
.layout-edit-mode .top-nav .nav-link,
.layout-edit-mode .content-grid > .panel {
  cursor: move;
  border: 1px dashed var(--border-strong);
}

.layout-edit-actions.hidden {
  display: none;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr);
  gap: 1.25rem;
}

@media (max-width: 900px) {
  .page {
    padding: 1rem;
  }
  .content-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 700px) {
  .panel {
    padding: 0.85rem;
  }
  .panel-header {
    margin-bottom: 0.6rem;
  }
  .summary-row {
    gap: 0.7rem;
  }
}

@media (max-width: 760px) {
  .mobile-actions {
    display: flex;
  }
  .page {
    padding-bottom: 6rem;
  }
}

.panel {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.panel-header {
  margin-bottom: 0.75rem;
}

.panel-header h2 {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}

.panel-caption {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.panel-caption.heading-help {
  margin: 0;
}

.panel-header--with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.panel-header--with-action .panel-header-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.panel-add-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: none;
  background: var(--primary);
  color: #ffffff;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(29, 78, 216, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}

.panel-add-btn:hover {
  background: #1e40af;
  box-shadow: 0 12px 22px rgba(29, 78, 216, 0.35);
  transform: translateY(-1px);
}

.panel-add-btn:active {
  transform: translateY(0);
  box-shadow: 0 8px 16px rgba(249, 115, 22, 0.25);
}

.panel-add-btn:focus-visible {
  outline: 3px solid rgba(29, 78, 216, 0.35);
  outline-offset: 2px;
}

@media (max-width: 700px) {
  .panel-add-btn {
    width: 40px;
    height: 40px;
    font-size: 1.4rem;
  }
}


.tx-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}

@media (max-width: 700px) {
  .tx-form {
    grid-template-columns: 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
}

.field label {
  color: var(--text-muted);
}

.dir-toggle {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.dir-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.dir-toggle label {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
}

.dir-toggle label:hover {
  background: var(--bg-soft);
}

.dir-toggle input:checked + label {
  background: var(--text-main);
  border-color: var(--text-main);
  color: #fff;
}

input,
select,
textarea {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-main);
  font-size: var(--text-sm);
}

input:not([type="checkbox"]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(29, 78, 216, 0.65);
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.14);
}

@media (max-width: 640px) {
  input:not([type="checkbox"]),
  select,
  textarea {
    font-size: 16px;
  }
}

.form-grid{
  display:grid;
  gap:.75rem;
}
.form-field{
  display:grid;
  gap:.35rem;
}
.label{
  color:var(--text-muted);
  font-weight:700;
  font-size: var(--text-sm);
}

.muted{color:var(--text-muted);}

.input-like:focus-within{
  border-color: rgba(37, 99, 235, 0.65);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

@supports (backdrop-filter: blur(2px)) {
  @media (max-width: 900px) {
    .sidebar-overlay { backdrop-filter: blur(2px); }
  }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .sidebar { transition: none !important; }
  .btn { transition: none !important; }
}


/* Checkbox reset (global input styles would otherwise make checkboxes look like empty pills) */
input[type="checkbox"]{
  padding: 0;
  border-radius: 4px;
  width: 16px;
  height: 16px;
  border: 1px solid var(--border-strong);
  background: #fff;
  appearance: auto;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-start;
  margin-top: 0.25rem;
}

button:not(.btn):not(.icon-btn):not(.nav-link) {
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--primary);
  color: #ffffff;
  font-size: var(--text-sm);
  cursor: pointer;
}

button:not(.nav-link):not(.icon-btn):not(.btn):hover {
  filter: brightness(0.95);
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

:where(a, button, .btn, .icon-btn, .nav-link):focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.2);
}

.message {
  margin-top: 0.5rem;
  font-size: var(--text-sm);
  min-height: 1.1rem;
}

.message.ok {
  color: var(--green);
}

.message.error {
  color: var(--red);
}

.table-wrapper {
  max-height: min(520px, 60vh);
  overflow: auto;
}

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

thead {
  background: var(--bg-soft);
}

th,
td {
  padding: 0.4rem 0.45rem;
  border-bottom: 1px solid var(--border);
}

th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
}

.amount-col {
  text-align: right;
}

.tx-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-soft);
}

.tx-table tbody tr:hover {
  background: rgba(15, 23, 42, 0.03);
}

.tx-cards {
  display: none;
  gap: var(--space-3);
}

.tx-cards-empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  color: var(--text-muted);
  background: var(--surface);
}

.tx-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: var(--space-2);
  cursor: pointer;
}

.tx-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.2);
}

.tx-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.tx-card-header-left {
  display: grid;
  gap: 2px;
}

.tx-card-title {
  font-weight: 700;
  font-size: var(--text-md);
}

.tx-card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.tx-card-amount {
  font-weight: 800;
  font-size: var(--text-lg);
  white-space: nowrap;
}

.tx-card-amount.is-in {
  color: var(--green);
}

.tx-card-amount.is-out {
  color: var(--red);
}

.tx-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tx-chip {
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-main);
  font-size: var(--text-xs);
  border: 1px solid var(--border);
}

.tx-chip--in {
  background: rgba(22, 163, 74, 0.12);
  color: #166534;
  border-color: rgba(22, 163, 74, 0.2);
}

.tx-chip--out {
  background: rgba(220, 38, 38, 0.1);
  color: #991b1b;
  border-color: rgba(220, 38, 38, 0.2);
}

@media (max-width: 1024px) {
  .col-account,
  .col-vat {
    display: none;
  }
}

@media (max-width: 900px) {
  .col-type {
    display: none;
  }
}

@media (max-width: 760px) {
  #txTableWrapper {
    display: none;
  }

  .bulk-edit-toolbar {
    display: none;
  }

  .tx-cards {
    display: grid;
  }
}

@media (max-width: 760px) {
  body[data-view="dashboard"] .year-filter,
  body[data-view="mutaties"] .year-filter,
  body[data-view="openposten"] .year-filter,
  body[data-view="grootboek"] .year-filter,
  body[data-view="bonnetjes"] .year-filter,
  body[data-view="icp"] .year-filter,
  body[data-view="aangiftes"] .year-filter,
  body[data-view="wv"] .year-filter,
body[data-view="balans"] .year-filter,
body[data-view="btw"] .year-filter,
body[data-view="jaarrekening"] .year-filter,
  body[data-view="vpb"] .year-filter {
    position: sticky;
    top: var(--sticky-offset);
    z-index: 40;
    background: var(--bg);
    padding: 0.35rem 0;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
  }

  .year-filter.is-blocks {
    position: static;
    background: transparent;
    padding: 0;
    margin-bottom: 1rem;
    border-bottom: none;
  }

  body[data-view="bestanden"] .report-head {
    position: sticky;
    top: var(--sticky-offset);
    z-index: 35;
    background: var(--bg);
    padding: 0.35rem 0 0.65rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
  }
}

body[data-view="jaarrekening"] .year-filter {
  display: none;
}

.action-col {
  width: 1%;
  white-space: nowrap;
}

.tx-type-income {
  color: var(--green);
}

.tx-type-expense {
  color: var(--red);
}

.app-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 0.6rem 2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.footer-right {
  text-align: right;
}

@media (max-width: 700px) {
  .app-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}



.report-head{display:flex;justify-content:space-between;align-items:flex-start;gap:1rem;margin-bottom:0.6rem;}
.report-actions{display:flex;gap:0.5rem;align-items:center;flex-wrap:wrap;}
.report-head .section-title{margin:0}

th.sortable{cursor:pointer;user-select:none;white-space:nowrap;}
th.sortable::after{content:'↕';font-size:0.8em;margin-left:0.35rem;color:var(--text-muted);}
th.sortable.sorted-asc::after{content:'↑';color:var(--text-main);}
th.sortable.sorted-desc::after{content:'↓';color:var(--text-main);}

@media (max-width: 700px){
  .report-head{flex-direction:column;align-items:stretch;}
}

.sheet-content {
  margin-top: 0.75rem;
}

.sheet-title {
  font-size: var(--text-sm);
  margin-bottom: 0.35rem;
  color: var(--text-muted);
  font-weight: 600;
}

.panel-header .section-title {
  margin-top: 0;
}

.sheet-wrapper {
  max-height: 340px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.sheet-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.45rem 0.55rem;
  white-space: nowrap;
}

.sheet-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.45rem 0.55rem;
  background: var(--bg-soft);
}

.sheet-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Dashboard */
.dashboard-toolbar {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 1rem;
}

.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.kpi-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 0.35rem;
}

.kpi-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 600;
}

.kpi-value {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.kpi-value.positive { color: var(--green); }
.kpi-value.negative { color: var(--red); }
.kpi-value.neutral { color: var(--text-main); }

.kpi-sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

@media (max-width: 1024px) {
  .dashboard-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .dashboard-kpis {
    grid-template-columns: 1fr;
  }
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
}

.dashboard-card {
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.dashboard-card-title {
  font-weight: 750;
  margin: 0 0 0.35rem;
}

.dashboard-card-title.section-title {
  font-size: var(--h3-size);
  line-height: var(--h3-line);
  font-weight: var(--h3-weight);
  margin: 0 0 0.35rem;
}

.dashboard-card-meta {
  margin-top: 0.35rem;
  font-size: 0.85rem;
}

.dashboard-card-actions {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.dashboard-balance {
  font-size: 1.9rem;
  font-weight: 850;
  letter-spacing: -0.02em;
  margin-top: 0.4rem;
}

.dashboard-balance.negative {
  color: var(--red);
}

.dashboard-balance.positive {
  color: var(--green);
}

.dashboard-card--tasks {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.dashboard-card--open-deb {
  grid-column: 2;
  grid-row: 1;
}

.dashboard-card--open-cred {
  grid-column: 2;
  grid-row: 2;
}

.dashboard-card--saldo {
  grid-column: 3;
  grid-row: 1 / span 2;
}

.dashboard-card--news {
  grid-column: 1 / span 2;
  grid-row: 3;
}

.dashboard-news {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.dashboard-pl {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.dashboard-pl-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.dashboard-pl-row--total {
  border-top: 1px dashed var(--border-strong);
  padding-top: 0.45rem;
  margin-top: 0.25rem;
}

.dashboard-card--pl {
  grid-column: 3;
  grid-row: 3;
}

@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-card--tasks,
  .dashboard-card--open-deb,
  .dashboard-card--open-cred,
  .dashboard-card--saldo,
  .dashboard-card--news,
  .dashboard-card--pl {
    grid-column: auto;
    grid-row: auto;
  }
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Bestanden */
.files-layout {
  display: flex;
  gap: 1rem;
  align-items: stretch;
}

.files-sidebar {
  flex: 0 0 220px;
  width: 220px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  border-radius: 0.75rem;
  padding: 0.5rem;
}

.files-sidebar-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0.15rem 0.35rem 0.4rem;
}

.files-folder {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-main);
  border-radius: 0.6rem;
  padding: 0.45rem 0.55rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.files-folder:hover {
  background: rgba(15, 23, 42, 0.05);
}

.files-folder.active {
  background: #ffffff;
  border-color: var(--border);
}

.files-main {
  flex: 1 1 auto;
  min-width: 0;
}

.files-search {
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  width: min(320px, 100%);
}

.files-upload {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.files-upload select,
.files-upload input[type="text"] {
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  background: #ffffff;
}

.files-upload .btn {
  white-space: nowrap;
}

/* Customers */
.customers-layout{
  display:grid;
  grid-template-columns:280px 1fr;
  gap:24px;
}
.customers-sidebar{
  background:var(--bg-panel);
  border:1px solid var(--border);
  border-radius:16px;
  padding:16px;
}
.customers-sidebar-head{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.customers-search{
  border:1px solid var(--border);
  border-radius:0.6rem;
  padding:0.35rem 0.6rem;
  font-size:0.85rem;
  width:100%;
  background:#fff;
}
.customers-list{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin-top:12px;
}
.customer-item{
  border:1px solid var(--border);
  background:#fff;
  border-radius:12px;
  padding:10px 12px;
  text-align:left;
  cursor:pointer;
  display:flex;
  flex-direction:column;
  gap:4px;
}
.customer-item:hover{background:var(--bg-soft);}
.customer-item.is-active{
  background:var(--blue-soft);
  border-color:rgba(37,99,235,0.3);
}
.customer-name{font-weight:600;}
.customer-meta{font-size:12px;color:var(--text-muted);}
.customers-main{display:flex;flex-direction:column;gap:16px;}
.customers-main-head{display:flex;justify-content:space-between;align-items:flex-start;}
.customers-section{margin-top:4px;}
.invoice-customer-cell{display:flex;align-items:center;gap:8px;}
.icon-btn--sm{width:28px;height:28px;border-radius:8px;}

@media (max-width: 980px){
  .customers-layout{grid-template-columns:1fr;}
}

.import-optional {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-soft);
  margin-top: 0.75rem;
}

.import-optional summary {
  cursor: pointer;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.import-optional[open] summary {
  margin-bottom: 0.6rem;
}

.payroll-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.payroll-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.employees-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.employees-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.employees-filter {
  margin-bottom: 0.5rem;
}

.openposten-cards {
  display: none;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.openposten-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: var(--space-2);
}

.openposten-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.openposten-card-title {
  font-weight: 700;
}

.openposten-card-amount {
  font-weight: 800;
  white-space: nowrap;
}

.openposten-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.openposten-card-actions {
  display: flex;
  gap: 0.5rem;
}

.payroll-cards,
.employees-cards {
  display: none;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.payroll-card,
.employee-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: var(--space-2);
}

.payroll-card-header,
.employee-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.payroll-card-title,
.employee-card-title {
  font-weight: 700;
}

.payroll-card-subtitle,
.employee-card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.payroll-card-amount {
  font-weight: 800;
  font-size: var(--text-lg);
  white-space: nowrap;
}

.payroll-card-meta,
.employee-card-meta {
  display: grid;
  gap: 0.35rem;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.payroll-card-actions,
.employee-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.webhooks-grid {
  margin-bottom: 18px;
}

.webhooks-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.webhook-url {
  display: inline-block;
  padding: 6px 8px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  word-break: break-all;
}

.webhook-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #e2e8f0;
  color: #334155;
}

.webhook-pill.ok {
  background: #dcfce7;
  color: #166534;
}

.webhook-pill.warn {
  background: #fee2e2;
  color: #991b1b;
}

.webhook-payload {
  margin-top: 16px;
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px;
}

.webhook-payload-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.webhook-payload-code {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.4;
  max-height: 360px;
  overflow: auto;
}

.invoice-card {
  margin-bottom: 18px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.invoice-settings-grid,
.invoice-form-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.invoice-items-wrapper .sheet-table input,
.invoice-items-wrapper .sheet-table textarea {
  width: 100%;
}

.invoice-items-actions {
  margin: 10px 0 4px;
}

.invoice-totals {
  margin: 12px 0 16px;
  display: grid;
  gap: 6px;
  justify-content: flex-end;
  text-align: right;
  max-width: 280px;
  margin-left: auto;
}

.invoice-totals-total strong {
  font-size: 1.05em;
}

.invoice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.4;
}

.bank-head {
  margin-bottom: 12px;
}

@media (max-width: 1100px) {
  .col-pay-account,
  .col-pay-cat {
    display: none;
  }
}

@media (max-width: 900px) {
  .col-emp-iban,
  .col-emp-notes {
    display: none;
  }

  .col-op-category {
    display: none;
  }
}

@media (max-width: 760px) {
  #payrollRulesTableWrapper,
  #payrollRunsTableWrapper,
  #employeesTableWrapper,
  #employeesRunsTableWrapper {
    display: none;
  }

  .payroll-cards,
  .employees-cards {
    display: grid;
  }

  #openpostenTableWrapper {
    display: none;
  }

  .openposten-cards {
    display: grid;
  }

  .import-edit-table thead {
    display: none;
  }

  .import-edit-table tbody tr {
    display: grid;
    gap: 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-3);
    background: var(--surface);
  }

  .import-edit-table tbody td {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(0, 2fr);
    align-items: center;
    gap: 0.5rem;
    padding: 0;
    border: none;
  }

  .import-edit-table tbody td::before {
    content: attr(data-label);
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: 600;
  }
}

@media (max-width: 900px) {
  .files-layout {
    flex-direction: column;
  }
  .files-sidebar {
    width: auto;
    flex: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    background: var(--surface);
  }
  .files-sidebar-title {
    width: 100%;
    margin-left: 0;
  }
  .files-folder {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    background: var(--bg-soft);
  }
  .files-folder.active {
    background: var(--blue-soft);
    border-color: rgba(29, 78, 216, 0.3);
    color: var(--primary);
  }
}

.bestanden-cards {
  display: none;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.bestanden-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: var(--space-2);
}

.bestanden-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.bestanden-card-type {
  font-weight: 700;
  color: var(--text-main);
}

.bestanden-card-title {
  font-weight: 700;
}

.bestanden-card-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.bestanden-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (max-width: 1024px) {
  .col-bes-desc {
    display: none;
  }
}

@media (max-width: 760px) {
  #bestandenTableWrapper {
    display: none;
  }

  .bestanden-cards {
    display: grid;
  }
}


/* Layout toggle: single panel vs transacties-layout */
.content-grid.single-panel {
  grid-template-columns: minmax(0, 1fr);
}

.content-grid.single-panel .panel[data-panel-id="form"] {
  display: none;
}

.content-grid.single-panel .panel[data-panel-id="table"] {
  grid-column: 1 / -1;
}

/* Layout toggle: only show the transaction form (new transaction page) */
.content-grid.form-only {
  grid-template-columns: minmax(0, 1fr);
}

.content-grid.form-only .panel[data-panel-id="table"] {
  display: none;
}

.content-grid.form-only .panel[data-panel-id="form"] {
  grid-column: 1 / -1;
}

/* Hide summary row when not needed */
.summary-row.hidden {
  display: none;
}

/* Sheet toolbar */
.sheet-toolbar {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
}

.sheet-toolbar button {
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--accent-soft);
  color: var(--accent);
}

.sheet-toolbar button:hover {
  filter: brightness(0.95);
}

.sheet-message {
  color: var(--text-muted);
}
.sheet-message.ok {
  color: #16a34a;
}
.sheet-message.error {
  color: #dc2626;
}

/* Editable cells highlight on focus */
.sheet-table td[contenteditable="true"]:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--border-strong);
}


/* Vereenvoudigde sheet-UI met knoppen i.p.v. grote Excel-tabellen */
.sheet-section {
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

.sheet-section + .sheet-section {
  margin-top: 1rem;
}

.sheet-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.sheet-actions {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.nav-chip {
  background: var(--blue-soft);
  color: var(--blue);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border: 1px solid rgba(37, 99, 235, 0.25);
  cursor: pointer;
}

.nav-chip:hover {
  background: #dbeafe;
}

.sheet-list {
  padding-left: 1.1rem;
  margin: 0.25rem 0 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sheet-list li + li {
  margin-top: 0.25rem;
}

/* Generic helper */
.hidden {
  display: none !important;
}

/* Inline SVG icons */
.i{
  width: var(--icon-size);
  height: var(--icon-size);
  display:block;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}
.i-lg{width:var(--icon-size-lg);height:var(--icon-size-lg)}

/* --- Icon buttons in table actions --- */
.icon-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  width: var(--icon-btn-size);
  height: var(--icon-btn-size);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  cursor: pointer;
  line-height: 1;
}

.icon-btn:hover {
  background: var(--bg-soft);
}

.icon-btn.attached {
  background: var(--blue-soft);
  border-color: rgba(37, 99, 235, 0.25);
  color: var(--blue);
}

.action-stack {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* --- Modal (popup) --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  /* Moet boven de drawer (z-index: 2000) liggen */
  z-index: 3000;
}

.modal {
  width: min(620px, 100%);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
  padding: 1rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.modal-close {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
}

.modal-close:hover {
  background: var(--bg-soft);
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .modal-grid {
    grid-template-columns: 1fr;
  }
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Backwards compatible grid helpers used in markup */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
}

.btn-secondary {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-soft);
}


/* ---- Drawer (Jortt-achtige) ---- */
.drawer-overlay{
  position:fixed; inset:0;
  background:rgba(15,23,42,.35);
  display:flex; justify-content:flex-end;
  z-index:2000;
}
.drawer{
  width:min(720px, 96vw);
  height:100%;
  background: var(--surface);
  box-shadow:-20px 0 60px rgba(15, 23, 42, 0.18);
  display:flex; flex-direction:column;
}
.drawer-header{
  display:flex; align-items:flex-start; justify-content:space-between;
  padding:16px 18px;
  border-bottom:1px solid var(--border);
}
.drawer-title .dialog-title{ margin:0; }
.drawer-subtitle{ color:var(--text-muted); margin-top:4px; }
.drawer-actions{
  display:flex; gap:8px; padding:10px 18px;
  border-bottom:1px solid var(--border);
}
.icon-btn.danger{ background:#fee2e2; border-color:#fecaca; color:#b91c1c; }
.icon-btn.danger:hover{ background:#fecaca; }
.drawer-body{
  padding:16px 18px;
  overflow:auto;
}
.drawer-card{
  border:1px solid var(--border);
  border-radius: var(--radius-md);
  padding:14px;
  background: var(--surface-muted);
  margin-bottom:14px;
}
.drawer-split{
  display:grid;
  grid-template-columns:1.2fr .9fr;
  gap:14px;
}
@media (max-width: 860px){
  .drawer{ width:100vw; }
  .drawer-split{ grid-template-columns:1fr; }
  .drawer-body{ padding:14px 14px; }
  .drawer-header{ padding:14px 14px; }
  .drawer-actions{ padding:8px 14px; }
}
.card-title{ font-weight:700; margin-bottom:10px; }
.kv{
  display:grid;
  grid-template-columns:140px 1fr;
  row-gap:8px; column-gap:12px;
}
.kv .k{ color:var(--text-muted); }
.kv .v{ font-weight:600; }
.totals .total-row{
  display:flex; align-items:center; justify-content:space-between;
  padding:6px 0;
}
.totals .total-row.big{
  border-top:1px solid var(--border);
  margin-top:8px; padding-top:10px;
  font-size: var(--text-lg);
}
.attachment-preview img{
  max-width:100%;
  border-radius: var(--radius-sm);
  border:1px solid var(--border);
}
.dropzone{
  border:2px dashed #22c55e;
  border-radius: var(--radius-md);
  padding:14px;
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  background:#f0fdf4;
}
.dropzone.dragover{
  background:#dcfce7;
}
.btn-secondary{
  background: var(--surface);
  border:1px solid var(--border);
  border-radius: var(--radius-sm);
  padding:8px 12px;
}
.btn-primary{
  background: var(--text-main);
  color:#fff;
  border:1px solid var(--text-main);
  border-radius: var(--radius-sm);
  padding:10px 14px;
}
.drawer-footer{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px;
}
.drawer-footer-actions{ display:flex; gap:10px; }

.tx-row-click{cursor:pointer;}


/* Attachment modal */
.modal.modal-wide { width: min(920px, 100%); }

.att-empty { margin-top: .75rem; }
.att-empty-title { font-weight: 700; margin-bottom: .5rem; }

.att-dropzone {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .9rem 1rem;
  border: 2px dashed #22c55e;
  border-radius: 12px;
  background: rgba(34, 197, 94, .07);
}

.att-dropzone.dragover {
  background: rgba(34, 197, 94, .12);
  border-color: #16a34a;
}

.att-preview-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin: .75rem 0;
}

.att-preview-frame {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  min-height: 420px;
}

.att-preview-frame iframe,
.att-preview-frame img {
  width: 100%;
  height: 520px;
  display: block;
  border: 0;
  object-fit: contain;
}


/* Dropdown in sheet cells */
.sheet-table td .cell-select{width:100%; border:1px solid #d7dde6; border-radius:10px; padding:8px 10px; font: inherit; background:#fff;}

/* Bulk type actions for categories */
.bulk-type-bar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:10px 12px;
  border:1px solid #e5e7eb;
  border-radius:10px;
  background:#fff;
  margin:10px 0 12px;
}
.bulk-hint{
  color:#6b7280;
  font-size:13px;
}
.bulk-right{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.bulk-label{
  font-size:13px;
  color:#374151;
}
.bulk-select{
  border:1px solid #d1d5db;
  border-radius:8px;
  padding:6px 10px;
  background:#fff;
}
.select-all{
  display:flex;
  align-items:center;
  gap:6px;
  font-weight:600;
}
.row-actions{
  white-space:nowrap;
}
.row-select-wrap{
  display:inline-flex;
  align-items:center;
  margin-right:8px;
}
.row-select{
  width:16px;
  height:16px;
}
.sheet-message.warning{ color:#b45309; }
.sheet-message.success{ color:#15803d; }


/* Categorieën: tabel direct zonder extra witruimte */
.sheet-section--flush {
  margin-top: 0;
}


/* Categorieën: geen extra ruimte boven de tabel */
.sheet-content--flush {
  margin-top: 0;
}

/* ------------------------------
   Jortt-achtige rapporten (W/V + Balans)
   ------------------------------ */
.jortt-report{max-width:980px;margin:0 auto;padding:6px 2px 14px 2px}
.jortt-report-top{display:flex;justify-content:space-between;align-items:center;font-size:12px;color:var(--text-muted)}
.jortt-report-brand{color:var(--text-main)}
.jortt-report-title{margin:10px 0 12px 0;font-size:22px;font-weight:700;color:var(--text-main)}
.jortt-report-title.section-title{font-size:var(--h2-size);line-height:var(--h2-line);margin:var(--space-4) 0 var(--space-3)}
.jortt-report-title.subsection-title{font-size:var(--h3-size);line-height:var(--h3-line);margin:var(--space-3) 0 var(--space-2)}
.jortt-section-bar .subsection-title{margin:0;font-size:inherit;line-height:inherit;font-weight:inherit}
.jortt-balance-subtitle.subsection-title{margin:var(--space-3) 0 var(--space-2)}
.jortt-report-sub{padding:10px 0 12px 0;border-top:2px solid var(--blue)}
.jortt-report-company{font-weight:700;color:var(--text-main)}
.jortt-report-period{margin-top:4px;font-size:12px;color:var(--text-main)}
.jr-year-picker{margin:var(--space-3) 0 var(--space-5);padding:var(--space-4);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);box-shadow:var(--shadow-sm)}
.jr-year-title{font-weight:700;color:var(--text-main);margin-bottom:var(--space-2)}
.jr-year-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:var(--space-2)}
.jr-year-btn{display:flex;align-items:center;justify-content:center;min-height:72px;padding:12px 14px;border-radius:12px;border:1px solid var(--border);background:var(--surface-muted);color:var(--text-main);font-weight:700;font-size:26px;line-height:1;letter-spacing:-0.01em;cursor:pointer;transition:background .15s ease,border-color .15s ease,transform .15s ease}
.jr-year-btn:hover{background:var(--blue-soft);border-color:var(--blue);transform:translateY(-1px)}
.jr-year-btn.is-current{background:var(--blue);border-color:var(--blue);color:#fff}
.jr-year-help{margin-top:var(--space-2);font-size:var(--text-sm);color:var(--text-muted)}
.jr-year-empty{font-size:var(--text-sm);color:var(--text-muted)}
.year-gated-active #yearBlockPicker ~ *{display:none !important}
.settings-logo-preview-wrap{margin-top:10px;display:flex;align-items:center;gap:12px;min-height:44px}
.settings-logo-preview{max-width:220px;max-height:72px;display:block;border:1px solid var(--border);border-radius:8px;background:#fff;object-fit:contain;padding:4px}

.jortt-section{margin-top:14px}
.jortt-section-bar{display:flex;justify-content:space-between;align-items:center;border-top:2px solid var(--blue);border-bottom:2px solid var(--blue);padding:10px 0;font-weight:700;color:var(--text-main)}
.jortt-section-total{white-space:nowrap}

.jortt-rows{padding-top:6px}
.jortt-row{display:flex;justify-content:space-between;gap:12px;padding:7px 0;border-bottom:1px solid var(--border)}
.jortt-row:last-child{border-bottom:0}
.jortt-row .name{color:var(--text-main)}
.jortt-row .value{white-space:nowrap}

.jortt-row.group{font-weight:700;border-bottom:1px solid var(--border-strong)}
.jortt-row.sub{padding-left:22px;color:var(--text-main)}
.jortt-row.sub .name::before{content:"↳ ";color:var(--text-muted)}

.jortt-report-result{display:flex;justify-content:flex-end;gap:18px;margin-top:18px;font-weight:700;color:var(--text-main)}
.jortt-report-result-value{white-space:nowrap}

.jortt-balance-grid{display:grid;grid-template-columns:1fr 1fr;gap:26px;margin-top:8px}
.jortt-balance-col .jortt-section-bar{margin-bottom:6px}
.jortt-balance-subtitle{margin-top:12px;font-weight:700;color:var(--text-main)}
.jortt-balance-note{margin-top:12px;font-size:13px;color:var(--text-muted)}

@media (max-width: 860px){
  .jortt-balance-grid{grid-template-columns:1fr}
}


/* BTW Jortt-style form */
.btw-header{display:flex;justify-content:space-between;align-items:flex-end;gap:12px;margin-top:6px}
.btw-controls{display:flex;gap:8px;align-items:center}
.btw-select{padding:8px 10px;border:1px solid #ddd;border-radius:10px;background:#fff;font-size:13px}
.btw-section{margin-top:16px}
.btw-section-title{font-weight:700;margin-bottom:6px}
.btw-section-title.subsection-title{margin:0 0 6px;font-size:var(--h3-size);line-height:var(--h3-line)}
.btw-divider{height:2px;background:#3e78a5;margin:8px 0 6px 0}
.btw-row{display:grid;grid-template-columns:34px 1fr 140px 140px;gap:10px;align-items:center;padding:10px 0;border-bottom:1px solid #eee}
.btw-row:last-child{border-bottom:0}
.btw-code{font-weight:700;color:#111}
.btw-desc{font-size:13px;color:#111}
.btw-box{width:100%;padding:8px 10px;border:1px solid #d9d9d9;border-radius:10px;background:#fff;text-align:right}
.btw-box[readonly]{background:#fafafa}
.btw-box--ghost{border:0;background:transparent}
.btw-disabled .sheet-note{margin-top:10px}
.btw-footnote{margin-top:12px;font-size:13px;color:#444}

@media (max-width: 860px){
  .btw-row{grid-template-columns:34px 1fr 1fr;grid-template-areas:
    "code desc desc"
    "base base vat";
  }
  .btw-row .btw-code{grid-area:code}
  .btw-row .btw-desc{grid-area:desc}
  .btw-row input:nth-of-type(1){grid-area:base}
  .btw-row input:nth-of-type(2){grid-area:vat}
}


.btw-export{margin-left:8px;}


@media print{
  /* Print only the active report */
  body.print-report{
    background:#fff !important;
  }
  body.print-report .app-header,
  body.print-report .sidebar,
  body.print-report .top-nav,
  body.print-report .summary-row,
  body.print-report .year-filter,
  body.print-report .panel[data-panel-id="form"],
  body.print-report .no-print{
    display:none !important;
  }
  body.print-report #sheetToolbar{
    display:none !important;
  }
  body.print-report .app-shell{
    display:block !important;
  }
  body.print-report .app-main{
    width:100% !important;
  }
  body.print-report .content-grid{
    display:block !important;
    padding:0 !important;
    margin:0 !important;
  }
  body.print-report .panel[data-panel-id="table"]{
    border:0 !important;
    box-shadow:none !important;
    padding:0 !important;
    margin:0 !important;
  }
  body.print-report .panel-header{
    display:none !important;
  }
  body.print-report .sheet-content{
    padding:0 !important;
  }
  body.print-report .btw-controls,
  body.print-report .reports-card,
  body.print-report #btwExportPdf,
  body.print-report #wvExportPdf,
  body.print-report #balExportPdf,
  body.print-report .btw-footnote{
    display:none !important;
  }
  body.print-report .report{
    max-width:none !important;
    padding:0 !important;
    margin:0 !important;
  }
}


/* --- Auth pages (login/register) --- */
.auth-body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
}

.auth-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(37, 99, 235, 0.18), transparent 60%),
    radial-gradient(900px 500px at 100% 20%, rgba(22, 163, 74, 0.14), transparent 55%),
    linear-gradient(180deg, #ffffff, var(--bg));
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem 1.25rem 1.1rem;
  box-shadow: 0 18px 40px rgba(17, 24, 39, 0.08);
}

.auth-lang {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
}

.auth-lang label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.auth-lang select {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  background: #fff;
  color: var(--text-main);
}

.auth-brand {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  margin-bottom: 1rem;
}

.auth-logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 800;
}

.auth-brand h1 {
  margin: 0;
  font-size: var(--h1-size);
  line-height: var(--h1-line);
  font-weight: var(--h1-weight);
  letter-spacing: var(--h1-letter);
}

.auth-brand p {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.auth-label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-main);
}

.auth-form input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-main);
}

.auth-form select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-main);
}

.auth-form input:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.65);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.auth-form select:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.65);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.auth-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-main);
}

.auth-check input {
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.auth-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.auth-link {
  color: var(--blue);
  text-decoration: none;
  font-size: 0.9rem;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-link[data-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}

.auth-message {
  min-height: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-message.error {
  color: #b91c1c;
}

.auth-message.success {
  color: var(--green);
}

.auth-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1rem;
}

.auth-step {
  font-size: 0.72rem;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: #fff;
}

.auth-step.active {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: transparent;
  font-weight: 600;
}

.auth-step.done {
  color: var(--green);
  background: rgba(22, 163, 74, 0.12);
  border-color: transparent;
}

.auth-info {
  margin: 0 0 0.4rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.nav-spacer {
  flex: 1 1 auto;
}

.input-like {
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
}

.team-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.team-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.team-avatar {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.team-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}

.team-title {
  font-weight: 650;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.team-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  word-break: break-word;
}

.team-role {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.team-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 600;
}

.team-badge.pending {
  background: rgba(249, 115, 22, 0.12);
  color: var(--orange-dark);
}

.team-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.team-role-select {
  min-width: 130px;
}

@media (max-width: 700px) {
  .team-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .team-actions {
    width: 100%;
    justify-content: flex-start;
  }
}


.jortt-report-meta{display:flex;align-items:center;gap:8px;}
.report-export{white-space:nowrap;}

.reports-card{
  background:#fff;
  border:1px solid var(--border);
  border-radius:1rem;
  overflow:hidden;
}
.reports-list{display:flex;flex-direction:column;}
.report-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  padding:0.85rem 1rem;
  border-bottom:1px solid var(--border);
}
.report-row:last-child{border-bottom:0;}
.report-name{font-weight:600;}
.reports-note{margin:0.75rem 1rem;}


/* --- Geldzaken --- */
.gz-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:1rem;
  margin:0 0 0.75rem;
}
.gz-header .sheet-note{margin:0.4rem 0 0;}
.gz-meta{
  margin-top:0.35rem;
  font-size:0.85rem;
  color:var(--text-muted);
}
.gz-meta-label{font-weight:600;color:var(--text-main);}
.gz-meta-sep{margin:0 0.25rem;color:var(--text-muted);}
.gz-meta-value{font-weight:600;color:var(--text-main);}
.gz-summary-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:1rem;
  margin:0.75rem 0 0.4rem;
}
.gz-summary{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(160px,1fr));
  gap:0.75rem;
  margin-bottom:1rem;
}
.gz-card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:14px;
  padding:0.75rem 0.9rem;
  box-shadow:var(--shadow-sm);
}
.gz-card-label{font-size:0.8rem;color:var(--text-muted);}
.gz-card-value{margin-top:0.3rem;font-size:1.25rem;font-weight:700;color:var(--text-main);}
.gz-status{
  font-size:0.9rem;
  color:var(--muted);
  margin-top:0.5rem;
}
.gz-header .gz-status{margin-top:0;}
.gz-status.saving{color:var(--text-main);}
.gz-status.error{color:#b91c1c;}

.gz-section{
  background:#fff;
  border:1px solid var(--border);
  border-radius:14px;
  overflow:hidden;
  margin:1rem 0;
}

.gz-section-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:1rem;
  padding:0.9rem 1rem;
  background:var(--bg-soft);
  border-bottom:1px solid var(--border);
}

.gz-section-head h4{
  margin:0;
  font-size:1.05rem;
}

.gz-sub{
  margin-top:0.2rem;
  font-size:0.85rem;
  color:var(--muted);
}

.gz-actions{
  display:flex;
  align-items:center;
  gap:0.75rem;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.gz-total{
  font-weight:600;
  white-space:nowrap;
}

.gz-table th:nth-child(2), .gz-table td:nth-child(2){
  text-align:right;
  width:160px;
}

.gz-input{
  width:100%;
  box-sizing:border-box;
  border:1px solid var(--border);
  border-radius:10px;
  padding:8px 10px;
  font:inherit;
  background:#fff;
}

.gz-input.gz-amount{
  text-align:right;
}
.gz-euro-field{
  display:flex;
  align-items:center;
  gap:.45rem;
  border:1px solid var(--border);
  border-radius:10px;
  background:#fff;
  padding:0 10px;
}
.gz-euro-sign{
  color:var(--text-muted);
  font-weight:800;
  flex:0 0 auto;
}
.gz-euro-field .gz-input,
.gz-euro-field .kb-input{
  border:0;
  border-radius:0;
  background:transparent;
  padding:8px 0;
}
.gz-euro-field .gz-input:focus,
.gz-euro-field .kb-input:focus{outline:none}

/* gz-delete is vervangen door row-action-btn danger — alias voor backwards compat */
.gz-delete{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:30px;
  height:30px;
  padding:0;
  border-radius:8px;
  border:1px solid #fecaca;
  background:#fee2e2;
  color:#991b1b;
  cursor:pointer;
  font-size:15px;
  line-height:1;
  transition:background .15s,border-color .15s;
}
.gz-delete:hover{
  background:#fecaca;
}

@media (max-width: 720px){
  .gz-header{flex-direction:column;align-items:flex-start;}
  .gz-summary-head{flex-direction:column;align-items:flex-start;}
}



/* Geldzaken - kas & bank gekoppeld aan rekeningen */
.kb-input{width:100%;box-sizing:border-box;padding:8px 10px;border:1px solid #e5e7eb;border-radius:10px;background:#fff;}
.gz-col-saldo{white-space:nowrap;text-align:right;}
.gz-col-num{white-space:nowrap;text-align:right;}
.gz-input[type="date"],.kb-input[type="date"]{min-width:130px;}

/* --- Chat widget (floating help) --- */
.chat-fab{position:fixed;right:18px;bottom:18px;width:54px;height:54px;border-radius:999px;border:none;cursor:pointer;box-shadow:0 10px 25px rgba(0,0,0,.18);display:flex;align-items:center;justify-content:center;font-size:22px;font-weight:700;z-index:9999;background:#111;color:#fff;}
.chat-panel{position:fixed;right:18px;bottom:84px;width:min(420px,calc(100vw - 36px));max-height:min(560px,calc(100vh - 120px));border-radius:16px;box-shadow:0 18px 40px rgba(0,0,0,.22);background:#fff;z-index:9999;display:flex;flex-direction:column;overflow:hidden;}
.chat-panel.hidden{display:none;}
.chat-panel__header{display:flex;align-items:center;justify-content:space-between;padding:12px 12px;border-bottom:1px solid rgba(0,0,0,.08);font-weight:700;}
.chat-panel__header button{border:none;background:transparent;cursor:pointer;font-size:18px;line-height:1;}
.chat-panel__messages{padding:12px 12px;overflow:auto;display:flex;flex-direction:column;gap:10px;}
.chat-msg{max-width:85%;padding:10px 12px;border-radius:14px;line-height:1.35;white-space:pre-wrap;word-break:break-word;font-size:14px;}
.chat-msg.user{align-self:flex-end;background:rgba(0,0,0,.06);}
.chat-msg.assistant{align-self:flex-start;background:rgba(17,17,17,.06);}
.chat-panel__composer{display:flex;gap:8px;padding:10px 12px;border-top:1px solid rgba(0,0,0,.08);}
.chat-panel__composer textarea{flex:1;resize:none;min-height:40px;max-height:120px;padding:10px 12px;border-radius:12px;border:1px solid rgba(0,0,0,.16);font-family:inherit;font-size:14px;}
.chat-panel__composer button{padding:10px 12px;border-radius:12px;border:none;cursor:pointer;background:#111;color:#fff;font-weight:600;}



/* Categories grouping */
.sheet-table tr.sheet-group-row td {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  background: #f6f6f6;
}

/* ------------------------------
   Stap 2: nieuwe overzichten
------------------------------ */
.report-meta{margin:.25rem 0 .75rem}
.report-summary-row{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.75rem;margin:0 0 .75rem}
.report-pill{border:1px solid var(--border);background:var(--surface);border-radius:14px;padding:.65rem .75rem;box-shadow:var(--shadow-sm)}
.report-pill-label{font-size:var(--text-sm);color:var(--text-muted)}
.report-pill-value{font-size:1.05rem;font-weight:700;margin-top:.2rem}
.empty-state{padding:var(--space-4);border:1px dashed var(--border);border-radius:var(--radius-md);color:var(--text-muted);background:var(--bg-soft)}
.report-footer{margin-top:.5rem;display:flex;justify-content:flex-end;color:var(--text-muted)}
.report-total{font-weight:700;color:var(--text-main)}

/* Report tables: slightly larger and with a sticky header */
.report-table-wrapper{
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.report-table{
  font-size: var(--text-sm);
}

.report-table th,
.report-table td{
  padding: 0.5rem 0.65rem;
}

.report-table thead th{
  position: sticky;
  top: 0;
  z-index: 2;
}

.btn.small{padding:6px 10px;border-radius:10px;font-size:13px}

/* Consistente icon-knoppen voor edit/delete in alle tabellen */
.row-action-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:30px;
  height:30px;
  padding:0;
  border-radius:8px;
  border:1px solid var(--border);
  background:var(--surface);
  color:var(--text-muted);
  cursor:pointer;
  font-size:15px;
  line-height:1;
  transition:background .15s,border-color .15s,color .15s;
}
.row-action-btn:hover{
  background:var(--bg-soft);
  color:var(--text-main);
}
.row-action-btn.danger{
  color:#991b1b;
  border-color:#fecaca;
  background:#fee2e2;
}
.row-action-btn.danger:hover{
  background:#fecaca;
}
.row-actions-cell{
  white-space:nowrap;
  text-align:right;
  display:flex;
  gap:4px;
  align-items:center;
  justify-content:flex-end;
}

.import-box{display:flex;flex-wrap:wrap;gap:.5rem;align-items:center;margin:.5rem 0 .75rem}
.import-box input[type="file"]{max-width:280px}
.import-actions{display:flex;justify-content:flex-end;margin-top:.6rem}
.import-edit-table input,
.import-edit-table select{width:100%;min-width:110px}
.import-edit-table input[type="number"]{text-align:right;min-width:90px}


/* Grootboek selectie (e-boekhouden-achtig) */
.gb-select-wrap{max-width:920px}
.gb-select-title{font-size:1.6rem;margin:.25rem 0 1rem}
.gb-select-title.section-title{font-size:var(--h2-size);line-height:var(--h2-line);margin:0 0 var(--space-4)}
.gb-select-card{
  background:#fff;
  border:1px solid var(--border);
  border-radius:22px;
  padding:1.25rem 1.25rem 1.1rem;
  box-shadow:0 8px 24px rgba(15,23,42,.06);
}

.gb-row{display:flex;gap:1rem;align-items:center;flex-wrap:wrap}
.gb-row-label{min-width:90px;color:var(--text-muted);font-weight:600}

.gb-periods{display:flex;gap:1.1rem;flex-wrap:wrap;align-items:center}
.gb-radio{display:flex;gap:.5rem;align-items:center;font-weight:600}
.gb-radio input{width:18px;height:18px}

.gb-dates{margin:1rem 0 .9rem;display:grid;gap:.65rem;max-width:520px}
.gb-date-row{display:grid;grid-template-columns:70px 1fr 44px;gap:.75rem;align-items:center}
.gb-date-label{color:var(--text-muted);font-weight:700}

.gb-date-control{
  display:grid;
  grid-template-columns:40px 1fr 40px;
  align-items:center;
  border:1px solid var(--border);
  border-radius:12px;
  overflow:hidden;
  background:#fff;
}
.gb-date-control input[type="date"]{
  border:0;
  padding:.65rem .6rem;
  width:100%;
  font-weight:700;
  background:transparent;
}
.gb-icon-btn{
  border:0;
  background:transparent;
  cursor:pointer;
  font-size:1.2rem;
  line-height:1;
  height:42px;
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--text-muted);
}
.gb-icon-btn:hover{background:var(--bg-soft);color:var(--text-main)}
.gb-cal-btn{
  border:1px solid var(--border);
  border-radius:12px;
  height:42px;
  background:#fff;
}
.gb-cal-btn:hover{background:var(--bg-soft)}

.gb-field{margin:.65rem 0;max-width:520px}
.gb-field label{display:block;font-weight:700;margin-bottom:.35rem;color:var(--text-muted)}
.gb-field select{
  width:100%;
  border:1px solid var(--border);
  border-radius:12px;
  padding:.7rem .75rem;
  font-weight:700;
  background:#fff;
}

.gb-checks{margin:1rem 0 .75rem;display:grid;gap:.6rem}
.gb-check{display:flex;gap:.6rem;align-items:center;font-weight:600;color:var(--text-main)}
.gb-check input{width:18px;height:18px}

.gb-actions{display:flex;justify-content:flex-end;margin-top:.85rem}
.gb-next{border-radius:18px;padding:.85rem 1.25rem;font-weight:800}

.gb-report{margin-top:1.1rem}
.gb-group-row td{
  background:var(--bg-soft);
  font-weight:800;
  color:var(--text-main);
}

/* ------------------------------
   Beginbalans (e-boekhouden stijl)
------------------------------ */
.bb-card{
  background:#fff;
  border:1px solid var(--border);
  border-radius:24px;
  padding:1.25rem;
  box-shadow:0 10px 30px rgba(20, 30, 70, .06);
}

.bb-card--secondary{margin-top:1.25rem}

.bb-title{margin:.1rem 0 1rem;font-size:1.6rem;letter-spacing:-.01em}
.bb-title.section-title{font-size:var(--h2-size);line-height:var(--h2-line);margin:0 0 var(--space-3)}
.bb-subtitle{margin:.1rem 0 1rem;font-size:1.35rem;letter-spacing:-.01em}
.bb-subtitle.subsection-title{font-size:var(--h3-size);line-height:var(--h3-line);margin:var(--space-3) 0 var(--space-2)}

.bb-toprow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  margin-bottom:.9rem;
}
.bb-toprow-left{font-weight:800;color:var(--text-main)}

.bb-date{display:flex;align-items:center;gap:.5rem}
.bb-date-display{
  width:160px;
  height:44px;
  border:1px solid var(--border);
  border-radius:14px;
  padding:0 .75rem;
  font-weight:800;
  background:#fff;
}
.bb-date-btn{
  width:44px;height:44px;
  border:1px solid var(--border);
  border-radius:14px;
  background:#fff;
  padding:0;
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--text-muted);
}
.bb-date-btn:hover{background:var(--bg-soft);color:var(--text-main)}
.bb-date-cal{
  width:44px;height:44px;
  border:1px solid var(--border);
  border-radius:14px;
  background:#fff;
  padding:0;
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--text-muted);
}
.bb-date-cal:hover{background:var(--bg-soft);color:var(--text-main)}
.bb-date-picker{position:absolute;opacity:0;pointer-events:none;width:0;height:0}

.bb-table-wrap{margin-top:.5rem}
.bb-table{width:100%;border-collapse:separate;border-spacing:0 .55rem}
.bb-table thead th{
  text-align:left;
  padding:0 .25rem;
  color:var(--text-muted);
  font-weight:800;
}
.bb-table tbody tr,
.bb-total-row{
  background:#fff;
}
.bb-table tbody td{
  padding:.85rem .75rem;
  border:1px solid var(--border);
  background:#fff;
}
.bb-table tbody td:first-child{border-top-left-radius:16px;border-bottom-left-radius:16px}
.bb-table tbody td:last-child{border-top-right-radius:16px;border-bottom-right-radius:16px}

.bb-col-amt{width:200px;text-align:left}
.bb-col-actions{width:40px}

.bb-desc{font-weight:800;color:var(--text-main)}

.bb-input{
  width:100%;
  height:44px;
  border:1px solid var(--border);
  border-radius:14px;
  padding:0 .75rem;
  font-weight:800;
  background:#fff;
}
.bb-input[disabled]{background:var(--bg-soft);color:var(--text-muted)}
.bb-input.bb-input-auto{
  background:var(--bg-soft);
  color:var(--text-main);
  border-color:var(--border);
  font-weight:900;
}
.bb-euro-field{
  display:flex;
  align-items:center;
  gap:.45rem;
  border:1px solid var(--border);
  border-radius:14px;
  background:#fff;
  padding:0 .75rem;
  height:44px;
}
.bb-euro-field.bb-euro-field-auto{background:var(--bg-soft)}
.bb-euro-sign{
  color:var(--text-muted);
  font-weight:900;
  flex:0 0 auto;
}
.bb-euro-field .bb-input{
  border:0;
  border-radius:0;
  background:transparent;
  height:100%;
  padding:0;
}
.bb-euro-field .bb-input[disabled]{background:transparent}
.bb-euro-field .bb-input:focus{outline:none}

.bb-total-row td{
  border:0;
  background:transparent;
  padding:.25rem .25rem;
}
.bb-total-label{font-weight:900;color:var(--text-main)}
.bb-total-cell{
  font-weight:900;
  color:var(--text-main);
  text-align:right;
}

.bb-bottom-actions{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  margin-top:.25rem;
}
.bb-add{
  border:0;
  background:var(--primary);
  color:#fff;
  border-radius:18px;
  padding:.9rem 1.35rem;
  font-weight:900;
}
.bb-add:hover{filter:brightness(.98)}

.bb-save{
  border:0;
  border-radius:18px;
  padding:.9rem 1.35rem;
  font-weight:900;
  background:var(--primary);
  color:#fff;
}
.bb-save:hover{filter:brightness(.98)}
.bb-save:disabled{opacity:.65;cursor:not-allowed}

.bb-msg{margin-top:.5rem;color:var(--text-muted);font-weight:700}
.bb-msg.ok{color:#146c2e}
.bb-msg.error{color:#b00020}

.bb-info{
  margin-top:1rem;
  border:1px solid var(--border);
  border-radius:22px;
  padding:1.1rem 1.25rem;
  background:#fff;
  color:var(--text-main);
  font-weight:700;
}
.bb-support{color:var(--primary);text-decoration:underline;cursor:pointer}

.bb-par{color:var(--text-main);opacity:.88;line-height:1.55;margin:.2rem 0 1rem}

.bb-debcred{display:grid;grid-template-columns:1fr 1fr;gap:2rem}
.bb-debcred-title{font-weight:900;margin-bottom:.75rem}
.bb-debcred-row{display:flex;justify-content:space-between;gap:1rem;margin:.55rem 0;font-weight:800}
.bb-link{
  border:0;
  padding:0;
  background:transparent;
  color:var(--primary);
  text-decoration:underline;
  font-weight:900;
  cursor:pointer;
}

.bb-modal{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center}
.bb-modal-backdrop{position:absolute;inset:0;background:rgba(15, 20, 40, .35);z-index:0}
.bb-modal-card{
  position:relative;
  z-index:1;
  width:min(520px, calc(100% - 2rem));
  background:#fff;
  border-radius:24px;
  border:1px solid var(--border);
  box-shadow:0 20px 60px rgba(0,0,0,.25);
  overflow:hidden;
}
.bb-modal-head{display:flex;align-items:center;justify-content:space-between;padding:1rem 1.25rem;border-bottom:1px solid var(--border)}
.bb-modal-title{font-weight:900}
.bb-modal-close{
  border:1px solid transparent;
  background:transparent;
  width:var(--icon-btn-size);
  height:var(--icon-btn-size);
  border-radius:14px;
  padding:0;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color:var(--text-muted);
  cursor:pointer;
}
.bb-modal-close:hover{background:var(--bg-soft);border-color:var(--border);color:var(--text-main)}
.bb-modal-body{padding:1rem 1.25rem;display:grid;gap:.85rem}
.bb-modal-field{display:grid;gap:.35rem;font-weight:800;color:var(--text-muted)}
.bb-modal-field input{height:44px;border:1px solid var(--border);border-radius:14px;padding:0 .75rem;font-weight:900;color:var(--text-main)}
.bb-modal-hint{color:var(--text-muted);font-weight:700;font-size:.95rem}
.bb-modal-actions{display:flex;justify-content:flex-end;gap:.75rem;padding:1rem 1.25rem;border-top:1px solid var(--border)}
.bb-btn{border:1px solid var(--border);background:#fff;border-radius:16px;padding:.75rem 1rem;font-weight:900}
.bb-btn-primary{border:0;background:var(--primary);color:#fff}

@media (max-width: 820px){
  .bb-debcred{grid-template-columns:1fr;gap:1.25rem}
  .bb-toprow{flex-direction:column;align-items:flex-start}
}

/* ------------------------------
   Admin (custom CSS editor)
------------------------------ */
.admin-card{
  background:#fff;
  border:1px solid var(--border);
  border-radius:24px;
  padding:1.25rem;
  box-shadow:0 10px 30px rgba(20, 30, 70, .06);
}
.admin-title{margin:.1rem 0 .35rem;font-size:1.6rem;letter-spacing:-.01em}
.admin-note{margin:0 0 1rem;color:var(--text-muted);font-weight:700}
.admin-section{margin-top:.35rem}
.admin-section-title{margin:0 0 .4rem;font-weight:900}
.admin-help{margin:0 0 .75rem;color:var(--text-muted);font-weight:700}
.admin-textarea{
  width:100%;
  border:1px solid var(--border);
  border-radius:14px;
  padding:.75rem .85rem;
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
  font-size:12px;
  line-height:1.45;
  min-height:260px;
  background:#fff;
}
.admin-actions{display:flex;justify-content:flex-end;gap:.75rem;margin-top:.75rem}
.admin-noaccess{
  margin-top:.75rem;
  border:1px solid var(--border);
  border-radius:16px;
  padding:1rem 1.1rem;
  background:var(--bg-soft);
  font-weight:800;
}

/* ------------------------------
   Bulk Edit Toolbar
------------------------------ */
.bulk-edit-toolbar {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.bulk-edit-toolbar.hidden {
  display: none;
}

.bulk-edit-info {
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.bulk-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.field-inline {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 180px;
}

.field-inline label {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.field-inline select {
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 0.75rem;
  font-weight: 700;
  background: #fff;
  color: var(--text-main);
}

.checkbox-col {
  width: 40px;
  padding: 0.5rem;
  text-align: center;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

.tx-row-click {
  cursor: pointer;
}

.tx-row-click:hover {
  background-color: var(--bg-soft);
}
