/* ============================================================
   工具箱 Toolbox — design system
   anchor: utility shelf / file-cabinet (Vercel Geist × macOS 设置)
   bg #FAFAF9 · ink #1C1917 · accent #C2410C
   ============================================================ */

:root {
  --bg: #FAFAF9;
  --surface: #FFFFFF;
  --surface-2: #F5F5F4;
  --ink: #1C1917;
  --ink-2: #44403C;
  --muted: #78716C;
  --border: #E7E5E4;
  --border-strong: #D6D3D1;
  --accent: #C2410C;
  --accent-hover: #9A3412;
  --accent-soft: #FFF7ED;
  --accent-line: #FED7AA;
  --success: #15803D;
  --success-soft: #F0FDF4;
  --danger: #B91C1C;
  --danger-soft: #FEF2F2;
  --shadow: 0 1px 2px rgba(28, 25, 23, .05), 0 8px 24px -12px rgba(28, 25, 23, .12);
  --shadow-lift: 0 2px 4px rgba(28, 25, 23, .06), 0 16px 32px -16px rgba(28, 25, 23, .18);
  --radius: 10px;
  --radius-sm: 7px;
  --sidebar-w: 264px;
  --topbar-h: 52px;
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", "SF Mono", Consolas, "Courier New", monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

::selection { background: var(--accent-line); color: var(--ink); }

/* ---------- layout ---------- */

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink-2);
  letter-spacing: .01em;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-email {
  flex: 1;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.topbar-home {
  font-size: 12.5px;
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  transition: all .15s var(--ease);
}
.topbar-home:hover {
  color: var(--ink);
  border-color: var(--border-strong);
  background: var(--surface);
}

.menu-btn {
  display: none;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

.content {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 28px 72px;
  outline: none;
}

/* ---------- sidebar ---------- */

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 9px;
  border: 1px solid var(--accent-line);
}

.brand-name {
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: .02em;
}

.sidebar-close {
  display: none;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
}
.sidebar-close:hover { background: var(--surface-2); color: var(--ink); }

.sidebar-search {
  padding: 10px 14px 6px;
}

.sidebar-search input {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 13px;
  outline: none;
  transition: all .15s var(--ease);
}
.sidebar-search input::placeholder { color: var(--muted); }
.sidebar-search input:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 16px;
}

.nav-group { margin-bottom: 14px; }

.nav-group-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--ink-2);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 13px;
  opacity: .85;
}
.nav-item .nav-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-empty {
  padding: 12px 10px;
  color: var(--muted);
  font-size: 12.5px;
}

.sidebar-foot {
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--muted);
}

.sidebar-mask {
  display: none;
}

/* ---------- home ---------- */

.hero {
  margin-bottom: 36px;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  padding: 4px 11px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.2;
  letter-spacing: -.02em;
  font-weight: 750;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero p {
  margin: 0;
  max-width: 560px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.section { margin-bottom: 36px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.section-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.section-head .section-count {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 14px;
}

.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
  overflow: hidden;
}
.tool-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity .18s var(--ease);
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
  border-color: var(--border-strong);
}
.tool-card:hover::before { opacity: 1; }
.tool-card:active { transform: translateY(0); }

.tool-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  flex: none;
}
.tool-card:hover .tool-card-icon {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.tool-card h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -.01em;
}

.tool-card p {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
}

.tool-card-tag {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 5px;
  padding: 2px 7px;
  margin-top: 4px;
}

/* ---------- favorites ---------- */

.fav-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, background .15s, transform .15s;
}
.fav-btn:hover {
  background: var(--surface-2);
  color: #d97706;
  transform: scale(1.12);
}
.fav-btn.active {
  color: #d97706;
}

.fav-btn-lg {
  position: static;
  width: auto;
  height: auto;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  margin-top: 4px;
}
.fav-btn-lg:hover {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: #d97706;
  transform: none;
}
.fav-btn-lg.active {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #b45309;
}

.fav-empty {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}
.fav-empty > span {
  font-size: 26px;
  color: #d97706;
  flex: none;
}
.fav-empty strong { color: #d97706; }

.fav-clear {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.fav-clear:hover {
  color: var(--danger, #dc2626);
  background: var(--surface-2);
}

/* ---------- tool page ---------- */

.tool-page { max-width: 820px; }

.tool-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 18px;
  transition: color .12s;
}
.tool-breadcrumb:hover { color: var(--accent); }

.tool-header {
  margin-bottom: 24px;
}

.tool-header-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.tool-header-icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  flex: none;
}

.tool-header h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 720;
  letter-spacing: -.02em;
  line-height: 1.25;
}

.tool-header .tool-desc {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 640px;
}

/* ---------- panels ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.panel-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}

/* ---------- dropzone ---------- */

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 168px;
  padding: 28px 20px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  text-align: center;
  transition: all .18s var(--ease);
}
.dropzone:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
  transform: scale(1.005);
}
.dropzone.has-file {
  border-style: solid;
  border-color: var(--border);
  background: var(--surface);
  cursor: default;
  min-height: auto;
  padding: 16px 18px;
  flex-direction: row;
  align-items: center;
  text-align: left;
  gap: 14px;
}

.dropzone-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 20px;
  box-shadow: var(--shadow);
}
.dropzone.has-file .dropzone-icon { box-shadow: none; }

.dropzone-title {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--ink);
}
.dropzone.has-file .dropzone-title {
  font-family: var(--mono);
  font-size: 13px;
  word-break: break-all;
}

.dropzone-hint {
  font-size: 12.5px;
  color: var(--muted);
}
.dropzone.has-file .dropzone-hint { font-family: var(--mono); font-size: 12px; }

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}
.dropzone.has-file input[type="file"] { display: none; }

.dropzone-clear {
  position: relative;
  z-index: 2;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  margin-left: auto;
  flex: none;
  transition: all .12s;
}
.dropzone-clear:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }

/* multi-file list */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.file-row-icon {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 14px;
  flex: none;
}
.file-row-meta { flex: 1; min-width: 0; }
.file-row-name {
  font-family: var(--mono);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-row-size {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.file-row-remove {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 5px;
  flex: none;
}
.file-row-remove:hover { color: var(--danger); background: var(--danger-soft); }
.file-row-order {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: none;
}
.file-row-order button {
  border: 1px solid var(--border);
  background: var(--surface);
  width: 22px;
  height: 18px;
  border-radius: 4px;
  font-size: 9px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 0;
}
.file-row-order button:hover { color: var(--ink); border-color: var(--border-strong); }

/* ---------- controls ---------- */

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  align-items: flex-end;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
}

.control label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}

.control .control-note {
  font-size: 11.5px;
  color: var(--muted);
}

select.control-input,
input.control-input[type="text"],
input.control-input[type="number"],
input.control-input[type="password"] {
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13.5px;
  outline: none;
  transition: all .15s var(--ease);
  min-width: 160px;
}
select.control-input:focus,
input.control-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2.5px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow);
  cursor: grab;
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2.5px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent);
  cursor: grab;
}

.range-value {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  min-width: 44px;
  text-align: right;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.checkbox-row input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

/* ---------- buttons ---------- */

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s var(--ease);
  background: var(--surface-2);
  color: var(--ink);
  white-space: nowrap;
}
.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 1px 2px rgba(194, 65, 12, .3);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--ink-2);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.btn-danger-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--muted);
}
.btn-danger-ghost:hover:not(:disabled) {
  color: var(--danger);
  border-color: var(--danger);
  background: var(--danger-soft);
}

.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; }

/* ---------- results ---------- */

.result {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  margin-bottom: 16px;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.result-head h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.result-body { padding: 18px; }

.result-empty {
  padding: 36px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* size compare bar */
.size-compare { margin-bottom: 4px; }

.size-compare-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
  font-family: var(--mono);
  font-size: 12px;
}
.size-compare-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-2);
}
.size-compare-legend .dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex: none;
}
.dot-before { background: var(--border-strong); }
.dot-after { background: var(--accent); }

.size-bar {
  display: flex;
  height: 26px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.size-bar-before {
  background: repeating-linear-gradient(
    -45deg,
    var(--border-strong),
    var(--border-strong) 5px,
    var(--border) 5px,
    var(--border) 10px
  );
  transition: width .5s var(--ease);
  min-width: 0;
}
.size-bar-after {
  background: var(--accent);
  transition: width .5s var(--ease);
  min-width: 0;
}

.size-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 14px;
}
.size-stat { display: flex; flex-direction: column; gap: 2px; }
.size-stat .stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}
.size-stat .stat-value {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 650;
}
.size-stat.is-good .stat-value { color: var(--success); }
.size-stat.is-bad .stat-value { color: var(--danger); }

.badge-saved {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid #BBF7D0;
}
.badge-saved.bad {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #FECACA;
}

/* result file rows */
.result-files {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.result-file {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.result-file-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  display: grid;
  place-items: center;
  font-size: 16px;
  flex: none;
}
.result-file-meta { flex: 1; min-width: 0; }
.result-file-name {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-file-sub {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}
.result-file-sub .delta-good { color: var(--success); font-weight: 600; }
.result-file-sub .delta-bad { color: var(--danger); font-weight: 600; }

/* textarea result */
.text-result {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink);
  outline: none;
}
.text-result:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

/* table result */
.result-table-wrap { overflow-x: auto; }
.result-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12.5px;
}
.result-table th, .result-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
.result-table th {
  background: var(--surface-2);
  font-weight: 650;
  color: var(--ink-2);
  position: sticky;
  top: 0;
}
.result-table tr:last-child td { border-bottom: none; }
.result-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* progress */
.progress {
  height: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 14px;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .25s var(--ease);
  width: 0%;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 6px;
}

/* status line */
.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
  min-height: 20px;
}
.status-line.ok { color: var(--success); }
.status-line.err { color: var(--danger); }
.status-line .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* preview img */
.img-preview {
  max-width: 100%;
  max-height: 280px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background:
    repeating-conic-gradient(#f0f0f0 0% 25%, #fff 0% 50%) 0 0 / 16px 16px;
  display: block;
}

.preview-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.preview-cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.preview-cell .preview-label {
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}
.preview-stage {
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

/* ---------- empty / error states ---------- */

.empty-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}
.empty-state .empty-icon { font-size: 32px; margin-bottom: 10px; }
.empty-state p { margin: 0; font-size: 13.5px; }

/* ---------- toast ---------- */

.toast-host {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--ink);
  color: #FAFAF9;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-lift);
  animation: toast-in .25s var(--ease);
  max-width: min(90vw, 420px);
  text-align: center;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--success); }
.toast.out { animation: toast-out .2s var(--ease) forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(6px) scale(.97); }
}

/* ---------- misc ---------- */

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

.kbd {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--ink-2);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
  border: none;
}

.hint-box {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.6;
}
.hint-box strong { color: var(--accent); }

/* code block inline */
.code-inline {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .topbar-email { display: none; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s var(--ease);
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(0,0,0,.15);
  }
  .sidebar-close { display: block; }
  .main-wrap { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .sidebar-mask {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(28, 25, 23, .35);
    z-index: 35;
    backdrop-filter: blur(2px);
  }
  .sidebar-mask[hidden] { display: none; }
  .content { padding: 22px 16px 64px; }
  .preview-pair { grid-template-columns: 1fr; }
  .controls { flex-direction: column; align-items: stretch; }
  .control, .control-input, select.control-input { min-width: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
