:root {
  --brand: #00a99d;
  --brand-600: #008f85;
  --brand-50: #e6f7f5;
  --nav: #0d1b2e;
  --nav-2: #16273f;
  --nav-text: #a9b6c8;
  --bg: #f3f5f8;
  --card: #ffffff;
  --text: #17212f;
  --muted: #6b7686;
  --line: #e3e7ee;
  --input: #ffffff;
  --hover: #f5f7fa;
  --pass: #16a34a;
  --pass-bg: #e8f7ee;
  --fail: #dc2626;
  --fail-bg: #fdecec;
  --pend: #d97706;
  --pend-bg: #fdf3e2;
  --info: #2563eb;
  --info-bg: #e9f0fe;
  --crit: #9f1239;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #19c2b4; --brand-600: #12a89c; --brand-50: #0f2e2c;
    --nav: #0a1422; --nav-2: #13233a; --nav-text: #93a3b8;
    --bg: #0f1722; --card: #172231; --text: #e4e9f0; --muted: #93a0b2; --line: #263447;
    --input: #111b28; --hover: #1d2a3c;
    --pass: #34c06b; --pass-bg: #12301f; --fail: #f05252; --fail-bg: #3a1618;
    --pend: #f0a33a; --pend-bg: #3a2a12; --info: #5b8def; --info-bg: #182a4a; --crit: #f472b6;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #19c2b4; --brand-600: #12a89c; --brand-50: #0f2e2c;
  --nav: #0a1422; --nav-2: #13233a; --nav-text: #93a3b8;
  --bg: #0f1722; --card: #172231; --text: #e4e9f0; --muted: #93a0b2; --line: #263447;
  --input: #111b28; --hover: #1d2a3c;
  --pass: #34c06b; --pass-bg: #12301f; --fail: #f05252; --fail-bg: #3a1618;
  --pend: #f0a33a; --pend-bg: #3a2a12; --info: #5b8def; --info-bg: #182a4a; --crit: #f472b6;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

@font-face { font-family: 'KhmerOSBattambangWeb'; src: url('/static/KhmerOSbattambang.ttf') format('truetype'); font-display: swap; }
html[data-lang="km"] body, html[data-lang="km"] .report { font-family: 'KhmerOSBattambangWeb', "Segoe UI", system-ui, sans-serif; line-height: 1.6; }
html[data-lang="zh"] body, html[data-lang="zh"] .report { font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Segoe UI", system-ui, sans-serif; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 40px; color: var(--muted); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--nav); color: var(--nav-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 22px; color: #fff; font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.brand .mark { width: 32px; height: 32px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; }
.brand small { display: block; font-weight: 500; font-size: 11px; color: var(--nav-text); letter-spacing: .4px; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: var(--nav-text); font-weight: 500; }
.nav a:hover { background: var(--nav-2); color: #fff; }
.nav a.on { background: var(--nav-2); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.nav .sep { height: 1px; background: rgba(255, 255, 255, .07); margin: 10px 4px; }
.side .me { margin-top: auto; padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, .07); display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.side .me .n { color: #fff; font-weight: 600; font-size: 13px; }
.side .me .r { font-size: 11px; text-transform: capitalize; }
.side .me button { margin-left: auto; background: none; border: 0; color: var(--nav-text); cursor: pointer; padding: 6px; border-radius: 6px; }
.side .me button:hover { background: var(--nav-2); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; min-height: 62px; }
.topbar h1 { font-size: 19px; margin: 0; font-weight: 650; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.topbar .grow { flex: 1; }
.content { padding: 24px 28px 40px; max-width: 1320px; width: 100%; }

.bottomnav { display: none; }
.fab { display: none; }

/* ---------- common ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-h h3 { margin: 0; font-size: 15px; font-weight: 650; }
.card-b { padding: 16px 18px; }
.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)); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.hide { display: none !important; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-600); }
.btn.danger { color: var(--fail); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--hover); color: var(--text); }

.f { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }
.in, select.in, textarea.in { height: 40px; border: 1px solid var(--line); background: var(--input); border-radius: 8px; padding: 0 12px; width: 100%; outline: none; font-size: 14px; color: var(--text); font-weight: 400; }
textarea.in { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
.in:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.in[readonly] { background: var(--hover); }
.in.num { text-align: right; font-variant-numeric: tabular-nums; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.PASS { color: var(--pass); background: var(--pass-bg); }
.pill.FAIL { color: var(--fail); background: var(--fail-bg); }
.pill.PENDING { color: var(--pend); background: var(--pend-bg); }
.pill.none { color: var(--muted); background: var(--hover); }
.pill.draft { color: var(--muted); background: var(--hover); }
.pill.in_progress { color: var(--info); background: var(--info-bg); }
.pill.submitted { color: var(--brand-600); background: var(--brand-50); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .3px; background: var(--hover); color: var(--muted); }
.tag.final { background: #e8e5fb; color: #5b45d6; }
.tag.inline { background: #e6f1fb; color: #1f6fb8; }
.tag.measure { background: #fdf0e3; color: #b8621a; }
.tag.packing { background: #e6f6f3; color: #0e7f72; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tag.final { background: #2a2552; color: #b3a6ff; }
  :root:not([data-theme="light"]) .tag.inline { background: #16304a; color: #79b6f0; }
  :root:not([data-theme="light"]) .tag.measure { background: #3a2a18; color: #f0b072; }
  :root:not([data-theme="light"]) .tag.packing { background: #123430; color: #5fd3c3; }
}
:root[data-theme="dark"] .tag.final { background: #2a2552; color: #b3a6ff; }
:root[data-theme="dark"] .tag.inline { background: #16304a; color: #79b6f0; }
:root[data-theme="dark"] .tag.measure { background: #3a2a18; color: #f0b072; }
:root[data-theme="dark"] .tag.packing { background: #123430; color: #5fd3c3; }

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 650; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--hover); white-space: nowrap; }
table.t td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--hover); }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow-x: auto; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 40px; height: 40px; opacity: .5; }

.seg { display: inline-flex; background: var(--hover); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; height: 32px; padding: 0 12px; border-radius: 7px; cursor: pointer; font-weight: 600; color: var(--muted); font-size: 13px; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.seg button.on.PASS { color: var(--pass); }
.seg button.on.FAIL { color: var(--fail); }
.seg button.on.PENDING, .seg button.on.NA { color: var(--pend); }
.seg button.on.OK { color: var(--pass); }
.seg button.on.NG { color: var(--fail); }
.seg button.on.critical { color: var(--crit); }
.seg button.on.major { color: var(--fail); }
.seg button.on.minor { color: var(--pend); }

/* ---------- KPI ---------- */
.kpi { padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.kpi .ic { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.kpi .ic svg { width: 22px; height: 22px; }
.kpi .v { font-size: 24px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.ic.teal { background: var(--brand-50); color: var(--brand); }
.ic.green { background: var(--pass-bg); color: var(--pass); }
.ic.red { background: var(--fail-bg); color: var(--fail); }
.ic.amber { background: var(--pend-bg); color: var(--pend); }
.ic.blue { background: var(--info-bg); color: var(--info); }

.bar { height: 8px; border-radius: 99px; background: var(--hover); overflow: hidden; display: flex; }
.bar > span { display: block; height: 100%; }
.bar .p { background: var(--pass); }
.bar .f { background: var(--fail); }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) 2fr 44px; gap: 10px; align-items: center; padding: 6px 0; font-size: 13px; }
.hbar .tr { height: 10px; background: var(--hover); border-radius: 99px; overflow: hidden; }
.hbar .tr span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.hbar .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cols { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: 6px; }
.cols .c { flex: 1; display: flex; flex-direction: column-reverse; min-width: 4px; height: 100%; gap: 1px; }
.cols .c span { display: block; border-radius: 3px 3px 0 0; }
.cols .c .p { background: var(--pass); }
.cols .c .f { background: var(--fail); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- filters ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.filters .in { width: auto; height: 36px; }
.search { position: relative; flex: 1; min-width: 200px; }
.search svg { position: absolute; left: 11px; top: 9px; color: var(--muted); }
.search .in { padding-left: 36px; width: 100%; }

/* ---------- new inspection ---------- */
.type-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.type-card { text-align: left; padding: 18px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; display: flex; flex-direction: column; gap: 8px; }
.type-card:hover { border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); }
.type-card.on { border-color: var(--brand); background: var(--brand-50); }
.type-card .ic { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; }
.type-card b { font-size: 15px; }
.type-card span { color: var(--muted); font-size: 12.5px; }

/* ---------- inspection editor ---------- */
.ed-head { background: var(--card); border-bottom: 1px solid var(--line); padding: 14px 28px 0; position: sticky; top: 0; z-index: 20; }
.ed-head .t1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ed-head .no { font-size: 18px; font-weight: 700; }
.ed-head .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.save-state { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.save-state.dirty { color: var(--pend); }
.steps { display: flex; gap: 4px; margin-top: 12px; overflow-x: auto; scrollbar-width: none; }
.steps::-webkit-scrollbar { display: none; }
.steps a { display: flex; align-items: center; gap: 8px; padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; font-size: 13.5px; }
.steps a .d { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--hover); font-size: 11px; border: 1px solid var(--line); }
.steps a.on { color: var(--text); border-bottom-color: var(--brand); }
.steps a.on .d { background: var(--brand); color: #fff; border-color: var(--brand); }
.steps a.ok .d { background: var(--pass-bg); color: var(--pass); border-color: transparent; }
.steps a.bad .d { background: var(--fail-bg); color: var(--fail); border-color: transparent; }
.ed-body { padding: 22px 28px 110px; max-width: 1180px; width: 100%; }
.ed-foot { position: sticky; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding: 10px 28px; display: flex; gap: 10px; align-items: center; z-index: 15; }
.locked-banner { background: var(--brand-50); color: var(--brand-600); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; display: flex; gap: 10px; align-items: center; }

.verdict { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 10px; border: 1px solid var(--line); }
.verdict .big { font-size: 22px; font-weight: 800; letter-spacing: .5px; }
.verdict.PASS { background: var(--pass-bg); border-color: transparent; color: var(--pass); }
.verdict.FAIL { background: var(--fail-bg); border-color: transparent; color: var(--fail); }
.verdict.PENDING, .verdict.none { background: var(--hover); color: var(--muted); }
.verdict .why { color: var(--text); font-size: 13px; opacity: .85; }

.aql-table td, .aql-table th { text-align: center !important; }
.aql-table td:first-child, .aql-table th:first-child { text-align: left !important; }
.sev { font-weight: 700; }
.sev.critical { color: var(--crit); }
.sev.major { color: var(--fail); }
.sev.minor { color: var(--pend); }

.lib { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.cat-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }

.defect { display: grid; grid-template-columns: minmax(0, 1.6fr) auto auto 34px; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.defect:last-child { border-bottom: 0; }
.defect .nm b { display: block; }
.defect .nm small { color: var(--muted); }
.defect .rm { grid-column: 1 / -1; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.stepper button { width: 40px; height: 38px; border: 0; background: var(--hover); cursor: pointer; font-size: 18px; font-weight: 700; color: var(--text); }
.stepper button:active { background: var(--brand-50); }
.stepper input { width: 54px; height: 38px; border: 0; text-align: center; font-weight: 700; background: var(--input); outline: none; font-size: 15px; }
.totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tot { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.tot .v { font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; }
.tot .l { font-size: 12px; color: var(--muted); font-weight: 600; }
.tot.bad { border-color: var(--fail); background: var(--fail-bg); }
.tot.bad .v { color: var(--fail); }

.meas td { padding: 6px 6px !important; }
.meas input { width: 70px; height: 34px; border: 1px solid var(--line); border-radius: 6px; text-align: center; background: var(--input); outline: none; font-variant-numeric: tabular-nums; }
.meas input:focus { border-color: var(--brand); }
.meas input.oot { border-color: var(--fail); background: var(--fail-bg); color: var(--fail); font-weight: 700; }
.meas input.ok { border-color: color-mix(in srgb, var(--pass) 45%, var(--line)); }
.meas input.wide { width: 100%; min-width: 150px; text-align: left; padding: 0 8px; }
.meas .spec { font-weight: 700; }
.size-tabs { display: flex; gap: 6px; flex-wrap: wrap; }

.checks .ck { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.checks .ck:last-child { border-bottom: 0; }
.checks .ck .rm { grid-column: 1 / -1; }

.thumbs { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.thumbs .th { position: relative; width: 64px; height: 64px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.thumbs .th img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.thumbs .th button { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; font-size: 14px; line-height: 20px; padding: 0; }
.th-add { width: 64px; height: 64px; border-radius: 8px; border: 1.5px dashed var(--line); background: var(--hover); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.th-add:hover { border-color: var(--brand); color: var(--brand); }
.th-add svg { width: 22px; height: 22px; }
.thumbs.mini { flex-wrap: nowrap; gap: 4px; }
.thumbs.mini .th, .thumbs.mini .th-add { width: 34px; height: 34px; border-radius: 6px; }
.thumbs.mini .th-add svg { width: 16px; height: 16px; }
.thumbs.mini .more { font-size: 11px; color: var(--muted); font-weight: 700; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.ph { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); display: flex; flex-direction: column; }
.ph img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: var(--hover); cursor: zoom-in; }
.ph .cap { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.ph .cap input, .ph .cap select { height: 30px; font-size: 12.5px; padding: 0 8px; }
.ph .cap .row { flex-wrap: nowrap; }
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 24px; text-align: center; color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.drop:hover, .drop.over { border-color: var(--brand); color: var(--brand); background: var(--brand-50); }

.sig { border: 1px dashed var(--line); border-radius: 10px; background: #fff; position: relative; overflow: hidden; }
.sig .clr { color: #17212f; background: #f3f5f8; border-color: #dfe3ea; }
.sig canvas { width: 100%; height: 150px; display: block; touch-action: none; cursor: crosshair; }
.sig img { width: 100%; height: 150px; object-fit: contain; display: block; }
.sig .clr { position: absolute; top: 6px; right: 6px; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.25fr 1fr; }
.auth .art { position: relative; overflow: hidden; color: #fff; background: #0d1b2e; }
.auth .art-bg { position: absolute; inset: 0; background-size: cover; background-position: center; transform: scale(1.04); }
.auth .art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(13, 27, 46, .92) 0%, rgba(13, 27, 46, .78) 45%, rgba(8, 70, 72, .82) 100%); }
.auth .art-in { position: relative; z-index: 1; height: 100%; padding: 40px 48px 36px; display: flex; flex-direction: column; justify-content: space-between; gap: 28px; }
.auth .art .brand { font-size: 18px; }
.auth .art .brand small { color: #9fe3dc; letter-spacing: 1.2px; }
.auth .kicker { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; background: rgba(0, 194, 179, .16); border: 1px solid rgba(94, 230, 218, .35); color: #9ff3ea; font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.auth .kicker svg { width: 14px; height: 14px; }
.auth .art h2 { font-size: 42px; line-height: 1.12; margin: 18px 0 14px; max-width: 560px; letter-spacing: -.5px; }
.auth .art h2 em { font-style: normal; background: linear-gradient(90deg, #5ee6da, #00c2b3); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth .art p { color: #c9d6e4; max-width: 500px; font-size: 15.5px; line-height: 1.6; margin: 0; }
.auth .art .feat { display: grid; grid-template-columns: repeat(2, minmax(0, max-content)); gap: 10px 26px; margin-top: 24px; }
.auth .art .feat div { display: flex; align-items: center; gap: 10px; color: #e3ebf3; font-size: 14px; font-weight: 600; }
.auth .art .feat svg { color: #5ee6da; width: 18px; height: 18px; }
.auth .mosaic { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.auth .ph { margin: 0; position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 4 / 5; box-shadow: 0 14px 30px rgba(0, 0, 0, .35); border: 1px solid rgba(255, 255, 255, .14); }
.auth .ph:nth-child(even) { transform: translateY(16px); }
.auth .ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s ease; }
.auth .ph:hover img { transform: scale(1.07); }
.auth .ph figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 9px; background: linear-gradient(transparent, rgba(0, 0, 0, .78)); font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.auth .ph figcaption svg { width: 14px; height: 14px; color: #5ee6da; flex: none; }
.auth .form { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 32px 20px; background: var(--card); position: relative; }
.auth .form-hero { display: none; }
.auth .box { width: 100%; max-width: 380px; display: grid; gap: 14px; }
.auth .box-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.auth .box-brand b { display: block; font-size: 18px; }
.auth .box-brand small { color: var(--muted); font-size: 12.5px; }
.auth .form-foot { display: flex; align-items: center; gap: 6px; }
.auth .form-foot span { width: 30px; height: 30px; border-radius: 50%; background-size: cover; background-position: center; border: 2px solid var(--card); margin-left: -12px; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
.auth .form-foot span:first-child { margin-left: 0; }
.auth .form-foot .small { margin-left: 8px; }
.logo { width: 32px; height: 32px; border-radius: 8px; flex: none; display: block; }
.logo.lg { width: 46px; height: 46px; border-radius: 11px; box-shadow: 0 6px 18px rgba(0, 194, 179, .35); }
.logo.xl { width: 54px; height: 54px; border-radius: 13px; box-shadow: 0 6px 18px rgba(0, 169, 157, .3); }
.auth .box h3 { margin: 0; font-size: 22px; }
.err { color: var(--fail); font-size: 13px; min-height: 18px; }

/* ---------- modal / toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(9, 15, 25, .55); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--card); border-radius: 14px; width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.modal .mh { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal .mh h3 { margin: 0; font-size: 16px; flex: 1; }
.modal .mb { padding: 18px 20px; display: grid; gap: 14px; }
.modal .mf { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal.wide { max-width: 1000px; }
.aqlc-sum { background: var(--hover); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; display: grid; gap: 4px; }
.aqlc-wrap { overflow-x: auto; margin-bottom: 14px; }
table.aqlc { border-collapse: collapse; width: 100%; font-size: 12px; font-variant-numeric: tabular-nums; background: #fff; color: #222; }
.aqlc th, .aqlc td { border: 1px solid #d9d9d9; padding: 4px 6px; text-align: center; white-space: nowrap; }
.aqlc thead th { background: #fbe9e7; color: #7f1d1d; font-weight: 700; }
.aqlc thead th.red { background: #c0392b; color: #fff; font-size: 13px; letter-spacing: .5px; }
.aqlc tbody th { background: #c0392b; color: #fff; font-weight: 600; text-align: left; }
.aqlc.plans tbody th { text-align: center; }
.aqlc th.acre { font-size: 10.5px; font-weight: 600; }
.aqlc td.arr { color: #888; font-size: 14px; }
.aqlc .hc { background: #fff8db !important; }
.aqlc tr.hl td { background: #fff3bf; }
.aqlc tr.hl th { background: #8e2a1f; }
.aqlc td.hx { background: #ffd43b !important; font-weight: 800; font-size: 13px; outline: 2px solid #b8860b; outline-offset: -2px; }
.aqlc td.hit { font-weight: 800; outline: 2px solid; outline-offset: -2px; }
.aqlc td.hit.critical { background: #fce7f3 !important; outline-color: #9f1239; color: #9f1239; }
.aqlc td.hit.major { background: #fde2e2 !important; outline-color: #dc2626; color: #b91c1c; }
.aqlc td.hit.minor { background: #fdf0d5 !important; outline-color: #d97706; color: #b45309; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin: 0 1px; vertical-align: 0; }
.dot.critical { background: #9f1239; } .dot.major { background: #dc2626; } .dot.minor { background: #d97706; }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .9); display: grid; place-items: center; z-index: 120; cursor: zoom-out; }
.lightbox img { max-width: 96vw; max-height: 92vh; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; }
#toast div { background: #17212f; color: #fff; padding: 10px 16px; border-radius: 9px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); font-size: 13.5px; animation: tin .2s ease; }
#toast div.e { background: var(--fail); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* ---------- report ---------- */
.report { background: #fff; color: #111; max-width: 900px; margin: 0 auto; padding: 32px 36px; border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; }
.report h2 { margin: 0; font-size: 20px; }
.report h4 { margin: 22px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: #0d1b2e; border-bottom: 2px solid #00a99d; padding-bottom: 4px; }
.report table { width: 100%; border-collapse: collapse; }
.report td, .report th { border: 1px solid #cfd6df; padding: 5px 7px; text-align: left; vertical-align: top; }
.report th { background: #f1f4f7; font-weight: 650; }
.report .rh { display: flex; align-items: center; gap: 14px; border-bottom: 3px solid #0d1b2e; padding-bottom: 12px; }
.report .stamp { margin-left: auto; font-size: 22px; font-weight: 800; padding: 6px 18px; border: 3px solid; border-radius: 8px; letter-spacing: 1px; }
.report .stamp.PASS { color: #15803d; }
.report .stamp.FAIL { color: #b91c1c; }
.report .stamp.PENDING, .report .stamp.none { color: #b45309; }
.report .rt { width: 160px; }
.report tr.ph-row td { padding: 6px; background: #fafbfc; }
.report tr.ph-row .rp figure { border: 1px solid #cfd6df; }
.report .rt img { width: 72px; height: 54px; object-fit: cover; margin: 1px; border: 1px solid #cfd6df; vertical-align: top; cursor: zoom-in; }
.report .oot { color: #b91c1c; font-weight: 700; }
.report .rp { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.report .rp figure { margin: 0; border: 1px solid #cfd6df; break-inside: avoid; }
.report .rp img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.report .rp figcaption { padding: 4px 6px; font-size: 11px; }
.report .rp.big { grid-template-columns: repeat(2, 1fr); }
.report .rp.big img { aspect-ratio: auto; max-height: 520px; object-fit: contain; background: #f6f6f6; }
.report .sigs { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 10px; }
.report .sigs .sig-img { height: 78px; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid #333; padding-bottom: 2px; }
.report .sigs .sig-img img { max-height: 74px; max-width: 100%; object-fit: contain; display: block; mix-blend-mode: multiply; }
.report .sigs .sig-name { padding-top: 5px; text-align: center; }

/* ---------- full (buyer-style) report ---------- */
.tag.full { background: #e3ebff; color: #1a4fd8; }
.cp-no { width: 26px; height: 26px; border-radius: 50%; background: var(--hover); border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.cp .card-h h3 { font-size: 14px; }
.seg button.on.pass, .seg button.on.yes { color: var(--pass); }
.seg button.on.fail, .seg button.on.no { color: var(--fail); }
.seg button.on.pending { color: var(--pend); }
.checks .cf-head { padding-bottom: 4px; border-bottom: 0; }
.checks .cf-sub { margin-left: 28px; }
.checks .cf-sub .cp-no { width: auto; min-width: 26px; padding: 0 6px; border-radius: 13px; }
.dc-wrap { max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.dc-table thead th { position: sticky; top: 0; z-index: 1; }
.dc-table td { padding: 9px 12px; }
.dc-table tr.added td { background: color-mix(in srgb, var(--pass) 8%, transparent); }
.sevs { display: flex; gap: 4px; flex-wrap: wrap; }
.sv { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; }
.sv.critical { color: var(--crit); background: color-mix(in srgb, var(--crit) 14%, transparent); }
.sv.major { color: var(--fail); background: var(--fail-bg); }
.sv.minor { color: var(--pend); background: var(--pend-bg); }
.plan-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.plan-tiles .tot { text-align: left; cursor: pointer; background: var(--card); color: var(--text); font: inherit; }
.plan-tiles .tot.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.plan-t td { vertical-align: top; }
.plan-t tr.locked td { background: color-mix(in srgb, var(--fail) 6%, transparent); }
.pill svg.i { width: 12px; height: 12px; }
.lang-pick { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--hover); border: 1px solid var(--line); }
.lang-pick button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 7px; cursor: pointer; }
.lang-pick button.on { background: var(--brand); color: #fff; }
.lang-pick button:not(.on):hover { color: var(--text); }
.side-lang { padding: 0 16px 10px; }
.side-lang .lang-pick { background: var(--nav-2); border-color: transparent; width: 100%; justify-content: space-between; }
.side-lang .lang-pick button { color: var(--nav-text); flex: 1; }
.side-lang .lang-pick button.on { color: #fff; }
.show-m { display: none; }
.rbar { flex: 1; height: 8px; border-radius: 99px; background: var(--hover); overflow: hidden; min-width: 60px; }
.rbar span { display: block; height: 100%; border-radius: 99px; }
.fperf td { vertical-align: top; }
.fperf tr.open td { background: var(--hover); }
.pill.grade { font-size: 13px; padding: 0 12px; }
.pill.grade::before { display: none; }
.fdetail > td { background: var(--bg); padding: 12px !important; }
.fdet .t { background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.fchart .gl { stroke: var(--line); stroke-width: 1; }
.fchart .ax { fill: var(--muted); font-size: 11px; }
.fchart .fx { fill: var(--text); font-size: 12px; font-weight: 600; }
.fchart .vl { fill: var(--text); font-size: 10.5px; font-weight: 700; }
.mission { position: relative; overflow: hidden; border-radius: 18px; color: #fff; padding: 44px 48px;
  background: radial-gradient(1200px 400px at 110% -20%, rgba(0, 169, 157, .55), transparent 60%), linear-gradient(135deg, #0d1b2e 0%, #10324a 55%, #0b5e5a 100%);
  box-shadow: 0 18px 40px rgba(13, 27, 46, .25); }
.mission::after { content: ""; position: absolute; right: -90px; bottom: -90px; width: 300px; height: 300px; border-radius: 50%; border: 46px solid rgba(255, 255, 255, .06); }
.mission-in { position: relative; z-index: 1; max-width: 860px; }
.mission-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.mission-brand .mark { width: 40px; height: 40px; border-radius: 10px; background: #00a99d; display: grid; place-items: center; }
.mission-brand b { display: block; font-size: 15px; letter-spacing: .3px; }
.mission-brand small { color: #9fe3dc; font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; font-weight: 700; }
.mission-q { font-family: Georgia, serif; font-size: 90px; line-height: .6; color: #00c2b3; height: 40px; }
.mission-t { font-size: 22px; line-height: 1.55; margin: 0 0 12px; font-weight: 500; letter-spacing: .1px; }
.mission-pills { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.mission-pills span { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); font-size: 13px; font-weight: 600; }
.mission-pills svg { width: 16px; height: 16px; color: #5ee6da; }
.home-h { margin: 0; font-size: 20px; }
.task-group { margin-bottom: 14px; }
.task-h { font-size: 12px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); margin: 6px 0 8px; }
.task-h span { background: var(--hover); border-radius: 99px; padding: 1px 8px; margin-left: 4px; }
.task-h.now { color: var(--brand); } .task-h.bad { color: var(--fail); }
.task { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; background: var(--card); }
.task.locked { border-color: color-mix(in srgb, var(--fail) 40%, var(--line)); background: color-mix(in srgb, var(--fail) 5%, var(--card)); }
.task-date { width: 52px; flex: none; text-align: center; border-radius: 10px; background: var(--brand-50); color: var(--brand-600); padding: 6px 0; }
.task-date b { display: block; font-size: 20px; line-height: 1.1; }
.task-date span { font-size: 11px; font-weight: 700; text-transform: uppercase; }
.missing { border: 1px solid color-mix(in srgb, var(--fail) 45%, var(--line)); background: var(--fail-bg); border-radius: 12px; padding: 14px 16px; }
.missing .mi { width: 36px; height: 36px; border-radius: 10px; background: var(--fail); color: #fff; display: grid; place-items: center; flex: none; }
.miss-g { margin: 10px 0 0 48px; }
.miss-g a { font-weight: 700; }
.miss-g ul { margin: 4px 0 0; padding-left: 18px; font-size: 13px; }
.ready { display: flex; gap: 12px; align-items: center; border: 1px solid color-mix(in srgb, var(--pass) 45%, var(--line)); background: var(--pass-bg); color: var(--pass); border-radius: 12px; padding: 14px 16px; }
.ready .small { color: var(--text); opacity: .8; }
.fa-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.fa-tiles .fa-rate { grid-column: span 1; }
#fa-out .cols { justify-content: flex-start; }
#fa-out .cols .c { max-width: 28px; }
.t3-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.t3 { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--card); }
.t3-one { max-width: 560px; }
.t3-one .t3-name { white-space: normal; }
.t3-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.t3-n { width: 22px; height: 22px; border-radius: 50%; background: var(--fail-bg); color: var(--fail); font-weight: 800; font-size: 12px; display: grid; place-items: center; flex: none; }
.t3-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.t3 .tr { height: 7px; background: var(--hover); border-radius: 99px; overflow: hidden; }
.t3 .tr span { display: block; height: 100%; background: var(--fail); border-radius: 99px; opacity: .8; }
.t3-q { min-width: 22px; text-align: right; }
.fa-h { font-size: 12px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.icon-btn.danger-ic:hover { color: var(--fail); background: var(--fail-bg); }
.wdef { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 10px; margin-bottom: 12px; }
.freport { max-width: 860px; padding: 0 0 24px; overflow: hidden; font-size: 12px; color: #1f2937; }
.freport .fr-cover { padding: 28px 34px 22px; border-bottom: 1px solid #e5e7eb; }
.fr-top { display: flex; align-items: flex-start; justify-content: space-between; }
.fr-brand { display: flex; align-items: center; gap: 10px; }
.fr-brand b { display: block; font-size: 15px; letter-spacing: 1px; color: #0d1b2e; }
.fr-brand small { display: block; font-size: 10px; letter-spacing: 2px; color: #00a99d; font-weight: 700; }
.fr-title { display: flex; align-items: center; justify-content: space-between; margin: 34px 0 14px; }
.fr-title .t1 { font-size: 30px; font-weight: 400; color: #111827; letter-spacing: .5px; line-height: 1.1; }
.fr-title .t2 { font-size: 30px; color: #1a4fd8; letter-spacing: .5px; line-height: 1.1; }
.fr-overall { min-width: 150px; padding: 10px 18px; border-radius: 6px; text-align: center; color: #fff; background: #9ca3af; }
.fr-overall span { display: block; font-size: 11px; opacity: .9; }
.fr-overall b { font-size: 20px; }
.fr-overall.FAIL { background: #e05252; } .fr-overall.PASS { background: #22a55b; } .fr-overall.PENDING { background: #e3a008; }
.fr-no { font-weight: 700; font-size: 14px; margin-bottom: 16px; word-break: break-all; }
.fr-l { color: #6b7280; font-size: 11px; margin: 10px 0 4px; }
.fr-v { font-size: 13px; color: #111827; }
.fr-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fr-chip { background: #eef0f3; border-radius: 3px; padding: 2px 6px; font-size: 11px; }
.fr-chip.hi { background: #c9f1fb; font-weight: 700; color: #155e75; }
.fr-hr { border: 0; border-top: 3px solid #2f8cf0; margin: 18px 0 6px; }
.fr-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 16px; }
.fr-bar { background: #1a4fd8; color: #fff; font-weight: 700; padding: 8px 14px; margin: 18px 0 0; font-size: 12px; letter-spacing: .3px; break-after: avoid; }
.fr-sub { background: #eef1f6; font-weight: 700; padding: 8px 14px; margin: 14px 0 8px; font-size: 12px; break-after: avoid; }
.fr-chiph { background: #f2f5fb; color: #1a4fd8; font-weight: 700; padding: 8px 14px; margin: 12px 14px 8px; border-radius: 6px; font-size: 11.5px; break-after: avoid; }
.fr-kv { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; padding: 6px 14px 8px; }
.fr-kv span { color: #4b5563; font-weight: 600; font-size: 11.5px; }
.fr-kv b { font-size: 13px; margin-right: 40px; }
.fr-kv.c { border: 1px solid #e5e7eb; margin: 0 14px; justify-content: space-around; }
.fr-sum { display: grid; grid-template-columns: 1fr 1fr; margin: 0 14px; }
.fr-sum div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 8px; }
.fr-sum div:nth-child(4n+1), .fr-sum div:nth-child(4n+2) { background: #f6f7f9; }
.fr-sum b, .freport .r-na { font-size: 10.5px; }
.r-pass { color: #16a34a; } .r-fail { color: #dc2626; } .r-pend { color: #d97706; } .r-na { color: #374151; }
table.fr-t { width: calc(100% - 28px); margin: 8px 14px; border-collapse: collapse; font-size: 11.5px; }
.fr-t th { background: #f3f4f6; text-align: left; padding: 6px 8px; border: 1px solid #e5e7eb; font-weight: 700; }
.fr-t td { padding: 6px 8px; border: 1px solid #e5e7eb; vertical-align: top; }
.fr-t td.num, .fr-t th.num { text-align: center; }
.fr-sig td { height: 26px; }
.fr-sig img { height: 80px; max-width: 100%; object-fit: contain; display: block; margin: 0 auto; }
.fr-cp { border: 1px solid #e5e7eb; border-radius: 4px; margin: 10px 14px; break-inside: avoid; }
.fr-cpt { font-weight: 700; font-size: 13px; padding: 8px 10px 4px; }
.fr-cpb .fr-row, .fr-cpb .fr-desc { background: #eeeeee; padding: 6px 10px; border-top: 1px solid #fff; }
.fr-desc { background: #fff !important; white-space: pre-wrap; }
.fr-ph { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 8px 10px 10px; }
.freport > .fr-ph { padding: 8px 14px; }
.fr-ph img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; cursor: zoom-in; break-inside: avoid; }
.fr-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 14px; }
.fr-card { border: 1px solid #e5e7eb; break-inside: avoid; }
.fr-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; cursor: zoom-in; }
.fr-noimg { aspect-ratio: 4/3; display: grid; place-items: center; color: #9ca3af; background: #f3f4f6; }
.fr-cardb { padding: 8px 10px; }
.fr-cardb .fr-l { margin: 6px 0 2px; }

@media print {
  /* All six top/bottom boxes are defined so the browser's own date/time, title and URL lines are not printed. */
  @page {
    @top-left { content: ""; } @top-right { content: ""; }
    @top-center { content: "Ealytex (CAMBODIA) Garment Co., Ltd"; font-size: 9pt; color: #555; }
    @bottom-left { content: "Ealytex (CAMBODIA) Garment Co., Ltd | Confidential information"; font-size: 8pt; color: #888; }
    @bottom-center { content: ""; }
    @bottom-right { content: "Page: " counter(page) " / " counter(pages); font-size: 8pt; color: #888; }
  }
  .freport .fr-cover { break-after: page; min-height: 250mm; border: 0; }
  .fr-bar, .fr-sub, .fr-chiph, .fr-overall, .fr-sum div, .fr-t th, .fr-cpb .fr-row, .fr-chip { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  .side, .topbar, .bottomnav, .fab, .no-print, #toast { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  .report { border: 0; padding: 0; max-width: none; }
}

/* ---------- responsive ---------- */
@media screen and (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .type-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media screen and (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { padding: 12px 16px; min-height: 56px; }
  .topbar h1 { font-size: 17px; }
  .content { padding: 16px 16px 96px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--line); z-index: 50; padding-bottom: env(safe-area-inset-bottom); }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; color: var(--muted); font-size: 11px; font-weight: 600; }
  .bottomnav a.on { color: var(--brand); }
  .fab { display: grid; place-items: center; position: fixed; right: 18px; bottom: 76px; width: 56px; height: 56px; border-radius: 50%; background: var(--brand); color: #fff; box-shadow: 0 6px 18px rgba(0, 169, 157, .45); z-index: 51; }
  .fab svg { width: 26px; height: 26px; }
  .ed-head { padding: 12px 16px 0; }
  .ed-body { padding: 16px 16px 150px; }
  .ed-foot { padding: 10px 16px; position: fixed; left: 0; right: 0; bottom: 58px; }
  .auth { grid-template-columns: 1fr; }
  .auth .art { display: none; }
  .auth .form { justify-content: flex-start; padding: 0 20px 28px; gap: 22px; }
  .auth .form-hero { display: block; width: calc(100% + 40px); height: 210px; margin: 0 -20px; background-size: cover; background-position: center; position: relative; }
  .auth .form-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(13, 27, 46, .15), var(--card)); }
  .auth .box { margin-top: -70px; position: relative; z-index: 1; background: var(--card); border-radius: 16px; padding: 20px; box-shadow: 0 10px 30px rgba(0, 0, 0, .12); }
  .totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .defect { grid-template-columns: minmax(0, 1fr) 34px; }
  .defect .seg, .defect .stepper { grid-column: 1 / 2; }
  .checks .ck { grid-template-columns: minmax(0, 1fr); }
  .hide-m { display: none !important; }
  .report { padding: 16px; }
  .report .rp { grid-template-columns: repeat(2, 1fr); }
  .fr-grid, .fr-sum { grid-template-columns: 1fr 1fr; }
  .dc-table .sv-col { display: none; }
  .fa-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mission { padding: 28px 22px; border-radius: 14px; }
  .mission-t { font-size: 17px; }
  .mission-q { font-size: 64px; height: 28px; }
  .show-m { display: inline-flex; }
  .plan-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dc-wrap { max-height: 55vh; }
  .fr-ph, .fr-cards { grid-template-columns: repeat(2, 1fr); }
  .freport .fr-cover { padding: 18px; }
  .report { overflow-x: auto; }
  .report table { font-size: 11px; }
  .topbar { flex-wrap: wrap; }
  .topbar h1 { word-break: break-all; }
  .report .rt { width: 70px; }
  .report .rt img { width: 60px; height: 45px; }
}
@media screen and (max-width: 520px) {
  .type-cards { grid-template-columns: 1fr; }
  .type-card { display: grid; grid-template-columns: 42px 1fr; column-gap: 12px; row-gap: 2px; padding: 14px; }
  .type-card .ic { grid-row: span 2; }
  .kpi { padding: 12px; gap: 10px; }
  .kpi .ic { width: 36px; height: 36px; }
  .kpi .v { font-size: 20px; }
  .card-h .small.muted { display: none; }
}

.in.err { border-color: var(--fail); background: var(--fail-bg); }
.bd-t { width: 100%; }
.bd-t td .in { min-width: 90px; }
@media screen and (max-height: 820px) { .auth .ph { aspect-ratio: 1 / 1; } .auth .art h2 { font-size: 36px; } }
.grid.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media screen and (max-width: 900px) { .grid.g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.grid.g5 > .f[style*="span 5"] { grid-column: 1 / -1 !important; }
.rmk-bad { color: #dc2626; font-weight: 800; margin-top: 3px; }
.pct-bad { color: #dc2626; font-weight: 800; }
.auth .art h2 { max-width: 700px; }
.auth .ph img[src*="measuring-garment"] { object-position: 78% center; }
.auth .ph img[src*="audit-tablet"] { object-position: 70% center; }

/* photo editor */
.ped{position:fixed;inset:0;z-index:2000;background:#0b0f14;color:#e5e7eb;display:flex;flex-direction:column;gap:8px;padding:10px 12px calc(10px + env(safe-area-inset-bottom));}
.ped .muted{color:#9ca3af;}
.ped-top{display:flex;align-items:center;gap:8px;flex-wrap:wrap;}
.ped-top .btn{height:36px;}
.ped-top .btn.ghost{color:#e5e7eb;}
.ped .btn:not(.primary):not(.ghost){background:#1f2937;color:#e5e7eb;border-color:#334155;}
.ped-stage{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;overflow:hidden;}
.ped-cv{max-width:100%;max-height:100%;object-fit:contain;touch-action:none;border-radius:6px;background:#111;}
.ped-hint{text-align:center;font-size:13px;color:#fbbf24;}
.ped-tools{display:flex;gap:6px;overflow-x:auto;padding-bottom:2px;}
.ped-t{flex:0 0 auto;min-width:64px;border:1px solid #334155;background:#111827;color:#e5e7eb;border-radius:10px;padding:6px 8px;display:flex;flex-direction:column;align-items:center;gap:2px;cursor:pointer;}
.ped-t span{font-size:20px;line-height:1;}
.ped-t small{font-size:11px;color:#9ca3af;}
.ped-t.on{border-color:#22d3ee;background:#0e7490;}
.ped-t.on small{color:#e0f2fe;}
.ped-t:disabled{opacity:.35;}
.ped-row{display:flex;align-items:center;gap:14px;flex-wrap:wrap;font-size:13px;}
.ped-row label{display:flex;align-items:center;gap:6px;}
.ped-row input[type=range]{width:130px;}
.ped-cols{display:flex;gap:6px;}
.ped-cols button{width:26px;height:26px;border-radius:50%;border:2px solid #475569;cursor:pointer;}
.ped-cols button.on{border-color:#22d3ee;box-shadow:0 0 0 2px #22d3ee;}
.ped-crop{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:13px;color:#fbbf24;}
.ped-crop[hidden],.ped-hint[hidden]{display:none;}
.ped-always{font-size:12px;color:#9ca3af;display:flex;gap:6px;align-items:center;}
.lightbox .lb-edit{position:fixed;bottom:22px;left:50%;transform:translateX(-50%);z-index:2;}
/* measurement deviation chips */
.dchips{margin-top:8px;display:flex;flex-direction:column;gap:6px;}
.dline{display:flex;gap:6px;flex-wrap:wrap;}
.dchip{min-width:52px;height:36px;padding:0 10px;border-radius:18px;border:1px solid var(--line);background:var(--card);font-weight:700;font-size:14px;cursor:pointer;}
.dchip.neg{color:#2563eb;}
.dchip.pos{color:#dc2626;}
.dchip.on.neg{background:#2563eb;color:#fff;border-color:#2563eb;}
.dchip.on.pos{background:#dc2626;color:#fff;border-color:#dc2626;}
.act-t td { vertical-align: top; }
.act-t tr.act-late td { background: color-mix(in srgb, var(--fail) 6%, transparent); }
.act-t tr.act-done td { opacity: .7; }
.act-hint { display: flex; gap: 12px; align-items: flex-start; border: 1px solid color-mix(in srgb, var(--fail) 40%, var(--line)); background: var(--fail-bg); border-radius: 12px; padding: 12px 14px; }
.act-hint svg { color: var(--fail); flex: none; margin-top: 2px; }
.prev-def { border-color: color-mix(in srgb, var(--pend) 45%, var(--line)); }
#followup { max-width: 1000px; margin: 0 auto; }
@media screen and (max-width: 700px) {
  .act-t thead { display: none; }
  .act-t, .act-t tbody, .act-t tr, .act-t td { display: block; width: 100%; }
  .act-t tr { border-bottom: 1px solid var(--line); padding: 10px 12px; }
  .act-t td { border: 0 !important; padding: 2px 0 !important; text-align: left !important; }
  .act-t td:last-child { margin-top: 6px; }
}
.bell { position: relative; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); display: inline-grid; place-items: center; cursor: pointer; flex: none; margin-left: 8px; }
.bell svg { width: 20px; height: 20px; }
.bell-n { position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: var(--fail); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--card); }
.notif-panel { position: fixed; top: 64px; right: 18px; width: 380px; max-width: calc(100vw - 24px); max-height: min(70vh, 560px); display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 40px rgba(0, 0, 0, .22); z-index: 60; overflow: hidden; }
.np-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.np-list { overflow-y: auto; }
.np-i { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.np-i:hover { background: var(--hover); }
.np-i.unread { background: color-mix(in srgb, var(--brand) 7%, var(--card)); }
.np-i.unread b::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-right: 6px; vertical-align: middle; }
.np-ic { width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-600); }
.np-ic svg { width: 17px; height: 17px; }
.np-i.k-fail .np-ic, .np-i.k-locked .np-ic, .np-i.k-overdue .np-ic { background: var(--fail-bg); color: var(--fail); }
.np-i.k-pass .np-ic { background: var(--pass-bg); color: var(--pass); }
.np-i.k-due .np-ic { background: color-mix(in srgb, var(--pend) 15%, var(--card)); color: var(--pend); }
.np-b { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.np-t { display: block; font-size: 11.5px; color: var(--muted); margin-top: 3px; }
@media screen and (max-width: 700px) { .notif-panel { top: 58px; right: 12px; left: 12px; width: auto; } }

/* Measure guide (Walmart Method of Measure) */
.mom-modal { max-width: 760px; }
.mom-open { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--input); color: var(--muted); font: inherit; text-align: left; cursor: pointer; }
.mom-open:hover { border-color: var(--brand); color: var(--text); }
.mom-hit { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 6px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.mom-hit:hover { background: var(--hover); }
.mom-hit b { display: block; }
.mom-hit .small { display: block; }
.mom-hit .tag { flex: none; min-width: 64px; justify-content: center; }
.mom-sec { border-bottom: 1px solid var(--line); }
.mom-sec > summary { padding: 10px 2px; cursor: pointer; }
.mom-sec .mom-hit { padding-left: 14px; }
.mom-img { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); background: #fff; margin-bottom: 10px; }
.mom-how { padding: 10px 12px; border-radius: 8px; background: var(--info-bg); margin-bottom: 10px; line-height: 1.5; }
.mom-how b { display: block; margin-bottom: 2px; }
.mom-std summary { cursor: pointer; color: var(--muted); }
.mom-std .small { margin-top: 6px; line-height: 1.5; }
.mom-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.mom-head .tag { flex: none; }
.mom-sub { margin-bottom: 10px; }
.mom-search { margin-bottom: 10px; }
.mom-back { margin-bottom: 10px; }
