:root {
  --bg: #f4f5f1;
  --surface: #ffffff;
  --ink: #1c231e;
  --ink-soft: #4b5249;
  --muted: #7c8377;
  --line: #dfe1d8;
  --accent: #2e6a5e;
  --accent-soft: #e4efec;
  --danger: #b0483a;
  --danger-soft: #f7e6e2;
  --gold: #a97729;
  --gold-soft: #f3e6cf;
  --warn: #a5761f;
  --warn-soft: #f1e6d0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181a;
    --surface: #1c2224;
    --ink: #e8eae4;
    --ink-soft: #b9c0b2;
    --muted: #838c7c;
    --line: #333b34;
    --accent: #5fa391;
    --accent-soft: #223530;
    --danger: #d97e68;
    --danger-soft: #3a2521;
    --gold: #d3a257;
    --gold-soft: #3a2f19;
    --warn: #d3a257;
    --warn-soft: #362c17;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic Medium", "Noto Sans JP", sans-serif;
  line-height: 1.7;
}

a { color: var(--accent); }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand { font-weight: 700; text-decoration: none; color: var(--ink); }
.nav { display: flex; gap: 18px; font-size: 14px; }
.nav a { text-decoration: none; color: var(--ink-soft); }
.nav a:hover { color: var(--accent); }

.container { max-width: 1000px; margin: 0 auto; padding: 32px 20px 80px; }

h1 { font-size: 24px; margin: 0 0 20px; }
h2 { font-size: 17px; margin: 0 0 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 24px;
}

.muted { color: var(--muted); font-size: 14px; }

.keyword-form .field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.keyword-form label { font-size: 13px; color: var(--ink-soft); }
.keyword-form input[type="text"],
.keyword-form input[type="number"],
.keyword-form input[type="password"],
.keyword-form textarea {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
}
.keyword-form textarea { resize: vertical; }
.field-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: end; }
.field-row .field { flex: 1; min-width: 160px; }

.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tab-button {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 8px 4px; margin-bottom: -1px; font-size: 14px; color: var(--muted); cursor: pointer;
}
.tab-button.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel + .tab-panel { margin-top: 0; }

.checkbox-group { display: flex; gap: 16px; flex-wrap: wrap; }
.checkbox { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); }

button, .button-secondary {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 5px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}
.button-secondary {
  background: transparent;
  color: var(--accent);
}
.link-button {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}
.link-button.danger { color: var(--danger); }

.inline-form { display: inline; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table-wrap { overflow-x: auto; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .03em; }
tr.row-inactive { opacity: .55; }
.actions { display: flex; gap: 10px; align-items: center; white-space: nowrap; }
.nowrap { white-space: nowrap; }

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 4px;
}
.badge-on { background: var(--accent-soft); color: var(--accent); }
.badge-off { background: var(--line); color: var(--muted); }
.badge-error { background: var(--danger-soft); color: var(--danger); }

.verdict-badge { font-weight: 600; }
.verdict-badge.verdict-buy { background: var(--gold-soft); color: var(--gold); }
.verdict-badge.verdict-consider { background: var(--warn-soft); color: var(--warn); }
.verdict-badge.verdict-skip { background: var(--line); color: var(--muted); }
.verdict-badge.verdict-insufficient_data { background: var(--line); color: var(--muted); }
.listing-card.verdict-buy { border-color: var(--gold); border-width: 2px; }

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  margin: 0 4px 4px 0;
}

.notice { padding: 10px 14px; border-radius: 6px; font-size: 14px; margin-bottom: 16px; }
.notice-ok { background: var(--accent-soft); color: var(--accent); }
.notice-error { background: var(--danger-soft); color: var(--danger); }

.status-list { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }

.listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.listing-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
}
.listing-card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--bg); }
.listing-noimage {
  width: 100%; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--muted); font-size: 12px;
}
.listing-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.listing-badges { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.listing-title { font-size: 13px; margin: 4px 0; line-height: 1.5; }
.listing-price { font-weight: 700; margin: 0; font-variant-numeric: tabular-nums; }
.listing-market { font-size: 12px; margin: 0; color: var(--ink-soft); }
.diff-cheap { color: var(--gold); }
.diff-expensive { color: var(--danger); }
.listing-meta { font-size: 11px; color: var(--muted); margin: 0; }

.gpu-panel {
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 2px 0;
}
.gpu-title { font-size: 12px; font-weight: 700; color: var(--accent); margin: 0 0 2px; }
.gpu-specs { font-size: 11px; margin: 0; font-variant-numeric: tabular-nums; color: var(--ink); }
.gpu-note { font-size: 11px; margin: 4px 0 0; color: var(--ink-soft); }

.login-box {
  max-width: 340px;
  margin: 80px auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
}
.login-box form { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.error { color: var(--danger); font-size: 14px; }

code {
  background: var(--accent-soft);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.9em;
}
