/* LEVDesk — UK HSG258 & COSHH Reg 9 Engineering UI */
:root {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-alt: #f0f4f8;
  --border: #d9e2ec;
  --border-strong: #bcccdc;
  --ink: #0f172a;
  --ink-2: #334e68;
  --muted: #627d98;
  --brand: #0f4c5c;
  --brand-dark: #093542;
  --brand-soft: #e6f4f7;
  --accent: #e36414;
  --pass: #15803d;
  --pass-bg: #dcfce7;
  --obs: #b45309;
  --obs-bg: #fef3c7;
  --fail: #b91c1c;
  --fail-bg: #fee2e2;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.container { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 820px; margin: 0 auto; padding: 0 20px; }

/* Navigation */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  flex-wrap: wrap;
  padding: 8px 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.12rem;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: -0.03em;
}
.brand-tag {
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--brand-soft);
  color: var(--brand);
  padding: 2px 7px;
  border-radius: 99px;
  letter-spacing: 0.02em;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.nav-link {
  color: var(--ink-2);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 7px 11px;
  border-radius: 7px;
}
.nav-link:hover, .nav-link.active {
  background: var(--surface-alt);
  color: var(--brand);
  text-decoration: none;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #c5530d; color: #fff; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-alt); }
.btn-danger { background: var(--fail); color: #fff; }
.btn-danger:hover { background: #991b1b; }
.btn-sm { padding: 6px 11px; font-size: 0.82rem; border-radius: 6px; }
.btn-lg { padding: 13px 22px; font-size: 1rem; }

/* Cards & Grids */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  min-width: 0;
  max-width: 100%;
}
.card-tight { padding: 16px; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.card h2, .card h3 { margin: 0 0 8px; letter-spacing: -0.015em; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; min-width: 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.row-between > *, .grid-2 > *, .grid-3 > *, .grid-4 > * { min-width: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .grid-2, .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

/* Badges & Status Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 0.76rem;
  font-weight: 700;
  max-width: 100%;
  white-space: normal;
  line-height: 1.3;
}
.badge-pass { background: var(--pass-bg); color: var(--pass); }
.badge-obs, .badge-warn { background: var(--obs-bg); color: var(--obs); }
.badge-fail, .badge-danger { background: var(--fail-bg); color: var(--fail); }
.badge-neutral { background: var(--surface-alt); color: var(--ink-2); }
.badge-brand { background: var(--brand-soft); color: var(--brand); }

/* KPI Stat Cards */
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.kpi-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; }
.kpi-value { font-size: 1.85rem; font-weight: 800; margin: 4px 0 2px; line-height: 1.1; }
.kpi-sub { font-size: 0.8rem; color: var(--muted); }

/* Banners & Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid;
  font-size: 0.9rem;
  margin-bottom: 16px;
}
.alert-info { background: var(--brand-soft); border-color: #b8dde5; color: var(--brand-dark); }
.alert-pass { background: var(--pass-bg); border-color: #86efac; comax-width: 100%; lor: #14532d; }
.alert-warn { background: var(--obs-bg); border-color: #fcd34d; color: #78350f; }
.alert-fail { background: var(--fail-bg); border-color: #fca5a5; color: #7f1d1d; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--surface-alt); font-weight: 700; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafcfd; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 5px; }
label { font-size: 0.82rem; font-weight: 700; color: var(--ink-2); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="color"], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 76, 92, 0.14);
}
textarea { min-height: 78px; resize: vertical; }
.help { font-size: 0.78rem; color: var(--muted); }

/* Hero & Marketing Sections */
.hero {
  background: linear-gradient(155deg, #0b3947 0%, #0f4c5c 55%, #165e70 100%);
  color: #fff;
  padding: 64px 0 56px;
}
.hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.12;
  margin: 14px 0 16px;
  letter-spacing: -0.025em;
  max-width: 820px;
}
.hero p.lead {
  font-size: 1.12rem;
  color: #d9eef3;
  max-width: 700px;
  margin: 0 0 26px;
}
.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #e6f6fa;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 600;
}
.section { padding: 52px 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-title { font-size: 1.75rem; margin: 0 0 8px; letter-spacing: -0.02em; }
.section-sub { color: var(--muted); margin: 0 0 28px; max-width: 680px; }

/* Pricing */
.price-card { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 16px; }
.price-card.featured { border: 2px solid var(--brand); box-shadow: var(--shadow-lg); }
.price-amount { font-size: 2.3rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.price-list { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 8px; font-size: 0.88rem; color: var(--ink-2); }
.price-list li::before { content: '✓ '; color: var(--pass); font-weight: 800; }

/* Field TExT Inspection Builder */
.stage-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  margin-bottom: 18px;
}
.stage-head {
  background: var(--surface-alt);
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.stage-head h3 { margin: 0; font-size: 1rem; color: var(--brand-dark); }
.stage-body { padding: 18px; }
.hood-box {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdff;
  margin-bottom: 14px;
}
.calc-strip {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--surface-alt);
  border-radius: 7px;
  padding: 9px 12px;
  margin-top: 10px;
  font-size: 0.84rem;
}
.photo-thumb {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* Printable HSG258 A4 Report */
.report-sheet {
  max-width: 920px;
  margin: 24px auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 36px;
  box-shadow: var(--shadow-lg);
}
.report-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  border-bottom: 3px solid var(--brand);
  padding-bottom: 16px;
  margin-bottom: 20px;
}
.report-section { margin-top: 22px; break-inside: avoid; }
.report-section h3 {
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-dark);
  background: var(--brand-soft);
  padding: 6px 10px;
  border-left: 4px solid var(--brand);
  margin: 0 0 10px;
}
.outcome-banner {
  padding: 14px 18px;
  border-radius: 8px;
  border: 2px solid;
  margin: 14px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.outcome-banner.PASS { background: var(--pass-bg); border-color: var(--pass); color: #14532d; }
.outcome-banner.PASS_OBS { background: var(--obs-bg); border-color: var(--obs); color: #78350f; }
.outcome-banner.FAIL { background: var(--fail-bg); border-color: var(--fail); color: #7f1d1d; }

/* Printable HSE Asset QR Sticker */
.label-sheet {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: center;
  padding: 24px;
}
.lev-sticker {
  width: 390px;
  background: #fff;
  border: 3px solid #0f172a;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.lev-sticker-top {
  padding: 12px 16px;
  color: #fff;
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.lev-sticker-body {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr 122px;
  gap: 12px;
  align-items: center;
}
.lev-sticker-meta { font-size: 0.8rem; line-height: 1.45; }
.lev-sticker-foot {
  background: #f1f5f9;
  padding: 8px 16px;
  font-size: 0.72rem;
  color: #334155;
  border-top: 1px solid #cbd5e1;
  display: flex;
  justify-content: space-between;
}

.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 32px 0;
  margin-top: 48px;
  font-size: 0.85rem;
  color: var(--muted);
}

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff !important; font-size: 11px; }
  .no-print, .topbar, .footer { display: none !important; }
  .report-sheet {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    max-width: 100% !important;
  }
  .lev-sticker { box-shadow: none !important; break-inside: avoid; }
  table { font-size: 10.5px; }
  th, td { padding: 6px 8px; }
  .outcome-banner, .badge, .report-section h3, .lev-sticker-top {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
