/* Kleuren komen live van de website (Kadence global palette) en worden
   door app.js op :root gezet. Dit zijn alleen reservewaarden. */
:root {
  --global-palette1: #3d6b4f;   /* accent / knoppen */
  --global-palette3: #2a2622;   /* tekst */
  --global-palette8: #f6f1e7;   /* pagina-achtergrond */
  --global-palette9: #ffffff;   /* vlakken */
  --line: #e3d8c3;              /* randkleur van de website */
  --muted: color-mix(in srgb, var(--global-palette3) 62%, var(--global-palette8));
  --accent-soft: color-mix(in srgb, var(--global-palette1) 12%, var(--global-palette9));
  --ok: #2f7d4a;
  --warn: #a86a12;
  --err: #b3392f;
  --radius: 12px;
  --pill: 999px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--global-palette3);
  background: var(--global-palette8);
}

* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
h1, h2 { line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
.muted { color: var(--muted); }
small { font-weight: 400; color: var(--muted); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Bovenbalk */
.topbar { background: var(--global-palette9); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; padding-top: env(safe-area-inset-top, 0px); }
.topbar-inner { display: flex; align-items: center; gap: 24px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-logo { height: 40px; width: auto; max-width: 120px; object-fit: contain; }
.brand-name { font-size: 13px; color: var(--muted); }
.brand-app { font-size: 20px; font-weight: 700; }
.tabs { display: flex; gap: 4px; }
.tab { white-space: nowrap; flex: none; border: 0; background: none; font: inherit; padding: 8px 16px; border-radius: var(--pill); cursor: pointer; color: var(--global-palette3); }
.tab.is-active { background: var(--accent-soft); color: var(--global-palette1); font-weight: 600; }
.conn { margin-left: auto;  display: flex; gap: 12px; font-size: 13px; color: var(--muted); }
.conn span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--line); vertical-align: 1px; }
.conn span.on::before { background: var(--ok); }

main.wrap { padding-top: 32px; padding-bottom: 56px; }

/* Knoppen – pilvorm zoals op de website */
.btn { font: inherit; font-weight: 600; border-radius: var(--pill); padding: 10px 22px; cursor: pointer; border: 2px solid var(--global-palette1); transition: filter .15s; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--global-palette1); color: var(--global-palette9); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-outline { background: transparent; color: var(--global-palette1); }
.btn-quiet { background: none; border-color: transparent; color: var(--muted); padding: 8px 12px; font-weight: 500; }
.btn-quiet:hover { color: var(--global-palette3); }
.btn-danger:hover { color: var(--err); }
.btn-block { width: 100%; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--global-palette1) 55%, transparent); outline-offset: 2px; }

/* Indeling */
.layout { display: grid; grid-template-columns: 320px 1fr; gap: 32px; align-items: start; }
.card { background: var(--global-palette9); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; }

/* Lijst met advertenties */
.list-col { position: sticky; top: 96px; }
.filter { font-size: 14px; color: var(--muted); margin: 12px 4px; }
.ad-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: calc(100vh - 220px); overflow: auto; }
.ad-item { display: grid; grid-template-columns: 56px 1fr auto; align-items: start; gap: 12px; padding: 10px; border-radius: var(--radius); background: var(--global-palette9); border: 1px solid var(--line); cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%; }
.ad-item[aria-current="true"] { border-color: var(--global-palette1); box-shadow: inset 0 0 0 1px var(--global-palette1); }
.ad-item.is-sold { opacity: .6; }
.ad-thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--global-palette8); border: 1px solid var(--line); }
.ad-item > span:last-child { min-width: 0; }
.ad-title { font-weight: 600; font-size: 15px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-price { font-size: 14px; color: var(--global-palette1); font-weight: 600; }
.ad-badges { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.badge { font-size: 11px; padding: 1px 8px; border-radius: var(--pill); border: 1px solid var(--line); color: var(--muted); }
.badge.live { border-color: var(--ok); color: var(--ok); }
.badge.fout { border-color: var(--err); color: var(--err); }
.badge.handmatig_verwijderen { border-color: var(--warn); color: var(--warn); }
.empty { color: var(--muted); font-size: 14px; padding: 16px 4px; }

/* Formulier */
.editor-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.lock-note { font-size: 14px; color: var(--warn); }
.grid-2 { display: grid; grid-template-columns: 1fr 160px; gap: 16px; }
.field { display: block; margin-bottom: 18px; }
.field > span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
input[type=text], input[type=password], input:not([type]), textarea {
  width: 100%; font: inherit; color: inherit; padding: 10px 14px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--global-palette9);
}
input:focus, textarea:focus { outline: none; border-color: var(--global-palette1); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; }
fieldset:disabled .dropzone, form.is-locked .dropzone { pointer-events: none; opacity: .5; }
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.check { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }

.photos { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.photo { position: relative; width: 96px; height: 96px; }
.photo img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); }
.photo:first-child img { border: 2px solid var(--global-palette1); }
.photo button { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); background: var(--global-palette9); cursor: pointer; font-size: 14px; line-height: 1; }
.dropzone { display: block; text-align: center; padding: 18px; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted); cursor: pointer; }
.dropzone.is-over { border-color: var(--global-palette1); background: var(--accent-soft); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: var(--pill); border: 1px solid var(--line); cursor: pointer; font-size: 14px; user-select: none; }
.chip input { accent-color: var(--global-palette1); }
.chip:has(input:checked) { border-color: var(--global-palette1); background: var(--accent-soft); color: var(--global-palette1); font-weight: 600; }

/* Kanalen */
.channels { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 8px; }
.channel { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 6px; cursor: pointer; }
.channel:has(input:checked) { border-color: var(--global-palette1); background: var(--accent-soft); }
.channel.is-off { opacity: .55; cursor: not-allowed; }
.channel-top { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.channel-top input { accent-color: var(--global-palette1); width: 18px; height: 18px; }
.channel-state { font-size: 13px; color: var(--muted); }
.channel-state.live { color: var(--ok); }
.channel-state.fout { color: var(--err); }
.channel-state.handmatig_verwijderen { color: var(--warn); }
.channel-state a { color: inherit; }
.danger-row { display: flex; justify-content: space-between; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; gap: 8px; }

/* Voorbeeld */
.preview-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.preview-head h2 { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--pill); padding: 3px; }
.seg button { border: 0; background: none; font: inherit; font-size: 14px; padding: 6px 14px; border-radius: var(--pill); cursor: pointer; color: var(--muted); }
.seg button.is-active { background: var(--global-palette1); color: var(--global-palette9); }

.pv-site { background: var(--global-palette8); padding: 24px; border-radius: var(--radius); }
.pv-site .pv-inner { background: var(--global-palette9); padding: 20px; border-radius: var(--radius); max-width: 640px; }
.pv-site img { width: 100%; aspect-ratio: 3/2; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); }
.pv-site h3 { font-size: 24px; margin: 16px 0 4px; }
.pv-site .pv-price { color: var(--global-palette1); font-weight: 600; font-size: 22px; margin: 0 0 12px; }
.pv-site .pv-snippet { background: var(--global-palette9); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.pv-site .pv-gallery { display: flex; gap: 8px; margin-top: 8px; }
.pv-site .pv-gallery img { width: 80px; height: 80px; aspect-ratio: auto; }

.pv-social { max-width: 470px; border: 1px solid #dbdbdb; border-radius: 8px; background: #fff; color: #1c1e21; font-size: 15px; overflow: hidden; }
.pv-social .pv-who { display: flex; align-items: center; gap: 10px; padding: 12px; font-weight: 600; }
.pv-social .pv-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--global-palette1); color: #fff; display: grid; place-items: center; font-size: 14px; }
.pv-social .pv-text { padding: 0 12px 12px; white-space: pre-wrap; }
.pv-social img { width: 100%; display: block; background: #f0f0f0; }
.pv-social.ig .pv-text { padding: 12px; }
.pv-social .pv-count { font-size: 12px; color: #65676b; padding: 6px 12px; }
.pv-empty { color: var(--muted); padding: 24px; text-align: center; border: 2px dashed var(--line); border-radius: var(--radius); }

/* Vaste teksten */
.snippets-wrap { display: grid; grid-template-columns: 1fr 380px; gap: 32px; align-items: start; }
.snippet-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.snippet { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.snippet strong { display: flex; gap: 8px; align-items: center; }
.snippet p { margin: 0; color: var(--muted); grid-column: 1; white-space: pre-wrap; }
.snippet .actions { grid-row: 1 / span 2; grid-column: 2; display: flex; gap: 4px; align-self: center; }
.tag { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: var(--pill); background: var(--accent-soft); color: var(--global-palette1); }

/* Melding */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--global-palette3); color: var(--global-palette9); padding: 12px 20px; border-radius: var(--pill); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 40px); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--err); }

/* Avatars: foto of initialen in een rondje */
.avatar { width: var(--size, 36px); height: var(--size, 36px); border-radius: 50%; background: var(--av, #7a7a7a); color: #fff;
  display: inline-grid; place-items: center; flex: none; overflow: hidden; font-weight: 600; letter-spacing: .02em;
  font-size: calc(var(--size, 36px) * .36); line-height: 1; user-select: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.ad-by { align-self: center; }

/* Accountmenu */
.me { position: relative; margin-left: 4px; }
.conn[hidden] + .me, .conn[hidden] ~ .me { margin-left: auto; }
.me-btn { border: 0; background: none; padding: 2px; border-radius: 50%; cursor: pointer; display: grid; }
.me-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; padding: 8px; margin: 0; box-shadow: 0 8px 24px rgb(0 0 0 / .08); z-index: 10; }
.me-who { display: flex; gap: 10px; align-items: center; padding: 8px 8px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.me-who > span:last-child { display: flex; flex-direction: column; line-height: 1.3; }
.me-menu button { display: block; width: 100%; text-align: left; font: inherit; border: 0; background: none; padding: 10px 12px; border-radius: 8px; cursor: pointer; color: var(--global-palette3); }
.me-menu button:hover { background: var(--accent-soft); }

/* Profiel, gebruikers, instellingen */
.narrow { max-width: 640px; }
.small { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.profile-photo { display: flex; gap: 20px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.profile-photo-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.profile-photo-actions p { margin: 0; }
label.btn { display: inline-block; }
.users-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.user-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.user { display: grid; grid-template-columns: auto 1fr auto auto; gap: 6px 14px; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.user.is-off .avatar, .user.is-off .user-main { opacity: .55; }
.user-main { display: flex; flex-direction: column; min-width: 0; }
.user-main small { overflow: hidden; text-overflow: ellipsis; }
.user-more { grid-column: 2 / -1; display: flex; gap: 4px; flex-wrap: wrap; margin-left: -12px; }
.user-more:empty { display: none; }
.role { font: inherit; font-size: 14px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--pill); background: var(--global-palette9); color: inherit; }
.switch { position: relative; display: inline-block; width: 46px; height: 28px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span[aria-hidden] { position: absolute; inset: 0; border-radius: var(--pill); background: var(--line); transition: background .15s; }
.switch span[aria-hidden]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .15s; }
.switch input:checked + span { background: var(--global-palette1); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--global-palette1) 55%, transparent); outline-offset: 2px; }
.switch input:disabled + span { opacity: .5; }
.logo-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.app-icon-preview { width: 88px; height: 88px; border-radius: 20px; border: 1px solid var(--line); background: var(--global-palette9); }

/* Inlogpagina */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; padding-top: max(20px, env(safe-area-inset-top)); }
.login-box { width: 100%; max-width: 400px; margin: 0; padding: 32px; }
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand img { max-width: 160px; max-height: 96px; object-fit: contain; margin-bottom: 12px; }
.login-brand h1 { font-size: 24px; margin: 0; }
.form-error { color: var(--err); min-height: 1.5em; margin: 0 0 8px; font-size: 14px; }

@media (max-width: 900px) {
  .layout, .snippets-wrap { grid-template-columns: 1fr; }
  .topbar { position: static; }
  .list-col { position: static; }
  .ad-list { max-height: 320px; }
  .channels { grid-template-columns: 1fr; }
  .conn { display: none; }
  .me { margin-left: auto; }
  .tabs { order: 3; width: 100%; overflow-x: auto; padding-bottom: 8px; }
  .user { grid-template-columns: auto 1fr auto; }
  .user .role { grid-column: 2; justify-self: start; }
  .user .switch { grid-row: 1; grid-column: 3; }
}
@media (max-width: 520px) {
  .grid-2 { grid-template-columns: 1fr; }
  .card { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Google-voorbeeld */
.pv-social.gbp .pv-who { flex-wrap: wrap; }
.pv-social.gbp .pv-who small { width: 100%; font-weight: 400; color: #5f6368; margin-left: 46px; margin-top: -8px; }
.pv-cta { margin: 0 12px 14px; padding: 8px 16px; border-radius: 999px; border: 1px solid #dadce0; color: #1a73e8; font-weight: 600; display: inline-block; font-size: 14px; }

/* Instellingen */
.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: 32px; align-items: start; }
.settings-nav { position: sticky; top: 96px; display: grid; gap: 4px; }
.settings-nav button { display: flex; align-items: center; gap: 10px; text-align: left; font: inherit; border: 0; background: none; padding: 10px 14px; border-radius: 10px; cursor: pointer; color: var(--global-palette3); }
.settings-nav button:hover { background: var(--accent-soft); }
.settings-nav button.is-active { background: var(--global-palette9); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; color: var(--global-palette1); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.dot.on { background: var(--ok); }
.settings-body { max-width: 720px; min-width: 0; }
.settings-body h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.settings-body h3 { margin: 0 0 6px; font-size: 16px; }
.chip-status { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.chip-status.on { border-color: var(--ok); color: var(--ok); }
.help { display: block; margin-top: 6px; color: var(--muted); font-size: 13px; }
.help a, .steps a, .card a { color: var(--global-palette1); }
.lock { font-size: 12px; font-weight: 500; color: var(--ok); margin-left: 6px; }
.clear-secret { display: block; margin-top: 6px; }
.check.small { font-size: 13px; margin: 0; color: var(--muted); }
select { width: 100%; font: inherit; color: inherit; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--global-palette9); }
input[type=url], input[type=number] { width: 100%; font: inherit; color: inherit; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--global-palette9); }
.grid-2.even { grid-template-columns: 1fr 1fr; }
.test-result { margin: 12px 0 0; font-size: 14px; min-height: 0; }
.test-result:empty { display: none; }
.test-result.ok { color: var(--ok); }
.test-result.warn { color: var(--warn); }
.test-result.err { color: var(--err); }
.steps { padding-left: 20px; margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.steps li { margin-bottom: 6px; }
.steps code, .settings-body code { font-size: 13px; background: var(--global-palette8); padding: 1px 6px; border-radius: 6px; word-break: break-all; }
.copy-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.card.note { background: var(--global-palette8); }
.radio-row { display: grid; gap: 10px; margin-bottom: 16px; }
.radio { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.radio:has(input:checked) { border-color: var(--global-palette1); background: var(--accent-soft); }
.radio input { margin-top: 4px; accent-color: var(--global-palette1); }
.radio span { display: flex; flex-direction: column; }
.radio small { color: var(--muted); }
.swatches { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 8px; }
.swatch { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.swatch input { width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 2px; background: var(--global-palette9); cursor: pointer; }
.pick-list { display: grid; gap: 8px; margin-top: 12px; }
.pick { display: flex; flex-direction: column; align-items: flex-start; text-align: left; font: inherit; color: inherit; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--global-palette9); cursor: pointer; }
.pick:hover { border-color: var(--global-palette1); background: var(--accent-soft); }
.pick small { color: var(--muted); }
button.link { border: 0; background: none; padding: 0; font: inherit; color: var(--global-palette1); text-decoration: underline; cursor: pointer; }
a.btn { text-decoration: none; display: inline-block; }
details summary { cursor: pointer; color: var(--muted); margin: 8px 0; }
ul.plain { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; }

/* Logboek */
.log-list { list-style: none; padding: 0; margin: 16px 0 0; }
.log-row { display: grid; grid-template-columns: 96px 150px 1fr; gap: 12px; padding: 10px 4px; border-top: 1px solid var(--line); font-size: 14px; }
.log-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.log-who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-what small { display: block; color: var(--muted); }

@media (max-width: 900px) {
  .settings-layout { grid-template-columns: 1fr; gap: 12px; }
  .settings-nav { position: static; display: flex; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .settings-nav button { white-space: nowrap; flex: none; }
  .log-row { grid-template-columns: 1fr; gap: 2px; }
  .grid-2.even { grid-template-columns: 1fr; }
}
