/* ==========================================================================
   KOLORDACH CRM — system wizualny
   Typografia: Plus Jakarta Sans (nagłówki, nazwy, kwoty, statystyki) + Inter (interfejs).
   Grubości: 400 / 500 / 600. Cyfry tabelaryczne w kwotach i liczbach.
   ========================================================================== */

@font-face { font-family: "Inter"; src: url("/fonts/inter-regular.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-medium.woff") format("woff"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-semibold.woff") format("woff"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("/fonts/plus-jakarta-sans-var.woff") format("woff"); font-weight: 200 800; font-style: normal; font-display: swap; }

:root {
  /* marka */
  --red: #d93425; --red-600: #bf2c1f; --red-50: #fdf2f1; --red-100: #fbe1de;
  /* menu */
  --nav: #192633; --nav-2: #213140; --nav-ink: #c9d3dd; --nav-ink-strong: #ffffff; --nav-muted: #7f8fa0;
  /* powierzchnie */
  --bg: #f5f6f8; --surface: #ffffff; --line: #e6e9ee; --line-soft: #eef1f4;
  --ink: #111827; --ink-2: #374151; --muted: #6b7280; --faint: #9ca3af;
  --ok: #16a34a; --warn: #b45309; --danger: #c2410c;
  /* typografia */
  --f-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --f-display: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  /* skala */
  --fs-xs: 11.5px; --fs-sm: 12.5px; --fs-base: 14px; --fs-md: 15px; --fs-lg: 18px; --fs-xl: 22px; --fs-2xl: 28px;
  /* układ */
  --r-sm: 6px; --r: 10px; --r-lg: 14px;
  --sb: 268px; --sb-c: 68px; --top: 60px;
  --shadow-1: 0 1px 2px rgb(16 24 40 / 4%);
  --shadow-pop: 0 12px 32px rgb(16 24 40 / 14%), 0 2px 6px rgb(16 24 40 / 6%);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 var(--fs-base)/1.5 var(--f-ui);
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { display: block; }

/* ── Typografia: wspólne style ── */
.t-display { font: 600 var(--fs-2xl)/1.2 var(--f-display); letter-spacing: -0.02em; margin: 0; }
.t-h1 { font: 600 var(--fs-xl)/1.25 var(--f-display); letter-spacing: -0.015em; margin: 0; display: flex; align-items: center; gap: 10px; }
.t-h2 { font: 600 var(--fs-lg)/1.3 var(--f-display); letter-spacing: -0.01em; margin: 0 0 6px; }
.t-h3 { font: 600 var(--fs-md)/1.35 var(--f-display); margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.t-label { font: 500 var(--fs-xs)/1.3 var(--f-ui); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 8px; }
.t-sub { color: var(--muted); margin: 4px 0 0; font-size: var(--fs-base); }
.t-strong { font-weight: 500; color: var(--ink); }
.t-small { font-size: var(--fs-sm); }
.t-muted { color: var(--muted); }
.t-danger { color: var(--danger); }
.t-num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.t-note { color: var(--muted); font-size: var(--fs-sm); margin: 12px 2px 0; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.grow { flex: 1; min-width: 0; }
.clip { display: block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stale { color: var(--warn); font-weight: 500; }
.count { font: 500 var(--fs-sm)/1 var(--f-ui); color: var(--muted); background: var(--line-soft); padding: 4px 8px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.i { width: 18px; height: 18px; flex: none; }
.i-sm { width: 15px; height: 15px; }
.i-xs { width: 13px; height: 13px; }
.link { display: inline-flex; align-items: center; gap: 4px; color: var(--red); font-weight: 500; font-size: var(--fs-sm); }
.link:hover { color: var(--red-600); }

/* ── Menu boczne ── */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sb); z-index: 60;
  background: var(--nav); color: var(--nav-ink); display: flex; flex-direction: column;
  transition: width .18s ease, transform .22s ease;
}
.sb-head { display: flex; align-items: center; height: var(--top); padding: 0 16px; flex: none; }
.sb-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sb-brand img { border-radius: 8px; flex: none; }
.sb-word { font: 600 16px/1 var(--f-display); letter-spacing: .04em; color: #fff; white-space: nowrap; }
.sb-word b { font-weight: 600; color: #ff6a5b; }
.sb-close { display: none; margin-left: auto; background: none; border: 0; color: var(--nav-ink); padding: 6px; cursor: pointer; }
.sb-nav { flex: 1; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; scrollbar-color: #33475a transparent; }
.sb-item {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 9px 12px; border-radius: 8px; border: 0; background: none; cursor: pointer;
  color: var(--nav-ink); font: 500 13.5px/1.25 var(--f-ui); text-align: left; white-space: nowrap;
  transition: background .12s, color .12s;
}
.sb-item .i { width: 19px; height: 19px; color: var(--nav-muted); transition: color .12s; }
.sb-item:hover { background: rgb(255 255 255 / 6%); color: #fff; }
.sb-item:hover .i { color: #fff; }
.sb-item.active { background: rgb(255 255 255 / 9%); color: #fff; }
.sb-item.active .i { color: #ff6a5b; }
.sb-item.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--red); }
.sb-label { overflow: hidden; text-overflow: ellipsis; }
.sb-count { margin-left: auto; font: 500 11.5px/1 var(--f-ui); color: var(--nav-ink); background: rgb(255 255 255 / 10%); padding: 3px 7px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.sb-item.active .sb-count { background: var(--red); color: #fff; }
.sb-foot { padding: 10px; border-top: 1px solid rgb(255 255 255 / 7%); }
.sb-collapse .i { transition: transform .18s; }
.sb-overlay { display: none; }

/* zwinięte menu: same ikony + podpowiedzi */
.nav-collapsed .sidebar { width: var(--sb-c); }
.nav-collapsed .sb-word, .nav-collapsed .sb-label, .nav-collapsed .sb-count { display: none; }
.nav-collapsed .sb-head { padding: 0; justify-content: center; }
.nav-collapsed .sb-item { justify-content: center; padding: 10px 0; }
.nav-collapsed .sb-collapse .i { transform: rotate(180deg); }
.nav-collapsed .sb-item[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
  background: #0f1923; color: #fff; font: 500 12.5px/1 var(--f-ui); padding: 8px 10px; border-radius: 6px; white-space: nowrap;
  box-shadow: var(--shadow-pop); pointer-events: none; z-index: 80;
}
.nav-collapsed .sb-item.active .sb-count { display: none; }

/* ── Górny pasek ── */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--top); margin-left: var(--sb);
  display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: rgb(245 246 248 / 86%); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
  transition: margin-left .18s ease;
}
.nav-collapsed .topbar, .nav-collapsed .main { margin-left: var(--sb-c); }
.tb-menu { display: none; background: none; border: 0; padding: 6px; margin-left: -6px; cursor: pointer; color: var(--ink); }
.search {
  flex: 1; max-width: 520px; height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px; color: var(--faint);
}
.search:focus-within { border-color: #c9ced6; box-shadow: 0 0 0 3px rgb(17 24 39 / 5%); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: 400 var(--fs-base) var(--f-ui); color: var(--ink); }
.env-pill { font: 500 var(--fs-xs)/1 var(--f-ui); color: #92400e; background: #fef3c7; border: 1px solid #fde68a; padding: 6px 10px; border-radius: 99px; white-space: nowrap; }
.tb-new { margin-left: auto; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; }
.usermenu summary::-webkit-details-marker { display: none; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--nav); color: #fff; font: 600 13px/1 var(--f-display); }
.env-strip { text-align: center; font: 500 var(--fs-xs)/1 var(--f-ui); color: #92400e; background: #fef3c7; padding: 7px; position: fixed; top: 0; left: 0; right: 0; z-index: 5; }

/* ── Menu rozwijane ── */
.menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px; z-index: 70;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-pop); padding: 6px;
}
.menu-right { left: auto; right: 0; }
.menu a, .menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 7px;
  font: 400 var(--fs-base)/1.2 var(--f-ui); color: var(--ink-2); cursor: pointer; text-align: left; white-space: nowrap;
}
.menu a:hover, .menu button:hover { background: var(--bg); color: var(--ink); }
.menu .i { width: 16px; height: 16px; color: var(--muted); }
.menu-head { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; font-size: var(--fs-sm); }
.dd { position: relative; }
.dd summary { list-style: none; }
.dd summary::-webkit-details-marker { display: none; }

/* ── Główna część ── */
.main { margin-left: var(--sb); padding: 28px 32px 56px; max-width: 1680px; transition: margin-left .18s ease; }
.main-bare { padding: 0; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.ph-text { flex: 1; min-width: 240px; }
.ph-actions { display: flex; gap: 8px; align-items: center; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-1); }
.panel + .panel { margin-top: 16px; }
.panel.narrow { max-width: 560px; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.split > .panel + .panel { margin-top: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head .t-h3 { margin: 0; }
.bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.bar .seg-tabs { margin: 0; }
.bar .filters { margin: 0 0 0 auto; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-sm); font-weight: 500; margin-bottom: 14px; }
.back-link:hover { color: var(--ink); }
.flash { padding: 11px 14px; border-radius: var(--r); margin-bottom: 16px; font-weight: 500; font-size: var(--fs-sm); }
.flash-ok { background: #ecfdf3; color: #166534; border: 1px solid #c6f0d5; }
.flash-error { background: #fef3f2; color: #a8261b; border: 1px solid #fcd2cd; }
.notice { background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--r); padding: 14px 16px; margin-bottom: 18px; }
.notice p { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: #92400e; }
.notice ul { margin: 0 0 10px; padding-left: 18px; }
.notice li { margin-bottom: 6px; }

/* ── Przyciski ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 500 var(--fs-base)/1 var(--f-ui); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { border-color: #cfd4db; background: #fafbfc; }
.btn .i { width: 17px; height: 17px; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-600); border-color: var(--red-600); }
.btn-ghost { background: none; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgb(17 24 39 / 5%); border-color: transparent; }
.btn-sm { height: 32px; padding: 0 11px; font-size: var(--fs-sm); border-radius: 8px; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon .dd-label { display: none; }
.btn.is-disabled { opacity: .45; pointer-events: none; }
.pill { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--red); color: #fff; font: 600 10.5px/1 var(--f-ui); margin-left: 6px; font-variant-numeric: tabular-nums; }

/* przełączniki widoku */
.seg { display: inline-flex; background: #eceef2; border-radius: 9px; padding: 3px; }
.seg a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 7px; font: 500 var(--fs-sm)/1 var(--f-ui); color: var(--muted); }
.seg a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(16 24 40 / 10%); }
.seg .i { width: 15px; height: 15px; }
.seg-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.seg-tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 4px; margin-right: 18px; font: 500 var(--fs-base)/1 var(--f-ui); color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.seg-tabs a:hover { color: var(--ink); }
.seg-tabs a.on { color: var(--ink); border-bottom-color: var(--red); }
.seg-tabs a span { font: 500 var(--fs-xs)/1 var(--f-ui); color: var(--muted); background: var(--line-soft); padding: 3px 7px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.seg-tabs a.on span { background: var(--red-50); color: var(--red); }

/* status i znaczniki */
.status { display: inline-flex; align-items: center; gap: 6px; font: 500 var(--fs-sm)/1.2 var(--f-ui); color: var(--ink-2); white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: none; }
.team { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); white-space: nowrap; }
.team i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.ral { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ral i { width: 14px; height: 14px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 12%); display: inline-block; flex: none; }
.warn-dot { color: var(--warn); margin-left: 6px; display: inline-flex; vertical-align: -2px; }
.warn-dot .i { width: 14px; height: 14px; }
.type-tag { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-sm); color: var(--muted); }
.prep { font-size: var(--fs-sm); color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.prep.ok { color: var(--ok); }
.prep .i { width: 14px; height: 14px; }

/* ── Formularze ── */
input, select, textarea {
  width: 100%; min-height: 38px; padding: 8px 11px; border: 1px solid #d9dde3; border-radius: 8px; background: var(--surface);
  font: 400 var(--fs-base)/1.4 var(--f-ui); color: var(--ink); transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-100); }
input:disabled, select:disabled, textarea:disabled { background: var(--bg); color: var(--muted); }
textarea { resize: vertical; }
label { display: flex; flex-direction: column; gap: 6px; font: 500 var(--fs-sm)/1.3 var(--f-ui); color: var(--ink-2); }
label.check { flex-direction: row; align-items: center; gap: 9px; font-weight: 400; font-size: var(--fs-base); color: var(--ink); }
label.check input { width: 17px; height: 17px; min-height: 0; accent-color: var(--red); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.form-sec + .form-sec { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line-soft); }
.grid-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 16px; }
.grid-form.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-form.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.checks { display: flex; flex-wrap: wrap; gap: 12px 26px; }
.mt { margin-top: 16px; }
.form-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.form-foot > span:first-child { margin-right: auto; }
.form-stack { display: flex; flex-direction: column; gap: 12px; }
.radio-seg { display: inline-flex; gap: 6px; margin-bottom: 16px; }
.radio-seg label { flex-direction: row; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; font-weight: 500; color: var(--ink-2); }
.radio-seg input { position: absolute; opacity: 0; width: 0; height: 0; min-height: 0; }
.radio-seg label:has(input:checked) { border-color: var(--ink); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.radio-seg .i { width: 16px; height: 16px; }

/* filtry list */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.f-search { flex-direction: row; align-items: center; gap: 8px; height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--faint); min-width: 240px; }
.f-search input { border: 0; min-height: 0; padding: 0; box-shadow: none !important; font-weight: 400; }
.f-more { display: contents; }
.f-more select { width: auto; min-height: 36px; padding: 6px 30px 6px 10px; font-size: var(--fs-sm); }
.f-toggle { display: none; }

/* ── Tabele ── */
.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow-x: auto; box-shadow: var(--shadow-1); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 12px 16px; font: 500 var(--fs-xs)/1.2 var(--f-ui); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fbfbfc; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; font-size: var(--fs-base); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: #fafbfc; }
.table tr[data-href] { cursor: pointer; }
.table .num { text-align: right; }
.table .c-client { min-width: 220px; }
.table .c-note { max-width: 300px; }
.cards { display: none; }

/* ── Pulpit ── */
.kpis { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow-1); transition: border-color .12s; }
.kpi:hover { border-color: #cfd4db; }
.kpi-value { font: 600 26px/1.1 var(--f-display); letter-spacing: -0.02em; }
.kpi-label { font-size: var(--fs-sm); color: var(--muted); line-height: 1.3; }
.kpi-accent .kpi-value { color: var(--red); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .t-label { margin: 0; }
.stat-value { font: 600 22px/1.2 var(--f-display); letter-spacing: -0.015em; }
.stat-value small, .sm-value small { font: 500 var(--fs-sm) var(--f-ui); color: var(--muted); }
.goal-title { margin-top: 26px; }
.goal + .goal { margin-top: 12px; }
.goal-head { display: flex; gap: 10px; font-size: var(--fs-sm); margin-bottom: 6px; }
.goal-head span:first-child { width: 96px; color: var(--muted); }
.goal-head span:nth-child(2) { margin-right: auto; }
.goal-head b { font-weight: 600; }
.goal-bar { height: 6px; background: var(--line-soft); border-radius: 99px; overflow: hidden; }
.goal-bar span { display: block; height: 100%; background: var(--red); border-radius: 99px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li + li { border-top: 1px solid var(--line-soft); }
.rows a, .rows .row-static { display: flex; align-items: center; gap: 12px; padding: 11px 2px; }
.rows a:hover .t-strong { color: var(--red); }
.rows .nr { width: 64px; flex: none; }

/* ── Karta klienta ── */
.deal { max-width: 1240px; }
.dh { display: flex; align-items: flex-start; gap: 24px; margin-bottom: 22px; }
.dh-main { flex: 1; min-width: 0; }
.dh-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-top: 8px; color: var(--muted); font-size: var(--fs-base); }
.dh-meta > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.dh-actions { display: flex; gap: 8px; flex: none; }
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); margin-bottom: 12px; }
.summary > div { padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.summary > div + div { border-left: 1px solid var(--line-soft); }
.sm-label { font: 500 var(--fs-xs)/1.2 var(--f-ui); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.sm-value { font: 600 19px/1.3 var(--f-display); letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-value .ral { font: inherit; }
.strip { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; padding: 10px 4px; margin-bottom: 6px; font-size: var(--fs-sm); color: var(--ink-2); }
.strip > span { display: inline-flex; align-items: center; gap: 7px; }
.strip b { font-weight: 600; }
.strip .i { color: var(--muted); }
.strip-warn, .strip-warn .i { color: var(--warn) !important; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 6px 0 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { display: inline-flex; align-items: center; padding: 12px 14px; font: 500 var(--fs-base)/1 var(--f-ui); color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--red); }
.ov { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ov .panel + .panel { margin-top: 0; }
.ov-big { display: flex; align-items: center; gap: 10px; font: 600 var(--fs-lg)/1.3 var(--f-display); margin: 0 0 12px; }
.ov-big i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.ov-text { margin: 0 0 4px; font-size: var(--fs-md); color: var(--ink); }
.ov .link { margin-top: 12px; }
.progress { display: flex; gap: 4px; list-style: none; padding: 0; margin: 0 0 10px; }
.progress li { flex: 1; height: 5px; border-radius: 99px; background: var(--line-soft); }
.progress li.done { background: #f2a49b; }
.progress li.now { background: var(--red); }
.stage-form { display: flex; gap: 8px; margin-top: 16px; }
.stage-form select { flex: 1; }
.note-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 14px; }
.note-form textarea { min-height: 40px; }
.mini-tl { list-style: none; margin: 0; padding: 0; }
.mini-tl li { display: flex; flex-direction: column; gap: 1px; padding: 7px 0; }
.mini-tl li + li { border-top: 1px solid var(--line-soft); }
.others { margin-top: 16px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: var(--fs-sm); padding-top: 1px; }
.kv dd { margin: 0; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; text-align: right; }
.totals .t-strong { font: 600 var(--fs-lg) var(--f-display); color: var(--ink); }
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 30px 16px; color: var(--muted); }
.empty-state p { margin: 0; max-width: 460px; font-size: var(--fs-sm); }
.empty-ico { width: 22px; height: 22px; color: #c7ccd4; }

/* zadania */
.tasks { list-style: none; margin: 0; padding: 0; }
.tasks li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.tasks li:first-child { border-top: 0; }
.tasks li.done .grow > span:first-child { color: var(--muted); text-decoration: line-through; }
.tasks .prio::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--red); margin-right: 8px; vertical-align: 2px; }
.tick { width: 20px; height: 20px; margin-top: 1px; border: 1.5px solid #c7ccd4; border-radius: 6px; background: var(--surface); display: grid; place-items: center; cursor: pointer; padding: 0; color: var(--ok); }
.tick .i { width: 14px; height: 14px; }
.tick:hover { border-color: var(--ok); }
.task-form { display: grid; grid-template-columns: 1fr 150px 120px 170px auto; gap: 8px; margin-bottom: 14px; }

/* historia */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { display: flex; gap: 14px; padding: 0 0 18px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 14px; top: 30px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.tl-dot { width: 29px; height: 29px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--muted); flex: none; }
.tl-body { display: flex; flex-direction: column; gap: 2px; padding-top: 4px; min-width: 0; }
.tl-title { font-weight: 500; }
.tl-body p { margin: 4px 0; color: var(--ink-2); background: var(--bg); border-radius: 8px; padding: 9px 12px; }

/* planowanie */
.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 16px; }
.month { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.month header { display: flex; align-items: baseline; justify-content: space-between; padding: 16px 18px 6px; }
.month header .t-h3 { margin: 0; }
.month-muted header .t-h3 { color: var(--muted); }
.plan-list { list-style: none; margin: 0; padding: 4px 8px 8px; }
.plan-list a { display: grid; grid-template-columns: 56px 1fr auto; grid-template-areas: "date main team" "date meta team"; gap: 0 12px; align-items: center; padding: 10px; border-radius: 9px; }
.plan-list a:hover { background: var(--bg); }
.pl-date { grid-area: date; font: 600 var(--fs-base) var(--f-display); }
.pl-main { grid-area: main; display: flex; flex-direction: column; min-width: 0; }
.pl-meta { grid-area: meta; color: var(--muted); }
.plan-list .team, .plan-list a > .t-small:last-child { grid-area: team; }

/* kontakty */
.profile { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.pf-avatar { width: 52px; height: 52px; border-radius: 14px; background: var(--nav); color: #fff; display: grid; place-items: center; }
.pf-avatar .i { width: 24px; height: 24px; }
.pf-main { flex: 1; min-width: 220px; }
.pf-actions { display: flex; gap: 8px; }

/* moduły w przygotowaniu */
.module { text-align: center; padding: 40px 24px; }
.module-ico { width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 14px; background: var(--red-50); color: var(--red); display: grid; place-items: center; }
.module-ico .i { width: 24px; height: 24px; }
.module > .t-muted { max-width: 520px; margin: 0 auto; }
.module-parts { list-style: none; padding: 0; margin: 26px auto 0; max-width: 780px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; text-align: left; }
.module-parts li { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: var(--r); background: #fcfcfd; }

/* kanban */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; min-height: 60vh; }
.kcol { flex: 0 0 260px; background: #eef0f3; border-radius: var(--r-lg); padding: 10px; }
.kcol-side { flex-basis: 220px; background: #f1f2f4; }
.kcol header { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; font: 600 var(--fs-sm)/1.2 var(--f-display); }
.kcol header i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.kcol header b { margin-left: auto; font: 500 var(--fs-xs) var(--f-ui); color: var(--muted); font-variant-numeric: tabular-nums; }
.ksum { font-size: var(--fs-xs); color: var(--muted); padding: 0 6px 8px; }
.kitems { display: flex; flex-direction: column; gap: 8px; min-height: 48px; border-radius: 10px; }
.kitems.over { outline: 2px dashed var(--red); outline-offset: 3px; background: #fff6f5; }
.kcard { display: flex; flex-direction: column; gap: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow-1); cursor: grab; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.kcard:hover { border-color: #cfd4db; }
.kcard.dragging { opacity: .35; }
.kcard.ghost { position: fixed; z-index: 100; width: 240px; pointer-events: none; box-shadow: var(--shadow-pop); transform: rotate(1.5deg); }
.kmeta { display: flex; gap: 10px; font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; }

/* okno dialogowe */
.dialog { border: 0; border-radius: var(--r-lg); padding: 22px; width: min(420px, calc(100vw - 32px)); box-shadow: var(--shadow-pop); }
.dialog::backdrop { background: rgb(15 23 42 / 35%); }
.dialog .t-h3 { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* logowanie */
.auth-body { min-height: 100vh; display: grid; place-items: center; background: var(--bg); }
.auth-card { width: min(400px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 30px; box-shadow: 0 24px 48px rgb(16 24 40 / 8%); margin: 48px auto; }
.auth-brand { display: flex; align-items: center; gap: 10px; }
.auth-brand .brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--red); color: #fff; font: 700 16px var(--f-display); }
.auth-brand .brand-name { font: 600 17px/1 var(--f-display); letter-spacing: .04em; }
.auth-brand .brand-name b { font-weight: 600; color: var(--red); }
.auth-brand small { margin-left: auto; font: 500 var(--fs-xs) var(--f-ui); letter-spacing: .1em; color: var(--muted); }
.auth-card h1 { font: 600 var(--fs-xl)/1.3 var(--f-display); margin: 22px 0 16px; }
.btn-block { width: 100%; height: 42px; }
.btn-link { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 10px 0; text-decoration: underline; }
.code-input { font: 600 22px var(--f-display); letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.steps { padding-left: 20px; }
.steps li { margin-bottom: 12px; }
.secret { font: 600 16px var(--f-display); letter-spacing: .08em; background: var(--bg); border: 1px dashed #c7ccd4; border-radius: 8px; padding: 10px 12px; margin: 8px 0; word-break: break-all; user-select: all; font-variant-numeric: tabular-nums; }
.form-inline { display: flex; gap: 8px; }
.form-inline input { max-width: 180px; }
.error-card { margin: 48px auto; text-align: center; }
.error-card .t-h1 { justify-content: center; margin-bottom: 8px; }

/* ── Szerokie ekrany / tablet ── */
@media (max-width: 1360px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .split, .ov { grid-template-columns: 1fr; }
  .dh { flex-direction: column; gap: 16px; }
  .module-parts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-form { grid-template-columns: 1fr 1fr; }
  .task-form input[name=title] { grid-column: 1 / -1; }
  .table .c-note, .table .c-source, .table .c-owner { display: none; }
}

/* ── Telefon / mały tablet: menu wysuwane ── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); width: min(300px, 86vw) !important; box-shadow: var(--shadow-pop); }
  .nav-open .sidebar { transform: none; }
  .nav-open .sb-overlay { display: block; position: fixed; inset: 0; background: rgb(15 23 42 / 40%); z-index: 55; }
  .sb-close { display: block; }
  .nav-collapsed .sb-word, .nav-collapsed .sb-label, .nav-collapsed .sb-count { display: initial; }
  .nav-collapsed .sb-item { justify-content: flex-start; padding: 9px 12px; }
  .nav-collapsed .sb-head { padding: 0 16px; justify-content: flex-start; }
  .sb-foot { display: none; }
  .topbar, .main, .nav-collapsed .topbar, .nav-collapsed .main { margin-left: 0; }
  .topbar { padding: 0 14px; gap: 8px; }
  .tb-menu { display: inline-flex; }
  .env-pill { display: none; }
  .main { padding: 20px 16px calc(40px + var(--safe-b)); }
}
@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .tb-new span { display: none; }
  .tb-new { width: 38px; padding: 0; }
  .search { height: 38px; }
  .t-display { font-size: 23px; }
  .t-h1 { font-size: 20px; }
  .page-head { margin-bottom: 14px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi-value { font-size: 22px; }
  .panel { padding: 16px; border-radius: 12px; }
  .grid-form, .grid-form.grid-2, .grid-form.grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .table-card { display: none; }
  .cards { display: flex; flex-direction: column; gap: 8px; list-style: none; margin: 0; padding: 0; }
  .cards li { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-1); }
  .card-link { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; }
  .cl-top { display: flex; align-items: center; gap: 4px; }
  .cl-nr { margin-left: auto; font-size: var(--fs-xs); }
  .cl-mid { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 2px; }
  .cl-call { display: grid; place-items: center; width: 54px; border-left: 1px solid var(--line-soft); color: var(--red); flex: none; }
  .cl-call .i { width: 21px; height: 21px; }
  .f-search { flex: 1; min-width: 0; }
  .f-toggle { display: inline-flex; height: 36px; }
  .f-more { display: none; width: 100%; gap: 8px; flex-wrap: wrap; }
  .f-more.open { display: flex; }
  .f-more select { flex: 1 1 45%; }
  .bar .filters { margin: 0; width: 100%; }
  /* karta klienta na telefonie */
  .dh-actions { width: 100%; display: grid; grid-template-columns: 1.25fr 1fr 1fr 44px; gap: 6px; }
  .dh-actions .btn { width: 100%; padding: 0 8px; }
  .dh-actions .dd { min-width: 0; }
  .dh-actions .dd > summary { width: 100%; }
  .summary { grid-template-columns: 1fr 1fr; }
  .summary > div { padding: 12px 14px; }
  .summary > div:nth-child(3) { border-left: 0; }
  .summary > div:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
  .sm-value { font-size: 16.5px; }
  .tabs a { padding: 12px 11px; }
  .kv { grid-template-columns: 110px 1fr; }
  .months { grid-template-columns: 1fr; }
  .module-parts { grid-template-columns: 1fr; }
  .kcol { flex-basis: 80vw; }
  .note-form { flex-direction: column; align-items: stretch; }
  .hide-sm { display: none; }
  input, select, textarea { font-size: 16px; } /* iOS bez powiększania */
  .f-more select, .f-search input { font-size: 15px; }
}
