/* Freelume/ Styles */

/* Remove number input spinners site-wide */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

:root {
    --primary: #2563EB;
    --primary-dark: #1D4ED8;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    --success-light: #ECFDF5;
    --success-dark: #059669;
    --success-bg: #D1FAE5;
    --success-text: #065F46;
    --warning-light: #FFFBEB;
    --warning-dark: #D97706;
    --warning-border: #FDE68A;
    --warning-text: #92400E;
    --danger-light: #FEE2E2;
    --danger-dark: #DC2626;
    --danger-text: #991B1B;
    --primary-light: #EFF6FF;
    --info-bg: #e3f2fd;
    --gold: #E6A817;
    --gold-dark: #D49B15;
    --gold-light: #F5DFA0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
}

/* Navigation */
.navbar {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
}

.nav-left,
.nav-right {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    height: 100%;
}

.nav-brand {
    text-decoration: none;
    margin-right: 1.5rem;
}

.nav-brand h1 {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.nav-cta {
    background: var(--primary);
    color: white !important;
    padding: 0.4rem 0.875rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    margin-right: 0.75rem;
    transition: background 0.2s;
    white-space: nowrap;
}

.nav-cta:hover,
.nav-cta.active {
    background: var(--primary-dark);
}

/* Harvest button */
.harvest-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: linear-gradient(135deg, var(--warning), var(--warning-dark));
    color: white !important;
    padding: 0.4rem 0.875rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s, transform 0.1s;
    margin-right: 0.5rem;
    box-shadow: 0 1px 4px rgba(217, 119, 6, 0.3);
}

.harvest-btn svg {
    flex-shrink: 0;
}

.harvest-btn:hover {
    background: linear-gradient(135deg, var(--warning-dark), var(--warning-dark));
    transform: scale(1.03);
}

/* Last-day jiggle */
.harvest-jiggle {
    animation: harvest-shake 0.5s ease-in-out 1s 1;
}

@keyframes harvest-shake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-3px) rotate(-1deg); }
    30% { transform: translateX(3px) rotate(1deg); }
    45% { transform: translateX(-2px) rotate(-0.5deg); }
    60% { transform: translateX(2px) rotate(0.5deg); }
    75% { transform: translateX(-1px); }
}

.nav-link {
    text-decoration: none;
    color: var(--gray-600);
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0 0.75rem;
    height: 100%;
    display: flex;
    align-items: center;
    border-bottom: 2px solid transparent;
    transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.dropdown-arrow {
    font-size: 0.6rem;
    margin-left: 0.25rem;
}

/* Dropdowns */
.nav-dropdown {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 180px;
    padding: 0.5rem 0;
    z-index: 200;
}

.nav-dropdown-right {
    left: auto;
    right: 0;
}

.nav-dropdown:hover .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--gray-700);
    text-decoration: none;
    font-size: 0.875rem;
}

.nav-dropdown-menu a:hover {
    background: var(--gray-50);
    color: var(--primary);
}

.dropdown-divider {
    border: none;
    border-top: 1px solid var(--gray-200);
    margin: 0.25rem 0;
}

.logout-link {
    color: var(--danger) !important;
}

/* Mobile Tab Bar (base - hidden on desktop) */
.mobile-tab-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;
    background: white;
    border-top: 1px solid var(--gray-200);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    /* Force own compositing layer — prevents repaint jank when mobile browser chrome animates */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    /* Prevent touches on the bar from triggering browser toolbar show/hide */
    touch-action: none;
}

/* Extend background below to cover gap when mobile browser chrome animates */
.mobile-tab-bar::after {
    content: '';
    position: absolute;
    bottom: -50px;
    left: 0;
    right: 0;
    height: 50px;
    background: white;
}

.mobile-tab-bar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.125rem;
    text-decoration: none;
    color: var(--gray-400);
    font-size: 0.625rem;
    font-weight: 500;
    min-height: 56px;
    min-width: 44px;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.mobile-tab-bar a.active {
    color: var(--primary);
}

.mobile-tab-bar a svg {
    flex-shrink: 0;
}

/* Werk tab: raised primary button */
.mobile-tab-bar a.tab-werk {
    color: white;
}

.mobile-tab-bar a.tab-werk svg {
    background: var(--primary);
    border-radius: 50%;
    padding: 0.3125rem;
    width: 32px;
    height: 32px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mobile-tab-bar a.tab-werk span {
    color: var(--primary);
    font-weight: 600;
}

.mobile-tab-bar a.tab-werk.active svg {
    background: var(--primary-dark);
    box-shadow: 0 2px 12px rgba(37, 99, 235, 0.5);
}

.mobile-harvest-badge {
    position: absolute;
    top: 6px;
    right: 50%;
    margin-right: -16px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--warning), var(--warning-dark));
    box-shadow: 0 0 4px rgba(245, 158, 11, 0.5);
}

.nav-user {
    font-size: 0.875rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.test-mode-banner {
    background: var(--warning-light);
    border-bottom: 1px solid var(--warning-border);
    color: var(--warning-text);
    padding: 0.375rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    font-size: 0.875rem;
    position: sticky;
    top: 0;
    z-index: 999;
}

.test-mode-label {
    background: var(--warning);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 0.125rem 0.5rem;
    border-radius: 3px;
}

.test-mode-text {
    color: var(--warning-text);
}

.test-mode-text strong {
    font-weight: 600;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Site Footer */
.site-footer {
    text-align: center;
    padding: 2rem 1rem 2rem;
    color: var(--gray-400);
    font-size: 0.75rem;
}

.site-footer p {
    margin: 0;
}

.footer-brand {
    font-family: 'Roboto Mono', monospace;
    font-weight: 500;
}

@media (max-width: 768px) {
    .site-footer {
        padding-bottom: calc(2rem + 56px + env(safe-area-inset-bottom, 0px));
    }
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-box {
    background: white;
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 100%;
}

.login-box h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
    text-align: center;
}

.login-brand {
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.subtitle {
    text-align: center;
    color: var(--gray-500);
    margin-bottom: 2rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group input, 
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input[readonly] {
    background: var(--gray-50);
    cursor: not-allowed;
}

/* Buttons */
.btn-primary, button[type="submit"] {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
}

.btn-primary:hover, button[type="submit"]:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-block {
    width: 100%;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Error Messages */
.error-message {
    background: var(--danger-light);
    border: 1px solid var(--danger);
    color: var(--danger-text);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
}

.help-text {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--gray-500);
    text-align: center;
}

.help-text code {
    background: var(--gray-100);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Roboto Mono', monospace;
}

/* Dashboard */
.page-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h1 {
    font-size: 2rem;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.page-header .subtitle {
    text-align: left;
    margin: 0;
}

/* Alerts */
.alert {
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.alert-warning {
    background: var(--warning-light);
    border: 1px solid var(--warning);
    color: var(--warning-text);
}

.alert h3 {
    margin-bottom: 0.5rem;
    font-size: 1.125rem;
}

.overdue-list {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0;
    font-size: 0.875rem;
}

.overdue-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.375rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.overdue-list li:last-child {
    border-bottom: none;
}

.overdue-list-info {
    flex: 1;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.stat-card-warning {
    border-left: 4px solid var(--danger);
}

/* Dashboard Cards & Sections */
.dashboard-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.dashboard-section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--gray-700);
}

.stat-sublabel {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 0.25rem;
}

/* Contract Progress (shared with beheer) */
.contract-progress-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.contract-progress-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.contract-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.875rem;
    color: var(--gray-700);
}
.contract-progress-header .cp-value {
    font-weight: 600;
    white-space: nowrap;
}
.contract-progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
}
.contract-progress-fill {
    height: 100%;
    transition: width 0.3s ease;
}
.contract-progress-fill.status-ok { background: var(--primary); }
.contract-progress-fill.status-warning { background: var(--warning); }
.contract-progress-fill.status-danger { background: var(--danger); }
.contract-progress-fill.status-comp { background: var(--warning); opacity: 0.7; }
.contract-progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--gray-400);
}

/* Dashboard: Contracts grid */
.contracts-progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}
.cp-client-block {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.cp-client-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-700);
}

/* Contract compensation alert */
.contract-comp-alert {
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
    background: var(--warning-light);
    border: 1px solid var(--warning);
    border-radius: 8px;
}
.contract-comp-alert-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}
.contract-comp-alert p { color: var(--gray-600); margin-bottom: 0.5rem; }
.contract-comp-alert ul { margin: 0; padding-left: 1.25rem; color: var(--gray-600); }

/* Dashboard: Monthly chart */
.monthly-chart {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.mc-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.mc-label {
    width: 56px;
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--gray-500);
    text-align: right;
}
.mc-bar-track {
    flex: 1;
    height: 18px;
    background: var(--gray-100);
    border-radius: 4px;
    overflow: hidden;
}
.mc-bar {
    height: 100%;
    background: rgba(37, 99, 235, 0.15);
    border-radius: 4px;
    display: flex;
    min-width: 2px;
}
.mc-bar-billed {
    height: 100%;
    background: var(--primary);
    border-radius: 4px 0 0 4px;
}
.mc-amount {
    width: 80px;
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-700);
    text-align: right;
}
.mc-legend {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
    font-size: 0.7rem;
    color: var(--gray-400);
}
.mc-legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.mc-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
}
.mc-legend-billed { background: var(--primary); }
.mc-legend-unbilled { background: rgba(37, 99, 235, 0.15); }

/* Dashboard: Top clients */
.top-clients-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.tc-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.tc-name {
    width: 120px;
    flex-shrink: 0;
    font-size: 0.875rem;
    color: var(--gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tc-bar-track {
    flex: 1;
    height: 18px;
    background: var(--gray-100);
    border-radius: 4px;
    overflow: hidden;
}
.tc-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    min-width: 2px;
}
.tc-amount {
    width: 80px;
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-700);
    text-align: right;
}

/* Dashboard: Two-column lower grid */
.dashboard-lower-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.dashboard-lower-grid .dashboard-card {
    margin-bottom: 0;
}
@media (max-width: 768px) {
    .dashboard-lower-grid {
        grid-template-columns: 1fr;
    }
    .contracts-progress-grid {
        grid-template-columns: 1fr;
    }
}

/* Clients Grid */
/* Client Edit Modal (Combined Tabs) */
.client-edit-modal {
    max-width: 560px;
    padding: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.client-edit-modal > .close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    z-index: 1;
}

.client-edit-header {
    padding: 1.5rem 1.75rem 0;
}

.client-edit-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}

.client-tabs {
    display: flex;
    gap: 0;
    padding: 0 1.75rem;
    margin-top: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.client-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-400);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.client-tab:hover {
    color: var(--gray-600);
}

.client-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.client-tab-content {
    display: none;
    overflow-y: auto;
    padding: 1.25rem 1.75rem;
    flex: 1;
}

.client-tab-content.active {
    display: block;
}

.client-form-sections {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.client-form-section h4 {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
    margin: 0 0 0.625rem;
}

.client-form-group {
    margin-bottom: 0.625rem;
}

.client-form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.25rem;
}

.client-form-group input[type="text"],
.client-form-group input[type="number"],
.client-form-group input[type="email"] {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.client-form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.client-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    cursor: pointer;
}

.client-checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.client-form-hint {
    font-size: 0.875rem;
    color: var(--gray-400);
    margin: 0 0 0.625rem;
}

/* Field hint below input */
.field-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 0.25rem;
}

/* Address block — light background to signify PDF address group */
.address-block {
    background: var(--gray-50);
    border-radius: 8px;
    padding: 0.875rem;
    margin-top: 0.5rem;
}

.address-block .client-form-group:last-child {
    margin-bottom: 0;
}

/* Client number — second line below name */
.client-number-line {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.2rem;
}

.client-number-read {
    font-size: 0.875rem;
    color: var(--gray-400);
}

.client-number-edit-btn {
    background: none;
    border: none;
    padding: 0.15rem;
    cursor: pointer;
    color: var(--gray-300);
    border-radius: 4px;
    display: flex;
    align-items: center;
}

.client-number-edit-btn:hover {
    color: var(--primary);
    background: var(--gray-100);
}

.client-number-edit {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.client-number-edit-prefix {
    font-size: 0.875rem;
    color: var(--gray-400);
}

.client-number-input {
    width: 40px;
    padding: 0.1rem 0.3rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 0.875rem;
    color: var(--gray-700);
    box-sizing: border-box;
    text-align: center;
}

.client-number-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.client-number-action {
    background: none;
    border: none;
    padding: 0.15rem;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
}

.client-number-action.save {
    color: var(--success);
}

.client-number-action.save:hover {
    background: var(--success-light);
}

.client-number-action.cancel {
    color: var(--gray-400);
}

.client-number-action.cancel:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* Checkbox-driven progressive disclosure */
.disclosure-option {
    margin-bottom: 0.625rem;
}

.disclosure-field {
    margin-top: 0.375rem;
    padding-left: 1.5rem;
}

/* Segmented control */
.segmented-control {
    display: flex;
    background: var(--gray-100);
    border-radius: 8px;
    padding: 0.125rem;
}

.segment {
    flex: 1;
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
    border: none;
    background: none;
    color: var(--gray-500);
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    text-align: center;
    white-space: nowrap;
}

.segment.active {
    background: white;
    color: var(--gray-900);
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Euro input wrapper */
.euro-input-wrapper {
    position: relative;
}
.euro-input-wrapper .euro-sign {
    position: absolute;
    left: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
    font-size: 0.875rem;
}
.euro-input-wrapper input {
    padding-left: 1.5rem !important;
    width: 100%;
}

/* Special field builder */
.special-field-builder {
    margin-top: 0.25rem;
}

/* Info icon */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    font-style: normal;
    background: var(--gray-100);
    color: var(--gray-400);
    border-radius: 50%;
    margin-left: 0.25rem;
    cursor: help;
    vertical-align: middle;
}

/* Section dividers */
.client-form-section + .client-form-section {
    padding-top: 1.25rem;
    border-top: 1px solid var(--gray-100);
}

.client-form-archive {
    padding-top: 1.25rem;
    margin-top: 0.5rem;
    border-top: 1px solid var(--gray-100);
}

/* Services Tab */
.service-config-header {
    display: grid;
    grid-template-columns: 1fr 70px;
    gap: 0.5rem;
    padding: 0 0 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
}

.service-config-header span:last-child {
    text-align: center;
}

.service-config-item {
    display: grid;
    grid-template-columns: 1fr 70px;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-50);
}

.service-config-item:last-child {
    border-bottom: none;
}

.svc-info-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
}

.svc-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.svc-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.svc-price {
    font-size: 0.75rem;
    color: var(--gray-400);
}

/* Star shortcut toggle */
.svc-star {
    background: none;
    border: none;
    padding: 0.125rem;
    cursor: pointer;
    color: var(--gray-300);
    flex-shrink: 0;
    line-height: 0;
    transition: color 0.15s, transform 0.15s;
}

.svc-star:hover {
    color: var(--gold);
    transform: scale(1.15);
}

.svc-star.active {
    color: var(--gold);
}

.svc-star.active svg {
    fill: var(--gold);
}

.svc-toggle {
    display: flex;
    justify-content: center;
}

.svc-toggle input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
}

.client-add-service-btn {
    background: none;
    border: 1px dashed var(--gray-300);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--gray-500);
    cursor: pointer;
    width: 100%;
    margin-top: 0.75rem;
    transition: border-color 0.15s, color 0.15s;
}

.client-add-service-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.client-edit-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.75rem;
    border-top: 1px solid var(--gray-100);
    background: white;
    border-radius: 0 0 8px 8px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 0.5rem;
    margin-top: 0.5rem;
}

.badge-info {
    background: var(--info-bg);
    color: var(--primary);
}

.badge-secondary {
    background: var(--gray-100);
    color: var(--gray-500);
}

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

.badge-warning {
    background: var(--warning-light);
    color: var(--warning-text);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger-text);
}

.badge-unsent {
    background: var(--warning);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    margin-left: 8px;
}

.badge-credit {
    background: var(--gray-200);
    color: var(--gray-700);
}

/* Tables */
.invoices-table {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

tr:hover {
    background: var(--gray-50);
}

.invoice-paid {
    opacity: 0.6;
}

.invoice-overdue {
    background: var(--danger-light);
}

.overdue-badge {
    margin-left: 0.5rem;
}

.paid-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Filters */
.filters {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 500;
    color: var(--gray-700);
}

.filter-group select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    cursor: pointer;
}

/* Overzicht stats strip */
.overzicht-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.overzicht-stat {
    padding: 0.875rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}
.overzicht-stat:not(:last-child) {
    border-right: 1px solid var(--gray-200);
}
.overzicht-stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
}
.overzicht-stat-value.danger {
    color: var(--danger);
}
.overzicht-stat-label {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Invoice rows (card-based replacement for tables) */
.invoice-rows {
    display: flex;
    flex-direction: column;
}
.invoice-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.1s;
}
.invoice-row:last-child {
    border-bottom: none;
}
.invoice-row:hover {
    background: var(--gray-50);
}
.invoice-row.invoice-paid {
    opacity: 0.6;
}
.invoice-row.invoice-overdue {
    background: var(--danger-light);
}
.invoice-row.invoice-overdue:hover {
    background: var(--danger-light);
}
.inv-row-date {
    font-size: 0.875rem;
    color: var(--gray-500);
    flex-shrink: 0;
    width: 5.5rem;
}
.inv-row-number {
    font-weight: 600;
    color: var(--gray-900);
    flex-shrink: 0;
}
.inv-row-client {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--gray-700);
    font-size: 0.875rem;
}
.inv-row-amount {
    font-weight: 600;
    color: var(--gray-900);
    flex-shrink: 0;
    margin-left: auto;
}
.inv-row-badge {
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
}
.inv-row-paid-toggle {
    flex-shrink: 0;
}
.inv-row-paid-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}
.inv-row-actions {
    flex-shrink: 0;
}

/* Settings Page */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.settings-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.settings-section h2 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    color: var(--gray-900);
}

.settings-section .form-group .help-text {
    text-align: left;
    margin-top: 0.5rem;
}

/* Settings group box — groups related fields like address-block */
.settings-group-box {
    background: var(--gray-50);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.5rem;
}

.settings-group-box .form-group label {
    font-size: 0.875rem;
}

.settings-group-box .help-text {
    text-align: left;
}

/* Inline row — two fields side by side on desktop, stacked on mobile */
.settings-inline-row {
    display: flex;
    gap: 0.75rem;
}

@media (max-width: 768px) {
    .settings-inline-row {
        flex-direction: column;
    }
}

/* Settings template action cards */
.settings-template-cards {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.settings-template-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    background: var(--gray-50);
    border-radius: 8px;
    text-decoration: none;
    color: var(--gray-700);
    transition: background 0.15s, box-shadow 0.15s;
    cursor: pointer;
}

.settings-template-card:hover {
    background: var(--gray-100);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.settings-template-card-icon {
    flex-shrink: 0;
    color: var(--gray-400);
}

.settings-template-card-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.settings-template-card-text strong {
    font-size: 0.875rem;
    color: var(--gray-900);
}

.settings-template-card-text span {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.settings-template-card-arrow {
    flex-shrink: 0;
    color: var(--gray-300);
    transition: color 0.15s;
}

.settings-template-card:hover .settings-template-card-arrow {
    color: var(--gray-500);
}

.settings-template-card-toggleable {
    padding-right: 0.75rem;
}

.settings-template-card-toggleable:hover {
    background: var(--gray-100);
}

/* Feature toggle (like svc-star) */
.feature-toggle {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    border-radius: 999px;
    cursor: pointer;
    color: var(--gray-300);
    transition: color 0.15s, background 0.15s;
}

.feature-toggle:hover {
    color: var(--gray-500);
    background: rgba(0, 0, 0, 0.05);
}

.feature-toggle.active {
    color: var(--primary);
}

.feature-toggle.active svg {
    stroke: var(--primary);
}

/* Settings inline editor (below cards) */
.settings-inline-editor {
    background: var(--gray-50);
    border-radius: 8px;
    padding: 1.25rem;
    margin-top: 0.5rem;
}

/* Security grid (side by side on desktop) */
.settings-security-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .settings-security-grid {
        grid-template-columns: 1fr;
    }
}

.settings-sticky-actions {
    position: sticky;
    bottom: 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 1rem;
    z-index: 10;
}

/* Coming Soon */
.coming-soon {
    background: white;
    padding: 3rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.coming-soon h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--gray-700);
}

.coming-soon ul {
    list-style: none;
    margin-top: 1.5rem;
}

.coming-soon li {
    padding: 0.5rem 0;
    color: var(--gray-600);
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        display: none;
    }

    .mobile-tab-bar {
        display: flex;
    }

    body {
        padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }

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

    .tab-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-bar .tab {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .service-row {
        padding: 0.75rem 1rem;
    }

    .service-group h2 {
        padding: 1rem;
    }

    .settings-sticky-actions {
        bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 1rem);
    }

    .filters {
        flex-direction: column;
        gap: 0.75rem;
    }

    /* Overzicht sections: reduce padding on mobile */
    .unbilled-section,
    .drafts-section,
    .historical-section {
        padding: 1rem;
    }

    .unbilled-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .unbilled-totals {
        gap: 1rem;
        font-size: 1rem;
    }

    /* Work item rows: compact single line on mobile */
    .work-item-row {
        padding: 0.625rem 1rem;
        gap: 0.5rem;
    }

    .work-item-row .item-date {
        display: none;
    }

    .work-item-row .item-details {
        flex: 1;
        min-width: 0;
    }

    .work-item-row .item-service {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
    }

    .work-item-row .item-description,
    .work-item-row .item-units {
        display: none;
    }

    .auto-badge-inline {
        display: inline-block;
        font-size: 0.6rem;
        padding: 0.0625rem 0.375rem;
        vertical-align: middle;
    }

    /* Invoice rows: compact on mobile */
    .invoice-row {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
    }

    .invoice-row .inv-row-date {
        display: none;
    }

    .invoice-row .inv-row-badge {
        font-size: 0;
        padding: 0;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        min-width: 8px;
    }
    .invoice-row .inv-row-badge.badge-success { background: var(--success-text); }
    .invoice-row .inv-row-badge.badge-danger { background: var(--danger-text); }
    .invoice-row .inv-row-badge.badge-warning { background: var(--warning); }
    .invoice-row .inv-row-badge.badge-credit { background: var(--gray-500); }
    .invoice-row .inv-row-badge.badge-unsent { background: var(--warning); }

    .invoice-row .inv-row-actions {
        display: none;
    }

    .client-card-header {
        padding: 0.75rem 1rem;
    }
    .client-card-amount {
        font-size: 0.875rem;
    }
    .client-card-amount-secondary {
        font-size: 0.75rem;
    }

    .overzicht-stats {
        grid-template-columns: 1fr;
    }
    .overzicht-stat:not(:last-child) {
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
    }
}

/* Work Entry Page */
.work-page {
    max-width: 640px;
}

.work-form-container {
    display: block;
}

.work-form {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-section {
    margin-bottom: 1.5rem;
}

.form-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

/* Description Rows */
.description-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.description-row:has(.units-input) {
    grid-template-columns: 120px 100px 80px 1fr;
}

.date-label {
    font-weight: 500;
    color: var(--gray-700);
    font-size: 0.875rem;
    text-align: right;
}

.description-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.description-input.description-full {
    grid-column: 2;
}

.units-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.units-label {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.description-input:focus,
.units-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.description-input:required,
.units-input:required {
    border-left: 3px solid var(--warning);
}

/* Autocomplete */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-wrapper .client-search-input {
    width: 100%;
    padding: 0.75rem 0.75rem 0.75rem 2.25rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.656a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") no-repeat 0.75rem center;
}

.autocomplete-wrapper .client-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.autocomplete-wrapper .client-search-input:disabled {
    background-color: var(--gray-50);
    color: var(--gray-700);
    cursor: default;
    background-image: none;
    padding-left: 0.75rem;
}

.client-selected-display {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
}

.client-selected-display .client-selected-name {
    font-weight: 500;
    color: var(--gray-700);
    flex: 1;
}

.client-selected-display .client-change-btn {
    font-size: 0.875rem;
    color: var(--primary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    transition: background 0.15s;
}

.client-selected-display .client-change-btn:hover {
    background: rgba(37, 99, 235, 0.1);
}

.autocomplete-results {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 100;
}

.autocomplete-item {
    padding: 0.625rem 0.75rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.1s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: var(--gray-50);
}

.recent-badge {
    font-size: 0.7rem;
    background: var(--primary);
    color: white;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
}

.autocomplete-item-add {
    color: var(--primary);
    font-size: 0.875rem;
    border-top: 1px solid var(--gray-200);
}

.autocomplete-item-add:hover {
    background: rgba(37, 99, 235, 0.05);
}

.service-search-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.service-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Service Shortcuts */
.service-shortcuts {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.service-shortcut {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.service-shortcut:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.service-shortcut.active {
    background: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* Calendar */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
}

.calendar-header h3 {
    margin: 0;
    font-size: 1rem;
    text-transform: capitalize;
}

/* Inline icon alignment for SVGs in text/buttons */
.inline-icon {
    vertical-align: -0.125em;
    flex-shrink: 0;
}

/* icon-btn: Tier 5 bare icon buttons (matches svc-star pattern) */
.icon-btn {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--gray-400);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border-radius: 999px;
    transition: color 0.15s, transform 0.15s;
    line-height: 0;
}

.icon-btn:hover {
    color: var(--primary);
    transform: scale(1.15);
}

/* Calendar nav arrows keep their circle style via icon-btn-circle */
.icon-btn-circle {
    background: var(--gray-100);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-btn-circle:hover {
    background: var(--gray-200);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.375rem;
}

.calendar-day-header {
    text-align: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--gray-500);
    padding: 0.25rem;
}

.calendar-day {
    position: relative;
    aspect-ratio: 1;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: white;
}

.calendar-day:hover:not(.past) {
    border-color: var(--primary);
    background: var(--gray-50);
}

.calendar-day.past {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--gray-50);
}

.calendar-day.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.calendar-day.existing {
    border-color: var(--warning);
    background: var(--warning-light);
}

.calendar-day.selected.existing {
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--primary-light) 50%, var(--warning-light) 50%);
}

.day-number {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-900);
}

.existing-indicator {
    position: absolute;
    top: 4px;
    right: 4px;
    color: var(--warning);
    font-size: 0.5rem;
}

.day-checkbox {
    position: absolute;
    bottom: 3px;
    right: 3px;
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-danger:disabled {
    background: var(--gray-300);
    color: var(--gray-500);
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

/* Optional Fields */
details {
    margin-top: 1rem;
}

details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--primary);
    padding: 0.5rem 0;
}

details summary:hover {
    color: var(--primary-dark);
}

.optional-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

/* Work Preview */
.work-preview {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-top: 1.5rem;
}

.work-preview h3 {
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    overflow-y: auto;
    padding: 2rem 0;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    margin: auto;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 800px;
    width: 90vw;
}

.modal-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 0.625rem;
}

.close {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-400);
    cursor: pointer;
}

.close:hover {
    color: var(--gray-600);
}

.modal-content h3 {
    margin-bottom: 1.5rem;
    color: var(--gray-900);
    position: sticky;
    top: 0;
    background: white;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-content .form-group {
    margin-bottom: 1rem;
}

.modal-content label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

.modal-content input[type="text"],
.modal-content input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 1rem;
}

.modal-content input[type="text"]:focus,
.modal-content input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.readonly-field {
    background: var(--gray-100);
    cursor: not-allowed;
    color: var(--gray-600);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
    position: sticky;
    bottom: 0;
    background: white;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

/* Invoice Detail Modal */
.invoice-detail-modal {
    max-width: 460px;
    padding: 1.5rem 1.75rem 1.25rem;
    position: relative;
}

.invoice-detail-modal > .close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
}

.invoice-detail-header {
    margin-bottom: 1.25rem;
}

.invoice-detail-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: var(--gray-900);
}

.invoice-detail-client {
    font-size: 1rem;
    color: var(--gray-600);
    margin: 0 0 0.125rem;
}

.invoice-detail-total {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

/* Accordion */
.invoice-detail-accordion {
    margin-bottom: 1.25rem;
}

.accordion-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    color: var(--gray-600);
    cursor: pointer;
    transition: background 0.15s;
}

.accordion-toggle:hover {
    background: var(--gray-50);
}

.accordion-chevron {
    transition: transform 0.2s;
}

.accordion-chevron.open {
    transform: rotate(180deg);
}

.accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.accordion-body.open {
    max-height: 400px;
    overflow-y: auto;
    padding-top: 0.75rem;
}

.accordion-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.5rem 0.875rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-item-name {
    color: var(--gray-800);
    flex: 1;
    margin-right: 1rem;
}

.accordion-item-date {
    color: var(--gray-400);
    white-space: nowrap;
    font-size: 0.875rem;
}

/* Meta / email status */
.invoice-detail-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: var(--gray-600);
    padding: 0.75rem 0;
    border-top: 1px solid var(--gray-100);
    margin-bottom: 1.25rem;
}

.detail-meta-line {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-meta-icon {
    margin-right: 0.125rem;
}

.detail-meta-date {
    flex-shrink: 0;
    color: var(--gray-400);
    font-size: 0.875rem;
}

/* Actions */
.invoice-detail-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.invoice-detail-links {
    display: flex;
    gap: 1.25rem;
}

.detail-link {
    font-size: 0.875rem;
    color: var(--gray-600);
    text-decoration: none;
    padding: 0.375rem 0.625rem;
    border-radius: 999px;
    transition: color 0.15s, background 0.15s;
}

.detail-link:hover {
    color: var(--primary);
    background: rgba(0, 0, 0, 0.05);
}

.detail-link-warning {
    color: var(--warning);
}

.detail-link-warning:hover {
    color: var(--warning-dark);
}

.detail-link-success {
    color: var(--success);
}

.detail-link-success:hover {
    color: var(--success-dark);
}

.invoice-detail-pdf-btn {
    display: block;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    margin-right: auto;
    text-decoration: none;
}

.btn-danger:hover {
    background: var(--danger-dark);
    transform: translateY(-1px);
}


@media (max-width: 768px) {
    .work-page {
        max-width: none;
    }

    .calendar-grid {
        gap: 0.25rem;
    }

    .calendar-day {
        font-size: 0.875rem;
    }
    
    .day-number {
        font-size: 1rem;
    }
}

/* Unbilled Work Section */
.unbilled-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.unbilled-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-200);
}

.unbilled-header h2 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.unbilled-totals {
    display: flex;
    gap: 2rem;
    font-size: 1.125rem;
    margin-top: 0.5rem;
}

.total-ex {
    font-weight: 700;
    color: var(--gray-900);
}

.total-inc {
    color: var(--gray-600);
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
    font-size: 1.125rem;
}

.unbilled-clients {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.unbilled-client-card {
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
}

.client-card-header {
    background: var(--gray-50);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
    user-select: none;
}

/* Collapsible client card body */
.client-card-collapsible {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.25s ease;
}
.client-card-collapsible.collapsed {
    grid-template-rows: 0fr;
}
.client-card-collapsible > .client-card-collapsible-inner {
    overflow: hidden;
}
.client-card-header .collapse-chevron {
    transition: transform 0.2s;
    flex-shrink: 0;
    color: var(--gray-400);
    margin-left: 0.75rem;
}
.client-card-header.collapsed .collapse-chevron {
    transform: rotate(-90deg);
}

.client-card-header-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}
.client-card-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
}
.client-card-amount {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
}
.client-card-amount-secondary {
    font-weight: 400;
    color: var(--gray-400);
    margin-left: 0.25rem;
}

.work-items-list {
    padding: 0.25rem 0;
}

.work-item-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.work-item-row .item-date {
    flex-shrink: 0;
    width: 5.5rem;
}

.work-item-row .item-details {
    flex: 1;
    min-width: 0;
}

.work-item-row .item-price {
    flex-shrink: 0;
    margin-left: auto;
}

.work-item-row:last-child {
    border-bottom: none;
}

.work-item-row:hover {
    background: var(--gray-50);
}

.work-item-row.auto-item {
    background: var(--warning-light);
}

.work-item-row.auto-item:hover {
    background: var(--warning-light);
}

.work-item-row.missing-item {
    background: var(--danger-light);
}

.work-item-row.missing-item:hover {
    background: var(--danger-light);
}

.work-item-row.excluded-item {
    background: var(--gray-100);
    opacity: 0.6;
}

.work-item-row.excluded-item:hover {
    background: var(--gray-200);
    opacity: 0.8;
}

.work-item-row.excluded-item .item-service {
    text-decoration: line-through;
    color: var(--gray-500);
}

.work-item-row.excluded-item .item-price {
    text-decoration: line-through;
    color: var(--gray-500);
}

.item-date {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.auto-badge {
    display: inline-block;
    background: var(--warning);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.auto-badge-inline {
    display: none;
}

.recurring-date {
    color: var(--primary);
}

.item-selection-row.recurring-item {
    background: var(--primary-light);
}

.item-selection-row.recurring-item:hover {
    background: var(--primary-light);
}

.item-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.item-service {
    font-weight: 500;
    color: var(--gray-900);
}

.item-description {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.item-units {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.item-warning {
    font-size: 0.875rem;
    color: var(--danger);
    font-weight: 500;
}

.item-excluded-text {
    font-size: 0.875rem;
    color: var(--gray-500);
    font-style: italic;
}

.item-price {
    text-align: right;
    font-weight: 600;
    color: var(--gray-900);
}

/* btn-icon-small removed — use icon-btn instead */

.vat-info {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--gray-400);
    margin-left: 0.25rem;
    text-transform: none;
    letter-spacing: normal;
}

/* Historical Section */
.historical-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.historical-section h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

/* Invoice Generation Selection Page */
.generate-invoices-page {
    max-width: 1200px;
    margin: 0 auto;
}

.selection-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.selection-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--gray-200);
}

.selection-totals {
    display: flex;
    gap: 2rem;
}

.total-box {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.total-box .total-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.total-box .total-amount {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
}

.total-box .total-sublabel {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.clients-selection {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.client-selection-card {
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.client-selection-card:has(.client-checkbox:checked) {
    border-color: var(--primary);
}

.client-selection-header {
    background: var(--gray-50);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
    user-select: none;
}
.client-selection-header .collapse-chevron {
    transition: transform 0.2s;
    flex-shrink: 0;
    color: var(--gray-400);
    margin-left: 0.75rem;
}
.client-selection-header.collapsed .collapse-chevron {
    transform: rotate(-90deg);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.125rem;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.client-checkbox:indeterminate {
    opacity: 0.6;
}

.items-selection-list {
    padding: 0.5rem 0;
}

.item-selection-row {
    display: grid;
    grid-template-columns: 40px 100px 1fr 120px;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.2s;
}

.item-selection-row:last-child {
    border-bottom: none;
}

.item-selection-row:hover {
    background: var(--gray-50);
}

.item-selection-row.auto-item {
    background: var(--warning-light);
}

.item-selection-row.auto-item:hover {
    background: var(--warning-light);
}

.item-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.selection-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 2rem;
    border-top: 2px solid var(--gray-200);
}

/* duplicate btn-primary:disabled removed — see earlier definition */

#selectedCount {
    font-weight: 400;
    font-size: 0.875rem;
    opacity: 0.8;
}

/* Review Invoice Page */
.review-invoice-page {
    max-width: 1200px;
    margin: 0 auto;
}

.progress-indicator {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
}

.progress-bar {
    width: 200px;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}

.progress-text {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.review-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.invoice-preview-section,
.email-preview-section {
    display: flex;
    flex-direction: column;
}

.preview-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.preview-card h2 {
    margin-bottom: 1.5rem;
    color: var(--gray-900);
}

.preview-card h3 {
    margin-bottom: 1rem;
    font-size: 1.125rem;
    color: var(--gray-900);
}

.invoice-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.meta-label {
    font-size: 0.75rem;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.meta-value {
    font-weight: 600;
    color: var(--gray-900);
}

.client-info {
    background: var(--gray-50);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.special-field-section {
    margin-bottom: 1.5rem;
}

.special-field-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

.special-field-section input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 1rem;
}

.invoice-items-table {
    margin-top: 1.5rem;
}

.invoice-items-table table {
    width: 100%;
    border-collapse: collapse;
}

.invoice-items-table th {
    text-align: left;
    padding: 0.75rem 0.5rem;
    border-bottom: 2px solid var(--gray-300);
    font-size: 0.875rem;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.invoice-items-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.invoice-items-table .text-right {
    text-align: right;
}

.item-desc {
    color: var(--gray-600);
    font-size: 0.875rem;
}

.auto-item-row {
    background: var(--warning-light);
}

.subtotal-row td {
    padding-top: 1rem;
    font-weight: 600;
}

.total-row td {
    padding-top: 0.5rem;
    padding-bottom: 1rem;
    border-bottom: none;
    font-size: 1.125rem;
}

.email-field {
    margin-bottom: 1rem;
}

.email-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
    font-size: 0.875rem;
}

.email-field input,
.email-field textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: inherit;
}

.email-field textarea {
    resize: vertical;
    line-height: 1.6;
}

.email-info {
    background: var(--gray-50);
    padding: 0.75rem;
    border-radius: 6px;
    margin-top: 1rem;
}

.email-info p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.review-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.nav-buttons {
    display: flex;
    gap: 1rem;
}

@media (max-width: 1024px) {
    .review-container {
        grid-template-columns: 1fr;
    }
    
    .invoice-meta {
        grid-template-columns: 1fr;
    }
}

/* Test Mode Section */
.test-mode-section {
    background: linear-gradient(135deg, var(--warning-light) 0%, var(--warning-border) 100%);
    border: 2px solid var(--warning);
    border-radius: 8px;
    padding: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h3 {
    margin: 0;
    color: var(--warning-dark);
}


/* Test Mode Info */
.test-mode-info {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 16px;
}

.info-text {
    margin: 0;
    color: var(--gray-500);
    line-height: 1.6;
}

.info-text strong {
    color: var(--warning-dark);
    display: block;
    margin-bottom: 8px;
}

/* Email Input */
.label-icon {
    margin-right: 8px;
}

.test-mode-section .email-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--warning);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.test-mode-section .email-input:focus {
    outline: none;
    border-color: var(--warning-dark);
    box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.1);
}

.test-mode-section .help-text {
    display: block;
    margin-top: 0.5rem;
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* ========================
   Invoices Page
   ======================== */
.invoice-link {
    text-decoration: none;
    color: var(--primary);
    font-weight: 500;
}

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

.status-sent {
    color: var(--success);
    font-weight: 700;
}

.status-unsent {
    color: var(--warning);
    font-weight: 700;
}

/* btn-danger-small removed — use btn-danger btn-small instead */

.email-status {
    margin: 1.25rem 0;
    padding: 0.9375rem;
    background: var(--gray-50);
    border-radius: 8px;
}

.actions {
    margin-top: 20px;
}

.actions-cell {
    white-space: nowrap;
}

/* btn-sm removed — use btn-small instead */

.invoice-send-preview {
    background: var(--gray-50);
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
}

.preview-row {
    display: flex;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-200);
}

.preview-row:last-child {
    border-bottom: none;
}

.preview-label {
    font-weight: 600;
    width: 100px;
    color: var(--gray-600);
}

.preview-value {
    flex: 1;
    color: var(--gray-900);
}

/* ========================
   Invoices Finalized Page
   ======================== */
.finalized-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.finalized-page .page-header {
    text-align: center;
    margin-bottom: 3rem;
}

.finalized-page .page-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--success);
}

.invoices-summary {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.invoice-summary-card {
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 1.5rem;
    background: var(--gray-50);
}

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

.invoice-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.invoice-total {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--success);
    color: white;
    border-radius: 999px;
    font-size: 0.875rem;
}

.next-steps {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.step-card {
    text-align: center;
    padding: 2rem;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: var(--gray-50);
}

.step-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.step-card h4 {
    margin: 0.5rem 0;
}

.step-card p {
    color: var(--gray-600);
    margin-bottom: 1rem;
}

/* ========================
   Clients Page
   ======================== */
.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.filter-toggle {
    display: flex;
    gap: 0.5rem;
    background: var(--gray-100);
    padding: 0.25rem;
    border-radius: 8px;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s, box-shadow 0.2s;
}

.filter-btn.active {
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filter-btn:hover {
    background: white;
}

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

.services-list {
    display: grid;
    gap: 0.75rem;
}

.service-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: 8px;
}

.service-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

.service-details {
    flex: 1;
}

.service-name {
    font-weight: 500;
}

.service-price {
    color: var(--gray-600);
    font-size: 0.875rem;
}

.shortcut-input {
    width: 60px;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    text-align: center;
    font-weight: 700;
}

/* ========================
   Services Page
   ======================== */
.service-price-display {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

/* Services list layout */
.service-group {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.service-group h2 {
    font-size: 1.125rem;
    padding: 1rem 1.5rem;
    margin: 0;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.service-list {
    display: flex;
    flex-direction: column;
}

.service-row {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.service-row:last-child {
    border-bottom: none;
}

.service-row.service-archived {
    opacity: 0.6;
}

.service-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
}

.service-name-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    max-width: 100%;
}

.service-name-line .service-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex-shrink: 1;
}

.service-name-line .badge {
    flex-shrink: 0;
}

.service-name {
    font-weight: 500;
}

.service-price {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
}

.service-unit {
    font-weight: 400;
    color: var(--gray-500);
    font-size: 0.875rem;
}

.service-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
    margin-left: auto;
}

/* ========================
   Tab Bar (Overzicht)
   ======================== */
.tab-bar-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.tab-bar-row .tab-bar {
    flex: 1;
    margin-bottom: 0;
}

.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 2rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    color: var(--gray-500);
    cursor: pointer;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.tab:hover {
    color: var(--gray-700);
}

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

.tab-badge {
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    margin-left: 0.5rem;
}

/* Draft Cards */
.drafts-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.drafts-section h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.draft-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.draft-info h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
}

.draft-info p {
    margin: 0;
    color: var(--gray-600);
    font-size: 0.875rem;
}

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

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
}

/* Credit Notes */
.negative-amount {
    color: var(--danger);
}

.credit-item {
    background: var(--danger-light);
}

.credit-item:hover {
    background: var(--danger-light);
}

/* =============================================================================
   TOAST NOTIFICATIONS
   ============================================================================= */

.ff-toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    align-items: stretch;
    max-width: 420px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10), 0 1px 3px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transform: translateX(calc(100% + 2rem));
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: auto;
}

.ff-toast-visible {
    transform: translateX(0);
    opacity: 1;
}

.ff-toast-exit {
    transform: translateX(calc(100% + 2rem));
    opacity: 0;
}

/* 4px accent bar on the left */
.ff-toast-bar {
    width: 4px;
    flex-shrink: 0;
}

.ff-toast-success .ff-toast-bar { background: var(--success); }
.ff-toast-error .ff-toast-bar { background: var(--danger); }
.ff-toast-warning .ff-toast-bar { background: var(--warning); }
.ff-toast-info .ff-toast-bar { background: var(--primary); }

.ff-toast-message {
    flex: 1;
    padding: 0.75rem 0.5rem 0.75rem 0.875rem;
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--gray-800);
}

.ff-toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.4;
    padding: 0.75rem 0.75rem 0.75rem 0.25rem;
    line-height: 1;
    color: var(--gray-500);
    align-self: flex-start;
}

.ff-toast-close:hover {
    opacity: 1;
}

/* =============================================================================
   CONFIRM DIALOG (Overlay variant — Pattern B)
   ============================================================================= */

.ff-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    transition: background 0.2s ease;
    padding: 1rem;
}

.ff-confirm-overlay.ff-confirm-visible {
    background: rgba(0, 0, 0, 0.35);
}

.ff-confirm-box {
    background: white;
    border-radius: 8px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
    overflow: hidden;
}

.ff-confirm-visible .ff-confirm-box {
    transform: scale(1);
    opacity: 1;
}

.ff-confirm-body {
    padding: 1.5rem 1.5rem 1rem;
}

.ff-confirm-danger .ff-confirm-body {
    border-top: 3px solid var(--danger);
}

.ff-confirm-warning .ff-confirm-body {
    border-top: 3px solid var(--warning);
}

.ff-confirm-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0 0 0.5rem;
}

.ff-confirm-message {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin: 0;
    line-height: 1.5;
}

.ff-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--gray-50);
}

.ff-confirm-cancel {
    background: none;
    border: none;
    font-size: 0.875rem;
    color: var(--gray-500);
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    transition: background 0.15s, color 0.15s;
}

.ff-confirm-cancel:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.ff-confirm-btn {
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    cursor: pointer;
    transition: filter 0.15s;
}

.ff-confirm-btn:hover {
    filter: brightness(0.9);
}

.ff-confirm-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.ff-confirm-danger .ff-confirm-btn {
    background: var(--danger);
}

.ff-confirm-warning .ff-confirm-btn {
    background: var(--warning);
}

/* =============================================================================
   CONFIRM INLINE (Inside modals — Pattern A)
   ============================================================================= */

.ff-confirm-inline {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.ff-confirm-inline .ff-confirm-body {
    padding: 1rem 0;
    flex: 1;
}

.ff-confirm-inline.ff-confirm-danger .ff-confirm-body {
    border-top: none;
}

.ff-confirm-inline.ff-confirm-warning .ff-confirm-body {
    border-top: none;
}

.ff-confirm-inline .ff-confirm-actions {
    background: none;
    padding: 1rem 0 0;
    border-top: 1px solid var(--gray-100);
}

.btn-small {
    padding: 0.4rem 0.9rem;
    font-size: 0.875rem;
    border-radius: 999px;
}

/* ─── Beheer Page Styles (moved from template) ─── */

/* Client row styles */
.client-row-number {
    font-size: 0.875rem;
    color: var(--gray-400);
    font-weight: 500;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .client-row-email {
        display: none;
    }
}

/* Client Detail Modal */
.client-detail-modal {
    max-width: 560px;
    padding: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}
.client-detail-modal > .close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    z-index: 1;
}
.client-detail-header {
    padding: 1.5rem 1.75rem 1.25rem;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.client-detail-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}
.client-detail-number {
    font-size: 0.875rem;
    color: var(--gray-400);
    font-weight: 500;
}
.client-detail-ranking {
    width: 100%;
    font-size: 0.875rem;
    color: var(--primary);
    font-weight: 500;
}
.client-detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 1.75rem 1.5rem;
}
.client-detail-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.client-detail-stat {
    padding: 0.875rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}
.client-detail-stat:not(:last-child) {
    border-right: 1px solid var(--gray-200);
}
.client-detail-stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
}
.client-detail-stat-label {
    font-size: 0.75rem;
    color: var(--gray-500);
}
.client-detail-section {
    margin-bottom: 1.5rem;
}
.client-detail-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
    margin-bottom: 0.375rem;
}
.client-detail-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.client-detail-columns > div {
    font-size: 0.875rem;
    color: var(--gray-700);
    line-height: 1.5;
}
.client-detail-invoice-list {
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
}
.client-detail-invoice-row {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    gap: 0.75rem;
    border-bottom: 1px solid var(--gray-100);
}
.client-detail-invoice-row:last-child {
    border-bottom: none;
}
.cd-inv-date {
    color: var(--gray-500);
    flex-shrink: 0;
    width: 5.5rem;
}
.cd-inv-number {
    font-weight: 500;
    color: var(--gray-700);
    flex-shrink: 0;
}
.cd-inv-total {
    margin-left: auto;
    font-weight: 600;
    color: var(--gray-900);
    flex-shrink: 0;
}
.cd-inv-status {
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
}
.cd-inv-status.paid {
    background: var(--success-bg);
    color: var(--success-text);
}
.cd-inv-status.open {
    background: var(--warning-light);
    color: var(--warning-text);
}
.cd-inv-status.draft {
    background: var(--gray-100);
    color: var(--gray-500);
}
.cd-inv-status.credit {
    background: var(--danger-light);
    color: var(--danger-text);
}
.cd-inv-status.legacy {
    background: var(--gray-100);
    color: var(--gray-400);
}
.client-detail-invoice-more {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--gray-400);
}
.client-detail-footer {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.75rem;
    border-top: 1px solid var(--gray-200);
}
.client-detail-footer-left {
    margin-right: auto;
}

@media (max-width: 768px) {
    .client-detail-columns {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .client-detail-stats {
        grid-template-columns: 1fr;
    }
    .client-detail-stat:not(:last-child) {
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
    }
    .cd-inv-date {
        display: none;
    }
    .cd-inv-status {
        font-size: 0;
        padding: 0;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        min-width: 8px;
    }
    .cd-inv-status.paid { background: var(--success-text); }
    .cd-inv-status.open { background: var(--warning); }
    .cd-inv-status.draft { background: var(--gray-300); }
    .cd-inv-status.credit { background: var(--danger-text); }
    .cd-inv-status.legacy { background: var(--gray-300); }
}

.badge-auto {
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    font-weight: 500;
    letter-spacing: 0.05em;
}

.badge-recurring-svc {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-weight: 500;
}

/* Service edit modal — follows client-edit-modal pattern */
.service-edit-modal {
    max-width: 560px;
    padding: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}
.service-edit-modal > .close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    z-index: 1;
}
.service-edit-header {
    padding: 1.5rem 1.75rem 0;
}
.service-edit-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}
.service-edit-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.75rem 1.5rem;
}
.automation-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
#automationConfig {
    padding-top: 0.5rem;
}
.form-row {
    display: flex;
    gap: 1rem;
}
.form-row .client-form-group {
    flex: 1;
}
.trigger-select {
    width: 100%;
    padding: 0.375rem;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.875rem;
    background: white;
}
.trigger-select option {
    padding: 0.375rem 0.5rem;
}
.trigger-select option:checked {
    background: var(--primary);
    color: white;
}

/* Contract Rules — Edit Modal */
.cr-editor-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.cr-editor-back {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 0.25rem;
    transition: color 0.15s;
}
.cr-editor-back:hover { color: var(--gray-700); }
.cr-editor-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    flex: 1;
}
.cr-field-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.cr-field label {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}
.cr-field input, .cr-field select {
    width: 100%;
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.875rem;
    background: white;
    box-sizing: border-box;
}
.cr-field .trigger-select {
    margin-top: 0;
}
.cr-field .field-hint {
    display: block;
    font-size: 0.7rem;
    color: var(--gray-400);
    margin-top: 0.25rem;
}
.logic-toggle {
    display: flex;
    flex-direction: column;
    background: var(--gray-100);
    border-radius: 6px;
    padding: 0.0625rem;
    cursor: pointer;
    flex-shrink: 0;
}
.logic-option {
    padding: 0.125rem 0.375rem;
    font-size: 0.7rem;
    color: var(--gray-400);
    text-align: center;
    border-radius: 5px;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    line-height: 1.3;
}
.logic-option.active {
    background: white;
    color: var(--gray-900);
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.hybrid-threshold-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.hybrid-threshold-row .euro-input-wrapper {
    flex: 1;
}
.hybrid-threshold-row input[data-field="threshold_count"] {
    width: 100px;
}
.cr-auto-compensate {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--gray-50);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-top: 0.75rem;
}
.cr-auto-compensate input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary);
}
.cr-editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-100);
}
.cr-add-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: none;
    border: 1px dashed var(--gray-300);
    border-radius: 8px;
    color: var(--gray-500);
    font-size: 0.875rem;
    cursor: pointer;
    width: 100%;
    margin-top: 0.5rem;
    transition: border-color 0.15s, color 0.15s;
}
.cr-add-card:hover {
    border-color: var(--primary);
    color: var(--primary);
}
@media (max-width: 768px) {
    .cr-field-row {
        grid-template-columns: 1fr;
    }
}

/* ─── Review Invoice Styles (moved from template) ─── */

.warning-box {
    background: var(--warning-light);
    border: 1px solid var(--warning);
    border-radius: 8px;
    padding: 0.9375rem;
    margin: 0.9375rem 0;
}

.info-box {
    background: var(--info-bg);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 0.9375rem;
    margin: 0.9375rem 0;
}

.warning-box ul, .info-box ul {
    margin: 0.625rem 0;
    padding-left: 20px;
}

.send-option {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
}

.fixed-field-display {
    padding: 0.75rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    color: var(--gray-800);
    font-weight: 500;
}

.comp-inline-input {
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    font-size: inherit;
    font-family: inherit;
    background: var(--gray-50);
    width: 100%;
}
.comp-price-wrapper {
    display: flex;
    align-items: center;
    position: relative;
    width: 120px;
    margin-left: auto;
}
.comp-price-prefix {
    position: absolute;
    left: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
    font-size: inherit;
}
.comp-price-wrapper .comp-inline-input {
    padding-left: 1.5rem;
    text-align: right;
}
.comp-inline-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}
