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

:root {
    --rws-blauw: #003082;
    --rws-lichtblauw: #0059b3;
    --rws-geel: #f0c000;
    --gemeld: #e67e00;
    --in-behandeling: #0059b3;
    --afgehandeld: #1a7f3c;
    --bg: #f0f2f7;
    --wit: #ffffff;
    --tekst: #1a1a1a;
    --rand: #dde2ec;
    --sidebar-w: 230px;
}

body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--tekst); min-height: 100vh; }

/* ── LAYOUT ── */
.layout { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--rws-blauw);
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}
.logo-rws {
    background: var(--rws-geel);
    color: var(--rws-blauw);
    font-weight: 900;
    font-size: 0.85rem;
    padding: 4px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}
.logo-titel { font-size: 0.9rem; font-weight: 600; line-height: 1.2; }

.sidebar-nav { display: flex; flex-direction: column; padding: 0.75rem 0; gap: 2px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: none;
    border: none;
    color: rgba(255,255,255,0.75);
    padding: 0.7rem 1rem;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 500;
    text-align: left;
    border-radius: 0;
    transition: background 0.15s, color 0.15s;
    position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.15); color: #fff; border-left: 3px solid var(--rws-geel); }
.nav-icon { font-size: 1rem; }
.badge-count {
    margin-left: auto;
    background: #c0392b;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}
.badge-count:empty { display: none; }

/* ── MAIN WRAPPER ── */
.main-wrapper { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.tab-content { display: none; padding: 2rem; flex: 1; }
.tab-content.active { display: flex; flex-direction: column; gap: 1.5rem; }

/* ── PAGE HEADER ── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}
.page-header h1 { font-size: 1.5rem; color: var(--rws-blauw); }
.subtext { font-size: 0.85rem; color: #666; margin-top: 2px; }

/* ── INPUTS ── */
input[type="text"], select, textarea {
    border: 1px solid var(--rand);
    border-radius: 6px;
    padding: 0.55rem 0.85rem;
    font-size: 0.88rem;
    background: var(--wit);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]:focus, select:focus, textarea:focus {
    border-color: var(--rws-lichtblauw);
    box-shadow: 0 0 0 3px rgba(0,89,179,0.12);
}
#zoek-kunstwerk { width: 300px; }

/* ── KUNSTWERK LAYOUT ── */
.kunstwerk-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    flex: 1;
}

/* ── KAARTEN ── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    flex: 1;
    align-content: start;
}
.kaart {
    background: var(--wit);
    border: 2px solid var(--rand);
    border-radius: 10px;
    padding: 1.1rem;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.kaart:hover { border-color: var(--rws-lichtblauw); box-shadow: 0 4px 14px rgba(0,48,130,0.1); transform: translateY(-2px); }
.kaart.actief { border-color: var(--rws-blauw); box-shadow: 0 4px 14px rgba(0,48,130,0.15); }
.kaart h3 { font-size: 0.95rem; color: var(--rws-blauw); margin-bottom: 0.4rem; }
.kaart p { font-size: 0.82rem; color: #555; margin-bottom: 0.2rem; }
.kaart .type-badge {
    display: inline-block;
    background: #e8eef8;
    color: var(--rws-blauw);
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 0.5rem;
    font-weight: 600;
}
.kaart .storing-indicator {
    float: right;
    font-size: 0.75rem;
    background: #fde8e8;
    color: #c0392b;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
}

/* ── DETAIL PANEEL ── */
.detail-paneel {
    width: 360px;
    flex-shrink: 0;
    background: var(--wit);
    border: 1px solid var(--rand);
    border-radius: 12px;
    padding: 1.5rem;
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}
.detail-paneel.verborgen { display: none; }
.sluit-detail {
    float: right;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: #999;
    line-height: 1;
}
.sluit-detail:hover { color: #333; }
.detail-paneel h2 { font-size: 1.1rem; color: var(--rws-blauw); margin-bottom: 1rem; clear: both; }
.detail-paneel h3 { font-size: 0.85rem; font-weight: 700; color: #666; text-transform: uppercase; letter-spacing: 0.05em; margin: 1.25rem 0 0.5rem; }

.detail-rij {
    display: flex;
    justify-content: space-between;
    padding: 0.45rem 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.85rem;
}
.detail-rij:last-child { border-bottom: none; }
.detail-rij span:first-child { color: #666; }
.detail-rij span:last-child { font-weight: 600; text-align: right; max-width: 55%; }

.btn-meld-storing {
    display: block;
    width: 100%;
    margin-top: 1.25rem;
    padding: 0.6rem;
    background: var(--rws-blauw);
    color: var(--wit);
    border: none;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s;
}
.btn-meld-storing:hover { background: var(--rws-lichtblauw); }

/* ── TABEL ── */
.tabel-wrapper { overflow-x: auto; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
table { width: 100%; border-collapse: collapse; background: var(--wit); }
th {
    background: var(--rws-blauw);
    color: #fff;
    text-align: left;
    padding: 0.7rem 1rem;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}
td { padding: 0.7rem 1rem; font-size: 0.83rem; border-bottom: 1px solid var(--rand); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8f9fc; }

/* ── BADGES ── */
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-gemeld { background: #fff3e0; color: var(--gemeld); }
.badge-in_behandeling { background: #e3f0ff; color: var(--in-behandeling); }
.badge-afgehandeld { background: #e6f4ec; color: var(--afgehandeld); }

.prio { font-weight: 700; }
.prio-laag { color: #1a7f3c; }
.prio-middel { color: var(--gemeld); }
.prio-hoog { color: #c0392b; }

.urgentie-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}
.urgentie-te_laat    { background: #fde8e8; color: #c0392b; }
.urgentie-urgent     { background: #fff3e0; color: #e67e00; }
.urgentie-binnenkort { background: #fffbe0; color: #b8860b; }
.urgentie-ok         { background: #e6f4ec; color: #1a7f3c; }
.urgentie-onbekend   { background: #f0f0f0; color: #888; }

tr.rij-te_laat td:first-child    { border-left: 3px solid #c0392b; }
tr.rij-urgent td:first-child     { border-left: 3px solid #e67e00; }
tr.rij-binnenkort td:first-child { border-left: 3px solid #b8860b; }
tr.rij-ok td:first-child         { border-left: 3px solid #1a7f3c; }

/* ── BUTTONS ── */
.btn {
    padding: 0.45rem 1rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.83rem;
    font-weight: 600;
    transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn-primary  { background: var(--rws-blauw); color: #fff; }
.btn-success  { background: var(--afgehandeld); color: #fff; }
.btn-disabled { background: #ccc; color: #fff; cursor: not-allowed; }

/* ── FORMULIER ── */
.formulier {
    background: var(--wit);
    border: 1px solid var(--rand);
    border-radius: 10px;
    padding: 2rem;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}
.formulier label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.88rem; font-weight: 500; }
.formulier input, .formulier select, .formulier textarea { width: 100%; }
.resultaat { font-size: 0.88rem; }
.resultaat.succes { color: var(--afgehandeld); }
.resultaat.fout   { color: #c0392b; }

.legenda { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.laden { color: #999; font-style: italic; }
.leeg  { color: #999; text-align: center; padding: 3rem 0; }

/* ── LOGIN SCHERM ── */
.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 30, 80, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.login-box {
    background: var(--wit);
    border-radius: 14px;
    padding: 2.5rem 2rem;
    width: 360px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.login-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}
.login-box h2 {
    font-size: 1.2rem;
    color: var(--rws-blauw);
    margin: 0;
}
.login-box form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.login-box label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.88rem;
    font-weight: 500;
}
.login-box input {
    width: 100%;
    border: 1px solid var(--rand);
    border-radius: 6px;
    padding: 0.55rem 0.85rem;
    font-size: 0.88rem;
}
.login-box input:focus {
    outline: none;
    border-color: var(--rws-lichtblauw);
    box-shadow: 0 0 0 3px rgba(0,89,179,0.12);
}

/* ── FACTUUR BEREKENING ── */
.factuur-berekening {
    background: #f0f4ff;
    border: 1px solid var(--rand);
    border-radius: 8px;
    padding: 0.75rem 1rem;
}
