:root {
    --blue: #3f65ae;
    --blue-dark: #14294d;
    --blue-pale: #edf3fc;
    --orange: #f79321;
    --green: #67c642;
    --line: #d2deed;
    --muted: #6f7f98;
    --page: #f4f7fb;
    --shadow: 0 12px 34px rgba(20, 41, 77, .07);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--blue-dark); background: var(--page); font: 14px/1.45 Poppins, Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
a { color: inherit; }

/* Mio-logo */
.brand, .login-logo { position: relative; display: block; width: 106px; height: 58px; text-decoration: none; }
.brand-word { display: flex; align-items: baseline; font-size: 48px; line-height: 1; letter-spacing: -7px; }
.brand-word b { font-weight: 500; }
.brand-word b:first-child { color: var(--blue); }
.brand-word b:nth-child(2) { color: var(--green); }
.brand-word b:last-child { margin-left: 5px; color: var(--orange); font-size: 55px; }
.brand-dots { position: absolute; z-index: 1; top: -7px; left: 34px; display: flex; gap: 7px; }
.brand-dots i { width: 10px; height: 10px; background: #ffb400; border-radius: 50%; }
.brand-dots i:last-child { background: var(--green); }
.brand.small { width: 77px; height: 43px; }
.brand.small .brand-word { font-size: 34px; letter-spacing: -5px; }
.brand.small .brand-word b:last-child { margin-left: 4px; font-size: 39px; }
.brand.small .brand-dots { top: -5px; left: 24px; gap: 5px; }
.brand.small .brand-dots i { width: 7px; height: 7px; }

/* Publieke startpagina */
.public-page { border-top: 2px solid rgba(247,147,33,.25); }
.public-main { width: min(1380px, calc(100% - 48px)); margin: 0 auto; padding: 24px 0 46px; }
.public-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; align-items: start; }
.public-column { display: grid; gap: 14px; align-content: start; min-width: 0; }
.public-category { min-width: 0; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--blue); box-shadow: var(--shadow); }
.public-category:nth-child(3n+2) { border-top-color: var(--green); }
.public-category:nth-child(3n) { border-top-color: var(--orange); }
.public-category h2 { margin: 0; padding: 10px 13px 9px; color: var(--blue); border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.public-links { padding: 4px 0; }
.public-links a { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; gap: 8px; align-items: center; min-height: 32px; padding: 5px 11px 5px 13px; text-decoration: none; }
.public-links a + a { border-top: 1px solid #edf1f7; }
.public-links a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.public-links a i { color: #9aabc2; font-style: normal; font-size: 18px; }
.public-links a:hover { color: var(--blue); background: var(--blue-pale); }
.public-links a:hover i { color: var(--orange); transform: translateX(2px); }
.status-dot { display: block; width: 8px; height: 8px; border-radius: 50%; background: #aeb9c8; box-shadow: 0 0 0 2px rgba(174,185,200,.16); }
.status-dot.online { background: #35ad4a; box-shadow: 0 0 0 2px rgba(53,173,74,.14); }
.status-dot.offline { background: #dc3d3d; box-shadow: 0 0 0 2px rgba(220,61,61,.14); }
.status-dot.checking { animation: status-pulse 1.1s ease-in-out infinite; }
@keyframes status-pulse { 50% { opacity: .38; } }
.public-footer { width: min(1380px, calc(100% - 48px)); margin: 0 auto; padding: 18px 0 28px; border-top: 1px solid var(--line); text-align: right; }
.public-footer a { color: #91a0b5; font-size: 11px; text-decoration: none; }
.public-footer a:hover { color: var(--blue); }

/* Knoppen en formulieren */
.button { min-height: 39px; padding: 8px 14px; color: var(--blue-dark); background: #fff; border: 1px solid var(--line); cursor: pointer; font-weight: 600; }
.button:hover { color: var(--blue); background: var(--blue-pale); border-color: #aabfdb; }
.button-primary { color: #fff; background: var(--green); border-color: var(--green); }
.button-primary:hover { color: #fff; background: #56ae36; border-color: #56ae36; }
.button-wide { width: 100%; margin-top: 7px; }
label { display: block; margin: 14px 0; font-size: 12px; font-weight: 600; }
label small { color: var(--muted); font-weight: 400; }
input, select { width: 100%; height: 43px; margin-top: 6px; padding: 0 12px; color: var(--blue-dark); background: #fff; border: 1px solid #bfd0e5; outline: none; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(63,101,174,.1); }

/* Login */
.login-page { display: grid; place-items: center; border-top: 2px solid rgba(247,147,33,.24); }
.login-shell { width: 100%; padding: 32px 18px; }
.login-card { width: min(420px, 100%); margin: 0 auto; padding: 34px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 50px rgba(20,41,77,.10); }
.login-logo { width: 145px; height: 92px; margin-bottom: 10px; }
.login-logo .brand-word { font-size: 76px; letter-spacing: -11px; }
.login-logo .brand-word b:last-child { margin-left: 8px; font-size: 86px; }
.login-logo .brand-dots { top: -9px; left: 55px; gap: 9px; }
.login-logo .brand-dots i { width: 12px; height: 12px; }
.login-card h1 { margin: 0; color: var(--blue); font-size: 27px; }
.login-card > p { margin: 3px 0 23px; color: var(--muted); }
.login-error { padding: 10px 12px; color: #912b2b; background: #fff1f1; border-left: 3px solid #c74343; font-size: 12px; }

/* Beheer */
.admin-header { position: sticky; z-index: 10; top: 0; display: grid; grid-template-columns: 90px 1fr auto; gap: 20px; align-items: center; min-height: 70px; padding: 12px max(24px, calc((100vw - 1180px) / 2)); background: rgba(255,255,255,.97); border-top: 2px solid rgba(247,147,33,.24); border-bottom: 1px solid var(--line); }
.admin-header > div strong, .admin-header > div span { display: block; }
.admin-header > div strong { color: var(--blue); }
.admin-header > div span { color: var(--muted); font-size: 11px; }
.admin-header nav { display: flex; gap: 8px; }
.admin-header nav a { padding: 8px 10px; color: var(--blue); border: 1px solid var(--line); text-decoration: none; font-size: 11px; font-weight: 600; }
.admin-header nav a:hover { background: var(--blue-pale); }
.admin-main { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 28px 0 60px; }
.admin-toolbar { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 18px; }
.admin-toolbar h1 { margin: 0; color: var(--blue); font-size: 25px; }
.admin-toolbar p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.admin-toolbar > div:last-child { display: flex; gap: 8px; }
.admin-grid { display: grid; gap: 13px; }
.admin-category { overflow: hidden; background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--blue); box-shadow: var(--shadow); }
.admin-category:nth-child(3n+2) { border-left-color: var(--green); }
.admin-category:nth-child(3n) { border-left-color: var(--orange); }
.admin-category.dragging, .admin-item.dragging { opacity: .35; }
.admin-category-header { display: grid; grid-template-columns: 25px 1fr auto; gap: 8px; align-items: center; min-height: 52px; padding: 7px 10px; background: #f8faff; border-bottom: 1px solid var(--line); cursor: grab; }
.admin-category-header h2 { margin: 0; color: var(--blue); font-size: 14px; }
.admin-category-header small { display: block; color: var(--muted); font-size: 10px; }
.drag-handle { color: #9caac0; cursor: grab; font-weight: 700; letter-spacing: -2px; }
.row-actions { display: flex; gap: 5px; }
.row-actions button { padding: 5px 8px; color: var(--blue); background: #fff; border: 1px solid var(--line); cursor: pointer; font-size: 10px; font-weight: 600; }
.row-actions button:hover { background: var(--blue-pale); }
.row-actions .danger { color: #a43c3c; }
.row-actions .danger:hover { background: #fff0f0; border-color: #efcaca; }
.admin-items { min-height: 10px; }
.admin-items.drop-target { background: #fff7e9; }
.admin-item { display: grid; grid-template-columns: 25px minmax(0, 1fr) auto; gap: 8px; align-items: center; min-height: 46px; padding: 6px 10px; cursor: grab; }
.admin-item + .admin-item { border-top: 1px solid #e9eef5; }
.admin-item-copy { min-width: 0; }
.admin-item-copy strong, .admin-item-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-item-copy strong { font-size: 12px; }
.admin-item-copy span { color: var(--muted); font-size: 10px; }
.admin-add { width: 100%; height: 35px; color: var(--blue); background: #fafcff; border: 0; border-top: 1px dashed #c5d4e7; cursor: pointer; font-size: 11px; font-weight: 600; }
.admin-add:hover { background: var(--blue-pale); }
.admin-empty { padding: 50px; color: var(--muted); background: #fff; border: 1px dashed #b9cce3; text-align: center; }

/* Dialoog */
dialog { width: min(500px, calc(100% - 28px)); padding: 0; color: var(--blue-dark); background: #fff; border: 1px solid var(--line); box-shadow: 0 25px 80px rgba(20,41,77,.24); }
dialog::backdrop { background: rgba(20,41,77,.38); backdrop-filter: blur(2px); }
dialog form { padding: 22px; }
dialog header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 18px; }
dialog h2 { margin: 0; color: var(--blue); font-size: 21px; }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 600; }
.close { width: 30px; height: 30px; padding: 0; color: var(--muted); background: transparent; border: 0; cursor: pointer; font-size: 24px; }
dialog footer { display: flex; justify-content: end; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.toast { position: fixed; z-index: 30; right: 22px; bottom: 22px; max-width: 350px; padding: 11px 15px; color: #fff; background: var(--blue-dark); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(10px); transition: .18s; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: #a33333; }

@media (max-width: 680px) {
    .public-main, .public-footer, .admin-main { width: calc(100% - 28px); }
    .public-grid { grid-template-columns: 1fr; }
    .admin-header { position: static; grid-template-columns: 70px 1fr; padding: 12px 14px; }
    .admin-header nav { grid-column: 1 / -1; }
    .admin-toolbar { align-items: start; flex-direction: column; }
    .admin-toolbar > div:last-child { width: 100%; }
    .admin-toolbar .button { flex: 1; }
    .row-actions button { font-size: 0; }
    .row-actions button:first-child::after { content: '✎'; font-size: 14px; }
    .row-actions button:last-child::after { content: '×'; font-size: 16px; }
    .login-card { padding: 28px 24px; }
}
