/* Metre2 PDF Flatten 1.1 - "light table" (concept 1, 2026-10-23).
   Accent: lime #8fdc1c - picked by minimum RGB distance from every accent already shipped in
   Keystone (194 in-content + chrome colours; nearest is 53 away - sky #0ea5e9 from the mockups
   turned out to be used already). Red = removed/hidden, amber = markups, lime = kept/done. */
@font-face { font-family: 'InterPF'; src: url('fonts/inter-var.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
:root {
  --accent: #8fdc1c; --accent-2: #b8f05a; --accent-ink: #102000; --accent-soft: rgba(143, 220, 28, .14);
  --red: #ff5a5f; --red-soft: rgba(255, 90, 95, .14); --red-text: #ffa3a6;
  --amber: #f5b83d; --amber-soft: rgba(245, 184, 61, .14); --amber-text: #ffd27a;
  --bg: #08101c; --bg-2: #0b1424; --glass: rgba(17, 29, 48, .66); --glass-2: rgba(22, 37, 60, .8);
  --line: rgba(148, 197, 255, .13); --line-2: rgba(148, 197, 255, .22);
  --text: #e7f0fa; --muted: #93a6bd; --dim: #62768e;
  --radius: 12px;
  font-family: 'InterPF', 'Segoe UI Variable Text', 'Segoe UI', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; color: var(--text); font-size: 13.5px; overflow: hidden;
  background:
    radial-gradient(1000px 560px at 50% 42%, rgba(143, 220, 28, .07), transparent 70%),
    radial-gradient(700px 480px at 6% 100%, rgba(80, 160, 255, .07), transparent 70%),
    linear-gradient(rgba(148, 197, 255, .045) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(148, 197, 255, .045) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(180deg, #0a1322, #060b14);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.muted { color: var(--muted); line-height: 1.55; }
.small { font-size: 12px; }
.label { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); margin: 0; }

/* ---- layout ---------------------------------------------------------------------------- */
#app { position: fixed; inset: 0; display: grid; grid-template-columns: 268px minmax(0, 1fr) 316px; grid-template-rows: 56px minmax(0, 1fr); }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--line); background: rgba(6, 11, 20, .55); backdrop-filter: blur(14px); }
.summary { display: flex; gap: 8px; align-items: center; min-width: 0; }
.web-brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; margin-right: 10px; white-space: nowrap; }
.web-brand .mk { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--accent-ink); background: linear-gradient(135deg, #c9f77a, #8fdc1c 55%, #5fa60a); }
.web-brand .mk svg { width: 17px; height: 17px; }
.web-brand b { font-size: 14px; } .web-brand span:last-child { font-size: 12px; color: var(--muted); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.files { padding: 14px 10px 14px 16px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.file-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding: 2px 6px 8px 2px; min-height: 0; }
.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 14px 8px; position: relative; }
.inspector { margin: 14px 16px 14px 8px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(14px); display: flex; flex-direction: column; min-height: 0; }
.insp-scroll { overflow-y: auto; padding: 18px 18px 8px; flex: 1; min-height: 0; }
.insp-foot { padding: 12px 18px 16px; border-top: 1px solid var(--line); }
#app.empty .files, #app.empty .stage, #app.empty .inspector { display: none; }
#app:not(.empty) .welcome { display: none; }
#app.empty #clear-all { display: none; }

/* ---- buttons, chips ---------------------------------------------------------------------- */
.pf-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 9px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .03); font-weight: 600; font-size: 13px; white-space: nowrap; }
.pf-btn:hover { background: rgba(255, 255, 255, .07); }
.pf-btn.sm { height: 28px; padding: 0 9px; font-size: 12px; }
.pf-btn svg { width: 16px; height: 16px; }
.pf-btn.main { color: var(--accent-ink); border: 0; background: linear-gradient(135deg, #d6ff8a, #8fdc1c 55%, #6fb80a); box-shadow: 0 10px 28px rgba(143, 220, 28, .28), inset 0 1px 0 rgba(255, 255, 255, .55); }
.pf-btn.main:hover { filter: brightness(1.06); }
.pf-btn.main:disabled { filter: grayscale(.8) brightness(.6); box-shadow: none; cursor: default; }
.pf-btn.big { width: 100%; height: 50px; border-radius: 12px; font-size: 15px; }
.pf-btn.danger { color: var(--red-text); }
.pf-icon { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 0; }
.pf-icon:hover { color: var(--text); border-color: var(--line-2); }
.pf-icon.sm { width: 28px; height: 28px; }
.pf-icon:disabled { opacity: .35; cursor: default; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; background: rgba(255, 255, 255, .07); color: var(--muted); }
.chip i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: currentColor; }
.chip.red { background: var(--red-soft); color: var(--red-text); } .chip.red i { background: var(--red); box-shadow: 0 0 8px var(--red); }
.chip.amber { background: var(--amber-soft); color: var(--amber-text); } .chip.amber i { background: var(--amber); }
.chip.ok { background: var(--accent-soft); color: #c8f58a; } .chip.ok i { background: var(--accent); }
.pro-tag { display: inline-flex; align-items: center; font-size: 9.5px; font-weight: 800; letter-spacing: .08em; padding: 2px 6px; border-radius: 4px; background: #ffc94d; color: #1d1400; vertical-align: 1px; }
html[data-ks-pro="1"] .pro-tag { background: rgba(255, 201, 77, .16); color: #ffd36b; }
.toolbar-gap { flex: 1; }

/* ---- welcome ----------------------------------------------------------------------------- */
.welcome { grid-column: 1 / -1; display: grid; place-items: center; padding: 24px; overflow: auto; }
.welcome-card { max-width: 620px; text-align: center; }
.drop-art { position: relative; width: 190px; height: 150px; margin: 0 auto 26px; }
.film { position: absolute; left: 35px; width: 120px; height: 82px; border-radius: 6px; transform: rotateX(58deg) rotateZ(-34deg); }
.film.f1 { top: 62px; background: #f4f7fb; box-shadow: 0 24px 40px rgba(0, 0, 0, .5); }
.film.f2 { top: 38px; border: 1.5px solid rgba(255, 90, 95, .8); background: rgba(255, 90, 95, .08); }
.film.f3 { top: 14px; border: 1.5px solid rgba(245, 184, 61, .8); background: rgba(245, 184, 61, .06); }
.drop-art .arrow { position: absolute; right: 0; top: 0; width: 34px; height: 34px; color: var(--accent); }
.welcome h1 { font-size: 30px; letter-spacing: -.02em; margin: 0 0 10px; font-weight: 750; }
.welcome .lede { color: var(--muted); font-size: 15px; line-height: 1.6; margin: 0 auto 22px; max-width: 540px; }
.welcome-actions { display: flex; gap: 10px; justify-content: center; margin-bottom: 30px; }
.welcome-actions .pf-btn { height: 44px; padding: 0 20px; font-size: 14px; }
.points { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; text-align: left; }
.points li { padding: 14px; border-radius: var(--radius); background: var(--glass); border: 1px solid var(--line); color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.points b { display: block; color: var(--text); font-size: 13.5px; margin-bottom: 3px; }

/* ---- file list --------------------------------------------------------------------------- */
.dropzone { border: 1.5px dashed rgba(143, 220, 28, .45); border-radius: var(--radius); padding: 11px; text-align: center; font-size: 12.5px; color: #c4ef8a; background: rgba(143, 220, 28, .05); cursor: pointer; flex-shrink: 0; }
.dropzone b { display: block; color: var(--text); font-size: 13.5px; margin-bottom: 1px; }
.file { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; padding: 9px; border-radius: var(--radius); background: var(--glass); border: 1px solid var(--line); text-align: left; position: relative; }
.file:hover { border-color: var(--line-2); }
.file.on { border-color: rgba(143, 220, 28, .7); box-shadow: 0 0 0 1px rgba(143, 220, 28, .3), 0 10px 28px rgba(143, 220, 28, .12); background: var(--glass-2); }
.file .th { width: 52px; height: 46px; border-radius: 6px; background: #f4f7fb; overflow: hidden; display: grid; place-items: center; }
.file .th canvas { max-width: 100%; max-height: 100%; display: block; }
.file .nm { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .meta { font-size: 11px; color: var(--muted); margin: 2px 0 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .chips { display: flex; gap: 4px; flex-wrap: wrap; }
.file .chip { font-size: 10.5px; padding: 2px 7px; }
.file .x { align-self: start; width: 22px; height: 22px; border: 0; background: none; color: var(--dim); border-radius: 6px; display: grid; place-items: center; padding: 0; opacity: 0; }
.file:hover .x, .file.on .x { opacity: 1; }
.file .x:hover { color: var(--text); background: rgba(255, 255, 255, .08); }
.file .x svg { width: 14px; height: 14px; }
.file .bar { position: absolute; left: 9px; right: 9px; bottom: 4px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.file .bar i { display: block; height: 100%; width: 40%; background: var(--accent); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* ---- stage ------------------------------------------------------------------------------- */
.stage-bar { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 12px; flex-wrap: wrap; }
.seg { display: flex; padding: 4px; border-radius: 11px; background: rgba(6, 11, 20, .7); border: 1px solid var(--line); gap: 3px; }
.seg button { padding: 7px 14px; border-radius: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; border: 0; background: none; display: inline-flex; align-items: center; gap: 7px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: rgba(255, 255, 255, .09); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg button[data-view="hidden"].on { background: linear-gradient(180deg, rgba(255, 90, 95, .25), rgba(255, 90, 95, .1)); color: #ffc7c9; box-shadow: inset 0 0 0 1px rgba(255, 90, 95, .45); }
.seg button[data-view="after"].on { background: linear-gradient(180deg, rgba(143, 220, 28, .22), rgba(143, 220, 28, .08)); color: #d6f7a8; box-shadow: inset 0 0 0 1px rgba(143, 220, 28, .45); }
.seg .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 8px var(--red); }
.pager, .zoom { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.table { flex: 1; min-height: 0; overflow: auto; position: relative; border-radius: 10px; }
.sheet-wrap { min-width: 100%; min-height: 100%; display: grid; place-items: center; padding: 6px; }
.sheet { display: block; background: #fff; border-radius: 3px; box-shadow: 0 30px 70px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .08); }
.sheet-note { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); padding: 7px 12px; border-radius: 9px; background: rgba(8, 14, 24, .92); border: 1px solid var(--line-2); font-size: 12.5px; color: var(--muted); box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
.busy { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; background: rgba(6, 11, 20, .35); }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .12); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.findings { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.finding { max-width: 420px; background: rgba(10, 16, 28, .92); border: 1px solid rgba(255, 90, 95, .55); color: #ffd6d7; font-size: 12px; padding: 6px 10px; border-radius: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finding b { color: #ff9599; font-size: 9.5px; letter-spacing: .1em; margin-right: 6px; }

/* ---- inspector --------------------------------------------------------------------------- */
.insp-title { font-size: 15px; font-weight: 700; margin: 0 0 3px; word-break: break-word; }
.insp-sub { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.banner { border-radius: 10px; padding: 10px 12px; font-size: 12.5px; line-height: 1.5; margin-bottom: 12px; }
.banner.red { background: var(--red-soft); border: 1px solid rgba(255, 90, 95, .4); color: #ffd6d7; }
.banner.ok { background: var(--accent-soft); border: 1px solid rgba(143, 220, 28, .35); color: #dcf7b8; }
.banner.info { background: rgba(255, 255, 255, .05); border: 1px solid var(--line); color: var(--muted); }
.banner b { display: block; font-size: 10.5px; letter-spacing: .1em; margin-bottom: 3px; }
.banner q { display: block; font-style: italic; margin-top: 3px; quotes: none; }
.sec { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 4px; gap: 8px; }
.sec .note { font-size: 11px; color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid rgba(148, 197, 255, .08); font-size: 12.5px; }
.row .n { flex: 1; min-width: 0; } .row .n .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.row .n small { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }
.row .n small.removed { color: var(--red-text); } .row .n small.kept { color: #c8f58a; }
.toggle { width: 34px; height: 20px; border-radius: 10px; background: #26364c; position: relative; flex-shrink: 0; border: 0; padding: 0; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #7f93ab; transition: left .15s; }
.toggle.on { background: linear-gradient(90deg, #6fb80a, #8fdc1c); } .toggle.on::after { left: 17px; background: #fff; }
.toggle.locked { opacity: .75; }
.mk { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 12.5px; padding: 7px 0; border-top: 1px solid rgba(148, 197, 255, .08); }
.mseg { display: flex; border-radius: 7px; overflow: hidden; border: 1px solid var(--line); font-size: 10.5px; font-weight: 600; }
.mseg button { padding: 4px 7px; color: var(--muted); border: 0; background: none; }
.mseg button + button { border-left: 1px solid var(--line); }
.mseg button.on { background: var(--amber-soft); color: var(--amber-text); }
.mseg button.on[data-mode="remove"] { background: var(--red-soft); color: var(--red-text); }
.mseg button.on[data-mode="keep"] { background: rgba(255, 255, 255, .1); color: var(--text); }
.options { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.opt { padding: 10px 0; border-bottom: 1px solid rgba(148, 197, 255, .08); }
.opt:last-child { border-bottom: 0; }
.opt-head { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.opt-head .grow { flex: 1; }
.opt small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; margin-top: 2px; line-height: 1.45; }
.opt-body { margin-top: 10px; display: grid; gap: 8px; }
.field { display: grid; gap: 4px; font-size: 11.5px; color: var(--muted); }
.field input, .field select { height: 32px; border-radius: 8px; border: 1px solid var(--line-2); background: rgba(6, 11, 20, .6); padding: 0 10px; font-size: 13px; color: var(--text); width: 100%; }
.field input:disabled, .field select:disabled { opacity: .6; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.swatches { display: flex; gap: 6px; }
.swatches button { width: 24px; height: 24px; border-radius: 6px; border: 2px solid transparent; padding: 0; }
.swatches button.on { border-color: #fff; }
.radio { display: flex; gap: 6px; }
.radio button { flex: 1; height: 32px; border-radius: 8px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .03); font-size: 12px; font-weight: 600; color: var(--muted); }
.radio button.on { border-color: rgba(143, 220, 28, .6); color: #dcf7b8; background: var(--accent-soft); }
.path { font-size: 11.5px; color: var(--muted); word-break: break-all; }
.foot-note { font-size: 11.5px; color: var(--muted); text-align: center; margin-top: 8px; line-height: 1.45; }
.foot-note a, .linkish { color: #c8f58a; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; background: none; border: 0; padding: 0; font-size: inherit; }
.done-list { display: grid; gap: 6px; margin-top: 8px; }

/* ---- overlays ---------------------------------------------------------------------------- */
.drop-overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(6, 11, 20, .7); backdrop-filter: blur(4px); pointer-events: none; }
.drop-overlay div { display: grid; justify-items: center; gap: 10px; padding: 36px 54px; border: 2px dashed rgba(143, 220, 28, .7); border-radius: 20px; font-size: 18px; font-weight: 700; color: #dcf7b8; }
.drop-overlay svg { width: 40px; height: 40px; color: var(--accent); }
dialog { background: #111c2e; color: var(--text); border: 1px solid var(--line-2); border-radius: 16px; padding: 0; width: 460px; max-width: 92vw; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 0; }
.dlg-head h2 { margin: 0; font-size: 17px; }
.dlg-body { padding: 10px 18px 18px; }
.dlg-body .label { margin-top: 10px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px); background: #1b2a40; border: 1px solid var(--line-2); color: var(--text); padding: 10px 16px; border-radius: 10px; font-size: 13px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 60; max-width: 80vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Keystone Pro panel buttons ("ks-btn primary/secondary") - this page has no .primary/.secondary
   styles of its own (everything here is pf-*), so nothing to undo - kept as a reminder. */

@media (max-width: 1100px) { #app { grid-template-columns: 230px minmax(0, 1fr) 290px; } }
@media (max-width: 860px) {
  body { overflow: auto; }
  #app { position: static; display: flex; flex-direction: column; min-height: 100%; }
  .topbar { flex-wrap: wrap; padding: 10px 16px; gap: 8px; }
  .top-actions span { display: none; }
  .files { padding: 12px 16px 0; }
  .file-list { flex-direction: row; overflow-x: auto; }
  .file { min-width: 230px; }
  .stage { padding: 12px 16px; height: 70vh; }
  .inspector { margin: 0 16px 16px; }
  .points { grid-template-columns: 1fr; }
  .welcome h1 { font-size: 24px; }
}
