/* Inter, served from here: the same letter on every machine, made for screens full of figures. */
@font-face { font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/inter-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/inter-latin.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
:root {
  --bg: #f4f5f7; --card: #fff; --text: #1d2330; --muted: #6b7280; --line: #e5e7eb;
  --accent: #2563eb; --accent-ink: #fff; --accent-soft: #dbeafe;
  --payroll: #2563eb; --expenses: #0d9488;
  --ok: #16a34a; --ok-soft: #dcfce7;
  --warn: #d97706; --warn-soft: #fef3c7;
  --danger: #dc2626; --danger-soft: #fee2e2;
  --line-strong: #cbd5e1; --on-solid: #fff;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1218; --card: #181c24; --text: #e5e7eb; --muted: #9aa3b2; --line: #2b313c;
  --accent: #60a5fa; --accent-ink: #0b1220; --accent-soft: #1b3150;
  --payroll: #60a5fa; --expenses: #2dd4bf;
  --ok: #4ade80; --ok-soft: #12301d;
  --warn: #fbbf24; --warn-soft: #362709;
  --danger: #f87171; --danger-soft: #3a1717;
  --line-strong: #47505e; --on-solid: #0f1218;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
html { font-size: 14px; }
body { font: 13px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0 0 .5rem; font-weight: 600; }
h1 { letter-spacing: -.015em; }
h1 { font-size: 1.25rem; } h2 { font-size: .95rem; }
input, select, textarea { color: var(--text); background-color: var(--card); font: inherit; }
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--muted); cursor: pointer; }
.theme-toggle:hover { color: var(--text); border-color: var(--line-strong); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: none; }
:root:not([data-theme-choice]) .icon-system, [data-theme-choice=system] .icon-system, [data-theme-choice=light] .icon-light, [data-theme-choice=dark] .icon-dark { display: block; }
.muted { color: var(--muted); } .small { font-size: .8rem; } .error { color: var(--danger); } .strong { font-weight: 600; } .nowrap { white-space: nowrap; }

/* ---- app shell (same as the other tools) ---- */
body.with-sidebar { display: grid; grid-template-columns: 204px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--card); border-right: 1px solid var(--line); padding: .9rem .7rem; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--text); padding: .2rem .5rem .9rem; font-size: 1rem; }
.brand img { border-radius: 6px; }
.brand small { font-weight: 500; color: var(--muted); font-size: .8rem; margin-left: .3rem; }
.side-nav { display: flex; flex-direction: column; gap: .15rem; }
.side-nav a { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: 8px; color: var(--text); font-size: .9rem; }
.side-nav a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
.side-nav a:hover { background: var(--bg); }
.side-nav a.app { font-weight: 600; }
.side-nav a.app.current { color: var(--text); }
.side-nav a.app.current svg { color: var(--accent); }
.side-nav a.app + a.app { margin-top: .15rem; }
.side-nav a.sub { padding: .38rem .6rem .38rem 2.35rem; font-size: .86rem; margin-top: -.1rem; }
.side-nav .nav-label { padding: .7rem .6rem .2rem 2.35rem; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.side-nav a.sub.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: .7rem; display: flex; flex-direction: column; gap: .6rem; }
.me { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.me-text strong { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-tools { display: flex; align-items: center; justify-content: space-between; }
.lang-switch { display: inline-flex; gap: .3rem; align-items: center; font-size: .8rem; }
.lang-switch a { color: var(--muted); font-weight: 600; }
.lang-switch a.active { color: var(--accent); }
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: .78rem; }
.content { padding: 1.2rem 1.6rem 2rem; max-width: 1280px; width: 100%; }
@media (max-width: 860px) {
  body.with-sidebar { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: .5rem; padding: .5rem .8rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0 .4rem 0 0; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-nav a span { display: none; }
  .side-nav a.sub { padding: .4rem .5rem; }
  .side-nav a.sub span { display: inline; }
  .side-foot { margin: 0 0 0 auto; border: 0; padding: 0; flex-direction: row; align-items: center; }
  .me-text { display: none; }
  .content { padding: .8rem; }
}
.topbar { display: flex; align-items: center; justify-content: space-between; padding: .5rem 1rem; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar nav { display: flex; gap: .8rem; align-items: center; }
.page { padding: 1rem; max-width: 1100px; margin: 0 auto; }
.footer { max-width: 1100px; margin: 1rem auto 0; padding: 1rem; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--line); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head h1 .muted { font-weight: 500; }
.page-head .sub { color: var(--muted); font-size: .85rem; margin: .1rem 0 0; max-width: 75ch; }
.crumbs { margin: 0 0 .4rem; font-size: .85rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .9rem 1rem; }
.card + .card, .stats + .card, .notice + .stats { margin-top: .8rem; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.login { max-width: 440px; margin: 4rem auto; text-align: center; }
.login .btn { margin-top: .5rem; }
.notice { background: var(--warn-soft); color: var(--text); border: 1px solid var(--warn); border-radius: 8px; padding: .5rem .8rem; margin: 0 0 .8rem; font-size: .88rem; }


/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; margin-top: .4rem; }
th, td { text-align: left; padding: .45rem .5rem; font-size: .88rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
tbody tr:hover { background: var(--bg); }
tfoot td { border-bottom: 0; font-size: .85rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td .sub { color: var(--muted); font-size: .78rem; }
.tag { font-size: .7rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 .4rem; margin-left: .3rem; white-space: nowrap; }
.tag.warn { color: var(--warn); border-color: var(--warn); }
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--card); padding: .6rem 1rem; border-radius: 8px; opacity: 0; transition: all .2s; pointer-events: none; max-width: 90vw; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { background: var(--danger); }
.toast.action { display: flex; align-items: center; gap: 1rem; pointer-events: auto; }
.toast button { border: 0; padding: 0; background: none; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 1.2rem 0 .5rem; }
.count { display: inline-block; min-width: 1.4rem; padding: 0 .35rem; border-radius: 999px; background: var(--warn); color: var(--on-solid); font-size: .72rem; font-weight: 700; text-align: center; line-height: 1.25rem; }
.count.muted-count { background: var(--line); color: var(--muted); }
.count[hidden], .card[hidden], tr[hidden] { display: none; }
.tag.ok { color: var(--ok); border-color: var(--ok); margin-left: 0; }
/* Short screens: the sidebar's list tightens up and, if it still doesn't fit, scrolls between the brand and the foot */
.sidebar .brand, .side-foot { flex: none; }
.side-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
@media (min-width: 861px) and (max-height: 860px) {
  .sidebar { padding: .6rem .7rem; }
  .sidebar .brand { padding-bottom: .5rem; }
  .side-nav { gap: .05rem; }
  .side-nav a { padding-top: .32rem; padding-bottom: .32rem; }
  .side-nav a.sub { padding-top: .22rem; padding-bottom: .22rem; }
  .side-nav .nav-label { padding-top: .45rem; padding-bottom: .1rem; }
  .side-foot { padding-top: .5rem; gap: .4rem; }
}
@media (max-width: 860px) { .side-nav { flex: initial; overflow: visible; } }

/* ---- GDD: how much of each page the owner has approved ---- */
:root { --approved: #16a34a; --ticket: #d97706; --unvalidated: #cbd5e1; }
:root[data-theme="dark"] { --approved: #4ade80; --ticket: #fbbf24; --unvalidated: #47505e; }
.page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .7rem; }
.page-card { display: flex; flex-direction: column; gap: .5rem; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .8rem .9rem; color: var(--text); min-width: 0; }
.page-card:hover { border-color: var(--line-strong); }
.page-card h2 { margin: 0; font-size: .95rem; }
.page-card .figures { display: flex; gap: .8rem; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.page-card .figures strong { color: var(--text); font-variant-numeric: tabular-nums; }
.bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--unvalidated); }
.bar span { height: 100%; }
.bar .approved, .dot.approved { background: var(--approved); }
.bar .ticket, .dot.ticket { background: var(--ticket); }
.dot.unvalidated { background: var(--unvalidated); }
.legend-row { display: flex; gap: 1rem; font-size: .8rem; color: var(--muted); margin: 0 0 .7rem; flex-wrap: wrap; }
.legend-row span { display: inline-flex; align-items: center; gap: .35rem; }
.origin { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; white-space: nowrap; }
.rules td { vertical-align: top; }
.rules td.rule-cell { max-width: 0; }
.rules .rule-title { font-weight: 600; }
.rules .rule-rest { color: var(--muted); font-size: .82rem; margin-top: .15rem; }
.rules td.actions { text-align: right; white-space: nowrap; width: 1%; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }
.status-chip { font-size: .72rem; border-radius: 999px; padding: 0 .45rem; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.status-chip.running { color: var(--accent); border-color: var(--accent); }
.status-chip.error { color: var(--danger); border-color: var(--danger); }

/* ---- the interview ---- */
.chat { display: flex; flex-direction: column; gap: .7rem; max-width: 860px; }
.msg { padding: .65rem .85rem; border-radius: 10px; font-size: .92rem; line-height: 1.55; max-width: 88%; overflow-wrap: anywhere; }
.msg p { margin: 0 0 .5rem; } .msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: .2rem 0 .5rem; padding-left: 1.2rem; }
.msg code { font-size: .85em; background: var(--bg); padding: 0 .25rem; border-radius: 4px; }
.msg.assistant { background: var(--card); border: 1px solid var(--line); align-self: flex-start; }
.msg.owner { background: var(--accent-soft); align-self: flex-end; }
.msg.seed, .msg.decision { align-self: center; background: none; color: var(--muted); font-size: .8rem; text-align: center; padding: .2rem; }
.activity { align-self: flex-start; color: var(--muted); font-size: .78rem; display: flex; gap: .4rem; align-items: center; }
.activity::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.proposal { border: 1px solid var(--accent); border-radius: 10px; background: var(--card); padding: .8rem .9rem; max-width: 100%; }
.proposal.applied { border-color: var(--approved); }
.proposal.rejected, .proposal.failed { border-color: var(--line); opacity: .8; }
.proposal h3 { margin: 0 0 .4rem; font-size: .9rem; }
.diff { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin: .5rem 0; }
.diff pre { margin: 0; padding: .5rem .6rem; border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; font: .8rem/1.5 Inter, system-ui, sans-serif; }
.diff .before { background: var(--danger-soft); }
.diff .after { background: var(--ok-soft); }
.diff .label { font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-bottom: .2rem; font-weight: 600; }
@media (max-width: 700px) { .diff { grid-template-columns: 1fr; } .msg { max-width: 100%; } }
.proposal .decide { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.proposal .decide input { flex: 1; min-width: 180px; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 6px; }
.thinking { color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: .5rem; }
.thinking::before { content: ""; width: 14px; height: 14px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .thinking::before { animation: none; } }
.composer { position: sticky; bottom: 0; background: var(--bg); padding: .7rem 0 1rem; max-width: 860px; display: flex; gap: .5rem; align-items: flex-end; }
.composer textarea { flex: 1; min-height: 2.6rem; max-height: 14rem; resize: vertical; padding: .55rem .7rem; border: 1px solid var(--line-strong); border-radius: 8px; font-size: .92rem; }
.err-line { color: var(--danger); font-size: .85rem; }
