/* ============================================================
   Liquid Rock SOP System — Shared Design System
   Self-contained. No external dependencies.
   Color families:  GENERAL = slate-blue   |   COSTCO = warm amber/red
   ============================================================ */

:root {
  /* Neutrals */
  --ink: #11181f;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --bg: #f6f8fb;
  --card: #ffffff;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.06);
  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 980px;

  /* Status palette (shared) */
  --st-todo: #64748b;
  --st-progress: #2563eb;
  --st-blocked: #dc2626;
  --st-done: #16a34a;

  /* Priority */
  --pri-low: #94a3b8;
  --pri-normal: #475569;
  --pri-high: #d97706;
  --pri-urgent: #dc2626;

  /* GENERAL family (default) — slate-blue */
  --accent: #2456a6;
  --accent-2: #3b82c4;
  --accent-soft: #eaf1fb;
  --accent-ink: #14365f;
  --band: linear-gradient(135deg, #1e3a5f 0%, #2456a6 60%, #3b82c4 100%);
}

/* COSTCO family — warm amber to red (evokes, does not copy, the brand) */
body.costco {
  --accent: #c0392b;
  --accent-2: #e07b2e;
  --accent-soft: #fdeee4;
  --accent-ink: #7a2218;
  --band: linear-gradient(135deg, #7a1f15 0%, #c0392b 55%, #e8902f 100%);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 10px 18px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .2px; color: var(--ink); text-decoration: none; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: var(--band); display: grid; place-items: center; color: #fff; font-size: 15px; font-weight: 900;
}
.brand small { display:block; font-weight:600; font-size:11px; color:var(--muted); letter-spacing:.06em; text-transform:uppercase; }
.topbar .spacer { flex: 1; }
.tag {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}

/* ---------- Hero / doc header band ---------- */
.hero {
  background: var(--band); color: #fff;
}
.hero-inner { max-width: var(--maxw); margin: 0 auto; padding: 30px 18px 26px; }
.crumbs { font-size: 12.5px; opacity: .9; margin-bottom: 10px; }
.crumbs a { color: #fff; text-decoration: none; border-bottom: 1px dotted rgba(255,255,255,.6); }
.hero h1 { margin: 0 0 6px; font-size: clamp(24px, 4.5vw, 38px); line-height: 1.12; letter-spacing: -.5px; }
.hero p.lede { margin: 0; font-size: 16px; max-width: 62ch; opacity: .95; }
.hero .meta { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.hero .meta .chip { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25); color:#fff; }

/* ---------- Layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 22px 18px 64px; }
.grid { display: grid; gap: 16px; }
@media (min-width: 720px){ .grid.cols-2 { grid-template-columns: 1fr 1fr; } .grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; } }

/* ---------- Document control table ---------- */
.docctl {
  width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  font-size: 13.5px; margin: 18px 0;
}
.docctl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.docctl tr:last-child td { border-bottom: 0; }
.docctl td:first-child { width: 150px; font-weight: 700; color: var(--muted); background: #fafbfd; text-transform: uppercase; font-size: 11px; letter-spacing: .05em; }

/* ---------- Cards / sections ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow); margin: 16px 0;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.section-num {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent-ink); font-weight: 800; font-size: 14px; margin-right: 8px;
}
h2 { font-size: 22px; letter-spacing: -.3px; margin: 28px 0 12px; display: flex; align-items: center; }
h3 { font-size: 17px; margin: 20px 0 8px; color: var(--accent-ink); }
h4 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 6px; }
p { margin: 10px 0; }
a { color: var(--accent); }
hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; line-height: 1.5; white-space: nowrap;
  border: 1px solid var(--line-2); background: #fff; color: var(--ink-2);
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.role { background:#eef2ff; color:#3730a3; border-color:#c7d2fe; }
.badge.owner { background:#f5f3ff; color:#6d28d9; border-color:#ddd6fe; }
.badge.manager { background:#ecfeff; color:#0e7490; border-color:#a5f3fc; }
.badge.employee { background:#f0fdf4; color:#15803d; border-color:#bbf7d0; }

.badge.type-repair { background:#fef2f2; color:#b91c1c; border-color:#fecaca; }
.badge.type-finishing { background:#fffbeb; color:#b45309; border-color:#fde68a; }
.badge.type-maintenance { background:#eff6ff; color:#1d4ed8; border-color:#bfdbfe; }
.badge.type-safety { background:#fef2f2; color:#991b1b; border-color:#fecaca; }
.badge.type-inspection { background:#f0fdfa; color:#0f766e; border-color:#99f6e4; }

.badge.st-todo { color: var(--st-todo); border-color:#cbd5e1; }
.badge.st-progress { color: var(--st-progress); border-color:#bfdbfe; background:#eff6ff;}
.badge.st-blocked { color: var(--st-blocked); border-color:#fecaca; background:#fef2f2;}
.badge.st-done { color: var(--st-done); border-color:#bbf7d0; background:#f0fdf4;}

.badge.pri-high { color: var(--pri-high); border-color:#fed7aa; background:#fff7ed;}
.badge.pri-urgent { color:#fff; background: var(--pri-urgent); border-color: var(--pri-urgent);}

/* ---------- Callouts ---------- */
.callout {
  border-left: 5px solid var(--accent); background: var(--accent-soft);
  border-radius: 10px; padding: 13px 16px; margin: 14px 0; font-size: 14.5px;
}
.callout .ctitle { font-weight: 800; display:flex; align-items:center; gap:8px; margin-bottom: 4px; }
.callout.warn { border-color:#d97706; background:#fff7ed; }
.callout.danger { border-color:#dc2626; background:#fef2f2; }
.callout.legal { border-color:#7c3aed; background:#f5f3ff; }
.callout.ok { border-color:#16a34a; background:#f0fdf4; }
.callout .ico { font-size: 17px; }

/* ---------- Step lists ---------- */
ol.steps { counter-reset: step; list-style: none; padding: 0; margin: 14px 0; }
ol.steps > li {
  position: relative; padding: 12px 14px 12px 52px; margin: 8px 0;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
}
ol.steps > li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 12px; top: 11px; width: 28px; height: 28px;
  background: var(--accent); color: #fff; border-radius: 8px;
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
}
ol.steps > li strong { color: var(--accent-ink); }

/* ---------- Checklists ---------- */
ul.check { list-style: none; padding: 0; margin: 12px 0; }
ul.check li { position: relative; padding: 7px 6px 7px 32px; border-bottom: 1px dashed var(--line); }
ul.check li::before {
  content: ""; position: absolute; left: 4px; top: 9px; width: 18px; height: 18px;
  border: 2px solid var(--line-2); border-radius: 5px; background:#fff;
}
ul.check li:last-child { border-bottom: 0; }

/* ---------- Tables ---------- */
table.data { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 14px; background:#fff;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.data th { text-align: left; background: var(--accent-soft); color: var(--accent-ink);
  font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:nth-child(even) td { background: #fafbfd; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }

/* ---------- TODO(confirm) inline marker ---------- */
.confirm {
  background: repeating-linear-gradient(45deg,#fff7ed,#fff7ed 8px,#ffedd5 8px,#ffedd5 16px);
  border: 1px dashed #f59e0b; color: #92400e; font-weight: 700; font-size: 12.5px;
  padding: 1px 7px; border-radius: 6px; white-space: nowrap;
}

/* ---------- Cross-nav cards ---------- */
.navgrid { display: grid; gap: 12px; grid-template-columns: 1fr; margin: 14px 0; }
@media (min-width: 640px){ .navgrid { grid-template-columns: 1fr 1fr; } }
.navcard {
  display: flex; gap: 12px; align-items: flex-start; text-decoration: none; color: var(--ink);
  background:#fff; border:1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.navcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent-2); }
.navcard .nico { font-size: 22px; flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); }
.navcard .ntitle { font-weight: 800; margin: 0 0 2px; }
.navcard .ndesc { font-size: 13px; color: var(--muted); margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  font-weight: 700; font-size: 14px; padding: 9px 16px; border-radius: 10px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff; text-decoration: none;
}
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: #fff; color: var(--accent); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; }

/* ---------- Footer ---------- */
.foot { max-width: var(--maxw); margin: 0 auto; padding: 22px 18px 50px; color: var(--muted); font-size: 12.5px; }
.foot a { color: var(--accent); }

/* ---------- Utilities ---------- */
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.mt0{margin-top:0}.mb0{margin-bottom:0}
.kbd { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; background:#0f172a; color:#e2e8f0; padding:1px 6px; border-radius:6px; font-size:12.5px; }

/* ---------- Print ---------- */
@media print {
  :root { --bg:#fff; }
  body { background:#fff; font-size: 11.5pt; }
  .topbar, .no-print, .btn { display: none !important; }
  .hero { background: #fff !important; color:#000 !important; border-bottom: 2px solid #000; }
  .hero .crumbs, .hero .meta { display:none; }
  .hero h1 { color:#000; }
  .card, table.data, .docctl { box-shadow: none; break-inside: avoid; }
  ol.steps > li, .callout, .navcard { break-inside: avoid; }
  a { color:#000; text-decoration: underline; }
  .band, .hero { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
