/* HQ v2 components, layered on styles.css. */
.top-inner { gap: 14px; }
.head > .row-actions { display: flex; align-self: end; }
.nav a { padding-inline: 8px; font-size: 14px; }
.top-inner { gap: 12px; }
.icon-link { position: relative; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); color: var(--ink); text-decoration: none; background: var(--surface); flex: none; }
.icon-link:hover { background: var(--surface-2); }
.icon-link svg { width: 18px; height: 18px; }
.badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.menu { position: relative; }
.menu > button { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px 3px 3px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink); }
.menu > button .avatar { width: 26px; height: 26px; font-size: 12px; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); min-width: 210px; padding: 6px; display: grid; z-index: 30; }
.menu-pop a, .menu-pop button { text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 8px; font-size: 14px; color: var(--ink); text-decoration: none; cursor: pointer; font-weight: 500; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); }
.menu-pop .who-line { padding: 8px 10px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }

.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: grid; gap: 2px; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.stat:hover { border-color: var(--blue); }
.stat .n { font-family: var(--label); font-stretch: 112%; font-weight: 800; font-size: 30px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat.bad .n { color: var(--red); }
.stat.warn .n { color: var(--amber); }
.stat.good .n { color: var(--green); }

/* Task rows */
.tgroup { display: grid; gap: 0; }
.tgroup-h { display: flex; align-items: center; gap: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; padding: 10px 0 6px; }
.tgroup-h.bad { color: var(--red); }
.task { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 4px 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.tgroup .task:first-of-type { border-top: 0; }
.task .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); cursor: pointer; margin-top: 1px; display: grid; place-items: center; padding: 0; color: transparent; font-size: 12px; font-weight: 900; }
.task .tick:hover { border-color: var(--green); color: var(--green); }
.task.done .tick { background: var(--green); border-color: var(--green); color: #fff; }
.task .t-title { font-weight: 650; text-decoration: none; color: inherit; overflow-wrap: anywhere; }
.task .t-title:hover { color: var(--blue); }
.task.done .t-title { color: var(--muted); text-decoration: line-through; }
.task .t-meta { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); }
.task .t-right { display: flex; align-items: center; gap: 6px; }
.due { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.due.late { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.due.today { background: var(--amber-soft); color: var(--amber); }
.mini-av { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--blue-soft); color: var(--blue); font-size: 11px; font-weight: 800; font-family: var(--label); flex: none; }

/* Deliverable boxes with due dates */
.box.late { border-color: var(--red); color: var(--red); background: color-mix(in srgb, var(--red) 8%, var(--surface)); }
.box.soon { border-color: var(--amber); }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(8, 14, 30, .45); z-index: 40; display: grid; place-items: start center; padding: 6vh 16px 16px; overflow-y: auto; }
.modal { width: min(100%, 620px); background: var(--surface); border-radius: 16px; box-shadow: 0 20px 60px -20px rgba(0,0,0,.45); padding: 20px; display: grid; gap: 14px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* Markdown */
.md { font-size: 15px; line-height: 1.6; display: grid; gap: 10px; overflow-wrap: anywhere; }
.md h1 { font-size: 24px; }
.md h2 { font-size: 19px; margin-top: 10px; }
.md h3 { font-size: 16px; margin-top: 6px; }
.md h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.md ul, .md ol { margin: 0; padding-left: 22px; display: grid; gap: 3px; }
.md li > ul, .md li > ol { margin-top: 3px; }
.md li:has(> input[type="checkbox"]:first-child) { list-style: none; margin-left: -18px; }
.md li > input[type="checkbox"] { margin: 0 6px 0 0; vertical-align: -2px; }
.md code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: .92em; }
.md hr { border: 0; border-top: 1px solid var(--line); width: 100%; }
.md .flash { background: color-mix(in srgb, var(--amber) 25%, transparent); border-radius: 6px; transition: background 1.5s; }
.md.small-md { font-size: 14px; gap: 8px; }

/* Assistant */
.chat { display: grid; gap: 14px; }
.msg { display: grid; gap: 8px; max-width: 760px; }
.msg.me { justify-self: end; background: var(--blue); color: var(--blue-ink); padding: 10px 14px; border-radius: 14px 14px 4px 14px; font-weight: 600; max-width: min(560px, 90%); }
.msg.bot { background: var(--surface); border: 1px solid var(--line); padding: 14px 16px; border-radius: 14px 14px 14px 4px; box-shadow: var(--shadow); }
.msg.bot.miss { border-color: color-mix(in srgb, var(--amber) 50%, var(--line)); }
.msg .src { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 13px; }
.msg .src a { font-weight: 600; }
.ask-bar { position: sticky; bottom: 0; background: linear-gradient(to top, var(--bg) 75%, transparent); padding: 14px 0 calc(14px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 8px; }
.ask-bar input { flex: 1; font-size: 15px; padding: 12px 14px; border-radius: 12px; }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; }

/* Goals */
.lanes { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); align-items: start; }
.lane { display: grid; gap: 10px; align-content: start; }
.seat { font-family: var(--label); font-stretch: 120%; font-weight: 900; font-size: 12px; letter-spacing: .14em; color: var(--blue); text-transform: uppercase; }
.goal { display: grid; gap: 6px; padding: 12px 0; border-top: 1px solid var(--line); }
.goal:first-of-type { border-top: 0; }
.goal-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.goal-num { font-family: var(--label); font-stretch: 110%; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 14px; }
.split-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; gap: 2px; }
.split-bar i { display: block; background: var(--blue); }
.split-bar i:nth-child(2) { background: color-mix(in srgb, var(--blue) 60%, var(--surface)); }
.split-bar i:nth-child(3) { background: color-mix(in srgb, var(--blue) 30%, var(--surface)); }
.bullets { margin: 0; padding-left: 18px; display: grid; gap: 3px; font-size: 14px; }

/* Permissions */
.perm-grid { display: grid; }
.perm { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.perm:first-child { border-top: 0; }
.perm .hint { grid-column: 1; font-size: 12.5px; color: var(--muted); }
.switch { position: relative; width: 42px; height: 24px; flex: none; grid-row: 1 / span 2; grid-column: 2; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:disabled + span { opacity: .5; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 9px 12px; font-weight: 600; font-size: 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--blue); border-bottom-color: var(--blue); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.code-box { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; white-space: pre-wrap; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; max-height: 260px; overflow: auto; overflow-wrap: anywhere; }
.notice { background: var(--blue-soft); border-radius: 12px; padding: 12px 14px; font-size: 14px; display: grid; gap: 4px; }
.notice.warn { background: var(--amber-soft); }
.notice.bad { background: color-mix(in srgb, var(--red) 12%, transparent); }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.editor textarea { min-height: 60vh; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; line-height: 1.5; }
@media (max-width: 900px) { .editor { grid-template-columns: minmax(0, 1fr); } .editor .preview { display: none; } }
.link-btn { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
.dropzone { border: 2px dashed var(--line); border-radius: 14px; padding: 22px; text-align: center; display: grid; gap: 8px; justify-items: center; color: var(--muted); }
.dropzone.over { border-color: var(--blue); background: var(--blue-soft); }
.notif { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; align-items: start; }
.notif:first-child { border-top: 0; }
.notif .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); margin-top: 7px; }
.notif.read .dot { background: transparent; }
.notif.read { color: var(--muted); }
.auth-alt { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.dev-note { background: var(--amber-soft); border-radius: 10px; padding: 10px 12px; font-size: 13px; overflow-wrap: anywhere; }
.inline-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.inline-form .inp { width: auto; flex: 1; min-width: 90px; }
.muted-link { color: var(--muted); text-decoration: none; }
.muted-link:hover { color: var(--blue); }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.comment { display: grid; gap: 2px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.comment:first-child { border-top: 0; }
.comment .who { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.status-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tick-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 900; flex: none; margin-top: 1px; color: #fff; }
.tick-dot.on { background: var(--green); border-color: var(--green); }
.gs-card { border-color: color-mix(in srgb, var(--blue) 35%, var(--line)); }

/* Pipeline */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; align-items: start; }
.col { background: var(--surface-2); border-radius: 14px; padding: 10px; display: grid; gap: 8px; align-content: start; min-height: 120px; }
.col-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 2px 4px 4px; }
.col-h b { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.col-h span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lead { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.lead:hover { border-color: var(--blue); }
.lead .lt { font-weight: 700; overflow-wrap: anywhere; }
.lead .lm { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); }
.lead.late { border-color: color-mix(in srgb, var(--red) 55%, var(--line)); }
.stage-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.phase-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.wm-tag { font-family: var(--label); font-stretch: 125%; font-size: 8px; letter-spacing: .3em; font-weight: 700; color: var(--red); margin-top: 4px; }

/* Header: nav drops to its own row when it does not fit next to the brand. */
.top.two-row .top-inner { flex-wrap: wrap; row-gap: 4px; padding-block: 8px 6px; }
.top.two-row .nav { order: 3; flex-basis: 100%; }
.top.two-row .icon-link { margin-left: auto; }
