/* FuelPro app — palette carried over from the original FuelPro build */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-hover: #f0f4f8;
  --border: #d1d9e6;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --primary: #5b6f8c;
  --accent: #7b90ad;
  --dark: #3e5166;
  --light: #e8f1f8;
  --success: #16803c;
  --success-bg: #e7f6ec;
  --warning: #a16207;
  --warning-bg: #fef6db;
  --danger: #c62828;
  --danger-bg: #fdecec;
  --info: #2563eb;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 30, 50, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: Barlow, system-ui, sans-serif; font-size: 16px; line-height: 1.45; background: var(--bg); color: var(--text); min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--dark); }
h1, h2, h3 { line-height: 1.2; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.boot, .loading { padding: 48px; color: var(--text-muted); text-align: center; }

/* ---------- Login ---------- */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(135deg, var(--dark) 0%, var(--primary) 100%); }
.login-box { background: var(--surface); border-radius: 12px; padding: 36px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.login-header { display: flex; gap: 14px; align-items: center; margin-bottom: 22px; }
.logo-mark { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 22px;
  background: linear-gradient(135deg, var(--primary), var(--dark)); flex: none; }
.logo-mark.small { width: 34px; height: 34px; font-size: 18px; border-radius: 8px; }
.logo-word { font-weight: 700; font-size: 22px; color: var(--dark); letter-spacing: .2px; }
.login-subtitle { color: var(--text-muted); font-size: 14px; }
.login-btn { width: 100%; margin-top: 18px; padding: 14px 20px; border: 0; border-radius: 8px; color: #fff; font-weight: 600; font-size: 15px;
  text-transform: uppercase; letter-spacing: .5px; cursor: pointer; background: linear-gradient(135deg, var(--primary) 0%, var(--dark) 100%); }
.login-btn:disabled { opacity: .7; cursor: default; }
.login-error, .form-error { color: var(--danger); font-size: 14px; min-height: 1em; margin-top: 8px; }
.login-foot { margin: 18px 0 0; font-size: 12px; color: var(--text-muted); text-align: center; }

/* ---------- Fields ---------- */
.field { display: block; margin-top: 12px; }
.field-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.field-hint { display: block; font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; min-height: 42px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 14px; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 560px) { .form-grid .span-2 { grid-column: auto; } }
.form-section { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); margin: 22px 0 0; padding-top: 12px; border-top: 1px solid var(--border); }
.choice { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented.choice span { min-width: 0; padding: 8px 14px; }
.segmented.choice input:checked + span { background: var(--light); border-color: var(--primary); color: var(--dark); }
.mfr-control { display: grid; gap: 6px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.form-actions.split { justify-content: space-between; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-weight: 600; min-height: 40px; text-decoration: none; }
.btn:hover { background: var(--surface-hover); }
.btn.primary { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn.primary:hover { background: var(--primary); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 12px; min-height: 32px; font-size: 14px; }
.btn.big { padding: 12px 26px; font-size: 16px; }
.btn:disabled { opacity: .6; cursor: default; }
.icon-btn { border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--text-muted); padding: 4px 8px; }
.link { font-size: 14px; font-weight: 600; text-decoration: none; }

/* ---------- Shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 260px; flex: none; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; }
.sidebar-header { display: flex; align-items: center; gap: 10px; padding: 20px 20px 14px; }
.current-site { padding: 0 16px 14px; border-bottom: 1px solid var(--border); }
.current-site-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); margin-bottom: 4px; }
.sidebar-nav { padding: 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-btn { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; text-decoration: none; color: var(--text); font-weight: 500; }
.nav-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; color: var(--primary); }
.nav-btn:hover { background: var(--surface-hover); }
.nav-btn.active { background: var(--light); color: var(--dark); font-weight: 600; }
.nav-btn.active svg { color: var(--dark); }
.sidebar-footer { border-top: 1px solid var(--border); padding: 14px 16px; }
.user-info { display: flex; gap: 10px; align-items: center; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--light); color: var(--dark); display: grid; place-items: center; font-weight: 700; flex: none; }
.user-name { font-weight: 600; }
.user-role { font-size: 12.5px; color: var(--text-muted); text-transform: capitalize; }
.logout-btn { margin-top: 10px; width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: none; cursor: pointer; }
.logout-btn:hover { background: var(--surface-hover); }
.powered-by { margin-top: 8px; font-size: 12px; color: var(--text-muted); text-align: center; }
.main-wrap { flex: 1; min-width: 0; }
.topbar { display: none; }
.scrim { display: none; }
.main-content { padding: 28px 32px 60px; max-width: 1200px; outline: none; }

/* ---------- Page ---------- */
.page-header { margin-bottom: 22px; }
.page-header h1 { margin: 0 0 4px; font-size: 28px; color: var(--dark); }
.page-header p { margin: 0; color: var(--text-muted); }
.page-header.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.back { display: inline-block; margin-bottom: 12px; text-decoration: none; font-weight: 600; color: var(--primary); }
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 12px; gap: 12px; }
.section-head h2 { margin: 0; font-size: 18px; }
.notice { background: var(--light); border-radius: 8px; padding: 10px 14px; font-size: 14px; margin-bottom: 14px; color: var(--dark); }
.search { margin-bottom: 14px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; text-align: left; box-shadow: var(--shadow); }
.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:hover { border-color: var(--accent); }
.stat-card-value { font-size: 30px; font-weight: 700; color: var(--dark); }
.stat-card-value.danger { color: var(--danger); }
.stat-card-value.success { color: var(--success); }
.stat-card-label { color: var(--text-muted); font-size: 14px; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.card-title { margin: 0 0 8px; font-size: 18px; color: var(--dark); }
.asset-counts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.asset-count { display: flex; flex-direction: column; padding: 14px; border-radius: 8px; background: var(--bg); text-decoration: none; color: var(--text); }
.asset-count strong { font-size: 24px; color: var(--dark); }
.asset-count:hover { background: var(--light); }

.task-list { list-style: none; margin: 0; padding: 0; }
.task-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "t b" "m b"; gap: 2px 10px; padding: 10px 0;
  border-top: 1px solid var(--border); text-decoration: none; color: var(--text); }
.task-list li:first-child .task-row { border-top: 0; }
.task-title { grid-area: t; font-weight: 600; }
.task-meta { grid-area: m; font-size: 13px; color: var(--text-muted); }
.task-row .badge { grid-area: b; align-self: center; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 10px 14px; text-decoration: none; color: var(--text-muted); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab.active { color: var(--dark); border-bottom-color: var(--dark); }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); background: var(--bg); }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-hover); }
.table td.actions { white-space: nowrap; text-align: right; }
.table td.actions .btn + .btn { margin-left: 6px; }
.table.compact th, .table.compact td { padding: 7px 10px; font-size: 14px; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.badge.success { background: var(--success-bg); color: var(--success); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.neutral { background: var(--light); color: var(--dark); }
.badge.muted { background: #eef0f3; color: var(--text-muted); }

.empty { text-align: center; padding: 48px 20px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty h3 { margin: 0 0 6px; color: var(--dark); }
.empty p { margin: 0 0 14px; color: var(--text-muted); }
.error-box { padding: 24px; border-radius: var(--radius); background: var(--danger-bg); color: var(--danger); }
.alert { padding: 12px 14px; border-radius: 8px; margin: 12px 0; font-weight: 600; }
.alert.danger { background: var(--danger-bg); color: var(--danger); }

/* ---------- Checklist ---------- */
.task-desc { color: var(--text-muted); margin-top: -10px; }
.checklist { list-style: none; counter-reset: c; padding: 0; margin: 0; }
.check-item { counter-increment: c; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 16px 14px 52px;
  margin-bottom: 10px; position: relative; box-shadow: var(--shadow); }
.check-item::before { content: counter(c); position: absolute; left: 14px; top: 15px; width: 26px; height: 26px; border-radius: 50%; background: var(--light);
  color: var(--dark); font-weight: 700; font-size: 14px; display: grid; place-items: center; }
.check-item.critical { border-left: 4px solid var(--danger); }
.check-head { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 10px; }
.check-prompt { font-weight: 600; flex: 1 1 260px; }
.control { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.control select, .control > input { max-width: 360px; }
.segmented { gap: 8px; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: inline-block; padding: 8px 20px; border: 1px solid var(--border); border-radius: 8px; font-weight: 600; min-width: 80px; text-align: center; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }
.segmented input[value=pass]:checked + span { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.segmented input[value=fail]:checked + span { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.numeric { display: flex; align-items: center; gap: 8px; }
.numeric input { width: 160px; }
.unit { color: var(--text-muted); font-weight: 600; }
.na { font-size: 14px; color: var(--text-muted); cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.note { margin-top: 10px; font-size: 14px; min-height: 36px !important; }
.guidance { margin-top: 8px; font-size: 14px; }
.guidance summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.guidance p { margin: 6px 0 0; color: var(--text); }
.check-ref, .result-ref { margin-top: 6px; font-size: 12.5px; color: var(--text-muted); }
.template-info p { margin: 6px 0 0; }

.result-list { padding-left: 22px; margin: 0; }
.result { padding: 10px 0; border-bottom: 1px solid var(--border); }
.result:last-child { border-bottom: 0; }
.result-main { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.result-prompt { font-weight: 600; }
.result.fail .result-prompt { color: var(--danger); }
.result-value { margin-top: 2px; font-size: 18px; font-weight: 600; color: var(--dark); }
.result-note { font-size: 14px; font-style: italic; color: var(--text-muted); }

.summary-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.sum { background: var(--bg); border-radius: 8px; padding: 12px; text-align: center; }
.sum strong { display: block; font-size: 26px; }
.sum.success strong { color: var(--success); }
.sum.danger strong { color: var(--danger); }
.sum.muted strong { color: var(--text-muted); }
.fail-list { padding-left: 18px; }
.fail-list li { margin-bottom: 8px; }

/* ---------- Library ---------- */
.lib-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; padding: 0 16px; box-shadow: var(--shadow); }
.lib-item summary { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 0; cursor: pointer; list-style: none; }
.lib-item summary::-webkit-details-marker { display: none; }
.lib-item[open] { padding-bottom: 14px; }
.lib-name { font-weight: 700; color: var(--dark); flex: 1 1 240px; }
.lib-ref { font-size: 13px; color: var(--text-muted); }
.crit { color: var(--danger); font-size: 12px; font-weight: 600; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; font-weight: 500; text-transform: none; }

/* ---------- Modal / toast ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(20, 30, 45, .45); display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 12px; width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal.wide { max-width: 820px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 19px; color: var(--dark); }
.modal-body { padding: 8px 20px 20px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 30px); opacity: 0; transition: .25s; background: var(--dark); color: #fff;
  padding: 11px 18px; border-radius: 8px; z-index: 60; pointer-events: none; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* ---------- Phone ---------- */
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .2); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(20, 30, 45, .35); z-index: 35; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 30; }
  .menu-btn { border: 1px solid var(--border); background: none; border-radius: 8px; padding: 6px 10px; font-size: 18px; cursor: pointer; }
  .main-content { padding: 18px 16px 48px; }
  .page-header h1 { font-size: 24px; }
  .form-row { grid-template-columns: 1fr; }
  .summary-stats { grid-template-columns: repeat(2, 1fr); }
  .check-item { padding-left: 44px; }
  .check-item::before { left: 10px; }
  .kv { grid-template-columns: 1fr; }
  .kv dd { margin-bottom: 6px; }
}

/* ---------- Maintenance ---------- */
.badge.assumed { background: #fdecec; color: #9b2c2c; }
.maint-group { font-size: 15px; margin: 22px 0 6px; color: var(--dark); }
.maint-group.danger { color: var(--danger); }
.maint-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.maint-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); }
.maint-row:first-child { border-top: 0; }
.maint-title { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; font-weight: 600; font-size: 15px; color: var(--text); }
.maint-title:hover { color: var(--dark); text-decoration: underline; }
.maint-meta { color: var(--text-muted); font-size: 13.5px; margin-top: 2px; }
.maint-meta .overdue { color: var(--danger); font-weight: 600; }
.maint-side { display: flex; align-items: center; gap: 8px; flex: none; }
.tagchip { display: inline-block; font-weight: 600; font-size: 12.5px; padding: 1px 8px; border-radius: 6px; background: var(--light); color: var(--dark); }
.checklist-box { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: 12px 0 0; }
.check-line { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0; cursor: pointer; }
.check-line input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.checklist-plain { margin: 8px 0; padding-left: 20px; }
.checklist-plain li { margin: 3px 0; }
.detail-list { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 10px 0; }
.detail-list dt { color: var(--text-muted); }
.detail-list dd { margin: 0; }
.log-list { list-style: none; padding: 0; margin: 6px 0; }
.log-list li { padding: 6px 0; border-top: 1px solid var(--border); }
.section-head .tabs { margin-bottom: 0; }
@media (max-width: 600px) { .maint-row { flex-direction: column; align-items: flex-start; } }
.calc-out { padding: 10px 0; font-weight: 600; color: var(--dark); }

/* Code citations on recurring tasks (M010) */
.code-refs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.code-ref { font-size: 11px; line-height: 1.5; padding: 0 6px; border-radius: 4px; background: var(--surface-hover); color: var(--text-muted); border: 1px solid var(--border); }
.code-ref.clause { background: var(--light); color: var(--dark); border-color: var(--accent); font-weight: 600; }
.code-list { margin: 0; padding-left: 18px; }
.code-list li { margin: 2px 0; }
.page-note { margin: -8px 0 12px; }
.section-head:has(> .tabs) { flex-wrap: wrap; }
.section-head > .tabs { flex: 1 1 auto; min-width: 0; }
.section-head > .btn { flex: 0 0 auto; white-space: nowrap; }

/* Task levels + Task Manager (M011) */
.maint-title-line { display: flex; align-items: center; gap: 8px; }
.level-badge { display: inline-block; min-width: 26px; text-align: center; font-size: 11px; font-weight: 700; line-height: 18px; padding: 0 5px; border-radius: 4px; border: 1px solid transparent; flex: 0 0 auto; }
.level-badge.l1 { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.level-badge.l2 { background: var(--light); color: var(--dark); border-color: var(--accent); }
.level-badge.l3 { background: var(--surface-hover); color: var(--text-muted); border-color: var(--border); }
.level-badge.l4 { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
.tm-head { font-size: 16px; margin: 20px 0 10px; }
.level-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.level-card { display: flex; flex-direction: column; justify-content: flex-start; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; cursor: pointer; font: inherit; color: var(--text); opacity: .55; }
.level-card.included { opacity: 1; }
.level-card.active { border: 2px solid var(--dark); box-shadow: var(--shadow); }
.level-card:disabled { cursor: default; }
.level-card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.tm-groups { display: flex; flex-wrap: wrap; gap: 8px; }
.tm-list.dimmed, .maint-row.off { opacity: .55; }
.switch { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; cursor: pointer; flex: 0 0 auto; }
.switch input { width: 20px; height: 20px; }
.tm-list .maint-title { cursor: default; text-decoration: none; }
.level-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 14px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.level-filter-label { font-weight: 700; margin-right: 4px; }
.level-chip { display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--text-muted); cursor: pointer; opacity: .6; }
.level-chip.on { opacity: 1; color: var(--text); background: var(--surface); border-color: var(--dark); }
.level-chip:disabled { cursor: default; }
.level-filter-note { margin-left: auto; font-size: 13px; color: var(--text-muted); }

/* Email reminders (M012) */
.alert.warning { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }
.rem-form .card { margin-bottom: 14px; }
.rem-form .card h3 { margin: 0 0 10px; font-size: 16px; }
.switch.big { font-size: 16px; }
.day-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.day-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; }
.rem-users { list-style: none; margin: 0 0 10px; padding: 0; }
.rem-users li { padding: 2px 0; }
.rem-form .check-line { display: flex; align-items: center; gap: 8px; margin: 6px 0; flex-wrap: wrap; }
.mail-preview { width: 100%; height: 60vh; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.rem-form .check-line input[type=number] { width: 80px; height: auto; margin-top: 0; }
.test-to { width: 240px; margin: 0 6px; }

/* Readings on recurring tasks (M013) */
.badge.warning { background: var(--warning-bg); color: var(--warning); }
.reading { margin: 8px 0 12px; }
.reading-label { display: block; font-weight: 600; margin-bottom: 4px; }
.reading-input { display: flex; align-items: center; gap: 8px; max-width: 320px; }
.reading-input input, .reading-input select { flex: 1; }
.reading-results { list-style: none; padding: 0; margin: 6px 0; }
.reading-result { padding: 4px 0; }
.reading-result .action { color: var(--danger); font-weight: 600; }
.reading-result.alert .action { color: var(--warning); }

/* Records report */
.records-controls { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.records-presets, .records-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.records-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.records-filters .field { margin: 0; min-width: 150px; }
.records-head h2 { margin: 0 0 4px; font-size: 20px; }
.records-head p { margin: 0 0 12px; color: var(--text-muted); }
.records-summary { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.records-sum { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; min-width: 90px; }
.records-sum strong { display: block; font-size: 20px; }
.records-sum strong.danger { color: var(--danger); } .records-sum strong.warning { color: var(--warning); } .records-sum strong.success { color: var(--success); }
.records-sum span { font-size: 12px; color: var(--text-muted); }
.records-table td { vertical-align: top; }
.records-table .nowrap { white-space: nowrap; }
.records-table tr.row-fail td { background: var(--danger-bg); }
.records-table tr.row-alert td { background: var(--warning-bg); }
.records-sub { margin-top: 22px; }
.records-foot { margin-top: 18px; }
@media print {
  .sidebar, .topbar, .no-print, .toast, .menu-btn { display: none !important; }
  body, .main, main { background: #fff !important; }
  .app, .layout { display: block !important; }
  .main-wrap, .main-content { padding: 0 !important; margin: 0 !important; max-width: none !important; overflow: visible !important; }
  .scrim { display: none !important; }
  .table-wrap { overflow: visible !important; border: 0 !important; }
  .records-table { font-size: 10.5px; }
  .records-table th, .records-table td { padding: 4px 6px !important; }
  .records-table tr { page-break-inside: avoid; }
  .level-badge, .badge { border: 1px solid #999 !important; }
  @page { size: letter landscape; margin: 12mm; }
}

/* ---------- Field procedures ---------- */
.proc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.proc-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.proc-link { font-weight: 600; text-decoration: none; }
.proc-link:hover { text-decoration: underline; }
.proc-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.proc-code { color: var(--primary); }
.proc-head { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; margin: 0 0 14px; }
.proc-head dt { font-weight: 600; color: var(--text-muted); }
.proc-head dd { margin: 0; }
.proc-head dd .badge { margin: 0 6px 4px 0; }
.proc-general { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 14px; margin-bottom: 14px; }
.proc-general summary { cursor: pointer; font-weight: 600; }
.proc-body { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 18px 14px; max-width: 900px; }
.proc-body table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 15px; }
.proc-body th, .proc-body td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
.proc-body th { background: var(--light); }
.proc-body td p, .proc-body li p { margin: 2px 0; }
.proc-body table.proc-box td { border: 0; }
.proc-body table.proc-box { border: 1px solid var(--border); border-left: 4px solid var(--primary); background: var(--bg); }
.proc-body table.proc-box.safety { border-left-color: var(--danger); background: var(--danger-bg); }
.proc-body table.proc-box.record { border-left-color: var(--info); }
.proc-body ol, .proc-body ul { padding-left: 22px; }
.proc-body ol li { margin: 4px 0; }
.proc-refs { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.proc-ref { font-size: 13px; font-weight: 600; }
.maint-main .proc-refs { margin-top: 2px; }
@media (max-width: 600px) {
  .proc-head { grid-template-columns: 1fr; }
  .proc-body { padding: 4px 10px 10px; }
  .proc-body table { font-size: 14px; }
}
@page proc { size: letter portrait; margin: 14mm; }
@media print {
  .proc-print { page: proc; }
  .proc-body, .proc-head, .proc-general { border: 0 !important; padding: 0 !important; max-width: none; }
  .proc-general { display: none; }
  .proc-body table, .proc-body li { page-break-inside: avoid; }
  .proc-body table.proc-box.safety { background: #fff !important; }
}

/* ---------- Sign-up, plans and billing ---------- */
.login-box h2 { margin: 0 0 12px; font-size: 20px; }
.login-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; font-size: 14px; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.login-box .check-line { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; }
.plan-banner { background: var(--light); color: var(--dark); padding: 8px 20px; font-size: 14px; border-bottom: 1px solid var(--border); }
.plan-banner.warn { background: var(--warning-bg); color: var(--warning); }
.plan-banner a { font-weight: 600; }
.upgrade-box { max-width: 560px; margin: 40px auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; text-align: center; }
.upgrade-form .row { display: flex; gap: 12px; flex-wrap: wrap; }
.upgrade-form .row .field { flex: 1 1 140px; }
.form-actions.left { justify-content: flex-start; flex-wrap: wrap; gap: 8px; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Document library (v1.12) */
.doc-storage { display: flex; flex-direction: column; gap: 4px; min-width: 200px; }
.doc-meter { display: block; height: 6px; background: var(--light); border-radius: 3px; overflow: hidden; }
.doc-meter span { display: block; height: 100%; background: var(--primary); }
.doc-filters { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; }
.doc-filters select, .doc-filters input { min-width: 200px; flex: 1 1 220px; max-width: 360px; }
.doc-group { font-size: 16px; margin: 20px 0 10px; color: var(--dark); }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.doc-card { display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.doc-thumb { flex: 0 0 72px; width: 72px; height: 72px; border-radius: 6px; overflow: hidden; background: var(--light); display: flex; align-items: center; justify-content: center; text-decoration: none; }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-thumb.file span { font-weight: 700; font-size: 13px; color: var(--dark); }
.doc-info { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.doc-title { font-weight: 600; color: var(--dark); word-break: break-word; }
.doc-notes { white-space: pre-wrap; }
.doc-actions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.danger-text { color: var(--danger); }
.doc-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.doc-pick .btn { cursor: pointer; }
.doc-picked { list-style: none; padding: 0; margin: 8px 0; font-size: 14px; }
.doc-picked li { padding: 4px 8px; border-radius: 6px; background: linear-gradient(90deg, var(--light) var(--p, 0%), transparent var(--p, 0%)); }
.doc-picked li.done::after { content: " ✓"; color: var(--success); font-weight: 700; }
.doc-picked li.failed { background: var(--danger-bg); }
@media print { .doc-actions { display: none; } }

/* Service calls (v1.13) */
.sc-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.sc-row { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "n t b" "n m m"; gap: 2px 12px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: inherit; }
.sc-row:hover { background: var(--surface-hover); }
.sc-num { grid-area: n; font-weight: 700; color: var(--text-muted); font-size: 13px; padding-top: 2px; }
.sc-title { grid-area: t; font-weight: 600; color: var(--dark); }
.sc-badges { grid-area: b; white-space: nowrap; }
.sc-meta { grid-area: m; }
.sc-files { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.doc-thumb.big { flex: 0 0 120px; width: 120px; height: 120px; flex-direction: column; gap: 4px; }
.sc-log { list-style: none; padding: 0; margin: 0 0 10px; border-left: 2px solid var(--border); }
.sc-log li { padding: 6px 0 6px 14px; }
.sc-note { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 30px; }
.sc-note textarea { flex: 1; }
@media (max-width: 640px) { .sc-row { grid-template-columns: 1fr; grid-template-areas: "n" "t" "b" "m"; } }

/* Sectioned inspections (migration 021) */
.reading-section, .check-section { margin: 18px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--border); font-size: 1rem; }
.check-section { font-size: 1.05rem; }
.reading-seg { padding: 6px 0 10px; border-bottom: 1px dashed var(--border); }
.reading-seg .reading-input { max-width: none; }
.reading-seg .segmented { display: flex; flex-wrap: wrap; }
.reading-seg .segmented span { min-width: 64px; padding: 8px 16px; }
.segmented input:checked + span { background: var(--light); border-color: var(--primary); color: var(--dark); }
.segmented input[value=Yes]:checked + span { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.segmented label.bad input:checked + span { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.check-sections { counter-reset: c; }
.check-sections .checklist { counter-reset: none; }

/* Document viewer */
body.viewer-open { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; background: #3a4049; }
.viewer-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.viewer-title { flex: 1 1 200px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-zoom { display: inline-flex; gap: 4px; }
.viewer-stage { flex: 1; min-height: 0; overflow: auto; position: relative; -webkit-overflow-scrolling: touch; }
.viewer-pages { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px; min-width: min-content; }
.viewer-page { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); flex: none; }
.viewer-page canvas { display: block; }
.viewer-count { position: sticky; top: 0; z-index: 1; text-align: center; padding: 4px; color: #e5e7eb; background: rgba(58,64,73,.85); }
.viewer-msg { max-width: 520px; margin: 60px auto; padding: 24px; background: var(--surface); border-radius: var(--radius); text-align: center; }
.viewer-img { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 12px; }
.viewer-img img { max-width: 100%; max-height: calc(100vh - 80px); object-fit: contain; background: #fff; }
.viewer-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; display: block; }

/* Contractors (M022) */
.ctr-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.ctr-card.retired { opacity: .65; }
.ctr-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.ctr-badges { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.ctr-trades { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.ctr-contact { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0; }
.ctr-notes { white-space: pre-wrap; margin-top: 6px; }
.ctr-trade-boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 12px; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filter-row .search { flex: 1 1 240px; }
.sc-approve { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.sc-approve-btns { display: inline-flex; gap: 6px; }
.sc-dispatches { list-style: none; padding: 0; margin: 0 0 16px; }
.sc-dispatches li { padding: 10px 0; border-bottom: 1px solid var(--border); display: grid; gap: 3px; }
/* contractor read-only page */
.contractor-page { background: var(--bg, #f4f6f8); }
.ctr-view { max-width: 1000px; margin: 0 auto; padding: 16px; }
.ctr-view-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 0 16px; border-bottom: 2px solid var(--primary); margin-bottom: 16px; }
.ctr-brand { font-weight: 700; font-size: 22px; color: var(--dark); }
.ctr-view .card { margin-bottom: 16px; }
.ctr-docs { list-style: none; padding: 0; margin: 0 0 12px; }
.ctr-docs li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.ctr-view-foot { margin-top: 32px; padding-top: 12px; border-top: 1px solid var(--border); }

/* People, partners, account switcher (v1.19) */
.alert.info { background: var(--light); color: var(--dark); border: 1px solid var(--accent); font-weight: 500; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.people-table tr.retired { opacity: .6; }
.site-access-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 4px 0; flex-wrap: wrap; }
.site-access-row select { max-width: 200px; }
.account-switch { padding: 12px 16px 0; }
.account-switch select { width: 100%; }
.partner-banner { background: var(--light); color: var(--dark); border-bottom: 1px solid var(--accent); padding: 8px 16px; font-size: 14px; }
.partner-banner a, .partner-banner button { color: var(--dark); font-weight: 600; }
.handoff-steps { margin: 6px 0 12px 18px; padding: 0; }
.handoff-steps li { margin: 4px 0; }
.partner-banner button.link { background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; font: inherit; font-weight: 600; }

/* Help & Support (v26) */
.help-contact { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 16px; }
.help-card p { margin: 6px 0; }
.help-big { font-size: 20px; font-weight: 700; color: var(--primary); text-decoration: none; word-break: break-all; }
.help-big:hover { text-decoration: underline; }
.help-form { margin-bottom: 8px; }
.help-form textarea { width: 100%; }
.help-check { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; font-size: 14px; }
.help-section { margin: 28px 0 12px; font-size: 20px; color: var(--dark); }
.help-guides { display: grid; gap: 10px; }
.help-guide { padding: 0; }
.help-guide summary { cursor: pointer; padding: 14px 20px; font-weight: 600; color: var(--dark); }
.help-guide[open] summary { border-bottom: 1px solid var(--border); }
.help-guide ul { margin: 0; padding: 14px 20px 16px 40px; }
.help-guide li { margin: 6px 0; }
.help-about { margin-top: 8px; }
.powered-by a, .login-foot a { color: inherit; }

/* ---------- Inventory reconciliation (M029) ---------- */
.inv-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 14px; }
.inv-card h2 { margin: 0; font-size: 20px; }
.inv-card .small { margin-top: 4px; }
.inv-kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 12px 0; }
.inv-kv dt { color: var(--text-muted); }
.inv-kv dd { margin: 0; }
.warn-text { color: var(--warning); }
.inv-var { display: inline-block; padding: 2px 8px; border-radius: 999px; font-weight: 600; font-size: 13px; background: var(--success-bg); color: var(--success); white-space: nowrap; }
.inv-var.short { background: var(--danger-bg); color: var(--danger); }
.inv-var.over { background: var(--warning-bg); color: var(--warning); }
.inv-form section.card { margin-bottom: 14px; }
.inv-form h3 { margin: 0 0 10px; }
.inv-tank { border-top: 1px solid var(--border); padding: 12px 0; }
.inv-tank:first-of-type { border-top: 0; padding-top: 0; }
.inv-tank h4 { margin: 0 0 8px; }
.inv-tank .segmented { display: flex; flex-wrap: wrap; margin-bottom: 8px; }
.inv-conv { display: block; font-weight: 600; color: var(--dark); min-height: 1.2em; }
.inv-del { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; align-items: end; border-bottom: 1px dashed var(--border); padding-bottom: 8px; margin-bottom: 8px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inv-sum-table { width: 100%; max-width: 460px; border-collapse: collapse; }
.inv-sum-table td { padding: 5px 4px; border-bottom: 1px solid var(--border); }
.inv-sum-table tr.total td { font-weight: 700; }
.inv-sum-table td.num, .inv-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inv-chart-table td.num { text-align: right; }
.inv-chart-table { max-height: 50vh; overflow-y: auto; }
.inv-preview { margin: 6px 0; color: var(--text-muted); }
.inv-settings { margin-top: 18px; max-width: 760px; }
.inv-report-product { margin-bottom: 22px; }
@media print { .inv-report-product { page-break-inside: auto; } }
