/* ========================================================
   Klastra • Radar Przetargów
   Tokeny i komponenty według DESIGN.md (Cal.com monochrome)
   ======================================================== */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ink: #111111;
  --body: #374151;
  --muted: #6b7280;
  --muted-soft: #9ca3af;
  --surface: #ffffff;
  --bg: #fafafa;
  --surface-subtle: #f4f4f5;
  --row-hover: #f9fafb;
  --border: #e5e7eb;
  --border-strong: #d1d5db;

  --primary: #111111;
  --primary-hover: #262626;
  --klastra-amber: #f59e0b;

  --green: #15803d;
  --green-bg: #f0fdf4;
  --green-border: #bbf7d0;
  --amber: #b45309;
  --amber-bg: #fffbeb;
  --amber-border: #fde68a;
  --red: #b91c1c;
  --red-bg: #fef2f2;
  --red-border: #fecaca;
  --blue: #1d4ed8;
  --blue-bg: #eff6ff;
  --blue-border: #bfdbfe;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius: 10px;
  --radius-pill: 9999px;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --focus: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink);
  --control-h: 36px;
}

/* Skalowanie tekstu A / A+ / A++ */
html { font-size: 100%; }
html[data-font="lg"] { font-size: 112.5%; }
html[data-font="xl"] { font-size: 125%; }

/* Tryb wysokiego kontrastu */
html[data-contrast="high"] {
  --body: #111111;
  --muted: #374151;
  --muted-soft: #4b5563;
  --border: #6b7280;
  --border-strong: #111111;
  --surface-subtle: #e5e7eb;
  --row-hover: #e5e7eb;
  --bg: #ffffff;
  --green: #14532d;
  --amber: #78350f;
  --red: #7f1d1d;
  --blue: #1e3a8a;
  --green-border: #14532d;
  --amber-border: #78350f;
  --red-border: #7f1d1d;
  --blue-border: #1e3a8a;
  --focus: 0 0 0 2px #ffffff, 0 0 0 5px #111111;
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  min-height: 100dvh;
}

body {
  font-size: 0.875rem;
  line-height: 1.5;
  overflow-x: hidden;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

:focus { outline: none; }
:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--radius-sm);
}

.hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.sprite { position: absolute; width: 0; height: 0; }

.ico {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.muted-small {
  font-size: 0.8125rem;
  color: var(--muted);
}

h1, h2, h3 { margin: 0; }

/* Znak: papierowy samolot (oferta w locie) na kobaltowym kafelku */
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #2f5bff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-mark svg { width: 70%; height: 70%; }
.brand-mark.sm { width: 30px; height: 30px; border-radius: 8px; }

/* Logowanie */
.auth-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 390px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-xs);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.auth-brand h1 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.025em; }
.auth-brand p { margin: 2px 0 0; font-size: 0.8125rem; color: var(--muted); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-hint {
  margin: 18px 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

/* Pola */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 0.8125rem; font-weight: 500; color: var(--body); }

.field input, .notes-input, .sort-select {
  width: 100%;
  min-height: 38px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 7px 11px;
  color: var(--ink);
}
textarea.notes-input { line-height: 1.5; resize: vertical; }
.field input:hover, .notes-input:hover, .sort-select:hover { border-color: var(--border-strong); }
.field input:focus-visible, .notes-input:focus-visible, .sort-select:focus-visible {
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
  border-radius: var(--radius-md);
}
.sort-select { width: auto; padding-right: 8px; cursor: pointer; display: none; }

.error-text {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--red);
  background: var(--red-bg);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--red-border);
}

/* Przyciski */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--control-h);
  padding: 0 12px;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
}
.btn:hover:not(:disabled) { background: var(--surface-subtle); border-color: var(--border-strong); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-primary { background: var(--primary); color: #ffffff; border-color: var(--primary); font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-sm { min-height: 32px; padding: 0 10px; }
.btn-block { width: 100%; min-height: 40px; }
.btn-danger { color: var(--red); border-color: var(--red-border); }
.btn-danger:hover:not(:disabled) { background: var(--red-bg); border-color: var(--red); }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.push-right { margin-left: auto; }

.icon-btn {
  width: var(--control-h);
  height: var(--control-h);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--body);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-subtle); color: var(--ink); }

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--ink);
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-align: left;
}

/* Układ */
.klastra-layout { display: flex; min-height: 100dvh; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
}

.sidebar-org { display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; }
.sidebar-org-text { display: flex; flex-direction: column; min-width: 0; }
.sidebar-org-text strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-org-text span { font-size: 0.75rem; color: var(--muted); }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 10px;
  margin-bottom: 10px;
  color: var(--muted);
}
.search-box:hover { border-color: var(--border-strong); }
.search-box:focus-within { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.search-box input {
  border: none;
  background: transparent;
  width: 100%;
  min-width: 0;
  color: var(--ink);
  padding: 0;
}
.search-box input:focus-visible { box-shadow: none; }
.search-box kbd {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 5px;
}
.search-mobile { display: none; }

.nav-group-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  padding: 12px 10px 4px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: var(--control-h);
  padding: 0 10px;
  border: none;
  background: transparent;
  color: var(--body);
  border-radius: var(--radius-md);
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.nav-item:hover { background: var(--surface-subtle); color: var(--ink); }
.nav-item.active { background: var(--surface-subtle); color: var(--ink); font-weight: 600; }
.nav-item-left { display: flex; align-items: center; gap: 9px; min-width: 0; }

.nav-badge {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--body);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.display-settings { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: space-between; }
.sidebar-user { display: flex; align-items: center; gap: 8px; }
.sidebar-user-name { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.seg button {
  min-width: 34px;
  padding: 0 6px;
  white-space: nowrap;
  min-height: 32px;
  border: none;
  border-right: 1px solid var(--border);
  background: var(--surface);
  color: var(--body);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.seg button:last-child { border-right: none; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #ffffff; }
[data-contrast-toggle][aria-pressed="true"] { background: var(--ink); color: #ffffff; border-color: var(--ink); }

.avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink);
  color: #ffffff;
  font-size: 0.6875rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.breadcrumb { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; }
.breadcrumb .muted { color: var(--muted); }
.breadcrumb .sep { color: var(--muted-soft); }
.breadcrumb strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.page-content { padding: 20px 24px 48px; max-width: 1360px; width: 100%; margin: 0 auto; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.page-title-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; min-width: 0; }
.page-title-row h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.025em; }
.date-meta { font-size: 0.8125rem; color: var(--muted); }
.page-head-actions { display: flex; gap: 8px; align-items: center; }
#cap-chip-val.good { color: var(--green); }
#cap-chip-val.warn { color: var(--amber); }
#cap-chip-val.danger { color: var(--red); }

/* Karty i panele */
.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.panel-gap { margin-bottom: 14px; }

.panel-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px 14px;
  flex-wrap: wrap;
}
.panel-head.between { justify-content: space-between; }
.panel-title-wrap { display: flex; align-items: center; gap: 8px; margin-right: auto; }
.panel-title-wrap h2, .panel-head h2 { font-size: 1rem; font-weight: 600; }
.panel-body { padding: 14px 16px; }

.count-pill {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-subtle);
  color: var(--ink);
  border: 1px solid var(--border);
}

.source-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip {
  min-height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--body);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
}
.chip:hover { border-color: var(--border-strong); color: var(--ink); }
.chip.active { background: var(--ink); color: #ffffff; border-color: var(--ink); }

/* Plakietki: zawsze ikona i słowo */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--ink);
  white-space: nowrap;
}
.pill .ico { width: 12px; height: 12px; stroke-width: 2; }
.pill-green { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.pill-blue { background: var(--blue-bg); color: var(--blue); border-color: var(--blue-border); }
.pill-amber { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-border); }
.pill-red { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }
.pill-dark { background: var(--ink); color: #ffffff; border-color: var(--ink); }

.code-meta {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--body);
  white-space: nowrap;
}

/* Układ roboczy: tabela + inspektor */
.workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 440px);
  gap: 14px;
  align-items: start;
}

.t-head, .t-row {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr) 6rem 6.5rem 6rem 9.5rem;
  gap: 12px;
  align-items: center;
  padding: 0 14px;
}
.t-head {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 34px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}
.t-sort {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: none;
  background: none;
  padding: 4px 0;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  cursor: pointer;
}
.t-sort .ico { width: 12px; height: 12px; }
.t-sort:hover, .t-sort[aria-pressed="true"] { color: var(--ink); }

.tender-feed { max-height: calc(100dvh - 232px); overflow-y: auto; }

.t-row {
  position: relative;
  padding-top: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  box-shadow: inset 2px 0 0 transparent;
}
.t-row:last-child { border-bottom: none; }
.t-row:hover { background: var(--row-hover); }
.t-row.selected { background: var(--surface-subtle); box-shadow: inset 2px 0 0 var(--ink); }

.t-score {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.9375rem;
}
.t-score small { font-size: 0.6875rem; font-weight: 500; color: var(--muted); }
.t-score.tier-green { color: var(--green); }
.t-score.tier-blue { color: var(--blue); }
.t-score.tier-amber { color: var(--amber); }
.t-score.tier-red { color: var(--red); }

.t-main { min-width: 0; }
.t-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  width: 100%;
  border: none;
  background: none;
  padding: 0;
  text-align: left;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  cursor: pointer;
}
/* Cały wiersz jest celem kliknięcia tytułu */
.t-title::after { content: ""; position: absolute; inset: 0; }
.t-title:focus-visible { box-shadow: none; }
.t-row:has(.t-title:focus-visible) { box-shadow: inset 0 0 0 2px var(--ink); }
.t-sub {
  margin-top: 2px;
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.t-ai {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 0.8125rem;
  color: var(--body);
}
.t-ai .pill { flex-shrink: 0; }
.t-ai span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-row.ai-no { opacity: 0.72; }
.t-row.ai-no:hover, .t-row.ai-no.selected { opacity: 1; }

.reject-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--body);
}
.reject-summary strong { color: var(--ink); margin-right: 4px; }

.t-label { display: none; }
.t-published { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 0.8125rem; line-height: 1.35; color: var(--body); }
.t-published small { display: block; font-family: var(--sans); font-size: 0.75rem; color: var(--muted); }
.t-deadline { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 0.8125rem; line-height: 1.35; }
.t-deadline small { display: block; font-family: var(--sans); font-size: 0.75rem; color: var(--muted); }
.t-deadline.urgent, .t-deadline.urgent small { color: var(--red); font-weight: 600; }
.t-wadium { font-size: 0.8125rem; color: var(--body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-status { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.t-quick { display: none; gap: 4px; position: relative; z-index: 1; }
.t-row:hover .t-quick, .t-row:focus-within .t-quick { display: inline-flex; }
.t-row:hover .t-status .pill, .t-row:focus-within .t-status .pill { display: none; }
.quick-btn {
  min-height: 26px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.quick-btn.go { background: var(--ink); color: #ffffff; border-color: var(--ink); }
.quick-btn.drop:hover { background: var(--red-bg); color: var(--red); border-color: var(--red); }

.empty-state { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty-state strong { color: var(--ink); }

/* Inspektor */
.inspector-pane { position: sticky; top: 66px; max-height: calc(100dvh - 82px); overflow-y: auto; }
.inspector-empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.inspector-empty strong { color: var(--ink); }
.inspector-mobile-bar { display: none; }
.inspector-head { padding: 16px 18px 14px; border-bottom: 1px solid var(--border); }
.inspector-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.inspector-title { margin: 0 0 6px; font-size: 1.0625rem; font-weight: 600; line-height: 1.35; letter-spacing: -0.015em; }
.inspector-meta { font-size: 0.8125rem; color: var(--body); }
.inspector-actions { padding: 10px 18px; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.inspector-tabs { display: flex; gap: 2px; padding: 0 18px; border-bottom: 1px solid var(--border); }
.inspector-tab {
  min-height: 38px;
  padding: 0 12px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}
.inspector-tab:hover { color: var(--ink); }
.inspector-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.inspector-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 18px; }

.spec-list { margin: 0; display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 12px; }
.spec-list dt { font-size: 0.8125rem; color: var(--muted); }
.spec-list dd { margin: 0; font-weight: 500; }
.spec-list dd small { display: block; font-weight: 400; font-size: 0.75rem; color: var(--muted); }

.note-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 0.8125rem;
}
.note-box.amber { background: var(--amber-bg); border-color: var(--amber-border); color: var(--amber); }
.note-box strong { display: block; margin-bottom: 2px; }
.note-line { font-size: 0.8125rem; margin: 0 0 4px; color: var(--body); }
.note-line.red { color: var(--red); }
.note-line.amber { color: var(--amber); }
.note-line.blue { color: var(--blue); }

.section-lbl { font-size: 0.8125rem; font-weight: 600; color: var(--ink); margin: 0 0 8px; }

.criteria-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.crit-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 0.8125rem; margin-bottom: 4px; color: var(--body); }
.crit-top strong { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.crit-bar-track { height: 4px; border-radius: 99px; background: var(--border); overflow: hidden; }
.crit-bar-fill { height: 100%; border-radius: 99px; background: var(--ink); }

/* Plan wejścia */
.spinner.dark { border-color: var(--border); border-top-color: var(--ink); flex-shrink: 0; }
.plan-progress { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--body); }
.plan-verdict { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px; }
.plan-verdict p { margin: 8px 0 0; color: var(--body); }
.plan-teaser-wrap { display: flex; flex-direction: column; gap: 8px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.plan-teaser-sum { margin: 0; color: var(--body); }
.teaser-reqs { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.teaser-reqs li { display: flex; align-items: flex-start; gap: 8px; font-size: 0.8125rem; }
.teaser-reqs .pill { flex-shrink: 0; }
.pipeline-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.plan-teaser { display: block; width: 100%; text-align: left; background: var(--surface); cursor: pointer; color: var(--body); }
.plan-teaser:hover { border-color: var(--ink); }
.plan-teaser .row-wrap { margin-bottom: 4px; }
.pill-tab { margin-left: 4px; padding: 0 6px; font-size: 0.6875rem; }
.fit-row { margin-bottom: 10px; }
.fit-row .muted-small { margin-top: 4px; }
.req-list, .todo-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.req-list li, .todo-list li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.8125rem; }
.req-top { display: flex; align-items: flex-start; gap: 8px; }
.req-top .pill { flex-shrink: 0; }
.req-name { font-weight: 500; color: var(--ink); }
.req-how { margin: 4px 0 2px; color: var(--body); }
.todo-list li { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: 8px; }
.todo-days { color: var(--ink); font-weight: 600; }
.paste-box { border: 1px dashed var(--border-strong); border-radius: var(--radius-md); padding: 8px 12px; }
.paste-box summary { cursor: pointer; font-weight: 500; font-size: 0.8125rem; }
.paste-box textarea { margin: 8px 0; }
.profile-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.profile-form .field:nth-last-of-type(1), .profile-form .row-wrap { grid-column: 1 / -1; }
@media (max-width: 820px) { .profile-form { grid-template-columns: 1fr; } }

.bench-summary { margin: 0 0 8px; font-size: 0.8125rem; color: var(--body); }
.bench-summary strong { color: var(--ink); }
.bench-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.bench-list li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.8125rem; }
.bench-list a { color: var(--ink); font-weight: 500; text-underline-offset: 3px; overflow-wrap: anywhere; }
.bench-meta { margin-top: 2px; color: var(--muted); }
.bench-meta strong { color: var(--ink); font-weight: 600; }

.kw-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.kw-tag {
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 1px 7px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.plain-list { margin: 0; padding-left: 18px; font-size: 0.8125rem; color: var(--body); display: flex; flex-direction: column; gap: 4px; }
.plain-list a { color: var(--ink); font-weight: 500; text-underline-offset: 3px; overflow-wrap: anywhere; }
.notes-row { display: flex; gap: 6px; }
.row-wrap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Tekst z asystenta i raportów (lekki markdown) */
.md {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--body);
  overflow-wrap: anywhere;
}
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 8px; }
.md .md-h { margin: 12px 0 4px; font-weight: 600; color: var(--ink); font-size: 0.875rem; }
.md ul { margin: 0 0 8px; padding-left: 18px; }
.md li { margin-bottom: 2px; }
.md strong { color: var(--ink); font-weight: 600; }

/* Pasek pilnych */
.urgent-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: var(--radius);
  overflow-x: auto;
}
.urgent-label { display: inline-flex; align-items: center; gap: 5px; font-size: 0.8125rem; font-weight: 600; color: var(--red); white-space: nowrap; flex-shrink: 0; }
.urgent-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--red-border);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.8125rem;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.urgent-chip:hover { border-color: var(--red); }
.urgent-chip b { font-family: var(--mono); color: var(--red); font-weight: 600; }

/* Pipeline */
.pipeline-board { margin-bottom: 16px; }
.pipeline-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 10px; flex-wrap: wrap; }
.pipeline-head h2 { font-size: 1rem; font-weight: 600; }
.pipeline-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.pipeline-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pipeline-col-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 6px; border-bottom: 1px solid var(--border); font-size: 0.8125rem; font-weight: 600; }
.pipeline-card { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.pipeline-card-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.pipeline-card-title { font-weight: 600; line-height: 1.35; }
.pipeline-card-actions { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 2px; }

/* Terminy (agenda) */
.agenda-day { margin-bottom: 14px; }
.agenda-day:last-child { margin-bottom: 0; }
.agenda-date { font-size: 0.8125rem; font-weight: 600; margin-bottom: 4px; text-transform: capitalize; }
.agenda-date small { font-weight: 400; color: var(--muted); text-transform: none; margin-left: 6px; }
.agenda-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}
.agenda-time { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 0.8125rem; color: var(--body); }
.agenda-main { min-width: 0; }
.agenda-main .link-btn { display: block; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-right { display: flex; gap: 6px; align-items: center; }

/* Komunikat */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 32px);
  background: var(--ink);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}
.toast-undo {
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: transparent;
  color: #ffffff;
  border-radius: var(--radius-sm);
  min-height: 28px;
  padding: 0 10px;
  font-weight: 600;
  cursor: pointer;
}
.toast-undo:focus-visible { box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px #ffffff; }

.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
}

/* Asystent AI */
.bot-drawer {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 410px;
  max-width: calc(100vw - 24px);
  height: 560px;
  max-height: calc(100dvh - 40px);
  z-index: 75;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.14);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.bot-drawer-head { padding: 10px 12px 10px 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.bot-drawer-title { min-width: 0; }
.bot-drawer-title .muted-small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bot-chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.bot-drawer-messages { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.bot-drawer-form { padding: 10px 12px; border-top: 1px solid var(--border); display: flex; gap: 6px; }
.ai-msg { padding: 8px 10px; border-radius: var(--radius-md); font-size: 0.8125rem; line-height: 1.5; overflow-wrap: anywhere; }
.ai-msg-user { align-self: flex-end; background: var(--ink); color: #ffffff; max-width: 88%; white-space: pre-wrap; }
.ai-msg-bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); color: var(--body); max-width: 96%; }
.ai-msg-bot.md { padding: 8px 10px; }

/* Okno wyboru powodu odrzucenia */
.dialog-center { align-items: flex-end; }
.reject-head { display: flex; flex-direction: column; gap: 2px; padding: 6px 6px 10px; }
.reject-head .muted-small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reject-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.reject-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.reject-opt:hover { border-color: var(--ink); }
.reject-opt kbd {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 5px;
}
.reject-hint { margin: 10px 6px 0; }
@media (min-width: 821px) {
  .sheet-backdrop.dialog-center { align-items: center; justify-content: center; }
  .sheet.reject-sheet { width: 460px; border-radius: var(--radius); padding: 14px; }
}
@media (max-width: 820px) {
  .reject-opt kbd { display: none; }
}

/* Arkusz „Więcej” */
.sheet-backdrop { position: fixed; inset: 0; z-index: 85; background: rgba(0, 0, 0, 0.45); display: flex; align-items: flex-end; }
.sheet {
  width: 100%;
  background: var(--surface);
  border-radius: 12px 12px 0 0;
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sheet-item, .sheet-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 6px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: none;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  border-radius: 0;
}
.sheet-row { justify-content: space-between; cursor: default; }
.sheet-item > span:nth-of-type(1) { flex: 1; }
.sheet-item[aria-pressed="true"] { background: none; color: var(--ink); font-weight: 700; }
.sheet .btn-block { margin-top: 10px; min-height: 44px; }

.mobile-bottom-nav { display: none; }

/* Kolumna wadium tylko na szerokich ekranach; niżej jest w inspektorze. */
@media (max-width: 1560px) {
  .t-head, .t-row { grid-template-columns: 3.5rem minmax(0, 1fr) 6rem 6.5rem 9.5rem; }
  .t-head > :nth-child(5), .t-wadium { display: none; }
}

@media (max-width: 1080px) {
  .workbench-grid { grid-template-columns: 1fr; }
  .tender-feed { max-height: none; }
  .inspector-pane {
    display: none;
    position: fixed;
    inset: 0;
    max-height: 100dvh;
    z-index: 65;
    border-radius: 0;
    border: none;
  }
  .inspector-pane.mobile-open { display: block; }
  .inspector-mobile-bar {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .inspector-head .code-meta { display: none; }
  .pipeline-cols { grid-template-columns: 1fr; }
}

/* Telefon: pola dotykowe 44 px, dolny pasek z ikonami */
@media (max-width: 820px) {
  :root { --control-h: 44px; }
  .sidebar { display: none; }
  .crumb-org { display: none; }
  .topbar { padding: 0 14px; }
  .main-wrap { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .page-content { padding: 14px 14px 24px; }
  .page-title-row h1 { font-size: 1.25rem; }
  .page-head-actions { width: 100%; }
  .page-head-actions .btn { flex: 1; }
  .search-mobile { display: flex; min-height: 44px; margin-bottom: 12px; }
  .btn-sm, .chip, .quick-btn, .inspector-tab, .seg button, .urgent-chip, .toast-undo { min-height: 44px; }
  .seg button { min-width: 44px; }
  .field input, .notes-input, .sort-select { min-height: 44px; font-size: 1rem; }
  .search-box input { font-size: 1rem; }
  .sort-select { display: block; order: 1; font-size: 0.875rem; }
  .panel-title-wrap { flex: 1; }
  .source-chips { order: 2; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; }
  .source-chips .chip { flex-shrink: 0; }

  .t-head { display: none; }
  .t-row {
    grid-template-columns: 44px minmax(0, 1fr);
    grid-template-areas: "score main" "score published" "score deadline" "score status";
    gap: 4px 10px;
    align-items: start;
  }
  .t-score { grid-area: score; padding-top: 1px; }
  .t-main { grid-area: main; }
  .t-deadline { grid-area: deadline; }
  .t-published { grid-area: published; }
  .t-published small { display: inline; margin-left: 6px; }
  .t-label { display: inline; font-family: var(--sans); color: var(--muted); }
  .t-deadline small { display: inline; margin-left: 6px; }
  .t-status { grid-area: status; }
  .t-quick { display: none !important; }
  .t-row .t-status .pill { display: inline-flex !important; }

  .inspector-head, .inspector-actions, .inspector-body { padding-left: 14px; padding-right: 14px; }
  .inspector-tabs { padding: 0 6px; }
  .inspector-actions .btn { flex: 1 1 auto; }
  .inspector-actions .push-right { margin-left: 0; }
  .spec-list { grid-template-columns: 1fr; gap: 2px; }
  .spec-list dd { margin-bottom: 8px; }
  .criteria-grid { grid-template-columns: 1fr; }
  .agenda-item { grid-template-columns: 48px minmax(0, 1fr); }
  .agenda-right { grid-column: 2; }

  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    z-index: 50;
  }
  .mobile-bottom-nav .nav-item {
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-height: 52px;
    padding: 4px 2px;
    font-size: 0.6875rem;
    color: var(--muted);
    background: none;
  }
  .mobile-bottom-nav .nav-item .ico { width: 20px; height: 20px; }
  .mobile-bottom-nav .nav-item.active { color: var(--ink); }

  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); width: max-content; }
  .bot-drawer { right: 0; bottom: 0; width: 100vw; max-width: 100vw; height: 88dvh; max-height: 88dvh; border-radius: 12px 12px 0 0; }
}
