:root { --gap: 12px; --radius: 8px; }
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, Segoe UI, Roboto, Arial; background: #f6f7fb; color: #111; }

header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 18px; background: #fff;
    border-bottom: 1px solid #e9e9ef; position: sticky; top: 0; z-index: 10;
}
header nav { display: flex; align-items: center; gap: 16px; }
header nav a { text-decoration: none; color: #2563eb; font-weight: 600; font-size: .95rem; }
header nav a:hover { text-decoration: underline; }

.container { padding: 16px 20px; max-width: 1300px; margin: 0 auto; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 6px 14px; height: 36px;
    border: 1px solid #d1d5db; border-radius: 6px; background: #fff;
    font-weight: 600; color: #111; cursor: pointer; font-size: .9rem;
    text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #f3f4f6; }
.btn-primary { border-color: #2563eb; background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1e40af; }
.btn-sm { height: 28px; padding: 0 10px; font-size: .82rem; min-width: 80px; }

/* ---- Filter bar ---- */
.filter-bar {
    background: #fff; border: 1px solid #e5e7eb;
    border-radius: var(--radius); padding: 14px 16px;
    margin-bottom: 12px;
}
.filter-3col {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1.5fr;
    gap: 20px; align-items: start;
}
.filter-col { display: flex; flex-direction: column; gap: 10px; }
.filter-col label {
    display: flex; flex-direction: column; gap: 3px;
    font-size: .85rem; font-weight: 600; color: #374151;
}
.filter-col input[type=text],
.filter-col input[type=number],
.filter-col select {
    padding: 7px 10px; border: 1px solid #d1d5db;
    border-radius: 6px; font-size: .88rem; background: #fff;
    width: 100%;
}
.filter-checks-col { justify-content: center; gap: 14px; }
.check-label {
    display: flex; align-items: center; gap: 8px;
    font-size: .9rem; font-weight: 500; color: #374151; cursor: pointer;
    flex-direction: row-reverse;
}
.check-label input { width: 16px; height: 16px; cursor: pointer; }
.filter-btns { display: flex; gap: 8px; margin-top: 4px; }

/* ---- Listing header + pager ---- */
.listing-header { margin: 8px 0; color: #6b7280; font-size: .9rem; }
.pager { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.page-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px; padding: 0 10px;
    border: 1px solid #d1d5db; border-radius: 6px; background: #fff;
    font-size: .88rem; font-weight: 600; color: #111;
    text-decoration: none;
}
.page-btn:hover { background: #f3f4f6; }
.page-active { background: #2563eb; border-color: #2563eb; color: #fff; }
.page-active:hover { background: #1e40af; }
.page-disabled { color: #9ca3af; cursor: default; }

/* ---- Listings list ---- */
.listings-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

.listing-row {
    background: #fff; border: 1px solid #e5e7eb;
    border-radius: var(--radius); display: flex;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    overflow: hidden;
}
.listing-row:hover { box-shadow: 0 2px 8px rgba(0,0,0,.09); }
.listing-row.listing-defect { border-left: 3px solid #f59e0b; }

.listing-row-img {
    width: 160px; min-width: 160px; display: block;
    background: #f0f2f5; overflow: hidden;
}
.listing-row-img img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.no-img {
    width: 100%; height: 100%; display: flex;
    align-items: center; justify-content: center;
    color: #9ca3af; font-size: .8rem;
}

.listing-row-body { flex: 1; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }

.listing-row-top {
    display: flex; justify-content: space-between;
    align-items: flex-start; gap: 12px;
}
.listing-titel-link { text-decoration: none; color: #111; font-size: .95rem; }
.listing-titel-link:hover { color: #2563eb; }
.listing-row-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.listing-row-prijs { font-size: 1.15rem; font-weight: 700; white-space: nowrap; }
.prijs-gratis { color: #16a34a; }

.listing-row-meta {
    display: flex; flex-wrap: wrap; gap: 6px 20px;
    align-items: center; font-size: .83rem; color: #374151;
}
.listing-row-meta strong { font-weight: 600; color: #111; }

/* ---- Badges ---- */
.badge {
    display: inline-block; padding: 1px 7px; border-radius: 4px;
    font-size: .75rem; font-weight: 600;
}
.badge-defect      { background: #fef3c7; color: #92400e; }
.badge-saved       { background: #dbeafe; color: #1e40af; }
.badge-interesting { background: #d1fae5; color: #065f46; }
.badge-new         { background: #ede9fe; color: #5b21b6; }
.badge-inactief    { background: #fee2e2; color: #991b1b; }
.badge-model {
    display: inline-flex; align-items: center; gap: 4px;
    background: #eff6ff; color: #1e40af;
    padding: 2px 8px; border-radius: 4px; font-size: .78rem; font-weight: 600;
}
.badge-model .conf { color: #6b7280; font-weight: 400; }
.badge-onbekend {
    background: #f3f4f6; color: #6b7280;
    padding: 2px 8px; border-radius: 4px; font-size: .78rem; display: inline-block;
}

/* ---- Stat grid (dashboard) ---- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--gap); margin-bottom: 2rem;
}
.stat-card {
    background: #fff; border: 1px solid #e5e7eb;
    border-radius: var(--radius); padding: 16px; text-align: center;
}
.stat-card.stat-warn { border-color: #f59e0b; background: #fffbeb; }
.stat-value { font-size: 2rem; font-weight: 700; color: #111; }
.stat-label { font-size: .85rem; color: #6b7280; margin-top: 4px; }

/* ---- Tabel ---- */
.tbl { width: 100%; border-collapse: collapse; background: #fff;
       border: 1px solid #e5e7eb; border-radius: var(--radius); overflow: hidden; }
.tbl th { background: #f9fafb; text-align: left; padding: 10px 12px;
          font-size: .85rem; color: #6b7280; border-bottom: 1px solid #e5e7eb; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl code { background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-size: .9rem; }

/* ---- Formulier ---- */
.form-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--gap); margin-top: 1rem;
}
.form-grid label {
    display: flex; flex-direction: column; gap: 4px;
    font-size: .9rem; font-weight: 600; color: #374151;
}
.form-grid input[type=text],
.form-grid input[type=number],
.form-grid input[type=password],
.form-grid select {
    padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 1rem; background: #fff;
}

/* ---- Login ---- */
.login-wrap {
    max-width: 320px; margin: 80px auto; background: #fff;
    padding: 32px; border-radius: var(--radius); border: 1px solid #e5e7eb;
}
.login-wrap h2 { margin: 0 0 20px; }
.login-wrap label {
    display: flex; flex-direction: column; gap: 6px;
    font-weight: 600; margin-bottom: 16px;
}
.login-wrap input {
    padding: 8px 10px; border: 1px solid #d1d5db;
    border-radius: 6px; font-size: 1rem;
}

/* ---- Berichten ---- */
.msg-ok { background: #d1fae5; color: #065f46; padding: 10px 14px; border-radius: 6px; margin-bottom: 1rem; }
.error  { background: #fee2e2; color: #991b1b; padding: 10px 14px; border-radius: 6px; margin-bottom: 1rem; }

/* ---- Item detail ---- */
.item-wrap {
    display: grid; grid-template-columns: 260px 1fr 260px;
    gap: 20px; align-items: start;
}
.item-left { display: flex; flex-direction: column; gap: 10px; }
.item-img-main { border-radius: var(--radius); overflow: hidden; background: #f0f2f5; }
.item-img-main img { width: 100%; height: auto; display: block; }
.item-img-thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.item-img-thumbs .thumb {
    width: 56px; height: 56px; object-fit: cover;
    border-radius: 4px; cursor: pointer; border: 2px solid transparent;
}
.item-img-thumbs .thumb:hover { border-color: #2563eb; }
.item-actions { display: flex; flex-direction: column; gap: 8px; }
.item-actions .btn { width: 100%; justify-content: center; }
.item-titel { margin: 0 0 8px; font-size: 1.15rem; }
.item-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.detail-tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.detail-tbl th {
    text-align: left; padding: 5px 8px 5px 0;
    color: #6b7280; font-weight: 600; width: 130px;
    border-bottom: 1px solid #f3f4f6;
}
.detail-tbl td { padding: 5px 0; border-bottom: 1px solid #f3f4f6; }
.item-beschrijving {
    background: #f9fafb; border-radius: 6px; padding: 12px;
    font-size: .88rem; line-height: 1.6; color: #374151;
    max-height: 300px; overflow-y: auto; white-space: pre-wrap;
}
.issues-list { margin: 6px 0 0 1.2em; padding: 0; font-size: .85rem; color: #374151; }
.issues-list li { margin-bottom: 4px; }
.muted { color: #6b7280; font-size: .88rem; }

h2 { margin: 0 0 1rem; }
h3 { margin: 0 0 .75rem; }

@media (max-width: 900px) {
    .item-wrap { grid-template-columns: 1fr; }
    .filter-3col { grid-template-columns: 1fr; }
}
