/* Uzupełnienia do IBM Carbon Design System (@carbon/styles 1.71.0, motyw White).
   Wyłącznie tokeny Carbon (--cds-*) i paleta data-viz Carbon – bez własnych kolorów. */
:root {
  --viz-1: #6929c4;   /* purple 70 */
  --viz-pl: #9f1853;  /* magenta 70 – dane polskie */
  --viz-eu: #1192e8;  /* cyan 50 – dane europejskie */
  --viz-warn: #b28600;/* yellow 50 */
  --mono: "IBM Plex Mono", "Menlo", monospace;
}
html, body { color-scheme: light; }
body { background: var(--cds-background); color: var(--cds-text-primary); font-family: "IBM Plex Sans", system-ui, sans-serif; }
.page { padding: 4.5rem 2rem 4rem; max-width: 1312px; margin: 0 auto; }
.page.doc { max-width: 1056px; }
a { color: var(--cds-link-primary); }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.muted { color: var(--cds-text-secondary); }
.helper { color: var(--cds-text-helper); font-size: .75rem; line-height: 1.34; letter-spacing: .32px; }

/* nagłówek UI Shell */
.cds--header__menu-item[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; border-bottom: 3px solid var(--cds-border-interactive, #0f62fe); }
.cds--header__menu-item { position: relative; }
.hdr-user { display: flex; align-items: center; height: 100%; font-size: .875rem; }
.hdr-user[hidden] { display: none; }
.hdr-user a { color: #c6c6c6; text-decoration: none; padding: 0 1rem; height: 100%; display: flex; align-items: center; }
.hdr-user a[href]:hover { background: #353535; color: #f4f4f4; }
.hdr-user__out { border-left: 1px solid #393939; }
.hdr-status { margin-left: auto; padding: 0 1rem; display: flex; align-items: center; gap: .5rem; color: #c6c6c6; font-size: .75rem; letter-spacing: .32px; }
.hdr-dot { width: 8px; height: 8px; background: #f1c21b; }
.hdr-dot.on { background: #42be65; }

/* typografia dokumentu (skala productive Carbon) */
.eyebrow { font-size: .75rem; letter-spacing: .32px; color: var(--cds-text-secondary); margin: 0 0 .5rem; }
.h1 { font-size: 2rem; line-height: 1.25; font-weight: 400; margin: 0 0 .5rem; }
.h2 { font-size: 1.25rem; line-height: 1.4; font-weight: 400; margin: 0 0 1rem; }
.h3 { font-size: 1rem; font-weight: 600; margin: 0 0 .5rem; }
.lead { font-size: 1rem; line-height: 1.5; max-width: 44rem; }

/* raport – sekcje numerowane */
.doc-head { display: grid; grid-template-columns: 1fr auto; gap: 2rem; align-items: end; padding: 2rem 0 1.5rem; border-bottom: 1px solid var(--cds-border-subtle-01); }
.doc-actions { display: flex; gap: 1px; }
.doc-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--cds-border-subtle-01); }
.doc-meta > div { padding: 1rem 1rem 1rem 0; }
.doc-meta dt { font-size: .75rem; letter-spacing: .32px; color: var(--cds-text-secondary); margin-bottom: .25rem; }
.doc-meta dd { margin: 0; font-size: .875rem; }
.section { display: grid; grid-template-columns: 12rem 1fr; gap: 2rem; padding: 2.5rem 0; border-bottom: 1px solid var(--cds-border-subtle-01); }
.section-no { font-family: var(--mono); font-size: .875rem; color: var(--cds-text-secondary); }
.section-no b { display: block; font-family: "IBM Plex Sans"; font-weight: 400; font-size: 1.25rem; color: var(--cds-text-primary); margin-top: .25rem; }
@media (max-width: 860px) { .section { grid-template-columns: 1fr; gap: 1rem; } .doc-meta { grid-template-columns: 1fr 1fr; } .doc-head { grid-template-columns: 1fr; } }

.result { display: grid; grid-template-columns: auto 1fr; gap: 2.5rem; align-items: end; margin-bottom: 2rem; }
.result .big { font-size: 4.5rem; line-height: 1; font-weight: 300; letter-spacing: -.02em; }
.result .big small { font-size: 1.25rem; font-weight: 400; margin-left: .5rem; letter-spacing: 0; }
.result .stmt { font-size: 1rem; line-height: 1.5; max-width: 30rem; padding-bottom: .375rem; }

/* tabele w raporcie */
.cds--data-table td.num, .cds--data-table th.num { text-align: right; }
.cds--data-table th.num .cds--table-header-label { text-align: right; width: 100%; }
.cds--data-table tfoot td { font-weight: 600; border-top: 1px solid var(--cds-border-strong-01); background: var(--cds-layer-01); }
.bar { height: 8px; background: var(--cds-layer-accent-01); min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--viz-1); }
.bar i.pl { background: var(--viz-pl); } .bar i.eu { background: var(--viz-eu); }
.bar i.unsure { background: repeating-linear-gradient(135deg, var(--viz-warn) 0 3px, transparent 3px 6px); }
.share { display: flex; height: 24px; margin: .5rem 0 .75rem; background: var(--cds-layer-accent-01); }
.share i { display: block; height: 100%; }
.legend { display: flex; gap: 1.5rem; flex-wrap: wrap; font-size: .75rem; letter-spacing: .32px; color: var(--cds-text-secondary); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: .5rem; vertical-align: -1px; background: var(--c); }
.kv-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--cds-border-subtle-01); }
.kv-list li { display: grid; grid-template-columns: 14rem 1fr; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--cds-border-subtle-01); font-size: .875rem; line-height: 1.43; }
.kv-list li > span:first-child { color: var(--cds-text-secondary); }
.notice { margin: 1.5rem 0 0; max-width: none; }

/* strona główna */
.home { display: grid; grid-template-columns: 22rem 1fr; gap: 2rem; align-items: start; padding-top: 2rem; }
@media (max-width: 960px) { .home { grid-template-columns: 1fr; } }
.upload { background: var(--cds-layer-01); padding: 1.5rem; }
.upload .cds--form-item { margin-top: 1.5rem; }
.drop { border: 1px dashed var(--cds-border-strong-01); padding: 2rem 1rem; text-align: center; cursor: pointer; background: var(--cds-field-01); }
.drop:hover, .drop.over { border: 2px solid var(--cds-focus); padding: calc(2rem - 1px) calc(1rem - 1px); }
.drop .t { font-size: .875rem; color: var(--cds-link-primary); }
.drop .f { margin-top: .5rem; font-size: .875rem; font-family: var(--mono); }
.upload .cds--btn { margin-top: 2rem; width: 100%; max-width: none; }
tr.click { cursor: pointer; }

/* edycja dopasowań */
.toolbar { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin: 1.5rem 0 0; }
.toolbar .cds--content-switcher { width: auto; max-width: 100%; height: auto; flex-wrap: wrap; }
#filters .cds--content-switcher-btn { white-space: nowrap; padding: 0 1rem; flex: 0 0 auto; inline-size: auto; max-inline-size: none; }
#filters .cds--content-switcher__label { overflow: visible; text-overflow: clip; max-inline-size: none; }
.toolbar .search { margin-left: auto; width: 18rem; }
.cell-sub { font-size: .75rem; color: var(--cds-text-secondary); margin-top: .125rem; letter-spacing: .32px; line-height: 1.34; }
.cell-why { font-size: .75rem; color: var(--cds-text-helper); margin-top: .25rem; }
.cds--data-table td { vertical-align: top; }
.cds--tag { margin: 0 .25rem 0 0; }
.conf { display: inline-block; width: 40px; height: 4px; background: var(--cds-layer-accent-01); vertical-align: middle; margin-left: .25rem; }
.conf i { display: block; height: 100%; background: var(--cds-support-success); }

/* panel boczny (wzór: Carbon side panel) */
.side-panel { position: fixed; top: 48px; right: 0; bottom: 0; width: min(40rem, 100vw); background: var(--cds-layer-01); border-left: 1px solid var(--cds-border-subtle-01);
  transform: translateX(100%); transition: transform 240ms cubic-bezier(.2, 0, .38, .9); z-index: 8000; overflow: auto; }
.side-panel.open { transform: none; }
.side-scrim { position: fixed; inset: 48px 0 0 0; background: rgba(22, 22, 22, .5); opacity: 0; pointer-events: none; transition: opacity 240ms; z-index: 7999; }
.side-scrim.open { opacity: 1; pointer-events: auto; }
.sp-head { position: sticky; top: 0; background: var(--cds-layer-01); padding: 1.5rem 1.5rem 1rem; border-bottom: 1px solid var(--cds-border-subtle-01); z-index: 2; }
.sp-head .close { position: absolute; top: .5rem; right: .5rem; }
.sp-body { padding: 1.5rem; }
.sp-block { background: var(--cds-layer-02, #fff); padding: 1rem; margin-bottom: 1.5rem; }
.sp-block .kv-list li { grid-template-columns: 10rem 1fr; }
.cand { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; padding: 1rem 0; border-bottom: 1px solid var(--cds-border-subtle-01); align-items: start; }
.cand.sel { box-shadow: inset 3px 0 0 var(--cds-interactive); padding-left: .75rem; }
.cand .meta { font-size: .75rem; letter-spacing: .32px; color: var(--cds-text-secondary); margin-top: .25rem; }
.row { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.row .grow { flex: 1; min-width: 12rem; }
.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(1rem); background: #262626; color: #f4f4f4; padding: .875rem 1rem; font-size: .875rem; opacity: 0; transition: 200ms; z-index: 9000; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.empty { padding: 3rem 1rem; text-align: center; color: var(--cds-text-secondary); }

@media print {
  .cds--header, .doc-actions, .side-panel, .side-scrim, .no-print { display: none !important; }
  .page { padding: 0; max-width: none; }
  .section { break-inside: avoid; padding: 1.25rem 0; }
  .result .big { font-size: 3rem; }
}

/* strona dla niezalogowanych */
.lp-head { padding-top: 1rem; }
.lp-nav { margin-left: auto; }
.lp-head .h1 { max-width: 40rem; }
.lp-head .lead { margin: 1rem 0 0; }
.lp-formula { font-family: var(--mono); font-size: 1.25rem; margin: 0 0 .5rem; }
.lp-legend { margin: 0 0 1.5rem; max-width: 44rem; }
.lp-steps { margin: 0 0 1.25rem; padding: 0; list-style: none; counter-reset: s; border-top: 1px solid var(--cds-border-subtle-01); }
.lp-steps li { counter-increment: s; display: grid; grid-template-columns: 2rem 1fr; padding: .75rem 0; border-bottom: 1px solid var(--cds-border-subtle-01); font-size: .875rem; line-height: 1.43; }
.lp-steps li::before { content: counter(s); font-family: var(--mono); color: var(--cds-text-secondary); }
.lp-steps li b { font-weight: 600; }
.lp-p { font-size: .875rem; line-height: 1.5; max-width: 44rem; margin: 0; }
code { font-family: var(--mono); font-size: .875em; }

/* stopka */
body { display: flex; flex-direction: column; min-height: 100vh; }
main#view, main.page { flex: 1 0 auto; width: 100%; }
.site-footer { background: var(--cds-layer-01); border-top: 1px solid var(--cds-border-subtle-01); color: var(--cds-text-secondary); font-size: .75rem; line-height: 1.34; letter-spacing: .32px; }
.site-footer__in { max-width: 1312px; margin: 0 auto; padding: 1.5rem 2rem 2rem; display: grid; grid-template-columns: 1fr auto; gap: .75rem 2rem; }
.site-footer b { color: var(--cds-text-primary); font-weight: 600; }
.site-footer nav { display: flex; gap: 1.5rem; }
.site-footer a { color: var(--cds-link-primary); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer__src { grid-column: 1 / -1; margin: 0; max-width: 60rem; }
@media (max-width: 672px) { .site-footer__in { grid-template-columns: 1fr; padding: 1.5rem 1rem; } }
@media print { .site-footer nav { display: none; } }
.result .range { font-size: .875rem; color: var(--cds-text-secondary); margin-top: .5rem; letter-spacing: .16px; }

/* lista kosztorysów */
.projects { table-layout: fixed; }
.projects col.c-name { width: 38%; }
.projects col.c-inv { width: 20%; }
.projects col.c-date { width: 14%; }
.projects col.c-val { width: 10%; }
.projects col.c-stat { width: 18%; }
.projects th { vertical-align: bottom; padding-top: .75rem; padding-bottom: .75rem; }
.projects th .cds--table-header-label { line-height: 1.29; }
.projects th.num .cds--table-header-label { white-space: nowrap; }
.projects .th-unit { display: block; font-weight: 400; font-size: .75rem; letter-spacing: .32px; color: var(--cds-text-secondary); }
.projects td { padding-top: 1rem; padding-bottom: 1rem; vertical-align: top; line-height: 1.43; }
.projects td .cell-sub { margin-top: .25rem; }
.projects td.val { font-size: 1rem; font-variant-numeric: tabular-nums; }
.projects td.num-date { font-variant-numeric: tabular-nums; }
.projects .nowrap, .projects td .cds--tag { white-space: nowrap; }
.projects td .cds--tag { margin: -.125rem 0 0; }
.projects tr.click:hover td { background: var(--cds-layer-hover-01); }
.cds--data-table-container .cds--data-table-header { padding-bottom: 1.25rem; }
.projects .show-sm { display: none; }
@media (max-width: 760px) {
  .projects { table-layout: auto; }
  .projects col { width: auto !important; }
  .projects .hide-sm { display: none; }
  .projects .show-sm { display: block; }
  .projects td .cds--tag { white-space: normal; }
  .projects th, .projects td { padding-left: .75rem; padding-right: .75rem; }
}
