@font-face { font-family: "Nunito"; font-weight: 800; font-display: swap; src: url("fonts/nunito-800-pl.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 700; font-display: swap; src: url("fonts/nunito-700s-pl.woff2") format("woff2"); }
@font-face { font-family: "Nunito Sans"; font-weight: 300 800; font-display: swap; src: url("fonts/nunito-sans-normal-pl.woff2") format("woff2"); }

:root {
  --ink: #0F2419; --ink-soft: #45584A; --night-2: #194730; --sage: #D6E2D0; --sage-pale: #EEF3EB;
  --paper: #FFFFFF; --bg: #F5F6F4; --gold: #B69026; --bronze: #7A5E12; --sand: #F4E5C5;
  --line: #E1E6DE; --danger: #9B2C2C;
  --r-card: 18px; --r-block: 22px; --r-btn: 10px; --r-chip: 8px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 "Nunito Sans", system-ui, sans-serif; }
h1, h2, h3, .btn, .brand, .stat b { font-family: "Nunito", system-ui, sans-serif; font-weight: 800; }
h1 { font-size: 28px; line-height: 1.2; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin: 0 0 14px; }
a { color: var(--night-2); text-underline-offset: 3px; }
.muted { color: var(--ink-soft); }
.small { font-size: 14px; }

/* shell */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--ink); color: #F4EFE0; padding: 26px 16px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { font-size: 22px; padding: 0 12px 22px; letter-spacing: -0.01em; }
.brand span { color: var(--gold); }
.side a { color: #DCE5D8; text-decoration: none; padding: 11px 12px; border-radius: var(--r-btn); font-weight: 600; }
.side a:hover { background: rgba(255,255,255,.07); }
.side a.on { background: var(--night-2); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.side form { margin-top: auto; }
.side button { background: none; border: 0; color: #A9B8AC; font: inherit; padding: 11px 12px; cursor: pointer; }
.main { padding: 34px 40px 60px; max-width: 1180px; width: 100%; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }

/* blocks */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-card); padding: 22px; }
.grid { display: grid; gap: 18px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 30px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat span { color: var(--ink-soft); font-size: 14px; }
.stat.gold { background: var(--ink); color: #F4EFE0; border-color: var(--ink); }
.stat.gold span { color: #C8D3C5; }
.stat.gold b { color: #E9C963; }

.chip { display: inline-block; padding: 3px 10px; border-radius: var(--r-chip); font-size: 13px; font-weight: 700; background: var(--sage-pale); color: var(--night-2); white-space: nowrap; }
.chip.klient { background: var(--sage); }
.chip.oczekuje { background: var(--sand); color: var(--bronze); }
.chip.zgloszenie { background: #ECEEEA; color: var(--ink-soft); }
.chip.off { background: #ECEEEA; color: var(--ink-soft); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); padding: 0 12px 10px; font-weight: 700; }
td { padding: 13px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
tr.row { cursor: pointer; }
tr.row:hover td { background: var(--sage-pale); }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td a.name { font-weight: 700; color: var(--ink); text-decoration: none; }

/* forms */
label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-soft); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid #C9D2C5; border-radius: var(--r-btn); padding: 11px 13px; min-height: 46px; }
textarea { min-height: 92px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 20px; border-radius: var(--r-btn); border: 0; background: var(--night-2); color: #fff; font-size: 15px; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--ink); }
.btn.ghost { background: transparent; color: var(--night-2); border: 1.5px solid var(--night-2); }
.btn.ghost:hover { background: var(--sage-pale); }
.link-danger { background: none; border: 0; color: var(--danger); font: inherit; font-size: 13px; cursor: pointer; padding: 6px 0; text-decoration: underline; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.fields .wide { grid-column: 1 / -1; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.filters input { flex: 1 1 260px; }
.filters select { flex: 0 0 180px; }
.seg { display: inline-flex; background: var(--sage-pale); border-radius: var(--r-btn); padding: 4px; gap: 4px; margin-bottom: 12px; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 8px 14px; border-radius: 7px; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--ink-soft); }
.seg input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(15,36,25,.12); }
.seg input:focus-visible + span { outline: 3px solid var(--gold); }
.error { background: #FBEAEA; color: var(--danger); border-radius: var(--r-btn); padding: 11px 14px; margin-bottom: 16px; font-weight: 600; }
details > summary { cursor: pointer; font-weight: 700; color: var(--night-2); list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 16px; }

/* timeline */
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { position: relative; padding: 0 0 20px 26px; border-left: 2px solid var(--line); margin-left: 6px; }
.tl li:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl li::before { content: ""; position: absolute; left: -7px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--sage); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.tl li.payment::before { background: var(--gold); }
.tl li.note::before, .tl li.call::before { background: var(--night-2); }
.tl .top { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.tl .kind { font-weight: 800; font-family: "Nunito", sans-serif; }
.tl .when { color: var(--ink-soft); font-size: 13px; }
.tl p { margin: 3px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.kv dt { color: var(--ink-soft); font-size: 14px; }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.empty { color: var(--ink-soft); padding: 26px 0; text-align: center; }
.stack > * + * { margin-top: 18px; }
.bar { height: 8px; border-radius: 4px; background: var(--sage-pale); overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--night-2); border-radius: 4px; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--ink); }
.auth .card { width: 100%; max-width: 420px; border-radius: var(--r-block); padding: 30px; }
.auth .brand { color: var(--ink); padding: 0 0 6px; }
.auth form > * + * { margin-top: 14px; }
.auth .btn { width: 100%; }
.qr { display: flex; justify-content: center; margin: 14px 0 6px; }
.qr svg { max-width: 100%; height: auto; }
code { font-size: 14px; background: var(--sage-pale); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; overflow-x: auto; gap: 2px; }
  .brand { padding: 0 10px 0 4px; font-size: 18px; white-space: nowrap; }
  .side a { white-space: nowrap; padding: 10px 11px; min-height: 44px; display: flex; align-items: center; }
  .side a.on { box-shadow: inset 0 -3px 0 var(--gold); }
  .side form { margin: 0 0 0 auto; }
  .side button { min-height: 44px; white-space: nowrap; }
  .main { padding: 22px 16px 48px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .fields { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 24px; }
  .stat b { font-size: 23px; white-space: nowrap; }
  .card { padding: 18px; }
  .hide-m { display: none; }
}
