/* ── CSS tokens ─────────────────────────────────────────────── */
:root {
  --ink-900: #0E1B2C;
  --ink-700: #1F2E44;
  --ink-500: #4A5670;
  --ink-300: #7A8599;
  --ink-400: #6A778A;
  --ink-100: #D9DCE3;
  --paper:   #F4F0E6;
  --paper-2: #ECE6D5;
  --offwhite:#FBFAF7;
  --oxblood: #7A1F2B;
  --oxblood-soft: #F2D9DC;
  --forest:  #1F4A3A;
  --forest-soft: #DEE9DF;
  --amber:      #9A6B1F;
  --amber-dark: #8A5C12;
  --amber-soft: #F4E6C8;
  --ink-200: #7E8897;
  --serif: 'Newsreader', 'Source Serif Pro', Georgia, serif;
  --sans:  'Inter', -apple-system, system-ui, sans-serif;
  --mono:  'JetBrains Mono', 'IBM Plex Mono', Menlo, monospace;

  --text-xs:   13px;
  --text-sm:   14px;
  --text-base: 15px;
  --text-md:   18px;
  --text-lg:   26px;
  --text-xl:   36px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--offwhite); font-family: var(--sans); font-size: 14px; color: var(--ink-900); -webkit-font-smoothing: antialiased; }
h1,h2,h3,h4 { margin: 0; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
a { text-decoration: none; cursor: pointer; }
textarea { font-family: var(--serif); }
button { font-family: var(--sans); cursor: pointer; }

#app {
  width: 1280px;
  max-width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--offwhite);
  position: relative;
}

/* ── App bar ────────────────────────────────────────────────── */
.app-bar {
  box-shadow: 0 1px 0 var(--ink-100);
  padding: 0 40px;
  height: 56px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  background: var(--offwhite);
  gap: 0;
}
.app-bar-logo { display: flex; align-items: center; gap: 14px; color: inherit; cursor: pointer; padding-right: 16px; }
a.app-bar-logo { text-decoration: none; }
a.app-bar-logo:hover { opacity: 0.75; }
.app-bar-emblem {
  width: 40px; height: 40px;
  border: 1.5px solid var(--ink-900);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-style: italic; font-weight: 700; font-size: 20px;
  color: var(--ink-900); flex-shrink: 0;
}
.app-bar-title { font-family: var(--serif); font-size: 20px; font-style: italic; }
.app-bar-sub { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; color: var(--ink-500); text-transform: uppercase; }
.app-bar-report-label { font-family: var(--serif); font-style: italic; font-size: 13px; color: var(--ink-300); }
.app-bar-case { font-family: var(--mono); font-size: var(--text-xs); color: var(--ink-500); letter-spacing: .04em; }
.app-bar-case span { color: var(--ink-900); font-weight: 600; }
.app-bar-actions { display: flex; gap: 0; align-items: stretch; }
.app-bar-actions a {
  font-family: var(--sans); font-size: var(--text-sm); font-weight: 500;
  color: var(--ink-400); text-decoration: none;
  display: flex; align-items: center; padding: 0 14px;
  border-bottom: 2px solid transparent;
}
.app-bar-actions a:hover { color: var(--ink-900); }
.app-bar-actions a.active { color: var(--ink-900); border-bottom-color: var(--ink-900); }
.app-bar-sep { width: 1px; background: var(--ink-100); margin: 14px 6px; align-self: stretch; }

/* dropdown */
.app-bar-dropdown { position: relative; display: flex; align-items: stretch; }
.app-bar-dropdown-toggle {
  font-family: var(--sans); font-size: var(--text-sm); font-weight: 500;
  color: var(--ink-400); text-decoration: none; cursor: pointer;
  display: flex; align-items: center; gap: 4px; padding: 0 14px;
  border-bottom: 2px solid transparent; user-select: none;
}
.app-bar-dropdown-toggle:hover,
.app-bar-dropdown:hover .app-bar-dropdown-toggle { color: var(--ink-900); }
.app-bar-dropdown-toggle.active { color: var(--ink-900); border-bottom-color: var(--ink-900); }
.app-bar-dropdown-arrow { font-size: 9px; opacity: 0.5; }
.app-bar-dropdown-menu {
  display: none; position: absolute; top: 100%; left: 0;
  background: var(--offwhite); border: 1px solid var(--ink-100);
  box-shadow: 0 4px 12px rgba(14,27,44,.08);
  min-width: 180px; z-index: 200;
}
.app-bar-dropdown:hover .app-bar-dropdown-menu,
.app-bar-dropdown.open .app-bar-dropdown-menu { display: block; }
.app-bar-dropdown-menu a.app-bar-dropdown-item {
  display: block; padding: 9px 16px;
  font-family: var(--sans); font-size: var(--text-sm); font-weight: 400;
  color: var(--ink-500); text-decoration: none;
  border-bottom: 1px solid var(--ink-100); white-space: nowrap;
  border-bottom-style: solid;
}
.app-bar-dropdown-menu a.app-bar-dropdown-item:last-child { border-bottom: none; }
.app-bar-dropdown-menu a.app-bar-dropdown-item:hover { color: var(--ink-900); background: var(--paper); }
.app-bar-dropdown-menu a.app-bar-dropdown-item.active { color: var(--ink-900); font-weight: 600; }
.app-bar-form { display: flex; gap: 8px; align-items: center; }
.app-bar-form input[type=text] {
  width: 200px; padding: 7px 11px; border: 1px solid var(--ink-300); background: var(--offwhite);
  font-family: var(--mono); font-size: 13px; color: var(--ink-900); outline: none;
}
.app-bar-form input[type=text]:focus { border-color: var(--ink-900); }
.app-bar-form button {
  background: var(--ink-900); color: #fff; border: none; padding: 7px 18px;
  font-family: var(--serif); font-style: italic; font-size: 14px; cursor: pointer;
}
.app-bar-form button:hover { opacity: 0.9; }

.app-bar-nav-link {
  font-family: var(--sans);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  color: var(--ink-400);
  border-bottom: none;
}
.app-bar-nav-link:hover { color: var(--ink-900); }
.app-bar-actions a.app-bar-login-btn {
  font-family: var(--mono);
  font-style: normal;
  font-size: var(--text-xs);
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-900);
  border: 1px solid var(--ink-300);
  padding: 5px 14px;
  align-self: center;
}
.app-bar-actions a.app-bar-login-btn:hover { border-color: var(--ink-900); color: var(--ink-900); }
.app-bar-user-label {
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: .08em;
  color: var(--ink-400);
  display: flex;
  align-items: center;
}
.app-bar-actions a.app-bar-logout {
  font-family: var(--mono);
  font-style: normal;
  font-size: var(--text-xs);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-900);
  border: 1px solid var(--ink-300);
  padding: 5px 14px;
  align-self: center;
  font-weight: 400;
}
.app-bar-actions a.app-bar-logout:hover { border-color: var(--ink-900); color: var(--ink-900); }

/* ── Login ──────────────────────────────────────────────────── */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 80vh; }
.login-card { border: 1px solid var(--ink-100); padding: 48px; width: 360px; background: var(--offwhite); }
.login-card h1, .login-h1 { font-family: var(--serif); font-style: italic; font-size: var(--text-lg); margin-bottom: 24px; }
.login-card label { font-family: var(--mono); font-size: var(--text-xs); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-500); display: block; margin-bottom: 6px; }
.err { font-family: var(--mono); font-size: var(--text-xs); color: var(--oxblood); margin-top: 12px; }
input[type=text], input[type=password], input[type=email] { padding: 7px 11px; border: 1px solid var(--ink-400); background: var(--offwhite); font-family: var(--mono); font-size: var(--text-sm); color: var(--ink-900); }
input[type=text]:focus, input[type=password]:focus, input[type=email]:focus { border-color: var(--ink-900); outline: none; }
.btn-primary { background: var(--ink-900); color: #fff; border: 1px solid var(--ink-900); padding: 9px 18px; min-height: 36px; font-family: var(--mono); font-style: normal; font-size: var(--text-xs); letter-spacing: .12em; text-transform: uppercase; cursor: pointer; }
.btn-primary:hover { background: var(--ink-700); border-color: var(--ink-700); }
.btn-danger { background: var(--oxblood); color: #fff; border: none; padding: 9px 18px; min-height: 36px; font-family: var(--serif); font-style: italic; font-size: 14px; cursor: pointer; }
.btn-danger:hover { opacity: 0.9; }

/* ── Skip link (WCAG) ───────────────────────────────────────── */
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 9999; background: var(--ink-900); color: #fff; padding: 10px 20px; font-family: var(--mono); font-size: var(--text-sm); letter-spacing: .08em; text-decoration: none; }
.skip-link:focus { left: 16px; }

/* ── Subnav tabs ────────────────────────────────────────────── */
.subnav { display: flex; gap: 0; border-bottom: 2px solid var(--ink-200); margin-bottom: 28px; }
.subnav-tab { font-family: var(--mono); font-size: var(--text-xs); letter-spacing: .10em; text-transform: uppercase; padding: 8px 16px 11px; text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -2px; color: var(--ink-500); min-height: 32px; display: inline-flex; align-items: center; }
.subnav-tab[aria-current="page"], .subnav-tab.active { color: var(--ink-900); border-bottom-color: var(--ink-900); }
.subnav-tab:hover:not([aria-current="page"]):not(.active) { color: var(--ink-700); }

/* ── Admin page layout ──────────────────────────────────────── */
.page-wrap { padding: 44px 40px 56px; }
.section-card { background: var(--offwhite); border: 1px solid var(--ink-100); padding: 32px; }
.section-card h2 { font-family: var(--serif); font-style: italic; font-size: var(--text-lg); margin-bottom: 16px; }
.section-card h3 { font-family: var(--sans); font-size: var(--text-base); font-weight: 600; margin-bottom: 0; }
.section-card label { font-family: var(--mono); font-size: var(--text-xs); letter-spacing: .10em; text-transform: uppercase; color: var(--ink-500); display: block; margin-bottom: 6px; }

/* ── Log box ────────────────────────────────────────────────── */
.log-box { background: var(--paper); padding: 16px; max-height: 600px; overflow-y: auto; font-family: var(--mono); font-size: var(--text-xs); line-height: 1.7; border: 0.5px solid var(--ink-100); margin-top: 12px; }
.log-line { margin: 0; white-space: pre-wrap; word-break: break-all; }
.log-check { color: var(--forest); font-weight: 600; }
.log-error { color: var(--oxblood); }
.log-warn { color: var(--amber-a); }
.log-dim { color: var(--ink-500); }

/* ── Subject banner ─────────────────────────────────────────── */
.subject-banner {
  padding: 36px 40px;
  border-bottom: 2px solid var(--ink-900);
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 32px;
  align-items: end;
}
.banner-case-no {
  font-family: var(--mono); font-size: var(--text-xs); letter-spacing: .16em;
  color: var(--ink-500); text-transform: uppercase; line-height: 1.7;
}
.banner-name {
  font-family: var(--serif); font-size: var(--text-xl); font-weight: 500; letter-spacing: -0.01em;
}
.banner-meta {
  font-family: var(--mono); font-size: var(--text-sm); color: var(--ink-700); margin-top: 4px;
  word-break: normal;
}
.banner-risk-col { display: flex; align-items: flex-end; justify-content: flex-end; }
.banner-risk-label {
  font-family: var(--mono); font-size: var(--text-xs); color: var(--ink-500);
  letter-spacing: .10em; text-transform: uppercase; margin-bottom: 8px; text-align: right;
}
.risk-badge {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; padding: 10px 20px; gap: 4px;
  font-family: var(--mono); font-weight: 700; letter-spacing: .10em; text-transform: uppercase;
  min-width: 120px; max-width: 290px; width: 290px; text-align: center;
}
.risk-badge .risk-badge-level {
  font-size: 20px; letter-spacing: .12em;
}
.risk-badge .risk-badge-pts-inner {
  font-size: var(--text-xs); opacity: .85; letter-spacing: .08em; font-weight: 400;
}
.risk-badge.b-low      { background: var(--forest); }
.risk-badge.b-medium   { background: var(--amber); }
.risk-badge.b-high     { background: #8B2500; }
.risk-badge.b-critical { background: var(--oxblood); border: 2px solid #fff; outline: 2px solid var(--oxblood); }
.risk-badge-pts {
  font-family: var(--mono); font-size: var(--text-xs); color: var(--ink-500);
  margin-top: 6px; text-align: right;
}

/* ── Body ───────────────────────────────────────────────────── */
.body { padding: 44px 40px 56px; }

/* ── Section ────────────────────────────────────────────────── */
.section {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 220px;
  column-gap: 36px;
  padding: 22px 0;
  border-bottom: 0.5px solid var(--ink-300);
}
.section.last { border-bottom: none; }

.section.critical-section {
  border-left: 4px solid var(--oxblood);
  border-top: 2px solid var(--oxblood);
  padding-left: 12px;
  background: rgba(122,31,43,0.06);
  margin-left: -15px;
  padding-right: 0;
}

.ceidg-strip { height: 3px; background: var(--oxblood); margin-bottom: 0; }

.section.quiet { padding: 16px 0; }
.section.quiet .main-col { padding: 8px 28px; }
.section.quiet .section-head { margin-bottom: 8px; }

/* ── Left aside ─────────────────────────────────────────────── */
.aside-left { padding-top: 18px; }
.aside-num {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--serif); font-size: var(--text-md); font-style: italic;
  color: var(--ink-500); margin-bottom: 10px;
}
.aside-num-check {
  font-size: 16px; font-style: normal; font-family: var(--sans); font-weight: 700;
}
.aside-num-check.ok  { color: var(--forest); }
.aside-num-check.bad { color: var(--oxblood); }
.aside-meta {
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
  color: var(--ink-500); letter-spacing: .04em;
}
.aside-meta .source-label {
  font-size: var(--text-xs); letter-spacing: .12em; text-transform: uppercase;
  font-weight: 600; color: var(--ink-700); font-family: var(--mono);
}
.aside-meta .art-ref {
  font-style: italic; font-family: var(--serif); font-size: 12px;
  color: var(--ink-700);
}

/* ── Main column ────────────────────────────────────────────── */
.main-col {
  border-left: 0.5px solid var(--ink-200);
  border-right: 0.5px solid var(--ink-200);
  padding: 12px 28px;
  min-height: 60px;
}

/* ── Right aside ────────────────────────────────────────────── */
.aside-right {
  padding-top: 0;
  margin-top: 44px;
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: 14px; line-height: 1.55; color: var(--ink-700);
}

/* ── Section header ─────────────────────────────────────────── */
.section-head { margin-bottom: 14px; }
.section-head h2 {
  font-family: var(--serif); font-size: var(--text-lg); font-style: italic;
  font-weight: 600; letter-spacing: -0.005em;
}
.section-head-sub {
  font-family: var(--mono); font-size: var(--text-xs); letter-spacing: .03em;
  color: var(--ink-500); margin-top: 4px;
}

/* ── DataGrid / DataLine ────────────────────────────────────── */
.data-grid { border-top: 0.5px solid var(--ink-200); }
.data-line {
  display: grid;
  grid-template-columns: 24px 180px 1fr;
  column-gap: 10px;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--ink-200);
  align-items: baseline;
  transition: background 0.12s ease;
  border-radius: 2px;
}
.data-line:hover { background: rgba(14,27,44,0.02); }
.data-line-indicator { display: flex; align-items: center; padding-top: 2px; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; vertical-align: middle; }
.dot-ok   { border: 1px solid var(--ink-300); background: transparent; }
.dot-on   { background: var(--forest); }
.dot-warn { background: var(--amber); }
.dot-fail { background: var(--oxblood); }
.data-line-key {
  font-family: var(--mono); font-size: var(--text-xs); letter-spacing: .02em;
  color: var(--ink-500); padding-top: 2px;
}
.data-line-val {
  font-size: var(--text-base); font-weight: 400; color: var(--ink-900);
  word-break: break-word;
}
.data-line-val.mono { font-family: var(--mono); font-size: var(--text-sm); }
.data-line-val.bold { font-weight: 700; }
.data-line-val.fail { color: var(--oxblood); }
.nowrap-num { white-space: nowrap; }

.fail-pill {
  display: inline-flex; align-items: center;
  background: var(--oxblood-soft); color: var(--oxblood);
  padding: 2px 10px; border-radius: 999px;
  font-weight: 700; font-size: var(--text-base); font-family: var(--sans);
  letter-spacing: .01em; white-space: nowrap; line-height: 1;
}
.warn-pill {
  display: inline-flex; align-items: center;
  background: var(--amber-soft); color: var(--amber-dark);
  padding: 2px 10px; border-radius: 999px;
  font-weight: 700; font-size: var(--text-base); font-family: var(--sans);
  white-space: nowrap; line-height: 1;
}
.ok-pill {
  display: inline-flex; align-items: center;
  background: var(--forest-soft); color: var(--forest);
  padding: 2px 10px; border-radius: 999px;
  font-weight: 700; font-size: var(--text-base); font-family: var(--sans);
  white-space: nowrap; line-height: 1;
}

/* ── Country risk flags (UBO table) ────────────────────────── */
.high-risk-flag {
  margin-left: 4px; color: #c62828; font-weight: 700;
  font-size: 13px; cursor: help;
}
.annex4-flag {
  margin-left: 3px; color: #6a1a6a; font-weight: 700;
  font-size: 13px; cursor: help;
}

/* ── Risk table §III ────────────────────────────────────────── */
.risk-table { font-size: var(--text-base); margin-top: 4px; }
.risk-table td { padding: 11px 0; vertical-align: middle; }
.risk-table tr { border-bottom: 1px solid var(--ink-200); }
.risk-table .cell-id { font-family: var(--mono); font-size: var(--text-xs); color: var(--ink-500); width: 38px; }
.risk-table .cell-label { padding: 11px 8px; }
.risk-table .cell-label-title { font-family: var(--sans); font-size: var(--text-base); font-weight: 600; color: var(--ink-900); }
.risk-table .cell-label-note { font-family: var(--mono); font-size: var(--text-xs); color: var(--oxblood); margin-top: 2px; }
.risk-table .cell-result {
  padding: 11px 8px; width: 120px;
  font-family: var(--sans); font-size: var(--text-base); font-weight: 400;
}
.risk-table .cell-result.fail { color: var(--oxblood); }
.risk-table .cell-result.warn { color: var(--amber); }
.risk-table .cell-result.ok  { color: var(--forest); }
.risk-table .cell-result .dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  margin-right: 8px; vertical-align: middle;
}
.risk-table .cell-result.fail .dot { background: var(--oxblood); }
.risk-table .cell-result.warn .dot { background: var(--amber); }
.risk-table .cell-result.ok .dot  { border: 1px solid var(--forest); background: transparent; }
.risk-table .cell-pts {
  text-align: right; font-family: var(--sans);
  font-size: var(--text-base); width: 60px;
}
.risk-table .cell-pts.has-pts { font-weight: 600; color: var(--ink-900); }
.risk-table .cell-pts.no-pts  { color: var(--ink-300); font-weight: 400; }
.risk-sum-row td {
  padding: 14px 0 0 !important;
  border-top: 1px solid var(--ink-900) !important;
  border-bottom: none !important;
}
.risk-sum-label {
  font-family: var(--serif); font-style: italic; font-size: var(--text-base); color: var(--ink-700);
}
.risk-sum-num-wrap { text-align: right; display: flex; align-items: baseline; justify-content: flex-end; gap: 10px; }
.risk-sum-critical {
  font-family: var(--mono); font-size: var(--text-sm); letter-spacing: .12em;
  text-transform: uppercase; color: var(--oxblood); font-weight: 600;
}
.risk-sum-num {
  font-family: var(--sans); font-size: 36px;
  font-weight: 700; color: var(--oxblood);
}
.risk-sum-num.low { color: var(--forest); }
.risk-sum-num.med { color: var(--amber); }

/* ── §VII + check matrix shared ────────────────────────────── */
.data-line-val.edd { color: var(--oxblood); font-weight: 600; }
.data-line-key.edd { color: var(--oxblood); }
.data-line-tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: .14px;
  padding: 2px 7px; border: 1px solid var(--ink-300); color: var(--ink-500); white-space: nowrap;
}
.data-line-tag.edd { border-color: var(--oxblood); color: var(--oxblood); font-weight: 600; }
/* checks-grid — kontener macierzy kontroli §III */
.checks-grid { margin-top: 8px; }

/* check-row — macierz kontroli §III (rozszerzony data-line z kolumną pkt) */
.check-row {
  display: grid; grid-template-columns: 24px 1fr 1fr 80px;
  column-gap: 10px; padding: 9px 0;
  border-bottom: 0.5px solid var(--ink-200); align-items: baseline;
}
.check-row-key {
  font-family: var(--mono); font-size: var(--text-xs);
  letter-spacing: .02em; color: var(--ink-500); padding-top: 2px;
}
.check-row-val { font-size: var(--text-base); color: var(--ink-500); }
.check-row-val.fail { font-family: var(--serif); font-style: italic; font-weight: 600; color: var(--oxblood); }
.check-row-val.warn { font-family: var(--serif); font-style: italic; font-weight: 600; color: var(--amber); }
.check-row-pts { text-align: right; }
.check-row-pts span { font-family: var(--mono); font-size: var(--text-xs); color: var(--oxblood); font-weight: 700; }

/* ── PKD list ───────────────────────────────────────────────── */
.pkd-wrap { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--ink-200); }
.pkd-label {
  font-family: var(--mono); font-size: var(--text-xs); letter-spacing: .02em;
  color: var(--ink-500); margin-bottom: 8px;
}
.pkd-grid {
  display: grid; grid-template-columns: 80px 1fr;
  row-gap: 6px; column-gap: 14px; font-size: var(--text-base);
}
.pkd-code { font-family: var(--mono); color: var(--ink-500); }

/* ── Sub-block (organy: zarząd, RN, prokurenci) ─────────────── */
.sub-block { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--ink-200); }
.sub-block-label {
  font-family: var(--mono); font-size: var(--text-xs); letter-spacing: .02em;
  color: var(--ink-500); margin-bottom: 8px;
}

/* ── Tabela wewnątrz main-col (zarząd, UBO itd.) ─────────────── */
.main-col table {
  font-size: 13px; margin-top: 4px;
}
.main-col table th {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .02em;
  font-weight: 400; color: var(--ink-500);
  padding: 8px 6px; border-bottom: 0.5px solid var(--ink-300); text-align: left;
  white-space: nowrap;
}
.main-col table td {
  padding: 7px 6px; border-bottom: 0.5px solid var(--ink-200);
  vertical-align: top; word-break: break-word;
}
.main-col table tr:last-child td { border-bottom: none; }
.main-col table tr.row-fail td { background: var(--oxblood-soft) !important; }
.main-col table tr.row-warn td { background: var(--amber-soft) !important; }


/* ── Doc footer ─────────────────────────────────────────────── */
.doc-footer {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 20px 40px 40px;
  border-top: 0.5px solid var(--ink-200);
  gap: 40px;
  margin-top: 8px;
}
.doc-footer-left { font-family: var(--mono); font-size: 11px; color: var(--ink-300); }
.doc-footer-right { font-family: var(--mono); font-size: 11px; color: var(--ink-300); text-align: right; line-height: 1.6; }
.doc-footer-admin-link { color: var(--ink-300); text-decoration: none; }
.doc-footer-admin-link:hover { color: var(--ink-500); text-decoration: underline; }

/* Footer na stronie głównej — wycentrowany */
.form-footer {
  font-family: var(--mono); font-size: 9px; color: var(--ink-300);
  text-align: center; letter-spacing: .06em;
  padding: 28px 0 32px; width: 100%;
}

/* ── Misc ───────────────────────────────────────────────────── */
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.smallcaps { text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 600; }
.note-warn {
  margin-top: 10px; padding: 10px 14px;
  border-left: 3px solid var(--amber); background: var(--amber-soft);
  font-family: var(--serif); font-style: italic; font-size: 13px; color: var(--ink-700);
}
.note-err {
  margin-top: 10px; padding: 10px 14px;
  border-left: 3px solid var(--oxblood); background: var(--oxblood-soft);
  font-family: var(--serif); font-style: italic; font-size: 13px; color: var(--oxblood);
}

/* Nota oddziału przedsiębiorcy zagranicznego (§1E) — blok wielowierszowy z listą.
   WCAG: sans ≥14px, line-height ≥1.5, treść ink-700 (kontrast 10.3:1 na tle). */
.oddzial-note {
  margin-top: 12px; padding: 14px 16px;
  border-left: 4px solid var(--oxblood); background: var(--oxblood-soft);
  font-family: var(--sans); font-style: normal;
  font-size: var(--text-sm); line-height: 1.6; color: var(--ink-700);
}
.oddzial-note .oddzial-note-title {
  display: block; color: var(--oxblood); font-weight: 600; margin-bottom: 6px;
}
.oddzial-note .oddzial-note-meta { margin-top: 6px; }
.oddzial-note .oddzial-note-sub { margin-top: 10px; font-weight: 600; }
.oddzial-note ul { margin: 6px 0 0; padding-left: 20px; }
.oddzial-note li { margin-bottom: 4px; line-height: 1.55; }

/* Panel „Co ustalono / Czego nie ustalono" — §I raportu osoby fizycznej (PESEL) bez powiązań */
.pesel-panel {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-bottom: 18px;
}
@media (max-width: 720px) { .pesel-panel { grid-template-columns: 1fr; } }
.pesel-panel-col {
  padding: 14px 16px; border-radius: 2px;
  font-family: var(--sans); font-size: var(--text-sm); line-height: 1.6; color: var(--ink-700);
}
.pesel-panel-ok   { border-left: 4px solid #2E7D5B; background: #E7F0EA; }
.pesel-panel-warn { border-left: 4px solid var(--amber-dark); background: var(--paper-2); }
.pesel-panel-head { font-weight: 600; margin-bottom: 8px; color: var(--ink-900); }
.pesel-panel-list { margin: 0; padding-left: 18px; }
.pesel-panel-list li { margin-bottom: 6px; line-height: 1.6; }

/* ── @media print ────────────────────────────────────────────── */
@media print {
  .app-bar-actions,
  .app-bar-form,
  .app-bar-actions a { display: none !important; }
  #kyc-toolbar { display: none !important; }
  body { background: #fff !important; }
  #app { background: #fff !important; box-shadow: none; }
  .section { background: #fff !important; page-break-inside: avoid; break-inside: avoid; }
  .main-col { background: #fff !important; }
}

/* ── FORM (home page) ───────────────────────────────────────── */
.form-page {
  display: flex; flex-direction: column; align-items: center;
  padding: 60px 40px 0;
}
.form-card {
  width: 560px; max-width: 100%;
  padding: 48px 48px 40px;
  border: 0.5px solid var(--ink-300);
  background: var(--offwhite);
}
.form-card h1 {
  font-family: var(--serif); font-size: 38px; font-weight: 500;
  letter-spacing: -0.02em; margin-bottom: 8px;
}
.form-card .sub {
  font-family: var(--mono); font-size: var(--text-xs); letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-300); margin-bottom: 40px;
}
.form-card .form-row { display: flex; gap: 10px; align-items: stretch; }
.form-card input[type=text] {
  flex: 1; padding: 15px 18px; border: 1px solid var(--ink-300);
  background: var(--offwhite); font-family: var(--mono); font-size: 18px;
  color: var(--ink-900); outline: none;
  transition: border-color .15s;
}
.form-card input[type=text]:focus {
  border-color: var(--ink-900);
  border-left: 3px solid var(--ink-900);
}
.form-card button {
  background: var(--ink-900); color: #fff; border: 1px solid var(--ink-900); padding: 15px 32px;
  font-family: var(--mono); font-style: normal; font-size: var(--text-xs); font-weight: 400;
  letter-spacing: .12em; text-transform: uppercase;
  cursor: pointer; transition: background .15s, opacity .15s;
}
.form-card button:hover { background: var(--ink-700); }
.form-card button:active { opacity: .85; }
.form-card .hint {
  font-family: var(--mono); font-size: var(--text-xs); color: var(--ink-300);
  letter-spacing: .04em; margin-top: 14px; line-height: 1.6;
}

.krz-checkbox-label {
  display: flex; align-items: center; gap: 8px; margin-top: 16px;
  font-family: var(--mono); font-size: var(--text-xs); color: var(--ink-400);
  cursor: pointer; user-select: none;
}
.krz-checkbox-label input[type=checkbox] {
  width: 13px; height: 13px; cursor: pointer;
  border: 1px solid var(--ink-300); accent-color: var(--ink-900);
  flex-shrink: 0;
}
.krz-note { color: var(--ink-300); }
/* ── Status panel ───────────────────────────────────────────── */
.status-panel {
  width: 560px; max-width: 100%;
  margin-top: 32px;
}
.status-divider {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.status-divider::before,
.status-divider::after {
  content: ''; flex: 1; height: 0.5px; background: var(--ink-200);
}
.status-divider-label {
  font-family: var(--mono); font-size: var(--text-xs); letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-300); white-space: nowrap; flex-shrink: 0;
}
.status-ts {
  font-family: var(--mono); font-size: 9px; color: var(--ink-300);
  text-align: center; margin-bottom: 10px; letter-spacing: .04em;
}
.status-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.status-group-label {
  font-family: var(--mono); font-size: 9px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-400);
  margin: 14px 0 6px; padding-bottom: 3px; border-bottom: 0.5px solid var(--ink-100);
}
.status-group-label:first-of-type { margin-top: 4px; }
.status-item {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 8px; border: 0.5px solid var(--ink-100);
  background: var(--offwhite);
  animation: status-slide-in 200ms ease-out;
}
.status-item.fail {
  background: var(--oxblood-soft); border-color: #e8c8cc;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--ink-200);
}
.status-dot.ok   { background: #2E7D52; }
.status-dot.fail { background: #C0392B; }
.status-name {
  font-family: var(--mono); font-size: 10px; color: var(--ink-700);
  letter-spacing: .04em;
}
.status-detail {
  font-family: var(--mono); font-size: 9px; color: var(--ink-400); margin-top: 1px;
}

/* Skeleton loading */
.status-skeleton {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 8px; border: 0.5px solid var(--ink-100); background: var(--offwhite);
}
.skeleton-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--ink-100); animation: sk-pulse 1.4s ease-in-out infinite;
}
.skeleton-line {
  height: 8px; border-radius: 2px;
  background: var(--ink-100); animation: sk-pulse 1.4s ease-in-out infinite;
}
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w40 { width: 40%; margin-top: 3px; }
@keyframes sk-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .35; }
}
@keyframes status-slide-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
.status-placeholder {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 8px; border: 0.5px solid var(--ink-100); background: var(--offwhite);
  opacity: 0.6;
}
.status-placeholder .skeleton-dot {
  background: var(--ink-200); animation: sk-pulse 1.4s ease-in-out infinite;
}
.status-placeholder .status-name {
  font-family: var(--mono); font-size: 10px; color: var(--ink-500);
  letter-spacing: .04em;
}

/* ══ WZORZEC reg-table ══════════════════════════════════════════ */
.reg-table { width: 100%; table-layout: fixed; }
/* Tabela podrzędna (np. wspólnicy s.c. z BIR12) — odstęp od poprzedniego bloku */
.reg-table-sub { margin-top: 8px; }
.reg-table col.c-label  { width: 180px; }
.reg-table col.c-val    { width: auto; }
.reg-table col.c-label2 { width: 160px; }
.reg-table col.c-val2   { width: auto; }
.reg-table tr { border-bottom: 0.5px solid var(--ink-200); }
.reg-table tr:last-child { border-bottom: none; }
.rt-label {
  font-family: var(--sans); font-size: var(--text-xs); font-weight: 400;
  letter-spacing: .02em; color: var(--ink-500);
  padding: 10px 20px 10px 0; vertical-align: top;
  white-space: normal; line-height: 1.5; word-break: break-word;
}
.rt-val {
  font-family: var(--sans); font-size: var(--text-base); font-weight: 400;
  color: var(--ink-900); padding: 10px 0; vertical-align: top; line-height: 1.6;
}
.rt-label-2 {
  font-family: var(--sans); font-size: var(--text-xs); font-weight: 400;
  letter-spacing: .02em; color: var(--ink-500);
  padding: 10px 20px 10px 24px; vertical-align: top;
  white-space: normal; border-left: 0.5px solid var(--ink-200); line-height: 1.5;
}
.rt-source {
  margin-top: 4px; padding-top: 6px; border-top: none;
  font-family: var(--mono); font-size: var(--text-xs); color: var(--ink-500);
  letter-spacing: .06em; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.rt-src-tag {
  border: 0.5px solid var(--ink-300); background: transparent; color: var(--ink-500);
  padding: 1px 7px; font-size: 10px; font-weight: 400;
  letter-spacing: .04em;
}
.fn-ref {
  font-size: 9px; vertical-align: super; line-height: 1;
  color: var(--ink-400); font-family: var(--mono); font-weight: 500;
  cursor: default;
}
.fn-text {
  font-size: 10px; color: var(--ink-400); font-family: var(--mono);
  letter-spacing: .01em;
}
.fn-list {
  margin: 6px 0 0; padding: 6px 0 0 0; list-style: none;
  border-top: 0.5px solid var(--ink-200);
  font-family: var(--mono); font-size: 10px; color: var(--ink-400);
  line-height: 1.6; letter-spacing: .01em;
  display: flex; flex-direction: column; gap: 2px;
}
.fn-list li {
  padding: 0;
}
.fn-list li sup {
  font-size: 9px; margin-right: 3px; color: var(--ink-500);
}
.rt-sub-heading {
  font-family: var(--mono); font-size: var(--text-xs); letter-spacing: .03em;
  color: var(--ink-500);
  margin: 24px -28px 0; padding: 8px 28px;
  background: var(--paper);
  border-top: 0.5px solid var(--ink-300); border-bottom: 0.5px solid var(--ink-200);
  display: block;
}
.rt-entry-list {
  margin: 10px 0 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 5px;
}
.rt-entry-list li {
  font-family: var(--sans); font-size: var(--text-base);
  font-weight: 400; color: var(--ink-900);
}
.rt-entry-count {
  font-family: var(--mono); font-size: var(--text-xs);
  color: var(--ink-500); margin-top: 8px; letter-spacing: .06em;
}
.rt-accounts-list {
  margin: 6px 0 0; display: flex; flex-direction: column; gap: 4px;
}
.rt-accounts-list span {
  font-family: var(--sans); font-size: var(--text-base);
  font-weight: 400; color: var(--ink-900);
}
.rt-expand-toggle {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 6px;
  font-family: var(--mono); font-size: var(--text-xs); color: var(--ink-500);
  cursor: pointer; border: none; background: none; padding: 0;
  border-bottom: 0.5px dotted var(--ink-300); letter-spacing: .05em;
}
.rt-expand-toggle:hover { color: var(--ink-900); }
.rt-expand-body { display: none; margin-top: 8px; line-height: 1.7; font-weight: 400; color: var(--ink-900); }

/* ══ WZORZEC person-table ════════════════════════════════════════ */
.person-table { width: 100%; }
.person-table thead tr { border-bottom: 0.5px solid var(--ink-300); }
.person-table thead th {
  font-family: var(--sans); font-size: var(--text-xs); font-weight: 400;
  letter-spacing: .02em; color: var(--ink-500);
  padding: 8px 12px 8px 0; text-align: left; white-space: nowrap;
}
.person-table thead th:last-child { padding-right: 0; text-align: right; }
.person-table tbody tr { border-bottom: 0.5px solid var(--ink-200); }
.person-table tbody tr:last-child { border-bottom: none; }
.person-table tbody td {
  padding: 10px 12px 10px 0; vertical-align: top;
  font-family: var(--sans); font-size: var(--text-base);
  font-weight: 400; color: var(--ink-900);
}
.person-table tbody td:last-child { padding-right: 0; text-align: right; }
.person-table tbody tr.row-fail td { background: var(--oxblood-soft); }
.person-table tbody tr.row-warn td { background: var(--amber-soft); }
.person-table tbody tr.row-fail:last-child td,
.person-table tbody tr.row-warn:last-child td { border-bottom: none; }
.pt-screen { text-align: right; white-space: nowrap; }
.pt-ctrl {
  font-family: var(--mono); font-size: var(--text-xs);
  letter-spacing: .02em; color: var(--ink-700);
  font-weight: 400;
}
.pt-pts {
  text-align: right; white-space: nowrap; width: 110px;
  font-family: var(--mono); font-size: var(--text-xs);
  color: var(--oxblood); font-weight: 700;
}
.pt-detail {
  font-family: var(--mono); font-size: var(--text-xs);
  color: var(--ink-500); margin-top: 4px; line-height: 1.5;
}
.pt-source {
  margin-top: 12px; padding-top: 10px; border-top: 0.5px solid var(--ink-200);
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: var(--text-xs); color: var(--ink-500); letter-spacing: .06em;
}
.pt-note {
  font-family: var(--mono); font-size: var(--text-xs); color: var(--ink-700);
  margin-top: 10px; padding: 8px 12px;
  background: var(--amber-soft); border-left: 2px solid var(--amber); line-height: 1.6;
}
.pt-note-info {
  font-family: var(--mono); font-size: var(--text-xs); color: #1565c0;
  margin-top: 10px; padding: 8px 12px;
  background: #e3f0fb; border-left: 2px solid #90caf9; line-height: 1.6;
}
.pt-zakres-toggle {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 5px;
  font-family: var(--mono); font-size: var(--text-xs); color: var(--ink-500);
  cursor: pointer; border: none; background: none; padding: 0;
  border-bottom: 0.5px dotted var(--ink-300);
}
.pt-zakres-toggle:hover { color: var(--ink-900); }
.pt-zakres-body {
  display: none; margin-top: 6px; padding: 8px 12px;
  background: var(--paper); border-left: 2px solid var(--ink-300);
  font-family: var(--mono); font-size: var(--text-xs); color: var(--ink-700);
  line-height: 1.7; white-space: pre-wrap;
}
.pt-inner-table { width: 100%; margin-top: 6px; }
.pt-inner-table thead th {
  font-family: var(--sans); font-size: var(--text-xs); font-weight: 400;
  letter-spacing: .02em; color: var(--ink-500);
  padding: 8px 12px 8px 0; text-align: left; border-bottom: 0.5px solid var(--ink-300);
}
.pt-inner-table tbody td {
  font-family: var(--sans); font-size: var(--text-base); font-weight: 400; color: var(--ink-900);
  padding: 9px 12px 9px 0; border-bottom: 0.5px solid var(--ink-200); vertical-align: top;
}
.pt-inner-table tbody tr:last-child td { border-bottom: none; }

/* ══ WZORZEC event-table ═════════════════════════════════════════ */
.event-table { width: 100%; }
.event-table thead tr { border-bottom: 0.5px solid var(--ink-300); }
.event-table thead th {
  font-family: var(--sans); font-size: var(--text-xs); font-weight: 400;
  letter-spacing: .02em; color: var(--ink-500);
  padding: 8px 12px 8px 0; text-align: left; white-space: nowrap;
}
.event-table thead th.et-pts-th { text-align: right; padding-right: 0; }
.event-table tbody tr { border-bottom: 0.5px solid var(--ink-200); }
.event-table tbody tr:last-child { border-bottom: none; }
.event-table tbody td {
  padding: 10px 12px 10px 0; vertical-align: middle;
  font-family: var(--sans); font-size: var(--text-base); font-weight: 400; color: var(--ink-900);
}
.event-table tbody tr.ev-fail td { background: var(--oxblood-soft); }
.event-table tbody tr.ev-warn td { background: var(--amber-soft); }
.event-table tbody tr.ev-fail:last-child td,
.event-table tbody tr.ev-warn:last-child td { border-bottom: none; }
.et-icon { width: 28px; font-size: 15px; text-align: center; padding-right: 4px !important; font-weight: 400; }
.et-pts { text-align: right; white-space: nowrap; padding-right: 0 !important; }
.et-pts.pts-high { color: var(--oxblood); }
.et-pts.pts-med  { color: var(--amber); }
.et-pts.pts-low  { color: var(--ink-300); font-weight: 400; }
.et-footer {
  margin-top: 12px; padding-top: 10px; border-top: 0.5px solid var(--ink-200);
  display: flex; align-items: baseline; justify-content: space-between;
}
.et-count { font-family: var(--mono); font-size: var(--text-xs); color: var(--ink-500); letter-spacing: .06em; }
.et-count a { color: var(--ink-500); border-bottom: 0.5px dotted var(--ink-300); }
.et-sum { font-family: var(--serif); font-style: italic; font-size: var(--text-md); color: var(--ink-900); }
.et-sum strong { font-style: normal; font-weight: 700; }

/* ══ ok-pill.small ═══════════════════════════════════════════════ */
.ok-pill.small { font-size: 11px; padding: 1px 8px; line-height: 1; }

/* ══ action-link — linki zewnętrzne (eKRS, MSiG, sankcje) ═══════ */
a.action-link {
  display: inline-flex; align-items: center; gap: 4px;
  border: 0.5px solid var(--ink-300); border-radius: 3px;
  padding: 1px 7px;
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-500); text-decoration: none;
  white-space: nowrap;
  transition: border-color .12s, color .12s, background .12s;
}
a.action-link:hover {
  border-color: var(--ink-900); color: var(--ink-900);
  background: var(--paper);
}

/* ══ kyc-link — subtelny link do KYC podmiotu/osoby powiązanej ═══
   Nienarzucający się: dziedziczy kolor i font identyfikatora, dyskretne
   podkreślenie kropkowane; pełne podkreślenie + akcent dopiero na hover. */
a.kyc-link {
  color: inherit; text-decoration: none;
  border-bottom: 1px dotted var(--ink-300);
  cursor: pointer;
  transition: color .12s, border-color .12s;
}
a.kyc-link:hover, a.kyc-link:focus-visible {
  color: var(--oxblood); border-bottom-color: var(--oxblood);
  text-decoration: none;
}

/* ── Separator sekcji wewnątrz §I ───────────────────────── */
.rt-separator {
  display: table-row;
}
.rt-separator td {
  padding: 18px 0 6px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .03em;
  color: var(--ink-500);
  border-bottom: 0.5px solid var(--ink-200);
  colspan: 4;
}

/* ── Overlay weryfikacji ─────────────────────────────────── */
#kyc-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(251,250,247,.84);
  backdrop-filter: blur(5px);
  align-items: center; justify-content: center;
}
#kyc-overlay.active { display: flex; }
.kyc-modal {
  background: var(--offwhite);
  border: 0.5px solid var(--ink-300);
  padding: 40px 44px 32px;
  width: 480px;
  max-width: 92vw;
  text-align: center;
  box-shadow: 0 8px 40px rgba(14,27,44,.08);
}
.kyc-modal-title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  font-style: italic;
  letter-spacing: -0.01em;
  color: var(--ink-900);
  margin-bottom: 4px;
}
.kyc-modal-sub {
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-300);
  margin-bottom: 28px;
}
/* progress bar */
.kyc-pbar-bg {
  background: var(--ink-200);
  height: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.kyc-pbar {
  height: 100%;
  background: var(--oxblood);
  width: 0%;
  transition: width .45s ease;
  position: relative;
  overflow: hidden;
}
.kyc-pbar::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.3), transparent);
  animation: kyc-shimmer 1.5s infinite;
}
@keyframes kyc-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.kyc-pct {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .06em;
  color: var(--ink-300);
  text-align: right;
  margin-bottom: 20px;
}
/* aktywny krok */
.kyc-active-row {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 0.5px solid var(--ink-200);
  padding: 14px 16px;
  margin-bottom: 16px;
  text-align: left;
  min-height: 56px;
}
.kyc-spin {
  width: 16px; height: 16px;
  border: 2px solid var(--ink-200);
  border-top-color: var(--oxblood);
  border-radius: 50%;
  animation: kyc-spin .75s linear infinite;
  flex-shrink: 0;
}
@keyframes kyc-spin { to { transform: rotate(360deg); } }
.kyc-step-name {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-900);
  line-height: 1.3;
}
.kyc-step-src {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .06em;
  color: var(--ink-300);
  margin-top: 3px;
}
/* ukończone */
.kyc-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
  min-height: 20px;
  margin-bottom: 20px;
}
.kyc-chip {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .06em;
  color: var(--forest);
  border: 0.5px solid var(--forest);
  padding: 2px 8px;
  animation: kyc-chip-in .15s ease both;
}
@keyframes kyc-chip-in {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: none; }
}
.kyc-modal-footer {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .06em;
  color: var(--ink-300);
}

/* ── Responsive mobile ───────────────────────────────────────── */
@media (max-width: 600px) {
  /* App bar */
  .app-bar {
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .app-bar-form {
    width: 100%;
    order: 3;
  }
  .app-bar-form input[type=text] {
    flex: 1;
    width: auto;
    min-width: 0;
  }
  .app-bar-actions { gap: 12px; }

  /* Home page form */
  .form-page { padding: 16px 12px 0; }
  .form-card  { padding: 24px 16px; width: 100%; }
  .form-card h1 { font-size: 26px; }
  .form-card .sub { margin-bottom: 24px; }
  .form-card .form-row { flex-direction: column; gap: 8px; }
  .form-card .form-row input[type=text] { width: 100%; font-size: 16px; padding: 14px 14px; }
  .form-card .form-row button { width: 100%; padding: 14px; }
  .status-panel { width: 100%; }
  .status-grid { grid-template-columns: repeat(2, 1fr); }

  /* Subject banner */
  .subject-banner {
    padding: 16px 16px;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .banner-risk-col { justify-content: flex-start; }

  /* Report sections: złóż 3-kolumnowy layout w jedną kolumnę */
  .section {
    display: block;
    padding: 16px 0;
  }
  .aside-left {
    padding: 0 16px 0 16px;
  }
  .main-col {
    padding: 12px 16px;
    border-left: none;
    border-right: none;
    border-top: 0.5px solid var(--ink-200);
  }
  .aside-right {
    padding: 8px 16px 0 16px;
    margin-top: 0;
    font-size: 13px;
    border-top: 0.5px solid var(--ink-200);
  }

  /* data-line: usuń stałą szerokość klucza */
  .data-line {
    grid-template-columns: 20px 1fr;
    grid-template-rows: auto auto;
  }
  .data-line-key {
    grid-column: 2;
    grid-row: 1;
  }
  .data-line-val {
    grid-column: 2;
    grid-row: 2;
  }
  .data-line-indicator { grid-row: 1 / span 2; }

  /* section.critical — usuń ujemny margin */
  .section.critical-section {
    margin-left: 0;
    margin-right: 0;
  }

  /* Tabele wewnątrz sekcji — przewijane poziomo */
  .main-col table, .reg-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* check-row: dot | opis | pts */
  .check-row {
    grid-template-columns: 20px 1fr auto;
    grid-template-rows: auto auto;
  }
  .check-row-key { grid-column: 2; grid-row: 1; }
  .check-row-val { grid-column: 2; grid-row: 2; }
  .check-row-pts { grid-column: 3; grid-row: 1 / span 2; align-self: center; }

  /* reg-table: ukryj drugą parę kolumn, złóż do 2 kolumn */
  .reg-table {
    table-layout: fixed;
    width: 100%;
  }
  .reg-table col.c-label  { width: 42%; }
  .reg-table col.c-val    { width: 58%; }
  .reg-table col.c-label2,
  .reg-table col.c-val2   { display: none; }
  .rt-label-2, .reg-table td.rt-label-2,
  .reg-table td:nth-child(3),
  .reg-table td:nth-child(4) {
    display: none;
  }
  .rt-label {
    padding-right: 8px;
    white-space: normal;
    word-break: normal;
    font-size: 11px;
  }
  .rt-val { font-size: 13px; }

  /* person-table: tabele wielokolumnowe przewijane poziomo */
  .person-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .person-table table { white-space: normal; }
  .person-table td, .person-table th {
    white-space: normal;
    font-size: 12px;
    min-width: 70px;
    max-width: 140px;
    word-break: break-word;
  }
  /* macierz kontroli (3 kolumny z pt-ctrl/pt-pts) — nie przewijaj, fixed */
  .person-table:has(.pt-ctrl) {
    display: table;
    table-layout: fixed;
    overflow-x: visible;
    white-space: normal;
    width: 100%;
  }
  .person-table:has(.pt-ctrl) .pt-ctrl { width: 40%; }
  .person-table:has(.pt-ctrl) .pt-pts  { width: 65px; white-space: nowrap; }
  .person-table:has(.pt-ctrl) td, .person-table:has(.pt-ctrl) th {
    font-size: 12px; word-break: break-word; white-space: normal; min-width: unset; max-width: unset;
  }

  /* tabela 6-kolumnowa UBO/CRBR: ukryj PESEL i Obywatelstwo */
  .person-table:not(:has(.pt-ctrl)) thead th:nth-child(2),
  .person-table:not(:has(.pt-ctrl)) thead th:nth-child(3),
  .person-table:not(:has(.pt-ctrl)) tbody td:nth-child(2),
  .person-table:not(:has(.pt-ctrl)) tbody td:nth-child(3) {
    display: none;
  }

  /* risk-table: przewijana */
  .risk-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* nowrap-num może się łamać */
  .nowrap-num { white-space: normal; word-break: break-all; }

  /* Pill mniejszy */
  .ok-pill, .warn-pill, .fail-pill, .na-pill {
    font-size: 11px;
    padding: 2px 6px;
  }

  /* risk-table §III: auto layout, ukryj pts */
  .risk-table {
    display: table;
    table-layout: auto;
    width: 100%;
    white-space: normal;
  }
  .risk-table .cell-id   { width: 24px; }
  .risk-table .cell-result { white-space: nowrap; padding: 8px 4px; font-size: 12px; }
  .risk-table .cell-pts  { display: none; }
  .risk-sum-row .risk-sum-num-wrap { justify-content: flex-start; }
  .risk-table .cell-label { padding: 8px 6px; }
  .risk-table .cell-label-title { font-size: 13px; }
}

/* ── Admin panel mobile ─────────────────────────────────── */
@media (max-width: 600px) {

  /* App-bar: zwijaj nawigację */
  .app-bar {
    height: auto;
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }
  .app-bar-logo { padding-right: 0; }
  .app-bar-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    border-top: 0.5px solid var(--ink-100);
    padding-top: 8px;
    overflow-x: auto;
  }
  .app-bar-actions a {
    padding: 4px 8px;
    font-size: 11px;
    white-space: nowrap;
  }
  .app-bar-dropdown-toggle {
    padding: 4px 8px;
    font-size: 11px;
    white-space: nowrap;
  }
  .app-bar-actions a.app-bar-logout,
  .app-bar-actions a.app-bar-login-btn {
    padding: 3px 8px;
    font-size: 11px;
  }
  .app-bar-sep { display: none; }

  /* Admin body paddingi */
  .body { padding: 20px 16px 32px; }
  .page-wrap { padding: 20px 16px 32px; }
  .subject-banner { padding: 14px 16px; }

  /* Pulpit: 4 liczniki → 2×2 */
  .body > div[style*="repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  /* Pulpit: sidebar → pionowo */
  .body > div[style*="280px"],
  .body > div[style*="1fr 280px"] {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  /* Tabele admin — przewijalne */
  .body table,
  .page-wrap table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .body table td,
  .body table th {
    white-space: nowrap;
  }

  /* Section-card */
  .section-card { padding: 16px; }
}

/* ── Sekcja dokumentów §IX ──────────────────────────────── */
.docs-section { break-inside: avoid; }
@media print { .no-print { display: none !important; } }

.doc-card {
  border: 1px solid var(--ink-100);
  border-top: 3px solid var(--ink-700);
  background: #fff;
  padding: 0;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(14,27,44,.06);
}
.doc-card-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 14px 20px 12px;
  background: var(--offwhite);
  border-bottom: 1px solid var(--ink-100);
}
.doc-card-title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink-900);
  white-space: nowrap;
}
.doc-card-sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--text-sm);
  color: var(--ink-400);
  line-height: 1.4;
}
.doc-form {
  padding: 16px 20px 20px;
}
.doc-form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 18px;
  margin-bottom: 16px;
}
.doc-field { display: flex; flex-direction: column; gap: 4px; }
.doc-field-narrow { grid-column: span 1; }
.doc-field-wide   { grid-column: span 2; }
.doc-field-full   { grid-column: span 3; }
.doc-ubo-wrapper  { grid-column: span 3; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 18px; }
.doc-label {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-400);
  letter-spacing: .03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-input {
  font-family: var(--sans);
  font-size: var(--text-sm);
  color: var(--ink-900);
  border: none;
  border-bottom: 1.5px solid var(--ink-200);
  padding: 5px 0 4px;
  background: transparent;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  transition: border-color .15s;
  border-radius: 0;
}
.doc-input:focus {
  border-bottom-color: var(--ink-700);
  background: transparent;
}
.doc-input[readonly], .doc-input[disabled] {
  color: var(--ink-400);
  border-bottom-style: dashed;
}
select.doc-input {
  cursor: pointer;
  padding-right: 4px;
  -webkit-appearance: auto;
  appearance: auto;
}
textarea.doc-input {
  resize: vertical;
  min-height: 58px;
  line-height: 1.5;
  padding: 4px 0;
}
.doc-submit {
  display: block;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  font-family: var(--sans);
  font-size: var(--text-sm);
  font-weight: 700;
  background: var(--ink-700);
  color: #fff;
  border: none;
  border-radius: 0;
  padding: 10px 20px;
  cursor: pointer;
  letter-spacing: .04em;
  text-align: center;
  text-transform: uppercase;
  margin-top: 4px;
}
.doc-submit:hover  { background: var(--ink-900); }
.doc-submit:active { background: #000; }
.doc-form-divider {
  grid-column: span 3;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-400);
  text-transform: uppercase;
  letter-spacing: .08em;
  border-top: 1px solid var(--ink-100);
  padding-top: 10px;
  margin-top: 6px;
}
.doc-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 5px 0 2px;
}
.doc-check-label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-family: var(--sans);
  font-size: var(--text-sm);
  color: var(--ink-800);
  cursor: pointer;
  line-height: 1.5;
}
.doc-check-label input[type="checkbox"],
.doc-check-label input[type="radio"] {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--ink-700);
  width: 14px;
  height: 14px;
  cursor: pointer;
}
.doc-hint {
  grid-column: span 3;
  font-size: 11px;
  color: var(--ink-400);
  font-style: italic;
  margin-top: -4px;
  margin-bottom: 2px;
}

@media (max-width: 700px) {
  .doc-form-grid { grid-template-columns: 1fr; }
  .doc-field-narrow, .doc-field-wide, .doc-field-full { grid-column: span 1; }
}
