:root {
  --bg: #fafaf8;
  --fg: #1f1f1d;
  --muted: #6b6b66;
  --line: #e2e1dc;
  --card: #ffffff;
  --accent: #2f5d50;
  --accent-fg: #ffffff;
  --alert: #9b2c2c;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615;
    --fg: #ecebe6;
    --muted: #a09f99;
    --line: #2e2e2b;
    --card: #1e1e1c;
    --accent: #7fb8a4;
    --accent-fg: #10201b;
    --alert: #f08a8a;
  }
}

* { box-sizing: border-box; }

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

header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

header nav { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
header form { display: inline; }

main { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; }

a { color: var(--accent); }
.brand { color: var(--fg); font-weight: 600; text-decoration: none; }
.muted { color: var(--muted); }

h1 { font-size: 1.5rem; margin: 0 0 16px; }
h2 { font-size: 1.1rem; margin: 32px 0 8px; }

.flash { padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--card); }
.flash.alert { border-color: var(--alert); }

button, .button, input[type=submit] {
  display: inline-block;
  font: inherit;
  padding: 8px 16px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-fg);
  cursor: pointer;
  text-decoration: none;
}

button.link {
  padding: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
}

button.danger { background: none; color: var(--alert); padding: 0; text-decoration: underline; }

label { display: block; margin: 16px 0 4px; font-weight: 500; }
input[type=text], input[type=email], input[type=url], textarea {
  width: 100%;
  font: inherit;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--fg);
}
fieldset { border: 0; padding: 0; margin: 16px 0; }
fieldset label { display: inline-flex; gap: 6px; margin: 4px 16px 4px 0; font-weight: normal; }
.actions { margin-top: 24px; display: flex; gap: 16px; align-items: center; }
.errors { color: var(--alert); }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 500; color: var(--muted); }
td.check, th.check { text-align: center; }
td form { display: inline; }

.apps { list-style: none; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.apps a {
  display: block;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--fg);
  text-decoration: none;
  font-weight: 500;
}
.apps a:hover { border-color: var(--accent); }

code, .secret { font-family: ui-monospace, Menlo, monospace; font-size: 0.9em; overflow-wrap: anywhere; }
pre.secret { padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 6px; white-space: pre-wrap; }
