/*
 * Visual style translated from prototype-reference.html (colours, card
 * panels, general layout feel only — not its single-file structure).
 */

:root {
  --ink: #17191f;
  --ink-soft: #4c5360;
  --line: #dfe3e8;
  --panel: #ffffff;
  --page: #f3f5f7;
  --accent: #e90046;
  --accent-dark: #bd0038;
  --accent-soft: #fff0f5;
  --success: #147a4b;
  --success-soft: #e9f7f0;
  --warning: #a45a00;
  --warning-soft: #fff6df;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --info: #1b5f9b;
  --info-soft: #edf6ff;
  --radius: 16px;
  --shadow: 0 12px 30px rgba(20, 24, 32, .08);
  --focus: 0 0 0 4px rgba(233, 0, 70, .14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
  line-height: 1.45;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin-top: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Login */

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 12% 12%, rgba(233, 0, 70, .12), transparent 32%),
    radial-gradient(circle at 88% 80%, rgba(23, 25, 31, .12), transparent 30%),
    var(--page);
}

.login-card {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -.01em;
}

.login-card h1 {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  line-height: 1.05;
  margin: 28px 0 8px;
}

.login-card p { color: var(--ink-soft); }

.error-note {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid #f0cad6;
  background: var(--accent-soft);
  border-radius: 12px;
  color: #6f1732;
  font-size: .9rem;
}

/* Topbar */

.topbar {
  position: relative;
  z-index: 20;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1500px;
  margin: 0 auto;
  min-height: 72px;
  padding: 10px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.topbar-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 18px;
  text-decoration: none;
  color: inherit;
  border-radius: 12px;
  transition: opacity .15s ease;
}

.topbar-brand:hover { opacity: .82; }
.topbar-brand:focus-visible { outline: none; box-shadow: var(--focus); }

.app-title {
  padding-left: 18px;
  border-left: 1px solid var(--line);
  min-width: 0;
}

.app-title strong { display: block; font-size: 1rem; }
.app-title span { display: block; color: var(--ink-soft); font-size: .82rem; white-space: nowrap; }

.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: #fff;
  font-size: .88rem;
}

.user-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft);
}

/* Breadcrumbs */

.breadcrumbs {
  border-bottom: 1px solid var(--line);
  background: var(--page);
}

.breadcrumbs-inner {
  max-width: 1500px;
  margin: 0 auto;
  padding: 10px 22px;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink-soft);
  font-size: .84rem;
}

.breadcrumbs li { display: flex; align-items: center; gap: 6px; }
.breadcrumbs li:not(:last-child)::after { content: "/"; color: #c3c8d0; }

.breadcrumbs a { color: var(--ink-soft); text-decoration: none; }
.breadcrumbs a:hover { color: var(--ink); text-decoration: underline; }
.breadcrumbs span[aria-current="page"] { color: var(--ink); font-weight: 650; }

/* Layout */

.container {
  width: min(1500px, calc(100% - 36px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.hero-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.hero-row h1 {
  margin-bottom: 6px;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1.08;
  letter-spacing: -.035em;
}

.subtle { color: var(--ink-soft); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  color: var(--accent-dark);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .11em;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 9px 14px;
  font-weight: 750;
  text-decoration: none;
  transition: transform .15s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }

.btn-primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-secondary { color: var(--ink); background: #fff; border-color: var(--line); }
.btn-secondary:hover { border-color: #b8bec7; background: #fafafa; }
.btn-dark { color: #fff; background: var(--ink); border-color: var(--ink); }
.btn-dark:hover { background: #000; border-color: #000; }

/* A rendered-but-unavailable action (INTERFACES.md section EE's "Complete job"
   button while stages are outstanding) — shown rather than hidden, so the panel
   can explain what is missing, styled to match .tab-link.disabled's greyed,
   not-allowed reading. */
.btn[disabled], .btn[disabled]:hover { opacity: .55; cursor: not-allowed; transform: none; }

/* Forms */

.field { display: grid; gap: 7px; }

.field label {
  font-weight: 720;
  font-size: .86rem;
  color: #343943;
}

.required::after { content: " *"; color: var(--accent); }

.field-error { color: var(--danger); font-size: .8rem; }

.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  border: 1px solid #cfd4dc;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  min-height: 42px;
  outline: none;
  font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}

textarea { min-height: 96px; resize: vertical; }

input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--focus); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.span-2 { grid-column: span 2; }

/* Panel */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(20,24,32,.035);
  overflow: hidden;
  margin-bottom: 18px;
}

.panel-body { padding: 22px; }

.panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 22px;
  border-top: 1px solid var(--line);
}

.notice h3 { margin-bottom: 8px; }
.notice p { margin-bottom: 16px; }

/* Stats */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 8px 20px rgba(20,24,32,.035);
}

.stat-card span { display: block; color: var(--ink-soft); font-size: .84rem; }
.stat-card strong { display: block; margin-top: 5px; font-size: 1.9rem; line-height: 1; }

/* Stat cards as one-click status-filter shortcuts (dashboard, Task 25) */

.stat-card-filter {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  text-align: left;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.stat-card-filter:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #c8cdd4; }
.stat-card-filter:focus-visible { outline: none; box-shadow: var(--focus); }
.stat-card-filter.dash-stat-active { border-color: var(--accent); box-shadow: var(--focus); }

/* Jobs grid + empty state */

.jobs-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.empty-state {
  grid-column: 1 / -1;
  border: 1px dashed #bbc1c9;
  background: rgba(255,255,255,.65);
  border-radius: 20px;
  padding: 52px 24px;
  text-align: center;
}

.empty-state .empty-icon { font-size: 2.4rem; margin-bottom: 10px; }
.empty-state h3 { margin-bottom: 7px; }
.empty-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

.job-card {
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-height: 220px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 10px 28px rgba(20,24,32,.045);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.job-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: #c8cdd4;
}

.job-card-top, .job-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.job-card h3 { margin: 0; font-size: 1.15rem; line-height: 1.3; }
.job-ref { color: var(--ink-soft); font-size: .86rem; }

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-weight: 800;
  font-size: .72rem;
  letter-spacing: .02em;
  white-space: nowrap;
}

.chip-active { color: var(--info); background: var(--info-soft); }
.chip-complete { color: var(--success); background: var(--success-soft); }
.chip-overdue { color: var(--danger); background: var(--danger-soft); }
.chip-ready { color: var(--warning); background: var(--warning-soft); }
.chip-muted { color: var(--ink-soft); background: var(--page); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

.job-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  color: var(--ink-soft);
  font-size: .84rem;
}

.job-meta strong { display: block; color: var(--ink); font-size: .88rem; margin-top: 2px; }
.job-card-actions { margin-top: auto; }

/* Job pack tab bar */

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  margin-bottom: 18px;
  box-shadow: 0 8px 20px rgba(20,24,32,.035);
}

.tab-link {
  display: inline-flex;
  align-items: center;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 730;
  font-size: .92rem;
  text-decoration: none;
  color: var(--ink-soft);
}

.tab-link:hover { background: #f5f6f8; color: var(--ink); }
.tab-link.active { background: var(--accent-soft); color: var(--accent-dark); }
.tab-link.disabled { color: #b7bcc4; cursor: not-allowed; }

/* Commercial tab's internal sub-nav — a smaller, borderless tab-bar nested one level in */

.subtab-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.subtab-bar {
  margin-bottom: 0;
  padding: 4px;
  box-shadow: none;
  background: var(--page);
}

.subtab-bar .tab-link { padding: 8px 12px; font-size: .86rem; }

/* Read-only detail grid (job overview, KPI reference) */

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.info-item {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 13px;
  background: #fafbfc;
  font-size: .92rem;
}

.info-label {
  color: var(--ink-soft);
  font-size: .76rem;
  font-weight: 720;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* Checklists */

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.check-card {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px;
  background: #fff;
  transition: border-color .15s ease, background .15s ease;
}

.check-card:hover { border-color: #bfc5ce; }
.check-card:has(input:checked) { border-color: #9fd4bb; background: var(--success-soft); }
.check-card label { cursor: pointer; font-size: .9rem; }

/* Photos */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.photo-card {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 14px;
  min-width: 0;
}

.photo-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.photo-card h4 { margin: 0; }
.photo-card small { color: var(--ink-soft); }

.asset-empty {
  margin: 12px 0 0;
  padding: 12px;
  border: 1px dashed #cfd4dc;
  border-radius: 9px;
  color: var(--ink-soft);
  text-align: center;
  font-size: .8rem;
}

.photo-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }

.photo-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  display: grid;
  gap: 8px;
}

.photo-thumb-link { display: block; }
.photo-thumb { display: block; width: 100%; max-height: 160px; object-fit: cover; border-radius: 7px; }
.photo-download { font-size: .86rem; font-weight: 650; word-break: break-all; }

.photo-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.photo-item-foot form { margin: 0; }

.photo-upload-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
}

.photo-upload-form input[type="file"] {
  flex: 1;
  min-width: 0;
  min-height: auto;
  padding: 6px 0;
  border: none;
  font-size: .82rem;
}

/* Visit history */

.visit-list { display: grid; gap: 12px; }

.visit-card {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 14px 16px;
  background: #fafbfc;
}

.visit-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.visit-notes { margin: 10px 0 0; color: var(--ink-soft); font-size: .9rem; }

/* Callouts (variations tab warnings) */

.callout {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.callout strong { display: block; margin-bottom: 3px; }
.callout p { margin: 0; }
.callout-danger { border-color: #efb8c8; border-left-color: var(--accent); background: #fff7fa; }
.callout-warning { border-color: #efd58a; border-left-color: #df9f00; background: #fff9e8; }

/* Variations */

.btn-danger { color: var(--danger); background: #fff; border-color: #efc5c0; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-small { min-height: 34px; padding: 6px 10px; font-size: .84rem; border-radius: 9px; }

.variation-list { display: grid; gap: 14px; }

.variation-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: #fff;
}

.variation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.variation-ref { font-weight: 900; color: var(--accent-dark); }

.variation-grid {
  display: grid;
  grid-template-columns: 2fr 1fr .65fr 1fr;
  gap: 12px;
}

.variation-description { grid-column: span 2; }
.variation-approval { grid-column: span 2; }

.variation-summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 14px;
  color: var(--ink-soft);
}

.variation-summary strong { color: var(--ink); }

/* Initial works ticksheet */

.scope-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 18px;
}

.progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: .84rem;
  color: var(--ink-soft);
}

.progress-label strong { color: var(--ink); }

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: #eceff2;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .2s ease;
}

.scope-progress-copy { color: var(--ink-soft); font-size: .88rem; white-space: nowrap; }
.scope-progress-copy strong { color: var(--ink); font-size: 1.1rem; }

.scope-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
}

.scope-filter-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.scope-filter-field { display: grid; gap: 5px; }

.scope-filter-field label {
  font-weight: 720;
  font-size: .78rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.scope-filter-field select,
.scope-filter-field input { min-width: 190px; min-height: 38px; padding: 7px 10px; }

.scope-filter-result { margin: 10px 0; color: var(--ink-soft); font-size: .84rem; }

.scope-room-list { display: grid; gap: 18px; }

.scope-room-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.scope-room-head h3 { margin: 0; font-size: 1.05rem; }
.scope-room-head span { color: var(--ink-soft); font-size: .82rem; }

.scope-item-list { display: grid; gap: 12px; }

.scope-item-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: #fff;
  transition: border-color .15s ease, background .15s ease;
}

.scope-item-card:has(input[name="completed"]:checked) { border-color: #9fd4bb; background: var(--success-soft); }

/* Section CC — the pre-work review strip sits above the line's own form
   (HTML forbids nesting forms), reading as a separate act from ticking the
   works off, which is why it gets its own rule rather than sharing
   .scope-item-complete's tile styling. */
.scope-item-review {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}

.scope-item-review-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .78rem;
  font-weight: 750;
  color: var(--ink-soft);
  cursor: pointer;
}

.scope-item-review-toggle input { width: 17px; height: 17px; }
.scope-item-review small { font-size: .74rem; }

.scope-bulk-review {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.scope-bulk-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.scope-item-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.scope-item-complete {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 68px;
  font-size: .74rem;
  font-weight: 750;
  color: var(--ink-soft);
  cursor: pointer;
}

.scope-item-complete input { width: 20px; height: 20px; }

.scope-item-main { flex: 1; min-width: 0; }

.scope-item-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: .74rem;
  font-weight: 750;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.scope-item-kicker .chip { text-transform: none; letter-spacing: 0; }

.scope-item-desc { font-weight: 650; overflow-wrap: anywhere; }

.scope-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: .82rem;
}

.scope-item-meta strong { color: var(--ink); }

.scope-item-details { margin-top: 12px; }

.scope-item-details summary {
  cursor: pointer;
  font-weight: 720;
  font-size: .84rem;
  color: var(--info);
  list-style: none;
}

.scope-item-details summary::-webkit-details-marker { display: none; }
.scope-item-details summary::before { content: "+ "; }
.scope-item-details[open] summary::before { content: "− "; }

.scope-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.scope-detail-grid .span-3 { grid-column: span 3; }

.scope-filtered-out { display: none !important; }

.scope-signoff-lock {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #efd58a;
  border-left: 4px solid #df9f00;
  border-radius: 12px;
  background: #fff9e8;
}

.scope-signoff-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid #9fd4bb;
  border-radius: 12px;
  background: var(--success-soft);
  color: #0b4b30;
}

/* Quality check & handover */

.section-bar {
  margin: 0 0 14px;
  padding: 10px 14px;
  color: #fff;
  background: var(--ink);
  border-radius: 9px;
  font-size: .95rem;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.quality-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.quality-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.7fr) minmax(240px, .9fr) minmax(180px, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
}

.quality-row:last-child { border-bottom: 0; }
.quality-row:nth-child(even) { background: #fafbfc; }
.quality-label { font-weight: 680; }

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.segmented label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid #cfd4dc;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  font-size: .78rem;
  font-weight: 800;
}

.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }

/* Feedback widget */

.feedback-trigger {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 750;
  font-size: .86rem;
  box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease, background .15s ease, color .15s ease;
}

.feedback-trigger:hover { transform: translateY(-1px); border-color: #b8bec7; }
.feedback-trigger:focus-visible { outline: none; box-shadow: var(--focus); }
.feedback-trigger[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

body.feedback-picking { cursor: crosshair; }
body.feedback-picking .feedback-trigger { cursor: pointer; }

.feedback-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 110;
  padding: 10px 16px;
  text-align: center;
  background: var(--ink);
  color: #fff;
  font-size: .86rem;
  font-weight: 650;
}

.feedback-banner kbd {
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .16);
  font-family: inherit;
}

.feedback-popup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(23, 25, 31, .45);
}

.feedback-popup-backdrop[hidden] { display: none; }

.feedback-popup {
  width: min(420px, 100%);
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.feedback-popup h3 { margin: 0 0 6px; font-size: 1.05rem; }

.feedback-popup-target {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-size: .82rem;
  overflow-wrap: anywhere;
}

.feedback-popup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.feedback-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 130;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: .86rem;
  font-weight: 650;
  box-shadow: var(--shadow);
}

/* Admin feedback console (Task 11) */

/*
 * Layout-collision handling with .feedback-trigger above (flagged in
 * INTERFACES.md section E given Task 8's CSS bug in this same feature area):
 * whenever the console is present at all, the trigger is permanently
 * shifted up clear of the docked collapsed bar (not just while expanded),
 * and hidden outright while the panel is expanded, since the expanded panel
 * covers far more of the bottom of the viewport than the trigger has room
 * to float above. Plain class toggling + `display`, not the `hidden`
 * attribute, so there's no risk of repeating Task 8's
 * author-stylesheet-overrides-[hidden] mistake.
 */
body.has-feedback-admin-console .feedback-trigger { bottom: 76px; }
body.feedback-admin-expanded .feedback-trigger { display: none; }

.feedback-admin-console {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 105;
}

.feedback-admin-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  border: 0;
  border-top: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-weight: 750;
  font-size: .86rem;
  box-shadow: 0 -6px 16px rgba(20, 24, 32, .07);
}

.feedback-admin-toggle:hover { background: var(--page); }
.feedback-admin-toggle:focus-visible { outline: none; box-shadow: var(--focus); }

.feedback-admin-panel {
  max-height: min(54vh, 560px);
  overflow-y: auto;
  background: var(--panel);
  border-top: 1px solid var(--line);
  box-shadow: 0 -12px 30px rgba(20, 24, 32, .12);
}

.feedback-admin-panel[hidden] { display: none; }

.feedback-admin-panel-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.feedback-admin-panel-header h3 { margin: 0; font-size: 1rem; flex: 1; }
.feedback-admin-message { color: var(--danger); font-size: .8rem; }

.feedback-admin-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: .82rem;
}

.feedback-admin-filter-label { font-weight: 750; color: var(--ink-soft); }

.feedback-admin-filter-option {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.feedback-admin-list { padding: 4px 16px 16px; }

.feedback-admin-row {
  display: grid;
  gap: 5px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.feedback-admin-row:last-child { border-bottom: 0; }

.feedback-admin-row-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.feedback-admin-row-top a { color: var(--info); font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
.feedback-admin-row-top a:hover { text-decoration: underline; }

.feedback-admin-meta { color: var(--ink-soft); font-size: .78rem; }
.feedback-admin-comment { font-size: .88rem; overflow-wrap: anywhere; }

.feedback-admin-row-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.feedback-admin-row-controls select {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font-size: .8rem;
}

.feedback-admin-empty { color: var(--ink-soft); font-size: .88rem; padding: 10px 0; }

.chip-open { color: var(--warning); background: var(--warning-soft); }
.chip-resolved { color: var(--success); background: var(--success-soft); }
.chip-wontfix { color: var(--ink-soft); background: var(--page); }

/* Click-through-and-highlight (fetched/rendered by feedback-admin.js) */

.feedback-admin-highlight-target {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
  box-shadow: 0 0 0 6px var(--accent-soft);
}

.feedback-admin-highlight-popover {
  position: fixed;
  z-index: 125;
  width: min(320px, calc(100vw - 20px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.feedback-admin-highlight-popover p {
  margin: 0 0 10px;
  font-size: .88rem;
  overflow-wrap: anywhere;
}

.feedback-admin-highlight-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 125;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--ink);
  color: #fff;
  font-size: .86rem;
  font-weight: 600;
  text-align: center;
}

.feedback-admin-highlight-dismiss {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px 6px;
}

.rate-table-wrap { overflow-x: auto; }

.rate-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.rate-table th, .rate-table td { padding: 10px 12px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.rate-table th { color: var(--ink-soft); font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.rate-table td.rate-description { white-space: normal; min-width: 220px; }
.rate-table tbody tr:last-child td { border-bottom: 0; }

/* Dashboard job register table (INTERFACES.md section O, Task 25) */

.dashboard-table-wrap { overflow-x: auto; }

.dashboard-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.dashboard-table th, .dashboard-table td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.dashboard-table th { color: var(--ink-soft); font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; white-space: nowrap; }
.dashboard-table tbody tr:last-child td { border-bottom: 0; }
.dashboard-table tbody tr:hover { background: var(--page); }
.dashboard-table td, .dashboard-table th { min-width: 130px; }

.dash-cell-primary { min-width: 190px; }
.dash-address { font-weight: 750; color: var(--ink); text-decoration: none; }
.dash-address:hover { text-decoration: underline; }
.dash-subline { margin-top: 4px; font-size: .8rem; line-height: 1.3; }
.dash-subline.subtle { color: var(--ink-soft); }
.dash-scope { max-width: 220px; white-space: normal; color: var(--ink-soft); }

/* Notification hub (Task 24) — topbar bell + dropdown */

.notifications-widget { position: relative; }

.notifications-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-size: .86rem;
  font-weight: 750;
}

.notifications-toggle:hover { background: var(--page); }
.notifications-toggle:focus-visible { outline: none; box-shadow: var(--focus); }

.notifications-bell { font-size: 1rem; line-height: 1; }

.notifications-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
}

.notifications-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: min(380px, calc(100vw - 32px));
  max-height: min(60vh, 520px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.notifications-panel[hidden] { display: none; }

.notifications-panel-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
}

.notifications-panel-header h3 { margin: 0; font-size: 1rem; flex: 1; }

.notifications-list { padding: 4px 16px 16px; }

.notifications-row {
  display: block;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}

.notifications-row:last-child { border-bottom: 0; }
.notifications-row:hover .notifications-row-type { color: var(--accent-dark); }

.notifications-row-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.notifications-row-type { font-weight: 750; font-size: .86rem; }
.notifications-row-address { color: var(--ink-soft); font-size: .82rem; margin-top: 3px; }
.notifications-row-message { font-size: .84rem; margin-top: 3px; }

/* Notification hub — per-job banner (job_tabs.php) */

.job-reminder-banner { display: flex; flex-direction: column; gap: 8px; margin: 0 0 16px; }
.job-reminder-banner[hidden] { display: none; }

.job-reminder-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--warning);
  border-radius: 12px;
  background: var(--warning-soft);
  color: var(--warning);
}

.job-reminder-text { flex: 1; font-size: .88rem; font-weight: 650; }

.job-reminder-dismiss {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px 6px;
}

@media (max-width: 860px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .jobs-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .login-card { padding: 24px; }
  .info-grid, .check-grid, .photo-grid { grid-template-columns: 1fr; }
  .variation-grid { grid-template-columns: 1fr; }
  .variation-description, .variation-approval { grid-column: span 1; }
  .quality-row { grid-template-columns: 1fr; gap: 8px; }
  .scope-filter-field select, .scope-filter-field input { min-width: 0; width: 100%; }
  .scope-detail-grid { grid-template-columns: 1fr; }
  .scope-detail-grid .span-3 { grid-column: span 1; }
  .scope-item-top { flex-wrap: wrap; }
  .feedback-trigger { right: 14px; bottom: 14px; }
  body.has-feedback-admin-console .feedback-trigger { bottom: 66px; }
  .notifications-panel { right: -12px; width: calc(100vw - 24px); }
}

/* Signature capture (INTERFACES.md section Q) — shared canvas pad, embedded
   identically in job_quality/job_satisfaction/job_initial_works/job_cpp_rams/
   job_induction. */

.signature-current {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.signature-thumb {
  height: 48px;
  max-width: 160px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
}

.signature-pad {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.signature-pad-canvas {
  display: block;
  width: 100%;
  height: 160px;
  touch-action: none;
  cursor: crosshair;
  background:
    linear-gradient(transparent calc(100% - 1px), var(--line) 0) 0 100% / 100% 100% no-repeat;
}

.signature-pad-actions {
  display: flex;
  justify-content: flex-end;
  padding: 8px;
  border-top: 1px solid var(--line);
  background: var(--page);
}

/* Print/PDF export (job_print.php, INTERFACES.md section D, Task 27) */

.print-actions { display: flex; gap: 10px; margin-bottom: 18px; }

.print-status-line { font-weight: 700; white-space: nowrap; }

.print-section-title {
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--ink);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/*
 * Hides every piece of interactive/navigational chrome when the page is
 * actually printed (or "Print to PDF"'d) — not just on job_print.php, since
 * .topbar/.breadcrumbs/#job-reminder-banner/the feedback + notifications
 * widgets are rendered by layout.php on every authenticated page. A user
 * could in principle print any page in the app; this rule makes that sane
 * everywhere, not only on the dedicated print view.
 */
@media print {
  .topbar, .breadcrumbs, .tab-bar, #job-reminder-banner,
  #feedback-widget, #feedback-admin-console, #notifications-widget,
  .no-print {
    display: none !important;
  }

  body { background: #fff; }

  .container { width: 100%; padding: 0; margin: 0; }

  .panel {
    box-shadow: none;
    border: 1px solid #999;
    break-inside: avoid;
  }

  .info-item { background: #fff; border: 1px solid #ccc; }

  a { color: inherit; text-decoration: none; }

  @page { margin: 1.5cm; }
}

/* PDF schedule-import review — expandable scope-of-works table (INTERFACES.md
   section T). Reuses .dashboard-table / .dashboard-table-wrap; adds only the
   click-to-expand row behaviour and the drop-a-row (cleared description) hint. */

.import-scope-table td, .import-scope-table th { min-width: 0; }
.import-scope-table .scope-group-row th {
  background: var(--page);
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  font-size: .82rem;
  padding-top: 12px;
}
.import-scope-table .scope-row { cursor: pointer; }
.import-scope-table .scope-row:focus-visible { outline: 2px solid var(--info); outline-offset: -2px; }
.import-scope-table .scope-chevron { width: 26px; min-width: 26px; color: var(--ink-soft); }
.import-scope-table .scope-row .scope-chevron::before { content: "\25B8"; } /* right triangle */
.import-scope-table .scope-row.open .scope-chevron::before { content: "\25BE"; } /* down triangle */
.import-scope-table .scope-row.open > td { background: var(--page); }
.import-scope-table .scope-desc { white-space: normal; min-width: 220px; }
.import-scope-table .scope-row-dropped > td { opacity: .45; text-decoration: line-through; }
.import-scope-table .scope-edit-row > td { background: var(--page); padding: 6px 16px 16px; }
.import-scope-table .scope-edit-row .form-grid { margin: 0; }

/* Profit planner (INTERFACES.md section Z) — a wide, editable grid. Reuses
   .rate-table / .rate-table-wrap for the frame and adds only what a grid of
   inputs needs: compact in-cell controls, a sticky-left manager column so a
   row stays identifiable while scrolling twelve months sideways, and the
   negative-net highlight the forecast turns on. */

.pp-cell { width: 92px; text-align: right; padding: 6px 8px; font-size: .84rem; }
.pp-text { width: 140px; padding: 6px 8px; font-size: .84rem; }
.pp-select { width: 150px; padding: 6px 8px; font-size: .84rem; }
.pp-notes { width: 190px; min-height: 44px; padding: 6px 8px; font-size: .84rem; }

.pp-chip-row { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }

.pp-money { font-variant-numeric: tabular-nums; }
.pp-negative { color: var(--danger); font-weight: 750; }

.pp-button-row { display: flex; gap: 8px; align-items: center; }

.pp-summary th[scope="row"] { text-transform: none; letter-spacing: 0; font-size: .84rem; color: var(--ink); }
.pp-summary td { font-variant-numeric: tabular-nums; }

.pp-grid td, .pp-grid th { vertical-align: top; }
.pp-grid td.rate-description { max-width: 240px; }
.pp-grid tfoot th {
  border-top: 2px solid var(--line);
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  font-size: .84rem;
  font-variant-numeric: tabular-nums;
}

.pp-grid thead th:first-child,
.pp-grid tbody td:first-child,
.pp-grid tfoot th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--panel);
}

/* Permits & site start (INTERFACES.md section AA). The hot-work fire-watch
 * block is shown/hidden by permits.js via the `hidden` attribute, so it gets
 * the explicit `[hidden] { display: none; }` this stylesheet already applies
 * to every other toggled panel — see the note above .feedback-admin-panel
 * about author styles otherwise winning over the UA's own [hidden] rule. */
.hot-work-block { display: block; margin-top: 8px; }
.hot-work-block[hidden] { display: none; }
