:root {
  --bg: #F4F6F9; --surface: #FFFFFF; --soft: #F7F9FB; --grp: #F1F4F8;
  --ink: #18273A; --muted: #55697F; --faint: #8796A8;
  --line: #E1E7EE; --line-2: #EDF1F5;
  --side: #1F3A5F; --side-2: #18304F; --side-ink: #DCE6F2;
  --blue: #1668D6; --blue-d: #0E4FA6; --blue-l: #E6EFFB;
  --field: #EEF5FD; --field-bd: #B9D6F5;
  --red: #B42318; --red-bg: #FDECEA; --red-bd: #F4C7C1;
  --green: #12805A; --green-bg: #E3F4EC;
  --amber: #8A5A00; --amber-bg: #FFF6DB; --amber-bd: #F1D58A;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "IBM Plex Sans Thai", "Noto Sans Thai", "Leelawadee UI", sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-d); text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
button:disabled { opacity: .45; cursor: not-allowed; }
h1, h2 { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.r { text-align: right; } .c { text-align: center; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.small { font-size: 12px; } .strong { font-weight: 600; }
.red { color: var(--red); } .green { color: var(--green); }
.mono { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.row-gap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.scroll-x { overflow-x: auto; }

/* ── shell ── */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--side); color: var(--side-ink); z-index: 30; }
.brand { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px 12px; background: var(--surface); color: var(--ink); }
.brand-logo { display: block; width: 172px; height: auto; }
.brand-sub { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding-left: 2px; }
.mode-switch { padding: 14px 12px 4px; }
.mode-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: rgba(220, 230, 242, .7); margin: 0 4px 6px; }
.mode-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; border-radius: 9px; background: var(--side-2); }
.mode-seg button { padding: 7px 8px; border: 0; border-radius: 7px; background: none; color: var(--side-ink); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.mode-seg button:hover { color: #FFFFFF; background: rgba(255, 255, 255, .06); }
.mode-seg button.on { background: #1BA0E2; color: #FFFFFF; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.mode-long { margin: 6px 4px 0; font-size: 12px; color: rgba(220, 230, 242, .75); line-height: 1.4; }
.mode-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px; background: var(--side); color: #FFFFFF; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.mode-tag.lbs { background: #0F7FB8; }
.side-nav { display: flex; flex-direction: column; gap: 4px; padding: 14px 10px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--side-ink); font-size: 14px; }
.side-nav a:hover { background: rgba(255, 255, 255, .08); color: #FFFFFF; text-decoration: none; }
.side-nav a.on { background: var(--surface); color: var(--side); font-weight: 600; }
.ico { width: 18px; height: 18px; flex: none; }
.side-foot { margin-top: auto; padding: 14px 18px 18px; border-top: 1px solid rgba(255, 255, 255, .12); font-size: 12.5px; }
.save-state { display: flex; align-items: center; gap: 8px; font-weight: 600; color: #FFFFFF; }
.dot { width: 8px; height: 8px; border-radius: 4px; background: #3DD68C; }
.dot.bad { background: #FF8A7A; }
.side-muted { margin-top: 3px; color: rgba(220, 230, 242, .7); }
.side-link { margin-top: 8px; padding: 0; border: 0; background: none; color: #FFFFFF; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 12.5px; }
.backdrop { display: none; }
.main { min-width: 0; }
.topbar { display: none; }
.page { max-width: 1440px; padding: 22px 28px 72px; }

/* ── controls ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid #CBD5E1; background: var(--surface); font-size: 13.5px; font-weight: 500; color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; background: none; }
.btn.danger:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.btn-primary { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--blue); background: var(--blue); color: #FFFFFF; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.btn-primary:hover { background: var(--blue-d); color: #FFFFFF; text-decoration: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 8px; border: 0; background: none; color: inherit; cursor: pointer; }
.link { border: 0; background: none; padding: 0; color: var(--blue); font-size: inherit; cursor: pointer; }
.link:hover { text-decoration: underline; }
.input { width: 100%; padding: 8px 10px; border: 1px solid #CBD5E1; border-radius: 8px; background: var(--surface); font-size: 14px; }
.input.area { min-height: 160px; resize: vertical; line-height: 1.65; font-size: 13.5px; }
.field { width: 100%; padding: 6px 8px; border: 1px solid var(--field-bd); background: var(--field); border-radius: 6px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13.5px; }
.field.stale { border-color: var(--amber-bd); background: var(--amber-bg); }
.select { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 13.5px; }
.select.bad { border-color: var(--red-bd); background: var(--red-bg); }
.tbl .select { padding: 3px 4px; line-height: 1.35; border-color: transparent; background-color: transparent; font-weight: 500; cursor: pointer; }
.tbl .select:hover, .tbl .select:focus { border-color: var(--line); background-color: var(--surface); }
.tbl .select.bad { border-color: var(--red-bd); background-color: var(--red-bg); }
.tbl .field { padding: 4px 8px; }
.tbl.boq td { padding-top: 7px; padding-bottom: 7px; }
.tbl td.c { padding-left: 4px; padding-right: 4px; }
.tbl.boq .meta { padding-left: 5px; }
.badge { display: inline-block; white-space: nowrap; padding: 2px 7px; border-radius: 5px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.badge.ok { background: var(--green-bg); color: var(--green); }
.badge.bad { background: var(--red-bg); color: var(--red); }
.badge.none { background: var(--grp); color: var(--faint); }
.code-tag { flex: none; display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 5px; background: var(--blue-l); color: var(--blue-d); font-family: var(--mono); font-size: 11.5px; font-weight: 600; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 11px; background: var(--grp); color: var(--muted); font-size: 12px; }
.file-in { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ── notices / toast / states ── */
.notice { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; padding: 11px 16px; margin-bottom: 14px; border-radius: var(--radius); font-size: 13.5px; line-height: 1.55; border: 1px solid var(--amber-bd); background: var(--amber-bg); color: var(--amber); }
.notice.err { border-color: var(--red-bd); background: var(--red-bg); color: var(--red); }
.notice .btn { color: var(--ink); }
.state-box { padding: 48px 20px; text-align: center; color: var(--faint); line-height: 1.7; }
.state-box.err { color: var(--red); background: var(--surface); border: 1px solid var(--red-bd); border-radius: 12px; }
.state-box code { font-family: var(--mono); font-size: 12px; background: var(--red-bg); padding: 1px 6px; border-radius: 4px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50; display: flex; gap: 14px; align-items: center; max-width: calc(100% - 32px); padding: 10px 14px 10px 16px; border-radius: 10px; background: var(--side); color: #FFFFFF; font-size: 13px; box-shadow: 0 8px 28px rgba(19, 34, 52, .25); }
.toast button { border: 1px solid rgba(255, 255, 255, .35); background: none; color: #FFFFFF; border-radius: 7px; padding: 5px 10px; cursor: pointer; font-size: 12.5px; font-weight: 600; }
.toast button:hover { background: rgba(255, 255, 255, .12); }

/* ── project header + tabs ── */
.proj-head { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: flex-start; justify-content: space-between; margin: 4px 0 18px; }
.proj-title { min-width: 0; }
.crumb { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumb strong { color: var(--ink); font-weight: 600; }
.proj-title h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; }
.proj-title .sub { margin-top: 3px; color: var(--muted); font-size: 13.5px; }
.proj-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; width: 290px; padding: 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 12px 32px rgba(19, 34, 52, .16); }
.menu button { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 9px 10px; border: 0; border-radius: 7px; background: none; text-align: left; cursor: pointer; }
.menu button:hover, .menu button:focus-visible { background: var(--soft); outline: none; }
.menu strong { font-size: 13.5px; }
.menu span { font-size: 12px; color: var(--muted); }
.menu span.red { color: var(--red); }
.utabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 18px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.utabs a { flex: none; padding: 10px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 14px; font-weight: 500; }
.utabs a:hover { color: var(--ink); text-decoration: none; }
.utabs a.on { color: var(--side); border-bottom-color: var(--blue); font-weight: 650; }

/* ── cards & workspace ── */
.work { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.work-main { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.work-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card + .card { margin-top: 16px; }
.work-side .card + .card, .work-main .card + .card { margin-top: 0; }
.card.pad { padding: 20px 22px; }
.card.pad h2 { font-size: 16px; margin-bottom: 6px; }
.card.pad p { margin: 0 0 16px; line-height: 1.65; max-width: 72ch; }
.card-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 15px; font-weight: 650; }
.card-note { font-size: 12px; color: var(--faint); }
.card-foot { padding: 10px 16px; font-size: 12px; border-top: 1px solid var(--line-2); line-height: 1.5; }
.page-head { margin: 4px 0 18px; }
.page-head h1 { font-size: 22px; font-weight: 700; }
.page-head p { margin: 5px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; max-width: 90ch; }

/* ── tables ── */
.tbl { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13.5px; }
.tbl.boq { min-width: 720px; }
.tbl.actual { min-width: 1120px; }
.tbl.mat { min-width: 920px; }
.tbl th { padding: 10px 12px; background: var(--soft); color: var(--muted); font-size: 12.5px; font-weight: 600; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th.r { text-align: right; } .tbl th.c { text-align: center; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; overflow-wrap: anywhere; }
.tbl tbody tr:hover td { background: #FAFBFD; }
.tbl tr.grp td { background: var(--grp); font-weight: 650; border-bottom-color: var(--line); }
.tbl tr.grp.empty td { color: var(--muted); font-weight: 500; }
.tbl tr.bad-row td { background: #FFF8F7; }
.tbl tfoot td { padding: 11px 12px; background: var(--soft); font-weight: 700; border-top: 1px solid var(--line); border-bottom: 0; }
.grp-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.grp-title { min-width: 0; }
.add { margin-left: auto; flex: none; padding: 3px 10px; border-radius: 6px; border: 1px dashed var(--field-bd); background: var(--surface); color: var(--blue); font-size: 12px; font-weight: 600; cursor: pointer; }
.add:hover:not(:disabled) { background: var(--blue-l); }
.del { width: 28px; height: 28px; border-radius: 6px; border: 1px solid transparent; background: none; color: var(--faint); cursor: pointer; font-size: 16px; line-height: 1; }
.del:hover { border-color: var(--red-bd); color: var(--red); background: var(--red-bg); }
.meta { margin-top: 3px; font-size: 11.5px; color: var(--faint); font-weight: 400; line-height: 1.4; }
.meta .mono { font-size: 11px; }
.meta .warn { color: var(--amber); font-weight: 600; }
.meta .bad { color: var(--red); font-weight: 600; }
.status { font-size: 12.5px; font-weight: 600; }
.meter { height: 5px; border-radius: 3px; background: var(--line-2); margin-top: 5px; overflow: hidden; }
.meter > div { height: 100%; border-radius: 3px; background: var(--blue); }
.meter > div.over { background: var(--red); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.search { flex: 1 1 240px; min-width: 0; width: auto; background: var(--soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.chip { padding: 5px 11px; border-radius: 14px; font-size: 12.5px; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.chip.on { background: var(--side); border-color: var(--side); color: #FFFFFF; }
.chip.warn:not(.on) { border-color: var(--amber-bd); color: var(--amber); background: var(--amber-bg); }

/* ── P&L + params ── */
.pnl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.pnl td { padding: 7px 8px; border-bottom: 1px solid var(--line-2); font-size: 13px; white-space: nowrap; }
.pnl td:first-child { padding-left: 16px; }
.pnl td:last-child { padding-right: 16px; }
.pnl .share { width: 58px; color: var(--muted); font-size: 12px; }
.pnl tr.sub td:first-child { padding-left: 24px; color: var(--muted); font-size: 12.5px; }
.pnl tr.strong td { font-weight: 700; background: var(--soft); }
.pnl tr.gm td { font-size: 17px; font-weight: 700; padding-top: 10px; padding-bottom: 10px; }
.pnl tr.gm td.share { font-size: 12px; }
.pnl tr.gm.red td { color: var(--red); background: #FFF7F6; }
.pnl tr.gm.green td { color: var(--green); background: #F5FBF8; }
.pnl tr:last-child td { border-bottom: 0; }
.pnl-note { padding: 10px 16px; font-size: 12.5px; line-height: 1.55; border-top: 1px solid var(--line-2); }
.pnl-note.ok { background: var(--green-bg); color: var(--green); }
.pnl-note.bad { background: var(--red-bg); color: var(--red); }
.params { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px 16px; }
.params label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
.params .wide { grid-column: 1 / -1; }
.params .field { padding: 8px 10px; font-size: 14px; }
.params small { font-size: 11.5px; }

/* ── customer form ── */
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; padding: 18px 20px 22px; }
.field-row { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field-row.wide { grid-column: 1 / -1; }
.with-btn { display: flex; gap: 8px; align-items: center; }
.with-btn .input { flex: 1; }

/* ── LBS ── */
.tbl.lbs { min-width: 1160px; }
.tbl.indirect { min-width: 640px; }
.tbl.indirect.with-actual { min-width: 760px; }
.tbl tr.subtotal td { background: var(--soft); font-weight: 650; border-bottom-color: var(--line); }
.tbl.actual tr.grp td { padding-top: 8px; padding-bottom: 8px; }
.work-main > .card + .card, .page > .card + .card { margin-top: 16px; }
.tbl .code-select { display: block; font-size: 12.5px; font-family: var(--mono); font-weight: 500; }
.tbl .code-select + .code-select { margin-top: 2px; }
.item-name { font-weight: 500; line-height: 1.4; }
.heading-input { flex: 1; min-width: 0; padding: 4px 8px; font-weight: 650; background: transparent; border-color: transparent; }
.heading-input:hover, .heading-input:focus { background: var(--surface); border-color: var(--line); }
.input.sm { padding: 5px 8px; font-size: 13.5px; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; align-items: center; }
.mini { width: 22px; height: 26px; padding: 0; border: 1px solid transparent; border-radius: 5px; background: none; color: var(--faint); cursor: pointer; font-size: 12px; }
.mini:hover { border-color: var(--line); color: var(--ink); background: var(--surface); }
.field.pending { border-color: var(--amber-bd); background: var(--amber-bg); }
.field::placeholder { color: var(--faint); }
.pnl-note.warn { background: var(--amber-bg); color: var(--amber); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { display: flex; flex-direction: column; gap: 3px; padding: 12px 16px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); font-size: 12px; color: var(--muted); }
.stat strong { font-size: 16px; color: var(--ink); }
.stat.total { background: var(--soft); }
.stat.total strong { color: var(--side); }
/* ── template page ── */
.sheet-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 18px; }
.sheet-list > div { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line-2); font-size: 13.5px; line-height: 1.55; }
.sheet-list > div:last-child { border-bottom: 0; }
.sheet-list .mono { font-size: 12.5px; color: var(--blue-d); }

/* ── responsive ── */
@media (max-width: 1180px) {
  .work { grid-template-columns: minmax(0, 1fr); }
  .work-side { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; transform: translateX(-100%); transition: transform .2s ease, visibility .2s; visibility: hidden; }
  .nav-open .side { transform: none; visibility: visible; box-shadow: 0 0 40px rgba(0, 0, 0, .25); }
  .nav-open .backdrop { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(15, 25, 40, .45); }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; height: 56px; padding: 0 12px 0 6px; background: var(--side); color: #FFFFFF; }
  .topbar-logo { display: inline-flex; align-items: center; height: 34px; padding: 0 10px; border-radius: 7px; background: #FFFFFF; }
  .topbar-img { display: block; width: 112px; height: auto; }
  .mode-chip { margin-left: auto; padding: 4px 10px; border-radius: 12px; background: rgba(255, 255, 255, .14); font-size: 12.5px; font-weight: 700; }
  .page { padding: 16px 16px 64px; }
}
@media (max-width: 640px) {
  .proj-title h1, .page-head h1 { font-size: 19px; }
  .proj-actions { width: 100%; gap: 6px; }
  .proj-actions > * { flex: 1 1 auto; }
  .proj-actions .btn { justify-content: center; padding: 8px 10px; font-size: 13px; }
  .menu-wrap .btn { width: 100%; }
  .menu { left: 0; right: auto; width: min(290px, calc(100vw - 32px)); }
  .form { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .params { grid-template-columns: 1fr 1fr; }
  .card.pad { padding: 18px 16px; }
}

/* ── projects / dashboard ── */
.status-badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st-quoting { background: var(--blue-l); color: var(--blue-d); }
.st-won { background: var(--green-bg); color: var(--green); }
.st-active { background: var(--amber-bg); color: var(--amber); }
.st-closed { background: #E6EAF0; color: var(--side); }
.st-lost { background: var(--grp); color: var(--faint); }
.status-select { height: 24px; padding: 0 6px; border-radius: 12px; border: 1px solid transparent; font-size: 12px; font-weight: 600; cursor: pointer; }
.status-select:hover { border-color: currentColor; }
.bar { height: 8px; border-radius: 4px; background: var(--line-2); overflow: hidden; min-width: 60px; }
.st-bar { height: 100%; border-radius: 4px; }
.st-bar.st-quoting { background: var(--blue); } .st-bar.st-won { background: var(--green); } .st-bar.st-active { background: #D9A21B; }
.st-bar.st-closed { background: var(--side); } .st-bar.st-lost { background: #B8C2CE; }
.page-head.with-actions { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 9px; background: #E3E9F0; }
.seg button { padding: 6px 12px; border: 0; border-radius: 7px; background: none; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--side); box-shadow: 0 1px 3px rgba(19, 34, 52, .15); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; align-items: start; }
.dash-grid .card + .card { margin-top: 0; }
.tbl.pipeline { min-width: 760px; }
.tbl td.num { overflow-wrap: normal; white-space: nowrap; }
.plist { list-style: none; margin: 0; padding: 0; }
.plist li + li { border-top: 1px solid var(--line-2); }
.plist a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 120px 64px 150px; gap: 12px; align-items: center; padding: 10px 16px; color: var(--ink); }
.plist a:hover { background: var(--soft); text-decoration: none; }
.pl-name { display: flex; flex-direction: column; min-width: 0; }
.pl-name strong, .pl-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-name small { color: var(--faint); font-size: 12px; }
.pl-num { text-align: right; } .pl-gm { text-align: right; font-weight: 600; } .pl-when { font-size: 12px; text-align: right; }
.tbl.projects { min-width: 1000px; }
.tbl tr.clickable { cursor: pointer; }
.empty { text-align: center; }
.empty p { margin-left: auto; margin-right: auto; }
.profit-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpis .card, .profit-cards .card { padding: 14px 16px; }
.kpis .card + .card, .profit-cards .card + .card { margin-top: 0; }
.card-label { font-size: 12px; color: var(--faint); margin-bottom: 6px; }
.card-value { font-size: 22px; font-weight: 650; letter-spacing: -.01em; font-variant-numeric: tabular-nums; color: var(--ink); }
.card-value.sm { font-size: 19px; }
.card-sub { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.card-value.red { color: var(--red); } .card-value.green { color: var(--green); }
@media (max-width: 640px) {
  .kpis, .profit-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpis .card, .profit-cards .card { padding: 12px; }
  .card-value, .card-value.sm { font-size: 16px; }
  .card-sub { font-size: 11px; }
}
.save-note { align-self: center; font-size: 12.5px; color: var(--faint); margin-right: 4px; }
.nav-sub { margin-left: auto; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; opacity: .75; }
.dot.busy { background: #F5C451; }
.notice.info { border-color: var(--line); background: var(--surface); color: var(--muted); }
.modal-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; background: rgba(15, 25, 40, .45); overflow-y: auto; }
.modal { width: min(640px, 100%); background: var(--surface); border-radius: 12px; box-shadow: 0 20px 50px rgba(15, 25, 40, .3); overflow: hidden; }
.modal .seg { width: 100%; }
.modal .seg button { flex: 1 1 200px; text-align: left; }
.modal-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--soft); }
@media (max-width: 1180px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .plist a { grid-template-columns: minmax(0, 1fr) auto; }
  .plist .mode-tag, .plist .pl-when, .plist .pl-gm { display: none; }
  .modal-wrap { padding-top: 16px; }
}
