/* office.css - B21: the office's screens across every job (office.js), the job's plan on its own pages (project.js), the
   schedule paste, History and the logo chip. Every color is a token from app.css (light, system dark and the dark
   switch), plus the logo chip's own below. Full width for data; on a phone the jobs table becomes one card per job and
   nothing scrolls sideways. */
:root { --logo-chip: #ffffff; --o-row-hover: var(--sunk); }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) { --logo-chip: #f4f4f1; } }
:root[data-theme=dark] { --logo-chip: #f4f4f1; }

/* the header's company logo, on a light chip so a dark or colored logo reads in both themes and on the brand band (C2-L5) */
.logo-box.has-logo, .logo-box.on-brand.has-logo { background: var(--logo-chip); border-radius: var(--r-sm); padding: 3px 7px; box-shadow: inset 0 0 0 1px var(--line); }
.logo-box.has-logo img { max-height: 26px; }

/* the frame: title, search every job, status report, new project */
.o-head .o-q { flex: 0 1 340px; min-width: 200px; }
.o-head .o-q input { padding-left: 36px; }
.o-h2 { font: 600 13px/1.2 var(--font-head); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); margin: 0 0 var(--s2); }

/* Needs you */
.o-needs { margin-bottom: var(--s5); }
.o-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: var(--s3); }
.o-tile { position: relative; display: grid; gap: 2px; padding: 12px 14px 12px 16px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--e1); color: var(--fg); text-decoration: none; overflow: hidden; }
.o-tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--faint); }
.o-tile.t-bad::before { background: var(--bad); }
.o-tile.t-warn::before { background: var(--warn); }
.o-tile.t-good::before { background: var(--good); }
.o-tile.t-info::before { background: var(--info); }
.o-tile:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.o-tile b { font: 700 28px/1 var(--font-head); font-variant-numeric: tabular-nums; }
.o-tile .o-tl { font-weight: 650; }
.o-tile small { color: var(--mute); font-size: var(--t-xs); }
.o-tile.zero b, .o-tile.zero .o-tl { color: var(--mute); }
.o-calm { margin: 0; padding: 14px 16px; border-radius: var(--r); background: var(--good-soft); color: var(--good-ink); font-weight: 600; }

/* filters over the jobs table */
.o-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s2) var(--s3); margin-bottom: var(--s3); }
.o-sel { display: grid; gap: 4px; font-size: var(--t-xs); font-weight: 600; color: var(--mute); }
.o-sel select { height: 38px; min-width: 150px; max-width: 240px; }
.o-n { margin-left: auto; align-self: center; }
.o-sortsel { display: none; }

/* the table of every job: full width, numbers lined up, every count a link */
.o-jobs-card { overflow-x: auto; }
table.o-jobs { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.o-jobs thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; text-align: left; vertical-align: bottom; padding: 10px 8px; border-bottom: 1px solid var(--line); font: 600 12.5px/1.15 var(--font-head); letter-spacing: .04em; text-transform: uppercase; color: var(--mute); white-space: nowrap; }
.o-jobs thead th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: flex-end; }
.o-jobs thead th button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.o-jobs thead th[aria-sort] { color: var(--fg); }
.o-jobs thead th span[aria-hidden] { font-size: 9px; }
.o-jobs tbody th, .o-jobs tbody td { padding: 10px 8px; border-top: 1px solid var(--line2); vertical-align: top; text-align: left; font-weight: 400; }
.o-jobs tbody tr:hover > * { background: var(--o-row-hover); }
.o-jobs .o-job { min-width: 240px; max-width: 380px; }
.o-jobs .o-job > a { font: 700 16.5px/1.2 var(--font-head); color: var(--fg); text-decoration: none; }
.o-jobs .o-job > a:hover { color: var(--accent); text-decoration: underline; }
.o-meta { display: block; font-size: var(--t-sm); color: var(--mute); margin-top: 2px; }
.o-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 8px; vertical-align: 1px; }
.o-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 5px; background: var(--sunk); color: var(--fg2); font: 600 12px/1 var(--font); white-space: nowrap; }
.o-tag.cx { background: var(--cx-soft); color: var(--cx); }
.o-jobs .o-num { text-align: center; min-width: 50px; padding-left: 4px; padding-right: 4px; }
.o-jobs thead .o-num { text-align: center; }
.o-jobs .o-num a { display: inline-grid; place-items: center; min-width: 36px; height: 30px; padding: 0 6px; border-radius: var(--r-xs); font-weight: 700; color: var(--accent); text-decoration: none; background: color-mix(in srgb, var(--accent) 9%, transparent); }
.o-jobs .o-num a:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.o-z { color: var(--faint); }
.o-done { min-width: 120px; }
.o-done > span:first-child { display: block; white-space: nowrap; }
.o-done .bar { margin-top: 6px; }
.o-target { white-space: nowrap; }
.o-target > .pill, .o-target > .o-late { display: flex; width: max-content; margin-top: 4px; }
.o-upd { color: var(--mute); white-space: nowrap; font-size: var(--t-sm); }
.o-none { padding: 24px 16px !important; color: var(--mute); text-align: center !important; }
.o-chips { display: inline-flex; flex-wrap: nowrap; gap: 3px; }
.o-av { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 14%, var(--panel)); color: var(--accent); font: 700 11.5px/1 var(--font); letter-spacing: .02em; flex: none; }
.o-av.more { background: var(--sunk); color: var(--mute); }
.o-late { color: var(--bad); font-weight: 650; }
.o-soon { color: var(--warn-ink); font-weight: 650; }
.o-ok { color: var(--good-ink); }

/* lists across jobs, and the plan line on a job's own rows */
.o-list-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s3); margin-bottom: var(--s3); }
.o-list-head h2 { margin-bottom: 2px; }
.o-list-head p { margin: 0; max-width: 72ch; }
.o-gname { font-weight: 700; color: var(--fg); text-decoration: none; }
.o-gname:hover { color: var(--accent); text-decoration: underline; }
.o-plan { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: var(--t-sm); color: var(--mute); }
.o-plan:empty { display: none; }
.o-plan > span { display: inline-flex; align-items: center; gap: 4px; }
.o-who svg { width: 14px; height: 14px; }
.o-why { font-size: var(--t-sm); color: var(--fg2); overflow-wrap: anywhere; }
.o-issue { font-weight: 600; color: var(--fg); overflow-wrap: anywhere; line-height: 1.35; }
.o-hit { font-size: var(--t-sm); color: var(--fg2); }
.o-hit mark { background: var(--warn-soft); color: var(--fg); border-radius: 3px; padding: 0 2px; }
.o-pills { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; flex: none; max-width: 50%; }
.o-mk { white-space: nowrap; }
.o-wrap { white-space: normal !important; overflow-wrap: anywhere; }
.seg a { display: inline-flex; align-items: center; color: var(--mute); font: 600 15px/1 var(--font-head); height: 34px; padding: 0 12px; border-radius: 7px; text-decoration: none; }
.seg a[aria-pressed=true] { background: var(--panel); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.14); }
.o-jobplan { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: center; padding: 10px var(--s4); border-top: 1px solid var(--line2); font-size: var(--t-sm); }
.o-jobplan > span { display: inline-flex; align-items: center; gap: 6px; }
.o-jobplan .btn.sm { height: 28px; padding: 0 8px; font-size: 14px; }
.o-gcrew { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; font: 500 13px/1 var(--font); color: var(--mute); }
.o-gcrew svg { width: 14px; height: 14px; }
.o-frow { align-items: center; }
.o-fchips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 100%; }
.o-fchips .chip .n { font-variant-numeric: tabular-nums; }
.o-cxnote { background: var(--cx-soft); color: var(--fg); font-weight: 600; }

/* assign: people as big tick boxes */
.o-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 8px; }
.o-person { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); cursor: pointer; font-weight: 600; }
.o-person:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); box-shadow: inset 0 0 0 1px var(--accent); }
.o-more > summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 6px 0; min-height: 32px; }
.o-more .o-people { margin-top: 8px; }

/* the schedule paste: a wider dialog, what each column is, each type's template, and a preview with locations */
dialog.o-wide { width: min(920px, calc(100vw - 32px)); }
.o-map, .o-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 8px; }
.o-types { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line2); }
.o-types > b { grid-column: 1 / -1; }
.o-mapcol > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o-mapcol small { font-weight: 400; }
.o-prev p { margin: 4px 0; }
.o-prevwrap { overflow-x: auto; border: 1px solid var(--line2); border-radius: var(--r-sm); margin: 6px 0; }
table.o-prevt { width: 100%; border-collapse: collapse; font-size: 13px; color: var(--fg); }
.o-prevt th, .o-prevt td { padding: 5px 8px; text-align: left; border-top: 1px solid var(--line2); white-space: nowrap; }
.o-prevt th { border-top: 0; background: var(--sunk); font-weight: 650; color: var(--fg2); }
.o-warn { display: block; color: var(--warn-ink); font-weight: 600; }
.o-where { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line2); }
.o-wheret td { padding: 4px 6px; min-width: 170px; }
.o-wheret th[scope], .o-wheret tbody th { white-space: nowrap; }
.o-wheret select.in { height: 36px; font-size: 13.5px; }
fieldset.o-contact { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.o-contact legend { font-size: 13.5px; font-weight: 600; color: var(--fg2); padding: 0; margin-bottom: 6px; }

/* History: every change, the rest behind a tap */
.o-hrow { align-items: flex-start !important; }
.o-changes { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; font-size: var(--t-sm); color: var(--fg2); overflow-wrap: anywhere; }
.o-from { color: var(--mute); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--mute) 50%, transparent); }

/* C2-R2-M2: between a phone and a wide screen the job column stays put while the counts scroll beside it */
.o-jobs thead .o-job, .o-jobs tbody .o-job { position: sticky; left: 0; z-index: 2; background: var(--panel); box-shadow: 1px 0 0 var(--line2); }
.o-jobs tbody tr:hover > .o-job { background: var(--o-row-hover); }
@media (max-width: 1100px) {
  /* C2-R2-L5: the search gets its own line, so the title and its count keep theirs */
  .o-head .o-q { order: 3; flex: 1 1 100%; min-width: 0; }
}
/* C2-R2-M2: below 1100 px each job is a card: every count it has shows, labelled, and wraps; none hides in a scroll */
@media (max-width: 1099px) {
  .o-jobs-card { overflow: visible; background: transparent; border: 0; box-shadow: none; }
  table.o-jobs, .o-jobs tbody { display: block; }
  .o-jobs thead { display: none; }
  .o-jobs tbody tr { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; padding: 12px 14px; margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--e1); }
  .o-jobs tbody tr:hover > * { background: transparent; }
  .o-jobs tbody th, .o-jobs tbody td { display: block; padding: 0; border: 0; }
  .o-jobs .o-job, .o-jobs tbody .o-job { flex: 1 1 100%; min-width: 0; max-width: none; position: static; box-shadow: none; background: transparent; }
  .o-jobs .o-done { flex: 1 1 100%; display: flex; align-items: center; gap: 10px; }
  .o-jobs .o-done .bar { flex: 1; margin: 0; }
  .o-jobs .o-num { min-width: 0; text-align: left; }
  .o-jobs .o-num.o-zero { display: none; }
  .o-jobs .o-num a { gap: 6px; height: 32px; padding: 0 10px; grid-auto-flow: column; }
  .o-jobs .o-num a::before { content: attr(data-l); }
  .o-jobs td[data-l]:not(.o-num):not(.o-done)::before { content: attr(data-l) ": "; color: var(--mute); font-size: var(--t-xs); }
  .o-jobs .o-upd { margin-left: auto; }
  .o-techs .o-num a::before { content: none; }
  .o-techs td.o-num::before { content: attr(data-l) " "; color: var(--mute); font-size: var(--t-xs); }
  .o-jobs tbody { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 10px; }
  .o-sortsel { display: grid; }
  .o-jobs .o-upd { display: block; }
}
/* phones: one card per job, the counts as labelled chips; zero counts drop out */
@media (max-width: 760px) {
  .o-head .o-q { order: 3; flex: 1 1 100%; min-width: 0; }
  .o-head > .btn { flex: 1 1 auto; }
  .o-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .o-tile { padding: 10px 12px 10px 14px; }
  .o-tile b { font-size: 24px; }
  .o-filters { gap: 8px; }
  .o-sel { flex: 1 1 calc(50% - 8px); }
  .o-sel select { min-width: 0; max-width: none; width: 100%; }
  .o-filters .seg { flex: 1 1 100%; }
  .o-filters .seg button { flex: 1; padding: 0 6px; }
  .o-n { margin-left: 0; }
  .o-pills { max-width: 100%; justify-content: flex-start; }
  .list > li:has(> .o-pills) { flex-wrap: wrap; }
  .list > li:has(> .o-pills) > .main { flex-basis: calc(100% - 40px); }
  .o-list-head .seg { flex: 1 1 100%; }
  .o-list-head .seg button, .o-list-head .seg a { flex: 1; justify-content: center; padding: 0 6px; }
  .o-fchips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter); }
  .o-fchips::-webkit-scrollbar { display: none; }
  .o-fchips .chip { flex: none; }
  .o-jobplan { padding: 10px var(--s3); gap: 6px 14px; }
  /* a report row with more than one tag (return visit, issues, status): the tags go under the name */
  .list > li:has(> .pill ~ .pill) { flex-wrap: wrap; row-gap: 6px; }
  .list > li:has(> .pill ~ .pill) > .main { flex-basis: calc(100% - 40px); }
  .list > li:has(> .cb):has(> .pill ~ .pill) > .pill:first-of-type { margin-left: 34px; }
  .group-h { flex-wrap: wrap; row-gap: 6px; }
  dialog.o-wide { width: 100%; }
}
