/* inCon-trol PM: one stylesheet, no build step. */
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("../fonts/barlow-latin-400-normal.81419bf5abb5.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("../fonts/barlow-latin-500-normal.8e986e86d57e.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600 700; font-display: swap; src: url("../fonts/barlow-latin-600-normal.a1e2a2d7d4c0.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("../fonts/barlow-condensed-latin-600-normal.ba4513495282.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("../fonts/barlow-condensed-latin-700-normal.e1180918b873.woff2") format("woff2"); }

/* Brand: navy #1b6094 and aqua #7cd8e5 from the inCon-trol logo. */
:root {
  --navy: #0d2f4f;
  --navy-2: #16466f;
  --accent: #1b6094;
  --accent-soft: #e3f1f8;
  --aqua: #7cd8e5;
  --bg: #f2f2f0;
  --card: #ffffff;
  --text: #1d2733;
  --muted: #5f6b7a;
  --line: #dcdcd6;
  --good: #1f9d55;
  --good-soft: #e3f6ea;
  --warn: #b57500;
  --warn-soft: #fdf3dc;
  --bad: #d64545;
  --bad-soft: #fde8e8;
  --radius: 3px;
  --font: "Barlow", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --font-head: "Barlow Condensed", "Arial Narrow", "Barlow", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14.5px; color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-family: var(--font-head); font-size: 30px; margin: 0; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; line-height: 1.1; }
h2 { font-family: var(--font-head); font-size: 19px; margin: 0 0 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
h3 { font-family: var(--font-head); font-weight: 700; letter-spacing: .4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Layout: white header with logo and main menu, navy bar with breadcrumbs and who is signed in. */
.shell { min-height: 100vh; }
.site-header { position: sticky; top: 0; z-index: 30; display: flex; align-items: stretch; justify-content: space-between; gap: 16px;
  background: #fff; border-bottom: 4px solid var(--accent); padding: 0 0 0 20px; }
.brand { display: flex; align-items: center; gap: 14px; padding: 8px 0; flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand img { display: block; width: 150px; height: auto; }
.brand-name { width: 120px; padding-left: 12px; border-left: 2px solid var(--aqua); color: var(--accent); font-family: var(--font-head);
  font-size: 15px; font-weight: 700; line-height: 1.1; text-transform: uppercase; letter-spacing: .5px; }
.nav { display: flex; align-items: stretch; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { display: flex; align-items: center; gap: 7px; padding: 0 14px; white-space: nowrap; color: var(--text); font-family: var(--font-head);
  font-size: 17px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.nav a:hover { background: var(--bg); color: var(--accent); text-decoration: none; }
.nav a.active { background: var(--accent); color: #fff; }
.nav em.count { font-family: var(--font); font-style: normal; font-size: 11px; font-weight: 700; background: var(--accent); color: #fff; border-radius: 10px; padding: 1px 7px; letter-spacing: 0; }
.nav a.active em.count { background: #fff; color: var(--accent); }
/* App switcher (inCon-trol apps), next to the brand. <details> so it works without JavaScript. */
.app-switcher { position: relative; align-self: center; flex-shrink: 0; margin-right: auto; }
.app-switcher summary { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; cursor: pointer; list-style: none;
  color: var(--accent); border: 1px solid var(--line); border-radius: var(--radius); font-family: var(--font-head);
  font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; user-select: none; }
.app-switcher summary::-webkit-details-marker { display: none; }
.app-switcher summary:hover { border-color: var(--accent); background: var(--accent-soft); }
.app-switcher[open] summary { border-color: var(--accent); background: var(--accent); color: #fff; }
.app-switcher[open] summary .icon:last-child { transform: rotate(180deg); }
.app-menu { position: absolute; left: 0; top: calc(100% + 6px); z-index: 40; min-width: 250px; padding: 8px;
  background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(13, 47, 79, .18); }
.app-menu { min-width: 290px; }
.app-menu-label { margin: 2px 8px 6px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.app-menu ul { list-style: none; margin: 0; padding: 0; }
.app-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: var(--radius);
  color: var(--text); font-family: var(--font-head); font-size: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
a.app-item:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.app-item .icon { opacity: .6; }
.app-item em { font-family: var(--font); font-style: normal; font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0;
  padding: 1px 8px; border-radius: 10px; white-space: nowrap; }
.app-item.current { color: var(--accent); }
.app-item.current em { background: var(--accent-soft); color: var(--accent); }
.app-item.soon { color: var(--muted); cursor: not-allowed; }
.app-item.soon em { background: var(--warn-soft); color: var(--warn); }
.main { min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 8px 28px; min-height: 52px; background: var(--navy); color: #cfe3f0; }
.topbar a { color: var(--aqua); transition: color .12s ease; }
.topbar a:hover, .topbar a:focus-visible { color: #fff; text-decoration: none; }
.topbar a.on { color: #fff; text-decoration: underline; text-underline-offset: 4px; }
.topbar b { color: #fff; }
.topbar .muted { color: #8fb0c9; }
.topbar .btn.secondary { background: #fff; color: var(--navy); border-color: #fff; }
.topbar .btn.small.signout { height: 30px; padding: 0 12px; font-size: 14px; letter-spacing: .6px; }
.topbar .btn.secondary.signout:hover { background: var(--accent-soft); }
.topbar .admin-link { font-family: var(--font-head); font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.topbar .who { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--navy-2); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 12px; }
.viewing-as { display: flex; align-items: center; gap: 8px; color: var(--text); background: var(--warn-soft); border: 1px solid #f1d38a; padding: 4px 10px; border-radius: 6px; font-size: 12px; }
.viewing-as select { font: inherit; padding: 3px 4px; }
/* Full width on every screen (no centred column with blank sides); grids below reflow to the space. */
.content { padding: 20px 24px 40px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }

/* Brand loader: the CRM's logo reveal (blur -> focus, then a soft light passes over the logo while
   loading continues), with the same timings. Intro on the first page of a visit and on refresh;
   for slow page loads and form submits after 400 ms. See static/js/brand-loader.js. */
.brand-loader { display: none; position: fixed; inset: 0; z-index: 100; flex-direction: column; align-items: center;
  justify-content: center; padding: 32px 16px; }
.brand-loader::before { content: ""; position: absolute; inset: 0; border-top: 4px solid var(--accent);
  background: radial-gradient(520px circle at 50% 46%, color-mix(in srgb, var(--accent-soft) 75%, transparent), transparent 70%), var(--bg);
  transition: opacity .55s cubic-bezier(0.16, 1, 0.3, 1); }
html.brand-intro .brand-loader, html.brand-busy .brand-loader { display: flex; }
html.brand-intro body { overflow: hidden; }
html.brand-intro-leaving .brand-loader::before { opacity: 0; }
html.brand-intro-leaving .brand-loader-message, html.brand-intro-leaving .brand-intro-sheen { opacity: 0 !important; animation: none; }
html.brand-busy .brand-loader { animation: brand-fade-in .16s cubic-bezier(0.4, 0, 0.2, 1) both; }
html.brand-busy .brand-loader::before { background: radial-gradient(520px circle at 50% 46%, color-mix(in srgb, var(--accent-soft) 75%, transparent), transparent 70%),
  color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(3px); }
.brand-loader.is-fading { opacity: 0; transition: opacity .24s cubic-bezier(0.4, 0, 0.2, 1); }
.brand-intro-mark { position: relative; z-index: 1; line-height: 0; animation: brand-focus .75s cubic-bezier(0.33, 1, 0.68, 1) both;
  will-change: filter, transform, opacity; }
.brand-intro-logo { display: block; width: min(220px, 60vw); height: auto; transform-origin: center; }
.brand-intro-sheen { position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(105deg, transparent 38%, rgb(255 255 255 / .7) 50%, transparent 62%) no-repeat;
  background-size: 260% 100%; background-position: 160% 0;
  -webkit-mask: var(--logo-mask) center / 100% 100% no-repeat; mask: var(--logo-mask) center / 100% 100% no-repeat;
  animation: brand-sheen 2.4s cubic-bezier(0.4, 0, 0.2, 1) 1.1s infinite; }
.brand-loader-message { position: relative; z-index: 1; margin: 20px 0 0; font-size: 14px; color: var(--muted); opacity: 0;
  animation: brand-rise-in .4s cubic-bezier(0.16, 1, 0.3, 1) 1.2s both; }
html.brand-busy .brand-loader-message { animation-delay: .4s; }
@keyframes brand-focus { 0% { opacity: 0; filter: blur(14px); transform: scale(1.06); } 45% { opacity: 1; }
  100% { opacity: 1; filter: blur(0); transform: scale(1); } }
@keyframes brand-sheen { 0% { opacity: 1; background-position: 160% 0; } 55%, 100% { opacity: 1; background-position: -60% 0; } }
@keyframes brand-rise-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes brand-fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .brand-intro-mark, .brand-intro-sheen, .brand-loader-message, html.brand-busy .brand-loader { animation: none; }
  .brand-loader-message { opacity: 1; }
}
@media print { .brand-loader { display: none !important; } }

/* Cards and tiles */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.grid { display: grid; gap: 16px; }
.tiles { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: var(--radius); padding: 14px 16px; }
.tile:nth-child(2) { border-left-color: var(--aqua); }
.tile .label { color: var(--muted); font-family: var(--font-head); font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; }
.tile .value { font-family: var(--font-head); font-size: 30px; font-weight: 700; margin-top: 2px; line-height: 1.15; }
.tile .value.alert { color: var(--bad); }
.tile .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.two-col { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
/* Wide screens: the main column takes the extra width; the side column stays a comfortable reading width. */
@media (min-width: 1700px) { .two-col { grid-template-columns: minmax(0, 2fr) minmax(380px, 1fr); } }
.project-cards { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.pcard { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--text); }
.pcard:hover { border-color: var(--accent); text-decoration: none; box-shadow: 0 2px 8px rgba(18,38,63,.08); }
.pcard .job { color: var(--muted); font-size: 12px; font-weight: 600; }
.pcard .name { font-weight: 600; font-size: 15.5px; margin: 2px 0 8px; }
.pcard .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.bar > div { height: 100%; background: var(--accent); }

/* Badges and health dots */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; background: var(--line); color: var(--text); white-space: nowrap; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--accent-soft); color: var(--accent); }
.badge.test { background: transparent; border: 1px dashed var(--muted); color: var(--muted); }
.pager { margin-top: 10px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.dot.good { background: var(--good); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.status-ACTIVE { background: var(--good-soft); color: var(--good); }
.status-BIDDING { background: var(--accent-soft); color: var(--accent); }
.status-ON_HOLD { background: var(--warn-soft); color: var(--warn); }
.status-CLOSED { background: var(--line); color: var(--muted); }
.co-PENDING { background: var(--warn-soft); color: var(--warn); }
.co-APPROVED { background: var(--good-soft); color: var(--good); }
.co-REJECTED { background: var(--bad-soft); color: var(--bad); }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-family: var(--font-head); font-size: 12.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); background: #f7f7f5; font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
/* The row you just changed (keep-place.js): a short highlight so you see what happened without losing your place. */
tr.just-updated > td { animation: just-updated 1.6s ease-out; }
@keyframes just-updated { from { background: var(--accent-soft); } to { background: transparent; } }
tr.clickable:hover td { background: var(--accent-soft); }
tfoot td { font-weight: 600; background: #fafbfc; }
td.indent { padding-left: 32px; }
/* Text columns in wide lists keep a readable width (at most two lines) instead of wrapping word by word. */
td.cell-name { width: 17rem; }
th .th-sub { color: var(--muted); font-weight: 500; opacity: .8; }

/* Lists (action items) */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.list li:last-child { border-bottom: 0; }
.list .title { font-weight: 500; }
.section + .section { margin-top: 18px; }
.empty { color: var(--muted); padding: 8px 0; }
td.empty { padding: 16px 12px; }

/* Forms and buttons */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
input[type=search], input[type=text], input[type=url], input[type=email], input[type=date], input[type=number], select, textarea { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
input[type=search] { min-width: 260px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.btn { display: inline-block; font: inherit; font-family: var(--font-head); font-size: 15px; font-weight: 600; text-transform: uppercase; letter-spacing: .7px; padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; }
.btn { transition: background-color .12s ease, filter .12s ease, border-color .12s ease; }
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn.secondary:hover { filter: none; background: var(--accent-soft); }
.btn.secondary { background: #fff; color: var(--accent); }
.btn.danger { background: #fff; color: var(--bad); border-color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.link { background: none; border: 0; color: #c9d6e6; padding: 0; font-weight: 400; }

/* Project page */
.project-head { background: var(--card); border-bottom: 1px solid var(--line); padding: 18px 28px 0; }
.project-head .meta { display: flex; gap: 6px 24px; flex-wrap: wrap; margin-top: 8px; color: var(--muted); font-size: 13px; }
.project-head .meta b { color: var(--text); font-weight: 600; }
.tabs { display: flex; gap: 4px; margin-top: 16px; overflow-x: auto; }
.tabs a { padding: 10px 16px; color: var(--muted); border-bottom: 3px solid transparent; font-family: var(--font-head); font-size: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; white-space: nowrap; }
.tabs a.active { color: #fff; background: var(--accent); border-bottom-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.kv { display: grid; grid-template-columns: minmax(0, 160px) minmax(0, 1fr); gap: 8px 16px; }
.kv dd { overflow-wrap: anywhere; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* Messages */
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { padding: 10px 14px; border-radius: 6px; margin-bottom: 8px; }
.messages .success { background: var(--good-soft); color: var(--good); }
.messages .error { background: var(--bad-soft); color: var(--bad); }
.messages .warning, .messages .info { background: var(--warn-soft); color: #7a5200; }

/* Sign-in pages */
/* Sign-in page: kept in step with the CRM's (src/index.css, .crm-auth-*) - 520px card, centred logo (2026-12-03). */
.login-wrap { max-width: 520px; margin: 60px auto; padding: 0 16px; }
.login-card { padding: 28px; }
.login-card h1 { margin-top: 4px; }
.login-logo { display: block; width: 100%; max-width: 300px; height: auto; margin: 0 auto 16px; }
html[data-theme="dark"] .login-logo { background: #fff; padding: 6px 12px; border-radius: 6px; box-sizing: border-box; }
.dev-banner { background: var(--warn-soft); border: 1px solid #f1d38a; color: #7a5200; padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.user-grid button { text-align: left; font: inherit; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; cursor: pointer; }
.user-grid button:hover { border-color: var(--accent); }
.user-grid .role { color: var(--muted); font-size: 12px; }

/* The Menu button only appears on narrower screens (see below). */
.nav-check { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.nav-burger { display: none; }
@media (max-width: 1180px) {
  /* Narrower screens: logo and a Menu button; the menu opens as a list below. */
  .site-header { flex-wrap: wrap; align-items: center; gap: 0; padding: 0 12px 0 0; position: static; }
  .brand { padding: 8px 16px; flex: 1; }
  .brand { flex: 0 1 auto; }
  .app-switcher { margin-right: auto; }
  .nav-burger { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; cursor: pointer; color: var(--accent);
    border: 1px solid var(--accent); border-radius: var(--radius); font-family: var(--font-head); font-size: 16px;
    font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
  .nav-check:focus-visible + .nav-burger { outline: 3px solid var(--aqua); outline-offset: 2px; }
  .nav-check:checked + .nav-burger { background: var(--accent); color: #fff; }
  .nav { display: none; flex-basis: 100%; flex-direction: column; border-top: 1px solid var(--line); margin-right: -12px; }
  .nav-check:checked ~ .nav { display: flex; }
  .nav a { padding: 13px 16px; font-size: 17px; border-bottom: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .content, .project-head, .topbar { padding-left: 16px; padding-right: 16px; }
  input[type=search] { min-width: 0; width: 100%; }
  /* Phones: the top bar wraps (breadcrumbs, then Viewing as, then who's signed in) instead of
     pushing the page wider than the screen. */
  .topbar { flex-wrap: wrap; gap: 8px; }
  .topbar .who { flex-wrap: wrap; min-width: 0; max-width: 100%; }
  .topbar .viewing-as, .topbar .viewing-as select { min-width: 0; max-width: 100%; }
}

/* Segmented control (zoom) */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; }
.seg a { padding: 5px 12px; color: var(--muted); font-size: 12px; font-weight: 600; }
.seg a + a { border-left: 1px solid var(--line); }
.seg a.on { background: var(--accent); color: #fff; }
.seg a:hover { text-decoration: none; }
.offscreen { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Gantt */
.gantt-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.gantt { width: max-content; min-width: 100%; }
.gantt th, .gantt td { padding: 5px 6px; white-space: nowrap; font-size: 12px; }
.gantt th { font-size: 10px; letter-spacing: .3px; line-height: 1.2; }
.gantt td.indent { padding-left: 24px; }
.gantt .g-sticky { position: sticky; background: var(--card); z-index: 2; }
.gantt thead .g-sticky { background: #fafbfc; }
.gantt .g1 { left: 0; }
.gantt .g1 { min-width: 36px; }
.gantt .g2 { left: 36px; min-width: 190px; max-width: 230px; overflow: hidden; text-overflow: ellipsis; box-shadow: 1px 0 0 var(--line); }
.gantt tr.section-row td { background: #f3f6fa; }
.gantt tr.section-row td.g-sticky { background: #f3f6fa; }
.gantt th.chart-head, .gantt td.chart { padding: 0; }
.tl-row { display: flex; }
.tl-row span { flex: none; overflow: visible; white-space: nowrap; font-size: 10px; text-align: left; padding: 2px 0 2px 3px; box-sizing: border-box; }
.tl-row.groups span { color: var(--text); font-weight: 600; text-transform: none; letter-spacing: 0; }
.tl-row.labels span { border-left: 1px solid var(--line); color: var(--muted); font-weight: 500; }
.tl-row.labels span.today-col { color: var(--bad); font-weight: 700; }
.track { position: relative; height: 26px; background-image: linear-gradient(to right, var(--line) 1px, transparent 1px); }
.g-bar { position: absolute; top: 6px; height: 12px; border-radius: 3px; background: #9cc8ea; overflow: hidden; }
.g-bar .g-fill { height: 100%; background: var(--accent); }
.g-bar.g-section { top: 9px; height: 8px; background: var(--navy); border-radius: 2px; }
.g-bar.g-late .g-fill { background: var(--bad); }
.g-bar.g-late { background: #f3b7b7; }
.g-baseline { position: absolute; top: 20px; height: 3px; background: #9aa5b1; border-radius: 2px; }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--bad); }
.gantt-edit input[type=date] { padding: 5px 6px; }
.gantt-edit td { padding: 6px 8px; }
.gantt-edit tr.section-row td { background: #f3f6fa; }
.row-actions .btn { margin-right: 2px; }

/* SOV table */
.sov-wrap { overflow-x: auto; }
.sov { width: max-content; min-width: 100%; }
.sov th, .sov td { padding: 7px 10px; white-space: nowrap; font-size: 13px; }
.sov .sticky { position: sticky; background: var(--card); z-index: 2; }
.sov thead .sticky { background: #fafbfc; }
.sov .c1 { left: 0; min-width: 40px; }
.sov .c2 { left: 40px; min-width: 240px; box-shadow: 1px 0 0 var(--line); }
.sov tr.sub-head th { font-size: 10px; padding-top: 0; }
.sov th.month-head { text-align: center; border-left: 1px solid var(--line); }
.sov td.month { color: var(--text); }
.sov .this-month { background: #fff8e6 !important; }
.sov tr.unapproved td { color: var(--muted); }
.sov tfoot .sticky { background: #fafbfc; }

/* Create project */
.steps { display: flex; gap: 8px; margin-bottom: 16px; font-size: 13px; }
.steps span { padding: 4px 10px; border-radius: 12px; background: var(--line); color: var(--muted); }
.steps span.on { background: var(--accent); color: #fff; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px 20px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.field input, .field select { width: 100%; }
.field .help { color: var(--muted); font-size: 12px; margin-top: 3px; }
.field .error, .errorlist { color: var(--bad); font-size: 12px; margin: 4px 0 0; padding: 0; list-style: none; }
.preview-table td, .preview-table th { padding: 6px 10px; font-size: 13px; }
.gantt-edit .name-input { width: 100%; min-width: 190px; }
.gantt-edit .lead-input { width: 110px; }

.g-clip { position: absolute; top: 5px; font-size: 10px; line-height: 14px; color: var(--accent); background: var(--card); padding: 0 2px; border-radius: 2px; }
.g-clip-left { left: 1px; }
.g-clip-right { right: 1px; }
.g-nodates { position: absolute; left: 8px; top: 5px; font-size: 11px; color: var(--muted); font-style: italic; }

/* Est. vs Actual */
.cost-table td.neg, .kv-table td.neg, td.neg { color: var(--bad); }
.spent { display: inline-block; width: calc(100% - 44px); height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.spent-bar { height: 100%; background: var(--good); }
/* Percent columns: header, value and bar centred in the column (value above its bar). */
th.center, td.center { text-align: center; }
td.pct-cell { text-align: center; min-width: 110px; }
td.pct-cell .pct-value { display: block; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
td.pct-cell .spent { display: block; width: 100%; max-width: 180px; margin: 4px auto 0; }
.spent-bar.warn { background: var(--warn); }
.spent-bar.bad { background: var(--bad); }
.kv-table { width: 100%; }
.kv-table th, .kv-table td { padding: 8px 6px; }

/* Bucket drill-down: estimate detail grouped by scope item */
.plan-table tr.plan-scope td { background: var(--bg); border-top: 2px solid var(--line); }
.grid > * { min-width: 0; }
.stack { display: grid; gap: 16px; align-content: start; min-width: 0; }  /* cards stacked in one column of a two-column page */  /* let wide tables scroll inside their card instead of widening the page */

/* Project email */
.email-layout { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.contact-form { display: grid; gap: 8px; margin-top: 12px; }
.contact-form input, .contact-form select { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
.email-msg { margin-bottom: 12px; }
.email-msg.current { border-color: var(--accent); }
.email-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.email-body { white-space: normal; line-height: 1.55; overflow-wrap: anywhere; }
.file-form select { max-width: 260px; }
@media (max-width: 900px) { .email-layout { grid-template-columns: 1fr; } }

/* Create a project: upload step */
.create-upload { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 28px; padding: 24px; }
.create-upload h2 { margin-top: 0; }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 200px;
  margin-top: 12px; border: 2px dashed #b9cde0; border-radius: 10px; background: var(--accent-soft); cursor: pointer; text-align: center; padding: 20px; }
.dropzone:hover, .dropzone:focus-within { border-color: var(--accent); }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dz-icon { font-size: 34px; color: var(--accent); line-height: 1; }
.dz-title { font-weight: 700; font-size: 16px; color: var(--navy); }
.dz-sub { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.btn.big { padding: 10px 22px; font-size: 17px; }
.upload-help { background: var(--bg); border-radius: 10px; padding: 18px 20px; }
.upload-help h3 { margin: 0 0 12px; font-size: 15px; }
.how-steps { list-style: none; counter-reset: step; margin: 0 0 12px; padding: 0; display: grid; gap: 14px; }
.how-steps li { counter-increment: step; position: relative; padding-left: 40px; }
.how-steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.how-steps li > b { display: block; }
.how-steps li > span { color: var(--muted); font-size: 13px; }
.form-group-title { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 18px 0 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.form-grid .span-2 { grid-column: span 2; }
.field textarea { width: 100%; font: inherit; border: 1px solid var(--line); border-radius: 6px; }
@media (max-width: 900px) { .create-upload { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: auto; } }

/* Estimate items: Ordered */
.plan-table tr.ordered td { background: var(--good-soft); }
.order-btn.on { background: var(--good); border-color: var(--good); }
.plan-table td form { margin: 0; }
/* "Where these numbers come from" (Est. vs Actual, and any page with several kinds of upload):
   one card per source, side by side, each with what it is, its scope, its status and its own action. */
.data-sources { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.source-card { display: flex; flex-direction: column; gap: 8px; background: var(--card); border: 1px solid var(--line);
  border-left: 5px solid var(--accent); border-radius: var(--radius); padding: 14px 18px; }
.source-card.actual { border-left-color: var(--aqua); }
.source-head h3 { margin: 2px 0 0; font-size: 19px; text-transform: uppercase; letter-spacing: .6px; }
.source-kicker { color: var(--muted); font-family: var(--font-head); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; }
.source-desc { margin: 0; color: var(--text); }
.source-status { margin: 0; font-size: 13px; }
.source-status .icon { color: var(--good); vertical-align: -2px; }
.source-action { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.source-action input[type=file] { min-width: 0; max-width: 100%; font-size: 13px; }
@media (max-width: 900px) { .data-sources { grid-template-columns: 1fr; } }
/* Cost bucket page: Planned vs Actual cards that switch the table below (one table at a time). */
.report-results { grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); align-items: start; }
@media (max-width: 600px) { .report-results { grid-template-columns: 1fr; } }
.bucket-views { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 16px; }
a.bucket-view { color: var(--text); text-decoration: none; cursor: pointer; transition: border-color .12s ease, box-shadow .12s ease; }
a.bucket-view:hover { text-decoration: none; border-color: var(--accent); }
.bucket-tabs a.bucket-view.on { box-shadow: 0 0 0 2px var(--accent); }
.bucket-tabs a.bucket-view.on .bucket-view-title { color: var(--accent); }
.bucket-view-title { font-family: var(--font-head); font-size: 19px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.bucket-view-figure { font-family: var(--font-head); font-size: 30px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.bucket-panel + .bucket-panel { margin-top: 16px; }
.bucket-tabs .bucket-panel + .bucket-panel { margin-top: 0; }
html[data-theme="dark"] .bucket-tabs a.bucket-view.on .bucket-view-title { color: var(--link); }
.actuals-note { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--accent-soft); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 13px; }

/* Retired projects */
.status-CANCELED { background: var(--bad-soft); color: var(--bad); }
.retired-banner { background: var(--warn-soft); color: #7a5200; border-radius: 8px; padding: 10px 14px; margin: 10px 0 0; font-size: 13px; }
.retire-box { margin-bottom: 14px; }
.retire-box summary { list-style: none; display: inline-block; }
.retire-box summary::-webkit-details-marker { display: none; }
.retire-form { display: grid; gap: 8px; margin-top: 10px; padding: 12px; background: var(--bg); border-radius: 8px; }
.retire-form input[name=reason] { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
.radio { display: inline-flex; gap: 4px; align-items: center; margin-right: 12px; }
.head-actions { margin-left: auto; display: inline-flex; gap: 8px; flex-wrap: wrap; }
.warn-text { color: var(--warn); }
.contact-links { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }

/* Crews (one crew at a time per job; colors from the Crew table) */
.crew-card { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; padding: 12px 16px; margin-bottom: 14px; }
.crew-now { display: flex; flex-direction: column; gap: 4px; }
.crew-chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; padding: 3px 10px; border-radius: 12px;
  background: color-mix(in srgb, var(--crew) 18%, white); color: #1d2733; border: 1px solid var(--crew); }
.crew-chip::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--crew); }
.crew-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.crew-history { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; }
.crew-form select, .crew-form input[type=date] { font: inherit; padding: 4px 6px; }
.crew-edits summary { cursor: pointer; color: var(--accent); }
.crew-band { position: absolute; top: 5px; height: 16px; border-radius: 3px; opacity: .85; overflow: hidden; }
.crew-band span { color: #fff; font-size: 10px; font-weight: 700; padding-left: 4px; white-space: nowrap; text-shadow: 0 0 2px rgba(0,0,0,.5); }
.g-bar .g-crew { position: absolute; top: 0; bottom: 0; opacity: .78; }
.g-bar.g-crewed { background: #e2e8f0; }
.g-bar.g-crewed .g-fill { position: absolute; top: 0; bottom: 0; left: 0; background: rgba(15, 23, 42, .3); }
.overlap-box { background: var(--warn-soft); color: #7a5200; border-radius: 8px; padding: 8px 14px; margin-bottom: 14px; font-size: 13px; }
.overlap-box summary { cursor: pointer; }
.overlap-box ul { margin: 8px 0 0; padding-left: 4px; list-style: none; display: grid; gap: 3px; }

/* Company Wide Gantt */
.crew-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 14px; }
.crew-pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 13px; }
.crew-pill:hover { text-decoration: none; border-color: var(--accent); }
.crew-pill.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.crew-pill .crew-dot { margin-right: 2px; }
.crew-chip.small { font-size: 12px; padding: 1px 8px; }
.gantt.company .g-bar.g-job { top: 5px; height: 16px; }
.gantt.company .g-bar.g-thin { top: 9px; height: 8px; }
.expander { border: 0; background: none; cursor: pointer; font-size: 14px; color: var(--muted); padding: 0 4px; }
.company-edit { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; padding: 6px 0; }
.company-edit select, .company-edit input[type=date] { font: inherit; padding: 3px 6px; }
.gantt.company .task-row input[type=date] { font: inherit; font-size: 12px; padding: 2px 4px; width: 128px; }
.gantt.company .dur-input { width: 64px; font: inherit; font-size: 12px; padding: 2px 4px; }
.gantt.company .edit-row td { background: var(--accent-soft); }
.closeout { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 14px; }
.closeout h2 { margin-top: 0; }
.card.closeout { border-bottom: 1px solid var(--line); padding-bottom: 18px; margin-bottom: 0; }
.closeout-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.closeout-actions summary { list-style: none; display: inline-block; }
.closeout-actions summary::-webkit-details-marker { display: none; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.secondary.danger { background: #fff; color: var(--bad); }
.legend { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.legend-item { color: var(--text); display: inline-flex; align-items: center; }
.super-menu { position: relative; display: inline-block; }
.super-menu summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; min-width: 220px; padding: 6px 30px 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; position: relative; }
.super-menu summary::-webkit-details-marker { display: none; }
.super-menu summary::after { content: "▾"; position: absolute; right: 10px; color: var(--muted); }
.super-menu[open] summary { border-color: var(--accent); }
.super-menu-list { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; min-width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 20px rgba(15, 23, 42, .15); padding: 4px 0; }
.super-menu-list a { display: flex; align-items: center; padding: 7px 12px; color: var(--text); white-space: nowrap; }
.super-menu-list a:hover { background: var(--accent-soft); text-decoration: none; }
.super-menu-list a.on { font-weight: 600; background: #f1f5f9; }
.crew-dot.crew-all { background: conic-gradient(#2563eb 0 25%, #eab308 0 50%, #6b7280 0 75%, #7c3aed 0); }
.crew-dot.crew-none { background: repeating-linear-gradient(45deg, #fff 0 2px, #94a3b8 2px 4px); box-shadow: inset 0 0 0 1px #94a3b8; }
.g-bar.g-unassigned { background: repeating-linear-gradient(45deg, #f8fafc 0 4px, #cbd5e1 4px 8px); box-shadow: inset 0 0 0 1px #94a3b8; }
.g-bar.g-unassigned .g-fill { background: rgba(15, 23, 42, .25); }

/* File pickers match the buttons. */
input[type=file] { font: inherit; font-size: 13px; color: var(--muted); }
input[type=file]::file-selector-button { font-family: var(--font-head); font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px;
  padding: 5px 12px; margin-right: 10px; border: 1px solid var(--accent); border-radius: var(--radius); background: #fff; color: var(--accent); cursor: pointer; }
input[type=file]::file-selector-button:hover { background: var(--accent-soft); }

/* Settings */
.settings-tabs { margin: 0 0 18px; border-bottom: 1px solid var(--line); }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.narrow-card { max-width: 900px; }
.settings-section { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 2.4fr); gap: 24px 32px; padding: 22px 24px; }
.settings-section > .settings-intro h2 { margin-bottom: 6px; }
.settings-section > .settings-intro p { margin: 0 0 8px; }
.settings-section > .settings-body { min-width: 0; }
@media (max-width: 900px) { .settings-section { grid-template-columns: 1fr; padding: 16px; } }
.settings-user .form-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin-bottom: 8px; }
tr.inactive-row td { color: var(--muted); background: #fafaf8; }
.card-inset { margin-top: 10px; padding: 12px 14px; background: var(--bg); border-radius: var(--radius); }
.card-inset p { margin: 0 0 10px; }
.assign-form { display: grid; grid-template-columns: 1fr 180px auto; gap: 10px; align-items: end; margin-top: 12px; }
.super-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; width: 100%; }
.super-row input[type=text] { flex: 1; min-width: 160px; }
input[type=color] { width: 44px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; cursor: pointer; }
label.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
@media (max-width: 900px) { .assign-form { grid-template-columns: 1fr; } }
.settings-user .closeout { margin: 18px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line); border-bottom: 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.settings-user .closeout h3 { width: 100%; margin: 0; }

/* Email: chains waiting for the PM's answer */
.waiting-card { margin-bottom: 18px; border-left: 5px solid var(--warn); }
.waiting-card.quiet { border-left-color: var(--line); }
.waiting-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.waiting-head h2 { margin-bottom: 2px; }
.waiting-tools { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.upload-email summary { list-style: none; }
.upload-email summary::-webkit-details-marker { display: none; }
.upload-email { position: relative; }
.upload-email form { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: min(460px, calc(100vw - 32px));
  display: grid; gap: 8px; margin: 0; background: #fff; border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(15, 23, 42, .15); }
.waiting-list { margin-top: 10px; }
.waiting-chain { align-items: flex-start; }
.waiting-main { min-width: 0; flex: 1; }
.waiting-subject { font-size: 15px; }
.waiting-preview { margin-top: 2px; }
.waiting-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.waiting-actions .btn { width: 100%; }
.why { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.why-tag { font-size: 12px; background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 2px 9px; }
.waiting-read summary { cursor: pointer; color: var(--accent); margin-top: 6px; }
.waiting-msg { border-left: 3px solid var(--line); padding: 6px 0 6px 10px; margin-top: 8px; }
.review-group { margin-bottom: 16px; }
.review-group h2 a { color: var(--text); }
.joined-note { color: var(--good); font-weight: 600; margin-bottom: 6px; }
@media (max-width: 700px) { .waiting-chain { flex-direction: column; } .waiting-actions { flex-direction: row; } }

/* Icons */
.icon { flex-shrink: 0; vertical-align: -3px; }
.nav .icon { opacity: .8; }
.btn .icon { vertical-align: -3px; margin-right: 2px; }
.admin-link { display: inline-flex; align-items: center; gap: 4px; }

/* Tables: long lists keep their headings in view; easier-to-follow rows */
.table-wrap.tall { max-height: 72vh; overflow: auto; }
.table-wrap.tall thead th { position: sticky; top: 0; z-index: 1; }
.table-wrap > table:not(.gantt):not(.sov) > tbody > tr:nth-child(even) > td { background: #fafaf8; }
.table-wrap > table.signin-summary > tbody > tr.never-row > td { background: var(--bad-soft) !important; }  /* beats the row stripes, light and dark */
.table-wrap > table > tbody > tr.clickable:hover > td { background: var(--accent-soft); }

/* Keyboard focus is always visible */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
summary:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--aqua); outline-offset: 2px; }

/* Error pages */
.error-page { max-width: 640px; margin: 8vh auto; padding: 0 16px; text-align: center; }
.error-page img { width: 260px; max-width: 80%; height: auto; }
.error-page .code { font-family: var(--font-head); font-size: 64px; font-weight: 700; color: var(--accent); line-height: 1; margin: 18px 0 6px; }
.error-page h1 { margin-bottom: 10px; }
.error-page .btn { margin-top: 16px; }

/* Printing: Overview, SOV and Schedule on letter landscape, without the menus */
@media print {
  @page { size: letter landscape; margin: .4in; }
  body { background: #fff; font-size: 11px; }
  .site-header, .topbar, .tabs, .nav-burger, .app-switcher, .filters, .btn, form, details, .viewing-as, .messages,
  .header-actions, .snapshot-note, .closeout { display: none !important; }
  .content { padding: 0; max-width: none; }
  .card, .tile, .table-wrap, .gantt-wrap { box-shadow: none; break-inside: avoid; }
  .table-wrap, .gantt-wrap, .table-wrap.tall { overflow: visible; max-height: none; }
  .g-bar, .g-crew, .g-fill, .badge, .tile, .crew-dot, .bar > span { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
  .project-head { padding: 0 0 8px; border: 0; }
  /* The Gantt's frozen columns only make sense on screen; on paper the whole chart is shrunk to fit. */
  .gantt .g-sticky { position: static !important; box-shadow: none; }
  .gantt-wrap { overflow: hidden; }
  .gantt { min-width: 0; zoom: .62; }
  .gantt .crew-row { display: none; }
}
@media (max-width: 600px) {
  /* Summary tiles two per row on phones (PM figures are short, e.g. $12.1M). */
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 12px 12px; }
  .tiles > .tile:last-child:nth-child(odd) { grid-column: span 2; }
  .tile .label { font-size: 12.5px; letter-spacing: .6px; }
  .tile .value { font-size: 28px; }
  .brand { gap: 10px; padding: 8px 12px; }
  .brand img { width: 128px; }
  .brand-name { width: 96px; font-size: 13px; padding-left: 10px; }
  .nav-burger { padding: 8px 10px; }
  .nav-burger span { display: none; }
  .app-switcher summary span { display: none; }
  .app-switcher summary { padding: 7px 8px; }
  .app-menu { position: fixed; left: 12px; right: 12px; top: 64px; min-width: 0; }
}

/* Settings -> Display */
/* Settings -> Display, as in the CRM (max-w-4xl card, 20px padding, heading on top). */
.display-card { max-width: 896px; padding: 20px; }
.display-card h2 { margin: 0; }
.display-card > p { margin: 4px 0 0; font-size: 14px; }
.theme-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 12px; }
.theme-option { display: grid; gap: 6px; padding: 14px; border: 2px solid var(--line); border-radius: 6px; cursor: pointer; background: var(--card); }
.theme-option:hover { border-color: var(--accent); }
.theme-option.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.theme-option:focus-within { outline: 3px solid var(--aqua); outline-offset: 2px; }
.theme-preview { display: grid; grid-template-rows: 10px 8px 1fr; gap: 4px; height: 70px; padding: 6px; border-radius: 4px; border: 1px solid var(--line); }
.theme-preview span:nth-child(1) { background: #1b6094; border-radius: 2px; }
.theme-preview span:nth-child(2) { width: 60%; border-radius: 2px; }
.theme-preview span:nth-child(3) { border-radius: 2px; }
.theme-preview-light { background: #f2f2f0; }
.theme-preview-light span:nth-child(2) { background: #1d2733; }
.theme-preview-light span:nth-child(3) { background: #fff; }
.theme-preview-dark { background: #11161c; }
.theme-preview-dark span:nth-child(2) { background: #e4e9ef; }
.theme-preview-dark span:nth-child(3) { background: #1a2129; }
.theme-preview-auto { background: linear-gradient(135deg, #f2f2f0 50%, #11161c 50%); }
.theme-preview-auto span:nth-child(2) { background: #7a8794; }
.theme-preview-auto span:nth-child(3) { background: linear-gradient(135deg, #fff 50%, #1a2129 50%); }

/* ===== Dark mode (Settings -> Display). Screen only: printouts stay white. ===== */
@media screen {
  html[data-theme="dark"] {
    color-scheme: dark;
    --navy: #0a1b2c;
    --navy-2: #163a5c;
    --accent: #2471ad;
    --accent-soft: #1b3346;
    --link: #6cb4e8;
    --bg: #11161c;
    --card: #1a2129;
    --text: #e4e9ef;
    --muted: #9aa8b6;
    --line: #2d3742;
    --good: #4cc38a;
    --good-soft: #163a29;
    --warn: #e5ac45;
    --warn-soft: #3a2f17;
    --bad: #f07a7a;
    --bad-soft: #43201f;
    --surface-2: #202833;
  }
  html[data-theme="dark"] a { color: var(--link); }
  html[data-theme="dark"] a.btn:not(.secondary):not(.danger) { color: #fff; }
  html[data-theme="dark"] .site-header { background: #161d25; }
  html[data-theme="dark"] .brand img { background: #fff; padding: 3px 6px; border-radius: 4px; box-sizing: content-box; }
  html[data-theme="dark"] .brand-intro-logo { background: #fff; padding: 6px 12px; border-radius: 6px; box-sizing: content-box; }
  html[data-theme="dark"] .brand-name { color: var(--aqua); }
  html[data-theme="dark"] .nav a { color: var(--text); }
  html[data-theme="dark"] .nav a:hover { background: var(--surface-2); color: var(--link); }
  html[data-theme="dark"] .nav a.active, html[data-theme="dark"] .tabs a.active { color: #fff; }
  html[data-theme="dark"] .nav-burger { color: var(--link); border-color: var(--link); }
  html[data-theme="dark"] .app-switcher summary { color: var(--link); border-color: var(--line); }
  html[data-theme="dark"] .app-switcher[open] summary { background: var(--accent); color: #fff; }
  html[data-theme="dark"] a.app-item:hover { background: var(--surface-2); color: var(--link); }
  html[data-theme="dark"] .nav { border-color: var(--line); }
  html[data-theme="dark"] .nav a { border-color: var(--line); }
  html[data-theme="dark"] .topbar .btn.secondary { background: var(--card); color: var(--text); border-color: var(--line); }
  html[data-theme="dark"] .btn.secondary, html[data-theme="dark"] .btn.danger, html[data-theme="dark"] .btn.secondary.danger,
  html[data-theme="dark"] input[type=file]::file-selector-button { background: var(--card); }
  html[data-theme="dark"] .btn.secondary, html[data-theme="dark"] input[type=file]::file-selector-button { color: var(--link); border-color: var(--link); }
  html[data-theme="dark"] .btn.danger:not(.secondary) { background: var(--bad); color: #1a0d0d; }
  html[data-theme="dark"] input[type=search], html[data-theme="dark"] input[type=text], html[data-theme="dark"] input[type=url],
  html[data-theme="dark"] input[type=email], html[data-theme="dark"] input[type=date], html[data-theme="dark"] input[type=number],
  html[data-theme="dark"] select, html[data-theme="dark"] textarea, html[data-theme="dark"] .field textarea,
  html[data-theme="dark"] input[type=color] { background: #0f141a; color: var(--text); border-color: var(--line); }
  html[data-theme="dark"] th, html[data-theme="dark"] tfoot td, html[data-theme="dark"] .gantt thead .g-sticky,
  html[data-theme="dark"] .sov thead .sticky, html[data-theme="dark"] .sov tfoot .sticky { background: var(--surface-2); }
  html[data-theme="dark"] .table-wrap > table:not(.gantt):not(.sov) > tbody > tr:nth-child(even) > td,
  html[data-theme="dark"] tr.inactive-row td { background: #1e2630; }
  html[data-theme="dark"] .gantt tr.section-row td, html[data-theme="dark"] .gantt-edit tr.section-row td { background: #222c37; }
  html[data-theme="dark"] .sov .this-month { background: #3a3218 !important; }
  html[data-theme="dark"] .g-bar { background: #3d6b91; }
  html[data-theme="dark"] .g-bar.g-late { background: #6e3434; }
  html[data-theme="dark"] .g-bar.g-crewed { background: #33404d; }
  html[data-theme="dark"] .g-bar.g-crewed .g-fill, html[data-theme="dark"] .g-bar.g-unassigned .g-fill { background: rgba(0, 0, 0, .35); }
  html[data-theme="dark"] .g-bar.g-unassigned { background: repeating-linear-gradient(45deg, #26303b 0 4px, #3a4654 4px 8px); }
  html[data-theme="dark"] .g-baseline { background: #6b7684; }
  html[data-theme="dark"] .crew-chip { background: color-mix(in srgb, var(--crew) 28%, var(--card)); color: var(--text); }
  html[data-theme="dark"] .seg, html[data-theme="dark"] .super-menu summary, html[data-theme="dark"] .super-menu-list,
  html[data-theme="dark"] .upload-email form { background: var(--card); }
  html[data-theme="dark"] .super-menu-list a { color: var(--text); }
  html[data-theme="dark"] .super-menu-list a.on { background: var(--surface-2); }
  html[data-theme="dark"] .messages .warning, html[data-theme="dark"] .messages .info, html[data-theme="dark"] .dev-banner,
  html[data-theme="dark"] .retired-banner, html[data-theme="dark"] .overlap-box, html[data-theme="dark"] .snap-preview { color: #f3c97a; }
  html[data-theme="dark"] .viewing-as, html[data-theme="dark"] .dev-banner { border-color: #6b5520; }
  html[data-theme="dark"] .dropzone { border-color: #35506a; }
  html[data-theme="dark"] .dz-title { color: var(--text); }
  html[data-theme="dark"] .dz-icon { color: var(--link); }
  html[data-theme="dark"] .btn.secondary:hover, html[data-theme="dark"] .topbar .btn.secondary.signout:hover { background: var(--surface-2); }
  html[data-theme="dark"] .topbar a.on, html[data-theme="dark"] .topbar a:hover { color: #fff; }
  html[data-theme="dark"] .pcard:hover { box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
  html[data-theme="dark"] .upload-help, html[data-theme="dark"] .card-inset { background: var(--surface-2); }
  html[data-theme="dark"] .badge.info, html[data-theme="dark"] .why-tag { color: var(--link); }
  html[data-theme="dark"] .tile .value:not(.alert) { color: var(--text); }
  html[data-theme="dark"] .crew-dot.crew-none { background: repeating-linear-gradient(45deg, #1a2129 0 2px, #94a3b8 2px 4px); }
}

/* Buyout savings */
.saved { color: var(--good); font-weight: 600; }
.over { color: var(--bad); font-weight: 600; }
.buyout-box { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line);
  border-left: 5px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 16px; }
.buyout-box.good { border-left-color: var(--good); }
.buyout-box.bad { border-left-color: var(--bad); }
.buyout-net .label { color: var(--muted); font-family: var(--font-head); font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; }
.buyout-net .value { font-family: var(--font-head); font-size: 34px; font-weight: 700; line-height: 1.15; }
.buyout-box.good .buyout-net .value { color: var(--good); }
.buyout-box.bad .buyout-net .value { color: var(--bad); }
.buyout-split { display: grid; gap: 3px; }
.buyout-cell { min-width: 150px; }
.buyout-edit summary { cursor: pointer; color: var(--accent); }
.buyout-form { display: grid; gap: 6px; margin-top: 6px; text-align: left; min-width: 200px; }
.buyout-form label { display: grid; gap: 2px; }
.buyout-form input { width: 100%; }
.buyout-actions { display: flex; gap: 6px; }
.tile-saved .value:not(.alert) { color: var(--good); }
.leaderboard { padding: 0; margin: 0; }
.leaderboard .rank { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent); font-size: 12px; font-weight: 700; margin-right: 4px; }
.leaderboard li:first-child .rank { background: #f2b705; color: #3a2a00; }

/* Sample data */
.badge.sample { background: repeating-linear-gradient(45deg, var(--warn-soft) 0 6px, transparent 6px 12px); color: var(--warn);
  border: 1px dashed var(--warn); }
.sample-switch { display: grid; gap: 12px; justify-items: start; margin: 12px 0; }
.switch-state { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Project notes */
.notes-card { padding: 0; overflow: hidden; }
.notes-toolbar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--bg); }
.notes-toolbar .tool { font: inherit; font-size: 14px; min-width: 34px; height: 32px; padding: 0 10px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--card); color: var(--text); cursor: pointer; }
.notes-toolbar .tool:hover { border-color: var(--accent); }
.notes-toolbar .tool.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tool-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.tool-hint { margin-left: auto; }
.notes-editor { min-height: 420px; padding: 16px 20px; outline: none; }
.notes-editor:focus { box-shadow: inset 0 0 0 2px var(--aqua); }
.notes-editor:empty::before { content: attr(data-placeholder); color: var(--muted); }
.notes-body { font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.notes-card > .notes-body:not(.notes-editor) { padding: 16px 20px; }
.notes-body p { margin: 0 0 8px; }
.notes-body ul, .notes-body ol { margin: 0 0 8px; padding-left: 26px; }
.notes-body li { margin: 2px 0; }
.notes-fallback { display: block; width: 100%; border: 0; padding: 16px 20px; font: inherit; resize: vertical; }
.notes-actions { padding: 10px 14px; border-top: 1px solid var(--line); }
.notes-toolbar .notes-status { margin-left: auto; }
.notes-toolbar .tool-hint { margin-left: 12px; }
.notes-status.ok { color: var(--muted); }
.notes-status.ok::before { content: "\2713  "; color: var(--good); }
.notes-status.bad { color: var(--bad); font-weight: 600; }
.notes-theirs { margin-bottom: 14px; border-left: 5px solid var(--warn); }
.notes-theirs h3 { margin-top: 0; }
/* Estimate history, design changes, re-estimation (under Est. vs Actual). Four layers, one color each:
   original estimate (navy), design proposed (amber), estimation approved (green), actual (aqua). */
.costs-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.costs-nav a { padding: 6px 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); color: var(--text); font-weight: 600; font-size: 14px; }
.costs-nav a:hover { border-color: var(--accent); text-decoration: none; }
.costs-nav a.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.costs-nav .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 10px; background: var(--warn); color: #fff; font-size: 12px; text-align: center; }
.text-bad { color: var(--bad); }
.text-good { color: var(--good); }
.layer-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.layer-legend b { color: var(--text); margin-right: 4px; }
.layer { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.layer.original, .hkpi.layer-original { --layer: var(--navy-2); }
.layer.design, .hkpi.layer-design { --layer: #c98a00; }
.layer.approved, .hkpi.layer-approved { --layer: var(--good); }
.layer.actual, .hkpi.layer-actual { --layer: #2aa6b8; }
.layer { background: var(--layer); }
.history-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.hkpi { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--layer, var(--line)); border-radius: var(--radius); padding: 12px 14px; }
.hkpi .label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.hkpi .value { font-family: var(--font-head); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.small-kpis .hkpi .value { font-size: 20px; }
.th-sub { font-size: 11px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.history-table .col-current { box-shadow: inset 0 3px 0 var(--navy-2); }
.history-table .col-approved { background: color-mix(in srgb, var(--good) 8%, transparent); }
tr.muted-row td { color: var(--muted); }
.changes-table th.grp { text-align: center; border-bottom: 3px solid var(--layer); }
.grp-original { --layer: var(--navy-2); } .grp-design { --layer: #c98a00; } .grp-approved { --layer: var(--good); }
.compare-3 thead th.grp-original, .compare-3 thead th.grp-design, .compare-3 thead th.grp-approved { border-bottom: 3px solid var(--layer); }
.compare-3 tbody th, .compare-3 tfoot th { text-align: left; font-weight: 600; white-space: nowrap; }
.compare-3 td.changed { background: color-mix(in srgb, #c98a00 14%, transparent); font-weight: 600; }
.change-grid { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
@media (max-width: 960px) { .change-grid { grid-template-columns: 1fr; } }
.change-notes { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.trail { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.trail li { padding-left: 14px; border-left: 3px solid var(--line); }
.action-box { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.action-box h3 { margin: 0; }
.action-box textarea, .action-box input[type=text] { width: 100%; }
.price-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.price-grid label { display: grid; gap: 3px; font-size: 13px; font-weight: 600; }
.price-grid input { width: 100%; }
.orig-box { border-left: 4px solid var(--navy-2); background: var(--bg); padding: 10px 14px; margin-bottom: 14px; }
.orig-box .kicker { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.flow-steps { list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 0 0 16px; padding: 0; }
.flow-steps li { counter-increment: step; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 10px 46px; position: relative; }
.flow-steps li::before { content: counter(step); position: absolute; left: 12px; top: 10px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.flow-steps li > b { display: block; }
.flow-steps li > span { color: var(--muted); font-size: 13px; }
.card-head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head-row h2 { margin: 0; }
.egnyte-pick { display: grid; gap: 6px; margin-top: 10px; }
.design-cell { min-width: 120px; }
.design-cell .proposed { font-weight: 600; }
/* Discussion tab: chat for everyone on the job. Own messages on the right; avatars colored per person. */
.chat-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.chat-list { list-style: none; margin: 0; padding: 16px 20px; height: min(64vh, 720px); overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.chat-list > :first-child { margin-top: auto; } /* few messages sit at the bottom, next to the box */
.chat-empty, .chat-earlier { text-align: center; color: var(--muted); padding: 10px; font-size: 14px; }
.chat-day { display: flex; align-items: center; gap: 10px; margin: 14px 0 6px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.chat-day::before, .chat-day::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.chat-msg { display: grid; grid-template-columns: 34px minmax(0, 1fr); column-gap: 10px; align-items: start; max-width: min(760px, 88%); }
.chat-msg.head { margin-top: 10px; }
.chat-msg:not(.head) .chat-bubble { grid-column: 2; }
.chat-msg.mine { align-self: flex-end; grid-template-columns: minmax(0, 1fr) 34px; }
.chat-msg.mine .chat-avatar { grid-column: 2; grid-row: 1; }
.chat-msg.mine .chat-bubble { grid-column: 1; grid-row: 1; background: var(--accent-soft); border-color: transparent; }
.chat-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; }
.chat-avatar.c0 { background: #1b6094; } .chat-avatar.c1 { background: #1f8a70; } .chat-avatar.c2 { background: #8a5a00; }
.chat-avatar.c3 { background: #6b4fa0; } .chat-avatar.c4 { background: #b4443c; } .chat-avatar.c5 { background: #3d6b7a; }
.chat-bubble { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; min-width: 0; position: relative; }
.chat-meta { display: flex; gap: 8px; align-items: baseline; font-size: 13px; margin-bottom: 2px; }
.chat-meta time, .chat-time { color: var(--muted); font-size: 12px; }
.chat-time { display: block; text-align: right; margin-top: 2px; }
.chat-text { font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.chat-compose { display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--bg); }
.chat-compose textarea { font: inherit; font-size: 15px; resize: vertical; min-height: var(--control-h); max-height: 240px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text); }
.chat-compose .btn { align-self: end; }
.chat-hint { grid-column: 1 / -1; }
.chat-status.bad { color: var(--bad); font-weight: 600; margin-left: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 640px) { .chat-list { padding: 12px; } .chat-msg { max-width: 100%; } .chat-compose { grid-template-columns: 1fr; } .chat-compose .btn { justify-self: end; } }
@media print { .chat-list { height: auto; overflow: visible; } .chat-compose { display: none; } }
@media print { .notes-card { border: 0; } .notes-editor { min-height: 0; padding: 0; } }
th .sort-link { color: inherit; }
th .sort-link.on, th .sort-link:hover { color: var(--accent); text-decoration: none; }

/* Plans and pictures */
.upload-card { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin-bottom: 16px; }
.upload-card .field { display: grid; gap: 4px; flex: 1 1 220px; margin: 0; }
.upload-card .field > span { font-weight: 600; }
.upload-card .upload-pick { flex: 1 1 300px; }
.row-actions { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; }
.inline-confirm { margin: 0; }
.photo-day { margin: 18px 0 8px; font-size: 16px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.photo-card { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.photo-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--bg); }
.photo-card figcaption { padding: 8px 10px; display: grid; gap: 2px; }
.photo-actions { display: flex; gap: 12px; align-items: center; }
.photo-actions form { margin: 0; }
button.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.danger-text { color: var(--bad) !important; }

/* Settings -> Roles & permissions: capability x role grid */
.settings-section.single { grid-template-columns: minmax(0, 1fr); }
.perm-table { border-collapse: separate; border-spacing: 0; }
.perm-table th.perm-cap { position: sticky; left: 0; z-index: 2; background: var(--card); text-align: left; min-width: 220px; max-width: 280px; font-weight: 500; }
.perm-table thead th.perm-cap { z-index: 3; }
.perm-table th.perm-role { text-align: center; min-width: 96px; vertical-align: bottom; }
.perm-table tr.perm-group th { text-align: left; text-transform: uppercase; letter-spacing: .04em; font-size: 11px; color: var(--muted); background: var(--surface-2, #f3f6fa); }
.perm-table td.perm-cell { text-align: center; }
.perm-table td.perm-cell input { width: 18px; height: 18px; cursor: pointer; }
.table-wrap > table.perm-table > tbody > tr > td.perm-cell.changed { background: var(--warn-soft); }
.perm-changed-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--warn-soft); border: 1px solid var(--warn); vertical-align: -1px; }
.perm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }

.perm-table tbody th.perm-cap { font-family: inherit; font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--text); white-space: normal; font-weight: 500; }
.perm-table tbody th.perm-cap .small { font-weight: 400; }
.perm-table thead th.perm-role { white-space: normal; }
.perm-table thead th.perm-role .small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.table-wrap > table.perm-table > tbody > tr.perm-group > * { background: var(--surface-2, #f3f6fa); }
.perm-table tbody tr.perm-group th.perm-cap { text-transform: uppercase; letter-spacing: .04em; font-size: 11px; color: var(--muted); font-weight: 600; }

/* ===== Shared form controls (2026-11-12): one height for every input, dropdown and text box ===== */
:root { --control-h: 36px; --ease: cubic-bezier(.2, .8, .2, 1); }
input[type=search], input[type=text], input[type=url], input[type=email], input[type=date], input[type=number],
input[type=password], select, textarea { min-height: var(--control-h); line-height: 1.4; color: var(--text);
  transition: border-color .12s ease, box-shadow .12s ease; }
input[type=search]:hover, input[type=text]:hover, input[type=url]:hover, input[type=email]:hover, input[type=date]:hover,
input[type=number]:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
input[type=search]:focus, input[type=text]:focus, input[type=url]:focus, input[type=email]:focus, input[type=date]:focus,
input[type=number]:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); outline: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
input.invalid, .combo-btn.invalid { border-color: var(--bad) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 14%, transparent); }
.date-error { color: var(--bad); font-size: 12px; margin-top: 4px; white-space: normal; }
/* Text boxes start one line high, like the inputs beside them, and grow with what's typed (ui.js where unsupported). */
textarea, .field textarea { display: block; padding: 7px 10px; resize: vertical; field-sizing: content; max-height: 50vh; }
textarea.notes-fallback { field-sizing: fixed; max-height: none; }
/* Dropdowns look like dropdowns: one chevron, same in every browser. */
select:not([multiple]):not([size]) { -webkit-appearance: none; appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f6b7a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--muted);
  font-size: 12px; font-weight: 600; line-height: 1.5; vertical-align: 1px; white-space: nowrap; }
.role-tag { display: inline-block; padding: 0 7px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; white-space: nowrap; }

/* Twelve-column form layout: fields keep sensible widths on wide screens and stack on narrow ones. */
.form-12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px 20px; align-items: start; }
.form-12 .field { grid-column: span 12; margin: 0; min-width: 0; }
.form-12 .field.c-3 { grid-column: span 3; } .form-12 .field.c-4 { grid-column: span 4; } .form-12 .field.c-6 { grid-column: span 6; }
@media (max-width: 1100px) { .form-12 .field.c-3 { grid-column: span 6; } .form-12 .field.c-6 { grid-column: span 12; } }
@media (max-width: 600px) { .form-12 .field.c-3, .form-12 .field.c-4 { grid-column: span 12; } }
.form-12 .field label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.form-12 .field input, .form-12 .field select, .form-12 .field textarea { width: 100%; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 16px; border-top: 1px solid var(--line); }
.form-actions .btn { min-height: var(--control-h); }
.form-actions-aside { margin-left: auto; color: var(--muted); font-size: 13px; }
@media (max-width: 700px) { .form-actions-aside { margin-left: 0; width: 100%; } }
.card-title-row { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.card-title-row h2 { margin: 0; }
.list-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.title-block h2 { margin: 0 0 6px; }
.title-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ===== Info tips: short explanations behind an (i), on hover, focus or tap ===== */
.tip { position: relative; display: inline-flex; vertical-align: middle; text-transform: none; letter-spacing: 0; font-family: var(--font); }
.tip-btn { display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer; transition: color .12s ease, background-color .12s ease; }
.tip-btn:hover, .tip.open .tip-btn, .tip-btn:focus-visible { color: var(--accent); background: var(--accent-soft); }
.tip-pop { position: fixed; z-index: 1000; left: 0; top: 0; width: max-content; max-width: min(340px, calc(100vw - 16px));
  padding: 9px 12px; border-radius: 6px; background: var(--navy); color: #fff; font-size: 13px; font-weight: 400; line-height: 1.45;
  text-align: left; white-space: normal; box-shadow: 0 8px 24px rgba(13, 47, 79, .22); display: none; }
.tip-pop::after { content: ""; position: absolute; top: 100%; left: var(--arrow-x, 50%); margin-left: -6px; border: 6px solid transparent; border-top-color: var(--navy); }
.tip.below .tip-pop::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--navy); }
.tip-pop::before { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 12px; }  /* lets the mouse cross the gap */
.tip.below .tip-pop::before { top: auto; bottom: 100%; }
.tip-pop a { color: var(--aqua); text-decoration: underline; }
.tip-pop b { color: #fff; }
.tip.open .tip-pop { display: block; animation: tip-in .15s var(--ease); }
@keyframes tip-in { from { opacity: 0; } }
th .tip { margin: -4px 0; }

/* ===== Modal (project Details): centred box, dimmed and blurred page behind, fade + scale in and out ===== */
dialog.modal { border: 0; padding: 0; border-radius: 10px; width: min(580px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  background: var(--card); color: var(--text); box-shadow: 0 24px 64px rgba(13, 30, 48, .3); overflow: auto; }
dialog.modal::backdrop { background: rgba(13, 30, 48, .38); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
dialog.modal[open] { animation: modal-in .22s var(--ease); }
dialog.modal[open]::backdrop { animation: fade-in .22s ease-out; }
dialog.modal.closing { animation: modal-out .18s ease-in forwards; }
dialog.modal.closing::backdrop { animation: fade-out .18s ease-in forwards; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes modal-out { to { opacity: 0; transform: translateY(6px) scale(.97); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { dialog.modal[open], dialog.modal[open]::backdrop, .tip-pop, .combo-pop { animation: none; transition: none; } }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 2px 0 0; }
.modal-kicker { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .5px; }
.modal-x { display: grid; place-items: center; width: 32px; height: 32px; margin: -4px -6px 0 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.modal-x:hover { background: var(--bg); color: var(--text); }
.details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 28px; margin: 0; padding: 18px 20px 20px; }
.details-grid dt, .project-head .meta dt { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.details-grid dd { margin: 3px 0 0; font-size: 15px; font-weight: 600; }
.details-grid .wide { grid-column: 1 / -1; }
@media (max-width: 420px) { .details-grid { grid-template-columns: 1fr; } }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
/* On screen the details live in the modal; on paper they're always printed under the job name. */
.print-only { display: none !important; }
.project-head .meta { margin: 8px 0 0; }
.project-head .meta > div { display: flex; gap: 6px; align-items: baseline; }
.project-head .meta dd { margin: 0; color: var(--text); font-weight: 600; }
@media print {
  .print-only { display: flex !important; }
  dialog { display: none !important; }
  .tip-btn, .tip-pop { display: none !important; }
}

/* ===== Searchable dropdown (Design changes -> Estimate item) ===== */
.combo { position: relative; }
.combo-btn { width: 100%; min-height: var(--control-h); display: flex; align-items: center; gap: 8px; padding: 7px 10px; font: inherit; line-height: 1.4;
  text-align: left; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: 6px; cursor: pointer;
  transition: border-color .12s ease, box-shadow .12s ease; }
.combo-btn:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.combo-btn:focus-visible, .combo.open .combo-btn { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); outline: none; }
.combo-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-value.placeholder { color: var(--muted); }
.combo-chev { flex: none; color: var(--muted); transition: transform .18s var(--ease); }
.combo.open .combo-chev { transform: rotate(180deg); }
.combo-pop { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); padding: 8px; background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 14px 36px rgba(13, 47, 79, .16); animation: pop-in .16s var(--ease); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }
.combo-find { width: 100%; min-width: 0 !important; }
.combo-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: min(340px, 50vh); overflow: auto; overscroll-behavior: contain; }
.combo-group { position: sticky; top: 0; z-index: 1; padding: 8px 10px 4px; background: var(--card); color: var(--muted);
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.combo-opt { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 7px 10px; border-radius: 5px; cursor: pointer; }
.combo-opt .q { flex: none; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.combo-opt:hover, .combo-opt.active { background: var(--accent-soft); }
.combo-opt[aria-disabled="true"] { color: var(--muted); cursor: not-allowed; background: none; }
.combo-opt[hidden], .combo-group[hidden] { display: none; }
.combo-count { padding: 8px 10px 2px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); margin-top: 6px; }

/* ===== Design changes -> Log a design change ===== */
.dc-form { display: grid; gap: 18px; }
.dc-panel { display: contents; }
.dc-panel[hidden] { display: none !important; }
.dc-kinds { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 760px) { .dc-kinds { grid-template-columns: 1fr; } }
.dc-kinds legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.dc-kind { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; cursor: pointer;
  background: var(--card); transition: border-color .12s ease, background-color .12s ease; }
.dc-kind:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.dc-kind:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.dc-kind input { margin-top: 3px; accent-color: var(--accent); }
.dc-kind span { display: grid; gap: 2px; }
.dc-kind small { color: var(--muted); font-size: 12.5px; }
.dc-picked { margin-top: 6px; font-size: 13px; }
.dc-dupes { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dc-dupes p { margin: 0; width: 100%; color: var(--warn); font-weight: 600; font-size: 13px; }
.dc-dupes .btn { white-space: normal; text-align: left; text-transform: none; letter-spacing: 0; }
.compare-3 { table-layout: fixed; width: 100%; }
.compare-3 col.c-label { width: 130px; }
.compare-3 thead th { white-space: normal; }
.trail li.pending { border-left-style: dashed; }

@media screen {
  html[data-theme="dark"] select:not([multiple]):not([size]) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa8b6' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; background-size: 14px; }
  html[data-theme="dark"] .combo-btn { background: #0f141a; }
  html[data-theme="dark"] .tip-pop { background: #2b3644; }
  html[data-theme="dark"] .tip-pop::after { border-top-color: #2b3644; }
  html[data-theme="dark"] .tip.below .tip-pop::after { border-top-color: transparent; border-bottom-color: #2b3644; }
  html[data-theme="dark"] .role-tag { color: var(--link); }
}
/* Original / design / approved read across a row: one alignment for words and numbers alike. */
.compare-3 td, .compare-3 td.num, .compare-3 thead th { text-align: left; font-variant-numeric: tabular-nums; }
.action-box > .btn, .action-box > .filters { justify-self: start; }

/* ===== Data tables (2026-11-18): auto layout, every column as wide as its content; descriptive columns
   (Item, Notes, Name) take what's left. Notes wrap in full instead of being cut off. ===== */
.cost-table { min-width: 760px; }
.cost-table td.pct-cell { min-width: 160px; }
.plan-table { min-width: 1100px; }
.plan-table td { overflow-wrap: break-word; }
.plan-table th:first-child { min-width: 260px; }
.plan-table td.notes-cell { min-width: 160px; }
.note-clip { display: block; white-space: normal; }
.plan-table th { white-space: normal; }
.design-cell { min-width: 0; }
.design-cell .design-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.design-cell .badge { font-size: 11px; padding: 1px 7px; }
.buyout-cell { min-width: 0; }
.tip + .th-sub, th .tip { vertical-align: -6px; }

/* Access denied / not found inside the app (403.html, 404.html): a calm card, not an error dump. */
.denied { max-width: 620px; margin: 6vh auto; padding: 32px 28px; text-align: center; animation: rise .25s var(--ease) both; }
.denied-icon { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); }
.denied-code { font-family: var(--font-head); font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.denied h1 { font-size: 24px; text-transform: none; letter-spacing: 0; margin: 6px 0 10px; }
.denied p { margin: 6px 0; }
.denied-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }
@keyframes rise { from { transform: translateY(6px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .denied, .dash-group, .qrow { animation: none !important; transition: none !important; } }

/* Profit table: content widths like every other table. */
.even-table { min-width: 520px; }

/* The Estimating Director's approval on a design change: the three numbers first, then the decision. */
.decision { gap: 12px; }
.decision-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.decision-head .badge { display: inline-flex; align-items: center; gap: 4px; }
.decision-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); }
.decision-figures > div { padding: 10px 12px; display: grid; gap: 2px; }
.decision-figures > div + div { border-left: 1px solid var(--line); }
.decision-figures span { font-family: var(--font-head); font-size: 12px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.decision-figures b { font-family: var(--font-head); font-size: 20px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.decision-figures em { font-style: normal; font-size: 12px; font-weight: 600; }
.decision-figures .up b, .decision-figures .up em { color: var(--bad); }
.decision-figures .down b, .decision-figures .down em { color: var(--good); }
.decision-by { margin: 0; }
.decision-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.decision-actions .danger-text { margin-left: auto; }
.btn.secondary.danger-text { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.btn.secondary.danger-text:hover { background: var(--bad-soft); }
@media (max-width: 520px) { .decision-figures { grid-template-columns: 1fr; } .decision-figures > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .decision-actions .danger-text { margin-left: 0; } }

/* ---- Home dashboard (2026-11-12): one spacing step (--gap) between every block, cards the same padding. ---- */
:root { --gap: 16px; }
.count-pill { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px;
  background: var(--line); color: var(--text); font-family: var(--font); font-size: 12px; font-weight: 700; letter-spacing: 0;
  vertical-align: 2px; margin-left: 4px; }
.count-pill.hot { background: var(--accent); color: #fff; }
.prio { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--accent); }
.prio.good { background: var(--good); } .prio.warn { background: var(--warn); } .prio.bad { background: var(--bad); }
.prio.bad { box-shadow: 0 0 0 3px var(--bad-soft); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* KPI strip: same height cards, clickable ones lift a little and jump to their card. */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.kpi { display: block; background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--accent);
  border-radius: var(--radius); padding: 12px 14px; color: var(--text); transition: transform .15s var(--ease), box-shadow .15s var(--ease), border-color .15s; }
a.kpi:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(18, 38, 63, .10); border-color: var(--accent); }
.kpi.alert { border-top-color: var(--bad); } .kpi.alert .kpi-value { color: var(--bad); }
.kpi.warn { border-top-color: var(--warn); } .kpi.warn .kpi-value { color: var(--warn); }
.kpi.good { border-top-color: var(--good); }
.kpi-label { font-family: var(--font-head); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); }
.kpi-value { font-family: var(--font-head); font-size: 30px; font-weight: 700; line-height: 1.15; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Sections */
.dash-section { margin-top: calc(var(--gap) * 1.5); }
.section-head, .card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.section-head h2, .card-head h2 { margin: 0; }
.card-head .legend { margin-left: auto; display: flex; gap: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.all-clear { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; }
.all-clear span { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 12px; font-size: 12px;
  font-weight: 600; background: var(--good-soft); color: var(--good); }
.all-clear-big { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius); background: var(--good-soft); color: var(--good); }
.all-clear-big b { color: var(--text); }

/* "Waiting for you": the design / estimating queue as a scannable table, oldest first. */
.queue { margin-bottom: 0; }
.queue-table { table-layout: fixed; min-width: 980px; }
.queue-table col.q-job { width: 20%; } .queue-table col.q-who { width: 17%; } .queue-table col.q-amt { width: 110px; }
.queue-table col.q-age { width: 90px; } .queue-table col.q-status { width: 200px; } .queue-table col.q-act { width: 178px; }
.queue-table td { vertical-align: middle; }
.queue-table .prio { margin-right: 10px; vertical-align: 1px; }
.q-title { font-weight: 600; }
.q-act { text-align: center; }
.q-act .btn { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.qrow { transition: background-color .12s; }
.qrow:hover td { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.age { font-weight: 600; } .age.bad { color: var(--bad); } .age.warn { color: var(--warn); } .age.info { color: var(--muted); }

/* Action items: grouped cards that pack into balanced columns (no tall list leaving grey space beside it). */
/* Cards wrap and grow to fill their row; a card left alone on the last row spreads its list into columns. */
.dash-groups { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: flex-start; }
.dash-group { flex: 1 1 330px; min-width: 0; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 8px; }
.dash-group header { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.dash-group h3 { margin: 0; font-size: 15px; text-transform: uppercase; letter-spacing: .6px; flex: 1; min-width: 0; }
.dash-group .count-pill { margin: 0; }
.gicon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); flex: none; }
#g-cost .gicon, #g-billing .gicon, #g-behind .gicon { background: var(--bad-soft); color: var(--bad); }
#g-buyout .gicon, #g-decided .gicon { background: var(--good-soft); color: var(--good); }
.dash-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); column-gap: 28px; }
.dash-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); min-width: 0; }

.dl-main { flex: 1; min-width: 0; }
.dl-title { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-row .rank { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
.dash-list .dash-row:first-child .rank { background: #f2b705; color: #3a2a00; }
/* Show N more: the extra rows slide open (grid 0fr -> 1fr). */
.more-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .28s var(--ease); }
.more-wrap > div { overflow: hidden; min-height: 0; }
.dash-group.is-open .more-wrap { grid-template-rows: 1fr; }
.more-btn { display: block; width: 100%; margin-top: 2px; padding: 8px 0 4px; border: 0; border-top: 1px dashed var(--line); background: none;
  color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-align: left; }
.more-btn:hover { text-decoration: underline; }

/* Open projects: compact cards, same height in a row. */
.project-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: var(--gap); }
.pcard { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; transition: transform .15s var(--ease), box-shadow .15s var(--ease), border-color .15s; }
.pcard:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(18, 38, 63, .10); }
.pc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pc-badges { display: inline-flex; gap: 4px; }
.pcard .name { margin: 0; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.pc-meta { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-stats { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; margin-top: 2px; }
.pc-stats span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; }
.pc-stats b { font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pcard .bar { margin-top: 0; }
.pc-foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: auto; }

@media (max-width: 760px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpis > .kpi:last-child:nth-child(odd) { grid-column: span 2; }
  .kpi-value { font-size: 26px; }
  .card-head .legend, .all-clear { margin-left: 0; }
  .dash-group { flex-basis: 100%; }
}
html[data-theme="dark"] a.kpi:hover, html[data-theme="dark"] .pcard:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, .45); }
html[data-theme="dark"] .count-pill:not(.hot) { background: #2b3642; }
@media print { .kpi, .pcard, .dash-group { break-inside: avoid; transform: none !important; } .more-wrap { grid-template-rows: 1fr; } .more-btn { display: none; } }

/* Confirmation dialog (ui.js appConfirm): the app's own, never the browser's. */
dialog.confirm-modal { width: min(440px, calc(100vw - 32px)); }
.confirm-body { display: flex; gap: 14px; padding: 22px 22px 8px; align-items: flex-start; }
.confirm-icon { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); position: relative; }
.confirm-icon::after { content: "?"; position: absolute; inset: 0; display: grid; place-items: center; font: 700 18px var(--font-head); color: var(--accent); }
dialog.confirm-modal.danger .confirm-icon { background: var(--bad-soft); }
dialog.confirm-modal.danger .confirm-icon::after { content: "!"; color: var(--bad); }
.confirm-body h2 { margin: 4px 0 6px; font-size: 20px; }
.confirm-body p { margin: 0; color: var(--muted); line-height: 1.45; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px 20px; }

/* ACK (acknowledged: seen, not yet acted on) */
.badge.ack { background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--muted); display: inline-flex; align-items: center; gap: 3px; }
.prio.ack { background: color-mix(in srgb, var(--muted) 55%, transparent); box-shadow: none; }
.age.ack { color: var(--muted); font-weight: 500; }
.qrow.is-acked td { color: var(--muted); }
.qrow.is-acked .q-title { font-weight: 500; }
.queue-acked-note { font-family: var(--font); text-transform: none; letter-spacing: 0; font-weight: 500; }
.ack-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ack-box p { margin: 0; }

/* Waiting for you: search + filters bar, sortable headings. */
.qfilters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }
.qf-search { position: relative; display: flex; align-items: center; flex: 1 1 240px; max-width: 340px; }
.qf-search svg { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.qf-search input { width: 100%; padding-left: 32px; }
.qfilters select { flex: 0 1 180px; min-width: 130px; }
.qf-count { margin-left: auto; }
.legend-btn { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border: 1px solid transparent; border-radius: 12px;
  background: none; color: var(--muted); font: inherit; cursor: pointer; transition: background-color .12s, border-color .12s; }
.legend-btn:hover { background: var(--bg); }
.legend-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.legend-ack { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); padding: 3px 0; }
.th-sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }
.th-sort::after { content: "↕"; opacity: .35; font-size: 11px; }
th[aria-sort="ascending"] .th-sort::after { content: "↑"; opacity: 1; }
th[aria-sort="descending"] .th-sort::after { content: "↓"; opacity: 1; }
.th-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.queue-table col.q-act { width: 236px; } .queue-table col.q-status { width: 230px; }
.q-act { white-space: nowrap; }
.q-act .q-ack { display: inline; margin: 0 4px 0 0; }
.q-status-cell { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.q-status-cell .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.q-status-cell .badge.ack { margin-left: 4px; }
@media (max-width: 760px) { .qf-search { max-width: none; flex-basis: 100%; } .qfilters select { flex: 1 1 calc(50% - 4px); } .qf-count { margin-left: 0; } }

.inline-form { display: inline; margin: 0; }
.btn[hidden], .qfilters [hidden] { display: none !important; }
.queue-table col.q-job { width: 17%; } .queue-table col.q-who { width: 14%; } .queue-table col.q-status { width: 205px; }
.queue-table col.q-act { width: 222px; } .queue-table col.q-amt { width: 104px; } .queue-table col.q-age { width: 84px; }
.queue-table { min-width: 1060px; }

/* Waiting for you tabs: Pending acknowledgment (default) / Acknowledged / All, with counts. */
.qtabs { display: flex; gap: 2px; margin: 0 0 10px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.qtab { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; margin-bottom: -1px; border: 0; border-bottom: 3px solid transparent;
  background: none; color: var(--muted); font: 600 13px var(--font-head); letter-spacing: .6px; text-transform: uppercase; cursor: pointer;
  white-space: nowrap; transition: color .12s, border-color .12s; }
.qtab:hover { color: var(--text); }
.qtab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.qtab .count-pill { margin: 0; }
.qtab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.qtabs { border-bottom: 0; box-shadow: inset 0 -1px var(--line); overflow-y: hidden; scrollbar-width: none; }
.qtab { margin-bottom: 0; }
@media (max-width: 520px) { .hide-sm { display: none; } }

/* Sign in with Microsoft */
.login-card { text-align: center; }
.login-card .messages { text-align: left; }
.ms-btn { display: inline-flex; align-items: center; gap: 10px; margin: 6px 0 12px; padding: 0 18px; min-height: 42px;
  background: #fff; color: #1d2733 !important; border: 1px solid #8c8c8c; text-transform: none; letter-spacing: 0; font: 600 15px var(--font); }
.ms-btn:hover { background: #f3f3f3; text-decoration: none; }

/* Projects list (2026-11-18): columns as wide as their content, Name / Contractor takes the rest; Job # and the
   leadership-only Gross Margin % column are tinted blue. Narrow screens scroll inside the card. */
.projects-table { min-width: 1180px; }
.projects-table th, .projects-table td { padding: 10px 12px; }
.projects-table th { line-height: 1.25; }
.projects-table td.cell-name { width: auto; min-width: 13rem; white-space: normal; }
.projects-table td.status-cell { white-space: nowrap; }
.projects-table td .badge + .badge { margin-left: 4px; }
/* Job # and Gross Margin % carry the blue tint (Gross Margin % alternates white / blue) with bold headings. */
.table-wrap > table.projects-table > thead > tr > th.job-col,
.table-wrap > table.projects-table > thead > tr > th.gm-col { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.table-wrap > table.projects-table > tbody > tr > td.job-col { background: color-mix(in srgb, var(--accent-soft) 70%, var(--card)); }
.table-wrap > table.projects-table > tbody > tr > td.gm-col { background: color-mix(in srgb, var(--accent-soft) 70%, var(--card)); }  /* same shades as Job # */
.table-wrap > table.projects-table > tbody > tr:nth-child(even) > td.job-col,
.table-wrap > table.projects-table > tbody > tr:nth-child(even) > td.gm-col { background: var(--accent-soft); }
.table-wrap > table.projects-table > tbody > tr.clickable:hover > td.job-col,
.table-wrap > table.projects-table > tbody > tr.clickable:hover > td.gm-col { background: color-mix(in srgb, var(--accent) 18%, var(--card)); }
.gm-value { display: inline-block; min-width: 4.6em; text-align: center; padding: 2px 8px; border-radius: 999px; font-weight: 700;
  background: var(--card); color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.gm-value.negative { color: var(--bad); background: var(--bad-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bad) 35%, transparent); }
@media screen {
  html[data-theme="dark"] .table-wrap > table.projects-table > thead > tr > th.gm-col,
  html[data-theme="dark"] .table-wrap > table.projects-table > thead > tr > th.job-col,
  html[data-theme="dark"] .gm-value { color: var(--link); }
}

/* ===== Text alignment (2026-11-18), one rule set for every page =====
   Left: headings, labels, names, descriptions, form fields (reading order and hierarchy start at the left edge).
   Right: amounts, counts and percentages (.num), and row actions, so figures line up by their digits.
   Center: columns that only hold a status badge (th/td .center), KPI tiles, empty-state messages, sign-in and
   error pages. Justified: longer explanatory paragraphs in cards and help boxes, on screens wide enough that
   justifying doesn't leave gaps between words; the last line stays left. */
.kpi, .tile { text-align: center; }
.empty, td.empty, .card.empty { text-align: center; }
p.empty { padding: 12px 0; }
@media (min-width: 700px) {
  .card > p:not(.empty):not(.small):not(.muted), .card-inset p, .upload-help p {
    text-align: justify; text-align-last: left; hyphens: auto; -webkit-hyphens: auto; }
}

/* Table alignment (2026-11-18): every heading sits centered over its values. The row label (first column) and
   long descriptive text (th/td .desc: names, items, descriptions, reasons, notes on file) stay left so they read
   naturally; everything else (dates, numbers, codes, statuses, short notes) is centered under its heading.
   The SOV and Gantt grids, the Roles grid and the design-change comparison keep their own layout. */
:is(.table-wrap, .card) table:not(.sov):not(.gantt):not(.perm-table):not(.compare-3) > * > tr > :is(th, td) { text-align: center; }
:is(.table-wrap, .card) table:not(.sov):not(.gantt):not(.perm-table):not(.compare-3) > :is(tbody, tfoot) > tr > :is(th, td):first-child,
:is(.table-wrap, .card) table:not(.sov):not(.gantt):not(.perm-table):not(.compare-3) > thead > tr:first-child > th:first-child,
:is(.table-wrap, .card) table:not(.sov):not(.gantt):not(.perm-table):not(.compare-3) > * > tr > :is(th, td).desc { text-align: left; }
:is(.table-wrap, .card) table:not(.sov):not(.gantt):not(.perm-table):not(.compare-3) > * > tr > :is(th, td):is(.center, .num, .empty) { text-align: center; }
.design-cell .design-line { justify-content: center; }
.buyout-cell .buyout-form { margin-left: auto; margin-right: auto; }

/* Table headings (2026-11-18): highlighted in every table, the same as the CRM: a soft blue band with bold
   blue labels. Job # and Gross Margin % on Projects stay a shade stronger. */
th { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
th .th-sub { color: color-mix(in srgb, var(--accent) 70%, var(--muted)); }
.table-wrap > table.projects-table > thead > tr > th.job-col,
.table-wrap > table.projects-table > thead > tr > th.gm-col { background: color-mix(in srgb, var(--accent) 18%, var(--card)); }
@media screen {
  html[data-theme="dark"] th { background: #1b3346; color: var(--link); }
}

/* Audit log (Settings): one colour per kind of change. */
.badge.audit-create, .badge.audit-approve { background: var(--good-soft); color: var(--good); }
.badge.audit-update { background: var(--accent-soft); color: var(--accent); }
.badge.audit-delete { background: var(--bad-soft); color: var(--bad); }
.badge.audit-reject { background: var(--warn-soft); color: var(--warn); }
.badge.audit-login { background: var(--bg); color: var(--muted); }
.audit-table td.desc { min-width: 14rem; }
.audit-change { line-height: 1.45; }
.audit-filters input[type=search] { min-width: 16rem; }


/* Drag and drop on every file upload (ui.js, 2026-11-20): while files are dragged over the page each upload is
   outlined; the one under the pointer turns blue. */
.drop-target { transition: outline-color .12s ease, background-color .12s ease; outline: 2px dashed transparent; outline-offset: 4px; border-radius: var(--radius); }
body.dragging-files .drop-target { outline-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.drop-target.drag-over { outline-color: var(--accent); background-color: var(--accent-soft); }
.dropzone.drag-over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
.drop-hint { display: inline-block; margin: 0 8px; font-size: 12.5px; color: var(--muted); }
.drop-hint.drop-error, .dz-sub.drop-error { color: var(--bad); font-weight: 600; }

/* Est. vs Actual: each card's upload box, the per-file list, and the Outlook-style split drop overlay. */
.source-action:has(.source-dropzone) { display: block; }
.source-dropzone { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 16px;
  border: 2px dashed #b9cde0; border-radius: 10px; background: var(--accent-soft); cursor: pointer; text-align: center;
  transition: border-color .12s ease, background-color .12s ease; }
.source-dropzone.actual { border-color: color-mix(in srgb, var(--aqua) 55%, #b9cde0); background: color-mix(in srgb, var(--aqua) 10%, var(--card)); }
.source-dropzone:hover, .source-dropzone:focus-within, .source-dropzone.drag-over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
.source-dropzone.actual:hover, .source-dropzone.actual:focus-within, .source-dropzone.actual.drag-over { border-color: var(--aqua); background: color-mix(in srgb, var(--aqua) 18%, var(--card)); }
.source-dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.source-dropzone .dz-icon { display: flex; color: var(--accent); }
.source-dropzone.actual .dz-icon { color: var(--aqua); }
.source-dropzone .dz-title { font-size: 14px; }
.source-dropzone .dz-sub { font-size: 12.5px; }
.upload-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.upload-list:empty { display: none; }
.upload-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; padding: 8px 10px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.upload-list .u-name { font-weight: 600; overflow-wrap: anywhere; }
.upload-list .u-state { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--accent); white-space: nowrap; }
.upload-list .u-bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.upload-list .u-bar i { display: block; width: 0; height: 100%; background: var(--accent); transition: width .15s ease; }
.upload-list li:not(.busy) .u-bar { display: none; }
.upload-list .u-msg { grid-column: 1 / -1; color: var(--muted); }
.upload-list .u-msg:empty { display: none; }
.upload-list li.ok { border-color: color-mix(in srgb, var(--good) 40%, var(--line)); background: var(--good-soft); }
.upload-list li.ok .u-state { color: var(--good); }
.upload-list li.fail { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); background: var(--bad-soft); }
.upload-list li.fail .u-state { color: var(--bad); }
.upload-list li.u-done { display: block; padding: 0; border: 0; background: none; }
/* The page stays visible behind the halves, blurred; the overlay fades and blurs in, and out again. */
.split-drop { position: fixed; inset: 0; z-index: 1000; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px;
  padding: 24px; background: color-mix(in srgb, var(--navy) 22%, transparent);
  -webkit-backdrop-filter: blur(7px) saturate(1.1); backdrop-filter: blur(7px) saturate(1.1);
  animation: split-in .22s ease-out both; }
.split-drop.leaving { animation: split-out .16s ease-in both; }
.split-drop[hidden] { display: none; }
@keyframes split-in {
  from { opacity: 0; -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); }
  to { opacity: 1; -webkit-backdrop-filter: blur(7px) saturate(1.1); backdrop-filter: blur(7px) saturate(1.1); }
}
@keyframes split-out { from { opacity: 1; } to { opacity: 0; } }
.split-drop .split-half { animation: split-half-in .26s cubic-bezier(.2, .8, .3, 1) backwards; }
@keyframes split-half-in { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .split-drop, .split-drop.leaving, .split-drop .split-half { animation: none; } }
.split-half { display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; color: var(--text);
  border: 3px dashed color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 16px;
  background: color-mix(in srgb, var(--card) 38%, transparent); box-shadow: 0 8px 30px rgba(0, 0, 0, .12);
  transition: border-color .15s ease, background-color .15s ease, transform .15s ease; }
.split-box { padding: 18px 26px; border-radius: 12px; background: color-mix(in srgb, var(--card) 80%, transparent); }
.split-half.actual { border-color: color-mix(in srgb, var(--aqua) 55%, transparent); }
.split-box { display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.split-box h3 { margin: 0; font-size: 28px; text-transform: uppercase; letter-spacing: .6px; }
.split-box p { margin: 0; color: var(--muted); font-size: 15px; }
.split-icon { display: flex; color: var(--accent); }
.split-half.actual .split-icon { color: var(--aqua); }
.split-half.over { border-style: solid; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, transparent); transform: scale(1.01); }
.split-half.actual.over { border-color: var(--aqua); background: color-mix(in srgb, var(--aqua) 26%, transparent); }
.split-half.locked { opacity: .7; }
.split-half.locked.over { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 18%, transparent); transform: none; }
@media (max-width: 700px) {
  .split-drop { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; padding: 12px; gap: 12px; }
  .split-box h3 { font-size: 22px; }
}

/* Settings -> Roles & permissions: custom roles (2026-11-24). */
.perm-table thead th.perm-role.custom { background: color-mix(in srgb, var(--aqua) 14%, var(--accent-soft)); }
.perm-table thead th.perm-role.custom a { color: var(--accent); text-decoration: none; }
.perm-table thead th.perm-role.custom a:hover { text-decoration: underline; }
.perm-table thead th.perm-role.custom .icon { vertical-align: -1px; }
.settings-intro .filters { margin-top: 10px; align-items: center; }
.role-delete { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); }
.role-delete h3 { margin: 0 0 6px; }


/* Est. vs Actual (2026-11-30): a one-line status of what the numbers are based on at the top; the uploads at the bottom. */
.sources-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: 0 0 16px; padding: 9px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); font-size: 13.5px; }
.sources-item .icon { color: var(--good); vertical-align: -2px; }
.sources-link { margin-left: auto; font-weight: 600; white-space: nowrap; }
.sources-link .icon { vertical-align: -2px; }
.update-numbers { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); scroll-margin-top: 16px; }
.update-numbers > h2 { margin: 0 0 4px; }
.update-numbers > p { margin: 0 0 14px; }
.update-numbers .data-sources { margin-bottom: 0; }
@media (max-width: 700px) { .sources-link { margin-left: 0; } }

/* Org chart (2026-11-30), like Microsoft Teams: managers above, the person, then their direct reports. */
.org-chart { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 6px 0; }
.org-level { display: flex; flex-direction: column; align-items: center; }
.org-level + .org-level::before, .org-reports-head::before { content: ""; display: block; width: 2px; height: 18px; margin: 0 auto; background: var(--line); }
.org-card { display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 320px; padding: 10px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; color: var(--text); text-decoration: none;
  box-shadow: 0 1px 2px rgba(13, 47, 79, .06); transition: border-color .12s ease, box-shadow .12s ease; }
a.org-card:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(13, 47, 79, .12); text-decoration: none; }
.org-card.me { border: 2px solid var(--accent); background: var(--accent-soft); }
.org-card.group { flex-direction: column; align-items: flex-start; gap: 4px; }
.org-group-title { font-weight: 700; }
.org-group-people { font-size: 13px; }
.org-avatar { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent);
  color: #fff; font-weight: 700; font-size: 13px; }
.org-avatar.big { width: 56px; height: 56px; font-size: 19px; }
.org-who { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.org-who b { overflow-wrap: anywhere; }
.org-who span { color: var(--muted); font-size: 12.5px; }
.org-reports-head { margin-top: 0; text-align: center; }
.org-reports-head::after { content: ""; display: block; width: 2px; height: 10px; margin: 4px auto 0; background: var(--line); }
.org-reports { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding-top: 10px; border-top: 2px solid var(--line); }
.org-card.small { min-width: 200px; padding: 8px 12px; }
.org-none { margin: 14px 0 0; text-align: center; }
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.profile-head h2 { margin: 0; }
.profile-facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0 0 14px; }
.profile-facts dt { color: var(--muted); font-size: 13px; }
.profile-facts dd { margin: 0; }
.me-link { color: inherit; text-decoration: none; }
.me-link:hover { text-decoration: none; opacity: .85; }
.org-card-section { margin-top: 18px; }
.hierarchy-body { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr); gap: 24px; align-items: start; }
.role-tree { list-style: none; margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.role-tree li { position: relative; padding: 3px 0 3px calc(var(--depth) * 18px); font-size: 14px; }
.role-tree-line { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); vertical-align: 3px; }
.hierarchy-table select { min-width: 220px; }
@media (max-width: 900px) { .hierarchy-body { grid-template-columns: 1fr; } .org-card { min-width: 0; width: 100%; } }

/* Est. vs Actual: Egnyte weekly sync card (2026-12-01) */
.egnyte-sync { margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg, transparent); }
.egnyte-sync-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.egnyte-sync-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px 14px; margin: 8px 0 6px; }
.egnyte-sync-facts dt { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.egnyte-sync-facts dd { margin: 0; font-size: 13px; }
.egnyte-sync-msg, .egnyte-sync-note { margin: 4px 0 8px; overflow-wrap: anywhere; }
.egnyte-sync-msg.bad, .egnyte-sync-note.bad { color: var(--bad); }
.egnyte-sync-note.good { color: var(--good); }
.egnyte-sync form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.egnyte-sync .btn[disabled] { opacity: .6; cursor: not-allowed; }
.egnyte-sync .btn[aria-busy="true"] .icon { animation: egnyte-spin 1s linear infinite; }
@keyframes egnyte-spin { to { transform: rotate(360deg); } }

/* Plans / Pictures: a row whose file is gone from storage (2026-12-01) */
.photo-card.missing { border-style: dashed; }
.photo-missing { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 140px; padding: 12px; text-align: center; color: var(--bad); background: var(--bad-soft); border-radius: var(--radius); font-size: 13px; }
.photo-missing span { color: var(--text); }

/* In-place page changes (static/js/nav.js, 2026-12-02): a thin bar along the top while a page takes longer
   than 150 ms. The header, menu and logo stay put, like the CRM. */
html.pm-nav-busy::before {
  content: ""; position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 2000;
  background: linear-gradient(90deg, transparent, var(--aqua), var(--accent), transparent);
  background-size: 50% 100%; background-repeat: no-repeat;
  animation: pm-nav-bar 1s ease-in-out infinite;
}
@keyframes pm-nav-bar { from { background-position: -50% 0; } to { background-position: 150% 0; } }
@media (prefers-reduced-motion: reduce) { html.pm-nav-busy::before { animation: none; background: var(--accent); } }
main.content:focus { outline: none; }
