
:root {
  --red: #C1121F;
  --red-dark: #B01218;
  --red-lighter: #FBEAEC;
  --graphite: #2B2B2B;
  --warm-gray: #6B6560;
  --warm-gray-400: #C9C2B9;
  --mist: #E5E0DA;
  --paper: #F7F5F2;
  --panel: #ECE7E1;
  --ink-900: #1C1C1C;
  --white: #FFFFFF;
  --font-serif: 'Literata', Georgia, serif;
  --font-sans: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
  /* Alias dla SVG z client-brand.ts (pieczęć/chmura używają --font-plex-sans). */
  --font-plex-sans: var(--font-sans);
}

@font-face {
  font-family: 'Literata';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/literata-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Literata';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/literata-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Literata';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/literata-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/plex-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/plex-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/plex-sans-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/assets/fonts/plex-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/assets/fonts/plex-mono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--graphite);
  line-height: 1.5;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 1rem;
  color: var(--ink-900);
}
h1 { font-size: 1.75rem; }

p { margin: 0 0 1rem; }

a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-dark); text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.mono-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--red);
  margin: 0 0 0.75rem;
}

.site-header {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--mist);
  background: var(--white);
}
.site-header .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--ink-900);
}
.site-header .brand svg { display: block; flex: none; }
.site-header .brand:hover { color: var(--red); text-decoration: none; }

main {
  flex: 1;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.card {
  background: var(--white);
  border: 1px solid var(--mist);
  padding: 1.5rem;
}

/* ── Strony auth: kartka-dokument z odbitą pieczęcią na teksturze chmury słów ── */
main.auth-main {
  max-width: none;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 1rem 4rem;
  overflow: hidden;
}
/* Chmura wyśrodkowana w całości (SVG ma "meet", więc skaluje się do szerokości).
   Bez wyśrodkowania w pionie siedziałaby przy górnej krawędzi. */
.auth-bg {
  position: absolute;
  left: -6%;
  right: -6%;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.05;
  pointer-events: none;
}
.auth-doc {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--white);
  border: 1px solid var(--mist);
  padding: 2.75rem 2.5rem 2.5rem;
}
.auth-stamp {
  position: absolute;
  top: -38px;
  right: -30px;
  transform: rotate(9deg);
  opacity: 0.92;
  pointer-events: none;
}
.auth-doc h1 {
  position: relative;
  padding-bottom: 0.9rem;
  margin-bottom: 1.25rem;
}
.auth-doc h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 60px;
  height: 4px;
  background: var(--red);
}
.auth-doc .sub { color: var(--warm-gray); font-size: 0.95rem; margin: -0.5rem 0 1.5rem; }
@media (max-width: 560px) {
  .auth-stamp { top: -30px; right: -10px; }
  .auth-stamp svg { width: 92px; height: 92px; }
  .auth-doc { padding: 2.25rem 1.5rem 2rem; }
}

.site-footer {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--warm-gray);
  font-size: 0.85rem;
  border-top: 1px solid var(--mist);
  background: var(--paper);
}
.site-footer p { margin: 0; }

form { margin: 0; }
label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin: 1.1rem 0 0.35rem;
  color: var(--ink-900);
}
label:first-child { margin-top: 0; }

input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="search"] {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--warm-gray-400);
  border-radius: 0;
  background: var(--white);
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink-900);
  transition: border-color 0.2s;
}
input:hover { border-color: var(--warm-gray); }
input:focus { outline: 2px solid var(--red); outline-offset: 1px; border-color: var(--red); }
input[type="radio"], input[type="checkbox"] { width: auto; margin-right: 0.4rem; accent-color: var(--red); }

label.checkbox {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  font-weight: 400;
  font-size: 0.9rem;
  color: var(--graphite);
}
label.checkbox input { margin: 0.2rem 0 0; }

button, input[type="submit"] {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0;
  background: var(--red);
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.2s;
}
button:hover, input[type="submit"]:hover { background: var(--red-dark); }
button:focus-visible, input[type="submit"]:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
/* Full-width CTA na stronach klienckich (.card / .auth-doc) — panel personelu
   trzyma naturalną szerokość, żeby przyciski w tabelach się nie rozjeżdżały. */
.card button, .card input[type="submit"],
.auth-doc button, .auth-doc input[type="submit"] {
  display: block;
  width: 100%;
  margin-top: 1.4rem;
}

.btn-alt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
  background: var(--white);
  border: 1px solid var(--warm-gray-400);
  color: var(--ink-900);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: border-color 0.2s;
}
.btn-alt:hover { border-color: var(--red); color: var(--ink-900); text-decoration: none; }
.btn-alt svg { flex: none; }

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0 0.75rem;
  color: var(--warm-gray);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--mist); }

.aux-links { margin-top: 1.25rem; font-size: 0.9rem; }
.aux-links p { margin: 0.3rem 0; }

/* .error to ta sama intencja co .form-error, tylko inna nazwa w order-form-html.ts
   i legal.ts — jedna reguła obsługuje obie, zamiast dublować styl pod drugą nazwą. */
.form-error, .error {
  color: var(--red);
  font-weight: 600;
  margin: 0 0 1rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--red);
  background: var(--red-lighter);
  font-size: 0.9rem;
}

/* KLIENT-3: neutralne potwierdzenie (np. „Zostałeś wylogowany") — nie błąd, więc bez czerwieni. */
.form-notice {
  color: var(--graphite);
  margin: 0 0 1rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--mist);
  border-left: 3px solid var(--red);
  background: var(--panel);
  font-size: 0.9rem;
}

/* Tekst pomocniczy pod polem (order-form-html.ts, legal.ts) — dotąd bez stylu.
   warmGray #6B6560 = 5.28:1 na paper, przechodzi AA; warmGray400 tu NIE wolno. */
.hint {
  display: block;
  margin: 0.35rem 0 0;
  color: var(--warm-gray);
  font-size: 0.85rem;
  line-height: 1.45;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background: var(--white);
}
th, td {
  border: 1px solid var(--mist);
  padding: 0.5rem 0.6rem;
  text-align: left;
  font-size: 0.9rem;
}
th { background: var(--panel); }

/* ── Panel klienta: nagłówek z nawigacją ──────────────────────────────────
   Header staje się paskiem: logo z lewej, nawigacja z prawej. Mono-etykiety
   jak na landingu, aktywna sekcja podkreślona czerwienią. Zawija na mobile. */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
}
.panel-nav {
  display: flex;
  align-items: center;
  gap: 0.2rem 1.4rem;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.panel-nav a {
  color: var(--graphite);
  font-weight: 500;
  padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
}
.panel-nav a:hover { color: var(--red); text-decoration: none; }
.panel-nav a.active { color: var(--ink-900); border-bottom-color: var(--red); }
.panel-nav form { margin: 0; }
/* Wyloguj jako lekka akcja tekstowa — nie duży czerwony CTA (nadpisuje globalny button). */
.panel-nav .nav-logout {
  padding: 0.3rem 0;
  background: none;
  border: none;
  color: var(--warm-gray);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.panel-nav .nav-logout:hover { background: none; color: var(--red); text-decoration: underline; }

/* Panel: szerszy main niż wąska karta auth (mieści tabelę zamówień). */
main.panel-main { max-width: 40rem; }

/* ── Panel: tabela zamówień ───────────────────────────────────────────────
   Nagłówki mono/uppercase, linie włosowe tylko poziomo, wiersz podświetla się
   przy najechaniu. Scopowana klasą .orders, żeby nie ruszać tabel personelu. */
.orders { border: none; margin: 0.5rem 0 0; }
.orders th, .orders td { border: none; border-bottom: 1px solid var(--mist); padding: 0.7rem 0.6rem; }
.orders thead th {
  background: none;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--warm-gray);
}
.orders tbody tr:last-child td { border-bottom: none; }
.orders tbody tr:hover { background: var(--paper); }
.orders td:first-child { font-family: var(--font-mono); font-weight: 600; }

/* Znacznik statusu — spójny na liście i na stronie statusu zamówienia. */
.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  background: var(--panel);
  border: 1px solid var(--mist);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--graphite);
  white-space: nowrap;
}

/* ── Stan pusty (brak zamówień) — brandowy, z wyciszoną pieczęcią i CTA ──── */
.empty { text-align: center; padding: 2.5rem 1rem 1.5rem; }
.empty-mark { opacity: 0.5; margin-bottom: 1rem; }
.empty-mark svg { display: inline-block; }
.empty h2 { margin-bottom: 0.5rem; }
.empty p { color: var(--warm-gray); max-width: 36ch; margin: 0 auto 1.5rem; }

/* CTA-link (stan pusty) — wygląda jak przycisk primary, ale to <a>. */
.btn-cta {
  display: inline-block;
  padding: 0.75rem 1.6rem;
  background: var(--red);
  color: var(--white);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.btn-cta:hover { background: var(--red-dark); color: var(--white); text-decoration: none; }

/* ── Strona statusu zamówienia: wiersz stanu + akcje w stopce karty ──────── */
.status-line { display: flex; align-items: center; gap: 0.6rem; font-size: 1.05rem; margin-bottom: 0.75rem; }
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--mist);
}
.page-actions p { margin: 0; font-size: 0.9rem; }
