/* Local Vault — precision-instrument design system.
   Palette is fixed: bg #0B0D0F, panels #14171B / #1A1E23, hairlines #262B31,
   text #E9ECEF, muted #8B939C, brass #C9A45C (hover #D8B36B),
   success #6FBF8B (sparingly), error #D97066. Flat fills only. */

@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/instrument-serif-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/inter-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/inter-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/inter-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
}

:root {
  --bg: #0B0D0F;
  --panel: #14171B;
  --panel-2: #1A1E23;
  --line: #262B31;
  --text: #E9ECEF;
  --muted: #8B939C;
  --brass: #C9A45C;
  --brass-hover: #D8B36B;
  --ok: #6FBF8B;
  --err: #D97066;
  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --sidebar-w: 280px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--brass); color: var(--bg); }

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 20;
  padding: 8px 14px;
  background: var(--brass);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
}
.skip-link:focus { left: 8px; top: 8px; }

.micro {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Shell ---------- */

.shell { min-height: 100vh; }

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

.stage {
  margin-left: var(--sidebar-w);
  padding: 48px 40px 96px;
  max-width: calc(var(--sidebar-w) + 980px + 80px);
}
.stage-inner { max-width: 980px; }

/* ---------- Brand ---------- */

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--line);
}
.brand-dial { flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: 0.01em;
}
.brand-sub {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 3px;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.nav-toggle:hover { border-color: var(--brass); }

/* ---------- Nav ---------- */

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 20px;
}
.nav-group { margin-bottom: 18px; }
.nav-group-label {
  display: block;
  padding: 8px 10px 6px;
}
.nav a {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 9px 10px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid transparent;
}
.nav a:hover { background: var(--panel-2); }
.nav a[aria-current="page"] {
  background: var(--panel-2);
  border-color: var(--line);
  border-left: 2px solid var(--brass);
  padding-left: 9px;
}
.nav a svg { flex: none; margin-top: 2px; color: var(--muted); }
.nav a[aria-current="page"] svg { color: var(--brass); }
.nav-item-name { display: block; font-size: 13.5px; font-weight: 500; line-height: 1.3; }
.nav-item-desc { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.35; margin-top: 1px; }

/* ---------- Trust meter ---------- */

.trust {
  border-top: 1px solid var(--line);
  background: var(--panel-2);
  padding: 14px 20px 16px;
}
.trust-row { display: flex; align-items: center; gap: 9px; }
.trust-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  flex: none;
  animation: trust-pulse 3s ease-in-out infinite;
}
.trust-dot.is-alert { background: var(--err); animation: none; }
@keyframes trust-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
.trust-bytes {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.trust-req {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 6px 0 8px;
}
.trust-note {
  font-size: 11.5px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

/* ---------- Tool page ---------- */

.tool-head { margin-bottom: 28px; }
.tool-title {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0.005em;
  margin-bottom: 10px;
}
.tool-desc { color: var(--muted); font-size: 14.5px; max-width: 62ch; }

.tool-note {
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--brass);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  max-width: 70ch;
}

/* ---------- Drop zone ---------- */

.dropzone {
  border: 1.5px dashed var(--line);
  background: var(--panel);
  padding: 44px 24px;
  text-align: center;
  cursor: pointer;
  width: 100%;
  color: var(--text);
  font-family: var(--sans);
  display: block;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--brass); }
.dropzone.is-over { background: var(--panel-2); }
.dropzone-icon { color: var(--muted); margin-bottom: 12px; }
.dropzone:hover .dropzone-icon, .dropzone.is-over .dropzone-icon { color: var(--brass); }
.dropzone-line { font-size: 14.5px; }
.dropzone-line b { font-weight: 500; color: var(--brass); }
.dropzone-hint {
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- File queue ---------- */

.queue { margin-top: 18px; border: 1px solid var(--line); }
.queue:empty { display: none; }
.queue-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.queue-row:last-child { border-bottom: none; }
.queue-row.is-dragging { opacity: 0.35; }
.queue-row.is-drop-target { box-shadow: inset 0 2px 0 var(--brass); }
.queue-grip {
  color: var(--muted);
  cursor: grab;
  flex: none;
  display: flex;
  background: none;
  border: none;
  padding: 4px 2px;
}
.queue-grip:hover { color: var(--brass); }
.queue-index {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  width: 22px;
  text-align: right;
  flex: none;
  font-variant-numeric: tabular-nums;
}
.queue-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
}
.queue-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  flex: none;
  font-variant-numeric: tabular-nums;
}
.queue-btn {
  flex: none;
  background: none;
  border: 1px solid transparent;
  color: var(--muted);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.queue-btn:hover { color: var(--text); border-color: var(--line); }
.queue-btn.remove:hover { color: var(--err); }

/* ---------- Controls bar ---------- */

.controls {
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.controls .spacer { flex: 1; }

.field { display: flex; align-items: center; gap: 10px; }
.field-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.field input[type="text"], .field input[type="number"], .field select {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  padding: 7px 10px;
  min-width: 0;
}
.field input[type="text"] { width: 150px; }
.field input[type="number"] { width: 90px; }
.field input:hover, .field select:hover { border-color: var(--muted); }
.field input[aria-invalid="true"] { border-color: var(--err); }
.field select { cursor: pointer; appearance: none; padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238B939C' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}

.field input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 140px;
  height: 18px;
  background: transparent;
  cursor: pointer;
}
.field input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--line);
}
.field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--brass);
  border: none;
  margin-top: -6px;
}
.field input[type="range"]::-webkit-slider-thumb:hover { background: var(--brass-hover); }
.field input[type="range"]::-moz-range-track { height: 2px; background: var(--line); }
.field input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--brass); border: none;
}
.field-value {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  min-width: 42px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Buttons ---------- */

.btn-primary {
  background: var(--brass);
  color: var(--bg);
  border: none;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  padding: 11px 22px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary:hover:not(:disabled) { background: var(--brass-hover); }
.btn-primary:disabled { background: var(--panel-2); color: var(--muted); cursor: not-allowed; border: 1px solid var(--line); }

.btn-ghost {
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-ghost:hover { border-color: var(--brass); color: var(--brass); }

/* ---------- Status / progress ---------- */

.status {
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.status:empty { display: none; }
.status.is-error { color: var(--err); }
.status.is-done { color: var(--ok); }

/* ---------- Results ---------- */

.results { margin-top: 26px; }
.results:empty { display: none; }
.results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
}
.results-list { border: 1px solid var(--line); }
.result-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.result-row:last-child { border-bottom: none; }
.result-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
}
.result-sizes {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  flex: none;
  font-variant-numeric: tabular-nums;
}
.result-sizes .arrow { padding: 0 5px; }
.result-sizes .after { color: var(--text); }
.result-delta { font-family: var(--mono); font-size: 12px; flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.result-row.is-error .result-sizes, .result-row.is-error .result-name { color: var(--err); }

.btn-download {
  flex: none;
  background: none;
  border: 1px solid var(--line);
  color: var(--brass);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 7px 13px;
  cursor: pointer;
  text-decoration: none;
}
.btn-download:hover { border-color: var(--brass); color: var(--brass-hover); }

/* ---------- Page grid (organize) ---------- */

.page-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
}
.page-card {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 10px 10px 8px;
  cursor: grab;
  position: relative;
}
.page-card:hover { border-color: var(--muted); }
.page-card.is-dragging { opacity: 0.35; }
.page-card.is-drop-target { border-color: var(--brass); }
.page-card:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.page-thumb-wrap {
  background: var(--bg);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 170px;
  overflow: hidden;
}
.page-thumb-wrap canvas { max-width: 100%; max-height: 100%; }
.page-card.is-deleted .page-thumb-wrap { opacity: 0.25; }
.page-card.is-deleted .page-thumb-wrap::after { content: ''; }
.page-deleted-tag {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--err);
  border: 1px solid var(--err);
  padding: 4px 8px;
  background: var(--panel);
}
.page-card.is-deleted .page-deleted-tag { display: block; }
.page-card-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
}
.page-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  flex: 1;
  font-variant-numeric: tabular-nums;
}
.page-act {
  background: none;
  border: 1px solid transparent;
  color: var(--muted);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.page-act:hover { color: var(--text); border-color: var(--line); }
.page-act.delete:hover { color: var(--err); }

/* ---------- Empty state ---------- */

.empty-hint { margin-top: 14px; color: var(--muted); font-size: 13px; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .stage { margin-left: 0; padding: 28px 18px 72px; }
  .nav-toggle { display: flex; }
  .nav { display: none; padding-top: 4px; }
  .nav.is-open { display: block; }
  .trust { padding: 12px 20px; }
  .tool-title { font-size: 32px; }
  .controls { align-items: stretch; flex-direction: column; }
  .controls .spacer { display: none; }
  .btn-primary { width: 100%; }
  .field { justify-content: space-between; }
}
