/* Kleuren van de kaders volgen het Value Proposition-template. */
:root {
  --accent: #C0504D;
  --c-value: #95B3D7;
  --c-rtb: #E5B8B7;
  --c-barrier: #FABF8F;
  --c-discriminator: #FBD4B4;
  --c-competition: #C4BC96;
  --c-market: #CCC0D9;
  --c-problem: #B6DDE8;
  --c-product: #E36C0A;
  --c-pillars: #C0504D;
  --bg: #f5f5f3;
  --surface: #fff;
  --text: #1f2328;
  --muted: #6b7075;
  --border: #e2e2de;
  --good: #2e7d4f;
  --fair: #b7791f;
  --poor: #c0392b;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 1px 3px rgba(0, 0, 0, .04);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); display: flex; min-height: 100vh; }
a { color: #1f5fa8; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: .2rem 0; }
h3 { font-size: 1rem; margin: 0 0 .6rem; display: flex; align-items: center; gap: .5rem; }
h4 { margin: .8rem 0 .4rem; font-size: .9rem; }
code { background: #f0f0ec; padding: 1px 4px; border-radius: 3px; font-size: .85em; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.d-block { display: block; }
.ok { color: var(--good); }
.warn { color: var(--poor); }
.pad { padding: 1rem; }

/* Navigatie */
.sidebar { width: 220px; flex-shrink: 0; background: #23262b; color: #ddd; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { color: #fff; font-weight: 600; padding: 1.1rem 1rem; font-size: 1.05rem; }
.logo { color: var(--accent); }
.sidebar ul { list-style: none; margin: 0; padding: 0 .5rem; overflow-y: auto; flex: 1; }
.sidebar li a { display: block; color: #cfd2d6; padding: .45rem .7rem; border-radius: 6px; }
.sidebar li a:hover { background: #33373d; text-decoration: none; }
.sidebar li a.active { background: var(--accent); color: #fff; }
.sidebar li.group { text-transform: uppercase; font-size: .7rem; letter-spacing: .06em; color: #8a8f96; padding: 1rem .7rem .3rem; }
.sidebar-foot { padding: 1rem; border-top: 1px solid #33373d; display: flex; justify-content: space-between; align-items: center; font-size: .85rem; }
.sidebar-foot .link { color: #cfd2d6; }

.main { flex: 1; padding: 1.5rem 2rem 3rem; max-width: 1280px; min-width: 0; }
.main.wide { max-width: none; }
.main.center { display: flex; align-items: center; justify-content: center; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.crumbs { margin: 0; font-size: .85rem; color: var(--muted); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* Basiscomponenten */
.btn { display: inline-flex; align-items: center; gap: .3rem; border: 1px solid var(--border); background: var(--surface); padding: .45rem .8rem; border-radius: 6px; cursor: pointer; color: var(--text); font: inherit; }
.btn:hover { background: #f0f0ec; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(.95); }
.btn.danger { background: var(--poor); border-color: var(--poor); color: #fff; }
.btn.small { padding: .2rem .55rem; font-size: .85rem; }
.danger-text { color: var(--poor) !important; }
button.link { background: none; border: 0; padding: 0; color: #1f5fa8; cursor: pointer; font: inherit; text-align: left; }
.card, .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card { padding: 1.2rem; }
.panel { padding: 1rem 1.1rem; margin-bottom: 1rem; }
.narrow { max-width: 720px; }
.login { width: 360px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; align-items: start; }
.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: .15rem .5rem; border-radius: 99px; background: #eee; vertical-align: middle; }
.badge.status-draft { background: #eee; }
.badge.status-review { background: #fff1c2; }
.badge.status-approved { background: #d5f0dd; color: var(--good); }
.badge.status-archived { background: #e6e6e6; color: var(--muted); }
.count { font-size: .75rem; color: var(--muted); font-weight: normal; }
.messages { margin-bottom: 1rem; }
.msg { padding: .6rem .9rem; border-radius: 6px; margin-bottom: .4rem; background: #e8f1fb; }
.msg-success { background: #e3f4e8; }
.msg-error { background: #fbe4e1; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: .2rem 0; }
.steps li { margin-bottom: .6rem; }

/* Formulieren */
.form > div, .form fieldset > div { margin-bottom: .8rem; }
.form label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .25rem; }
.form .helptext { display: block; color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.form ul.errorlist, .errorlist { color: var(--poor); padding: 0; list-style: none; margin: .2rem 0; font-size: .85rem; }
input[type=text], input[type=email], input[type=url], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: .45rem .6rem; border: 1px solid #cfcfca; border-radius: 6px; font: inherit; background: #fff;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
.form div:has(> input[type=checkbox]) { display: flex; align-items: center; gap: .5rem; }
.form div:has(> input[type=checkbox]) label { margin: 0; }
.form div[id] > div > label, .form ul label { font-weight: normal; display: flex; gap: .4rem; align-items: baseline; }
.form div[id] { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; padding: .4rem .6rem; }
.form.compact > div { margin-bottom: .4rem; }
.subform { border: 1px solid var(--border); border-radius: 6px; margin-bottom: .6rem; padding: .6rem .8rem; }
.row-actions { display: flex; gap: .5rem; align-items: center; margin-top: .6rem; flex-wrap: wrap; }
.filters { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filters input, .filters select { width: auto; min-width: 180px; }
.check { display: flex; gap: .4rem; align-items: center; padding: .15rem 0; }

/* Tabellen en lijsten */
.table { width: 100%; border-collapse: collapse; padding: 0; }
.table th, .table td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.table tr.overdue td:nth-child(7) { color: var(--poor); font-weight: 600; }
.table tr.done { opacity: .55; }
.table select { width: auto; padding: .2rem .4rem; }
.fields { display: grid; grid-template-columns: 160px 1fr; gap: .5rem 1rem; margin: 0; }
.fields dt { color: var(--muted); }
.fields dd { margin: 0; }
.pager { display: flex; gap: 1rem; }
.stats { display: flex; gap: 1rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1.2rem; display: flex; flex-direction: column; min-width: 150px; }
.stat-value { font-size: 1.8rem; font-weight: 600; }
.stat-label { color: var(--muted); }
.stat.alert .stat-value { color: var(--poor); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.prop-card { color: inherit; border-top: 4px solid var(--accent); }
.prop-card:hover { text-decoration: none; box-shadow: 0 4px 12px rgba(0, 0, 0, .08); }
.prop-card h3 { margin: .5rem 0 .2rem; }
.prop-card-head { display: flex; justify-content: space-between; }
blockquote { margin: .6rem 0; font-style: italic; }
.empty-state { padding: 2rem; text-align: center; }
.score-pill { font-size: .75rem; font-weight: 600; padding: .15rem .5rem; border-radius: 99px; color: #fff; }
.score-good { --score: var(--good); }
.score-fair { --score: var(--fair); }
.score-poor { --score: var(--poor); }
.score-pill { background: var(--score); }
.activity { list-style: none; padding: 0; margin: 0; }
.activity li { padding: .4rem 0; border-bottom: 1px solid #f0f0ec; display: flex; flex-direction: column; }
.activity small { color: var(--muted); }
.prio { font-size: .72rem; padding: .1rem .45rem; border-radius: 4px; background: #eee; }
.prio-high { background: #fbe4e1; color: var(--poor); }
.prio-low { background: #eef3f8; color: var(--muted); }
.avatar { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; background: #5b6b7f; color: #fff; font-size: .65rem; align-items: center; justify-content: center; font-weight: 600; }
.due { font-size: .78rem; color: var(--muted); }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.segmented a { padding: .4rem .8rem; color: var(--text); background: var(--surface); }
.segmented a.active { background: #23262b; color: #fff; }

/* Taken-chips */
.task-chips { list-style: none; padding: 0; margin: 0; }
.task-chip { display: flex; align-items: center; gap: .45rem; padding: .3rem 0; border-bottom: 1px solid #f3f3f0; }
.task-chip a { flex: 1; }
.task-chip.done a { text-decoration: line-through; color: var(--muted); }
.task-chip.overdue .due { color: var(--poor); font-weight: 600; }

/* Documenten */
.doc-list { list-style: none; padding: 0; margin: 0 0 .5rem; }
.doc-list li { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; border-bottom: 1px solid #f3f3f0; }
.doc-list li > a:first-of-type { flex: 1; }
.doc-source { font-size: .68rem; padding: .1rem .4rem; border-radius: 4px; background: #eef3f8; color: #355; white-space: nowrap; }
details summary { cursor: pointer; color: #1f5fa8; margin: .4rem 0; }

/* Canvas */
.canvas-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.canvas { display: flex; flex-direction: column; gap: .6rem; }
.canvas-top {
  display: grid; gap: .6rem; grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas: "value rtb disc" "value barrier disc" "competition market problem";
}
.canvas-bottom { display: grid; gap: .6rem; grid-template-columns: 22fr 78fr; }
.box { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); padding: 0 .8rem .7rem; display: flex; flex-direction: column; min-height: 150px; --box: #ccc; border-top: 0; }
.box-head { background: var(--box); margin: 0 -.8rem; padding: .5rem .8rem; border-radius: var(--radius) var(--radius) 0 0; display: flex; justify-content: space-between; align-items: center; }
.box-head h3 { margin: 0; }
.box-hint { color: var(--muted); font-size: .8rem; margin: .4rem 0; }
.box-value { grid-area: value; --box: var(--c-value); }
.box-rtb { grid-area: rtb; --box: var(--c-rtb); }
.box-barrier { grid-area: barrier; --box: var(--c-barrier); }
.box-discriminator { grid-area: disc; --box: var(--c-discriminator); }
.box-competition { grid-area: competition; --box: var(--c-competition); }
.box-market { grid-area: market; --box: var(--c-market); }
.box-problem { grid-area: problem; --box: var(--c-problem); }
.box-product { --box: var(--c-product); }
.box-pillars { --box: var(--c-pillars); }
.box-product .box-head, .box-pillars .box-head { color: #fff; }

.items { list-style: none; padding: 0; margin: 0 0 .4rem; flex: 1; }
.items .empty { color: var(--muted); font-size: .85rem; padding: .3rem 0; }
.item { display: flex; align-items: flex-start; gap: .3rem; padding: .35rem .2rem; border-bottom: 1px solid #f0f0ec; border-radius: 4px; }
.item:hover { background: #fafaf8; }
.item.status-done .item-title { color: var(--muted); }
.handle { cursor: grab; color: #c4c4c0; font-size: .8rem; padding-top: .15rem; user-select: none; }
.item-body { flex: 1; min-width: 0; }
.item-title { background: none; border: 0; padding: 0; text-align: left; font: inherit; cursor: pointer; color: var(--text); }
.item-title:hover { color: #1f5fa8; text-decoration: underline; }
.item-meta { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .2rem; align-items: center; }
.item-meta:empty { display: none; }
.item-actions { display: flex; gap: .1rem; opacity: 0; transition: opacity .1s; }
.item:hover .item-actions, .item:focus-within .item-actions { opacity: 1; }
.item-actions button { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: .95rem; padding: 0 .25rem; }
.item-actions button:hover { color: var(--text); }
.item.editing { display: block; background: #fafaf8; }
.inline-form { display: flex; flex-wrap: wrap; gap: .3rem; }
.inline-form input[name=title] { flex: 1 1 100%; }
.inline-form select { width: auto; flex: 1; }
.meta { font-size: .72rem; color: var(--muted); }
.meta.warn { color: var(--poor); font-weight: 600; }
.pill { font-size: .68rem; padding: .05rem .4rem; border-radius: 99px; background: #eee; }
.pill-in_progress { background: #fff1c2; }
.pill-done { background: #d5f0dd; color: var(--good); }
.tag { font-size: .68rem; padding: .05rem .4rem; border-radius: 4px; background: #eee; font-weight: 600; }
.tag-value { background: var(--c-value); }
.tag-rtb { background: var(--c-rtb); }
.tag-barrier { background: var(--c-barrier); }
.tag-assumption { background: #ffe3c8; border: 1px dashed #e69a5a; }
.tag-competition { background: var(--c-competition); }
.tag-problem { background: var(--c-problem); }
.pillar-dot { height: 16px; padding: 0 .35rem; border-radius: 99px; background: var(--c-pillars); color: #fff; font-size: .6rem; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.quick-add { display: flex; gap: .3rem; }
.quick-add input { flex: 1; min-width: 0; border-style: dashed; background: #fcfcfb; }
.quick-add select { width: auto; flex: 0 0 auto; padding: .3rem; }

.editable { cursor: text; border-radius: 6px; padding: .4rem; margin: 0 -.4rem; min-height: 2rem; }
.editable:hover { background: #fafaf8; outline: 1px dashed #d8d8d3; }
.placeholder { color: var(--muted); font-style: italic; }
.discriminator { font-size: 1.15rem; font-weight: 600; font-style: normal; line-height: 1.4; margin: .2rem 0; }
.word-count, .word-counter { font-size: .75rem; color: var(--muted); }
.word-count.over, .word-counter.over { color: var(--poor); font-weight: 600; }
.derived { border-top: 1px dashed var(--border); margin-top: auto; }
.derived ul { margin: 0; padding-left: 1.1rem; font-size: .85rem; color: var(--muted); }
.field-form textarea { margin-bottom: .2rem; }
.market-facts { margin: .2rem 0 .5rem; }
.personas { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .5rem; align-items: center; }
.chip { font-size: .8rem; background: #f1edf6; border-radius: 99px; padding: .15rem .55rem; color: var(--text); }
.personas-form { margin-bottom: .5rem; }

.pillars { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: .6rem; margin-top: .6rem; }
.pillar { border: 1px solid var(--border); border-radius: 6px; padding: .5rem .6rem; }
.pillar h4 { margin: 0 0 .4rem; color: var(--c-pillars); }
.pillar ul { list-style: none; padding: 0; margin: 0; font-size: .85rem; }
.pillar li { padding: .15rem 0; }
.pillar li.warn { font-size: .8rem; }
.pillar.uncovered { border-color: #f0b6ae; background: #fff8f7; }

.canvas-side .panel h3 { justify-content: space-between; }
.health .score { position: relative; height: 22px; background: #eee; border-radius: 99px; overflow: hidden; margin-bottom: .6rem; }
.health .bar { height: 100%; background: var(--score); transition: width .3s; }
.health .score span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; }
.issues { padding-left: 1.1rem; margin: 0; font-size: .85rem; }
.issues li { margin-bottom: .3rem; }
.issue-error::marker { color: var(--poor); }
.issue-warning::marker { color: var(--fair); }

/* Drawer (het onderwaterdeel van de ijsberg) */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface); box-shadow: -8px 0 24px rgba(0, 0, 0, .12); overflow-y: auto; z-index: 20; }
.drawer:empty { display: none; }
.drawer-inner { padding: 1rem 1.3rem 2rem; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; padding-bottom: .6rem; }
.drawer-head h2 { margin: .3rem 0 0; font-size: 1.2rem; }
.close { font-size: 1.6rem; background: none; border: 0; cursor: pointer; color: var(--muted); line-height: 1; }
.drawer section { border-top: 1px solid var(--border); margin-top: 1rem; }
.drawer-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 1.5rem; }

/* Board */
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: .8rem; align-items: start; }
.board-col { background: #ebebe7; border-radius: var(--radius); padding: .7rem; }
.board-list { list-style: none; padding: 0; margin: 0; min-height: 60px; }
.board-card { background: var(--surface); border-radius: 6px; padding: .6rem; margin-bottom: .5rem; box-shadow: var(--shadow); cursor: grab; }
.board-card.overdue { border-left: 3px solid var(--poor); }
.board-meta { display: flex; gap: .4rem; align-items: center; margin-top: .4rem; }
.board-meta .avatar { margin-left: auto; }

/* Tijdlijn */
.timeline { padding: 0; overflow-x: auto; margin-bottom: 1rem; }
.tl-row { display: grid; grid-template-columns: 240px 1fr; border-bottom: 1px solid #f0f0ec; min-width: 1100px; }
.tl-label { padding: .4rem .7rem; display: flex; flex-direction: column; border-right: 1px solid var(--border); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tl-grid { display: grid; grid-template-columns: repeat(var(--days), 1fr); position: relative; align-items: center; background-image: linear-gradient(to right, #f0f0ec 1px, transparent 1px); background-size: calc(100% / 12) 100%; }
.tl-header .tl-week { font-size: .72rem; color: var(--muted); padding: .4rem .3rem; }
.tl-bar { grid-row: 1; height: 16px; border-radius: 4px; background: var(--c-value); }
.tl-bar.status-doing { background: #f2b84b; }
.tl-bar.status-review { background: var(--c-market); }
.tl-bar.status-done { background: #9fd3b0; }
.tl-bar.overdue { background: var(--poor); }
.tl-bar.clip-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.tl-bar.clip-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.tl-today { grid-row: 1; align-self: stretch; width: 2px; background: var(--accent); }

@media (max-width: 1100px) {
  .canvas-layout, .grid-2 { grid-template-columns: 1fr; }
  .canvas-top { grid-template-columns: 1fr 1fr; grid-template-areas: "value rtb" "disc barrier" "competition market" "problem problem"; }
}
@media (max-width: 700px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .main { padding: 1rem; }
  .canvas-top, .canvas-bottom { grid-template-columns: 1fr; grid-template-areas: "value" "rtb" "barrier" "disc" "competition" "market" "problem"; }
}

@media print {
  .sidebar, .canvas-side, .actions, .quick-add, .item-actions, .handle, .drawer, .box-hint, .derived, #market-personas .btn { display: none !important; }
  body { background: #fff; }
  .main { padding: 0; }
  .canvas-layout { display: block; }
  .box { box-shadow: none; break-inside: avoid; }
  .box-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { size: A4 landscape; margin: 10mm; }
}

/* Canvas-first: stamgegevens direct in het canvas kiezen of aanmaken */
.start-form { display: inline; margin: 0; }
.picker { margin-bottom: .2rem; }
.picker .btn { flex: 0 0 auto; }
.box-market .quick-add, .box-pillars .quick-add { margin: .4rem 0; }
.title-block h1.editable { margin: 0 -.4rem; }
.title-block .field-form input { font-size: 1.4rem; font-weight: 600; }
.box-product .box-head button.link, .box-pillars .box-head button.link { color: #fff; text-decoration: underline; }
@media print { .box-head button.link, .start-form { display: none !important; } }
.tag-master { background: #e6e9ee; }
button.chip { border: 0; cursor: pointer; font-family: inherit; }
button.chip:hover { background: #e4dcef; }
.market-facts button.link, .box-product p button.link { color: inherit; }
.box-pillars .pillar h4 button.link { color: inherit; font-weight: inherit; }
.pillar-row { border: 1px solid var(--border); border-radius: 6px; padding: .5rem .7rem .1rem; margin: 0 0 .6rem; }
.saved { color: var(--good, #2e7d32); margin-left: .6rem; }

/* Gebruikers en delen */
.copy-link { width: 100%; font-family: ui-monospace, monospace; font-size: .8rem; margin: .3rem 0; }
.share-list li { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .15rem 0; }
.sidebar-foot .role { display: block; opacity: .7; font-size: .75rem; }
