:root {
    --bg: #eef0f4;
    --card-bg: #ffffff;
    --border: #e2e5ea;
    --text: #1a1f36;
    --text-muted: #6b7280;
    --primary: #2f6fed;
    --primary-dark: #1f52c9;
    --danger: #d64545;
    --success-bg: #e7f7ee;
    --success-text: #17803d;
    --error-bg: #fdecec;
    --error-text: #c0392b;
    --radius: 10px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

h1, h2 {
    margin: 0 0 1rem;
    color: var(--text);
}

h1 {
    font-size: 1.5rem;
}

h2 {
    font-size: 1.15rem;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Auth pages */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.auth-wrap {
    width: 100%;
    max-width: 420px;
    padding: 2rem 1rem;
}

.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
}

.auth-subtitle {
    color: var(--text-muted);
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
}

.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

form label {
    display: block;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text);
}

form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="number"],
form select {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fafbfc;
    font-size: 0.95rem;
    color: var(--text);
}

form input:focus,
form select:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
}

/* App shell */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: #161a2b;
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
}

.app-logo {
    font-weight: 700;
    font-size: 1.15rem;
    margin-bottom: 2rem;
}

.app-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-grow: 1;
}

.app-nav a {
    color: #c6c9d8;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
}

.app-nav a:hover {
    text-decoration: none;
    background: rgba(255, 255, 255, 0.06);
}

.app-nav a.active {
    background: var(--primary);
    color: #fff;
}

.app-nav a.nav-link-credits {
    color: #e67e22;
    font-weight: 700;
}

.app-nav a.nav-link-credits:hover {
    color: #f39c42;
}

.app-nav a.nav-link-credits.active {
    background: #e67e22;
    color: #fff;
}

.app-sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
    font-size: 0.85rem;
}

.app-account-name {
    color: #fff;
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.app-credits-balance {
    color: #c6c9d8;
    margin-bottom: 0.5rem;
}

.app-sidebar-footer a {
    color: #c6c9d8;
}

.app-main {
    flex-grow: 1;
    padding: 2rem 2.5rem;
    max-width: 100%;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-header-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-total {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.hidden {
    display: none !important;
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-hint {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: -0.5rem;
    margin-bottom: 1.25rem;
}

.card-subhead {
    font-weight: 600;
    margin: 1.25rem 0 0.75rem;
}

/* Settings rows */
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid #f1f2f5;
}

.settings-row:last-of-type {
    border-bottom: none;
}

.settings-label {
    color: var(--text);
    flex-shrink: 0;
}

.settings-row select,
.settings-row input {
    max-width: 320px;
}

.input-small {
    max-width: 100px !important;
}

.input-with-suffix {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Tables */
.settings-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.settings-table th {
    text-align: left;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.settings-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f1f2f5;
    vertical-align: middle;
}

.settings-table input,
.settings-table select {
    width: 100%;
}

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

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-block {
    width: 100%;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    text-decoration: none;
}

.btn-primary:disabled {
    background: #a9bce8;
    cursor: not-allowed;
}

.btn-secondary {
    background: #f1f2f5;
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #b83a3a;
}

.btn-sm {
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
}

.btn-link {
    background: none;
    color: var(--primary);
    font-weight: 600;
    padding: 0.5rem 0;
}

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

.icon-btn {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
}

.icon-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
}

.icon-btn-action:hover {
    background: #f1f2f5;
    color: var(--text);
    text-decoration: none;
}

.icon-btn-action.icon-btn-danger:hover {
    background: var(--error-bg);
    color: var(--danger);
    border-color: var(--danger);
}

/* Tags */
.tag-toggle-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag-toggle {
    position: relative;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    background: #f1f2f5;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

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

.tag-toggle.tag-active {
    background: #4b5265;
    color: #fff;
    border-color: #4b5265;
}

.tag-toggle.tag-outline {
    background: #fff;
    color: var(--text-muted);
    border: 1px solid var(--border);
    cursor: default;
}

.badge {
    background: #161a2b;
    color: #fff;
    padding: 0.25rem 0.7rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-active {
    background: var(--success-text);
}

.badge-inactive {
    background: var(--danger);
}

/* Admin */
.admin-tag {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.45rem;
    border-radius: 5px;
    margin-left: 0.35rem;
    vertical-align: middle;
}

.search-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.search-form input {
    flex-grow: 1;
    max-width: 320px;
}

.page-header a {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* Custom field add form */
.custom-field-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.custom-field-form input,
.custom-field-form select {
    width: auto;
    flex: 1 1 160px;
}

/* Mollie */
.mollie-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.mollie-key-form {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.mollie-key-form .settings-label {
    display: block;
    margin-bottom: 0.35rem;
}

.mollie-key-form input {
    min-width: 340px;
}

.mollie-disconnect-form {
    margin-bottom: 0.75rem;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.status-off {
    background: #b6bac4;
}

.status-dot.status-on {
    background: #17803d;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.alert ul {
    margin: 0;
    padding-left: 1.1rem;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.alert-error {
    background: var(--error-bg);
    color: var(--error-text);
}

.alert-warning {
    background: #fdf3d8;
    color: #8a6a00;
}

/* Facturen */
.factuur-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.factuur-filters {
    display: flex;
    gap: 1.25rem;
    font-size: 0.9rem;
}

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

.factuur-filters a.filter-active {
    color: var(--primary);
    font-weight: 600;
}

.card-flush {
    padding: 0.5rem 1.75rem;
}

.status-dot.status-concept {
    background: #b6bac4;
}

.status-dot.status-open {
    background: var(--primary);
}

.status-dot.status-betaald {
    background: var(--success-text);
}

.badge-status-concept {
    background: #6b7280;
}

.badge-status-open {
    background: var(--primary);
}

.badge-status-betaald {
    background: var(--success-text);
}

.status-dot.status-offerte-concept {
    background: #b6bac4;
}

.status-dot.status-offerte-verzonden {
    background: var(--primary);
}

.status-dot.status-offerte-geaccepteerd {
    background: var(--success-text);
}

.status-dot.status-offerte-afgewezen {
    background: var(--danger);
}

.badge-status-offerte-concept {
    background: #6b7280;
}

.badge-status-offerte-verzonden {
    background: var(--primary);
}

.badge-status-offerte-geaccepteerd {
    background: var(--success-text);
}

.badge-status-offerte-afgewezen {
    background: var(--danger);
}

/* Publieke offertepagina */
.offerte-public-body {
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.offerte-public-wrap {
    width: 100%;
    max-width: 720px;
}

.offerte-public-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.offerte-public-bedrijf {
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.offerte-public-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.factuur-actions {
    margin-bottom: 1.5rem;
}

.factuur-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.factuur-col select,
.factuur-col input {
    width: 100%;
}

.contactpersoon-fields {
    display: grid;
    grid-template-columns: 100px 1fr 1fr;
    gap: 0.6rem;
    max-width: 420px;
    flex-grow: 1;
}

.contactpersoon-fields select,
.contactpersoon-fields input {
    max-width: none;
    min-width: 0;
}

.postcode-plaats-fields {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 0.6rem;
    max-width: 420px;
    flex-grow: 1;
}

.postcode-plaats-fields input {
    max-width: none;
    min-width: 0;
}

.inline-add-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.factuur-regels-table input,
.factuur-regels-table select {
    min-width: 100px;
}

.add-regel-form {
    margin-top: 0.5rem;
}

.factuur-totalen {
    max-width: 320px;
    margin-left: auto;
    margin-top: 1rem;
    border-top: 1px solid var(--border);
    padding-top: 0.5rem;
}

/* Statistieken */
.stats-filter-form {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.stats-filter-form select {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fafbfc;
}

.stats-tabs {
    display: flex;
    gap: 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.stats-tabs a {
    padding: 0.75rem 0;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 2px solid transparent;
}

.stats-tabs a:hover {
    text-decoration: none;
    color: var(--text);
}

.stats-tabs a.stats-tab-active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.stats-overzicht-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 2.5rem;
    align-items: start;
}

.chart-legend {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.chart-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.chart-dot-inkomsten {
    background: #2fa84f;
}

.chart-dot-uitgaven {
    background: #d64545;
}

.chart-dot-vergelijk {
    background: #9aa3b5;
}

.stats-chart {
    width: 100%;
    height: auto;
}

.chart-gridline {
    stroke: #eef0f4;
    stroke-width: 1;
}

.chart-axis-label {
    fill: var(--text-muted);
    font-size: 10px;
}

.chart-area-inkomsten {
    fill: rgba(47, 168, 79, 0.15);
    stroke: none;
}

.chart-line-inkomsten {
    fill: none;
    stroke: #2fa84f;
    stroke-width: 2.5;
}

.chart-line-uitgaven {
    fill: none;
    stroke: #d64545;
    stroke-width: 2;
}

.chart-line-vergelijk {
    fill: none;
    stroke: #9aa3b5;
    stroke-width: 2;
    stroke-dasharray: 5 4;
}

/* Credits */
.credit-pakketten {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.credit-pakket {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    min-width: 180px;
    text-align: center;
}

.credit-pakket-credits {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.credit-pakket-prijs {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
}

.credit-pakket-sub {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.credit-pakket-unlimited {
    border-color: var(--primary);
    border-width: 2px;
    background: #f5f8ff;
}
