:root {
  --ink: #13201c;
  --muted: #5c6f68;
  --paper: #f3f0e8;
  --panel: rgba(255, 252, 245, 0.92);
  --line: rgba(19, 32, 28, 0.12);
  --accent: #c45c26;
  --accent-soft: #f0d5c4;
  --ok: #1f7a4c;
  --warn: #b07a12;
  --bad: #a33b2c;
  --maybe: #2f6f8f;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Outfit", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--sans);
  background: var(--paper);
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, #d9e8df 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, #ead7c8 0%, transparent 50%),
    linear-gradient(rgba(19, 32, 28, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(19, 32, 28, 0.04) 1px, transparent 1px);
  background-size: auto, auto, 28px 28px, 28px 28px;
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.hero {
  margin-bottom: 1.75rem;
  animation: rise 0.6s ease both;
}

.brand {
  margin: 0 0 0.35rem;
  font-family: var(--display);
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
}

.hero h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--muted);
}

.lede {
  margin: 0.55rem 0 0;
  max-width: 34rem;
  color: var(--ink);
  font-size: 1.05rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.15rem 1.25rem 1.25rem;
  backdrop-filter: blur(8px);
  box-shadow: 0 18px 40px rgba(19, 32, 28, 0.06);
  animation: rise 0.7s ease both;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.panel-head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.92rem;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}

textarea,
input[type="search"],
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf8;
  color: var(--ink);
  font: 500 0.95rem/1.5 var(--mono);
  padding: 0.85rem 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

textarea:focus,
input[type="search"]:focus,
select:focus {
  border-color: rgba(196, 92, 38, 0.55);
  box-shadow: 0 0 0 3px rgba(196, 92, 38, 0.15);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  font: 600 0.92rem/1 var(--sans);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s, border-color 0.2s, opacity 0.2s;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--ink);
  color: #f7f3ea;
}

.btn.primary:hover:not(:disabled) {
  background: #1d312a;
}

.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn.ghost:hover:not(:disabled) {
  background: rgba(19, 32, 28, 0.04);
}

.file-btn {
  display: inline-flex;
  align-items: center;
}

.hint {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  margin: 1rem 0;
  animation: rise 0.5s ease both;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem 1rem;
}

.stat .n {
  display: block;
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;
}

.stat .l {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.stat.accent {
  border-color: rgba(196, 92, 38, 0.35);
  background: linear-gradient(160deg, #fff8f2, #fffdf8);
}

.stat.accent .n {
  color: var(--accent);
}

.filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filters select,
.filters input {
  width: auto;
  min-width: 140px;
  padding: 0.55rem 0.75rem;
  font-family: var(--sans);
  font-size: 0.88rem;
}

.table-wrap {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: #fffdf8;
}

th,
td {
  padding: 0.7rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #efe9dc;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

td.bin {
  font-family: var(--mono);
  font-weight: 500;
  white-space: nowrap;
}

td.note {
  max-width: 280px;
  color: var(--muted);
  font-size: 0.82rem;
}

tbody tr {
  animation: faderow 0.35s ease both;
}

tbody tr:hover {
  background: rgba(196, 92, 38, 0.04);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge.ok {
  color: var(--ok);
  background: rgba(31, 122, 76, 0.1);
  border-color: rgba(31, 122, 76, 0.2);
}

.badge.maybe {
  color: var(--maybe);
  background: rgba(47, 111, 143, 0.1);
  border-color: rgba(47, 111, 143, 0.2);
}

.badge.warn {
  color: var(--warn);
  background: rgba(176, 122, 18, 0.12);
  border-color: rgba(176, 122, 18, 0.22);
}

.badge.bad {
  color: var(--bad);
  background: rgba(163, 59, 44, 0.1);
  border-color: rgba(163, 59, 44, 0.2);
}

.badge.muted {
  color: var(--muted);
  background: rgba(19, 32, 28, 0.06);
}

.stars {
  display: inline-block;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
  line-height: 1;
}

.stars.s5 { color: #c45c26; }
.stars.s4 { color: #b07a12; }
.stars.s3 { color: #2f6f8f; }
.stars.s2 { color: #6b7280; }
.stars.s1,
.stars.s0 { color: #9aa3a0; }

.status {
  min-height: 1.4rem;
  margin-top: 0.9rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.status.error {
  color: var(--bad);
}

.status.busy::before {
  content: "";
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  margin-right: 0.45rem;
  border-radius: 50%;
  border: 2px solid var(--accent);
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
  vertical-align: -1px;
}

footer {
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.82rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes faderow {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 800px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .brand {
    font-size: 2.2rem;
  }
}
