:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c1f24;
  --muted: #646b75;
  --border: #dde1e6;
  --accent: #c4302b;
  --accent-text: #ffffff;
  --link: #1a5fb4;
  --ok: #1e7a3c;
  --warn: #9a6200;
  --err: #b42318;
  --notice-bg: #fff4d6;
  --flash-bg: #e5f4ea;
  --radius: 8px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1c1f24;
    --text: #e7e9ec;
    --muted: #9aa1ab;
    --border: #30353d;
    --accent: #e0524c;
    --link: #79a8ff;
    --ok: #5cc27e;
    --warn: #e0a640;
    --err: #ff7b6e;
    --notice-bg: #3a2f12;
    --flash-bg: #173322;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--link); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.top form { margin: 0; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; }

main { max-width: 1100px; margin: 0 auto; padding: 16px; }
section { margin-bottom: 32px; }
h1 { font-size: 1.5rem; margin: 0 0 12px; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  max-width: 720px;
}
.card.narrow { max-width: 400px; margin: 48px auto; }
.card.danger { border-color: color-mix(in srgb, var(--err) 40%, var(--border)); }

.heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.heading h1 { margin: 0; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-top: 12px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
tr.disabled td { opacity: 0.6; }
.nowrap { white-space: nowrap; }

.url { display: flex; gap: 6px; align-items: center; min-width: 280px; }
.url input { flex: 1; min-width: 0; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }

input:not([type="checkbox"]) {
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.field.invalid input { border-color: var(--err); }
.check { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; }

button, .button {
  display: inline-block;
  padding: 8px 16px;
  font: inherit;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}
button.small { padding: 6px 10px; font-size: 0.85rem; }
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
button.danger { background: var(--err); }
button.link { background: none; color: var(--link); padding: 0; font-weight: 400; }
.actions { display: flex; gap: 16px; align-items: center; }

.muted, .hint { color: var(--muted); }
.hint, .error { font-size: 0.85rem; margin: 4px 0 0; }
.error { color: var(--err); }
.flash, .notice { padding: 10px 14px; border-radius: var(--radius); }
.flash { background: var(--flash-bg); }
.notice { background: var(--notice-bg); }

.tag { font-size: 0.75rem; padding: 1px 6px; border: 1px solid var(--border); border-radius: 4px; color: var(--muted); }
.outcome { font-weight: 600; }
.outcome.posted, .outcome.dry_run { color: var(--ok); }
.outcome.cooldown, .outcome.no_stream, .outcome.no_match { color: var(--warn); }
.outcome.error { color: var(--err); }

.card.account { max-width: none; }
.card.account p { margin: 0 0 12px; }
.actions form { margin: 0; }
a.button.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); font-weight: 600; }

code.key { font-size: 1rem; letter-spacing: 0.05em; }
.key-url { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.1rem; overflow-wrap: anywhere; margin: 0 0 8px; }
.key-url strong { font-size: 1.5rem; letter-spacing: 0.08em; }

.would-post { margin-bottom: 16px; }
.would-post p { margin: 0 0 8px; }
blockquote.comment {
  margin: 0 0 6px;
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  background: var(--bg);
  border-radius: 0 6px 6px 0;
  white-space: pre-wrap;
}
tr.chosen td { background: color-mix(in srgb, var(--ok) 10%, transparent); }
form.inline { display: inline; margin: 0; }
.outcome.queued { color: var(--ok); }
.outcome.pending { color: var(--warn); }
.outcome.expired, .outcome.failed { color: var(--err); }
.outcome.cancelled { color: var(--muted); }
fieldset.group { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px 0; margin: 0 0 16px; }
fieldset.group legend { font-weight: 600; padding: 0 6px; }
