/* Development Tasks. The look follows the institute site of the RID brand: white ground,
   one centered column, an accent rule under the navigation, framed cards, bold uppercase
   headings over light text. Every colour is a token; brand.json overrides them at load. */
:root {
  --accent: #4d7c0f; --accent-hover: #a3e635; --accent-ink: #3f6212; --alert: #b91c1c;
  --ink: #1c1917; --ink-soft: #57534e; --line: #d6d3d1; --ground: #ffffff; --panel: #f5f5f4; --ok: #15803d;
  --head: "Inter", "Helvetica Neue", Arial, sans-serif;
  --font: "Source Sans 3", "Source Sans Pro", "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--ground); line-height: 1.45; }
[hidden] { display: none !important; }
.wrap { max-width: 1000px; margin: 0 auto; padding-inline: 24px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }

.head { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; padding-block: 28px 32px; flex-wrap: wrap; }
.inst { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.inst img { width: 56px; height: 56px; }
.inst-name { font-weight: 300; font-size: 1.02rem; line-height: 1.3; display: grid; }
.inst-name strong { font-family: var(--head); font-weight: 800; letter-spacing: .04em; font-size: 1.05rem; }
.primary-menu { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.primary-menu a, .primary-menu .off { font-family: var(--head); font-weight: 800; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; text-decoration: none; color: var(--ink); padding: 8px 12px; border-bottom: 4px solid transparent; }
.primary-menu a:hover { border-bottom-color: var(--accent-hover); }
.primary-menu a[aria-current] { border-bottom-color: var(--accent); }
.primary-menu .off { color: var(--ink-soft); opacity: .6; }
.session { display: flex; align-items: center; gap: 6px; font-size: .84rem; white-space: nowrap; font-weight: 300; color: var(--ink-soft); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.dot.on { background: var(--ok); }
.link { background: none; border: 0; padding: 0 0 0 10px; cursor: pointer; text-decoration: underline; color: var(--ink); }

.menu { text-align: center; }
.crumbs { font-weight: 300; font-size: .85rem; color: var(--ink-soft); }
.nav { display: flex; justify-content: center; gap: 2px 10px; flex-wrap: wrap; width: fit-content; max-width: 100%; margin: 4px auto 0; padding: 0 20px 6px; border-bottom: 4px solid var(--accent); }
.nav button { background: none; border: 0; padding: 6px 12px; cursor: pointer; font-weight: 300; font-size: 1.05rem; }
.nav button:hover { color: var(--accent-ink); }
.nav button[aria-pressed="true"] { font-weight: 600; }

.title { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-block: 52px 8px; }
h1 { font-family: var(--head); font-weight: 800; font-size: 2rem; letter-spacing: .04em; text-transform: uppercase; margin: 0; line-height: 1.1; text-wrap: balance; }
h2 { font-family: var(--head); font-weight: 800; font-size: 1.15rem; letter-spacing: .05em; text-transform: uppercase; margin: 0; text-wrap: balance; }
.lead { color: var(--ink-soft); font-weight: 300; font-size: 1.12rem; max-width: 65ch; margin: 0 0 26px; }
.hint { font-size: .86rem; color: var(--ink-soft); font-weight: 300; margin: 0; }

.primary { background: var(--ground); border: 3px solid var(--accent); padding: 8px 18px; cursor: pointer; font-family: var(--head); font-weight: 800; font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; }
.primary:hover { border-color: var(--accent-hover); }
.secondary { background: var(--ground); border: 3px solid var(--line); padding: 8px 18px; cursor: pointer; font-family: var(--head); font-weight: 800; font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; }
.secondary:hover { border-color: var(--ink-soft); }
.danger:hover { border-color: var(--alert); }
button:disabled { opacity: .5; cursor: progress; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); border-block: 1px solid var(--line); margin: 0 0 28px; }
.kpi { padding: 14px 14px 16px; border-right: 1px solid var(--line); min-width: 0; }
.kpi:last-child { border-right: 0; }
.kpi dt { font-size: .76rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.kpi dd { margin: 2px 0 0; font-size: 1.9rem; font-weight: 300; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--ink-soft); font-weight: 300; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
input, select, textarea { border: 1px solid var(--line); background: var(--ground); padding: 9px 11px; width: 100%; border-radius: 0; }
input[type="checkbox"] { width: auto; }
#search { max-width: 320px; }
textarea { resize: vertical; min-height: 5em; }
label { display: grid; gap: 5px; font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
label input, label select, label textarea { font-size: 1rem; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink); }
label.check { display: flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: .95rem; color: var(--ink); }

.card { border: 4px solid var(--line); padding: 20px; background: var(--ground); }
.card.selected { border-color: var(--accent); }
.login { display: grid; gap: 16px; max-width: 460px; }

.task { display: grid; grid-template-columns: 6.2em 1fr auto; gap: 4px 16px; align-items: start; width: 100%; text-align: left; background: var(--ground); border: 0; border-top: 1px solid var(--line); padding: 14px 4px; cursor: pointer; }
.task:first-child { border-top: 4px solid var(--accent); }
.task:hover { background: var(--panel); }
.task-ref { font-family: var(--mono); font-size: .82rem; color: var(--ink-soft); padding-top: 3px; }
.task-title { font-weight: 600; overflow-wrap: anywhere; }
.task-preview { grid-column: 2; color: var(--ink-soft); font-weight: 300; font-size: .93rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.task-meta { grid-column: 3; grid-row: 1 / span 2; display: grid; gap: 4px; justify-items: end; font-size: .84rem; color: var(--ink-soft); white-space: nowrap; }
.empty { border: 4px solid var(--line); padding: 36px 20px; text-align: center; color: var(--ink-soft); font-weight: 300; }

.state { display: inline-flex; align-items: center; gap: 7px; font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.state::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.state.running { color: var(--ok); } .state.running::before { background: var(--ok); animation: pulse 1.6s ease-in-out infinite; }
.state.review { color: var(--accent-ink); } .state.review::before { background: var(--accent); }
.state.open::before { background: var(--ink-soft); }
.state.blocked { color: var(--alert); } .state.blocked::before { background: var(--alert); }
@keyframes pulse { 50% { opacity: .35; } }

dialog { border: 4px solid var(--accent); padding: 0; width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); color: var(--ink); background: var(--ground); }
dialog::backdrop { background: rgb(35 31 32 / .45); }
dialog > form, dialog > div { display: grid; gap: 16px; padding: 24px; }
.dialog-head { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.dialog-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.row { display: grid; grid-template-columns: 180px 1fr; gap: 16px; align-items: end; }
.icon { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 0 4px; }
.eyebrow { font-family: var(--mono); font-size: .8rem; color: var(--ink-soft); }
.meta { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; font-size: .88rem; color: var(--ink-soft); }
.body-text { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 16em; overflow: auto; border-left: 4px solid var(--line); padding-left: 14px; font-size: .95rem; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.section { font-family: var(--head); font-weight: 800; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; border-bottom: 4px solid var(--accent); padding-bottom: 6px; margin-top: 6px; }
.run { display: grid; gap: 4px; font-size: .92rem; }
.run pre, .comment pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: .82rem; background: var(--panel); padding: 10px; max-height: 14em; overflow: auto; }
.comment { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 4px; }
.comment small { color: var(--ink-soft); }
.comment.system { color: var(--ink-soft); font-weight: 300; font-size: .9rem; }
.comment-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.budget { font-size: .84rem; color: var(--ink-soft); }
.budget.warn { color: var(--alert); font-weight: 600; }

.notice { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--ground); padding: 10px 18px; max-width: calc(100vw - 32px); font-size: .95rem; }
.foot { margin-top: 56px; text-align: center; font-size: .9rem; font-weight: 300; color: var(--ink-soft); }
.foot p { width: fit-content; max-width: 100%; margin: 0 auto; padding: 16px 24px 40px; border-top: 1px solid var(--ink); }

@media (max-width: 760px) {
  .wrap { padding-inline: 16px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi:nth-child(2) { border-right: 0; } .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .task { grid-template-columns: 1fr; } .task-preview, .task-meta { grid-column: 1; grid-row: auto; justify-items: start; }
  .task-meta { display: flex; gap: 12px; }
  .row { grid-template-columns: 1fr; }
  h1 { font-size: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) { .state.running::before { animation: none; } }
