/* Avallo Protect — wygląd wspólny z aplikacjami Avallo (Poczta, Proposals, Actors):
   Arial, szare tło, białe karty z cienką ramką, logo Avallo z bordową etykietą aplikacji. */
:root {
  --brand: #8b1d3f;
  --brand-dark: #6e1631;
  --brand-soft: #f7edf0;
  --brand-border: #e8cbd4;
  --focus-border: #b96780;
  --bg: #f5f6f7;
  --surface: #ffffff;
  --text: #292d32;
  --muted: #626970;
  --faint: #7a8187;
  --line: #e1e4e6;
  --input-line: #d5d9dc;
  --ok: #15803d;
  --ok-soft: #ecfdf3;
  --ok-border: #b7ebc8;
  --warn: #a15c07;
  --warn-soft: #fff8eb;
  --warn-border: #f6d8a2;
  --bad: #b42318;
  --bad-soft: #fef3f2;
  --bad-border: #f5c2bd;
  --radius: 12px;
  --radius-sm: 7px;
  --shadow: 0 4px 24px #292d3206;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 Arial, Helvetica, sans-serif; }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.3; margin: 0; text-wrap: balance; }
p { margin: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------ logo i etykieta -- */
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-logo { width: 118px; height: auto; display: block; }
.app-badge {
  background: var(--brand-soft); color: var(--brand); border-radius: 5px; font-size: 10px; letter-spacing: 1.2px;
  padding: 5px 10px; font-weight: 600; text-transform: uppercase; white-space: nowrap;
}

/* ------------------------------------ strony dla klientów: karta nagłówka -- */
.page { max-width: 560px; margin: 0 auto; padding: 24px 16px 40px; display: flex; flex-direction: column; gap: 14px; }
.page-wide { max-width: 1160px; }
.card.app-head { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; }
.app-head .who { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.app-head .who strong { color: var(--text); font-weight: 600; max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-head form { margin: 0; }

/* ------------------------------------------------ panel: górny pasek -- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); padding: 0 16px; padding-top: env(safe-area-inset-top, 0px); }
.topbar-inner { max-width: 1160px; margin: 0 auto; min-height: 68px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.topbar-right form { margin: 0; }

/* ------------------------------------------------------------------ karty -- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; display: flex; flex-direction: column; gap: 14px; }
.card h1 { font-size: 22px; letter-spacing: -.5px; }
.card h2 { font-size: 16px; letter-spacing: -.2px; }
.lead { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }

/* -------------------------------------------------------------- przyciski -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 10px 16px;
  font: 600 14px/1.3 Arial, Helvetica, sans-serif; cursor: pointer; text-decoration: none; min-height: 42px;
}
.btn:focus-visible, .input:focus-visible { outline: none; box-shadow: 0 0 0 3px #8b1d3f26; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-outline { background: var(--surface); color: var(--brand); border-color: var(--brand-border); }
.btn-outline:hover { background: var(--brand-soft); color: var(--brand); }
.btn-ghost { background: transparent; color: var(--muted); padding: 6px 10px; min-height: 0; font-size: 12px; }
.btn-ghost:hover { color: var(--brand); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; min-height: 0; font-size: 12px; }
.actions { display: flex; flex-direction: column; gap: 10px; }

/* ------------------------------------------------------------- formularze -- */
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field label, .field legend { font-weight: 600; font-size: 13px; padding: 0; }
.input {
  width: 100%; border: 1px solid var(--input-line); border-radius: var(--radius-sm); padding: 10px 12px;
  font: 16px/1.3 Arial, Helvetica, sans-serif; color: var(--text); background: #fff; min-height: 42px;
}
.input:focus { border-color: var(--focus-border); box-shadow: 0 0 0 3px #8b1d3f14; outline: none; }
.input-code { font-family: "Courier New", Courier, monospace; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
.input-otp { font-family: "Courier New", Courier, monospace; font-size: 24px; font-weight: 700; letter-spacing: 8px; text-align: center; }
.hint { font-size: 12px; color: var(--muted); }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { flex: 1 1 180px; }

/* -------------------------------------------------------------- komunikaty -- */
.flash { border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13px; border: 1px solid; }
.flash-success { background: var(--ok-soft); border-color: var(--ok-border); color: #0f5c2e; }
.flash-danger { background: var(--bad-soft); border-color: var(--bad-border); color: #8a1c13; }
.flash-warning { background: var(--warn-soft); border-color: var(--warn-border); color: #7a4605; }
.flash-info { background: var(--brand-soft); border-color: var(--brand-border); color: var(--brand-dark); }

/* ----------------------------------------------------------- strona główna -- */
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; counter-reset: s; font-size: 13px; }
.steps li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; }
.steps li::before {
  counter-increment: s; content: counter(s); width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 12px;
  display: grid; place-items: center;
}

/* ------------------------------------------------------------------- wynik -- */
.verdict { border-radius: var(--radius); border: 1px solid; padding: 24px 22px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.verdict svg { width: 52px; height: 52px; }
.verdict h1 { font-size: 21px; letter-spacing: -.3px; }
.verdict p { max-width: 44ch; font-size: 13px; }
.verdict .btn { margin-top: 4px; }
.verdict-ok { background: var(--ok-soft); border-color: var(--ok-border); color: #0f5c2e; }
.verdict-ok svg { color: var(--ok); }
.verdict-warn { background: var(--warn-soft); border-color: var(--warn-border); color: #6b3d04; }
.verdict-warn svg { color: var(--warn); }
.verdict-bad { background: var(--bad-soft); border-color: var(--bad-border); color: #7a1911; }
.verdict-bad svg { color: var(--bad); }
.facts { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: 13px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.code-box {
  font-family: "Courier New", Courier, monospace; font-weight: 700; letter-spacing: .5px;
  background: var(--brand-soft); border-radius: 5px; padding: 2px 7px; display: inline-block; color: var(--text);
}
.tips { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }

/* ------------------------------------------------------------------- skaner -- */
.scanner { position: relative; border-radius: var(--radius); overflow: hidden; background: #111; aspect-ratio: 3 / 4; max-width: 100%; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner-frame { position: absolute; inset: 18%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); }
.scanner-status { font-size: 13px; text-align: center; min-height: 1.5em; }
.scanner-status.is-error { color: var(--bad); font-weight: 600; }

/* ------------------------------------------------------------------- tabele -- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #fafbfb; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.nowrap, .nowrap { white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: "Courier New", Courier, monospace; font-size: 12px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid; white-space: nowrap; }
.pill-ok { background: var(--ok-soft); border-color: var(--ok-border); color: #0f5c2e; }
.pill-warn { background: var(--warn-soft); border-color: var(--warn-border); color: #7a4605; }
.pill-bad { background: var(--bad-soft); border-color: var(--bad-border); color: #8a1c13; }
.pill-muted { background: #f2f4f5; border-color: var(--line); color: var(--muted); }

/* ------------------------------------------------------------ panel admina -- */
.admin-nav { display: flex; flex-wrap: wrap; gap: 2px; }
.admin-nav a { text-decoration: none; color: var(--muted); padding: 8px 12px; border-radius: var(--radius-sm); font-weight: 600; font-size: 13px; }
.admin-nav a:hover { color: var(--brand); background: var(--brand-soft); }
.admin-nav a.is-active { color: var(--brand); background: var(--brand-soft); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.stat b { display: block; font-size: 24px; color: var(--brand); font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.stat.is-alert b { color: var(--bad); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; font-size: 12px; }
.token-box { font-family: "Courier New", Courier, monospace; word-break: break-all; background: var(--warn-soft); border: 1px solid var(--warn-border); border-radius: var(--radius-sm); padding: 10px 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }

.footer { text-align: center; font-size: 11px; color: var(--faint); padding: 4px 16px 28px; padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
.footer a { color: var(--faint); }

.narrow { width: 100%; max-width: 430px; margin: 0 auto; }
@media (min-width: 720px) {
  .page { padding-top: 40px; }
  .actions-row { flex-direction: row; }
  .actions-row .btn { flex: 1; }
}
@media (max-width: 480px) {
  .card { padding: 22px 18px; }
  .brand-logo { width: 100px; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn { transition: background .15s, color .15s, border-color .15s; }
}
