/*
 * Schil van het CRM (OPS-512): navy zijbalk op desktop (vanaf 1024 px), witte bovenbalk met beeldmerk en een tabbar onderin op een telefoon
 * of tablet. Tokens uit ontwerp.css. De inhoud (.inhoud) en de schermen zelf blijven zoals ze waren; alleen de schil eromheen is nieuw.
 */

.schil-crm { min-height: 100vh; }
.overslaan { position: absolute; left: -9999px; top: 8px; z-index: 100; }
.overslaan:focus { left: 8px; padding: 8px 12px; border-radius: var(--radius-knop); background: var(--inkt-0); color: var(--merk-600); box-shadow: var(--focus-ring); }

/* ---- Zijbalk (desktop) ---- */
.zijbalk { display: none; }
.zijbalk-logo { display: block; padding: var(--ruimte-6) var(--ruimte-5) var(--ruimte-4); border-radius: var(--radius-knop); }
.zijbalk-logo img { display: block; width: 128px; height: auto; }
.zijbalk-logo:focus-visible { outline: 2px solid transparent; outline-offset: 2px; box-shadow: var(--focus-ring-navy); }
.zijbalk-nav { flex: 1; overflow-y: auto; padding: var(--ruimte-2) var(--ruimte-3) var(--ruimte-4); scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .2) transparent; }
.zijbalk-groep { margin: var(--ruimte-5) var(--ruimte-3) var(--ruimte-1); font-size: var(--tekst-xs); line-height: var(--regel-xs); font-weight: var(--gewicht-halfvet); letter-spacing: .06em; text-transform: uppercase; color: var(--merk-200); }
.zijbalk-groep:first-child { margin-top: var(--ruimte-1); }
.zijbalk ul { list-style: none; margin: 0; padding: 0; display: block; }
.zijbalk-item { position: relative; display: flex; align-items: center; gap: var(--ruimte-3); min-height: 40px; margin: 2px 0; padding: 0 var(--ruimte-3); border-radius: var(--radius-knop);
    color: var(--merk-200); font-size: var(--tekst-sm); line-height: var(--regel-sm); font-weight: var(--gewicht-medium); text-decoration: none; }
.zijbalk-item:hover { background: rgba(255, 255, 255, .06); color: var(--inkt-0); }
.zijbalk-item[aria-current="page"] { background: rgba(255, 255, 255, .10); color: var(--inkt-0); font-weight: var(--gewicht-halfvet); }
.zijbalk-item[aria-current="page"]::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--merkverloop-staand); }
.zijbalk-item:focus-visible { outline: 2px solid transparent; outline-offset: 2px; box-shadow: var(--focus-ring-navy); }
.zijbalk-voet { display: flex; align-items: center; gap: var(--ruimte-3); padding: var(--ruimte-4) var(--ruimte-5); border-top: 1px solid rgba(255, 255, 255, .1); color: var(--merk-200); font-size: var(--tekst-sm); }
.zijbalk-naam { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--inkt-0); font-weight: var(--gewicht-medium); }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: none; border-radius: 50%; background: rgba(255, 255, 255, .12); color: var(--merk-200); }

/* Icoon met teller (belletje) */
.icoon-plek { position: relative; display: inline-flex; flex: none; }
.teller { position: absolute; top: -6px; right: -9px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-rond); background: var(--gevaar-600); color: var(--inkt-0);
    font-size: 11px; line-height: 18px; font-weight: var(--gewicht-vet); text-align: center; font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--merk-900); }

/* ---- Bovenbalk (telefoon, tablet) ---- */
.mobielbalk { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: var(--ruimte-3); height: var(--bovenbalk); padding: 0 var(--ruimte-4);
    background: var(--inkt-0); border-bottom: 1px solid var(--inkt-200); }
.mobielbalk::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--merkverloop); }
.mobielbalk-logo { display: inline-flex; align-items: center; justify-content: center; min-width: var(--tikdoel); min-height: var(--tikdoel); margin-left: -6px; border-radius: var(--radius-knop); }
.mobielbalk-logo img { display: block; width: 32px; height: auto; }
.mobielbalk-logo:focus-visible { outline: 2px solid transparent; outline-offset: 2px; box-shadow: var(--focus-ring); }
.mobielbalk-titel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--tekst-base); font-weight: var(--gewicht-vet); color: var(--inkt-900); }

/* ---- Tabbar onderin (telefoon, tablet) ---- */
.tabbar { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; background: var(--inkt-0); border-top: 1px solid var(--inkt-200); padding-bottom: env(safe-area-inset-bottom, 0px); box-shadow: 0 -4px 16px -8px rgba(0, 0, 70, .12); }
.tabbar > ul { display: flex; list-style: none; margin: 0; padding: 0; }
.tabbar > ul > li { flex: 1 1 0; min-width: 0; }
.tabbar-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 100%; height: var(--tabbar); padding: 0 2px;
    color: var(--inkt-500); text-decoration: none; font-size: 11px; line-height: 14px; font-weight: var(--gewicht-halfvet); cursor: pointer; list-style: none; }
.tabbar-item::-webkit-details-marker { display: none; }
.tabbar-item .item-tekst { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar-item[aria-current="page"], .meer[open] > .tabbar-item { color: var(--merk-600); }
.tabbar-item[aria-current="page"] .ui-icoon { fill: var(--merk-50); }
.tabbar-item:focus-visible { outline: 2px solid transparent; outline-offset: 2px; box-shadow: inset 0 0 0 2px var(--merk-500); border-radius: var(--radius-knop); }
.tabbar .teller { box-shadow: 0 0 0 2px var(--inkt-0); }

/* "Meer": paneel boven de tabbar met alle onderdelen */
.meer-paneel { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px)); max-height: calc(100vh - var(--tabbar) - var(--bovenbalk) - 16px); overflow-y: auto;
    padding: var(--ruimte-2) var(--ruimte-4) var(--ruimte-4); background: var(--inkt-0); border-top: 1px solid var(--inkt-200); border-radius: var(--radius-sheet) var(--radius-sheet) 0 0; box-shadow: var(--schaduw-modal); }
.meer-groep { margin: var(--ruimte-4) 0 var(--ruimte-1); font-size: var(--tekst-xs); line-height: var(--regel-xs); font-weight: var(--gewicht-halfvet); letter-spacing: .06em; text-transform: uppercase; color: var(--inkt-500); }
.meer-paneel ul { list-style: none; margin: 0; padding: 0; display: block; }
.meer-item { display: flex; align-items: center; gap: var(--ruimte-3); min-height: 48px; padding: 0 var(--ruimte-3); border-radius: var(--radius-knop); color: var(--inkt-900); font-size: var(--tekst-base); font-weight: var(--gewicht-medium); text-decoration: none; }
.meer-item:hover { background: var(--inkt-50); }
.meer-item[aria-current="page"] { background: var(--merk-50); color: var(--merk-600); font-weight: var(--gewicht-halfvet); }
.meer-item:focus-visible { outline: 2px solid transparent; outline-offset: 2px; box-shadow: var(--focus-ring); }

/* ---- Inhoud ---- */
.schil-crm .inhoud { margin: 0 auto; padding: var(--ruimte-4) var(--ruimte-4) calc(var(--tabbar) + var(--ruimte-6) + env(safe-area-inset-bottom, 0px)); }
.schil-crm .inhoud h1 { font-size: var(--tekst-xl); line-height: var(--regel-xl); font-weight: var(--gewicht-vet); letter-spacing: -.01em; color: var(--inkt-900); }

/* ---- Desktop: zijbalk aan, bovenbalk en tabbar uit ---- */
@media (min-width: 1024px) {
    .schil-crm { display: grid; grid-template-columns: var(--zijbalk) minmax(0, 1fr); }
    .zijbalk { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; grid-row: 1 / span 3; background: var(--merk-900); color: var(--inkt-0); }
    .mobielbalk, .tabbar { display: none; }
    .schil-crm .inhoud { grid-column: 2; width: 100%; max-width: 1180px; padding: var(--ruimte-8) var(--ruimte-8) var(--ruimte-12); }
    .schil-crm .inhoud h1 { font-size: var(--tekst-2xl); line-height: var(--regel-2xl); }
}

/* Uitloggen (OPS-328): in de voet van de zijbalk en onderaan "Meer" */
.zijbalk-voet .uitloggen { margin: 0 0 0 auto; }
.zijbalk-uit { display: inline-flex; align-items: center; justify-content: center; width: 40px; min-height: 40px; padding: 0; border: 0; border-radius: var(--radius-knop); background: transparent; color: var(--merk-200); cursor: pointer; }
.zijbalk-uit:hover { background: rgba(255, 255, 255, .08); color: var(--inkt-0); }
.zijbalk-uit:focus-visible { outline: 2px solid transparent; outline-offset: 2px; box-shadow: var(--focus-ring-navy); }
.meer-uit { margin: var(--ruimte-3) 0 0; padding-top: var(--ruimte-3); border-top: 1px solid var(--inkt-200); }
.meer-uit .meer-item { width: 100%; border: 0; background: transparent; font-family: inherit; cursor: pointer; text-align: left; }

/* Inloggen (OPS-328, layout crm.layout): witte bovenbalk met het merkverloop als lijn, de kaart in het midden */
.schil-login .topbalk { position: relative; min-height: 64px; padding: 8px 24px; border-bottom: 1px solid var(--inkt-200); }
.schil-login .topbalk::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--merkverloop); }
.schil-login .topbalk .logo img { display: block; height: 40px; width: auto; }
.schil-login .login-kaart { border-radius: var(--radius-kaart); border-color: var(--inkt-200); box-shadow: var(--schaduw-kaart); }
.schil-login h1 { font-size: var(--tekst-2xl); line-height: var(--regel-2xl); letter-spacing: -.01em; margin: 0 0 var(--ruimte-2); }
.schil-login a.knop.primair { min-height: 44px; padding: 0 var(--ruimte-5); border-color: var(--merk-600); font-weight: var(--gewicht-halfvet); }
.schil-login a.knop.primair:hover { background: var(--merk-700); }

/* Brede tabel (bijv. Producten): horizontaal scrollen binnen het blok, niet de hele pagina; met toetsenbord bereikbaar (tabindex=0) */
.tabel-scroll { max-width: 100%; overflow-x: auto; }
.tabel-scroll:focus-visible { outline: 2px solid transparent; outline-offset: 2px; box-shadow: var(--focus-ring); }
