:root {
    --teal-900: #0f3d47;
    --teal-800: #14525f;
    --teal-700: #1a6878;
    --teal-600: #1f7f92;
    --teal-500: #2596ad;
    --slate-900: #0f172a;
    --slate-800: #1e293b;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748b;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --slate-50: #f8fafc;
    --white: #ffffff;
    --success: #15803d;
    --warning: #b45309;
    --danger: #b91c1c;
    --info: #0369a1;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.04);
    --font: "Segoe UI", system-ui, -apple-system, sans-serif;
    --brand-text: #222222;
    --brand-heading: #1F4E79;
    --brand-accent: #1F4E79;
    --brand-link: #0563C1;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; }
body {
    margin: 0;
    font-family: var(--font);
    color: var(--brand-text, var(--slate-800));
    background: var(--slate-50);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--teal-700); text-decoration: none; }
a:hover { color: var(--teal-900); text-decoration: underline; }

/* Layout */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--teal-900), var(--slate-900));
    color: var(--white);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}
.sidebar-brand {
    padding: 1.25rem 1.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}
.sidebar-logo {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}
.sidebar-nav { flex: 1; padding: 1rem 0; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.6rem 1.5rem;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 0.925rem;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
    background: rgba(255,255,255,0.08);
    color: var(--white);
    text-decoration: none;
}
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}
.btn-notifications {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.nav-badge--header {
    position: relative;
    top: 0;
}
.sidebar-nav .nav-section {
    padding: 0.75rem 1.5rem 0.35rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.45);
}
.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--slate-200);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.page-body { padding: 1.5rem; flex: 1; }

/* Auth / Install centered */
.auth-layout, .install-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--slate-100), #dce8eb);
    padding: 1rem;
}
.auth-card, .install-card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 440px;
    padding: 2rem;
}
.install-card { max-width: 640px; }

/* Typography */
h1, h2, h3 { color: var(--brand-heading, var(--slate-900)); margin: 0 0 0.75rem; }
a { color: var(--brand-link, var(--teal-700)); }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Cards */
.card {
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}
.card-header {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--slate-200);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header--toggle {
    width: 100%;
    margin: 0;
    border: 0;
    border-bottom: 1px solid var(--slate-200);
    background: transparent;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
    gap: 0.75rem;
}
.card-header--toggle:hover {
    background: var(--slate-50);
}
.settings-section .card-header--toggle[aria-expanded="false"] {
    border-bottom-color: transparent;
}
.collapse-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    color: var(--slate-500);
    font-size: 0.85rem;
    transition: transform 0.15s ease;
    transform: rotate(-90deg);
}
.collapse-chevron.is-open {
    transform: rotate(0deg);
}
.card-body { padding: 1.25rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.stat-card {
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
}
.stat-card .value { font-size: 2rem; font-weight: 700; color: var(--teal-800); }
.stat-card .label { font-size: 0.85rem; color: var(--slate-500); }

/* Forms */
.form-group { margin-bottom: 1rem; }
label { display: block; font-size: 0.875rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--slate-700); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], input[type=number], input[type=file], select, textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--slate-200);
    border-radius: 6px;
    font: inherit;
    background: var(--white);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--teal-500);
    box-shadow: 0 0 0 3px rgba(37, 150, 173, 0.15);
}
textarea { min-height: 100px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-help { font-size: 0.8rem; color: var(--slate-500); margin-top: 0.25rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--teal-700); color: var(--white); }
.btn-primary:hover { background: var(--teal-800); color: var(--white); }
.btn-secondary { background: var(--white); color: var(--slate-700); border-color: var(--slate-200); }
.btn-secondary:hover { background: var(--slate-100); color: var(--slate-900); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #991b1b; color: var(--white); }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; }
.btn-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { padding: 0.65rem 0.875rem; text-align: left; border-bottom: 1px solid var(--slate-200); }
th { background: var(--slate-100); font-weight: 600; color: var(--slate-700); white-space: nowrap; }
tr:hover td { background: rgba(241,245,249,0.5); }

/* Badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-success { background: #dcfce7; color: var(--success); }
.badge-warning { background: #fef3c7; color: var(--warning); }
.badge-danger { background: #fee2e2; color: var(--danger); }
.badge-info { background: #e0f2fe; color: var(--info); }
.badge-neutral { background: var(--slate-200); color: var(--slate-700); }
.badge-concept { background: #e0f2fe; color: #0369a1; }
.badge-review { background: #fef3c7; color: #92400e; }
.badge-published { background: #dcfce7; color: #166534; }

/* Alerts / Flash */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--slate-200); margin-bottom: 1.25rem; flex-wrap: wrap; }
.tab {
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--slate-500);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    text-decoration: none;
}
.tab:hover { color: var(--teal-700); text-decoration: none; }
.tab.active { color: var(--teal-800); border-bottom-color: var(--teal-600); }

/* Pagination */
.pagination { display: flex; gap: 0.35rem; margin-top: 1rem; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--slate-200);
    border-radius: 4px;
    font-size: 0.85rem;
}
.pagination .active { background: var(--teal-700); color: var(--white); border-color: var(--teal-700); }

/* Editor */
.editor-layout { display: grid; grid-template-columns: 280px 1fr; gap: 1rem; min-height: 70vh; }
.editor-sidebar { background: var(--white); border: 1px solid var(--slate-200); border-radius: var(--radius); padding: 1rem; }
.editor-sidebar-header { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.25rem; }
.editor-add-form { margin-top: 0.75rem; padding: 0.75rem; background: var(--slate-50, #f8fafc); border: 1px solid var(--slate-200); border-radius: 6px; }
.editor-add-form .form-group { margin-bottom: 0.65rem; }
.editor-add-form label { font-size: 0.8rem; }
.editor-add-form input,
.editor-add-form select { width: 100%; font-size: 0.875rem; }
.editor-main { background: var(--white); border: 1px solid var(--slate-200); border-radius: var(--radius); padding: 1rem; }
.ql-container { min-height: 400px; font-family: var(--font); }
.article-list-item { padding: 0.5rem; border-radius: 4px; font-size: 0.875rem; display: flex; align-items: center; gap: 0.4rem; }
.article-list-item.active { background: rgba(37,150,173,0.1); font-weight: 600; }
.article-list-item a { flex: 1; min-width: 0; }
.drag-handle {
    cursor: grab;
    color: var(--slate-500);
    user-select: none;
    font-size: 0.85rem;
    letter-spacing: -0.15em;
    padding: 0.15rem 0.25rem;
    line-height: 1;
}
.drag-handle:active { cursor: grabbing; }
.drag-col { width: 2rem; }
td.drag-handle { width: 2rem; color: var(--slate-500); vertical-align: middle; }
.sortable-ghost { opacity: 0.45; background: #e8f5f2 !important; }
.article-sortable-list .sortable-ghost { background: #e8f5f2; }
[x-cloak] { display: none !important; }
.mb-2 { margin-bottom: 1rem; }
.mt-2 { margin-top: 1rem; }

/* Compare diff */
.diff-added { background: #dcfce7; }
.diff-removed { background: #fee2e2; }
.diff-changed { background: #fef3c7; }
.compare-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Utilities */
.text-muted { color: var(--slate-500); font-size: 0.875rem; }
.text-sm { font-size: 0.8rem; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mt-2 { margin-top: 1rem; }
.empty-state { text-align: center; padding: 2rem; color: var(--slate-500); }

/* Workflow */
.workflow-steps {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.workflow-step {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: var(--slate-100);
    color: var(--slate-500);
    border: 1px solid var(--slate-200);
}
.workflow-step.is-done {
    background: #e8f5f2;
    color: var(--teal-800);
    border-color: #b7ddd6;
}
.workflow-step.is-current {
    background: var(--teal-700);
    color: #fff;
    border-color: var(--teal-700);
    font-weight: 600;
}
.workflow-action {
    padding: 0.75rem;
    border: 1px solid var(--slate-200);
    border-radius: 6px;
    background: var(--slate-50);
}
.workflow-action-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}
.workflow-action .text-muted { margin-top: 0; margin-bottom: 0.5rem; }

/* Document lezen (leesweergave) */
.document-read-toc { margin-bottom: 1.25rem; }
.document-read-toc-list {
    margin: 0;
    padding-left: 1.25rem;
    display: grid;
    gap: 0.35rem;
    font-size: 0.95rem;
}
.document-read-toc-list a { color: var(--brand-link, var(--teal-700)); text-decoration: none; }
.document-read-toc-list a:hover { text-decoration: underline; }
.document-read { display: grid; gap: 1rem; }
.document-read-article { scroll-margin-top: 1.5rem; }
.document-read-body {
    font-size: 1rem;
    line-height: 1.65;
    color: var(--brand-text, var(--slate-800));
}
.document-read-body h1,
.document-read-body h2,
.document-read-body h3 {
    color: var(--brand-heading, var(--slate-900));
    margin: 1.25rem 0 0.5rem;
}
.document-read-body p { margin: 0 0 0.85rem; }
.document-read-body ul,
.document-read-body ol { margin: 0 0 0.85rem; padding-left: 1.35rem; }
.document-read-body img { max-width: 100%; height: auto; }

/* Responsive */
@media (max-width: 768px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; }
    .sidebar-nav { display: flex; flex-wrap: wrap; padding: 0.5rem; }
    .sidebar-nav a { padding: 0.5rem 0.75rem; }
    .form-row, .editor-layout, .compare-columns { grid-template-columns: 1fr; }
}

