/* ============================================================
   SG FULFILMENT V2 — COMPLETE STYLESHEET
   Inlogpagina + Dashboard systeem
   ============================================================ */

/* -- RESET & BASE ------------------------------------------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:root {
    --blue:         #2563eb;
    --blue-dark:    #1d4ed8;
    --blue-light:   #eff6ff;
    --blue-mid:     #bfdbfe;
    --green:        #10b981;
    --green-light:  #d1fae5;
    --amber:        #f59e0b;
    --amber-light:  #fef3c7;
    --red:          #ef4444;
    --red-light:    #fee2e2;
    --purple:       #8b5cf6;
    --purple-light: #ede9fe;
    --gray-950:     #0f172a;
    --gray-900:     #1e293b;
    --gray-800:     #334155;
    --gray-700:     #475569;
    --gray-600:     #64748b;
    --gray-400:     #94a3b8;
    --gray-300:     #cbd5e1;
    --gray-200:     #e2e8f0;
    --gray-100:     #f1f5f9;
    --gray-50:      #f8fafc;
    --white:        #ffffff;
    --sidebar-w:    248px;
    --topbar-h:     60px;
    --radius:       10px;
    --radius-sm:    8px;
    --shadow:       0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md:    0 4px 16px rgba(0,0,0,.09);
}

/* -- INLOGPAGINA -------------------------------------------- */
body.login-body {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    color: var(--gray-900);
}

.portal-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
}

.login-container-v3 {
    background: var(--white);
    width: 100%;
    max-width: 520px;
    padding: 55px 50px;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,.05), 0 10px 10px -5px rgba(0,0,0,.02);
    border: 1px solid var(--gray-200);
}

.portal-logo { margin-bottom: 30px; text-align: center; }
.portal-logo img { max-width: 260px; height: auto; object-fit: contain; }

.portal-header { text-align: center; margin-bottom: 35px; }
.portal-header h2 { font-size: 22px; color: var(--gray-950); font-weight: 700; letter-spacing: -.5px; margin-bottom: 8px; }
.portal-header p { font-size: 14px; color: var(--gray-600); }

.input-field-group { margin-bottom: 22px; text-align: left; }
.input-field-group label { display: block; font-size: 13px; color: var(--gray-800); font-weight: 600; margin-bottom: 8px; }
.input-field-group input {
    width: 100%; padding: 14px 16px;
    background: var(--gray-50); border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm); font-size: 14px; color: var(--gray-950);
    outline: none; transition: all .15s ease;
}
.input-field-group input:focus {
    border-color: var(--blue); background: var(--white);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.password-wrapper { position: relative; }
.password-toggle-btn {
    position: absolute; right: 16px; top: 43px;
    background: none; border: none; color: var(--gray-400); cursor: pointer; font-size: 16px;
}
.password-toggle-btn:hover { color: var(--gray-800); }

.form-options { text-align: right; margin: -10px 0 25px 0; }
.forgot-link { font-size: 13px; color: var(--gray-600); text-decoration: none; font-weight: 500; }
.forgot-link:hover { color: var(--blue); }

.btn-portal-submit {
    width: 100%; background: var(--blue); color: var(--white);
    border: none; padding: 16px; font-size: 15px; font-weight: 600;
    border-radius: var(--radius-sm); cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: background .15s ease;
}
.btn-portal-submit:hover { background: var(--blue-dark); }

.login-fout {
    background: var(--red-light); border: 1px solid rgba(239,68,68,.3);
    border-radius: var(--radius-sm); padding: 12px 16px;
    font-size: 13px; color: #991b1b; font-weight: 600;
    margin-bottom: 20px; display: flex; align-items: center; gap: 8px;
}

/* -- DASHBOARD LAYOUT --------------------------------------- */
body.dashboard-body {
    background: var(--gray-50);
    color: var(--gray-900);
    min-height: 100vh;
    display: flex;
}

/* -- SIDEBAR ------------------------------------------------ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--gray-950);
    height: 100vh;
    position: fixed;
    top: 0; left: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 22px 18px 18px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
}

.sidebar-logo-row { display: flex; align-items: center; gap: 10px; }
.sidebar-sg { font-size: 24px; font-weight: 900; color: var(--blue); letter-spacing: -1px; }
.sidebar-txt { font-size: 11px; font-weight: 700; color: var(--white); text-transform: uppercase; letter-spacing: .08em; line-height: 1.2; }
.sidebar-sub { color: var(--gray-600); font-weight: 400; font-size: 10px; text-transform: none; letter-spacing: 0; display: block; margin-top: 1px; }

.sidebar-nav { padding: 8px 0; flex: 1; }

.nav-section {
    padding: 16px 16px 5px;
    font-size: 10px; font-weight: 700;
    color: var(--gray-600);
    text-transform: uppercase; letter-spacing: .1em;
}

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 16px;
    color: var(--gray-400); font-size: 13px; font-weight: 500;
    text-decoration: none; cursor: pointer;
    border: none; background: none; width: 100%; text-align: left;
    border-right: 2px solid transparent;
    transition: all .12s;
    position: relative;
}
.nav-item:hover { color: var(--white); background: rgba(255,255,255,.05); }
.nav-item.active { color: var(--white); background: rgba(37,99,235,.2); border-right-color: var(--blue); }
.nav-item svg { opacity: .65; flex-shrink: 0; width: 16px; height: 16px; }
.nav-item.active svg, .nav-item:hover svg { opacity: 1; }

.nav-badge {
    margin-left: auto;
    background: var(--red); color: var(--white);
    font-size: 10px; font-weight: 700;
    padding: 1px 6px; border-radius: 10px; min-width: 18px; text-align: center;
}
.nav-badge.amber { background: var(--amber); }

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
}

.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--blue); color: var(--white);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--white); }
.sidebar-user-role { font-size: 11px; color: var(--gray-600); }

.sidebar-uitlog {
    margin-left: auto;
    background: none; border: none;
    color: var(--gray-600); cursor: pointer; padding: 4px;
    border-radius: 4px; transition: color .12s;
}
.sidebar-uitlog:hover { color: var(--red); }

/* -- MAIN CONTENT ------------------------------------------- */
.main-wrap {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-h);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px;
    position: sticky; top: 0; z-index: 50;
}

.topbar-title { font-size: 14px; font-weight: 600; color: var(--gray-700); }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.topbar-notif {
    width: 34px; height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
    background: var(--white);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; position: relative;
    color: var(--gray-600);
}
.topbar-notif:hover { border-color: var(--blue); color: var(--blue); }
.notif-dot {
    position: absolute; top: 7px; right: 7px;
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--red); border: 1.5px solid var(--white);
}

.page-content { padding: 28px 32px; flex: 1; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 26px; }
.page-title { font-size: 21px; font-weight: 800; color: var(--gray-900); letter-spacing: -.3px; }
.page-sub { font-size: 13px; color: var(--gray-400); margin-top: 3px; }
.page-actions { display: flex; gap: 8px; align-items: center; }

/* -- CARDS -------------------------------------------------- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}
.card-pad { padding: 20px 24px; }
.card-title {
    font-size: 11px; font-weight: 700;
    color: var(--gray-400); text-transform: uppercase;
    letter-spacing: .08em; margin-bottom: 14px;
}
.card-mb { margin-bottom: 20px; }

/* -- STAT CARDS --------------------------------------------- */
.stats-grid { display: grid; gap: 16px; margin-bottom: 22px; }
.stats-4 { grid-template-columns: repeat(4, 1fr); }
.stats-3 { grid-template-columns: repeat(3, 1fr); }
.stats-2 { grid-template-columns: repeat(2, 1fr); }

.stat-card {
    background: var(--white);
    border-radius: var(--radius); padding: 18px 20px;
    box-shadow: var(--shadow); border: 1px solid var(--gray-200);
}
.stat-icon {
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 12px;
}
.stat-val { font-size: 28px; font-weight: 800; letter-spacing: -.5px; line-height: 1; }
.stat-lbl { font-size: 12px; color: var(--gray-400); margin-top: 5px; font-weight: 500; }
.stat-delta { font-size: 11px; margin-top: 6px; font-weight: 600; }
.delta-up { color: var(--green); }
.delta-down { color: var(--red); }
.delta-neutral { color: var(--gray-400); }

/* -- GRID LAYOUTS ------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid-3l { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid-3r { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; margin-bottom: 20px; }

/* -- BADGES ------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; border-radius: 20px;
    font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge-green  { background: var(--green-light);  color: #065f46; }
.badge-blue   { background: var(--blue-light);   color: var(--blue-dark); }
.badge-amber  { background: var(--amber-light);  color: #92400e; }
.badge-red    { background: var(--red-light);    color: #991b1b; }
.badge-purple { background: var(--purple-light); color: #5b21b6; }
.badge-gray   { background: var(--gray-100);     color: var(--gray-700); }

/* -- BUTTONS ------------------------------------------------ */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600; cursor: pointer;
    border: none; transition: all .12s; font-family: inherit;
    text-decoration: none;
}
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-green { background: var(--green); color: var(--white); }
.btn-green:hover { background: #0ea572; }
.btn-red { background: var(--red); color: var(--white); }
.btn-red:hover { background: #dc2626; }
.btn-outline { background: var(--white); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }
.btn-ghost { background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-900); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 4px; }
.btn-block { width: 100%; justify-content: center; }

/* -- TABLES ------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    padding: 9px 14px; text-align: left;
    font-size: 11px; font-weight: 700;
    color: var(--gray-400); text-transform: uppercase;
    letter-spacing: .06em; border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}
td {
    padding: 11px 14px; font-size: 13px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

/* -- FORMS -------------------------------------------------- */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; font-size: 12px; font-weight: 600;
    color: var(--gray-700); margin-bottom: 5px;
}
.form-control {
    width: 100%; padding: 9px 12px;
    border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
    font-size: 13px; font-family: inherit; color: var(--gray-900);
    background: var(--white); outline: none; transition: border-color .12s;
}
.form-control:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
textarea.form-control { resize: vertical; min-height: 80px; }
.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* -- ALERT / MELDING ---------------------------------------- */
.alert {
    padding: 12px 16px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600; margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}
.alert-success { background: var(--green-light); color: #065f46; border: 1px solid rgba(16,185,129,.3); }
.alert-error   { background: var(--red-light);   color: #991b1b; border: 1px solid rgba(239,68,68,.3); }
.alert-warning { background: var(--amber-light); color: #92400e; border: 1px solid rgba(245,158,11,.3); }
.alert-info    { background: var(--blue-light);  color: var(--blue-dark); border: 1px solid rgba(37,99,235,.2); }

/* -- FEED / ACTIVITEIT -------------------------------------- */
.feed-item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--gray-100); align-items: flex-start; }
.feed-item:last-child { border-bottom: none; }
.feed-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.feed-txt { font-size: 13px; color: var(--gray-700); line-height: 1.4; }
.feed-time { font-size: 11px; color: var(--gray-400); margin-top: 2px; }

/* -- CHART BARS --------------------------------------------- */
.chart-bars { height: 190px; display: flex; align-items: flex-end; gap: 8px; margin-top: 24px; }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; flex: 1; position: relative; min-width: 18px; }
.bar-total { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; color: var(--gray-600); white-space: nowrap; }
.bar-stack { width: 18px; display: flex; flex-direction: column-reverse; border-radius: 3px 3px 0 0; overflow: hidden; }
.bar-seg { width: 100%; transition: opacity .15s; }
.bar-seg:hover { opacity: .75; }
.chart-labels { display: flex; padding: 6px 4px 0; gap: 8px; }
.chart-labels span { flex: 1; text-align: center; font-size: 9px; color: var(--gray-400); }
.chart-legend { display: flex; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--gray-400); }
.legend-dot { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }

/* -- PROGRESS BAR ------------------------------------------- */
.progress-bar { height: 6px; background: var(--gray-100); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width .3s; }

/* -- INFO ROWS ---------------------------------------------- */
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--gray-100); font-size: 13px; }
.info-row:last-child { border-bottom: none; }
.info-lbl { color: var(--gray-400); font-weight: 500; }
.info-val { font-weight: 600; color: var(--gray-800); }

/* -- DIVIDER ------------------------------------------------ */
.divider { height: 1px; background: var(--gray-100); margin: 16px 0; }

/* -- CODE --------------------------------------------------- */
code { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; background: var(--gray-100); padding: 1px 5px; border-radius: 3px; color: var(--blue); }

/* -- EMPTY STATE -------------------------------------------- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--gray-400); font-size: 13px; }
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--gray-600); margin-bottom: 6px; }

/* -- MODAL -------------------------------------------------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 2000; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--white); border-radius: 14px; padding: 28px; width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal-title { font-size: 17px; font-weight: 800; margin-bottom: 20px; color: var(--gray-900); }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--gray-100); }

/* -- TOAST -------------------------------------------------- */
.toast {
    position: fixed; bottom: 24px; right: 24px;
    background: var(--gray-900); color: var(--white);
    padding: 12px 20px; border-radius: var(--radius);
    font-size: 13px; font-weight: 600;
    box-shadow: var(--shadow-md); display: none; z-index: 999;
    border-left: 3px solid var(--green);
}
.toast.show { display: block; animation: toastIn .2s ease; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.mobile-menu-btn {
    display: none; position: fixed; top: 12px; left: 12px; z-index: 1001;
    width: 34px; height: 34px; border-radius: 8px; border: none;
    background: var(--gray-900); color: var(--white);
    align-items: center; justify-content: center; cursor: pointer;
}
.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4);
    z-index: 999;
}

/* -- RESPONSIVE --------------------------------------------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 768px) {
    body { overflow-x: hidden; }
    .sidebar { transform: translateX(-100%); transition: transform .2s; }
    .sidebar.open { transform: translateX(0); }
    .main-wrap { margin-left: 0; overflow-x: hidden; }
    .stats-4, .stats-3, .stats-grid, .grid-2, .grid-3l, .grid-3r { grid-template-columns: 1fr; }
    .page-content, .card, .stat-card { min-width: 0; }
    .page-content { padding: 16px; overflow-x: hidden; }
    .mobile-menu-btn { display: flex; }
    .sidebar-overlay.open { display: block; }
    .topbar { padding-left: 56px; }
}

/* -- KLANT SIDEBAR (licht thema) ---------------------------- */
.klant-sidebar { background: white; border-right: 1px solid var(--gray-200); }
.klant-sidebar .sidebar-logo { border-bottom-color: var(--gray-200); height: var(--topbar-h); padding: 0 18px; display: flex; align-items: center; justify-content: center; }
.klant-sidebar .nav-section { color: var(--gray-400); }
.klant-sidebar .nav-item { color: var(--gray-600); }
.klant-sidebar .nav-item:hover { color: var(--blue); background: var(--blue-light); }
.klant-sidebar .nav-item.active { color: var(--blue); background: var(--blue-light); border-right-color: var(--blue); }
.klant-sidebar .nav-item svg { color: inherit; }
.klant-sidebar .sidebar-footer { border-top-color: var(--gray-200); }
.klant-sidebar .sidebar-user-name { color: var(--gray-900) !important; }
.klant-sidebar .sidebar-uitlog { color: var(--gray-400); }
.klant-sidebar .sidebar-uitlog:hover { color: var(--red); }