/* gManager v2 — jeden arkusz, bez frameworka. Kolory jako tokeny, motyw jasny/ciemny. */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --hover: #f1f3f6;
  --border: #e5e7eb;
  --border-strong: #d4d8df;
  --text: #0f1216;
  --text-2: #374050;
  --muted: #6b7280;
  --accent: #2f6fed;
  --accent-hover: #2461d8;
  --accent-soft: #eaf1fe;
  --accent-text: #1d4fbf;
  --green: #12a150;
  --green-hover: #0e8c45;
  --green-soft: #e6f6ed;
  --green-text: #0b7a3b;
  --amber: #d98a04;
  --amber-soft: #fdf2df;
  --amber-text: #94570a;
  --red: #dc3b30;
  --red-soft: #fdecea;
  --red-text: #b4231a;
  --star: #f2ae1c;
  --today: #f3fbf6;
  --logo-bg: #111318;
  --logo-fg: #ffffff;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .06);
  --backdrop: rgba(10, 12, 16, .45);
  --maxw: 1120px;
  --top: 56px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0e12;
    --surface: #14171c;
    --surface-2: #171b21;
    --hover: #1d2128;
    --border: #252a32;
    --border-strong: #323843;
    --text: #e9ebef;
    --text-2: #c3c8d1;
    --muted: #8a919d;
    --accent: #4f86f0;
    --accent-hover: #6595f3;
    --accent-soft: #18233a;
    --accent-text: #9dbcff;
    --green: #22a862;
    --green-hover: #27b86c;
    --green-soft: #12251a;
    --green-text: #6fdc9f;
    --amber: #e8a43a;
    --amber-soft: #2a2112;
    --amber-text: #f0bf6c;
    --red: #e5544a;
    --red-soft: #2d1716;
    --red-text: #ff9a92;
    --star: #f5bf3d;
    --today: #0f1a14;
    --logo-bg: #ffffff;
    --logo-fg: #111318;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .4);
    --backdrop: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0e12;
  --surface: #14171c;
  --surface-2: #171b21;
  --hover: #1d2128;
  --border: #252a32;
  --border-strong: #323843;
  --text: #e9ebef;
  --text-2: #c3c8d1;
  --muted: #8a919d;
  --accent: #4f86f0;
  --accent-hover: #6595f3;
  --accent-soft: #18233a;
  --accent-text: #9dbcff;
  --green: #22a862;
  --green-hover: #27b86c;
  --green-soft: #12251a;
  --green-text: #6fdc9f;
  --amber: #e8a43a;
  --amber-soft: #2a2112;
  --amber-text: #f0bf6c;
  --red: #e5544a;
  --red-soft: #2d1716;
  --red-text: #ff9a92;
  --star: #f5bf3d;
  --today: #0f1a14;
  --logo-bg: #ffffff;
  --logo-fg: #111318;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .4);
  --backdrop: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ── Podstawy ─────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent-text); }
button { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); font-weight: 400; }
.grow { flex: 1 1 auto; }

svg.i {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ── Przyciski ────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 12px;
  border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  font-size: 13.5px; font-weight: 500; line-height: 1;
  cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none;
  transition: background-color .12s, border-color .12s, color .12s, opacity .12s;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: var(--green-hover); border-color: var(--green-hover); }
/* „Oznacz jako pozyskaną" — spokojna zieleń, żeby lista opinii nie krzyczała. */
.btn-mark { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 30%, transparent); color: var(--green-text); }
.btn-mark:hover { background: color-mix(in srgb, var(--green) 14%, var(--green-soft)); border-color: color-mix(in srgb, var(--green) 50%, transparent); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(1.06); background: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); }
.btn-sm { height: 28px; padding: 0 9px; font-size: 12.5px; border-radius: 8px; gap: 5px; }
.btn-sm svg.i { width: 14px; height: 14px; }
.btn-block { width: 100%; }
.btn.is-done { background: var(--green); border-color: var(--green); color: #fff; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 9px; border: 0;
  background: transparent; color: var(--muted); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }

.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Plakietki ────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 7px; border-radius: 6px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.badge svg.i { width: 12px; height: 12px; stroke-width: 2.4; }
.b-green { background: var(--green-soft); color: var(--green-text); }
.b-blue { background: var(--accent-soft); color: var(--accent-text); }
.b-amber { background: var(--amber-soft); color: var(--amber-text); }
.b-red { background: var(--red-soft); color: var(--red-text); }
.b-gray { background: var(--hover); color: var(--muted); }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Górny pasek ──────────────────────────────────────────────────────── */

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-in {
  max-width: var(--maxw); margin: 0 auto; height: var(--top);
  display: flex; align-items: center; gap: 10px;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.logo {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  background: var(--logo-bg); color: var(--logo-fg);
  font-weight: 800; font-size: 15px; letter-spacing: -.02em;
}
.nav { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--hover); margin-left: 6px; }
.nav a {
  display: flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 11px; border-radius: 7px;
  color: var(--muted); font-weight: 500; font-size: 13px; text-decoration: none; white-space: nowrap;
}
.nav a:hover { color: var(--text); }
.nav a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.counter {
  margin-left: auto;
  display: flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 11px; border-radius: 999px;
  background: var(--green-soft); color: var(--green-text);
  font-size: 13px; white-space: nowrap;
}
.counter b { font-weight: 700; font-variant-numeric: tabular-nums; }
.avatar-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 0; flex: none;
  background: var(--accent-soft); color: var(--accent-text);
  font-weight: 700; font-size: 14px; cursor: pointer;
}

/* ── Układ ────────────────────────────────────────────────────────────── */

.main {
  max-width: var(--maxw); margin: 0 auto;
  padding: 12px max(16px, env(safe-area-inset-right)) calc(48px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.subtabs, .filters {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.subtabs::-webkit-scrollbar, .filters::-webkit-scrollbar { display: none; }
.subtabs { padding: 2px 0 10px; }
.subtabs-l { align-self: center; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-right: 4px; white-space: nowrap; }

.fchip {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 30px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer; text-decoration: none;
}
.fchip:hover { border-color: var(--border-strong); color: var(--text); }
.fchip .n { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 500; }
.fchip.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.fchip.on .n { color: inherit; opacity: .65; }
.fchip-add { border-style: dashed; color: var(--muted); }

.toolbar {
  position: sticky; top: var(--top); z-index: 30;
  display: flex; align-items: center; gap: 10px;
  margin: 0 -16px; padding: 8px 16px 10px;
  background: var(--bg);
}
.search-row { display: flex; gap: 8px; flex: none; min-width: 0; }
.search { position: relative; flex: 1 1 auto; min-width: 0; }
.tool-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer;
}
.tool-btn:hover { border-color: var(--border-strong); color: var(--text); }
/* Wyszukiwarka zwinięta do lupy; rozwinięta („searching") — pole zamiast lupy. */
.toolbar:not(.searching) .search { display: none; }
.toolbar.searching .search-toggle { display: none; }
.toolbar.searching .search-row { flex: 0 1 440px; min-width: 260px; }
.toolbar.searching .search { animation: searchIn .16s ease both; }
@keyframes searchIn { from { opacity: 0; transform: translateX(-6px); } }
.sort-btn {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 36px; padding: 0 11px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer;
}
.sort-btn:hover { border-color: var(--border-strong); color: var(--text); }
.sort-btn svg.i { color: var(--muted); }
.search svg.i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 36px; padding: 0 34px 0 34px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted);
  border: 1px solid var(--border); border-radius: 5px; padding: 3px 5px; pointer-events: none;
}
.search .clear { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; }
.filters { flex: 1 1 auto; min-width: 0; }
.list-count { color: var(--muted); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ── Lista profili ────────────────────────────────────────────────────── */

.list {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.item { border-top: 1px solid var(--border); scroll-margin-top: calc(var(--top) + 64px); }
.item:first-child { border-top: 0; }

.row {
  display: grid; align-items: center;
  grid-template-columns: 40px minmax(0, 1fr) auto auto auto;
  grid-template-areas: "star main meta ext chev";
  column-gap: 6px;
  min-height: 46px; padding: 0 6px 0 4px;
  cursor: pointer;
  transition: background-color .12s;
}
.row:hover { background: var(--hover); }
.row.is-today { background: var(--today); }
.row.is-today:hover { background: color-mix(in srgb, var(--today) 70%, var(--hover)); }
.item.open > .row { background: var(--surface-2); box-shadow: inset 3px 0 var(--accent); }

.star-btn {
  grid-area: star;
  display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 9px;
  background: transparent; color: var(--border-strong); cursor: pointer;
}
.star-btn svg.i { width: 18px; height: 18px; }
.star-btn:hover { color: var(--star); background: var(--hover); }
.star-btn.on { color: var(--star); }
.star-btn.on svg.i { fill: currentColor; }

.row-main {
  grid-area: main;
  display: flex; align-items: center; min-width: 0; gap: 8px;
  padding: 11px 0; border: 0; background: none; text-align: left; cursor: pointer;
}
.name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; font-size: 14px; }
.name .guide-ic { width: 14px; height: 14px; color: var(--amber); margin-right: 5px; vertical-align: -2px; }

.meta { grid-area: meta; display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.sub-pill {
  display: inline-flex; align-items: center; gap: 5px; max-width: 150px;
  height: 24px; padding: 0 8px 0 7px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font-size: 12px; font-weight: 500; cursor: pointer;
}
.sub-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-pill svg.i { width: 13px; height: 13px; color: var(--muted); }
.sub-pill:hover { border-color: var(--border-strong); background: var(--hover); }
.sub-pill.is-self { color: var(--muted); }
.row .ext { grid-area: ext; }
.row .chev { grid-area: chev; }
.chev svg.i { transition: transform .18s ease; }
.item.open .chev svg.i { transform: rotate(180deg); }

.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }
.empty.sm { padding: 24px 12px; font-size: 13px; }

/* ── Rozwinięty profil ────────────────────────────────────────────────── */

.panel {
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  padding: 12px 14px 14px 46px;
  animation: panelIn .18s ease both;
}
@keyframes panelIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.panel-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.panel-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; color: var(--muted); font-size: 12.5px; min-width: 0; margin-left: 4px; }
.panel-meta span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.panel-meta svg.i { width: 13px; height: 13px; }
.pm-rating svg.i { color: var(--star); fill: var(--star); stroke: var(--star); }
.pm-addr { max-width: 420px; }
.pm-addr span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.panel-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 12px; align-items: start; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; min-width: 0; }
.card-h {
  display: flex; align-items: center; gap: 7px;
  min-height: 42px; padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 13px;
}
.card-h > svg.i { color: var(--muted); }
.card-b { padding: 12px; }

/* Treść do wklejenia */
.tx-text {
  max-height: 280px; overflow: auto;
  padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2);
  font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: default;
}
.is-copied .tx-text { border-color: color-mix(in srgb, var(--red) 55%, transparent); background: var(--red-soft); }
.is-locked .tx-text { border-color: color-mix(in srgb, var(--amber) 55%, transparent); background: var(--amber-soft); }
.tx-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tx-actions .btn-primary { flex: 1 1 auto; max-width: 220px; }
.hint { margin-top: 8px; color: var(--muted); font-size: 12px; }

.notice { display: flex; gap: 10px; padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.45; }
.notice > svg.i { margin-top: 1px; }
.notice.warn { background: var(--amber-soft); color: var(--amber-text); }
.notice.danger { background: var(--red-soft); color: var(--red-text); }
.guide { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 12.5px; white-space: pre-wrap; }
.guide-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 4px; }

/* Opinie */
.rv-list { list-style: none; margin: 0; padding: 0; }
.rv {
  display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px;
  padding: 11px 12px; border-top: 1px solid var(--border);
}
.rv:first-child { border-top: 0; }
.rv-sep {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-top: 1px solid var(--border); background: var(--surface-2);
  color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
}
.rv-sep:first-child { border-top: 0; }
.rv-sep .n { font-weight: 600; letter-spacing: 0; opacity: .75; font-variant-numeric: tabular-nums; }
.rv-sep.today { color: var(--green-text); }
.rv-sep.today::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.rv.is-pending { box-shadow: inset 3px 0 var(--accent); }
.rv.is-confirmed { box-shadow: inset 3px 0 var(--green); }
.rv.is-deleted { box-shadow: inset 3px 0 var(--red); }
.av {
  width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
  background: var(--hover); color: var(--muted);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.rv-head { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 8px; font-size: 13px; min-width: 0; }
.rv-author { font-weight: 600; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
a.rv-author:hover { text-decoration: underline; }
.stars { color: var(--border-strong); font-size: 12px; letter-spacing: -.5px; white-space: nowrap; }
.stars b { color: var(--star); font-weight: 400; }
.rv-time { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.rv-place { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; margin-bottom: 3px; min-width: 0; }
.rv-place svg.i { width: 12px; height: 12px; }
.rv-place span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-text {
  margin-top: 4px; color: var(--text-2); font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  cursor: pointer;
}
.rv-text.full { display: block; -webkit-line-clamp: unset; white-space: pre-wrap; }
.rv-text.no-text { color: var(--muted); font-style: italic; cursor: default; }
.rv-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.rv-acts:empty { display: none; }
.rv-acts .rv-id { color: var(--muted); font-size: 12px; margin-right: auto; font-variant-numeric: tabular-nums; }
.rv-msg { margin-top: 8px; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; line-height: 1.45; }
.rv-msg.err { background: var(--red-soft); color: var(--red-text); }
.rv-msg.ok { background: var(--green-soft); color: var(--green-text); }

/* ── Widok „Usunięte" ─────────────────────────────────────────────────── */

.view-h { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; padding: 6px 2px 12px; }
.view-h h1 { font-size: 18px; letter-spacing: -.01em; }
.view-h p { color: var(--muted); font-size: 13px; }
.dlist .rv { padding: 12px 14px; box-shadow: none; }
.more { display: flex; justify-content: center; padding: 12px; border-top: 1px solid var(--border); }

/* ── Szkielet ładowania ───────────────────────────────────────────────── */

.skeleton { pointer-events: none; }
.sk-row { position: relative; height: 46px; border-top: 1px solid var(--border); }
.sk-row:first-child { border-top: 0; }
.sk-row::before, .sk-row::after, .sk-line {
  content: ""; position: absolute; top: 50%; height: 12px; margin-top: -6px; border-radius: 6px;
  background: linear-gradient(90deg, var(--hover) 25%, var(--surface-2) 50%, var(--hover) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s linear infinite;
}
.sk-row::before { left: 14px; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%; }
.sk-row::after { left: 50px; width: var(--w, 50%); }
.sk-block { position: relative; height: 120px; border-radius: 12px; overflow: hidden;
  background: linear-gradient(90deg, var(--hover) 25%, var(--surface-2) 50%, var(--hover) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── Menu, okna, powiadomienia ────────────────────────────────────────── */

.menu {
  position: fixed; z-index: 120;
  min-width: 220px; max-width: min(320px, calc(100vw - 16px)); max-height: min(60vh, 440px); overflow: auto;
  padding: 6px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  animation: pop .14s ease both;
}
.menu-h { padding: 8px 10px 6px; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.menu-i {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 8px; background: none;
  color: var(--text); font-size: 13.5px; text-align: left; text-decoration: none; cursor: pointer;
}
.menu-i:hover, .menu-i:focus-visible { background: var(--hover); outline: none; }
.menu-i svg.i { color: var(--muted); }
.menu-i .lbl { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-i .n { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.menu-i.on { color: var(--accent-text); font-weight: 600; }
.menu-i.on svg.i { color: var(--accent-text); }
.menu-i.danger { color: var(--red-text); }
.menu-i.danger svg.i { color: var(--red-text); }
.menu-sep { height: 1px; margin: 5px 4px; background: var(--border); }
.menu-bg { position: fixed; inset: 0; z-index: 110; }

.modal-bg {
  position: fixed; inset: 0; z-index: 130;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: var(--backdrop); animation: fade .15s ease both;
}
.modal {
  width: 100%; max-width: 440px; padding: 20px;
  border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-lg);
  animation: pop .18s ease both;
}
.modal-h { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; margin-bottom: 10px; letter-spacing: -.01em; }
.modal-h svg.i { width: 22px; height: 22px; }
.modal.danger .modal-h { color: var(--red-text); }
.modal-b { font-size: 14px; line-height: 1.55; color: var(--text-2); }
.modal-b p + p, .modal-b .notice + p, .modal-b p + .notice { margin-top: 10px; }
.modal-b .notice { margin-bottom: 10px; }
.modal-b .field { margin: 4px 0 0; }
.modal-f { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.modal-f .btn { flex: 1 1 150px; height: 40px; font-size: 14px; }
.modal-err { margin-top: 10px; color: var(--red-text); font-size: 13px; }

.toasts {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 200;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: max-content; max-width: calc(100vw - 24px); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 11px;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg);
  font-size: 13.5px; line-height: 1.4; pointer-events: auto;
  animation: toastIn .2s ease both;
}
.toast.ok svg.i { color: var(--green); }
:root[data-theme="dark"] .toast.ok svg.i { color: #0b7a3b; }
.toast.err { background: var(--red); color: #fff; }
.toast.out { animation: toastOut .2s ease both; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(4px); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }
@keyframes up { from { transform: translateY(100%); } }

/* ── Logowanie ────────────────────────────────────────────────────────── */

.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 360px; padding: 28px 24px 24px;
  border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.login-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; margin-bottom: 26px; }
.login-card h1 { font-size: 21px; letter-spacing: -.02em; margin-bottom: 16px; }
.login-err { margin-bottom: 14px; padding: 9px 12px; border-radius: 9px; background: var(--red-soft); color: var(--red-text); font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.field input {
  height: 42px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: 15px; outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-card .btn { height: 42px; font-size: 14.5px; }
.check { display: flex; align-items: center; gap: 9px; margin: -2px 0 16px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.check input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); cursor: pointer; flex: none; }

/* ── Telefon ──────────────────────────────────────────────────────────── */

@media (max-width: 860px) {
  .panel-grid { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 12px; }
}

@media (max-width: 720px) {
  :root { --top: 52px; }
  .topbar-in { gap: 8px; }
  .brand-name, .counter-l, .nav svg.i, .topbar [data-act="theme"] { display: none; }
  .nav { margin-left: 0; }
  .nav a { padding: 0 10px; }
  .counter { padding: 0 9px; gap: 4px; }
  .main { padding-top: 8px; }
  /* Jeden wiersz: lupa, kolejność i przewijane filtry; rozwinięta wyszukiwarka zajmuje cały wiersz. */
  .toolbar { flex-wrap: wrap; gap: 8px; padding-top: 6px; }
  .filters { flex: 1 1 0; }
  .toolbar.searching .search-row { flex: 1 1 100%; min-width: 0; }
  .search kbd { display: none; }
  .search input, .field input { font-size: 16px; } /* iOS nie powiększa pola przy 16px */
  .list-count { display: none; }

  .row {
    grid-template-columns: 40px minmax(0, 1fr) auto auto;
    grid-template-areas: "star main ext chev" ". meta meta meta";
    padding: 3px 4px 3px 2px;
  }
  .row-main { padding: 8px 0; }
  .name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
  .meta { justify-content: flex-start; flex-wrap: wrap; padding: 0 0 8px; }
  .meta:empty { display: none; }

  .tx-actions .btn-primary { max-width: none; }
  .tx-actions .btn { height: 40px; flex: 1 1 auto; }
  .rv-acts .btn-sm { height: 32px; }
  .pm-addr { max-width: 100%; }
}

@media (max-width: 600px) {
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal {
    max-width: none; border-radius: 18px 18px 0 0;
    padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
    animation: up .22s cubic-bezier(.2, .8, .2, 1) both;
  }
  .menu.sheet {
    left: 8px !important; right: 8px; top: auto !important; bottom: calc(8px + env(safe-area-inset-bottom));
    max-width: none; max-height: 70vh; border-radius: 16px;
    animation: up .22s cubic-bezier(.2, .8, .2, 1) both;
  }
  .menu.sheet .menu-i { padding: 12px; font-size: 15px; }
  .menu-bg.sheet { background: var(--backdrop); animation: fade .15s ease both; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
