/* MilestoneWatch — AFGHS - CHS theme
   CHS brand: navy #233D77, amber #FBB040, sand #BEB58B (card outlines on chskenya.org)
   Department colours: TB = light lime green, HIV = #0096C7 */
:root {
  --navy: #233D77;
  --navy-700: #1a2f5e;
  --navy-50: #eef1f8;
  --amber: #FBB040;
  --amber-600: #e39a22;
  --amber-50: #fff6e6;
  --sand: #BEB58B;
  --sand-50: #f7f5ec;

  --tb: #B8E86A;        /* light lime green */
  --tb-ink: #2f4a06;
  --tb-soft: #f0fadc;
  --hiv: #0096C7;
  --hiv-ink: #ffffff;
  --hiv-soft: #e1f4fb;

  --t-virtual: #7c4dce;
  --t-physical: #e8890c;
  --t-internal: #233D77;

  --ink: #1f2a44;
  --ink-2: #4a5574;
  --muted: #6c7690;
  --line: #e2e5ee;
  --bg: #f4f5f9;
  --card: #ffffff;

  --ok: #1e8e4e;     --ok-50: #e5f6ec;
  --warn: #b26b00;   --warn-50: #fff3dc;
  --bad: #c0392b;    --bad-50: #fde8e6;
  --info: #2a5db0;   --info-50: #e7effc;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 2px 8px rgba(20, 30, 60, .04);
  --font: "Quicksand", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-head: "Ubuntu", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-weight: 500; font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg); }
a { color: var(--navy); }
a:hover { color: var(--amber-600); }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--navy); margin: 0 0 .5em; line-height: 1.25; font-weight: 700; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; }
code { background: var(--navy-50); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ------------------------------------------------------------ top bar & brand */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; height: 66px; padding: 0 20px;
  background: #fff; border-bottom: 3px solid var(--amber); box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.brand img { height: 42px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; border-left: 2px solid var(--line); padding-left: 12px; line-height: 1.15; }
.brand-afghs { font-family: var(--font-head); font-weight: 700; color: var(--navy); font-size: 1.05rem; letter-spacing: .3px; white-space: nowrap; }
.brand-app { font-weight: 700; color: var(--amber-600); font-size: .82rem; letter-spacing: .4px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.me { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.me-text { display: flex; flex-direction: column; line-height: 1.2; }
.me-text small { color: var(--muted); font-size: .78rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .8rem; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; font-size: 20px; padding: 4px 10px; cursor: pointer; color: var(--navy); }

/* ------------------------------------------------------------ shell */
.shell { display: flex; min-height: calc(100vh - 66px); }
.sidenav { width: 220px; flex: none; background: var(--navy); color: #cfd6ea; padding: 18px 12px; position: sticky; top: 66px; height: calc(100vh - 66px); overflow-y: auto; }
.sidenav a, .nav-logout button { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 8px; color: #dfe4f2; text-decoration: none; font-weight: 600; font-size: .95rem; width: 100%; background: none; border: 0; cursor: pointer; font-family: inherit; text-align: left; }
.sidenav a:hover, .nav-logout button:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidenav a.active { background: var(--amber); color: var(--navy-700); }
.nav-sep { margin: 18px 12px 6px; font-size: .72rem; text-transform: uppercase; letter-spacing: 1px; color: #8e9bc0; }
.main { flex: 1; min-width: 0; padding: 24px 28px 48px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

/* ------------------------------------------------------------ cards & grid */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head a { font-size: .88rem; font-weight: 600; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.grid > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 18px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); border-top: 4px solid var(--navy); transition: transform .12s; }
.kpi:hover { transform: translateY(-2px); color: var(--ink); }
.kpi .kpi-label { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.kpi .kpi-value { font-family: var(--font-head); font-size: 1.75rem; color: var(--navy); font-weight: 700; line-height: 1.2; margin-top: 4px; }
.kpi .kpi-note { font-size: .82rem; color: var(--ink-2); }
.kpi.k-amber { border-top-color: var(--amber); }
.kpi.k-ok { border-top-color: var(--ok); }
.kpi.k-bad { border-top-color: var(--bad); }
.kpi.k-hiv { border-top-color: var(--hiv); }
.kpi.k-tb { border-top-color: var(--tb); }

.bar { height: 8px; background: var(--navy-50); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }

/* ------------------------------------------------------------ buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; background: var(--navy); color: #fff !important; border: 1px solid var(--navy); border-radius: 8px; font-family: inherit; font-weight: 700; font-size: .92rem; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { background: var(--navy-700); }
.btn .ico { width: 16px; height: 16px; }
.btn-accent { background: var(--amber); border-color: var(--amber); color: var(--navy-700) !important; }
.btn-accent:hover { background: var(--amber-600); }
.btn-ghost { background: #fff; color: var(--navy) !important; border-color: var(--line); }
.btn-ghost:hover { background: var(--navy-50); }
.btn-danger { background: #fff; color: var(--bad) !important; border-color: #f1c6c0; }
.btn-danger:hover { background: var(--bad-50); }
.btn-sm { padding: 6px 11px; font-size: .84rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--navy); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.form label { display: block; font-weight: 600; font-size: .9rem; color: var(--ink-2); margin-bottom: 14px; }
.form label .hint { display: block; font-weight: 500; color: var(--muted); font-size: .8rem; margin-top: 3px; }
input[type=text], input[type=email], input[type=date], input[type=time], input[type=number], input[type=url], input[type=search], input:not([type]), select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid #cfd4e2; border-radius: 8px; font: inherit; font-weight: 500; color: var(--ink); background: #fff; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(35,61,119,.15); }
input[type=file] { margin-top: 6px; font: inherit; }
.form label.check, label.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 16px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px 4px; margin: 0 0 14px; }
legend { font-weight: 700; color: var(--navy); padding: 0 6px; font-size: .9rem; }
.checklist { max-height: 220px; overflow-y: auto; border: 1px solid #cfd4e2; border-radius: 8px; padding: 6px 10px; margin-top: 5px; background: #fff; }
.checklist label { margin: 0; padding: 5px 0; font-weight: 500; color: var(--ink); display: flex; gap: 8px; align-items: center; border-bottom: 1px dashed var(--line); }
.checklist label:last-child { border-bottom: 0; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.filter-bar label { margin: 0; font-size: .8rem; font-weight: 700; color: var(--muted); }
.filter-bar select, .filter-bar input { margin-top: 3px; min-width: 150px; padding: 7px 10px; }
.inline-form { display: inline; }
.req { color: var(--bad); }

/* ------------------------------------------------------------ flash messages */
.flash { position: relative; padding: 11px 40px 11px 14px; border-radius: 8px; margin-bottom: 14px; font-weight: 600; border: 1px solid transparent; }
.flash-success { background: var(--ok-50); color: #145c33; border-color: #bfe5cd; }
.flash-error { background: var(--bad-50); color: #8e2418; border-color: #f2c3bc; }
.flash-info { background: var(--info-50); color: #1d4589; border-color: #c8d8f4; }
.flash-warn, .reminder { background: var(--amber-50); color: #7a4c00; border-color: #f6d79e; }
.flash-x { position: absolute; right: 10px; top: 8px; background: none; border: 0; font-size: 20px; cursor: pointer; color: inherit; opacity: .6; }
.reminder { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 8px; border: 1px solid #f6d79e; border-left: 5px solid var(--amber); margin-bottom: 16px; font-weight: 600; }

/* ------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; padding: 9px 10px; border-bottom: 2px solid var(--line); background: #fafbfd; white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:hover td { background: #fafbfe; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tfoot td { font-weight: 700; border-top: 2px solid var(--line); background: #fafbfd; }

/* ------------------------------------------------------------ badges */
.dept { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .76rem; font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
.dept-tb { background: var(--tb); color: var(--tb-ink); }
.dept-hiv { background: var(--hiv); color: var(--hiv-ink); }
.dept-both { background: linear-gradient(110deg, var(--tb) 0 50%, var(--hiv) 50% 100%); color: #12304a; text-shadow: 0 0 3px rgba(255,255,255,.8); }
.code-tag { display: inline-block; font-family: var(--font-head); font-weight: 700; font-size: .82rem; padding: 2px 8px; border-radius: 6px; color: #fff; background: var(--navy); white-space: nowrap; }
.code-tag.dept-tb { background: var(--tb); color: var(--tb-ink); }
.code-tag.dept-hiv { background: var(--hiv); color: #fff; }

.atype { display: inline-flex; align-items: center; gap: 5px; font-size: .76rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: #f0f1f6; color: var(--ink-2); white-space: nowrap; }
.atype::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.atype-virtual { color: var(--t-virtual); background: #f1ebfb; }
.atype-physical { color: var(--t-physical); background: #fff1de; }
.atype-internal { color: var(--t-internal); background: var(--navy-50); }

.status, .astate { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.status-achieved, .astate-completed { background: var(--ok-50); color: var(--ok); }
.status-partially_achieved { background: var(--warn-50); color: var(--warn); }
.status-not_achieved { background: var(--bad-50); color: var(--bad); }
.status-not_due, .astate-upcoming, .astate-tbd { background: #eef0f5; color: #5b6582; }
.status-pending { background: var(--amber-50); color: #9a5f00; border: 1px dashed #f0c06a; }
.astate-awaiting_closure { background: var(--bad-50); color: var(--bad); }
.astate-ongoing { background: var(--info-50); color: var(--info); }
.astate-cancelled { background: #eee; color: #777; text-decoration: line-through; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 5px; background: var(--navy-50); color: var(--navy); font-size: .76rem; font-weight: 700; }
.ini { font-weight: 700; color: var(--navy); font-size: .85em; white-space: nowrap; }

/* ------------------------------------------------------------ milestone cards */
.ms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.ms-card { position: relative; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 16px 14px 20px; text-decoration: none; color: var(--ink); overflow: hidden; }
.ms-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--navy); }
.ms-card.dept-tb::before { background: var(--tb); }
.ms-card.dept-hiv::before { background: var(--hiv); }
.ms-card.dept-both::before { background: linear-gradient(var(--tb) 0 50%, var(--hiv) 50% 100%); }
.ms-card:hover { border-color: #c9cfe0; color: var(--ink); }
.ms-card .ms-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.ms-card h3 { font-size: .98rem; margin-bottom: 10px; color: var(--ink); font-family: var(--font); font-weight: 700; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ms-card .ms-meta { display: flex; justify-content: space-between; gap: 8px; font-size: .82rem; color: var(--muted); margin-top: auto; padding-top: 8px; border-top: 1px dashed var(--line); }
.ms-card .ms-due { font-size: .8rem; font-weight: 700; color: var(--bad); }
.ms-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.ms-row:last-child { border-bottom: 0; }
.ms-row:hover { color: var(--navy); }
.ms-row .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: .92rem; }

.status-strip { display: flex; gap: 3px; margin-top: 2px; }
.status-strip i { flex: 1; height: 6px; border-radius: 3px; background: #e7e9f0; }
.status-strip i.s-achieved { background: var(--ok); }
.status-strip i.s-partially_achieved { background: #f0a92b; }
.status-strip i.s-not_achieved { background: var(--bad); }
.status-strip i.s-not_due { background: #b8bfd2; }
.status-strip i.s-due { background: #fff; border: 1.5px dashed var(--bad); }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .8rem; color: var(--ink-2); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

/* ------------------------------------------------------------ detail page */
.kv { display: grid; grid-template-columns: minmax(130px, auto) 1fr; gap: 8px 16px; margin: 0 0 12px; }
.kv dt { color: var(--muted); font-weight: 700; font-size: .84rem; }
.kv dd { margin: 0; white-space: pre-line; }
.prose { white-space: pre-line; }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; padding: 9px 14px; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs button.active { color: var(--navy); border-bottom-color: var(--amber); }
.tabs .count { display: inline-block; background: var(--navy-50); color: var(--navy); border-radius: 99px; padding: 0 7px; font-size: .75rem; margin-left: 4px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.act-list { list-style: none; margin: 0; padding: 0; }
.act-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.act-list li:last-child { border-bottom: 0; }
.act-date { flex: none; width: 54px; text-align: center; background: var(--navy-50); border-radius: 8px; padding: 5px 0; line-height: 1.1; }
.act-date b { display: block; font-family: var(--font-head); font-size: 1.15rem; color: var(--navy); }
.act-date small { font-size: .7rem; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.act-body { flex: 1; min-width: 0; }
.act-body a.t { font-weight: 700; text-decoration: none; color: var(--ink); }
.act-body a.t:hover { color: var(--navy); }
.act-sub { font-size: .82rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 3px; }

.docs { list-style: none; margin: 0; padding: 0; }
.docs li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.docs li:last-child { border-bottom: 0; }
.docs .meta { font-size: .8rem; color: var(--muted); }
.ficon { flex: none; display: inline-grid; place-items: center; width: 38px; height: 30px; border-radius: 6px; background: var(--navy); color: #fff; font-size: .68rem; font-weight: 700; letter-spacing: .5px; }
.no-doc { color: var(--bad); font-weight: 700; font-size: .88rem; }
.empty-state { text-align: center; padding: 32px 20px; color: var(--muted); }
.empty { color: var(--muted); font-style: italic; padding: 8px 0; }

/* ------------------------------------------------------------ calendar */
.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.cal-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-toolbar .cal-title { font-family: var(--font-head); font-size: 1.2rem; color: var(--navy); font-weight: 700; min-width: 170px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 7px 13px; font: inherit; font-weight: 700; color: var(--ink-2); cursor: pointer; font-size: .86rem; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active { background: var(--navy); color: #fff; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-dow { padding: 7px 8px; font-size: .74rem; text-transform: uppercase; font-weight: 700; color: var(--muted); background: #fafbfd; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal-day { min-height: 112px; padding: 5px 5px 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; background: #fff; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day:hover { background: #fbfbfe; }
.cal-day.other { background: #f8f9fb; }
.cal-day.other .dnum { color: #b2b8c9; }
.cal-day.weekend { background: #fcfcfd; }
.cal-day.selected { box-shadow: inset 0 0 0 2px var(--amber); background: var(--amber-50); }
.cal-day .dnum { font-size: .82rem; font-weight: 700; color: var(--ink-2); display: flex; justify-content: space-between; align-items: center; }
.cal-day.today .dnum span { background: var(--navy); color: #fff; border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; }
.cal-more { font-size: .76rem; font-weight: 700; color: var(--navy); padding: 1px 4px; border-radius: 4px; background: var(--navy-50); align-self: flex-start; }

/* activity chip: background = department colour, left stripe + dot = activity type */
.chip { display: block; font-size: .76rem; line-height: 1.25; padding: 3px 6px 3px 7px; border-radius: 5px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 4px solid var(--t-physical); font-weight: 600; }
.chip.dept-tb { background: var(--tb); color: var(--tb-ink); }
.chip.dept-hiv { background: var(--hiv); color: #fff; }
.chip.dept-both { background: linear-gradient(100deg, var(--tb) 0 50%, var(--hiv) 50% 100%); color: #10283f; text-shadow: 0 0 3px rgba(255,255,255,.9); }
.chip.t-virtual { border-left: 4px dashed var(--t-virtual); }
.chip.t-physical { border-left: 4px solid var(--t-physical); }
.chip.t-internal { border-left: 4px double var(--t-internal); border-left-width: 5px; }
.chip .tk { display: inline-block; width: 15px; height: 15px; border-radius: 3px; font-size: .64rem; text-align: center; line-height: 15px; margin-right: 4px; color: #fff; font-weight: 700; text-shadow: none; vertical-align: 1px; }
.chip.t-virtual .tk { background: var(--t-virtual); }
.chip.t-physical .tk { background: var(--t-physical); }
.chip.t-internal .tk { background: var(--t-internal); }
.chip.done { opacity: .62; }
.chip.done::after { content: " ✓"; }
.chip:hover { filter: brightness(.96); }
.chip .ci { font-weight: 800; }

.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-week .cal-day { min-height: 340px; }
.cal-week .chip { white-space: normal; }
.cal-dayview .chip { white-space: normal; font-size: .9rem; padding: 8px 10px; margin-bottom: 8px; }

.panel { position: sticky; top: 84px; }
.panel h2 { margin-bottom: 2px; }
.panel .act-list li { padding: 9px 0; }
.p-act { display: block; border-radius: 8px; padding: 9px 11px; margin-bottom: 9px; text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-left: 6px solid var(--navy); background: #fff; }
.p-act.dept-tb { border-left-color: var(--tb); }
.p-act.dept-hiv { border-left-color: var(--hiv); }
.p-act.dept-both { border-image: linear-gradient(var(--tb) 0 50%, var(--hiv) 50% 100%) 1; border-left-width: 6px; border-image-slice: 1; }
.p-act:hover { background: #fafbfe; color: var(--ink); }
.p-act .pt { font-weight: 700; font-size: .92rem; }
.p-act .ps { font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.flex-list { margin-top: 14px; }
.flex-list h3 { font-size: .9rem; }

/* ------------------------------------------------------------ auth */
.auth-main { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px;
  background: radial-gradient(circle at 15% 10%, rgba(251,176,64,.18), transparent 40%), radial-gradient(circle at 90% 90%, rgba(0,150,199,.14), transparent 45%), var(--bg); }
.auth-main > .flash { width: 100%; max-width: 440px; }
.auth-card { width: 100%; max-width: 440px; background: #fff; border-radius: 14px; padding: 28px 28px 22px; box-shadow: 0 10px 40px rgba(20,30,60,.12); border-top: 5px solid var(--amber); }
.auth-card .brand { margin-bottom: 22px; }
.auth-card h1 { font-size: 1.35rem; }
.otp-input { font-size: 1.6rem !important; letter-spacing: 10px; text-align: center; font-weight: 700 !important; font-family: var(--font-head) !important; }

/* ------------------------------------------------------------ modal */
.modal-back { position: fixed; inset: 0; background: rgba(15, 22, 45, .45); z-index: 50; display: none; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal-back.open { display: flex; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; padding: 20px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modal-head h2 { margin: 0; }
.modal-x { background: none; border: 0; font-size: 24px; cursor: pointer; color: var(--muted); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1150px) {
  .cal-wrap, .grid-main { grid-template-columns: minmax(0, 1fr); }
  .panel { position: static; }
}
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .nav-toggle { display: inline-block; }
  .sidenav { position: fixed; left: 0; top: 66px; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 20px rgba(0,0,0,.2); }
  body.nav-open .sidenav { transform: none; }
  .main { padding: 18px 16px 40px; }
  .me-text, .hide-sm { display: none !important; }
  .brand img { height: 34px; }
  .brand-afghs { font-size: .95rem; }
  .cal-day { min-height: 74px; }
  .cal-day .chip { font-size: 0; padding: 0; height: 7px; border-left-width: 0 !important; border-radius: 3px; }
  .cal-day .chip .tk { display: none; }
  .cal-week { grid-template-columns: minmax(0, 1fr); }
  .cal-week .cal-day { min-height: 0; }
  .cal-week .cal-day .chip { font-size: .8rem; height: auto; padding: 4px 7px; border-left-width: 4px !important; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dt { margin-top: 6px; }
}
@media (max-width: 520px) {
  .brand-app { display: none; }
  .brand-text { padding-left: 8px; }
  .brand-afghs { font-size: .85rem; }
  .topbar { padding: 0 12px; }
  .cal-dow { font-size: .62rem; padding: 5px 3px; }
}
@media print {
  .topbar, .sidenav, .btn, .filter-bar { display: none !important; }
  .main { padding: 0; }
  .card { box-shadow: none; }
}

.flex-list summary { cursor: pointer; color: var(--ink-2); padding: 6px 0; }
.flex-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 12px; margin-top: 8px; }
.flex-item { display: flex; flex-direction: column; min-width: 0; }
.flex-item .chip { max-width: 100%; }

/* chip: name truncates, initials always visible */
.chip { display: flex; align-items: center; gap: 0; }
.chip .tk { flex: none; }
.chip .ct { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .ci { flex: none; margin-left: 4px; font-size: .92em; }
.cal-week .chip .ct, .cal-dayview .chip .ct { white-space: normal; }
.legend .chip { display: inline-flex !important; }
.tbl td:first-child strong { white-space: nowrap; }
.cal-week .chip, .cal-dayview .chip { display: block; }
.cal-week .chip .ct, .cal-dayview .chip .ct { display: inline; white-space: normal; overflow: visible; }
.cal-week .chip .ci, .cal-dayview .chip .ci { display: inline; }

/* milestones page summary */
.summary-scope { display: flex; align-items: center; gap: 8px; margin: 2px 0 10px; color: var(--navy); }
.dept-strip { display: flex; flex-wrap: wrap; gap: 10px; margin: -4px 0 18px; }
.dept-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; background: #fff; border: 1px solid var(--line); border-radius: 99px; text-decoration: none; color: var(--ink); font-size: .88rem; box-shadow: var(--shadow); }
.dept-chip:hover { border-color: #c9cfe0; color: var(--navy); }
.filter-bar label.check { display: inline-flex; align-items: center; gap: 6px; align-self: flex-end; padding-bottom: 9px; color: var(--ink-2); font-size: .85rem; }
.filter-bar input[type=checkbox] { min-width: 0; width: auto; margin: 0; padding: 0; }

/* repeated activities */
.repeat-box legend { font-size: .95rem; }
.seg-wide { display: flex; flex-wrap: wrap; margin-bottom: 12px; }
.seg-opt { margin: 0 !important; display: block; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span { display: block; padding: 8px 16px; font-weight: 700; font-size: .88rem; color: var(--ink-2); cursor: pointer; border-right: 1px solid var(--line); }
.seg-opt:last-child span { border-right: 0; }
.seg-opt input:checked + span { background: var(--navy); color: #fff; }
.seg-opt input:focus-visible + span { outline: 2px solid var(--amber); outline-offset: -2px; }
.rep-panel { display: none; }
.custom-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.custom-row input { margin: 0 !important; max-width: 190px; }
.rep-preview { background: var(--navy-50); border-radius: 8px; padding: 10px 12px; margin: 10px 0 4px; }
.rep-dates { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag-past { opacity: .45; }
.tag-soon { background: var(--amber-50); color: #8a5600; }
.tag-current { background: var(--navy); color: #fff; }
.apply-to { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 10px; }
.apply-to .check { margin: 6px 0 0 !important; font-weight: 500; }
.series-tag { font-size: .74rem; font-weight: 700; color: var(--navy); background: var(--navy-50); border-radius: 99px; padding: 1px 7px; white-space: nowrap; }
.tag-weekend { background: var(--bad-50); color: var(--bad); }

/* ---- "When" box: one-time / repeated / custom (5 Nov 2026 b) */
.when-box legend { font-size: .95rem; }
.when-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 2px 0 14px; }
.when-opt { margin: 0 !important; display: block; cursor: pointer; }
.when-opt input { position: absolute; opacity: 0; pointer-events: none; }
.when-opt span { display: block; height: 100%; border: 1.5px solid var(--line); border-radius: 9px; padding: 9px 12px; background: #fff; }
.when-opt strong { display: block; color: var(--ink); font-size: .92rem; }
.when-opt small { display: block; color: var(--muted); font-weight: 500; font-size: .78rem; margin-top: 2px; }
.when-opt input:checked + span { border-color: var(--navy); background: var(--navy-50); box-shadow: inset 0 0 0 1px var(--navy); }
.when-opt input:checked + span strong { color: var(--navy); }
.when-opt input:focus-visible + span { outline: 2px solid var(--amber); outline-offset: 2px; }
.kind-opts { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 10px; }
.kind-opts .check { margin: 0 !important; font-weight: 600; font-size: .88rem; }
.date-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.date-row { display: grid; grid-template-columns: 112px minmax(0, 1.2fr) auto minmax(0, 1.2fr) minmax(0, 1fr) auto minmax(0, 1fr) auto; gap: 5px; align-items: center; gap: 6px; }
.date-row input { margin: 0 !important; padding: 6px 5px; font-size: .84rem; min-width: 0; }
.date-row .rm-row { padding: 5px 9px; }
.dr-label { font-weight: 700; font-size: .8rem; line-height: 1.25; color: var(--navy); }
.dr-label.dr-extra { color: var(--muted); font-weight: 600; }
.date-row.dr-off input[name="od[]"] { border-color: var(--bad); background: var(--bad-50); }
.fill-how { width: auto !important; margin: 0 !important; padding: 5px 8px !important; font-size: .84rem; }
.when-summary { background: var(--navy-50); border-radius: 8px; padding: 9px 12px; margin-top: 8px; line-height: 1.9; }
@media (min-width: 901px) { .when-box .k-dates { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; } .when-box .k-dates > label { margin: 0; } }
.extra-dates { border-top: 1px dashed var(--line); margin-top: 10px; padding-top: 10px; }
@media (max-width: 900px) {
  .when-opts { grid-template-columns: minmax(0, 1fr); }
  .date-row { grid-template-columns: 1fr 1fr; }
  .date-row .dr-label { grid-column: 1 / -1; }
  .date-row > span.muted { display: none; }
}

/* ---- Activity page: per-date close / cancel panel (5 Nov 2026 c) */
.od-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.od-item { border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff; }
.od-item.od-current { box-shadow: 0 0 0 1px var(--navy) inset; border-left-color: var(--navy); }
.od-item.od-completed { border-left-color: var(--ok, #2e8b57); }
.od-item.od-cancelled { border-left-color: var(--muted); background: #fafafa; }
.od-item.od-cancelled .od-head strong { text-decoration: line-through; color: var(--muted); }
.od-item.od-awaiting_closure { border-left-color: var(--amber); }
.od-item.od-flash { animation: odflash 1.6s ease-out 1; }
@keyframes odflash { from { background: var(--navy-50); } to { background: #fff; } }
.od-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.od-head .tag-current { font-size: .7rem; padding: 1px 6px; }
.od-meta { margin-top: 4px; color: var(--muted); }
.no-doc-inline { color: var(--bad); }
.od-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.od-actions form { margin: 0; }
.od-actions .btn[disabled] { opacity: .45; cursor: not-allowed; }
.od-toggle.is-open { box-shadow: inset 0 0 0 2px var(--navy); }
.od-note { margin: 4px 0 0; }
.od-panel { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }

.od-modal-date { margin: -2px 0 12px; padding: 8px 12px; background: var(--navy-50); border-radius: 8px; }
.od-modal-date strong { color: var(--navy); margin-left: 6px; }
/* calendar: status on each chip */
.chip.cancelled { opacity: .55; text-decoration: line-through; background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(0,0,0,.06) 6px 8px); }
.chip.cancelled::after { content: " ✕"; text-decoration: none; }
.chip.awaiting { box-shadow: inset -3px 0 0 var(--amber); }

.m-files { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin-bottom: 12px; }
.m-files label { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 8px; font-weight: 600; font-size: .86rem; }
.m-files input[type=file] { width: 100%; font-size: .8rem; }
@media (max-width: 560px) { .m-files { grid-template-columns: minmax(0, 1fr); } }
/* edit form: other dates of the activity as editable rows */
.series-rows .date-row { grid-template-columns: 104px minmax(0, 1.15fr) auto minmax(0, 1.15fr) minmax(0, 1.05fr) auto minmax(0, 1.05fr) auto; }
.series-rows .dr-label { text-decoration: underline; text-decoration-color: var(--line); }
.series-rows .dr-state { justify-self: end; }
.series-rows .dr-state .astate { font-size: .72rem; white-space: nowrap; }
.date-row.dr-locked input { background: #f4f5f8; color: var(--muted); }
.date-row.dr-changed input[name^="sd["], .date-row.dr-changed input[name^="se["], .date-row.dr-changed input[name^="s1["], .date-row.dr-changed input[name^="s2["] { border-color: var(--amber); }

/* ---- Calendar full screen (6 Nov 2026) */
.cal-full-btn .fs-off { display: none; }
.cal-full .cal-full-btn .fs-on { display: none; }
.cal-full .cal-full-btn .fs-off { display: inline; }
.cal-wrap.cal-full { position: fixed; inset: 0; z-index: 900; background: var(--bg, #f3f4f8); padding: 14px 16px; overflow: auto;
  grid-template-columns: minmax(0, 1fr) 310px; gap: 14px; margin: 0; }
.cal-wrap.cal-full:fullscreen, .cal-wrap.cal-full:-webkit-full-screen { width: 100%; height: 100%; }
.cal-wrap.cal-full::backdrop { background: var(--bg, #f3f4f8); }
html.cal-full-open body { overflow: hidden; }
.cal-full > .card { margin: 0; min-height: calc(100vh - 28px); }
.cal-full .cal-grid { grid-auto-rows: minmax(150px, auto); }
.cal-full .cal-day { min-height: 150px; gap: 4px; }
.cal-full .cal-week .cal-day { min-height: calc(100vh - 230px); }
.cal-full .cal-dnum, .cal-full .dnum { font-size: .9rem; }
.chip.chip-x { display: block; white-space: normal; overflow: visible; padding: 5px 7px 5px 8px; font-weight: 500; line-height: 1.3; font-size: .78rem; }
.chip-x .cx-top { display: block; font-weight: 700; }
.chip-x .cx-top .tk { margin-right: 4px; }
.chip-x .cx-time { font-weight: 800; }
.chip-x .cx-code { opacity: .75; }
.chip-x .cx-meta { display: block; margin-top: 2px; font-size: .72rem; opacity: .9; }
.chip-x .cx-meta > span { display: block; }
.chip-x .cx-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.chip-x .cx-tags .astate { font-size: .64rem; padding: 1px 6px; }
.chip-x .cx-tag { font-size: .64rem; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: rgba(255,255,255,.6); border: 1px solid rgba(0,0,0,.08); color: var(--ink); }
.chip-x.cancelled::after { content: none; }
.cal-dayview .chip-x { font-size: .92rem; padding: 10px 12px; margin-bottom: 8px; }
.cal-dayview .chip-x .cx-meta, .cal-dayview .chip-x .cx-tag { font-size: .8rem; }
.cal-week .chip-x { margin-bottom: 2px; }
@media (max-width: 1100px) { .cal-wrap.cal-full { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .cal-full .cal-day .chip.chip-x { font-size: .7rem; height: auto; padding: 3px 5px; border-left-width: 3px !important; }
  .cal-full .chip-x .cx-meta, .cal-full .cal-grid .chip-x .cx-tags { display: none; }
}
.chip-x .cx-people { font-weight: 600; }
.chip-x .cx-venue { font-style: italic; }
.chip-x .cx-venue::before { content: "at "; font-style: normal; opacity: .75; }

/* ---- Milestones: tiles / list (17 Nov 2026) */
.ms-viewbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 4px 0 12px; }
.ms-viewbar .seg button { display: inline-flex; gap: 5px; align-items: center; }
.ms-views[data-view="tiles"] .ms-list { display: none; }
.ms-views[data-view="list"] .ms-grid { display: none; }
.ms-table td { vertical-align: middle; }
.ms-table tbody tr { cursor: pointer; }
.ms-table tbody tr:hover td { background: var(--navy-50); }
.ms-table tr.dept-row-tb td:first-child { box-shadow: inset 4px 0 0 var(--tb); }
.ms-table tr.dept-row-hiv td:first-child { box-shadow: inset 4px 0 0 var(--hiv); }
.ms-table tr.dept-row-both td:first-child { box-shadow: inset 4px 0 0 #7fbfa0; }
.ms-table .status-strip i { height: 7px; }

/* ---- Milestone page: previous / next + full screen */
.ms-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.ms-nav-btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ms-nav-btns .nav-code { font-weight: 700; }
.page-full-btn .fs-off { display: none; }
html.page-full .page-full-btn .fs-on { display: none; }
html.page-full .page-full-btn .fs-off { display: inline; }
html.page-full .topbar, html.page-full .sidenav { display: none; }
html.page-full .shell { min-height: 100vh; }
html.page-full .main { padding: 16px 28px 32px; max-width: none; }
html.page-full .ms-nav { position: sticky; top: 0; z-index: 25; background: var(--bg, #f3f4f8); padding: 8px 0; margin: -8px 0 8px; }
@media (max-width: 760px) { .ms-nav-btns .nav-code { display: none; } .ms-viewbar .seg button { padding: 6px 9px; } }

/* ---- Milestone verification: one list with the source of each document (17 Nov 2026) */
.ev-filter { margin: 4px 0 10px; display: inline-flex; flex-wrap: wrap; }
.ev-filter .count { font-size: .72rem; opacity: .8; margin-left: 3px; }
.ev-src { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 3px 0 1px; font-size: .84rem; }
.src-tag { font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.src-tag.src-ms { background: var(--navy-50); color: var(--navy); border: 1px solid rgba(35,61,119,.25); }
.src-tag.src-act { background: var(--amber-50, #fff4dd); color: #8a5600; border: 1px solid rgba(251,176,64,.45); }
.ev-list > li[data-src="activity"] { border-left: 3px solid rgba(251,176,64,.6); padding-left: 8px; }
.ev-list > li[data-src="milestone"] { border-left: 3px solid rgba(35,61,119,.45); padding-left: 8px; }
.ev-missing { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--line); }
.ev-missing ul { margin: 6px 0 0; padding-left: 18px; }
.ev-missing li { margin: 3px 0; }

/* ---- Multiple-file uploads (17 Nov 2026) */
.modal.modal-wide { max-width: 720px; }
.up-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; background: #fff; }
.up-head { margin-bottom: 8px; }
.up-head strong { display: block; color: var(--navy); }
.up-drop { position: relative; display: block !important; margin: 0 !important; border: 2px dashed #c9cfdf; border-radius: 10px; padding: 18px 12px; text-align: center; cursor: pointer; background: #fafbfd; transition: background .15s, border-color .15s; }
.up-drop:hover, .up-drop.drag { border-color: var(--navy); background: var(--navy-50); }
.up-drop input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.up-drop-text { color: var(--ink-2); font-weight: 500; }
.up-drop-text b { color: var(--navy); }
.up-drop.has-files { padding: 10px 12px; }
.up-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.up-item { display: grid; grid-template-columns: minmax(0, 1.2fr) auto minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe; font-size: .85rem; }
.up-item:not(:has(.up-title)) { grid-template-columns: minmax(0, 1fr) auto auto; }
.up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.up-size { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.up-item input.up-title { margin: 0 !important; padding: 5px 8px; font-size: .84rem; }
.up-item .up-rm { padding: 2px 9px; }
.up-item.up-bad { border-color: var(--bad); background: var(--bad-50, #fdeeee); }
.up-item.up-bad .up-size { color: var(--bad); font-weight: 600; }
.up-total { margin-top: 6px; }
.up-err { color: var(--bad); font-weight: 600; margin-top: 3px; }
.link-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.link-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 6px; }
.link-row input { margin: 0 !important; }
@media (max-width: 640px) { .up-item { grid-template-columns: minmax(0, 1fr) auto; } .up-item .up-title { grid-column: 1 / -1; } .link-row { grid-template-columns: 1fr auto; } .link-row input[type=url] { grid-column: 1 / -1; grid-row: 2; } }

/* ---- Reporting window / locks / settings (18 Nov 2026) */
.lock-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-radius: 10px; margin: 0 0 14px; border: 1px solid var(--line); background: #fff; }
.lock-bar.lock-open { background: #eef8f0; border-color: #b9e0c3; }
.lock-bar.lock-closed { background: #f4f5f9; border-color: #d9dce6; }
.lock-ico { font-size: 1.25rem; line-height: 1; }
.lock-text { flex: 1; min-width: 220px; font-size: .9rem; }
.lock-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.lock-actions form { margin: 0; }
.locked-tag { display: inline-block; font-size: .76rem; font-weight: 700; color: #6c7690; background: #eef0f5; border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.unlocked-tag { font-size: .9rem; margin-right: 4px; }
.req-card { border-left: 4px solid var(--amber); }
.req-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.req-row:last-child { border-bottom: 0; }
.req-row.req-hl { background: #fff8e8; margin: 0 -12px; padding: 10px 12px; border-radius: 8px; }
.req-reason { margin-top: 4px; padding: 6px 9px; background: #f6f7fb; border-radius: 6px; max-width: 640px; }
.req-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; }
.req-form label { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.req-form input { margin: 0 !important; padding: 6px 8px; width: auto; }
.req-form input[name=note] { min-width: 200px; }
.count-hot { background: var(--bad) !important; color: #fff !important; }
.alert-opt { display: flex !important; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); margin: 0 !important; font-weight: 500; }
.alert-opt input[type=checkbox] { margin-top: 4px; }
.inline-time { width: auto !important; display: inline-block !important; padding: 2px 6px !important; margin: 0 !important; }
.approver-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 0; }
.approver-box legend { font-weight: 700; color: var(--navy); padding: 0 6px; }
.approver-box.dept-tb { border-top: 4px solid var(--tb); }
.approver-box.dept-hiv { border-top: 4px solid var(--hiv); }
.approver-box.dept-both { border-top: 4px solid #7fbfa0; }
.approver-box .check { display: block; margin: 4px 0; font-weight: 500; }
tr.row-now td { background: #eef8f0; }
.inv-tbl td { vertical-align: middle; }
.inv-tbl tr.inv-future td { color: var(--muted); }
.inv-bar { position: relative; display: inline-block; vertical-align: middle; width: calc(100% - 52px); min-width: 70px; height: 10px; background: #eef0f5; border-radius: 5px; overflow: hidden; margin-right: 6px; }
.inv-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; }
.inv-bar .inv-max { background: #d6dcec; }
.inv-bar .inv-val { background: var(--ok); }

/* ---- In-app document viewer (18 Nov 2026) */
.dv-back { position: fixed; inset: 0; z-index: 1000; background: rgba(20, 28, 48, .72); display: none; padding: 18px; }
.dv-back.open { display: flex; }
html.dv-open body { overflow: hidden; }
.dv { background: #fff; border-radius: 12px; width: 100%; max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.dv-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #f7f8fb; flex-wrap: wrap; }
.dv-name { flex: 1; min-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--navy); }
.dv-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.dv-body { flex: 1; min-height: 0; overflow: auto; background: #525659; position: relative; }
.dv-frame { width: 100%; height: 100%; border: 0; display: block; background: #525659; }
.dv-img { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dv-img img { max-width: 100%; max-height: calc(100vh - 120px); box-shadow: 0 4px 18px rgba(0,0,0,.4); background: #fff; }
.dv-body.dv-docx { background: #e9ebf0; }
.dv-docx-pages .docx-wrapper { background: #e9ebf0 !important; padding: 20px 10px !important; }
.dv-docx-pages .docx-wrapper > section.docx { box-shadow: 0 2px 10px rgba(0,0,0,.18) !important; margin-bottom: 20px !important; }
.dv-loading { color: #fff; padding: 40px; text-align: center; }
.dv-body.dv-docx .dv-loading { color: var(--ink); }
.doc-btns { display: inline-flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.doc-btns .btn { padding: 3px 10px; }
.link-open { font-weight: 600; }
@media (max-width: 640px) { .dv-back { padding: 0; } .dv { border-radius: 0; } }

.ev-link-main { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 4px 0 12px; border: 1px solid rgba(0,150,199,.35); border-left: 4px solid var(--hiv); border-radius: 8px; background: #f2fafd; flex-wrap: wrap; }
.ev-link-main .link-open { word-break: break-all; }
.docs li { align-items: center; }
.dv-pdf-pages { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 16px; }
.dv-pdf-pages canvas { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.2); max-width: 100%; height: auto; }

/* ---- Dashboard: smaller tiles, full-screen panels (23 Nov 2026) */
.kpis .kpi { padding: 8px 14px 9px; border-top-width: 3px; }
.kpis .kpi .kpi-label { font-size: .72rem; }
.kpis .kpi .kpi-value { font-size: 1.35rem; margin-top: 1px; line-height: 1.15; }
.kpis .kpi .kpi-note { font-size: .76rem; line-height: 1.3; }
.card-tools { display: inline-flex; align-items: center; gap: 10px; }
.icon-btn { border: 1px solid var(--line); background: #fff; border-radius: 7px; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--navy); font-size: 1rem; line-height: 1; padding: 0; }
.icon-btn:hover { background: var(--navy-50); border-color: var(--navy); }
.fs-btn .fs-off, .fs-card.is-full .fs-btn .fs-on { display: none; }
.fs-card.is-full .fs-btn .fs-off { display: inline; }
.fs-card.is-full { position: fixed; inset: 0; z-index: 950; margin: 0; border-radius: 0; overflow: auto; padding: 22px 30px; }
.fs-card.is-full:fullscreen, .fs-card.is-full:-webkit-full-screen { width: 100%; height: 100%; background: #fff; }
html.card-full-open body { overflow: hidden; }
.fs-card.is-full .card-head h2 { font-size: 1.5rem; }
.fs-card.is-full .inv-tbl { font-size: 1.05rem; }
.fs-card.is-full .inv-tbl td, .fs-card.is-full .inv-tbl th { padding-top: 10px; padding-bottom: 10px; }
.fs-card.is-full .inv-bar { height: 14px; }
.fs-card.is-full .ms-row { padding-top: 10px; padding-bottom: 10px; font-size: 1.02rem; }
.fs-card.is-full .status-strip i { height: 9px; }

/* ---- Verification means per reporting period (23 Nov 2026) */
.ev-period { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px 6px; margin: 12px 0; }
.ev-period.ev-open { border-color: #b9e0c3; box-shadow: inset 4px 0 0 var(--ok); }
.ev-period.ev-locked { background: #fafbfc; box-shadow: inset 4px 0 0 #c5cad8; }
.ev-phead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 6px; border-bottom: 1px dashed var(--line); margin-bottom: 6px; }
.ev-phead > div:first-child { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ev-phead strong { color: var(--navy); font-size: 1rem; }
.ev-pact { display: flex; gap: 6px; }
.lk { font-size: .74rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #eef0f5; color: #5d6782; white-space: nowrap; }
.lk.lk-open { background: #e3f4e7; color: #1e7a37; }
.ev-period .ev-link-main { margin: 6px 0 8px; padding: 8px 10px; }
.ev-link-form { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; margin-top: 6px; }
.ev-link-form input[type=url] { flex: 1; min-width: 220px; margin: 0 !important; }
.ev-period .docs { margin: 0; }
.ev-period .docs li { padding: 8px 0 8px 8px; }

.kpis { align-items: start; }
.kpis .kpi { padding: 7px 12px 8px; }
.kpis .kpi .kpi-label, .kpis .kpi .kpi-note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpis .kpi .kpi-value { font-size: 1.3rem; }
.kpis .kpi .progress, .kpis .kpi .bar { height: 4px !important; margin: 3px 0 !important; }
.vm-total { margin: 0 0 8px; font-size: .92rem; }

/* ---- Month summary page (24 Nov 2026) */
.mo-link { color: inherit; text-decoration: none; }
.mo-link:hover strong { color: var(--navy); text-decoration: underline; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-actions select { width: auto; margin: 0; padding: 6px 8px; }
.kpis.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis .kpi .kpi-value small { font-size: .8rem; color: var(--muted); font-weight: 600; }
.mo-filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 0 0 8px; }
.mo-filters .seg a { padding: 6px 12px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .85rem; }
.mo-filters .seg a.active { background: var(--navy); color: #fff; }
.mo-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-f { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 11px; font-size: .8rem; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.chip-f b { margin-left: 3px; color: var(--navy); }
.chip-f.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip-f.active b { color: #fff; }
.mo-sort { margin-left: auto; }
.mo-sort select { width: auto; display: inline-block; margin: 0 0 0 4px; padding: 5px 8px; }
.mo-status-sum { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 8px; }
.mo-tbl th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.mo-tbl th.sortable::after { content: " ↕"; opacity: .35; font-size: .8em; }
.mo-tbl th.sorted { color: var(--navy); }
.mo-tbl th.sorted::after { content: " ▼"; opacity: .9; }
.mo-tbl td { vertical-align: middle; }
.mo-tbl tr.mo-not_due td, .mo-tbl tr.mo-completed td { color: var(--muted); }
.mo-tbl tr.mo-not_due td a, .mo-tbl tr.mo-completed td a { color: var(--ink-2); }
.mo-kind { font-weight: 700; font-size: .74rem; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.mo-kind-due { background: var(--navy-50); color: var(--navy); }
.mo-kind-completed { background: #e3f4e7; color: #1e7a37; }
.mo-kind-not_due { background: #eef0f5; color: #6c7690; }
.mo-kind-overdue { background: #fdeaea; color: var(--bad); }
@media (max-width: 900px) { .kpis.kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .mo-sort { margin-left: 0; } }
.mo-tbl td:nth-child(2) { min-width: 190px; }
.mo-tbl td:nth-child(5) { max-width: 170px; }
.mo-tbl td:nth-child(8) { min-width: 100px; max-width: 150px; }
.mo-tbl th, .mo-tbl td { padding-left: 8px; padding-right: 8px; }
.mo-tier { font-weight: 700; color: var(--ink-2); margin-top: 2px; }

/* ---- Reports: milestone picker (25 Nov 2026) */
.ms-pick { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 10px; margin: 0 0 12px; }
.ms-pick legend { font-weight: 700; color: var(--ink); padding: 0 6px; font-size: .88rem; }
.ms-pick-count { font-weight: 500; color: var(--muted); }
.ms-pick-quick { display: flex; flex-wrap: wrap; gap: 5px; margin: 2px 0 8px; }
.ms-pick-quick button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 11px; font-size: .78rem; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.ms-pick-quick button:hover { border-color: var(--navy); }
.ms-pick-quick button.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.ms-pick-quick .ms-pick-none { margin-left: auto; color: var(--muted); }
.ms-pick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; }
.ms-pick-col { border-top: 3px solid var(--line); padding-top: 4px; min-width: 0; }
.ms-pick-col.pick-tb { border-top-color: var(--tb); }
.ms-pick-col.pick-hiv { border-top-color: var(--hiv); }
.ms-pick-col.pick-both { border-top-color: #7fbfa0; }
.ms-pick label { display: flex !important; gap: 6px; align-items: baseline; margin: 0 !important; padding: 2px 0; font-weight: 500; font-size: .8rem; cursor: pointer; min-width: 0; }
.ms-pick label input { flex: none; width: auto !important; margin: 0 !important; }
.ms-pick label.ms-pick-item { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block !important; }
.ms-pick-item b { color: var(--navy); }
.ms-pick-head { margin-bottom: 2px !important; font-size: .82rem !important; }
@media (max-width: 1100px) { .ms-pick-grid { grid-template-columns: minmax(0, 1fr); } }
.row > .ms-pick, .ms-pick { grid-column: 1 / -1; width: 100%; box-sizing: border-box; }
.ms-pick-quick .ms-pick-none { margin-left: 0; }
.ms-pick-head strong { white-space: nowrap; }

/* ---- Office schedule (26 Nov 2026) */
.nav a.nav-sub, nav a.nav-sub { padding-left: 34px; font-size: .9em; }
.tag-super { background: #ede4fb; color: #5b2ea6; }
.os-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 10px; }
.os-range { color: var(--navy); font-size: 1.02rem; min-width: 150px; text-align: center; }
.os-bar .seg a { padding: 6px 12px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .85rem; }
.os-bar .seg a.active { background: var(--navy); color: #fff; }
.os-dl { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.os-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 0 0 10px; }
.os-chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 6px; padding: 3px 8px; font-size: .82rem; font-weight: 600; margin: 0 0 3px; border-left: 4px solid; }
.os-day .os-chip { display: flex; }
.os-chip b { font-size: .68rem; letter-spacing: .02em; }
.os-clinical { background: #e6f5f4; border-color: #0b7a75; color: #134e4a; }
.os-clinical b { color: #0b7a75; }
.os-si { background: #fdf1db; border-color: #e39a22; color: #5c3b00; }
.os-si b { color: #b26a00; }
.os-act { box-shadow: inset 0 0 0 1px currentColor; }
.os-warn { color: var(--bad); font-weight: 700; }
.os-ok { color: #1e7a37; font-weight: 700; }
.os-cal { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.os-row { display: grid; grid-template-columns: 110px repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.os-row:first-child { border-top: 0; }
.os-head > div { background: var(--navy); color: #fff; font-weight: 700; font-size: .82rem; padding: 8px 10px; }
.os-week { padding: 10px; background: #f6f7fb; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line); }
.os-week strong { color: var(--navy); }
.os-day { padding: 8px; border-right: 1px solid var(--line); min-height: 120px; }
.os-day:last-child { border-right: 0; }
.os-day.os-out { background: #f3f4f8; }
.os-day.os-out .os-date { color: #a3a9ba; }
.os-day.os-today { box-shadow: inset 0 3px 0 var(--amber); }
.os-day.os-bad { background: #fff5f5; }
.os-date { display: flex; justify-content: space-between; font-weight: 700; color: var(--navy); font-size: .84rem; margin-bottom: 6px; }
.os-cnt { font-weight: 600; color: var(--muted); font-size: .74rem; }
.os-tbl th, .os-tbl td { padding: 6px 6px; }
.os-tbl th.center, .os-tbl td.center { text-align: center; }
.os-tbl .os-mon { border-left: 2px solid #c5cad8; }
.os-tick { display: inline-block; min-width: 24px; border-radius: 5px; font-weight: 800; padding: 2px 4px; }
.os-tick.os-clinical { background: #d6f0ee; color: #0b7a75; border: 0; }
.os-tick.os-si { background: #fdebc8; color: #b26a00; border: 0; }
.os-tbl tfoot td { font-weight: 700; }
.os-zero { color: var(--bad); background: #fdeaea; }
.os-check td.os-bad { background: #fdeaea; }
.os-changes { margin: 6px 0 0; padding-left: 18px; }
.os-changes li { margin: 4px 0; }
.os-staff td { vertical-align: middle; }
.os-staff input, .os-staff select { margin: 0 !important; padding: 6px 8px; }
.os-staff tr.os-inactive td { opacity: .5; }
.os-days { white-space: nowrap; }
.os-day-pick { display: inline-flex !important; margin: 0 2px 0 0 !important; cursor: pointer; }
.os-day-pick input { position: absolute; opacity: 0; pointer-events: none; }
.os-day-pick span { display: inline-block; padding: 4px 7px; border: 1px solid var(--line); border-radius: 6px; font-size: .76rem; font-weight: 600; color: var(--muted); }
.os-day-pick input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.os-day-pick input:focus-visible + span { outline: 2px solid var(--amber); }
.os-access { columns: 2; margin: 8px 0 12px; }
.os-access .check { display: block; break-inside: avoid; margin: 4px 0; font-weight: 500; }
@media (max-width: 900px) { .os-row { grid-template-columns: 80px repeat(5, minmax(110px, 1fr)); } .os-cal { overflow-x: auto; } .os-dl { margin-left: 0; } .os-access { columns: 1; } }
.os-staff select[name^="disc"], .os-staff select[name="new_disc"] { min-width: 108px; }
.os-staff input[name^="name"], .os-staff input[name="new_name"] { min-width: 140px; }
.os-cycle { max-width: 260px; }
.os-csu { background: #f3edfb; border-color: #6b3fa0; color: #3f2368; }
.os-csu b { color: #6b3fa0; }
.os-tick.os-csu { background: #ebe2f7; color: #6b3fa0; border: 0; }
.os-chip.os-flex { border-left-style: dashed; }
.os-chip i, .os-flex-tag { font-style: normal; font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; background: #fff; border: 1px dashed currentColor; border-radius: 4px; padding: 0 4px; margin-left: auto; }
.os-flex-tag { color: #6b3fa0; margin-left: 4px; }

/* ---- Automatic tier / status on the milestone update form (26 Nov 2026) */
.calc-box { border: 1px solid #cfe3f5; background: #f4f9fe; border-radius: 10px; padding: 12px 14px 10px; margin: 0 0 14px; }
.calc-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; justify-content: space-between; margin-bottom: 8px; color: var(--navy); }
.calc-box label { margin-bottom: 6px; }
.calc-box input[readonly] { background: #eef1f6; color: var(--ink-2); cursor: not-allowed; }
.calc-result { min-height: 22px; font-size: .9rem; padding-top: 4px; border-top: 1px dashed #cfe3f5; }
.calc-result .status { margin-left: 2px; }
.calc-arrow { color: var(--muted); font-weight: 700; }
.calc-doc { margin: 0 0 6px; line-height: 1.45; }
.calc-ok { color: #1e7a37; font-weight: 600; }
.calc-wait { color: #8a5a00; margin-top: 2px; }
.calc-manual { margin: -4px 0 10px; color: #8a5a00; }
.form .auto-fill { background-color: #f8fbff; }

/* ---- Dashboard: invoiced per month tabs (27 Nov 2026) */
.inv-tabs { margin: -2px 0 12px; }
.sched-tbl td, .sched-tbl th { padding: 9px 10px; }
.sched-tbl tbody tr:nth-child(even) td { background: #f3f6fb; }
.sched-tbl tr.sched-final td { background: #fdf6e3 !important; font-weight: 700; }
.cum-title { margin: 0 0 4px; color: var(--navy); font-size: 1rem; text-align: center; }
.cum-svg { width: 100%; height: auto; display: block; max-height: 420px; }
.cum-svg .cum-max { fill: #f2b90f; }
.cum-svg .cum-final { fill: #b22a2a; }
.cum-svg .cum-inv { fill: #1f3a7a; }
.cum-svg .cum-axis { stroke: #cfd5e2; stroke-width: 1; }
.cum-svg .cum-lbl { font-size: 12px; font-weight: 700; font-family: inherit; fill: #1f2a44; text-anchor: middle; }
.cum-svg .cum-x { font-size: 12px; font-family: inherit; fill: #5b6478; text-anchor: middle; }
.cum-svg g:hover rect { opacity: .85; }
.cum-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; margin: 6px 0 0; color: var(--muted); }
.cum-legend .sw { display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.sw-max { background: #f2b90f; } .sw-final { background: #b22a2a; } .sw-inv { background: #1f3a7a; }
.fs-card.is-full .cum-svg { max-height: 70vh; }
