@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --sidebar-bg: #131417;
    --sidebar-bg-hover: #1d1f24;
    --sidebar-bg-active: #212327;
    --sidebar-text: #a7abb4;
    --sidebar-text-active: #ffffff;
    --sidebar-border: #232529;

    --brand-red: #e0202a;
    --brand-red-dark: #b8161f;
    --brand-red-glow: rgba(224, 32, 42, 0.28);

    --bg-page: #f3f4f7;
    --bg-card: #ffffff;
    --border: #e7e9ee;
    --border-soft: #eef0f3;

    --text: #191b1f;
    --text-dim: #676c76;
    --text-faint: #9aa0aa;

    --amber-bg: #fdf1d6; --amber-fg: #92650a; --amber-solid: #f5a524;
    --green-bg: #e1f6ea; --green-fg: #157a4a; --green-solid: #22c55e;
    --gray-bg: #eceef1;  --gray-fg: #4b5563;  --gray-solid: #6b7280;
    --blue-bg: #e5eefe;  --blue-fg: #1d4ed8;  --blue-solid: #3b82f6;

    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    --font-mono: ui-monospace, 'SF Mono', Consolas, monospace;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg-page);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-red); text-decoration: none; }
a:hover { color: var(--brand-red-dark); }
*:focus-visible { outline: 2px solid var(--brand-red); outline-offset: 2px; }

/* ============ Auth pages (login) ============ */
.auth-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 20px;
    background: var(--sidebar-bg);
    background-image: radial-gradient(ellipse 800px 500px at 20% 0%, rgba(224,32,42,0.12), transparent 60%);
}
.auth-box {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 38px 34px;
    width: 100%; max-width: 380px;
    box-shadow: 0 30px 70px -25px rgba(0,0,0,0.55);
}
.auth-box h1 { font-size: 22px; font-weight: 800; margin: 0 0 4px; color: var(--text); letter-spacing: -0.01em; }
.auth-box h1 .accent { color: var(--brand-red); }
.auth-box h2 { font-size: 14px; font-weight: 500; color: var(--text-faint); margin: 0 0 24px; }

label {
    display: block; margin-bottom: 16px;
    font-size: 12.5px; font-weight: 600; color: var(--text-dim);
}
input, select, textarea {
    display: block; width: 100%; margin-top: 7px;
    padding: 11px 13px; background: #fff;
    border: 1px solid var(--border); border-radius: 9px;
    color: var(--text); font-size: 14px; font-family: var(--font-body);
    font-weight: 400;
    transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--brand-red);
    box-shadow: 0 0 0 3px rgba(224,32,42,0.12);
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 20px; border-radius: 9px; border: none;
    font-family: var(--font-body); font-size: 13.5px; font-weight: 700;
    cursor: pointer; text-align: center;
    transition: transform .1s ease, box-shadow .15s ease, background .15s ease;
}
.btn-primary {
    background: linear-gradient(180deg, var(--brand-red), var(--brand-red-dark));
    color: #fff;
    box-shadow: 0 4px 14px -4px var(--brand-red-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px -4px var(--brand-red-glow); }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-page); }
.btn-danger { background: #fff; color: #c0242f; border: 1px solid #f3c7ca; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 12px; }

.alert { padding: 11px 15px; border-radius: 9px; margin-bottom: 16px; font-size: 13px; border-left: 3px solid; }
.alert-error { background: #fdecee; border-color: #e0202a; color: #a1121b; }
.alert-success { background: #e9f9ef; border-color: #22c55e; color: #157a4a; }
.alert-info { background: #eaf2ff; border-color: #3b82f6; color: #1d4ed8; }

/* ============ App shell: sidebar + main ============ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px; flex-shrink: 0;
    background: var(--sidebar-bg);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
    padding: 22px 22px 18px;
    border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-brand .name {
    font-size: 19px; font-weight: 800; color: #fff; letter-spacing: -0.01em;
    display: block; line-height: 1.15;
}
.sidebar-brand .tagline {
    font-size: 10.5px; font-weight: 700; color: var(--brand-red);
    letter-spacing: 0.14em; text-transform: uppercase; margin-top: 2px; display: block;
}
.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px; margin-bottom: 2px;
    border-radius: 9px; color: var(--sidebar-text);
    font-size: 13.5px; font-weight: 500;
}
.sidebar-nav a:hover { background: var(--sidebar-bg-hover); color: #fff; }
.sidebar-nav a.active { background: var(--sidebar-bg-active); color: #fff; font-weight: 600; }
.sidebar-nav .icon { width: 17px; text-align: center; opacity: 0.9; }
.sidebar-nav .nav-badge {
    margin-left: auto; background: var(--brand-red); color: #fff;
    font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
}
.sidebar-divider { height: 1px; background: var(--sidebar-border); margin: 10px 4px; }

.sidebar-help {
    margin: 12px; padding: 16px;
    background: var(--sidebar-bg-hover); border-radius: 12px;
}
.sidebar-help h4 { margin: 0 0 6px; color: #fff; font-size: 13px; font-weight: 700; }
.sidebar-help p { margin: 0 0 12px; color: var(--sidebar-text); font-size: 12px; line-height: 1.5; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.content-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 28px; background: #fff; border-bottom: 1px solid var(--border);
}
.content-topbar .page-heading { font-size: 17px; font-weight: 700; color: var(--text); }
.content-topbar .right-controls { display: flex; align-items: center; gap: 18px; }
.bell-wrap { position: relative; color: var(--text-dim); font-size: 18px; }
.bell-wrap .dot {
    position: absolute; top: -4px; right: -6px;
    background: var(--brand-red); color: #fff; font-size: 10px; font-weight: 700;
    min-width: 16px; height: 16px; border-radius: 999px;
    display: flex; align-items: center; justify-content: center; padding: 0 3px;
}
.avatar-chip { display: flex; align-items: center; gap: 10px; }
.avatar-circle {
    width: 32px; height: 32px; border-radius: 999px;
    background: var(--sidebar-bg); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
}
.avatar-chip .uname { font-size: 13.5px; font-weight: 600; color: var(--text); }
.avatar-chip a.logout-link { font-size: 12px; color: var(--text-faint); font-weight: 500; }
.avatar-chip a.logout-link:hover { color: var(--brand-red); }

.container { max-width: 1120px; margin: 0 auto; padding: 26px 24px 60px; width: 100%; }

h1.page-title { font-size: 22px; font-weight: 700; margin: 0 0 18px; color: var(--text); }

/* ============ Cards / stat tiles ============ */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 14px; padding: 22px 24px; margin-bottom: 18px;
}
.card h3 { font-size: 14px; font-weight: 700; color: var(--text); margin: 0 0 16px; }

.stat-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px;
}
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
    padding: 20px;
}
.stat-icon {
    width: 42px; height: 42px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; margin-bottom: 14px;
}
.stat-icon.icon-total { background: var(--sidebar-bg); color: #fff; }
.stat-icon.icon-progress { background: var(--amber-solid); color: #fff; }
.stat-icon.icon-done { background: var(--green-solid); color: #fff; }
.stat-icon.icon-archived { background: var(--gray-solid); color: #fff; }
.stat-number { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 12.5px; color: var(--text-dim); margin: 5px 0 12px; }
.stat-card a { font-size: 12.5px; font-weight: 700; }

.dash-grid { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } .stat-grid { grid-template-columns: 1fr 1fr; } }

.card-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-header-row h3 { margin: 0; }
.card-header-row a { font-size: 12.5px; font-weight: 700; }

/* ============ Table ============ */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; font-size: 13px; border-bottom: 1px solid var(--border-soft); }
th { color: var(--text-faint); font-weight: 700; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
tr:hover td { background: #fafbfc; }
.cell-primary { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--text-faint); }

/* ============ Status badges (pastel pills, matching mockup) ============ */
.badge {
    display: inline-block; padding: 5px 12px; border-radius: 999px;
    font-size: 12px; font-weight: 700;
}
.badge-new { background: var(--blue-bg); color: var(--blue-fg); }
.badge-progress { background: var(--amber-bg); color: var(--amber-fg); }
.badge-done { background: var(--green-bg); color: var(--green-fg); }
.badge-sent { background: var(--gray-bg); color: var(--gray-fg); }

/* ============ Forms ============ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.checkbox-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 16px; margin-top: 8px; }
.checkbox-grid label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 400; color: var(--text); margin-bottom: 0; }
.checkbox-grid input { width: auto; margin: 0; }

.detail-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.detail-row:last-child { border-bottom: none; }
.detail-row span:first-child { color: var(--text-faint); font-size: 12px; font-weight: 600; }
.detail-row span:last-child { font-weight: 500; text-align: right; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--text-faint); font-size: 13px; }
.empty-state a { font-weight: 700; }

/* ============ Nieuwe opdracht CTA panel ============ */
.cta-panel {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 22px;
}
.cta-panel h3 { font-size: 15px; font-weight: 700; margin: 0 0 8px; }
.cta-panel p { font-size: 13px; color: var(--text-dim); line-height: 1.5; margin: 0 0 16px; }

/* ============ Hoe het werkt ============ */
.steps-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
@media (max-width: 900px) { .steps-grid { grid-template-columns: 1fr 1fr; } }
.step-item { text-align: left; }
.step-circle {
    width: 42px; height: 42px; border-radius: 999px;
    background: var(--sidebar-bg); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; margin-bottom: 12px;
}
.step-circle.done { background: var(--green-solid); }
.step-item h4 { font-size: 13.5px; font-weight: 700; margin: 0 0 5px; color: var(--text); }
.step-item p { font-size: 12.5px; color: var(--text-dim); margin: 0; line-height: 1.5; }

/* ============ Berichten / chat ============ */
.messages-layout { display: grid; grid-template-columns: 260px 1fr; gap: 0; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--bg-card); min-height: 460px; }
@media (max-width: 800px) { .messages-layout { grid-template-columns: 1fr; } }
.thread-list { border-right: 1px solid var(--border); overflow-y: auto; max-height: 620px; }
.thread-list a { display: block; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); color: var(--text); }
.thread-list a:hover { background: var(--bg-page); }
.thread-list a.active { background: #fdecee; }
.thread-list .t-name { font-size: 13.5px; font-weight: 700; }
.thread-list .t-preview { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.thread-panel { display: flex; flex-direction: column; }
.thread-header { padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 14px; }
.thread-messages { flex: 1; padding: 18px; overflow-y: auto; max-height: 480px; display: flex; flex-direction: column; gap: 12px; }
.msg-bubble { max-width: 72%; padding: 10px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.45; }
.msg-bubble .meta { font-size: 10.5px; opacity: 0.7; margin-top: 5px; }
.msg-in { align-self: flex-start; background: var(--bg-page); color: var(--text); border-bottom-left-radius: 3px; }
.msg-out { align-self: flex-end; background: var(--brand-red); color: #fff; border-bottom-right-radius: 3px; }
.msg-system { align-self: center; background: var(--gray-bg); color: var(--gray-fg); font-size: 12px; padding: 7px 14px; border-radius: 999px; }
.thread-form { border-top: 1px solid var(--border); padding: 14px 16px; display: flex; gap: 10px; }
.thread-form textarea { margin: 0; resize: none; }

/* ============ Utility ============ */
.hamburger { display: none; }
@media (max-width: 760px) {
    .sidebar { position: fixed; left: -260px; z-index: 40; transition: left .2s ease; }
    .sidebar.open { left: 0; }
    .hamburger { display: inline-flex; background: none; border: none; font-size: 20px; color: var(--text); cursor: pointer; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
}
