/* ============================================
   inlyn - Mobile First CSS
   ============================================ */

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* --- CSS Variables --- */
:root {
    /* Brand (overschrijfbaar via config) */
    --brand: #fd3d3a;
    --brand-rgb: 253, 61, 58;

    /* Light mode */
    --bg: #f0f4f8;
    --card: #fff;
    --card2: #f8fafc;
    --border: rgba(0, 0, 0, .08);
    --border2: rgba(0, 0, 0, .15);
    --text: #1a202c;
    --muted: #64748b;
    --subtle: rgba(0, 0, 0, .03);

    /* Semantic */
    --green: #22c55e;
    --blue: #4f7fff;
    --amber: #f59e0b;
    --red: #ef4444;

    /* Layout */
    --nav-w: 220px;
    --radius: 10px;
    --radius-sm: 7px;
    --radius-xs: 5px;
}

[data-theme="dark"] {
    --bg: #0d1117;
    --card: #161b22;
    --card2: #1c2333;
    --border: rgba(255, 255, 255, .08);
    --border2: rgba(255, 255, 255, .14);
    --text: #e6edf3;
    --muted: #8b949e;
    --subtle: rgba(255, 255, 255, .04);
}
/* Logo light/dark switching */
.nav-logo-dark { display: none; }
[data-theme="dark"] .nav-logo-light { display: none; }
[data-theme="dark"] .nav-logo-dark { display: block; }

/* --- Base --- */
html { font-size: 13px; -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
}
a { color: var(--brand); text-decoration: none; }
a:hover { opacity: .85; }
img { max-width: 100%; height: auto; }

/* --- Typography --- */
h1 { font-size: 18px; font-weight: 700; }
h2 { font-size: 15px; font-weight: 700; }
h3 { font-size: 13px; font-weight: 600; }
.muted { color: var(--muted); }
.label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
}

/* --- App Shell --- */
.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

/* --- Sidebar Nav (mobile: overlay) --- */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--nav-w);
    background: var(--card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .2s ease;
}
.nav.open { transform: translateX(0); }

.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 49;
}
.nav-overlay.open { display: block; }

.nav-top {
    padding: 14px 14px 10px;
}
.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.nav-logo img:not(.nav-logo-circle) {
    height: 28px;
    width: auto;
}
.nav-logo-circle {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-xs);
    object-fit: contain;
    flex-shrink: 0;
    border: 2px solid var(--border);
    padding: 3px;
    background: var(--card);
}
.nav-logo-text {
    font-family: 'Rubik', sans-serif;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: -.06em;
    color: var(--text);
}
.nav-logo-dot {
    color: var(--brand);
}
.nav-logo-text-plain {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.nav-menu {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}
.nav-group-label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    padding: 12px 10px 4px;
    opacity: .6;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    font-weight: 400;
    transition: background .15s;
    cursor: pointer;
}
.nav-item:hover { background: var(--subtle); }
.nav-item.active {
    background: rgba(var(--brand-rgb), .1);
    color: var(--brand);
    font-weight: 600;
}
.nav-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.nav-bottom {
    padding: 6px 8px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-powered {
    font-size: 9px;
    color: var(--muted);
    opacity: .6;
}
.nav-bottom-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
    transition: background .15s;
    cursor: pointer;
}
.nav-bottom-user:hover { background: var(--subtle); opacity: 1; }
.nav-bottom-user.active { background: rgba(var(--brand-rgb), .1); }
.nav-bottom-user svg { flex-shrink: 0; color: var(--muted); }

/* Entity switcher */
.nav-entity-switcher {
    padding: 0px;
    position: relative;
}
.nav-entity-current {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    transition: background .15s;
}
.nav-entity-current:hover { background: var(--subtle); }
.nav-entity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.nav-entity-dropdown {
    position: absolute;
    left: 8px;
    right: 8px;
    top: 100%;
    background: var(--card);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
    z-index: 60;
    overflow: hidden;
}
.nav-entity-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    font-size: 12px;
    color: var(--text);
    text-decoration: none;
    transition: background .1s;
}
.nav-entity-option:hover { background: var(--subtle); opacity: 1; }
.nav-entity-option.active { background: rgba(var(--brand-rgb), .08); }

/* Bottom actions row */
.nav-bottom-actions {
    display: none;
    gap: 4px;
    margin-bottom: 4px;
}
.nav-collapse-btn {
    flex: 1;
    padding: 6px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    border-radius: var(--radius-xs);
    transition: background .15s;
    text-decoration: none;
    text-align: center;
}
.nav-collapse-btn:hover { background: var(--subtle); color: var(--text); opacity: 1; }
.nav-collapse-btn svg { display: block; margin: 0 auto; transition: transform .2s; }
.nav-user {
    flex: 1;
    overflow: hidden;
}
.nav-user-name {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-user-role {
    font-size: 10px;
    color: var(--muted);
}

/* --- Topbar (mobile) --- */
.topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99;
}
.topbar-menu-btn {
    background: none;
    border: none;
    color: var(--text);
    padding: 4px;
    cursor: pointer;
}
.topbar-menu-btn svg { width: 20px; height: 20px; }
.topbar-title {
    flex: 1;
    font-size: 15px;
    font-weight: 700;
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Topbar user/avatar */
.topbar-user {
    display: flex;
    align-items: center;
    text-decoration: none;
    margin-left: 2px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}
.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    transition: border-color .15s;
}
.topbar-user:hover .topbar-avatar { border-color: var(--brand); }
.topbar-avatar-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card2);
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

/* Topbar user dropdown */
.topbar-user-wrap { position: relative; }
.topbar-user-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 200px;
    background: var(--card);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
    z-index: 60;
    overflow: hidden;
}
.topbar-user-info {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
.topbar-user-name { font-size: 13px; font-weight: 600; }
.topbar-user-email { font-size: 11px; color: var(--muted); }
.topbar-user-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    font-size: 12px;
    color: var(--text);
    text-decoration: none;
    transition: background .1s;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}
.topbar-user-item:hover { background: var(--subtle); opacity: 1; }
.topbar-user-logout { color: var(--red); }

/* Hover dropdown - bridge tussen avatar en dropdown */
.topbar-user-wrap::before {
    content: '';
    position: absolute;
    top: 100%;
    right: 0;
    width: 220px;
    height: 12px;
    display: none;
}
.topbar-user-wrap:hover::before { display: block; }
.topbar-user-wrap:hover .topbar-user-dropdown,
.topbar-user-dropdown:hover {
    display: block !important;
}

/* --- Main content --- */
.main {
    flex: 1;
    padding: 68px 16px 16px;
    min-width: 0;
    max-width: 100%;
}

/* --- Cards --- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.card-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h2 { margin: 0; }
.card-body { padding: 16px; }
.card-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* --- Insights --- */
.insights-grid { display: flex; flex-direction: column; gap: 8px; }
.insight-card {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--brand);
    border-radius: var(--radius);
    transition: opacity .2s;
}
.insight-icon { width: 18px; height: 18px; color: var(--brand); flex-shrink: 0; margin-top: 2px; }
.insight-icon svg { width: 18px; height: 18px; }
.insight-body { flex: 1; min-width: 0; }
.insight-title { font-size: 13px; font-weight: 600; }
.insight-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.insight-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* --- KPI Cards --- */
.kpi-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 16px;
}
.kpi-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
    overflow: hidden;
    transition: border-color .15s, transform .15s, box-shadow .15s;
}
.kpi-card:hover { border-color: var(--border2); }
a.kpi-card { text-decoration: none; color: inherit; }
a.kpi-card.kpi-clickable { cursor: pointer; }
a.kpi-card.kpi-clickable:hover { border-color: var(--brand); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,.04); }
a.kpi-card.kpi-clickable:hover .kpi-icon { background: rgba(var(--brand-rgb), .1); }
a.kpi-card.kpi-clickable:hover .kpi-icon svg { color: var(--brand); }
.kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--card2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.kpi-icon svg { width: 16px; height: 16px; color: var(--muted); }
.kpi-value { font-size: 22px; font-weight: 700; line-height: 1.2; }
.kpi-label { font-size: 11px; color: var(--muted); }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border2);
    background: var(--card2);
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    font-family: inherit;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn svg { width: 13px; height: 13px; }

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.btn-primary:hover { opacity: .88; color: #fff; }

.btn-danger {
    background: rgba(239, 68, 68, .1);
    border-color: var(--red);
    color: var(--red);
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-ghost {
    background: transparent;
    border-color: transparent;
}
.btn-ghost:hover { background: var(--subtle); border-color: var(--border); }

.btn-sm { padding: 4px 9px; font-size: 11px; }
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
}

/* --- Forms --- */
.form-row { margin-bottom: 14px; }
.form-row-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 14px;
}
.form-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 5px;
}
.form-input {
    width: 100%;
    background: var(--card2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 11px;
    font-size: 16px;
    color: var(--text);
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.form-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .1);
}
.form-input::placeholder { color: var(--muted); }

select.form-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

/* File input */
input[type="file"] {
    font-size: 12px;
    color: var(--muted);
    padding: 8px 0;
}
input[type="file"]::file-selector-button {
    background: var(--card2);
    border: 1px solid var(--border2);
    border-radius: var(--radius-xs);
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    margin-right: 8px;
    transition: all .15s;
}
input[type="file"]::file-selector-button:hover {
    border-color: var(--brand);
    color: var(--brand);
}

/* Toggle switch */
.toggle {
    position: relative;
    width: 38px;
    height: 21px;
    cursor: pointer;
}
.toggle input { display: none; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--card2);
    border: 1px solid var(--border2);
    border-radius: 99px;
    transition: all .2s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 13px;
    height: 13px;
    background: var(--muted);
    border-radius: 50%;
    transition: all .2s;
}
.toggle input:checked + .toggle-slider {
    background: var(--brand);
    border-color: var(--brand);
}
.toggle input:checked + .toggle-slider::before {
    background: #fff;
    transform: translateX(17px);
}

/* --- Tables --- */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
table {
    width: 100%;
    border-collapse: collapse;
}
th {
    text-align: left;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--subtle); }

/* --- Table component (dryve-table) --- */
.dryve-table {
    overflow: hidden;
}
.dryve-table-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}
.dryve-table-filters {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    width: 100%;
}
.dryve-table-filters .form-input {
    width: 100%;
    min-width: 0;
    font-size: 12px;
    padding: 6px 8px;
}
.dryve-table-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
@media (min-width: 768px) {
    .form-input { font-size: 13px; }
    .dryve-table-filters { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* --- Rows (settings style) --- */
.row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: none; }
.row-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--card2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.row-icon svg { width: 14px; height: 14px; color: var(--muted); }
.row-body { flex: 1; min-width: 0; }
.row-title { font-size: 13px; font-weight: 600; }
.row-sub { font-size: 11px; color: var(--muted); }
.row-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* --- Notification bell --- */
.topbar-timer { display: flex; align-items: center; }
.topbar-timer-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--card2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
    font-variant-numeric: tabular-nums;
}
.topbar-timer-btn:hover { background: var(--subtle); }
.topbar-timer-btn.is-running { background: rgba(var(--brand-rgb), .15); border-color: var(--brand); color: var(--brand); }
.topbar-timer-btn svg { display: block; }

.notif-bell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    color: var(--text);
    transition: background .15s;
    text-decoration: none;
}
.notif-bell:hover { background: var(--subtle); opacity: 1; }
.notif-bell svg { display: block; }
.notif-bell.has-unread svg {
    animation: bellShake 0.5s ease-in-out;
    animation-iteration-count: 1;
}
.notif-bell.has-unread { animation: bellRemind 8s ease-in-out infinite; }
@keyframes bellShake {
    0%, 100% { transform: rotate(0); }
    15% { transform: rotate(14deg); }
    30% { transform: rotate(-12deg); }
    45% { transform: rotate(8deg); }
    60% { transform: rotate(-6deg); }
    75% { transform: rotate(2deg); }
}
@keyframes bellRemind {
    0%, 90%, 100% { transform: rotate(0); }
    92% { transform: rotate(10deg); }
    94% { transform: rotate(-8deg); }
    96% { transform: rotate(5deg); }
    98% { transform: rotate(-3deg); }
}
.notif-bell-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 20px;
    background: var(--brand);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* --- Kanban board --- */
.kanban-board {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 16px;
    -webkit-overflow-scrolling: touch;
}
.kanban-col {
    min-width: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.kanban-col-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
}
.kanban-col-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
}
.kanban-col-body {
    min-height: 100px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}
.kanban-col-body.drag-over {
    background: rgba(var(--brand-rgb), .05);
    border-radius: 8px;
}
.kanban-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 12px;
    border-left: 2px solid var(--border2);
    cursor: grab;
    transition: all .15s;
}
.kanban-card:hover {
    border-color: var(--border2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
}
.kanban-card.dragging { opacity: .5; }
.kanban-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    display: block;
    margin-bottom: 4px;
}
.kanban-card-title:hover { color: var(--brand); opacity: 1; }
.kanban-card-meta {
    font-size: 11px;
    color: var(--muted);
}

/* --- Modal --- */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.overlay.open { display: flex; }

.modal {
    background: var(--card);
    border: 1px solid var(--border2);
    border-radius: 14px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.modal-head {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-title { font-size: 15px; font-weight: 700; }
.modal-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 18px;
    cursor: pointer;
    border-radius: var(--radius-xs);
    padding: 2px 6px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* --- Toast (micro, bottom center) --- */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translate(-50%, 12px);
    background: var(--card);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .15);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    pointer-events: none;
    transition: all .2s ease;
}
.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
    pointer-events: auto;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--blue); }
.toast.warning { border-left: 3px solid var(--amber); }

/* --- Notification toast (right side, richer) --- */
.notif-toast {
    position: fixed;
    bottom: 24px;
    right: 16px;
    left: 16px;
    background: var(--card);
    border: 1px solid var(--border2);
    border-left: 3px solid var(--brand);
    border-radius: var(--radius);
    padding: 12px 14px 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .18);
    z-index: 9999;
    animation: toastIn .25s ease;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.notif-toast-title { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.notif-toast-body { font-size: 11px; color: var(--muted); line-height: 1.5; }
.notif-toast-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
}
.badge-green { background: rgba(34, 197, 94, .12); color: var(--green); }
.badge-red { background: rgba(239, 68, 68, .12); color: var(--red); }
.badge-blue { background: rgba(79, 127, 255, .12); color: var(--blue); }
.badge-amber { background: rgba(245, 158, 11, .12); color: var(--amber); }
.badge-muted { background: var(--subtle); color: var(--muted); }

/* --- Timeline (chatter) --- */
.timeline { position: relative; padding-left: 12px; }
.timeline::before {
    content: '';
    position: absolute;
    left: 23px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: var(--border);
}
.timeline-item {
    display: flex;
    gap: 12px;
    position: relative;
    padding: 8px 0;
}
.timeline-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 1;
    background: var(--card2)!important;
}
.timeline-icon svg { width: 12px; height: 12px; }
.timeline-body { flex: 1; padding-bottom: 8px; }
.timeline-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}
.timeline-title a { color: inherit; text-decoration: none; }
.timeline-title a:hover { color: var(--brand); opacity: 1; }
.timeline-content {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 4px;
    line-height: 1.5;
}
.timeline-meta {
    font-size: 10px;
    color: var(--muted);
}

/* --- Tag pill (selector) --- */
.tag-pill {
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 20px;
    padding: 0;
    transition: all .15s;
    user-select: none;
}
.tag-pill span {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    opacity: .4;
    transition: opacity .15s;
}
.tag-pill:has(input:checked) span { opacity: 1; }

/* --- Empty state --- */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}
.empty-state svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 13px; }

/* --- Cookie consent --- */
.cookie-consent {
    position: fixed;
    bottom: 16px;
    left: 16px;
    right: 16px;
    max-width: 600px;
    margin: 0 auto;
    background: var(--card);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    padding: 14px 18px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .2);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 9999;
    font-size: 12px;
    color: var(--text);
}
.cookie-consent-text { flex: 1; }
.cookie-consent-text a { color: var(--brand); font-weight: 600; }

/* --- Powered by inlyn --- */
.powered-by, .powered-by-fixed {
    font-size: 10px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 4px;
}
.powered-by { text-align: center; padding: 16px; justify-content: center; }
.powered-by-fixed {
    padding: 16px;
    justify-content: center;
}
.powered-by a, .powered-by-fixed a { color: inherit; text-decoration: none; }
.inlyn-wordmark {
    font-family: 'Rubik', sans-serif;
    font-weight: 900;
    font-size: 13px;
    letter-spacing: -.06em;
    color: var(--text);
}
.inlyn-dot { color: #fd3d3a; }

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 0;
}
.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all .15s;
}
.pagination-btn:hover { border-color: var(--brand); color: var(--brand); opacity: 1; }
.pagination-btn.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.pagination-dots {
    font-size: 12px;
    color: var(--muted);
    padding: 0 4px;
}

/* --- Search results --- */
.search-result {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    color: var(--text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: background .1s;
    margin: 2px 4px;
}
.search-result:hover { background: var(--subtle); opacity: 1; }
.search-result-label { font-size: 13px; font-weight: 500; }
.search-result-sub { font-size: 11px; color: var(--muted); flex: 1; }
.search-result-type {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--card2);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
}

/* --- Utility --- */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.p-16 { padding: 16px; }
.hidden { display: none !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }

/* ============================================
   Tablet (>= 640px) — large phones landscape, kleine tablets
   ============================================ */
@media (min-width: 640px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row-2 { grid-template-columns: 1fr 1fr; }
}

/* ============================================
   Desktop (>= 768px) — tablets portrait/landscape, sidebar zichtbaar
   ============================================ */
@media (min-width: 768px) {

    /* Nav altijd zichtbaar */
    .nav {
        transform: translateX(0);
        position: fixed;
    }
    .nav-overlay { display: none !important; }
    .topbar-menu-btn { display: none; }

    /* Content naast nav */
    .main {
        margin-left: var(--nav-w);
        padding: 74px 24px 24px;
        max-width: min(calc(100vw - var(--nav-w)), 1400px);
    }
    .topbar {
        left: var(--nav-w);
        padding: 12px 24px;
    }

    /* Bottom actions zichtbaar op desktop */
    .nav-bottom-actions { display: flex; }

    /* Grid uitbreidingen */
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row-2 { grid-template-columns: 1fr 1fr; }

    /* === Sidebar transitions === */
    .nav { transition: width .2s ease; }
    .main { transition: margin-left .2s ease; }
    .topbar { transition: left .2s ease; }
    .nav-logo-text-plain { transition: opacity .15s ease, width .15s ease; overflow: hidden; white-space: nowrap; }
    .nav-label { transition: opacity .15s ease, width .15s ease; overflow: hidden; white-space: nowrap; }
    .nav-user { transition: opacity .15s ease, width .15s ease; overflow: hidden; }

    /* === Compact sidebar === */
    html.nav-compact .nav { width: 56px; }
    html.nav-compact .nav-logo-text-plain { opacity: 0; width: 0; }
    html.nav-compact .nav-label { opacity: 0; width: 0; }
    html.nav-compact .nav-user { opacity: 0; width: 0; }
    html.nav-compact .nav-bottom-user { gap: 0; padding: 10px; justify-content: center; }
    html.nav-compact .nav-bottom-user svg { width: 18px; height: 18px; flex-shrink: 0; }
    html.nav-compact .nav-entity-current { justify-content: center; padding: 8px; }
    html.nav-compact .nav-entity-dropdown { left: 56px; right: auto; top: 0; width: 200px; }
    html.nav-compact .nav-logo { justify-content: center; }
    html.nav-compact .nav-logo-circle { width: 28px; height: 28px; }
    html.nav-compact .nav-top { padding: 12px 8px 8px; }
    html.nav-compact .nav-menu { padding: 4px; }
    html.nav-compact .nav-item {
        justify-content: center;
        padding: 8px;
        gap: 0;
    }
    html.nav-compact .nav-logo { gap: 0; }
    html.nav-compact .nav-item svg { width: 16px; height: 16px; }
    html.nav-compact .nav-bottom { padding: 6px 4px; }
    html.nav-compact .nav-bottom-user {
        justify-content: center;
        padding: 8px;
    }
    html.nav-compact .nav-collapse-btn svg { transform: rotate(180deg); }
    html.nav-compact .main {
        margin-left: 56px;
        max-width: min(calc(100vw - 56px), 1400px);
    }
    html.nav-compact .topbar { left: 56px; }

    /* Powered by fixed rechtsonder */
    .powered-by-fixed {
        position: fixed;
        bottom: 12px;
        left: 50%;
        transform: translateX(-50%);
        padding: 0;
        z-index: 10;
    }

    /* Notif toast rechts */
    .notif-toast {
        left: auto;
        right: 24px;
        width: 300px;
    }
}

/* ============================================
   Large desktop (>= 1024px)
   ============================================ */
@media (min-width: 1024px) {
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ============================================
   Privacy mode: bedragen blurren als klant meekijkt
   ============================================ */
html.privacy-mode .privacy-amount {
    filter: blur(6px);
    transition: filter .15s ease;
    user-select: none;
}
html.privacy-mode .privacy-amount:hover {
    filter: blur(0);
}
html.privacy-mode #privacyIconOff { display: none; }
html.privacy-mode #privacyIconOn { display: block !important; }
html.privacy-mode #privacyToggleBtn { color: var(--brand); }

/* ============================================
   Generieke tabel UI (Table::render)
   ============================================ */
.dryve-table { display: flex; flex-direction: column; gap: 12px; }
.dryve-table-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.dryve-table-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
    min-width: 200px;
}
.dryve-table-filter {
    height: 32px;
    font-size: 12px;
    padding: 4px 10px;
    flex: 1 1 100%;
    min-width: 0;
}
@media (min-width: 768px) {
    .dryve-table-filter {
        flex: 0 1 auto;
        min-width: 120px;
        max-width: 200px;
    }
}
.dryve-table-filter-bool {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 0 10px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--card);
    cursor: pointer;
}
.dryve-table-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-left: auto;
}
.dryve-table-sort {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.dryve-table-sort:hover { color: var(--brand); }

.dryve-table tbody tr[data-url] { cursor: pointer; }
.dryve-table tbody tr[data-url]:hover { background: rgba(var(--brand-rgb), .04); }
.dryve-table tbody tr[data-url] td.no-click { cursor: default; }

.dryve-column-modal-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 50vh;
    overflow-y: auto;
}
.dryve-column-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--card);
    cursor: grab;
    font-size: 13px;
    transition: background .15s;
}
.dryve-column-row.dragging { opacity: .4; }
.dryve-column-row.drag-over { border-top: 2px solid var(--brand); }
.dryve-column-row .grip {
    color: var(--muted);
    flex-shrink: 0;
}
.dryve-column-row label {
    flex: 1;
    cursor: pointer;
    user-select: none;
}

/* Attachments */
.attachments-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.attachment-item { position: relative; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.attachment-item img { display: block; max-width: 160px; max-height: 120px; object-fit: cover; }
.attachment-item .attachment-file { display: flex; align-items: center; gap: 6px; padding: 8px 12px; font-size: 12px; color: var(--text); text-decoration: none; }
.attachment-remove { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,.6); color: #fff; border: none; border-radius: 50%; width: 20px; height: 20px; font-size: 14px; line-height: 20px; text-align: center; cursor: pointer; opacity: 0; transition: opacity .15s; }
.attachment-item:hover .attachment-remove { opacity: 1; }
.attachment-upload { margin-top: 8px; }
.attachment-upload-btn { cursor: pointer; }
.attachment-upload-btn input[type=file] { display: none; }

/* Rich text editor */
.rich-editor-wrap { margin-bottom: 14px; }
.rich-editor { min-height: 120px; background: var(--card2); border: 1px solid var(--border); border-radius: 0 0 8px 8px; padding: 12px; font-size: 13px; color: var(--text); line-height: 1.6; outline: none; }
.rich-editor:focus { border-color: var(--brand); }
.rich-editor ul, .rich-editor ol { padding-left: 15px; margin: 4px 0; }
.rich-editor li { margin: 2px 0; }
.rich-toolbar { display: flex; align-items: center; gap: 2px; padding: 4px; background: var(--card2); border: 1px solid var(--border); border-radius: 8px 8px 0 0; }
.rich-toolbar button { background: none; border: none; padding: 4px 8px; border-radius: 4px; font-size: 11px; color: var(--muted); cursor: pointer; display: flex; align-items: center; }
.rich-toolbar button:hover { background: var(--subtle); color: var(--text); }
.rich-sep { width: 1px; height: 16px; background: var(--border); margin: 0 4px; }
.rich-editor table, .rich-content table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.rich-editor th, .rich-editor td, .rich-content th, .rich-content td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.rich-editor th, .rich-content th { background: var(--subtle); font-weight: 600; }
.rich-content ul, .rich-content ol { padding-left: 15px; margin: 4px 0; }
.rich-content li { margin: 2px 0; }
.rich-content a { color: var(--brand); text-decoration: underline; }

/* AI Drawer */
.ai-drawer {
    position: fixed;
    bottom: 0;
    right: 80px;
    width: 360px;
    max-height: 55vh;
    background: var(--card);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,.1);
    z-index: 91;
    display: flex;
    flex-direction: column;
    transition: transform .3s ease;
    transform: translateY(calc(100% - 40px));
}

/* Mobile bottom nav */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 90;
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 14px 0;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}
.mobile-bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    color: var(--muted);
    font-size: 10px;
    padding: 4px 0;
    transition: color .15s;
}
.mobile-bottom-nav-item.active { color: var(--brand); }
.mobile-bottom-nav-icon svg { width: 24px; height: 24px; }
.mobile-bottom-nav-label { font-weight: 500; line-height: 1; }

@media (max-width: 767px) {
    .mobile-bottom-nav { display: flex; }
    .main { padding-bottom: 80px; }
    .nav-menu { padding-bottom: 80px; }
    .ai-drawer { bottom: 80px; right: 16px; width: calc(100% - 32px); }
}
