/* ==========================================================================
   Krewson Environmental Inspection — public site + admin console
   Accent colours are injected as CSS vars in <head> from config/site.js.
   ========================================================================== */

@import url("/css/fonts.css");

*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #ffffff;
  --bg-alt: #f5f7f7;
  --bg-deep: #0d1a1c;
  --line: #e2e8e8;
  --line-strong: #c9d5d5;
  --text: #16211f;
  --muted: #5f6f6d;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --accent-soft: #e6f2f0;
  --ok: #15803d;
  --warn: #b45309;
  --bad: #b91c1c;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(13,26,28,.05);
  --shadow: 0 1px 2px rgba(13,26,28,.05), 0 10px 30px -12px rgba(13,26,28,.16);
  --shadow-lg: 0 2px 4px rgba(13,26,28,.05), 0 24px 56px -20px rgba(13,26,28,.28);
  --wrap: 1160px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Space Grotesk", "Inter", ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-dark); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent); }

h1, h2, h3, h4 {
  font-family: var(--display);
  line-height: 1.12;
  letter-spacing: -0.022em;
  margin: 0 0 .5em;
  font-weight: 700;
}
h1 { font-size: clamp(2.15rem, 5.4vw, 3.6rem); }
h2 { font-size: clamp(1.65rem, 3.5vw, 2.5rem); }
h3 { font-size: 1.14rem; letter-spacing: -0.012em; }
p  { margin: 0 0 1em; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 24px; }
.wrap.narrow { max-width: 760px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.lede { font-size: 1.15rem; color: #3f3833; max-width: 62ch; }
.section-lede { color: var(--muted); max-width: 65ch; font-size: 1.05rem; }

.eyebrow {
  text-transform: uppercase; letter-spacing: .12em; font-size: .74rem;
  font-weight: 700; color: var(--accent); margin: 0 0 .6em;
}

.skip {
  position: absolute; left: -9999px; top: 0; background: #fff; padding: 12px 18px; z-index: 100;
}
.skip:focus { left: 12px; top: 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  padding: .6em 1.15em; border-radius: var(--radius); font-weight: 600;
  font-size: .95rem; text-decoration: none; cursor: pointer; font-family: inherit;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn-lg { padding: .8em 1.6em; font-size: 1.02rem; }
.btn-sm { padding: .4em .85em; font-size: .85rem; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--bg-alt); color: var(--text); border-color: var(--muted); }
.btn-danger { background: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: #991b1b; border-color: #991b1b; }

:where(a, button, input, select, textarea, summary, details):focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255,255,255,.88);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 74px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 38px; height: 38px; flex: none; border-radius: 10px; color: #fff;
  background: linear-gradient(145deg, var(--accent) 0%, var(--accent-dark) 100%);
  display: grid; place-items: center; box-shadow: 0 4px 14px -4px rgba(15,118,110,.55);
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-text strong { display: block; font-family: var(--display); font-size: 1.02rem; letter-spacing: -.02em; line-height: 1.2; }
.brand-text small { display: block; color: var(--muted); font-size: .76rem; letter-spacing: .01em; }

.site-nav { display: flex; align-items: center; gap: 6px; }
.site-nav a {
  color: var(--text); text-decoration: none; font-size: .93rem; font-weight: 500;
  padding: 8px 12px; border-radius: 8px; transition: background .15s ease, color .15s ease;
}
.site-nav a:hover { background: var(--accent-soft); color: var(--accent-dark); }
.site-nav a.current { color: var(--accent-dark); background: var(--accent-soft); }
.site-nav .nav-phone {
  display: inline-flex; align-items: center; gap: 7px; font-weight: 600;
  font-variant-numeric: tabular-nums; margin-left: 6px;
}
.site-nav .nav-phone svg { width: 15px; height: 15px; flex: none; }
.site-nav .btn { color: #fff; margin-left: 6px; }
.site-nav .btn:hover { background: var(--accent-dark); color: #fff; }

.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-burger {
  display: none; width: 44px; height: 44px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line-strong); place-items: center; gap: 5px; flex-direction: column;
}
.nav-burger span {
  display: block; width: 19px; height: 2px; border-radius: 2px; background: var(--text);
  transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle:focus-visible + .nav-burger { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: var(--bg-deep);
  background-image:
    radial-gradient(880px 460px at 84% -12%, rgba(15,118,110,.46), transparent 64%),
    radial-gradient(620px 380px at 8% 108%, rgba(15,118,110,.20), transparent 66%),
    linear-gradient(180deg, #122426 0%, #0d1a1c 100%);
  color: #eef4f3;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
/* Survey-grid texture — evokes mapping and measurement. */
.hero-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 70% 10%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at 70% 10%, #000 0%, transparent 72%);
}
.hero-inner { position: relative; padding: clamp(66px, 9.5vw, 122px) 24px clamp(56px, 7.5vw, 90px); }
.hero h1 { max-width: 19ch; color: #fff; }
.hero .lede { color: #bccbc9; max-width: 60ch; }
.hero .eyebrow {
  color: #6fd3c4; display: inline-flex; align-items: center; gap: 9px;
  padding: 6px 14px 6px 11px; border-radius: 30px;
  background: rgba(111,211,196,.10); border: 1px solid rgba(111,211,196,.24);
}
.hero .eyebrow::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: #6fd3c4; flex: none;
  box-shadow: 0 0 0 3px rgba(111,211,196,.22);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 34px 0 0; }
.hero .btn-ghost { color: #eef4f3; border-color: rgba(255,255,255,.26); background: rgba(255,255,255,.04); }
.hero .btn-ghost:hover { background: rgba(255,255,255,.11); color: #fff; border-color: rgba(255,255,255,.4); }
.hero-stats {
  display: flex; flex-wrap: wrap; gap: 46px; margin: 54px 0 0; padding: 30px 0 0;
  border-top: 1px solid rgba(255,255,255,.13);
}
.hero-stats dt { font-family: var(--display); font-size: 1.9rem; font-weight: 700; color: #fff; letter-spacing: -.025em; }
.hero-stats dd { margin: 3px 0 0; color: #94a7a4; font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; }

/* ---------- Sections ---------- */
.section { padding: clamp(56px, 7.5vw, 92px) 0; }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--line); }
.narrow-page { min-height: 52vh; }

.card-grid {
  display: grid; gap: 20px; margin-top: 40px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.card {
  position: relative; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.card h3 { margin-bottom: .4em; }
.card p { color: var(--muted); font-size: .95rem; }
.svc-icon {
  display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 18px;
  border-radius: 11px; background: var(--accent-soft); color: var(--accent-dark);
}
.svc-icon svg { width: 23px; height: 23px; }
.ticks { list-style: none; margin: 14px 0 0; padding: 0; font-size: .88rem; }
.ticks li { position: relative; padding-left: 22px; margin-bottom: 5px; color: var(--text); }
.ticks li::before {
  content: ""; position: absolute; left: 2px; top: .42em; width: 13px; height: 13px;
  border-radius: 50%; background: var(--accent-soft);
}
.ticks li::after {
  content: ""; position: absolute; left: 5px; top: .68em; width: 6px; height: 3px;
  border-left: 1.6px solid var(--accent-dark); border-bottom: 1.6px solid var(--accent-dark);
  transform: rotate(-45deg);
}

.steps { list-style: none; counter-reset: s; margin: 40px 0 0; padding: 0; display: grid; gap: 6px; }
.steps li { display: flex; gap: 22px; padding: 22px 0; border-top: 1px solid var(--line-strong); }
.steps li:last-child { border-bottom: 1px solid var(--line-strong); }
.step-num { font-family: var(--mono); font-size: 1.05rem; font-weight: 700; color: var(--accent); flex: none; width: 3ch; padding-top: 2px; }
.steps h3 { margin-bottom: .25em; }
.steps p { margin: 0; color: var(--muted); font-size: .96rem; max-width: 68ch; }

.split { display: grid; gap: 48px; grid-template-columns: 1fr 1fr; align-items: start; }
.diff-grid { display: grid; gap: 22px; grid-template-columns: 1fr 1fr; }
.diff h3 { font-size: 1rem; margin-bottom: .3em; }
.diff p { font-size: .92rem; color: var(--muted); margin: 0; }

.quote-grid { display: grid; gap: 20px; margin-top: 40px; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.quote { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.quote blockquote { margin: 0 0 16px; }
.quote blockquote p { margin: 0; font-size: 1rem; }
.quote blockquote p::before { content: "\201C"; }
.quote blockquote p::after { content: "\201D"; }
.quote figcaption strong { display: block; font-size: .9rem; }
.quote figcaption span { color: var(--muted); font-size: .83rem; }

.faq { margin-top: 32px; border-top: 1px solid var(--line-strong); }
.faq details { border-bottom: 1px solid var(--line-strong); }
.faq summary {
  cursor: pointer; padding: 18px 0; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 1.5rem; font-weight: 400; line-height: 1; }
.faq details[open] summary::after { content: "\2013"; }
.faq details p { margin: 0 0 18px; color: var(--muted); max-width: 72ch; }

/* ---------- Contact ---------- */
.contact-section { background: var(--bg-alt); border-top: 1px solid var(--line); }
.contact-split { grid-template-columns: 1fr 1.1fr; gap: 56px; }
.contact-list { list-style: none; margin: 28px 0 0; padding: 0; }
.contact-list li { display: flex; gap: 16px; padding: 11px 0; border-top: 1px solid var(--line-strong); font-size: .95rem; }
.contact-list span { width: 72px; flex: none; color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .07em; padding-top: 3px; }

.inquiry { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px; box-shadow: var(--shadow-lg); }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: .84rem; font-weight: 600; margin-bottom: 6px; }
.field b { color: var(--accent); }
.field-row { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; font: inherit; font-size: .95rem; color: var(--text);
  padding: .6em .75em; border: 1px solid var(--line-strong); border-radius: 8px;
  background: #fff; transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15,118,110,.15);
}
textarea { resize: vertical; min-height: 110px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.field-error {
  display: block; margin-top: 6px; font-size: .82rem; font-style: normal;
  font-weight: 500; color: var(--bad);
}
.field-hint { display: block; margin-top: 6px; font-size: .78rem; font-style: normal; color: var(--muted); }
.field.has-error > span { color: var(--bad); }
.field.has-error input, .field.has-error textarea, .field.has-error select {
  border-color: #f0a3a3; background: #fffafa;
}
.field.has-error input:focus, .field.has-error textarea:focus {
  border-color: var(--bad); box-shadow: 0 0 0 3px rgba(185,28,28,.12);
}
button[disabled] { opacity: .6; cursor: progress; }
.fineprint { font-size: .78rem; color: var(--muted); margin: 14px 0 0; text-align: center; }

.alert { border-radius: 8px; padding: 12px 16px; margin-bottom: 18px; font-size: .9rem; border: 1px solid; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-error { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.alert-ok { background: #f0fdf4; border-color: #86efac; color: #14532d; }

/* ---------- Footer ---------- */
.site-footer { background: var(--bg-deep); color: #b8b0a8; padding: 60px 0 24px; font-size: .92rem; }
.footer-grid { display: grid; gap: 36px; grid-template-columns: 1.4fr 1fr 1fr 1fr; }
.footer-name { color: #fff; font-size: 1.05rem; }
.site-footer h4 { color: #fff; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; margin-bottom: .9em; }
.site-footer a { color: #d6cfc8; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-list { list-style: none; margin: 0; padding: 0; }
.footer-list li { margin-bottom: 6px; }
.footer-bar {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  margin-top: 44px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.12);
  font-size: .82rem; color: #8b827a;
}

.prose h2 { font-size: 1.3rem; margin-top: 1.8em; }

/* ==========================================================================
   Admin console
   ========================================================================== */
.admin body, body.admin { background: var(--bg-alt); }

.login-page {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: var(--bg-deep);
  background-image:
    radial-gradient(760px 380px at 50% -6%, rgba(15,118,110,.42), transparent 64%),
    linear-gradient(180deg, #122426 0%, #0d1a1c 100%);
}
.login-card {
  background: #fff; border-radius: 18px; padding: 40px; width: 100%; max-width: 410px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.55);
}
.login-card h1 { font-size: 1.45rem; margin-bottom: .18em; }
.login-card .muted { font-size: .9rem; margin-bottom: 28px; }

.admin-shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.admin-side { background: var(--bg-deep); color: #b8b0a8; padding: 22px 0; display: flex; flex-direction: column; }
.admin-side .brand { padding: 0 20px 22px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 14px; }
.admin-side .brand-text strong { color: #fff; }
.admin-side .brand-text small { color: #8b827a; }
.admin-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; flex: 1; }
.admin-nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 14px; border-radius: 8px; color: #cfc7bf; text-decoration: none; font-size: .92rem; font-weight: 500;
}
.admin-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.admin-nav a.active { background: var(--accent); color: #fff; box-shadow: 0 4px 12px -4px rgba(15,118,110,.7); }
.admin-nav .pill { background: rgba(255,255,255,.16); color: #fff; border-radius: 20px; padding: 1px 8px; font-size: .74rem; font-weight: 700; }
.admin-nav a.active .pill { background: rgba(0,0,0,.22); }
.admin-side-foot { padding: 16px 20px 0; border-top: 1px solid rgba(255,255,255,.1); font-size: .82rem; }
.admin-side-foot a { color: #cfc7bf; }

.admin-main { padding: 30px 34px 70px; max-width: 1200px; }
.admin-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.admin-head h1 { font-family: var(--display); font-size: 1.7rem; margin: 0 0 .2em; letter-spacing: -.025em; }
.admin-head .muted { margin: 0; font-size: .92rem; }
.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 22px; overflow: hidden; }
.panel-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.panel-head h2 { font-size: 1.02rem; margin: 0; }
.panel-body { padding: 20px; }
.panel-body.tight { padding: 0; }

.stat-row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); margin-bottom: 24px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
  transition: box-shadow .18s ease;
}
.stat:hover { box-shadow: var(--shadow); }
.stat .label { font-size: .74rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 600; }
.stat .value {
  font-family: var(--display); font-size: 1.7rem; font-weight: 700;
  letter-spacing: -.03em; margin-top: 4px; font-variant-numeric: tabular-nums;
}
.stat .sub { font-size: .8rem; color: var(--muted); }
.stat.good .value { color: var(--ok); }
.stat.bad .value { color: var(--bad); }
.stat.warn .value { color: var(--warn); }

.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .91rem; }
table.data th, table.data td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data thead th {
  background: #f7faf9; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 700; white-space: nowrap; position: sticky; top: 0;
}
table.data tbody tr { transition: background .12s ease; }
table.data tbody tr:hover { background: var(--accent-soft); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .nowrap { white-space: nowrap; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty p { margin: 0 0 14px; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: .74rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
}
.badge-draft { background: #f1f0ee; color: #57534e; }
.badge-sent, .badge-contacted { background: #eff6ff; color: #1d4ed8; }
.badge-paid, .badge-won { background: #f0fdf4; color: #15803d; }
.badge-overdue, .badge-lost { background: #fef2f2; color: #b91c1c; }
.badge-void { background: #f1f0ee; color: #a8a29e; }
.badge-new { background: #fff7ed; color: #c2410c; }
.badge-quoted { background: #faf5ff; color: #7e22ce; }
.badge-active { background: #eff6ff; color: #1d4ed8; }
.badge-complete { background: #f0fdf4; color: #15803d; }
.badge-cancelled { background: #f1f0ee; color: #a8a29e; }
.badge-lead { background: #fff7ed; color: #c2410c; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar input[type=search], .toolbar select, .toolbar input[type=date] { width: auto; min-width: 150px; font-size: .88rem; padding: .45em .6em; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a {
  padding: 5px 12px; border-radius: 20px; font-size: .85rem; text-decoration: none;
  color: var(--muted); border: 1px solid var(--line-strong); background: #fff;
}
.tabs a { transition: background .15s ease, color .15s ease, border-color .15s ease; }
.tabs a:hover { border-color: var(--accent); color: var(--accent-dark); }
.tabs a.active { background: var(--accent-dark); color: #fff; border-color: var(--accent-dark); }
.tabs a.active:hover { color: #fff; }

.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.inline-form { display: inline; }
.actions-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.link-danger { color: var(--bad); font-size: .87rem; text-decoration: none; }
.link-danger:hover { text-decoration: underline; color: var(--bad); }

/* Invoice line-item editor */
table.items { width: 100%; border-collapse: collapse; }
table.items th { font-size: .73rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); text-align: left; padding: 0 8px 8px; font-weight: 700; }
table.items td { padding: 4px 8px 4px 0; vertical-align: top; }
table.items input { font-size: .9rem; padding: .45em .6em; }
table.items .col-qty { width: 90px; }
table.items .col-unit { width: 90px; }
table.items .col-price { width: 130px; }
table.items .col-line { width: 120px; text-align: right; font-variant-numeric: tabular-nums; padding-top: .75em; font-size: .92rem; }
table.items .col-del { width: 42px; }
.row-del {
  background: none; border: 1px solid var(--line-strong); color: var(--muted);
  border-radius: 6px; width: 30px; height: 34px; cursor: pointer; font-size: 1rem; line-height: 1;
}
.row-del:hover { border-color: var(--bad); color: var(--bad); }

.totals { margin-left: auto; width: min(340px, 100%); font-size: .94rem; }
.totals div { display: flex; justify-content: space-between; padding: 6px 0; }
.totals .grand { border-top: 2px solid var(--ink, #1c1917); margin-top: 6px; padding-top: 10px; font-weight: 700; font-size: 1.1rem; }
.totals .bal { color: var(--accent-dark); font-weight: 700; }
.totals span:last-child { font-variant-numeric: tabular-nums; }

/* Invoice preview / print */
.doc { background: #fff; padding: 48px; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.doc-head { display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; padding-bottom: 28px; border-bottom: 3px solid var(--accent); }
.doc-head h1 { font-size: 2rem; margin: 0; }
.doc-meta { text-align: right; font-size: .9rem; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin: 30px 0; font-size: .92rem; }
.doc-parties h4 { font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin-bottom: .6em; }
.doc table { width: 100%; border-collapse: collapse; font-size: .92rem; margin-top: 10px; }
.doc table th { text-align: left; border-bottom: 2px solid var(--ink, #1c1917); padding: 8px 10px; font-size: .73rem; text-transform: uppercase; letter-spacing: .07em; }
.doc table td { padding: 10px; border-bottom: 1px solid var(--line); }
.doc table .num { text-align: right; font-variant-numeric: tabular-nums; }
.doc-notes { margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line); font-size: .87rem; color: var(--muted); }

@media print {
  .site-header, .site-footer, .admin-side, .admin-head, .no-print { display: none !important; }
  .admin-shell { display: block; }
  .admin-main { padding: 0; max-width: none; }
  .doc { border: 0; box-shadow: none; padding: 0; }
  body { background: #fff; font-size: 12pt; }
}

/* ---------- Responsive ---------- */
@media (max-width: 940px) {
  .split, .contact-split, .footer-grid { grid-template-columns: 1fr; }
  .quote-grid { grid-template-columns: 1fr; }
  .diff-grid { grid-template-columns: 1fr 1fr; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { flex-direction: row; align-items: center; gap: 12px; padding: 12px 16px; overflow-x: auto; }
  .admin-side .brand { border: 0; padding: 0 16px 0 0; margin: 0; flex: none; }
  .admin-nav { flex-direction: row; padding: 0; flex: none; }
  .admin-nav a { white-space: nowrap; }
  .admin-side-foot { border: 0; padding: 0 0 0 12px; margin-left: auto; white-space: nowrap; }
  .admin-main { padding: 22px 18px 60px; }
}
@media (max-width: 860px) {
  body { font-size: 16px; }

  /* Collapse the header into a real slide-down menu. Previously the links
     were simply hidden on small screens, leaving no way to navigate. */
  .nav-burger { display: flex; }
  .site-nav {
    position: fixed; inset: 74px 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: #fff; border-bottom: 1px solid var(--line);
    padding: 14px 20px 22px;
    box-shadow: var(--shadow-lg);
    transform: translateY(-12px);
    opacity: 0; visibility: hidden;
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
    max-height: calc(100dvh - 74px); overflow-y: auto;
  }
  .nav-toggle:checked ~ .site-nav { opacity: 1; visibility: visible; transform: translateY(0); }
  .site-nav a { padding: 13px 14px; font-size: 1rem; border-radius: 10px; }
  .site-nav a + a { border-top: 1px solid var(--line); border-radius: 0; }
  .site-nav .nav-phone { margin: 8px 0 0; justify-content: flex-start; border-top: 0; }
  .site-nav .btn { margin: 12px 0 0; justify-content: center; padding: .85em 1.2em; }

  .nav-toggle:checked ~ .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle:checked ~ .nav-burger span:nth-child(2) { opacity: 0; }
  .nav-toggle:checked ~ .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .field-row { grid-template-columns: 1fr; }
  .diff-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 28px; }
  .doc { padding: 24px; }
  .doc-parties { grid-template-columns: 1fr; gap: 20px; }
  .inquiry { padding: 22px; }
  .steps li { gap: 16px; }
}
@media (max-width: 420px) {
  .brand-text small { display: none; }
  .wrap { padding-inline: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

/* ==========================================================================
   Site content editor
   ========================================================================== */
.content-tabs { margin-bottom: 22px; }
.content-tabs a { padding: 7px 14px; font-size: .88rem; }

.rep-row {
  display: grid; grid-template-columns: 1fr 1fr auto; gap: 14px; align-items: start;
  padding: 16px; margin-bottom: 12px;
  background: #fbfcfc; border: 1px solid var(--line); border-radius: 10px;
}
.rep-row.rep-stack { grid-template-columns: 1fr auto; }
.rep-row .field { margin-bottom: 0; }
.rep-row.rep-stack .field { grid-column: 1; }
.rep-row [data-del] { margin-top: 26px; }

.rep-card {
  position: relative; padding: 22px; margin-bottom: 14px;
  background: #fbfcfc; border: 1px solid var(--line); border-radius: 12px;
}
.rep-card:hover { border-color: var(--line-strong); }
.rep-card .field { margin-bottom: 0; }
.rep-card-del { position: absolute; top: 14px; right: 14px; }

.color-row { display: flex; align-items: center; gap: 12px; }
.color-row input[type=color] {
  width: 56px; height: 40px; padding: 3px; border: 1px solid var(--line-strong);
  border-radius: 8px; background: #fff; cursor: pointer;
}
.color-row output { font-family: var(--mono); font-size: .85rem; color: var(--muted); }

.reset-panel { background: transparent; border: 0; box-shadow: none; margin-top: 4px; }
.reset-panel .panel-body { padding: 4px 0 0; }

@media (max-width: 720px) {
  .rep-row, .rep-row.rep-stack { grid-template-columns: 1fr; }
  .rep-row [data-del] { margin-top: 0; justify-self: end; }
}

/* Uploaded logo replaces the built-in mark. */
.brand-logo { width: auto; max-width: 210px; object-fit: contain; display: block; }
.logo-preview {
  display: flex; align-items: center; gap: 20px; padding: 20px;
  border: 1px solid var(--line); border-radius: 10px; background: #fbfcfc; margin-bottom: 18px;
}
.logo-preview img { max-width: 240px; max-height: 90px; width: auto; object-fit: contain; }
.logo-preview .on-dark {
  background: var(--bg-deep); padding: 14px 18px; border-radius: 8px; display: grid; place-items: center;
}
