/* Sterling PDF portal - design tokens, layout and components. No build step. */

:root {
  color-scheme: light;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;

  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef0f4;
  --border: #e3e6eb;
  --border-strong: #cfd4dc;
  --text: #121620;
  --text-2: #4a5263;
  --text-3: #7a8293;
  --brand: #2453d4;
  --brand-hover: #1d45b3;
  --brand-soft: #e8eefc;
  --brand-ink: #ffffff;
  --focus: #2453d4;
  --danger: #c42f2f;
  --danger-soft: #fdecec;
  --warn: #9a6200;
  --warn-soft: #fff4dc;
  --ok: #187a2f;
  --ok-soft: #e6f5ea;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 4px 12px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .18);
  --radius: 10px;
  --radius-sm: 7px;
  --sidebar: 248px;

  /* category tiles */
  --cat-organize: #2a78d6;  --cat-organize-bg: #e6f0fc;
  --cat-convert-to: #128a5e; --cat-convert-to-bg: #e2f5ed;
  --cat-convert-from: #0f7f95; --cat-convert-from-bg: #e0f3f7;
  --cat-edit: #b86e00;      --cat-edit-bg: #fdf1dc;
  --cat-security: #c23a5c;  --cat-security-bg: #fce8ee;
  --cat-inspect: #6250d6;   --cat-inspect-bg: #eeebfc;

  /* charts (dataviz reference palette) */
  --chart-surface: #ffffff;
  --series-1: #2a78d6;
  --series-1-track: #cde2fb;
  --status-critical: #d03b3b;
  --status-warning: #fab219;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --muted-ink: #898781;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0e1015;
    --surface: #161920;
    --surface-2: #1b1f27;
    --surface-3: #232833;
    --border: #2a303c;
    --border-strong: #3a4250;
    --text: #eef0f4;
    --text-2: #b5bccb;
    --text-3: #858d9e;
    --brand: #5b8cff;
    --brand-hover: #7aa2ff;
    --brand-soft: #1c2742;
    --brand-ink: #0b1020;
    --focus: #7aa2ff;
    --danger: #ff6b6b;
    --danger-soft: #3a1c1f;
    --warn: #f2b84b;
    --warn-soft: #33290f;
    --ok: #4cc970;
    --ok-soft: #14301c;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 4px 12px rgba(0, 0, 0, .3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .6);
    --cat-organize: #6aa5f0;  --cat-organize-bg: #18263b;
    --cat-convert-to: #3fc495; --cat-convert-to-bg: #13302a;
    --cat-convert-from: #43c0d6; --cat-convert-from-bg: #122d33;
    --cat-edit: #f0ad45;      --cat-edit-bg: #33260f;
    --cat-security: #f07597;  --cat-security-bg: #36192a;
    --cat-inspect: #9085e9;   --cat-inspect-bg: #241f40;
    --chart-surface: #161920;
    --series-1: #3987e5;
    --series-1-track: #184f95;
    --grid: #2c2c2a;
    --axis: #383835;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1015;
  --surface: #161920;
  --surface-2: #1b1f27;
  --surface-3: #232833;
  --border: #2a303c;
  --border-strong: #3a4250;
  --text: #eef0f4;
  --text-2: #b5bccb;
  --text-3: #858d9e;
  --brand: #5b8cff;
  --brand-hover: #7aa2ff;
  --brand-soft: #1c2742;
  --brand-ink: #0b1020;
  --focus: #7aa2ff;
  --danger: #ff6b6b;
  --danger-soft: #3a1c1f;
  --warn: #f2b84b;
  --warn-soft: #33290f;
  --ok: #4cc970;
  --ok-soft: #14301c;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 4px 12px rgba(0, 0, 0, .3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .6);
  --cat-organize: #6aa5f0;  --cat-organize-bg: #18263b;
  --cat-convert-to: #3fc495; --cat-convert-to-bg: #13302a;
  --cat-convert-from: #43c0d6; --cat-convert-from-bg: #122d33;
  --cat-edit: #f0ad45;      --cat-edit-bg: #33260f;
  --cat-security: #f07597;  --cat-security-bg: #36192a;
  --cat-inspect: #9085e9;   --cat-inspect-bg: #241f40;
  --chart-surface: #161920;
  --series-1: #3987e5;
  --series-1-track: #184f95;
  --grid: #2c2c2a;
  --axis: #383835;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.hidden { display: none !important; }
svg.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- shell */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 16px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand-sub { font-size: 11.5px; color: var(--text-3); margin-top: -2px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500;
}
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand); }
.nav .badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 13px;
}
.user-meta { min-width: 0; }
.user-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-actions { display: flex; gap: 6px; padding: 8px 4px 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.icon-btn.menu-btn { display: none; }
.search {
  position: relative; flex: 1; max-width: 560px;
}
.search input {
  width: 100%; height: 38px; padding: 0 70px 0 38px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search > .icon { position: absolute; left: 11px; top: 10px; color: var(--text-3); }
.search kbd { position: absolute; right: 9px; top: 8px; }
kbd {
  font-family: var(--font); font-size: 11px; color: var(--text-3);
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; background: var(--surface-2);
}
.search-results {
  position: absolute; left: 0; right: 0; top: 44px; z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 6px; max-height: 420px; overflow: auto;
}
.search-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); cursor: pointer; }
.search-item.active, .search-item:hover { background: var(--surface-3); }
.search-item .t { font-weight: 600; }
.search-item .d { font-size: 12.5px; color: var(--text-3); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.content { padding: 8px 28px 48px; max-width: 1320px; width: 100%; }
.banner {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 0 28px 4px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
}
.banner.dev { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }

/* -------------------------------------------------------------- headings */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin: 12px 0 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; line-height: 1.2; margin: 0; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; }
.crumbs { font-size: 13px; color: var(--text-3); margin-top: 8px; display: flex; gap: 6px; align-items: center; }
.crumbs a { color: var(--text-3); }
h2.section { font-size: 15px; margin: 28px 0 12px; display: flex; align-items: center; gap: 8px; }
h2.section .count { color: var(--text-3); font-weight: 500; }
.section-desc { color: var(--text-3); font-weight: 400; font-size: 13px; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow-sm); }
.btn.primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn.block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px;
  border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.on { color: #e3a008; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.err { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }

/* ------------------------------------------------------------------ cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px; }
.card h3 { margin: 0 0 4px; font-size: 14px; }
.card .sub { color: var(--text-3); font-size: 12.5px; margin: 0 0 14px; }

.hero { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 12px 0 8px; flex-wrap: wrap; }
.hero h1 { font-size: 26px; margin: 0; letter-spacing: -.02em; }
.hero p { margin: 4px 0 0; color: var(--text-2); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 4px; }
.chip {
  height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); font-weight: 500; cursor: pointer;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--text); color: var(--surface); border-color: var(--text); }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 12px; }
.tool-card {
  position: relative; display: flex; gap: 12px; align-items: flex-start;
  padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-align: left; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.tool-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); text-decoration: none; transform: translateY(-1px); }
.tool-card .name { font-weight: 600; margin-top: 1px; }
.tool-card .desc { font-size: 12.5px; color: var(--text-3); margin-top: 2px; line-height: 1.4; }
.tool-card .fav { position: absolute; top: 8px; right: 8px; opacity: 0; transition: opacity .12s; }
.tool-card:hover .fav, .tool-card .fav.on { opacity: 1; }
.tool-card .body { padding-right: 18px; min-width: 0; }

.tile {
  width: 38px; height: 38px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: var(--cat-organize-bg); color: var(--cat-organize);
}
.tile.lg { width: 48px; height: 48px; border-radius: 12px; }
.tile.lg svg.icon { width: 24px; height: 24px; }
.tile.sm { width: 28px; height: 28px; border-radius: 7px; }
.tile.sm svg.icon { width: 15px; height: 15px; }
.tile[data-cat="convert-to"] { background: var(--cat-convert-to-bg); color: var(--cat-convert-to); }
.tile[data-cat="convert-from"] { background: var(--cat-convert-from-bg); color: var(--cat-convert-from); }
.tile[data-cat="edit"] { background: var(--cat-edit-bg); color: var(--cat-edit); }
.tile[data-cat="security"] { background: var(--cat-security-bg); color: var(--cat-security); }
.tile[data-cat="inspect"] { background: var(--cat-inspect-bg); color: var(--cat-inspect); }
.tile[data-cat="file"] { background: var(--surface-3); color: var(--text-2); }

.empty {
  text-align: center; padding: 36px 16px; color: var(--text-3);
  border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2);
}
.empty .icon { width: 28px; height: 28px; margin-bottom: 8px; }

/* ----------------------------------------------------------- tool runner */
.tool-head { display: flex; gap: 16px; align-items: center; margin: 4px 0 18px; }
.tool-head h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.tool-head p { margin: 2px 0 0; color: var(--text-2); }
.tool-head .fav { margin-left: auto; }
.runner { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); gap: 18px; align-items: start; }
.panel-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 8px; }
.panel-title h3 { margin: 0; font-size: 14px; }

.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2);
  padding: 30px 18px; text-align: center; cursor: pointer; transition: border-color .12s, background .12s;
}
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone .icon { width: 30px; height: 30px; color: var(--brand); }
.dropzone .big { font-weight: 600; font-size: 15px; margin: 8px 0 2px; }
.dropzone .small { color: var(--text-3); font-size: 12.5px; }
.dropzone.compact { padding: 14px; }
.dropzone.compact .big { font-size: 13.5px; margin: 0; }
.dropzone.compact .icon { width: 20px; height: 20px; }
.dropzone.compact .dz-inner { display: flex; align-items: center; justify-content: center; gap: 10px; }

.file-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.file-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
}
.file-item.dragging { opacity: .5; }
.file-item.drop-target { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.file-item .fname { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item .fmeta { font-size: 12px; color: var(--text-3); }
.file-item .grow { flex: 1; min-width: 0; }
.file-item .handle { cursor: grab; color: var(--text-3); }
.file-item .order { width: 22px; text-align: center; font-size: 12px; color: var(--text-3); font-weight: 600; }

.form { display: flex; flex-direction: column; gap: 14px; }
.field label.lbl, .field .lbl { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.field .help { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.field.invalid .input, .field.invalid textarea, .field.invalid select { border-color: var(--danger); }
.field .err { font-size: 12px; color: var(--danger); margin-top: 5px; }
.input, select.input, textarea.input {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface);
}
textarea.input { height: auto; min-height: 96px; padding: 8px 10px; resize: vertical; font-family: var(--mono); font-size: 13px; }
.input:focus, textarea.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type="color"].input { padding: 3px; width: 64px; cursor: pointer; }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row .input.hex { width: 110px; font-family: var(--mono); }

.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 9px; background: var(--surface-3); max-width: 100%; }
.seg button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; cursor: pointer; color: var(--text-2); font-weight: 500;
}
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 600; }

.switch { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
  position: relative; width: 36px; height: 20px; border-radius: 999px; background: var(--border-strong); flex: none; margin-top: 1px;
  transition: background .15s;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s;
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch .txt { font-weight: 500; }
.switch .txt .help { font-weight: 400; }

.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--brand); }
.range-row .val { min-width: 44px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

.pos-grid { display: grid; grid-template-columns: repeat(3, 34px); grid-template-rows: repeat(3, 26px); gap: 4px; padding: 6px; background: var(--surface-3); border-radius: 8px; width: max-content; }
.pos-grid button { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 5px; cursor: pointer; }
.pos-grid button.on { background: var(--brand); border-color: var(--brand); }

.lang-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.lang-picker .chip.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

details.advanced { border-top: 1px solid var(--border); padding-top: 12px; }
details.advanced > summary { cursor: pointer; font-weight: 600; color: var(--text-2); list-style: none; display: flex; align-items: center; gap: 6px; }
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary .icon { transition: transform .15s; width: 16px; height: 16px; }
details.advanced[open] > summary .icon { transform: rotate(90deg); }
details.advanced .form { margin-top: 14px; }

.note { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--text); font-size: 13px; margin-bottom: 14px; }
.note .icon { color: var(--brand); margin-top: 1px; }
.note.warn { background: var(--warn-soft); }
.note.warn .icon { color: var(--warn); }
.note.err { background: var(--danger-soft); }
.note.err .icon { color: var(--danger); }

.run-bar { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--brand); border-radius: 999px; transition: width .2s; }
.progress.indeterminate > div { width: 35%; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.run-status { font-size: 12.5px; color: var(--text-2); display: flex; justify-content: space-between; }

.results { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.result {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.result.err { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); background: var(--danger-soft); }
.result .grow { flex: 1; min-width: 180px; }
.result .rname { font-weight: 600; word-break: break-all; }
.result .rmeta { font-size: 12px; color: var(--text-3); }
.result .ractions { display: flex; gap: 6px; flex-wrap: wrap; }
.result-body { width: 100%; }

.json-view { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; max-height: 520px; overflow: auto; }
.json-view details { margin-left: 14px; }
.json-view summary { cursor: pointer; margin-left: -14px; }
.json-view .k { color: var(--brand); }
.json-view .s { color: var(--ok); }
.json-view .n { color: var(--cat-edit); }
.json-view .b { color: var(--cat-inspect); }
.json-view .row { white-space: pre-wrap; word-break: break-word; }
pre.text-view { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; max-height: 520px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 0; }

/* ----------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .r { text-align: right; font-variant-numeric: tabular-nums; }
.table .clip { max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-tool { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.table-foot { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 12.5px; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .input { width: auto; min-width: 160px; }
.toolbar .search-input { min-width: 240px; flex: 1; max-width: 360px; }

/* ------------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ------------------------------------------------------------------- stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.big-figure { font-size: 26px; font-weight: 650; letter-spacing: -.02em; }
.stat { padding: 16px; }
.stat .label { color: var(--text-3); font-size: 12.5px; font-weight: 500; }
.stat .value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 4px; }
.stat .delta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.grid-even { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }

/* meter (allowance) */
.meter { height: 10px; border-radius: 999px; background: var(--series-1-track); overflow: hidden; margin: 12px 0 8px; }
.meter > div { height: 100%; background: var(--series-1); border-radius: 999px; }
.meter.warning > div { background: var(--status-warning); }
.meter.critical > div { background: var(--status-critical); }
.meter-legend { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); }

/* charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted-ink); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .s-ok { fill: var(--series-1); }
.chart .s-err { fill: var(--status-critical); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .col-hover, .chart .col-hover { pointer-events: none; }
.chart .hover-band { fill: var(--surface-3); opacity: 0; }
.chart .hover-band.on { opacity: .8; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; flex-wrap: wrap; }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.sw.ok { background: var(--series-1); }
.sw.err { background: var(--status-critical); }
.toolbar .grow { flex: 1; }
.badge svg.icon { width: 12px; height: 12px; }
.tooltip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 140px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg);
  padding: 8px 10px; font-size: 12.5px; color: var(--text);
}
.tooltip .tt-title { font-weight: 600; margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.tooltip .tt-row span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }

.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: 10px; align-items: center; font-size: 13px; }
.hbar .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.hbar .barline { display: flex; align-items: center; gap: 8px; }
.hbar .bar { height: 14px; border-radius: 0 4px 4px 0; background: var(--series-1); min-width: 2px; }
.hbar .v { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; font-size: 12.5px; }

details.table-view { margin-top: 10px; }
details.table-view summary { cursor: pointer; font-size: 12.5px; color: var(--text-3); }

/* kv list */
.kv { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 8px 16px; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; word-break: break-all; display: flex; gap: 8px; align-items: center; }

/* --------------------------------------------------------- modal & toast */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(10, 14, 22, .55);
  display: grid; place-items: center; padding: 20px; animation: fade .12s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}
.modal.wide { width: min(1100px, 100%); height: calc(100vh - 40px); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 15px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 16px; overflow: auto; flex: 1; }
.modal-body.flush { padding: 0; display: flex; }
.modal-body iframe { border: 0; width: 100%; height: 100%; flex: 1; background: #525659; border-radius: 0 0 14px 14px; }
.modal-body img.preview { max-width: 100%; display: block; margin: 0 auto; }
.picker-list { display: flex; flex-direction: column; gap: 4px; }
.picker-list button {
  display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; background: transparent; border-radius: 8px; text-align: left; cursor: pointer;
}
.picker-list button:hover { background: var(--surface-3); }
.picker-list .d { font-size: 12px; color: var(--text-3); }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px;
  background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg); font-size: 13.5px; animation: rise .18s ease-out;
}
.toast.err { background: var(--danger); color: #fff; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.loading-block { height: 120px; }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .runner { grid-template-columns: 1fr; }
  .grid-2, .grid-even { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; left: 0; top: 0; width: 272px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 50; background: rgba(10, 14, 22, .45); }
  .icon-btn.menu-btn { display: inline-grid; }
  .topbar { padding: 10px 16px; }
  .content { padding: 8px 16px 40px; }
  .banner { margin: 0 16px 4px; }
  .search kbd { display: none; }
  .search input { padding-right: 12px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  .tool-grid { grid-template-columns: 1fr; }
  .page-head .actions { margin-left: 0; }
  .tool-head { flex-wrap: wrap; gap: 12px; }
  .tool-head > div:not(.tile) { flex: 1; min-width: 0; }
  .tool-head h1 { font-size: 21px; }
  .tool-head .fav { margin-left: 0; order: 3; width: 100%; justify-content: flex-start; padding: 0; height: 30px; }
  .result .ractions { width: 100%; }
}

/* ------------------------------------------------------------------ login */
.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: var(--surface); }
.login-art {
  position: relative; overflow: hidden; padding: 48px; color: #fff; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(1200px 600px at -10% -10%, #3c6df0 0%, transparent 60%), radial-gradient(900px 600px at 110% 110%, #0f9bb3 0%, transparent 55%), #0d1b3d;
}
.login-art .brand { color: #fff; padding: 0; }
.login-art .brand-sub { color: rgba(255, 255, 255, .7); }
.login-art h2 { font-size: 34px; line-height: 1.15; letter-spacing: -.02em; margin: 0 0 14px; max-width: 520px; }
.login-art p { color: rgba(255, 255, 255, .78); max-width: 480px; font-size: 15px; margin: 0; }
.login-art ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.login-art li { display: flex; gap: 10px; align-items: center; color: rgba(255, 255, 255, .88); }
.login-art li .icon { color: #8fb3ff; }
.login-art .foot { font-size: 12.5px; color: rgba(255, 255, 255, .55); }
.login-panel { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.login-card { width: min(400px, 100%); }
.login-card h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: -.02em; }
.login-card .lead { color: var(--text-2); margin: 0 0 24px; }
.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; height: 46px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 15px; box-shadow: var(--shadow-sm); cursor: pointer;
}
.google-btn:hover { background: var(--surface-2); text-decoration: none; box-shadow: var(--shadow); }
.google-btn img { width: 20px; height: 20px; }
.login-card .fine { font-size: 12.5px; color: var(--text-3); margin-top: 18px; }
.setup-wrap { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.setup-wrap > summary { cursor: pointer; color: var(--text-2); font-weight: 600; font-size: 13px; }
.setup-wrap .form { margin-top: 12px; }
.setup-wrap code, .help code { font-family: var(--mono); font-size: 12px; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
.steps { display: flex; flex-direction: column; gap: 16px; }
.step-card { position: relative; padding-left: 60px; }
.step-num {
  position: absolute; left: 18px; top: 18px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--brand-soft); color: var(--brand);
}
.step-card.done .step-num { background: var(--ok-soft); color: var(--ok); }
.status-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.drop-xml { border: 2px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 18px; text-align: center; cursor: pointer; background: var(--surface-2); }
.drop-xml.over { border-color: var(--brand); background: var(--brand-soft); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12px; margin: 20px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
@media (max-width: 860px) {
  .login-page { grid-template-columns: 1fr; }
  .login-art { display: none; }
}
