/* Reset en basis */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #000000;
    --primary-dark: #000000;
    --accent: #f0e51b;
    --accent-light: #f5ed6a;
    --bg: #f0e51b;
    --bg-card: #ffffff;
    --text: #000000;
    --text-muted: #4a4a4a;
    --border: #e0d819;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --radius: 8px;
    --danger: #dc3545;
    --danger-light: #ffe6e6;
}

body {
    font-family: 'Helvetica Neue', Inter, sans-serif;
    font-weight: 400;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
}

h1, h2, h3, h4, h5, h6,
.section-title,
.modal-title,
.detail-name,
.logo {
    font-weight: 900;
}

/* App layout */
.app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    min-height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--text);
}

img.logo-siskin {
    height: 60px;
    width: auto;
    object-fit: contain;
}

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

.instance-switcher select {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
}

.instance-name {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

.header-link {
    font-size: 0.875rem;
    color: var(--text-primary);
    text-decoration: none;
}

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

.user-name {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.sandbox-banner {
    background: #fef3c7;
    color: #92400e;
    padding: 0.5rem 1rem;
    text-align: center;
    font-size: 0.875rem;
    border-radius: 0.5rem;
    margin: 0.75rem 1rem 0;
}

/* Main content */
.main {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0; /* Belangrijk voor flex scroll */
}

/* Layout containers */
.content-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0; /* Belangrijk voor flex scroll */
}

/* Relaties panel */
.relaties-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0.75rem;
    padding-right: 370px; /* Ruimte voor chat panel */
    padding-bottom: 32px; /* Ruimte voor footer */
    min-height: 0; /* Belangrijk voor flex scroll */
}

.relaties-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.75rem;
    flex-shrink: 0;
    gap: 1rem;
}

.header-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.zoek-input {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    outline: none;
    width: 150px;
}

.zoek-input:focus {
    border-color: var(--text);
}

.tag-filter-wrapper {
    display: flex;
    align-items: stretch;
}

.tag-filter-mode {
    padding: 0.375rem 0.6rem;
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 6px 0 0 6px;
    font-size: 0.9rem;
    font-weight: bold;
    background: var(--bg-card);
    cursor: pointer;
    min-width: 28px;
}

.tag-filter-mode:hover {
    background: var(--accent-light);
}

.tag-filter-mode.exclude {
    background: var(--danger-light);
    color: var(--danger);
}

.tag-filter-mode.exclude:hover {
    background: var(--danger);
    color: white;
}

.tag-filter {
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0 6px 6px 0;
    font-size: 0.8rem;
    outline: none;
    background: var(--bg-card);
    cursor: pointer;
    max-width: 140px;
}

.tag-filter:focus {
    border-color: var(--text);
}

.relaties-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

/* Segmented control */
.segment-control {
    display: inline-flex;
    background: var(--border);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}

.segment-btn {
    padding: 0.375rem 0.875rem;
    border: none;
    border-radius: 4px;
    background: transparent;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.segment-btn:hover {
    color: var(--text);
}

.segment-btn.active {
    background: var(--bg-card);
    color: var(--text);
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* Relatie kaarten */
.relatie-lijst {
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow-y: auto;
    flex: 1;
    background: var(--border);
    border-radius: 6px;
}

.relatie-card {
    background: var(--bg-card);
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.relatie-card:first-child {
    border-radius: 6px 6px 0 0;
}

.relatie-card:last-child {
    border-radius: 0 0 6px 6px;
}

.relatie-card:only-child {
    border-radius: 6px;
}

.relatie-card:hover {
    background: var(--bg);
}

.relatie-naam {
    font-weight: 500;
    font-size: 0.875rem;
    width: 150px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.relatie-organisatie {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex: 1;
    min-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.relatie-contact {
    font-size: 0.75rem;
    color: var(--text-muted);
    width: 100px;
    flex-shrink: 0;
    text-align: right;
    white-space: nowrap;
}

/* Organisatie overzicht: naam-kolom breder als er geen organisatie-kolom is */
.relatie-card:not(:has(.relatie-organisatie)) .relatie-naam {
    flex: 1;
    width: auto;
}

/* Chat panel - fixed rechtsonder */
.chat-panel {
    position: fixed;
    top: 80px;
    bottom: 32px; /* Ruimte voor footer */
    right: 0;
    width: 350px;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 50;
}

.chat-header {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chat-message {
    max-width: 90%;
    font-size: 0.875rem;
}

.chat-message.user {
    align-self: flex-end;
    background: var(--primary);
    color: var(--accent);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    border-bottom-right-radius: 2px;
}

.chat-message.assistant {
    align-self: flex-start;
    background: var(--bg);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    border-bottom-left-radius: 2px;
}

.chat-message.assistant a {
    color: var(--text);
    text-decoration: underline;
}

.chat-message.assistant a:hover {
    text-decoration: none;
}

.chat-message.assistant ul,
.chat-message.assistant ol {
    margin: 0.25rem 0;
    padding-left: 0;
    list-style-position: inside;
}

.chat-message.assistant ul {
    list-style: none;
}

.chat-message.assistant ol {
    list-style: none;
    counter-reset: item;
}

.chat-message.assistant li {
    display: flex;
    white-space: pre-wrap;
}

.chat-message.assistant li::before {
    content: "•";
    margin-right: 0.5em;
    flex-shrink: 0;
}

.chat-message.assistant ol li {
    counter-increment: item;
}

.chat-message.assistant ol li::before {
    content: counter(item) ".";
}

.chat-message.assistant li > * {
    display: inline;
}

.chat-message.assistant p {
    margin: 0;
}

.chat-message.assistant p + p {
    margin-top: 0.25rem;
}

.chat-input-wrapper {
    padding: 0.75rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.chat-form {
    display: flex;
    gap: 0.5rem;
}

.chat-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    outline: none;
}

.chat-input:focus {
    border-color: var(--text);
}

/* Buttons */
.btn {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

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

.btn-primary:hover {
    background: var(--text-muted);
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
}

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

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

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

.btn-danger {
    background: #dc2626;
    color: white;
}

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

.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.form-actions .btn {
    flex: 1;
}

.clickable {
    cursor: pointer;
    transition: background 0.2s;
}

.clickable:hover {
    background: var(--border);
}

.org-link {
    color: var(--text);
    cursor: pointer;
    font-weight: 500;
}

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

.detail-org a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}

.detail-org a:hover {
    text-decoration: underline;
}

.detail-info {
    background: var(--bg);
    padding: 1rem;
    border-radius: var(--radius);
}

.detail-row {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

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

.detail-row strong {
    color: var(--text-muted);
    min-width: 100px;
    display: inline-block;
}

.detail-row a {
    color: var(--text);
    text-decoration: underline;
}

.detail-row a:hover {
    text-decoration: none;
}

/* Detail pagina */
.detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}

.back-link {
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

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

.detail-content {
    padding: 1rem;
    max-width: 1000px;
    overflow-y: auto;
    flex: 1;
}

.detail-name {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.detail-org {
    color: var(--text-muted);
    margin-bottom: 0;
    line-height: 1.4;
}

.detail-org.overige {
    font-size: 0.9rem;
}

.detail-org:last-of-type {
    margin-bottom: 1.5rem;
}

.detail-org .functie-tag {
    font-size: 0.85em;
    color: var(--text-muted);
}

.functie-edit {
    font-size: 0.85em;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.1rem 0.25rem;
    border-radius: 4px;
}

.functie-edit:hover {
    background: var(--accent-light);
}

.add-functie {
    font-style: italic;
    opacity: 0.6;
}

.modal-content.modal-small {
    max-width: 400px;
}

.form-help {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.section {
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
}

.header-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Contactmomenten lijst */
.contact-lijst {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.contact-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius);
}

.contact-datum {
    color: var(--text-muted);
    font-size: 0.875rem;
    white-space: nowrap;
}

.contact-type {
    font-weight: 500;
}

.contact-beschrijving {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.contact-beschrijving a {
    color: var(--text);
    text-decoration: underline;
}

.contact-beschrijving a:hover {
    text-decoration: none;
}

.contact-beschrijving ul,
.contact-beschrijving ol {
    margin: 0.25rem 0;
    padding-left: 1.25rem;
}

.contact-beschrijving p {
    margin: 0;
}

.contact-beschrijving p + p {
    margin-top: 0.25rem;
}

/* Formulieren */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--text);
}

.input-with-button {
    display: flex;
    gap: 0.5rem;
}

.input-with-button .form-input {
    flex: 1;
}

.btn-icon {
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-hint.success {
    color: #28a745;
}

.form-hint.error {
    color: var(--danger);
}

/* Modal/Dialog */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal.open {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 90%;
    max-width: 400px;
}

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

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    background: var(--bg-card);
    border-radius: 6px;
}

/* Utility classes */
.mobile-only {
    display: none;
}

.desktop-only {
    display: flex;
}

/* Mobile responsive - Chat first! */
@media (max-width: 768px) {
    .mobile-only {
        display: flex;
    }

    .desktop-only {
        display: none !important;
    }

    .header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        min-height: 60px;
        padding: 0.5rem 1rem;
        justify-content: center;
        z-index: 200;
    }

    .header .btn-icon {
        position: absolute;
        left: 1rem;
    }

    .header-actions {
        position: absolute;
        right: 1rem;
        gap: 0.5rem;
    }

    /* Verberg niet-essentiële links op mobiel */
    .header-actions .header-link:not([href="/logout"]) {
        display: none;
    }

    .header-actions .user-name {
        display: none;
    }

    /* Instance naam/switcher verbergen op mobiel */
    .instance-name,
    .instance-switcher {
        display: none;
    }

    .content-wrapper {
        flex-direction: column;
    }

    /* Chat is nu de default view op mobiel */
    .chat-panel {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: none;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    .chat-panel .chat-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 1rem;
    }

    .chat-messages {
        flex: 1;
        padding: 1rem;
    }

    .chat-input-wrapper {
        padding: 0.75rem 1rem 1rem;
        background: var(--bg-card);
        border-top: 1px solid var(--border);
    }

    /* Lijst panel schuift in van links */
    .relaties-panel {
        position: fixed;
        top: 60px;
        left: 0;
        bottom: 0;
        width: 100%;
        background: var(--bg);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 160;
        padding: 0;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    .relaties-panel.open {
        transform: translateX(0);
    }

    .panel-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid var(--border);
        background: var(--bg-card);
    }

    .panel-title {
        font-weight: 600;
        font-size: 1rem;
    }

    .relaties-panel .relaties-header {
        padding: 0.75rem;
    }

    .relaties-panel .relatie-lijst {
        flex: 1;
        overflow-y: auto;
        padding: 0 0.75rem 0.75rem;
    }

    .panel-close {
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        color: var(--text-muted);
        padding: 0;
        line-height: 1;
    }

    .chat-close {
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        color: var(--text-muted);
    }

    /* Footer verbergen op mobiel */
    .footer {
        display: none;
    }
}

/* Notities editor en omschrijving */
.notities-preview,
.omschrijving-content {
    background: var(--bg-card);
    padding: 0.75rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.notities-preview a,
.omschrijving-content a {
    color: var(--text);
    text-decoration: underline;
}

.notities-preview ul,
.notities-preview ol,
.omschrijving-content ul,
.omschrijving-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.notities-preview p,
.omschrijving-content p {
    margin: 0.5rem 0;
}

.notities-preview p:first-child,
.omschrijving-content p:first-child {
    margin-top: 0;
}

.notities-preview p:last-child,
.omschrijving-content p:last-child {
    margin-bottom: 0;
}

.notities-editor {
    display: flex;
    flex-direction: row;
    gap: 1rem;
}

.notities-editor .form-textarea {
    flex: 1 1 50%;
    min-width: 0;
    min-height: 200px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.875rem;
    resize: vertical;
}

.notities-editor .notities-live-preview {
    flex: 1 1 50%;
    min-width: 0;
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow-y: auto;
    min-height: 200px;
    max-height: 300px;
}

.notities-live-preview a {
    color: var(--text);
    text-decoration: underline;
}

.notities-live-preview ul,
.notities-live-preview ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.notities-live-preview p {
    margin: 0.5rem 0;
}

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

/* Organisaties lijst in relatie details */
.organisaties-lijst {
    display: inline;
}

.organisatie-item {
    display: inline;
}

.organisatie-item:not(:last-child)::after {
    content: ", ";
}

.functie-tag {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.primair-tag {
    background: var(--accent);
    color: var(--text);
    font-size: 0.7rem;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    margin-left: 0.25rem;
}

/* HTMX loading indicator */
.htmx-request .htmx-indicator {
    opacity: 1;
}

.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease-in;
}

/* Footer */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: var(--bg);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    z-index: 40;
}

/* Tags */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.tags-empty {
    margin-bottom: 0.5rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

.tag-link {
    color: var(--text);
    text-decoration: none;
}

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

.tag-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0 0.25rem;
    line-height: 1;
}

.tag-remove:hover {
    color: var(--text);
}

.tag-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.tag-input {
    flex: 1;
    max-width: 200px;
    padding: 0.4rem 0.75rem !important;
    font-size: 0.9rem !important;
}

.tag-suggesties {
    margin: 0.75rem 0;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}

.tag-suggesties .form-hint {
    display: block;
    margin-bottom: 0.5rem;
}

#tag-suggesties-lijst {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-suggestie {
    background: var(--accent);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.1s;
}

.tag-suggestie:hover {
    transform: scale(1.05);
}

.tag-suggestie.nieuw {
    background: var(--success, #28a745);
}

.btn-small {
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
}

/* Active filter indicator */
.active-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--accent-light);
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

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

.filter-tag {
    background: var(--bg-card);
    padding: 0.2rem 0.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
}

.filter-tag.clickable {
    cursor: pointer;
}

.filter-tag.clickable:hover {
    background: var(--accent);
    color: white;
}

.filter-tag.exclude {
    background: var(--danger-light, #ffe6e6);
    border-color: var(--danger, #dc3545);
    text-decoration: line-through;
    text-decoration-color: var(--danger, #dc3545);
}

.filter-tag.exclude:hover {
    background: var(--danger, #dc3545);
    color: white;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.filter-clear {
    margin-left: auto;
    color: var(--text);
    text-decoration: none;
    font-size: 0.8rem;
}

.filter-clear:hover {
    text-decoration: underline;
}

/* Danger zone */
.danger-zone {
    margin-top: 2rem;
    padding: 1rem;
    background: var(--accent);
    border-radius: 0.5rem;
    text-align: center;
}

.btn-danger-subtle {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--text-muted);
    padding: 0.4rem 0.8rem;
    border-radius: 0.3rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-danger-subtle:hover {
    background: var(--danger, #dc3545);
    color: white;
    border-color: var(--danger, #dc3545);
}

/* Admin panel styles */
body:has(.admin-container) {
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
}

body:has(.admin-container) .app {
    height: auto;
    overflow: visible;
}

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 60px);
}

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

.admin-header h1 {
    font-size: 1.75rem;
    font-weight: 900;
}

.admin-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}

.admin-nav-link {
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 0.5rem 0.5rem 0 0;
    transition: all 0.15s ease;
}

.admin-nav-link:hover {
    color: var(--text);
    background: rgba(0,0,0,0.05);
}

.admin-nav-link.active {
    color: var(--text);
    background: var(--bg-card);
    font-weight: 600;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 0.75rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--text);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.admin-section {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.admin-section h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.admin-table {
    overflow-x: auto;
}

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

.admin-table th,
.admin-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

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

.badge-success {
    background: #10b981;
    color: white;
}

.badge-warning {
    background: #f59e0b;
    color: white;
}

.badge-muted {
    background: #6b7280;
    color: white;
}

.badge-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.badge-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    margin-left: 0.25rem;
    padding: 0 0.25rem;
}

.badge-remove:hover {
    color: var(--danger);
}

.form-select-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    background: white;
}

.access-form {
    display: inline-block;
}

/* Admin forms */
.admin-form {
    max-width: 800px;
}

.admin-form .form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.admin-form .form-group {
    flex: 1;
    min-width: 0;
}

.admin-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.admin-form input[type="text"],
.admin-form input[type="email"],
.admin-form input[type="password"],
.admin-form select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background: white;
}

.admin-form input:focus,
.admin-form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.admin-form .form-help {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.admin-form .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
    cursor: pointer;
    margin-top: 1.5rem;
}

.admin-form .checkbox-label input[type="checkbox"] {
    width: auto;
}

.form-input-disabled {
    background: var(--bg) !important;
    color: var(--text-muted);
}

.form-select-inline {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    background: white;
}

/* Button variants */
.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

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

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

/* Modal actions */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Admin section header */
.admin-section h2 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* Wide modal for admin forms */
.modal-wide {
    max-width: 500px;
}

/* CSV Import */
#csv-import-modal .modal-content {
    max-width: 850px;
    max-height: 90vh;
    overflow-y: auto;
}
.csv-preview h4 { margin: 1rem 0 0.75rem; }
.csv-summary {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.csv-stat { font-size: 0.9em; }
.csv-stat strong { font-size: 1.1em; }
.csv-stat-warn strong { color: var(--warning, #d97706); }
.csv-table-wrap { overflow-x: auto; margin: 0.75rem 0; }
.csv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
}
.csv-table th {
    text-align: left;
    padding: 0.5rem;
    border-bottom: 2px solid var(--border);
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
}
.csv-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.csv-row-dup { background-color: rgba(255, 193, 7, 0.08); }
.csv-alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius, 6px);
    margin-bottom: 0.75rem;
}
.csv-alert-success { background: rgba(34, 197, 94, 0.1); border-left: 3px solid #22c55e; }
.csv-alert-danger { background: rgba(239, 68, 68, 0.1); border-left: 3px solid #ef4444; }
.csv-alert-warn { background: rgba(255, 193, 7, 0.1); border-left: 3px solid #ffc107; }
.csv-alert h4 { margin: 0 0 0.25rem; }

/* Opvolgacties */
.opvolgactie-item {
    align-items: flex-start;
}
.opvolgactie-check {
    padding-top: 0.15rem;
    flex-shrink: 0;
}
.opvolgactie-check input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
}
.opvolgactie-content {
    flex: 1;
    min-width: 0;
}
.opvolgactie-top {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.opvolgactie-relatie {
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
}
.opvolgactie-relatie:hover {
    text-decoration: underline;
}
.opvolgactie-org {
    color: var(--text-muted);
    font-size: 0.8rem;
}
.opvolgactie-org::before {
    content: "·";
    margin-right: 0.2rem;
}
.opvolgactie-top .contact-datum {
    margin-left: auto;
}
.opvolgactie-tekst {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.3;
}
.opvolgactie-tekst.doorgestreept {
    text-decoration: line-through;
    opacity: 0.6;
}
.opvolgactie-item.afgerond {
    opacity: 0.6;
}
.contact-datum.overdue {
    color: var(--danger, #ef4444);
    font-weight: 500;
}
.link-subtle {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-decoration: none;
}
.link-subtle:hover {
    text-decoration: underline;
}

/* Footer */
.app-footer {
    position: fixed;
    bottom: 0;
    right: 0;
    padding: 4px 12px;
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.5;
    z-index: 1;
}
.app-footer:hover {
    opacity: 1;
}
