:root {
  --bg: #0f1115;
  --card: #171a21;
  --border: #2a2e38;
  --text: #e8e9ec;
  --muted: #9aa0ac;
  --accent: #f4b942;
  --accent-2: #4ade80;
  --danger: #ff6b6b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 16px;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
}

h1 {
  font-size: 1.4rem;
  margin-bottom: 4px;
}

.subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

form.search-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 2px;
  display: block;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0d0f13;
  color: var(--text);
  font-size: 1rem;
}

input[type="text"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.row2 {
  display: flex;
  gap: 10px;
}
.row2 > div { flex: 1; }

button {
  margin-top: 6px;
  padding: 12px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #1a1a1a;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}
button:active { opacity: 0.85; }

.error {
  background: #3a1d1d;
  border: 1px solid #6b2b2b;
  color: #ffb4b4;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.card-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 18px;
}

.card-header img {
  width: 110px;
  border-radius: 6px;
  flex-shrink: 0;
  background: #0d0f13;
}

.card-header .meta h2 {
  margin: 0 0 4px 0;
  font-size: 1.1rem;
}
.card-header .meta .set {
  color: var(--muted);
  font-size: 0.85rem;
}
.card-header .meta a {
  color: var(--accent);
  font-size: 0.8rem;
  text-decoration: none;
}

h3.section-title {
  font-size: 0.95rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 22px 0 8px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-size: 0.88rem;
}

th, td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
}

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

.total-value { font-weight: 600; }
.none { color: var(--muted); font-style: italic; }

.info-icon {
  display: inline-block;
  margin-left: 4px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
  line-height: 15px;
  cursor: help;
  vertical-align: middle;
}

.sales-stats {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 2px 0 8px 0;
}
.sales-stats strong { color: var(--text); }

.diff-pos { color: var(--danger); font-size: 0.82rem; }
.diff-neg { color: var(--accent-2); font-size: 0.82rem; }

.recency-fresh { color: var(--accent-2); }
.recency-month { color: var(--accent); }
.recency-stale { color: var(--danger); }

.sales-block { margin-bottom: 16px; }
.sales-block h4 {
  margin: 0 0 6px 0;
  font-size: 0.85rem;
  color: var(--text);
}

.candidate-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.candidate {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  text-decoration: none;
  color: var(--text);
}
.candidate img {
  width: 60px;
  border-radius: 4px;
  background: #0d0f13;
}
.candidate .name { font-weight: 600; font-size: 0.92rem; }
.candidate .set { color: var(--muted); font-size: 0.8rem; }

.back-link {
  display: inline-block;
  margin-top: 18px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

@media (max-width: 480px) {
  .row2 { flex-direction: column; }
  .card-header img { width: 90px; }
}

select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0d0f13;
  color: var(--text);
  font-size: 1rem;
}
label.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  color: var(--text);
  padding: 10px 0;
}
label.check input { width: 20px; height: 20px; }

.back-link.top {
  margin-top: 0;
  margin-bottom: 14px;
}

.notice {
  background: #1d2a3a;
  border: 1px solid #2b4a6b;
  color: #bcd9f5;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

/* --- Added for the login/logout feature (append to static/style.css) --- */

/* 1) Password field: find your existing rule that starts with
      input[type="text"] {
   and change that selector line to:
      input[type="text"],
      input[type="password"] {
   (keeps the same properties, so the password box matches the text boxes). */

/* 2) New rules: */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.topbar .back-link { margin: 0; }
.logout-link {
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
}
.logout-link:hover { color: var(--text); }
.sort-bar { margin-bottom: 12px; }
.sort-bar label { display: block; margin-bottom: 4px; }
.candidate .info { flex: 1; min-width: 0; }
.candidate .price {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent-2);
  white-space: nowrap;
}
.printing-bar { margin-bottom: 12px; }
.printing-bar label { display: block; margin-bottom: 4px; }
.printing-bar button { margin-top: 8px; }

/* Price-source toggle: full width like the tables, split into two halves. */
.source-toggle {
  display: flex;
  width: 100%;
  margin: 18px 0 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card);
}
.source-toggle a {
  flex: 1;
  text-align: center;
  padding: 11px 0;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}
.source-toggle a + a { border-left: 1px solid var(--border); }
.source-toggle a.active { background: var(--accent); color: #1a1a1a; }
.notice a { color: var(--accent); }
.ext-link { color: var(--accent); text-decoration: none; margin-left: 4px; }

/* Per-condition links to eBay's sold listings (eBay view, where recent sales would be). */
.sold-links {
  margin: 8px 0 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.sold-links a {
  display: flex;
  justify-content: space-between;
  padding: 11px 12px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.sold-links a:last-child { border-bottom: none; }
.sold-links .go { color: var(--accent); }

/* Printing choice on the search form: radio buttons shown as a two-column grid of buttons. */
.option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
label.option-btn {
  position: relative;
  display: block;
  margin: 0;
  font-size: 1rem;
  color: var(--text);
}
label.option-btn input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
label.option-btn span {
  display: block;
  text-align: center;
  padding: 11px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0d0f13;
  cursor: pointer;
}
label.option-btn input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1a1a;
  font-weight: 600;
}
label.option-btn input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
