@font-face {
  font-family: "Fira Code";
  src: url("/fonts/FiraCode-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fira Code";
  src: url("/fonts/FiraCode-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --base03:  #002b36;
  --base02:  #073642;
  --base01:  #586e75;
  --base00:  #657b83;
  --base0:   #839496;
  --base1:   #93a1a1;
  --base2:   #eee8d5;
  --base3:   #fdf6e3;
  --yellow:  #b58900;
  --orange:  #cb4b16;
  --red:     #dc322f;
  --magenta: #d33682;
  --violet:  #6c71c4;
  --blue:    #268bd2;
  --cyan:    #2aa198;
  --green:   #859900;

  --bg:     var(--base3);
  --fg:     var(--base02);
  --muted:  var(--base01);
  --accent: var(--magenta);
  --rule:   rgba(88,110,117,.25);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:    var(--base03);
    --fg:    var(--base1);
    --muted: var(--base0);
    --rule:  rgba(147,161,161,.18);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); }
body {
  font-family: "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 78ch;
  margin: 0 auto;
  padding: 40px 24px 96px;
}

/* ── nav: a single line of plain links ───────────────────── */
nav.top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4em;
  flex-wrap: wrap;
  align-items: baseline;
}
nav.top .nav-left {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: baseline;
}
nav.top .nav-right {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: baseline;
}
nav.top a { color: var(--muted); text-decoration: none; }
nav.top a:hover { color: var(--accent); }
nav.top .sep { opacity: .4; }
nav.top a.cta {
  color: var(--accent);
  font-weight: 700;
}
nav.top a.cta:hover { color: var(--violet); }
nav.top a.cta .arr {
  display: inline-block;
  transition: transform .15s ease;
  margin-left: 2px;
}
nav.top a.cta:hover .arr { transform: translateX(2px); }
nav.top .who { color: var(--fg); font-weight: 700; }
nav.top form { margin: 0; display: inline; }
nav.top button.linkish {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
nav.top button.linkish:hover { color: var(--accent); }

/* ── header: logo + tagline (right of logo, bottom-aligned) ───── */
header.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 32px;
}
header.brand img { height: 44px; width: auto; display: block; }
header.brand .tag {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

/* ── prose ──────────────────────────────────────────────── */
p { margin: 0 0 1em; }
p, li {
  max-width: 72ch;
  text-wrap: pretty;
}
strong { color: var(--fg); font-weight: 700; }

a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }

/* ── section headings: "# foo" style ─────────────────────── */
h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 1em;
  letter-spacing: -.005em;
}
h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  margin: 2.6em 0 1em;
  letter-spacing: -.005em;
}
h2::before { content: '# '; opacity: .55; color: var(--muted); font-weight: 400; }
h2.page-title { margin-top: 0; }

/* ── code blocks: left-rule, no panel chrome ─────────────── */
pre, code {
  font-family: inherit;
  font-size: inherit;
}
pre {
  background: transparent;
  border-left: 2px solid var(--rule);
  padding: 2px 16px;
  margin: 1em 0 1.3em;
  overflow-x: auto;
  white-space: pre;
}
p code, li code, td code {
  background: transparent;
  color: var(--violet);
}

/* syntax accents (used inside <pre>) */
.kw    { color: var(--magenta); }
.fn    { color: var(--blue); }
.str   { color: var(--cyan); }
.num   { color: var(--green); }
.com   { color: var(--muted); opacity: .75; }
.prom  { color: var(--magenta); user-select: none; }
.ok    { color: var(--green); }

/* ── tables ──────────────────────────────────────────────── */
table {
  border-collapse: collapse;
  margin: 1em 0 1.4em;
  font-size: 13px;
  width: 100%;
}
th, td {
  padding: 8px 18px 8px 0;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px dashed var(--rule);
}
thead th {
  font-weight: 700;
  color: var(--muted);
  font-size: 12px;
  border-bottom: 1px solid var(--muted);
}
tbody tr:last-child td { border-bottom: none; }
td.name { font-weight: 700; color: var(--fg); white-space: nowrap; }
td .price-none { color: var(--muted); opacity: .5; }

/* ── lists ──────────────────────────────────────────────── */
ul.dash { list-style: none; padding-left: 0; margin: 0 0 1em; }
ul.dash li { padding-left: 2ch; text-indent: -2ch; }
ul.dash li::before { content: '- '; color: var(--muted); }

/* ── ascii rule between sections (optional) ──────────────── */
.rule {
  color: var(--rule);
  margin: 2em 0 0;
  user-select: none;
  overflow: hidden;
  font-size: 14px;
  letter-spacing: 0;
}

/* ── footer/meta ─────────────────────────────────────────── */
footer.meta {
  margin-top: 5em;
  padding-top: 1.6em;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  color: var(--muted);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 1.8em;
  align-items: start;
  line-height: 1.75;
}
@media (max-width: 640px) {
  footer.meta { grid-template-columns: 1fr; gap: 0.6em; }
}
footer.meta img.logo-sm {
  height: 22px;
  width: auto;
  display: block;
}
footer.meta .stack {
  display: flex;
  flex-direction: column;
  gap: 0.3em;
}
footer.meta a { color: var(--muted); }
footer.meta a:hover { color: var(--accent); }
footer.meta .sep { opacity: .4; padding: 0 0.4em; user-select: none; }

/* small marker for "→" arrows in text */
.arr { color: var(--muted); }

/* ────────────────────────────────────────────────────────── */
/* DASHBOARD-ONLY: bordered widgets per i contenuti utili.    */
/* ────────────────────────────────────────────────────────── */

.form-box {
  max-width: 40ch;
}

.error-split {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 48px;
  align-items: center;
  margin: 2em 0;
}
.error-split .error-code {
  font-size: 120px;
  line-height: 1;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -.02em;
}
.error-split .error-aside p { margin: 0 0 1em; }
@media (max-width: 720px) {
  .error-split {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .error-split .error-code { font-size: 80px; }
}

.auth-split {
  display: grid;
  grid-template-columns: minmax(0, 40ch) minmax(0, 36ch);
  gap: 48px;
  align-items: center;
  margin: 1.4em 0;
}
.auth-split .auth-aside {
  color: var(--muted);
  font-size: 13px;
  max-width: 36ch;
}
.auth-split .auth-aside p { margin: 0 0 1em; }
@media (max-width: 720px) {
  .auth-split {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}
.form-row { margin-bottom: 14px; }
.form-row label.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  font-weight: 400;
}
.form-row label.checkbox-row input[type=checkbox] { margin-top: 3px; }
.form-row label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 700;
}
.form-row input[type=text],
.form-row input[type=email],
.form-row input[type=password] {
  width: 100%;
  border: 1px solid var(--muted);
  background: var(--bg);
  color: var(--fg);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
}
.form-row input:focus {
  outline: none;
  border-color: var(--accent);
}
.form-row .hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

button.btn, input[type=submit] {
  border: 1px solid var(--muted);
  background: var(--bg);
  color: var(--fg);
  padding: 8px 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
button.btn:not([disabled]):hover { color: var(--accent); border-color: var(--accent); }
button.btn.primary {
  background: var(--accent);
  color: var(--base3);
  border-color: var(--accent);
}
button.btn.primary:not([disabled]):hover {
  background: var(--bg);
  color: var(--accent);
}
button.btn { position: relative; }
button.btn[disabled] {
  opacity: .6;
  cursor: not-allowed;
}
button.btn .btn-loading {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: 2px;
}
button.btn .btn-loading::after {
  content: ".";
  animation: btn-dots 1.2s steps(1) infinite;
}
.htmx-request button.btn .btn-label { visibility: hidden; }
.htmx-request button.btn .btn-loading { display: flex; }
@keyframes btn-dots {
  0%   { content: "."; }
  33%  { content: ".."; }
  66%  { content: "..."; }
}

.form-error {
  border: none;
  border-left: 2px solid var(--accent);
  color: var(--accent);
  background: var(--base2);
  padding: 8px 12px;
  margin-bottom: 14px;
  font-size: 12px;
}
.form-ok {
  border: none;
  border-left: 2px solid var(--green);
  color: var(--green);
  background: var(--base2);
  padding: 8px 12px;
  margin-bottom: 14px;
  font-size: 12px;
}
.form-meta {
  text-align: center;
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 1.4em 0;
}
.kpi {
  border: 1px solid var(--muted);
  padding: 14px 16px;
}
.kpi .label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}
.kpi .value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  margin-top: 4px;
}

.card {
  border: 1px solid var(--muted);
  margin: 1.4em 0;
}
.card-header {
  background: var(--base2);
  border-bottom: 1px solid var(--muted);
  padding: 10px 14px;
  font-weight: 700;
  font-size: 13px;
  color: var(--accent);
}
.card-header::before { content: '# '; opacity: .55; color: var(--muted); font-weight: 400; }
.card-body { padding: 16px; }
.card-body > *:last-child { margin-bottom: 0; }
