/* Blogtool dashboard.
 *
 * The product writes and publishes on a rhythm, so the interface is built
 * like the back office of a small press: a reading serif for anything the
 * tool wrote or proposes, a quiet sans for everything that operates the
 * machine, and one accent colour that always means the same thing.
 *
 * Colour rule: teal is "on" - a site that publishes, a selected option, a
 * publishing day, the focus ring. Ink is the primary action. Ochre means
 * waiting on someone, brick means something broke. Nothing else is coloured,
 * which is what keeps a page of status readable at a glance.
 *
 * Interaction rule: only things you can actually click react to the pointer,
 * and each of them changes exactly one property. No card hovers, no shadows
 * that grow, no transitions - the state you see is the state that is true.
 *
 * Hierarchy rule: what you look at daily is at the top and largest; what you
 * configure once collapses out of the way. */

:root {
  /* Surfaces - a cool mineral canvas so white cards separate without shadow. */
  --canvas:  #eef1f0;
  --surface: #ffffff;
  --sunken:  #f5f7f6;

  /* Text - one deep petrol darkened and lightened, never a neutral grey. */
  --ink:     #12292c;
  --ink-2:   #4c6266;
  --ink-3:   #7b9095;

  --rule:    #dee5e4;
  --rule-2:  #c7d1d0;

  /* Signals, held at the same weight so none shouts over the others. */
  --live:    #146a5b;
  --live-bg: #e7efec;
  --wait:    #8a5a12;
  --wait-bg: #f5efe3;
  --danger:  #9c3327;
  --danger-bg: #f7ebe9;
  --focus:   var(--live);

  --sans:  'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;

  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.5625rem;
  --step-3: 1.953rem;
  --small:  0.8125rem;

  --r-card:  10px;
  --r-field: 6px;

  --measure: 58rem;
}

*, *::before, *::after { box-sizing: border-box; }

/* The browser hides [hidden] with display:none, but that comes from the user
   agent stylesheet and any display: in here beats it. An element given
   display:grid or display:flex therefore stays on screen while the code that
   set hidden believes it is gone - which is how an empty editor appeared
   under a message explaining there was nothing to edit. */
[hidden] { display: none !important; }

/* The articles page starts one line tall and grows to twenty rows once the
   list arrives; the same happens on the dashboard the first time a site is
   drawn. With classic scrollbars (macOS with a mouse, every Windows machine)
   that growth summons the scrollbar, which narrows the viewport and nudges
   the centred top bar and page half a scrollbar to the left. The gutter is
   reserved from the start, so nothing moves when the content lands. */
html { scrollbar-gutter: stable; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 6rem;
}

/* The serif is reserved for what the tool wrote or proposes: page titles,
   article titles, topic titles. Everything operational stays sans. */
h1 {
  font-family: var(--serif);
  font-size: var(--step-3);
  font-weight: 400;
  line-height: 1.15;
  margin: 0 0 1.75rem;
  letter-spacing: -0.015em;
}

h2 {
  font-size: var(--step-1);
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 0 0 0.5rem;
}

p { margin: 0 0 0.75rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--ink); text-decoration-color: var(--rule-2); text-underline-offset: 0.15em; }
a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── Moving between pages ───────────────────────────────────────────── */

/* Es gab hier einen dokumentübergreifenden Seitenübergang. Er ist wieder
   entfernt, aus zwei gemessenen Gründen: Er hat nichts gebracht - mit und
   ohne ihn stand die alte Seite gleich lange (171 gegen 173 ms) - und er
   warf bei jeder Navigation ein unbehandeltes AbortError ("Transition was
   skipped") in die Konsole, sobald der Übergang übersprungen wurde.
   Ein reiner Schauwert, der Fehler erzeugt, ist keiner. */

/* ── Top bar ────────────────────────────────────────────────────────── */

/* Full width and fixed to the top: the account you are signed into and the
   credits you have left are true on every page, so they belong to the
   window rather than to the page. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}

.topbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0.65rem 1.5rem;
}

.brand-mark { width: 1.75rem; height: 1.75rem; display: block; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--serif);
  font-size: var(--step-1);
  letter-spacing: -0.015em;
  text-decoration: none;
  color: var(--ink);
}

/* Without min-width:0 the link row refuses to shrink and pushes the whole
   page wider than a phone screen. */
.main-nav { min-width: 0; }

.main-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 1.15rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--small);
}

.main-nav a {
  display: block;
  color: var(--ink-2);
  text-decoration: none;
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
}

.main-nav a:hover { color: var(--ink); }

.main-nav a.active {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--live);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-left: auto;
  font-size: var(--small);
}

.nav-credits {
  color: var(--ink-2);
  text-decoration: none;
  padding: 0.15rem 0.6rem;
  background: var(--sunken);
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.nav-credits:hover { color: var(--ink); }
/* Running low is worth noticing; running out is worth acting on. */
.nav-credits.low { color: var(--wait); background: var(--wait-bg); border-color: #e3d3b4; }
.nav-credits.empty { color: var(--danger); background: var(--danger-bg); border-color: #ecc9c3; }

.nav-account {
  color: var(--ink-3);
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-logout { color: var(--ink-2) !important; text-decoration: none; }
.nav-logout:hover { color: var(--ink) !important; }

@media (max-width: 46rem) {
  .topbar-inner { gap: 0.6rem 1.25rem; padding: 0.6rem 1.1rem; }
  .main-nav { width: 100%; order: 2; }
  .topbar-right { width: 100%; margin-left: 0; order: 3; }
  .nav-account { max-width: none; }
}

/* ── Sections ───────────────────────────────────────────────────────── */

/* A section is a band of the page, separated by space and a hairline -
   not another box. Boxes are for individual items you act on. */
.section { margin-bottom: 2.75rem; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--rule);
}

.section-head h2 { margin: 0; }

/* Settings collapse once they are set: they matter on day one and rarely
   again, and leaving them open is most of why the page felt crowded. */
details.fold {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  margin-bottom: 1rem;
}

details.fold > summary {
  cursor: pointer;
  list-style: none;
  font-weight: 500;
  padding: 0.7rem 1.1rem;
  color: var(--ink-2);
  border-radius: var(--r-card);
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before {
  content: "+";
  display: inline-block;
  width: 1.1em;
  color: var(--ink-3);
  font-weight: 400;
}
details.fold > summary:hover { color: var(--ink); }
details.fold[open] > summary {
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
  border-radius: var(--r-card) var(--r-card) 0 0;
}
details.fold[open] > summary::before { content: "–"; }
details.fold > .fold-body { padding: 1.1rem; }
details.fold > .fold-body > .section:last-child { margin-bottom: 0; }

/* ── Tabs ───────────────────────────────────────────────────────────── */

/* Three views of one subject, so they sit on a shared baseline rule like the
   section heads do - a row of buttons with borders would read as three
   separate things to press. */
.tabs {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--rule);
}

.tabs button {
  --btn-fg:           var(--ink-2);
  --btn-fg-hover:     var(--ink);
  --btn-bg:           transparent;
  --btn-bg-hover:     transparent;
  --btn-border:       transparent;
  --btn-border-hover: transparent;

  border-width: 0 0 2px;
  border-radius: 0;
  padding: 0.35rem 0;
  margin-bottom: -1px;
  font-size: var(--step-0);
  font-weight: 400;
}
.tabs button[aria-selected="true"] {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--live);
}

/* ── Plans ──────────────────────────────────────────────────────────── */

/* Three columns, and the plan already in use is one of them. The question on
   this screen is "what would change", and that cannot be answered by a list
   which leaves out where you are standing. */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  align-items: stretch;
}

.plan-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.1rem 1.15rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
}

/* The current plan is the reference the other two are read against, not
   another thing being offered - so it is marked, not sold. */
.plan-card.current {
  border-color: var(--live);
  background: var(--live-bg);
}

/* Present on every card, empty on most: it holds the line so that the plan
   names, the prices and the rows below them line up across all three. */
.plan-tag {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  /* Stated, not inherited: an empty span and a filled one have to occupy
     exactly the same height, or the rows below them stop lining up. */
  line-height: 1.2;
  min-height: 1.2em;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--live);
}

.plan-card h3 {
  font-family: var(--serif);
  font-size: var(--step-1);
  font-weight: 400;
  letter-spacing: -0.005em;
  margin: 0;
}

.plan-price {
  font-size: var(--step-2);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  margin: 0 0 0.35rem;
}
.plan-price .meta { font-size: var(--small); font-weight: 400; }

/* The same six rows in the same order in every column, so the eye can run
   down them. What a plan does not include stays visible and struck out -
   that difference is the whole argument for the tier above. */
.plan-rows {
  list-style: none;
  margin: 0 0 0.9rem;
  padding: 0.75rem 0 0;
  border-top: 1px solid var(--rule);
  display: grid;
  gap: 0.4rem;
  flex-grow: 1;
  align-content: start;
  font-size: var(--small);
  line-height: 1.35;
}
.plan-card.current .plan-rows { border-top-color: #d6e4df; }

.plan-rows li {
  display: grid;
  grid-template-columns: 0.9rem 1fr;
  gap: 0.45rem;
  color: var(--ink-2);
}
.plan-rows li::before {
  content: "";
  width: 0.58rem;
  height: 0.32rem;
  margin-top: 0.3rem;
  border-left: 1.5px solid var(--live);
  border-bottom: 1.5px solid var(--live);
  transform: rotate(-45deg);
}
.plan-rows li.off { color: var(--ink-3); }
.plan-rows li.off::before {
  height: 0;
  margin-top: 0.52rem;
  border-left: none;
  border-bottom: 1.5px solid var(--rule-2);
  transform: none;
}

.plan-card button { margin-top: auto; width: 100%; }
.plan-card > a.meta { margin-top: auto; padding-top: 0.45rem; }

.plan-custom { margin-top: 0.9rem; }

/* Credit packs keep the same three-column rhythm: one price, one reason. */
.pack-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
}

.pack-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
}
.pack-card h3 { font-size: var(--step-0); font-weight: 600; margin: 0; }
.pack-card .plan-price { margin: 0; }
.pack-card button { margin-top: 0.7rem; width: 100%; }

@media (max-width: 46rem) {
  .plan-grid, .pack-grid { grid-template-columns: 1fr; }
  .plan-rows { flex-grow: 0; }
}


/* Usage: a proportion, not a number. Twelve of ninety and twelve of thirty
   are the same figure and entirely different situations, and the bar is what
   makes that visible before the text is read. */
.usage-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 0.9rem 0 0;
}
.usage-row > div { flex: 1 1 12rem; }

.usage-label {
  display: block;
  font-size: var(--small);
  color: var(--ink-2);
  margin-bottom: 0.3rem;
}

.usage {
  display: block;
  height: 5px;
  border-radius: 3px;
  background: #e2e8e6;
  position: relative;
  margin-bottom: 0.35rem;
}
.usage i {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--fill, 0%);
  border-radius: 3px;
  background: var(--live);
}
/* ── Fast Indexing ──────────────────────────────────────────────────── */

/* The key file is the one thing the customer has to put somewhere, so the
   address is selectable text rather than prose someone has to retype. */
code.key {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  background: var(--sunken);
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  word-break: break-all;
}

/* Per engine, next to the article it belongs to. */
.engines { display: inline-flex; gap: 0.6rem; }
.engine {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: var(--small);
  color: var(--ink-3);
}
.engine::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.engine.done { color: var(--live); }
.engine.bad { color: var(--danger); }

/* ── Items ──────────────────────────────────────────────────────────── */

.item {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  padding: 1.05rem 1.15rem;
  margin-bottom: 0.75rem;
}
.item:last-child { margin-bottom: 0; }

.item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.item-title {
  font-family: var(--serif);
  font-size: var(--step-1);
  line-height: 1.25;
  letter-spacing: -0.005em;
}

.head-right { display: inline-flex; align-items: center; gap: 0.7rem; }

/* A quiet control: it only needs to be findable once you look for it, and it
   must not compete with the site name or its status. Quiet is not the same as
   cryptic though - it carries its own word, and on hover it gains a surface
   rather than losing its text. */
button.icon {
  --btn-fg:           var(--ink-2);
  --btn-fg-hover:     var(--ink);
  --btn-bg:           transparent;
  --btn-bg-hover:     var(--sunken);
  --btn-border:       transparent;
  --btn-border-hover: var(--rule-2);

  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  line-height: 1;
  border-radius: 999px;
}

button.icon .icon-label { font-size: var(--small); font-weight: 400; }

button.icon[aria-expanded="true"] {
  --btn-fg:     var(--ink);
  --btn-bg:     var(--sunken);
  --btn-border: var(--rule-2);
}

/* On a phone the panel is the width of the screen anyway, so the cog alone
   is enough and the row stays short. */
@media (max-width: 34rem) {
  button.icon .icon-label { display: none; }
  button.icon { padding: 0.3rem; }
}

.settings {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

.settings-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.settings-row > div { flex: 1 1 12rem; }

/* ── Calendar ───────────────────────────────────────────────────────── */

/* A month of small cells, so the rhythm is visible at a glance: tinted
   columns are the days this site publishes on. */
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-head {
  margin-bottom: 3px;
  font-size: var(--small);
  color: var(--ink-3);
}
.cal-head span { padding: 0 0.35rem; }

.cal-cell {
  min-height: 4.75rem;
  padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-field);
  font-size: var(--small);
}
.cal-cell.empty { background: none; border-color: transparent; padding: 0; }
.cal-cell.publish { background: var(--live-bg); border-color: #d6e4df; }
.cal-cell.today { border-color: var(--ink); }

.cal-day {
  display: block;
  color: var(--ink-3);
  margin-bottom: 0.25rem;
  font-variant-numeric: tabular-nums;
}
.cal-cell.today .cal-day { color: var(--ink); font-weight: 600; }

.cal-item {
  display: block;
  margin-bottom: 2px;
  padding: 0.15rem 0.35rem;
  border-left: 2px solid var(--rule-2);
  color: var(--ink-2);
  text-decoration: none;
  line-height: 1.3;
}
.cal-item.done { border-left-color: var(--live); color: var(--ink); }
.cal-item.bad { border-left-color: var(--danger); color: var(--danger); }
a.cal-item:hover { color: var(--ink); }

@media (max-width: 34rem) {
  .cal-cell { min-height: 3.4rem; font-size: 0.7rem; }
  .cal-item { padding: 0.1rem 0.2rem; }
}

/* ── Chips and tags ─────────────────────────────────────────────────── */

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.35rem 0 0.9rem; }

.chip {
  --btn-fg:           var(--ink-2);
  --btn-fg-hover:     var(--ink);
  --btn-bg:           var(--surface);
  --btn-bg-hover:     var(--surface);
  --btn-border:       var(--rule-2);
  --btn-border-hover: var(--ink-3);

  font-size: var(--small);
  font-weight: 400;
  padding: 0.32rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
}

/* Teal fills anything that is switched on, the same teal as a live site - and
   it stays teal under the pointer, because here the colour is the state. */
.chip.on {
  --btn-fg:           var(--surface);
  --btn-fg-hover:     var(--surface);
  --btn-bg:           var(--live);
  --btn-bg-hover:     #0f5a4d;
  --btn-border:       var(--live);
  --btn-border-hover: #0f5a4d;
}
.chip.small { padding: 0.28rem 0.6rem; min-width: 2.8rem; font-variant-numeric: tabular-nums; }

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0 0; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.4rem 0.25rem 0.7rem;
  background: var(--sunken);
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: var(--small);
}
.tag button, .tag button.link {
  --btn-fg:       var(--ink-3);
  --btn-fg-hover: var(--danger);

  padding: 0 0.2rem;
  line-height: 1;
  text-decoration: none;
  font-size: 1rem;
}

/* ── Meta, state ────────────────────────────────────────────────────── */

.meta {
  color: var(--ink-2);
  font-size: var(--small);
}

.muted { color: var(--ink-3); }

/* A dot carries the state faster than a word does, and the word keeps it
   readable for anyone who cannot tell the colours apart. */
.state {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--small);
  white-space: nowrap;
  color: var(--ink-2);
}
.state::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.state.live { color: var(--live); }
.state.wait { color: var(--wait); }

/* The score is a measurement, so it reads as a number with a hairline
   meter rather than a coloured pill - a pill would rank it like a status. */
.score {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: var(--small);
  color: var(--ink-2);
}
.score b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.score i {
  display: inline-block;
  width: 2.75rem;
  height: 3px;
  border-radius: 2px;
  /* Track light enough that the filled part carries the reading - at 2px
     against a mid-grey track the difference between 52 and 84 vanished. */
  background: #e2e8e6;
  position: relative;
}
.score i::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--fill, 0%);
  border-radius: 2px;
  background: var(--live);
}

/* ── Forms ──────────────────────────────────────────────────────────── */

label {
  display: block;
  margin: 0.9rem 0 0.3rem;
  font-size: var(--small);
  font-weight: 500;
  color: var(--ink-2);
}

input, textarea, select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  font: inherit;
  font-size: var(--step-0);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--r-field);
}

textarea { min-height: 6rem; resize: vertical; line-height: 1.5; }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--live-bg);
}

input[type="checkbox"], input[type="radio"] { accent-color: var(--live); }

select {
  appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6' fill='none' stroke='%234c6266' stroke-width='1.4'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 10px 6px;
}

/* Every button state is declared as variables on the element rather than as
   rules that override each other. A variant that only wanted to change its
   text colour used to keep the solid dark background of the base hover
   underneath it - dark text on a dark field, which is how the settings icon
   vanished the moment the pointer touched it. With the values on the element,
   no variant can inherit half of another variant's state. */
button {
  --btn-fg:           var(--surface);
  --btn-fg-hover:     var(--surface);
  --btn-bg:           var(--ink);
  --btn-bg-hover:     #1c3a3e;
  --btn-border:       var(--ink);
  --btn-border-hover: #1c3a3e;

  font: inherit;
  font-size: var(--small);
  font-weight: 500;
  padding: 0.48rem 0.95rem;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: var(--r-field);
  cursor: pointer;
}

button:hover {
  color: var(--btn-fg-hover);
  background: var(--btn-bg-hover);
  border-color: var(--btn-border-hover);
}

button:disabled { opacity: 0.45; cursor: default; }
/* A disabled button is not a target, so it does not answer the pointer. */
button:disabled:hover {
  color: var(--btn-fg);
  background: var(--btn-bg);
  border-color: var(--btn-border);
}

button.secondary {
  --btn-fg:           var(--ink-2);
  --btn-fg-hover:     var(--ink);
  --btn-bg:           var(--surface);
  --btn-bg-hover:     var(--sunken);
  --btn-border:       var(--rule-2);
  --btn-border-hover: var(--rule-2);
}

button.link {
  --btn-fg:           var(--ink-2);
  --btn-fg-hover:     var(--ink);
  --btn-bg:           transparent;
  --btn-bg-hover:     transparent;
  --btn-border:       transparent;
  --btn-border-hover: transparent;

  padding: 0;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

form > button { margin-top: 1.1rem; }

/* Choices read as a stack of statements, not a grid of controls: the label
   sits on the same line as the control it belongs to. */
.radio-set { display: grid; gap: 0.55rem; margin: 0.5rem 0 0; }
.radio-set label,
.pause-row label {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  margin: 0;
  font-size: var(--step-0);
  font-weight: 400;
  color: var(--ink);
  line-height: 1.4;
}
.radio-set input, .pause-row input { width: auto; margin-top: 0.3rem; }
.radio-set .meta { grid-column: 2; }

.pause-row { margin: 1.1rem 0 0; }
.pause-row + p { margin-top: 1.35rem; }

.item-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
}


/* ── Article editor ─────────────────────────────────────────────────── */

/* The editor needs more room than the reading pages: the text and the
   numbers that judge it have to be visible at the same time, or the numbers
   are useless. */
.wrap.wide { max-width: 72rem; }

.editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.editor-head h1 { margin: 0.25rem 0 0; }
.editor-actions { display: inline-flex; align-items: center; gap: 0.75rem; white-space: nowrap; }

/* A link that sits next to a button and has to read as one. Same shape as
   button.secondary, without pretending to be a button to a screen reader -
   it navigates, so it stays a link. */
.btn-link {
  display: inline-flex;
  align-items: center;
  padding: 0.48rem 0.95rem;
  font-size: var(--small);
  font-weight: 500;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--r-field);
  text-decoration: none;
}
.btn-link:hover { color: var(--ink); background: var(--sunken); }

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20rem;
  gap: 1.5rem;
  align-items: start;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 1rem 0 0;
}
.toolbar button { padding: 0.35rem 0.7rem; min-width: 2.4rem; }

/* The text itself is set in the reading serif, because that is what it is:
   an article, not a form field. */
.article-body {
  margin-top: 0.5rem;
  padding: 1.5rem 1.75rem;
  min-height: 28rem;
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--r-card);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.65;
}
.article-body:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--live-bg); }
.article-body h2 { font-family: var(--sans); font-size: var(--step-1); margin: 1.6rem 0 0.6rem; }
.article-body h3 { font-family: var(--sans); font-size: var(--step-0); font-weight: 600; margin: 1.3rem 0 0.5rem; }
.article-body p { margin: 0 0 1rem; }
.article-body ul, .article-body ol { margin: 0 0 1rem; padding-left: 1.3rem; }
.article-body li { margin-bottom: 0.35rem; }
/* Capped, not because the image is wrong but because the editor is for
   working on the text: a photo at its natural height pushes half the article
   below the fold and makes scrolling the main activity. */
.article-body img {
  display: block;
  max-width: 100%;
  max-height: 20rem;
  width: auto;
  border-radius: var(--r-field);
}
.article-body figure { margin: 1.4rem 0; }
.article-body figcaption { font-family: var(--sans); font-size: var(--small); color: var(--ink-3); }

/* ── The sidebar that judges it ─────────────────────────────────────── */

.editor-side { display: grid; gap: 0.75rem; position: sticky; top: 4.5rem; }

.side-card {
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
}
.side-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }

.score-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.75rem; }
.score-big {
  display: block;
  font-size: 2.25rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.side-card .score-head + .meta { margin-top: 0.6rem; }

.structure {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  font-size: var(--small);
}
.structure li { display: flex; justify-content: space-between; gap: 0.75rem; color: var(--ink-2); }
.structure li.on > span:first-child { color: var(--ink); }
.structure li.off .term-count b { color: var(--wait); }

/* One row per term: the word, how often it is used against how often the
   ranking pages use it, and a bar that fills towards the lower bound - that
   is the number that has to be reached. */
.term { margin-bottom: 0.5rem; }
.term-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: var(--small);
  margin-bottom: 0.25rem;
}
.term-count { color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.term-count b { font-weight: 600; color: var(--ink-2); }

.term-bar {
  display: block;
  height: 3px;
  border-radius: 2px;
  background: #e2e8e6;
  position: relative;
}
.term-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--fill, 0%);
  border-radius: 2px;
  background: var(--rule-2);
}
.term.on .term-count b { color: var(--live); }
.term.on .term-bar i { background: var(--live); }
.term.near .term-count b { color: var(--wait); }
.term.near .term-bar i { background: var(--wait); }

@media (max-width: 62rem) {
  .editor-grid { grid-template-columns: 1fr; }
  .editor-side { position: static; }
}

/* ── Messages ───────────────────────────────────────────────────────── */

.notice {
  padding: 0.7rem 0.9rem;
  margin-bottom: 1.25rem;
  border: 1px solid #d6e4df;
  border-left: 3px solid var(--live);
  border-radius: var(--r-field);
  background: var(--live-bg);
  color: var(--ink);
  font-size: var(--small);
}
.notice.warn {
  border-color: #e3d3b4;
  border-left-color: var(--wait);
  background: var(--wait-bg);
}
.notice.bad {
  border-color: #ecc9c3;
  border-left-color: var(--danger);
  background: var(--danger-bg);
}

.error {
  margin-top: 0.75rem;
  color: var(--danger);
  font-size: var(--small);
}

/* An empty screen is an invitation to act, so it gets the same frame as the
   items that will eventually stand there. Scoped by element: "empty" is also
   a modifier on the credits pill and on the calendar's padding cells. */
p.empty {
  padding: 1.15rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  color: var(--ink-2);
  font-size: var(--small);
}
/* Inside a list that already has a frame, one line of text is enough. */
li.empty { color: var(--ink-2); font-size: var(--small); }

/* ── Auth pages ─────────────────────────────────────────────────────── */

.auth {
  max-width: 24rem;
  padding: 4.5rem 1.5rem 4rem;
}
/* The same mark and wordmark as in the top bar, so the sign-in page and the
   pages behind it are recognisably one thing. It is a link because the
   marketing site is where "back" leads from here. */
.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--serif);
  font-size: var(--step-1);
  letter-spacing: -0.015em;
  color: var(--ink);
  text-decoration: none;
  margin: 0 0 1.75rem;
}
.auth h1 { margin-bottom: 1.25rem; }
.auth form {
  padding: 1.35rem 1.4rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
}
/* Anmeldung über Google. Weißer Grund und die vierfarbige Marke sind von
   Google so vorgegeben; der Knopf steht über dem Formular, weil er der
   schnellere Weg ist und nicht wie eine Nachrangigkeit aussehen soll. */
.btn-google {
  --btn-fg:           var(--ink);
  --btn-fg-hover:     var(--ink);
  --btn-bg:           #ffffff;
  --btn-bg-hover:     var(--sunken);
  --btn-border:       var(--rule-2);
  --btn-border-hover: var(--rule-2);

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 1rem;
  font-size: var(--step-0);
}
.btn-google svg { flex: none; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.1rem 0;
  color: var(--ink-3, var(--ink-2));
  font-size: var(--small);
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

#google-error { margin-bottom: 1rem; }

.auth form label:first-of-type { margin-top: 0; }
.auth form > button { width: 100%; padding: 0.6rem 1rem; font-size: var(--step-0); }
.auth .meta { margin-top: 1.1rem; }
.auth form .meta { margin-top: 1rem; margin-bottom: 0; }

/* ── Lists ──────────────────────────────────────────────────────────── */

ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 0.6rem 0; border-bottom: 1px solid var(--rule); }
ul.plain li:last-child { border-bottom: none; }

/* A bare list on the canvas needs its own surface; one nested inside an
   item already has one. */
.wrap > ul.plain {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  padding: 0.25rem 1.15rem;
}
.section > ul.plain, #log > ul.plain, #invoices > ul.plain {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  padding: 0.25rem 1.15rem;
}
.item ul.plain li:first-child { padding-top: 0.75rem; }
.item ul.plain { margin-top: 0.6rem; border-top: 1px solid var(--rule); }

@media (max-width: 34rem) {
  .wrap { padding: 1.5rem 1.1rem 4rem; }
  .item-head { flex-direction: column; gap: 0.3rem; }
  .head-right { align-self: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
