/* LoopClosers CSM Tracker: "Maximalist Pop" design system, lifted from the
   loopclosers-website prototypes (index.html, platform.html, demo-modal.js)
   and tuned for a dense internal tool: no rotations or blobs inside the app,
   display type capped around 32-40px. */

:root {
  --ink: #11100c; --cream: #fff6e9; --blue: #2b27ff; --pink: #ff45b5;
  --lime: #c9f23a; --orange: #ff5c1a; --cyan: #19d3e6;
  --sun: #ffd23f; --red: #f0303a; --paper: #fffdf6; --white: #fff;
  --muted: #6b6a5e; --muted-2: #4a4940; --line: rgba(17, 16, 12, .14); --soft: #e9e2d3;
  --display: 'Bricolage Grotesque', 'Space Grotesk', system-ui, sans-serif;
  --body: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r-sm: 10px; --r: 14px; --r-lg: 20px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--cream); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.45;
       -webkit-font-smoothing: antialiased; min-height: 100vh; padding-bottom: 60px; }
a { color: inherit; }
a.link { color: var(--blue); font-weight: 600; text-decoration: none; }
a.link:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
img { max-width: 100%; }
h1, h2, h3, .display { font-family: var(--display); letter-spacing: -.01em; }
h1 { font-weight: 800; font-size: clamp(26px, 3.6vw, 36px); line-height: 1.04; }
h2 { font-weight: 800; font-size: 22px; line-height: 1.1; }
h3 { font-weight: 700; font-size: 17px; line-height: 1.2; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 24px; }
.loading { padding: 80px 0; text-align: center; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 700; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: 12px; color: var(--muted-2); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.stack.lg > * + * { margin-top: 22px; }
.spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.span2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.mt { margin-top: 20px; } .mt-s { margin-top: 10px; } .mt-l { margin-top: 32px; }
.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Nav (floating island) ---------- */
nav.top { position: sticky; top: 0; z-index: 80; padding: 14px 0 10px; background: linear-gradient(var(--cream) 70%, rgba(255, 246, 233, 0)); }
.navbar { display: flex; align-items: center; gap: 18px; background: var(--cream); border: 3px solid var(--ink);
          border-radius: 16px; box-shadow: 5px 5px 0 var(--ink); height: 60px; padding: 0 10px 0 18px; }
.navbar .logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.navbar .logo img { height: 24px; width: auto; display: block; }
.navbar .logo .tag { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
                     background: var(--lime); border: 2px solid var(--ink); border-radius: 999px; padding: 2px 8px; }
.navlinks { display: flex; gap: 4px; font-weight: 600; font-size: 14.5px; }
.navlinks a { text-decoration: none; padding: 7px 12px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; }
.navlinks a:hover { color: var(--pink); }
.navlinks a.active { background: var(--ink); color: var(--cream); }
.navlinks .count { background: var(--pink); color: var(--cream); border: 2px solid var(--ink); border-radius: 999px;
                   font-size: 11px; font-weight: 700; padding: 0 6px; line-height: 16px; }
.navlinks a.active .count { border-color: var(--cream); }
.navright { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--ink); background: var(--cream);
           display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative;
           font-size: 17px; transition: transform .12s, box-shadow .12s; }
.iconbtn:hover { background: var(--lime); }
.iconbtn .badge { position: absolute; top: -7px; right: -7px; background: var(--pink); color: var(--cream);
                  border: 2px solid var(--ink); border-radius: 999px; font-size: 11px; font-weight: 700;
                  min-width: 20px; height: 20px; padding: 0 5px; display: flex; align-items: center; justify-content: center; }
.avatar { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--ink); background: var(--sun);
          font-family: var(--display); font-weight: 800; display: inline-flex; align-items: center; justify-content: center;
          cursor: pointer; font-size: 15px; }
.avatar.sm { width: 26px; height: 26px; border-width: 2px; font-size: 11px; cursor: default; }
.dropdown { position: absolute; top: 74px; right: 0; width: min(380px, calc(100vw - 32px)); background: var(--cream);
            border: 3px solid var(--ink); border-radius: 16px; box-shadow: 6px 6px 0 var(--ink); z-index: 90;
            max-height: min(70vh, 560px); overflow: auto; }
.dropdown .dd-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px;
                     border-bottom: 3px solid var(--ink); position: sticky; top: 0; background: var(--cream); }
.dropdown .dd-item { display: block; padding: 11px 16px; border-bottom: 1px solid var(--line); text-decoration: none; cursor: pointer; }
.dropdown .dd-item:hover { background: var(--white); }
.dropdown .dd-item.unread { background: #fff; box-shadow: inset 5px 0 0 var(--pink); }
.dropdown .dd-item .t { font-weight: 700; font-size: 14px; }
.dropdown .dd-item .b { font-size: 13px; color: var(--muted-2); margin-top: 2px; }
.dropdown .dd-item .w { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.dropdown .dd-empty { padding: 26px 16px; text-align: center; color: var(--muted); }
.navwrap { position: relative; }
.menu-btn { display: none; }
.mobile-links { display: none; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--pink); color: var(--cream);
       font-weight: 700; font-size: 15px; padding: 11px 20px; border-radius: 999px; border: 3px solid var(--ink);
       box-shadow: 4px 4px 0 var(--ink); transition: transform .12s, box-shadow .12s; cursor: pointer;
       text-decoration: none; white-space: nowrap; line-height: 1.1; }
.btn:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: 4px 4px 0 var(--ink); }
.btn.lime { background: var(--lime); color: var(--ink); }
.btn.cream { background: var(--cream); color: var(--ink); }
.btn.white { background: var(--white); color: var(--ink); }
.btn.ink { background: var(--ink); color: var(--cream); }
.btn.cyan { background: var(--cyan); color: var(--ink); }
.btn.blue { background: var(--blue); color: var(--cream); }
.btn.red { background: var(--red); color: var(--cream); }
.btn.sm { font-size: 13.5px; padding: 7px 14px; box-shadow: 3px 3px 0 var(--ink); border-width: 2px; }
.btn.sm:hover { box-shadow: 1px 1px 0 var(--ink); }
.btn.xs { font-size: 12px; padding: 4px 10px; box-shadow: 2px 2px 0 var(--ink); border-width: 2px; }
.btn.xs:hover { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.btn.block { width: 100%; }
.linkbtn { background: none; border: none; color: var(--blue); font-weight: 700; cursor: pointer; padding: 0; text-decoration: none; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn.danger { color: var(--red); }
.x-btn { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--ink); background: var(--cream); cursor: pointer;
         font-weight: 700; line-height: 1; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.x-btn:hover { background: var(--red); color: var(--cream); }

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 18px 0 20px; }
.page-head .titles { flex: 1; min-width: 240px; }
.page-head h1 { margin-top: 4px; }
.page-head .sub { color: var(--muted-2); margin-top: 6px; font-weight: 500; }
.crumb { display: inline-flex; gap: 6px; align-items: center; font-weight: 700; font-size: 13.5px; text-decoration: none; color: var(--muted-2); margin-top: 14px; }
.crumb:hover { color: var(--pink); }

/* ---------- Cards ---------- */
.card { background: var(--white); border: 3px solid var(--ink); border-radius: var(--r-lg); box-shadow: 6px 6px 0 var(--ink); overflow: hidden; min-width: 0; }
.card > .head { padding: 13px 18px; border-bottom: 3px solid var(--ink); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card > .head h2, .card > .head h3 { font-size: 17px; font-weight: 800; font-family: var(--display); }
.card > .head .hint { font-size: 12px; font-weight: 600; opacity: .8; }
.card > .head .actions { margin-left: auto; display: flex; gap: 8px; }
.card > .body { padding: 16px 18px; }
.card > .body.flush { padding: 0; }
.card.flat { box-shadow: 4px 4px 0 var(--ink); border-radius: var(--r); }
.h-pink { background: var(--pink); color: var(--cream); }
.h-cyan { background: var(--cyan); color: var(--ink); }
.h-lime { background: var(--lime); color: var(--ink); }
.h-blue { background: var(--blue); color: var(--cream); }
.h-orange { background: var(--orange); color: var(--ink); }
.h-sun { background: var(--sun); color: var(--ink); }
.h-ink { background: var(--ink); color: var(--cream); }
.h-cream { background: var(--cream); color: var(--ink); }
.h-red { background: var(--red); color: var(--cream); }
.h-pink .btn.xs, .h-blue .btn.xs, .h-ink .btn.xs, .h-red .btn.xs { box-shadow: 2px 2px 0 var(--cream); border-color: var(--cream); }
.empty { border: 2px dashed var(--ink); border-radius: var(--r); padding: 22px; text-align: center; color: var(--muted-2); background: var(--paper); }
.empty .btn { margin-top: 12px; }
.note { background: var(--paper); border: 2px dashed var(--ink); border-radius: var(--r-sm); padding: 10px 12px; font-size: 13.5px; }
.banner { border: 3px solid var(--ink); border-radius: var(--r); padding: 12px 16px; font-weight: 600; box-shadow: 4px 4px 0 var(--ink); }
.banner.lime { background: var(--lime); } .banner.sun { background: var(--sun); } .banner.orange { background: var(--orange); }

/* Definition lists inside cards */
.dl { display: grid; grid-template-columns: minmax(120px, 42%) 1fr; gap: 9px 14px; font-size: 14px; }
.dl dt { color: var(--muted); font-weight: 600; font-size: 13px; display: flex; gap: 5px; align-items: baseline; }
.dl dd { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.dl dd.empty-v { color: var(--muted); font-weight: 500; }
.lock { font-size: 11px; color: var(--muted); }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- KPI (from platform.html) ---------- */
.kpi-row { display: grid; grid-template-columns: 5fr 8fr; gap: 18px; }
.roi { background: var(--blue); color: var(--cream); border: 3px solid var(--ink); border-radius: 18px; padding: 22px; box-shadow: 6px 6px 0 var(--ink); display: flex; flex-direction: column; min-width: 0; }
.roi .k { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--lime); }
.roi .big { font-family: var(--display); font-weight: 800; font-size: clamp(34px, 4.4vw, 50px); line-height: 1; margin-top: 8px; }
.roi .big small { font-size: 13px; background: var(--lime); color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; padding: 2px 8px; vertical-align: middle; margin-left: 6px; font-weight: 700; font-family: var(--body); }
.roi .sub { font-size: 13px; color: #d8d5ff; margin-top: 8px; font-weight: 500; }
.roi svg { margin-top: auto; padding-top: 14px; width: 100%; height: 70px; overflow: visible; }
.roi .spark-labels { display: flex; justify-content: space-between; font-size: 10.5px; color: #d8d5ff; font-weight: 600; margin-top: 4px; }
.mgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.m { background: var(--cream); border: 3px solid var(--ink); border-radius: var(--r); padding: 13px 14px; box-shadow: 4px 4px 0 var(--ink); min-width: 0; text-decoration: none; display: block; }
a.m:hover { background: var(--white); }
.m .row { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; flex-wrap: nowrap; }
.m .delta { background: var(--lime); border: 2px solid var(--ink); border-radius: 999px; padding: 0 7px; font-size: 10.5px; font-weight: 700; color: var(--ink); text-transform: none; letter-spacing: 0; white-space: nowrap; }
.m .delta.bad { background: var(--red); color: var(--cream); }
.m .delta.warn { background: var(--sun); }
.m .v { font-family: var(--display); font-weight: 800; font-size: 26px; margin-top: 6px; line-height: 1.05; overflow-wrap: anywhere; }
.m .s { font-size: 12px; color: var(--muted-2); margin-top: 3px; font-weight: 500; }
.m.alert { background: #ffe3e4; }

/* ---------- Forms (from demo-modal.js) ---------- */
label, .label { display: block; font-weight: 700; font-size: 13px; margin: 0 0 6px; }
.fld { margin-bottom: 14px; min-width: 0; }
.fld .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.fld .req { color: var(--pink); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], input[type=search],
select, textarea {
  width: 100%; font-family: inherit; font-size: 15px; padding: 10px 12px; border: 3px solid var(--ink); border-radius: 12px;
  background: var(--white); color: var(--ink); outline: none; transition: box-shadow .12s; min-height: 44px; }
textarea { min-height: 76px; resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { box-shadow: 4px 4px 0 var(--blue); }
input.bad, select.bad, textarea.bad { border-color: var(--orange); box-shadow: 4px 4px 0 var(--orange); }
input:disabled, select:disabled, textarea:disabled { background: var(--soft); color: var(--muted-2); }
select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
         background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1.5 1.5l5.5 5.5 5.5-5.5' fill='none' stroke='%2311100c' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
         background-repeat: no-repeat; background-position: right 13px center; }
select.sm, input.sm { min-height: 36px; padding: 6px 10px; font-size: 13.5px; border-width: 2px; border-radius: 10px; }
select.sm { padding-right: 30px; background-position: right 10px center; }
input[type=checkbox], input[type=radio] { appearance: none; -webkit-appearance: none; width: 22px; height: 22px; border: 3px solid var(--ink);
  border-radius: 6px; background: var(--white); cursor: pointer; flex: none; display: inline-grid; place-content: center; vertical-align: middle; }
input[type=radio] { border-radius: 50%; }
input[type=checkbox]:checked { background: var(--lime); }
input[type=checkbox]:checked::after { content: ""; width: 10px; height: 6px; border-left: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: translateY(-1px) rotate(-45deg); }
input[type=radio]:checked { background: var(--blue); box-shadow: inset 0 0 0 3px var(--white); }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { box-shadow: 3px 3px 0 var(--blue); }
.check { display: flex; gap: 10px; align-items: center; font-weight: 600; font-size: 14px; cursor: pointer; margin: 0; }
.err { color: #c43d00; font-size: 13px; font-weight: 700; margin-top: 8px; }
.err:empty { display: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.money-in { position: relative; }
.money-in::before { content: "₹"; position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-weight: 700; color: var(--muted-2); pointer-events: none; }
.money-in input { padding-left: 28px; }
.money-in.sm::before { left: 10px; font-size: 13px; }
.money-in.sm input { padding-left: 22px; }

/* Segmented control / tabs (from demo-modal day picker) */
.seg { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.seg button, .seg a { font-weight: 700; font-size: 13.5px; padding: 8px 14px; border: 2px solid var(--ink); border-radius: 11px;
                      background: var(--white); cursor: pointer; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.seg button:hover, .seg a:hover { background: var(--cyan); }
.seg .sel, .seg .sel:hover { background: var(--blue); color: var(--cream); }
.seg .count { font-size: 11px; background: var(--cream); color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; padding: 0 6px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 4px 8px; margin: 0 -4px 14px; scrollbar-width: thin; }
.tabs button { flex: none; }

/* ---------- Chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; border: 2px solid var(--ink); border-radius: 999px; padding: 2px 10px;
        font-size: 12px; font-weight: 700; line-height: 1.35; white-space: nowrap; background: var(--white); max-width: 100%; }
.chip.lg { font-size: 13.5px; padding: 4px 13px; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--ink); flex: none; }
.st-discovery { background: var(--sun); }
.st-in-development { background: var(--blue); color: var(--cream); }
.st-live { background: var(--lime); }
.st-stuck { background: var(--orange); }
.st-closed { background: var(--ink); color: var(--cream); }
.stage { background: var(--white); }
.stage.warn { border-color: var(--orange); box-shadow: 2px 2px 0 var(--orange); }
.flag { cursor: default; }
.flag.red { background: var(--red); color: var(--cream); }
.flag.orange { background: var(--cream); border-color: var(--orange); color: #b23a00; }
.flag.info { background: var(--soft); }
.flag.acked { opacity: .55; text-decoration: line-through; }
.ap-pending { background: var(--sun); }
.ap-approved { background: var(--lime); }
.ap-changes_requested { background: var(--cyan); }
.ap-rejected { background: var(--red); color: var(--cream); }
.ap-draft, .ap-withdrawn, .ap-superseded { background: var(--soft); color: var(--muted-2); }
.q-tag { font-size: 11px; font-weight: 700; border: 2px solid var(--ink); border-radius: 6px; padding: 0 6px; background: var(--cream); white-space: nowrap; }
.person { background: var(--white); }
.person.on { background: var(--lime); }
.dots { display: inline-flex; gap: 4px; align-items: center; }
.fdot { min-width: 20px; height: 20px; border-radius: 999px; border: 2px solid var(--ink); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.fdot.red { background: var(--red); color: var(--cream); }
.fdot.orange { background: var(--sun); }

/* ---------- Filters bar ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filters select, .filters input { width: auto; min-width: 140px; }
.filters input[type=search] { min-width: 240px; flex: 1; max-width: 320px; }
.attention { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.attention a { text-decoration: none; }

/* ---------- Kanban board ---------- */
.board { display: grid; grid-template-columns: repeat(5, minmax(250px, 1fr)); gap: 16px; overflow-x: auto; padding: 4px 8px 16px 4px; margin: 0 -8px 0 -4px; align-items: start; }
.board.no-closed { grid-template-columns: repeat(4, minmax(250px, 1fr)); }
.col { background: var(--paper); border: 3px solid var(--ink); border-radius: 18px; min-width: 0; }
.col-head { padding: 11px 14px; border-bottom: 3px solid var(--ink); border-radius: 15px 15px 0 0; display: flex; align-items: center; gap: 8px; }
.col-head h3 { font-size: 15px; font-weight: 800; }
.col-head .n { margin-left: auto; font-weight: 700; font-size: 12px; background: var(--cream); color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; padding: 0 8px; }
.col-head .val { font-size: 12px; font-weight: 600; opacity: .85; }
.col-body { padding: 12px; display: flex; flex-direction: column; gap: 12px; min-height: 80px; }
.col-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 16px 0; }
.pcard { display: block; text-decoration: none; background: var(--white); border: 3px solid var(--ink); border-radius: 14px; padding: 12px 13px;
         box-shadow: 4px 4px 0 var(--ink); transition: transform .12s, box-shadow .12s; }
.pcard:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.pcard .client { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .name { font-family: var(--display); font-weight: 800; font-size: 16.5px; line-height: 1.15; margin: 3px 0 8px; }
.pcard .headline { font-size: 13px; color: var(--muted-2); margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard .foot { display: flex; gap: 6px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.pcard .foot .spacer { min-width: 4px; }
.pcard .age { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.pcard.red { box-shadow: 4px 4px 0 var(--red); }

/* ---------- Tables (from celevida .summary) ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2);
          padding: 10px 12px; border-bottom: 3px solid var(--ink); background: var(--cream); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--pink); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: var(--paper); }
.tbl td.name { font-weight: 700; min-width: 180px; }
.tbl th.right, .tbl td.right { text-align: right; }
.tbl .sub { font-size: 12px; color: var(--muted); font-weight: 500; }
.tbl.compact td, .tbl.compact th { padding: 7px 10px; }

/* ---------- Project page ---------- */
.phead { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start; background: var(--white); border: 3px solid var(--ink);
         border-radius: var(--r-lg); box-shadow: 6px 6px 0 var(--ink); padding: 20px 22px; margin: 14px 0 18px; }
.phead h1 { margin: 6px 0 10px; }
.phead .actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.phead .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stuck-note { margin-top: 10px; background: #ffe7dc; border: 2px solid var(--orange); border-radius: 10px; padding: 7px 11px; font-size: 13.5px; font-weight: 600; }

.stepper { display: flex; align-items: stretch; overflow-x: auto; gap: 0; padding: 2px 4px 12px; margin-bottom: 14px; scrollbar-width: thin; }
.stp-group { display: flex; flex-direction: column; gap: 6px; flex: none; }
.stp-group .g-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding-left: 4px; }
.stp-row { display: flex; align-items: center; }
.stp { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 84px; text-align: center; position: relative; }
.stp .node { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--ink); background: var(--white); z-index: 1; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; }
.stp .lbl { font-size: 11.5px; font-weight: 600; line-height: 1.15; color: var(--muted-2); }
.stp::before { content: ""; position: absolute; top: 12px; left: -50%; width: 100%; height: 3px; background: var(--ink); opacity: .25; }
.stp.first::before { display: none; }
.stp.done .node { background: var(--lime); }
.stp.done::before, .stp.current::before { opacity: 1; }
.stp.current .node { background: var(--pink); width: 30px; height: 30px; box-shadow: 3px 3px 0 var(--ink); }
.stp.current .lbl { color: var(--ink); font-weight: 800; }
.stp.side .node { border-style: dashed; }
.gate { width: 18px; height: 18px; transform: rotate(45deg); border: 3px solid var(--ink); background: var(--white); margin: 0 -2px; flex: none; align-self: flex-start; margin-top: 4px; z-index: 2; position: relative; }
.gate.ok { background: var(--lime); }
.gate.wait { background: var(--sun); }
.stp-sep { width: 14px; flex: none; }

.timeline { list-style: none; }
.timeline li { display: grid; grid-template-columns: 112px 1fr; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: none; }
.timeline .when { font-size: 12px; color: var(--muted); font-weight: 600; }
.timeline .what { font-size: 14px; }
.timeline .diff { font-size: 12.5px; color: var(--muted-2); margin-top: 4px; }
.timeline .diff s { color: var(--muted); }

.update { border: 3px solid var(--ink); border-radius: var(--r); background: var(--white); box-shadow: 4px 4px 0 var(--ink); padding: 14px 16px; }
.update.latest { box-shadow: 4px 4px 0 var(--pink); }
.update .uh { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.update .uh h3 { font-size: 16px; }
.update .uh .when { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: auto; }
.update .ub { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin-top: 10px; font-size: 14px; }
.update .ub .k { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 2px; }

.apcards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.history { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.history summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--blue); }
.history .hv { padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.history .hv:last-child { border-bottom: none; }
.diffv s { color: var(--muted); text-decoration-thickness: 2px; margin-right: 6px; }
.diffv b { background: var(--sun); padding: 0 3px; border-radius: 4px; }
.decision { margin-top: 12px; border-radius: 12px; border: 2px solid var(--ink); padding: 10px 12px; font-size: 13.5px; }
.decision.approved { background: #f1fbd2; } .decision.rejected { background: #ffe3e4; } .decision.changes_requested { background: #dcf8fb; }
.breakdown { width: 100%; font-size: 13px; border-collapse: collapse; margin-top: 6px; }
.breakdown td { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.breakdown td:last-child { text-align: right; font-weight: 700; }
.margin-pill { font-weight: 800; border: 2px solid var(--ink); border-radius: 999px; padding: 1px 8px; font-size: 13px; }
.margin-pill.good { background: var(--lime); } .margin-pill.warn { background: var(--sun); } .margin-pill.bad { background: var(--red); color: var(--cream); }

.picker-team { margin-bottom: 12px; }
.picker-team .tl { font-size: 12px; font-weight: 700; display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.picker-team .tl .sugg { background: var(--lime); border: 2px solid var(--ink); border-radius: 999px; padding: 0 7px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; }
.picker-team .people { display: flex; gap: 8px; flex-wrap: wrap; }
.picker-team .person { cursor: pointer; font-size: 13.5px; padding: 5px 12px; }
.picker-team .person:hover { background: var(--cyan); }
.picker-team .person.on:hover { background: var(--lime); }
.effort-rows { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 14px; }
.effort-row { display: grid; grid-template-columns: 1fr 130px 1.4fr; gap: 10px; align-items: center; }
.stage-block + .stage-block { margin-top: 16px; }
.stage-block .sb-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.team-row { display: grid; grid-template-columns: minmax(150px, 1.2fr) 120px 2fr 30px; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.team-row:last-child { border-bottom: none; }
.team-row input { min-height: 34px; padding: 5px 9px; font-size: 13.5px; border-width: 2px; border-radius: 9px; }

/* ---------- Approvals inbox ---------- */
.inbox { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; align-items: start; }
.ap-list { display: flex; flex-direction: column; gap: 10px; }
.ap-item { display: block; text-align: left; width: 100%; background: var(--white); border: 3px solid var(--ink); border-radius: 14px; padding: 11px 13px;
           box-shadow: 3px 3px 0 var(--ink); cursor: pointer; transition: transform .1s, box-shadow .1s; }
.ap-item:hover { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--ink); }
.ap-item.sel { background: var(--cream); box-shadow: 3px 3px 0 var(--pink); border-color: var(--ink); }
.ap-item .r1 { display: flex; gap: 8px; align-items: center; }
.ap-item .r1 .age { margin-left: auto; font-size: 12px; font-weight: 700; }
.ap-item .r2 { font-family: var(--display); font-weight: 800; font-size: 15.5px; margin-top: 6px; }
.ap-item .r3 { font-size: 12.5px; color: var(--muted-2); margin-top: 2px; }
.age.ok { color: var(--muted); } .age.warn { color: #a36b00; } .age.bad { color: var(--red); }
.ap-panel { position: sticky; top: 92px; }
.checklist { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 14px; }
.checklist .check .have { font-size: 12px; color: var(--muted); font-weight: 500; }

/* ---------- Dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; }
.c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c6 { grid-column: span 6; }
.c7 { grid-column: span 7; } .c8 { grid-column: span 8; } .c12 { grid-column: span 12; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.bar-row .bl { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .bv { font-weight: 700; font-size: 13px; white-space: nowrap; min-width: 34px; text-align: right; }
.track { height: 16px; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); overflow: hidden; }
.track .fill { height: 100%; background: var(--blue); border-right: 2px solid var(--ink); min-width: 0; }
.track .fill.zero { border-right: none; }
.funnel { display: flex; flex-direction: column; gap: 7px; }
.funnel .fs { display: grid; grid-template-columns: 150px 1fr; gap: 10px; align-items: center; font-size: 13.5px; }
.funnel .fb { height: 30px; border: 3px solid var(--ink); border-radius: 10px; display: flex; align-items: center; padding: 0 10px; font-weight: 800; font-family: var(--display); min-width: 46px; }
.funnel .fs .pc { font-size: 11px; font-weight: 700; color: var(--muted); margin-left: 6px; font-family: var(--body); }
.cmp { width: 100%; border-collapse: collapse; font-size: 14px; }
.cmp th, .cmp td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: right; }
.cmp th:first-child, .cmp td:first-child { text-align: left; color: var(--muted-2); font-weight: 600; }
.cmp thead th { font-family: var(--display); font-size: 16px; font-weight: 800; color: var(--ink); border-bottom: 3px solid var(--ink); }
.cmp td.best { background: #f1fbd2; font-weight: 800; }
.flaglist { display: flex; flex-direction: column; }
.flaglist .fr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.flaglist .fr:last-child { border-bottom: none; }
.flaglist .fr .d { font-size: 12.5px; color: var(--muted-2); }
.stat-trio { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat { border: 2px solid var(--ink); border-radius: 12px; padding: 10px 12px; background: var(--cream); }
.stat .k { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat .v { font-family: var(--display); font-weight: 800; font-size: 22px; margin-top: 3px; }
.stat .s { font-size: 11.5px; color: var(--muted); }

/* Profitability */
.prof-top { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(0, 3.4fr); gap: 16px; align-items: stretch; }
.prof-head { background: var(--ink); color: var(--cream); border: 3px solid var(--ink); border-radius: 16px; padding: 16px 18px; box-shadow: 5px 5px 0 var(--lime); }
.prof-head .k { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--lime); }
.prof-head .v { font-family: var(--display); font-weight: 800; font-size: 44px; line-height: 1; margin: 8px 0 6px; }
.prof-head .s { font-size: 12.5px; color: #d9d5c7; margin-top: 3px; }
.bands { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.band { text-align: left; border: 3px solid var(--ink); border-radius: 14px; padding: 11px 12px; box-shadow: 4px 4px 0 var(--ink); background: var(--white);
        cursor: pointer; transition: transform .12s, box-shadow .12s; font: inherit; color: var(--ink); min-width: 0; }
.band:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.band.sel { box-shadow: 4px 4px 0 var(--pink); outline: 3px solid var(--pink); outline-offset: 2px; }
.band .bl { font-weight: 800; font-family: var(--display); font-size: 15px; }
.band .br { font-size: 11.5px; font-weight: 600; opacity: .8; }
.band .bn { font-family: var(--display); font-weight: 800; font-size: 32px; line-height: 1; margin-top: 10px; }
.band .bn small { font-family: var(--body); font-size: 13px; font-weight: 700; opacity: .8; }
.band .bs { font-size: 12px; font-weight: 600; opacity: .85; margin-top: 3px; }
.b-loss { background: var(--red); color: var(--cream); }
.b-below { background: var(--sun); }
.b-healthy { background: var(--lime); }
.b-strong { background: var(--blue); color: var(--cream); }
.b-none { background: var(--soft); cursor: default; box-shadow: none; border-style: dashed; }
.b-none:hover { transform: none; box-shadow: none; }
.tbl tr.team-h td { background: var(--paper); padding: 8px 12px; }

/* ---------- Team matrix ---------- */
.loadgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.lrow { display: grid; grid-template-columns: minmax(70px, 1fr) 1.4fr auto; gap: 10px; align-items: center; padding: 6px 0; cursor: pointer; border-radius: 8px; }
.lrow:hover .lname { color: var(--pink); }
.lname { font-weight: 700; font-size: 14px; }
.load { display: flex; gap: 3px; }
.load i { flex: 1; height: 14px; border: 2px solid var(--ink); border-radius: 4px; background: var(--paper); }
.load i.on { background: var(--lime); } .load.warn i.on { background: var(--sun); } .load.bad i.on { background: var(--red); }
.matrix-wrap { overflow: auto; max-height: 75vh; }
table.matrix { border-collapse: separate; border-spacing: 0; font-size: 13px; }
.matrix th, .matrix td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 7px 9px; vertical-align: top; }
.matrix thead th { position: sticky; top: 0; background: var(--cream); z-index: 2; border-bottom: 3px solid var(--ink); min-width: 130px; max-width: 170px; text-align: left; font-weight: 700; }
.matrix thead th a { text-decoration: none; }
.matrix thead th a:hover { color: var(--pink); }
.matrix thead th .sub { font-size: 11px; color: var(--muted); font-weight: 500; }
.matrix .rh { position: sticky; left: 0; background: var(--white); z-index: 1; font-weight: 700; min-width: 140px; border-right: 3px solid var(--ink); white-space: nowrap; }
.matrix thead th.rh { z-index: 3; background: var(--cream); }
.matrix tr.team-h td { background: var(--paper); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); position: sticky; left: 0; }
.matrix .cell { display: flex; flex-direction: column; gap: 4px; }
.mchip { font-size: 11px; font-weight: 700; border: 2px solid var(--ink); border-radius: 7px; padding: 1px 6px; background: var(--white); white-space: nowrap; }
.mchip.current { background: var(--lime); }
.mchip .e { font-weight: 600; color: var(--muted-2); margin-left: 4px; }

/* ---------- Modal (from demo-modal.js) ---------- */
.modal-root { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.modal-back { position: fixed; inset: 0; background: rgba(17, 16, 12, .62); backdrop-filter: blur(4px); }
.modal { position: relative; z-index: 1; width: 100%; max-width: 560px; background: var(--cream); border: 3px solid var(--ink); border-radius: 22px;
         box-shadow: 9px 9px 0 var(--ink); padding: 26px 26px 22px; animation: lcPop .2s cubic-bezier(.2, 1.3, .5, 1); margin-bottom: 5vh; }
.modal.wide { max-width: 760px; }
@keyframes lcPop { from { transform: translateY(14px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h2 { font-size: 24px; margin-right: 46px; }
.modal .msub { font-size: 14px; color: var(--muted-2); margin: 6px 0 18px; }
.modal .x { position: absolute; top: 16px; right: 16px; width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--ink); background: var(--cream);
            font-size: 20px; font-weight: 700; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform .12s; }
.modal .x:hover { transform: rotate(90deg); background: var(--pink); color: var(--cream); }
.modal .mfoot { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.modal .mbody { margin-top: 14px; }
.opt { display: flex; gap: 12px; align-items: flex-start; border: 3px solid var(--ink); border-radius: 14px; padding: 11px 13px; background: var(--white); cursor: pointer; margin-bottom: 10px; }
.opt:hover { background: var(--paper); }
.opt.on { box-shadow: 4px 4px 0 var(--blue); }
.opt.off { opacity: .55; cursor: not-allowed; }
.opt .ot { font-weight: 700; }
.opt .od { font-size: 13px; color: var(--muted-2); margin-top: 2px; }
.opt-extra { margin: -2px 0 12px 0; padding: 12px 14px 2px; border: 2px dashed var(--ink); border-radius: 12px; background: var(--paper); }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; font-weight: 700; background: var(--white); border: 3px solid var(--ink); border-radius: 12px; padding: 12px 14px; letter-spacing: .03em; word-break: break-all; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; bottom: 18px; right: 18px; z-index: 300; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast { background: var(--ink); color: var(--cream); border: 3px solid var(--ink); border-radius: 14px; padding: 11px 16px; font-weight: 600; font-size: 14px;
         box-shadow: 5px 5px 0 var(--lime); max-width: min(420px, calc(100vw - 36px)); animation: lcPop .2s ease-out; }
.toast.error { background: var(--red); box-shadow: 5px 5px 0 var(--ink); }

/* ---------- Login ---------- */
body.login-body { background: var(--blue); overflow-x: hidden; padding: 0; }
body.login-body main.wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; position: relative; padding-top: 30px; padding-bottom: 30px; }
.blob { position: fixed; border-radius: 50%; z-index: 0; border: 3px solid var(--ink); }
.blob.p { width: 300px; height: 300px; background: var(--pink); top: -90px; right: 6%; }
.blob.o { width: 170px; height: 170px; background: var(--orange); bottom: 40px; right: 24%; }
.blob.c { width: 130px; height: 130px; background: var(--cyan); top: 40%; left: -40px; }
.blob.l { width: 90px; height: 90px; background: var(--lime); bottom: -20px; left: 18%; }
.login-card { position: relative; z-index: 2; width: 100%; max-width: 440px; background: var(--cream); border: 3px solid var(--ink); border-radius: 24px;
              box-shadow: 10px 10px 0 var(--ink); padding: 32px 30px 28px; }
.login-card .logo { height: 34px; width: auto; display: block; }
.login-card .sticker { display: inline-flex; align-items: center; gap: 8px; background: var(--lime); font-weight: 700; padding: 5px 13px; border-radius: 999px;
                       border: 2px solid var(--ink); transform: rotate(-2deg); font-size: 12.5px; margin: 22px 0 10px; }
.login-card h1 { font-size: 34px; margin-bottom: 6px; }
.login-card .sub { color: var(--muted-2); margin-bottom: 22px; }
.login-card .btn { width: 100%; margin-top: 6px; font-family: var(--display); font-weight: 800; font-size: 17px; padding: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .navlinks a { padding: 7px 9px; }
  .mgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .loadgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .c3, .c4, .c5 { grid-column: span 6; } .c7, .c8 { grid-column: span 12; }
  .prof-top { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .wrap { padding: 0 16px; }
  .navlinks { display: none; }
  .menu-btn { display: inline-flex; }
  .mobile-links { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-bottom: 3px solid var(--ink); }
  .mobile-links a { text-decoration: none; font-weight: 700; padding: 9px 12px; border-radius: 10px; border: 2px solid var(--ink); background: var(--white); display: flex; justify-content: space-between; }
  .mobile-links a.active { background: var(--lime); }
  .grid2, .grid3, .kpi-row, .inbox, .apcards { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid > * { grid-column: span 12; }
  .bands { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .phead { grid-template-columns: 1fr; }
  .phead .actions { justify-content: flex-start; }
  .ap-panel { position: static; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .update .ub { grid-template-columns: minmax(0, 1fr); }
  .team-row { grid-template-columns: 1fr 90px 30px; }
  .team-row .tnote { grid-column: 1 / -1; }
  .effort-row { grid-template-columns: 1fr 110px; }
  .effort-row .tnote { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .navbar { padding: 0 8px 0 12px; gap: 10px; }
  .navbar .logo .tag { display: none; }
  .mgrid, .loadgrid, .grid4 { grid-template-columns: minmax(0, 1fr); }
  .dl { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .dl dd { margin-bottom: 8px; }
  .filters select, .filters input { flex: 1 1 140px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .modal { padding: 22px 18px 18px; }
  .funnel .fs { grid-template-columns: 110px 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Invoicing ---------- */
.ms-editor { border: 2px dashed var(--ink); border-radius: 14px; background: var(--paper); padding: 12px; }
.ms-head, .ms-row { display: grid; grid-template-columns: minmax(140px, 1.5fr) minmax(150px, 1.3fr) 92px 130px 160px 30px; gap: 8px; align-items: center; }
.ms-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0 2px 6px; }
.ms-rows { display: flex; flex-direction: column; gap: 8px; }
.ms-row input, .ms-row select { min-height: 38px; padding: 6px 9px; font-size: 14px; border-width: 2px; border-radius: 9px; }
.ms-row select { padding-right: 30px; background-position: right 10px center; }
.ms-row.locked { opacity: .7; }
.ms-pct { display: flex; align-items: center; gap: 4px; font-weight: 700; }
.ms-total { margin: 10px 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ms-empty { padding: 6px 2px; }
.stat.bad { background: #ffe3e4; border-color: var(--red); }
.tbl tr.missed td { background: #fff1f1; }
@media (max-width: 900px) {
  .ms-head { display: none; }
  .ms-row { grid-template-columns: 1fr 1fr; padding: 10px; border: 2px solid var(--ink); border-radius: 12px; background: var(--white); }
  .ms-row > :first-child { grid-column: 1 / -1; }
}
.phead > * { min-width: 0; }
.chip.flag { white-space: normal; text-align: left; }

/* ---------- Calendar ---------- */
.cal-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-title { font-size: 22px; margin-left: 6px; }
.cal-legend { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-toggle { display: inline-flex; align-items: center; gap: 7px; border: 2px solid var(--ink); border-radius: 999px; background: var(--white);
              padding: 4px 11px; font-weight: 700; font-size: 12.5px; cursor: pointer; opacity: .45; }
.cal-toggle.on { opacity: 1; }
.cal-toggle .sw { width: 12px; height: 12px; border-radius: 4px; border: 2px solid var(--ink); background: var(--g); }
.cal-toggle .n { font-size: 11px; background: var(--cream); border: 1.5px solid var(--ink); border-radius: 999px; padding: 0 6px; }
.g-milestones { --g: var(--sun); } .g-approvals { --g: #ff9bd6; } .g-work { --g: #e9e5ff; }
.g-invoicing { --g: #ffb48f; } .g-updates { --g: #d8f6fa; } .g-stages { --g: #e7f7b3; }
.cal-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 2px solid var(--ink); border-radius: 14px; overflow: hidden; min-width: 760px; background: var(--ink); gap: 2px; }
.cal-dow { background: var(--ink); color: var(--cream); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; padding: 6px 8px; }
.cal-cell { background: var(--white); min-height: 118px; padding: 6px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; position: relative; min-width: 0; }
.cal-cell:hover { background: var(--paper); }
.cal-cell:focus-visible { outline: 3px solid var(--blue); outline-offset: -3px; }
.cal-cell.wkend { background: #fbf7ee; }
.cal-cell.out { background: #f3eee3; }
.cal-cell.out .cal-dn { color: var(--muted); }
.cal-cell.today { box-shadow: inset 0 0 0 3px var(--blue); }
.cal-dn { font-weight: 800; font-family: var(--display); font-size: 14px; display: flex; align-items: center; gap: 6px; }
.cal-today { font-size: 10px; font-family: var(--body); text-transform: uppercase; letter-spacing: .06em; background: var(--blue); color: var(--cream); border-radius: 999px; padding: 1px 7px; }
.cal-evs { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-ev { display: flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; line-height: 1.25; text-decoration: none; color: var(--ink);
          background: var(--g); border: 1.5px solid var(--ink); border-radius: 7px; padding: 2px 5px; min-width: 0; }
.cal-ev .tx { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cal-ev .i { flex: none; font-size: 11px; }
.cal-ev:hover { filter: brightness(.95); }
.cal-ev.t-work { background: var(--white); border-left: 6px solid var(--tc, #888); }
.cal-ev.cont { opacity: .7; border-style: dashed; }
.cal-ev.tone-bad, .cal-item.tone-bad { background: #ffd9db; border-color: var(--red); }
.cal-ev.tone-late, .cal-item.tone-late { background: #ffe9c7; }
.cal-ev.tone-good { background: #e6f7b0; }
.cal-ev.t-golive_due { background: var(--white); border-style: dashed; }
.cal-ev.t-golive_due.tone-late { background: #ffe9c7; border-color: var(--red); }
.cal-more { background: none; border: none; text-align: left; font-size: 11.5px; font-weight: 700; color: var(--blue); cursor: pointer; padding: 0 2px; }
.cal-count { display: none; }
.cal-list { display: flex; flex-direction: column; gap: 8px; }
.cal-item { display: flex; gap: 10px; align-items: flex-start; text-decoration: none; color: var(--ink); background: var(--white); border: 2px solid var(--ink);
            border-left: 8px solid var(--g); border-radius: 12px; padding: 8px 12px; }
.cal-item:hover { background: var(--paper); }
.cal-item.t-work { border-left-color: var(--tc, #888); }
.cal-item .ci-icon { width: 22px; flex: none; text-align: center; font-size: 15px; }
.cal-item .ci-main { min-width: 0; }
.cal-item .ci-t { font-weight: 700; font-size: 14px; }
.cal-item .ci-p { font-weight: 600; color: var(--muted-2); }
.cal-item .ci-d { font-size: 13px; color: var(--muted-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.cal-item .ci-m { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.cal-month { font-family: var(--display); font-weight: 800; font-size: 18px; margin: 18px 0 6px; padding-bottom: 4px; border-bottom: 3px solid var(--ink); }
.cal-month:first-child { margin-top: 0; }
.cal-day { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.cal-day:last-child { border-bottom: none; }
.cal-day.future .cal-dh { color: var(--blue); }
.cal-dh { font-weight: 800; font-size: 13.5px; display: flex; gap: 6px; align-items: center; align-content: flex-start; align-self: start; flex-wrap: wrap; }
@media (max-width: 700px) {
  .cal-grid { min-width: 0; }
  .cal-cell { min-height: 56px; padding: 4px; }
  .cal-evs { flex-direction: row; flex-wrap: wrap; gap: 3px; }
  .cal-ev { width: 10px; height: 10px; padding: 0; border-radius: 50%; border-width: 1.5px; }
  .cal-ev .tx, .cal-ev .i, .cal-more, .cal-today { display: none; }
  .cal-ev.t-work { border-left-width: 1.5px; background: var(--tc, #888); }
  .cal-dow { padding: 5px 2px; text-align: center; font-size: 10px; letter-spacing: 0; }
  .cal-day { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}

/* ---------- SOW PDFs ---------- */
.pdf-pick { display: flex; align-items: center; gap: 12px; border: 2px dashed var(--ink); border-radius: 14px; background: var(--paper); padding: 12px 14px; }
.pdf-pick.over { background: #e6f7b0; border-style: solid; }
.pdf-icon { flex: none; width: 42px; height: 50px; border: 2px solid var(--ink); border-radius: 6px 14px 6px 6px; background: var(--red); color: var(--cream);
            font-weight: 800; font-size: 12px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; }
.pdf-info { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pdf-link { display: inline-flex; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.pdf-tag { font-size: 9.5px; font-weight: 800; background: var(--red); color: var(--cream); border: 1.5px solid var(--ink); border-radius: 4px; padding: 0 4px; flex: none; }
.chip.new-pdf { background: var(--lime); font-size: 11px; margin-left: 6px; }
.sow-hist { margin-top: 16px; border-top: 2px solid var(--ink); padding-top: 12px; }
.sow-hist .sv { padding: 10px 12px; border: 2px solid var(--ink); border-radius: 12px; background: var(--paper); margin-top: 8px; }
.sow-hist .sv.official { background: #f1fbd2; }
.sv-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sv-ver { font-family: var(--display); font-weight: 800; font-size: 16px; }
.sv-note { font-size: 13px; margin-top: 4px; overflow-wrap: anywhere; }
.sv-req { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.sv-comment { flex-basis: 100%; color: var(--muted-2); }
@media (max-width: 560px) { .pdf-pick { flex-wrap: wrap; } }

/* ---------- Work log ---------- */
.picker-team .tl .swatch { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); display: inline-block; }
.people-sum { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 12px 0 16px; padding-bottom: 12px; border-bottom: 1px dashed var(--line); }
.people-sum .ps { display: flex; align-items: center; gap: 6px; }
.work-row { display: grid; grid-template-columns: minmax(150px, 1.1fr) 150px 90px minmax(0, 1.4fr) auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.work-row:last-child { border-bottom: none; }
.work-row .wr-note { overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .work-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; }
  .work-row .wr-when, .work-row .wr-note { grid-column: 1; }
  .work-row .wr-h { grid-column: 2; grid-row: 1; }
  .work-row .wr-act { grid-column: 2; grid-row: 2; }
}
