/* Packaged ESG Hub — team interface */
:root {
  --paper: #f3f4ef;
  --card: #ffffff;
  --ink: #16231e;
  --muted: #5a6a63;
  --faint: #8a978f;
  --line: #d6dcd4;
  --line-strong: #b9c3b9;
  --pine: #1d5a44;
  --pine-ink: #ffffff;
  --pine-soft: #e3eee8;
  --kraft: #a5733b;
  --kraft-soft: #f3e9db;
  --red: #b2361d;
  --red-soft: #f8e4de;
  --amber: #a86a12;
  --amber-soft: #f8edd7;
  --blue: #2c5d8a;
  --blue-soft: #e2ecf5;
  --radius: 6px;
  --shadow: 0 1px 0 rgba(22, 35, 30, .06);
  --s1: #1d5a44; --s2: #a5733b; --s3: #2c5d8a; --s4: #c99a2e; --s5: #6b8f7d; --s6: #8c3b2a; --s7: #4f7f94;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121815; --card: #19211d; --ink: #e7ece8; --muted: #a2b0a8; --faint: #7d8b83;
    --line: #2b3631; --line-strong: #3b4842; --pine: #5fb48f; --pine-ink: #0d1411; --pine-soft: #1f3129;
    --kraft: #d4a067; --kraft-soft: #33281b; --red: #ef7b62; --red-soft: #3a211b; --amber: #e3b25a;
    --amber-soft: #352914; --blue: #7fb0dc; --blue-soft: #1b2a37; color-scheme: dark;
    --s1: #5fb48f; --s2: #d4a067; --s3: #7fb0dc; --s4: #e3c25a; --s5: #9fbfae; --s6: #e08a72; --s7: #8fbccf;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.5 "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--pine); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 650; margin-top: 1.75rem; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .75rem; max-width: 72ch; }
small, .muted { color: var(--muted); }
.faint { color: var(--faint); }
:focus-visible { outline: 2px solid var(--pine); outline-offset: 2px; }

/* shell */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 22px 14px;
  border-right: 1px solid var(--line); background: var(--card);
}
.mark { display: inline-block; position: relative; font-weight: 800; letter-spacing: .14em; font-size: 15px; padding: 6px 9px; margin: 0 0 4px 8px; color: var(--ink); text-decoration: none; }
.mark::before, .mark::after { content: ""; position: absolute; width: 9px; height: 9px; border-color: var(--ink); border-style: solid; }
.mark::before { top: 0; left: 0; border-width: 2px 0 0 2px; }
.mark::after { bottom: 0; right: 0; border-width: 0 2px 2px 0; }
.rail .sub { margin: 0 0 18px 17px; font-size: 12px; color: var(--muted); }
.rail nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius); color: var(--ink); text-decoration: none; font-weight: 500;
}
.rail nav a:hover { background: var(--paper); }
.rail nav a.on { background: var(--pine-soft); color: var(--pine); font-weight: 650; }
.rail nav .grp { margin: 16px 10px 4px; font-size: 12px; color: var(--faint); }
.rail .count { font-size: 12px; background: var(--red); color: #fff; border-radius: 10px; padding: 0 7px; font-weight: 600; }
.rail .foot { margin-top: 24px; padding: 0 10px; font-size: 12px; color: var(--muted); }
main { padding: 28px 36px 80px; max-width: 1240px; width: 100%; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.topbar p { margin: 0; color: var(--muted); }
.btn.menu-btn { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; z-index: 30; inset: 0 30% 0 0; transform: translateX(-102%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .rail.open { transform: none; }
  main { padding: 16px 16px 80px; }
  .btn.menu-btn { display: inline-flex; position: sticky; top: 8px; z-index: 20; margin: 8px 16px 0; }
}
@media (prefers-reduced-motion: reduce) { .rail { transition: none; } }

/* blocks */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.panel h2:first-child, .panel h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 960px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack > * + * { margin-top: 10px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* figures: a strip of tallies, not cards */
.tally { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.tally a, .tally div { padding: 14px 16px; border-right: 1px solid var(--line); text-decoration: none; color: inherit; }
.tally > :last-child { border-right: 0; }
.tally b { display: block; font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.tally span { font-size: 13px; color: var(--muted); }
.tally .warn b { color: var(--red); }
.tally a:hover { background: var(--paper); }
@media (max-width: 960px) { .tally { grid-template-columns: repeat(3, 1fr); } .tally > :nth-child(3) { border-right: 0; } .tally > :nth-child(-n+3) { border-bottom: 1px solid var(--line); } }

/* buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px;
  padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--line-strong);
  background: var(--card); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--pine); border-color: var(--pine); color: var(--pine-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--red); }
.btn.small { min-height: 30px; padding: 3px 10px; font-size: 13px; }
.btn.link { border: 0; background: none; color: var(--pine); padding: 0; min-height: 0; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
label.inline { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; font-size: 14px; margin: 0 14px 6px 0; }
input[type=text], input[type=number], input[type=email], input[type=tel], input[type=date], input[type=month], input[type=password], input[type=search], input[type=url], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 8px 10px; min-height: 38px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--pine); outline-offset: 0; border-color: var(--pine); }
.field { margin-bottom: 12px; }
.help { font-size: 13px; color: var(--muted); margin-top: 3px; }
.err { background: var(--red-soft); color: var(--red); padding: 10px 12px; border-radius: var(--radius); margin-bottom: 12px; }
.ok { background: var(--pine-soft); color: var(--pine); padding: 10px 12px; border-radius: var(--radius); margin-bottom: 12px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 12px; }
legend { font-size: 13px; font-weight: 600; padding: 0 6px; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line-strong); }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; white-space: nowrap; }
.tablewrap { overflow-x: auto; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--paper); }

/* the signature element: inspection stamps */
.stamp {
  display: inline-block; white-space: nowrap; font-size: 12px; font-weight: 700; line-height: 1;
  padding: 5px 8px 4px; border: 1.5px solid currentColor; border-radius: 3px;
  transform: rotate(-1.5deg); letter-spacing: .02em;
}
.st-ok, .st-na, .st-current, .st-not_required { color: var(--pine); }
.st-expiring, .st-planned, .st-verify { color: var(--amber); }
.st-expired, .st-missing, .st-rejected, .st-overdue, .st-needed { color: var(--red); }
.st-review, .st-help { color: var(--blue); }
.st-na { opacity: .7; }
.st-missing { border-style: dashed; }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pri-critical { color: var(--red); border-color: currentColor; background: transparent; }
.pri-high { color: var(--amber); border-color: currentColor; background: transparent; }
.risk-high { color: var(--red); } .risk-elevated { color: var(--amber); } .risk-low { color: var(--pine); }

/* progress meter */
.meter { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; min-width: 80px; }
.meter i { display: block; height: 100%; background: var(--pine); }

/* carbon stage strip */
.strip { display: flex; height: 26px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); background: var(--paper); }
.strip i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 13px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; background: var(--c); vertical-align: -1px; }
.big-number { font-size: 2.6rem; font-weight: 750; line-height: 1; letter-spacing: -.02em; }
.unit { font-size: .95rem; font-weight: 500; color: var(--muted); margin-left: 4px; }

/* action list */
.actions { list-style: none; margin: 0; padding: 0; }
.actions li { display: grid; grid-template-columns: 120px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.actions li:last-child { border-bottom: 0; }
@media (max-width: 620px) { .actions li { grid-template-columns: 1fr; gap: 4px; } }

/* requirement rows on the vendor page */
.req { border-top: 1px solid var(--line); padding: 14px 0; }
.req:first-child { border-top: 0; }
.req-head { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start; }
.req details { margin-top: 8px; }
.req summary { cursor: pointer; color: var(--pine); font-size: 13px; font-weight: 600; }
.files a { display: inline-block; margin: 4px 8px 0 0; font-size: 13px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.datatable { font-size: 13px; }
.datatable td, .datatable th { padding: 5px 8px; }

.copybox { white-space: pre-wrap; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; font-size: 13.5px; max-height: 260px; overflow: auto; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected=true] { color: var(--pine); border-bottom-color: var(--pine); }

/* calculator */
.calc { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .calc { grid-template-columns: 1fr; } }
.result { position: sticky; top: 16px; }
.lines .line { display: grid; gap: 8px; align-items: end; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.lines .bomline { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.3fr) minmax(0, .7fr) minmax(0, .7fr) minmax(0, 1fr) 34px; }
.lines .printline { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) 34px; }
.lines .legline { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, .8fr) minmax(0, .8fr) 34px; }
@media (max-width: 760px) {
  .lines .bomline, .lines .legline { grid-template-columns: 1fr 1fr; }
  .lines .printline { grid-template-columns: 1fr 1fr; }
}
.lines label { font-weight: 500; color: var(--muted); font-size: 12px; }
.x { width: 34px; height: 38px; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); cursor: pointer; color: var(--muted); font-size: 18px; }
.x:hover { color: var(--red); border-color: var(--red); }
.saved-flag { font-size: 12.5px; color: var(--muted); }
.rec { padding: 10px 0; border-bottom: 1px solid var(--line); }
.rec:last-child { border-bottom: 0; }
.rec b { display: block; }
.verdict { padding: 12px 14px; border-radius: var(--radius); border-left: 4px solid var(--pine); background: var(--pine-soft); }
.verdict.single { border-color: var(--amber); background: var(--amber-soft); }
.verdict.never { border-color: var(--red); background: var(--red-soft); }

.notice { border: 1px solid var(--line); border-left: 4px solid var(--kraft); background: var(--kraft-soft); padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 14px; }

/* print */
@media print {
  .rail, .menu-btn, .noprint { display: none !important; }
  .shell { display: block; }
  main { padding: 0; max-width: none; }
  body { background: #fff; font-size: 11pt; }
  .panel { border: 0; box-shadow: none; padding: 0; }
  a { color: inherit; text-decoration: none; }
}
