/* ==========================================================================
   De Bandenberg BV — beheerportaal
   ========================================================================== */

:root {
    --accent: #fdac45;
    --accent-600: #f5951f;
    --ink: #241708;
    --sidebar: #0d0600;
    --sidebar-2: #17100a;
    --bg: #f5f3f0;
    --card: #ffffff;
    --line: #e7e2db;
    --muted: #7d7466;
    --radius: 14px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
body.admin { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink); }
a { color: inherit; text-decoration: none; }

/* Echte inline-tekstlinks: oranje, alleen onderstreept bij hover */
.lead a, .help a, .msg-body a, .flash a, .callout a, .admin-content p a, .contact-list a {
    color: var(--accent-600); font-weight: 600;
}
.lead a:hover, .help a:hover, .msg-body a:hover, .flash a:hover, .callout a:hover, .admin-content p a:hover {
    text-decoration: underline;
}

.brand-emblem {
    display: inline-grid; place-items: center;
    width: 34px; height: 34px; border-radius: 8px;
    background: var(--accent); color: #2a1a05; font-weight: 900;
    transform: skewX(-6deg); flex: 0 0 auto;
}

/* ---------- Layout ---------- */
.admin { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 264px; flex: 0 0 264px;
    background: linear-gradient(180deg, #140d06, #0d0600);
    color: #f7fafc;
    display: flex; flex-direction: column;
    padding: 1.1rem .9rem 1rem;
    position: sticky; top: 0; height: 100vh;
    border-right: 1px solid rgba(255,255,255,.06);
}
.admin-brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.05rem; padding: .4rem .5rem 1rem; margin-bottom: .3rem; border-bottom: 1px solid rgba(255,255,255,.07); }
.admin-nav { display: flex; flex-direction: column; gap: .12rem; flex: 1; overflow-y: auto; }
.admin-nav-label { font-size: .67rem; text-transform: uppercase; letter-spacing: .09em; color: rgba(255,255,255,.36); margin: 1rem .7rem .35rem; font-weight: 700; }
.admin-nav a { display: flex; align-items: center; gap: .7rem; padding: .56rem .7rem; border-radius: 9px; color: rgba(255,255,255,.78); font-size: .9rem; font-weight: 500; transition: background .12s, color .12s; }
.admin-nav a .icon { color: rgba(255,255,255,.5); flex: 0 0 auto; transition: color .12s; }
.admin-nav a > span:first-of-type { flex: 1; }
.admin-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.admin-nav a:hover .icon { color: var(--accent); }
.admin-nav a.active { background: var(--accent); color: #2a1a05; font-weight: 700; box-shadow: 0 6px 16px rgba(253,172,69,.22); }
.admin-nav a.active .icon { color: #2a1a05; }
.nav-ext { opacity: .5; }

.admin-logout { border-top: 1px solid rgba(255,255,255,.09); padding-top: .8rem; margin-top: .6rem; }
.admin-user { display: flex; align-items: center; gap: .6rem; margin-bottom: .7rem; padding: 0 .3rem; }
.admin-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #2a1a05; font-weight: 800; flex: 0 0 auto; }
.admin-user-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.admin-user-meta strong { font-size: .85rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-logout button { display: flex; align-items: center; justify-content: center; gap: .4rem; width: 100%; padding: .55rem; background: rgba(255,255,255,.07); color: rgba(255,255,255,.85); border: 1px solid rgba(255,255,255,.08); border-radius: 9px; cursor: pointer; font-weight: 600; font-size: .85rem; }
.admin-logout button:hover { background: rgba(255,255,255,.14); color: #fff; }
.admin-logout button .icon { transform: rotate(90deg); }

.admin-main { flex: 1; min-width: 0; padding: 1.6rem 2.2rem 3rem; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.6rem; padding-bottom: 1.1rem; border-bottom: 1px solid var(--line); }
.admin-topbar h1 { font-size: 1.45rem; margin: 0; letter-spacing: -.01em; }
.topbar-actions { display: flex; align-items: center; gap: .8rem; flex-shrink: 0; }
.btn-back-site { display: inline-flex; align-items: center; gap: .45rem; padding: .55rem 1.1rem; border-radius: 999px; font-weight: 700; font-size: .88rem; color: var(--ink); background: #fff; border: 1px solid var(--line); text-decoration: none; transition: border-color .14s, box-shadow .14s, color .14s; }
.btn-back-site:hover { border-color: var(--accent); color: var(--accent-600); box-shadow: 0 6px 16px rgba(20,15,8,.07); }
.btn-back-site .icon { color: var(--accent-600); }
.admin-content { max-width: 920px; }
.lead { color: var(--muted); margin-top: 0; font-size: 1rem; line-height: 1.6; }

.admin-menu-toggle { display: none; position: fixed; top: 12px; left: 12px; z-index: 60; background: var(--sidebar); color: #fff; border: 0; width: 42px; height: 42px; border-radius: 10px; font-size: 20px; cursor: pointer; }

/* ---------- Flash ---------- */
.flash { padding: .85rem 1.1rem; border-radius: 11px; margin-bottom: 1.2rem; font-size: .92rem; border-left-width: 4px; border-left-style: solid; box-shadow: 0 1px 2px rgba(20,15,8,.04); }
.flash-ok { background: #e9f7ef; border: 1px solid #b6e4c6; border-left-color: #2f9e5f; color: #1c6b3a; }
.flash-error { background: #fdecec; border: 1px solid #f3b6b6; border-left-color: #d64545; color: #a12a2a; }

/* ---------- Tiles / cards ---------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.1rem; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1.4rem; display: flex; flex-direction: column; min-height: 148px; box-shadow: 0 1px 2px rgba(20,15,8,.04); transition: transform .14s, box-shadow .14s, border-color .14s; }
.tile:hover { border-color: var(--accent); box-shadow: 0 14px 30px rgba(20,15,8,.09); transform: translateY(-3px); }
.tile-icon { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: rgba(253,172,69,.16); color: var(--accent-600); margin-bottom: .6rem; }
.tile h3 { margin: .1rem 0 .45rem; font-size: 1.02rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.tile p { margin: 0 0 1rem; color: var(--muted); font-size: .9rem; line-height: 1.55; flex: 1; }
.tile-cta { color: var(--accent-600); font-weight: 700; font-size: .88rem; margin-top: auto; }
.tile-highlight { background: linear-gradient(135deg, #fff8ec, #fff); border-color: var(--accent); }

/* Nav badge + rol-tag */
.nav-badge { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; text-align: center; background: var(--accent); color: #2a1a05; border-radius: 999px; font-size: .72rem; font-weight: 800; padding: 0 5px; margin-left: .3rem; }
.role-tag { display: inline-block; background: rgba(255,255,255,.12); color: rgba(255,255,255,.8); border-radius: 6px; padding: 1px 6px; font-size: .68rem; font-weight: 700; vertical-align: middle; }
.muted-sm { color: var(--muted); font-size: .85rem; }
.pager { margin-top: 1rem; }

/* Inbox */
.msg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.msg-body { white-space: pre-line; background: #faf8f5; border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.1rem; line-height: 1.6; }

/* Mailsjabloon-previews */
.mail-previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.2rem; }
.mail-frame { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #ece9e4; }
.mail-frame iframe { width: 100%; height: 460px; border: 0; display: block; }

/* Systeem / databasedokter */
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.1rem; margin-bottom: 1.2rem; }
.status-grid .card-panel { margin: 0; }
.mono-list { list-style: none; margin: 0 0 1rem; padding: .7rem .9rem; background: #faf8f5; border: 1px solid var(--line); border-radius: 10px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82rem; }
.mono-list li { padding: .15rem 0; }
.artisan-out { background: #1b120a; color: #e8e2d8; padding: 1rem 1.1rem; border-radius: 10px; font-size: .82rem; line-height: 1.5; overflow-x: auto; white-space: pre-wrap; margin: 0; }

/* ---------- Pills ---------- */
.pill { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 700; vertical-align: middle; }
.pill-on { background: #d7f2e0; color: #1c6b3a; }
.pill-warn { background: #fdecc8; color: #8a5a0a; }
.pill-off { background: #eceae6; color: #8b8479; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1.1rem; }
.field label { font-weight: 600; font-size: .9rem; }
.field .opt { color: var(--muted); font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=tel], textarea, select {
    width: 100%; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 10px;
    font-family: inherit; font-size: .95rem; background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(253,172,69,.2); }
textarea { resize: vertical; }
.help { font-size: .8rem; color: var(--muted); }
.checkbox { display: inline-flex; align-items: center; gap: .5rem; font-size: .92rem; cursor: pointer; margin-bottom: 1rem; }
.checkbox.small { font-size: .82rem; margin: 0; }
.sep { border: 0; border-top: 1px solid var(--line); margin: 1.6rem 0; }
.sub-h { font-size: 1.1rem; margin: 0 0 .8rem; }
.form-actions { display: flex; gap: 1rem; align-items: center; margin-top: 1.4rem; }

.settings-form, .content-form { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1.5rem 1.6rem; box-shadow: 0 1px 2px rgba(20,15,8,.04); }
.callout { background: #fff8ec; border: 1px solid #f3d9a8; border-radius: 12px; padding: .9rem 1.1rem; margin-bottom: 1.2rem; font-size: .9rem; }
.callout code.copyable { display: inline-block; margin-top: .3rem; background: #fff; border: 1px solid var(--line); padding: .3rem .5rem; border-radius: 6px; user-select: all; }
code { background: #efece7; padding: .1rem .35rem; border-radius: 5px; font-size: .85em; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .62rem 1.35rem; border-radius: 999px; font-weight: 700; border: 0; cursor: pointer; font-size: .92rem; text-decoration: none; transition: background .14s, box-shadow .14s, transform .14s; }
.btn-sm { transition: border-color .14s, color .14s, background .14s; }
.btn-accent { background: var(--accent); color: #2a1a05; box-shadow: 0 6px 16px rgba(253,172,69,.28); }
.btn-accent:hover { background: var(--accent-600); box-shadow: 0 8px 20px rgba(253,172,69,.34); transform: translateY(-1px); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: .45rem .9rem; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: .85rem; cursor: pointer; }
.btn-sm:hover { border-color: var(--accent); color: var(--accent-600); }
.btn-ghost { color: var(--accent-600); font-weight: 600; text-decoration: none; }
.inline-form { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; min-width: 220px; }

/* ---------- Content editor: panels & repeaters ---------- */
.card-panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1.4rem 1.5rem; margin-bottom: 1.2rem; box-shadow: 0 1px 2px rgba(20,15,8,.04); }
.content-form .card-panel { box-shadow: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.panel-head h2 { font-size: 1.05rem; margin: 0; }
.rep-list { display: flex; flex-direction: column; gap: .9rem; }
.rep-row { display: flex; gap: .8rem; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 1rem; background: #fbfaf8; }
.rep-row-fields { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .8rem; }
.rep-row-fields .field { margin: 0; }
.rep-remove { background: #fff; border: 1px solid var(--line); color: #a12a2a; border-radius: 8px; width: 34px; height: 34px; cursor: pointer; flex: 0 0 auto; }
.rep-remove:hover { background: #fdecec; border-color: #f3b6b6; }

/* ---------- Image fields ---------- */
.field-image .img-field { display: flex; gap: 1rem; align-items: flex-start; }
.img-preview { width: 120px; height: 84px; border: 1px dashed var(--line); border-radius: 10px; display: grid; place-items: center; overflow: hidden; background: #faf8f5; flex: 0 0 auto; }
.img-preview.large { width: 220px; height: 130px; }
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.img-empty { color: var(--muted); font-size: .78rem; }
.img-controls { display: flex; flex-direction: column; gap: .5rem; }

/* ---------- Cloudflare ---------- */
.cf-actions { display: flex; gap: .8rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.cf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; margin: 0; }
.kv dt { color: var(--muted); font-size: .85rem; }
.kv dd { margin: 0; font-weight: 600; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 1px 2px rgba(20,15,8,.04); }
.data-table { width: 100%; border-collapse: collapse; font-size: .89rem; background: #fff; }
.data-table th, .data-table td { text-align: left; padding: .75rem .9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .1s; }
.data-table tbody tr:hover { background: #faf8f5; }
.data-table th { background: #faf8f5; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.data-table .mono, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.tag { background: #efece7; padding: .1rem .45rem; border-radius: 5px; font-size: .78rem; font-weight: 700; }

/* ---------- Login ---------- */
.login-page { display: grid; place-items: center; min-height: 100vh; background: radial-gradient(1000px 500px at 50% -10%, #241708, #0d0600); }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 2rem; box-shadow: 0 24px 60px rgba(0,0,0,.4); }
.login-head { text-align: center; margin-bottom: 1.4rem; }
.login-head .brand-emblem { width: 46px; height: 46px; font-size: 1.3rem; margin-bottom: .6rem; }
.login-head h1 { font-size: 1.2rem; margin: .3rem 0; }
.login-head p { color: var(--muted); margin: 0; font-size: .9rem; }
.login-form { display: flex; flex-direction: column; }
.btn-ms { display: flex; align-items: center; justify-content: center; gap: .6rem; width: 100%; padding: .7rem; border: 1px solid var(--line); border-radius: 10px; font-weight: 600; background: #fff; margin-bottom: 1rem; text-decoration: none; color: var(--ink); }
.btn-ms:hover { background: #faf8f5; }
.login-divider { text-align: center; position: relative; margin: 1rem 0; color: var(--muted); font-size: .82rem; }
.login-divider::before { content: ""; position: absolute; top: 50%; left: 0; right: 0; border-top: 1px solid var(--line); }
.login-divider span { background: #fff; padding: 0 .7rem; position: relative; }
.login-back { text-align: center; margin: 1.2rem 0 0; font-size: .88rem; }
.login-back a { color: var(--muted); }

/* Installatie-wizard */
.setup-card { max-width: 480px; }
.setup-card .login-head h1 { font-size: 1.15rem; }
.setup-step-done { text-align: center; }
.setup-check { color: #1c6b3a; font-weight: 700; margin: 0 0 1rem; }
.setup-local { margin-top: .4rem; border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; }
.setup-local summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--muted); }
.setup-local[open] summary { margin-bottom: .5rem; color: var(--ink); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .cf-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .admin-menu-toggle { display: block; }
    .admin-sidebar { position: fixed; z-index: 55; left: 0; top: 0; transform: translateX(-105%); transition: transform .22s; box-shadow: 0 0 40px rgba(0,0,0,.4); }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { padding: 4rem 1.2rem 3rem; }
}
