:root {
  --bg: #1c1a17;
  --surface: #242119;
  --surface-alt: #2b2720;
  --border: #3c362c;
  --text: #ede6da;
  --text-muted: #a79c8a;
  --gold: #c9a227;
  --rust: #b5533c;
  --verdigris: #5a9c86;

  --font-display: 'Zilla Slab', Georgia, serif;
  --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  padding: 2rem clamp(1rem, 4vw, 3rem) 4rem;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}

h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.6rem;
  margin: 0 0 0.25rem;
  letter-spacing: 0.01em;
}

a { color: var(--verdigris); }
a:hover { color: var(--gold); }

/* --- nav --- */

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.4rem;
  padding-bottom: 0.9rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.site-nav a {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-muted);
  text-decoration: none;
}

.site-nav a:hover { color: var(--text); }
.site-nav a.current { color: var(--gold); }

/* --- status header --- */

.statusbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.statusbar-sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.statusbar-meta {
  display: flex;
  gap: 2rem;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}

/* --- notices --- */

.notice {
  background: var(--surface);
  border-left: 3px solid var(--gold);
  padding: 0.75rem 1rem;
  border-radius: 3px;
  color: var(--text);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.notice-error { border-left-color: var(--rust); }

/* --- controls --- */

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1rem;
}

#filter-name {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: 3px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  min-width: 14rem;
}

#filter-skill {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: 3px;
  font-family: var(--font-body);
  font-size: 0.85rem;
}

#filter-name:focus,
input:focus-visible,
button:focus-visible,
th.sortable:focus-visible {
  outline: 2px solid var(--verdigris);
  outline-offset: 2px;
}

.control-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
}

.control-chip input { accent-color: var(--verdigris); }

.row-count {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

/* --- table --- */

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

thead th {
  text-align: left;
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
  white-space: nowrap;
}

th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--text); }

th.sort-asc::after  { content: ' \2191'; }
th.sort-desc::after { content: ' \2193'; }

th.num, td.num { text-align: right; }

tbody tr {
  border-left: 3px solid transparent;
  border-bottom: 1px solid var(--border);
}

tbody tr:last-child { border-bottom: none; }

tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.015); }

tbody td {
  padding: 0.55rem 0.9rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

td.item-name { font-variant-numeric: normal; white-space: normal; }
td.muted { color: var(--text-muted); }

.row-underpriced { border-left-color: var(--gold); }
.row-shopflip     { border-left-color: var(--verdigris); }
.row-neutral      { border-left-color: transparent; }

/* --- footer --- */

.page-footer {
  margin-top: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* --- admin / login forms --- */

.login-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.login-form label { color: var(--text-muted); font-size: 0.9rem; }

input[type="password"],
input[type="number"] {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.6rem;
  border-radius: 3px;
  font-family: var(--font-body);
  font-size: 0.9rem;
}

input[type="number"] { width: 9rem; }

button {
  background: var(--verdigris);
  color: #0f1a16;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 3px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

button:hover { background: var(--gold); }

button.suggestion {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 400;
}
button.suggestion:hover { background: var(--surface-alt); color: var(--text); }

.inline-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* --- today's picks --- */

.picks { margin-bottom: 1.75rem; }

.picks-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.2rem;
}

.picks-sub {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin: 0 0 0.9rem;
  max-width: 46rem;
}

.picks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
}

.pick-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.9rem 1rem;
}

.pick-name {
  font-family: var(--font-display);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.pick-action {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
  line-height: 1.4;
}

.pick-profit {
  font-weight: 600;
  color: var(--gold);
  margin: 0;
  font-variant-numeric: tabular-nums;
}

/* --- character cards --- */

.character-card {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  background: var(--surface);
}

.stat-hero {
  font-size: 1.8rem;
  color: var(--gold);
}

.character-head h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 0.6rem;
}

.character-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.75rem;
}

.character-body {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1.5rem;
  margin-top: 1.25rem;
}

.chart-wrap {
  position: relative;
  height: 220px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.75rem;
}

.skills-table-wrap { max-height: 260px; overflow-y: auto; }
.skills-note {
  margin: 0 0 0.6rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.skills-table { width: 100%; border-collapse: collapse; }
.skills-table thead th {
  position: sticky;
  top: 0;
}
.skills-table td { padding: 0.4rem 0.9rem; }

@media (max-width: 780px) {
  .character-body { grid-template-columns: 1fr; }
}

/* --- news --- */

.news { margin: 1.75rem 0; }

.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.news-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.7rem 1rem;
  font-size: 0.88rem;
}

/* --- small screens --- */

@media (max-width: 640px) {
  body { padding: 1.25rem 1rem 3rem; }
  .statusbar { flex-direction: column; align-items: flex-start; }
  .row-count { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
