@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Blogfabrik colours: slate neutrals with one brick-red accent, as on blogfabrik.ch. */
:root {
  --bg: #f3f5f7;
  --surface: #fbfcfd;
  --surface-2: #eef1f4;
  --border: #dde3e9;
  --text: #16202a;
  --muted: #4f5d6a;
  --accent: #b8471f;
  --accent-hover: #933713;
  --accent-soft: #f5e4dc;
  --accent-ink: #fff8f4;
  --ok: #1d7a46;
  --ok-soft: #e4f4ea;
  --warn: #8a5a00;
  --warn-soft: #fdf3dc;
  --bad: #b42318;
  --bad-soft: #fde8e6;
  --info: #1f5fa8;
  --info-soft: #e5eefa;
  --google-link: #1a0dab;
  --google-url: #4d5156;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(16 24 20 / 6%), 0 4px 16px rgb(16 24 20 / 6%);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1318;
    --surface: #172029;
    --surface-2: #1d2833;
    --border: #2a3642;
    --text: #e7ecf1;
    --muted: #a5b1bd;
    --accent: #ec8a62;
    --accent-hover: #f4aa8b;
    --accent-soft: #33221a;
    --accent-ink: #170e09;
    --ok: #7fc8a2;
    --ok-soft: #142820;
    --warn: #f0b84a;
    --warn-soft: #362b14;
    --bad: #ff8a80;
    --bad-soft: #3a1c1a;
    --info: #8ab8f0;
    --info-soft: #1b2738;
    --google-link: #99c3ff;
    --google-url: #bdc1c6;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5em; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 4px; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 8px; padding: 8px 14px;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, transform 80ms ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 1px; border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn.secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover:not(:disabled) { background: var(--accent-soft); }
.btn.danger { color: var(--bad); }
.btn.ghost.danger:hover:not(:disabled) { background: var(--bad-soft); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.large { padding: 10px 28px; font-size: 16px; }

/* Pills */
.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill.small { font-size: 12px; padding: 1px 8px; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.neutral { background: var(--surface-2); color: var(--muted); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px; padding: 10px 20px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; border-radius: 10px; }
.brand:hover strong { color: var(--accent); }
.brand > div { display: flex; flex-direction: column; line-height: 1.2; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.brand-mark svg { width: 100%; height: 100%; }
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* Account menu: who is signed in, connections, website, sign out, delete. */
.account { position: relative; }
.account-button { display: inline-flex; align-items: center; gap: 6px; }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.chevron { font-size: 11px; color: var(--muted); }
.account-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 20;
  width: min(300px, calc(100vw - 24px)); padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 32px rgb(0 0 0 / 18%); transform-origin: top right;
}
.account-menu:not([hidden]) { animation: menu-in 0.16s cubic-bezier(0.23, 1, 0.32, 1); }
@keyframes menu-in { from { opacity: 0; transform: scale(0.97) translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .account-menu:not([hidden]) { animation: none; } }
.menu-who { margin: 6px 8px 8px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.menu-section { padding: 6px 0; border-top: 1px solid var(--border); }
.menu-label { margin: 2px 8px 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.menu-pills { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 8px 6px; }
.menu-item { display: block; width: 100%; padding: 8px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: 14px; text-align: left; text-decoration: none; cursor: pointer; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.menu-item.danger { color: var(--bad); }
/* On phones "Sign out" stays in the account menu, so the bar keeps to one line. */
@media (max-width: 640px) { .topbar-logout { display: none; } }

/* DE / EN switch: two small segments, the active language filled. */
.lang-switch { display: inline-flex; padding: 2px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); }
.lang-switch button {
  min-width: 34px; padding: 4px 9px; border: 0; border-radius: 999px; background: transparent;
  color: var(--muted); font: inherit; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; cursor: pointer;
}
.lang-switch button:hover { color: var(--text); }
.lang-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(22 32 42 / 0.12); }
.lang-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.login-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.login-foot { margin: 22px 0 0; text-align: center; font-size: 14px; }
.login-foot a { color: var(--muted); text-decoration: none; }
.login-foot a:hover { color: var(--accent); }

.job-banner {
  position: sticky; top: 55px; z-index: 9;
  display: flex; align-items: center; gap: 10px; padding: 10px 20px;
  background: var(--info-soft); color: var(--info); font-weight: 600;
}
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* Layout */
.layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 20px; padding: 20px; max-width: 1500px; margin: 0 auto; }
.sidebar { display: flex; flex-direction: column; gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-head h2 { font-size: 16px; margin: 0; }
.post-list, .news-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.post-item {
  display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left;
  background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 8px 10px;
  font: inherit; color: inherit; cursor: pointer;
}
.post-item:hover { background: var(--surface-2); }
.post-item.active { background: var(--accent-soft); border-color: var(--accent); }
.post-item-title { font-weight: 600; }
.post-item-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.news-item { border-top: 1px solid var(--border); padding-top: 8px; }
.news-item:first-child { border-top: 0; padding-top: 0; }
.news-item a { font-weight: 600; color: var(--text); text-decoration: none; }
.news-item a:hover { text-decoration: underline; }
.news-item p { margin: 2px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.angle { font-style: italic; }

.main { min-width: 0; }
.post { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.back { margin: -4px 0 8px -10px; }
.link-title { padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.link-title:hover { color: var(--accent); }

/* Overview: one tile per post, like the cards on the site's blog page. */
.overview { display: flex; flex-direction: column; gap: 28px; }
.overview-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.overview-head h1 { margin: 0; font-size: 26px; }
.overview-head p { margin: 4px 0 0; }
.tile-group h2 { margin: 0 0 12px; font-size: 17px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.tiles-empty { grid-column: 1 / -1; margin: 0; padding: 22px; border: 1px dashed var(--border); border-radius: 12px; color: var(--muted); text-align: center; }
.tile { display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.tile-img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-2); }
.tile-noimg { display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.tile-body { display: flex; flex: 1; flex-direction: column; gap: 8px; padding: 14px 16px; }
.tile-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.tile-title { margin: 0; font-size: 16px; line-height: 1.35; }
.tile-excerpt { display: -webkit-box; margin: 0; overflow: hidden; color: var(--muted); font-size: 14px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.tile-date { margin: auto 0 0; padding-top: 4px; }
.tile-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 16px 16px; }
.tile-actions .btn { justify-content: center; text-align: center; text-decoration: none; }

/* A slight 3D tilt towards the pointer, with a soft sheen (app.js sets --rx, --ry, --mx, --my).
   Only with a mouse, and not when the system asks for reduced motion. */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .tile {
    position: relative;
    transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0px));
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.3s ease;
  }
  .tile.tilting {
    --lift: -3px;
    transition: transform 0.12s linear, box-shadow 0.3s ease;
    box-shadow: 0 2px 4px rgb(16 24 20 / 6%), 0 16px 32px -12px rgb(16 24 20 / 22%);
  }
  .tile::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), rgb(255 255 255 / 16%), transparent 45%);
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  .tile.tilting::after { opacity: 1; }
}
@media (prefers-color-scheme: dark) {
  .tile::after { background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), rgb(255 255 255 / 6%), transparent 45%); }
}
.post-head { padding: 20px 24px 8px; }
.post-head h1 { font-size: 26px; margin-top: 8px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 10px; }
.targets { display: flex; flex-wrap: wrap; gap: 14px; border: 0; padding: 0; margin: 0 0 8px; }
.targets legend { padding: 0; margin-bottom: 4px; }
.target-option { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.target-option input { width: auto; }

.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.alert > p { margin: 0; }
.alert > p + p { margin-top: 4px; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.info { background: var(--info-soft); color: var(--info); }

/* Tabs */
.tabs { display: flex; gap: 4px; padding: 0 24px; border-bottom: 1px solid var(--border); }
.tabs [role="tab"] {
  background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px;
  font: inherit; font-weight: 600; color: var(--muted); cursor: pointer;
}
.tabs [role="tab"][aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.score-chip { font-size: 12px; border-radius: 999px; padding: 1px 7px; margin-left: 4px; }
.score-chip.ok { background: var(--ok-soft); color: var(--ok); }
.score-chip.warn { background: var(--warn-soft); color: var(--warn); }
.tab { padding: 24px; }

/* Google snippet */
.snippet { max-width: 640px; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 24px; font-family: Arial, sans-serif; }
.snippet p { margin: 0; }
.snippet-label { margin-bottom: 6px !important; font-family: inherit; }
.snippet-url { color: var(--google-url); font-size: 14px; }
.snippet-title { color: var(--google-link); font-size: 20px; line-height: 1.3; margin: 2px 0 !important; }
.snippet-desc { color: var(--google-url); font-size: 14px; }

/* Article preview: approximates the blog, with generous type for older readers */
.hero { display: block; width: 100%; max-width: 760px; max-height: 380px; object-fit: cover; border-radius: var(--radius); margin: 0 auto 20px; }
.article { max-width: 760px; margin: 0 auto; font-size: 18px; line-height: 1.7; }
.article.compact { font-size: 15px; }
.article h1 { font-size: 32px; }
.article h2 { font-size: 1.4em; margin-top: 1.6em; }
.article h3 { font-size: 1.15em; margin-top: 1.3em; }
.article table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 0.9em; }
.article th, .article td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.article th { background: var(--surface-2); }
.article blockquote { margin: 1.2em 0; padding: 12px 16px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; }
.article blockquote p { margin: 0; }
.article .ft-summary { background: var(--surface-2); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 1.4em; }
.article .ft-summary p { margin: 0 0 6px; }
.article .ft-summary ul { margin: 0; }
.article .ft-toc { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 18px; margin-bottom: 1.4em; font-size: 0.9em; }
.article .ft-toc p { margin: 0 0 4px; }
.article .ft-toc ol { margin: 0; }
.article .ft-meta { color: var(--muted); font-size: 0.85em; margin-top: 2em; }

/* Edit tab */
.edit-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.edit-fields { display: flex; flex-direction: column; gap: 16px; }
.edit-preview { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 160px); overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 0; min-width: 0; }
.field > span, .field > legend { font-weight: 600; font-size: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input, textarea, select {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}
textarea { resize: vertical; }
.body-editor { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; line-height: 1.6; min-height: 420px; }
.prefixed { display: flex; align-items: center; gap: 4px; }
.counter { font-weight: 600; color: var(--ok); margin-left: 4px; }
.counter.off { color: var(--warn); }
.toolbar { display: flex; flex-wrap: wrap; gap: 4px; }
.repeat { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.repeat-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.repeat-row { display: grid; gap: 6px; align-items: start; }
.repeat-row.faq { grid-template-columns: 1fr; }
.repeat-row.source { grid-template-columns: 1.2fr 1.6fr 0.8fr auto; }
.thumb { max-width: 220px; border-radius: 8px; }
.savebar {
  grid-column: 1 / -1; position: sticky; bottom: 0;
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  background: var(--surface); border-top: 1px solid var(--border); padding: 12px 0;
}
.savebar #save-state { margin-right: auto; }

/* Checks tab */
.scores { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 16px; }
.score { border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; align-items: center; }
.score-value { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.score-label { font-size: 13px; font-weight: 600; }
.score.ok { background: var(--ok-soft); color: var(--ok); }
.score.warn { background: var(--warn-soft); color: var(--warn); }
.score.bad { background: var(--bad-soft); color: var(--bad); }
.score.neutral { background: var(--surface-2); color: var(--muted); }
.check-actions { margin-bottom: 8px; }
.check-group h3 { font-size: 15px; margin: 20px 0 8px; }
.check-group ul, .test-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.check p { margin: 2px 0 0; overflow-wrap: anywhere; }
.check-icon { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-weight: 800; font-size: 13px; }
.check.pass .check-icon { background: var(--ok-soft); color: var(--ok); }
.check.warn .check-icon { background: var(--warn-soft); color: var(--warn); }
.check.fail .check-icon { background: var(--bad-soft); color: var(--bad); }
.research { margin-top: 20px; }
.research summary { cursor: pointer; font-weight: 600; }
.research pre { white-space: pre-wrap; font-size: 13px; background: var(--surface-2); padding: 12px; border-radius: 8px; max-height: 400px; overflow: auto; }

/* Dialogs and toast */
.dialog { border: 0; border-radius: 14px; padding: 24px; width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgb(0 0 0 / 25%); }
.dialog::backdrop { background: rgb(10 16 13 / 45%); }
.dialog form { display: flex; flex-direction: column; gap: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 20; max-width: min(460px, calc(100vw - 40px));
  padding: 12px 16px; border-radius: 10px; font-weight: 600; box-shadow: 0 8px 30px rgb(0 0 0 / 18%);
  background: var(--surface); border: 1px solid var(--border); overflow-wrap: anywhere;
}
.toast.ok { background: var(--ok-soft); color: var(--ok); }
.toast.error { background: var(--bad-soft); color: var(--bad); }

/* Automatic-publishing switch */
.switch-row { display: flex; align-items: flex-start; gap: 10px; margin: 6px 0 10px; cursor: pointer; font-size: 14px; }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { flex: none; position: relative; width: 38px; height: 22px; margin-top: 2px; border-radius: 999px; background: var(--border); transition: background-color 150ms ease; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 25%); transition: transform 150ms ease; }
.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { transform: translateX(16px); }
.switch-row input:focus-visible + .switch { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .switch, .switch::after { transition: none; } }
#topics-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 0; }

/* Topics view */
.topics-view { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 24px; }
.topics-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.topics-head p { margin: 0; }
.topic-block { margin-top: 24px; }
.topic-block h2 { font-size: 17px; margin-bottom: 4px; }
.topic-block summary { cursor: pointer; font-weight: 600; }
.topic-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.topic-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; }
.topic-row.suggestion { background: var(--info-soft); border-color: transparent; }
.topic-main { min-width: 0; }
.topic-main p { margin: 4px 0 0; }
.topic-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.topic-actions { display: flex; flex-wrap: wrap; gap: 4px; flex: none; }
.topic-edit { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; width: 100%; align-items: center; }
.topic-edit .topic-actions { grid-column: 1 / -1; }
.add-topic { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.add-topic-fields { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; margin: 8px 0 12px; }

/* Sign-in page */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.login-card .alert { margin: 0; }
.login-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 22px; padding: 4px; border-radius: 10px; background: var(--surface-2); }
.login-tabs button { padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.login-tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(22 32 42 / 0.12); }
.login-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
#login-notice { margin-top: 16px; }
.login-form { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.login-form[hidden] { display: none; }
.step-label { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.login-title { margin: 0; font-size: 18px; }
.login-form p { margin: 0; }
.qr { align-self: center; width: 200px; height: 200px; border-radius: 8px; border: 1px solid var(--border); background: #fff; }
.setup-key { font-size: 15px; letter-spacing: 0.06em; word-break: break-all; }
.login-links { display: flex; justify-content: space-between; gap: 12px; }
.link-button { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.account-email { margin: 0; font-weight: 600; }
.danger-zone { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--border); }
.danger-zone h3 { margin: 0; font-size: 16px; color: var(--bad); }
.danger-zone p { margin: 0; }
.btn.primary.danger-fill { background: var(--bad); color: var(--surface); }
.btn.primary.danger-fill:hover:not(:disabled) { background: color-mix(in srgb, var(--bad) 85%, black); }

@media (max-width: 1100px) {
  .edit-grid { grid-template-columns: 1fr; }
  .edit-preview { position: static; max-height: none; }
}
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; padding: 12px; }
  /* Phones and tablets upright: the tiles or the open post first, the side panels below. The
     post list of the side panel would only repeat the tiles. */
  .main { order: -1; }
  .sidebar .post-list { display: none; }
  .overview-head h1 { font-size: 22px; }
  .topbar { padding: 10px 16px; }
  .post-head, .tab { padding-left: 16px; padding-right: 16px; }
  .tabs { padding: 0 8px; overflow-x: auto; }
  .field-row, .repeat-row.source, .topic-edit, .add-topic-fields { grid-template-columns: 1fr; }
  .topic-row { flex-direction: column; }
  .topics-view { padding: 16px; }
}
