/* ============================================================
   Coaching App — Stylesheet
   ============================================================ */

/* --- Reset & Custom Properties --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --color-bg:         #f5f5f0;
    --color-surface:    #ffffff;
    --color-border:     #e0e0d8;
    --color-text:       #1a1a1a;
    --color-text-muted: #6b6b6b;
    --color-primary:    #2563eb;
    --color-primary-h:  #1d4ed8;
    --color-success:    #16a34a;
    --color-warning:    #d97706;
    --color-error:      #dc2626;
    --color-info:       #0891b2;

    --radius:    6px;
    --radius-lg: 10px;
    --shadow:    0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);

    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', Consolas, monospace;
    --font-size: 15px;
    --line-height: 1.6;
}

/* --- Base --- */
html { font-size: var(--font-size); }
body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: var(--line-height);
    min-height: 100vh;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin-bottom: .75rem; }
p:last-child { margin-bottom: 0; }
h1, h2, h3, h4 { line-height: 1.3; font-weight: 600; }

/* --- Sidebar variables --- */
:root {
    --sb-w:          64px;
    --sb-wx:         240px;
    --sb-bg:         #1e293b;
    --sb-text:       rgba(255,255,255,.70);
    --sb-text-h:     #ffffff;
    --sb-active-bg:  rgba(255,255,255,.12);
    --sb-hover-bg:   rgba(255,255,255,.07);
    --sb-border:     rgba(255,255,255,.09);
    --sb-speed:      200ms;
}

/* --- App layout --- */
body {
    display: flex;
    min-height: 100vh;
}

.app-content {
    margin-left: var(--sb-w);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--sb-speed) ease;
}

body.sidebar-pinned .app-content {
    margin-left: var(--sb-wx);
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sb-w);
    background: var(--sb-bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 200;
    transition: width var(--sb-speed) ease;
    flex-shrink: 0;
}

.sidebar.is-expanded { width: var(--sb-wx); }

/* Brand + pin row */
.sidebar__top {
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 8px;
    border-bottom: 1px solid var(--sb-border);
    flex-shrink: 0;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.sidebar__brand-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar__brand .sidebar__label {
    color: #fff;
    font-weight: 700;
    font-size: 15px;
}

/* Pin button (only visible when expanded) */
.sidebar__pin {
    background: none;
    border: none;
    color: var(--sb-text);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 150ms, background 150ms, color 150ms;
}

.sidebar__pin svg { width: 15px; height: 15px; }

.sidebar.is-expanded .sidebar__pin {
    opacity: 1;
    pointer-events: auto;
}

.sidebar:not(.is-expanded) .sidebar__pin {
    display: none;
}

.sidebar:not(.is-expanded) .sidebar__brand {
    gap: 0;
}

.sidebar__pin:hover { background: var(--sb-hover-bg); color: #fff; }
body.sidebar-pinned .sidebar__pin { color: #fff; }

/* Nav items */
.sidebar__nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0;
    scrollbar-width: none;
}
.sidebar__nav::-webkit-scrollbar { display: none; }

.sidebar__nav ul { list-style: none; }

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 22px;
    color: var(--sb-text);
    text-decoration: none;
    transition: background var(--sb-speed), color 150ms;
    white-space: nowrap;
    min-height: 44px;
}

.sidebar__link:hover {
    background: var(--sb-hover-bg);
    color: var(--sb-text-h);
    text-decoration: none;
}

.sidebar__link--active {
    background: var(--sb-active-bg);
    color: var(--sb-text-h);
}

.sidebar__link--active:hover { background: var(--sb-active-bg); }

.sidebar__icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar__nav .sidebar__label {
    font-size: 14px;
    font-weight: 500;
}

/* Labels: hidden when collapsed, visible when expanded */
.sidebar__label {
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity var(--sb-speed) ease, transform var(--sb-speed) ease;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar.is-expanded .sidebar__label {
    opacity: 1;
    transform: translateX(0);
}

/* Divider between nav groups */
.sidebar__divider {
    height: 1px;
    background: var(--sb-border);
    margin: 6px 16px;
}

/* Logout at bottom */
.sidebar__bottom {
    border-top: 1px solid var(--sb-border);
    padding: 8px 0;
    flex-shrink: 0;
}

.sidebar__link--logout { color: rgba(248,113,113,.8); }
.sidebar__link--logout:hover { color: #f87171; background: rgba(248,113,113,.10); }

/* Overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 190;
}
.sidebar-overlay.is-visible { display: block; }

/* Mobile top bar */
.mobile-topbar {
    display: none;
    align-items: center;
    gap: 12px;
    height: 52px;
    padding: 0 16px;
    background: var(--sb-bg);
    position: sticky;
    top: 0;
    z-index: 150;
    flex-shrink: 0;
}

.mobile-topbar__brand {
    color: #fff;
    font-weight: 700;
    font-size: 15px;
}

.mobile-menu-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-btn svg { width: 22px; height: 22px; }

/* --- Responsive --- */
@media (max-width: 768px) {
    body { display: block; }

    .sidebar {
        left: calc(-1 * var(--sb-wx));
        width: var(--sb-wx);
        transition: left var(--sb-speed) ease;
    }

    .sidebar.mobile-open {
        left: 0;
    }

    /* Always show labels on mobile (sidebar is full-width overlay) */
    .sidebar .sidebar__label {
        opacity: 1;
        transform: none;
    }

    .sidebar__pin { display: none; }

    .app-content {
        margin-left: 0 !important;
    }

    .mobile-topbar { display: flex; }
}

/* --- Main layout --- */
.main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px 48px;
    flex: 1;
}

.page-title {
    font-size: 22px;
    margin-bottom: 24px;
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--color-text-muted);
    font-size: 13px;
    border-top: 1px solid var(--color-border);
    margin-top: auto;
}

/* --- Login page --- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}
.login-box {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-md);
}
.login-box__icon { margin-bottom: 16px; }
.login-box h1 { font-size: 24px; margin-bottom: 4px; }
.login-box__subtitle { color: var(--color-text-muted); margin-bottom: 28px; }

/* --- Cards --- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.card--highlight { border-color: var(--color-primary); }
.card--active    { border-color: var(--color-success); }
.card__header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card__header h3 { font-size: 15px; margin: 0; }
.card__body { padding: 20px; }
.card__body--row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.card__actions { display: flex; gap: 8px; }

/* --- Alerts --- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    border-left: 4px solid transparent;
}
.alert--success { background: #f0fdf4; border-color: var(--color-success); color: #15803d; }
.alert--error   { background: #fef2f2; border-color: var(--color-error);   color: #991b1b; }
.alert--warning { background: #fffbeb; border-color: var(--color-warning); color: #92400e; }
.alert--info    { background: #f0f9ff; border-color: var(--color-info);    color: #075985; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background .15s, opacity .15s;
    white-space: nowrap;
}
.btn--primary   { background: var(--color-primary); color: #fff; }
.btn--primary:hover { background: var(--color-primary-h); color: #fff; text-decoration: none; }
.btn--secondary { background: var(--color-bg); color: var(--color-text); border: 1px solid var(--color-border); }
.btn--secondary:hover { background: var(--color-border); text-decoration: none; }
.btn--warning   { background: var(--color-warning); color: #fff; }
.btn--success   { background: var(--color-success); color: #fff; }
.btn--success:hover { background: #15803d; color: #fff; text-decoration: none; }
.btn--full      { width: 100%; justify-content: center; }
.btn--sm        { padding: 5px 12px; font-size: 13px; }

.btn-inline-delete {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-error);
    font-size: 16px;
    line-height: 1;
    padding: 0 3px;
    vertical-align: middle;
}

/* --- Forms --- */
.form { max-width: 680px; }
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--color-text);
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font-sans);
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-group small { display: block; margin-top: 4px; font-size: 12px; color: var(--color-text-muted); }
.form-actions { display: flex; gap: 10px; margin-top: 28px; flex-wrap: wrap; }
.form-inline { display: flex; align-items: center; gap: 10px; }

.required { color: var(--color-error); }

/* --- Scale inputs --- */
.scale-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.scale-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: normal;
}
.scale-label input { cursor: pointer; }
.yes-no-group { display: flex; gap: 20px; }
.yes-no-group label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* --- Toolbar --- */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

/* --- Tables --- */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.table th {
    background: var(--color-bg);
    text-align: left;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
}
.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
    vertical-align: top;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafaf8; }
.table .actions { display: flex; gap: 10px; }

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.badge--active    { background: #dcfce7; color: #15803d; }
.badge--completed { background: #dbeafe; color: #1d4ed8; }
.badge--paused    { background: #fef9c3; color: #854d0e; }
.badge--dropped   { background: #fee2e2; color: #991b1b; }
.badge--neutral   { background: var(--color-bg); color: var(--color-text-muted); border: 1px solid var(--color-border); }
.badge--success   { background: #dcfce7; color: #15803d; }
.badge--info      { background: #e0f2fe; color: #075985; }

/* --- Section --- */
.section { margin-top: 36px; }
.section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}
.section__header h2 { font-size: 17px; }

/* --- Empty state --- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--color-text-muted);
    background: var(--color-surface);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-lg);
}
.empty-state p { margin-bottom: 16px; }

/* --- Dashboard goal grid (legacy, voor goals/index) --- */
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.goal-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow);
    transition: box-shadow .15s;
}
.goal-card:hover { box-shadow: var(--shadow-md); }
.goal-card--completed { border-left: 4px solid var(--color-primary); }
.goal-card--active    { border-left: 4px solid var(--color-success); }
.goal-card--paused    { border-left: 4px solid var(--color-warning); }
.goal-card--dropped   { border-left: 4px solid var(--color-error); opacity: .8; }
.goal-card__header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.goal-card__header a { font-weight: 600; font-size: 15px; color: var(--color-text); }
.goal-card__desc { font-size: 13px; color: var(--color-text-muted); margin-bottom: 12px; }
.goal-card__actions { display: flex; gap: 12px; font-size: 13px; }

/* --- Dashboard check-in kaarten (nieuwe stijl) --- */
.goal-checkin-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 8px; }
.goal-checkin-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: var(--shadow-md);
    transition: box-shadow .15s;
}
.goal-checkin-card:hover { box-shadow: 0 6px 12px rgba(0,0,0,.10); }
.goal-checkin-card--active    { border-left-color: var(--color-success); }
.goal-checkin-card--completed { border-left-color: var(--color-primary); }
.goal-checkin-card--paused    { border-left-color: var(--color-warning); }
.goal-checkin-card--dropped   { border-left-color: var(--color-error); opacity: .8; }
.goal-checkin-card__left { flex: 1; min-width: 0; }
.goal-checkin-card__title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.goal-checkin-card__title a { color: var(--color-text); word-break: break-word; overflow-wrap: anywhere; }
.goal-checkin-card__actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }

/* Mobiel: stapel titel + acties verticaal zodat de titel niet wordt platgedrukt */
@media (max-width: 640px) {
    .goal-checkin-card {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .goal-checkin-card__actions { width: 100%; }
    .goal-checkin-card__actions .btn { flex: 1 1 auto; min-width: 0; }
}

/* Check-in create header */
.checkin-create-header { margin-bottom: 20px; }

/* Check-in view meta */
.checkin-view__meta { margin-bottom: 20px; display: flex; flex-direction: column; gap: 4px; }

/* --- Goal view --- */
.goal-view__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 12px; }
.goal-view__actions { display: flex; gap: 8px; }

/* --- Check-in list --- */
.checkin-list { display: flex; flex-direction: column; gap: 16px; }
.checkin-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 16px;
}
.checkin-item__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-weight: 600; }
.checkin-item__answer { margin: 8px 0; padding: 8px 0; border-top: 1px solid var(--color-border); }

/* --- Check-in view --- */
.checkin-view {}
.answer-block {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}
.answer-block__question { font-weight: 500; margin-bottom: 6px; }
.answer-block__value { font-size: 15px; margin-bottom: 8px; }
.answer-block__links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.goal-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 13px;
}
.free-text-block {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
}

/* --- Goal link toggle (details/summary) --- */
.goal-link-toggle {
    margin-top: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}
.goal-link-toggle > summary {
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
    background: var(--color-bg);
    list-style: none;
}
.goal-link-toggle > summary::-webkit-details-marker { display: none; }
.goal-link-list { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.goal-link-item { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.goal-link-note input {
    width: 100%;
    margin-top: 4px;
    padding: 5px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 13px;
}

/* --- Inline link form (checkin view) --- */
.inline-link-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 10px 12px;
}
.inline-link-form select,
.inline-link-form input[type="text"] {
    padding: 5px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 13px;
    background: var(--color-surface);
}
.inline-form { display: inline; }

/* --- Question sets --- */
.question-sets { display: flex; flex-direction: column; gap: 16px; }
.question-list { padding-left: 20px; }
.question-list li { margin: 6px 0; font-size: 14px; }

/* --- Question editor rows --- */
.question-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}
.question-row__num {
    width: 24px;
    flex-shrink: 0;
    font-size: 13px;
    color: var(--color-text-muted);
    padding-top: 9px;
    text-align: right;
}
.question-row__fields {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.question-text { flex: 1 1 300px; }
.inline-check { display: flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }

/* --- AI Coach page --- */
.ai-coach-page { max-width: 800px; }
.goal-info-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
#ai-prompt { width: 100%; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: 14px; font-family: var(--font-sans); resize: vertical; }
#ai-prompt:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.context-preview { margin: 16px 0; }
.context-preview h4 { font-size: 14px; margin-bottom: 8px; }
.code-block {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 14px;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 12px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
.ai-response {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: var(--radius);
    padding: 16px;
    font-size: 14px;
    line-height: 1.6;
    margin: 16px 0;
}
.ai-loading { display: flex; align-items: center; gap: 10px; color: var(--color-text-muted); padding: 16px 0; }
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* AI sessiehistorie */
.ai-sessions-history { display: flex; flex-direction: column; gap: 8px; }
.ai-session-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}
.ai-session-item > summary {
    padding: 12px 16px;
    cursor: pointer;
    list-style: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--color-bg);
}
.ai-session-item > summary::-webkit-details-marker { display: none; }
.ai-session-detail { padding: 16px; font-size: 14px; }
.ai-session-detail__prompt { margin-bottom: 12px; }
.ai-session-detail__response { margin-bottom: 12px; }

/* --- Markdown-content (AI-antwoorden) --- */
.markdown { font-size: 14px; line-height: 1.55; }
.markdown > *:first-child { margin-top: 0; }
.markdown > *:last-child  { margin-bottom: 0; }
.markdown p { margin: 0 0 10px; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 {
    margin: 16px 0 8px; line-height: 1.3; font-weight: 700;
}
.markdown h1 { font-size: 18px; }
.markdown h2 { font-size: 16px; }
.markdown h3 { font-size: 15px; }
.markdown h4 { font-size: 14px; }
.markdown ul, .markdown ol { margin: 0 0 10px; padding-left: 22px; }
.markdown li { margin-bottom: 4px; }
.markdown li > p { margin: 0; }
.markdown strong { font-weight: 700; }
.markdown em { font-style: italic; }
.markdown code {
    background: var(--color-bg);
    padding: 1px 5px; border-radius: 4px;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: .92em;
}
.markdown pre {
    background: var(--color-bg);
    padding: 10px 12px; border-radius: 6px;
    overflow-x: auto; margin: 0 0 10px;
    border: 1px solid var(--color-border);
}
.markdown pre code { background: transparent; padding: 0; }
.markdown blockquote {
    border-left: 3px solid var(--color-border);
    margin: 0 0 10px; padding: 2px 12px;
    color: var(--color-text-muted);
}
.markdown hr { border: none; border-top: 1px solid var(--color-border); margin: 14px 0; }
.markdown a { color: var(--color-primary); text-decoration: underline; }
.ai-session-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--color-border); }

/* --- Snelle notities (quick notes) op check-in pagina --- */
.quick-notes-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-warning, #f59e0b);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 24px;
}
.quick-notes-section h2 { font-size: 15px; margin-bottom: 4px; }
.quick-notes-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.quick-note-item {
    background: var(--color-bg, #f8fafc);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}
.quick-note-item > summary {
    padding: 10px 14px;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 12px;
    user-select: none;
}
.quick-note-item > summary::-webkit-details-marker { display: none; }
.quick-note-item[open] > summary { border-bottom: 1px solid var(--color-border); }
.quick-note-item[open] .quick-note-toggle { transform: rotate(180deg); }
.quick-note-toggle { margin-left: auto; transition: transform .15s; color: var(--color-text-muted); }
.quick-note-date { white-space: nowrap; }
.quick-note-check {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; cursor: pointer;
}
.quick-note-check input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.quick-note-check__label { font-weight: 500; }
.quick-note-item:has(input[type="checkbox"]:checked) {
    opacity: .55;
    text-decoration: line-through;
}
.quick-note-item:has(input[type="checkbox"]:checked) .quick-note-body { text-decoration: none; }
.quick-note-body { padding: 12px 14px; font-size: 14px; }

/* --- Check-in doeltegels filter --- */
.goal-filter-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}
.goal-filter-tile {
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    min-width: 150px;
    max-width: 260px;
    text-decoration: none;
    color: var(--color-text);
    transition: border-color .15s, box-shadow .15s;
}
.goal-filter-tile:hover { border-color: var(--color-primary); box-shadow: var(--shadow-md); text-decoration: none; }
.goal-filter-tile--selected { border-color: var(--color-primary); background: #eff6ff; }
.goal-filter-tile--selected:hover { border-color: var(--color-primary-h); }
.goal-filter-tile--selected .goal-filter-tile__title { color: var(--color-primary); }
.goal-filter-tile__title { font-weight: 600; font-size: 14px; line-height: 1.3; }
.goal-filter-tile__meta { font-size: 12px; color: var(--color-text-muted); }
.goal-filter-tile__count { font-size: 12px; color: var(--color-primary); margin-top: 4px; }

/* AI response actieknoppen */
.ai-response-actions { flex-wrap: wrap; gap: 8px; }
.action-status {
    margin-top: 10px;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: var(--radius);
}
.action-status--success { background: #f0fdf4; color: var(--color-success); border: 1px solid #bbf7d0; }
.action-status--error   { background: #fef2f2; color: var(--color-error);   border: 1px solid #fecaca; }

/* Feedback preview in check-in formulier */
.feedback-preview {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    overflow: hidden;
}
.feedback-preview > summary {
    padding: 12px 16px;
    cursor: pointer;
    list-style: none;
    font-size: 14px;
    font-weight: 600;
    color: #92400e;
}
.feedback-preview > summary::-webkit-details-marker { display: none; }
.feedback-preview__body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.feedback-preview__item { border-top: 1px solid #fde68a; padding-top: 12px; }
.feedback-preview__text { font-size: 14px; margin-top: 4px; color: #78350f; }

/* --- AI sessies op goal-view --- */
.ai-sessions { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.ai-session { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 14px; }
.ai-session__meta { font-size: 12px; color: var(--color-text-muted); margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.ai-session__prompt { font-size: 13px; margin-bottom: 8px; }
.ai-session__response { font-size: 14px; white-space: pre-wrap; }

/* --- Export page --- */
.export-page { max-width: 600px; }
.checkbox-group, .radio-group { display: flex; flex-direction: column; gap: 8px; }
.checkbox-group label, .radio-group label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; font-weight: normal; }
.checkbox-group__all { border-bottom: 1px solid var(--color-border); padding-bottom: 8px; margin-bottom: 4px; }

/* --- Utility --- */
.text-muted   { color: var(--color-text-muted); }
.text-sm      { font-size: 13px; }
.note         { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }
.icon-check   { color: var(--color-success); }

/* --- Responsive --- */
@media (max-width: 640px) {
    .nav__links { display: none; }
    .main { padding: 20px 16px 60px; }
    .goal-grid { grid-template-columns: 1fr; }
    .card__body--row { flex-direction: column; align-items: flex-start; }
    .table { display: block; overflow-x: auto; }
}

/* --- Print --- */
@media print {
    .nav, .footer, .btn, .goal-link-toggle, .no-print { display: none !important; }
    .main { padding: 0; }
    body { background: #fff; }
    .card { box-shadow: none; border-color: #ccc; }
}
