:root {
  color-scheme: light dark;
  --bg: #f4f6f8;
  --card: #fff;
  --text: #1a1a1a;
  --muted: #5a6570;
  --accent: #0b5fff;
  --border: #d8dee4;
  --error: #b42318;
  --offline-row-bg: #ede7f6;
  --sortable-hover-bg: #eef2f7;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121417;
    --card: #1c2128;
    --text: #e6edf3;
    --muted: #9da7b3;
    --border: #30363d;
    --offline-row-bg: #211a2e;
    --sortable-hover-bg: #222830;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Segoe UI, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.card {
  max-width: 720px;
  margin: 4rem auto;
  padding: 2rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.card.narrow { max-width: 420px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.topbar nav a { margin-right: 1rem; }

.content {
  max-width: 1440px;
  margin: 1.5rem auto;
  padding: 0 1.25rem 2rem;
}

h1 { margin-top: 0; font-size: 1.5rem; }

.meta { color: var(--muted); font-size: 0.92rem; }

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

label {
  display: block;
  margin-bottom: 1rem;
}

input, textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

button, .button {
  display: inline-block;
  padding: 0.55rem 1rem;
  border: 0;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
}

.link-button {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
}

/* Long unbreakable values (HWID hash, tokens) wrap inside their cell instead
   of forcing the table wider than its container and clipping on the right. */
.table-scroll {
  overflow-x: auto;
}

th, td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
  word-break: normal;
}

td.machine, td.hwid {
  word-break: break-all;
}

th {
  background: var(--bg);
  white-space: nowrap;
}

td button, td .btn {
  white-space: nowrap;
}

code {
  font-family: Consolas, monospace;
  font-size: 0.88em;
}

.release-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
}

.seats-panel {
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.seats-title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.seats-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
}

.seats-field {
  margin: 0;
  min-width: 8rem;
  max-width: 10rem;
}

.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--border);
}

.tab-btn {
  padding: 0.6rem 1.25rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.filter-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
  align-items: flex-end;
}

.filter-row label {
  margin: 0;
  flex: 1;
  max-width: 20rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.settings-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  margin: 1rem 0;
}

.settings-panel label {
  display: block;
  margin: 0.75rem 0;
}

.settings-panel input,
.settings-panel select {
  width: 100%;
  max-width: 480px;
}

.settings-panel h2,
.settings-panel h3 {
  margin-top: 0;
}

.method-label {
  display: block;
  margin: 0.75rem 0 0.4rem;
  font-weight: 600;
}

.method-toggle {
  display: inline-flex;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid var(--accent);
}

.method-option {
  padding: 0.35rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--card);
  color: var(--text);
  transition: background 0.15s, color 0.15s;
  user-select: none;
}

.method-option.active {
  background: var(--accent);
  color: #fff;
}

th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th.sortable:hover {
  background: var(--sortable-hover-bg);
}
th.sort-asc::after {
  content: ' \25B2';
  font-size: 0.7em;
}
th.sort-desc::after {
  content: ' \25BC';
  font-size: 0.7em;
}

tr.offline-row {
  background: var(--offline-row-bg);
}
