/* Pricing Pilot — Light Wags operations family (shared design guide v1.1):
   white navigation and cards, navy primary actions, pale-gray canvas, lime for
   the active view only. Status colors are separate from selection. */
:root {
  --navy: #1F3A68;
  --navy-deep: #142847;
  --navy-hover: #2C4B80;
  --lime: #B5D334;
  --lime-wash: #F4F9E2;
  --canvas: #F5F7FA;
  --card: #FFFFFF;
  --ink: #26364C;
  --ink-2: #59667A;
  --line: #DFE5EC;
  --line-strong: #C9D2DD;
  --good: #106310; --good-bg: #ECF7E6;
  --review: #815500; --review-bg: #FDF5E0;
  --critical: #A92C2C; --critical-bg: #FDF0F0;
  --info-bg: #EEF3FA;
  --radius: 8px;
  --sidebar-w: 248px;
  --radius-sm: 6px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --fast: 150ms;
  --ease: cubic-bezier(.2,.7,.2,1);
}

* { box-sizing: border-box; }
.btn[hidden] { display: none; }
html { -webkit-text-size-adjust: 100%; }
::selection { background: var(--lime-wash); color: var(--navy-deep); }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 15px/1.5 var(--font); }
h1, h2, h3, h4 { color: var(--navy-deep); line-height: 1.25; margin: 0 0 8px; }
h1 { font-size: 34px; font-weight: 700; letter-spacing: -.6px; margin-bottom: 5px; }
h2 { font-size: 21px; font-weight: 650; }
h3 { font-size: 16px; font-weight: 600; }
h4 { font-size: 14px; font-weight: 600; }
p { margin: 0 0 12px; }
a { color: var(--navy); }
a { text-underline-offset: 3px; }
a:hover { color: var(--navy-hover); }
small { display: block; font-size: 12px; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; z-index: 100; }
:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
.demo-banner { background: var(--review-bg); color: var(--review); text-align: center; font-size: 13px; padding: 4px; }

/* ---------- app shell: same as Labor Intelligence and KPI ----------
   White sidebar, icon links, lime active edge, folders for owner
   settings, user at the bottom; a context bar with the location; on
   phones the sidebar slides in from the menu button. */
.navtoggle-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.shell { min-height: 100vh; }
.shell-main { margin-left: var(--sidebar-w); min-width: 0; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 30; background: var(--card); color: var(--navy);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; }
.demo-banner { position: sticky; top: 0; z-index: 40; height: 28px; line-height: 20px; }
.demo-banner ~ .shell .sidebar { top: 28px; }
.demo-banner ~ .shell .mobilebar { top: 28px; }
.sidebar-top { display: flex; align-items: center; gap: 8px; padding: 24px 20px; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; color: var(--navy); font-size: 14px; line-height: 1.2; flex: 1; min-width: 0; text-decoration: none; }
.sidebar-brand b { display: block; font-weight: 700; font-size: 16px; margin-top: 3px; }
.brand-logo { width: 32px; height: 32px; border-radius: 9px; background: #fff; display: block; flex-shrink: 0; object-fit: contain; }
.nav-close { display: none; }
.sidenav { display: flex; flex-direction: column; gap: 1px; padding: 0 12px 12px; flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) var(--card); }
.sidebar-top, .sidebar-user, .nav-primary, .nav-folder { flex-shrink: 0; }
.nav-primary { display: grid; gap: 4px; margin-bottom: 12px; }
.navlink { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 12px 10px; border-radius: 5px; border-left: 3px solid transparent;
  color: #40526B; font-size: 14px; font-weight: 500; line-height: 1.2; text-decoration: none; }
.navlink:hover { background: #EDF1F6; color: var(--navy); }
.navlink .ico { width: 18px; height: 18px; opacity: .85; flex-shrink: 0; }
.navlink.active { background: var(--lime-wash); border-left-color: var(--lime); color: var(--navy); font-weight: 600; }
.navlink.active .ico { opacity: 1; color: #66860A; }
.nav-folder { padding: 0 0 8px; color: var(--ink-2); }
.nav-folder > summary { font-size: 14px; font-weight: 500; cursor: pointer; padding: 10px 30px 10px 13px; min-height: 44px; list-style: none; position: relative; display: flex; align-items: center; gap: 8px; border-radius: var(--radius-sm); }
.nav-folder > summary::-webkit-details-marker { display: none; }
.nav-folder > summary::after { content: ''; position: absolute; width: 6px; height: 6px; right: 13px; top: calc(50% - 3px);
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); }
.nav-folder[open] > summary { color: var(--navy); }
.nav-folder[open] > summary::after { transform: rotate(45deg); }
.nav-folder .navlink { margin: 2px 0 2px 16px; }
.package-nav { border-block: 1px solid var(--line); margin-bottom: 12px; padding-block: 8px 12px; }
.package-nav > summary { min-height: 44px; font-weight: 600; gap: 8px; }
#package-nav-count { margin-left: auto; font-variant-numeric: tabular-nums; }
#package-nav-count:empty { display: none; }
.package-nav-context, .package-nav-empty { margin: 8px 13px 12px; font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; }
.package-nav-context strong { color: var(--navy); font-weight: 600; }
.package-nav-group { margin-left: 8px; }
.package-nav-group + .package-nav-group { margin-top: 4px; }
.package-nav-heading { display: flex; align-items: center; gap: 8px; min-height: 44px; margin: 0; padding: 10px 28px 10px 10px; position: relative; list-style: none; cursor: pointer; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; line-height: 1.4; color: var(--navy); }
.package-nav-heading > span:first-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.package-nav-heading::-webkit-details-marker { display: none; }
.package-nav-heading::after { content: ''; position: absolute; width: 6px; height: 6px; right: 13px; top: calc(50% - 3px); border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); }
.package-nav-group[open] > summary { color: var(--navy); }
.package-nav-group[open] > summary::after { transform: rotate(45deg); }
.package-group-count { flex-shrink: 0; min-width: 16px; text-align: center; color: var(--ink-2); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }
@media (hover: hover) { .package-nav-heading:hover { color: var(--navy); background: var(--canvas); } }
.package-nav ul { list-style: none; margin: 0; padding: 0; }
.package-nav-group > ul { margin: 0 0 8px 12px; padding-left: 8px; border-left: 1px solid var(--line); }
.package-link { display: flex; align-items: center; min-height: 44px; padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.4; color: var(--ink-2); text-decoration: none; overflow-wrap: anywhere; }
.package-link:hover { background: var(--canvas); color: var(--navy-deep); }
.package-link[aria-current="location"] { background: var(--lime-wash); color: var(--navy-deep); font-weight: 600; box-shadow: inset 3px 0 var(--lime); }
.package-nav-group:not([open]):has([aria-current="location"]) > summary,
.package-nav:not([open]):has([aria-current="location"]) > summary { background: var(--lime-wash); color: var(--navy-deep); }
.package-selection-note { display: none; }
.package-nav-group:not([open]):has([aria-current="location"]) > summary .package-selection-note,
.package-nav:not([open]):has([aria-current="location"]) > summary .package-selection-note { display: inline; }
.package-link:focus-visible { outline-offset: -3px; }
.action-label { display: inline-flex; align-items: center; gap: 8px; }
.nav-folder > summary .action-label { gap: 10px; }
.action-label .ico { width: 18px; height: 18px; }
@media (hover: hover) { .nav-folder > summary:hover { color: var(--navy); background: var(--canvas); border-radius: 5px; } }
.sidebar-user { display: flex; align-items: center; gap: 9px; margin: 8px 0 0; padding: 12px 16px; border-top: 1px solid var(--line); }
.sidebar-user-link { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; min-height: 44px; color: inherit; text-decoration: none; border-radius: 6px; }
.sidebar-user-link:hover .sidebar-user-name, .sidebar-user-link[aria-current] .sidebar-user-name { text-decoration: underline; }
.sidebar-user-text { flex: 1; min-width: 0; line-height: 1.25; }
.sidebar-user-name { display: block; font-size: 13.5px; font-weight: 600; color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-role { display: block; font-size: 12px; color: var(--ink-2); text-transform: capitalize; }
.avatar-sm { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--navy); color: #fff; font-weight: 700; font-size: 12.5px; text-transform: uppercase; flex-shrink: 0; line-height: 1; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex-shrink: 0; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--card); color: var(--navy); cursor: pointer; font: inherit; font-size: 16px; line-height: 1; padding: 0; }
.btn-icon:hover { background: var(--canvas); color: var(--navy-deep); }
.sidebar-user .btn-icon { width: 44px; height: 44px; }
.mobilebar, .nav-backdrop { display: none; }
.mobile-menu-button { display: none; }
.menu-enhanced .menu-fallback { display: none !important; }
.contextbar { background: #fff; border-bottom: 1px solid var(--line); padding: 12px 24px; display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 64px; }
.location-context { display: flex; gap: 12px; align-items: center; min-width: 0; margin: 0; }
.location-context label { flex-direction: row; font-weight: 400; }
.location-context label, .context-label, .workspace-label { font-size: 13px; color: var(--ink-2); }
.context-label strong { color: var(--navy); font-weight: 600; }
.location-context select { width: 225px; max-width: 100%; font-weight: 500; background: #fff; }
.navlink:focus-visible, summary:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; border-radius: 4px; }
@media (prefers-reduced-motion: no-preference) { .navlink, summary, .btn { transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease; } }
@media (max-width: 860px) {
  .shell-main { margin-left: 0; }
  .sidebar { width: 270px; transform: translateX(-100%); transition: transform .2s ease; }
  .navtoggle-input:checked ~ .shell .sidebar { transform: translateX(0); box-shadow: 0 12px 40px rgba(20,40,71,.28); }
  .navtoggle-input:checked ~ .shell .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(20,40,71,.45); }
  .nav-close { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 8px; cursor: pointer; color: var(--navy); font-size: 24px; line-height: 1; }
  .menu-enhanced .mobile-menu-button { display: inline-flex; }
  .mobilebar { display: flex; align-items: center; gap: 12px; background: #fff; border-bottom: 2px solid var(--lime); padding: 9px 12px; position: sticky; top: 0; z-index: 20; }
  .mobilebar .btn-icon { width: 44px; height: 44px; color: var(--navy); }
  .mobilebar-brand { display: flex; align-items: center; gap: 9px; color: var(--navy); font-weight: 700; font-size: 15px; text-decoration: none; }
  .mobilebar .brand-logo { width: 28px; height: 28px; }
}
@media (max-width: 720px) {
  .contextbar { padding: 10px 13px; min-height: 60px; }
  .location-context { gap: 9px; width: 100%; }
  .location-context select { flex: 1; min-width: 0; width: auto; }
  .workspace-label { display: none; }
}

/* ---------- layout ---------- */
.page { max-width: 1440px; margin: 0 auto; padding: 30px 28px 56px; }
.page.wide { max-width: 1440px; }
.page.narrow { max-width: 560px; }
.pagehead { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.pagehead p:last-child { margin-bottom: 0; }
.pagehead-main { min-width: 0; flex: 1; }
.draft-context { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; color: var(--ink-2); font-size: 13px; }
.draft-context a { color: inherit; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; }
.count { display: inline-block; min-width: 24px; padding: 0 8px; margin-left: 4px; border-radius: 12px; background: var(--canvas); color: var(--ink-2); font-size: 13px; font-weight: 600; text-align: center; vertical-align: middle; }

/* ---------- controls ---------- */
input, select, textarea { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 8px 10px; min-height: 40px; }
input, textarea { caret-color: var(--navy); }
input::placeholder, textarea::placeholder { color: var(--ink-2); opacity: 1; }
select, input { max-width: 100%; min-width: 0; }
input[readonly] { background: var(--canvas); border-color: var(--line); color: var(--ink-2); }
input[aria-invalid="true"] { border-color: var(--critical); background: var(--critical-bg); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font: 600 14px var(--font); cursor: pointer; text-decoration: none; transition: background var(--fast) var(--ease); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-primary, .btn-navy { background: var(--navy); color: #fff; }
.btn-primary:hover, .btn-navy:hover { background: var(--navy-hover); color: #fff; }
.btn-primary:disabled { background: var(--line-strong); cursor: default; }
.btn-ghost { background: var(--card); color: var(--navy); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--canvas); }
.btn-danger { background: var(--card); color: var(--critical); border-color: #E7B9B9; }
.btn-danger:hover { background: var(--critical-bg); }
.icon-btn { width: 36px; height: 36px; border: 1px solid transparent; background: transparent; border-radius: var(--radius-sm); color: var(--ink-2); cursor: pointer; font-size: 15px; }
.icon-btn:hover { background: var(--canvas); border-color: var(--line); color: var(--navy); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.row-form label { min-width: 180px; }
.row-form .check { min-width: 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.check { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; color: var(--ink); }
.check input { min-height: auto; }
.checks { border: 0; padding: 0; margin: 0; display: flex; gap: 12px; align-items: center; }
.checks legend { font-size: 13px; font-weight: 600; color: var(--ink-2); float: left; margin-right: 8px; }

.seg { display: inline-flex; background: var(--canvas); border: 1px solid var(--line); border-radius: var(--radius); padding: 3px; gap: 2px; }
.seg a, .seg-radio label { padding: 6px 14px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 500; cursor: pointer; flex-direction: row; align-items: center; gap: 6px; }
.seg a[aria-current="page"], .seg-radio label:has(input:checked) { background: var(--card); box-shadow: inset 0 -3px 0 var(--lime); color: var(--navy-deep); font-weight: 600; }
.seg-radio input { min-height: auto; accent-color: var(--navy); }
.seg-radio label:has(input:disabled) { color: var(--ink-2); cursor: default; }

.affix { display: inline-flex; align-items: center; gap: 4px; }
.affix > span { color: var(--ink-2); font-weight: 400; }
.affix .unit { font-size: 12px; }

/* ---------- alerts / pills ---------- */
.alert { border-radius: var(--radius-sm); padding: 10px 14px; margin: 0 0 16px; border: 1px solid transparent; }
.alert-good { background: var(--good-bg); color: var(--good); }
.alert-review { background: var(--review-bg); color: var(--review); }
.alert-critical { background: var(--critical-bg); color: var(--critical); }
.alert-info { background: var(--info-bg); color: var(--navy-deep); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill-good { background: var(--good-bg); color: var(--good); }
.pill-review { background: var(--review-bg); color: var(--review); }
.pill-critical { background: var(--critical-bg); color: var(--critical); }
.pill-muted { background: var(--canvas); color: var(--ink-2); }
.pill-navy { background: var(--info-bg); color: var(--navy); }

/* ---------- tables ---------- */
/* position: relative keeps hidden (.sr-only) labels inside the scroll box,
   so wide tables never widen the page on phones. */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-color: var(--line-strong) var(--canvas); }
.table-wrap:focus-visible { outline-offset: 4px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.rtable td small { margin-top: 2px; }
.status-stack { display: flex; flex-wrap: wrap; gap: 6px; }
.status-stack .pill { white-space: normal; }
.strong-link { font-weight: 600; }
.compare .grp { text-align: center; border-bottom: 1px solid var(--line); }
.compare .delta { color: var(--ink-2); }
.compare tr.status-added td:first-child { box-shadow: inset 3px 0 0 var(--navy); }
.compare tr.status-removed td { color: var(--ink-2); }

/* ---------- editor ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.save-state { font-size: 13px; color: var(--ink-2); }
.save-state.is-dirty { color: var(--review); font-weight: 600; }
.title-input { font-size: 32px; font-weight: 700; color: var(--navy-deep); border-color: transparent; background: transparent; padding: 2px 6px; margin-left: -7px; width: 100%; max-width: 640px; }
.title-input:hover, .title-input:focus { border-color: var(--line-strong); background: var(--card); }

.labor-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.labor-head h2 { margin: 0; }
.fields { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; margin-bottom: 12px; }
.fields-rates input { width: 110px; }
.permin { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.permin strong { font-variant-numeric: tabular-nums; color: var(--ink); }

.summary a { font-weight: 600; text-decoration: none; }
.summary a:hover { text-decoration: underline; }

.group { padding: 20px 20px 16px; }
.group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.group-name { flex: 1; min-width: 0; font-size: 20px; font-weight: 600; color: var(--navy-deep); border-color: transparent; background: transparent; padding: 2px 6px; margin-left: -7px; }
.group-name.ro { padding: 0; margin: 0; }
.group-name:hover, .group-name:focus { border-color: var(--line-strong); background: var(--card); }
.note-label { font-weight: 400; margin-bottom: 12px; }
.note-label input { width: 100%; }
.group-meta { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin-bottom: 12px; }
.group-meta .note-label { flex: 1 1 320px; margin-bottom: 0; }
.layout-label { font-weight: 400; }
.row-actions { display: flex; gap: 2px; white-space: nowrap; }
td.row-actions { justify-content: flex-end; }

.pkg { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; background: var(--card); scroll-margin-top: 16px; }
.pkg:target { border-color: var(--navy); box-shadow: 0 0 0 2px var(--info-bg); }
.pkg-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.pkg-title { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; flex: 1; min-width: 0; }
.pkg-name { font-size: 17px; font-weight: 600; color: var(--navy-deep); min-width: 240px; flex: 1; max-width: 420px; }
span.pkg-name { min-width: 0; }
.price-label input { width: 96px; font-weight: 600; border: 2px solid var(--navy-deep); }
.price-label input[readonly] { border-color: var(--line); }

.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin: 16px 0 20px; padding: 16px; background: var(--canvas); border-radius: var(--radius-sm); }
.metrics div { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.metrics dt { font-size: 13px; color: var(--ink-2); }
.metrics dd { margin: 0; font-size: 22px; overflow-wrap: anywhere; font-weight: 600; font-variant-numeric: tabular-nums; }
.metrics .lead dd .pill { font-size: 20px; padding: 2px 12px; }
.metrics .pill { max-width: 100%; white-space: normal; }

.acts { min-width: 1080px; }
.acts th, .acts td { padding: 6px 6px; }
.acts thead { background: var(--canvas); }
.acts thead th { padding-block: 10px; }
.acts tfoot { background: var(--canvas); }
.acts .num-in { width: 72px; text-align: right; min-height: 36px; padding: 6px 8px; }
.acts .act-name { width: 100%; min-width: 320px; min-height: 36px; padding: 6px 8px; }
.acts select { min-height: 36px; padding: 4px 6px; }
.acts .out { color: var(--ink-2); }
.acts tfoot th, .acts tfoot td { font-weight: 600; border-bottom: 0; border-top: 2px solid var(--line); color: var(--ink); }
.dp { min-width: 520px; max-width: 720px; }
.daypacks { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }

.actions-grid { display: flex; flex-direction: column; gap: 16px; }
.actions-grid form { margin: 0; }

/* ---------- pricing overview and decision charts ---------- */
.section-head { display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.section-head p { margin: 0; }
.overview-scope { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px; margin-top: 20px; }
.pricing-overview, .package-overview { margin-bottom: 28px; }
.overview-context { margin-bottom: 16px; }
.overview-context .section-head { align-items: flex-start; }
.overview-status { flex-shrink: 0; }
.scope-note .scope-saved { margin-left: auto; }
.package-overview > .section-head { margin: 28px 0 16px; }
.pricing-overview .labor-chart, .package-overview .labor-chart, .package-overview > .source-details, .pricing-overview .chart-empty { padding: 24px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.package-overview > .source-details { margin-top: 16px; padding-block: 4px; }
.overview-picker { flex: 1; min-width: 0; }
.overview-picker label { flex: 1; max-width: 400px; min-width: 180px; }
.overview-picker select { width: 100%; min-height: 44px; }
.scope-note { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; padding-top: 16px; margin: 18px 0 0; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 13px; overflow-wrap: anywhere; }
.scope-note strong { color: var(--ink); }
.overview-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 0 0 20px; }
.overview-counts > div { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 20px 22px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.overview-counts strong { font-size: 36px; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--navy-deep); }
.overview-counts span { order: -1; font-size: 14px; font-weight: 600; color: var(--navy); }
.overview-counts .count-over:not(.is-clear) strong { color: var(--critical); }
.overview-counts .count-review:not(.is-clear) strong { color: var(--review); }
.labor-chart, .comparison-chart { margin: 0; min-width: 0; }
.chart-caption { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 16px; }
.chart-caption h3 { font-size: 20px; margin: 0; }
.chart-caption p { max-width: 65ch; margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }
.target-key { font-size: 13px; color: var(--ink-2); }
.target-key::before { content: ''; display: inline-block; height: 12px; border-left: 2px dashed var(--navy-deep); margin-right: 8px; vertical-align: -1px; }
.labor-axis, .labor-row { display: grid; grid-template-columns: minmax(170px, 1.05fr) minmax(100px, 1.4fr) minmax(130px, .6fr); gap: 20px; align-items: center; }
.labor-axis, .comparison-axis { color: var(--ink-2); font-size: 12px; padding-bottom: 8px; }
.labor-axis > div, .comparison-axis > div { display: flex; justify-content: space-between; }
.labor-axis > span:last-child, .comparison-axis > span:last-child { text-align: right; }
.labor-bars, .comparison-bars { list-style: none; padding: 0; margin: 0; }
.labor-row { padding: 16px 0; border-top: 1px solid var(--line); }
.chart-name { min-width: 0; line-height: 1.35; }
.chart-name a, .chart-name > strong { color: var(--navy); font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.chart-name a { text-decoration: none; display: flex; flex-direction: column; justify-content: center; min-height: 44px; padding-block: 4px; }
.chart-name a:hover { text-decoration: underline; }
.chart-name small { font-size: 13px; color: var(--ink-2); margin-top: 3px; overflow-wrap: anywhere; }
.chart-name a small { font-weight: 400; }
.chart-name .pill { margin-top: 5px; font-size: 12px; }
.labor-track { height: 20px; background: #EDF1F6; position: relative; border-radius: 2px; }
.labor-fill { position: absolute; inset: 0 auto 0 0; width: var(--amount); background: var(--good); border-radius: 2px; }
.state-over .labor-fill { background: var(--critical); }
.state-review .labor-track { background: var(--review-bg); }
.target-mark { position: absolute; left: var(--target); top: -5px; bottom: -5px; border-left: 2px dashed var(--navy-deep); }
.track-unavailable { color: var(--review); font-size: 12px; position: absolute; top: -3px; left: 8px; background: var(--review-bg); z-index: 1; }
.chart-value, .pair-values { text-align: right; font-variant-numeric: tabular-nums; }
.chart-value strong { font-size: 20px; font-weight: 600; }
.chart-value small, .pair-values small { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.state-over .chart-value strong { color: var(--critical); }
.state-review .chart-value small { color: var(--review); }
.source-details { margin-top: 24px; padding-top: 4px; border-top: 1px solid var(--line); }
.source-details > summary { padding: 12px 0; min-height: 44px; color: var(--navy); font-size: 14px; font-weight: 600; cursor: pointer; }
.source-details[open] > summary { margin-bottom: 8px; }
#summary-h .pill { font-size: 12px; vertical-align: middle; }
#summary-h { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
#new-draft, #draft-list, .pkg { scroll-margin-top: 108px; }
.compare-picker label { flex: 1; min-width: 180px; }
.compare-picker select { width: 100%; min-height: 44px; }
.comparison-scope { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding-block: 12px 16px; border-bottom: 1px solid var(--line); }
.comparison-scope > div { min-width: 0; }
.comparison-scope span, .comparison-scope small { display: block; font-size: 13px; color: var(--ink-2); }
.comparison-scope a { display: block; width: fit-content; font-size: 16px; font-weight: 600; margin-block: 4px; overflow-wrap: anywhere; }
.comparison-tally { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 20px 0; padding: 18px 20px; background: var(--canvas); border-radius: var(--radius-sm); }
.comparison-tally > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.comparison-tally dt { font-size: 14px; color: var(--ink-2); }
.comparison-tally dd { order: -1; margin: 0; font-size: 26px; font-weight: 650; color: var(--navy-deep); font-variant-numeric: tabular-nums; }
.comparison-scope .scope-series::before { content: ""; display: inline-block; width: 18px; height: 9px; margin-right: 8px; background: #75859B; }
.comparison-scope .scope-to::before { background: var(--navy); }
.chart-toolbar { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px 24px; margin-bottom: 20px; }
.chart-toolbar p { margin: 0; max-width: 58ch; }
.chart-toolbar label { min-width: 180px; }
.chart-toolbar [hidden] { display: none; }
.chart-toolbar select { min-height: 44px; }
.chart-legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); }
.chart-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { display: inline-block; width: 20px; height: 8px; border-radius: 1px; }
.series-from { background: #75859B; }
.series-to { background: var(--navy); }
.comparison-axis, .comparison-row { display: grid; grid-template-columns: minmax(170px, 1fr) minmax(100px, 1.25fr) minmax(190px, .9fr); gap: 20px; align-items: center; }
.comparison-row { padding-block: 12px; border-top: 1px solid var(--line); }
.pair-track { display: grid; gap: 5px; position: relative; padding-block: 3px; }
.pair-track > div { position: relative; height: 14px; background: var(--canvas); }
.pair-bar { position: absolute; height: 14px; border-radius: 1px; }
.pair-zero { position: absolute; left: var(--zero); top: 0; bottom: 0; border-left: 1px solid var(--line-strong); z-index: 1; }
.pair-unavailable { display: block; font-size: 11px; color: var(--ink-2); line-height: 14px; background: var(--card); }
.pair-values { font-size: 15px; white-space: nowrap; }
.pair-values strong { font-weight: 600; color: var(--navy-deep); }
.chart-footnote { margin: 16px 0 0; font-size: 12px; color: var(--ink-2); max-width: 75ch; }
.chart-scale { font-size: 12px; color: var(--ink-2); margin: -6px 0 16px; }
.compare-empty { padding: 32px 20px; max-width: 70ch; }
.compare-empty h2 { font-size: 19px; }
.compare-empty p, .chart-empty p { color: var(--ink-2); margin: 8px 0 0; }
.chart-empty { padding-block: 24px; }

@media (max-width: 1100px) {
  .overview-counts > div { padding: 18px 16px; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .labor-axis, .labor-row { grid-template-columns: minmax(160px, 1fr) minmax(80px, 1fr) 140px; gap: 16px; }
  .comparison-axis { display: none; }
  .comparison-row { grid-template-columns: minmax(0, 1fr) minmax(190px, auto); gap: 8px 24px; }
  .comparison-row .chart-name { grid-column: 1; grid-row: 1 / span 2; }
  .comparison-row .pair-track { grid-column: 2; grid-row: 2; }
  .comparison-row .pair-values { grid-column: 2; grid-row: 1; }
}
@media (max-width: 600px) {
  .overview-counts { grid-template-columns: 1fr 1fr; gap: 12px; }
  .overview-counts > div { gap: 12px; padding: 16px; }
  .overview-counts strong { font-size: 30px; }
  .overview-counts span { font-size: 13px; }
  .scope-note .scope-saved { margin-left: 0; flex-basis: 100%; }
  .comparison-tally { grid-template-columns: 1fr 1fr; gap: 12px 20px; padding: 16px; }
  .comparison-scope { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-picker { flex-basis: 100%; }
  .overview-picker label { max-width: none; }
  .overview-scope > a { margin-left: 0; }
  .overview-scope .btn { flex: 1; }
  .labor-axis { display: none; }
  .labor-row { grid-template-columns: minmax(0, 1fr) 124px; gap: 10px 12px; }
  .labor-row .chart-name { grid-column: 1; grid-row: 1; }
  .labor-row .chart-value { grid-column: 2; grid-row: 1; }
  .labor-track { grid-column: 1 / -1; margin: 4px 0 6px; }
  .chart-name a { padding-block: 6px; }
  .chart-caption p { line-height: 1.5; }
  .comparison-scope { gap: 16px; }
  .comparison-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .comparison-row .chart-name, .comparison-row .pair-values, .comparison-row .pair-track { grid-column: 1; grid-row: auto; }
  .pair-values { text-align: left; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; white-space: normal; }
  .pair-track { margin-bottom: 6px; }
  .chart-toolbar label { width: 100%; }
  .chart-toolbar select { width: 100%; }
  .compare-empty { padding: 12px 4px; }
}

/* ---------- settings ---------- */
.card .table-wrap + h3 { margin-top: 28px; }
.loc-form { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.loc-form input { width: 150px; }

/* ---------- login ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 32px 28px; }
.auth-logo { width: 56px; height: 56px; object-fit: contain; }
.auth-brand { font-size: 24px; margin: 8px 0 4px; }
.auth-brand span { font-weight: 400; color: var(--ink-2); }

/* ---------- phones ---------- */
@media (max-width: 720px) {
  input, select, textarea { font-size: 16px; }
  h1 { font-size: 24px; }
  .page { padding: 20px 13px 40px; }
  .card, .group, .pricing-overview .labor-chart, .package-overview .labor-chart, .pricing-overview .chart-empty { padding: 16px; }
  .overview-context .section-head { flex-wrap: wrap; gap: 8px; }
  .sidebar-user .btn-icon, .mobilebar .btn-icon, .nav-close { min-width: 44px; min-height: 44px; }
  .btn-sm, .icon-btn, .acts input, .acts select { min-height: 44px; }
  .icon-btn { min-width: 44px; }
  .check { min-height: 44px; }
  .seg-radio label { min-height: 44px; }
  .pkg { padding: 12px; }
  .pkg-name { min-width: 0; width: 100%; max-width: none; flex-basis: 100%; }
  .pkg-head { flex-wrap: wrap; }
  .pkg-head .row-actions { order: -1; margin-left: auto; }
  .pkg-title { flex-basis: 100%; }
  .pagehead-main { flex-basis: 100%; }
  .title-input { font-size: 22px; }
  .row-form label { min-width: 0; flex: 1 1 100%; }
  .metrics { gap: 16px; padding: 14px; }
  /* Summary / list tables become stacked cards. */
  .rtable thead { display: none; }
  .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
  .rtable tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .rtable td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .rtable td::before { content: attr(data-th); color: var(--ink-2); font-size: 12px; font-weight: 600; text-align: left; }
  .rtable td[data-th=""]::before, .rtable td[data-th="Package"]::before, .rtable td[data-th="Draft"]::before, .rtable td[data-th="Name"]::before { content: none; }
  .rtable td[data-th="Package"], .rtable td[data-th="Draft"], .rtable td[data-th="Name"] { display: block; text-align: left; }
  .rtable .status-stack { min-width: 0; flex: 1; justify-content: flex-end; }
  .rtable td::before { flex-shrink: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .sidebar, .mobilebar, .contextbar, .toolbar, .actions-card, .row-actions, [data-act], #group-add { display: none !important; }
  body { background: #fff; }
  .shell-main { margin-left: 0; }
  .card, .pkg { break-inside: avoid; border-color: #ccc; }
}

/* A bar beyond the chart scale ends in a dashed edge (the value text says so too). */
.labor-row.off-scale .labor-fill { border-right: 3px dashed var(--card); box-shadow: 3px 0 0 var(--critical); }
