/* ============================================
   DBC PLANNING — Mobile-first stylesheet
   Huisstijl: teal + navy (afgeleid van dbc-service.nl)
   ============================================ */

:root {
    --navy: #1a3a4a;
    --navy-dark: #0f252f;
    --teal: #14b8a6;
    --teal-light: #2dd4bf;
    --teal-dark: #0d9488;
    --orange: #f4a020;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --red-500: #ef4444;
    --red-600: #dc2626;
    --amber-500: #f59e0b;
    --green-500: #10b981;
    --blue-500: #3b82f6;

    --sidebar-w: 240px;
    --topbar-h: 56px;
    --shadow-sm: 0 1px 3px rgba(15,37,47,0.08);
    --shadow: 0 4px 12px rgba(15,37,47,0.10);
    --shadow-lg: 0 12px 32px rgba(15,37,47,0.18);
    --radius: 8px;
    --radius-lg: 12px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--gray-800);
    background: var(--gray-100);
    font-size: 15px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

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

h1, h2, h3, h4 { color: var(--navy); line-height: 1.25; margin-top: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

.skip-link {
    position: absolute; top: -40px; left: 8px; z-index: 100;
    background: var(--navy); color: white; padding: 8px 16px; border-radius: 4px;
}
.skip-link:focus { top: 8px; }

/* ---------- Topbar ---------- */
.topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 50;
    height: var(--topbar-h);
    background: var(--navy);
    color: white;
    display: flex; align-items: center;
    padding: 0 12px;
    box-shadow: var(--shadow);
    gap: 12px;
}
.brand {
    display: flex; align-items: center; gap: 10px;
    color: white; font-weight: 700; letter-spacing: 0.5px;
}
.brand:hover { text-decoration: none; }
.brand-icon { width: 28px; height: 28px; display: inline-flex; }
.brand-icon svg { width: 100%; height: 100%; color: var(--teal-light); }
.brand-text { font-size: 1rem; }
.topbar-user {
    margin-left: auto;
    display: flex; align-items: center; gap: 8px;
    font-size: 0.85rem;
}
.topbar-user-name { display: none; }
@media (min-width: 720px) {
    .topbar-user-name { display: inline; }
}

.menu-toggle {
    background: transparent; border: 0; color: white;
    width: 40px; height: 40px; padding: 8px;
    display: flex; flex-direction: column; justify-content: space-around;
    cursor: pointer;
}
.menu-toggle span {
    display: block; height: 2px; background: white; border-radius: 1px;
    transition: transform .2s, opacity .2s;
}
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
@media (min-width: 960px) {
    .menu-toggle { display: none; }
}

/* ---------- App shell ---------- */
.app-shell {
    display: flex;
    padding-top: var(--topbar-h);
    min-height: 100vh;
}

.sidebar {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: white;
    border-right: 1px solid var(--gray-200);
    padding: 12px 0;
    overflow-y: auto;
    display: flex; flex-direction: column;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 40;
}
.sidebar.open { transform: translateX(0); }
@media (min-width: 960px) {
    .sidebar { transform: translateX(0); }
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid var(--gray-200); padding-top: 8px; }
.sidebar a, .sidebar-logout {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 20px;
    color: var(--gray-700);
    font-weight: 500;
    border-left: 3px solid transparent;
    background: none; border-right: 0; border-top: 0; border-bottom: 0;
    width: 100%; text-align: left; cursor: pointer;
    font-size: 15px; font-family: inherit;
}
.sidebar a:hover, .sidebar-logout:hover {
    background: var(--gray-50); color: var(--navy); text-decoration: none;
}
.sidebar a.active {
    background: var(--gray-50); color: var(--teal-dark);
    border-left-color: var(--teal); font-weight: 600;
}
.sidebar svg { width: 20px; height: 20px; flex-shrink: 0; }

.backdrop {
    position: fixed; inset: var(--topbar-h) 0 0 0;
    background: rgba(15,37,47,0.4);
    z-index: 30; opacity: 0; pointer-events: none;
    transition: opacity .2s;
}
.backdrop.open { opacity: 1; pointer-events: auto; }
@media (min-width: 960px) { .backdrop { display: none; } }

.content {
    flex: 1;
    padding: 16px;
    max-width: 100%;
    min-width: 0;
}
@media (min-width: 960px) {
    .content { margin-left: var(--sidebar-w); padding: 24px 32px; }
}

.content-guest {
    padding: 16px;
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
}

/* ---------- Page header ---------- */
.page-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    flex-wrap: wrap; gap: 12px;
    margin-bottom: 20px;
}
.page-header h1 { margin: 0 0 4px 0; }
.page-subtitle { color: var(--gray-500); margin: 0; font-size: 0.9rem; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb { color: var(--gray-500); font-size: 0.85rem; margin: 0 0 4px 0; }
.breadcrumb a { color: var(--gray-500); }

/* ---------- Card ---------- */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    margin-bottom: 16px;
}
.card h2 { font-size: 1.05rem; margin-top: 0; margin-bottom: 12px; }
.card.empty { color: var(--gray-500); text-align: center; padding: 32px 20px; }
.empty-inline { color: var(--gray-500); margin: 0; }
.section { margin-bottom: 24px; }
.section-head {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 8px;
}
.section-head h2 { margin: 0; }
.link { color: var(--teal-dark); font-size: 0.85rem; font-weight: 500; }

/* ---------- Stats ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.stat-card {
    background: white;
    padding: 16px 18px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--teal);
}
.stat-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray-500); font-weight: 600; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--navy); line-height: 1.1; margin: 4px 0; }
.stat-meta { font-size: 0.8rem; color: var(--gray-500); }

/* ---------- Table ---------- */
.table-card { padding: 0; overflow: hidden; }
.table {
    width: 100%; border-collapse: collapse;
    font-size: 0.92rem;
}
.table thead th {
    text-align: left; padding: 12px 16px;
    background: var(--gray-50); color: var(--gray-600);
    font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 1px solid var(--gray-200);
}
.table tbody td {
    padding: 12px 16px; border-bottom: 1px solid var(--gray-100);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--gray-50); }
.table-compact td, .table-compact th { padding: 8px 10px; font-size: 0.85rem; }
.row-inactive { opacity: 0.55; }
.cert-row-expired td { background: rgba(239,68,68,0.06); }
.cert-row-expiring td { background: rgba(245,158,11,0.06); }

@media (max-width: 640px) {
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr { border-bottom: 8px solid var(--gray-100); padding: 8px 0; }
    .table td { padding: 4px 12px; border: 0; }
    .table td:first-child { font-weight: 600; padding-top: 12px; }
}

.muted { color: var(--gray-500); font-size: 0.85rem; }
.notes { white-space: pre-wrap; color: var(--gray-700); }

/* ---------- Info list ---------- */
.info-list {
    display: grid; grid-template-columns: 130px 1fr;
    gap: 8px 16px; margin: 0;
}
.info-list dt { color: var(--gray-500); font-size: 0.85rem; }
.info-list dd { margin: 0; color: var(--gray-800); }

/* ---------- Detail grid ---------- */
.detail-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) {
    .detail-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 18px;
    border: 0; border-radius: var(--radius);
    font-weight: 600; font-size: 0.9rem;
    cursor: pointer; text-decoration: none;
    transition: all .15s;
    min-height: 40px;
    font-family: inherit;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--teal); color: white; }
.btn-primary:hover { background: var(--teal-dark); color: white; }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-danger { background: var(--red-500); color: white; }
.btn-danger:hover { background: var(--red-600); color: white; }
.btn-block { display: flex; width: 100%; }
.btn-icon {
    background: transparent; border: 0; cursor: pointer;
    color: var(--gray-500); padding: 4px 8px; font-size: 1rem;
}
.btn-icon:hover { color: var(--red-500); }

/* ---------- Forms ---------- */
.form-card { max-width: 720px; }
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; margin-bottom: 6px;
    font-weight: 600; font-size: 0.85rem; color: var(--gray-700);
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="tel"],
.form-group input[type="url"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--gray-300); border-radius: var(--radius);
    font-size: 15px; font-family: inherit;
    background: white; color: var(--gray-800);
    min-height: 42px;
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(20,184,166,0.15);
}
.form-row {
    display: grid; grid-template-columns: 1fr; gap: 12px;
}
@media (min-width: 640px) {
    .form-row { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}
.form-actions {
    display: flex; gap: 8px; justify-content: flex-end;
    margin-top: 20px; padding-top: 16px;
    border-top: 1px solid var(--gray-100);
}
.form-hint { font-size: 0.8rem; color: var(--gray-500); margin: 4px 0 0 0; }
.checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox input { width: auto; min-height: auto; }
.filter-form {
    display: flex; align-items: end; gap: 12px; flex-wrap: wrap;
    background: white; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}
.filter-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--gray-500); }
.filter-form input { min-height: 38px; padding: 6px 10px; border: 1px solid var(--gray-300); border-radius: var(--radius); }
.filter-summary { margin-left: auto; color: var(--gray-700); font-size: 0.95rem; }
.inline-form {
    display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap;
}
.inline-form select, .inline-form input {
    flex: 1; min-width: 160px;
    padding: 8px 10px; border: 1px solid var(--gray-300); border-radius: var(--radius);
    font-size: 14px;
}

.danger-zone {
    margin-top: 20px; padding: 16px;
    background: rgba(239,68,68,0.05); border: 1px dashed rgba(239,68,68,0.3);
    border-radius: var(--radius); text-align: right;
}

/* ---------- Alerts ---------- */
.alert {
    padding: 12px 16px; border-radius: var(--radius);
    margin-bottom: 16px; font-size: 0.9rem;
}
.alert-error { background: rgba(239,68,68,0.1); color: var(--red-600); border-left: 3px solid var(--red-500); }
.alert-success { background: rgba(16,185,129,0.1); color: #059669; border-left: 3px solid var(--green-500); }

/* ---------- Badges ---------- */
.badge {
    display: inline-block; padding: 3px 10px;
    border-radius: 999px; font-size: 0.75rem; font-weight: 600;
    background: var(--gray-100); color: var(--gray-700);
    text-transform: capitalize;
}
.badge-admin { background: var(--navy); color: white; }
.badge-ploegleider { background: var(--teal); color: white; }
.badge-medewerker { background: var(--gray-200); color: var(--gray-700); }

.badge-danger { background: var(--red-500); color: white; }
.badge-warning { background: var(--amber-500); color: white; }
.badge-ok { background: var(--green-500); color: white; }
.badge-info { background: var(--blue-500); color: white; }

.badge-emp-zzp { background: rgba(20,184,166,0.15); color: var(--teal-dark); }
.badge-emp-loon { background: rgba(59,130,246,0.15); color: #1e40af; }
.badge-emp-onderaannemer { background: rgba(139,92,246,0.15); color: #6d28d9; }
.badge-emp-leerling { background: rgba(244,160,32,0.15); color: #c2410c; }

.badge-type-groen { background: rgba(34,197,94,0.15); color: #15803d; }
.badge-type-spoor { background: rgba(100,116,139,0.15); color: var(--gray-700); }
.badge-type-verbouwing { background: rgba(13,148,136,0.15); color: var(--teal-dark); }
.badge-type-elektra { background: rgba(244,160,32,0.15); color: #c2410c; }
.badge-type-loodgieter { background: rgba(20,184,166,0.15); color: var(--teal-dark); }
.badge-type-schilderwerk { background: rgba(139,92,246,0.15); color: #6d28d9; }
.badge-type-sloop { background: rgba(100,116,139,0.15); color: var(--gray-700); }
.badge-type-onderhoud { background: rgba(59,130,246,0.15); color: #1e40af; }
.badge-type-anders { background: var(--gray-100); color: var(--gray-600); }

.badge-status-lopend { background: rgba(16,185,129,0.15); color: #059669; }
.badge-status-gepland { background: rgba(59,130,246,0.15); color: #1e40af; }
.badge-status-afgerond { background: var(--gray-200); color: var(--gray-600); }
.badge-status-gepauzeerd { background: rgba(245,158,11,0.15); color: #b45309; }

/* ---------- Chips (filter) ---------- */
.filter-bar {
    display: flex; gap: 6px; flex-wrap: wrap;
    margin-bottom: 16px; overflow-x: auto;
}
.chip {
    padding: 6px 14px; border-radius: 999px;
    background: white; color: var(--gray-600);
    font-size: 0.85rem; font-weight: 500;
    border: 1px solid var(--gray-200);
    text-decoration: none;
    white-space: nowrap;
}
.chip:hover { background: var(--gray-100); text-decoration: none; }
.chip.active { background: var(--navy); color: white; border-color: var(--navy); }

/* ---------- Crew grid ---------- */
.crew-grid {
    display: grid; gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.crew-card {
    background: white;
    padding: 16px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    color: var(--gray-800);
    transition: box-shadow .15s, transform .15s;
    display: block;
    border-left: 4px solid var(--teal);
}
.crew-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); text-decoration: none; }
.crew-card-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px;
}
.crew-card-count { font-size: 0.85rem; color: var(--gray-500); font-weight: 600; }
.crew-card h3 { margin: 4px 0; font-size: 1rem; }
.crew-card-project { color: var(--gray-500); font-size: 0.85rem; margin: 4px 0; }
.crew-card-loc { color: var(--gray-600); font-size: 0.85rem; margin: 4px 0; }
.crew-card-leader { color: var(--gray-500); font-size: 0.8rem; margin: 4px 0 0 0; }
.crew-card-foot {
    display: flex; gap: 4px;
    margin-top: 10px; font-size: 0.8rem; color: var(--gray-500);
}

/* ---------- Link list ---------- */
.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li { padding: 10px 0; border-bottom: 1px solid var(--gray-100); }
.link-list li:last-child { border-bottom: 0; }
.link-list a { color: var(--gray-800); }
.link-list a:hover { color: var(--teal-dark); text-decoration: none; }

/* ---------- Login ---------- */
.login-wrap {
    width: 100%; max-width: 400px;
}
.login-card {
    background: white; padding: 32px 28px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand h1 { margin: 8px 0 4px 0; color: var(--navy); }
.login-brand p { margin: 0; color: var(--gray-500); }
.login-brand-icon {
    display: inline-flex; width: 56px; height: 56px;
    align-items: center; justify-content: center;
    background: var(--navy); color: var(--teal-light);
    border-radius: 50%;
}
.login-brand-icon svg { width: 32px; height: 32px; }

/* ---------- PWA install hint (bottom) ---------- */
.pwa-install-banner {
    position: fixed; bottom: 12px; left: 12px; right: 12px;
    background: var(--navy); color: white;
    padding: 12px 16px; border-radius: var(--radius);
    display: flex; align-items: center; gap: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
}
.pwa-install-banner button {
    background: var(--teal); color: white;
    border: 0; padding: 8px 14px;
    border-radius: 6px; cursor: pointer;
    font-size: 0.85rem; font-weight: 600;
}
.pwa-install-banner .close {
    background: transparent; color: white;
    padding: 4px 8px;
}
