/* =====================================================================
   Rdzen CRM spolki Luvaro - arkusz wspolny.

   Kolory marki kazdy CRM nadpisuje w brand.css (tylko zmienne z :root).
   Tu sa wylacznie komponenty: powloka, karty, tabele, formularze,
   Gantt, kalendarz, zakladki, znaczniki statusow, druk.

   Fonty lokalne (Montserrat, Playfair Display) - naglowek CSP nie
   przepuszcza Google Fonts, a panel ma dzialac bez internetu.
   ===================================================================== */

@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/assets/fonts/montserrat-var-latin-ext.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: 'Montserrat'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/assets/fonts/montserrat-var-latin.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: 'Playfair Display'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/assets/fonts/playfair-var-latin-ext.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: 'Playfair Display'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/assets/fonts/playfair-var-latin.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 {
  /* marka - nadpisywane w brand.css */
  --side: #1b1a18;
  --side-2: #2a2825;
  --side-ink: #e9e3d8;
  --side-muted: #9d968a;
  --accent: #8a6d3b;
  --accent-deep: #6f5730;
  --accent-soft: #f3ead9;
  --gold: #b8925a;

  /* powierzchnie */
  --bg: #f6f3ee;
  --card: #fff;
  --line: #e6dfd3;
  --line-2: #f1ece3;

  /* tekst */
  --ink: #1d1b18;
  --ink-2: #3b372f;
  --muted: #736b5e;

  /* stany */
  --ok: #17693d; --ok-a: #2e9e62; --ok-bg: #e3f2e9;
  --warn: #8a5300; --warn-a: #d69a2d; --warn-bg: #fbf0da;
  --err: #9b2c26; --err-a: #d0433c; --err-bg: #fbe5e3;
  --info: #1f5b8f; --info-a: #4f8fd0; --info-bg: #e5eef8;

  /* kolory projektow / serii */
  --p1: #4f86c6; --p1-bg: #e4eef9;
  --p2: #3e9b6a; --p2-bg: #e2f3e9;
  --p3: #c0782e; --p3-bg: #fbeedd;
  --p4: #8a63c6; --p4-bg: #efe8f9;
  --p5: #c24d6b; --p5-bg: #f9e5eb;

  --r: 7px;
  --r-lg: 12px;
  --shadow: 0 1px 2px rgba(29, 27, 24, .05), 0 1px 1px rgba(29, 27, 24, .03);
  --shadow-lg: 0 14px 34px rgba(29, 27, 24, .18);
  --sans: 'Montserrat', system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --display: 'Playfair Display', Georgia, serif;
  --side-w: 236px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 14px/1.55 var(--sans); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 24px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 10px; }
small, .sm { font-size: 12px; }
.muted { color: var(--muted); }
.serif { font-family: var(--display); font-weight: 600; letter-spacing: 0; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.strong { font-weight: 700; }
.mt { margin-top: 16px; } .mt-s { margin-top: 8px; } .mb { margin-bottom: 16px; } .mb-s { margin-bottom: 8px; }
.hidden { display: none !important; }
.ico { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.ico.sm { width: 15px; height: 15px; }
.ico.lg { width: 24px; height: 24px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
code { font: 12.5px ui-monospace, Consolas, monospace; background: var(--line-2); padding: 1px 5px; border-radius: 4px; }

/* ---------- Powloka --------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }
.side { width: var(--side-w); flex: none; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 30; }
.side-brand { display: block; padding: 26px 22px 20px; color: var(--side-ink); text-decoration: none !important; }
.side-brand svg, .side-brand img { max-width: 100%; display: block; }
.side-nav { display: flex; flex-direction: column; padding: 6px 12px; gap: 2px; flex: 1; }
.side-link { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--r); color: var(--side-ink);
  font-size: 13.5px; font-weight: 500; opacity: .86; text-decoration: none !important; }
.side-link:hover { background: var(--side-2); opacity: 1; }
.side-link.is-active { background: var(--side-2); opacity: 1; font-weight: 650; box-shadow: inset 3px 0 0 var(--gold); }
.side-sep { height: 1px; background: rgba(255,255,255,.08); margin: 8px 10px; }
.side-foot { padding: 18px 22px 22px; font-size: 12px; color: var(--side-muted); line-height: 1.7; }
.side-foot em { font-family: var(--display); font-style: italic; font-size: 13px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 14px; padding: 12px 28px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20; }
.top-search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 14px; color: var(--muted); }
.top-search input { border: 0; background: transparent; outline: 0; flex: 1; font: inherit; color: var(--ink); min-width: 0; width: 100%; }
.top-search { min-width: 0; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.top-icon { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; border-radius: var(--r); color: var(--ink-2); }
.top-icon:hover { background: var(--bg); text-decoration: none; }
.top-icon .dot { position: absolute; top: 2px; right: 2px; background: var(--err-a); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px; display: grid; place-items: center; padding: 0 4px; }
.top-user { display: flex; align-items: center; gap: 9px; color: var(--ink); }
.top-user:hover { text-decoration: none; }
.top-user small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.2; }
.top-user strong { display: block; font-size: 13px; line-height: 1.3; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; flex: none; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.burger { display: none; background: none; border: 0; padding: 6px; cursor: pointer; }
.burger span { display: block; width: 20px; height: 2px; background: var(--ink); margin: 4px 0; border-radius: 2px; }

.page { padding: 26px 28px 40px; flex: 1; }
.foot { padding: 14px 28px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

/* ---------- Przelacznik CRM-ow ----------------------------------------- */
.crm-switch { position: relative; }
.crm-switch summary { list-style: none; display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border: 1px solid var(--line);
  border-radius: 999px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--card); white-space: nowrap; }
.crm-switch summary::-webkit-details-marker { display: none; }
.crm-switch summary:hover { border-color: var(--accent); }
.crm-switch .crm-chev { transform: rotate(90deg); transition: transform .15s; }
.crm-switch[open] .crm-chev { transform: rotate(-90deg); }
.crm-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 270px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; }
.crm-menu-head { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 6px 10px 4px; }
.crm-menu a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r); color: var(--ink); text-decoration: none !important; }
.crm-menu a:hover { background: var(--bg); }
.crm-menu small { display: block; color: var(--muted); font-size: 11.5px; }
.crm-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.crm-login-links { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.crm-login-links > div { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.crm-login-links .btn { gap: 8px; }

/* ---------- Karty i siatki ------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head a.more { font-size: 12.5px; font-weight: 600; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 16px 20px 0; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.stack > * + * { margin-top: 18px; }

.kpi { display: flex; gap: 14px; align-items: center; }
.kpi-ico { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-deep); flex: none; }
.kpi-ico.ok { background: var(--ok-bg); color: var(--ok); }
.kpi-ico.warn { background: var(--warn-bg); color: var(--warn); }
.kpi-ico.err { background: var(--err-bg); color: var(--err); }
.kpi-ico.info { background: var(--info-bg); color: var(--info); }
.kpi small { color: var(--muted); display: block; font-size: 12.5px; }
.kpi strong { font-size: 24px; display: block; line-height: 1.2; letter-spacing: -.02em; }
.kpi .sub { font-size: 12px; color: var(--muted); }

/* ---------- Tabele ---------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
.t th { text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: .03em; text-transform: uppercase; color: var(--muted);
  padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--card); position: sticky; top: 0; }
.t td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: #fcfbf8; }
.t .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.t td.title a { font-weight: 600; color: var(--ink); }
.t td small { display: block; color: var(--muted); }
.t tr.is-done td { color: var(--muted); }
.t tr.is-late td:first-child { box-shadow: inset 3px 0 0 var(--err-a); }
.t tr.row-group td { background: var(--line-2); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.t tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
.card.flush .t th:first-child, .card.flush .t td:first-child { padding-left: 20px; }
.card.flush .t th:last-child, .card.flush .t td:last-child { padding-right: 20px; }

/* ---------- Znaczniki -------------------------------------------------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--line-2); color: var(--ink-2); white-space: nowrap; line-height: 1.6; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.pill.no-dot::before { display: none; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-err { background: var(--err-bg); color: var(--err); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-muted { background: var(--line-2); color: var(--muted); }
.pill-gold { background: var(--accent-soft); color: var(--accent-deep); }
.pill-p1 { background: var(--p1-bg); color: #235d9c; }
.pill-p2 { background: var(--p2-bg); color: #1f6b44; }
.pill-p3 { background: var(--p3-bg); color: #8d4f12; }
.pill-p4 { background: var(--p4-bg); color: #5c3b93; }
.pill-p5 { background: var(--p5-bg); color: #8e2944; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 5px; font-size: 11.5px; font-weight: 600; background: var(--line-2); color: var(--ink-2); }

.bar { display: block; height: 7px; border-radius: 99px; background: var(--line-2); overflow: hidden; min-width: 60px; }
.bar > span { display: block; height: 100%; background: var(--ok-a); border-radius: 99px; }
.bar-warn > span { background: var(--warn-a); }
.bar-err > span { background: var(--err-a); }
.bar-gold > span { background: var(--gold); }
.bar-p1 > span { background: var(--p1); }
.bar-p3 > span { background: var(--p3); }
.bar-lg { height: 9px; }

/* ---------- Przyciski i formularze ------------------------------------ */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: 600 13px var(--sans); cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--side); color: #fff; border-color: var(--side); }
.btn-primary:hover { background: var(--side-2); border-color: var(--side-2); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-deep); }
.btn-danger { color: var(--err); }
.btn-danger:hover { border-color: var(--err); background: var(--err-bg); }
.btn-sm { padding: 5px 9px; font-size: 12px; }
.btn-link { background: none; border: 0; color: var(--accent-deep); font: 600 13px var(--sans); cursor: pointer; padding: 0; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--r) 0 0 var(--r); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--r) var(--r) 0; }
.btn-group .btn.is-on { background: var(--side); color: #fff; border-color: var(--side); position: relative; z-index: 1; }
form.inline { display: inline; }

.form { display: grid; gap: 14px; }
.fg { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.fg-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fg-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.span2 { grid-column: span 2; }
.field.full { grid-column: 1 / -1; }
label, .label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search],
input[type=url], input[type=tel], input[type=datetime-local], select, textarea {
  width: 100%; font: 13.5px var(--sans); color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  padding: 8px 10px; outline: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding-top: 4px; }
.hint { font-size: 12px; color: var(--muted); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters select, .filters input { width: auto; min-width: 150px; padding: 6px 9px; font-size: 13px; }
.filters input[type=checkbox], .filters input[type=radio], .filters input[type=range] { min-width: 0; }

.alert { padding: 11px 15px; border-radius: var(--r); margin-bottom: 16px; font-size: 13.5px; border: 1px solid transparent; }
.alert-ok { background: var(--ok-bg); color: var(--ok); border-color: #c5e6d2; }
.alert-err { background: var(--err-bg); color: var(--err); border-color: #f1c9c5; }
.alert-warn { background: var(--warn-bg); color: var(--warn); border-color: #f0dcb2; }
.alert-info { background: var(--info-bg); color: var(--info); border-color: #c9dcf1; }
.empty { color: var(--muted); padding: 18px 0; text-align: center; font-size: 13px; }

/* ---------- Zakladki -------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: thin; }
.tabs a { padding: 10px 14px; font-size: 13.5px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--ink); }
.tabs a.is-active { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .count { font-size: 11px; background: var(--line-2); padding: 0 6px; border-radius: 9px; }

/* ---------- Listy ------------------------------------------------------ */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.list li:last-child { border-bottom: 0; }
.list .when { width: 46px; flex: none; font-weight: 700; font-size: 12.5px; }
.list .grow { flex: 1; min-width: 0; }
.list .grow a { color: var(--ink); font-weight: 500; }
.list .grow small { display: block; color: var(--muted); }
.list .ico-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.ico-dot.err { background: var(--err-bg); color: var(--err); }
.ico-dot.warn { background: var(--warn-bg); color: var(--warn); }
.ico-dot.info { background: var(--info-bg); color: var(--info); }
.ico-dot.ok { background: var(--ok-bg); color: var(--ok); }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 7px 16px; margin: 0; font-size: 13px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-weight: 500; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 16px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline small { display: block; color: var(--muted); }

/* ---------- Donut (postep) ------------------------------------------- */
.donut { --v: 0; --c: var(--ok-a); width: 120px; height: 120px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--c) calc(var(--v) * 1%), var(--line-2) 0); display: grid; place-items: center; }
.donut > span { width: 86px; height: 86px; border-radius: 50%; background: var(--card); display: grid; place-items: center;
  font-size: 22px; font-weight: 700; }

/* ---------- Gantt ------------------------------------------------------ */
.gantt-wrap { --gl: 290px; --dw: 0px; }
.gantt-tools { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.gantt-tools .btn-group { margin-left: auto; }
.gantt-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.gantt-legend .lg { display: inline-block; width: 14px; height: 8px; border-radius: 3px; margin-left: 8px; }
.gantt-legend .lg-d { display: inline-block; width: 9px; height: 9px; background: var(--gold); transform: rotate(45deg); margin: 0 3px 0 10px; }
.gantt-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); }
.gantt { position: relative; min-width: calc(var(--gl) + max(620px, var(--days) * var(--dw))); font-size: 12.5px; }
.g-row { display: flex; min-height: 34px; border-bottom: 1px solid var(--line-2); }
.g-lab { width: var(--gl); flex: none; padding: 6px 10px 6px calc(12px + var(--depth, 0) * 18px); display: flex; align-items: center; gap: 4px;
  position: sticky; left: 0; background: var(--card); z-index: 3; border-right: 1px solid var(--line); min-width: 0; }
.g-lab-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-lab-txt a { color: var(--ink); }
.g-lab small { display: block; color: var(--muted); font-size: 11px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; }
.g-parent > .g-lab { font-weight: 700; }
.g-child .g-lab { font-size: 12px; }
.g-track { flex: 1; position: relative; }
.g-head { position: sticky; top: 0; z-index: 4; background: var(--card); min-height: 30px; }
.g-head .g-lab { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.g-month { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 600;
  color: var(--muted); border-left: 1px solid var(--line); overflow: hidden; white-space: nowrap; text-transform: capitalize; }
.g-body { position: relative; }
.g-grid { position: absolute; top: 0; bottom: 0; left: var(--gl); right: 0; pointer-events: none; z-index: 1; }
.g-vline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line-2); }
.g-today { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px dashed var(--err-a); z-index: 2; }
.g-today em { position: absolute; top: 2px; left: -18px; background: var(--err-a); color: #fff; font-style: normal; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 4px; }
.g-mark-line { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px solid var(--gold); z-index: 2; }
.g-mark-line em { position: absolute; bottom: 4px; left: 4px; background: var(--gold); color: #fff; font-style: normal; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 4px; white-space: nowrap; }
.g-bar { position: absolute; top: 50%; height: 16px; margin-top: -8px; border-radius: 5px; background: var(--p1); opacity: .9; z-index: 2; overflow: hidden;
  display: block; min-width: 4px; }
.g-bar:hover { opacity: 1; outline: 2px solid rgba(0,0,0,.15); }
.g-prog { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(0,0,0,.22); }
.g-parent .g-bar { height: 12px; margin-top: -6px; }
.g-diamond { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; transform: rotate(45deg); background: var(--gold);
  z-index: 3; border: 2px solid var(--card); box-sizing: content-box; display: block; }
.g-diamond-lab { position: absolute; top: calc(50% + 9px); transform: translateX(-50%); font-size: 10.5px; color: var(--muted); white-space: nowrap; z-index: 3; }
.g-ok, .g-bar.g-ok { background: var(--ok-a); } .lg.g-ok { background: var(--ok-a); }
.g-p1 { background: var(--p1); } .lg.g-p1 { background: var(--p1); }
.g-p2 { background: var(--p2); } .g-p3 { background: var(--p3); } .g-p4 { background: var(--p4); } .g-p5 { background: var(--p5); }
.g-warn { background: var(--warn-a); } .lg.g-warn { background: var(--warn-a); }
.g-err { background: var(--err-a); } .lg.g-err { background: var(--err-a); }
.g-muted { background: #c9c2b5; }
.g-bar.g-clip { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 3px dotted rgba(0,0,0,.35); } .g-gold { background: var(--gold); }
.g-toggle { background: none; border: 0; padding: 2px; cursor: pointer; color: var(--muted); display: inline-flex; transition: transform .15s; }
.g-group.is-open > .g-row > .g-lab .g-toggle { transform: rotate(90deg); }
.g-kids { display: none; }
.g-group.is-open > .g-kids { display: block; }
.g-kids .g-lab { background: #fcfbf8; }
.g-empty { padding: 30px; text-align: center; color: var(--muted); }
.g-row.g-tall { min-height: 52px; }

/* ---------- Kalendarz --------------------------------------------------- */
.cal { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--card); }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div { padding: 8px 10px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--line-2); }
.cal-cell { min-height: 112px; padding: 6px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.is-out { background: #faf8f4; }
.cal-cell.is-out .cal-day { color: #bbb3a5; }
.cal-cell.is-weekend { background: #fcfaf6; }
.cal-cell.is-today { background: var(--accent-soft); }
.cal-cell.is-today .cal-day { background: var(--accent); color: #fff; border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; }
.cal-day { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.cal-week .cal-cell { min-height: 360px; }
.cal-more { font-size: 11px; color: var(--muted); font-weight: 600; }
.ev { display: block; padding: 2px 7px; border-radius: 4px; font-size: 11.5px; line-height: 1.45; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border-left: 3px solid var(--p1); background: var(--p1-bg); color: var(--ink); text-decoration: none !important; }
.ev:hover { filter: brightness(.96); }
.ev small { color: var(--muted); }
.ev-p1 { border-color: var(--p1); background: var(--p1-bg); }
.ev-p2 { border-color: var(--p2); background: var(--p2-bg); }
.ev-p3 { border-color: var(--p3); background: var(--p3-bg); }
.ev-p4 { border-color: var(--p4); background: var(--p4-bg); }
.ev-p5 { border-color: var(--p5); background: var(--p5-bg); }
.ev-gold { border-color: var(--gold); background: var(--accent-soft); }
.ev-err { border-color: var(--err-a); background: var(--err-bg); }
.ev-muted { border-color: #bbb3a5; background: var(--line-2); color: var(--muted); }
.agenda-day { display: flex; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.agenda-day.is-today .agenda-date strong { color: var(--accent-deep); }
.agenda-date { width: 90px; flex: none; }
.agenda-date strong { display: block; font-size: 15px; }
.agenda-date small { color: var(--muted); }
.agenda-items { flex: 1; display: grid; gap: 5px; min-width: 0; }
.agenda-items .ev { white-space: normal; padding: 5px 10px; font-size: 13px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); align-items: center; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Modal ------------------------------------------------------- */
dialog.modal { border: 0; border-radius: var(--r-lg); padding: 0; width: min(720px, 94vw); box-shadow: var(--shadow-lg); }
dialog.modal::backdrop { background: rgba(20, 18, 15, .45); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px 20px; max-height: 72vh; overflow-y: auto; }

/* ---------- Logowanie --------------------------------------------------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; justify-content: space-between; padding: 48px; }
.login-art blockquote { font-family: var(--display); font-size: 30px; line-height: 1.3; margin: 0; max-width: 460px; }
.login-art p { color: var(--side-muted); }
.login-box { display: grid; place-items: center; padding: 40px; }
.login-box form { width: min(360px, 100%); }
.login-box h1 { margin-bottom: 6px; }

/* ---------- Druk ------------------------------------------------------- */
@media print {
  .side, .top, .foot, .no-print, .gantt-tools .btn-group, .page-head .actions { display: none !important; }
  body { background: #fff; font-size: 11px; }
  .page { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  .gantt-scroll { overflow: visible; }
  .gantt { min-width: 0 !important; }
  @page { size: A4 landscape; margin: 12mm; }
}

/* ---------- Responsywnosc ---------------------------------------------- */
@media (max-width: 1200px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-2-1, .g-1-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .side { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .side.is-open { transform: none; }
  .burger { display: block; }
  .g2, .g3, .g4, .fg-2, .fg-3 { grid-template-columns: minmax(0, 1fr); }
  .field.span2 { grid-column: auto; }
  .page { padding: 18px 16px 30px; }
  .top { padding: 10px 16px; }
  .top-user-txt, .hide-sm, .top-date { display: none; }
  .top { gap: 8px; }
  .top-right { gap: 6px; }
  .page-head .actions { width: 100%; }
  .kpi strong { font-size: 20px; }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .gantt-wrap { --gl: 170px; }
  .cal-cell { min-height: 70px; }
  .ev { font-size: 10px; padding: 1px 4px; }
}
