/* The palette. Defined once here; the deed plot PDF uses the same colors
   (exports/plat.py, COLOR_PALETTE). */
:root {
  /* Primary: deep navy, for the header, primary buttons, links, and the tract. */
  --primary: #1b365d;
  --primary-dark: #12263f;
  --primary-soft: #e8eef6;
  --primary-line: #b9c8dc;
  /* Accent: survey teal, for the POB, the tie line, and line numbers. */
  --accent: #0f7c8c;
  --accent-soft: #e2f3f5;
  /* Neutrals. */
  --ink: #1d2433;
  --muted: #5f6b7d;
  --line: #d9dee7;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --panel-alt: #fafbfc;
  /* Status: green good, amber warning, red error. */
  --ok: #15803d;
  --ok-bg: #edf8f1;
  --ok-line: #a7dcb9;
  --flag: #b45309;
  --flag-bg: #fff7e8;
  --flag-line: #f3c677;
  --error: #b42318;
  --error-bg: #fdecea;
  --error-line: #f5c2bd;
  /* Filled surfaces: primary buttons, the header, table heads. */
  --primary-fill: #1b365d;
  --primary-fill-hover: #12263f;
  --on-primary: #ffffff;
  --on-accent: #ffffff;
  --header-bg: #1b365d;
  --header-muted: #c9d4e3;
  --header-faint: #b9c6d8;
  /* Form fields and small surfaces. */
  --input-bg: #ffffff;
  --code-bg: #eef1f5;
  --alert-bg: #f9fafb;
  --disabled-fill: #c4cad4;
  --on-disabled: #ffffff;
  --placeholder: #a3acb9;
  --mark-bg: #ffe58a;
  --mark-ink: inherit;
  /* Paper: deed page images, the sample plot, logos, and plot thumbnails
     always sit on white, in both themes. */
  --paper: #ffffff;
  /* The sketch on the Results screen. */
  --sketch-bg: #fbfcfe;
  --sketch-fill: #e8eef6;
  --sketch-line: #1b365d;
  --sketch-tie: #0f7c8c;
  --sketch-label: #1d2433;
  --sketch-tag: #0f7c8c;
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
}

:root {
  /* Shared shape and depth, used by every card and panel. */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 4px 6px -2px rgba(16, 24, 40, .04), 0 12px 24px -4px rgba(16, 24, 40, .08);
  --space: 1.5rem;
}

/* Dark theme. The head script sets data-theme on <html> before the page
   draws: from the choice saved in the browser or the account, or from the
   computer's setting ("System"). Deep navy and charcoal, not black; the same
   hues, lightened to stay readable; status colors stay green, amber, red. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #9cc0f0;
  --primary-dark: #c3d8f6;
  --primary-soft: #1d2f4a;
  --primary-line: #3a5275;
  --accent: #3fc1d1;
  --accent-soft: #113840;
  --ink: #e3e8f0;
  --muted: #9ba8bb;
  --line: #2b3a50;
  --bg: #0e1522;
  --panel: #161f2e;
  --panel-alt: #1b2637;
  --ok: #4ade80;
  --ok-bg: #0f2b1d;
  --ok-line: #22603d;
  --flag: #fbbf24;
  --flag-bg: #2e2310;
  --flag-line: #75561a;
  --error: #f87171;
  --error-bg: #351719;
  --error-line: #74302f;
  --primary-fill: #3a6cb4;
  --primary-fill-hover: #4a7cc4;
  --on-primary: #ffffff;
  --on-accent: #062a30;
  --header-bg: #0a111d;
  --header-muted: #aab6c8;
  --header-faint: #8d9bb0;
  --input-bg: #0f1826;
  --code-bg: #223047;
  --alert-bg: #1b2637;
  --disabled-fill: #333e50;
  --on-disabled: #8f9bb0;
  --placeholder: #6d7a8e;
  --mark-bg: #7a6514;
  --mark-ink: #fff7d6;
  --sketch-bg: #111a28;
  --sketch-fill: #1c3050;
  --sketch-line: #a9c8f2;
  --sketch-tie: #45c9d9;
  --sketch-label: #e3e8f0;
  --sketch-tag: #5fd3e0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-lg: 0 4px 6px -2px rgba(0, 0, 0, .3), 0 12px 24px -4px rgba(0, 0, 0, .45);
}
body { background: var(--bg); color: var(--ink); }

[x-cloak] { display: none !important; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; }
h1 { font-size: 1.5rem; margin: 0 0 .4rem; }
h2 { font-size: 1.2rem; margin: 1rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1.4rem 0 .5rem; display: flex; gap: .6rem; align-items: baseline; }
p { margin: .3rem 0; }
code { background: var(--code-bg); padding: 0 .3em; border-radius: 3px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.topbar {
  display: flex; align-items: center; gap: 2rem; padding: .6rem 1.5rem; min-height: 3.2rem;
  background: var(--header-bg); color: #fff; border-bottom: 3px solid var(--accent);
  position: sticky; top: 0; z-index: 5;
}
/* The wordmark: lowercase, set in config/brand.toml. */
.brand { font-weight: 700; letter-spacing: .01em; font-size: 1.25rem; color: #fff; text-decoration: none; white-space: nowrap; }
.brand-suffix { font-weight: 400; color: var(--header-muted); font-size: 1rem; }
.tagline { color: var(--header-faint); font-size: .85rem; margin-left: -1.2rem; white-space: nowrap; }
@media (max-width: 700px) { .tagline { display: none; } }
/* Phones: the links wrap onto their own row under the wordmark; the email is dropped. */
@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; gap: .4rem 1rem; padding: .5rem 1rem; }
  .topbar .userbar { flex-wrap: wrap; gap: .3rem .9rem; margin-left: 0; width: 100%; }
  .topbar .userbar .email { display: none; }
  .topbar .plan-status { width: 100%; order: -1; font-size: .8rem; }
}
.brand::before {
  content: ""; display: inline-block; width: .6em; height: .6em; margin-right: .4em;
  border: 2px solid #fff; border-radius: 50%; background: var(--accent); vertical-align: .02em;
}
.topbar .link { margin-left: auto; }
.topbar button.link, .topbar .userbar a { color: #fff; }
.topbar .userbar .email, .topbar .plan-status { color: var(--header-muted); }
.topbar .userbar strong { color: #fff; }
.topbar button.link:hover { text-decoration: underline; }

/* Step indicators, at the top of the page content: done steps get a check,
   the current one is filled. */
.steps {
  display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; margin: 0 0 var(--space); padding: 0;
  font-size: .88rem;
}
.steps.narrow { max-width: 1180px; margin-left: auto; margin-right: auto; }
.steps li { display: flex; align-items: center; gap: .45rem; color: var(--muted); padding: .3rem .8rem .3rem .35rem; border-radius: 999px; }
.steps li:not(:last-child)::after { content: "→"; margin-left: .5rem; color: var(--placeholder); }
.steps .dot {
  display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem;
  border-radius: 50%; border: 1.5px solid var(--primary-line); background: var(--panel);
  font-size: .78rem; font-weight: 600; color: var(--muted);
}
.steps li.done { color: var(--ink); }
.steps li.done .dot { background: var(--primary-fill); border-color: var(--primary-fill); color: var(--on-primary); }
.steps li.on { color: var(--primary); font-weight: 600; background: var(--primary-soft); }
.steps li.on .dot { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

main { padding: var(--space); max-width: 1600px; margin: 0 auto; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--space); box-shadow: var(--shadow);
}
.panel.narrow { max-width: 720px; margin: 2rem auto; }

/* Upload page: intro on the left, the upload card on the right. */
.welcome {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3rem; align-items: start;
  max-width: 1180px; margin: 0 auto 2rem;
}
@media (max-width: 900px) { .welcome { grid-template-columns: 1fr; gap: 1.5rem; } }
.intro h1 { font-size: 2.3rem; line-height: 1.15; letter-spacing: -.01em; color: var(--primary); margin: .2rem 0 .8rem; }
.intro .lead { font-size: 1.08rem; line-height: 1.55; color: var(--ink); max-width: 34rem; }
.features { list-style: none; padding: 0; margin: 1.4rem 0; display: grid; gap: .75rem; }
.features li { display: flex; align-items: center; gap: .75rem; font-weight: 500; }
.features .icon {
  flex: none; width: 2.1rem; height: 2.1rem; padding: .42rem; border-radius: var(--radius-sm);
  background: var(--accent-soft); stroke: var(--accent); stroke-width: 1.8; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}
.preview { margin: 1.6rem 0 0; }
.preview img {
  display: block; width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line);
  box-shadow: var(--shadow-lg); background: var(--paper);
}
.preview figcaption { font-size: .82rem; color: var(--muted); margin-top: .5rem; }
.upload-card { box-shadow: var(--shadow-lg); padding: 1.75rem; }
.upload-card h2 { margin: 0 0 .3rem; font-size: 1.3rem; }
@media (max-width: 900px) {
  .intro h1 { font-size: 1.8rem; }
  .welcome .upload-card { order: -1; }  /* on phones the upload card comes first */
  .preview { display: none; }
}
@media (max-width: 900px) and (min-width: 560px) { .preview { display: block; } }

/* Site footer on every page. */
.sitefooter {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .8rem 1.5rem;
  padding: 1rem var(--space); border-top: 1px solid var(--line); background: var(--panel);
  color: var(--muted); font-size: .85rem;
}
.sitefooter .footmark strong { color: var(--primary); font-weight: 700; }
.sitefooter nav { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.sitefooter a { color: var(--muted); text-decoration: none; }
.sitefooter a:hover { color: var(--primary); text-decoration: underline; }
.panel.center { text-align: center; }

/* Secondary buttons are outlined; .primary buttons are filled. */
button {
  font: inherit; border: 1px solid var(--primary-line); background: var(--panel); color: var(--primary);
  border-radius: 6px; padding: .45rem .9rem; cursor: pointer; font-weight: 500;
}
button:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); }
button:disabled { opacity: .45; cursor: default; }
/* Continue is grey until there's something to read, then the primary color. */
button.primary:disabled { background: var(--disabled-fill); border-color: var(--disabled-fill); color: var(--on-disabled); opacity: 1; }
button.primary { background: var(--primary-fill); color: var(--on-primary); border-color: var(--primary-fill); }
button.primary:hover:not(:disabled) { background: var(--primary-fill-hover); border-color: var(--primary-fill-hover); }
button.primary.big { padding: .65rem 1.6rem; font-weight: 600; }
button.link { border: none; background: none; color: var(--primary); padding: .2rem .3rem; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--primary-line); }
button.link:hover:not(:disabled) { background: none; text-decoration-color: currentColor; }
a { color: var(--primary); }
button.small { padding: .15rem .5rem; font-size: .85rem; }
.actions { display: flex; gap: 1rem; align-items: center; margin-top: 1.2rem; }

input, select, textarea {
  font: inherit; border: 1px solid var(--line); border-radius: 5px; padding: .35rem .5rem;
  width: 100%; background: var(--input-bg); color: var(--ink);
}
textarea { font-family: ui-monospace, Menlo, monospace; font-size: .9rem; margin-top: 1rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input.bad, select.bad { border-color: var(--error); background: var(--error-bg); }
label > span { display: block; font-size: .75rem; color: var(--muted); margin-bottom: .15rem; }
/* A deed field whose label can be a control (the Book / Volume term menu). */
.field > .field-label { display: block; font-size: .75rem; color: var(--muted); margin-bottom: .15rem; }
.field > select.term-select {
  width: auto; padding: 0 .2rem; border: 0; border-bottom: 1px dashed var(--line);
  border-radius: 0; background: transparent; font-weight: 600; color: var(--ink); cursor: pointer;
}

.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin: 1rem 0 .5rem; }
.tabs button { color: var(--muted); border-color: var(--line); }
.tabs button.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.tabs.small { margin: 0; }
.tabs.small button { padding: .2rem .6rem; font-size: .85rem; }

.alert { border: 1px solid var(--line); background: var(--alert-bg); border-radius: 8px; padding: .7rem 1rem; margin: .8rem 0; }
.alert.warn { background: var(--flag-bg); border-color: var(--flag-line); }
.alert.error { background: var(--error-bg); border-color: var(--error-line); color: var(--error); }
.alert.warn button { margin-left: .6rem; }
.flag-text { color: var(--flag); }
.error-text { color: var(--error); font-size: .85rem; }

.dropzone {
  display: flex; flex-direction: column; gap: .35rem; align-items: center; justify-content: center;
  min-height: 15rem; padding: 2rem 1.25rem; cursor: pointer; text-align: center;
  border: 2px dashed var(--primary-line); border-radius: var(--radius); background: var(--panel-alt);
  color: var(--ink); transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.dropzone strong { font-size: 1.05rem; color: var(--primary); }
.dropzone u { text-decoration-color: var(--primary-line); text-underline-offset: 2px; color: var(--primary); }
.upload-icon {
  width: 3.2rem; height: 3.2rem; margin-bottom: .35rem; fill: none; stroke: var(--primary);
  stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
/* Hover and dragging a file over: primary border and a light tint. */
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone.over { border-style: solid; box-shadow: 0 0 0 4px var(--primary-soft); }
.dropzone.chosen { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.dropzone.chosen .upload-icon { stroke: var(--accent); }
.dropzone .filename { color: var(--ink); word-break: break-all; }
.dropzone input { display: none; }
.upload-card .actions { justify-content: space-between; flex-wrap: wrap; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; margin-top: 1rem; }
.thumb { border: 2px solid var(--line); border-radius: 8px; padding: .4rem; cursor: pointer; background: var(--panel); }
.thumb.on { border-color: var(--primary); background: var(--primary-soft); }
.thumb img { width: 100%; display: block; border: 1px solid var(--line); background: var(--paper); }
.thumb span { display: flex; gap: .4rem; align-items: center; margin-top: .4rem; font-size: .9rem; }
.thumb input { width: auto; }

.spinner {
  width: 42px; height: 42px; margin: 1rem auto; border-radius: 50%;
  border: 4px solid var(--primary-soft); border-top-color: var(--primary); animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Review: source on the left, calls on the right */
.review { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 1.5rem; align-items: start; }
@media (max-width: 1000px) { .review { grid-template-columns: 1fr; } }
.source {
  position: sticky; top: 4.2rem; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 1rem; max-height: calc(100vh - 5.5rem); overflow: auto;
}
.source-head { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: .4rem; }
.page { position: relative; margin-top: .5rem; }
.page img { width: 100%; display: block; border: 1px solid var(--line); background: var(--paper); }
.box { position: absolute; border: 2px solid var(--accent); background: rgba(15, 124, 140, .14); border-radius: 3px; pointer-events: none; }
.transcript { white-space: pre-wrap; line-height: 1.55; font-size: .92rem; margin-top: .5rem; }
.transcript mark { background: var(--mark-bg); color: var(--mark-ink); padding: .05em 0; border-radius: 2px; }

.calls { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: var(--shadow); }
.source { border-radius: var(--radius); box-shadow: var(--shadow); }
.card, .plot-card, .plan-card, .plotpanel, .sketch, .call { border-radius: var(--radius-sm); }
.plot-card, .plan-card { box-shadow: var(--shadow); }
.deedinfo summary { cursor: pointer; font-weight: 600; padding: .3rem 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .6rem; margin-top: .6rem; }
.grid .wide { grid-column: 1 / -1; }
.grid .check { display: flex; align-items: center; gap: .4rem; font-size: .9rem; }
.grid .check input { width: auto; }
.tract-picker { margin: 1rem 0; padding: .8rem 1rem; background: var(--primary-soft); border: 1px solid var(--primary-line); border-radius: 8px; }
label.wide { display: block; }

.call-rows { display: flex; flex-direction: column; gap: .5rem; }
.call { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .7rem; cursor: pointer; }
.call.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.call.flagged { background: var(--flag-bg); border-color: var(--flag-line); }
.call.invalid { border-color: var(--error); }
.call-main { display: flex; gap: .6rem; align-items: flex-end; }
.num { min-width: 2rem; font-weight: 700; color: var(--muted); padding-bottom: .45rem; }
.fields { display: grid; gap: .5rem; flex: 1; }
.fields.line { grid-template-columns: 1.1fr 1fr; }
.fields.curve { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.hint { font-style: normal; color: var(--accent); }
.row-actions { display: flex; gap: .2rem; padding-bottom: .1rem; }
.row-actions button { padding: .25rem .45rem; font-size: .85rem; }
.call-sub { margin: .4rem 0 0 2.6rem; }
label.inline { display: flex; align-items: center; gap: .4rem; margin-top: .3rem; }
label.inline span { display: inline; margin: 0; min-width: 3rem; }
label.inline input { padding: .2rem .4rem; font-size: .9rem; }

p.quote { color: var(--muted); font-style: italic; font-size: .85rem; margin-top: .4rem; }
.flags { margin-top: .4rem; color: var(--flag); font-size: .88rem; }
.flags.done { color: var(--muted); }
.flags p::before { content: "⚑ "; }

.confirm-bar { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--line); }

.results { margin-top: 1.5rem; padding-top: .5rem; border-top: 2px solid var(--primary-soft); }
.results h2 { color: var(--primary); }
/* Result cards are tinted by status; the word in the corner says it too. */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .8rem; }
.card { border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; padding: .7rem .9rem; display: flex; flex-direction: column; gap: .15rem; background: var(--panel); }
.card span { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; display: flex; justify-content: space-between; gap: .4rem; }
.card span em { font-style: normal; font-weight: 700; letter-spacing: .02em; }
.card strong { font-size: 1.25rem; }
.card small { color: var(--muted); }
.card.good { background: var(--ok-bg); border-color: var(--ok-line); border-left-color: var(--ok); }
.card.good strong, .card.good em { color: var(--ok); }
.card.warning { background: var(--flag-bg); border-color: var(--flag-line); border-left-color: var(--flag); }
.card.warning strong, .card.warning em { color: var(--flag); }
.card.error { background: var(--error-bg); border-color: var(--error-line); border-left-color: var(--error); }
.card.error strong, .card.error em { color: var(--error); }
.card.neutral { border-left-color: var(--primary-line); }
.issues { margin-top: 1rem; }
.issue { padding: .3rem .6rem; border-left: 3px solid var(--line); margin: .3rem 0; background: var(--panel-alt); }
.issue.warning { border-color: var(--flag); background: var(--flag-bg); }
.issue.error { border-color: var(--error); background: var(--error-bg); }
.suggestion { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: .5rem .7rem; border: 1px solid var(--flag-line); background: var(--flag-bg); border-radius: 6px; margin: .4rem 0; }
.sketch { margin-top: 1rem; border: 1px solid var(--line); border-radius: 8px; background: var(--sketch-bg); }
.sketch svg { width: 100%; max-height: 640px; display: block; }
.sketch text { fill: var(--sketch-label); }
.sketch text.tag { fill: var(--sketch-tag); font-weight: 700; }
.sketch text.pob { fill: var(--sketch-tag); font-weight: 700; }
.sketch text.note { fill: var(--sketch-tag); }
.acreages { margin: .6rem 0 0; padding: .5rem .8rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-alt); font-size: .88rem; }
.acreages.conflict { background: var(--flag-bg); border-color: var(--flag-line); }
.acreages ul { margin: .2rem 0 0; padding-left: 1.1rem; }
.acreages li { margin: .15rem 0; }
.acreages q { color: var(--muted); font-style: italic; }
input::placeholder, textarea::placeholder { color: var(--placeholder); font-style: italic; }
.calltable { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: .88rem; border: 1px solid var(--line); }
.calltable th { text-align: left; font-weight: 600; color: var(--on-primary); background: var(--primary-fill); padding: .4rem .5rem; }
.calltable td { border-bottom: 1px solid var(--line); padding: .3rem .5rem; font-variant-numeric: tabular-nums; }
.calltable tbody tr:nth-child(even) td { background: var(--panel-alt); }
.calltable td:first-child { font-weight: 700; color: var(--accent); }
.calltable tr.offdrawing td { background: var(--flag-bg); }
.plotpanel { margin-top: 1.4rem; padding: 1rem 1.1rem; border: 1px solid var(--line); border-top: 3px solid var(--primary-fill); border-radius: 8px; background: var(--panel-alt); }
.plotpanel h3 { margin-top: 0; color: var(--primary); }
.checkline { display: flex; align-items: center; gap: .45rem; font-size: .9rem; }
.checkline input { width: auto; }

.account form > label { display: block; margin-top: .8rem; }
.account .actions a { font-size: .9rem; }
.userbar { display: flex; gap: .9rem; align-items: center; margin-left: auto; font-size: .9rem; }
.userbar a { color: var(--primary); text-decoration: none; }
.userbar .email { color: var(--muted); }
.saved-note { color: var(--ok); font-size: .9rem; }

/* Beta badge beside the wordmark */
.beta-badge {
  display: inline-block; margin-left: -1.4rem; padding: .05rem .45rem; border-radius: 999px;
  border: 1px solid var(--accent); color: #fff; background: var(--accent);
  font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
dialog.beta-notice p { font-size: 1rem; line-height: 1.5; }

/* Project files, feedback, admin */
.open-project { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.open-project p { margin-top: .5rem; }
label.button-like.small { font-size: .88rem; padding: .3rem .7rem; }
.sitefooter .feedback-open { font-size: .85rem; color: var(--muted); padding: 0; }
.sitefooter .feedback-open:hover { color: var(--primary); }
dialog.feedback {
  width: min(32rem, calc(100vw - 2rem)); border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); color: var(--ink); padding: 1.4rem 1.5rem; box-shadow: var(--shadow-lg);
}
dialog.feedback::backdrop { background: rgba(10, 17, 29, .45); }
dialog.feedback h2 { margin-top: 0; }
dialog.feedback label { display: block; margin-top: .7rem; }
dialog.feedback textarea { font-family: inherit; font-size: inherit; margin-top: 0; }
.feedback-table td.note { white-space: pre-wrap; max-width: 36rem; }
main.admin { display: grid; gap: var(--space); }
main.admin > .panel { min-width: 0; }
.table-scroll { overflow-x: auto; }
.testers-table td { white-space: nowrap; vertical-align: top; }
.testers-table td:first-child { white-space: normal; min-width: 12rem; }
.testers-table tr.flagged td { background: var(--error-bg); }
.tester-flag { color: var(--error); font-size: .8rem; font-weight: 600; }
.tester-notes summary { cursor: pointer; color: var(--accent); text-decoration: underline; }
.tester-notes p { white-space: pre-wrap; min-width: 18rem; max-width: 30rem; margin: .4rem 0; }
.danger { color: var(--error); border-color: var(--error-line); }
button.danger:hover:not(:disabled) { border-color: var(--error); background: var(--error-bg); }
.plan-status { color: var(--muted); font-size: .85rem; }

/* Company */
.company { max-width: 1040px; margin: 0 auto; display: grid; gap: var(--space); }
.company textarea { font-family: inherit; font-size: inherit; margin-top: 0; }
.company .grid small { display: block; margin-top: .2rem; font-size: .78rem; }
.logo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.2rem; margin-top: 1rem; }
.logo-slot h3 { margin: 0 0 .2rem; }
.logo-thumb { height: 96px; border: 1px dashed var(--primary-line); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; background: var(--paper); margin: .5rem 0; padding: .5rem; }
.logo-thumb img { max-width: 100%; max-height: 100%; }
label.button-like { display: inline-block; border: 1px solid var(--primary-line); border-radius: 6px; padding: .45rem .9rem; color: var(--primary); cursor: pointer; font-weight: 500; background: var(--panel); }
label.button-like:hover { border-color: var(--primary); background: var(--primary-soft); }
label.button-like input { display: none; }
.preview-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.preview-head h2 { margin: 0; }
.plot-preview { width: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-top: .8rem; }
.invites { list-style: none; padding: 0; }

/* Plans */
.plans-panel { max-width: 1040px; margin: 2rem auto; }
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin: 1.2rem 0; }
.plan-card { border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: .4rem; }
.plan-card { background: var(--panel); border-top: 4px solid var(--primary-line); }
.plan-card.on { border-color: var(--primary); background: var(--primary-soft); }
.plan-card h2 { margin: 0; }
.plan-card .price { font-size: 1.15rem; font-weight: 600; margin: 0; }
.plan-card ul { padding-left: 1.1rem; margin: .3rem 0 .8rem; flex: 1; }
.plan-card li { margin: .25rem 0; font-size: .92rem; }
.plan-status a { color: var(--primary); }

/* Theme toggle (sun, moon, or screen for "System"), at the right of the header. */
.theme-toggle {
  margin-left: auto; flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; padding: 0; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .35); background: transparent; color: #fff;
}
.userbar .theme-toggle { margin-left: 0; }
.topbar .theme-toggle:hover:not(:disabled) { background: rgba(255, 255, 255, .14); border-color: #fff; }
.theme-toggle svg {
  display: none; width: 1.05rem; height: 1.05rem;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
:root[data-theme-choice="light"] .theme-toggle .i-light,
:root[data-theme-choice="dark"] .theme-toggle .i-dark,
:root[data-theme-choice="system"] .theme-toggle .i-system,
:root:not([data-theme-choice]) .theme-toggle .i-system { display: block; }
@media (max-width: 560px) { .topbar > .theme-toggle { margin-left: auto; } }
