:root {
  --canvas: #eef0f2;
  --panel: #ffffff;
  --soft: #f6f7f8;
  --ink: #14181b;
  --muted: #5c6670;
  --line: #dde1e5;
  --accent: #0f6b57;
  --accent-ink: #ffffff;
  --accent-soft: #e3f1ed;
  --mark: #e8590c; /* selecteren en "voorstel" */
  --error: #b42318;
  --shadow-sm: 0 1px 2px rgb(16 24 32 / .06), 0 4px 14px rgb(16 24 32 / .06);
  --shadow-lg: 0 18px 50px rgb(16 24 32 / .22), 0 2px 6px rgb(16 24 32 / .08);
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #0c0f11;
    --panel: #171b1e;
    --soft: #1e2327;
    --ink: #e9ecee;
    --muted: #98a2ab;
    --line: #2a3035;
    --accent: #3fb594;
    --accent-ink: #06130f;
    --accent-soft: #17302a;
    --mark: #ff8a3d;
    --error: #ff8a7a;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4), 0 6px 18px rgb(0 0 0 / .35);
    --shadow-lg: 0 18px 50px rgb(0 0 0 / .65);
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--canvas); font-size: 14px; line-height: 1.5; overflow: hidden; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 20px; } h3 { font-size: 16px; }
.muted { color: var(--muted); margin: 0; }
.error { color: var(--error); margin: 0; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- knoppen en velden ---------- */

button, input, textarea, select { font: inherit; color: inherit; }
:is(button, a, input, textarea, select):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); font-weight: 550; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.quiet { border-color: transparent; background: none; color: var(--muted); }
.btn.quiet:hover { background: var(--soft); color: var(--ink); }
.btn:disabled, .icon:disabled { opacity: .4; cursor: default; pointer-events: none; }
.icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.icon:hover { background: var(--soft); color: var(--ink); }
select { height: 34px; padding: 0 30px 0 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%237a848d' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 8px center / 14px; appearance: none; font-weight: 550; max-width: 230px; text-overflow: ellipsis; cursor: pointer; }
select:hover { background-color: var(--soft); }
select.plain { border-color: transparent; background-color: transparent; font-weight: 650; }
input, textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }

.pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill:empty { display: none; }
.pill[data-status="concept"], .pill.warn { background: color-mix(in srgb, var(--mark) 14%, transparent); color: var(--mark); }
.pill[data-status="live"] { background: var(--accent-soft); color: var(--accent); }
.logo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 750; font-size: 15px; flex: none; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px; display: grid; gap: 14px; box-shadow: var(--shadow-sm); }
.login { height: 100%; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(380px, 100%); }
.login-brand { display: flex; align-items: center; gap: 10px; }
.login .btn { height: 40px; }

/* ---------- opbouw: balk boven, website eronder, chat eroverheen ---------- */

.app { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); min-height: 52px; }
.bar-group { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar-group.end { justify-content: flex-end; }
.site { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.history { display: flex; align-items: center; gap: 2px; padding: 0 4px; height: 34px; border: 1px solid var(--line); border-radius: 8px; }
.history .icon { width: 28px; height: 28px; }
.version { font-size: 12px; color: var(--muted); min-width: 74px; text-align: center; font-variant-numeric: tabular-nums; }
.seg { display: flex; padding: 3px; gap: 2px; height: 34px; border-radius: 8px; background: var(--soft); border: 1px solid var(--line); }
.seg button { border: 0; border-radius: 6px; background: none; color: var(--muted); padding: 0 12px; font-weight: 550; cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgb(16 24 32 / .12); }
#pick[aria-pressed="true"], #edit-text[aria-pressed="true"] { background: var(--mark); border-color: var(--mark); color: #fff; }

/* Elk apparaat is een venster op de echte pagina. app.js zet er kaders in en schaalt die naar de ruimte. */
.stage { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 18px; padding: 18px; min-height: 0; }
.stage[data-device="beide"] { grid-template-columns: minmax(0, 1fr) auto; }
.stage[data-device="computer"] .phone, .stage[data-device="telefoon"] .desk { display: none; }
.device { display: flex; flex-direction: column; width: 100%; min-width: 0; min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-sm); overflow: hidden; }
.chrome { display: flex; align-items: center; gap: 12px; height: 34px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--soft); flex: none; }
.dots { display: flex; gap: 6px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.addr { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 2px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device.phone { width: 414px; max-height: 880px; align-self: center; height: 100%; padding: 11px; border-radius: 40px; background: #0d1113; border-color: #0d1113; }
.device.phone .view { border-radius: 30px; }
.view { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #fff; }
.view iframe { position: absolute; top: 0; left: 0; border: 0; background: #fff; transform-origin: 0 0; }
/* Een kader dat nog laadt blijft onzichtbaar tot de pagina klaar is: geen half opgemaakte pagina in beeld. */
.view iframe.pending,
.stage[data-layer="live"] iframe[data-layer="concept"],
.stage[data-layer="concept"] iframe[data-layer="live"] { visibility: hidden; pointer-events: none; }
.view.loading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, #f1f3f4 40%, #fafbfb 50%, #f1f3f4 60%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }

.working { position: absolute; z-index: 4; top: 28px; left: 50%; translate: -50% 0; display: flex; align-items: center; gap: 9px; padding: 7px 14px; border-radius: 99px; background: var(--ink); color: var(--panel); font-size: 13px; font-weight: 550; box-shadow: var(--shadow-lg); white-space: nowrap; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--mark); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.7); } }
.empty { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; background: var(--canvas); color: var(--muted); padding: 24px; text-align: center; }

/* ---------- chat ---------- */

.chatbox { position: fixed; z-index: 10; left: 22px; bottom: 22px; width: min(400px, calc(100vw - 44px)); max-height: min(560px, calc(100vh - 130px)); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.chatbox > header { display: flex; align-items: center; gap: 2px; padding: 8px 8px 8px 6px; border-bottom: 1px solid var(--line); }
.chatbox > header select { flex: 1; min-width: 0; max-width: none; }
.fab { position: fixed; z-index: 10; left: 22px; bottom: 22px; height: 44px; padding: 0 20px; border-radius: 99px; box-shadow: var(--shadow-lg); }

.messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 96px; }
.msg { max-width: 92%; padding: 9px 13px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--accent-soft); border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--soft); border-bottom-left-radius: 4px; }
.msg.error { align-self: flex-start; color: var(--error); border: 1px solid color-mix(in srgb, var(--error) 45%, transparent); }
.msg.hint { align-self: center; color: var(--muted); text-align: center; max-width: 320px; padding: 18px 6px; }
.msg.info { align-self: center; color: var(--muted); font-size: 12px; padding: 0; }
.msg .note { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Wat de assistent aan het doen is: een lijst stappen, tijdens het werk open, daarna ingeklapt. */
.activity { align-self: stretch; font-size: 13px; color: var(--muted); }
.activity summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.activity summary::-webkit-details-marker { display: none; }
.activity summary::before { content: "›"; transition: rotate .15s; }
.activity[open] summary::before { rotate: 90deg; }
.activity ol { list-style: none; margin: 6px 0 0; padding: 0 0 0 4px; display: grid; gap: 5px; }
.activity li { display: flex; align-items: baseline; gap: 8px; }
.activity li::before { content: "✓"; color: var(--accent); font-weight: 700; width: 12px; flex: none; text-align: center; }
.activity li.running::before { content: ""; align-self: center; width: 10px; height: 10px; margin: 0 1px; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent; animation: spin .8s linear infinite; }
.activity li.failed::before { content: "!"; color: var(--mark); }
.activity li.running { color: var(--ink); }
.activity li small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .activity li.running::before, .pulse, .view.loading::after { animation: none; } }

.note-line { margin: 0; font-size: 12px; color: var(--muted); padding: 0 14px 8px; }
.note-line:empty { display: none; }
.composer { display: grid; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; max-height: 150px; min-height: 38px; border-radius: 12px; background: var(--soft); }
.send { width: 38px; height: 38px; padding: 0; border-radius: 12px; }
.picked { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 2px 2px 10px; border-radius: 8px; background: color-mix(in srgb, var(--mark) 12%, transparent); color: var(--ink); }
.picked span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked .icon { width: 26px; height: 26px; }

.files { display: flex; flex-wrap: wrap; gap: 6px; }
.file { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; font-size: 12px; padding: 2px 2px 2px 9px; border-radius: 8px; background: var(--soft); border: 1px solid var(--line); }
.file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.file .icon { width: 22px; height: 22px; }
.composer-row > .icon { height: 38px; }

/* Lijsten in de vensters "Wat verandert er?" en "Delen". */
dialog.sheet { width: min(560px, calc(100% - 32px)); max-height: min(720px, calc(100% - 48px)); }
.sheet .card { max-height: inherit; overflow-y: auto; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet input { flex: 1; min-width: 0; height: 34px; padding: 0 10px; background: var(--soft); }
.changes { display: grid; gap: 10px; }
.change { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; }
.change .kind { font-size: 11px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.change .before { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--error) 70%, transparent); }
.change .after { background: var(--accent-soft); border-radius: 6px; padding: 3px 7px; margin: 0 -7px; }
.change p { margin: 0; overflow-wrap: anywhere; }

dialog { border: 0; padding: 0; background: none; width: min(430px, calc(100% - 32px)); }
dialog::backdrop { background: rgb(8 12 16 / .5); }
.row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* Smal scherm: alleen de telefoonweergave, chat als blad onderaan. */
@media (max-width: 860px) {
  #device, .bar .logo { display: none; }
  .stage, .stage[data-device] { grid-template-columns: minmax(0, 1fr); padding: 0; }
  .stage .desk { display: none !important; }
  .stage .phone { display: flex !important; width: 100%; max-height: none; padding: 0; border: 0; border-radius: 0; }
  .device.phone .view { border-radius: 0; }
  .chatbox { left: 0; right: 0; bottom: 0; width: auto; max-height: 62vh; border-radius: 16px 16px 0 0; }
  .fab { left: 16px; bottom: 16px; }
}
