/* Portal-specific additions on top of the Weidner design system.
   Anything reusable belongs in weidner.css, not here. */

/* ---- sign in ---- */
.signin {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--navy);
}
/* A class-level `display` beats the UA's [hidden]{display:none}, so the panel
   would stay on screen after sign-in. Restate it at matching specificity. */
.signin[hidden] { display: none; }
.signin-card {
  background: var(--surface); border-radius: 6px; padding: 34px 34px 26px;
  width: min(420px, 100%); border-top: 4px solid var(--red);
  box-shadow: 0 18px 48px rgba(0,0,0,0.35);
}
.signin-logo { height: 38px; width: auto; display: block; margin-bottom: 22px; }
.signin h1 {
  margin: 0 0 6px; font-size: 22px; font-weight: 700; color: var(--navy);
  letter-spacing: -0.01em;
}
.signin-sub { margin: 0 0 22px; font-size: 13px; color: var(--charcoal); line-height: 1.5; }
.signin label {
  display: block; font-size: 11px; font-weight: 700; color: var(--charcoal);
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px;
}
.signin input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 3px;
  font-family: inherit; font-size: 15px; color: var(--navy); background: #fff;
}
.signin input:focus { outline: 2px solid var(--red); outline-offset: -1px; border-color: var(--red); }
.signin-btn { width: 100%; justify-content: center; margin-top: 16px; padding: 12px; font-size: 13px; }
.signin-btn:disabled { opacity: 0.6; cursor: wait; }
.signin-msg {
  margin-top: 16px; padding: 11px 13px; border-radius: 3px; font-size: 13px;
  font-weight: 500; line-height: 1.45;
}
.signin-msg.ok  { background: var(--pos-bg); color: var(--pos); border-left: 3px solid var(--pos); }
.signin-msg.err { background: var(--neg-bg); color: var(--red-dk); border-left: 3px solid var(--red); }
.signin-foot {
  margin: 22px 0 0; padding-top: 16px; border-top: 1px solid var(--rule);
  font-size: 11.5px; color: var(--gray); line-height: 1.5;
}

/* ---- brand bar extras ---- */
.brandbar .whoami {
  font-size: 12px; color: rgba(255,255,255,0.75); font-weight: 500;
  padding-left: 12px; margin-left: 4px; border-left: 1px solid rgba(255,255,255,0.2);
}
.brandbar .signout {
  font-size: 11px; color: rgba(255,255,255,0.7); text-decoration: none;
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
  border: 1px solid rgba(255,255,255,0.2); border-radius: 3px; padding: 5px 10px;
}
.brandbar .signout:hover { background: rgba(255,255,255,0.1); color: #fff; }
@media (max-width: 720px) {
  .brandbar .whoami { display: none; }
}

/* ---- scroll containers ---- */
.table-scroll { max-height: 620px; overflow-y: auto; }
.table-scroll thead th { position: sticky; top: 0; z-index: 2; }
.list-scroll { max-height: 340px; overflow-y: auto; }
.table-more {
  padding: 12px; text-align: center; font-size: 12px; color: var(--gray);
  border-top: 1px solid var(--rule); font-weight: 500;
}

/* ---- empty states ----
   A customer looking at an empty section needs to know it is empty ON PURPOSE,
   not broken. Every one of these says what will fill it and when. */
.empty {
  text-align: center; padding: 42px 24px; color: var(--charcoal);
}
.empty .mark {
  width: 40px; height: 40px; border-radius: 50%; margin: 0 auto 14px;
  border: 2px dashed var(--border); display: flex; align-items: center;
  justify-content: center; color: var(--gray); font-size: 18px; font-weight: 700;
}
.empty h4 {
  margin: 0 0 6px; font-size: 14px; font-weight: 700; color: var(--navy);
  text-transform: none; letter-spacing: 0;
}
.empty p { margin: 0 auto; font-size: 13px; color: var(--charcoal); max-width: 460px; line-height: 1.55; }

/* ---- service job block ---- */
.job-block { margin-bottom: 12px; }
.job-head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px solid var(--rule);
}
.job-head h3 {
  margin: 0; padding: 0; border: none; font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--navy);
}
.job-head .when { font-size: 11px; color: var(--gray); font-weight: 500; }
.job-head .tally { margin-left: auto; font-size: 12px; color: var(--charcoal); font-weight: 600; }
.job-head .tally b { color: var(--navy); }
.job-split { display: grid; grid-template-columns: minmax(0,1fr) 260px; gap: 18px; }
@media (max-width: 860px) { .job-split { grid-template-columns: 1fr; } }

/* ---- misc ---- */
.photo-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.photo-strip img {
  width: 84px; height: 84px; object-fit: cover; border-radius: 4px;
  border: 1px solid var(--border); cursor: zoom-in; background: var(--bg);
}
.modal textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 3px;
  font-family: inherit; font-size: 14px; color: var(--navy); resize: vertical; line-height: 1.5;
}
.modal textarea:focus, .modal select:focus {
  outline: 2px solid var(--red); outline-offset: -1px; border-color: var(--red);
}
.modal-msg {
  margin-top: 14px; padding: 10px 12px; border-radius: 3px; font-size: 12.5px; font-weight: 600;
}
.modal-msg.ok  { background: var(--pos-bg); color: var(--pos); border-left: 3px solid var(--pos); }
.modal-msg.err { background: var(--neg-bg); color: var(--red-dk); border-left: 3px solid var(--red); }
.req-row {
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start;
  padding: 11px 0; border-bottom: 1px solid var(--rule);
}
.req-row:last-child { border-bottom: none; }
.req-row .subj { font-weight: 600; color: var(--navy); font-size: 13px; }
.req-row .body { font-size: 12.5px; color: var(--charcoal); margin-top: 3px; line-height: 1.5; }
.req-row .resp {
  font-size: 12.5px; color: var(--navy); margin-top: 7px; padding: 8px 10px;
  background: var(--tint); border-left: 3px solid var(--pos); line-height: 1.5;
}
.req-row .resp b { display: block; font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--charcoal); margin-bottom: 3px; }
.req-row .when { font-size: 11px; color: var(--gray); font-weight: 500; margin-top: 4px; }
.drawer-actions {
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--rule);
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}
.wo-mini {
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
  padding: 10px 12px; border-bottom: 1px solid var(--rule); font-size: 13px;
}
.wo-mini:last-child { border-bottom: none; }
.wo-mini .t { font-weight: 600; color: var(--navy); }
.wo-mini .s { font-size: 11px; color: var(--gray); margin-top: 2px; font-weight: 500; }

/* A work order whose asset has been removed from the base. Reads as a note,
   not as an asset tag, so nobody mistakes it for equipment they own. */
.asset-gone {
  font-weight: 400;
  font-style: italic;
  color: var(--gray);
}

/* ─────────────────────────── tabs ───────────────────────────
   Three top-level views. The nav sits directly under the brand bar and
   carries the red rule, so the page reads as one surface rather than a
   navigation chrome bolted on top. */
.tabs {
  display: flex;
  gap: 2px;
  margin: 0 0 4px;
  border-bottom: 2px solid var(--border);
}
.tabs .tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 13px 20px 11px;
  font: 700 13px/1 'Barlow', system-ui, sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--charcoal);
  cursor: pointer;
  transition: color .12s, border-color .12s;
}
.tabs .tab:hover { color: var(--navy); }
.tabs .tab[aria-selected="true"] {
  color: var(--navy);
  border-bottom-color: var(--red);
}
.tabs .tab:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }
.tab-count {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--gray-bg);
  color: var(--charcoal);
  font-size: 11px;
  letter-spacing: .02em;
}
.tabs .tab[aria-selected="true"] .tab-count { background: var(--neg-bg); color: var(--red); }

/* A section header can carry one control on the right (the job filter). */
.section-header .header-control { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.section-header .header-control label {
  font: 700 11px/1 'Barlow', system-ui, sans-serif;
  letter-spacing: .08em; text-transform: uppercase; color: var(--charcoal);
}

/* ── attention band ──
   Four states the customer may need to act on. Deliberately not stat tiles:
   these are conditions, so a zero reads as "nothing to do" and is styled
   calm rather than as a headline number. */
.attn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.attn {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gray);
  border-radius: 3px;
  padding: 15px 16px;
}
.attn.is-clear   { border-left-color: var(--pos); }
.attn.is-warn    { border-left-color: var(--warn); }
.attn.is-serious { border-left-color: var(--red); }
.attn .n { font: 700 26px/1 'Barlow', system-ui, sans-serif; color: var(--navy); }
.attn.is-clear .n   { color: var(--pos); }
.attn.is-warn .n    { color: var(--warn); }
.attn.is-serious .n { color: var(--red); }
.attn .lbl { font-weight: 700; font-size: 13px; color: var(--navy); }
.attn .sub { font-size: 12px; color: var(--charcoal); margin-top: 3px; line-height: 1.4; }
.attn.clickable { cursor: pointer; }
.attn.clickable:hover { background: var(--tint); }

/* ── recent job strip ── */
.jobstrip { display: flex; align-items: center; gap: 16px; padding: 14px 4px; border-bottom: 1px solid var(--rule); cursor: pointer; }
.jobstrip:last-child { border-bottom: 0; }
.jobstrip:hover { background: var(--tint-2); }
.jobstrip .js-name { font-weight: 700; color: var(--navy); flex: 1 1 auto; }
.jobstrip .js-when { font-size: 12px; color: var(--gray); white-space: nowrap; }
.jobstrip .js-count { font-size: 12px; color: var(--charcoal); white-space: nowrap; }
.jobstrip .js-rate { font: 700 17px/1 'Barlow', system-ui, sans-serif; width: 62px; text-align: right; }
.jobstrip .js-meter { width: 120px; }

/* A taller plot for the charts that carry many categories. */
.chart-wrap.tall { height: 340px; }

/* Job cards collapse: only the newest opens by default. */
.job-toggle {
  appearance: none; background: none; border: 0; cursor: pointer;
  color: var(--gray); font-size: 13px; line-height: 1;
  padding: 2px 6px 2px 0; transition: transform .12s, color .12s;
}
.job-toggle:hover { color: var(--navy); }
.job-toggle.is-open { transform: rotate(90deg); color: var(--navy); }
.job-head h3 { cursor: pointer; }

/* A class-level `display` beats the UA's [hidden]{display:none} — the same
   trap as .signin above. Without this the collapsed job tables stay on screen. */
.job-split[hidden] { display: none; }
.tabpanel[hidden] { display: none; }

/* Active job scope on the Work Orders tab. */
.scope-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--tint); border: 1px solid var(--border);
  border-left: 3px solid var(--red); border-radius: 3px;
  padding: 11px 14px; margin: 0 0 22px;
}
.scope-banner[hidden] { display: none; }
.scope-banner .ws-label {
  font: 700 10px/1 'Barlow', system-ui, sans-serif;
  letter-spacing: .09em; text-transform: uppercase; color: var(--charcoal);
}
.scope-banner b { color: var(--navy); font-size: 13px; }
.scope-banner .ws-count { font-size: 12px; color: var(--charcoal); }
.scope-banner .action-btn { margin-left: auto; }

/* ── Editing ─────────────────────────────────────────────────────────────
   Only Editors ever see any of this. The form deliberately looks like the
   record it is editing — same label column, same rhythm as .field-grid — so
   switching into edit mode reads as the same page, not a different app. */

.role-tag {
  display: inline-block; vertical-align: 1px;
  font: 700 9px/1 'Barlow', system-ui, sans-serif;
  letter-spacing: .1em; text-transform: uppercase;
  color: #fff; background: var(--red);
  padding: 3px 6px; border-radius: 2px;
}

.edit-form { margin-top: 4px; }

.edit-row {
  display: grid; grid-template-columns: 150px 1fr;
  gap: 10px 16px; align-items: start;
  padding: 9px 0; border-bottom: 1px solid var(--border);
}
.edit-label {
  font: 700 10px/1.5 'Barlow', system-ui, sans-serif;
  letter-spacing: .07em; text-transform: uppercase; color: var(--charcoal);
  padding-top: 8px;
}

.edit-input {
  width: 100%; box-sizing: border-box;
  font: 400 14px/1.4 'Barlow', system-ui, sans-serif; color: var(--navy);
  background: #fff; border: 1px solid var(--border); border-radius: 3px;
  padding: 8px 10px;
}
.edit-input:focus {
  outline: none; border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(193, 32, 39, .12);
}
textarea.edit-input { resize: vertical; }

.edit-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; padding-top: 7px; }
.edit-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--navy); }
.edit-toggle { margin-top: 10px; width: 16px; height: 16px; accent-color: var(--red); }

.edit-msg {
  margin: 14px 0 0; padding: 10px 12px; border-radius: 3px; font-size: 13px;
  border: 1px solid var(--border); background: var(--tint); color: var(--navy);
}
.edit-msg.ok  { border-color: #1F7A4D; color: #1F7A4D; background: rgba(31, 122, 77, .07); }
.edit-msg.err { border-color: var(--red); color: var(--red); background: rgba(193, 32, 39, .06); }
.edit-msg[hidden] { display: none; }

@media (max-width: 640px) {
  .edit-row { grid-template-columns: 1fr; }
  .edit-label { padding-top: 0; }
}

/* ── Job progress ────────────────────────────────────────────────────────
   A meter, not a chart: the question is one ratio, and a three-slice pie
   would be the same number pretending to be analysis. */

.progress-card { padding: 22px 24px 20px; }

.prog-top { display: flex; align-items: baseline; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }

.prog-figure { display: flex; align-items: baseline; gap: 8px; }
.prog-figure b {
  font: 700 48px/1 'Barlow', system-ui, sans-serif;
  color: var(--navy); letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.prog-figure b.is-pos { color: var(--pos); }
.prog-figure-lbl {
  font: 700 10px/1 'Barlow', system-ui, sans-serif;
  letter-spacing: .09em; text-transform: uppercase; color: var(--charcoal);
}

.prog-lines { flex: 1 1 240px; min-width: 0; }
.prog-count { font: 600 15px/1.3 'Barlow', system-ui, sans-serif; color: var(--navy); }
.prog-note { font-size: 12px; color: var(--charcoal); margin-top: 3px; }

/* Segments sit on the surface colour, so the 2px gap between them is a real
   separator rather than a border that would darken the fill. */
.meter {
  display: flex; gap: 2px; height: 22px; border-radius: 3px;
  background: var(--gray-bg); overflow: hidden;
}
.meter-seg {
  display: flex; align-items: center; justify-content: center;
  min-width: 2px; transition: width .3s ease;
}
.meter-seg:first-child { border-radius: 3px 0 0 3px; }
.meter-seg:last-child  { border-radius: 0 3px 3px 0; }
.meter-seg-n {
  font: 700 11px/1 'Barlow', system-ui, sans-serif;
  letter-spacing: .02em; font-variant-numeric: tabular-nums;
}
/* Ink per segment, set by the renderer — the pale steps need dark text. */
.meter-seg[data-ink="light"] .meter-seg-n { color: #fff; }
.meter-seg[data-ink="dark"]  .meter-seg-n { color: var(--navy); }

.meter-key { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; }
.meter-key .mk { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--charcoal); }
.meter-key .mk-dot { width: 10px; height: 10px; border-radius: 2px; flex: none; }

.stage-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border);
}
.stage-tile { min-width: 0; }
.st-n {
  font: 700 26px/1 'Barlow', system-ui, sans-serif;
  color: var(--navy); font-variant-numeric: tabular-nums;
}
.st-lbl {
  font: 700 10px/1.4 'Barlow', system-ui, sans-serif;
  letter-spacing: .08em; text-transform: uppercase; color: var(--charcoal); margin-top: 4px;
}
.st-bar { height: 3px; border-radius: 2px; margin-top: 7px; background: var(--gray); }
.st-bar.is-pos  { background: var(--pos); }
.st-bar.is-warn { background: var(--warn); }
.st-bar.is-gray { background: var(--gray); }
.st-share { font-size: 11px; color: var(--gray); margin-top: 5px; }

.progress-card.is-empty .meter,
.progress-card.is-empty .meter-key,
.progress-card.is-empty .stage-grid { display: none; }
.progress-card.is-empty .prog-figure b { color: var(--gray); }

@media (max-width: 640px) {
  .prog-figure b { font-size: 38px; }
  .stage-grid { grid-template-columns: repeat(2, 1fr); }
}
