/*
 * einvoice-at — the whole stylesheet.
 *
 * Hand authored rather than generated by Tailwind's standalone CLI; ADR-0009 has the reasoning
 * (a ~100 MB platform-specific binary downloaded in every build, for a handful of server-rendered
 * pages). The trade-off it accepts is that this file must stay small enough that nobody misses the
 * generator — so: custom properties for the palette, semantic class names, no utility soup, and no
 * rule that exists for one element.
 *
 * Stoicera-adjacent: near-black ground, warm gold accent, generous line height. Dark by default
 * because that is the brand; prefers-color-scheme is deliberately NOT honoured, since a validator
 * report is read for its colour coding (red/amber/green) and two palettes would mean maintaining
 * that coding twice.
 */

:root {
  --ink: #0e0f11;
  --ink-raised: #16181c;
  --ink-line: #262a31;
  --text: #e8e6e1;
  --text-dim: #a4a29c;
  --gold: #c9a227;
  --gold-dim: #8d711b;
  --error: #e2564a;
  --warn: #d9a020;
  --ok: #4fa96a;
  --radius: 6px;
  --measure: 68ch;
}

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- structure */

.shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.masthead {
  border-bottom: 1px solid var(--ink-line);
  padding: 1rem 0;
  margin-bottom: 2.5rem;
}

.masthead .shell {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.wordmark {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  font-size: 1.05rem;
}

.wordmark span {
  color: var(--gold);
}

.masthead nav {
  display: flex;
  gap: 1.25rem;
  margin-left: auto;
  font-size: 0.925rem;
}

.masthead nav a {
  color: var(--text-dim);
  text-decoration: none;
}

.masthead nav a:hover,
.masthead nav a:focus-visible {
  color: var(--text);
}

footer.colophon {
  border-top: 1px solid var(--ink-line);
  margin-top: 4rem;
  padding: 1.5rem 0 2.5rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* -------------------------------------------------------------------- type */

h1 {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 0.6rem;
}

h2 {
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  margin: 2.5rem 0 0.75rem;
}

h3 {
  font-size: 1rem;
  margin: 1.75rem 0 0.5rem;
}

/* A card's heading is an h2 in the document outline and h3-sized on the page.
   The landing page's three feature cards used to be <h3> with no <h2> above them, which is a
   heading-order violation (a11y): assistive technology reads the outline, not the font size, and
   an h1 → h3 jump means a missing level. Lighthouse's accessibility audit found it at 96/100.
   Fixing it in the markup rather than by silencing the audit, and keeping the visual weight here
   rather than inventing a section heading nobody asked for. */
.card h2 {
  font-size: 1rem;
  letter-spacing: normal;
  margin: 0 0 0.5rem;
}

p,
li {
  max-width: var(--measure);
}

.lede {
  font-size: 1.1rem;
  color: var(--text-dim);
}

a {
  color: var(--gold);
}

code,
.mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
}

/* ------------------------------------------------------------------ blocks */

.card {
  background: var(--ink-raised);
  border: 1px solid var(--ink-line);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.card + .card {
  margin-top: 1rem;
}

.notice {
  border-left: 3px solid var(--gold);
  background: var(--ink-raised);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.85rem 1.1rem;
  color: var(--text-dim);
  font-size: 0.925rem;
}

.notice strong {
  color: var(--text);
}

.notice.danger {
  border-left-color: var(--error);
}

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.stat {
  background: var(--ink-raised);
  border: 1px solid var(--ink-line);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.stat .value {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: block;
}

.stat .label {
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* ------------------------------------------------------------------- forms */

label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
}

input[type="text"],
input[type="date"],
input[type="email"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: var(--ink);
  color: var(--text);
  border: 1px solid var(--ink-line);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.95rem;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.field {
  margin-bottom: 1rem;
}

.field-row {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

button,
.button {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  background: var(--gold);
  color: #17140b;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
}

button:hover,
.button:hover {
  background: #dcb32d;
}

button.secondary,
.button.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--ink-line);
}

button.secondary:hover,
.button.secondary:hover {
  border-color: var(--text-dim);
  background: var(--ink-raised);
}

button.link {
  background: none;
  border: none;
  color: var(--gold);
  padding: 0;
  font-weight: 500;
  font-size: 0.875rem;
  text-decoration: underline;
}

button[disabled] {
  opacity: 0.55;
  cursor: progress;
}

/* Native file inputs cannot be styled; the drop zone wraps one instead. */
.dropzone {
  border: 1px dashed var(--ink-line);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  text-align: center;
  background: var(--ink-raised);
}

.dropzone input[type="file"] {
  color: var(--text-dim);
  font: inherit;
  font-size: 0.925rem;
}

/* ------------------------------------------------------------------ tables */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.925rem;
}

th,
td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--ink-line);
  vertical-align: top;
}

th {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Any table can outgrow a phone; the page body must never scroll sideways. */
.scroll-x {
  overflow-x: auto;
}

/* --------------------------------------------------------- dashboard chrome */

/* The dashboard's second-level nav. A row of quiet links with the current one in gold, rather than
   tabs with borders: five entries do not need a widget. */
.subnav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin: 0 0 1.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--ink-line);
  font-size: 0.95rem;
}

.subnav a {
  color: var(--text-dim);
  text-decoration: none;
}

.subnav a:hover {
  color: var(--text);
}

.subnav a.current {
  color: var(--gold);
}

/* Canonical JSON and generated XML, shown for inspection. Wrapped in .scroll-x by the template, so
   this only has to stop the block from stretching the page. */
pre.mono {
  margin: 0;
  padding: 0.9rem 1rem;
  background: var(--ink);
  border: 1px solid var(--ink-line);
  border-radius: var(--radius);
  font-size: 0.85rem;
  line-height: 1.5;
  max-width: none;
}

/* ----------------------------------------------------------------- reports */

.verdict {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--ink-line);
  background: var(--ink-raised);
}

.verdict.valid {
  border-left: 4px solid var(--ok);
}

.verdict.invalid {
  border-left: 4px solid var(--error);
}

.verdict .headline {
  font-size: 1.15rem;
  font-weight: 700;
}

.pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid currentColor;
}

.pill.error {
  color: var(--error);
}

.pill.warn {
  color: var(--warn);
}

.pill.info {
  color: var(--text-dim);
}

.pill.ok {
  color: var(--ok);
}

.finding {
  border: 1px solid var(--ink-line);
  border-left-width: 4px;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--ink-raised);
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.75rem;
}

.finding.error {
  border-left-color: var(--error);
}

.finding.warn {
  border-left-color: var(--warn);
}

.finding.info {
  border-left-color: var(--text-dim);
}

.finding .head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.finding .rule {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  color: var(--gold);
}

.finding .message-de {
  margin: 0 0 0.35rem;
}

/* The English mirror is secondary — present for a developer, quiet for an accountant. */
.finding .message-en,
.finding .where {
  color: var(--text-dim);
  font-size: 0.875rem;
  margin: 0;
  word-break: break-word;
}

.finding .explanation {
  margin-top: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  background: var(--ink);
  border: 1px solid var(--ink-line);
}

.finding .explanation .who {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.35rem;
}

.finding .explanation p {
  margin: 0 0 0.5rem;
  white-space: pre-line;
}

.finding .explanation p:last-child {
  margin-bottom: 0;
}

/* ------------------------------------------------------- in-flight affordances */

/* Shown only while a request is in flight. app.js toggles .htmx-request on the form — the class
   name is htmx's, deliberately, so swapping the twenty lines of app.js for real htmx one day needs
   no stylesheet change (ADR-0009 Entscheidung 5). htmx itself is NOT used here. */
.spinner {
  display: none;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.htmx-request .spinner,
.htmx-request.spinner {
  display: inline;
}

/* ------------------------------------------------------------------- utility */

/* Spacing helpers, and the reason they exist is a security one rather than a style one: the
   templates used inline `style="margin-top: …"` attributes, and an inline style attribute is
   exactly what forces `style-src 'unsafe-inline'` into a Content-Security-Policy. Five rules here
   buy a policy with no inline allowance at all (M5 hostile review, F8). This is not a utility
   convention creeping in — ADR-0009 Entscheidung 5's trigger for that is unchanged. */
.spaced {
  margin-top: 1.5rem;
}

.spaced-sm {
  margin-top: 0.6rem;
}

.spaced-md {
  margin-top: 1rem;
}

.spaced-lg {
  margin: 1.75rem 0;
}

.inline-form {
  display: inline;
}

/* The "automatically generated, not checked" line under an AI explanation. */
.disclaimer {
  font-size: 0.8rem;
}

.muted {
  color: var(--text-dim);
}

.stack > * + * {
  margin-top: 1rem;
}

.row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.right {
  margin-left: auto;
}

.steps {
  display: flex;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

.steps li {
  color: var(--text-dim);
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  max-width: none;
}

.steps li.current {
  color: var(--gold);
  border-color: var(--gold-dim);
}

.steps li.done {
  color: var(--text);
}

.errors {
  color: var(--error);
  font-size: 0.9rem;
}

.secret {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  word-break: break-all;
  background: var(--ink);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  display: block;
}

@media (max-width: 560px) {
  .masthead .shell {
    gap: 0.75rem;
  }

  .masthead nav {
    margin-left: 0;
    width: 100%;
  }
}
