/* ── Krąg — system projektowy ─────────────────────────────────────────────
   Kolory:  indygo #4f46e5 → fiolet #7c3aed (primary), koral #fb7185 (akcent)
   Fonty:   Space Grotesk (display), Inter (tekst), JetBrains Mono (meta)
   Sygnatura: pierścień logo + dok czatu w stylu Messengera
   ────────────────────────────────────────────────────────────────────────── */

:root {
  --indigo:   #4f46e5;
  --violet:   #7c3aed;
  --grad:     linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --coral:    #fb7185;
  --ink:      #1c2030;
  --muted:    #6b7280;
  --line:     #e7e8f0;
  --bg:       #f4f5fb;
  --card:     #ffffff;
  --soft:     #f2f3fa;
  --ok:       #16a34a;
  --err:      #dc2626;
  --radius:   16px;
  --radius-sm:10px;
  --shadow:   0 1px 2px rgba(28,32,48,.05), 0 6px 20px rgba(28,32,48,.06);
  --shadow-lg:0 12px 40px rgba(28,32,48,.18);
  --sans:     'Inter', system-ui, sans-serif;
  --display:  'Space Grotesk', var(--sans);
  --mono:     'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--indigo); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }

/* ── Awatary ─────────────────────────────────────────────────────────── */
.avatar {
  border-radius: 50%; object-fit: cover; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  vertical-align: middle;
}
.avatar-initials { color: #fff; font-family: var(--display); font-weight: 600; letter-spacing: .5px; }

/* ── Logo (pierścień) ────────────────────────────────────────────────── */
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 22px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-ring { width: 30px; height: 30px; border-radius: 50%; background: var(--grad);
  -webkit-mask: radial-gradient(circle 6px at 50% 50%, transparent 98%, #000 100%);
          mask: radial-gradient(circle 6px at 50% 50%, transparent 98%, #000 100%);
  box-shadow: 0 4px 12px rgba(124,58,237,.4); }
.brand em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ── Górny pasek ─────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  height: 60px;
}
.topbar-inner { max-width: 1180px; margin: 0 auto; height: 100%; padding: 0 18px;
  display: flex; align-items: center; gap: 16px; }
.searchbox { flex: 1; max-width: 340px; position: relative; }
.searchbox input { width: 100%; border: 1px solid var(--line); background: var(--soft);
  border-radius: 999px; padding: 9px 16px 9px 38px; font-size: 14px; }
.searchbox svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.iconbtn { position: relative; width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--soft); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.iconbtn:hover { background: #e9eaf5; }
.iconbtn .badge, .navlink .badge { position: absolute; top: -3px; right: -3px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--coral);
  color: #fff; font-size: 11px; font-weight: 700; display: none; align-items: center; justify-content: center;
  font-family: var(--mono); }
.iconbtn .badge.show, .navlink .badge.show { display: inline-flex; }

/* ── Układ 3-kolumnowy ───────────────────────────────────────────────── */
.shell { max-width: 1180px; margin: 22px auto; padding: 0 18px;
  display: grid; grid-template-columns: 240px minmax(0,1fr) 300px; gap: 22px; align-items: start; }
.col-left, .col-right { position: sticky; top: 82px; }

/* Nawigacja boczna */
.nav { display: flex; flex-direction: column; gap: 2px; }
.navlink { display: flex; align-items: center; gap: 13px; padding: 11px 14px; border-radius: var(--radius-sm);
  color: var(--ink); font-weight: 500; position: relative; }
.navlink:hover { background: #ececf7; text-decoration: none; }
.navlink.active { background: #fff; box-shadow: var(--shadow); color: var(--indigo); font-weight: 600; }
.navlink svg { color: var(--muted); }
.navlink.active svg { color: var(--indigo); }
.nav-me { display: flex; align-items: center; gap: 11px; padding: 10px 12px; margin-bottom: 8px;
  background: #fff; border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.nav-me b { font-family: var(--display); font-size: 15px; }
.nav-me small { color: var(--muted); font-size: 12px; }

/* ── Karty ───────────────────────────────────────────────────────────── */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.card-pad { padding: 18px; }
.card-title { font-family: var(--display); font-weight: 600; font-size: 15px; margin: 0 0 12px;
  display: flex; align-items: center; justify-content: space-between; }
.card-title .link-more { font-family: var(--sans); font-weight: 500; font-size: 13px; }

/* ── Przyciski ───────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: none; border-radius: 10px; padding: 10px 16px; font-weight: 600; font-size: 14px;
  background: var(--soft); color: var(--ink); transition: transform .06s, filter .15s; }
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(79,70,229,.35); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-danger { background: #fee2e2; color: var(--err); }

/* ── Kompozytor postu ────────────────────────────────────────────────── */
.composer { display: flex; gap: 12px; }
.composer textarea { flex: 1; border: none; resize: none; background: var(--soft); border-radius: 14px;
  padding: 12px 15px; font-family: var(--sans); font-size: 15px; min-height: 46px; }
.composer textarea:focus { outline: none; background: #eef0fa; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-left: 52px; }
.composer-tools { display: flex; gap: 4px; }
.tool { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 8px;
  color: var(--muted); font-size: 13px; font-weight: 500; background: none; border: none; }
.tool:hover { background: var(--soft); color: var(--indigo); }
.preview-thumb { position: relative; margin: 10px 0 0 52px; display: inline-block; }
.preview-thumb img { max-height: 200px; border-radius: 12px; }
.preview-thumb button { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff; border: none; font-size: 16px; line-height: 1; }

/* ── Post ────────────────────────────────────────────────────────────── */
.post-head { display: flex; align-items: center; gap: 11px; margin-bottom: 12px; }
.post-head .who b { font-family: var(--display); display: block; line-height: 1.2; }
.post-head .who .meta { color: var(--muted); font-size: 12.5px; font-family: var(--mono); }
.post-body { white-space: pre-wrap; word-break: break-word; margin: 0 0 12px; }
.post-image { border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.post-image img { width: 100%; }
.post-stats { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; padding: 4px 0; }
.post-stats .heart { color: var(--coral); }
.post-actions { display: flex; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 6px; }
.post-actions .act { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px; border-radius: 9px; background: none; border: none; color: var(--muted); font-weight: 600; font-size: 13.5px; }
.post-actions .act:hover { background: var(--soft); }
.post-actions .act.liked { color: var(--coral); }
.post-actions .act.liked svg { fill: var(--coral); }

/* Komentarze */
.comments { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 12px; display: none; }
.comments.open { display: block; }
.comment { background: var(--soft); border-radius: 12px; padding: 8px 13px; margin-bottom: 8px; font-size: 14px; }
.comment b { font-family: var(--display); font-weight: 600; margin-right: 4px; }
.comment .c-time { color: var(--muted); font-size: 11px; font-family: var(--mono); margin-left: 6px; }
.comment-form { display: flex; gap: 8px; margin-top: 6px; }
.comment-form input { flex: 1; border: 1px solid var(--line); border-radius: 999px; padding: 9px 15px; font-size: 14px; background: var(--soft); }
.comment-form input:focus { outline: none; border-color: var(--violet); }

/* ── Prawa kolumna: kontakty ─────────────────────────────────────────── */
.contact { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px; cursor: pointer; color: var(--ink); }
.contact:hover { background: var(--soft); text-decoration: none; }
.contact .dot { width: 10px; height: 10px; border-radius: 50%; background: #cbd0dc; margin-left: auto; flex: none; }
.contact .dot.online { background: var(--ok); box-shadow: 0 0 0 2px #fff, 0 0 0 4px #bbf7d0; }
.contact b { font-weight: 500; font-size: 14px; }

/* ── Profil ──────────────────────────────────────────────────────────── */
.cover { height: 240px; border-radius: 0 0 0 0; background: var(--grad); position: relative; overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.profile-head { background: #fff; border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow); padding: 0 24px 20px; margin-bottom: 18px; }
.profile-top { display: flex; align-items: flex-end; gap: 20px; margin-top: -56px; }
.profile-top .avatar { border: 5px solid #fff; box-shadow: var(--shadow); }
.profile-id h1 { font-family: var(--display); font-size: 26px; margin: 0; }
.profile-id .uname { color: var(--muted); font-family: var(--mono); font-size: 13px; }
.profile-actions { margin-left: auto; display: flex; gap: 8px; align-self: center; padding-top: 60px; }
.profile-bio { margin-top: 14px; color: #374151; }
.profile-stats { display: flex; gap: 22px; margin-top: 12px; font-size: 14px; }
.profile-stats b { font-family: var(--display); }
.profile-stats span { color: var(--muted); }

/* ── Znajomi / siatki użytkowników ───────────────────────────────────── */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 14px; }
.person { text-align: center; }
.person .avatar { margin: 0 auto 10px; }
.person b { font-family: var(--display); font-size: 15px; display: block; }
.person .uname { color: var(--muted); font-size: 12px; font-family: var(--mono); margin-bottom: 10px; }
.person .btn { width: 100%; }
.req-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.req-row:last-child { border-bottom: none; }
.req-row .who b { font-family: var(--display); display: block; }
.req-row .who small { color: var(--muted); font-family: var(--mono); }
.req-row .btns { margin-left: auto; display: flex; gap: 8px; }

/* ── Galerie ─────────────────────────────────────────────────────────── */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 16px; }
.album-tile { border-radius: var(--radius); overflow: hidden; background: #fff; box-shadow: var(--shadow); color: var(--ink); }
.album-tile:hover { text-decoration: none; transform: translateY(-2px); transition: transform .15s; }
.album-cover { aspect-ratio: 4/3; background: var(--soft) var(--grad); display: flex; align-items: center; justify-content: center; }
.album-cover img { width: 100%; height: 100%; object-fit: cover; }
.album-cover .ph { color: #fff; opacity: .6; }
.album-tile .info { padding: 12px 14px; }
.album-tile .info b { font-family: var(--display); }
.album-tile .info small { color: var(--muted); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 8px; }
.photo-grid a { aspect-ratio: 1; border-radius: 10px; overflow: hidden; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; }
.photo-grid a:hover img { transform: scale(1.04); transition: transform .2s; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(12,14,22,.92); z-index: 200;
  display: none; align-items: center; justify-content: center; padding: 30px; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 90vh; border-radius: 8px; }
.lightbox .close { position: absolute; top: 18px; right: 24px; color: #fff; font-size: 34px; background: none; border: none; }

/* ── Messenger — pełna strona ────────────────────────────────────────── */
.mgr { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - 104px);
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.mgr-list { border-right: 1px solid var(--line); overflow-y: auto; }
.mgr-list h2 { font-family: var(--display); font-size: 20px; padding: 18px 18px 8px; margin: 0; }
.conv { display: flex; align-items: center; gap: 12px; padding: 11px 16px; cursor: pointer; color: var(--ink); }
.conv:hover { background: var(--soft); text-decoration: none; }
.conv.active { background: #eef0fa; }
.conv .txt { min-width: 0; flex: 1; }
.conv .txt b { font-family: var(--display); font-weight: 600; font-size: 14.5px; display: block; }
.conv .txt .last { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .txt .last.unread { color: var(--ink); font-weight: 600; }
.conv .un { width: 9px; height: 9px; border-radius: 50%; background: var(--indigo); flex: none; }

.mgr-thread { display: flex; flex-direction: column; min-width: 0; }
.mgr-header { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.mgr-header b { font-family: var(--display); }
.mgr-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 4px; background: var(--soft); }
.mgr-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); gap: 12px; }
.mgr-input { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }
.mgr-input input { flex: 1; border: 1px solid var(--line); border-radius: 999px; padding: 11px 18px; font-size: 15px; background: var(--soft); }
.mgr-input input:focus { outline: none; border-color: var(--violet); }
.mgr-input .send { width: 44px; height: 44px; border-radius: 50%; background: var(--grad); color: #fff; border: none; flex: none; display: inline-flex; align-items: center; justify-content: center; }

/* Bąbelki wiadomości (współdzielone: strona + dok) */
.bubble { max-width: 72%; padding: 9px 14px; border-radius: 18px; font-size: 14.5px; line-height: 1.4;
  word-break: break-word; align-self: flex-start; background: #fff; box-shadow: 0 1px 1px rgba(0,0,0,.05); }
.bubble.mine { align-self: flex-end; background: var(--grad); color: #fff; }
.bubble .t { display: block; font-size: 10px; font-family: var(--mono); opacity: .55; margin-top: 3px; }

/* ── Dok czatu (sygnatura) ───────────────────────────────────────────── */
#chatdock { position: fixed; right: 20px; bottom: 0; z-index: 120; display: flex; align-items: flex-end; gap: 12px; }
.chatwin { width: 320px; height: 420px; background: #fff; border-radius: 14px 14px 0 0; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden; }
.chatwin.min { height: auto; }
.chatwin.min .cw-body, .chatwin.min .cw-input { display: none; }
.cw-head { display: flex; align-items: center; gap: 9px; padding: 10px 12px; background: var(--grad); color: #fff; cursor: pointer; }
.cw-head b { font-family: var(--display); font-size: 14px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-head button { background: rgba(255,255,255,.2); border: none; color: #fff; width: 24px; height: 24px; border-radius: 6px; font-size: 15px; line-height: 1; }
.cw-body { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 4px; background: var(--soft); }
.cw-input { display: flex; gap: 6px; padding: 9px; border-top: 1px solid var(--line); }
.cw-input input { flex: 1; border: 1px solid var(--line); border-radius: 999px; padding: 8px 13px; font-size: 13.5px; background: var(--soft); }
.cw-input input:focus { outline: none; border-color: var(--violet); }
.cw-input button { width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #fff; border: none; flex: none; }

/* ── Komunikaty flash ────────────────────────────────────────────────── */
#flash { position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 300; width: min(92vw, 420px); display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; background: #fff;
  border-left: 4px solid var(--indigo); animation: slidein .25s ease; }
.toast.success { border-color: var(--ok); }
.toast.error { border-color: var(--err); }
@keyframes slidein { from { opacity: 0; transform: translateY(-8px); } }

/* ── Formularze auth ─────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-hero { background: var(--grad); color: #fff; padding: 60px; display: flex; flex-direction: column; justify-content: center; }
.auth-hero .brand { color: #fff; font-size: 30px; margin-bottom: 30px; }
.auth-hero .brand em { color: #fff; }
.auth-hero .brand-ring { background: #fff; }
.auth-hero h1 { font-family: var(--display); font-size: 42px; line-height: 1.1; margin: 0 0 16px; max-width: 420px; }
.auth-hero p { font-size: 17px; opacity: .9; max-width: 380px; }
.auth-hero .feats { margin-top: 34px; display: flex; flex-direction: column; gap: 14px; }
.auth-hero .feat { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.auth-hero .feat span { width: 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,.18); display: inline-flex; align-items: center; justify-content: center; }
.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-form { width: 100%; max-width: 360px; }
.auth-form h2 { font-family: var(--display); font-size: 26px; margin: 0 0 4px; }
.auth-form .sub { color: var(--muted); margin: 0 0 24px; }
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #374151; }
.field input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px; font-size: 15px; font-family: var(--sans); }
.field input:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(124,58,237,.12); }
.auth-alt { text-align: center; margin-top: 18px; color: var(--muted); font-size: 14px; }

/* ── Puste stany ─────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .ic { width: 56px; height: 56px; border-radius: 16px; background: var(--soft); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; color: var(--violet); }
.empty b { font-family: var(--display); color: var(--ink); font-size: 16px; display: block; margin-bottom: 4px; }

/* ── Mobilna nawigacja dolna ─────────────────────────────────────────── */
.bottomnav { display: none; }

/* ── Responsywność ───────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .shell { grid-template-columns: 72px minmax(0,1fr); }
  .col-right { display: none; }
  .navlink span, .nav-me .txt { display: none; }
  .navlink { justify-content: center; padding: 12px; }
  .nav-me { justify-content: center; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; padding: 0 12px; margin: 14px auto 80px; }
  .col-left { display: none; }
  .searchbox { max-width: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .profile-top { flex-direction: column; align-items: flex-start; }
  .profile-actions { margin-left: 0; padding-top: 0; }
  .mgr { grid-template-columns: 1fr; height: calc(100vh - 150px); }
  .mgr.has-active .mgr-list { display: none; }
  .mgr:not(.has-active) .mgr-thread { display: none; }
  #chatdock { display: none; }   /* na mobile korzystamy z pełnej strony /messages */
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: #fff; border-top: 1px solid var(--line); height: 62px; }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--muted); font-size: 10px; position: relative; }
  .bottomnav a.active { color: var(--indigo); }
  .bottomnav .badge { position: absolute; top: 6px; right: 50%; margin-right: -22px; min-width: 16px; height: 16px;
    background: var(--coral); color: #fff; border-radius: 999px; font-size: 10px; display: none; align-items: center; justify-content: center; font-family: var(--mono); padding: 0 4px; }
  .bottomnav .badge.show { display: inline-flex; }
}

@media (max-width: 460px) {
  .searchbox { display: none; }
  .topbar-inner { gap: 10px; padding: 0 12px; }
}

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }


/* ── Panel administracyjny ──────────────────────────────────────────── */
.impersonate-banner {
  background: #fef3c7; color: #92400e; text-align: center;
  padding: 10px 16px; font-size: 14px; font-weight: 600;
}
.impersonate-banner a { color: #7c2d12; text-decoration: underline; margin-left: 10px; white-space: nowrap; }

.admin-subnav { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.admin-tab {
  padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
  color: var(--muted); background: var(--soft); white-space: nowrap;
}
.admin-tab.active { background: var(--grad); color: #fff; }
.admin-tab:hover { text-decoration: none; }

.admin-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; margin-top: 12px; }
.admin-stat {
  background: var(--soft); border-radius: var(--radius-sm); padding: 14px; text-align: center;
}
.admin-stat b { display: block; font-family: var(--display); font-size: 26px; }
.admin-stat span { color: var(--muted); font-size: 13px; }

.admin-filterbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-filterbar input[type="search"] { flex: 1 1 220px; }
.admin-filterbar input, .admin-filterbar select {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit;
  min-width: 0;
}
.admin-filterbar button { flex: none; }

/* Tabela użytkowników — na szerokich ekranach zwykła tabela */
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.admin-table th { color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }

.role-pill, .status-pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap;
}
.role-user      { background: var(--soft); color: var(--muted); }
.role-moderator { background: #dbeafe; color: #1d4ed8; }
.role-admin     { background: #ede9fe; color: #6d28d9; }
.status-active  { background: #dcfce7; color: #15803d; }
.status-blocked { background: #fee2e2; color: var(--err); }

.admin-pagination { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.admin-pagination a {
  padding: 6px 12px; border-radius: 8px; background: var(--soft); color: var(--ink); font-size: 13px;
}
.admin-pagination a.active { background: var(--grad); color: #fff; }
.admin-pagination a:hover { text-decoration: none; }

/* Formularze panelu */
.admin-form, .admin-form-inline { display: flex; flex-direction: column; gap: 14px; max-width: 480px; }
.admin-form-wide { max-width: 640px; }
.admin-form label, .admin-form-inline label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.admin-form input, .admin-form select, .admin-form textarea,
.admin-form-inline input, .admin-form-inline select {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; color: var(--ink);
  width: 100%;
}
.admin-form textarea { resize: vertical; }
.admin-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.admin-fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; margin: 0 0 18px; }
.admin-fieldset legend { font-family: var(--display); font-weight: 600; padding: 0 8px; font-size: 14px; }
.admin-sep { border: none; border-top: 1px solid var(--line); margin: 22px 0; }

/* Karta użytkownika w edycji: avatar + nazwa nie mogą się ściskać w nieskończoność */
.admin-user-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.admin-user-head .grow { min-width: 0; }
.admin-user-head h1 { font-size: 20px; word-break: break-word; margin: 0; font-family: var(--display); }

/* ── Responsywność panelu administracyjnego ──────────────────────────── */
@media (max-width: 760px) {
  .admin-form-grid { grid-template-columns: 1fr; }
  .admin-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-filterbar { flex-direction: column; align-items: stretch; }
  .admin-filterbar button { width: 100%; }
  .admin-form, .admin-form-inline { max-width: none; }
  .admin-form button[type="submit"], .admin-form-inline button[type="submit"] { width: 100%; }
}

@media (max-width: 640px) {
  /* Tabela -> stos kart czytelnych na telefonie, bez poziomego przewijania */
  .admin-table thead { display: none; }
  .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; width: 100%; }
  .admin-table tr {
    border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 12px; padding: 4px 12px;
  }
  .admin-table td {
    border-bottom: 1px solid var(--soft); padding: 10px 0; display: flex; align-items: center;
    justify-content: space-between; gap: 12px; text-align: right;
  }
  .admin-table td:last-child { border-bottom: none; justify-content: flex-end; }
  .admin-table td::before {
    content: attr(data-label); font-weight: 600; color: var(--muted); font-size: 12px; text-align: left;
  }
  .admin-table td:first-child { text-align: left; }
  .admin-table td:first-child::before { display: none; }
}
