/* Palette from the OEG logo: navy wordmark, OEG blue accent, on white. Green, amber and red mark status only. */
:root {
  --brand: #0d3b72;
  --brand-2: #1e6fc0;
  --bg-top: #f3f5f8;
  --bg-bottom: #f3f5f8;
  --glass: #ffffff;
  --glass-strong: #ffffff;
  --glass-line: #dde3ea;
  --ink: #14202e;
  --muted: #56667b;
  --line: #dde3ea;
  --night: #0d3b72;
  --night-2: #164a87;
  --night-3: #1d5799;
  --night-ink: #ffffff;
  --night-dim: #b4c6dc;
  --slate: #175a9e;
  --slate-deep: #134c87;
  --slate-tile: rgba(255, 255, 255, 0.1);
  --lime: #1e6fc0;
  --lime-deep: #175a9e;
  --lime-ink: #ffffff;
  --green: #276b44;
  --green-bg: #e6f2ea;
  --gold: #8a6512;
  --gold-bg: #f6efdc;
  --red: #a23a3a;
  --red-bg: #f9e8e6;
  --blue: #1e5fa8;
  --blue-bg: #e6eef8;
  --shadow: 0 1px 2px rgba(13, 37, 70, 0.05), 0 6px 18px rgba(13, 37, 70, 0.05);
  --radius: 14px;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #eef1f5;
  --hover: #fafcfe;
  --row-line: #edf1f6;
  --line-strong: #c9d3e0;
  --group-bg: #eaf0f7;
  --sub-bg: #fafbfd;
  --picked: #eef4fb;
  --track: rgba(13, 59, 114, 0.08);
  --bill-bg: #e4eef9;
  --bill-ink: #134f8f;
  --ring: #ffffff;
  --glow-1: transparent;
  --glow-2: transparent;
  --bg-end: #f3f5f8;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%23121417' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  --bottom-nav: 0px;
  --header-bg: rgba(243, 245, 248, 0.97);
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --brand: #b3cdec;
  --brand-2: #3a8ad6;
  --bg-top: #0e141c;
  --bg-bottom: #0e141c;
  --bg-end: #0e141c;
  --glow-1: transparent;
  --glow-2: transparent;
  --glass: #151c26;
  --glass-strong: #19212c;
  --glass-line: #263142;
  --ink: #e6ebf1;
  --muted: #8d99aa;
  --line: #263142;
  --line-strong: #364357;
  --surface: #151c26;
  --surface-2: #1a222e;
  --surface-3: #212b38;
  --hover: #1a222d;
  --row-line: #212a36;
  --group-bg: #15233a;
  --sub-bg: #121820;
  --picked: #13243a;
  --track: rgba(255, 255, 255, 0.08);
  --night: #0b2140;
  --night-2: #12305a;
  --night-3: #1a3d6e;
  --night-dim: #9fb5d0;
  --slate: #245d99;
  --slate-deep: #1e4f84;
  --slate-tile: rgba(255, 255, 255, 0.08);
  --lime: #2b70b8;
  --lime-deep: #2563a5;
  --lime-ink: #ffffff;
  --green: #6fcf97;
  --green-bg: rgba(111, 207, 151, 0.14);
  --gold: #e7c068;
  --gold-bg: rgba(231, 192, 104, 0.14);
  --red: #f08a80;
  --red-bg: rgba(240, 138, 128, 0.14);
  --blue: #8db4e2;
  --blue-bg: rgba(141, 180, 226, 0.14);
  --bill-bg: rgba(58, 138, 214, 0.16);
  --bill-ink: #8cbcf0;
  --ring: #0e141c;
  --header-bg: rgba(14, 20, 28, 0.97);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%23e8ecf1' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 120px; overflow-x: hidden; }
/* clip, unlike hidden on both, stops sideways panning on iOS without breaking the sticky header. */
@supports (overflow: clip) { html, body { overflow-x: clip; } }
body {
  font-family: var(--sans);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(1100px 520px at 12% -10%, var(--glow-1) 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, var(--glow-2) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom) 420px, var(--bg-end));
  background-color: var(--bg-end);
  background-attachment: fixed;
  font-feature-settings: "tnum" 1;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.025em; }
h1 { font-size: 44px; line-height: 1.05; margin: 0; }
h2 { font-size: 18px; margin: 0 0 12px; font-weight: 600; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.skip { position: absolute; left: 12px; top: -40px; background: var(--surface); padding: 8px 12px; z-index: 50; border-radius: 10px; }
.skip:focus { top: 12px; }
.to-top {
  position: fixed; z-index: 40; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom));
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%;
  background: var(--lime); color: #fff; cursor: pointer;
  box-shadow: 0 8px 20px rgba(8, 12, 18, 0.22);
}
.to-top[hidden] { display: none; }
.to-top svg { width: 18px; height: 18px; }
.to-top:hover { background: var(--lime-deep); }
.to-top:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
@media (max-width: 760px) {
  .to-top { right: 14px; bottom: calc(var(--bottom-nav) + 14px); }
}
body:has(.qty-bar) .to-top,
body:has(.cart-bar:not([hidden])) .to-top,
body:has(.live-chip) .to-top { bottom: calc(var(--bottom-nav) + 78px); }

/* ---------- Frame and top navigation ---------- */
.frame { max-width: 1440px; margin: 0 auto; padding: 18px 28px 48px; }
.topnav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 6px 0 10px;
  background: var(--header-bg);
}
.topnav-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  min-width: 0;
}
.menu-row {
  position: relative;
  z-index: 5;
  flex-wrap: nowrap;
  align-items: center;
  width: 100%;
  gap: 12px;
}
.menu-row > .phase-nav,
.menu-row > .phase-bar { flex: 1 1 auto; min-width: 0; }
.phase-bar .phase-nav { width: 100%; }
/* Keep search under phase dropdowns that open into this row. */
.tool-row { position: relative; z-index: 1; width: 100%; gap: 8px; }
.tool-row .top-tools {
  flex: 1 1 auto;
  width: 100%;
  justify-content: flex-start;
  align-items: center;
  min-width: 0;
  flex-wrap: nowrap;
  gap: 10px;
}
.tool-row .top-tools > .gsearch { flex: 1 1 240px; min-width: 180px; max-width: 380px; }
.tool-row .gsearch input,
.tool-row .gsearch input:focus { width: 100%; height: 40px; }
.tool-row .live-dot { flex: none; height: 40px; }
.tool-row .bell { margin-left: 0; flex: none; }
.project-here {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 2 1 320px;
  max-width: none;
  min-width: 0;
  padding: 0;
  background: none;
  border: 0;
}
.project-here .project-switch { flex: 1 1 auto; min-width: 0; max-width: none; }
.project-here .project-switch select {
  width: 100%;
  max-width: none;
  height: 40px;
  field-sizing: fixed;
  padding: 0 32px 0 14px;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-here-id {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  color: inherit;
  text-decoration: none;
}
.project-here-label {
  flex: none;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.project-here strong { flex: none; font-size: 14px; font-weight: 800; }
.project-here-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 600;
}
.project-here-stage {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 40px;
  margin-left: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.brand {
  display: flex;
  flex: none;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.mark { width: 36px; height: 36px; flex: none; object-fit: contain; display: block; }
:root[data-theme="dark"] .brand .mark { box-sizing: border-box; padding: 3px; border-radius: 50%; background: #f4f7fb; }
.login-logo { height: 46px; width: auto; display: block; margin-bottom: 14px; }

.phase-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  order: 0;
  min-width: 0;
  width: auto;
  max-width: none;
  margin: 0;
}
.phase-nav {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 5px;
  background: var(--night);
  border-radius: 22px;
  box-shadow: 0 10px 30px rgba(20, 24, 32, 0.18);
  overflow: visible;
  min-width: 0;
  width: auto;
  max-width: none;
}
.phase-more { position: relative; flex: none; }
.phase-more[hidden] { display: none; }
.phase-more summary {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--night);
  color: #fff;
  list-style: none;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(20, 24, 32, 0.18);
}
.phase-more summary::-webkit-details-marker { display: none; }
.phase-more summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
.phase-more[open] summary::before { transform: translateY(2px) rotate(225deg); }
.phase-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 100;
  min-width: 168px;
  max-height: min(320px, 60vh);
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 44px rgba(8, 12, 18, 0.22);
}
.phase-menu a {
  display: block;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.phase-menu a:hover, .phase-menu a.on { background: var(--night); color: #fff; }
.phase-nav::-webkit-scrollbar { display: none; }
.phase-item {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
}
.phase-tab {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  color: #d6e2f0;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.phase-tab:hover,
.phase-item:hover > .phase-tab,
.phase-item:focus-within > .phase-tab { background: var(--night-3); color: white; }
.phase-tab.on,
.phase-item.on > .phase-tab { background: #ffffff; color: #0d3b72; font-weight: 700; }
.phase-tab .plus { font-weight: 800; }
.phase-caret {
  display: inline-block;
  width: 0; height: 0; margin-left: 2px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.75;
}
.phase-item.has-menu { z-index: 1; }
.phase-item.has-menu:hover,
.phase-item.has-menu:focus-within { z-index: 6; }
.phase-mega {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 6;
  min-width: 220px;
  max-width: min(520px, 70vw);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(13, 37, 70, 0.18);
}
.phase-mega::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: -12px;
  height: 12px;
}
.phase-mega-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 2px 12px;
}
.phase-mega a {
  display: block;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}
.phase-mega a:hover,
.phase-mega a.on {
  background: #eef4fb;
  color: var(--brand);
}
.phase-item.has-menu:hover > .phase-mega,
.phase-item.has-menu:focus-within > .phase-mega { display: block; }
.phase-more { display: none; }
@media (max-width: 760px) {
  .phase-mega,
  .phase-caret { display: none !important; }
  .phase-item.has-menu:hover > .phase-mega,
  .phase-item.has-menu:focus-within > .phase-mega { display: none !important; }
}

.dock { display: none; }

.top-tools { display: flex; flex: 0 0 auto; justify-content: flex-end; align-items: center; gap: 8px; min-width: 0; }
.project-switch { flex: 0 0 auto; }
.project-switch select {
  appearance: none;
  width: auto;
  min-width: 9rem;
  max-width: min(440px, 46vw);
  field-sizing: content;
  padding: 10px 34px 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--glass-line);
  background: var(--select-arrow) no-repeat right 12px center / 12px, var(--glass-strong);
  font-size: 13px;
  font-weight: 600;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--glass-line);
  background: var(--glass-strong);
  color: var(--ink);
  cursor: pointer;
  padding: 0;
}
.icon-btn:hover { background: var(--surface); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.logout { margin: 0; }
.avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #0d3b72;
  color: white;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 0 0 3px var(--ring);
}
body[data-role="L2"] .avatar { background: #1e6fc0; }
body[data-role="L3"] .avatar { background: #4f6b8c; }
.role-dot {
  position: absolute;
  right: -6px;
  bottom: -4px;
  font-size: 9px;
  font-weight: 800;
  background: var(--lime);
  color: var(--lime-ink);
  border-radius: 999px;
  padding: 1px 5px;
  box-shadow: 0 0 0 2px var(--ring);
}

.icon-btn.bell { position: relative; }
.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--lime);
  color: var(--lime-ink);
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px var(--ring);
}
.profile { position: relative; flex: none; }
.profile > .avatar { border: 0; padding: 0; cursor: pointer; font: inherit; font-size: 13px; font-weight: 800; color: white; }
.profile > .avatar[aria-expanded="true"] { box-shadow: 0 0 0 3px var(--lime); }
/* Popover UA styles use inset:0 + margin:auto (centred tall sheet). Override hard so the
   menu sits under the avatar; flex + height:auto stops browsers stretching huge gaps. */
.profile-menu {
  position: fixed;
  inset: unset;
  top: var(--menu-top, 64px);
  right: var(--menu-right, 16px);
  bottom: auto;
  left: auto;
  z-index: 70;
  box-sizing: border-box;
  margin: 0 !important;
  width: 270px;
  height: auto;
  max-height: min(420px, calc(100dvh - var(--menu-top, 64px) - 12px));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: none;
  flex-direction: column;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: stretch;
  align-content: flex-start;
  gap: 2px;
  padding: 8px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(8, 12, 18, 0.28);
}
.profile-menu:popover-open,
.profile.open .profile-menu {
  display: flex;
  inset: unset;
  top: var(--menu-top, 64px);
  right: var(--menu-right, 16px);
  bottom: auto;
  left: auto;
  margin: 0 !important;
  height: auto;
}
.profile-menu::backdrop { background: transparent; }
.profile-who { display: grid; gap: 3px; padding: 8px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; flex: none; }
.profile-who span { color: var(--muted); font-size: 12px; font-weight: 600; }
.profile-menu a, .profile-menu button {
  display: block;
  flex: none;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
}
.profile-menu a:hover, .profile-menu button:hover { background: var(--surface-2); }
.profile-menu form { flex: none; margin: 0; }
.profile-menu button { color: var(--red); }
a.role-note, a.stage { text-decoration: none; }
a.role-note:hover { color: var(--ink); text-decoration: underline; }
a.linked { text-decoration: none; color: inherit; transition: transform .15s ease; }
a.linked:hover { transform: translateY(-2px); }
.pipeline li a { color: inherit; text-decoration: none; }
.pipeline li a:hover { text-decoration: underline; }

.sub-nav {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 18px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  backdrop-filter: blur(14px);
}
.sub-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.sub-tab {
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.sub-tab:hover { border-color: var(--line-strong); }
.sub-tab.on { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); }
.sub-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 6px 2px 2px;
  border-top: 1px solid var(--line);
}
.role-note { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; text-decoration: none; }
.role-note:hover { color: var(--ink); text-decoration: underline; }
.stage {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 11px;
  white-space: nowrap;
  text-decoration: none;
}
.stage:hover { border-color: var(--line-strong); }

/* ---------- Page ---------- */
.content { min-width: 0; max-width: 100%; }
.page-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin: 4px 0 14px;
}
.kicker, .crumb, .eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.crumb { font-size: 12.5px; }
.crumb a { color: var(--brand-2); font-weight: 700; text-decoration: none; }
.crumb a:hover { color: var(--ink); text-decoration: underline; }
.back-btn { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; margin: 0 0 12px; padding: 7px 15px 7px 11px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--brand); font-size: 13.5px; font-weight: 600; text-decoration: none; box-shadow: 0 1px 2px rgb(13 59 114 / 0.06); }
.back-btn span { font-size: 17px; line-height: 1; }
.back-btn b { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back-btn:hover { background: var(--blue-bg); border-color: var(--brand-2); color: var(--brand); }
.back-btn:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.lede { max-width: 70ch; color: var(--muted); margin: 10px 0 0; font-size: 15px; line-height: 1.5; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rule {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  padding: 12px 16px;
  margin: 12px 0 16px;
  font-size: 14px;
  backdrop-filter: blur(14px);
}
.rule::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime-deep);
  box-shadow: 0 0 0 4px rgba(30, 111, 192, 0.18);
}
.muted { color: var(--muted); }

.panel {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  min-width: 0;
  max-width: 100%;
}
.kpis, .cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.kpi, .project-card {
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.kpi span, .project-card .meta { color: var(--muted); font-size: 12px; font-weight: 600; }
.area-kpis { margin-bottom: 16px; }
.proc-chart { margin-top: 0; }
.proc-chart ul { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 12px; }
.proc-chart li { display: grid; grid-template-columns: 120px 1fr auto; gap: 12px; align-items: center; }
.proc-chart li > span:first-child { font-size: 13px; font-weight: 700; color: var(--muted); }
.proc-chart b { font-variant-numeric: tabular-nums; font-size: 14px; white-space: nowrap; }
.proc-bar { display: block; height: 14px; border-radius: 999px; background: var(--track, var(--line)); overflow: hidden; }
.proc-bar i { display: block; height: 100%; border-radius: inherit; min-width: 0; }
.proc-bar i.proc-freight { background: #0e7490; }
.proc-bar i.proc-gst { background: #b45309; }
.proc-bar i.proc-billable { background: var(--brand-2); }
.proc-bar i.proc-nonbillable { background: #c2410c; }
.proc-bar i.proc-total { background: var(--night, #0f1b2d); }
.proc-bar i.proc-mr { background: #0e7490; }
.proc-bar i.proc-received { background: #b45309; }
.proc-bar i.proc-approved { background: var(--brand-2); }
.site-flow { margin: 4px 0 22px; }
.site-lead { margin: 0 0 14px; max-width: 70ch; color: var(--ink); font-size: 15px; line-height: 1.45; }
.site-total { margin-bottom: 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
.site-total b { margin-right: 6px; color: var(--ink); font-size: 22px; font-variant-numeric: tabular-nums; }
.site-stack { display: flex; height: 22px; border-radius: 999px; overflow: hidden; background: var(--line); }
.site-stack i { display: block; height: 100%; min-width: 8px; }
.site-stack i.until, .site-key i.until { background: #0e7490; }
.site-stack i.waiting, .site-key i.waiting { background: #b45309; }
.site-stack i.approved, .site-key i.approved { background: var(--brand-2); }
.site-stack i.rejected, .site-key i.rejected { background: var(--red); }
.site-key { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 10px 0 0; padding: 0; }
.site-key li { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.site-key i { width: 12px; height: 12px; border-radius: 4px; }
.site-key b { color: var(--ink); font-variant-numeric: tabular-nums; }
.site-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.site-step { display: grid; gap: 4px; align-content: start; padding: 14px 16px; border: 1px solid var(--glass-line); border-top: 4px solid #0e7490; border-radius: 18px; background: var(--glass-strong); color: inherit; text-decoration: none; box-shadow: var(--shadow); }
.site-step span { color: var(--muted); font-size: 12px; font-weight: 700; }
.site-step strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.site-step small { color: var(--muted); font-size: 12px; }
.site-step.waiting { border-top-color: #b45309; }
.site-step.received { border-top-color: #b45309; }
.site-step.approved { border-top-color: var(--brand-2); }
.site-step.rejected { border-top-color: var(--red); background: var(--red-bg); }
.site-step.rejected strong { color: var(--red); }
a.site-step:hover { transform: translateY(-1px); }
@media (max-width: 760px) {
  .site-steps { grid-template-columns: 1fr 1fr; }
}
.kpi.proc-total { background: var(--night, #0f1b2d); border-color: var(--night, #0f1b2d); }
.kpi.proc-total span, .kpi.proc-total small { color: rgba(255, 255, 255, 0.78); }
.kpi.proc-total strong { color: #fff; }
.proc-chart li.proc-total { padding-top: 8px; border-top: 1px solid var(--line); }
.proc-chart li.proc-total > span:first-child, .proc-chart li.proc-total b { color: var(--ink); font-weight: 800; }
@media (max-width: 760px) {
  .proc-chart li { grid-template-columns: 1fr auto; }
  .proc-bar { grid-column: 1 / -1; order: 3; }
}
.area-kpi { display: grid; gap: 4px; align-content: start; color: inherit; text-decoration: none; transition: border-color .15s ease, transform .15s ease; }
a.area-kpi:hover { border-color: var(--lime-deep); transform: translateY(-1px); }
.area-kpi strong { margin-top: 4px; }
.area-kpi strong.as-text { font-size: 18px; }
.area-kpi small { color: var(--muted); font-size: 12px; }
.area-kpi .fund-bar { margin-top: 4px; }
.area-kpi.warn { border-color: var(--gold); }
.area-kpi.warn strong { color: var(--gold); }
.area-kpi.pending { background: var(--red-bg); border-color: #e3b4b0; }
.area-kpi.pending span, .area-kpi.pending small, .area-kpi.pending strong { color: var(--red); }
a.area-kpi.pending:hover { border-color: var(--red); }
.area-tasks li.pending a { background: var(--red-bg); border-radius: 10px; padding: 10px 12px; margin: 4px 0; }
.area-tasks li.pending + li.pending { border-top: 0; }
.area-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.area-tasks, .area-status, .area-feed { list-style: none; margin: 0; padding: 0; }
.area-tasks li + li, .area-feed li + li { border-top: 1px solid var(--row-line); }
.area-tasks a { display: grid; gap: 2px; padding: 10px 0; color: inherit; text-decoration: none; }
.area-tasks a:hover strong { text-decoration: underline; }
.area-tasks .muted { font-size: 13px; }
.area-sub { margin: 12px 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.area-sub:first-of-type { margin-top: 0; }
.area-status { display: flex; flex-wrap: wrap; gap: 6px; }
.area-status li > a, .area-status li > span:first-child { display: inline-flex; }
.area-status li a, .area-status li { color: inherit; text-decoration: none; }
.area-status li a, .area-status li:not(:has(a)) { display: inline-flex; gap: 8px; align-items: baseline; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; }
.area-status li a:hover { border-color: var(--lime-deep); }
.area-status strong { font-variant-numeric: tabular-nums; }
.area-feed li { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 8px 0; font-size: 13px; }
.area-feed .when { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.area-feed .muted { display: block; }
.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.project-card { text-decoration: none; color: inherit; display: block; transition: transform .15s ease, box-shadow .15s ease; }
.project-card:hover { transform: translateY(-2px); box-shadow: 0 24px 50px rgba(40, 62, 96, 0.14); }
.project-card h2 { margin: 6px 0 4px; font-size: 20px; }
.project-card p { margin: 6px 0 12px; color: var(--muted); }

.pipeline { display: flex; gap: 6px; overflow-x: auto; list-style: none; padding: 0 0 6px; margin: 14px 0; scrollbar-width: thin; }
.pipeline li {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--glass-line);
  background: var(--glass);
  border-radius: 999px;
  padding: 7px 12px;
}
.pipeline li.done { color: var(--ink); background: var(--surface); }
.pipeline li.done::before { content: "✓ "; color: var(--green); }
.pipeline li.now { color: var(--lime-ink); background: var(--lime); border-color: var(--lime); }
.dept-flow li { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; border-radius: 14px; }
.dept-flow li b { font-weight: 700; color: var(--ink); }
.dept-flow li span { font-size: 11px; font-weight: 700; color: var(--muted); }
.dept-lanes { margin-bottom: 18px; }
.dept-people { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.dept-people span { font-size: 12px; font-weight: 700; background: var(--glass); border: 1px solid var(--glass-line); border-radius: 999px; padding: 3px 8px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.inline-form select { min-width: 9rem; }
.inline-form input[type=email] { min-width: 12rem; }
.login-or { display: flex; align-items: center; gap: 10px; margin: 14px 0 10px; color: var(--muted); font-size: 12px; font-weight: 700; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--glass-line); }
.google-btn { display: flex; justify-content: center; width: 100%; }

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 12px 14px;
  background: var(--surface-2);
}
td { padding: 12px 14px; border-top: 1px solid var(--row-line); vertical-align: middle; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num { font-weight: 600; }
tr:hover td { background: var(--hover); }
.empty { color: var(--muted); text-align: center; padding: 24px; }
td input, td select { width: 100%; min-width: 88px; padding: 8px 10px; }

/* ---------- Buttons and forms ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 10px 18px;
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--line-strong); }
.btn.primary { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); }
.btn.primary:hover { background: var(--lime-deep); border-color: var(--lime-deep); }
.btn.ghost { background: var(--glass-strong); border-color: var(--glass-line); }
.btn.ghost:hover { background: var(--surface); }
.btn.danger { color: var(--red); border-color: #f0cfcb; background: var(--surface); }
.btn.dark { background: var(--night); border-color: var(--night); color: white; }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid #1e6fc0;
  outline-offset: 2px;
}

input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
input:focus, select:focus, textarea:focus { border-color: var(--line-strong); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid > * { min-width: 0; }
.form-grid select, .form-grid input { max-width: 100%; min-width: 0; text-overflow: ellipsis; }
label.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* ---------- Status pieces ---------- */
.pill, .chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.pill { background: var(--green-bg); color: var(--green); }
.pill.idle,
.pill.t-none,
.pill.t-draft { background: var(--surface-3); color: var(--muted); }
.pill.wait,
.pill.t-review { background: var(--gold-bg); color: var(--gold); }
.pill.t-progress { background: var(--blue-bg); color: var(--blue); }
.pill.t-live { background: #e0f2fe; color: #0369a1; }
.pill.t-changes { background: #ffedd5; color: #c2410c; }
.pill.t-held { background: #fef2f2; color: #b91c1c; }
.pill.t-ok { background: var(--green-bg); color: var(--green); }
.pill.t-archived { background: #eef2f7; color: #475569; }
.pill.bad,
.pill.t-bad { background: var(--red-bg); color: var(--red); }
.chip.bill { background: var(--bill-bg); color: var(--bill-ink); }
.chip.non { background: var(--blue-bg); color: var(--blue); }
.chip.nboq { background: #efe7fb; color: #5b21b6; }
.proc-bar i.proc-nonboq { background: #6d28d9; }
.nb-fund-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}
.nb-fund-tag.ok {
  color: var(--blue);
  background: var(--blue-bg);
}
.nb-fund-tag.empty {
  color: var(--red);
  background: var(--red-bg);
}
.nb-fund-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.masked {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface-3);
  border-radius: 999px;
  padding: 3px 9px;
}

.flash { padding: 12px 16px; border-radius: 14px; margin-bottom: 12px; font-weight: 600; font-size: 14px; }
.flash.error { background: var(--red-bg); color: var(--red); }
.flash.warn { background: var(--gold-bg); color: var(--gold); }
.flash.ok, .flash.info { background: var(--glass-strong); color: var(--ink); border: 1px solid var(--glass-line); }
.flash.ok::before, .flash.info::before { content: "●"; color: var(--lime-deep); margin-right: 8px; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.timeline-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.timeline time { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.timeline p { margin: 4px 0 0; font-size: 14px; }

.tabs { display: inline-flex; gap: 4px; margin: 8px 0 12px; padding: 4px; background: var(--glass-strong); border: 1px solid var(--glass-line); border-radius: 999px; }
.tabs a { text-decoration: none; border-radius: 999px; padding: 7px 14px; color: var(--ink); font-size: 13px; font-weight: 600; }
.tabs a.on { background: var(--lime); color: var(--lime-ink); }

.signs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sign { border: 1px dashed var(--line-strong); border-radius: 16px; padding: 14px; min-height: 150px; background: var(--surface); }
.sign h3 { margin: 0 0 8px; font-size: 16px; }
.sign .line { margin-top: 36px; border-top: 1px solid var(--ink); padding-top: 6px; font-size: 13px; }

/* ---------- Dashboard ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); gap: 16px; margin-top: 8px; }
.hero-card {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  min-width: 0;
}
.figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.figure span { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.figure { min-width: 0; }
.figure strong { display: block; margin-top: 6px; font-size: 30px; font-weight: 600; letter-spacing: -0.03em; max-width: 100%; overflow-wrap: anywhere; }
.figure strong small { font-size: 16px; color: var(--muted); font-weight: 500; margin-right: 2px; }
.bars { display: grid; gap: 12px; margin-top: 26px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 60px; gap: 12px; align-items: center; font-size: 12px; font-weight: 600; color: var(--muted); }
.bar-row b { color: var(--ink); text-align: right; font-weight: 700; }
.bar { height: 10px; border-radius: 999px; background: var(--track); overflow: hidden; }
.bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--lime);
}
.people { display: flex; margin-top: 18px; }
.people .avatar { width: 32px; height: 32px; font-size: 11px; margin-right: -6px; box-shadow: 0 0 0 2px var(--ring); }
.avatar.l1 { background: #0d3b72; }
.avatar.l2 { background: #1e6fc0; }
.avatar.l3 { background: #4f6b8c; }

.payout-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.payout-head .figure strong { font-size: 32px; }
.corner {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--glass-line);
  background: var(--glass-strong);
  text-decoration: none;
  font-weight: 700;
}
.figure .tag, .tag { display: inline-flex; color: var(--ink); margin-top: 10px; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 5px 10px; background: var(--surface); border: 1px solid var(--line); }
.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 18px; align-items: end; }
.slot {
  border-radius: 14px;
  padding: 12px;
  min-height: 86px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  min-width: 0;
}
.slot em { font-style: normal; color: var(--muted); font-weight: 600; }
.slot.on { background: var(--lime); border-color: var(--lime); min-height: 108px; color: var(--lime-ink); }
.slot.on em { color: rgba(255, 255, 255, 0.92); }

.filters { display: flex; align-items: center; gap: 10px; margin: 22px 0 12px; flex-wrap: wrap; }
.filters h2 { margin: 0; font-size: 16px; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--night); color: white; font-size: 11px; font-weight: 800; }

.night {
  position: relative;
  background: var(--night);
  color: var(--night-ink);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 30px 60px rgba(20, 24, 32, 0.25);
}
.night-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.night-head h2 { margin: 0; color: var(--night-ink); font-size: 16px; font-weight: 600; }
.night .tabs { margin: 0; background: var(--surface); border: 0; }
.night .tabs a { color: var(--ink); }
.night .tabs a.on { color: var(--lime-ink); }
.night .role-note { color: var(--night-dim); }
.night a.role-note:hover { color: var(--night-ink); }
.night .count { background: var(--night-3); }
.night .tabs a.on .count { background: var(--night); }
.split { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.6fr); gap: 14px; }
.rows { display: grid; gap: 8px; align-content: start; }
.row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--night-2);
  color: var(--night-ink);
  text-decoration: none;
}
.row:hover { background: var(--night-3); }
.row.on { background: var(--slate); }
.row strong { display: block; font-size: 14px; font-weight: 600; }
.row span:not(.avatar) { display: block; font-size: 12px; color: var(--night-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .avatar { width: 36px; height: 36px; font-size: 12px; box-shadow: none; color: white; }
.row.on span:not(.avatar) { color: rgba(255, 255, 255, 0.92); }
.row .when { font-size: 11px; font-weight: 700; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 999px; padding: 4px 9px; color: var(--night-dim); white-space: nowrap; }
.row.on span.when { background: var(--surface); color: var(--ink); border-color: var(--surface); }
.feed-list { display: grid; gap: 8px; align-content: start; max-height: min(460px, 62dvh); overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; scrollbar-width: thin; scrollbar-color: var(--night-3) transparent; }
.feed-day { position: sticky; top: 0; z-index: 1; margin: 6px 0 0; padding: 4px 2px; background: var(--night); color: var(--night-dim); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.feed-list > .feed-day:first-child { margin-top: 0; }
.feed .row { cursor: pointer; }
.feed .row:focus-visible { outline: 2px solid var(--night-ink); outline-offset: 2px; }
.feed .row.fresh { animation: rise .25s ease-out; }
.feed-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding-top: 10px; }
.feed-foot .feed-status { color: var(--night-dim); font-size: 12px; margin-right: auto; }
.feed-foot .feed-status b { color: var(--night-ink); }
.feed-foot .btn.ghost { background: var(--night-2); color: var(--night-ink); border-color: rgba(255, 255, 255, 0.14); }
.feed-foot .btn.ghost:hover { background: var(--night-3); }
.feed-foot .btn.busy::after { border-color: var(--night-ink); border-right-color: transparent; }
.feed-all { color: var(--night-ink); font-size: 12px; font-weight: 700; text-decoration: none; }
.feed-all:hover { text-decoration: underline; }
.detail {
  background: var(--slate);
  border-radius: 14px;
  padding: 18px;
  color: white;
  min-width: 0;
  align-self: start;
}
.log-card[hidden], .log-card [hidden] { display: none !important; }
.log-card { background: var(--slate-deep); border-radius: 14px; padding: 14px 16px; margin-bottom: 14px; }
.log-card-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.log-kind { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(255, 255, 255, 0.8); }
.log-card h3 { margin: 6px 0 4px; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.log-meaning { margin: 0 0 12px; font-size: 14px; line-height: 1.5; color: rgba(255, 255, 255, 0.94); }
.log-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin: 0; }
.log-facts dt { font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, 0.72); }
.log-facts dd { margin: 2px 0 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.log-facts [data-wrap="note"] { grid-column: 1 / -1; }
.log-facts [data-wrap="note"] dd { font-weight: 500; }
.log-next { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.16); font-size: 13px; color: rgba(255, 255, 255, 0.92); }
.log-next b { display: block; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(255, 255, 255, 0.72); margin-bottom: 2px; }
.detail-head { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.detail-head span { display: block; font-size: 12px; color: rgba(255, 255, 255, 0.92); font-weight: 600; }
.detail-head strong { display: block; margin-top: 6px; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.tile {
  background: var(--slate-tile);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  padding: 12px;
  min-height: 84px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}
.tile strong { font-size: 18px; font-weight: 600; }
.tile span { font-size: 12px; color: rgba(255, 255, 255, 0.94); font-weight: 500; }
.tile.hatch { background: repeating-linear-gradient(-45deg, rgba(255,255,255,.08) 0 8px, rgba(255,255,255,.18) 8px 10px); }
.totals {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--slate-deep);
  flex-wrap: wrap;
}
.totals div span { display: block; font-size: 12px; color: rgba(255, 255, 255, 0.92); }
.totals div strong { display: block; font-size: 18px; font-weight: 600; margin-top: 2px; }
.totals .btn { margin-left: auto; }
.night .empty-note { color: var(--night-dim); font-size: 14px; padding: 12px 4px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 20px; padding: 20px; }
.login-wrap.solo { grid-template-columns: 1fr; place-items: center; }
.login-story {
  background: var(--night);
  color: white;
  border-radius: 20px;
  padding: 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  position: relative;
  overflow: hidden;
}
.login-story::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -80px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  border: 40px solid rgba(255, 255, 255, 0.06);
}
.login-story > * { position: relative; z-index: 1; }
.login-story .eyebrow { color: #9cc7f0; }
.login-story h1 { font-size: 54px; max-width: 12ch; }
.login-story p { color: #c8d6e8; max-width: 46ch; line-height: 1.55; }
.layers { display: grid; gap: 10px; margin-top: 26px; max-width: 520px; }
.layer { display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: center; background: var(--night-2); border-radius: 16px; padding: 10px 12px; }
.layer b {
  font-size: 12px;
  font-weight: 800;
  background: var(--lime);
  color: var(--lime-ink);
  border-radius: 999px;
  padding: 6px 0;
  text-align: center;
}
.layer span { color: #d6e2f0; font-size: 14px; }
.login-panel { display: grid; place-items: center; padding: 28px 20px; }
.login-card { width: min(440px, 100%); }
.login-card h1 { font-size: 48px; }
/* ---------- BOM tree ---------- */
.tree-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 10px; }
.tree-bar p { margin: 0; }
.tree-tools { display: flex; gap: 8px; }
td.sno, th.sno { width: 1%; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; padding-right: 10px; }
table.tree td.ref, table.tree th.ref { width: 64px; font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
table.tree tr.group-row td { background: var(--group-bg); font-weight: 800; font-size: 13px; letter-spacing: 0.02em; text-transform: uppercase; color: var(--blue); }
table.tree tr.group-row td.ref { color: var(--blue); font-weight: 800; }
table.tree tr.parent-row td { font-weight: 600; }
table.tree tr.sub-row td { background: var(--sub-bg); font-size: 13px; }
table.tree tr.sub-row td:nth-child(2) { padding-left: 46px; }
table.tree tr.sub-row td.ref { padding-left: 22px; }
.sub-indent { color: var(--slate-deep); margin-right: 8px; font-weight: 800; }
.tree-toggle {
  display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: 8px; vertical-align: middle;
  border: 1px solid var(--line); border-radius: 7px; background: var(--surface); cursor: pointer; padding: 0;
}
.tree-toggle:hover { border-color: var(--slate-deep); }
.tree-toggle .caret { width: 0; height: 0; border-left: 6px solid var(--ink); border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform 0.15s; }
.tree-toggle[aria-expanded="true"] .caret { transform: rotate(90deg); }
.tree-spacer { display: inline-block; width: 32px; }
.count-chip { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--gold-bg); color: var(--gold); font-size: 11px; font-weight: 700; }
.split-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.split-panels .panel { margin-top: 16px; }
.row-actions .inline-form { flex-wrap: nowrap; gap: 6px; align-items: center; }
.row-actions .inline-form input, .row-actions .inline-form select { width: 140px; min-height: 32px; padding: 5px 10px; font-size: 13px; }
.item-sub td { background: var(--sub-bg); font-size: 13px; }
.item-sub td:first-child { padding-left: 40px; }
.under-bill { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 600; }
a.duty { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 5px 12px 5px 5px; border-radius: 999px; background: #c2410c; color: #fff; font-weight: 700; text-decoration: none; box-shadow: 0 0 0 3px #fdba74; }
a.duty span { background: #fff; color: #c2410c; border-radius: 999px; padding: 2px 7px; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
a.duty strong { font-size: 13px; }
a.duty-banner { display: flex; width: 100%; margin: 0 0 16px; padding: 14px 16px; border-radius: 14px; box-shadow: 0 0 0 4px #fdba74; }
a.duty-banner strong { font-size: 17px; }
a.duty-banner em { margin-left: auto; font-style: normal; font-weight: 600; }
tr.needs-you td { background: #fff7ed; }
.line-rejected { display: block; margin-top: 4px; font-size: 12px; color: var(--red); }
.line-edited { display: block; margin-top: 4px; font-size: 12px; color: var(--gold); font-weight: 600; }
.rejected-panel { border-left: 4px solid var(--red); }
.rejected-panel .reject-reason { color: var(--red); font-weight: 600; }
.issue-open { margin-bottom: 16px; }
.issue-open > summary { list-style: none; width: max-content; }
.issue-open > summary::-webkit-details-marker { display: none; }
.issue-open[open] > summary { margin-bottom: 10px; background: transparent; color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.issue-open:not([open]) .opened, .issue-open[open] .shut { display: none; }
.new-taker { margin: 12px 0 4px; padding: 12px 14px 4px; border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--surface-2); }
.new-taker[hidden] { display: none; }
.new-taker legend { padding: 0 6px; font-size: .82rem; font-weight: 700; }
.new-taker > p { margin: 0 0 8px; font-size: .8rem; }
.line-reject summary { list-style: none; cursor: pointer; width: max-content; }
.line-reject summary::-webkit-details-marker { display: none; }
.line-reject[open] summary { margin-bottom: 8px; }
.line-reject form { display: grid; gap: 8px; min-width: 220px; }
.line-reject textarea { width: 100%; min-width: 0; }

/* ---------- Exported documents (A4, OEG letterhead) ---------- */
.print-doc { background: #dfe5ee; font-family: var(--sans); }
.doc-toolbar {
  position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 20px; background: rgba(255, 255, 255, 0.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px);
}
.doc-toolbar .group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.doc-toolbar .status { font-size: 13px; color: var(--muted); }
.sheet {
  --oeg: #0b3a6f; --oeg-soft: #e8eff8; --oeg-accent: #1f7fd1;
  --ink: #14202e; --muted: #56667b; --line: #dde3ea; --surface-2: #f6f8fb; --hover: #fafcfe; --row-line: #edf1f6;
  width: 794px; min-height: 1123px; margin: 24px auto; padding: 32px 40px 26px; background: white; color: #10151c;
  box-shadow: 0 18px 48px rgba(20, 40, 70, 0.16); box-sizing: border-box; display: flex; flex-direction: column; font-size: 12px; line-height: 1.45;
}
.lh { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; padding-bottom: 14px; border-bottom: 3px solid var(--oeg); }
.lh img { height: 54px; width: auto; display: block; }
.lh-co { text-align: right; font-size: 10.5px; color: #3b4656; }
.sheet a.tel { color: #0b5cd6; text-decoration: underline; text-underline-offset: 1.5px; }
.lh-co strong { display: block; font-size: 14px; color: var(--oeg); letter-spacing: 0.01em; margin-bottom: 2px; }
.doc-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 14px 0 12px; }
.doc-title h1 { margin: 0; font-size: 22px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--oeg); }
.doc-title p { margin: 4px 0 0; color: #5a6575; font-size: 11px; }
.doc-no { text-align: right; }
.doc-no b { display: block; font-family: var(--mono); font-size: 15px; color: #10151c; }
.doc-no span { display: inline-block; margin-top: 4px; padding: 2px 10px; border-radius: 999px; background: var(--oeg-soft); color: var(--oeg); font-weight: 700; font-size: 10.5px; }
.doc-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid #cfd8e3; border-radius: 6px; overflow: hidden; margin-bottom: 14px; }
.doc-info div { display: grid; grid-template-columns: 128px 1fr; border-bottom: 1px solid #e3e8ef; }
.doc-info div:nth-child(odd) { border-right: 1px solid #e3e8ef; }
.doc-info dt { padding: 6px 10px; background: #f5f8fb; color: #5a6575; font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.03em; }
.doc-info dd { margin: 0; padding: 6px 10px; font-weight: 600; overflow-wrap: anywhere; white-space: pre-line; }
.doc-table { width: 100%; border-collapse: collapse; border-spacing: 0; font-size: 11.5px; border: 1px solid #111; empty-cells: show; }
.doc-table th { background: var(--blue-bg); color: #0f172a; text-align: left; padding: 7px 8px; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; border: 1px solid #111; }
.doc-table td { padding: 6px 8px; border: 1px solid #111; vertical-align: middle; }
.sheet tr:hover td { background: transparent; }
.doc-table .num { text-align: right; white-space: nowrap; }
.doc-table .ref { font-family: var(--mono); font-size: 10.5px; color: #5a6575; white-space: nowrap; width: 52px; }
.doc-table th.ref { color: #0f172a; font-family: var(--sans); }
.doc-table tr.g td { background: var(--oeg-soft); color: var(--oeg); font-weight: 800; text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.03em; }
.doc-table tr.b td { font-weight: 600; }
.doc-table tr.s td { color: #3b4656; font-size: 11px; }
.doc-table tr.s td.item { padding-left: 26px; }
.doc-table tr.s td.item::before { content: "↳ "; color: var(--oeg-accent); font-weight: 800; }
.doc-table tr.total td { border-top: 2px solid var(--oeg); border-bottom: none; font-weight: 800; background: #f5f8fb; }
.doc-table .tag { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 9.5px; font-weight: 800; white-space: nowrap; }
.doc-table th.remarks { width: 120px; }
.doc-table .tag.b { background: #e6f4ea; color: #2f7a4f; }
.doc-table .tag.n { background: #f8f0d9; color: #8a6512; }
.doc-table.compact, .doc-table.doc-summary { font-size: 10px; }
.doc-table.compact th, .doc-table.doc-summary th { padding: 6px 5px; font-size: 9px; }
.doc-table.compact td, .doc-table.doc-summary td { padding: 4px 5px; }
.doc-table.compact .ref, .doc-table.doc-summary .ref { width: 40px; font-size: 9.5px; }
.doc-table.doc-summary { margin-bottom: 4px; }
.doc-sub { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--oeg); }
.doc-table .blank { border-bottom: 1px dotted #9aa6b5; min-width: 60px; display: inline-block; height: 12px; }
.doc-block { margin-top: 10px; }
.doc-block h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--oeg); margin: 0 0 6px; }
.doc-block p { margin: 0 0 6px; }
.doc-breakup {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 10px;
  width: 100%;
}
.doc-totals {
  margin: 0;
  width: 210px;
  border-collapse: collapse;
  font-size: 10px;
  border: 1px solid #111;
  border-radius: 0;
  overflow: visible;
  background: #fff;
}
.doc-totals td {
  padding: 5px 6px;
  border: 1px solid #111;
  font-size: 10px;
  line-height: 1.3;
  color: #111;
  background: #fff;
}
.doc-totals tr:last-child td { border-bottom: 1px solid #111; }
.doc-totals td:last-child { text-align: right; font-weight: 700; white-space: nowrap; }
.doc-totals tr.grand td { background: var(--blue-bg); color: #0f172a; font-weight: 800; font-size: 10px; }
.doc-totals.doc-savings tr.good td:last-child { color: var(--brand-2); }
.doc-totals.doc-savings tr.bad td:last-child { color: var(--red); }
.doc-totals.doc-savings tr.grand td { background: transparent; color: inherit; border-top: 1px solid #e3e8ef; font-weight: 800; }
.doc-totals.doc-savings tr.good.grand td:last-child { color: var(--brand-2); }
.doc-totals.doc-savings tr.bad.grand td:last-child { color: var(--red); }

/* Purchase order print: Excel-style dark grid; even text size; variance in dark green / red only. */
.sheet.po-doc {
  color: #111;
  padding: 26px 24px 20px;
  font-size: 11px;
  line-height: 1.4;
}
.sheet.po-doc .lh { border-bottom: 2px solid #222; padding-bottom: 12px; }
.sheet.po-doc .lh img { height: 48px; }
.sheet.po-doc .lh-co,
.sheet.po-doc .lh-co strong,
.sheet.po-doc a.tel { color: #111; }
.sheet.po-doc .lh-co { font-size: 10.5px; }
.sheet.po-doc .lh-co strong { font-size: 13px; }
.sheet.po-doc .doc-title { margin: 12px 0 10px; }
.sheet.po-doc .doc-title h1 {
  color: #111;
  font-size: 16px;
  letter-spacing: 0.02em;
}
.sheet.po-doc .doc-title p {
  color: #333;
  font-size: 11px;
}
.sheet.po-doc .doc-no b { font-size: 14px; color: #111; }
.sheet.po-doc .doc-no span {
  background: transparent !important;
  color: #111 !important;
  border: 1px solid #333;
  border-radius: 0;
  padding: 2px 8px;
  font-size: 10.5px;
}
.sheet.po-doc .doc-info {
  border: 1px solid #333;
  border-radius: 0;
  margin-bottom: 12px;
}
.sheet.po-doc .doc-info div {
  border-bottom: 1px solid #333;
  grid-template-columns: 118px 1fr;
}
.sheet.po-doc .doc-info div:nth-child(odd) { border-right: 1px solid #333; }
.sheet.po-doc .doc-info div:nth-last-child(-n+2) { border-bottom: 0; }
.sheet.po-doc .doc-info dt {
  background: transparent !important;
  color: #111 !important;
  border-right: 1px solid #333;
  font-size: 10.5px;
  padding: 7px 8px;
}
.sheet.po-doc .doc-info dd {
  color: #111;
  font-size: 11px;
  padding: 7px 8px;
}
.sheet.po-doc .doc-table {
  table-layout: fixed;
  width: 100%;
  font-size: 10px;
  line-height: 1.35;
  border: 1.5px solid #222;
  border-collapse: collapse;
  background: #fff;
}
.sheet.po-doc .doc-table.compact {
  font-size: 10px;
}
.sheet.po-doc .doc-table th,
.sheet.po-doc .doc-table td {
  border: 1px solid #333 !important;
  background: #fff !important;
  color: #111 !important;
  padding: 6px 5px;
  vertical-align: middle;
}
.sheet.po-doc .doc-table th {
  background: var(--blue-bg) !important;
  color: #0f172a !important;
  font-size: 9.5px !important;
  font-weight: 800;
  white-space: normal;
  vertical-align: bottom;
  letter-spacing: 0;
  line-height: 1.25;
  text-align: left;
  text-transform: none !important;
}
.sheet.po-doc .doc-table.compact th,
.sheet.po-doc .doc-table.compact td {
  padding: 6px 5px;
  font-size: 10px;
}
.sheet.po-doc .doc-table.compact th { font-size: 9.5px !important; }
.sheet.po-doc .doc-table th.num { text-align: right; }
.sheet.po-doc .doc-table td { overflow-wrap: anywhere; font-size: 10px !important; }
.sheet.po-doc .doc-table .ref {
  width: 4%;
  font-size: 10px !important;
  color: #111 !important;
}
.sheet.po-doc .doc-table th.ref { color: #111 !important; font-family: var(--sans); }
.sheet.po-doc .doc-table .item {
  width: 22%;
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
  max-height: calc(1.3em * 4);
  vertical-align: top;
}
.sheet.po-doc .doc-table .type {
  width: 7%;
  text-align: left;
  font-weight: 700;
  white-space: normal;
  line-height: 1.25;
}
.sheet.po-doc .doc-table th:nth-child(4),
.sheet.po-doc .doc-table td:nth-child(4) { width: 5%; }
.sheet.po-doc .doc-table .num {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.sheet.po-doc .doc-table tr.g td {
  background: #fff !important;
  color: #111 !important;
  font-weight: 800;
  font-size: 10px !important;
}
.sheet.po-doc .doc-table tr.b td,
.sheet.po-doc .doc-table tr.s td {
  color: #111 !important;
  font-size: 10px !important;
}
.sheet.po-doc .doc-table tr.s td.item { padding-left: 8px; }
.sheet.po-doc .doc-table tr.s td.item::before { color: #111; content: ""; }
.sheet.po-doc .doc-table .var-good { color: #0b5c2e !important; font-weight: 700; }
.sheet.po-doc .doc-table .var-bad { color: #8b1515 !important; font-weight: 700; }
.sheet.po-doc .doc-block { margin-top: 12px; }
.sheet.po-doc .doc-block h2 {
  color: #111;
  font-size: 11px;
  margin: 0 0 4px;
}
.sheet.po-doc .doc-block p {
  color: #111;
  font-size: 11px;
  margin: 0;
}
.sheet.po-doc .doc-sign h3 { color: #111; font-size: 10.5px; }
/* Totals boxes: same type size as table cells, stacked under the right edge. */
.sheet.po-doc .doc-breakup,
.sheet.po-doc .po-breakup {
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: flex-end !important;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  margin: 8px 0 6px;
  page-break-inside: avoid;
}
.sheet.po-doc .doc-totals,
.sheet.po-doc .po-breakup .doc-totals {
  width: 210px !important;
  max-width: 42% !important;
  margin: 0 !important;
  border: 1px solid #000 !important;
  border-collapse: collapse;
  border-radius: 0 !important;
  background: #fff !important;
  font-size: 10px !important;
  overflow: visible;
  box-shadow: none !important;
}
.sheet.po-doc .doc-totals td,
.sheet.po-doc .po-breakup .doc-totals td {
  padding: 5px 6px !important;
  border: 1px solid #000 !important;
  color: #111 !important;
  background: #fff !important;
  font-size: 10px !important;
  line-height: 1.3;
}
.sheet.po-doc .doc-totals td:first-child { font-weight: 700; width: 58%; }
.sheet.po-doc .doc-totals td:last-child { font-weight: 700; text-align: right; width: 42%; white-space: nowrap; }
.sheet.po-doc .doc-totals tr.grand td,
.sheet.po-doc .po-breakup .doc-totals tr.grand td {
  background: var(--blue-bg) !important;
  color: #0f172a !important;
  font-weight: 800 !important;
  font-size: 10px !important;
  padding: 5px 6px !important;
}
.sheet.po-doc .doc-totals.doc-savings tr.good td:last-child,
.sheet.po-doc .doc-totals.doc-savings tr.good.grand td:last-child {
  color: #0b5c2e !important;
}
.sheet.po-doc .doc-totals.doc-savings tr.bad td:last-child,
.sheet.po-doc .doc-totals.doc-savings tr.bad.grand td:last-child {
  color: #8b1515 !important;
}
.sheet.po-doc .doc-sign { border: 1px solid #333; border-radius: 0; }
.sheet.po-doc .doc-foot {
  border-top: 1px solid #333;
  color: #333;
  font-size: 10px;
}
.doc-declare { margin-top: 10px; padding: 10px 12px; border: 1px solid #cfd8e3; border-left: 4px solid var(--oeg); background: #f9fbfd; font-size: 11.5px; }
.doc-signs { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 10px; margin-top: auto; padding-top: 14px; }
.doc-sign { border: 1px solid #cfd8e3; border-radius: 6px; padding: 8px 10px; min-height: 92px; display: flex; flex-direction: column; }
.doc-sign h3 { margin: 0 0 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--oeg); }
.doc-sign p { margin: 0; font-weight: 700; }
.doc-sign small { color: #5a6575; }
.doc-sign .line { margin-top: auto; border-top: 1px solid #10151c; padding-top: 4px; font-size: 10px; color: #5a6575; }
.doc-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; padding-top: 8px; border-top: 1px solid #cfd8e3; font-size: 9.5px; color: #6b7684; }
.doc-foot .page-no { font-weight: 700; color: #3b4656; white-space: nowrap; }
.sheet.page { height: 1120px; min-height: 0; overflow: hidden; }
.doc-picks { flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding-top: 8px; border-top: 1px solid var(--line); }
.doc-picks > span { font-size: 12px; font-weight: 700; color: var(--muted); }
.doc-picks label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; cursor: pointer; }
body.print-doc .sheet.reading { display: none; }
body.print-doc.reading .sheet.page { display: none; }
body.print-doc.reading .sheet.reading { display: flex; width: min(794px, calc(100% - 24px)); height: auto; min-height: 0; overflow: visible; margin: 12px auto 40px; }
.page-body { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.page-body > * { flex-shrink: 0; }
.doc-cont { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 10px 0 8px; font-size: 11px; color: #5a6575; }
.doc-cont strong { font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--oeg); }
.doc-cont span { font-family: var(--mono); }
.center { text-align: center; }

/* ---------- Developer console ---------- */
.console-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.console-grid.wide-left { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); margin-top: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.panel.no-top { margin-top: 0; }
.sub-panel { background: var(--glass-strong); border: 1px solid var(--glass-line); border-radius: 18px; padding: 18px; margin-top: 16px; min-width: 0; }
.sub-panel h3 { margin: 0 0 12px; font-size: 15px; }
.small-note { font-size: 12px; margin: 8px 0 0; line-height: 1.5; }
.small-strong { font-size: 18px !important; overflow-wrap: anywhere; }
.mono-cell { font-family: var(--mono); font-size: 12px; }
.mono-title { font-family: var(--mono); font-size: 34px; }
.clip-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bad-text { color: var(--red); }
.gap-top { margin-top: 18px; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 14px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 16px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; }
.pill.dev { background: var(--night); color: #ffffff; margin-left: 4px; }
.lvl { display: inline-grid; place-items: center; min-width: 40px; padding: 3px 8px; border-radius: 8px; font-size: 11px; font-weight: 800; border: 2px solid transparent; }
.lvl.both { background: var(--lime); color: var(--lime-ink); }
.lvl.approve { background: var(--gold-bg); color: var(--gold); }
.lvl.edit { background: var(--green-bg); color: var(--green); }
.lvl.view { background: var(--blue-bg); color: var(--blue); }
.lvl.none { background: var(--surface-3); color: var(--muted); }
.lvl.custom { border-color: var(--night); }
.lvl-cell { text-align: center; padding: 8px 4px; }
select.lvl-pick { appearance: none; -webkit-appearance: none; cursor: pointer; text-align: center; text-align-last: center; min-height: 0; width: auto; box-shadow: none; }
.tree-filter { width: 240px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); font: inherit; font-size: 13px; }
.desc-cell { max-width: 340px; color: var(--muted); font-size: 13px; }
.modal {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; overflow: auto;
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink);
  box-shadow: 0 30px 80px rgba(8, 12, 18, 0.35); text-align: left; overscroll-behavior: contain;
}
.modal::backdrop { background: rgba(8, 12, 18, 0.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal[open] { animation: modal-in .18s ease-out; }
.modal-form { display: grid; gap: 12px; padding: 12px 20px 20px; }
.modal-form > .field { margin: 0; }
.modal-form .actions { justify-content: flex-end; margin-top: 4px; }
.modal-form .reason-field { margin-top: 0; }
.modal-head { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 20px 8px; background: var(--surface); }
.modal-head .kicker { margin: 0 0 2px; }
.modal-head h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.modal-head h2.mono { font-family: var(--mono); font-size: 16px; }
.modal-head .icon-btn { flex: none; font-size: 22px; line-height: 1; }
.modal textarea { resize: vertical; min-height: 96px; }
.modal .ask-text { margin: 0; color: var(--ink); line-height: 1.5; }
.modal .ask-note { margin: 0; color: var(--muted); font-size: 13px; }
.modal .btn.danger-fill { background: var(--red); border-color: transparent; color: var(--surface); }
.modal [hidden] { display: none !important; }
body:has(dialog.modal[open]) { overflow: hidden; }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
.edit-panel { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; }
.edit-panel h2 { margin: 0 0 4px; }
.edit-panel p { margin: 0; }
.qty-input { width: 110px; text-align: right; padding: 5px 8px; font-variant-numeric: tabular-nums; }
.qty-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; margin: 12px 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); position: sticky; bottom: 8px; z-index: 5; box-shadow: 0 4px 16px rgba(16, 32, 48, 0.08); }
.qty-bar p { flex: 1 1 280px; margin: 0; }
.qty-bar .field { flex: 1 1 240px; margin: 0; }
.access-level { font-size: 13px; font-weight: 700; white-space: nowrap; }
.access-level::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.access-level.both, .access-level.edit { color: var(--ink); }
.access-level.both::before, .access-level.edit::before { background: var(--green); }
.access-level.approve { color: var(--gold); }
.access-level.approve::before { background: var(--gold); }
.access-level.view { color: var(--muted); }
.access-level.view::before { background: #9aa6b4; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.matrix th.rot { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; padding: 12px 6px; text-align: left; vertical-align: bottom; }
.matrix tr.off td { opacity: 0.55; }
.matrix tr.picked td { background: var(--picked); }
.checks { display: grid; gap: 8px; align-content: center; color: var(--ink); font-weight: 600; font-size: 14px; }
.checks label, .check-grid label { display: flex; gap: 8px; align-items: center; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 12px; font-size: 14px; }
.check-grid input:disabled + b { color: var(--muted); }
.reason-field { margin-top: 14px; }
.history-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 12px; align-items: end; margin: 0 0 16px; }
.history-filters .actions { margin: 0; }
.inline-form { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.inline-form .grow { flex: 1 1 320px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.op { display: inline-block; font-family: var(--mono); font-size: 11px; padding: 3px 8px; border-radius: 6px; margin-right: 6px; vertical-align: middle; }
.op.insert { background: var(--green-bg); color: var(--green); }
.op.update { background: var(--gold-bg); color: var(--gold); }
.op.delete, .op.restore { background: var(--red-bg); color: var(--red); }
.diff td.was { background: var(--red-bg); text-decoration: line-through; color: var(--red); }
.diff td.now { background: var(--green-bg); color: var(--green); font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .topnav-row { flex-wrap: wrap; }
  .menu-row { flex-wrap: nowrap; }
  .phase-bar { order: 0; margin: 0; width: auto; }
  .phase-nav { max-width: none; }
  .top-tools { margin-left: 0; }
  .hero, .split { grid-template-columns: 1fr; }
  .console-grid, .console-grid.wide-left, .history-filters { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  :root { --bottom-nav: calc(64px + env(safe-area-inset-bottom)); }
  html { scroll-padding-top: 118px; scroll-padding-bottom: calc(var(--bottom-nav) + 16px); }
  body { background-attachment: scroll; }
  .frame { padding: 0 12px calc(var(--bottom-nav) + 28px); }
  h1 { font-size: 28px; }
  .lede { font-size: 14px; }

  .topnav {
    position: sticky; top: 0; z-index: 30; gap: 8px;
    margin: 0 -12px; padding: calc(8px + env(safe-area-inset-top)) 18px 8px 12px;
    background: #f3f5f8; border-bottom: 1px solid var(--line);
    flex-direction: row; flex-wrap: nowrap; align-items: center; overflow: visible;
  }
  :root[data-theme="dark"] .topnav { background: #0e141c; }
  .menu-row { width: auto; flex: none; gap: 8px; align-items: center; }
  .tool-row { flex: 1 1 auto; width: auto; min-width: 0; }
  .topnav-row { flex-wrap: nowrap; gap: 8px; align-items: center; }
  .tool-row .top-tools {
    display: flex; align-items: center; flex-wrap: nowrap; gap: 8px;
    width: 100%; min-width: 0; margin-left: 0; justify-content: flex-start;
  }
  .tool-row .top-tools > .live-dot,
  .tool-row .top-tools > .bell,
  .tool-row .top-tools > .profile { flex: none; margin: 0; }
  .tool-row .top-tools > .gsearch,
  .gsearch.open { display: none; }
  .project-here { flex: 1 1 auto; max-width: none; min-width: 0; padding: 0; overflow: hidden; }
  .project-here-label, .project-here-stage { display: none; }
  .project-here .project-switch { flex: 1 1 auto; min-width: 0; width: 100%; max-width: none; }
  .project-here .project-switch select {
    display: block; box-sizing: border-box; height: 40px; min-width: 0; width: 100%; max-width: none;
    padding: 0 28px 0 12px; font-size: 15px; font-weight: 700;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .icon-btn, .gsearch-icon, .profile > .avatar { width: 40px; height: 40px; }

  .dock {
    display: none;
    position: fixed;
    z-index: 46;
    left: 10px;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
  }
  .dock-bar {
    pointer-events: auto;
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    align-items: flex-end;
    justify-content: space-around;
    gap: 2px;
    padding: 8px 6px 6px;
    border-radius: 28px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    border: 1px solid var(--line);
    box-shadow: 0 12px 40px rgba(16, 24, 40, 0.16);
    backdrop-filter: blur(16px);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .dock-bar::-webkit-scrollbar { display: none; }
  .dock-tab {
    flex: 1 0 auto;
    min-width: 64px;
    max-width: 92px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 2px 4px 0;
    color: #5c6572;
    text-decoration: none;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
  }
  .dock-tab span {
    max-width: 84px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
  }
  .dock-tab svg { width: 26px; height: 26px; fill: currentColor; stroke: none; }
  .dock-tab.on { color: #111; font-weight: 800; }
  .dock-tab.tone-overview svg { color: #1d6fbf; }
  .dock-tab.tone-sales svg { color: #0e8a4b; }
  .dock-tab.tone-budgeting svg { color: #b86e00; }
  .dock-tab.tone-procurement svg { color: #c2410c; }
  .dock-tab.tone-site svg { color: #0f766e; }
  .dock-tab.tone-billing-\&-payments svg,
  .dock-tab.tone-billing-payments svg { color: #0e7490; }
  .dock-tab.tone-site-administration svg { color: #6d28d9; }
  .dock-tab.tone-control svg { color: #1e3a8a; }
  .dock-tab.tone-report svg { color: #0369a1; }
  .dock-bar .dock-tab.on svg { color: #111; }
  .dock-plus {
    pointer-events: auto;
    flex: none;
    width: 56px;
    height: 56px;
    margin: 0 0 2px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #111;
    font-size: 34px;
    line-height: 1;
    box-shadow: 0 10px 28px rgba(16, 24, 40, 0.2);
    cursor: pointer;
  }
  .dock-plus[aria-expanded="true"] { transform: rotate(45deg); }
  .dock-pop {
    pointer-events: auto;
    position: absolute;
    right: 0;
    bottom: calc(100% + 12px);
    width: min(360px, calc(100vw - 24px));
    max-height: min(68vh, 520px);
    overflow: auto;
    padding: 8px;
    border-radius: 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: 0 18px 50px rgba(8, 12, 18, 0.28);
  }
  .dock-pop[hidden] { display: none; }
  .dock-group { padding: 4px 4px 8px; }
  .dock-group + .dock-group { border-top: 1px solid var(--line); }
  .dock-group h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 8px 4px;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink);
  }
  .dock-group h2 svg { width: 22px; height: 22px; fill: currentColor; stroke: none; flex: none; }
  .dock-group.tone-overview h2 svg { color: #1d6fbf; }
  .dock-group.tone-sales h2 svg { color: #0e8a4b; }
  .dock-group.tone-budgeting h2 svg { color: #b86e00; }
  .dock-group.tone-procurement h2 svg { color: #c2410c; }
  .dock-group.tone-site h2 svg { color: #0f766e; }
  .dock-group.tone-site-administration h2 svg { color: #6d28d9; }
  .dock-group.tone-control h2 svg { color: #1e3a8a; }
  .dock-group.tone-manual-entries h2 svg { color: #a16207; }
  .dock-group.tone-report h2 svg { color: #0369a1; }
  .dock-group.tone-financials h2 svg { color: #047857; }
  .dock-pop a {
    display: block;
    margin-left: 30px;
    padding: 12px 12px;
    border-radius: 12px;
    color: var(--ink);
    text-decoration: none;
    font-size: 16px;
    font-weight: 650;
    line-height: 1.25;
  }
  .dock-pop a.on, .dock-pop a:hover { background: var(--night); color: #fff; }
  :root[data-theme="dark"] .dock-tab.on,
  :root[data-theme="dark"] .dock-tab.on svg { color: #fff; }
  :root[data-theme="dark"] .dock-plus { background: #f4f7fb; color: #111; }

  .phase-more { display: none; }
  .phase-bar,
  .menu-row > .phase-nav {
    position: fixed; z-index: 35; left: 10px; right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: auto; margin: 0;
  }
  .phase-nav {
    flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    width: 100%; max-width: none; margin: 0; padding: 5px;
    scroll-snap-type: x proximity; overscroll-behavior-x: contain;
    scrollbar-width: none;
    box-shadow: 0 14px 34px rgba(10, 14, 20, 0.35);
  }
  .phase-bar .phase-nav { position: relative; left: auto; right: auto; bottom: auto; }
  .phase-tab { flex: none; padding: 12px 15px; scroll-snap-align: center; }
  .sub-nav {
    display: flex; flex-direction: column; margin: 10px 0 14px; padding: 6px 8px;
    border-radius: 14px;
  }
  .sub-tabs {
    display: flex; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x proximity; scrollbar-width: none; gap: 6px; min-width: 0;
  }
  .sub-tabs::-webkit-scrollbar { display: none; }
  .sub-tab { scroll-snap-align: start; padding: 9px 14px; flex: none; }
  .sub-meta { display: none; }

  .panel, .rule, .hero-card, .sub-nav, .kpi, .project-card, .sub-panel {
    -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--glass-strong);
  }
  .panel { padding: 16px; border-radius: 18px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .kpis, .cards { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .kpis, .cards { gap: 10px; }
  .kpi { padding: 14px; min-width: 0; }
  .kpi strong { font-size: clamp(14px, 4.8vw, 24px); letter-spacing: -0.03em; }
  .kpi strong, .detail-head strong, .tile strong, .totals strong, .payout-head .figure strong { overflow-wrap: anywhere; min-width: 0; }
  .form-grid, .signs, .detail-head { grid-template-columns: 1fr; }
  .figures { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 12px; }
  .figure span { font-size: 12px; }
  .figure strong { font-size: 22px; white-space: normal; overflow-wrap: anywhere; }
  .payout-head .figure strong { font-size: 26px; }
  .bar-row { grid-template-columns: 110px 1fr 48px; }
  .table-wrap table:not(.tree) td:first-child { min-width: 0; }
  table.tree td:nth-child(2) { min-width: 0; white-space: normal; }
  table { font-size: 12.5px; }
  th, td { padding: 7px 8px; }
  .so-table.lines td:nth-child(2),
  .so-table.lines:not(.pick-table) td:nth-child(2) { min-width: 0; white-space: normal; }
  .so-section .table-wrap { max-height: none; overflow-x: auto; overflow-y: visible; }
  .pick-table.fit,
  .pick-table.fit tbody { display: block; width: 100%; }
  .pick-table.fit thead { display: none; }
  .pick-table.fit tr.pick-row:not(.nb-add-row) {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) minmax(0, 1fr) 96px;
    grid-template-areas:
      "tick name name qty"
      "tick ref  ref  qty"
      "tick uom  left qty";
    column-gap: 8px;
    row-gap: 2px;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    padding: 10px 8px 12px;
    border-top: 1px solid var(--row-line);
  }
  .pick-table.fit tr.pick-row > :is(th, td),
  .pick-table.fit tr.pick-row.picked > td { background: none; }
  .pick-table.fit tr.pick-row.picked { background: color-mix(in srgb, var(--brand) 12%, transparent); }
  .pick-table.fit td.tick { grid-area: tick; align-self: start; padding-top: 3px; }
  .pick-table.fit td.ref { grid-area: ref; }
  .pick-table.fit tr.pick-row > td:nth-child(3) { grid-area: name; }
  .pick-table.fit td.uom { grid-area: uom; }
  .pick-table.fit td.left { grid-area: left; }
  .pick-table.fit td.ask { grid-area: qty; align-self: center; }
  .pick-table.fit :is(td, th) { display: block; width: auto; min-width: 0; max-width: none; padding: 0; border: 0; }
  .pick-table.fit .extra { display: none; }
  .pick-table.fit .desk { display: none; }
  .pick-table.fit .mob { display: inline; }
  .pick-table.fit .left small { display: none; }
  .pick-table.fit td.uom::before,
  .pick-table.fit td.left::before {
    color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  }
  .pick-table.fit td.uom::before { content: "Unit "; }
  .pick-table.fit td.left::before { content: "Left "; }
  .pick-table.fit td.tick input { width: 18px; min-width: 18px; padding: 0; }
  .pick-table.fit tr.pick-row .cell-input {
    min-width: 0; max-width: none; width: 100%; height: 40px; padding: 0 10px; font-size: 16px; text-align: right;
  }
  .pick-table.fit .mono { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
  .pick-table.fit .nb-toggle { display: inline-flex; align-items: center; margin: 6px 0 0; min-height: 32px; }
  .pick-table.fit tr.nb-add-row[hidden] { display: none !important; }
  .pick-table.fit tr.nb-add-row:not([hidden]) { display: block; width: 100%; padding: 0 8px 12px; border-top: 0; box-sizing: border-box; }
  .pick-table.fit tr.nb-add-row > td { display: block; width: 100%; padding: 0; background: none; }
  .pick-table.fit tr.pick-head { display: block; padding: 10px 8px; border-top: 1px solid var(--row-line); }
  .pick-table.fit tr.pick-head > td { display: block; width: auto; background: none; }

  input, select, textarea { font-size: 16px; }
  .project-switch select { font-size: 13px; }
  .btn { min-height: 42px; }
  .btn.small { min-height: 36px; }
  .tree-bar { align-items: stretch; }
  .tree-filter { width: 100%; }
  .tree-tools { flex-wrap: wrap; }
  .modal { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 24px 24px 0 0; border-bottom: 0; }
  .modal[open] { animation: sheet-up .22s ease-out; }
  .modal-form { padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .modal-form .actions { display: grid; grid-template-columns: 1fr 1.4fr; }
  .qty-bar { bottom: calc(var(--bottom-nav) + 8px); padding: 8px; flex-wrap: nowrap; align-items: center; gap: 8px; border-radius: 999px; }
  .qty-bar p, .qty-bar .field > span, .wide-only { display: none; }
  .qty-bar .field { flex: 1 1 auto; min-width: 0; }
  .qty-bar .field input { border-radius: 999px; padding: 9px 14px; }

  /* Only when open — bare .profile-menu here kept the sheet stuck open in Android WebView. */
  .profile-menu:popover-open,
  .profile.open .profile-menu {
    left: 8px; right: 8px; top: auto; bottom: calc(8px + env(safe-area-inset-bottom));
    width: auto; max-height: calc(100dvh - 24px - env(safe-area-inset-top));
    height: auto; padding: 10px; border-radius: 22px; animation: sheet-up .22s ease-out;
    display: flex; flex-direction: column; justify-content: flex-start;
  }
  .profile-menu::backdrop { background: rgba(8, 12, 18, 0.45); }
  .profile.open::before { content: ""; position: fixed; inset: 0; z-index: 55; background: rgba(8, 12, 18, 0.45); }
  body:has(.profile-menu:popover-open) { overflow: hidden; }
  .profile-menu a, .profile-menu button { padding: 12px; flex: none; }

  .login-wrap { grid-template-columns: 1fr; padding: 12px; gap: 12px; min-height: 100dvh; align-content: start; }
  .login-wrap.solo { align-content: center; }
  .login-panel { order: -1; padding: calc(12px + env(safe-area-inset-top)) 4px 4px; }
  .login-story { padding: 22px 20px; gap: 12px; }
  .login-story h1 { font-size: 26px; max-width: none; }
  .login-story::after { width: 180px; height: 180px; right: -60px; bottom: -60px; }
  .login-story .layers { margin-top: 14px; }
  .login-story > p:last-child { display: none; }
  .login-card h1 { font-size: 34px; }
}

/* ---------- Tablet portrait: roomy two-column forms, centred wider popups ---------- */
@media (min-width: 761px) and (max-width: 1180px) and (orientation: portrait) {
  .frame { padding: 16px max(22px, env(safe-area-inset-left)) 40px max(22px, env(safe-area-inset-right)); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal { width: min(640px, calc(100vw - 64px)); }
  .modal-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
  .modal-form > :not(.field), .modal-form > .field.wide, .modal-form > .field:has(textarea) { grid-column: 1 / -1; }
  .btn { min-height: 40px; }
}

/* ---------- Phone held sideways (short screen): one compact header row, no bottom bar ---------- */
@media (orientation: landscape) and (max-height: 540px) {
  :root { --bottom-nav: 0px; }
  html { scroll-padding-top: 88px; scroll-padding-bottom: 16px; }
  body { background-attachment: scroll; }
  .frame { padding: 0 max(16px, env(safe-area-inset-right)) 28px max(16px, env(safe-area-inset-left)); }
  h1 { font-size: 24px; margin-bottom: 4px; }
  .lede { font-size: 13.5px; }
  .kicker, .crumb { margin-bottom: 2px; }
  .page-head { flex-direction: row; align-items: flex-end; margin-bottom: 10px; }

  .topnav {
    position: sticky; top: 0; z-index: 30; gap: 6px;
    margin: 0 calc(-1 * max(16px, env(safe-area-inset-left))) 0 calc(-1 * max(16px, env(safe-area-inset-right)));
    padding: 6px max(16px, env(safe-area-inset-right)) 6px max(16px, env(safe-area-inset-left));
    background: var(--header-bg); border-bottom: 1px solid var(--line);
  }
  .topnav-row { flex-wrap: wrap; gap: 10px; }
  .project-here { padding: 0; }
  .project-here-stage { display: none; }
  .dock { display: none; }
  .menu-row .phase-nav, .menu-row .phase-bar { display: flex; }
  .sub-nav { display: flex; }
  .phase-bar {
    position: relative; left: auto; right: auto; bottom: auto; order: 0;
    flex: 1 1 auto; min-width: 0; width: auto; margin: 0;
  }
  .phase-nav {
    position: relative; left: auto; right: auto; bottom: auto;
    flex: 1 1 auto; flex-wrap: wrap; overflow: visible; min-width: 0; width: auto; max-width: none; margin: 0; padding: 3px; box-shadow: none;
  }
  .phase-menu { top: calc(100% + 8px); bottom: auto; }
  .phase-tab { padding: 7px 12px; font-size: 13px; }
  .top-tools { flex: 0 1 auto; min-width: 0; margin-left: 0; }
  .project-switch { flex: 0 0 auto; }
  .project-switch select { width: auto; min-width: 8rem; max-width: min(280px, 36vw); padding: 7px 28px 7px 10px; font-size: 12.5px; field-sizing: content; }

  .sub-nav { margin: 8px 0 10px; padding: 6px 8px; }
  .sub-tabs {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 6px;
  }
  .sub-tabs::-webkit-scrollbar { display: none; }
  .sub-tab { padding: 7px 12px; flex: none; }
  .sub-meta { display: none; }

  .panel, .rule, .hero-card, .sub-nav, .kpi, .project-card, .sub-panel {
    -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--glass-strong);
  }
  .panel { padding: 14px 16px; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi strong { font-size: clamp(16px, 2.6vw, 22px); overflow-wrap: anywhere; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero, .split, .split-panels { grid-template-columns: 1fr 1fr; }

  .modal { width: min(720px, calc(100vw - 32px)); max-width: calc(100vw - 32px); max-height: calc(100dvh - 16px); margin: auto; border-radius: 20px; border-bottom: 1px solid var(--line); }
  .modal[open] { animation: modal-in .18s ease-out; }
  .modal-head { padding: 12px 18px 6px; }
  .modal-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; padding: 8px 18px 14px; }
  .modal-form > :not(.field), .modal-form > .field.wide, .modal-form > .field:has(textarea) { grid-column: 1 / -1; }
  .modal textarea { min-height: 64px; }
  .modal-form .actions { display: flex; justify-content: flex-end; }

  .qty-bar { bottom: 8px; padding: 6px; flex-wrap: nowrap; align-items: center; gap: 8px; border-radius: 999px; }
  .qty-bar p, .qty-bar .field > span, .wide-only { display: none; }
  .qty-bar .field { flex: 1 1 auto; min-width: 0; }
  .qty-bar .field input { border-radius: 999px; padding: 8px 14px; }
  .profile-menu:popover-open,
  .profile.open .profile-menu {
    left: auto; right: var(--menu-right, 12px); top: var(--menu-top, 56px); bottom: auto;
    width: 280px; height: auto; max-height: calc(100dvh - var(--menu-top, 56px) - 8px);
    animation: none; display: flex; flex-direction: column; justify-content: flex-start;
  }
  .profile-menu::backdrop { background: transparent; }
  body:has(.profile-menu:popover-open) { overflow: auto; }

  .login-wrap { grid-template-columns: 1fr 1fr; min-height: 100dvh; padding: 12px max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left)); align-items: start; }
  .login-wrap.solo { grid-template-columns: 1fr; align-items: center; }
  .login-panel { order: 0; padding: 4px; }
  .login-story { padding: 20px; }
  .login-story h1 { font-size: 22px; }
  .login-story .layers, .login-story > p:last-child { display: none; }
  .login-card h1 { font-size: 28px; }
}

label.field { min-width: 0; max-width: 100%; }
label.field > select, label.field > input, label.field > textarea { min-width: 0; max-width: 100%; }

/* Site administration: the attendance register grid, laid out like the Excel sheet */
.att-grid { border-collapse: collapse; }
.att-grid th, .att-grid td { padding: 3px 5px; white-space: nowrap; }
.att-grid th.att-day { min-width: 34px; text-align: center; }
.att-grid th.att-day small { display: block; font-weight: 500; opacity: .65; }
.att-grid .att-name { position: sticky; left: 0; background: var(--surface); z-index: 2; min-width: 160px; }
.att-grid thead th.att-name { z-index: 3; }
.att-grid td.att-cell { text-align: center; padding: 1px 2px; }
.att-grid td.att-cell select, .att-grid td.att-cell input { width: 52px; min-width: 52px; padding: 3px 2px; font-size: 12px; text-align: center; border-radius: 6px; }
.att-grid td.att-cell input { width: 44px; min-width: 44px; }
.att-grid th.sun, .att-grid td.sun:not(.mark-p):not(.mark-off) { background: color-mix(in srgb, #e11d48 32%, var(--surface)); color: #e11d48; }
.att-grid td.mark-p, .att-grid td.mark-p select { background: #1f7a45; color: #fff; border-color: #1f7a45; font-weight: 700; }
.att-grid td.mark-off, .att-grid td.mark-off select { background: #b42318; color: #fff; border-color: #b42318; font-weight: 700; }
.att-key { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.att-key i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.att-key i.mark-p { background: #1f7a45; }
.att-key i.mark-off { background: #b42318; }
.att-key i.sun { background: color-mix(in srgb, #e11d48 32%, var(--surface)); box-shadow: inset 0 0 0 1px #e11d48; }
.att-bar.is-sun small { color: var(--red); font-weight: 700; }
[data-ot-all] label.check { margin: 0 0 10px; }
.att-grid .att-total td { border-top: 2px solid var(--line); font-weight: 600; }
.att-grid td.past select, .att-grid td.past input { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-2) 45%, transparent); }
.att-grid + .actions, form > .actions { margin-top: 12px; display: flex; justify-content: flex-end; }
.invoice-paper { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px 32px 20px; display: grid; gap: 14px; }
.invoice-paper .inv-title { text-align: center; letter-spacing: .28em; margin: 0; font-size: 22px; }
.inv-top { display: grid; grid-template-columns: 1.4fr .8fr; border: 1px solid var(--line); }
.inv-who, .inv-meta, .inv-bank > div { display: grid; gap: 8px; padding: 12px 14px; }
.inv-meta { border-left: 1px solid var(--line); }
.invoice-paper label { display: grid; gap: 4px; font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--muted); }
.invoice-paper label input, .invoice-paper label textarea, .invoice-paper label select { font-weight: 500; letter-spacing: 0; color: var(--ink); }
.inv-to { white-space: pre-line; margin: 0; }
.inv-lines { width: 100%; border-collapse: collapse; }
.inv-lines th, .inv-lines td { border: 1px solid var(--line); padding: 8px 10px; vertical-align: top; }
.inv-lines .num { width: 180px; text-align: right; white-space: nowrap; }
.inv-lines input { text-align: right; }
.inv-words { margin: 0; font-weight: 600; }
.inv-math { margin: 0; }
.inv-att-title { margin: 8px 0 0; font-size: 13px; letter-spacing: .04em; }
.inv-bank { display: grid; grid-template-columns: 1.4fr .6fr; border: 1px solid var(--line); }
.inv-sign { border-left: 1px solid var(--line); display: grid; align-content: space-between; padding: 12px 14px; min-height: 120px; }
.inv-roles { display: flex; justify-content: space-between; gap: 24px; padding: 8px 12px 0; font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
@media (max-width: 800px) {
  .inv-top, .inv-bank { grid-template-columns: 1fr; }
  .inv-meta, .inv-sign { border-left: 0; border-top: 1px solid var(--line); }
  .invoice-paper { padding: 16px; }
}
.att-people { display: grid; gap: 6px; }
.att-person { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr) 32px; align-items: center; gap: 8px; min-width: 0; }
.att-person a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.att-person i { display: block; height: 12px; width: var(--h); max-width: 100%; min-width: 2px; border-radius: 4px; background: color-mix(in srgb, var(--brand-2) 72%, var(--surface)); }
.att-person b { text-align: right; font-variant-numeric: tabular-nums; }
.pdf-preview { width: 100%; height: calc(100dvh - 210px); min-height: 520px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.att-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; max-width: 640px; }
.att-cal > span { font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; }
.att-cal > span.sun { color: var(--red); }
.att-tile, .att-cal > i.pad { aspect-ratio: 1.05; border-radius: 10px; min-width: 0; }
.att-cal > i.pad { display: block; }
.att-tile { display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; border: 0; padding: 6px 8px 8px; background: #e8f1fb; color: #1e3a5f; cursor: default; font: inherit; text-align: left; }
.att-tile span { font-size: 12px; font-weight: 700; line-height: 1; }
.att-tile b { font-size: clamp(15px, 2.4vw, 22px); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; text-align: right; }
.att-tile.lv-0 { background: #f3f6fb; color: #94a3b8; }
.att-tile.lv-1 { background: #e7f0fb; }
.att-tile.lv-2 { background: #d3e4f8; }
.att-tile.lv-3 { background: #a9cdf3; }
.att-tile.lv-4 { background: #5b96e6; color: #fff; }
.att-tile.is-today { box-shadow: inset 0 0 0 2px #1d4ed8; }
.att-tile.is-ahead { background: #f8fafc; color: #94a3b8; }
.sheet .att-doc { max-width: none; margin: 0 0 6px; gap: 3px; }
.sheet .att-doc > span { font-size: 9px; line-height: 1; }
.sheet .att-doc .att-tile, .sheet .att-doc > i.pad { aspect-ratio: auto; height: 34px; border-radius: 6px; padding: 3px 4px; }
.sheet .att-doc .att-tile span { font-size: 9px; }
.sheet .att-doc .att-tile b { font-size: 11px; }
.sheet .doc-days { table-layout: fixed; width: 100%; font-size: 7.5px; }
.sheet .doc-days th, .sheet .doc-days td { padding: 2px 0; text-align: center; line-height: 1.15; letter-spacing: 0; text-transform: none; white-space: nowrap; overflow: hidden; }
.sheet .doc-days .name { width: 108px; text-align: left; padding-left: 4px; font-size: 8.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet .doc-days .num { width: 22px; font-weight: 800; }
.sheet .doc-days th.sun, .sheet .doc-days td.sun { background: #f8e8e8; color: #8a2424; }
.sheet .doc-days td.p { background: #d6e6fa; font-weight: 800; color: #1e3a5f; }
.sheet .doc-days td.off { color: #5a6575; }
.sheet .doc-days td.pl, .sheet .doc-days td.co, .sheet .doc-days td.ph { background: #f8e7c4; color: #7a5410; font-weight: 700; }
.sheet .doc-days td.lop { background: #f8d4d4; color: #8a2424; font-weight: 700; }
.att-legend { margin: 0 0 8px; font-size: 10px; color: #5a6575; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.att-legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.att-legend i.lv-1 { background: #e7f0fb; }
.att-legend i.lv-2 { background: #d3e4f8; }
.att-legend i.lv-4 { background: #5b96e6; }
.sheet .att-tile.mark-p { background: #5b96e6; color: #fff; }
.sheet .att-tile.mark-off, .att-legend i.mark-off { background: #e7eef6; color: #3b4656; }
.sheet .att-tile.mark-pl, .sheet .att-tile.mark-co, .sheet .att-tile.mark-ph, .att-legend i.mark-pl { background: #f8e7c4; color: #7a5410; }
.sheet .att-tile.mark-lop, .att-legend i.mark-lop { background: #f8d4d4; color: #8a2424; }
.sheet .att-tile.mark-empty { background: #f3f6fb; color: #94a3b8; }
.sheet .att-tile.mark-ahead { background: #f8fafc; color: #94a3b8; }
.att-legend i.mark-p { background: #5b96e6; }
.att-bars { display: flex; align-items: flex-end; gap: 3px; height: 148px; overflow-x: auto; padding: 4px 2px 0; }
.att-bar { flex: 1 0 16px; max-width: 28px; min-width: 16px; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; }
.att-bar small { font-size: 10px; line-height: 1; color: var(--muted); }
.att-bar i { display: block; width: 100%; height: var(--h); min-height: 2px; border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--brand-2) 72%, var(--surface)); }
.att-bar.is-today i { background: var(--brand-2); }
.att-bar.is-today small { color: var(--ink); font-weight: 700; }
.att-punches { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.att-punches li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }

/* Touch screens: no sticky hover effects */
@media (hover: none) {
  .project-card:hover { transform: none; }
}

/* Phones, landscape phones and tablets: 16px fields stop iOS zooming on focus; fingers need 32px+ targets */
@media (max-width: 760px), (pointer: coarse), (orientation: landscape) and (max-height: 540px), (max-width: 1180px) and (orientation: portrait) {
  input, select, textarea, .tree-filter, .qty-input,
  .row-actions .inline-form input, .row-actions .inline-form select { font-size: 16px; }
  .project-switch select { font-size: 13px; }
  .tree-toggle { width: 32px; height: 32px; }
  .qty-input { min-height: 36px; }
  .profile-menu .seg button { min-height: 36px; padding: 8px 13px; font-size: 13px; }
}

/* ---------- Document status bar and linked-document buttons ---------- */
.docbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 0 0 14px; min-width: 0; max-width: 100%; }
.docbar > * { min-width: 0; max-width: 100%; }
.steps { flex: 1 1 440px; min-width: 0; max-width: 100%; margin: 0; padding: 14px 16px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.steps ol { display: flex; margin: 0; padding: 2px 0 0; list-style: none; overflow-x: auto; scrollbar-width: none; }
.steps ol::-webkit-scrollbar { display: none; }
.steps li { position: relative; flex: 1 1 0; min-width: 0; padding: 0 2px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.steps li + li::before { content: ""; position: absolute; top: 13px; left: calc(-50% + 18px); right: calc(50% + 18px); height: 3px; border-radius: 3px; background: var(--line-strong); }
.steps li.done + li::before { background: var(--brand-2); }
.steps li i { display: grid; place-items: center; width: 28px; height: 28px; box-sizing: border-box; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); color: var(--muted); font-style: normal; font-size: 13px; font-weight: 800; }
.steps li.done { color: var(--ink); }
.steps li.done i { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.steps li.now { color: var(--ink); }
.steps li.now i { background: var(--night); border-color: var(--brand-2); color: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-2) 28%, transparent); }
.steps li span { display: flex; flex-direction: column; align-items: center; gap: 3px; line-height: 1.25; max-width: 100%; overflow-wrap: anywhere; }
.steps li em { padding: 1px 7px; border-radius: 999px; background: var(--blue-bg); color: var(--blue); font-style: normal; font-size: 10.5px; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase; }
.steps.stopped li.now i { background: var(--red); border-color: var(--red); box-shadow: none; }
.steps.stopped li.now { color: var(--red); }
.steps-note { margin: 12px 0 0; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13.5px; line-height: 1.45; color: var(--ink); }
.steps.stopped .steps-note b { color: var(--red); }
.steps.stopped > .steps-note:only-child { margin: 0; padding: 0; border: 0; }
.tracker { position: relative; margin: 14px 0 6px; min-width: 0; max-width: 100%; }
.tracker ol { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; }
.tracker li { display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 0; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.tracker li span { display: block; max-width: 100%; line-height: 1.25; overflow-wrap: anywhere; }
.tracker li i { flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 3px solid var(--line-strong); box-sizing: border-box; }
.tracker li.done i { background: var(--brand-2); border-color: var(--brand-2); }
.tracker li.done { color: var(--ink); }
.tracker li.now i { background: var(--night); border-color: var(--brand-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-2) 30%, transparent); }
.tracker li.now { color: var(--ink); }
.tracker::before, .tracker-fill { content: ""; position: absolute; top: 7px; left: 10%; height: 4px; border-radius: 4px; z-index: 0; }
.tracker::before { width: 80%; background: var(--line); }
.tracker-fill { width: calc(80% * var(--done) / 100); background: var(--brand-2); }
.tracker-note { margin: 12px 0 0; font-size: 13.5px; }
/* In a table the five stage names used to spill onto the document number. Dots stay on one line; the current stage sits under them. */
.tracker.compact { margin: 0; width: 168px; max-width: 100%; }
.tracker.compact li { gap: 0; }
.tracker.compact li span { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.tracker.compact li i { width: 10px; height: 10px; border-width: 2px; }
.tracker.compact li.now i { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 28%, transparent); }
.tracker.compact::before, .tracker.compact .tracker-fill { top: 4px; height: 2px; }
.tracker-now { margin: 6px 0 0; text-align: center; font-size: 11px; font-weight: 700; line-height: 1.25; color: var(--ink); overflow-wrap: anywhere; }
td:has(.tracker.compact) { min-width: 180px; }
.tracker.cancelled span { display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: var(--red); background: var(--red-bg); }
.tracker.cancelled::before { display: none; }
@media (max-width: 760px) {
  .tracker:not(.compact) li { font-size: 11px; gap: 5px; }
  .tracker:not(.compact) li i { width: 14px; height: 14px; border-width: 2px; }
  .tracker:not(.compact)::before, .tracker:not(.compact) .tracker-fill { top: 5px; height: 3px; }
}
.arrival-grid input { max-width: 110px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.worker-edit-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; padding: 12px 20px 20px; text-align: left; }
.worker-edit-body .wage-history { grid-column: 1 / -1; padding-top: 12px; border-top: 1px solid var(--line); }
@media (min-width: 720px) { .modal:has(.worker-edit-body) { width: min(720px, calc(100vw - 64px)); } }
.worker-edit-body h3 { margin: 0 0 8px; font-size: 14px; }
.wage-history ul { margin: 0; padding-left: 16px; font-size: 13px; display: grid; gap: 4px; }
.po-totals { display: grid; gap: 4px; max-width: 340px; margin: 14px 0 0 auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.po-totals div { display: flex; justify-content: space-between; gap: 16px; font-size: 13.5px; }
.po-totals dt { color: var(--muted); }
.po-totals dd { margin: 0; font-variant-numeric: tabular-nums; }
.po-totals .grand { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line); font-weight: 800; font-size: 15px; }
.po-totals .grand dt { color: var(--ink); }
.grn-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.grn-head h2 { margin: 0; }
.smart-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.smart { display: inline-flex; align-items: baseline; gap: 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; font-size: 13px; }
.smart strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.smart span { color: var(--muted); font-weight: 600; }
a.smart:hover { border-color: var(--line-strong); background: var(--hover); }
.progress-cell { font-variant-numeric: tabular-nums; }
.progress-cell .muted { font-size: 12px; }
@media (max-width: 760px) {
  .docbar { flex-direction: column; align-items: stretch; }
  .steps { flex-basis: auto; padding: 12px 8px 10px; }
  .steps li { font-size: 11px; }
  .steps li em { font-size: 9.5px; padding: 1px 5px; }
  .steps-note { font-size: 13px; padding-inline: 6px; }
}

/* ---------- Toasts ---------- */
.content:focus { outline: none; }
.toasts {
  position: fixed; z-index: 90; top: calc(8px + env(safe-area-inset-top)); left: 0; right: 0; margin: 0 auto; padding: 30px 0 0; border: 0; background: transparent; overflow: visible;
  display: grid; align-items: start; width: min(420px, calc(100vw - 20px)); pointer-events: none;
}
.toasts.open { display: flex; flex-direction: column; gap: 8px; pointer-events: auto; }
.toast {
  grid-area: 1 / 1; pointer-events: auto; position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 12px 36px 12px 14px;
  border: 1px solid rgba(255, 255, 255, .55); border-radius: 22px;
  background: #f6f6f8;
  color: #111418; box-shadow: 0 10px 34px rgba(8, 12, 18, .22), 0 1px 2px rgba(8, 12, 18, .08);
  transform-origin: 50% 0; transition: transform .28s cubic-bezier(.2, .8, .2, 1), opacity .22s ease;
  animation: toast-fade .22s ease-out;
}
[data-theme="dark"] .toast { background: #2c3038; border-color: rgba(255, 255, 255, .08); color: #f3f5f8; }
.toasts:not(.open) .toast[data-depth="1"] { transform: translateY(-13px) scale(.95); opacity: .92; }
.toasts:not(.open) .toast[data-depth="2"] { transform: translateY(-25px) scale(.9); opacity: .8; }
.toasts:not(.open) .toast[data-depth="3"] { transform: translateY(-25px) scale(.9); opacity: 0; pointer-events: none; }
.toasts:not(.open) .toast:not([data-depth="0"]) > * { visibility: hidden; }
.toasts.open .toast { grid-area: auto; transform: none; }
.toast .n-icon {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; overflow: hidden;
  color: #fff; font-size: 20px; font-weight: 800; line-height: 1; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}
.toast .n-icon img { width: 100%; height: 100%; object-fit: cover; background: #fff; }
.toast.ok .n-icon { background: linear-gradient(160deg, #34c759, #1f9d48); }
.toast.warn .n-icon { background: linear-gradient(160deg, #ffb340, #e08a00); }
.toast.error .n-icon { background: linear-gradient(160deg, #ff5f57, #d93a32); }
.toast.info .n-icon { background: linear-gradient(160deg, #4aa3ff, #1d6fe0); }
.toast .n-body { flex: 1; min-width: 0; }
.toast .n-head { display: flex; align-items: baseline; gap: 10px; }
.toast .n-head b { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.toast .n-head time { flex: none; font-size: 13px; opacity: .55; }
.toast .n-body p { margin: 2px 0 0; font-size: 14px; line-height: 1.38; opacity: .88; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.toast.link { cursor: pointer; }
.toast .n-close {
  position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(120, 124, 132, .9); color: #fff; font-size: 14px; line-height: 1; cursor: pointer; opacity: .9;
}
.toast.gone { opacity: 0; transform: translateY(-10px) scale(.97); }
.alert-switches { display: grid; gap: 4px; margin-top: 8px; }
.switch-row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch-row input { flex: none; appearance: none; width: 42px; height: 24px; margin: 2px 0 0; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .15s ease; }
.switch-row input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s ease; }
.switch-row input:checked { background: var(--lime-deep); }
.switch-row input:checked::after { transform: translateX(18px); }
.switch-row input:focus-visible { outline: 2px solid var(--lime-deep); outline-offset: 2px; }
.switch-row span { display: grid; gap: 2px; }
.switch-row small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.notif-ask { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--line); border-left: 4px solid var(--lime-deep); border-radius: 14px; background: var(--surface); }
.notif-ask[hidden] { display: none; }
.notif-ask .notif-bell { font-size: 22px; line-height: 1; }
.notif-ask div { flex: 1; min-width: 0; }
.notif-ask b { display: block; font-size: 14px; }
.notif-ask p { margin: 2px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.wa-qr { display: inline-block; padding: 12px; border-radius: 12px; background: #fff; line-height: 0; }
.wa-qr svg { width: 260px; height: 260px; }
.alert-device { margin-top: 14px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 12px; }
.alert-device p { margin: 0 0 8px; }

/* Post-login: install app + allow closed-app banners */
.app-setup {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px 18px;
  margin: 0 0 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f6f9fc 100%);
  box-shadow: 0 1px 2px rgba(13, 37, 70, 0.04), 0 10px 28px rgba(13, 37, 70, 0.05);
}
.app-setup[hidden] { display: none !important; }
.app-setup-copy { flex: 1 1 220px; min-width: 0; }
.app-setup-copy b { display: block; font-size: 15px; letter-spacing: -0.01em; color: var(--ink); }
.app-setup-copy p { margin: 6px 0 0; font-size: 13px; line-height: 1.45; color: var(--muted); }
.app-setup-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.app-setup-hint { flex: 1 1 100%; margin: 0; }
.flash-inline.warn { padding: 8px 12px; border-left: 4px solid var(--gold); border-radius: 8px; background: rgba(217, 119, 6, .08); }
@keyframes toast-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(.97); } to { opacity: 1; transform: none; } }
@media (max-width: 760px) {
  .toasts { top: auto; bottom: calc(var(--bottom-nav) + 12px); }
  .toasts.open { flex-direction: column-reverse; }
  .toast.gone { transform: translateY(10px) scale(.97); }
}

/* ---------- Notifications ---------- */
.icon-btn.bell.on { background: var(--surface); }
.btn.danger-fill { background: var(--red); border-color: transparent; color: var(--surface); }
.nf-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; margin: 0 0 14px; }
.nf-seg { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.nf-seg::-webkit-scrollbar { display: none; }
.nf-seg button {
  display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 7px 13px; border: 0; border-radius: 999px;
  background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.nf-seg button:hover { color: var(--ink); }
.nf-seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.nf-seg b { font-size: 12px; opacity: .75; font-variant-numeric: tabular-nums; }
.nf { --nf-red: #d93b42; --nf-amber: #c98500; }
.nf-block { margin: 0 0 18px; }
.nf-head {
  display: flex; align-items: baseline; gap: 8px;
  margin: 0 0 8px; font-size: 13px; font-weight: 750; color: var(--muted); letter-spacing: .01em;
}
.nf-head b { font-variant-numeric: tabular-nums; color: var(--ink); }
.nf-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.nf-urgent { border-color: color-mix(in srgb, var(--nf-red) 28%, var(--line)); }
.nf-item { border-top: 1px solid var(--line); }
.nf-item:first-child { border-top: 0; }
.nf-item[hidden] { display: none; }
.nf-item.unread .nf-row { background: color-mix(in srgb, var(--picked) 55%, transparent); }
.nf-item.open .nf-row { background: var(--surface-2); }
.nf-row {
  display: flex; align-items: center; gap: 4px; min-width: 0;
}
.nf-main {
  flex: 1; min-width: 0; display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center; gap: 12px; padding: 12px 8px 12px 14px;
  color: inherit; text-decoration: none;
}
.nf-main:hover { background: transparent; }
.nf-row:hover { background: var(--surface-2); }
.nf-avatar {
  width: 36px; height: 36px; font-size: 12px; box-shadow: none;
  text-transform: uppercase; letter-spacing: .02em;
}
.nf-body { display: grid; gap: 2px; min-width: 0; }
.nf-line {
  font-size: 14px; line-height: 1.35; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nf-who, .nf-proj, .nf-action { font-weight: 750; }
.nf-doc {
  font-family: var(--mono); font-weight: 700; font-size: 13px;
  letter-spacing: .01em;
}
.nf-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  color: var(--muted); font-size: 12px; line-height: 1.3;
}
.nf-flag {
  flex: none; display: grid; place-items: center;
  width: 28px; height: 28px; margin-right: 4px; border-radius: 8px;
}
.nf-flag.high { color: var(--nf-red); background: color-mix(in srgb, var(--nf-red) 12%, transparent); }
.nf-flag.med { color: var(--nf-amber); background: color-mix(in srgb, var(--nf-amber) 14%, transparent); }
.nf-flag svg { display: block; }
.nf-more-btn {
  flex: none; margin-right: 6px; padding: 5px 9px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface); color: var(--muted);
  font: inherit; font-size: 11px; font-weight: 700; cursor: pointer;
}
.nf-more-btn:hover, .nf-item.open .nf-more-btn { color: var(--ink); border-color: var(--ink); }
.nf-more {
  padding: 0 14px 12px 62px; color: var(--ink); font-size: 13px; line-height: 1.45;
}
.nf-more p { margin: 0 0 8px; color: var(--muted); }
.nf-open {
  display: inline-flex; font-size: 12.5px; font-weight: 700; color: var(--brand, #1d4ed8);
  text-decoration: none;
}
.nf-open:hover { text-decoration: underline; }
.nf-item.done .nf-line, .nf-item.done .nf-who { color: var(--muted); }
.nf-item form { flex: none; display: grid; place-items: center; margin: 0 10px 0 0; }
.nf-x { width: 28px; height: 28px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.nf-x:hover { background: var(--surface-3); color: var(--ink); }
.nf-none { padding: 20px 14px; color: var(--muted); text-align: center; font-size: 14px; }
.nf-closed { margin-top: 8px; }
.nf-closed summary { cursor: pointer; margin-bottom: 10px; color: var(--muted); font-size: 13px; font-weight: 700; }
.nf-closed summary b { margin-left: 4px; }
@media (max-width: 760px) {
  .nf-main { grid-template-columns: 32px minmax(0, 1fr); gap: 10px; padding: 11px 6px 11px 12px; }
  .nf-avatar { width: 32px; height: 32px; font-size: 11px; }
  .nf-more { padding-left: 54px; }
  .nf-line { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}

/* ---------- Sales order breakup ---------- */
.split-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.split-part { border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 14px; padding: 12px 14px; background: var(--surface); min-width: 0; }
.split-part span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
.split-part strong { display: block; margin: 6px 0 2px; font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.split-part small { color: var(--muted); font-size: 12px; }
.split-part.supply { border-left-color: var(--brand); }
.split-part.install { border-left-color: var(--brand-2); }
.split-part.cost { border-left-color: var(--muted); }
.split-part.margin { border-left-color: var(--green); }
.split-part.margin strong { color: var(--green); }
.split-part.margin.loss { border-left-color: var(--red); }
.split-part.margin.loss strong { color: var(--red); }
.split-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; margin: 12px 0 4px; background: var(--surface-2); }
.split-bar .supply { background: var(--brand); }
.split-bar .install { background: var(--brand-2); }
.split-sums { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; margin: 10px 0 0; font-size: 13px; }
.split-sums div { display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: space-between; border-top: 1px dashed var(--line); padding-top: 6px; }
.split-sums dt { color: var(--muted); font-weight: 700; }
.split-sums dd { margin: 0; font-variant-numeric: tabular-nums; }
.split-gap { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.split-gap form { display: inline; }
.so-table td.ref, .so-table th.ref { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; width: 1%; }
.so-table td.num { white-space: nowrap; }
.so-table .neg { color: var(--red); }
.so-table tfoot td { font-weight: 800; border-top: 2px solid var(--line); background: var(--surface-2); }
.so-table.lines { font-size: 13px; }
.so-table.lines td, .so-table.lines th { padding: 9px 10px; }
.so-table.lines:not(.pick-table) td:nth-child(2) { min-width: 240px; }
@media (max-width: 760px) {
  .so-table.lines:not(.pick-table) td:nth-child(2) { min-width: 0; white-space: normal; }
  .so-table.stack { display: block; font-size: 12.5px; }
  .so-table.stack thead { display: none; }
  .so-table.stack tbody, .so-table.stack tfoot { display: block; }
  .so-table.stack tr { display: block; border-top: 1px solid var(--row-line); }
  .so-table.stack tbody tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; padding: 10px 10px 12px;
  }
  .so-table.stack td {
    display: block; width: auto; min-width: 0; padding: 0; border: 0; white-space: normal; text-align: left;
  }
  .so-table.stack tbody td:nth-child(1),
  .so-table.stack tbody td:nth-child(2) { grid-column: 1 / -1; }
  .so-table.stack tbody td:nth-child(n+3)::before {
    content: ""; display: block; margin-bottom: 1px; font-size: 10px; font-weight: 700; letter-spacing: .02em;
    text-transform: uppercase; color: var(--muted);
  }
  .so-table.stack tbody td:nth-child(3)::before { content: "Unit"; }
  .so-table.stack tbody td:nth-child(4)::before { content: "Quantity"; }
  .so-table.stack tbody td:nth-child(5)::before { content: "Supply rate"; }
  .so-table.stack tbody td:nth-child(6)::before { content: "Installation rate"; }
  .so-table.stack tbody td:nth-child(7)::before { content: "Supply amount"; }
  .so-table.stack tbody td:nth-child(8)::before { content: "Installation amount"; }
  .so-table.stack tbody td:nth-child(9)::before { content: "Total"; }
  .so-table.stack tbody td:nth-child(10) { grid-column: 1 / -1; }
  .so-table.stack tbody td:nth-child(10)::before { content: none; }
  .so-table.stack .cell-input { min-width: 0; max-width: none; width: 100%; text-align: left; }
  .so-table.stack tfoot tr { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: flex-end; padding: 10px; background: var(--surface-2); }
  .so-table.stack tfoot td { width: auto; font-weight: 800; }
  .so-table.stack tfoot td:empty { display: none; }
  .so-section .table-wrap:has(.so-table.stack) { max-height: none; overflow: visible; }
}
small.block { display: block; font-weight: 500; font-size: 11px; }
.so-lines { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.so-lines > .so-section { min-width: 0; }
.so-section { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.so-section > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 12px 14px; cursor: pointer; list-style: none; }
.so-section > summary::-webkit-details-marker { display: none; }
.so-section > summary::before { content: "▸"; color: var(--muted); transition: transform .15s ease; }
.so-section[open] > summary::before { transform: rotate(90deg); }
.so-section > summary .ref { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.so-section > summary .name { font-weight: 700; flex: 1 1 240px; min-width: 0; }
.so-section > summary .figs { display: flex; gap: 12px; align-items: baseline; margin-left: auto; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.so-section > summary .figs strong { color: var(--ink); font-size: 14px; }
.so-section > summary .figs .neg { color: var(--red); }
.so-section .table-wrap { border: 0; border-top: 1px solid var(--line); border-radius: 0 0 14px 14px; }
.split-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 14px; }
.pct-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-bottom: 6px; }
.pct-bar form { margin: 0; }
.pct-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-right: 6px; }
.pct-form .field { margin: 0; width: 190px; }
.so-table .pct-cell { display: flex; gap: 6px; justify-content: flex-end; align-items: center; margin: 0; }
.so-table .pct-cell .cell-input { min-width: 64px; max-width: 76px; }
.so-table .pct-cell .cell-input.own { border-color: var(--brand); font-weight: 700; }
.split-part.total { border-left-color: var(--ink); }
.so-table .cell-input { width: 100%; min-width: 84px; max-width: 130px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font: inherit; text-align: right; font-variant-numeric: tabular-nums; }
.so-table .cell-input:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
.so-table tr:has(.cell-input:focus) td { background: var(--surface-2); }
.so-table td form { margin: 0; }
.so-table .sub-row td { color: var(--muted); font-size: 12px; background: var(--surface-2); }
.so-table th.group-head { text-align: center; border-bottom: 1px solid var(--line); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
tr.flash-row td { animation: live-new 2.4s ease-out; }
.formula { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 6px 18px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 13px; }
.formula li { border-top: 1px dashed var(--line); padding-top: 6px; }
.formula b { font-weight: 700; }
.sum-line { margin: 0; font-size: 14px; color: var(--muted); }
.sum-line strong { color: var(--ink); font-variant-numeric: tabular-nums; }
@media (max-width: 1080px) { .split-grid, .split-grid.three, .split-grid.five { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .split-grid, .split-grid.three, .split-grid.five, .split-sums { grid-template-columns: 1fr; }
  .so-section > summary { flex-wrap: wrap; }
  .so-section > summary .figs { width: 100%; justify-content: space-between; }
}

/* ---------- Material request cart ---------- */
.price-fund { margin: 12px 0 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.price-fund h3 { margin: 0 0 8px; font-size: 14px; }
.price-fund p { margin: 8px 0 0; font-size: 13px; }
.price-sum { margin: 10px 0 0; font-size: 14px; font-weight: 700; }
.price-sum.neg { color: var(--red); }

/* Material request: tick rows, type the quantity, send from the bar at the bottom. */
.pick-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 12px; }
.pick-tools input[type="search"] {
  flex: 1 1 260px; min-width: 0; padding: 10px 16px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 14px;
}
.pick-tools .group-actions { margin-left: auto; display: flex; gap: 6px; }
.pick-table .mob { display: none; }
.pick-table th.tick, .pick-table td.tick { width: 1%; padding-right: 0; }
.pick-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.pick-table .pick-row { cursor: pointer; }
.pick-table .pick-row.out { cursor: default; opacity: .62; }
.pick-table .pick-row.picked td { background: var(--hover); }
.pick-table .qty-cell { min-width: 110px; }
.pick-table .cell-input:disabled { background: var(--surface-2); color: var(--muted); border-style: dashed; }
.pick-table .cell-input.bad { border-color: var(--red); outline: 1px solid var(--red); }
.pick-table tbody.pick-product + tbody.pick-product tr:first-child td { border-top: 2px solid var(--line); }
.pick-table .pick-head td { background: var(--surface-2); }
.pick-table .pick-nb td { padding-top: 4px; padding-bottom: 8px; }
.nb-toggle { margin-left: 6px; padding: 2px 8px; border: 1px dashed var(--line); border-radius: 999px; background: none; color: var(--muted); font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.nb-toggle:hover, .nb-toggle[aria-expanded="true"] { color: var(--brand); border-color: var(--brand); }
.pick-nb-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 12px; }
.pick-nb-bar .fund-meter { flex: 0 1 260px; margin: 0; }
.pick-section > summary [data-pick-count] { color: var(--brand); font-weight: 800; }
.pick-help { margin: 12px 4px; font-size: 13px; }
.send-bar {
  position: static; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px;
  margin: 28px 0 12px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface);
}
.send-where { flex: 1 1 100%; margin: 0; color: var(--muted); font-size: 13px; }
.send-bar .field { margin: 0; flex: 0 1 200px; }
.send-picked { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0 0 8px; list-style: none; max-height: 96px; overflow-y: auto; border-bottom: 1px solid var(--line); }
.send-picked li { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); font-size: 12px; overflow: hidden; }
.send-picked li.bad { border-color: var(--red); }
.send-picked button { border: 0; background: none; color: var(--ink); font: inherit; cursor: pointer; padding: 5px 4px 5px 10px; display: inline-flex; gap: 6px; align-items: baseline; }
.send-picked button span { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.send-picked li.bad strong { color: var(--red); }
.send-picked button[data-pick-drop] { padding: 5px 10px 5px 6px; color: var(--muted); font-size: 15px; line-height: 1; }
.send-picked button[data-pick-drop]:hover { color: var(--red); }
.send-picked li.new { border-style: dashed; border-color: var(--brand); }
.pick-total { font-size: 14px; white-space: nowrap; }
.review-kpis { margin-bottom: 16px; }
.review-steps { margin: 0; padding-left: 20px; display: grid; gap: 10px; }
.review-steps .block, .review-table .block { display: block; }
.review-note { margin: 0 0 12px; }
.review-lines .so-section { margin-bottom: 12px; }
.review-table .review-context td { color: var(--muted); }
.review-table .review-new td { background: var(--gold-bg); }
.review-total { display: flex; justify-content: flex-end; gap: 24px; margin: 4px 0 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; }
.review-send { position: static; display: flex; justify-content: flex-end; gap: 10px; padding: 12px 0 8px; margin-top: 8px; }
.review-qty { width: 96px; text-align: right; }
.review-qty.bad { border-color: var(--red); }
.po-charges { margin-top: 16px; }
.po-charges input.bad { border-color: var(--red); }
.po-charges .field small { display: block; margin-top: 4px; }
.po-charges .gst-cell select { width: 108px; height: 36px; padding: 0 8px; }
.po-charges .gst-cell input[data-gst-other-input] { display: block; width: 88px; margin-top: 6px; height: 36px; }
.po-charges .gst-cell input[data-gst-other-input][hidden] { display: none; }
.ask-line { display: flex; align-items: center; gap: 6px; }
.ask-line .cell-input { flex: 1 1 auto; min-width: 0; }
.line-clear, .review-drop { border: 0; background: none; color: var(--muted); cursor: pointer; font-weight: 650; white-space: nowrap; }
.line-clear:hover, .review-drop:hover { color: var(--red); }
td .nb-uom[hidden] { display: none; }
[data-nb-form] td select, [data-nb-form] td .nb-uom { display: block; width: 100%; margin-top: 6px; }
[data-nb-form] td select { margin-top: 0; }
form[data-review-edit] { margin-top: 16px; }
.cart-view { display: grid; gap: 12px; padding: 8px 20px 20px; }
.cart-view .actions { justify-content: flex-end; margin: 0; }
.cart-sum { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.cart-table td { vertical-align: top; }
.cart-table .cart-name { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.cart-table .cart-input, .cart-table .cell-input { width: 90px; }
.cart-tag { padding: 1px 8px; border-radius: 999px; background: var(--green-bg); color: var(--green); font-size: 11px; font-weight: 700; }
.cart-tag.new { background: var(--gold-bg); color: var(--gold); }
.cart-table tr.cart-new td { background: color-mix(in srgb, var(--gold-bg) 35%, transparent); }
.send-picked button[data-new-drop] { padding: 5px 10px 5px 6px; color: var(--muted); font-size: 15px; line-height: 1; }
.send-picked button[data-new-drop]:hover { color: var(--red); }
.nb-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.nb-add input { flex: 1 1 200px; min-width: 0; }
.nb-add input[data-nb-qty] { flex: 0 1 170px; }
.nb-add input.bad { border-color: var(--red); }
.nb-new { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; padding: 0; list-style: none; }
.nb-new li { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border: 1px dashed var(--brand); border-radius: 999px; font-size: 12px; }
.nb-new button { border: 0; background: none; color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer; padding: 0 6px; }
.nb-new button:hover { color: var(--red); }
.send-bar .send-note { flex: 1 1 240px; }
.send-count { flex: 0 1 auto; align-self: center; display: flex; flex-direction: column; gap: 2px; font-size: 14px; min-width: 90px; }
.send-warn { color: var(--red); font-size: 12px; font-weight: 700; max-width: 260px; }
.send-actions { display: flex; gap: 8px; margin-left: auto; }
.send-bar .btn:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 760px) {
  /* In the page flow, under the list. A sticky dock was covering the rows on a phone. */
  .send-bar {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    align-items: center;
    gap: 6px 8px;
    margin: 12px 0 4px;
    padding: 8px 10px;
  }
  .send-count { grid-column: 1; grid-row: 1; flex-direction: row; flex-wrap: wrap; gap: 4px 8px; min-width: 0; font-size: 13px; }
  .send-warn { max-width: none; }
  .send-actions { grid-column: 2; grid-row: 1; flex: none; margin: 0; min-width: 0; }
  .send-actions .btn { flex: 1; min-height: 36px; padding: 6px 10px; font-size: 13px; }
  .send-where { grid-column: 1 / -1; grid-row: 2; }
  .send-bar .field, .send-bar .send-note {
    flex: none; min-width: 0; gap: 0; font-size: 0; grid-row: 3;
  }
  .send-bar .send-note { grid-column: 1 / -1; }
  .send-bar select, .send-bar input { font-size: 16px; padding: 7px 10px; min-height: 36px; }
}
.shop { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.shop-main { min-width: 0; }
.shop .mono { font-family: var(--mono); font-size: 12px; }
.shop .ref { font-family: var(--mono); font-size: 12px; color: var(--muted); font-weight: 700; }
.nb-ask { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin-bottom: 14px; }
.nb-ask .field { flex: 1 1 320px; margin: 0; }
.nb-ask .field select { width: 100%; }
.nb-ask p { flex-basis: 100%; margin: 0; font-size: 13px; }
.shop-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 12px; }
.shop-tools input[type="search"] {
  flex: 1 1 260px; min-width: 0; padding: 10px 16px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 14px;
}
label.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; }
.shop-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.chip-link {
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--ink); font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap;
}
.chip-link:hover { border-color: var(--line-strong); }
.shop-group { scroll-margin-top: 90px; margin-top: 18px; }
.shop-group h2 { display: flex; align-items: baseline; gap: 8px; margin: 0 0 8px; font-size: 17px; }
.shop-group h2 .ref { color: var(--blue); }
.shop-card { margin-bottom: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: hidden; }
.shop-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; }
.shop-row + .shop-row { border-top: 1px solid var(--row-line); }
.shop-row.sub { background: var(--sub-bg); padding-left: 28px; }
.shop-row.in-cart { box-shadow: inset 3px 0 0 var(--lime-deep); background: var(--picked); }
.shop-row.out .shop-title strong { color: var(--muted); }
.nb-box { border-top: 1px solid var(--row-line); background: var(--sub-bg); }
.nb-box > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 9px 14px 9px 28px; cursor: pointer; list-style: none; font-size: 13px; }
.nb-box > summary::-webkit-details-marker { display: none; }
.nb-switch { position: relative; flex: none; width: 30px; height: 17px; border-radius: 999px; background: var(--line); transition: background .15s ease; }
.nb-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s ease; }
.nb-box[open] .nb-switch { background: var(--lime-deep); }
.nb-box[open] .nb-switch::after { transform: translateX(13px); }
.nb-title { font-weight: 700; }
.nb-box > summary .fund-meter { margin-left: auto; min-width: 220px; }
.nb-body .shop-row.sub { border-top: 1px solid var(--row-line); }
.nb-none { margin: 0; padding: 4px 28px 8px; font-size: 13px; }
.nb-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 14px 12px 28px; }
.fund-meter { display: grid; gap: 4px; }
.fund-meter p { margin: 0; font-size: 12px; color: var(--muted); }
.fund-meter p strong { color: var(--ink); }
.fund-bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.fund-bar span { display: block; height: 100%; background: var(--green); border-radius: inherit; }
.fund-meter.warn .fund-bar span { background: var(--gold); }
.fund-meter.full .fund-bar span { background: var(--red); }
.fund-meter.full p strong { color: var(--red); }
.fund-meter .neg { color: var(--red); font-weight: 700; }
.fund-cell { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.shop-info { flex: 1; min-width: 0; display: grid; gap: 3px; }
.shop-title { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 14.5px; line-height: 1.35; }
.shop-title .sub-indent { margin-right: 0; }
.shop-meta, .shop-price { margin: 0; font-size: 13px; color: var(--ink); }
.shop-meta b { color: var(--green); }
.shop-row.out .shop-meta b { color: var(--muted); }
.shop-price b { font-weight: 800; }
.shop-buy { flex: none; display: grid; justify-items: end; gap: 4px; min-width: 132px; }
.shop-hint { margin: 0; font-size: 12px; font-weight: 700; color: var(--gold); text-align: right; max-width: 180px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); overflow: hidden; }
.shop [hidden] { display: none !important; }
.stepper button { width: 34px; height: 34px; border: 0; background: none; color: var(--ink); font-size: 18px; font-weight: 700; cursor: pointer; }
.stepper button:hover { background: var(--surface-3); }
.stepper button:disabled { color: var(--line-strong); cursor: default; background: none; }
.stepper input { width: 64px; height: 34px; border: 0; border-inline: 1px solid var(--line); background: none; color: var(--ink); font: inherit; font-size: 14px; font-weight: 700; text-align: center; }
.stepper input:focus-visible { outline-offset: -2px; }
.shop-empty { margin: 18px 0; }
.link-btn { padding: 0; border: 0; background: none; color: var(--blue); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.shop-missing { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 18px; }
.shop-missing h2 { margin: 0 0 4px; font-size: 16px; }
.shop-missing p { margin: 0; }
.ask-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ask-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 14px; }
.ask-list li .muted { font-size: 13px; }
.ask-list li .pill { margin-left: auto; }

.cart {
  position: sticky; top: 84px; max-height: calc(100dvh - 100px); overflow-y: auto; overscroll-behavior: contain;
  display: grid; gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.cart-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cart-head h2 { margin: 0; font-size: 18px; }
.cart-empty { margin: 0; font-size: 14px; }
.cart-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 10px 0; border-bottom: 1px solid var(--row-line); }
.cart-line:last-child { border-bottom: 0; }
.cart-line .name { font-size: 14px; font-weight: 700; line-height: 1.3; }
.cart-line .name small { display: block; margin-top: 2px; color: var(--muted); font-family: var(--mono); font-size: 11.5px; font-weight: 500; }
.cart-line .remove { align-self: start; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.cart-line .remove:hover { color: var(--red); border-color: var(--red); }
.cart-line .controls { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.cart-line .stepper button { width: 30px; height: 30px; font-size: 16px; }
.cart-line .stepper input { width: 58px; height: 30px; font-size: 13px; }
.cart-line .math { font-size: 12.5px; color: var(--muted); text-align: right; }
.cart-line .math b { color: var(--ink); font-size: 13.5px; }
.cart-line .left { grid-column: 1 / -1; margin: 0; font-size: 12px; color: var(--muted); }
.cart-line .left.warn { color: var(--gold); font-weight: 700; }
.cart-sum { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); display: grid; gap: 6px; font-size: 13.5px; }
.cart-sum > div { display: flex; justify-content: space-between; gap: 10px; }
.cart-sum dt { color: var(--muted); font-weight: 600; }
.cart-sum dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.cart-sum .grand { padding-top: 6px; border-top: 1px solid var(--line); font-size: 15.5px; }
.cart-sum .grand dt { color: var(--ink); font-weight: 800; }
.cart-sum .grand dd { font-weight: 800; }
.cart-sum .muted dd { font-weight: 600; color: var(--muted); }
.cart-form { display: grid; gap: 10px; }
.cart-form .actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.cart-form .actions .btn { flex: 1 1 auto; justify-content: center; }
.cart-form .btn:disabled { opacity: .45; cursor: not-allowed; }
.cart-bar { display: none; }
.facts > div { display: contents; }
.facts .mono { font-family: var(--mono); }
.facts .wide dd { white-space: pre-line; }
fieldset.choice { margin: 0; padding: 0; border: 0; display: grid; gap: 8px; }
fieldset.choice legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
@media (max-width: 1080px) {
  .shop { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 860px) {
  .shop { grid-template-columns: 1fr; }
  .cart { position: static; max-height: none; overflow: visible; scroll-margin-top: 80px; }
  .cart-bar:not([hidden]) {
    position: fixed; z-index: 60; left: 12px; right: 12px; bottom: calc(var(--bottom-nav) + 12px);
    display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px;
    border-radius: 16px; background: var(--night); color: var(--night-ink); text-decoration: none;
    box-shadow: 0 14px 34px rgba(8, 12, 18, 0.3); font-size: 14px; font-weight: 600; animation: toast-in .2s ease-out;
  }
  .cart-bar strong { padding: 7px 12px; border-radius: 999px; background: var(--lime); color: var(--lime-ink); font-size: 13px; }
  .shop-main { padding-bottom: 72px; }
}
@media (max-width: 560px) {
  .shop-row { flex-wrap: wrap; gap: 10px; }
  .shop-row.sub { padding-left: 20px; }
  .nb-box > summary { padding-left: 20px; }
  .nb-box > summary .fund-meter { min-width: 0; width: 100%; margin-left: 0; }
  .shop-buy { width: 100%; min-width: 0; grid-auto-flow: column; justify-content: space-between; align-items: center; }
  .shop-buy .btn { min-width: 96px; }
  .shop-hint { text-align: left; max-width: none; }
}

/* ---------- Live updates ---------- */
.live-dot { display: inline-flex; align-items: center; gap: 6px; padding: 0 4px; color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; cursor: default; }
.live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live-dot.on::before { background: #2fbf71; animation: live-pulse 2.4s ease-out infinite; }
.live-dot.off { color: var(--gold); }
.live-dot.off::before { background: var(--gold); }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(47, 191, 113, 0.45); } 70%, 100% { box-shadow: 0 0 0 7px rgba(47, 191, 113, 0); } }
.live-new, tr.live-new > td { animation: live-new 2.8s ease-out; }
@keyframes live-new { 0%, 35% { background-color: rgba(30, 111, 192, 0.14); } 100% { background-color: transparent; } }
.live-chip {
  position: fixed; z-index: 85; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px; max-width: min(440px, calc(100vw - 32px)); padding: 8px 8px 8px 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink);
  box-shadow: 0 12px 32px rgba(8, 12, 18, 0.22); font-size: 13px; font-weight: 600; animation: toast-in .2s ease-out;
}
.live-chip p { flex: 1; margin: 0; line-height: 1.35; }
.live-chip button { flex: none; border: 0; border-radius: 999px; padding: 7px 12px; background: var(--lime); color: var(--lime-ink); font-size: 12px; font-weight: 700; cursor: pointer; }
@media (max-width: 760px) {
  .live-dot > span { display: none; }
  .live-chip { left: 12px; right: 12px; max-width: none; border-radius: 16px; bottom: calc(var(--bottom-nav) + 12px); }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot.on::before, .live-new, tr.live-new > td { animation: none; }
}
@media print { .live-dot, .live-chip, .to-top { display: none !important; } }

/* ---------- Theme switch, loading, swipe hints ---------- */
.theme-switch { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.theme-switch > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface-3); }
.profile-menu .seg button { width: auto; padding: 6px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--muted); }
.profile-menu .seg button:hover { background: transparent; color: var(--ink); }
.profile-menu .seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); }

.loadbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100; height: 3px; pointer-events: none;
  background: linear-gradient(90deg, var(--lime-deep), var(--lime)); box-shadow: 0 0 8px rgba(30, 111, 192, 0.45);
  transform: scaleX(0); transform-origin: left; opacity: 0;
}
.loadbar.run { opacity: 1; animation: load-crawl 6s cubic-bezier(0.1, 0.7, 0.2, 1) forwards; }
@keyframes load-crawl { 0% { transform: scaleX(0); } 20% { transform: scaleX(0.45); } 100% { transform: scaleX(0.92); } }
.btn.busy, button.busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.busy::after, button.busy::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--lime-ink); border-right-color: transparent; animation: spin .7s linear infinite;
}
.btn.ghost.busy::after, .btn:not(.primary).busy::after { border-color: var(--ink); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hscroll { overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.hscroll[data-more="right"] { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
.hscroll[data-more="left"] { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px); mask-image: linear-gradient(90deg, transparent, #000 36px); }
.hscroll[data-more="both"] { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
/* Phones and tablets: masks over tall tables repaint on every scroll frame on iOS, and a
   scrolling box inside the page traps the finger, so both give way to plain page scroll. */
@media (hover: none) and (pointer: coarse) {
  body { background-attachment: scroll; }
  .hscroll[data-more] { -webkit-mask-image: none; mask-image: none; }
  .feed-list { max-height: none; overflow: visible; overscroll-behavior: auto; padding-right: 0; }
  .feed-day { position: static; }
}
@media (max-width: 760px), (orientation: landscape) and (max-height: 540px) {
  .table-wrap table:not(.tree, .rab-table) :is(th, td):first-child:not(.empty) {
    position: sticky; left: 0; z-index: 2; background: var(--surface); box-shadow: 1px 0 0 var(--line);
    max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .table-wrap table:not(.tree) th:first-child { background: var(--surface-2); }
  .table-wrap table:not(.tree) tr:hover td:first-child:not(.empty) { background: var(--hover); }
  .table-wrap table:not(.tree) tr.item-sub td:first-child { background: var(--sub-bg); }
  .so-table.stack :is(th, td),
  .pick-table.fit :is(th, td) { position: static; left: auto; max-width: none; box-shadow: none; white-space: normal; }
  .rab-table .sticky-a { width: 36px; min-width: 36px; max-width: 36px; }
  .rab-table .sticky-b {
    left: 36px; min-width: 0; width: 28vw; max-width: 28vw; overflow: hidden;
  }
  .rab-table .sticky-c {
    left: calc(36px + 28vw); min-width: 0; width: 22vw; max-width: 22vw; overflow: hidden;
  }
  .rab-table td.sticky-b strong,
  .rab-table td.sticky-b small,
  .rab-entry-table .c-item strong,
  .rab-entry-table .c-item small {
    display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .rab-entry-table .c-item {
    min-width: 0; width: 40vw; max-width: 40vw; position: sticky; left: 0; z-index: 1;
    background: var(--surface); box-shadow: 1px 0 0 var(--line);
  }
  .rab-entry-table thead .c-item { z-index: 3; background: var(--group-bg); }
  .att-grid .att-name { min-width: 0; width: 34vw; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; }
}
.swipe-hint {
  display: flex; align-items: center; gap: 6px; margin: 6px 4px 6px auto; padding: 4px 10px; font: inherit; font-size: 12px; font-weight: 700;
  color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
}
.swipe-hint:hover { color: var(--ink); background: var(--hover); }
.swipe-hint i { display: inline-block; font-style: normal; animation: nudge 1.4s ease-in-out infinite; }
.swipe-hint.back i { animation: none; }
/* Long section tables scroll inside a capped box, so the sideways scrollbar stays on screen. */
.so-section .table-wrap { max-height: 72vh; overflow: auto; }
.so-section .table-wrap thead { position: sticky; top: 0; z-index: 3; }
.so-section .table-wrap thead th { background: var(--surface-2); }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(6px); } }

:root[data-theme="dark"] .phase-nav { border: 1px solid rgba(255, 255, 255, 0.08); }
:root[data-theme="dark"] .btn.danger { border-color: rgba(240, 138, 128, 0.35); }
:root[data-theme="dark"] .print-doc { background: #0c1015; }
:root[data-theme="dark"] .doc-toolbar { background: rgba(23, 28, 35, 0.92); }
:root[data-theme="dark"] .login-logo, :root[data-theme="dark"] .signin-logo { background: #f4f7fb; padding: 6px 12px; border-radius: 12px; box-sizing: content-box; }

body.print-doc.fit .sheet { zoom: var(--fit); margin: 12px auto; }
@media (max-width: 760px) {
  .doc-toolbar { padding: calc(8px + env(safe-area-inset-top)) 10px 8px; gap: 8px; }
  .doc-toolbar .group > strong { display: none; }
  .doc-toolbar .btn.small { min-height: 36px; padding: 7px 12px; }
}

@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  /* Do not name .topnav / .phase-nav — that traps dropdowns under the search row. */
  .content { animation: rise .22s ease-out; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

@media (max-width: 860px) and (orientation: portrait), (max-width: 860px) and (min-height: 541px) {
  .split-panels { grid-template-columns: 1fr; }
}

/* ---------- Section rail: slim marks on the right edge, tap to list the sections ---------- */
.section-rail {
  --rail-accent: var(--lime-deep);
  position: fixed; z-index: 80; right: calc(env(safe-area-inset-right) + 2px); top: 50%;
  transform: translateY(-50%); opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .2s ease, visibility 0s linear .2s;
}
:root[data-theme="dark"] .section-rail { --rail-accent: var(--lime); }
.section-rail.on { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .2s ease; }
.rail-marks {
  display: flex; flex-direction: column; align-items: flex-end; gap: 5px; max-height: 44vh; overflow: hidden;
  padding: 10px 6px 10px 16px; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.rail-marks i { flex: none; display: block; width: 8px; height: 2px; border-radius: 2px; background: var(--muted); opacity: .5; transition: width .15s ease, opacity .15s ease; }
.rail-marks i.on { width: 16px; background: var(--rail-accent); opacity: 1; }
.rail-list {
  position: absolute; right: 30px; top: 50%; width: min(230px, 68vw); max-height: 56vh; overflow-y: auto; overscroll-behavior: contain;
  padding: 5px; border: 1px solid var(--line); border-radius: 14px; background: var(--glass-strong);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 16px 40px rgba(8, 12, 18, .28);
  opacity: 0; pointer-events: none; transform: translateY(-50%) scale(.96); transform-origin: right center;
  transition: opacity .16s ease, transform .16s ease;
}
.section-rail.open .rail-list { opacity: 1; pointer-events: auto; transform: translateY(-50%); }
.rail-list button {
  display: block; width: 100%; min-height: 32px; padding: 6px 10px; border: 0; border-radius: 9px; background: none;
  color: var(--ink); font: inherit; font-size: 12.5px; font-weight: 700; line-height: 1.3; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.rail-list button.sub { padding-left: 18px; color: var(--muted); font-weight: 600; font-size: 12px; }
.rail-list button.on { background: color-mix(in srgb, var(--rail-accent) 16%, transparent); color: var(--ink); box-shadow: inset 2px 0 0 var(--rail-accent); }
.haptic-switch { position: fixed; left: -200px; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; overflow: hidden; }
@media not all and (hover: none) and (pointer: coarse) { .section-rail { display: none; } }
@media (prefers-reduced-motion: reduce) { .section-rail, .section-rail.on, .rail-list, .rail-marks i { transition: none; } }

@media print {
  .section-rail { display: none !important; }
  @page { size: A4; margin: 0; }
  body, body.print-doc { background: var(--surface); }
  .sheet { box-shadow: none; margin: 0; }
  .sheet.page { width: 210mm; height: 296.5mm; break-after: page; page-break-after: always; }
  .sheet.page:last-of-type { break-after: auto; page-break-after: auto; }
  .no-print, .doc-toolbar, .topnav, .sub-nav, .phase-nav, .dock, .loadbar { display: none !important; }
  .sheet.reading { display: none !important; }
  body.print-doc.reading .sheet.page { display: flex !important; }
  body.print-doc.fit .sheet { zoom: 1; margin: 0; }
  .sheet.po-doc { color: #111 !important; box-shadow: none !important; }
  .sheet.po-doc .doc-table,
  .sheet.po-doc .doc-totals,
  .sheet.po-doc .doc-info { background: #fff !important; }
  .sheet.po-doc .doc-table th,
  .sheet.po-doc .doc-table td,
  .sheet.po-doc .doc-totals td {
    background: #fff !important;
    border: 1px solid #333 !important;
    color: #111 !important;
    font-size: 10px !important;
  }
  .sheet.po-doc .doc-table th {
    background: var(--blue-bg) !important;
    color: #0f172a !important;
    font-size: 9.5px !important;
    text-transform: none !important;
  }
  .sheet.po-doc .doc-breakup,
  .sheet.po-doc .po-breakup {
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: flex-end !important;
  }
  .sheet.po-doc .doc-totals { width: 210px !important; max-width: 42% !important; }
  .sheet.po-doc .doc-totals td { font-size: 10px !important; padding: 5px 6px !important; }
  .sheet.po-doc .doc-totals tr.grand td {
    font-size: 10px !important;
    background: var(--blue-bg) !important;
    color: #0f172a !important;
  }
  .sheet.po-doc .doc-table .var-good,
  .sheet.po-doc .doc-totals.doc-savings tr.good td:last-child,
  .sheet.po-doc .doc-totals.doc-savings tr.good.grand td:last-child {
    color: #0b5c2e !important;
  }
  .sheet.po-doc .doc-table .var-bad,
  .sheet.po-doc .doc-totals.doc-savings tr.bad td:last-child,
  .sheet.po-doc .doc-totals.doc-savings tr.bad.grand td:last-child {
    color: #8b1515 !important;
  }
}

/* One-time password slip and first sign-in */
.narrow-panel { max-width: 640px; }
.slip { max-width: 640px; }
.slip-grid { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 16px 0; }
.slip-grid dt { color: var(--muted); }
.slip-grid dd { margin: 0; }
.slip-secret { font-size: 1.35rem; letter-spacing: 0.08em; font-weight: 600; }
@media print {
  .topnav, .sub-nav, .dock, .flash, .page-head .actions, .actions { display: none !important; }
  .slip { box-shadow: none; border: 1px solid #999; }
}

/* ---------- Sign-in page: photo panel + form ---------- */
/* Light Claude-style login: interactive dots, centered card, company logos. */
html:has(body.login-dots-page) { overflow: hidden; height: 100%; }
.login-dots-page {
  --login-bg: #f7f8fa;
  --login-ink: #141820;
  --login-muted: #5c6b7c;
  --login-line: #d9e0e8;
  --login-card: #ffffff;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  background: var(--login-bg);
  color: var(--login-ink);
  overflow: hidden;
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: stretch;
}
.login-dots {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}
.login-main,
.login-companies {
  position: relative;
  z-index: 1;
}
.login-main {
  width: min(440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
}
.login-headline {
  margin: 0 0 22px;
  text-align: center;
  font-size: clamp(24px, 3.6vw, 36px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.03em;
  color: var(--login-ink);
  min-height: 2.4em;
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.login-headline.is-fading {
  opacity: 0;
  transform: translateY(6px);
}
.login-card {
  background: var(--login-card);
  border: 1px solid var(--login-line);
  border-radius: 18px;
  padding: 28px 26px 26px;
  box-shadow: 0 1px 2px rgba(13, 37, 70, 0.04), 0 18px 40px rgba(13, 37, 70, 0.06);
  flex-shrink: 0;
}
.login-card .flash { margin-bottom: 12px; }
.signin-note { margin: 0 0 14px; font-size: 13px; color: var(--login-muted); }
.signin-fields { display: grid; gap: 14px; }
.signin-fields input { width: 100%; min-height: 46px; font-size: 16px; }
.pw-box { position: relative; display: block; }
.pw-box input { padding-right: 70px; }
.pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.pw-toggle:hover { background: var(--surface-3); }
.signin-btn { width: 100%; justify-content: center; min-height: 48px; font-size: 15px; }
.login-terms {
  margin: 18px auto 0;
  max-width: 34ch;
  text-align: center;
  font-size: 12px;
  line-height: 1.55;
  color: var(--login-muted);
  flex-shrink: 0;
}
.login-terms span {
  text-decoration: underline;
  text-underline-offset: 2px;
  color: var(--login-ink);
}
.login-companies {
  padding: 12px 24px calc(20px + env(safe-area-inset-bottom));
  text-align: center;
  flex-shrink: 0;
}
.login-companies p {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--login-muted);
}
.login-company-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 40px;
}
.login-co-logo {
  display: block;
  height: 40px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  object-position: center;
  opacity: 0.92;
}

@media (max-width: 640px) {
  .login-main { width: min(100%, calc(100% - 28px)); padding: 16px 0 12px; }
  .login-headline { font-size: 24px; margin-bottom: 16px; min-height: 2.5em; }
  .login-card { padding: 22px 18px 20px; border-radius: 16px; }
  .login-company-row { gap: 28px; }
  .login-co-logo { height: 34px; max-width: 150px; }
}
@media (max-height: 720px) {
  .login-headline { font-size: 22px; margin-bottom: 14px; min-height: 2.2em; }
  .login-card { padding: 20px 18px; }
  .login-terms { margin-top: 12px; }
  .login-companies { padding-top: 4px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .login-companies p { margin-bottom: 10px; }
  .login-co-logo { height: 32px; }
}
@media (orientation: landscape) and (max-height: 540px) {
  .login-headline { font-size: 18px; min-height: 0; margin-bottom: 10px; }
  .login-card { padding: 14px 16px; }
  .signin-fields { gap: 8px; }
  .signin-fields input, .signin-btn { min-height: 40px; }
  .login-terms { display: none; }
  .login-co-logo { height: 28px; }
}

/* Site location map */
.site-map { scroll-margin-top: 96px; }
.site-map-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.site-map-head h2 { margin-bottom: 4px; }
.site-map-head p { margin: 0; overflow-wrap: anywhere; }
.site-coords { font-variant-numeric: tabular-nums; }
.site-map-links { display: flex; flex-wrap: wrap; gap: 8px; }
.site-map-frame { display: block; width: 100%; height: clamp(220px, 34vh, 340px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-top); }
.site-map-empty { margin: 0; padding: 28px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.site-map-edit { margin-top: 14px; }
.site-map-edit summary { cursor: pointer; font-weight: 600; color: var(--blue); }
.site-map-edit form { margin-top: 12px; }
.site-pin { margin-left: 6px; font-size: 12px; font-weight: 600; }
@media (max-width: 600px) {
  .site-map-links { width: 100%; }
  .site-map-links .btn { flex: 1; text-align: center; }
}

/* Material request: stock position per item */
.shop-stock { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.shop-stock > div { display: grid; gap: 1px; padding: 5px 10px; border-radius: 10px; background: var(--surface-2); min-width: 78px; }
.shop-stock dt { font-size: 11px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); }
.shop-stock dd { margin: 0; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.shop-stock dd small { font-weight: 600; color: var(--muted); }
.shop-stock .pending { background: var(--gold-bg, var(--surface-2)); }
.shop-stock .pending dd { color: var(--gold); }
.shop-stock .open dd { color: var(--green); }
.shop-stock .zero dd { color: var(--muted); font-weight: 700; }
.cart-sum .sub { padding-left: 12px; font-size: 12.5px; }
.send-to { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; border: 0; padding: 0; margin: 0; }
.send-to legend { width: 100%; font-weight: 700; margin-bottom: 2px; }
.send-to small { width: 100%; }

/* Admin BOM revision */
.revise-table input { width: 100%; min-width: 84px; text-align: right; font-variant-numeric: tabular-nums; }
.revise-table input.bad { border-color: var(--red, #b42318); box-shadow: 0 0 0 2px rgba(180, 35, 24, .15); }
.revise-table td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.revise-sum { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.revise-sum > div { display: grid; gap: 2px; padding: 8px 14px; border-radius: 12px; background: var(--surface-2); min-width: 120px; }
.revise-sum dt { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }
.revise-sum dd { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; }
.revise-sum .grand { background: var(--blue-bg); }
.revise-sum .grand dd { color: var(--blue); font-size: 17px; }
.revise-sum .was dd { color: var(--muted); font-weight: 700; }
.revise-sum dd.neg { color: var(--red, #b42318); }

/* Owner's overview (logo) */
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--muted); }
.sw.sales { background: #0d3b72; }
.sw.budget { background: #7c93b3; }
.sw.committed { background: #c98a1b; }
.sw.billed { background: #2f8a57; }
.sw.s0 { background: #1e6fc0; } .sw.s1 { background: #2f8a57; } .sw.s2 { background: #c98a1b; } .sw.s3 { background: #8e4fb8; }
.sw.s4 { background: #d0573f; } .sw.s5 { background: #1a9aa0; } .sw.s6 { background: #6b7a90; } .sw.s7 { background: #b8447a; }
:root[data-theme="dark"] .sw.sales { background: #6ea6e6; }

.ov-modules { display: grid; gap: 12px; margin: 0 0 16px; }
.ov-module .panel-head { margin-bottom: 8px; }
.ov-module-kpis { margin: 0; }
.ov-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 4px; }
.ov-kpis.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ov-kpi { display: grid; gap: 4px; align-content: start; padding: 16px 18px; border-radius: var(--radius); background: var(--glass-strong); border: 1px solid var(--glass-line); box-shadow: var(--shadow); min-width: 0; }
.ov-kpi span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.ov-kpi strong { font-size: 27px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; max-width: 100%; overflow-wrap: anywhere; }
.ov-kpi strong small { font-size: 15px; color: var(--muted); font-weight: 600; }
.ov-kpi em { font-style: normal; font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.ov-kpi.lead { background: var(--night); border-color: transparent; }
.ov-kpi.lead span, .ov-kpi.lead em { color: var(--night-dim); }
.ov-kpi.lead strong { color: var(--night-ink); }
.ov-kpi.good strong { color: var(--green); }
.ov-kpi.bad strong { color: var(--red); }
.ov-kpi.warn strong { color: var(--gold); }

.ov-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; }
.ov-grid > .panel { margin-top: 16px; }
.ov-note { margin: 2px 0 0; font-size: 12px; }
.ov-legend { display: flex; gap: 12px; font-size: 12px; font-weight: 600; color: var(--muted); }
.ov-legend.wrap { flex-wrap: wrap; margin-top: 12px; }
.ov-legend span { display: inline-flex; align-items: center; gap: 6px; }

.ov-bars { display: grid; gap: 4px; }
.ov-bar-group { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 14px; align-items: center; padding: 8px 10px; border-radius: 12px; color: inherit; text-decoration: none; }
.ov-bar-group:hover { background: var(--hover); }
.ov-bar-name { display: grid; min-width: 0; }
.ov-bar-name b { font-size: 13px; }
.ov-bar-name small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-bar-set { display: grid; gap: 3px; }
.ov-bar-line { display: flex; align-items: center; gap: 8px; height: 9px; }
.ov-bar-line i { display: block; height: 9px; min-width: 2px; border-radius: 0 5px 5px 0; }
.ov-bar-line i.sales { background: #0d3b72; } .ov-bar-line i.budget { background: #7c93b3; }
.ov-bar-line i.committed { background: #c98a1b; } .ov-bar-line i.billed { background: #2f8a57; }
:root[data-theme="dark"] .ov-bar-line i.sales { background: #6ea6e6; }
.ov-bar-line em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.ov-funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ov-funnel li { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) 84px; gap: 12px; align-items: center; }
.ov-funnel-label { display: grid; min-width: 0; }
.ov-funnel-label b { font-size: 13px; }
.ov-funnel-label small { font-size: 11.5px; color: var(--muted); }
.ov-funnel-bar { height: 12px; border-radius: 999px; background: var(--track); overflow: hidden; }
.ov-funnel-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--lime-deep), var(--lime)); }
.ov-funnel li strong { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; }
.ov-projection { margin-top: 18px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.ov-projection h3 { margin: 0 0 8px; font-size: 14px; }
.ov-projection dl { margin: 0; display: grid; gap: 6px; }
.ov-projection dl div { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.ov-projection dt { color: var(--muted); }
.ov-projection dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.ov-projection .big { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 16px; }
.ov-projection .big dt { color: var(--ink); font-weight: 700; }
.up { color: var(--green); }
.down { color: var(--red); }

.ov-columns { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 6px; align-items: end; height: 220px; padding-top: 8px; }
.ov-col { display: grid; grid-template-rows: 18px 1fr auto; height: 100%; text-align: center; min-width: 0; }
.ov-col b { font-size: 11px; color: var(--ink); font-variant-numeric: tabular-nums; }
.ov-col-stack { display: flex; flex-direction: column-reverse; justify-content: flex-start; background: var(--track); border-radius: 8px 8px 3px 3px; overflow: hidden; }
.ov-col-stack i { display: block; width: 100%; height: 0; border-radius: 0; }
.ov-col small { margin-top: 6px; font-size: 10.5px; line-height: 1.2; color: var(--muted); font-weight: 600; }
.ov-col.today small { color: var(--ink); font-weight: 800; }
.ov-col.today .ov-col-stack { outline: 2px solid var(--lime); outline-offset: 1px; }

.ov-tasks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.ov-task { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); color: inherit; text-decoration: none; min-width: 0; }
.ov-task strong { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ov-task span { font-size: 12px; font-weight: 600; color: var(--muted); line-height: 1.3; }
.ov-task.warn strong { color: var(--gold); }
a.ov-task:hover { border-color: var(--lime); }
.ov-months { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; align-items: end; height: 150px; }
.ov-month { display: grid; grid-template-rows: 18px 1fr auto; height: 100%; text-align: center; min-width: 0; }
.ov-month b { font-size: 11.5px; font-variant-numeric: tabular-nums; }
.ov-month-bar { position: relative; background: var(--track); border-radius: 8px 8px 3px 3px; overflow: hidden; }
.ov-month-bar i { position: absolute; left: 0; right: 0; bottom: 0; background: #7c93b3; }
.ov-month-bar i.mine { left: 28%; right: 28%; background: var(--lime); border-radius: 4px 4px 0 0; }
.ov-month small { margin-top: 6px; font-size: 11px; color: var(--muted); font-weight: 600; }
.ov-month.now small { color: var(--ink); font-weight: 800; }
.ov-chart .ov-legend { margin-top: 10px; }
.sw.all { background: #7c93b3; }
.sw.mine { background: var(--lime); }

.ov-attention { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.ov-alert { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--gold-bg); border: 1px solid transparent; }
.ov-alert strong { grid-row: span 2; font-size: 26px; color: var(--gold); font-variant-numeric: tabular-nums; }
.ov-alert span { font-weight: 700; font-size: 13px; }
.ov-alert-links { display: flex; flex-wrap: wrap; gap: 4px; }
.ov-alert-links a { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface); color: var(--ink); text-decoration: none; border: 1px solid var(--line); }
.ov-alert-links a:hover { border-color: var(--line-strong); }

.ov-table td { vertical-align: middle; }
.ov-table td.num, .ov-table th.num { white-space: nowrap; }
.ov-table td.num small { font-size: 11px; }
.ov-sub { display: block; }
.ov-table tfoot td { border-top: 2px solid var(--line-strong); }
.ov-proj { display: grid; color: inherit; text-decoration: none; min-width: 180px; }
.ov-proj span { font-weight: 600; }
.ov-proj small { color: var(--muted); }
.ov-proj:hover span { text-decoration: underline; }
.ov-site { max-width: 220px; font-size: 13px; }
.ov-mini { display: block; width: 100%; max-width: 120px; height: 5px; margin-top: 6px; border-radius: 999px; background: var(--track); overflow: hidden; }
.ov-mini i { display: block; height: 100%; background: var(--lime); }
.ov-work { display: grid; gap: 4px; min-width: 190px; }
.ov-work span { display: grid; grid-template-columns: 62px 1fr 36px; gap: 6px; align-items: center; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.ov-work i { height: 6px; border-radius: 999px; background: var(--track); overflow: hidden; }
.ov-work b { display: block; height: 100%; background: var(--lime); }
.ov-count { display: inline-block; min-width: 26px; padding: 2px 8px; border-radius: 999px; background: var(--gold-bg); color: var(--gold); font-weight: 800; text-align: center; }

.ov-sites { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ov-site-card { display: grid; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.ov-site-card header { display: flex; gap: 10px; align-items: flex-start; }
.ov-site-card header .sw { margin-top: 4px; flex: none; }
.ov-site-card header div { display: grid; min-width: 0; }
.ov-site-card header span { font-size: 12.5px; color: var(--muted); }
.ov-site-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ov-site-figs div { display: grid; }
.ov-site-figs strong { font-size: 19px; font-variant-numeric: tabular-nums; }
.ov-site-figs span { font-size: 10.5px; color: var(--muted); font-weight: 600; line-height: 1.2; }
.ov-trades { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; }
.ov-trades span { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.ov-site-card footer { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.ov-site-card footer a { margin-left: 10px; font-weight: 700; }

@media (max-width: 1180px) {
  .ov-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .ov-kpis, .ov-kpis.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .ov-bar-group { grid-template-columns: 1fr; gap: 6px; }
  .ov-funnel li { grid-template-columns: minmax(0, 1fr) 76px; }
  .ov-funnel-bar { grid-column: 1 / -1; grid-row: 2; }
  .ov-columns { gap: 3px; height: 180px; }
  .ov-col b { font-size: 9.5px; }
  .ov-tasks { gap: 6px; }
  .ov-task strong { font-size: 20px; }
  .ov-kpi strong { font-size: 23px; }
}

/* Access: department per project */
.project-access td { padding-top: 6px; padding-bottom: 6px; }
.project-access select { min-width: 220px; }
.project-access tr.off td:first-child { opacity: .55; }

/* Status log page */
.audit-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.audit-pick { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.audit-pick select { width: auto; min-width: 220px; max-width: 360px; min-height: 0; height: 34px; padding: 0 12px; font-size: 13px; border-radius: 999px; }
.audit-filter .btn.small { height: 34px; padding: 0 14px; }
.audit-filter .btn.is-on { border-color: var(--line-strong); background: var(--surface); }
.audit-count { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.audit-table th, .audit-table td { vertical-align: middle; padding-top: 9px; padding-bottom: 9px; }
.audit-table .when { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--muted); }
.audit-table .code { white-space: nowrap; font-weight: 600; }
.audit-table .status, .audit-table .who { white-space: nowrap; }
.audit-table .role { margin-left: 4px; font-size: 11px; font-weight: 700; color: var(--muted); }
.audit-table .log-note { min-width: 220px; font-size: 13px; color: var(--muted); }
.audit-table .open { width: 1%; white-space: nowrap; text-align: right; }
.audit-table .open a { font-size: 13px; font-weight: 700; }
@media (max-width: 760px) {
  .audit-filter { max-width: 100%; }
  .audit-pick { flex: 1 1 100%; min-width: 0; }
  .audit-pick select { flex: 1 1 auto; width: 100%; min-width: 0; max-width: 100%; height: 40px; font-size: 16px; }
  .audit-count { margin-left: 0; flex-basis: 100%; }
}

/* Projects list: a deactivated project stays on L1's list, dimmed */
.projects-table tr.inactive td { color: var(--muted); }
.projects-table tr.inactive td:not(:last-child) { opacity: .5; }
.projects-table .row-actions { justify-content: flex-end; flex-wrap: nowrap; }
.projects-table .row-actions form { margin: 0; }

/* Console · People: project picker on the add form */
.scope{border:1px solid var(--line,#e2e2e2);border-radius:10px;padding:10px 14px;margin:12px 0;display:grid;gap:6px}
.scope legend{font-weight:600;padding:0 4px}
.scope-choice{display:flex;gap:8px;align-items:center}
.scope-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:4px 16px;margin:4px 0 0 24px}
.scope-list label{display:flex;gap:8px;align-items:center}
.scope:has(input[value="all"]:checked) .scope-list{opacity:.45;pointer-events:none}

/* ---------- Search: top bar, results page, table filter ---------- */
.gsearch { position: relative; display: flex; align-items: center; margin: 0; }
.gsearch input {
  width: 200px; height: 40px; padding: 0 34px 0 36px; border-radius: 999px; border: 1px solid var(--glass-line);
  background: var(--glass-strong); color: var(--ink); font: inherit; font-size: 13px; transition: width .18s ease, border-color .15s ease;
}
.gsearch input::-webkit-search-cancel-button { display: none; }
.gsearch input:focus { width: 300px; outline: none; border-color: var(--slate); box-shadow: 0 0 0 3px rgba(30, 111, 192, 0.15); }
.gsearch-icon {
  position: absolute; left: 4px; z-index: 1; display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer;
}
.gsearch-icon svg, .find-input svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.gsearch.fetching .gsearch-icon svg { animation: gsearch-pulse .8s ease-in-out infinite alternate; }
@keyframes gsearch-pulse { to { opacity: 0.35; } }
.gsearch-key {
  position: absolute; right: 12px; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px;
  color: var(--muted); font: 11px/18px var(--mono); pointer-events: none;
}
.gsearch input:focus ~ .gsearch-key, .gsearch input:not(:placeholder-shown) ~ .gsearch-key { display: none; }
.gsearch-pop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; width: min(480px, calc(100vw - 24px)); max-height: min(70dvh, 560px);
  overflow-y: auto; overscroll-behavior: contain; padding: 6px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); box-shadow: 0 24px 60px rgba(8, 12, 18, 0.22);
}
@media (max-width: 1180px) and (min-width: 761px) { .gsearch-pop { right: auto; left: 0; } }
.top-tools > .icon-btn, .top-tools > .profile, .top-tools > .live-dot, .gsearch { flex: none; }
@media (max-width: 1360px) and (min-width: 1181px) {
  .top-tools .live-dot > span { display: none; }
  .gsearch input { width: 150px; }
  .gsearch input:focus { width: 190px; }
}
@media (orientation: landscape) and (max-height: 540px) {
  .gsearch-pop {
    position: fixed; top: calc(56px + env(safe-area-inset-top)); left: auto; right: max(8px, env(safe-area-inset-right));
    width: min(480px, calc(100vw - 16px)); max-height: calc(100dvh - 66px - env(safe-area-inset-top));
  }
}
.gsearch-head {
  display: flex; justify-content: space-between; margin: 8px 10px 4px; color: var(--muted);
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
.gsearch-hit, .gsearch-all { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; color: var(--ink); text-decoration: none; scroll-margin: 6px; }
.gsearch-hit.on, .gsearch-hit:hover, .gsearch-all.on, .gsearch-all:hover { background: var(--picked); }
.gsearch-main { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 14px; }
.gsearch-main b { flex: none; }
.gsearch-main span, .gsearch-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gsearch-meta { color: var(--muted); font-size: 12px; }
.gsearch-all { margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; color: var(--slate); font-size: 13px; font-weight: 700; }
:root[data-theme="dark"] .gsearch-all { color: var(--brand); }
.gsearch-empty { margin: 0; padding: 14px 12px 8px; color: var(--muted); font-size: 13px; }
::highlight(gsearch), ::highlight(find), ::highlight(mark) { background-color: rgba(255, 196, 0, 0.42); color: inherit; }

.find-cell { min-width: 0; }
.find-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 10px; }
.find-input { position: relative; display: flex; align-items: center; flex: 0 1 280px; min-width: 180px; margin: 0; }
.find-input svg { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
.find-input input {
  width: 100%; padding: 8px 12px 8px 33px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13px;
}
.find-input input:focus { outline: none; border-color: var(--slate); box-shadow: 0 0 0 3px rgba(30, 111, 192, 0.15); }
.find-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.find-chips button {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.find-chips button b { color: var(--muted); font-weight: 700; }
.find-chips button[aria-pressed="true"] { border-color: var(--night); background: var(--night); color: var(--night-ink); }
.find-chips button[aria-pressed="true"] b { color: var(--night-dim); }
.find-count { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.find-bar.filtering .find-count { color: var(--ink); font-weight: 700; }

.search-page-form { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.search-page-form input {
  flex: 1 1 320px; min-width: 0; padding: 12px 18px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 15px;
}
.search-page-form input:focus { outline: none; border-color: var(--slate); box-shadow: 0 0 0 3px rgba(30, 111, 192, 0.15); }
.search-page-form select { max-width: 280px; border-radius: 999px; }
.search-types { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.search-types a {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600; text-decoration: none;
}
.search-types a b { color: var(--muted); }
.search-types a.on { border-color: var(--night); background: var(--night); color: var(--night-ink); }
.search-types a.on b { color: var(--night-dim); }
.search-results { display: grid; gap: 14px; }
.search-group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.search-group-head h2 { margin: 0; font-size: 16px; }
.search-list { display: grid; margin: 0; padding: 0; list-style: none; }
.search-list li + li .search-hit { border-top: 1px solid var(--row-line); }
.search-hit { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; padding: 10px 8px; color: var(--ink); text-decoration: none; }
.search-hit:hover { background: var(--hover); }
.search-hit .pill { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.search-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; }
.search-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--muted); font-size: 12.5px; }
.search-project { color: var(--slate); font-weight: 700; }
:root[data-theme="dark"] .search-project { color: var(--brand); }
.search-has { color: var(--ink); }
.search-tips ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.search-tips kbd { padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; font: 12px var(--mono); }

@media (max-width: 760px) {
  .gsearch { position: static; }
  .gsearch-icon { position: static; width: 40px; height: 40px; border: 1px solid var(--glass-line); background: var(--glass-strong); color: var(--ink); }
  .gsearch input, .gsearch-key { display: none; }
  .gsearch.open { position: fixed; z-index: 50; top: calc(6px + env(safe-area-inset-top)); left: 8px; right: 8px; }
  .gsearch.open .gsearch-icon { position: absolute; left: 5px; width: 34px; height: 34px; border: 0; background: none; color: var(--muted); }
  .gsearch.open input { display: block; width: 100%; height: 46px; font-size: 16px; box-shadow: 0 10px 30px rgba(8, 12, 18, 0.2); }
  .gsearch.open input:focus { width: 100%; }
  .gsearch-pop { position: fixed; top: calc(60px + env(safe-area-inset-top)); left: 8px; right: 8px; width: auto; max-height: calc(100dvh - var(--bottom-nav) - 80px); }
  .find-input { flex: 1 1 100%; }
  .find-input input { font-size: 16px; }
  .find-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  .find-chips button { flex: none; }
  .search-page-form input, .search-page-form select { font-size: 16px; }
  .search-page-form select { max-width: none; flex: 1 1 100%; }
}
@media print { .gsearch, .find-bar { display: none !important; } }
.so-cost { display: block; margin-top: 2px; font-size: 11px; }
.so-cost.no-cost { color: var(--gold); font-weight: 600; }
.qty-input.needs-cost { border-color: var(--gold); }
.wa-steps { margin: 0 0 12px; padding-left: 20px; line-height: 1.7; }
.wa-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.wa-form .field { flex: 1 1 200px; margin: 0; }
.wa-form .actions { margin: 0; }
.wa-change { margin-top: 12px; }
.wa-change summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-bottom: 8px; }

.team-roles { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.team-tips { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.team-tips li { padding: 8px 12px; border-radius: 10px; background: var(--surface-2); border-left: 3px solid var(--brand-2); }
.team-tips li.warn { border-left-color: var(--red); }
.team-tips li.bad { border-left-color: var(--red); }
.team-tips li a { margin-left: 6px; font-weight: 600; }

/* L1 dashboard: Money at a glance (OEG navy, blue, red and white only) */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.glance { margin-top: 8px; }
.glance-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.glance-head h2 { margin: 0; }
.glance-head .people { margin: 0; }
.glance-meta { display: flex; align-items: center; gap: 12px; }
.glance-empty { padding: 18px; border-radius: var(--radius); background: var(--surface-2); color: var(--muted); }
.glance-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 14px; }
.g-card { position: relative; display: block; padding: 18px 20px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; overflow: hidden; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
a.g-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: 0 10px 28px rgba(13, 59, 114, .12); }
.g-card h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.g-sub { margin: 2px 0 0; font-size: .78rem; color: var(--muted); }
.g-foot { margin: 10px 0 0; font-size: .8rem; color: var(--muted); }

.g-bubbles { min-height: 270px; background: radial-gradient(120% 90% at 85% 10%, var(--blue-bg), var(--surface) 70%); }
.g-legend { list-style: none; padding: 0; margin: 0; position: absolute; left: 20px; bottom: 18px; display: grid; gap: 8px; font-size: .76rem; z-index: 2; }
.g-legend li { display: flex; align-items: center; gap: 8px; }
.g-legend .dot { width: 22px; height: 8px; border-radius: 99px; }
.dot.sales { background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.dot.budget { background: var(--blue-bg); box-shadow: inset 0 0 0 1px var(--brand-2); }
.dot.committed { background: linear-gradient(90deg, var(--red), #d0605a); }
.dot.billed { background: linear-gradient(90deg, var(--brand-2), #8fbdea); }
.dot.spread { background: var(--night); box-shadow: inset 0 0 0 1px var(--brand-2); } .dot.spread.loss { background: var(--red); box-shadow: none; }
.glance-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.glance-col > .g-flow { flex: 1; }
.g-budget { padding: 14px 18px; }
.g-budget .g-big strong { font-size: 1.15rem; }
.g-budget .plan { margin-top: 34px; }
.g-budget .plan-bar { height: 10px; }
.g-budget .g-foot { margin-top: 6px; }
.bubble-field { position: absolute; inset: 0 0 0 30%; }
.bubble { position: absolute; left: var(--x); top: var(--y); width: var(--s); height: var(--s); margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2); border-radius: 50%; display: grid; place-content: center; text-align: center; line-height: 1.15; color: #fff; animation: g-float 7s ease-in-out var(--d) infinite alternate, g-pop .7s cubic-bezier(.2, .9, .3, 1.3) both; }
.bubble b { font-size: .86rem; font-weight: 800; } .bubble small { font-size: .66rem; opacity: .85; }
.bubble.sales { background: radial-gradient(circle at 35% 30%, var(--brand-2), var(--brand) 70%); box-shadow: 0 0 0 calc(var(--s) * .08) rgba(30, 111, 192, .14), 0 14px 30px rgba(13, 59, 114, .25); }
.bubble.budget { background: radial-gradient(circle at 35% 30%, #ffffff, var(--blue-bg) 75%); color: var(--brand); box-shadow: inset 0 0 0 1.5px rgba(30, 111, 192, .35), 0 10px 24px rgba(13, 59, 114, .1); }
.bubble.committed { background: radial-gradient(circle at 35% 30%, #d0605a, var(--red) 75%); box-shadow: 0 0 0 calc(var(--s) * .08) rgba(162, 58, 58, .12), 0 10px 22px rgba(162, 58, 58, .22); }
.bubble.billed { background: radial-gradient(circle at 35% 30%, #8fbdea, var(--brand-2) 80%); box-shadow: 0 8px 18px rgba(30, 111, 192, .22); }
.bubble.spread { background: var(--night); box-shadow: 0 0 0 6px rgba(13, 59, 114, .14); z-index: 2; }
.bubble.spread.loss { background: var(--red); box-shadow: 0 0 0 6px rgba(162, 58, 58, .16); }
@keyframes g-float { from { transform: translate(0, 0); } to { transform: translate(4px, -7px); } }
@keyframes g-pop { from { scale: .4; opacity: 0; } to { scale: 1; opacity: 1; } }

.g-billed { display: flex; flex-direction: column; }
.bill-figs { display: grid; gap: 2px; margin: 16px 0 0; }
.bill-figs div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.bill-figs div:last-child { border-bottom: 0; }
.bill-figs dt { display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--muted); }
.bill-figs dd { margin: 0; font-size: .95rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.bill-figs dd, .g-flow strong { text-align: right; }
.bill-figs dd small, .g-flow strong small { display: block; font-size: .72rem; font-weight: 600; color: var(--muted); }
.g-flow .g-amt { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; white-space: nowrap; }
.g-flow .g-amt b { font-size: .86rem; font-weight: 800; color: var(--brand); }
.g-flow .g-amt small { display: block; margin-top: 1px; font-size: .7rem; font-weight: 600; color: var(--muted); }
.g-flow .g-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-flow .pills { justify-content: flex-end; }
.bill-figs div.total { border-top: 2px solid var(--line-strong); border-bottom: 0; margin-top: 2px; }
.bill-figs div.total dt { color: var(--ink); font-weight: 700; }
.bill-figs .eq { width: 10px; text-align: center; font-weight: 800; color: var(--muted); }
.bill-figs .dot { width: 10px; height: 10px; border-radius: 3px; }
.bill-figs .dot.billed { background: var(--brand-2); }
.bill-figs .dot.left { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-strong); }
.bill-bar { height: 10px; margin-top: auto; border-radius: 99px; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.g-billed .bill-figs { margin-bottom: 16px; }
.bill-bar i { display: block; height: 100%; width: var(--p); min-width: 0; border-radius: 99px; background: var(--brand-2); animation: g-grow 1.1s cubic-bezier(.3, .8, .3, 1) both; }
.g-billed .g-foot b { color: var(--ink); }

.g-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.g-big { text-align: right; } .g-big strong { display: block; font-size: 1.35rem; font-weight: 800; color: var(--brand); } .g-big span { font-size: .74rem; color: var(--muted); }
.plan { position: relative; margin-top: 30px; }
.plan-bar { height: 16px; border-radius: 99px; background: radial-gradient(circle, var(--line-strong) 1.5px, transparent 2px) 0 50% / 14px 100% repeat-x, var(--surface-3); overflow: hidden; }
.plan-bar i { display: block; height: 100%; width: var(--p); min-width: 14px; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); animation: g-grow 1.1s cubic-bezier(.3, .8, .3, 1) both; }
@keyframes g-grow { from { width: 0; } }
.flag { position: absolute; bottom: 18px; left: max(7px, var(--p)); transform: translateX(calc(var(--p) * -1)); padding: 3px 8px; border-radius: 8px; background: var(--brand); color: #fff; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.flag::after { content: ""; position: absolute; left: clamp(4px, var(--p), calc(100% - 12px)); bottom: -4px; border: 4px solid transparent; border-bottom: 0; border-top-color: var(--brand); }
.g-ends { display: flex; justify-content: space-between; margin-top: 6px; font-size: .76rem; font-weight: 700; }
.g-budget.over .plan-bar i { background: linear-gradient(90deg, var(--red), #d0605a); }
.g-budget.over .flag, .g-budget.over .g-big strong { background: var(--red); } .g-budget.over .g-big strong { background: none; color: var(--red); }
.g-budget.over .flag::after { border-top-color: var(--red); }

.g-flow ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.g-flow a { display: grid; grid-template-columns: minmax(0, 1fr) 106px 104px; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 14px; background: var(--surface-2); color: inherit; text-decoration: none; transition: background .15s ease; }
.g-flow a:hover { background: var(--blue-bg); }
.g-label { font-size: .84rem; font-weight: 600; }
.g-flow strong { text-align: right; font-size: .86rem; color: var(--brand); }
.pills { display: flex; gap: 3px; }
.pills i { width: 7px; height: 16px; border-radius: 4px; background: var(--track); }
.pills i.on { background: linear-gradient(180deg, var(--brand-2), var(--brand)); animation: g-pill .4s ease both; animation-delay: calc(var(--i) * 60ms); }
.g-flow li:nth-child(3) .pills i.on { background: linear-gradient(180deg, #d0605a, var(--red)); }
@keyframes g-pill { from { opacity: 0; transform: scaleY(.3); } }

:root[data-theme="dark"] .g-bubbles { background: radial-gradient(120% 90% at 85% 10%, rgba(58, 138, 214, .16), var(--surface) 70%); }
:root[data-theme="dark"] .bubble.budget { background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .22), rgba(179, 205, 236, .08) 75%); color: #f3f5f8; }
:root[data-theme="dark"] .bubble.spread { background: #0a2a52; }
:root[data-theme="dark"] .g-big strong, :root[data-theme="dark"] .g-flow strong { color: var(--brand); }
:root[data-theme="dark"] .g-flow a:hover { background: var(--surface-3); }

@media (max-width: 900px) {
  .glance-grid { grid-template-columns: 1fr; }
  .g-bubbles { display: flex; flex-direction: column; min-height: 0; }
  .bubble-field { position: relative; inset: auto; order: 2; height: 240px; margin: 4px -8px 0; }
  .g-legend { position: static; order: 3; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
  .bubble { width: calc(var(--s) * .74); height: calc(var(--s) * .74); margin: calc(var(--s) * -.37) 0 0 calc(var(--s) * -.37); }
  .bubble b { font-size: .78rem; } .bubble small { font-size: .6rem; }
}
@media (max-width: 760px) {
  .glance-meta { flex-wrap: wrap; gap: 8px; }
  .glance-meta > .muted { font-size: .78rem; }
  .g-card { padding: 16px; border-radius: 16px; }
  .g-flow a { grid-template-columns: minmax(0, 1fr) 68px 92px; gap: 8px; padding: 8px 10px; }
  .g-flow .pills { gap: 2px; } .g-flow .pills i { width: 5px; height: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .bubble, .bill-bar i, .plan-bar i, .pills i.on { animation: none; }
}

/* Overview: whole blocks open their page */
[data-href] { cursor: pointer; }
.ov-row { transition: background .15s ease; }
.ov-row:hover td { background: var(--hover); }
.ov-row:hover .ov-proj b { color: var(--brand-2); }
a.ov-alert { color: var(--ink); text-decoration: none; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
a.ov-alert:hover { transform: translateY(-1px); border-color: rgba(138, 101, 18, .35); box-shadow: var(--shadow); }
a.ov-alert:focus-visible, a.ov-kpi:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.ov-alert-links { align-items: center; justify-content: space-between; }
.ov-alert-links b { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.ov-alert-links em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--gold); }
a.ov-kpi { color: inherit; text-decoration: none; transition: border-color .15s ease, transform .15s ease; }
a.ov-kpi:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.ov-site-card[data-href]:hover { border-color: var(--line-strong); background: var(--surface-3); }
.ov-progress { display: grid; gap: 5px; min-width: 200px; }
.ov-progress-top { display: flex; align-items: baseline; gap: 6px; }
.ov-progress-top strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.ov-progress-top span { font-size: 12px; color: var(--muted); font-weight: 600; }
.ov-progress i { display: block; height: 8px; border-radius: 999px; background: var(--track); overflow: hidden; }
.ov-progress b { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--lime), var(--brand-2)); }
.ov-progress small { font-size: 11.5px; color: var(--muted); }

/* Site attendance: mark the day in one place */
.section-title { margin: 26px 0 10px; font-size: 1.05rem; color: var(--muted); font-weight: 700; letter-spacing: .02em; }
.today-head { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
.today-head h2 { margin: 0; }
.today-nav { display: flex; align-items: center; gap: 6px; }
.today-nav input[type="date"] { width: auto; }
.today-tools { display: flex; justify-content: flex-end; margin: 4px 0 8px; }
.today-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.today-row { display: grid; grid-template-columns: minmax(180px, 1.3fr) auto minmax(0, auto); align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--line-strong); }
.today-row.mark-p { border-left-color: var(--brand-2); background: var(--blue-bg); }
.today-row.mark-h { border-left-color: #8fbdea; }
.today-row.mark-a { border-left-color: var(--red); background: var(--red-bg); }
.today-row.mark-l { border-left-color: var(--muted); }
.today-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.today-who .avatar { width: 34px; height: 34px; font-size: 11px; flex: none; }
.today-who div { display: grid; min-width: 0; }
.today-who small { color: var(--muted); font-size: 11.5px; }
.marks { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); gap: 2px; }
.mk { position: relative; cursor: pointer; }
.mk input { position: absolute; opacity: 0; pointer-events: none; }
.mk span { display: block; padding: 8px 12px; border-radius: 9px; font-size: 13px; font-weight: 700; color: var(--muted); transition: background .15s ease, color .15s ease; user-select: none; }
.mk:hover span { background: var(--surface-3); }
.mk input:focus-visible + span { outline: 2px solid var(--brand-2); outline-offset: 1px; }
.mk-p input:checked + span { background: var(--brand-2); color: #fff; }
.mk-h input:checked + span { background: #8fbdea; color: #0d3b72; }
.mk-a input:checked + span { background: var(--red); color: #fff; }
.mk-l input:checked + span { background: var(--muted); color: #fff; }
.today-extra { display: flex; gap: 8px; justify-content: flex-end; }
.today-extra label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.today-extra .qty-input { width: 64px; }
.today-status { justify-self: end; font-weight: 700; font-size: 13px; }
.today-row.mark-a .today-status { color: var(--red); }
.today-row.mark-p .today-status { color: var(--brand-2); }
@media (max-width: 760px) {
  .today-row { grid-template-columns: 1fr; }
  .marks { width: 100%; } .mk { flex: 1; } .mk span { text-align: center; padding: 10px 4px; }
  .today-extra { justify-content: flex-start; }
}

/* Running Account Bill sheet */
.rab-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin: 0 0 14px; }
.rab-kpi { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); min-width: 0; }
.rab-kpi > span { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.rab-kpi > strong { font-size: 24px; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; line-height: 1.15; max-width: 100%; overflow-wrap: anywhere; }
.rab-kpi > small { color: var(--muted); font-size: 12px; max-width: 100%; overflow-wrap: anywhere; }
.area-kpi strong, .split-part strong, .tile strong, .detail-head strong, .totals div strong, .project-card h2, .payout-head .figure strong {
  min-width: 0; max-width: 100%; overflow-wrap: anywhere;
}
.rab-kpi.strong { background: linear-gradient(135deg, var(--night), var(--brand-2)); border-color: var(--night); }
.rab-kpi.strong > span, .rab-kpi.strong > small { color: rgba(255, 255, 255, 0.78); }
.rab-kpi.strong > strong { color: #fff; }
.rab-kpi.strong .rab-meter { background: rgba(255, 255, 255, 0.22); }
.rab-kpi.strong .rab-meter b { background: #fff; }
.rab-meter { display: block; height: 6px; border-radius: 6px; background: var(--track); overflow: hidden; margin-top: 4px; }
.rab-meter b { display: block; height: 100%; border-radius: 6px; background: var(--brand-2); }
.rab-meter.alt b { background: #8fbdea; }

/* M-Book billing progress: raised / held / open */
.mbook-progress { padding: 16px 18px 14px; margin-bottom: 14px; }
.mbook-progress-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 14px; margin-bottom: 10px; }
.mbook-progress-head h2 { margin: 0; font-size: 15px; }
.mbook-progress-head p { margin: 0; font-size: 12.5px; }
.mbook-stack {
  display: flex; width: 100%; height: 12px; border-radius: 999px;
  overflow: hidden; background: var(--track, #e8edf5);
}
.mbook-stack.mini { height: 8px; min-width: 120px; max-width: 220px; }
.mbook-seg { display: block; height: 100%; min-width: 0; }
.mbook-seg.raised { background: var(--brand-2, #1d6b4f); }
.mbook-seg.held { background: #d97706; }
.mbook-seg.pending { background: #64748b; }
.mbook-seg.rest { background: transparent; }
.mbook-progress-legend {
  display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 10px 0 0; padding: 0;
  list-style: none; font-size: 13px;
}
.mbook-progress-legend li { display: inline-flex; align-items: center; gap: 6px; color: var(--ink, #1c2130); }
.mbook-progress-legend small { color: var(--muted); }
.mbook-progress-legend .total { margin-left: auto; font-weight: 700; }
.mbook-progress-legend .swatch {
  width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto;
}
.mbook-progress-legend .swatch.raised { background: var(--brand-2, #1d6b4f); }
.mbook-progress-legend .swatch.held { background: #d97706; }
.mbook-progress-legend .swatch.pending { background: #64748b; }
.mbook-progress-legend .swatch.potential {
  background: linear-gradient(90deg, var(--brand-2, #1d6b4f) 0 40%, #d97706 40% 70%, #64748b 70% 100%);
}
.mbook-progress-legend .swatch.rest { background: #e8edf5; border: 1px solid var(--line); }
.mbook-progress-legend .potential b { color: var(--brand, #1c2130); }
.mbook-book-list td small.muted { display: block; margin-top: 2px; font-size: 11px; }
.mbook-mini-cell { min-width: 140px; vertical-align: middle; }
.rab-upto { display: grid; gap: 3px; min-width: 140px; }
.rab-upto small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.rab-list tr.open td { background: var(--blue-bg); }
.rab-list .row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.rab-list .row-actions form { margin: 0; }
.rab-table th.grp a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.rab-table tr.rab-item-start td.sticky-a,
.rab-table tr.rab-item-start td.sticky-b {
  background: #e8edf5; font-weight: 700;
  border-top: 2px solid #1c2130;
  vertical-align: top;
}
.rab-table tr.rab-side-row td.sticky-a,
.rab-table tr.rab-side-row td.sticky-b { vertical-align: top; }
.rab-table .rab-side-label {
  display: inline-block; font-weight: 800; color: var(--brand, #1c2130); margin-right: 6px;
}
.rab-table tfoot tr.rab-foot-side td { font-weight: 700; }
.rab-panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 10px; }
.rab-panel-head h2 { margin: 0; }
h1 .pill { vertical-align: middle; font-size: 13px; }
.rab-panel { padding: 0; overflow: hidden; }
.rab-panel .actions, .rab-panel .small-note, .rab-panel .empty-note { padding: 0 18px; }
.rab-panel .actions { padding-top: 14px; }
.rab-panel .small-note { padding-bottom: 16px; }
.rab-wrap { max-height: 72vh; overflow: auto; border: 0; border-radius: 0; }
.rab-table { border-collapse: separate; border-spacing: 0; min-width: 100%; font-variant-numeric: tabular-nums; }
.rab-table th, .rab-table td { white-space: nowrap; border-bottom: 1px solid var(--row-line); border-right: 1px solid var(--row-line); padding: 8px 10px; background: var(--surface); }
.rab-table thead th { position: sticky; top: 0; z-index: 2; background: var(--group-bg); font-size: 12px; }
.rab-table thead tr:nth-child(2) th { top: 35px; background: var(--sub-bg); color: var(--muted); font-weight: 600; }
.rab-table th.grp { text-align: center; color: var(--brand); font-weight: 800; }
.rab-table th.grp.open { background: var(--brand-2); color: #fff; }
.rab-table .cum { background: var(--blue-bg); font-weight: 700; }
.rab-table thead .cum { color: var(--brand); }
.rab-table .sticky-a { position: sticky; left: 0; z-index: 1; box-sizing: border-box; width: 52px; min-width: 52px; max-width: 52px; }
.rab-table .sticky-b { position: sticky; left: 52px; z-index: 1; min-width: 200px; max-width: 280px; white-space: normal; }
.rab-table .sticky-c { position: sticky; left: 252px; z-index: 1; min-width: 120px; max-width: 160px; white-space: normal; box-shadow: 1px 0 0 var(--line); }
.rab-table thead .sticky-a, .rab-table thead .sticky-b, .rab-table thead .sticky-c { z-index: 3; }
.rab-table td.sticky-b strong { display: block; font-size: 13px; }
.rab-table td.sticky-b small { font-size: 11px; }
.rab-table td.over { background: var(--red-bg); color: var(--red); }
.rab-table tfoot td { position: sticky; bottom: 0; background: var(--group-bg); border-top: 2px solid var(--line-strong); z-index: 1; }
.rab-table tfoot .sticky-a, .rab-table tfoot .sticky-b, .rab-table tfoot .sticky-c { z-index: 2; }
.rab-table tbody tr:hover td { background: var(--hover); }
.rab-table tbody tr:hover td.cum { background: var(--picked); }
.rab-table td.cum.total { background: var(--group-bg); color: var(--brand); }
.rab-table td.edited { box-shadow: inset 3px 0 0 var(--red); }
.rab-table .rate-note { display: block; font-size: 11px; color: var(--muted); }
.rab-panel-tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.rab-panel .rab-history-note { margin: 0; padding-bottom: 10px; }
.rab-panel-note { margin: 0; font-size: 13px; }
.rab-table .bstart { border-left: 2px solid var(--line-strong); }
.rab-table.rab-history td.hit { background: var(--blue-bg); color: var(--brand); font-weight: 700; }
.rab-table.rab-history tbody tr:hover td.hit { background: var(--picked); }
.rab-table th.grp.open a { color: #fff; }
.rab-table td.edited .rate-note { color: var(--red); }

/* RAB entry page */
.rab-entry { padding: 0; overflow: clip; }
.rab-entry-tools { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; padding: 16px 18px 12px; }
.rab-remarks { flex: 1 1 320px; max-width: 560px; margin: 0; }
.rab-gst { flex: 0 1 220px; margin: 0; }
.rab-gst-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rab-gst-pick select { min-width: 120px; }
.rab-gst-pick input[data-gst-other-input] { width: 72px; }
.rab-gst-pick input[data-gst-other-input][hidden] { display: none; }
.rab-entry-tools .check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.rab-entry .table-wrap { max-height: 68vh; overflow: auto; border: 0; border-top: 1px solid var(--line); border-radius: 0; }

/* New / edit Measurement Book: use full viewport width; table scrolls when columns overflow. */
.frame:has(form.mbook-entry-full) {
  max-width: none;
  width: 100%;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}
form.mbook-entry-full {
  width: 100%;
  max-width: none;
}
form.mbook-entry-full .page-head .lede { max-width: none; }
form.mbook-entry-full .table-wrap {
  max-height: calc(100dvh - 210px);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
form.mbook-entry-full .mbook-entry-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}
form.mbook-entry-full .mbook-entry-table .mbook-hist-col {
  min-width: 4.25rem;
}
form.mbook-entry-full .mbook-entry-table td.mbook-hist-col.held-left,
form.mbook-entry-full .mbook-entry-table td.mbook-hist-col.held-released {
  min-width: 4.75rem;
  overflow: visible;
}
form.mbook-entry-full .mbook-entry-table th.this,
form.mbook-entry-full .mbook-entry-table td.this,
form.mbook-entry-full .mbook-entry-table td.c-in.this {
  min-width: 3.5rem;
}
/* Keep identity columns visible while scrolling prior-MB columns sideways. */
form.mbook-entry-full .mbook-entry-table .c-no {
  position: sticky; left: 0; z-index: 4;
  min-width: 2.5rem; width: 2.5rem;
  background: #e8edf5;
}
form.mbook-entry-full .mbook-entry-table .c-item {
  position: sticky; left: 2.5rem; z-index: 4;
  min-width: 11rem; max-width: 16rem;
  background: #eef2f7;
}
form.mbook-entry-full .mbook-entry-table .c-side {
  position: sticky; left: calc(2.5rem + 11rem); z-index: 4;
  min-width: 5.5rem;
  background: #f3f5f9;
}
form.mbook-entry-full .mbook-entry-table .c-terms,
form.mbook-entry-full .mbook-entry-table td[data-label="Terms"] {
  position: sticky; left: calc(2.5rem + 11rem + 5.5rem); z-index: 4;
  min-width: 7rem;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--line);
}
form.mbook-entry-full .mbook-entry-table thead .c-no,
form.mbook-entry-full .mbook-entry-table thead .c-item,
form.mbook-entry-full .mbook-entry-table thead .c-side,
form.mbook-entry-full .mbook-entry-table thead .c-terms {
  z-index: 6;
  background: var(--group-bg);
}
form.mbook-entry-full .mbook-entry-table thead tr:nth-child(2) .c-terms {
  background: var(--sub-bg);
}
.rab-entry-table { border-collapse: separate; border-spacing: 0; width: 100%; font-variant-numeric: tabular-nums; }
.rab-entry-table th, .rab-entry-table td { padding: 8px 10px; border-bottom: 1px solid var(--row-line); background: var(--surface); vertical-align: middle; }
.rab-entry-table thead th { position: sticky; top: 0; z-index: 2; background: var(--group-bg); font-size: 12px; }
.rab-entry-table thead tr:nth-child(2) th { top: 33px; background: var(--sub-bg); color: var(--muted); font-weight: 600; }
.rab-entry-table th.grp { text-align: center; color: var(--brand); font-weight: 800; border-left: 1px solid var(--line); }
.rab-entry-table th.this, .rab-entry-table td.c-in { background: var(--blue-bg); }
.rab-entry-table thead th.grp.this { background: var(--brand-2); color: #fff; }
.rab-entry-table .c-no { width: 36px; color: var(--muted); text-align: right; }
.rab-entry-table .c-item { min-width: 220px; max-width: 360px; }
.rab-entry-table .c-item strong { display: block; font-size: 13px; line-height: 1.3; }
.rab-entry-table .c-item small { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }
.rab-entry-table td.done { color: var(--muted); white-space: nowrap; }
.rab-entry-table td.done small { display: block; font-size: 11px; }
.rab-entry-table td.hold { color: #9a3412; font-weight: 600; white-space: nowrap; background: #fff7ed; }
.rab-entry-table td.c-in { padding: 6px 8px; width: 1%; }
.rab-entry-table td.c-in small.muted { display: block; margin-top: 2px; font-size: 10.5px; font-weight: 500; }
.entry-qty, .entry-rate { box-sizing: border-box; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px; text-align: right; font-variant-numeric: tabular-nums; }
.entry-qty { width: 92px; font-weight: 700; }
.entry-rate { width: 108px; color: var(--muted); }
.entry-qty:focus, .entry-rate:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 22%, transparent); color: var(--ink); }
.rab-entry-table td.c-in.edited .entry-rate { border-color: var(--red); color: var(--red); font-weight: 700; }
.rab-entry-table td.c-in.over { background: var(--red-bg); }
.rab-entry-table td.c-in.over .entry-qty { border-color: var(--red); color: var(--red); }
.rab-entry-table td.c-in.locked { background: var(--surface-3); }
.rab-entry-table td.c-in.locked .entry-qty,
.rab-entry-table td.c-in.locked .entry-qty:disabled {
  background: var(--surface-3); color: var(--muted); border-color: transparent;
  box-shadow: none; cursor: not-allowed; font-weight: 600;
}
.rab-entry-table td.dead { color: var(--muted); }
.rab-entry-table td.amt { font-weight: 700; white-space: nowrap; }
.rab-entry-table tr.has-qty td.c-no { box-shadow: inset 3px 0 0 var(--brand-2); color: var(--brand); font-weight: 700; }
.rab-entry-table tfoot td { position: sticky; bottom: 0; z-index: 1; background: var(--group-bg); border-top: 2px solid var(--line-strong); white-space: nowrap; }
/* RAB only — mbook keeps every splitup under an open side (see .mbook-entry-full rules). */
.rab-entry.only-entered:not(.mbook-entry-full) tr[data-entry]:not(.has-qty) { display: none; }
.rab-entry-bar { position: sticky; bottom: 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface); }
.rab-entry-bar p { margin: 0; font-size: 13.5px; color: var(--muted); }
.rab-entry-bar p b { color: var(--ink); }
.rab-entry-bar .actions { margin: 0; }
.rab-entry .small-note { padding: 0 18px 16px; margin: 0; }
@media (max-width: 760px) {
  .rab-entry-bar { bottom: calc(76px + env(safe-area-inset-bottom)); gap: 6px; padding: 8px 12px; box-shadow: 0 -6px 16px rgb(0 0 0 / 0.08); }
  .rab-entry-bar p { font-size: 12px; }
  .rab-entry-bar .actions { display: flex; flex-wrap: nowrap; gap: 8px; width: 100%; }
  .rab-entry-bar .actions .btn { flex: 1 1 0; min-height: 38px; padding-inline: 10px; }
  .rab-entry-bar .actions a.btn { display: none; }
  .rab-entry:not(.mbook-entry-full) .table-wrap { max-height: none; overflow: visible; }
  .rab-entry.mbook-entry-full .table-wrap {
    max-height: calc(100dvh - 240px);
    overflow: auto;
  }
  .rab-entry:not(.mbook-entry-full) .rab-entry-table,
  .rab-entry:not(.mbook-entry-full) .rab-entry-table tbody { display: block; width: 100%; }
  .rab-entry:not(.mbook-entry-full) .rab-entry-table thead,
  .rab-entry:not(.mbook-entry-full) .rab-entry-table tfoot { display: none; }
  .rab-entry:not(.mbook-entry-full) .rab-entry-table tr[data-entry] { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .rab-entry:not(.mbook-entry-full) .rab-entry-table tr[data-entry] td { display: block; padding: 0; border: 0; background: none; text-align: left; width: auto; }
  .rab-entry:not(.mbook-entry-full) .rab-entry-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 3px; font-size: 11px; font-weight: 600; color: var(--muted); }
  .rab-entry:not(.mbook-entry-full) .rab-entry-table .c-no { display: none !important; }
  .rab-entry:not(.mbook-entry-full) .rab-entry-table .c-item,
  .rab-entry:not(.mbook-entry-full) .rab-entry-table .c-so,
  .rab-entry:not(.mbook-entry-full) .rab-entry-table td.amt { grid-column: 1 / -1; max-width: none; }
  .rab-entry:not(.mbook-entry-full) .rab-entry-table .c-so { font-size: 12.5px; }
  .rab-entry.mbook-entry-full .rab-entry-table,
  .rab-entry.mbook-entry-full .rab-entry-table tbody {
    display: table; width: max-content; min-width: 100%;
  }
  .rab-entry.mbook-entry-full .rab-entry-table thead { display: table-header-group; }
  .rab-entry.mbook-entry-full .rab-entry-table tfoot { display: table-footer-group; }
  .rab-entry.mbook-entry-full .rab-entry-table tr[data-entry] { display: table-row; }
  .rab-entry.mbook-entry-full .rab-entry-table tr[data-entry] td { display: table-cell; }
  .rab-entry:not(.mbook-entry-full) .rab-entry-table .c-so::before { display: inline !important; margin-right: 6px; }
  .rab-entry:not(.mbook-entry-full) .rab-entry-table td.done small { display: inline; margin-left: 4px; }
  .rab-entry:not(.mbook-entry-full) .rab-entry-table tr[data-entry] td.amt { display: flex; justify-content: space-between; align-items: baseline; padding-top: 6px; border-top: 1px dashed var(--line); }
  .rab-entry:not(.mbook-entry-full) .rab-entry-table td.amt::before { margin: 0; }
  .rab-entry:not(.mbook-entry-full) .rab-entry-table tr.has-qty { box-shadow: inset 3px 0 0 var(--brand-2); }
  .rab-entry:not(.mbook-entry-full) .entry-qty,
  .rab-entry:not(.mbook-entry-full) .entry-rate { width: 100%; height: 40px; font-size: 15px; }
}

/* Supplier prices on a purchase order */
.good-text { color: var(--brand-2); }
.price-cell { min-width: 220px; }
.gst-cell { min-width: 108px; vertical-align: top; }
.gst-cell select { width: 108px; min-width: 0; height: 36px; padding: 0 8px; }
.gst-cell input { display: block; width: 88px; margin-top: 6px; height: 36px; }
.gst-cell input[hidden] { display: none; }
th.gst-head {
  min-width: 118px; white-space: nowrap; font-weight: 700;
}
th.gst-head select[data-gst-all] {
  display: block; width: 100%; max-width: 7.5rem; margin-top: 4px;
  height: 28px; padding: 0 6px; font-size: 12px; font-weight: 600;
}
.price-hints { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.price-hints .hint { border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 2px 8px; font: inherit; font-size: 11px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.price-hints .hint:hover { border-color: var(--brand-2); color: var(--brand); }
.price-hints .hint.best { border-color: var(--brand-2); color: var(--brand-2); font-weight: 700; }
.price-hints .hint.own { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.price-hints .hint.so { background: var(--blue-bg); color: var(--brand); }
/* Sales order Excel viewer */
.xl-panel { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; }
.xl-panel h2 { margin: 0 0 4px; }
.xl-panel p { margin: 0; }
.xl-panel-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: #e3f1e8; color: #1d7a46; }
.xl-panel-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; }
a.xl-ref { display: inline-flex; flex-direction: column; text-decoration: none; color: inherit; line-height: 1.25; }
a.xl-ref small { font-size: 10px; color: #1d7a46; white-space: nowrap; }
a.xl-ref:hover small { text-decoration: underline; }
.xl-key { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.xl-key i { width: 14px; height: 12px; border-radius: 3px; background: rgba(37, 132, 255, 0.28); border: 1px solid rgba(37, 132, 255, 0.55); display: inline-block; }
.xl-key.soft i { background: rgba(37, 132, 255, 0.12); border-color: rgba(37, 132, 255, 0.3); }
.xl-key.amber i { background: #fff; border: 2px solid #e8890c; }
.xl-key.yellow i { background: rgba(255, 200, 40, 0.55); border-color: #d6a400; }
.xl-key.green i { background: rgba(60, 180, 90, 0.3); border-color: #3c9a5a; }
.xl-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 13px; margin: 8px 0 20px; }
.xl-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 12px; }
.xl-version label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.xl-version select { max-width: min(560px, 80vw); }
.xl-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.xl-stat { font-size: 12.5px; padding: 5px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.xl-stat.on { background: rgba(37, 132, 255, 0.1); border-color: rgba(37, 132, 255, 0.35); }
.xl-stat.diff { background: #fff4e5; border-color: #f0b25f; color: #8a4b00; }
.xl-stat.warn { background: var(--red-bg); border-color: #e3b4b0; color: var(--red); }
.xl-stat.muted-stat { color: var(--muted); }
.xl { border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.xl.full { position: fixed; inset: 0; z-index: 200; border-radius: 0; border: 0; }
html.xl-locked, html.xl-locked body { overflow: hidden; }
.xl-toolbar { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.xl-toolbar2 { padding: 6px 10px; gap: 6px 14px; font-size: 13px; }
.xl-name { width: 120px; font-family: var(--mono); font-size: 13px; padding: 5px 8px; }
.xl-fx-label { font-style: italic; font-weight: 700; color: var(--muted); font-family: Georgia, serif; }
.xl-fx { flex: 1 1 320px; min-width: 200px; font-family: var(--mono); font-size: 13px; padding: 5px 8px; }
.xl-fx[readonly] { background: var(--surface); }
.xl-fx.is-formula { color: #1d5e9e; }
.xl-find { display: flex; align-items: center; gap: 6px; }
.xl-find input { width: 200px; padding: 5px 8px; font-size: 13px; }
.xl-find small { color: var(--muted); white-space: nowrap; }
.xl-check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.xl-edit-toggle { font-weight: 700; }
.xl.editing .xl-edit-toggle { color: #8a5a00; }
.xl-zoom { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-variant-numeric: tabular-nums; }
.xl-zoom [data-xl-zoom] { min-width: 42px; text-align: center; font-size: 13px; }
.xl-info { margin: 0; padding: 6px 12px; min-height: 32px; font-size: 13px; border-bottom: 1px solid var(--line); color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.xl-info.on { background: rgba(37, 132, 255, 0.08); color: var(--ink); }
.xl-info.soft { background: rgba(37, 132, 255, 0.04); }
.xl-info.warn { background: #fff4e5; color: #8a4b00; }
.xl-info code { font-family: var(--mono); font-size: 12px; }
.xl-info a { font-weight: 700; }
.xl-diff { color: #a85a00; }
.xl-grid { position: relative; height: calc(100vh - 290px); min-height: 460px; }
.xl.full .xl-grid { height: auto; flex: 1 1 auto; min-height: 0; }
.xl-scroll { position: absolute; inset: 0; overflow: auto; background: #fff; overscroll-behavior: contain; }
.xl-canvas { position: sticky; top: 0; left: 0; display: block; outline: none; }
.xl-spacer { pointer-events: none; }
.xl-editor { position: absolute; z-index: 3; border: 2px solid #1d7a46; padding: 0 4px; font: 13px var(--sans); background: #fffef5; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18); border-radius: 0; }
.xl-loading { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255, 255, 255, 0.82); font-weight: 600; color: var(--muted); }
.xl-loading[hidden] { display: none; }
.xl-tabs { display: flex; gap: 2px; overflow-x: auto; padding: 0 8px; background: var(--surface-3); border-top: 1px solid var(--line-strong); scrollbar-width: thin; }
.xl-tab { flex: none; border: 0; border-bottom: 3px solid var(--tab, transparent); background: transparent; padding: 7px 14px; font: 600 13px var(--sans); color: var(--muted); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; white-space: pre; }
.xl-tab b { font-size: 10.5px; padding: 1px 6px; border-radius: 999px; background: rgba(37, 132, 255, 0.16); color: #134f8f; }
.xl-tab:hover { background: var(--surface-2); color: var(--ink); }
.xl-tab[aria-selected="true"] { background: #fff; color: #1d7a46; box-shadow: inset 0 3px 0 #1d7a46; }
.xl-tab.is-hidden { display: none; font-style: italic; opacity: 0.75; }
.xl.show-hidden-tabs .xl-tab.is-hidden { display: inline-flex; }
.xl-editbar { display: flex; gap: 10px; align-items: center; padding: 8px 12px; background: #fff8e1; border-top: 1px solid #f0d58a; flex-wrap: wrap; }
.xl-editbar[hidden] { display: none; }
.xl-editbar-text { flex: 1 1 260px; font-size: 13px; }
.xl-editbar-text .warn { color: var(--red); }
.xl-editbar input[name="note"] { flex: 1 1 220px; padding: 5px 8px; font-size: 13px; }
.xl-attach { max-width: 760px; }
tr.is-current td { background: var(--picked); }
.actions-cell { white-space: nowrap; }
@media (max-width: 760px) {
  .xl-panel { grid-template-columns: 1fr; }
  .xl-panel-icon { display: none; }
  .xl-grid { height: 65vh; min-height: 360px; }
  .xl-find input { width: 140px; }
  .xl-zoom { margin-left: 0; }
}

/* Edit sales order */
.rev-kpis .kpi small { display: block; min-height: 1.2em; font-size: 12px; font-weight: 700; }
.rev-kpis .kpi small.up { color: var(--green, #1a7f37); }
.rev-kpis .kpi small.down { color: var(--red); }
.rev-table td.edited { background: rgba(255, 196, 0, .2); }
.rev-table td.edited .cell-input { border-color: #d4a106; font-weight: 700; }
.rev-table td.over { background: var(--red-bg); }
.rev-table td.over .cell-input { border-color: var(--red); color: var(--red); }
.rev-table tr.rev-section td { font-size: 12px; }
.so-revise.rev-only-changed tr[data-rev-row]:not(.rev-changed) { display: none; }
.rev-save { position: sticky; bottom: 0; z-index: 5; box-shadow: 0 -6px 18px rgba(0, 0, 0, .08); }

/* Vendor sub-bills */
.sb-grid th.bill-col { min-width: 190px; vertical-align: top; }
.sb-grid .bill-head { display: grid; gap: 5px; text-align: left; font-weight: 400; }
.sb-grid .bill-head input { min-height: 30px; padding: 4px 8px; font-size: 12.5px; }
.sb-grid .bill-sub { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sb-grid .split-cell { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sb-grid .split-cell input, .sb-grid tfoot input { width: 100%; min-width: 0; }
.sb-grid tfoot textarea { width: 100%; min-width: 0; font-size: 12.5px; }
.sb-grid td[data-split-left] { font-weight: 700; }
.sb-grid .hint { cursor: default; }
.price-hints .hint.no-cost { color: var(--red); }
.sub-bills tr.muted td { opacity: .6; }
.merged { margin-top: 14px; }
.merged summary { cursor: pointer; font-weight: 700; margin-bottom: 8px; }
.merged td.parts { display: flex; flex-wrap: wrap; gap: 4px; }
.merged .part { border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; font-size: 12px; text-decoration: none; white-space: nowrap; }
.merged .part.draft { border-style: dashed; color: var(--muted); }
.bill-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 0 0 14px; }
.bill-kpis div { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: var(--surface); }
.bill-kpis dt { font-size: 12px; color: var(--muted); }
.bill-kpis dd { margin: 2px 0 0; font-weight: 800; font-variant-numeric: tabular-nums; }
.bill-kpis .due dd { color: var(--red); }
.inline-add { margin-top: 10px; padding-top: 12px; border-top: 1px dashed var(--line); }
.inline-add .form-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.inline-add label.check { align-self: end; min-height: 38px; }
#invoices h3 { margin: 16px 0 8px; font-size: 15px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin: 0; }
.kv dt { font-size: 12px; color: var(--muted); }
.kv dd { margin: 2px 0 0; }

/* Overhead budget and unsaved-draft note */
.so-table .cell-input.wide-cell { max-width: none; min-width: 180px; text-align: left; }
.oh-add { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.draft-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 10px; padding: 8px 12px; border: 1px solid #e3c25c; border-radius: 10px; background: #fff8e1; color: #6b5200; font-size: 13px; }
.draft-note .link-btn { font-weight: 700; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .draft-note { background: #3a3110; border-color: #806a1f; color: #f4dc8a; } }
:root[data-theme="dark"] .draft-note { background: #3a3110; border-color: #806a1f; color: #f4dc8a; }
.margin-sheet .margin-row td { font-size: 15px; }
.margin-sheet .margin-row.net td { border-top: 2px solid var(--line); }
.margin-sheet .group-row td { padding-top: 14px; font-weight: 700; color: var(--muted); text-transform: uppercase; font-size: 11.5px; letter-spacing: .04em; }
.panel .sub-head { margin: 18px 0 4px; font-size: 15px; }
.var-fold { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 10px; }
.so-table tr.var-rest td { color: var(--muted); }
.so-table tr.var-fit td { background: color-mix(in srgb, var(--gold-bg, #f7f0de) 55%, var(--surface)); }
.so-table tr.var-usage td { font-size: 12.5px; color: var(--muted); background: color-mix(in srgb, var(--surface) 88%, var(--line)); }
.so-table tr.var-usage a { font-weight: 650; }

.approval-panel { border-left: 3px solid var(--accent, #2f6fde); }
.approval-line, .approval-why { display: block; width: min(320px, 100%); margin: 0 0 6px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font: inherit; }
.approval-why { margin-top: 6px; }
.approval-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; margin-top: 10px; }
.approval-actions .inline-form input[name=note] { min-width: 260px; }
.approval-done { margin: 0 0 12px; }
.review-panel .review-fields { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 6px 16px; margin: 12px 0; }
.review-panel .review-fields dt { color: var(--muted, #667); }
.review-panel .review-fields dd { margin: 0; font-weight: 600; white-space: pre-wrap; }
.review-panel .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.setup-steps { margin: 8px 0 0 18px; line-height: 1.7; }
.setup-steps .mono-cell { word-break: break-all; }

/* Budgeting: the full (100%) figures stay plain, the selected-% figures are tinted, held back is muted. */
.so-table th.at-full, .so-table td.at-full { color: var(--muted, #5b6472); }
.so-table th.at-sel, .so-table td.at-sel { background: color-mix(in srgb, var(--accent, #2f6fde) 9%, transparent); }
.so-table th.group-head.at-sel { color: var(--accent, #2f6fde); border-bottom: 2px solid var(--accent, #2f6fde); }
.so-table th.group-head.at-full { border-bottom: 2px solid var(--line, #d9dee5); }
.so-table td.at-held, .so-table th.at-held { color: var(--muted, #5b6472); font-style: italic; }
.budget-key { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 10px 0 6px; color: var(--muted, #5b6472); font-size: 13px; }
.budget-key .key { display: inline-block; padding: 2px 8px; border-radius: 4px; font-weight: 600; font-size: 12px; color: var(--text, #1d232b); }
.budget-key .key.full { border: 1px solid var(--line, #d9dee5); }
.budget-key .key.sel { background: color-mix(in srgb, var(--accent, #2f6fde) 14%, transparent); color: var(--accent, #2f6fde); }
.budget-key .key.held { font-style: italic; border: 1px dashed var(--line, #d9dee5); }

/* Purchase order savings and live budget tracking */
.po-savings .good dd { color: var(--good, #15803d); font-weight: 700; }
.po-savings .bad dd { color: var(--bad, #b91c1c); font-weight: 700; }
.budget-track .split-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* Material request timeline */
.journey { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 0; }
.journey li { position: relative; display: flex; gap: 12px; padding: 0 0 14px 0; }
.journey li:not(:last-child)::before { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 2px; background: var(--line); }
.journey li.done:not(:last-child)::before { background: var(--good, #15803d); }
.journey-dot { flex: none; width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); }
.journey li.done .journey-dot { border-color: var(--good, #15803d); background: var(--good, #15803d); }
.journey li.stop:not(:last-child)::before { background: var(--red); }
.journey li.stop .journey-dot { border-color: var(--red); background: var(--red); }
.journey li.stop strong { color: var(--red); }
.journey li.todo strong { color: var(--muted); font-weight: 600; }
.journey-body { min-width: 0; flex: 1; }
.journey-note { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; font-weight: 500; }
.journey li.has-pending .journey-dot { border-color: var(--gold); }

.pending-fold {
  margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.pending-fold > summary {
  list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline;
  justify-content: space-between; gap: 6px 12px; padding: 10px 12px; font-weight: 700;
}
.pending-fold > summary::-webkit-details-marker { display: none; }
.pending-fold > summary::after {
  content: "▾"; margin-left: auto; color: var(--muted); font-weight: 700;
  transition: transform 0.15s ease;
}
.pending-fold[open] > summary::after { transform: rotate(-180deg); }
.pending-fold-label { color: var(--ink); }
.pending-fold-open { display: none; }
.pending-fold[open] .pending-fold-closed { display: none; }
.pending-fold[open] .pending-fold-open { display: inline; }
.pending-fold-hint { font-size: 12px; font-weight: 600; }
.pending-fold-table { border-top: 1px solid var(--line); padding: 0; }
.pending-fold-table table { margin: 0; }
.pending-fold-table th { font-size: 11px; }

.pending-panel-head {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.pending-panel-head h2 { margin-bottom: 4px; }
.pending-lede { margin: 0; max-width: 52ch; }
.pending-toggle {
  display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 7px 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.pending-toggle:has(input:checked) {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--line));
  background: color-mix(in srgb, var(--blue-bg) 65%, var(--surface));
  color: var(--brand);
}
.pending-toggle input { margin: 0; }
.pending-summary { margin: 12px 0 0; }
.pending-panel .pending-fold-page { margin-top: 12px; }
.pending-panel.is-collapsed .pending-fold-page,
.pending-panel.is-collapsed .pending-summary { display: none; }

/* Non-billable / billable item added inside a product. The form spans the row so a phone does not crush each field into a column. */
.nb-add-row > td { background: var(--surface-2); }
.nb-add-row[data-nb-add] > td { background: color-mix(in srgb, var(--blue-bg) 55%, var(--surface-2)); }
.nb-add-row[data-bb-add] > td { background: color-mix(in srgb, var(--bill-bg) 55%, var(--surface-2)); }
.nb-toggle[data-nb-toggle][aria-expanded="true"] { color: var(--blue); border-color: var(--blue); background: var(--blue-bg); }
.nb-toggle[data-bb-toggle][aria-expanded="true"] { color: var(--bill-ink); border-color: var(--bill-ink); background: var(--bill-bg); }
.nb-add-row .nb-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
.nb-add-row .nb-name { flex: 1 1 280px; width: auto; min-width: 180px; max-width: none; text-align: left; }
.nb-add-row .nb-uom,
.nb-add-row .nb-form [data-nb-qty] { flex: 0 0 120px; width: 120px; max-width: none; text-align: left; }
.nb-add-row .nb-form input.nb-uom[hidden] { display: none; }
.nb-add-row .nb-form .btn { flex: none; }
.nb-add-row .bad-text { flex: 1 1 100%; }
@media (max-width: 760px) {
  .pick-table.fit tr.nb-add-row .nb-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 88px) auto; gap: 8px; width: 100%; }
  .pick-table.fit tr.nb-add-row .nb-name,
  .pick-table.fit tr.nb-add-row .bad-text { grid-column: 1 / -1; width: 100%; }
  .pick-table.fit tr.nb-add-row .nb-form input.nb-uom:not([hidden]) { grid-column: 1 / -1; }
  .pick-table.fit tr.nb-add-row .nb-uom,
  .pick-table.fit tr.nb-add-row .nb-form input.nb-uom,
  .pick-table.fit tr.nb-add-row .nb-form [data-nb-qty] { width: 100%; min-width: 0; }
  .pick-table.fit tr.nb-add-row .btn { min-height: 36px; }
  .pick-table.fit tr.nb-new-row .tag {
    display: block; margin: 4px 0 0; padding: 2px 8px; font-size: 11px; white-space: normal; width: fit-content;
  }
}
.nb-new-row .nb-drop { border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.nb-new-row .nb-drop:hover { color: var(--bad, #b91c1c); }

/* Common OEG site picker: site dropdown, multi-contact ticks, or manual edit. */
.site-picker { margin: 4px 0 0; display: grid; gap: 12px; }
.site-picker-mode { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.site-mode {
  display: inline-flex; align-items: center; gap: 8px; margin: 0;
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer;
}
.site-mode:has(input:checked) {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
  background: color-mix(in srgb, var(--blue-bg) 70%, var(--surface));
  color: var(--brand);
}
.site-mode input { margin: 0; }
.site-picker-site { margin: 0; }
.site-picker-contacts-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 8px; font-size: 13px; font-weight: 700; color: var(--ink);
}
.site-picker-checks { display: grid; gap: 6px; }
.site-picker-check {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); cursor: pointer; font-size: 13px; line-height: 1.35;
}
.site-picker-check:hover { border-color: var(--line-strong, var(--brand-2)); }
.site-picker-check:has(input:checked) {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
  background: color-mix(in srgb, var(--blue-bg) 70%, var(--surface));
}
.site-picker-check input { margin-top: 2px; flex: none; }
.site-picker-address {
  margin: 0; padding: 12px 14px; border-radius: 10px;
  background: var(--surface-2, #f4f6f9); border: 1px solid var(--line);
  white-space: pre-wrap; font: inherit; font-size: 13px; line-height: 1.45; color: var(--ink);
}
.site-picker-chosen {
  margin: 0; font-size: 12.5px; font-weight: 600; color: var(--muted); line-height: 1.4;
}
.site-picker-edit-hint { margin: 0; }
[data-manual-panel] { display: grid; gap: 12px; }
[data-manual-panel][hidden] { display: none !important; }
[data-site-panel][hidden] { display: none !important; }

/* Billable vs non-billable sub / new rows: colour wash + different arrow tab. */
.pick-table tr.is-nb > td { background: color-mix(in srgb, var(--blue-bg) 70%, var(--surface)); }
.pick-table tr.is-bb > td { background: color-mix(in srgb, var(--bill-bg) 75%, var(--surface)); }
.pick-table tr.is-nb > td:first-child { box-shadow: inset 3px 0 0 var(--blue); }
.pick-table tr.is-bb > td:first-child { box-shadow: inset 3px 0 0 var(--bill-ink); }
.sub-indent.nb-indent {
  color: var(--blue);
  margin-left: 4px;
  margin-right: 8px;
}
.sub-indent.bb-indent {
  color: var(--bill-ink);
  margin-left: 18px;
  margin-right: 8px;
  font-size: 1.05em;
}
.nb-new-row .tag.nb-tag {
  background: var(--blue-bg);
  color: var(--blue);
  border-color: color-mix(in srgb, var(--blue) 35%, var(--line));
}
.nb-new-row .tag.bb-tag {
  background: var(--bill-bg);
  color: var(--bill-ink);
  border-color: color-mix(in srgb, var(--bill-ink) 35%, var(--line));
}
.nb-new-row.is-nb .chip.non,
.nb-new-row.is-bb .chip.bill { margin-left: 2px; }

/* GRN arrival history */
.arrivals { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.arrival { border-left: 3px solid var(--accent, #2f7d5b); padding: 8px 12px; background: var(--surface-2, rgba(0,0,0,0.02)); border-radius: 6px; }
.arrival.closed { border-left-color: var(--bad, #b3261e); }
.arrival-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.arrival-head .btn { margin-left: auto; }
.arrival-items { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.arrival-items li { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }
.arrival-items b { font-weight: 600; white-space: nowrap; }
form.inline { display: inline; }
form[data-lvl-toggle] { margin: 0; display: inline; }
form[data-lvl-toggle] button.lvl { cursor: pointer; font: inherit; font-size: 11px; font-weight: 800; line-height: 1.4; min-height: 0; box-shadow: none; }
form[data-lvl-toggle] button.lvl:hover { filter: brightness(1.08); outline: 2px solid var(--blue, #3b82f6); outline-offset: 1px; }
form[data-lvl-toggle] button.lvl:disabled { opacity: 0.6; cursor: progress; }

.so-table.grid-lines th, .so-table.grid-lines td { border: 1px solid var(--line); }
.so-table.grid-lines col.gs { border-left: 2px solid color-mix(in srgb, var(--ink) 35%, var(--line)); }
.so-table.grid-lines thead th { background: var(--surface-2); }
.so-table.grid-lines th.group-head { border-bottom: 1px solid var(--line); }
.so-table .cell-input.own { border-color: var(--brand); font-weight: 700; }
.so-table .cell-input.narrow { min-width: 64px; max-width: 84px; }

/* Man-days entry, contractor add and register filter: one row of fields that wraps on a phone. */
.mandays-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-top: 12px; }
.mandays-form .field { margin: 0; }
.mandays-form .grow { flex: 1 1 240px; }
.mandays-table tr.muted td { color: var(--muted, #888); }
tr.sub-row td:first-child { padding-left: 28px; }
td.row-actions { white-space: nowrap; }
td.row-actions form { display: inline; }

tr.nb-row { background: color-mix(in srgb, #d97706 18%, var(--surface)); }
.nb-flag {
  margin: 0 0 14px;
  padding: 8px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, #d97706 18%, var(--surface));
  font-weight: 650;
}
.nb-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #ffedd5;
  color: #9a3412;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

/* L1 material-request flow */
.flow-projects { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.flow-projects a { text-decoration: none; font-size: 12px; font-weight: 700; color: var(--ink); background: var(--glass); border: 1px solid var(--glass-line); border-radius: 999px; padding: 5px 10px; }
.flow-projects a.on, .flow-projects a:hover { background: var(--lime); color: var(--lime-ink); border-color: var(--lime); }
.flow-back { margin: 0 0 12px; }
.flow-legend { display: flex; gap: 6px; overflow-x: auto; list-style: none; padding: 0 0 8px; margin: 0 0 12px; scrollbar-width: thin; }
.flow-legend li { flex: 0 0 auto; font-size: 12px; font-weight: 650; color: var(--muted); border: 1px solid var(--glass-line); background: var(--glass); border-radius: 999px; padding: 6px 10px; }
.flow-legend li b { color: var(--ink); }
.flow-legend li.hold { color: var(--ink); border-color: var(--gold); background: var(--gold-bg); }
.flow-board { display: flex; gap: 10px; overflow-x: auto; align-items: flex-start; padding-bottom: 16px; scrollbar-width: thin; }
.flow-col { flex: 0 0 232px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.flow-col header { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px 10px 14px; }
.flow-col header h2 { margin: 0; font-size: 14px; }
.flow-col header p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.flow-col header span { position: absolute; top: 10px; right: 12px; font-size: 12px; font-weight: 750; color: var(--muted); }
.flow-col.order header, .flow-col.po header, .flow-col.road header, .flow-col.approval header { border-color: var(--gold); }
.flow-card { display: block; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.flow-card.hold { box-shadow: inset 3px 0 0 var(--gold); }
.flow-card.done { box-shadow: inset 3px 0 0 var(--green); }
.flow-card.stop { box-shadow: inset 3px 0 0 var(--red); }
.flow-card:hover { border-color: var(--lime); }
.flow-card-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.flow-card-top span { font-size: 11px; font-weight: 750; color: var(--slate); }
.flow-card p { margin: 6px 0; font-size: 13px; }
.flow-card dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 0; }
.flow-card dt { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.flow-card dd { margin: 0; font-size: 13px; font-weight: 700; }
.flow-card footer { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.flow-card footer time { font-family: var(--mono); }
.flow-empty { margin: 0; font-size: 12px; color: var(--muted); padding: 4px 2px; }
.flow-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.flow-steps li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 0 0 14px; position: relative; }
.flow-steps li:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--line); }
.flow-steps li.done::before { background: var(--green); }
.flow-step-no { width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center; font-size: 12px; font-weight: 750; background: var(--glass); border: 1px solid var(--line); position: relative; z-index: 1; }
.flow-steps li.done .flow-step-no { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.flow-steps li.wait .flow-step-no { background: var(--gold-bg); border-color: var(--gold); }
.flow-steps li p { margin: 2px 0 0; font-size: 13px; }

/* One material request, with a wire for every delivery and receipt. */
.trace {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background-color: color-mix(in srgb, var(--surface) 88%, #e7ebf2);
  background-image: radial-gradient(circle, color-mix(in srgb, var(--ink) 16%, transparent) 1px, transparent 1.2px);
  background-size: 18px 18px;
  padding: 22px 18px 28px;
}
.trace-sheet { position: relative; width: max-content; min-width: 100%; min-height: 180px; }
.trace-board { position: relative; z-index: 1; display: grid; column-gap: 78px; row-gap: 14px; align-items: stretch; width: max-content; min-width: 100%; }
.trace-head { margin: 0; align-self: end; font-size: 11px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.trace-wires { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; z-index: 2; }
.trace-wires .wire { fill: none; stroke: #1c2130; stroke-width: 2; }
.trace-wires .wire.wait { stroke: var(--gold); }
.trace-wires .wire.stop { stroke: var(--red); }
.trace-wires .joint { stroke: none; }
.trace-wires .joint.done { fill: #1c2130; }
.trace-wires .joint.wait { fill: var(--gold); }
.trace-wires .joint.stop { fill: var(--red); }
.trace-card { display: flex; flex-direction: column; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 28px rgba(20, 28, 45, .06); padding: 12px 14px 10px; min-height: 0; cursor: pointer; }
.trace-card.wait { box-shadow: inset 3px 0 0 var(--gold), 0 10px 28px rgba(20, 28, 45, .06); }
.trace-tag { display: inline-block; margin: 0 0 8px 6px; padding: 2px 8px; border-radius: 999px; background: #fde8e8; color: #b91c1c; border: 1px solid #f3b4b4; font-size: 11px; font-weight: 750; letter-spacing: .02em; vertical-align: middle; }
.trace-card.stop { background: #fff5f5; border-color: #e7a3a3; box-shadow: inset 4px 0 0 #dc2626, 0 10px 28px rgba(20, 28, 45, .06); }
.trace-card.stop h4 { color: #b91c1c; }
.trace-card.shade.stop { background: #2a1619; border-color: #7f1d1d; color: #fde8e8; }
.trace-card.shade.stop h4 { color: #fecaca; }
.trace-card.shade .trace-tag { background: #7f1d1d; border-color: #b91c1c; color: #fff; }
.trace-card:hover { border-color: var(--lime); }
.trace-kicker { display: inline-block; margin: 0 0 8px; padding: 2px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 11px; font-weight: 750; }
.trace-kind { margin: 0; font-size: 11px; font-weight: 700; color: var(--muted); }
.trace-card h4 { margin: 1px 0 8px; font-size: 15px; }
.trace-card dl { margin: 0; }
.trace-card dl div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.trace-card dt { font-size: 12px; color: var(--muted); font-weight: 550; }
.trace-card dd { margin: 0; font-size: 12px; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.trace-card dl { flex: 1; }
.trace-open { align-self: flex-start; margin-top: 8px; font-size: 12px; font-weight: 750; }
.trace-card.shade { background: #1c2430; color: #f4f7fb; border-color: #0e1520; }
.trace-card.shade .trace-kind, .trace-card.shade dt { color: #b7c3d4; }
.trace-card.shade .trace-kicker { background: #2a3444; border-color: #3a4658; color: #f4f7fb; }
.trace-card.shade dl div { border-top-color: rgba(255, 255, 255, .12); }
.trace-card.shade .trace-open { color: #fff; }
.trace-card.dim { opacity: 0.22; }
.trace-wires .dim { opacity: 0.1; }
.trace[data-focus] .trace-card:not(.dim) { border-color: #1c2130; }

/* Client Measurement Book */
.mbook-table th,
.mbook-table td {
  border-bottom-color: #8b93a7 !important;
  border-right-color: #8b93a7 !important;
}
.mbook-table .mbook-item td {
  background: #e8edf5;
  font-weight: 700;
  border-top: 2px solid #1c2130 !important;
  color: #1c2130;
}
.mbook-table .mbook-item td.sticky-a,
.mbook-table .mbook-item td.sticky-b { background: #e8edf5; }
.mbook-table .mbook-side td {
  background: #f3f5f9;
  font-weight: 800;
  border-top: 2px solid #3d4659 !important;
  color: #1c2130;
}
.mbook-table .mbook-ms td {
  background: var(--surface);
  border-top: 1px solid #b4bbc8 !important;
}
.mbook-table .mbook-ms.billed td { background: rgba(37, 132, 255, 0.07); }
.mbook-table tbody tr:hover td { background: inherit; }
.mbook-table tbody tr.mbook-ms:hover td { background: #f7f8fb; }
.mbook-table tbody tr.mbook-ms.billed:hover td { background: rgba(37, 132, 255, 0.1); }
.mbook-ms-label { display: block; font-weight: 800; color: #1c2130; }
.mbook-side-note { display: block; margin-top: 2px; font-size: 11px; font-weight: 500; max-width: 28rem; }
.mbook-side .mbook-side-note { color: var(--muted); }
.mbook-ms .mbook-claims small.muted { display: block; margin-top: 2px; }
.mbook-tick { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.mbook-tick input { width: 16px; height: 16px; flex: 0 0 auto; accent-color: var(--brand-2); }
.mbook-tick-all { flex-wrap: wrap; max-width: 18rem; white-space: normal; line-height: 1.35; }
.mbook-tick-all small { font-weight: 600; color: var(--muted); }
.mbook-hold-list { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; max-width: 18rem; }
.mbook-hold-inline {
  flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  max-width: none; margin-top: 6px;
}
.mbook-hold-src { white-space: normal; line-height: 1.3; }
.mbook-hold-pick { vertical-align: top !important; }
.mbook-entry-table th.this { min-width: 0; width: 1%; }
.mbook-entry-table td[data-label="Past"],
.mbook-entry-table td[data-label="Fresh"],
.mbook-entry-table td[data-label="Total"],
.mbook-entry-table td[data-label="Held"],
.mbook-entry-table td[data-label="Amount"] { min-width: 0; width: 1%; }
.mbook-rest-row td { color: var(--muted); font-size: 12.5px; }
.mbook-claims { min-width: 160px; padding-left: 1.25rem !important; }
.mbook-table.mbook-history th.grp,
.mbook-entry-table.mbook-history th.grp { text-align: center; }
.mbook-table.mbook-history td.hit,
.mbook-entry-table.mbook-history td.hit {
  background: var(--blue-bg); color: var(--brand); font-weight: 700;
}
.mbook-table.mbook-history tbody tr:hover td.hit,
.mbook-entry-table.mbook-history tbody tr:hover td.hit { background: var(--picked); }
.mbook-table.mbook-history td.hit .rate-note,
.mbook-entry-table.mbook-history td.hit .rate-note {
  display: block; font-size: 11px; font-weight: 600; color: var(--muted);
}
.mbook-entry-table.hist-collapsed .mbook-hist-col { display: none !important; }
.mbook-entry-table.hist-open-only .mbook-hist-col.hist-idle { display: none !important; }
.mbook-entry-table.hist-none-open .mbook-hist-col { display: none !important; }
.mbook-hist-modes {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px;
  padding: 2px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-2, #f3f5f9);
}
.mbook-hist-modes-label {
  padding: 0 8px; font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted);
}
.mbook-hist-modes .btn.small {
  min-width: 0; padding: 4px 10px; font-size: 12px;
}
.mbook-hist-modes .btn.small[aria-pressed="true"] {
  background: var(--brand-2, #1e6fc0); color: #fff; border-color: transparent;
}
.mbook-entry-table .bstart { border-left: 2px solid var(--line-strong, #3d4659); }
.mbook-break {
  display: grid; gap: 8px; margin-top: 8px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.mbook-break[hidden] { display: none !important; }
.mbook-break-block {
  border-radius: 8px; padding: 8px 10px 10px; border: 1px solid transparent;
}
.mbook-break-block h4 {
  margin: 0 0 6px; font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.mbook-break-block ul {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 4px;
}
.mbook-break-block.claim {
  background: #ecfdf5; border-color: #86efac;
}
.mbook-break-block.claim h4 { color: #166534; }
.mbook-break-block.held {
  background: #fef2f2; border-color: #fca5a5;
}
.mbook-break-block.held h4 { color: #b91c1c; }
.mbook-break-item {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px;
  padding: 5px 7px; border-radius: 6px; background: rgba(255,255,255,0.72);
  font-size: 12.5px; cursor: default;
}
.mbook-break-item[data-ms] { cursor: pointer; }
.mbook-break-item[data-ms]:hover { outline: 1px solid rgba(0,0,0,0.12); }
.mbook-break-main { font-weight: 800; color: var(--ink, #1c2130); }
.mbook-break-detail {
  grid-column: 1 / -1; font-size: 11px; font-weight: 600; color: var(--muted);
}
.mbook-break-amt {
  font-variant-numeric: tabular-nums; font-weight: 800; align-self: start;
}
.mbook-break-block.claim .mbook-break-amt { color: #166534; }
.mbook-break-block.held .mbook-break-amt { color: #b91c1c; }
.mbook-break-sum {
  margin: 6px 0 0; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.mbook-break-block.claim .mbook-break-sum { color: #166534; }
.mbook-break-block.held .mbook-break-sum { color: #b91c1c; }
.mbook-entry-table .mbook-pct {
  color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums;
}
.mbook-entry-table tr[data-entry] td.c-in.this.on-bill {
  background: #f0fdf4 !important;
}
.mbook-entry-table td.c-in.this {
  width: 1%; min-width: 0; vertical-align: middle; text-align: center;
  padding: 4px 6px !important;
  border-left: 1px solid #c5ccd8;
}
.mbook-entry-table td.c-in.this.bstart {
  border-left: 2px solid #3d4659 !important;
}
.mbook-entry-table td.num.this,
.mbook-entry-table td.mbook-amt {
  border-left: 1px solid #c5ccd8;
  text-align: center;
  padding: 4px 6px !important;
  width: 1%; min-width: 0;
}
.mbook-entry-table td.c-in.this .entry-qty {
  width: 3.25rem; min-width: 2.75rem; max-width: 6rem;
  height: 28px; margin: 0 auto; display: block; text-align: center;
  padding: 2px 6px;
}
.mbook-entry-table td.c-in.this .entry-qty:focus {
  width: auto; min-width: 3.25rem;
}
.mbook-entry-table .mbook-fresh-hold-tick {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  margin: 0; cursor: pointer;
}
.mbook-entry-table .mbook-fresh-hold-tick input { flex: 0 0 auto; }
.mbook-entry-table tr[data-entry].mbook-flash td:not(.mbook-pad) {
  outline: 2px solid #2563eb; outline-offset: -2px;
}
.mbook-summary { margin: 16px 0 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.mbook-summary h2 { margin: 0 0 10px; font-size: 15px; }
.mbook-entry-table th .th-sub {
  display: block; font-size: 10px; font-weight: 600; color: var(--muted);
  text-transform: none; letter-spacing: 0; margin-top: 2px;
}
.mbook-entry-table td small.muted { display: block; font-size: 11px; font-weight: 500; }
.ok-text { color: #166534; }
.held-text { color: #b91c1c; }
.rab-entry.hide-billed tr.fully-billed { display: none; }
.mbook-entry-table th.mbook-hist-col,
.mbook-entry-table td.mbook-hist-col {
  width: 1%; min-width: 2.25rem;
  text-align: center; vertical-align: middle; padding: 2px 4px !important;
  border-left: 1px solid #c5ccd8;
  box-sizing: border-box;
  overflow: visible; white-space: nowrap;
  font-size: 12.5px;
}
.mbook-entry-table td.mbook-hist-col.held-left {
  background: #fff5f5 !important;
}
.mbook-entry-table td.mbook-hist-col.held-left.on-bill {
  background: #ecfdf5 !important;
}
.mbook-entry-table .mbook-mb-hold {
  display: inline-flex; flex-direction: row; align-items: center; justify-content: center;
  gap: 4px; margin: 0; cursor: pointer; line-height: 1.2;
  padding: 2px 3px; border-radius: 4px;
  background: #fff; border: 1px solid #fecaca;
}
.mbook-entry-table .mbook-mb-hold input {
  margin: 0; width: 14px; height: 14px; flex: 0 0 auto;
  accent-color: #b91c1c;
}
.mbook-entry-table td.mbook-hist-col.hit {
  background: #ecfdf5 !important;
}
.mbook-entry-table .hist-claimed { color: #166534; font-size: 12.5px; font-weight: 800; }
.mbook-entry-table .hist-held {
  color: #b91c1c; font-size: 12.5px; font-weight: 800;
  display: inline; min-width: 0; text-align: center;
}
.mbook-entry-table td.mbook-hist-col.held-released,
.mbook-table td.held-released {
  background: #f8fafc !important;
}
.mbook-entry-table .hist-stack,
.mbook-table .hist-stack {
  display: inline-flex; flex-direction: column; align-items: flex-end; gap: 2px; line-height: 1.2;
}
.mbook-entry-table .hist-released-wrap,
.mbook-table .hist-released-wrap {
  display: inline-flex; flex-direction: column; align-items: flex-end; gap: 1px; line-height: 1.15;
}
.mbook-entry-table .hist-released,
.mbook-table .hist-released,
.mbook-table s.hist-released {
  color: #64748b;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}
.mbook-entry-table .hist-claimed-by,
.mbook-table .hist-claimed-by {
  display: block; font-size: 10px; font-weight: 800; color: #166534;
  letter-spacing: 0.02em; white-space: nowrap;
}
.mbook-entry-table .hist-tally,
.mbook-table .hist-tally { font-size: 10px; font-weight: 600; }
.mbook-table .hist-claimed { color: #166534; font-weight: 800; }
.mbook-table .hist-held,
.mbook-entry-table .hist-held { color: #b91c1c; font-weight: 800; }
.mbook-table td.held-left { background: #fff5f5; }
.mbook-table td.mbook-hist-cell { vertical-align: top; white-space: normal; min-width: 5.5rem; }
.mbook-entry-table .mbook-fresh-slot {
  margin-top: 4px; text-align: center; min-height: 0;
}
.mbook-entry-table .mbook-fresh-held-badge,
.mbook-entry-table .mbook-fresh-now-badge {
  display: inline-block; padding: 1px 5px; border-radius: 3px;
  font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mbook-entry-table .mbook-fresh-held-badge {
  background: #fef2f2; color: #b91c1c;
}
.mbook-entry-table .mbook-fresh-now-badge {
  background: #ecfdf5; color: #166534;
}
.mbook-entry-table .mbook-fresh-note { display: none; }
.mbook-entry-table .bstart {
  border-left: 2px solid #3d4659 !important;
}
.mbook-entry-table thead th.grp.this {
  background: var(--brand-2); color: #fff;
}
.mbook-entry-table thead th.grp.mbook-hist-col {
  background: #cfd8e6; color: #1c2130; font-weight: 800;
}
.mbook-entry-table thead th.sub.this {
  background: #dbeafe; color: #1c2130; font-weight: 700;
}
.mbook-entry-table thead th.sub.this.held {
  background: #fee2e2; color: #9f1239;
}
.mbook-entry-table thead th.sub.mbook-hist-col {
  background: #e8eef6; color: #1c2130;
}
.mbook-entry-table td.mbook-held-col {
  width: 1%; min-width: 2.25rem; text-align: center; vertical-align: middle;
  padding: 2px 4px !important; border-left: 1px solid #c5ccd8;
  white-space: nowrap; font-size: 12px;
}
.mbook-entry-table td.mbook-held-col .mbook-held-show {
  font-size: 11.5px;
}
.mbook-entry-table td.mbook-held-col:has(.mbook-held-show:not(:empty)) {
  min-width: 0;
}
.mbook-entry-table td.mbook-held-col.on-held,
.mbook-entry-table td.mbook-held-col.on-bill:not(.on-held) {
  background: #fef2f2 !important;
}
.mbook-entry-table td.mbook-held-col .mbook-fresh-hold-tick {
  display: inline-flex; flex-direction: row; align-items: center; gap: 4px;
  cursor: pointer; white-space: nowrap;
}
.mbook-entry-table td.mbook-held-col .mbook-fresh-hold-tick[hidden] {
  display: none !important;
}
.mbook-entry-table [data-fresh-show].held-preview {
  color: #b91c1c; font-weight: 800;
}
.mbook-entry-table td.mbook-held-col .mbook-held-show {
  color: #b91c1c; font-size: 12px; font-weight: 800;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.mbook-entry-table td.mbook-held-col:has(input:checked) {
  background: #ecfdf5 !important;
}
.mbook-entry-table td.mbook-held-col:has(input:checked) .mbook-held-show {
  color: #166534;
}
.mbook-bottom-totals {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px;
}
.mbook-tot-card {
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); display: flex; flex-direction: column; gap: 4px;
}
.mbook-tot-card > span {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
}
.mbook-tot-card > strong {
  font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--brand);
}
.mbook-tot-card > small { color: var(--muted); font-size: 11.5px; }
.mbook-tot-card.break ul {
  list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 3px; font-size: 12.5px;
}
.mbook-tot-card.break li {
  display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-weight: 600;
}
.mbook-tot-card.break b { color: var(--ink); font-variant-numeric: tabular-nums; }
.mbook-tot-card.held {
  background: #fef2f2; border-color: #fca5a5;
}
.mbook-tot-card.held > span { color: #9f1239; }
.mbook-tot-card.held > strong { color: #b91c1c; }
.mbook-tot-card.held > small { color: #9f1239; }
.mbook-tot-card.master {
  background: linear-gradient(135deg, var(--night), var(--brand-2)); border-color: var(--night);
}
.mbook-tot-card.master > span,
.mbook-tot-card.master > small { color: rgba(255,255,255,0.78); }
.mbook-tot-card.master > strong { color: #fff; font-size: 1.5rem; }
.mbook-bar-bits .held-text { color: #b91c1c; }
.mbook-bar-bits {
  display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; font-size: 13px;
}
.mbook-bar-bits b { font-variant-numeric: tabular-nums; }
.mbook-side-amt {
  margin: 0; font-size: 13px; font-weight: 700; color: var(--ink, #1c2130);
}
.mbook-side-amt b { font-variant-numeric: tabular-nums; color: #166534; }
.mbook-entry-table td.mbook-amt {
  font-weight: 700; font-variant-numeric: tabular-nums; color: #166534; white-space: nowrap;
}
.mbook-price-break {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 0; max-width: 28rem;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: var(--surface);
}
.mbook-price-break li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 8px 14px; border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.mbook-price-break li:last-child { border-bottom: 0; }
.mbook-price-break li.sep { border-top: 2px solid var(--line); margin-top: 0; }
.mbook-price-break li span { color: var(--muted); font-weight: 600; }
.mbook-price-break li b { font-variant-numeric: tabular-nums; font-weight: 800; }
.mbook-price-break li.master {
  background: linear-gradient(135deg, var(--night), var(--brand-2));
  border-bottom: 0; padding: 12px 14px;
}
.mbook-price-break li.master span { color: rgba(255,255,255,0.8); text-transform: uppercase; letter-spacing: 0.03em; font-size: 12px; }
.mbook-price-break li.master b { color: #fff; font-size: 1.35rem; }
.mbook-master-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-right: 6px; }
.mbook-master-total { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.mbook-leg {
  display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 11px; font-weight: 800;
}
.mbook-leg.ok { background: #dcfce7; color: #166534; }
.mbook-leg.held { background: #fee2e2; color: #b91c1c; }
.mbook-detail-table td.mbook-claim-col { min-width: 280px; vertical-align: top; }
.mbook-claim-break {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 4px;
}
.mbook-claim-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 6px 8px; align-items: start;
  padding: 6px 8px; border-radius: 6px; border: 1px solid transparent;
}
.mbook-claim-item.now,
.mbook-claim-item.claimed {
  background: #ecfdf5; border-color: #86efac;
}
.mbook-claim-item.held {
  background: #fef2f2; border-color: #fca5a5;
}
.mbook-claim-tag {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 2px 6px; border-radius: 4px; align-self: start;
}
.mbook-claim-item.now .mbook-claim-tag,
.mbook-claim-item.claimed .mbook-claim-tag { background: #166534; color: #fff; }
.mbook-claim-item.held .mbook-claim-tag { background: #b91c1c; color: #fff; }
.mbook-claim-main { display: grid; gap: 1px; min-width: 0; }
.mbook-claim-main strong { font-size: 13px; }
.mbook-claim-main small { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.mbook-claim-main a { font-weight: 800; }
.mbook-claim-amt {
  font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; font-size: 13px;
}
.mbook-claim-item.now .mbook-claim-amt,
.mbook-claim-item.claimed .mbook-claim-amt { color: #166534; }
.mbook-claim-item.held .mbook-claim-amt { color: #b91c1c; }
.mbook-claim-foot {
  display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 8px 0 0;
  font-size: 12px; font-weight: 700; color: var(--muted);
}
.mbook-claim-foot .now { color: #166534; }
.mbook-claim-foot .held { color: #b91c1c; }
.mbook-claim-foot b { font-variant-numeric: tabular-nums; }
.mbook-entry-table {
  --mbook-th1: 24px;
  table-layout: auto; width: max-content; min-width: 0;
  border-collapse: collapse; border-spacing: 0;
}
.mbook-entry-table th,
.mbook-entry-table td {
  padding: 3px 6px !important;
  line-height: 1.2;
  white-space: nowrap;
}
/* Sticky two-row head: top offset must match row-1 height or a white gap appears. */
.mbook-entry-table thead th {
  position: sticky;
  z-index: 3;
  padding: 3px 6px !important;
  font-size: 11px;
  line-height: 1.15;
  vertical-align: middle;
  box-shadow: none;
}
.mbook-entry-table thead tr:first-child th {
  top: 0;
  z-index: 4;
  height: var(--mbook-th1);
  padding: 0 6px !important;
  border-bottom: 0 !important;
}
.mbook-entry-table thead tr:nth-child(2) th {
  top: var(--mbook-th1);
  z-index: 3;
  padding: 3px 5px !important;
  border-top: 0 !important;
  height: 22px;
}
.mbook-entry-table thead th.grp,
.mbook-entry-table thead th.grp.this {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.mbook-entry-table thead th.sub {
  font-size: 10.5px;
  font-weight: 700;
}
.mbook-entry-table thead th.sub a {
  text-decoration: none;
  color: inherit;
}
.mbook-entry-table thead th.sub a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.mbook-entry-table th.c-item,
.mbook-entry-table td.c-item.mbook-item-desc {
  white-space: normal;
}
.mbook-entry-table .c-no { width: 1%; vertical-align: top; padding: 3px 4px !important; }
.mbook-entry-table .c-side {
  width: 1%; vertical-align: top; white-space: nowrap;
  font-weight: 800; background: #f3f5f9; padding: 3px 6px !important;
  font-size: 12px;
}
.mbook-entry-table td.c-no {
  background: #e8edf5;
  border-top: 2px solid #1c2130 !important;
  vertical-align: top;
}
.mbook-entry-table th.c-item {
  min-width: 12rem; max-width: 22rem;
}
.mbook-entry-table td.c-item.mbook-item-desc {
  width: 14rem; min-width: 10rem; max-width: 18rem;
  padding: 5px 8px !important;
  background: #eef2f7 !important;
  border-top: 2px solid #1c2130 !important;
  border-right: 1px solid #c5ccd8;
  text-align: left; vertical-align: top;
  white-space: normal; word-break: break-word;
}
.mbook-entry-table td.c-item.mbook-item-desc strong {
  display: block; font-size: 12px; font-weight: 800; color: #1c2130; line-height: 1.3;
}
.mbook-entry-table td.c-item.mbook-item-desc small {
  display: block; margin-top: 2px; margin-left: 0;
  color: var(--muted); font-weight: 600; font-size: 10.5px; line-height: 1.3;
}
.mbook-entry-table td.c-side .mbook-side-amt {
  margin: 2px 0 0; font-size: 10.5px; font-weight: 700;
}
.mbook-entry-table tr.mbook-item-head > td:not(.c-no):not(.c-item) {
  border-top: 2px solid #1c2130 !important;
}
.mbook-entry-table tr.mbook-side-start:not(.mbook-item-head) > td:not(.c-no):not(.c-item) {
  border-top: 2px solid #3d4659 !important;
}
.mbook-entry-table tr.mbook-side-qty > td:not(.c-no):not(.c-item) {
  background: #eef4fb;
}
.mbook-entry-table tr.mbook-side-qty td.c-in.this .entry-qty {
  width: 4.25rem; min-width: 3.5rem; max-width: 6.5rem;
  height: 28px; font-size: 13.5px; font-weight: 700;
  border: 1.5px solid var(--brand-2);
  background: #fff;
}
.mbook-entry-table .c-terms,
.mbook-entry-table td[data-label="Terms"] {
  width: 1%; white-space: nowrap; padding: 3px 8px !important;
  font-size: 12.5px;
}
.mbook-entry-table .c-soq,
.mbook-entry-table td[data-label="SO qty"],
.mbook-entry-table .c-billed,
.mbook-entry-table td[data-label="Billed till date"],
.mbook-entry-table th.num:not(.this):not(.mbook-hist-col),
.mbook-entry-table td.num:not(.this):not(.mbook-hist-col) {
  width: 1%; text-align: right; padding: 3px 5px !important;
  font-size: 12.5px;
}
.mbook-entry-table .mbook-fresh-slot:empty { display: none; }
.mbook-entry-table label.mbook-fresh-hold-tick {
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  min-height: 0;
}
.mbook-entry-table th.this,
.mbook-entry-table td.num.this,
.mbook-entry-table td.mbook-amt {
  width: 1%; box-sizing: border-box; padding: 3px 5px !important;
}
.mbook-entry-table td.c-in.this {
  width: 1%; text-align: center; padding: 2px 4px !important;
}
.mbook-entry-table td.c-in.this .entry-qty {
  width: 3rem; min-width: 2.5rem; max-width: 5.5rem;
  height: 24px; padding: 1px 4px; margin: 0 auto; display: block;
  text-align: center; font-size: 12.5px; border-radius: 6px;
}
.mbook-entry-table td.c-in.this .entry-qty:focus {
  width: auto; min-width: 3rem;
}
.mbook-entry-table .mbook-so-note { font-weight: 500; }
.mbook-entry-table tr.mbook-side-head td:not(.c-no):not(.c-side) {
  background: #f3f5f9; font-weight: 700;
  border-top: 2px solid #3d4659 !important;
}
.mbook-entry-table tr[data-entry] td {
  position: relative;
  border-top: 1px solid #b4bbc8 !important;
  background: var(--surface);
}
.mbook-entry-table tr[data-entry] td small { display: block; color: var(--muted); font-weight: 500; }
.mbook-entry-table tr.mbook-hold-row td:not(.mbook-hist-col):not(.c-in):not(.mbook-held-col) {
  background: var(--surface);
}
.mbook-entry-table tr.mbook-rest-row td:not(.mbook-pad) { background: var(--surface); }
.mbook-entry-table td.num.this {
  min-width: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700;
}
.mbook-entry-table td.mbook-amt { min-width: 0; white-space: nowrap; }
.mbook-entry-table .mbook-hist { white-space: normal; min-width: 7rem; vertical-align: top; }
/* Named text (not type=hidden) so the check-page cart can list Fresh; keep inside a <td>. */
.mbook-entry-table input.mbook-fresh-val {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}
/* Claim filter: hide items with no claim. Keep every side + every splitup so rowspan stays intact. */
.rab-entry.mbook-entry-full.only-entered tr.mbook-empty-side:not(.has-qty),
.rab-entry.mbook-entry-full.only-entered tr[data-qty-row]:not(.mbook-item-open),
.rab-entry.mbook-entry-full.only-entered tr[data-entry]:not(.mbook-item-open) { display: none; }

/* Splitups under a claimed side read as addons between the main qty line and the next item. */
.mbook-entry-table tr[data-entry].mbook-rest-row td[data-label="Terms"] strong::before,
.mbook-entry-table tr[data-entry].mbook-hold-row td[data-label="Terms"] strong::before {
  content: "↳ ";
  color: var(--muted);
  font-weight: 700;
}
.mbook-entry-table tr[data-entry].mbook-rest-row td[data-label="Terms"],
.mbook-entry-table tr[data-entry].mbook-hold-row td[data-label="Terms"] {
  padding-left: 1.1rem;
}
.mbook-entry-table tr[data-entry].mbook-rest-row td:not(.c-no):not(.c-item):not(.c-side),
.mbook-entry-table tr[data-entry].mbook-hold-row td:not(.c-no):not(.c-item):not(.c-side) {
  background: #f7f9fc;
}
.mbook-tot-card.master .mbook-gst-break {
  display: grid; gap: 3px; margin: 6px 0 8px; padding: 0;
}
.mbook-tot-card.master .mbook-gst-break > div {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12px; color: rgba(255,255,255,0.78);
}
.mbook-tot-card.master .mbook-gst-break dt { margin: 0; font-weight: 600; }
.mbook-tot-card.master .mbook-gst-break dd {
  margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; color: #fff;
}
.mbook-tot-card.master .mbook-gst-break .grand {
  margin-top: 2px; padding-top: 4px; border-top: 1px solid rgba(255,255,255,0.22);
  font-size: 13px;
}
.mbook-tot-card.master .mbook-gst-pick {
  display: grid; gap: 4px; margin: 0 0 4px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: rgba(255,255,255,0.78);
}
.mbook-tot-card.master .mbook-gst-pick .rab-gst-pick select,
.mbook-tot-card.master .mbook-gst-pick .rab-gst-pick input {
  text-transform: none; letter-spacing: 0; font-weight: 600;
}
.mbook-mini-split {
  list-style: none; margin: 6px 0 2px; padding: 0;
  display: grid; gap: 2px;
  font-size: 11.5px; line-height: 1.25;
}
.mbook-mini-split[hidden] { display: none; }
.mbook-mini-split li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  color: #9f1239; font-weight: 600;
}
.mbook-mini-split li b {
  font-variant-numeric: tabular-nums; font-weight: 800; color: #b91c1c; white-space: nowrap;
}
.mbook-mini-split li.side {
  margin-top: 4px; padding-top: 4px; border-top: 1px solid rgba(185, 28, 28, 0.18);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; color: #9f1239;
}
.mbook-mini-split li.side:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.mbook-mini-split li.ms { padding-left: 2px; font-weight: 550; color: #be123c; }
.mbook-mini-split.on-dark li { color: rgba(255,255,255,0.78); }
.mbook-mini-split.on-dark li b { color: #fff; }
.mbook-mini-split.on-dark li.side {
  border-top-color: rgba(255,255,255,0.18); color: rgba(255,255,255,0.9);
}
.mbook-mini-split.on-dark li.ms { color: rgba(255,255,255,0.72); }
@media (max-width: 760px) {
  .mbook-entry-table { min-width: 0; table-layout: auto; }
  .mbook-entry-table tr.mbook-group-head,
  .mbook-entry-table tr.mbook-side-head,
  .mbook-entry-table tr.mbook-empty-side {
    display: block; padding: 10px 14px; border-bottom: 1px solid var(--line);
  }
  .mbook-entry-table tr.mbook-group-head td,
  .mbook-entry-table tr.mbook-side-head td,
  .mbook-entry-table tr.mbook-empty-side td {
    display: block; width: auto; padding: 2px 0; border: 0; background: none;
  }
  .mbook-entry-table tr.mbook-group-head { background: #e8edf5; }
  .mbook-entry-table tr.mbook-side-head { background: #f3f5f9; }
  .mbook-entry-table .mbook-pad,
  .mbook-entry-table .mbook-hist-col { display: none !important; }
  .mbook-entry-table tr[data-entry] { grid-template-columns: 1fr 1fr; }
  .mbook-entry-table tr[data-entry] td[data-label="Price split"] { grid-column: 1 / -1; }
}
.review-panel .mbook-review-table { min-width: 640px; width: 100%; }
.review-panel .mbook-review-table .mbook-pad {
  width: 36px; padding: 0 !important; border: 0 !important; background: transparent !important;
}
.review-panel .mbook-review-table tr.mbook-group-head td {
  background: #e8edf5; font-weight: 700; border-top: 2px solid #1c2130 !important;
}
.review-panel .mbook-review-table tr.mbook-side-head td {
  background: #f3f5f9; font-weight: 700;
}
.review-panel .mbook-review-table tr.has-qty td { background: #f0fdf4; }
.review-panel .mbook-review-table td small.muted {
  display: block; margin-top: 2px; font-size: 11px; font-weight: 600; color: var(--muted);
}
.review-panel .mbook-review-table tfoot td {
  font-weight: 800; background: var(--group-bg); border-top: 2px solid var(--line-strong);
}
.review-panel .rab-review-table { min-width: 880px; width: 100%; }
.review-panel .rab-review-table .c-item strong { display: block; }
.review-panel .rab-review-table .c-item small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.review-panel .rab-review-table td.done small { display: block; color: var(--muted); font-size: 11px; font-weight: 500; }
.review-panel .rab-review-table tfoot td { font-weight: 700; background: var(--group-bg); }
.review-panel .rab-review-table th.grp { text-align: center; }
.review-panel .rab-review-table th.grp.this,
.review-panel .rab-review-table th.sub.this { background: var(--brand-2); color: #fff; }
.review-panel .review-fields { margin: 0 0 12px; }
.review-panel .review-fields dt { font-size: 12px; color: var(--muted); font-weight: 600; }
.review-panel .review-fields dd { margin: 0 0 8px; font-weight: 700; }
.mbook-split-tag {
  margin-left: 8px; font-size: 12px; font-weight: 500; color: var(--muted);
}
.mbook-split-tag.custom { color: var(--brand); font-weight: 600; }
.console-split.mbook-split-form {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 8px 0 0;
}
.console-split.mbook-split-form label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; color: var(--muted); font-weight: 600;
}
.console-split-table td small { display: block; color: var(--muted); font-size: 11px; }
.console-split-table .mbook-split-form { margin: 0; }
.mbook-split { display: inline; margin-left: 8px; }
.mbook-split > summary {
  display: inline; cursor: pointer; list-style: none;
  font-size: 12px; font-weight: 500; color: var(--muted);
  text-decoration: underline; text-underline-offset: 2px; text-decoration-color: #c5cad3;
}
.mbook-split > summary::-webkit-details-marker { display: none; }
.mbook-split > summary::before { content: none; }
.mbook-split[open] > summary { color: var(--brand); text-decoration-color: var(--brand); }
.mbook-split-form {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px;
  margin: 4px 0 0; padding: 0; border: 0; background: transparent; max-width: none;
}
.mbook-split-form input {
  width: 3.2rem; padding: 2px 4px; border: 1px solid #c5cad3; border-radius: 3px;
  font: inherit; font-size: 12px; text-align: right; background: #fff;
}
.mbook-split-sum { margin: 0; font-size: 12px; color: var(--muted); white-space: nowrap; }
.mbook-split-sum.bad { color: #b42318; }
.mbook-split-sum.ok { color: #067647; }
.mbook-table .mbook-ms.over td { background: rgba(180, 35, 24, 0.05); }

/* Chart of Accounts (Finance) */
/* COA columns — same card language as M-Book totals / mega-menu columns. */
.coa-columns { margin-top: 22px; }
.coa-col-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}
.coa-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(13, 59, 114, 0.06);
  overflow: hidden;
}
.coa-col-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 14px 14px 12px;
  background: linear-gradient(180deg, #f7f9fc, #eef3f9);
  border-bottom: 1px solid var(--line);
}
.coa-col-head.recv {
  background: linear-gradient(180deg, #eff6ff, #e0ecff);
}
.coa-col-head.pay {
  background: linear-gradient(180deg, #fef2f2, #fee2e2);
}
.coa-col-no {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--night);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}
.coa-col-head.recv .coa-col-no { background: #1d4ed8; }
.coa-col-head.pay .coa-col-no { background: #b91c1c; }
.coa-col-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
}
.coa-col-pl {
  margin: 2px 0 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.coa-col-total {
  font-size: 1.2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--brand);
  white-space: nowrap;
}
.coa-col-head.pay .coa-col-total { color: #b91c1c; }
.coa-col-list {
  list-style: none;
  margin: 0;
  padding: 8px 0 12px;
  display: grid;
  gap: 2px;
  flex: 1;
}
.coa-item { padding: 0 10px; }
.coa-item-main,
.coa-sub li {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
  min-height: 34px;
  padding: 7px 8px;
  border-radius: 8px;
}
.coa-item-main:hover,
.coa-sub li:hover { background: #f7f9fc; }
.coa-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border: 1.5px solid #94a3b8;
  border-radius: 999px;
  background: transparent;
  flex: none;
}
.coa-item-no {
  font-size: 11.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #64748b;
  white-space: nowrap;
}
.coa-item-label {
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}
.coa-item-label a { font-weight: 700; }
.coa-item-label i {
  font-style: normal;
  margin-left: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.coa-item-main > b,
.coa-sub li > b {
  font-size: 13.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
  text-align: right;
}
.coa-sub {
  list-style: none;
  margin: 0 0 4px;
  padding: 0 0 0 28px;
  display: grid;
  gap: 1px;
  border-left: 2px solid #e2e8f0;
  margin-left: 12px;
}
.coa-sub li {
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding-left: 10px;
  min-height: 30px;
}
.coa-sub .coa-item-label {
  font-size: 12.5px;
  font-weight: 500;
  color: #334155;
}
.coa-sub li > b {
  font-size: 12.5px;
  font-weight: 700;
  color: #475569;
}
.coa-sub li.empty .coa-item-label,
.coa-sub li.empty > b { color: var(--muted); font-weight: 500; }
@media (max-width: 1100px) {
  .coa-col-grid { grid-template-columns: 1fr; }
}
