:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4d;
  --text: #e7edf4;
  --muted: #8b9cb3;
  --accent: #3d8bfd;
  --accent-hover: #5c9fff;
  --danger: #f85149;
  --ok: #3fb950;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.wrap {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 1.25rem 0 0.75rem;
}

label {
  display: block;
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 8rem;
  resize: vertical;
}

.field {
  margin-bottom: 1rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost:hover {
  border-color: var(--muted);
}

.btn-danger {
  background: rgba(248, 81, 73, 0.12);
  border-color: rgba(248, 81, 73, 0.45);
  color: #ff8b87;
}
.btn-danger:hover {
  background: rgba(248, 81, 73, 0.22);
  border-color: var(--danger);
  color: #ffc9c7;
}

.error {
  color: var(--danger);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

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

th {
  color: var(--muted);
  font-weight: 500;
}

.stat {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.8rem;
}
.stat-ok {
  background: rgba(63, 185, 80, 0.15);
  color: var(--ok);
}
.stat-used {
  background: rgba(248, 81, 73, 0.12);
  color: #ff8b87;
}

.option-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.option-list li {
  margin-bottom: 0.5rem;
}

.option-list label,
.option-label-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--text);
}

.option-list input {
  margin-top: 0.35rem;
}

.option-item {
  margin-bottom: 1rem;
}

.option-item:last-child {
  margin-bottom: 0;
}

.option-context {
  margin: 0.35rem 0 0 1.75rem;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.45;
  white-space: pre-wrap;
}

header.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.link-cell {
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
}

.copy-btn {
  flex-shrink: 0;
}

.option-rows {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.option-pair {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.option-pair-fields {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.option-label-inline {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.option-label-input,
.option-context-input {
  width: 100%;
}

.option-context-input {
  min-height: 3.5rem;
  resize: vertical;
}

.option-pair .remove-option {
  flex-shrink: 0;
  align-self: flex-start;
  padding: 0.35rem 0.55rem;
  line-height: 1;
}

.option-pair .remove-option:disabled {
  cursor: not-allowed;
}
