/* B&Y Projects Center. System font, generous whitespace, fixed status colours. */

:root {
    --bg: #f6f7f9;
    --panel: #ffffff;
    --ink: #1c1f24;
    --muted: #6b7280;
    --line: #e3e6ea;
    --accent: #1f4e79;
    --accent-ink: #ffffff;
    /* Status colours used everywhere the same way. */
    --status-moving: #2e8b57;   /* green */
    --status-stuck: #d98e04;    /* amber */
    --status-parked: #8a8f98;   /* grey */
    --status-needs: #c0392b;    /* red */
    --sidebar-width: 230px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.6rem; margin: 0 0 0.5rem; font-weight: 600; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; font-weight: 600; }
h3 { font-size: 1rem; margin: 0 0 0.5rem; font-weight: 600; }
p { margin: 0 0 0.75rem; }
.lead { color: var(--muted); font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.nowrap { white-space: nowrap; }
code.wrap { word-break: break-all; }

/* Shell */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--panel);
    border-right: 1px solid var(--line);
    padding: 1.25rem 1rem;
    flex-shrink: 0;
}
.brand { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.brand a { font-weight: 700; color: var(--ink); font-size: 1.05rem; }
.nav-toggle { display: none; }
.nav { list-style: none; margin: 0; padding: 0; }
.nav li { margin-bottom: 0.25rem; }
.nav-link {
    display: block;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    color: var(--ink);
    font-weight: 600;
}
.nav-link small { display: block; font-weight: 400; color: var(--muted); font-size: 0.8rem; }
.nav-link:hover { background: var(--bg); text-decoration: none; }
.nav-link.active { background: var(--accent); color: var(--accent-ink); }
.nav-link.active small { color: #d6e2ee; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.topbar-user { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.content { padding: 1.5rem; max-width: 1400px; width: 100%; }
.anonymous-content { max-width: 520px; margin: 4rem auto; }

/* Cards and panels */
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}
.card.narrow { max-width: 480px; }
.banner { background: #fff7e6; border-bottom: 1px solid #f1d9a7; padding: 0.6rem 1.5rem; }
.flash { background: #e8f5ee; border: 1px solid #bfe3cf; border-radius: 8px; padding: 0.6rem 0.9rem; margin: 0 0 1rem; }
.notice { background: #eef4fb; border: 1px solid #cfe0f1; border-radius: 8px; padding: 0.6rem 0.9rem; }
.errors, .error { color: var(--status-needs); }
.errors { margin-bottom: 0.75rem; }
.errors ul { margin: 0; padding-left: 1.2rem; }

/* Forms */
.field { margin-bottom: 0.9rem; }
.field label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.field.check label { font-weight: 400; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid #c9ced6;
    border-radius: 6px;
    font: inherit;
    background: #fff;
}
textarea { min-height: 5rem; }
button, .button {
    font: inherit;
    padding: 0.5rem 0.9rem;
    border-radius: 6px;
    border: 1px solid #c9ced6;
    background: #fff;
    cursor: pointer;
}
button.primary, .button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.link { background: none; border: none; color: var(--accent); padding: 0; cursor: pointer; }
button.link:hover { text-decoration: underline; }
form.inline { display: inline; }
.inline-form { display: flex; gap: 0.4rem; align-items: center; }
.inline-form input { width: auto; min-width: 14rem; }
.form-row { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.form-row .field { margin-bottom: 0; min-width: 12rem; }
.setting-form { display: flex; gap: 0.5rem; align-items: flex-start; }
.setting-form input, .setting-form textarea { flex: 1; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.02em; }
table.settings td.setting-key { width: 38%; }
table.audit pre { max-width: 28rem; max-height: 14rem; overflow: auto; font-size: 0.75rem; white-space: pre-wrap; word-break: break-all; margin: 0.25rem 0 0; }
details summary { cursor: pointer; color: var(--accent); }

/* Tabs and pager */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; flex-wrap: wrap; }
.tabs a { padding: 0.5rem 0.9rem; border-radius: 8px 8px 0 0; color: var(--muted); font-weight: 600; }
.tabs a.active { color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-bottom-color: var(--panel); margin-bottom: -1px; }
.pager a { display: inline-block; padding: 0.25rem 0.6rem; border: 1px solid var(--line); border-radius: 6px; margin-right: 0.25rem; }
.pager a.active { background: var(--accent); color: var(--accent-ink); }

/* Status dots: green moving, amber stuck, grey parked or not started, red needs a founder or overdue. */
.dot { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; vertical-align: middle; margin-right: 0.35rem; }
.dot.moving { background: var(--status-moving); }
.dot.stuck { background: var(--status-stuck); }
.dot.parked, .dot.notstarted { background: var(--status-parked); }
.dot.needs, .dot.overdue { background: var(--status-needs); }

/* Context pages */
.badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; background: #eef1f5; font-size: 0.8rem; margin-right: 0.25rem; }
.badge.amber { background: #fff1d6; color: #8a5a00; }
.badge.red { background: #fde3df; color: #8f1d12; }
tr.expiring td { background: #fff8e8; }
tr.expired td { background: #fdecea; }
.tree .entity-node { margin-bottom: 0.75rem; }
.tree-children { margin: 0.75rem 0 0.5rem 1.25rem; padding-left: 1rem; border-left: 2px solid var(--line); }
.entity-head { display: flex; gap: 0.75rem; align-items: baseline; flex-wrap: wrap; }
.entity-name { font-weight: 600; font-size: 1.05rem; }
.entity-meta { margin-top: 0.35rem; display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-2 .card { margin-bottom: 0; }
.grid-2 + .card, .grid-2 + section { margin-top: 1.25rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.75rem 1rem; align-items: end; }
.form-grid .field { margin-bottom: 0; }
.field.wide { flex: 2; }
.narrow-wide { max-width: 760px; }
.actions { display: flex; gap: 0.5rem; align-items: center; margin-top: 1rem; }
.add-form { margin-top: 0.75rem; }
.add-form summary { font-weight: 600; }
.add-form form { margin-top: 0.75rem; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 0.3rem 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: none; }
.prewrap { white-space: pre-wrap; }
.status-word { font-size: 0.9rem; }
.error-flash { background: #fdecea; border-color: #f3b7b0; }
.summary-form { margin-top: 1rem; }
.summary-form h3 { margin-top: 1rem; }
.upload-form { margin-top: 0.75rem; }

/* Map */
.map-layout { position: relative; }
.map-band-head { display: flex; justify-content: space-between; align-items: baseline; }
.map-band-grid { display: grid; grid-template-columns: minmax(16rem, 1fr) 2fr; gap: 1.5rem; }
.bar-row { display: grid; grid-template-columns: 7rem 1fr 6rem; gap: 0.5rem; align-items: center; margin-bottom: 0.4rem; }
.bar { position: relative; height: 0.7rem; background: #e9ecf0; border-radius: 999px; overflow: visible; }
.bar-fill { position: absolute; left: 0; top: 0; height: 100%; background: var(--accent); border-radius: 999px; }
.bar-target { position: absolute; top: -0.25rem; width: 2px; height: 1.2rem; background: var(--status-needs); }
.bar-value { font-size: 0.9rem; }
.map-band-projects { display: flex; flex-wrap: wrap; gap: 0.5rem; align-content: flex-start; }
.map-mini-card { display: inline-block; padding: 0.4rem 0.7rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.map-mini-card:hover { text-decoration: none; border-color: var(--accent); }
.map-columns { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem; align-items: flex-start; }
.map-column { flex: 0 0 300px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.9rem; }
.map-column.child { flex: none; margin-top: 0.75rem; background: #f9fafb; }
.map-children { margin-top: 0.5rem; padding-left: 0.5rem; border-left: 3px solid var(--line); }
.map-entity { display: block; color: var(--ink); margin-bottom: 0.6rem; }
.map-entity:hover { text-decoration: none; }
.map-entity:hover .map-entity-name { text-decoration: underline; }
.map-entity-name { font-weight: 600; }
.map-badges { margin: 0.25rem 0; }
.map-rows { display: flex; flex-direction: column; gap: 0.2rem; }
.map-row { display: grid; grid-template-columns: auto 1fr; column-gap: 0.4rem; padding: 0.35rem 0.4rem; border-radius: 6px; color: var(--ink); align-items: center; }
.map-row:hover { background: var(--bg); text-decoration: none; }
.map-row-owner { grid-column: 2; font-size: 0.8rem; }
.map-add { display: block; margin-top: 0.75rem; padding: 0.5rem; border: 1px dashed #b9c0c9; border-radius: 8px; text-align: center; color: var(--muted); }
.map-add:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.map-panel { position: fixed; top: 0; right: 0; width: 380px; max-width: 100%; height: 100vh; overflow-y: auto; background: var(--panel); border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(0,0,0,0.08); padding: 1.25rem; z-index: 20; }
.map-panel h3 { margin-top: 1rem; }
.map-panel-close { float: right; }

/* Direction cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.card-project { display: block; color: var(--ink); margin-bottom: 0; }
.card-project:hover { text-decoration: none; border-color: var(--accent); }
.card-project-head { display: flex; justify-content: space-between; gap: 0.75rem; align-items: flex-start; }
.card-project-name { font-weight: 600; font-size: 1.05rem; }
.card-project-status { white-space: nowrap; font-size: 0.9rem; }
.card-project-goal { margin: 0.5rem 0; }
.card-project-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1rem; font-size: 0.9rem; }
.needs-text { color: var(--status-needs); }
.overdue { color: var(--status-needs); }
.parked { margin-top: 1.25rem; }
.parked summary { font-weight: 600; cursor: pointer; margin-bottom: 0.75rem; }
.filter-bar { margin-bottom: 1rem; }

/* Project page */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.page-head .actions { margin-top: 0; }
.section-title { margin-top: 0.5rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.tile { display: block; background: var(--panel); border: 1px solid var(--line); border-left-width: 6px; border-radius: 10px; padding: 1rem; color: var(--ink); }
.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile-head { display: flex; justify-content: space-between; }
.tile-label { font-weight: 600; }
.tile-headline { margin: 0.4rem 0; }
.tile-metrics { list-style: none; padding: 0; margin: 0 0 0.4rem; font-size: 0.9rem; }
.tile-metrics li { display: flex; justify-content: space-between; gap: 0.5rem; border-bottom: 1px dotted var(--line); padding: 0.15rem 0; }
.rag-green { border-left-color: var(--status-moving); }
.rag-amber { border-left-color: var(--status-stuck); }
.rag-red { border-left-color: var(--status-needs); }
.rag-grey { border-left-color: var(--status-parked); }
.rag-word { font-size: 0.85rem; color: var(--muted); }
.rag-chip { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.8rem; color: #fff; }
.rag-chip.rag-green { background: var(--status-moving); }
.rag-chip.rag-amber { background: var(--status-stuck); }
.rag-chip.rag-red { background: var(--status-needs); }
.rag-chip.rag-grey { background: var(--status-parked); }
.rag-choice { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.rag-option { padding: 0.3rem 0.6rem; border: 1px solid var(--line); border-left-width: 6px; border-radius: 6px; }
.decision { padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.decision:last-child { border-bottom: none; }
.done { text-decoration: line-through; color: var(--muted); }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 0.4rem 0; border-bottom: 1px solid var(--line); }
.timeline .when { color: var(--muted); font-size: 0.85rem; margin-right: 0.5rem; white-space: nowrap; }
.comments { list-style: none; padding: 0; margin: 0 0 1rem; }
.comment { padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.comment.reply { margin-left: 1.5rem; }
.comment-meta { font-size: 0.9rem; margin-bottom: 0.2rem; }
.comment-body p:last-child, .md p:last-child { margin-bottom: 0; }
.check-inline { display: inline-block; margin-right: 1rem; font-weight: 400; }
.banner { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.banner-body { white-space: pre-wrap; font: inherit; margin: 0.5rem 0 0; }
table.agenda td { vertical-align: middle; }
hr { border: none; border-top: 1px solid var(--line); margin: 1rem 0; }

/* Filter */
.badge.green { background: #e3f3ea; color: #1f6b3f; }
.progress-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.dimension-title { margin-top: 1.25rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.question { padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.question.retag { background: #fff8e8; }
.question-text { margin-bottom: 0.4rem; }
.question-inputs { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: flex-start; }
.question-inputs input[type="number"] { max-width: 11rem; }
.question-inputs select { max-width: 16rem; }
.question-inputs textarea { flex: 1 1 100%; min-height: 3.2rem; }
.inline-label { display: inline-flex; align-items: center; gap: 0.4rem; }
.inline-label input { width: 6rem; }
.question-tag { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin-top: 0.4rem; }
.tag-option { padding: 0.2rem 0.6rem; border: 1px solid var(--line); border-radius: 999px; font-size: 0.9rem; }
.tag-fact { border-color: var(--status-moving); }
.tag-assumption { border-color: var(--status-stuck); }
.tag-unknown { border-color: var(--status-parked); }
.question-tag .source { flex: 1; min-width: 14rem; }
.gate-form { margin-top: 1rem; }
.count-row { margin-bottom: 0.6rem; }
.count-bar { display: flex; height: 0.8rem; background: #eef1f5; border-radius: 999px; overflow: hidden; }
.count-bar .seg { display: block; height: 100%; }
.seg.facts { background: var(--status-moving); }
.seg.assumptions { background: var(--status-stuck); }
.seg.unknowns { background: var(--status-parked); }
.verdict-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1rem; }
.verdict-box { border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem; }
.verdict-word { font-size: 1.3rem; font-weight: 700; }
.verdict-word.green { color: var(--status-moving); }
.verdict-word.amber { color: var(--status-stuck); }
.verdict-word.red { color: var(--status-needs); }
.exits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.exit-box { border: 1px solid var(--line); border-radius: 8px; padding: 0.9rem; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Unit and settings */
mark.assumption { background: #fff1b8; padding: 0 0.2rem; border-radius: 3px; }
.rulebook .md h1 { font-size: 1.4rem; }
.rulebook .md h2 { font-size: 1.1rem; margin-top: 1rem; }
table.matrix select, table.matrix input { padding: 0.25rem 0.4rem; }
table.matrix input { max-width: 7rem; }
select.sev-hard { border-color: var(--status-needs); }
select.sev-soft { border-color: var(--status-stuck); }
select.sev-off { color: var(--muted); }
.gate-edit input[type="text"] { margin-bottom: 0.25rem; }
.summarise-form { margin-bottom: 1rem; }

/* Phone */
@media (max-width: 820px) {
    .split, .grid-2 { grid-template-columns: 1fr; }
    .verdict-row, .exits { grid-template-columns: 1fr; }
    .map-band-grid { grid-template-columns: 1fr; }
    .bar-row { grid-template-columns: 5rem 1fr 5rem; }
    .map-column { flex-basis: 260px; }
    .map-panel { width: 100%; }
    .cards { grid-template-columns: 1fr; }
    .card-project-facts { grid-template-columns: 1fr; }
    .tiles { grid-template-columns: 1fr; }
    .page-head { flex-direction: column; }
    .shell { flex-direction: column; }
    .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--line); padding: 0.75rem 1rem; }
    .brand { margin-bottom: 0; }
    .nav-toggle { display: inline-block; }
    .nav { display: none; margin-top: 0.75rem; }
    .sidebar.open .nav { display: block; }
    .content { padding: 1rem; }
    .topbar { padding: 0.6rem 1rem; }
    table.settings td.setting-key { width: auto; }
    .setting-form { flex-direction: column; }
    .setting-form input, .setting-form textarea, .setting-form button { width: 100%; }
    .inline-form { flex-direction: column; align-items: stretch; }
    .inline-form input { min-width: 0; }
}
