/* GTP (Goal Tracking Platform). Mobile first; one stylesheet, no build step.
   Branded to match dryice.co.za: navy header with the round DII logo, Poppins, navy
   headings, steel-blue panels with white text. Their bright red is kept for "Behind" /
   "Overdue" only, so red always means a problem.
   Status colours always come with a text label, never colour alone. */
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/poppins-400.woff2) format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/poppins-500.woff2) format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/poppins-600.woff2) format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/poppins-700.woff2) format("woff2"); }
:root {
  --ink: #2a2a2a;          /* dryice.co.za body text */
  --muted: #707070;
  --line: #e1e5ee;
  --bg: #f4f6fa;
  --card: #ffffff;
  --brand: #263a75;        /* DII navy (header, headings) */
  --brand-2: #4c8ab1;      /* DII steel blue (panels, links) */
  --brand-red: #e30613;    /* DII red: problems only */
  --focus: #4c8ab1;
  --s-not_started: #8a8f99;
  --s-on_track: #1f8f4e;
  --s-at_risk: #d68a00;
  --s-behind: var(--brand-red);
  --s-done: #4c8ab1;
  --overdue: var(--brand-red);
  --radius: 6px;
  --shadow: 0 1px 2px rgba(38, 58, 117, .06), 0 3px 10px rgba(38, 58, 117, .06);
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* Full-height column: main grows, so the footer sits at the bottom of short pages. */
body { margin: 0; background: var(--bg); font-size: 14.5px; line-height: 1.5; padding-bottom: 72px;
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; box-sizing: border-box; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--brand); font-weight: 600; }
h1 { font-size: 1.45rem; margin: 0 0 .75rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .6rem; }
h3 { font-size: .95rem; margin: 0 0 .5rem; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- header and navigation ---------------------------------------------------------- */
.topbar { background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 6px rgba(0, 0, 0, .15); }
.topbar .in { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; gap: 1rem; padding: .45rem 16px; }
.brand { color: #fff; display: flex; align-items: center; gap: .7rem; }
.brand:hover { text-decoration: none; }
.brand img { width: 52px; height: 52px; display: block; }
.brand .t { display: flex; flex-direction: column; line-height: 1.15; }
.brand b { font-size: 1.05rem; font-weight: 600; letter-spacing: .01em; }
.brand span { font-weight: 400; opacity: .85; font-size: .78rem; }
.topnav { display: none; gap: .15rem; margin-left: 1.25rem; }
.topnav a { color: #fff; font-weight: 500; font-size: .92rem; padding: .4rem .75rem; border-radius: 4px; }
.topnav a.on, .topnav a:hover { background: rgba(255, 255, 255, .14); text-decoration: none; }
.topnav a.on { box-shadow: inset 0 -3px 0 #fff; }
.who { margin-left: auto; display: flex; align-items: center; gap: .6rem; font-size: .85rem; }
.who form { margin: 0; }
.who button { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .45); border-radius: 4px;
  padding: .3rem .7rem; font: inherit; font-weight: 500; cursor: pointer; }
.who button:hover { background: rgba(255, 255, 255, .12); }
.who a.me { color: #fff; display: flex; align-items: center; gap: .5rem; padding: .2rem .5rem .2rem .2rem; border-radius: 999px; }
.who a.me:hover, .who a.me.on { background: rgba(255, 255, 255, .14); text-decoration: none; }
.who .av { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-2); color: #fff; font-weight: 600;
  font-size: .8rem; display: inline-flex; align-items: center; justify-content: center; border: 2px solid rgba(255, 255, 255, .7); }
.mt0 { margin-top: 0; }
legend.lbl { font-weight: 600; font-size: .85rem; margin: .75rem 0 .4rem; padding: 0; }
fieldset.bare + fieldset.bare { margin-top: .75rem; }
.site-foot { width: 100%; max-width: 1400px; margin: 0 auto; padding: 1.5rem 16px 2rem; color: var(--muted); font-size: .8rem;
  display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; justify-content: space-between; border-top: 1px solid var(--line); }
.site-foot a { color: var(--muted); }
.who .name { display: none; }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { flex: 1; text-align: center; padding: .55rem 0 .5rem; color: var(--muted); font-size: .75rem; }
.tabbar a .i { display: block; font-size: 1.15rem; line-height: 1.2; }
.tabbar a.on { color: var(--brand); font-weight: 600; }
.devbar { background: #fff4d6; color: #6b4b00; text-align: center; font-size: .8rem; padding: .3rem 16px; }
main { flex: 1 0 auto; width: 100%; max-width: 1400px; margin: 0 auto; padding: 1rem 16px 2rem; }
.flash { padding: .6rem .8rem; border-radius: 8px; margin-bottom: .75rem; }
.flash.ok { background: #e3f4ea; color: #155c34; }
.flash.error { background: #fbe4e4; color: #8c2020; }

@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .tabbar { display: none; }
  .topnav { display: flex; }
  .who .name { display: inline; }
}

/* ---- building blocks --------------------------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; }
.btn { display: inline-flex; align-items: center; gap: .35rem; background: var(--brand); color: #fff; border: 0; border-radius: 4px;
  padding: .55rem 1rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--line); }
.btn.danger { background: #b42d2d; }
.btn.small { padding: .3rem .6rem; font-size: .85rem; }
.btn.ms { background: #2f2f2f; }
input[type=text], input[type=email], input[type=date], input[type=number], input[type=search], select, textarea {
  font: inherit; color: inherit; border: 1px solid #c8d2dd; border-radius: 8px; padding: .5rem .6rem; background: #fff; width: 100%; }
textarea { min-height: 5rem; resize: vertical; }
label { display: block; font-weight: 600; font-size: .85rem; margin: .75rem 0 .25rem; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; font-size: .95rem; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 160px; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
.chip { display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .02em; padding: .1rem .5rem;
  border-radius: 999px; background: #e6eef6; color: var(--brand); white-space: nowrap; }
.status { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 600; padding: .15rem .55rem;
  border-radius: 999px; color: #fff; white-space: nowrap; }
.status::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: rgba(255, 255, 255, .85); }
.s-not_started { background: var(--s-not_started); }
.s-on_track { background: var(--s-on_track); }
.s-at_risk { background: var(--s-at_risk); }
.s-behind { background: var(--s-behind); }
.s-done { background: var(--s-done); }
.due.overdue { color: var(--overdue); font-weight: 600; }
.empty { color: var(--muted); padding: 1rem 0; }
table.t { width: 100%; border-collapse: collapse; background: var(--card); }
table.t th, table.t td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: #fff; background: var(--brand); }
table.t tbody tr:hover { background: #f7f9fc; }
table.t th a { color: inherit; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }

/* ---- dashboard ---------------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem .8rem; color: var(--ink);
  border-left: 5px solid var(--line); box-shadow: var(--shadow); }
.kpi:hover { text-decoration: none; border-color: var(--brand-2); }
.kpi .n { font-size: 1.7rem; font-weight: 600; line-height: 1.1; display: block; color: var(--brand); }
.kpi .l { font-size: .8rem; color: var(--muted); }
.kpi.k-not_started { border-left-color: var(--s-not_started); }
.kpi.k-on_track { border-left-color: var(--s-on_track); }
.kpi.k-at_risk { border-left-color: var(--s-at_risk); }
.kpi.k-behind { border-left-color: var(--s-behind); }
.kpi.k-done { border-left-color: var(--s-done); }
.kpi.k-overdue { border-left-color: var(--overdue); }
.kpi.k-overdue .n { color: var(--overdue); }
.bar { display: block; width: 100%; height: 10px; border-radius: 999px; overflow: hidden; background: #e8eef5; margin: .45rem 0 .35rem; }
.r-not_started, .d-not_started { fill: var(--s-not_started); background: var(--s-not_started); }
.r-on_track, .d-on_track { fill: var(--s-on_track); background: var(--s-on_track); }
.r-at_risk, .d-at_risk { fill: var(--s-at_risk); background: var(--s-at_risk); }
.r-behind, .d-behind { fill: var(--s-behind); background: var(--s-behind); }
.r-done, .d-done { fill: var(--s-done); background: var(--s-done); }
.dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; margin-right: .25rem; }
.kpi.k-attention { border-left-color: var(--s-at_risk); }
.mini { list-style: none; margin: 0; padding: 0; }
.mini li { padding: .55rem 0; border-bottom: 1px solid var(--line); }
.mini li:last-child { border-bottom: 0; }
.mini a.t { color: var(--ink); font-weight: 500; }
.mini .meta { font-size: .8rem; color: var(--muted); margin-top: .15rem; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.more { margin: .6rem 0 0; }

/* Layout: one column on phones (attention, units, activity, my goals); on wide screens
   attention + activity + my goals on the left, the unit list on the right. */
.dash { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 1.25rem; grid-template-areas: "attn" "units" "act" "mine"; align-items: start; }
.d-attn { grid-area: attn; } .d-units { grid-area: units; } .d-act { grid-area: act; } .d-mine { grid-area: mine; }

/* Needs attention: tabs (JS) or stacked panels (no JS). */
.tabs-card { padding-top: .25rem; }
.tabs { display: none; gap: .25rem; border-bottom: 1px solid var(--line); margin: 0 -1rem .25rem; padding: 0 1rem; overflow-x: auto; }
.js .tabs { display: flex; }
.js .nojs-only { display: none; }
.tab { font: inherit; font-size: .88rem; font-weight: 500; color: var(--muted); background: none; border: 0; padding: .7rem .6rem .6rem;
  border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: .4rem; }
.tab:hover { color: var(--brand); }
.tab[aria-selected="true"] { color: var(--brand); font-weight: 600; border-bottom-color: var(--brand); }
.tab .tn { font-size: .75rem; font-weight: 600; min-width: 1.5rem; padding: .05rem .4rem; border-radius: 999px; background: #e6eef6; color: var(--brand); text-align: center; }
.tab.t-overdue .tn { background: var(--overdue); color: #fff; }
.tabpanel h3 { margin-top: .75rem; }
.tabpanel .hint { margin: .5rem 0 0; }
@media (max-width: 599px) {
  .tabs { gap: 0; margin: 0 -.75rem .25rem; padding: 0 .5rem; }
  .tab { font-size: .82rem; padding: .7rem .4rem .6rem; gap: .3rem; }
  .tab .tn { min-width: 1.3rem; padding: .05rem .3rem; }
}

/* Business units: one compact row each, worst first. */
.units { padding: 0; overflow: hidden; margin-bottom: .75rem; }
.ugroup-h { background: var(--brand-2); color: #fff; font-weight: 600; font-size: .85rem; padding: .45rem .9rem; }
.urow { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.units > .urow:last-child, .ugroup:last-child > .usub > .urow:last-child, .ugroup:last-child > .usub[hidden] + * { border-bottom: 0; }
.ulink { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name count" "bar bar" "flags flags";
  gap: .2rem .6rem; padding: .6rem .4rem .6rem .9rem; color: var(--ink); }
.ulink:hover { background: #f4f8fc; text-decoration: none; }
.uname { grid-area: name; min-width: 0; line-height: 1.3; }
.uname .muted { font-size: .85rem; }
.uname b { color: var(--brand); font-weight: 600; }
.ulink .bar { grid-area: bar; margin: .15rem 0; height: 8px; }
.uflags { grid-area: flags; display: flex; flex-wrap: wrap; gap: .3rem; }
.ucount { grid-area: count; font-size: .8rem; color: var(--muted); align-self: center; white-space: nowrap; }
.utoggle-gap { width: 2.4rem; flex: none; }
.flag { font-size: .72rem; font-weight: 600; padding: .05rem .45rem; border-radius: 999px; white-space: nowrap; }
.f-overdue { background: var(--overdue); color: #fff; }
.f-behind { background: #fde3e4; color: #a3050e; }
.f-at_risk { background: #fdf0d5; color: #7a4f00; }
.f-ok { background: #e1f3e8; color: #17663a; }
.usub { background: #f8fafc; }
.usub .ulink { padding-left: 2rem; }
.utoggle, .upin button { background: none; border: 0; cursor: pointer; color: var(--muted); width: 2.4rem; height: 2.4rem;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 1.05rem; }
.utoggle:hover, .upin button:hover { background: #eef3f9; color: var(--brand); }
.upin { margin: 0 .3rem 0 0; }
.upin button.on { color: #d68a00; }
.chev { width: .55rem; height: .55rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-top: -.2rem; transition: transform .15s; }
.utoggle[aria-expanded="true"] .chev { transform: rotate(-135deg); margin-top: .25rem; }
.pin-pick { columns: 2 220px; column-gap: 2rem; }
.pin-group { break-inside: avoid; }
.pin-group:has(.pin-kids) { padding-bottom: .35rem; }
.pin-pick label.check { margin: 0; padding: .2rem 0; align-items: center; }
.pin-pick label.check input { flex: none; margin: 0; }
.pin-kids { margin-left: .55rem; padding-left: .9rem; border-left: 2px solid var(--line); }

@media (min-width: 600px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
  /* Fixed columns so every unit's bar starts and ends in the same place. */
  .ulink { grid-template-columns: minmax(0, 1fr) 110px 13.5rem 4.6rem; grid-template-areas: "name bar flags count"; align-items: center; gap: .75rem; }
  .ulink .bar { margin: 0; }
  .uflags { justify-content: flex-start; }
  .ucount { text-align: right; }
}
@media (min-width: 1000px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .dash { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); grid-template-areas: "attn units" "act units" "mine units"; }
  .d-units { grid-row: 1 / span 3; }
}

/* ---- filters ------------------------------------------------------------------------ */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.filters input[type=search] { flex: 1 1 200px; width: auto; }
.filters select { width: auto; flex: 0 1 auto; min-width: 0; max-width: 100%; }
.filters .count { margin-left: auto; color: var(--muted); font-size: .85rem; }

/* ---- board -------------------------------------------------------------------------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 85vw); gap: .75rem; overflow-x: auto;
  scroll-snap-type: x mandatory; padding-bottom: .5rem; }
.col { background: #e9eef4; border-radius: var(--radius); padding: .6rem; scroll-snap-align: start; min-height: 200px; }
.col.drop { outline: 2px dashed var(--brand-2); outline-offset: -4px; background: #e0ecf7; }
.col-h { display: flex; align-items: center; justify-content: space-between; margin: 0 .2rem .6rem; }
.col-h .n { font-size: .8rem; color: var(--muted); font-weight: 600; }
.gcard { display: block; background: var(--card); border-radius: 8px; padding: .65rem .7rem; margin-bottom: .5rem; color: var(--ink);
  box-shadow: var(--shadow); border-left: 4px solid var(--line); }
.gcard:hover { text-decoration: none; box-shadow: 0 2px 10px rgba(15, 31, 51, .15); }
.gcard[draggable=true] { cursor: grab; }
.gcard.dragging { opacity: .5; }
.gcard.c-not_started { border-left-color: var(--s-not_started); }
.gcard.c-on_track { border-left-color: var(--s-on_track); }
.gcard.c-at_risk { border-left-color: var(--s-at_risk); }
.gcard.c-behind { border-left-color: var(--s-behind); }
.gcard.c-done { border-left-color: var(--s-done); }
.gcard .t { font-weight: 500; font-size: .92rem; }
.gcard .chips { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .35rem; }
.gcard .meta { display: flex; gap: .6rem; flex-wrap: wrap; font-size: .78rem; color: var(--muted); margin-top: .4rem; }
@media (min-width: 900px) { .board { grid-auto-columns: minmax(250px, 1fr); } }

/* ---- goal page ---------------------------------------------------------------------- */
.goal-head { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .5rem; }
.goal-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 900px) { .goal-grid { grid-template-columns: 2fr 1fr; } }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
dl.facts dt { color: var(--muted); font-size: .85rem; }
dl.facts dd { margin: 0; }
.status-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .4rem; }
.status-pick label { margin: 0; font-weight: 600; font-size: .85rem; display: flex; align-items: center; gap: .4rem; padding: .5rem .6rem;
  border: 2px solid var(--line); border-radius: 8px; cursor: pointer; background: #fff; }
.status-pick input { accent-color: var(--brand); }
.status-pick label:has(input:checked) { border-color: var(--brand); background: #eef5fb; }
.thread { list-style: none; margin: 0; padding: 0; }
.thread li { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.thread .by { font-size: .82rem; color: var(--muted); }
.thread .by b { color: var(--ink); }
.thread .body { white-space: pre-wrap; margin-top: .2rem; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: .85rem; }
.timeline li { padding: .4rem 0 .4rem .9rem; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: .75rem; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-2); }
.timeline li.h-comment::before { background: var(--muted); }
.history-more summary { cursor: pointer; color: var(--brand-2); font-size: .85rem; font-weight: 500; padding: .5rem 0 .25rem; list-style: none; }
.history-more summary::-webkit-details-marker { display: none; }
.history-more summary::after { content: " ▾"; }
.history-more[open] summary::after { content: " ▴"; }
.history-more .opened, .history-more[open] .closed { display: none; }
.history-more[open] .opened { display: inline; }.note { background: #f6f9fc; border-left: 3px solid var(--brand-2); padding: .5rem .7rem; border-radius: 0 6px 6px 0; white-space: pre-wrap; }

/* ---- login (navy page, logo above a white card) ------------------------------------- */
body.login-page { background: var(--brand) linear-gradient(160deg, #263a75 0%, #1d2d5c 60%, #4c8ab1 140%); min-height: 100vh; padding-bottom: 0; }
body.login-page .site-foot { border-top-color: rgba(255, 255, 255, .15); color: #c9d3ea; }
body.login-page .site-foot a { color: #c9d3ea; }
.login { max-width: 420px; margin: 6vh auto 0; text-align: center; }
.login .logo { width: 150px; height: 150px; display: block; margin: 0 auto 1rem; filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .25)); }
.login .card { padding: 1.5rem; text-align: left; border: 0; }
.login h1 { margin-bottom: .1rem; }
.people { list-style: none; margin: .75rem 0 0; padding: 0; }
.people li + li { margin-top: .4rem; }
.people button { width: 100%; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem;
  font: inherit; cursor: pointer; }
.people button:hover { border-color: var(--brand-2); background: #f4f8fc; }
.people button b { color: var(--brand); font-weight: 600; }

/* ---- admin -------------------------------------------------------------------------- */
.subnav { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.subnav a { padding: .35rem .8rem; border-radius: 999px; background: #e6eef6; color: var(--brand); font-size: .88rem; font-weight: 500; }
.subnav a.on { background: var(--brand); color: #fff; }
.issues { color: #8c2020; font-size: .85rem; }
.actions.fixed { flex: 0 0 auto; margin-top: 0; }
fieldset.bare { border: 0; padding: 0; margin: 0; min-width: 0; }
.mt { margin-top: 1rem; }
.inline { display: inline; margin: 0; }
