/* LUNA — panel administracyjny (mobile-first). Bazuje na tokenach i przyciskach z app.css. */
@layer components {
  body.admin {
    --accent-400: #a78bfa; --accent-500: #8b5cf6; --accent-600: #7c3aed;
    --bg: #0b0e12; --panel: #12161d; --panel-2: #171c25; --field: #0e1218;
    --line: rgb(255 255 255 / .07); --line-2: rgb(255 255 255 / .12);
    --tabbar-h: 64px; --appbar-h: 56px;
    background: radial-gradient(1200px 600px at -10% -20%, rgb(139 92 246 / .14), transparent 60%), var(--bg);
    background-attachment: fixed;
  }

  /* ---------------- układ ---------------- */
  .admin-layout { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); }
  .admin-main { min-width: 0; display: flex; flex-direction: column; }
  .admin-content { width: 100%; max-width: 920px; margin-inline: auto; display: grid; gap: 14px; align-content: start;
    padding: 12px 12px calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); }

  @media (min-width: 1024px) {
    .admin-layout { grid-template-columns: 260px minmax(0, 1fr); }
    .admin-content { padding: 20px 32px 48px; gap: 20px; }
  }

  /* ---------------- pasek górny (telefon/tablet) ---------------- */
  .appbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
    min-height: calc(var(--appbar-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0;
    background: rgb(11 14 18 / .78); backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
    border-bottom: 1px solid var(--line); }
  .appbar-logo .logo { width: 26px; height: 26px; color: var(--accent-400); }
  .appbar-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
  .appbar-title h1 { font-size: 1.0625rem; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
  .appbar .city-chip { margin-left: auto; }
  @media (min-width: 1024px) {
    .appbar { position: static; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; border: 0; padding: 28px 32px 0; min-height: 0; max-width: 920px; width: 100%; margin-inline: auto; }
    .appbar .appbar-logo, .appbar .appbar-me { display: none; }
    .appbar .city-chip { display: none; }
    .appbar-title h1 { font-size: 1.75rem; letter-spacing: -.03em; }
  }

  .city-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 52vw; height: 34px; padding: 0 10px 0 8px; border-radius: 999px;
    border: 1px solid var(--line-2); background: var(--panel-2); color: var(--fg); font-size: .8125rem; font-weight: 600; }
  .city-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .city-chip .ico { width: 15px; height: 15px; color: var(--accent-400); }
  .city-chip .ico:last-child:not(:first-child) { color: var(--fg-3); }
  .city-chip.static { cursor: default; }

  .icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--fg-2); transition: background .15s, color .15s, transform .1s; -webkit-tap-highlight-color: transparent; }
  .icon-btn:hover { background: rgb(255 255 255 / .07); color: var(--fg); }
  .icon-btn:active { transform: scale(.94); }
  .icon-btn.danger { color: #fca5a5; }
  .icon-btn.danger:hover { background: rgb(239 68 68 / .14); color: #fecaca; }
  .icon-btn.disabled { opacity: .3; pointer-events: none; }
  .icon-btn.lg { width: 52px; height: 52px; border: 1px solid var(--line-2); background: var(--panel-2); }
  .icon-btn .ico { width: 20px; height: 20px; }
  .avatar-i { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; font-size: .8125rem; font-weight: 800; color: #fff;
    background: linear-gradient(135deg, var(--accent-500), #6366f1); }
  .avatar-i.lg { width: 48px; height: 48px; font-size: 1.125rem; }

  /* ---------------- sidebar (komputer) ---------------- */
  .sidebar { display: none; }
  @media (min-width: 1024px) {
    .sidebar { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100dvh; padding: 22px 14px; border-right: 1px solid var(--line); background: rgb(255 255 255 / .015); }
    .sidebar .city-chip { max-width: none; width: 100%; height: 40px; border-radius: 12px; padding: 0 12px; justify-content: flex-start; }
    .sidebar .city-chip .ico:last-child:not(:first-child) { margin-left: auto; }
  }
  .side-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
  .side-brand .logo { width: 28px; height: 28px; color: var(--accent-400); }
  .luna { font-size: 1.25rem; font-weight: 900; letter-spacing: .14em; }
  .side-nav { display: grid; gap: 2px; }
  .side-nav a, .side-link { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 12px; color: var(--fg-2); font-size: .9rem; font-weight: 500; transition: background .15s, color .15s; }
  .side-nav a:hover, .side-link:hover { background: rgb(255 255 255 / .05); color: var(--fg); }
  .side-nav a[aria-current="page"] { background: rgb(139 92 246 / .16); color: #fff; }
  .side-nav a[aria-current="page"] .ico { color: var(--accent-400); }
  .side-nav .ico, .side-link .ico { width: 18px; height: 18px; }
  .side-foot { margin-top: auto; display: grid; gap: 6px; }
  .me-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); text-align: left; }
  .me-btn:hover { background: var(--panel-2); }
  .me-text { flex: 1; min-width: 0; display: grid; }
  .me-text b { font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .me-text small { font-size: .6875rem; color: var(--fg-3); }
  .me-btn > .ico { width: 16px; height: 16px; color: var(--fg-3); }

  /* ---------------- tabbar (telefon) ---------------- */
  .tabbar { position: fixed; z-index: 30; inset: auto 0 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 6px 6px env(safe-area-inset-bottom);
    background: rgb(13 16 21 / .9); backdrop-filter: blur(20px) saturate(150%); -webkit-backdrop-filter: blur(20px) saturate(150%); border-top: 1px solid var(--line); }
  .tabbar a { position: relative; display: grid; place-content: center; justify-items: center; gap: 3px; border-radius: 14px; font-size: .6875rem; font-weight: 600; color: var(--fg-3); -webkit-tap-highlight-color: transparent; }
  .tabbar .ico { width: 22px; height: 22px; transition: transform .15s; }
  .tabbar a[aria-current="page"] { color: #fff; }
  .tabbar a[aria-current="page"] .ico { color: var(--accent-400); }
  .tabbar a[aria-current="page"]::before { content: ''; position: absolute; top: 2px; width: 34px; height: 3px; border-radius: 3px; background: var(--accent-400); }
  .tabbar a:active .ico { transform: scale(.9); }
  @media (min-width: 1024px) { .tabbar { display: none; } }

  /* ---------------- sekcje ---------------- */
  .panel-sec { display: grid; gap: 12px; padding: 14px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); min-width: 0; }
  @media (min-width: 640px) { .panel-sec { padding: 20px; } }
  .sec-head { display: flex; align-items: flex-start; gap: 10px; }
  .sec-head > div { flex: 1; min-width: 0; }
  .sec-head h2 { display: flex; align-items: center; gap: 8px; font-size: 1.0625rem; font-weight: 700; }
  .sec-head h2 .ico { width: 18px; height: 18px; color: var(--accent-400); }
  .sec-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 3px; font-size: .78rem; color: var(--fg-3); }
  .sec-sub .ico { width: 14px; height: 14px; }
  .sec-sub b { color: var(--fg-2); }
  .count { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px; font-size: .75rem; background: rgb(139 92 246 / .2); color: var(--accent-400); }
  .hint { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 14px; font-size: .8125rem; color: var(--fg-3); background: var(--panel); border: 1px dashed var(--line-2); }
  .hint .ico { width: 16px; height: 16px; flex: none; }

  /* statystyki */
  .stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stat { display: grid; gap: 2px; padding: 12px 8px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); text-align: center; }
  .stat b { font-size: clamp(1.4rem, 6vw, 2rem); font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
  .stat span { font-size: .6875rem; color: var(--fg-3); line-height: 1.25; }
  .stat:first-child b { color: var(--accent-400); }
  @media (min-width: 640px) { .stats { gap: 14px; } .stat { padding: 18px; } .stat span { font-size: .8125rem; } }

  /* puste stany */
  .empty-state { display: grid; justify-items: center; gap: 6px; padding: 32px 16px; text-align: center; border-radius: 16px; border: 1px dashed var(--line-2); }
  .empty-state > .ico { width: 38px; height: 38px; padding: 8px; border-radius: 50%; color: var(--accent-400); background: rgb(139 92 246 / .14); }
  .empty-state h3 { font-size: 1rem; margin-top: 6px; }
  .empty-state p { font-size: .8125rem; color: var(--fg-3); max-width: 32ch; }

  /* ---------------- spoty ---------------- */
  .spot-toolbar { position: sticky; top: calc(var(--appbar-h) + env(safe-area-inset-top) + 6px); z-index: 6; display: flex; align-items: center; gap: 6px;
    padding: 6px; border-radius: 14px; background: rgb(23 28 37 / .94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--line-2); }
  @media (min-width: 1024px) { .spot-toolbar { top: 12px; } }
  .check-pill { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border-radius: 10px; font-size: .8125rem; font-weight: 600; color: var(--fg-2); cursor: pointer; }
  .check-pill:hover { background: rgb(255 255 255 / .05); }
  .sel-count { font-size: .8125rem; font-weight: 700; color: var(--accent-400); white-space: nowrap; }
  .spot-toolbar .btn { min-height: 36px; }
  .spot-toolbar input, .spot-check input { width: 18px; height: 18px; accent-color: var(--accent-500); cursor: pointer; }

  .spot-list { display: grid; gap: 8px; }
  .spot { display: grid; grid-template-columns: 76px minmax(0, 1fr); grid-template-areas: "thumb main" "thumb actions"; column-gap: 12px; row-gap: 4px;
    padding: 10px; border-radius: 16px; background: var(--panel-2); border: 1px solid var(--line); transition: border-color .15s, background .15s, opacity .25s, transform .25s; }
  .spot.mod-suspected { border-color: rgb(202 138 4 / .45); }
  .spot.mod-certain { border-color: rgb(220 38 38 / .55); background: rgb(127 29 29 / .12); }
  .spot.selected { border-color: var(--accent-400); background: rgb(139 92 246 / .1); }
  .spot.removing { opacity: 0; transform: translateX(-12px); }
  .spot-thumb-wrap { grid-area: thumb; position: relative; align-self: start; }
  .spot-thumb { position: relative; display: block; width: 76px; aspect-ratio: 1; padding: 0; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; background: rgb(255 255 255 / .04); }
  .spot-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
  .spot-check { position: absolute; top: -6px; left: -6px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--panel); border: 1px solid var(--line-2); cursor: pointer; }
  .spot-main { grid-area: main; min-width: 0; display: grid; gap: 4px; align-content: start; }
  .spot-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: .72rem; color: var(--fg-3); }
  .spot-city { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; color: var(--fg-2); }
  .spot-city .ico { width: 12px; height: 12px; color: var(--accent-400); }
  .spot-content { font-size: .9375rem; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
  .spot-actions { grid-area: actions; display: flex; justify-content: flex-end; gap: 2px; align-self: end; margin: 0 -4px -4px 0; }
  .spot-actions .icon-btn { width: 40px; height: 40px; }
  .spot-actions .ico { width: 18px; height: 18px; }
  .badge.spot-mod { padding: 2px 8px; }
  .badge.spot-mod .ico { width: 12px; height: 12px; }
  @media (min-width: 640px) {
    .spot { grid-template-columns: 96px minmax(0, 1fr) auto; grid-template-areas: "thumb main actions"; padding: 12px; column-gap: 16px; }
    .spot-thumb { width: 96px; }
    .spot-actions { flex-direction: column; justify-content: flex-start; align-self: start; margin: 0; }
    .spot-content { -webkit-line-clamp: 5; }
  }
  .load-more { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 16px; font-size: .8125rem; color: var(--fg-3); }
  .spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent-400); animation: spin .8s linear infinite; }
  @keyframes spin { to { rotate: 360deg; } }

  .thumb-ph { position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgb(255 255 255 / .07) 50%, transparent 70%) 0 0 / 200% 100%; animation: shimmer 1.2s linear infinite; }
  .spot-thumb.ready .thumb-ph, .cm-preview.ready .thumb-ph { display: none; }
  @keyframes shimmer { to { background-position: -200% 0; } }

  /* eksport */
  .export-grid { display: grid; gap: 8px; }
  @media (min-width: 640px) { .export-grid { grid-template-columns: 1fr 1fr; } }
  .tile-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; border-radius: 16px; text-align: left; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--fg); transition: background .15s, transform .1s; }
  .tile-btn:hover { background: rgb(255 255 255 / .06); }
  .tile-btn:active { transform: scale(.98); }
  .tile-btn:disabled { opacity: .45; pointer-events: none; }
  .tile-btn > .ico { width: 40px; height: 40px; padding: 10px; border-radius: 12px; background: rgb(255 255 255 / .06); }
  .tile-btn span { display: grid; gap: 1px; }
  .tile-btn b { font-size: .9375rem; }
  .tile-btn small { font-size: .75rem; color: var(--fg-3); }
  .tile-btn.primary { background: linear-gradient(135deg, rgb(139 92 246 / .32), rgb(99 102 241 / .2)); border-color: rgb(167 139 250 / .45); }
  .tile-btn.primary > .ico { background: var(--accent-500); color: #fff; }

  /* archiwum */
  .day-nav { display: flex; align-items: center; gap: 6px; }
  .day-pick { flex: 1; min-width: 0; }
  .day-label { position: relative; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 14px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line-2); cursor: pointer; }
  .day-label > .ico { width: 20px; height: 20px; color: var(--accent-400); }
  .day-label span { display: grid; line-height: 1.2; }
  .day-label b { font-size: .9375rem; }
  .day-label small { font-size: .72rem; color: var(--fg-3); }
  .admin .day-label select { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; min-height: 0; }
  .date-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
  .date-cell { display: grid; justify-items: center; gap: 2px; padding: 12px 6px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
  .date-cell:hover { border-color: var(--accent-400); }
  .date-cell b { font-variant-numeric: tabular-nums; }
  .date-cell small { font-size: .6875rem; color: var(--fg-3); }

  /* ---------------- formularze ---------------- */
  .admin input:not([type="checkbox"], [type="radio"], [type="file"]), .admin select, .admin textarea {
    width: 100%; min-height: 46px; padding: 11px 14px; border-radius: 12px; background: var(--field); border: 1px solid var(--line-2); outline: 0; font-size: 16px; font-weight: 400; color: var(--fg); transition: border-color .15s, box-shadow .15s; }
  .admin select { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; }
  .admin select option { background: #14181f; }
  .admin textarea { resize: vertical; line-height: 1.55; }
  .admin input:focus, .admin select:focus, .admin textarea:focus { border-color: var(--accent-400); box-shadow: 0 0 0 4px rgb(139 92 246 / .2); }
  .field { display: grid; gap: 6px; font-size: .8125rem; font-weight: 600; color: var(--fg-2); min-width: 0; }
  .check { display: flex; align-items: center; gap: 8px; font-size: .8125rem; color: var(--fg-3); cursor: pointer; }
  .check input { width: 18px; height: 18px; accent-color: var(--accent-500); }
  .form-card { display: grid; gap: 14px; min-width: 0; }
  .grid-2, .grid-3 { display: grid; gap: 12px; }
  @media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
  .prefix-input { display: flex; align-items: stretch; min-width: 0; border-radius: 12px; background: var(--field); border: 1px solid var(--line-2); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
  .prefix-input:focus-within { border-color: var(--accent-400); box-shadow: 0 0 0 4px rgb(139 92 246 / .2); }
  .prefix-input > span { display: grid; place-items: center; padding: 0 0 0 12px; color: var(--fg-4); font-weight: 500; white-space: nowrap; }
  .admin .prefix-input input { min-width: 0; border: 0; background: transparent; box-shadow: none; padding-left: 4px; }
  .row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .btn-lg { min-height: 52px; font-size: 1rem; }

  .themes { border: 0; padding: 0; margin: 0; min-width: 0; }
  .swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 10px; }
  .swatch { position: relative; aspect-ratio: 1; border-radius: 50%; background: var(--sw); cursor: pointer; box-shadow: inset 0 0 0 1px rgb(255 255 255 / .2); transition: transform .12s; }
  .swatch:active { transform: scale(.92); }
  .swatch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
  .swatch:has(input:checked) { box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px #fff; }
  .swatch:has(input:focus-visible) { outline: 2px solid var(--accent-400); outline-offset: 5px; }
  .sw-light { --sw: linear-gradient(135deg, #fff, #d4d4d8); }
  .sw-dark { --sw: linear-gradient(135deg, #3f3f46, #000); }

  .uploads { display: grid; gap: 8px; }
  .upload-row { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); }
  .up-preview { display: grid; place-items: center; flex: none; width: 56px; height: 56px; border-radius: 12px; overflow: hidden; background: rgb(255 255 255 / .05); color: var(--fg-4); }
  .up-preview.round { border-radius: 50%; }
  .up-preview.wide { width: 72px; height: 48px; }
  .up-preview img { width: 100%; height: 100%; object-fit: cover; }
  .up-preview .ico { width: 22px; height: 22px; }
  .up-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
  .up-text b { font-size: .875rem; }
  .up-text small { font-size: .72rem; color: var(--fg-3); }
  .up-text .check { margin-top: 4px; font-size: .75rem; }
  .up-btn { position: relative; overflow: hidden; flex: none; }
  .up-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
  .upload-row.changed { border-color: var(--accent-400); }

  .seg { display: grid; gap: 8px; }
  @media (min-width: 640px) { .seg { grid-template-columns: repeat(3, 1fr); } }
  .seg-opt { position: relative; display: block; cursor: pointer; }
  .seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
  .seg-opt span { display: grid; gap: 2px; height: 100%; padding: 12px 14px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line-2); transition: border-color .15s, background .15s; }
  .seg-opt b { font-size: .9375rem; }
  .seg-opt small { font-size: .75rem; color: var(--fg-3); }
  .seg-opt input:checked + span { border-color: var(--accent-400); background: rgb(139 92 246 / .14); box-shadow: inset 0 0 0 1px var(--accent-400); }
  .seg-opt input:focus-visible + span { outline: 2px solid var(--accent-400); outline-offset: 2px; }

  .save-bar { position: fixed; z-index: 25; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 10px);
    display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-radius: 16px; background: rgb(28 33 44 / .96);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgb(167 139 250 / .45); box-shadow: 0 20px 50px -10px #000; animation: rise .2s ease-out; }
  .save-bar > span { flex: 1; min-width: 0; font-size: .8125rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .admin-content:has(.save-bar:not([hidden])) { padding-bottom: calc(var(--tabbar-h) + 100px + env(safe-area-inset-bottom)); }
  @media (min-width: 1024px) { .save-bar { left: calc(260px + (100vw - 260px) / 2); right: auto; translate: -50% 0; width: min(560px, calc(100vw - 320px)); bottom: 24px; } }
  @keyframes rise { from { opacity: 0; transform: translateY(12px); } }

  .ig-connect { display: grid; gap: 10px; align-items: end; grid-template-columns: minmax(0, 1fr) auto; }
  .ig-status { display: grid; gap: 6px; padding: 12px; border-radius: 14px; background: var(--panel-2); }
  .howto-wrap summary { cursor: pointer; font-size: .8125rem; font-weight: 600; color: var(--accent-400); padding: 4px 0; }
  .howto-wrap[open] summary { margin-bottom: 10px; }
  .howto { list-style: decimal; padding-left: 1.3em; display: grid; gap: 8px; font-size: .8125rem; color: var(--fg-2); }
  .howto a { color: var(--accent-400); text-decoration: underline; }

  /* listy (podstrony, użytkownicy, miasta) */
  .list { display: grid; gap: 6px; }
  .list-empty { padding: 16px; text-align: center; font-size: .8125rem; color: var(--fg-3); border: 1px dashed var(--line-2); border-radius: 14px; }
  .list-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 58px; padding: 8px 6px 8px 12px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); text-align: left; color: var(--fg); }
  button.list-row:hover { border-color: var(--line-2); background: rgb(255 255 255 / .05); }
  .list-row > .ico { width: 18px; height: 18px; color: var(--fg-4); }
  .list-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
  .list-main b { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .list-main small { font-size: .72rem; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .list-row form { display: contents; }

  .me-card { display: flex; align-items: center; gap: 12px; }
  .me-card > div { flex: 1; min-width: 0; display: grid; }
  .me-card b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .me-card small { font-size: .75rem; }

  .badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: .6875rem; font-weight: 700; white-space: nowrap; background: rgb(255 255 255 / .06); border: 1px solid var(--line-2); color: var(--fg-2); }
  .mod-suspected.badge { color: #fde047; border-color: rgb(234 179 8 / .45); background: rgb(234 179 8 / .1); }
  .mod-certain.badge { color: #fca5a5; border-color: rgb(239 68 68 / .5); background: rgb(239 68 68 / .12); }
  .st-published { color: #86efac; border-color: rgb(34 197 94 / .4); background: rgb(34 197 94 / .1); }
  .st-archived { color: var(--fg-4); }

  .flash { padding: 12px 14px; border-radius: 14px; font-size: .875rem; font-weight: 600; }
  .flash.ok { color: #86efac; background: rgb(34 197 94 / .1); border: 1px solid rgb(34 197 94 / .3); }
  .flash.err { color: #fca5a5; background: rgb(239 68 68 / .1); border: 1px solid rgb(239 68 68 / .3); }
  .err { color: #f87171; }
  .err:empty { display: none; }
  .grow { flex: 1; }
  .quote { white-space: pre-line; max-height: 34vh; overflow: auto; padding: 12px 14px; border-radius: 12px; background: var(--panel-2); font-size: .9rem; }

  /* ---------------- arkusze (dialogi) ---------------- */
  .sheet { padding: 0; margin: auto auto 0; width: 100%; max-width: 100%; max-height: 92dvh; border: 0; border-radius: 24px 24px 0 0;
    background: var(--panel); color: var(--fg); box-shadow: 0 -20px 60px -10px #000; overscroll-behavior: contain; }
  .sheet[open] { animation: sheetUp .26s cubic-bezier(.2, .8, .2, 1); }
  .sheet::backdrop { background: rgb(0 0 0 / .6); backdrop-filter: blur(4px); }
  .sheet-tall { height: 92dvh; }
  .sheet-body { display: grid; gap: 14px; align-content: start; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); }
  .sheet-grip { justify-self: center; width: 40px; height: 5px; border-radius: 5px; background: var(--line-2); margin: 4px 0 2px; }
  .sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .sheet-head h2 { font-size: 1.125rem; }
  .sheet-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding-top: 4px; }
  .sheet-actions .btn { flex: 1; }
  .sheet-actions .grow { display: none; }
  .center { text-align: center; }
  @keyframes sheetUp { from { transform: translateY(40px); opacity: .4; } }
  @media (min-width: 640px) {
    .sheet { margin: auto; width: min(560px, calc(100vw - 32px)); border-radius: 24px; border: 1px solid var(--line-2); }
    .sheet-tall { width: min(860px, calc(100vw - 32px)); height: auto; max-height: 90dvh; }
    .sheet-body { padding: 20px 24px 24px; }
    .sheet-grip { display: none; }
    .sheet-actions .btn { flex: none; }
    .sheet-actions .grow { display: block; }
  }

  .search-mini { position: relative; display: block; }
  .search-mini .ico { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; color: var(--fg-4); }
  .admin .search-mini input { padding-left: 40px; }
  .option-list { display: grid; gap: 2px; max-height: 55dvh; overflow-y: auto; }
  .option { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 12px; border-radius: 12px; font-weight: 500; color: var(--fg); }
  .option:hover { background: rgb(255 255 255 / .05); }
  .option.on { background: rgb(139 92 246 / .14); }
  .option .ico { width: 20px; height: 20px; color: var(--fg-3); }
  .option.on .ico { color: var(--accent-400); }
  .option span { flex: 1; }
  .option.danger, .option.danger .ico { color: #fca5a5; }

  .progress { height: 10px; border-radius: 999px; background: rgb(255 255 255 / .08); overflow: hidden; }
  .progress div { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent-500), var(--accent-400)); transition: width .25s; }
  .progress-meta { display: flex; justify-content: space-between; font-size: .75rem; color: var(--fg-3); font-variant-numeric: tabular-nums; }

  /* ---------------- tryb kart ---------------- */
  .card-modal { padding: 0; margin: 0; width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; border: 0; background: #0d1015; color: var(--fg); display: none; }
  .card-modal[open] { display: flex; flex-direction: column; animation: fadeIn .2s ease-out; }
  .card-modal::backdrop { background: rgb(0 0 0 / .8); }
  @keyframes fadeIn { from { opacity: 0; } }
  .cm-head { display: flex; align-items: center; gap: 10px; padding: calc(8px + env(safe-area-inset-top)) 10px 8px; border-bottom: 1px solid var(--line); }
  .cm-progress { font-weight: 800; font-variant-numeric: tabular-nums; }
  .cm-keys { margin-left: auto; font-size: .75rem; color: var(--fg-4); display: none; }
  .cm-body { flex: 1; min-height: 0; display: grid; gap: 16px; padding: 16px; overflow-y: auto; align-content: start; }
  .cm-preview { position: relative; width: min(100%, 46dvh); margin-inline: auto; aspect-ratio: 1; border-radius: 18px; overflow: hidden; background: rgb(255 255 255 / .04); border: 1px solid var(--line); }
  .cm-preview img { width: 100%; height: 100%; object-fit: cover; }
  .cm-preview img:not([src]) { display: none; }
  .cm-side { display: grid; gap: 10px; align-content: start; }
  .cm-city { font-size: .75rem; color: var(--fg-3); }
  .cm-city:empty { display: none; }
  .cm-text { font-size: 1.0625rem; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
  .cm-date { font-size: .75rem; color: var(--fg-3); }
  #cmMod .badge { justify-self: start; }
  .cm-actions { display: grid; grid-template-columns: 1fr auto auto 1fr; gap: 8px; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #0d1015; }
  .cm-actions .btn { min-height: 52px; font-size: 1rem; }
  kbd { display: none; font: 600 .6875rem/1 var(--font); padding: 3px 6px; border-radius: 6px; background: rgb(0 0 0 / .25); }
  @media (min-width: 900px) {
    .card-modal { margin: auto; width: min(1000px, calc(100vw - 48px)); height: auto; max-height: calc(100dvh - 48px); border-radius: 24px; border: 1px solid var(--line-2); }
    .cm-keys { display: block; }
    .cm-body { grid-template-columns: minmax(0, 440px) 1fr; padding: 24px; gap: 24px; }
    .cm-preview { width: 100%; }
    .cm-text { font-size: 1.1875rem; }
    kbd { display: inline-block; }
  }

  /* ---------------- toasty ---------------- */
  .toasts { position: fixed; z-index: 100; left: 50%; translate: -50% 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
  @media (min-width: 1024px) { .toasts { bottom: 24px; left: calc(260px + (100vw - 260px) / 2); } }
  .toast { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px 12px 16px; border-radius: 14px; background: rgb(30 34 43 / .97); border: 1px solid var(--line-2); font-size: .875rem; font-weight: 500; box-shadow: 0 20px 40px -10px #000; animation: rise .2s ease-out; pointer-events: auto; }
  .toast.err { border-color: rgb(239 68 68 / .5); color: #fca5a5; }
  .toast button { border: 0; background: rgb(139 92 246 / .2); color: var(--accent-400); font-weight: 700; padding: 6px 12px; border-radius: 10px; }

  /* ---------------- edytor podstron ---------------- */
  .editor-toolbar { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; padding: 4px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
  .editor-toolbar::-webkit-scrollbar { display: none; }
  .editor-toolbar button, .tb-file { flex: none; display: inline-grid; place-items: center; min-width: 40px; height: 38px; padding: 0 8px; border-radius: 9px; border: 0; background: transparent; font-size: .875rem; color: var(--fg-2); cursor: pointer; }
  .editor-toolbar button:hover, .tb-file:hover { background: rgb(255 255 255 / .08); }
  .tb-file .ico { width: 18px; height: 18px; }
  .tb-file input { display: none; }
  .editor-toolbar .sep { flex: none; width: 1px; margin: 6px 2px; background: var(--line-2); }
  .editor { min-height: 220px; max-height: 50dvh; overflow: auto; padding: 14px; border-radius: 12px; background: var(--field); border: 1px solid var(--line-2); outline: 0; line-height: 1.7; }
  .editor:focus { border-color: var(--accent-400); }

  /* ---------------- logowanie ---------------- */
  .login-wrap { flex: 1; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); }
  .login-card { width: min(400px, 100%); display: grid; gap: 14px; padding: 28px 20px; border-radius: 24px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 30px 80px -30px #000; }
  @media (min-width: 480px) { .login-card { padding: 36px 32px; } }
  .login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
  .login-brand .logo { width: 32px; height: 32px; color: var(--accent-400); }
  .login-card h1 { font-size: 1.5rem; letter-spacing: -.02em; }
  .login-card > p.muted { margin-top: -10px; font-size: .875rem; }
  .back-link { display: inline-flex; align-items: center; justify-content: center; gap: 4px; font-size: .8125rem; color: var(--fg-3); }
  .back-link .ico { width: 16px; height: 16px; }
}
@layer components {
  .ig-acc { display: flex; align-items: center; gap: 12px; }
  .ig-acc > .ico { width: 36px; height: 36px; padding: 8px; border-radius: 12px; color: #fff; background: linear-gradient(45deg, #f09433, #dc2743 55%, #bc1888); }
  .ig-acc span { display: grid; min-width: 0; }
  .ig-acc small { font-size: .75rem; overflow-wrap: anywhere; }
  .switch-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); cursor: pointer; }
  .switch-row span { flex: 1; display: grid; gap: 3px; }
  .switch-row b { font-size: .9375rem; color: var(--fg); }
  .switch-row small { font-size: .75rem; font-weight: 400; color: var(--fg-3); line-height: 1.4; }
  input[role="switch"] { appearance: none; flex: none; width: 50px; height: 30px; border-radius: 999px; background: rgb(255 255 255 / .14); position: relative; cursor: pointer; transition: background .2s; }
  input[role="switch"]::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgb(0 0 0 / .4); transition: transform .2s; }
  input[role="switch"]:checked { background: var(--accent-500); }
  input[role="switch"]:checked::after { transform: translateX(20px); }
  input[role="switch"]:focus-visible { outline: 2px solid var(--accent-400); outline-offset: 3px; }
  .publish-now { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px dashed var(--line-2); }
  .publish-now span { flex: 1; display: grid; }
  .publish-now small { font-size: .72rem; color: var(--fg-3); }
  .pub-log { display: grid; gap: 8px; }
  .pub-log li { display: flex; gap: 10px; font-size: .8125rem; }
  .pub-log li > span:last-child { display: grid; gap: 2px; min-width: 0; }
  .pub-log small { color: var(--fg-3); overflow-wrap: anywhere; }
  .pl-dot { flex: none; width: 10px; height: 10px; margin-top: 4px; border-radius: 50%; background: var(--fg-4); }
  .pl-ok .pl-dot { background: #4ade80; } .pl-partial .pl-dot { background: #facc15; } .pl-error .pl-dot { background: #f87171; }
  .btn .spinner { width: 16px; height: 16px; }
}
@layer components {
  .autopub-note { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; font-size: .8125rem; color: var(--fg-2); background: var(--panel-2); border: 1px solid var(--line); }
  .autopub-note > .ico:first-child { width: 18px; height: 18px; color: var(--accent-400); }
  .autopub-note span { flex: 1; }
  .autopub-note > .ico:last-child { width: 16px; height: 16px; color: var(--fg-4); }
  .autopub-note.on { border-color: rgb(34 197 94 / .35); background: rgb(34 197 94 / .08); }
  .autopub-note.on > .ico:first-child { color: #4ade80; }
  .badge .ico { width: 12px; height: 12px; }
}
@layer components {
  .ai-ok { color: #86efac; border-color: rgb(34 197 94 / .3); background: rgb(34 197 94 / .08); }
  .ai-pending { color: var(--fg-3); }
  .ai-pending .ico { animation: pulse 1.2s ease-in-out infinite; }
  .ai-failed { color: var(--fg-4); }
  @keyframes pulse { 50% { opacity: .3; } }
  .spot-reason { display: flex; align-items: flex-start; gap: 6px; font-size: .78rem; line-height: 1.4; color: #fde68a; }
  .spot.mod-certain .spot-reason { color: #fca5a5; }
  .spot-reason .ico { width: 14px; height: 14px; margin-top: 1px; flex: none; }
  .cm-reason { font-size: .875rem; color: #fde68a; }
  .cm-reason:empty { display: none; }
}
@layer components { .ai-failed { cursor: pointer; } .ai-failed:hover { color: var(--fg-2); border-color: var(--line-2); } }
@layer components {
  .ai-pill { position: fixed; z-index: 90; right: 12px; top: calc(var(--appbar-h) + env(safe-area-inset-top) + 8px); display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px; border-radius: 999px; font-size: .78rem; font-weight: 600; color: var(--fg-2); background: rgb(28 33 44 / .95); border: 1px solid var(--line-2);
    box-shadow: 0 10px 30px -10px #000; animation: rise .2s ease-out; }
  .ai-pill::before { content: ''; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent-400); animation: spin .8s linear infinite; }
  .ai-pill.done { color: #86efac; border-color: rgb(34 197 94 / .35); }
  .ai-pill.done::before { border: 0; width: 8px; height: 8px; background: #4ade80; animation: none; }
  @media (min-width: 1024px) { .ai-pill { top: 20px; right: 24px; } }
}
