:root {
  --bg: #14110f;
  --panel: #1d1916;
  --line: #322a24;
  --text: #e8e0d6;
  --muted: #9a8f82;
  --accent: #c0392b;
  --accent-dim: #7a2a22;
  --edited: #e0b341;
  --warn: #c98a2b;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

#app { height: 100%; }

/* --- drop zone --- */
.dropzone {
  height: 100%;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: 2px dashed transparent;
  transition: background 0.12s, border-color 0.12s;
}
.dropzone.over { background: #1c1714; border-color: var(--accent); }
.drop-inner { text-align: center; max-width: 34rem; padding: 2rem; }
.drop-inner h1 { color: var(--accent); margin: 0 0 0.5rem; letter-spacing: 0.04em; }
.fineprint { color: var(--muted); font-size: 0.85rem; }
.error { color: var(--accent); }
code {
  background: var(--panel);
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  border: 1px solid var(--line);
}

/* --- editor --- */
.editor { height: 100%; display: flex; flex-direction: column; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.toolbar .file { flex: 0 0 auto; }
.toolbar .filters { display: flex; gap: 0.5rem; margin-left: auto; }
.toolbar .actions { display: flex; gap: 0.5rem; }

.muted { color: var(--muted); }

select, input[type="search"], .qty-input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  font: inherit;
}
input[type="search"] { min-width: 16rem; }

button {
  font: inherit;
  border-radius: 4px;
  border: 1px solid var(--line);
  padding: 0.35rem 0.8rem;
  cursor: pointer;
  background: #2a221d;
  color: var(--text);
}
button:disabled { opacity: 0.4; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); }
button.primary:disabled { background: var(--accent-dim); border-color: var(--accent-dim); }
button.secondary { background: #2a221d; }

.banner { padding: 0.5rem 1rem; font-size: 0.9rem; }
.banner.warn { background: #2a2110; color: var(--warn); border-bottom: 1px solid var(--line); }

/* --- table --- */
.table-wrap { flex: 1; overflow: auto; }
table.items { width: 100%; border-collapse: collapse; }
table.items thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  color: var(--muted);
  text-align: left;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--line);
  z-index: 1;
}
table.items td { padding: 0.3rem 0.75rem; border-bottom: 1px solid #221d19; }
table.items tbody tr:hover { background: #1b1613; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }
.notes { color: var(--muted); }

.qty {
  background: transparent;
  border: 1px solid transparent;
  padding: 0.1rem 0.4rem;
  color: var(--text);
  font: inherit;
  text-align: right;
  width: 100%;
}
.qty:hover { border-color: var(--line); }
.qty.edited { color: var(--edited); font-weight: 700; }
.qty-input { width: 8rem; text-align: right; }

.empty { color: var(--muted); padding: 1.5rem; text-align: center; }

/* --- modal --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: grid;
  place-items: center;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  min-width: 26rem;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.modal h2 { margin: 0 0 0.75rem; color: var(--accent); }
.review-list { overflow: auto; margin-bottom: 0.75rem; }
.review-list table { width: 100%; border-collapse: collapse; }
.review-list td { padding: 0.2rem 0.5rem; }
.review-list .rname { width: 60%; }
.review-list .arrow { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.85rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.5rem; }
