:root {
    --navy: #142233;
    --navy-2: #1e3149;
    --orange: #ef7f02;
    --orange-text: #b45a00;
    --bg: #f4f6f9;
    --card: #ffffff;
    --line: #e2e7ee;
    --text: #142233;
    --muted: #5d6b7c;
    --green: #1f8a4c;
    --red: #c0392b;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(20, 34, 51, .06), 0 6px 20px rgba(20, 34, 51, .06);
    --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.5; }
a { color: inherit; }
h1 { font-size: 28px; margin: 0 0 8px; letter-spacing: -.02em; }
h2 { font-size: 18px; margin: 0 0 8px; }
h3 { font-size: 15px; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--red); font-size: 13px; margin: 6px 0 0; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* topbar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px; padding: 0 20px; height: 56px;
    background: var(--navy); color: #fff; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-size: 16px; color: inherit; }
.brand strong { color: var(--orange); }
.brand-mark { width: 14px; height: 14px; background: var(--orange); transform: rotate(45deg); border-radius: 2px; }
.brand-lg { font-size: 22px; margin-bottom: 8px; }
.topnav { display: flex; gap: 4px; }
.topnav a { text-decoration: none; padding: 6px 12px; border-radius: 8px; color: #c9d3df; }
.topnav a.is-active, .topnav a:hover { background: var(--navy-2); color: #fff; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar .link { color: #c9d3df; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px;
    background: var(--navy-2); color: #fff; text-decoration: none; }
.card .pill, .wrap .pill { background: var(--bg); color: var(--text); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #8a96a5; }
.pill.is-online .dot { background: #33d17a; box-shadow: 0 0 0 3px rgba(51, 209, 122, .25); }
.pill.is-offline .dot { background: #e5a50a; }

.flash { margin: 16px auto 0; max-width: 1200px; padding: 10px 16px; border-radius: 10px; background: #fff4e5; border: 1px solid #f5c98a; }
.flash-error { background: #fdecea; border-color: #f2b8b1; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 10px;
    padding: 9px 16px; font: 600 14px var(--font); cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--orange); color: var(--navy); }
.btn-primary:hover { background: #ff9a2e; }
.btn-secondary { background: #fff; border-color: var(--line); color: var(--navy); }
.btn-secondary:hover { border-color: var(--navy); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--navy); background: rgba(20, 34, 51, .05); }
.btn-danger { background: #fff; border-color: #f2b8b1; color: var(--red); }
.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; color: var(--muted); }
input, textarea, select { width: 100%; font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text); }
textarea { resize: vertical; }
label { display: block; font-weight: 600; font-size: 13px; }
label input, label textarea { margin-top: 4px; font-weight: 400; font-size: 15px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
label.check input { width: auto; margin: 0; }
.stack > * + * { margin-top: 12px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* pages */
.wrap { max-width: 1200px; margin: 0 auto; padding: 32px 20px 64px; }
.wrap-narrow { max-width: 820px; }
.intro { max-width: 760px; margin-bottom: 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.proto-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.proto-shot { position: relative; display: block; aspect-ratio: 16 / 10; background: var(--navy); overflow: hidden; }
.proto-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; transition: transform .4s; }
.proto-card:hover .proto-shot img { transform: scale(1.02); }
.proto-shot-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 24px; font-weight: 700; }
.proto-shot .badge { position: absolute; left: 12px; top: 12px; }
.proto-body { padding: 16px 20px 0; flex: 1; }
.proto-body h2 a { text-decoration: none; }
.proto-body p { margin: 0 0 6px; }
.proto-actions { display: flex; gap: 8px; padding: 16px 20px 20px; align-items: flex-start; }
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; left: 0; top: calc(100% + 6px); width: 280px; background: #fff; border: 1px solid var(--line);
    border-radius: 12px; box-shadow: var(--shadow); padding: 14px; z-index: 5; display: grid; gap: 12px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--navy); }
.login-card { width: 100%; max-width: 380px; }
.login-card > * + * { margin-top: 14px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat-value { display: block; font-size: 24px; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 13px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.notice { font-size: 13px; background: #fff4e5; border-radius: 8px; padding: 8px 10px; margin: 0 0 8px; }

/* workspace */
.page-prototype { overflow: hidden; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 420px; height: calc(100vh - 56px); }
.stage { display: flex; flex-direction: column; min-width: 0; background: #dfe4ea; }
.stage-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--line); }
.stage-title { white-space: nowrap; }
.stage-path { font: 13px ui-monospace, Consolas, monospace; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.frame-state { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    background: rgba(244, 246, 249, .92); color: var(--muted); text-align: center; padding: 24px; }
.frame-state p { margin: 0; max-width: 420px; }
.frame-state.is-error .spinner { display: none; }
.frame-state.is-error p { color: var(--text); font-weight: 600; }
.stage-frame { position: relative; flex: 1; display: flex; justify-content: center; padding: 0; overflow: hidden; transition: padding .2s; }
.stage-frame iframe { width: 100%; height: 100%; border: 0; background: #fff; transition: width .25s; }
.stage-frame.is-mobile { padding: 16px; }
.stage-frame.is-mobile iframe { width: 390px; border-radius: 18px; box-shadow: 0 10px 40px rgba(0, 0, 0, .2); }
.is-picking .stage-frame { box-shadow: inset 0 0 0 3px var(--orange); }
.pick-hint { display: none; font-size: 13px; font-weight: 600; color: var(--orange-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.is-picking .pick-hint { display: inline; }
.is-picking .stage-path { display: none; }
.is-picking [data-pick] { background: var(--orange); border-color: var(--orange); }
.seg { display: inline-flex; background: var(--bg); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: none; padding: 5px 10px; border-radius: 6px; font: 600 12px var(--font); color: var(--muted); cursor: pointer; }
.seg button.is-active { background: #fff; color: var(--navy); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.seg-sm button { padding: 3px 8px; }

.panel { display: flex; flex-direction: column; min-height: 0; background: #fff; border-left: 1px solid var(--line); }
.panel-head { padding: 16px 18px 10px; border-bottom: 1px solid var(--line); }
.panel-head p { margin: 0; }
.panel-list { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; }
.empty { text-align: center; padding: 32px 12px; }
.composer { border-top: 1px solid var(--line); padding: 12px 14px 14px; background: #fbfcfd; }
.composer-context { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: #fff4e5; border-radius: 8px;
    padding: 6px 10px; font-size: 13px; margin-bottom: 8px; }
.composer-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.composer.is-sending [data-send] { opacity: .6; pointer-events: none; }

.wish { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; }
.wish.is-weg { opacity: .55; }
.wish.is-klaar { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(239, 127, 2, .12); }
.wish-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.wish-text { margin: 8px 0; white-space: pre-wrap; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--muted); }
.badge-busy, .badge-nieuw, .badge-verhaal, .badge-bouwen, .badge-beelden, .badge-akkoord { background: #e8f0fb; color: #1d4f91; }
.badge-klaar { background: #fff0dc; color: var(--orange-text); }
.badge-live { background: #e3f5ea; color: var(--green); }
.badge-fout { background: #fdecea; color: var(--red); }
.wish-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: #1d4f91; background: #f3f7fd;
    border-radius: 8px; padding: 8px 10px; }
.wish-progress .steps { display: flex; gap: 4px; width: 100%; }
.wish-progress .steps span { flex: 1; height: 4px; border-radius: 2px; background: #d3deee; }
.wish-progress .steps span.done { background: #1d4f91; }
.wish-progress .steps span.now { background: linear-gradient(90deg, #1d4f91, #8fb3e6, #1d4f91); background-size: 200% 100%; animation: flow 1.2s linear infinite; }
@keyframes flow { to { background-position: -200% 0; } }
.spinner { width: 14px; height: 14px; border: 2px solid #b8cbe8; border-top-color: #1d4f91; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner, .wish-progress .steps span.now { animation: none; } }
.wish-story { margin-top: 10px; padding: 10px 12px; background: var(--bg); border-radius: 8px; }
.wish-story div { white-space: pre-wrap; }
.criteria { margin: 8px 0 0; padding-left: 18px; font-size: 13px; }
.wish-images { margin-top: 10px; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.compare figure { margin: 0; }
.compare figcaption { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.compare img { width: 100%; display: block; border: 1px solid var(--line); border-radius: 8px; max-height: 260px; object-fit: cover; object-position: top; }
.wish-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.wish-revise { margin-top: 8px; display: grid; gap: 6px; }
.wish-log { margin-top: 8px; }
.wish-log ol { list-style: none; padding: 0; margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.wish-log li { padding: 2px 0; }
.wish-log time { font-variant-numeric: tabular-nums; margin-right: 4px; }
.wish-log .ev-bert { color: var(--navy); font-weight: 600; }

@media (max-width: 900px) {
    .page-prototype { overflow: auto; }
    .workspace { grid-template-columns: 1fr; height: auto; }
    .stage { height: 70vh; }
    .stage-path { display: none; }
    .row, .stats { grid-template-columns: 1fr; }
    .topnav { display: none; }
}
