/* Layout: white logo bar over a Harriet's-green nav strip; flat bordered panels, square corners, tables for project status. */
:root {
  --green: #05995D;        /* logo green */
  --green-ink: #04804E;    /* same hue, darker, for green text on white */
  --gold: #FFD526;         /* logo gold */
  --bg: #F4F5F4;
  --surface: #FFFFFF;
  --surface-alt: #F8F9F8;
  --ink: #1B1F1D;
  --muted: #5E6662;
  --line: #D7DCD9;
  --line-strong: #B9C1BC;
  --danger: #B3261E;
  --warn: #8A6100;
  --font-head: "IBM Plex Sans Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-body: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --r: 2px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 14.5px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.wrap {
  max-width: 1180px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* ---------- header ---------- */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); }
.brandbar .wrap { display: flex; align-items: center; gap: 16px; padding-block: 12px; }
.brandbar img { height: 36px; width: auto; display: block; }
.brandbar .divider { width: 1px; align-self: stretch; background: var(--line); }
.brandbar .portal-name { font-family: var(--font-head); font-weight: 600; font-size: 15px; color: var(--muted); letter-spacing: .4px; text-transform: uppercase; }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; text-align: right; }
.who .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.who .role { font-size: 12px; color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 2px; object-fit: cover; flex-shrink: 0; background: var(--surface-alt); }
.avatar.sm { width: 20px; height: 20px; }
.navbar { background: var(--green); }
.navbar .wrap { display: flex; gap: 0; overflow-x: auto; }
.navbar a {
  color: #FFFFFF; text-decoration: none; font-weight: 600; font-size: 14px; padding: 11px 16px 9px;
  border-bottom: 3px solid transparent; white-space: nowrap; display: flex; align-items: center; gap: 8px;
}
.navbar a:hover { background: rgba(0,0,0,.08); }
.navbar a[aria-current="page"] { border-bottom-color: var(--gold); background: rgba(0,0,0,.12); }
.navbar .count { background: var(--gold); color: #1B1F1D; font-size: 11px; font-weight: 700; padding: 0 6px; line-height: 17px; border-radius: 2px; }

/* ---------- page ---------- */
main { padding-block: 24px 56px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-bottom: 14px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
h1, h2, h3 { margin: 0; text-wrap: balance; font-family: var(--font-head); font-weight: 600; }
h1 { font-size: clamp(24px, 3.4vw, 30px); line-height: 1.15; letter-spacing: .1px; }
.kicker { font-size: 11.5px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase; color: var(--green-ink); margin-bottom: 4px; }
.sub { color: var(--muted); margin-top: 3px; }

.btn {
  border: 1px solid transparent; border-radius: var(--r); padding: 8px 14px; font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; line-height: 1.3;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--green); color: #FFFFFF; }
.btn-primary:hover { background: var(--green-ink); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-secondary:hover { background: var(--surface-alt); }
.btn-danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn-danger.armed { background: var(--danger); color: #FFFFFF; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.tabs { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); }
.tabs button { border: 0; border-left: 1px solid var(--line-strong); background: transparent; padding: 7px 14px; font-weight: 600; color: var(--muted); }
.tabs button:first-child { border-left: 0; }
.tabs button[aria-pressed="true"] { background: var(--green); color: #FFFFFF; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search { flex: 1 1 240px; min-width: 0; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r); padding: 8px 12px; }

/* ---------- KPI strip ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--surface); }
.kpi { padding: 14px 18px; border-left: 1px solid var(--line); min-width: 0; }
.kpi:first-child { border-left: 0; border-top: 3px solid var(--gold); }
.kpi:not(:first-child) { border-top: 3px solid transparent; }
.kpi .label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.kpi .value { font-family: var(--font-head); font-size: 30px; font-weight: 600; line-height: 1.15; margin-top: 2px; }
.kpi .value.bad { color: var(--danger); }
.kpi .hint { font-size: 12px; color: var(--muted); }

/* ---------- panels ---------- */
.cols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; margin-top: 20px; }
.panel { background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 16px; }
.panel-head a { color: var(--green-ink); font-weight: 600; text-decoration: none; font-size: 13px; }
.panel-head a:hover { text-decoration: underline; }
.panel-body { padding: 4px 16px 12px; }
.panel-empty { padding: 22px 16px; color: var(--muted); }

/* ---------- tasks ---------- */
.task { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; padding: 11px 16px; border-top: 1px solid var(--line); }
.list > .task:first-child { border-top: 0; }
.task.clickable { cursor: pointer; }
.task.clickable:hover { background: var(--surface-alt); }
.check {
  width: 18px; height: 18px; border: 1.5px solid var(--line-strong); border-radius: 2px; background: var(--surface);
  display: grid; place-items: center; padding: 0; margin-top: 2px; color: transparent;
}
.check:hover { border-color: var(--green); }
.check.on { background: var(--green); border-color: var(--green); color: #FFFFFF; }
.check svg { width: 12px; height: 12px; }
.check[disabled] { cursor: not-allowed; }
.task .title { font-weight: 600; overflow-wrap: anywhere; }
.task.done .title { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 3px; font-size: 12.5px; color: var(--muted); align-items: center; }
.meta .person { display: inline-flex; align-items: center; gap: 6px; }
.tag { font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; padding: 1px 6px; border: 1px solid currentColor; border-radius: 2px; }
.p-high { color: var(--danger); }
.p-medium { color: var(--warn); }
.p-low { color: var(--muted); }
.due-over { color: var(--danger); font-weight: 600; }
.due-today { color: var(--warn); font-weight: 600; }
.proj-ref { color: var(--green-ink); font-weight: 600; }
.list { background: var(--surface); border: 1px solid var(--line); }
.panel .list { border: 0; }

/* ---------- progress ---------- */
.bar { height: 8px; background: #E6EAE8; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--green); }
.bar.done > i { background: var(--gold); }
.pmini { padding: 11px 0; border-top: 1px solid var(--line); display: grid; gap: 5px; cursor: pointer; }
.panel-body > .pmini:first-child { border-top: 0; }
.pmini .row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.pmini .t { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pmini .pct { font-weight: 700; color: var(--green-ink); }
.pmini .stage { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pmini:hover .t { text-decoration: underline; }

/* ---------- project table ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); background: var(--surface-alt); border-bottom-color: var(--line-strong); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--surface-alt); }
tbody tr:last-child td { border-bottom: 0; }
td.name { font-weight: 600; }
td.name small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; margin-top: 1px; }
td.prog { width: 200px; }
td.prog .pl { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 4px; }
td.prog .pl b { color: var(--green-ink); }
.status { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; padding: 2px 7px; border-radius: 2px; }
.s-active { background: var(--green); color: #FFFFFF; }
.s-onHold { background: var(--gold); color: #1B1F1D; }
.s-done { background: #E6EAE8; color: var(--muted); }

.empty { background: var(--surface); border: 1px solid var(--line); padding: 36px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; font-family: var(--font-head); font-weight: 600; }
.empty .btn { margin-top: 14px; }
.notice { border: 1px solid var(--line); border-left: 4px solid var(--gold); background: var(--surface); padding: 10px 14px; margin-bottom: 18px; }

/* ---------- access page ---------- */
.roles td, .roles th { vertical-align: top; }
.roles table { min-width: 620px; }
.steps-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

/* ---------- dialog ---------- */
dialog {
  border: 1px solid var(--line-strong); padding: 0; border-radius: var(--r); background: var(--surface); color: var(--ink);
  width: min(600px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); box-shadow: 0 16px 40px rgba(0,0,0,.22);
}
dialog::backdrop { background: rgba(20, 28, 24, .5); }
.dlg { display: flex; flex-direction: column; max-height: calc(100dvh - 34px); }
.dlg-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 3px solid var(--green); }
.dlg-head h2 { font-size: 18px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.x { border: 0; background: transparent; width: 30px; height: 30px; display: grid; place-items: center; color: var(--muted); }
.x:hover { background: var(--surface-alt); color: var(--ink); }
.x svg { width: 16px; height: 16px; }
.dlg-body { padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.dlg-foot { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-alt); flex-wrap: wrap; }
.dlg-foot .spacer { flex: 1; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label, .field > .lbl { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .4px; text-transform: uppercase; }
.field input, .field select, .field textarea { border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r); padding: 8px 10px; width: 100%; }
.field textarea { resize: vertical; min-height: 72px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--green); outline-offset: -1px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.picker { position: relative; }
.picker-menu { position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 3; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: 0 8px 20px rgba(0,0,0,.12); }
.picker-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; text-align: left; }
.picker-menu button:hover { background: var(--surface-alt); }
.picker-menu .none { padding: 9px 10px; color: var(--muted); font-size: 13px; }
.assignee { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); padding: 7px 10px; }
.assignee span { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-btn { border: 0; background: none; color: var(--green-ink); font-weight: 600; padding: 0; }
.link-btn:hover { text-decoration: underline; }
.stages { border: 1px solid var(--line); }
.stage { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 9px 12px; border-top: 1px solid var(--line); }
.stage:first-child { border-top: 0; }
.stage .st { font-weight: 600; overflow-wrap: anywhere; }
.stage .st .idx { color: var(--muted); font-weight: 500; margin-right: 4px; }
.stage.done .st { color: var(--muted); }
.stage .info { font-size: 12px; color: var(--muted); margin-top: 1px; }
.stage .info.cur { color: var(--warn); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; font-size: 11px; }
.icon-btn { border: 0; background: none; color: var(--muted); padding: 3px; display: grid; place-items: center; }
.icon-btn:hover { color: var(--ink); background: var(--surface-alt); }
.icon-btn svg { width: 15px; height: 15px; }
.add-row { display: flex; gap: 8px; margin-top: 8px; }
.add-row input { flex: 1; min-width: 0; border: 1px solid var(--line-strong); padding: 8px 10px; border-radius: var(--r); }
.summary-line { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.summary-line b { color: var(--ink); }

/* ---------- gate & toast ---------- */
.gate { min-height: 60vh; display: grid; place-items: center; }
.gate-card { max-width: 460px; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--green); padding: 28px; }
.gate-card img { height: 54px; margin-bottom: 18px; }
.gate-card h1 { font-size: 22px; margin-bottom: 6px; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: #FFFFFF; padding: 10px 16px; border-left: 4px solid var(--gold); font-weight: 600; z-index: 20;
  max-width: calc(100vw - 32px);
}

@media (max-width: 860px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .brandbar .divider, .brandbar .portal-name, .who .text { display: none; }
  .brandbar img { height: 30px; }
  .grid2 { grid-template-columns: 1fr; }
  .kpi .value { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- hosted-version additions ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding-block: 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--green); padding: 32px 28px; }
.login-card img { height: 56px; margin-bottom: 22px; }
.login-card h1 { font-size: 24px; margin-bottom: 6px; }
.login-card .sub { margin-bottom: 22px; }
.google-btn { width: 100%; justify-content: center; padding: 11px 14px; background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink); font-weight: 600; }
.google-btn:hover { background: var(--surface-alt); }
.google-btn svg { width: 18px; height: 18px; }
.login-error { color: var(--danger); font-weight: 600; margin-top: 14px; }
.login-foot { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.signout { border: 1px solid var(--line-strong); background: var(--surface); padding: 6px 10px; font-weight: 600; font-size: 13px; border-radius: var(--r); }
.signout:hover { background: var(--surface-alt); }
.radio-list { display: grid; gap: 0; border: 1px solid var(--line); }
.radio-list label { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.radio-list label:first-child { border-top: 0; }
.radio-list label:hover { background: var(--surface-alt); }
.radio-list input { margin-top: 3px; accent-color: var(--green); }
.radio-list b { display: block; }
.radio-list span { color: var(--muted); font-size: 13px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { flex: 1 1 220px; }
td select { border: 1px solid var(--line-strong); padding: 5px 8px; border-radius: var(--r); background: var(--surface); }
.follow-btn[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #1B1F1D; }
.settings-grid { display: grid; gap: 20px; max-width: 760px; }
