/* NetiCRM – arkusz stylów (bez kroku budowania) */
:root {
  --navy: #252459; --blue: #3650C1; --blue-dark: #2a3f9e; --ink: #1d1f2b; --text: #3b3f52; --muted: #5f6475;
  --line: #d9dce5; --line-soft: #eceef3; --bg: #f6f7fb; --white: #fff;
  --ok-bg: #e7f6ec; --ok: #166534; --warn-bg: #fff4e5; --warn: #92400e; --info-bg: #eef1fb; --prog-bg: #dfe5fa; --prog: #1f2f7a;
  --neutral-bg: #f1f2f5; --err-bg: #fdecea; --err: #9f1c12; --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; }
a { color: var(--blue); } a:hover { color: var(--blue-dark); }
h1 { margin: 0; font-size: 26px; font-weight: 700; color: var(--navy); }
h2 { margin: 0; font-size: 17px; color: var(--navy); }
p { margin: 0; }
.muted { color: var(--muted); } .small { font-size: 13px; } .xs { font-size: 12px; }
.sr { position: absolute; left: -9999px; }

/* układ */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { background: var(--white); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1240px; margin: 0 auto; padding: 12px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.topbar-in.wide { max-width: none; }
.brand img { height: 26px; display: block; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 400px; }
.nav a { padding: 10px 14px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 500; font-size: 14px; }
.nav a.on { background: var(--info-bg); color: var(--navy); font-weight: 600; }
.who { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex: none; }
.who-text { display: flex; flex-direction: column; line-height: 1.25; }
.who-text b { font-size: 14px; } .who-text span { font-size: 12px; color: var(--muted); }
.linkbtn { background: none; border: 0; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; padding: 8px; }
.linkbtn:hover { color: var(--blue); }
main.page { max-width: 1240px; width: 100%; margin: 0 auto; padding: 28px 24px 40px; display: flex; flex-direction: column; gap: 22px; flex: 1; }
.admin-wrap { display: flex; flex-wrap: wrap; flex: 1; }
.sidenav { flex: 1 1 220px; max-width: 250px; background: var(--white); border-right: 1px solid var(--line); padding: 20px 12px; display: flex; flex-direction: column; gap: 2px; }
.sidenav a { padding: 10px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 500; font-size: 14px; display: flex; justify-content: space-between; }
.sidenav a.on { background: var(--info-bg); color: var(--navy); font-weight: 600; }
.sidenav .label { margin: 16px 12px 6px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.count { background: var(--blue); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; font-weight: 600; }
main.admin { flex: 999 1 560px; min-width: 0; padding: 28px 28px 40px; display: flex; flex-direction: column; gap: 20px; }
.foot { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 18px 24px 22px; font-size: 11px; color: var(--muted); }
.foot img { height: 12px; display: block; }

/* elementy */
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.head-l { display: flex; flex-direction: column; gap: 4px; }
.back { font-size: 14px; font-weight: 500; text-decoration: none; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.card > h2 { margin-bottom: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.col-main { flex: 999 1 540px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.col-side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.tile { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 10px; }
.tile .k { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.tile .v { font-size: 26px; font-weight: 700; color: var(--navy); }
.kv { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.kv span { color: var(--muted); }
.list-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line-soft); text-decoration: none; color: inherit; }
.list-row:first-of-type { border-top: 0; }
.list-row .grow { flex: 1 1 260px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--neutral-bg); color: var(--text); }
.b-info { background: var(--info-bg); color: var(--navy); } .b-neutral { background: var(--neutral-bg); color: var(--text); }
.b-progress { background: var(--prog-bg); color: var(--prog); } .b-warning { background: var(--warn-bg); color: var(--warn); }
.b-success { background: var(--ok-bg); color: var(--ok); } .b-muted { background: var(--neutral-bg); color: var(--muted); }
.b-danger { background: var(--err-bg); color: var(--err); }
.bar { height: 8px; border-radius: 999px; background: var(--line-soft); overflow: hidden; } .bar > i { display: block; height: 8px; background: var(--blue); }
.alert { padding: 13px 16px; border-radius: 12px; font-size: 14px; }
.alert-ok { background: var(--ok-bg); color: #14532d; } .alert-err { background: var(--err-bg); color: var(--err); }
.alert-warn { background: var(--warn-bg); color: #7a3306; border: 1px solid #f5d7a8; display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.alert-warn .grow { flex: 1 1 320px; display: flex; flex-direction: column; gap: 2px; }

/* formularze i przyciski */
label { font-size: 13px; font-weight: 500; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field .hint { font-size: 12px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], input[type=url], input[type=search], select, textarea {
  height: 44px; font: inherit; font-size: 14px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink); width: 100%; }
textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(54, 80, 193, .18); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 400; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border: 0; border-radius: var(--radius); background: var(--blue); color: #fff; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--blue-dark); color: #fff; }
.btn-2 { background: #fff; color: var(--ink); border: 1px solid var(--line); font-weight: 500; }
.btn-2:hover { background: #fafbfd; color: var(--ink); border-color: #b9bfcf; }
.btn-ok { background: #fff; color: var(--ok); border: 1px solid var(--ok); }
.btn-warn { background: #fff; color: var(--warn); border: 1px solid var(--warn); }
.btn-danger { background: #fff; color: var(--err); border: 1px solid #e5b6b1; }
.btn-sm { height: 36px; padding: 0 12px; font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.err { color: var(--err); font-size: 12px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { height: 40px; padding: 0 14px; border-radius: 999px; font-size: 14px; display: inline-flex; align-items: center; text-decoration: none; color: var(--text); background: #fff; border: 1px solid var(--line); font-weight: 500; }
.pill.on { background: var(--navy); color: #fff; border-color: var(--navy); font-weight: 600; }
.radio-card { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; }
.radio-card:has(input:checked) { border: 2px solid var(--blue); background: var(--info-bg); }
.radio-card input { width: 18px; height: 18px; accent-color: var(--blue); flex: none; }
.radio-card span { display: flex; flex-direction: column; gap: 2px; } .radio-card b { font-size: 14px; } .radio-card small { font-size: 12px; color: var(--muted); }
details.fold summary { cursor: pointer; list-style: none; } details.fold summary::-webkit-details-marker { display: none; }

/* tabele */
.table-box { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; padding: 10px 8px; }
table.t td { padding: 12px 8px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
table.t td.num { white-space: nowrap; }
table.t a.title { color: var(--ink); text-decoration: none; font-weight: 500; }
.who-cell { display: flex; flex-direction: column; gap: 2px; } .who-cell small { font-size: 12px; color: var(--muted); }
.empty { padding: 26px 0; text-align: center; color: var(--muted); font-size: 14px; }

/* historia */
.timeline { display: flex; flex-direction: column; gap: 16px; }
.tl { display: flex; gap: 12px; }
.tl .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--blue); margin-top: 5px; flex: none; }
.tl .dot.client { background: #9aa0b2; } .tl .dot.internal { background: #b45309; }
.tl .body { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.tl .meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--muted); }
.tl .meta b { color: var(--ink); }
.tl .text { font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.files { display: flex; flex-wrap: wrap; gap: 8px; }
.files a { padding: 6px 10px; border-radius: 8px; background: var(--neutral-bg); font-size: 13px; text-decoration: none; color: var(--ink); }

/* kalendarz */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); min-width: 700px; }
.day { container-type: inline-size; min-width: 0; display: flex; flex-direction: column; gap: 8px; padding: 12px 8px; min-height: 420px; border-left: 1px solid var(--line-soft); }
.day:first-child { border-left: 0; } .day.weekend { background: #fafbfd; }
.day-h { display: flex; flex-direction: column; gap: 2px; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
.day-h span { font-size: 12px; color: var(--muted); } .day-h b { font-size: 15px; } .day-h.today b { color: var(--blue); }
.ev { display: flex; flex-direction: column; gap: 2px; padding: 7px; border-radius: 8px; color: #fff; text-decoration: none; background: #5f6475; overflow: hidden; }
.ev:hover { color: #fff; filter: brightness(1.08); }
.ev.ticket { background: var(--blue); } .ev.contract { background: #b45309; } .ev.done { opacity: .55; }
.ev small { font-size: clamp(10px, 7cqi, 11px); opacity: .9; }
.ev b { font-size: clamp(10.5px, 8.5cqi, 13px); font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; hyphens: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--text); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* paginacja */
.pager { display: flex; gap: 6px; justify-content: center; padding-top: 12px; }
.pager a, .pager span { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); text-decoration: none; font-size: 13px; color: var(--text); background: #fff; }
.pager span.on { background: var(--navy); color: #fff; border-color: var(--navy); }

@media (max-width: 760px) {
  main.page, main.admin { padding: 20px 16px 32px; }
  .sidenav { max-width: none; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px; }
  .sidenav .label { display: none; }
}
