:root {
  color-scheme: light;
  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-2: #f7f9f8;
  --border: #e2e7e4;
  --text: #13201a;
  --text-2: #4d5a54;
  --muted: #7a8781;
  --brand: #0f6b45;
  --brand-2: #0b4f33;
  --brand-ink: #ffffff;
  --accent: #2a78d6;
  --s1: #2a78d6;  /* actual / earned */
  --s2: #eb6834;  /* planned */
  --s3: #1baf7a;
  --s4: #eda100;
  --good: #0f8a4a;
  --warn: #c98500;
  --bad: #d23b3a;
  --grid: #e9edeb;
  --shadow: 0 1px 2px rgba(16,32,24,.06), 0 4px 16px rgba(16,32,24,.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1412; --surface: #171d1a; --surface-2: #1c2420; --border: #2a3430;
    --text: #eef2ef; --text-2: #c0cac5; --muted: #8b9892;
    --brand: #18885a; --brand-2: #0f5c3c;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --good: #2fb36d; --warn: #e0a21a; --bad: #e66767; --grid: #26302c;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1412; --surface: #171d1a; --surface-2: #1c2420; --border: #2a3430;
  --text: #eef2ef; --text-2: #c0cac5; --muted: #8b9892;
  --brand: #18885a; --brand-2: #0f5c3c;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --good: #2fb36d; --warn: #e0a21a; --bad: #e66767; --grid: #26302c;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 Inter, Cairo, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}
h1, h3 { margin: 0; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 24px; color: var(--brand-ink);
  background: linear-gradient(110deg, var(--brand-2), var(--brand));
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.14); flex: none; }
.topbar h1 { font-size: 19px; font-weight: 700; letter-spacing: .1px; }
.topbar .sub { font-size: 12.5px; opacity: .85; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pill { font-size: 12px; padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.16); white-space: nowrap; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 7px 12px; border-radius: 8px; font: inherit; font-weight: 600; font-size: 13px;
}
.btn:hover { border-color: var(--brand); }
.topbar .btn { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.3); color: #fff; }
.topbar .btn:hover { background: rgba(255,255,255,.25); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; }

.tabs {
  display: flex; gap: 2px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--border);
  overflow-x: auto; position: sticky; top: 0; z-index: 5;
}
.tab {
  border: 0; background: none; color: var(--text-2); font: inherit; font-weight: 600; cursor: pointer;
  padding: 13px 14px; border-bottom: 3px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab.import { margin-left: auto; }

.banner { margin: 12px 24px 0; padding: 10px 14px; border-radius: 8px; background: color-mix(in srgb, var(--warn) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); font-size: 13px; }
.banner.hidden { display: none; }
.banner button { margin-left: 8px; }

main { padding: 18px 24px 8px; max-width: 1600px; margin: 0 auto; }
.panel { display: none; }
.panel.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.g-2-1 { grid-template-columns: 2fr 1fr; }
.g-1-1 { grid-template-columns: 1fr 1fr; }
@media (max-width: 1000px) { .g-2-1, .g-1-1 { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.grid > .card { margin-bottom: 0; }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-h h3 { font-size: 14.5px; font-weight: 700; }
.card p { color: var(--text-2); margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 12.5px; }
.small { font-size: 12px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--brand); }
.kpi .lbl { font-size: 12px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.kpi .val { font-size: 24px; font-weight: 700; margin-top: 4px; letter-spacing: -.3px; }
.kpi .val small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.kpi .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi .bar { height: 6px; background: var(--grid); border-radius: 4px; margin-top: 9px; overflow: hidden; }
.kpi .bar i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.status.good { color: var(--good); background: color-mix(in srgb, var(--good) 13%, transparent); }
.status.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 15%, transparent); }
.status.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 13%, transparent); }
.status.na { color: var(--muted); background: var(--surface-2); }

.chart-box { position: relative; height: 290px; }
.chart-box.tall { height: 360px; }
.donut-wrap { position: relative; height: 220px; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.donut-center b { font-size: 26px; display: block; }
.mini-list { list-style: none; padding: 0; margin: 14px 0 0; }
.mini-list li { display: flex; justify-content: space-between; padding: 7px 0; border-top: 1px solid var(--border); font-size: 13px; }
.mini-list li span:first-child { color: var(--text-2); }
.mini-list li b { font-weight: 600; }

.table-wrap { overflow: auto; max-height: 520px; border: 1px solid var(--border); border-radius: 8px; }
.table-wrap.tall { max-height: 640px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.8px; }
.tbl th { position: sticky; top: 0; background: var(--surface-2); color: var(--text-2); text-align: left; font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .3px; padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; cursor: pointer; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl td.n, .tbl th.n { text-align: right; white-space: nowrap; }
.tbl tr:hover td { background: var(--surface-2); }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); position: sticky; bottom: 0; }
.tbl .desc { max-width: 380px; }
.pbar { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.pbar .t { flex: 1; height: 7px; background: var(--grid); border-radius: 4px; overflow: hidden; position: relative; }
.pbar .t i { display: block; height: 100%; background: var(--s1); border-radius: 4px; }
.pbar .t .pl { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--s2); }
.pbar span { width: 50px; text-align: right; font-weight: 600; font-size: 12px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters select, .filters input { font: inherit; font-size: 13px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.filters input { min-width: 220px; }

.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 26px 16px; border: 2px dashed var(--border); border-radius: 12px; cursor: pointer; text-align: center; background: var(--surface-2); transition: .15s; }
.drop:hover, .drop.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
.drop input { display: none; }
.drop-ic { font-size: 28px; color: var(--brand); }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.log { background: var(--surface-2); border-radius: 8px; padding: 12px; margin: 0; font-size: 12.5px; white-space: pre-wrap; max-height: 260px; overflow: auto; }
.steps { margin: 0; padding-left: 20px; color: var(--text-2); }
.steps li { margin: 5px 0; }

.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 24px 22px; color: var(--muted); font-size: 12px; max-width: 1600px; margin: 0 auto; }

/* full-screen mode: tighter, fill the screen */
body.fs main { max-width: none; }
body.fs .chart-box { height: 34vh; }
body.fs .chart-box.tall { height: 42vh; }

@media (max-width: 640px) {
  .topbar, main, .foot { padding-left: 16px; padding-right: 16px; }
  .tabs { padding: 0 8px; }
  .kpi .val { font-size: 20px; }
  .btn span { display: none; }
  .filters input { min-width: 0; width: 100%; }
}

/* ---------- drill-down ---------- */
.kpi { cursor: pointer; transition: transform .12s, border-color .12s; }
.kpi:hover, .kpi:focus-visible { border-color: var(--brand); transform: translateY(-1px); outline: none; }
.kpi:hover::after { content: "Details ›"; position: absolute; top: 12px; right: 12px; font-size: 11px; font-weight: 600; color: var(--brand); }
tr.click { cursor: pointer; }
tr.click:hover td { background: color-mix(in srgb, var(--brand) 7%, var(--surface)); }
canvas { -webkit-tap-highlight-color: transparent; }

.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 4vh 16px; }
.modal.hidden { display: none; }
.modal-back { position: absolute; inset: 0; background: rgba(8,16,12,.55); backdrop-filter: blur(2px); }
.modal-card { position: relative; width: min(1100px, 100%); max-height: 92vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: fade .2s ease; }
.modal-h { display: flex; align-items: flex-start; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-h > div { flex: 1; min-width: 0; }
.modal-h h2 { margin: 0; font-size: 18px; }
.modal-h .muted { margin-top: 3px; font-size: 13px; }
.modal-b { overflow: auto; padding: 16px 18px 22px; }
.modal-b .table-wrap { max-height: 420px; }
.chart-box.mchart { height: 210px; margin-bottom: 14px; }
.dtiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 8px; }
.dtile { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.dtile .lbl { font-size: 11.5px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.dtile .v { font-size: 16px; font-weight: 700; margin-top: 3px; }
.dsec { margin: 18px 0 8px; font-size: 14px; }
.dnote { margin: 10px 0; padding: 9px 12px; border-radius: 8px; font-size: 13px; background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
@media (max-width: 640px) { .modal { padding: 0; } .modal-card { max-height: 100vh; height: 100vh; border-radius: 0; } }
.click { cursor: pointer; }
.mini-list li.click:hover b, .mini-list li.click:hover span { color: var(--brand); }
.card[data-card] { cursor: pointer; transition: border-color .12s; }
.card[data-card]:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }
.card[data-card] .card-h h3::after { content: "  ›"; color: var(--brand); opacity: 0; transition: opacity .12s; }
.card[data-card]:hover .card-h h3::after { opacity: 1; }
.card[data-card] input, .card[data-card] select { cursor: auto; }
#footTxt.click:hover, .pill.click:hover { text-decoration: underline; }

/* ---------- schedule / gantt ---------- */
.drop2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.xer-status { margin-top: 10px; line-height: 1.6; }
.card.empty { text-align: center; padding: 36px 18px; }
.g-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.g-toolbar select, .g-toolbar input[type=search], .g-toolbar input[type=date], .card-h select { font: inherit; font-size: 13px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.g-toolbar select.wide { max-width: 360px; }
.g-toolbar input[type=search] { min-width: 220px; flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600; padding: 7px 12px; cursor: pointer; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--brand); color: #fff; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.g-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; }
.g-legend { display: inline-flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.lg { display: inline-block; width: 16px; height: 8px; border-radius: 3px; margin-right: 3px; vertical-align: middle; }
.lg.done { background: var(--good); } .lg.act { background: var(--s1); } .lg.ns { background: color-mix(in srgb, var(--s1) 35%, var(--surface)); }
.lg.crit { background: var(--bad); } .lg.bl { background: var(--muted); height: 4px; } .lg.dd { width: 2px; height: 12px; background: var(--s2); }

.gantt { overflow: auto; max-height: 72vh; border: 1px solid var(--border); border-radius: 8px; position: relative; background: var(--surface); }
body.fs .gantt { max-height: 80vh; }
.g-in { position: relative; }
.g-head { position: sticky; top: 0; z-index: 4; display: flex; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.g-row { display: flex; height: 30px; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.g-row:hover .g-left, .g-row:hover .g-tl { background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
.g-left { position: sticky; left: 0; z-index: 3; flex: none; width: 800px; display: flex; align-items: center; gap: 0; background: var(--surface); border-right: 1px solid var(--border); font-size: 12px; padding-left: calc(6px + var(--d, 0) * 12px); }
.g-left.hd { background: var(--surface-2); font-weight: 700; color: var(--text-2); text-transform: uppercase; font-size: 10.5px; letter-spacing: .3px; height: 44px; padding-left: 6px; }
.g-left span { padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-id { width: 165px; flex: none; font-weight: 600; }
.c-nm { flex: 1; min-width: 0; }
.c-dt { width: 74px; flex: none; text-align: right; }
.c-n { width: 48px; flex: none; text-align: right; }
.c-n.neg, .tbl td.neg { color: var(--bad); font-weight: 700; }
.c-n.pos, .tbl td.pos { color: var(--good); }
.c-tg { width: 18px; flex: none; cursor: pointer; color: var(--brand); padding: 0 !important; text-align: center; }
.c-wbs { flex: 1; min-width: 0; }
.g-wbs .g-left { background: color-mix(in srgb, var(--brand) 5%, var(--surface)); cursor: pointer; }
.g-wbs.d0 .g-left { background: color-mix(in srgb, var(--brand) 13%, var(--surface)); }
.g-wbs.d1 .g-left { background: color-mix(in srgb, var(--brand) 9%, var(--surface)); }
.g-tl { position: relative; flex: none; height: 100%; }
.g-tl.hd { height: 44px; }
.g-hrow { position: relative; height: 22px; }
.g-hc { position: absolute; top: 0; height: 22px; line-height: 22px; font-size: 11px; font-weight: 600; color: var(--text-2); border-left: 1px solid var(--border); padding-left: 4px; overflow: hidden; white-space: nowrap; }
.g-hc.sm { font-weight: 500; font-size: 10px; }
.g-body { position: relative; }
.g-grid { position: absolute; top: 0; bottom: 0; left: 800px; pointer-events: none; z-index: 1; }
.g-grid i { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--grid); }
.g-dd { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--s2); z-index: 2; }
.g-win { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px dashed var(--muted); z-index: 2; }
.g-row .g-tl > * { z-index: 2; }
.g-bl { position: absolute; top: 21px; height: 4px; border-radius: 2px; background: var(--muted); opacity: .55; }
.g-bar { position: absolute; top: 6px; height: 13px; border-radius: 4px; overflow: hidden; background: color-mix(in srgb, var(--s1) 35%, var(--surface)); }
.g-bar i { display: block; height: 100%; background: var(--s1); }
.g-bar.done, .g-bar.done i { background: var(--good); }
.g-bar.crit { background: color-mix(in srgb, var(--bad) 30%, var(--surface)); outline: 1.5px solid var(--bad); }
.g-bar.crit i { background: var(--bad); }
.g-ms { position: absolute; top: 7px; width: 12px; height: 12px; transform: rotate(45deg); background: var(--text); }
.g-ms.crit { background: var(--bad); } .g-ms.done { background: var(--good); }
.g-sum { position: absolute; top: 10px; height: 8px; background: var(--text-2); border-radius: 2px; opacity: .7; }
.g-lbl { position: absolute; top: 7px; font-size: 10.5px; color: var(--text-2); white-space: nowrap; }
.g-empty { padding: 30px; text-align: center; color: var(--muted); }
.crumb { color: var(--brand); }
.crumb:hover { text-decoration: underline; }
tr.g-grp td { background: color-mix(in srgb, var(--brand) 9%, var(--surface)); }
@media (max-width: 640px) { .drop2 { grid-template-columns: 1fr; } }

/* ---------- weekly report ---------- */
.hidden { display: none !important; }
.wk-top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
.wk-top select { font: inherit; font-size: 14px; font-weight: 600; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); min-width: 300px; display: block; margin-top: 3px; }
.wk-top #wkMeta { flex: 1; min-width: 240px; }
.grid.inner { margin: 0 0 12px; gap: 14px; }
.chart-box.sm { height: 170px; margin-top: 10px; }
.qrow { padding: 10px 0; border-top: 1px solid var(--border); }
.qrow:first-child { border-top: 0; padding-top: 0; }
.qrow .qh { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; font-size: 13px; }
.qrow .pbar span { width: 56px; }
.pos { color: var(--good); } .neg { color: var(--bad); }
.wk-list { margin: 0; padding-left: 22px; }
.wk-list li { padding: 5px 4px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.wk-list li:hover { color: var(--brand); }
.wk-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.wk-ph { aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.wk-ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.wk-ph:hover img { transform: scale(1.04); }
.wk-img img { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); display: block; margin: 0 auto; }
.wk-full { max-width: 100%; max-height: 72vh; display: block; margin: 0 auto 10px; border-radius: 8px; }
.wk-exec p, .wk-exec li { color: var(--text-2); font-size: 13.5px; }
.wk-raw { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; }
.wk-raw summary { cursor: pointer; font-weight: 600; }
.wk-raw .table-wrap { margin-top: 8px; }
.tbl tr.tot td { font-weight: 700; background: var(--surface-2); }
.dtile.click:hover { border-color: var(--brand); }
@media (max-width: 640px) { .wk-top select { min-width: 0; width: 100%; } }

/* ---------- admin-only UI ---------- */
html:not(.admin) .admin-only { display: none !important; }
html.admin .viewer-only { display: none !important; }
.admin-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: color-mix(in srgb, var(--brand) 8%, var(--surface)); border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); }

/* ---------- P6 strip (overview) ---------- */
.p6strip { background: linear-gradient(110deg, color-mix(in srgb, var(--brand) 10%, var(--surface)), var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--border)); border-radius: 12px; padding: 14px 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.p6h { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.p6t { font-size: 15px; }
.p6k { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.p6k > div { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; display: flex; flex-direction: column; gap: 2px; }
.p6k > div:hover { border-color: var(--brand); }
.p6k span { font-size: 11.5px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.p6k b { font-size: 19px; }
.p6k em { font-style: normal; }
.p6k .status { align-self: flex-start; }
.p6bar { position: relative; height: 8px; background: var(--grid); border-radius: 5px; margin-top: 12px; }
.p6bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--s1); border-radius: 5px; }
.p6bar span { position: absolute; top: -4px; bottom: -4px; width: 3px; background: var(--s2); border-radius: 2px; }
.pill.hidden { display: none; }

/* ---------- junctions ---------- */
.jgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 16px; margin-bottom: 16px; }
.jgrid .card { margin: 0; }
.jcard { border-top: 4px solid var(--brand); }
.jcard:hover { border-color: var(--brand); }
.jh { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.jh h3 { font-size: 18px; }
.jbig { display: flex; align-items: baseline; gap: 8px; margin: 10px 0 6px; flex-wrap: wrap; }
.jbig b { font-size: 30px; letter-spacing: -.5px; }
.jcard .pbar span { width: 52px; }
.jrows { margin-top: 10px; }
.jrows > div { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); font-size: 13px; }
.jrows span { color: var(--text-2); }
.jrows b { text-align: right; font-weight: 600; }
.jcomp { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; }
.jcomp summary { cursor: pointer; padding: 4px 0; }
.jcomp .table-wrap { margin-top: 8px; }
.pour-wrap { max-height: none; }
.pour-wrap td { white-space: nowrap; }
.pt-h, .pt-cell { min-width: 420px; width: 420px; }
.pt { position: relative; height: 22px; }
.pt-bl { position: absolute; top: 15px; height: 4px; border-radius: 2px; background: var(--muted); opacity: .6; }
.pt-cur { position: absolute; top: 3px; height: 10px; border-radius: 3px; overflow: hidden; background: color-mix(in srgb, var(--s1) 35%, var(--surface)); }
.pt-cur em { display: block; height: 100%; background: var(--s1); }
.pt-cur.done, .pt-cur.done em { background: var(--good); }
.pt-cur.crit { outline: 1.5px solid var(--bad); }
.pt-cur.crit em { background: var(--bad); }
.pt-dd { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--s2); }
.pt-axis { position: relative; height: 14px; margin-top: 4px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.pt-axis span { position: absolute; font-size: 10px; color: var(--muted); border-left: 1px solid var(--border); padding-left: 2px; white-space: nowrap; }
.pt-axis .pt-dd { top: 0; bottom: 0; }

/* ---------- programmes / compare / slides ---------- */
.prog-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.prog-bar .seg button:disabled { opacity: .45; cursor: not-allowed; }
.p6strip .p6h .p6t b { color: var(--brand); }
.cmp-head { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.cmp-head .card { margin: 0; }
.cmp-card:hover { border-color: var(--brand); }
.cmp-t { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.cmp-big { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0 8px; }
.cmp-big > div { display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.cmp-big span { font-size: 11px; color: var(--text-2); font-weight: 600; text-transform: uppercase; }
.cmp-big b { font-size: 18px; }
.cmp-big em { font-style: normal; }
.jlist { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
.jline { display: grid; grid-template-columns: minmax(280px, 1fr) 2.2fr; gap: 16px; align-items: stretch; }
.jline .card { margin: 0; }
.jslide { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
.jslide img { width: 100%; height: auto; border-radius: 6px; display: block; }
.jslide figcaption { font-size: 12.5px; font-weight: 600; }
.jslide.empty { align-items: center; justify-content: center; min-height: 160px; }
.jslide.wide { box-shadow: none; border: 0; padding: 0; }
.jslide:hover { border-color: var(--brand); }
@media (max-width: 1000px) { .jline, .cmp-head { grid-template-columns: 1fr; } .cmp-big { grid-template-columns: 1fr 1fr; } }

/* ---------- forecast to date / logic ---------- */
.ol-ctl { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.ol-ctl label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
.ol-ctl input[type=date] { font: inherit; font-size: 14px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.lg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 12px; }
.lg-k { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 4px; }
.lg-k b { font-size: 22px; }
.lg-k div { font-size: 13px; color: var(--text-2); font-weight: 600; }
.lg-k.on, .lg-k:hover { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }
.lg-k .status { align-self: flex-start; }

/* ---------- print ---------- */
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.print-card { width: min(520px, 100%); }
.pr-row { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.pr-row > span { width: 92px; font-weight: 600; color: var(--text-2); font-size: 13px; }
.pr-opts { display: flex; flex-direction: column; gap: 6px; }
.pr-prev { display: flex; justify-content: center; padding: 10px 0 4px; }
.pr-sheet { position: relative; background: #fff; border: 1px solid var(--border); box-shadow: 0 4px 14px rgba(0,0,0,.12); border-radius: 3px; transition: width .2s, height .2s; }
.pr-sheet i { position: absolute; inset: 8%; border: 1.5px dashed var(--muted); border-radius: 2px; }
.pr-sheet span { position: absolute; left: 0; right: 0; bottom: -22px; text-align: center; font-size: 12px; color: var(--muted); white-space: nowrap; }
#printHead { display: none; }

@media print {
  :root { color-scheme: light; }
  html, body { background: #fff !important; }
  body { font-size: 11.5px; }
  body:not(.pr-nocolor) { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .topbar, .tabs, .banner, .foot, #printDlg, .row-btns, .prog-bar .seg, .g-toolbar, .filters, #jsErr, .admin-bar,
  .ol-ctl .seg, .kpi:hover::after, .btn, .modal-back { display: none !important; }
  #printHead { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 2px solid #0f6b45; padding: 0 0 6px; margin-bottom: 10px; font-size: 11px; color: #333; }
  #printHead b { color: #0f6b45; font-size: 13px; }
  main { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .panel { display: none !important; }
  .panel.active { display: block !important; animation: none !important; }
  .card, .kpi, .p6strip, .dtile, .jslide, .lg-k { box-shadow: none !important; break-inside: avoid; page-break-inside: avoid; }
  .card { border-color: #ccc; }
  .card:has(.table-wrap), .card:has(.gantt) { break-inside: auto; page-break-inside: auto; }
  .table-wrap, .table-wrap.tall, .gantt, .modal-b, .modal-b .table-wrap { max-height: none !important; overflow: visible !important; }
  .tbl th { position: static !important; }
  .tbl tfoot td { position: static !important; }
  .tbl tr { break-inside: avoid; page-break-inside: avoid; }
  .tbl thead { display: table-header-group; }
  .g-head, .g-left { position: static !important; }
  .tabs { position: static !important; }
  .chart-box { break-inside: avoid; }
  details, details > * { display: block !important; }
  details:not([open]) > :not(summary) { display: block !important; }
  /* printing a details window: only the window */
  body.pr-modal main { display: none !important; }
  body.pr-modal .modal:not(.hidden):not(#printDlg) { position: static !important; display: block !important; padding: 0 !important; }
  body.pr-modal .modal-card { max-height: none !important; box-shadow: none !important; border: 0 !important; width: auto; }
  body.pr-modal .modal-h { border-bottom: 1px solid #ccc; }
  body:not(.pr-modal) .modal { display: none !important; }
  .hidden { display: none !important; }
  .wk-photos { grid-template-columns: repeat(4, 1fr) !important; }
  .jslide img, .wk-img img { max-height: 150mm; width: auto !important; max-width: 100%; margin: 0 auto; object-fit: contain; }
  body.pr-portrait .jslide img { max-height: 110mm; }
  .card:has(.jslide), .jline { break-inside: auto; page-break-inside: auto; }
  .jline > .card, .jslide { break-inside: avoid; page-break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

/* page layout while printing — applied on screen too, so charts are sized for the paper before the snapshot */
body.printing.pr-portrait .g-2-1, body.printing.pr-portrait .g-1-1, body.printing.pr-portrait .cmp-head, body.printing.pr-portrait .jline { grid-template-columns: 1fr !important; }
body.printing.pr-portrait .chart-box { height: 260px !important; }
body.printing.pr-portrait .chart-box.tall { height: 320px !important; }
body.printing.pr-landscape .chart-box { height: 250px !important; }
body.printing.pr-landscape .chart-box.tall { height: 300px !important; }
body.printing.pr-A3.pr-landscape .chart-box { height: 320px !important; }
body.printing.pr-A3.pr-landscape .chart-box.tall { height: 380px !important; }
body.printing .kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important; }
body.printing .kpi .val { font-size: 20px; }
body.printing main { padding: 0; }

/* ---------- financial sub-sections ---------- */
.tab.fin { margin-left: auto; }
.tab.fin + .tab.import { margin-left: 0; }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.subtabs button { border: 0; background: none; font: inherit; font-weight: 600; font-size: 13.5px; color: var(--text-2); padding: 9px 12px; border-bottom: 2.5px solid transparent; cursor: pointer; }
.subtabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.subpanel { display: none; }
.subpanel.on { display: block; animation: fade .2s ease; }

/* ---------- drill-down filter (P6 Explorer / Resources) ---------- */
.xf { padding: 12px 16px; }
.xf-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 5px 0; }
.xf-l { width: 78px; font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .3px; }
.xf-path { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; }
.xf-path select, .xf select, .xf input[type=search] { font: inherit; font-size: 13px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); max-width: 360px; }
.xf-path select:not([data-lv="0"]) { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }
.xf input.xf-kw { flex: 1; min-width: 260px; max-width: none; }
.xf-arrow { color: var(--brand); font-weight: 700; }
.xf-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font: inherit; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.chip:hover { border-color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.xf-sum { margin: -4px 0 12px; font-size: 13px; }
.ov-tiles { grid-template-columns: repeat(2, 1fr); }
.ov-la { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }
.ov-la:hover { border-color: var(--brand); }
@media print { .xf-bar .xf { display: none; } .subtabs { display: none; } .subpanel { display: none !important; } .subpanel.on { display: block !important; } }
.chip-plus { font-weight: 500; opacity: .75; font-size: 11px; }

/* filter reference + monthly matrix */
.xf-ref { padding: 10px 16px; }
.xf-ref > summary { cursor: pointer; padding: 4px 0; }
.tbl.ref { margin-top: 8px; }
.tbl.ref th { position: static; width: 150px; text-transform: none; font-size: 12.5px; background: var(--surface-2); vertical-align: top; }
.tbl.ref td { font-size: 13px; }
.xf-nodes { margin-top: 8px; }
.xf-nodes summary { cursor: pointer; }
.xf-codes { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12px; max-height: 220px; overflow: auto; }
.tbl.mtx td, .tbl.mtx th { white-space: nowrap; }
.tbl.mtx td:first-child, .tbl.mtx th:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.tbl.mtx thead th:first-child { background: var(--surface-2); z-index: 3; }
.tbl.mtx .cur { background: color-mix(in srgb, var(--s2) 10%, var(--surface)); }
@media print { .xf-ref { display: block; } .xf-ref details, .xf-ref[open] { display: block; } }

/* cut-off block */
.cutbox { margin-bottom: 14px; }
.cut-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cut-now { display: flex; flex-direction: column; gap: 2px; min-width: 190px; }
.cut-now b { font-size: 18px; color: var(--brand); }
.cut-now em { align-self: flex-start; font-style: normal; font-size: 11px; padding: 1px 8px; border-radius: 99px; }
.cut-f { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.cut-f input { font: inherit; font-size: 14px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.cut-q { display: flex; gap: 6px; flex-wrap: wrap; }
.cut-tbl td { vertical-align: middle; }
.cut-chip { font: inherit; font-size: 12px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 4px 10px; cursor: pointer; }
.cut-chip b { color: var(--brand); }
.cut-chip.custom { border-color: var(--warn); }
@media print { .cut-row, .cut-chip { display: none !important; } }

/* recovery / revised programme */
.rv { margin-bottom: 14px; }
.rv-grid { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 10px; }
.cut-f select { font: inherit; font-size: 14px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.rv-drop { padding: 16px; margin: 10px 0; }
.rv-tiles { margin: 14px 0 10px; }
.rv .row-btns { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* events (NCO register) */
.ev-kpis { margin-bottom: 14px; }
.ev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin: 14px 0; }
.ev-card { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.ev-card:hover { border-color: var(--brand); }
.ev-h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ev-no { font-weight: 800; color: var(--brand); font-size: 15px; }
.ev-t { margin: 0; font-size: 16px; line-height: 1.3; }
.ev-dates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ev-dates div { display: flex; flex-direction: column; gap: 1px; background: var(--surface-2); border-radius: 8px; padding: 6px 8px; min-width: 0; }
.ev-dates span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.ev-dates b { font-size: 14px; }
.ev-dates em { font-style: normal; font-size: 11px; color: var(--text-2); }
.ev-s { margin: 0; font-size: 13px; color: var(--text-2); }
.ev-imp { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.ev-imp b { display: inline-block; min-width: 38px; color: var(--muted); font-weight: 600; }
.ev-f { margin-top: auto; display: flex; justify-content: space-between; gap: 8px; }
.ev-more { color: var(--brand); font-weight: 600; }
.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.dir { font-weight: 700; font-size: 12px; }
.dir.in { color: #2563eb; } .dir.out { color: var(--brand); } .dir.oth { color: var(--muted); }
/* timeline */
.tl { overflow-x: auto; }
.tl-row { display: grid; grid-template-columns: minmax(150px, 260px) 1fr; align-items: center; min-width: 720px; border-bottom: 1px solid var(--border); }
.tl-hrow { border-bottom: 0; }
.tl-l { padding: 8px 10px 8px 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-track { position: relative; height: 34px; }
.tl-htrack { height: 22px; }
.tl-axis span { position: absolute; top: 2px; font-size: 11px; color: var(--muted); transform: translateX(2px); }
.tl-g { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--border); }
.tl-bar { position: absolute; top: 12px; height: 10px; border-radius: 5px; opacity: .35; }
.tl-bar.bad { background: var(--bad); } .tl-bar.warn { background: var(--warn); } .tl-bar.good { background: var(--good); }
.tl-m { position: absolute; top: 9px; width: 14px; height: 14px; margin-left: -7px; cursor: pointer; border: 2px solid var(--surface); box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.tl-m.in { background: #2563eb; border-radius: 50%; }
.tl-m.out { background: var(--brand); transform: rotate(45deg); width: 12px; height: 12px; margin-left: -6px; top: 10px; }
.tl-m.oth { background: var(--muted); }
.tl-m:hover { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent); }
.tl-now { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--bad); }
/* letters in the detail */
.ev-ls-list { display: flex; flex-direction: column; gap: 8px; }
.ev-l { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-left: 4px solid var(--muted); border-radius: 8px; }
.ev-l.in { border-left-color: #2563eb; } .ev-l.out { border-left-color: var(--brand); }
.ev-ld { display: flex; flex-direction: column; }
.ev-ls { font-weight: 600; margin: 3px 0; }
.ev-reg td { vertical-align: top; }
/* import form */
.ev-form { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.ev-form .cut-f input, .ev-form .cut-f textarea { font: inherit; font-size: 14px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.ev-form .ev-wide { flex: 1 1 100%; }
.ev-form .ev-wide input, .ev-form .ev-wide textarea { width: 100%; box-sizing: border-box; }
.ev-new { padding: 10px; border: 1px dashed var(--brand); border-radius: 10px; }
@media (max-width: 600px) { .ev-grid { grid-template-columns: 1fr; } .ev-dates { grid-template-columns: 1fr 1fr; } .ev-l { grid-template-columns: 1fr; } }

/* junctions — weekly PowerPoint + daily photos */
.jm-offscreen { position: fixed; left: -12000px; top: 0; width: 1280px; height: 720px; }
.jm-week { margin-bottom: 16px; }
.jm-sel { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.jm-sel select { font: inherit; font-size: 14px; font-weight: 600; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.jm-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.jm-tile { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.jm-tile:hover { border-color: var(--brand); }
.jm-tile span { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.jm-tile b { font-size: 20px; color: var(--brand); }
.jm-tile em { font-style: normal; font-size: 11.5px; color: var(--text-2); }
.jm-tile em i { font-style: normal; font-weight: 700; }
.jm-main { display: grid; grid-template-columns: minmax(0, 2.3fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.jm-main > * { min-width: 0; }
.jm-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.jm-deck { width: 100%; aspect-ratio: 16 / 9; background: #1b2420; border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; color: #cfd8d3; }
.jm-deck-in { width: 100%; height: 100%; }
.jm-deck-col:fullscreen { background: #111; padding: 12px; display: flex; flex-direction: column; }
.jm-deck-col:fullscreen .jm-deck { flex: 1; aspect-ratio: auto; }
.jm-deck-col:fullscreen .jm-bar .btn, .jm-deck-col:fullscreen .jm-bar span { color: #eee; }
.jm-daily-col { border-left: 1px solid var(--border); padding-left: 14px; max-height: 640px; overflow-y: auto; }
.jm-dh { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; position: sticky; top: 0; background: var(--surface); padding-bottom: 6px; }
.jm-dh h4 { margin: 0; }
.jm-day { padding: 8px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; }
.jm-day:hover { border-color: var(--brand); }
.jm-dd { display: flex; flex-direction: column; margin-bottom: 6px; }
.jm-th { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.jm-th img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: var(--surface-2); }
.jm-hist { margin-top: 14px; }
.jm-hist summary { cursor: pointer; padding: 6px 0; }
.jm-cur { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.jm-slot { padding: 10px; }
.jm-thumb { width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 6px; background: var(--surface-2); }
.jm-thumb.empty { display: flex; align-items: center; justify-content: center; text-align: center; padding: 10px; }
.jm-slot-f { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.jm-dnav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; position: sticky; top: -1px; background: var(--surface); padding: 6px 0; z-index: 1; }
.jm-dsec { margin-bottom: 14px; }
.jm-gk { margin: 6px 0 4px; font-weight: 600; }
.jm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.jm-grid figure { margin: 0; }
.jm-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; display: block; background: var(--surface-2); }
.jm-grid figcaption { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.jm-pend { border: 1px dashed var(--brand); border-radius: 10px; padding: 10px; margin: 10px 0; }
.jm-pend input[type=number] { font: inherit; padding: 3px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--text); }
@media (max-width: 1000px) { .jm-main { grid-template-columns: minmax(0, 1fr); } .jm-daily-col { border-left: 0; padding-left: 0; max-height: none; } }
@media print { .jm-bar, .jm-sel select, .jm-dh .seg { display: none !important; } }
#pourCard .card-h { flex-wrap: wrap; } #pourCard .g-toolbar { flex-wrap: wrap; max-width: 100%; } #pourCard .seg { flex-wrap: wrap; }

/* manage daily photos */
.jm-mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 10px; }
.jm-mph { position: relative; display: flex; flex-direction: column; gap: 3px; border: 2px solid var(--border); border-radius: 10px; padding: 4px; cursor: pointer; font-size: 11.5px; }
.jm-mph.on { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, transparent); }
.jm-mph input { position: absolute; top: 8px; left: 8px; width: 18px; height: 18px; }
.jm-mph img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; }
.jm-mph span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jm-mact { align-items: center; position: sticky; bottom: 0; background: var(--surface); padding: 8px 0; }
.jm-mact select, .jm-mact input { font: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); }
.jm-adm { margin-top: 6px; }

/* publish bar (owner) + viewer refresh notice */
.pub-bar { margin: 12px 24px 0; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
.pub-bar.pending { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 9%, var(--surface)); }
.pub-bar.ok { border-color: color-mix(in srgb, var(--good) 45%, var(--border)); }
.pub-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pub-ic { font-size: 18px; font-weight: 800; width: 22px; text-align: center; }
.pub-bar.pending .pub-ic { color: var(--warn); } .pub-bar.ok .pub-ic { color: var(--good); } .pub-bar.busy .pub-ic { color: var(--brand); animation: pubspin 1s linear infinite; }
@keyframes pubspin { to { transform: rotate(360deg); } }
.pub-txt { flex: 1 1 320px; font-size: 13.5px; min-width: 0; }
.pub-btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pub-set { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.pub-set ol { margin: 6px 0 10px 18px; padding: 0; }
.pub-set input { flex: 1 1 260px; font: inherit; font-size: 14px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); }
.new-data { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--brand); box-shadow: 0 8px 28px rgba(0,0,0,.18); font-size: 14px; max-width: calc(100vw - 32px); }
@media (max-width: 600px) { .pub-bar { margin: 10px 16px 0; } }
@media print { .pub-bar, .new-data { display: none !important; } }

/* summary of progress */
.sop-ctl { display: flex; flex-direction: column; gap: 10px; }
.sop-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sop-row .seg { flex-wrap: wrap; }
.sop-row input[type=search] { flex: 1 1 220px; font: inherit; font-size: 14px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); }
.sop-tbl td { vertical-align: middle; }
.sop-tbl .pbar { min-width: 140px; }
.sop-r.d0 td:first-child b { font-size: 14.5px; color: var(--brand); }
.sop-r.d0 { background: color-mix(in srgb, var(--brand) 5%, transparent); }
.sop-r.d1 td:first-child b { font-weight: 650; }
.sop-r:not(.d0):not(.d1) td:first-child b { font-weight: 500; }
.sop-tg { display: inline-block; width: 16px; color: var(--muted); cursor: pointer; }
.sop-qc { max-width: 280px; }
.sop-q { display: inline-block; font-size: 11.5px; padding: 1px 7px; margin: 1px 4px 1px 0; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.sop-q b { color: var(--brand); }
@media print { body.sop-print-la main > section, body.sop-print-la .tabs, body.sop-print-la .topbar { display: none !important; }
  body.sop-print-la #tab-sop { display: block !important; } body.sop-print-la #tab-sop > div > *:not(#sopLa) { display: none !important; } body.sop-print-la #sopLa .row-btns { display: none !important; } }
.cut-weeks { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; } .cut-weeks .chip { cursor: pointer; }
.sop-acts { display: inline-block; margin-top: 3px; font: inherit; font-size: 12px; font-weight: 600; color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--border)); border-radius: 99px; padding: 1px 9px; cursor: pointer; white-space: nowrap; }
.sop-acts:hover { background: color-mix(in srgb, var(--brand) 16%, transparent); }
