/* Twoja sekretarka - wspólny system wizualny (landing, onboarding, panel).
   Kierunek: ciepły papier, butelkowa zieleń, jeden akcent koralowy dla "trwa rozmowa". */

:root {
  --paper: #f6f1e7;
  --paper-2: #efe7d8;
  --card: #fffdf8;
  --ink: #1b2a24;
  --ink-2: #44524c;
  --muted: #5d6863;
  --line: #ddd3c1;
  --line-strong: #b3a68f;
  --green: #1f4d3f;
  --green-2: #2c6a57;
  --green-soft: #dfeae3;
  --coral: #c8432a;
  --coral-soft: #fbe3dc;
  --amber: #8a5a12;
  --amber-soft: #f8ecd2;
  --red: #b42318;
  --red-soft: #fbe4e1;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(27, 42, 36, .04), 0 8px 24px -12px rgba(27, 42, 36, .18);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
}

html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
/* delikatne ziarno papieru */
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .35;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.35  0 0 0 0 0.3  0 0 0 0 0.2  0 0 0 .08 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
body > * { position: relative; z-index: 1; }

a { color: inherit; }
.display { font-family: var(--font-display); font-optical-sizing: auto; letter-spacing: -.02em; font-weight: 600; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--green-2); }
.muted { color: var(--muted); }
.ink-2 { color: var(--ink-2); }
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }

/* ── przyciski ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; padding: 11px 20px; font-weight: 700; font-size: 14px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
  font-family: var(--font-body);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--green); color: #fff; box-shadow: 0 6px 18px -8px rgba(31, 77, 63, .7); }
.btn-primary:hover { background: var(--green-2); }
.btn-coral { background: var(--coral); color: #fff; box-shadow: 0 6px 18px -8px rgba(226, 88, 62, .8); }
.btn-coral:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--card); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 15px 26px; font-size: 16px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link { color: var(--green); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }

/* ── karty ── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.card-flat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }

/* ── znaczniki statusu ── */
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge-todo { background: var(--paper-2); color: var(--ink-2); }
.badge-calling { background: var(--coral-soft); color: #9c3320; }
.badge-waiting { background: var(--amber-soft); color: #7a4f0e; }
.badge-done, .badge-solved { background: var(--green-soft); color: var(--green); }
.badge-partial { background: var(--amber-soft); color: #7a4f0e; }
.badge-not_solved, .badge-failed { background: var(--red-soft); color: var(--red); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 0 rgba(226, 88, 62, .6); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(226, 88, 62, 0); } 100% { box-shadow: 0 0 0 0 rgba(226, 88, 62, 0); } }

/* ── komunikaty ── */
.flash { border-radius: 12px; padding: 12px 16px; font-size: 14px; border: 1px solid; margin-bottom: 14px; }
.flash-info, .flash-success { background: var(--green-soft); border-color: #bcd3c6; color: var(--green); }
.flash-error { background: var(--red-soft); border-color: #f1bdb6; color: var(--red); }
.flash-warning { background: var(--amber-soft); border-color: #ead39f; color: #7a4f0e; }

/* ── formularze ── */
.form { display: grid; gap: 18px; }
.field label, .field-label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.field .hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.field .hint ul { margin: 4px 0 0; padding-left: 18px; }
.field .errors { list-style: none; padding: 0; margin: 6px 0 0; color: var(--red); font-size: 13px; font-weight: 600; }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=tel],
.field input[type=number], .field select, .field textarea, .input {
  width: 100%; box-sizing: border-box; border: 1px solid var(--line-strong); background: #fff;
  border-radius: 10px; padding: 11px 13px; font: inherit; color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { resize: vertical; min-height: 64px; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  outline: none; border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(44, 106, 87, .15);
}
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--red); }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; cursor: pointer; }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--green); flex: none; }
.code-input { font-size: 28px !important; letter-spacing: .5em; text-align: center; font-family: ui-monospace, Consolas, monospace !important; }

/* ── nawigacja panelu ── */
.topbar { border-bottom: 1px solid var(--line); background: rgba(246, 241, 231, .85); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }
.topbar-in { display: flex; align-items: center; gap: 22px; height: 62px; }
.brand { white-space: nowrap; display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-display); font-weight: 600; font-size: 19px; letter-spacing: -.02em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--green); color: #fff; display: grid; place-items: center; }
.nav a { white-space: nowrap; font-size: 14px; font-weight: 600; text-decoration: none; color: var(--ink-2); padding: 7px 12px; border-radius: 999px; }
.nav a:hover { background: var(--paper-2); color: var(--ink); }
.nav a.active { background: var(--ink); color: var(--paper); }
.nav { display: flex; gap: 4px; }
@media (max-width: 760px) {
  .topbar-in { height: auto; flex-wrap: wrap; padding: 10px 0; gap: 10px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
}

/* ── kroki onboardingu ── */
.steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 28px; counter-reset: step; }
.steps li { flex: 1; font-size: 12px; font-weight: 700; color: var(--muted); counter-increment: step; }
.steps li::before { content: ""; display: block; height: 4px; border-radius: 4px; background: var(--line); margin-bottom: 8px; }
.steps li.done, .steps li.current { color: var(--ink); }
.steps li.done::before { background: var(--green); }
.steps li.current::before { background: linear-gradient(90deg, var(--green) 50%, var(--line) 50%); }
.steps li span::before { content: counter(step) ". "; }

/* ── tablica ── */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
@media (max-width: 1000px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .board { grid-template-columns: 1fr; } }
.col { background: var(--paper-2); border-radius: var(--radius); padding: 12px; min-height: 120px; }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; font-size: 13px; font-weight: 800; }
.col-count { font-size: 12px; background: var(--card); border-radius: 999px; padding: 1px 9px; color: var(--ink-2); }
.tcard { display: block; text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; margin-bottom: 10px; transition: transform .15s ease, box-shadow .15s ease, border-color .15s; }
.tcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #cbbfa9; }
.tcard-live { border-color: #f0b3a5; box-shadow: 0 0 0 3px var(--coral-soft); }
.tcard-follow { border-left: 4px solid var(--amber); }
.empty-col { font-size: 13px; color: var(--muted); text-align: center; padding: 18px 8px; border: 1.5px dashed var(--line); border-radius: 12px; }

/* ── statystyki ── */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 800px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { padding: 16px 18px; }
.stat-num { font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.meter { height: 6px; background: var(--paper-2); border-radius: 6px; overflow: hidden; margin-top: 10px; }
.meter > i { display: block; height: 100%; background: var(--green); border-radius: 6px; }

/* ── oś zdarzeń ── */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 16px 26px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 5px; width: 14px; height: 14px; border-radius: 50%; background: var(--card); border: 2px solid var(--green-2); box-sizing: border-box; }
.timeline li:last-child::before { background: var(--green-2); }
.timeline time { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }

/* ── polecenie (podgląd akceptacji) ── */
.prompt-doc { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; line-height: 1.7; white-space: pre-wrap; max-height: 420px; overflow: auto;
  background-image: repeating-linear-gradient(transparent, transparent 21px, rgba(31, 77, 63, .05) 22px); }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 22px; margin: 0; font-size: 14px; }
dl.facts dt { color: var(--muted); font-weight: 600; }
dl.facts dd { margin: 0; font-weight: 600; }
@media (max-width: 560px) { dl.facts { grid-template-columns: 1fr; gap: 2px; } dl.facts dd { margin-bottom: 10px; } }

/* ── animacje wejścia ── */
.rise { opacity: 0; transform: translateY(14px); animation: rise .7s cubic-bezier(.2, .7, .2, 1) forwards; }
.d1 { animation-delay: .08s; } .d2 { animation-delay: .16s; } .d3 { animation-delay: .24s; } .d4 { animation-delay: .32s; } .d5 { animation-delay: .4s; }
@keyframes rise { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .rise { animation: none; opacity: 1; transform: none; } .pulse { animation: none; } }

/* ── dostępność: widoczny focus z klawiatury ── */
.btn:focus-visible, .nav a:focus-visible, .tcard:focus-visible, a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--green-2); outline-offset: 2px;
}
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--green-2); outline-offset: 1px; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.plain legend { padding: 0; }

/* ── alert: konsultant czeka na przełączenie ── */
.live-alert { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; text-decoration: none; background: var(--coral); color: #fff;
  padding: 14px 20px; font-size: 15px; position: sticky; top: 62px; z-index: 19; box-shadow: 0 10px 30px -12px rgba(200, 67, 42, .8); }
.live-alert-go { margin-left: auto; font-weight: 800; white-space: nowrap; }
.live-alert-ring { width: 12px; height: 12px; border-radius: 50%; background: #fff; flex: none; animation: ring 1.2s infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .7); } 100% { box-shadow: 0 0 0 12px rgba(255, 255, 255, 0); } }
@media (max-width: 760px) { .live-alert { top: 0; } }
@media (prefers-reduced-motion: reduce) { .live-alert-ring { animation: none; } }

/* ── mobile: cele dotyku, nagłówek ── */
@media (max-width: 760px) {
  .topbar-in { padding: 10px 20px; margin: 0; }
  .nav a { min-height: 40px; display: inline-flex; align-items: center; }
  .btn-sm { min-height: 40px; }
}
