:root {
  --fg: #1a1a1a;
  --muted: #6b7280;
  --bg: #f7f7f8;
  --card: #ffffff;
  --border: #e5e7eb;
  --accent: #2E86AB;
  --accent-hover: #246a8a;
  --danger: #b91c1c;
  --success: #166534;
  --warn: #92400e;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
  font-size: 14px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 600; font-size: 16px; }
.topbar nav a {
  margin-left: 16px;
  color: var(--accent);
  text-decoration: none;
}
.topbar nav a:hover { text-decoration: underline; }

main { max-width: 1100px; margin: 0 auto; padding: 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 8px 0; font-size: 18px; }
.card h3 { font-size: 14px; margin: 16px 0 6px; color: var(--muted); }

.flashes { max-width: 1100px; margin: 8px auto 0; padding: 0 16px; }
.flash {
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
}
.flash-success { background: #ecfdf5; border-color: #a7f3d0; color: var(--success); }
.flash-error { background: #fef2f2; border-color: #fecaca; color: var(--danger); }

.row-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}
.row-form label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--muted);
  gap: 4px;
}
.row-form label.grow { flex: 1 1 200px; }
.row-form label.grow2 { flex: 2 1 320px; }
.row-form input,
.row-form select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--fg);
  background: white;
}
button, .button, .button-ghost {
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  text-decoration: none;
  display: inline-block;
}
button:hover, .button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.danger { background: var(--danger); border-color: var(--danger); }
button.ghost, .button-ghost { background: white; color: var(--accent); }
button.ghost:hover, .button-ghost:hover { background: #eef6fb; }

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
form.inline { display: inline-block; margin: 0; }
form.inline select { padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data td, table.data th { overflow-wrap: anywhere; word-break: break-word; }
table.data td.url { max-width: 320px; }
table.data td.url a { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
table.data td.actions { white-space: nowrap; width: 1%; }
table.data th, table.data td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data thead th { background: #f3f4f6; font-weight: 600; }
table.data tr.disabled { color: var(--muted); }
table.data .desc {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.4;
  max-width: 600px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  vertical-align: middle;
  margin-left: 6px;
  font-weight: 600;
}
.badge.ok { background: #dcfce7; color: var(--success); }
.badge.err { background: #fee2e2; color: var(--danger); }
.muted { color: var(--muted); display: block; margin-top: 2px; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
small { font-size: 11px; }

.card.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.stacked { display: flex; flex-direction: column; gap: 10px; }
.stacked label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: var(--muted);
}
.stacked input {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px; color: var(--fg); background: white;
}
.stacked button { align-self: flex-start; margin-top: 4px; }
.nav-spacer { display: inline-block; width: 16px; }
dl.kv { margin: 0; }
dl.kv dt { color: var(--muted); font-size: 12px; }
dl.kv dd { margin: 0 0 8px 0; }
