/* AI4BM – panel administracyjny */
:root {
  --bg: #f4f6fb; --surface: #fff; --line: #e3e7f0; --text: #141a2e; --muted: #667089;
  --accent: #0f9f8d; --accent-soft: #e2f6f3; --accent-2: #7c4ddb; --danger: #d6455d; --warn: #b7791f;
  --side: #0b1020; --side-text: #c9d1e6; --radius: 12px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0 0 .6em; line-height: 1.2; }
h2 { font-size: 1.1rem; }
code { background: #eef1f7; padding: 2px 6px; border-radius: 6px; font-size: .9em; }
code.big { font-size: 1.2rem; padding: 6px 10px; letter-spacing: .04em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.strong { font-weight: 600; color: var(--text); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.inline { display: inline; }
.lead { font-size: 1.1rem; color: var(--muted); }

.logo-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; font-size: .78rem; font-weight: 700; color: #fff; background: linear-gradient(135deg, #2dd4bf, #8b5cf6); }

/* Przyciski */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.danger { background: #fff; color: var(--danger); border-color: #f1c4cc; }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.small { padding: 5px 10px; font-size: .85rem; font-weight: 500; }
.btn.block { width: 100%; justify-content: center; padding: 12px; }

/* Układ */
.admin { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-text); padding: 20px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; color: #fff; padding: 4px 8px 22px; font-size: 1.05rem; }
.sidebar .brand .muted { color: #7d88a8; font-weight: 400; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { color: var(--side-text); padding: 9px 12px; border-radius: 8px; display: flex; align-items: center; gap: 10px; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.sidebar nav a.active { background: rgba(45, 212, 191, .16); color: #fff; }
.sidebar .ico { width: 18px; text-align: center; color: #2dd4bf; }
.sidebar .pill { margin-left: auto; background: #2dd4bf; color: #04201c; font-size: .72rem; font-weight: 700; border-radius: 999px; padding: 1px 8px; }
.sidebar-foot { margin-top: auto; padding: 16px 12px 0; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-foot a { color: var(--side-text); font-size: .9rem; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 16px 32px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 1.3rem; margin: 0; flex: 1; }
.who { display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.who a { color: var(--text); font-weight: 600; }
.role-tag { font-size: .72rem; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 2px 8px; font-weight: 600; }
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; font-size: 1.1rem; padding: 4px 10px; cursor: pointer; }
.content { padding: 28px 32px 60px; max-width: 1180px; }

/* Panele i karty */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 20px; }
.panel.flush { padding: 0; overflow-x: auto; }
.panel.empty { text-align: center; color: var(--muted); padding: 40px; }
.panel.highlight { border-color: var(--accent); background: var(--accent-soft); }
.panel.narrow, .form.narrow { max-width: 560px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin: 20px 0 28px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; color: var(--text); }
a.stat-card:hover { border-color: var(--accent); text-decoration: none; }
.stat-card .label { font-weight: 600; color: var(--text); }
.stat-card .value { font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat-card .hint { font-size: .85rem; color: var(--muted); }
.stat-card a.hint { color: var(--accent); }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar p { margin: 0; }

/* Tabele */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fafbfe; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.dim td { opacity: .55; }
.thumb-col { width: 64px; }
.thumb { width: 48px; height: 36px; object-fit: cover; border-radius: 6px; display: block; background: #eef1f7; }
.thumb.ph { background: linear-gradient(135deg, #d6f5f0, #e7dcfb); }
.ok { color: var(--accent); font-weight: 600; }
.kv th { text-align: left; padding: 6px 16px 6px 0; color: var(--muted); font-weight: 500; }
.chip { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: #eef1f7; margin: 2px 4px 2px 0; }
.chip.admin { background: #ece4fb; color: var(--accent-2); font-weight: 600; }
.chip.off { background: #fbe4e8; color: var(--danger); }
.chip.warn { background: #fdf0d9; color: var(--warn); }

/* Formularze */
.form label { display: block; font-weight: 600; font-size: .9rem; }
.form .field { margin-bottom: 16px; }
input, select, textarea { font: inherit; }
.form input:not([type=checkbox]):not([type=radio]):not([type=file]), .form select, .form textarea, .auth-box input, .auth-box select, .app-actions input, .app-actions select {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid #cfd5e3; border-radius: 9px; background: #fff; color: var(--text); font-weight: 400;
}
.form input:focus, .form select:focus, .form textarea:focus, .auth-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 159, 141, .18); }
.form input.short { max-width: 160px; }
.form input:disabled { background: #f1f3f8; color: var(--muted); }
.form textarea { resize: vertical; min-height: 80px; }
label.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; margin: 10px 0; cursor: pointer; }
label.check input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--accent); flex: none; }
.help { color: var(--muted); font-size: .84rem; margin: 6px 0 0; }
.label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 8px; }
.image-field { display: flex; gap: 16px; align-items: flex-start; padding: 14px; border: 1px dashed #cfd5e3; border-radius: 10px; }
.image-field img { width: 140px; height: 96px; object-fit: cover; border-radius: 8px; background: #eef1f7; }
.form-actions { display: flex; gap: 10px; padding-top: 8px; }
.form-actions.sticky { position: sticky; bottom: 0; background: var(--bg); padding: 14px 0; border-top: 1px solid var(--line); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.perm-grid { border: 1px solid var(--line); border-radius: 10px; padding: 8px 16px 12px; margin: 12px 0 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.perm-grid legend { font-size: .85rem; color: var(--muted); padding: 0 6px; }
.perm-grid.off { opacity: .45; }
.role-admin { background: #f7f3fe; border: 1px solid #e5dbfa; border-radius: 10px; padding: 12px 14px; }

/* Komunikaty */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; }
.alert.ok { background: var(--accent-soft); border-color: #a9e5dc; color: #0b5e54; }
.alert.error { background: #fdecef; border-color: #f4bcc6; color: #9b2338; }
.alert.warn { background: #fdf5e6; border-color: #f2d7a6; color: #7a5212; }

/* Zgłoszenia */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { padding: 7px 12px; border-radius: 8px; color: var(--muted); font-size: .9rem; }
.tabs a.active { background: var(--surface); color: var(--text); border: 1px solid var(--line); font-weight: 600; }
.application header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.application h2 { margin: 0; }
.application dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 16px; margin: 14px 0; }
.application dt { color: var(--muted); font-size: .88rem; }
.application dd { margin: 0; }
.status-tag { font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #eef1f7; }
.status-nowe .status-tag { background: var(--accent-soft); color: var(--accent); }
.status-przyjete .status-tag { background: #e3f4e6; color: #2b7a3a; }
.status-odrzucone .status-tag { background: #fbe4e8; color: var(--danger); }
.application.status-nowe { border-left: 4px solid var(--accent); }
.app-actions { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.app-actions select, .app-actions input { width: auto !important; margin: 0 !important; padding: 6px 10px !important; }
.app-actions input { min-width: 260px; }
.application form.right { float: right; }

/* Logowanie i instalacja */
.auth-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(60% 60% at 80% 10%, rgba(139, 92, 246, .25), transparent 70%), radial-gradient(50% 50% at 10% 90%, rgba(45, 212, 191, .2), transparent 70%), #0b1020; padding: 20px; }
.auth-box { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 32px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.auth-box.wide { max-width: 640px; }
.auth-box .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; color: var(--muted); }
.auth-box .brand strong { color: var(--text); }
.auth-box h1 { font-size: 1.5rem; }
.auth-box label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 14px; }
.auth-box fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px 4px; margin: 0 0 16px; }
.auth-box legend { font-weight: 700; padding: 0 6px; }
.auth-box .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.auth-box textarea.mono { width: 100%; font-family: ui-monospace, monospace; font-size: .8rem; }
.checks { list-style: none; padding: 0; margin: 0 0 16px; font-size: .9rem; }
.checks .ok { color: var(--accent); }
.checks .bad { color: var(--danger); font-weight: 600; }

/* Telefon */
@media (max-width: 860px) {
  .admin { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; z-index: 20; }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .menu-btn { display: block; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .who .role-tag { display: none; }
  .content { padding: 20px 16px 60px; }
  .grid2, .perm-grid, .auth-box .row2 { grid-template-columns: 1fr; }
  .application dl { grid-template-columns: 1fr; }
  .image-field { flex-direction: column; }
}
.logo-img { height: 28px; width: auto; vertical-align: middle; }
.chip.mod { background: #dff5f1; color: #0f766e; font-weight: 600; }
.role-admin + .role-admin { margin-top: 8px; }
.role-admin:has(input:checked) { border-color: var(--accent); background: #effaf8; }
/* Aktualności – galeria w formularzu */
.gallery-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin: 10px 0 20px; }
.gi { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #fafbfe; display: flex; flex-direction: column; gap: 6px; }
.gi img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; display: block; }
.gi label.check { margin: 2px 0; }
.gi-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.gi-row label.check { margin: 0; }
.form input.tiny { width: 64px; padding: 4px 6px; display: inline-block; }
.form .gi input[name^=caption] { font-size: .85rem; padding: 6px 8px; }
.danger-text { color: var(--danger); }
.upload-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.upload-preview img { width: 84px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.form .gi input.tiny { width: 70px; padding: 4px 8px; }
.gi-row label.small { display: flex; align-items: center; gap: 6px; font-weight: 500; }

/* Profile członków (formularz profil.php) */
.share-box { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.share-box > div { flex: 1 1 420px; }
.share-box h2 { margin-bottom: 4px; }
.copy-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.copy-row input { flex: 1 1 280px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: .9rem; background: #fff; }
.share-box .chip { margin-right: 6px; }
.profile-entry { display: grid; grid-template-columns: 170px 1fr; gap: 22px; }
.pe-photo { display: flex; flex-direction: column; gap: 6px; }
.pe-photo img { width: 170px; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 12px; display: block; background: #eef1f7; }
.pe-photo .thumb.ph { width: 170px; height: 212px; }
.pe-links { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.accept-box { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin: 6px 0 14px; }
.accept-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-top: 10px; }
.accept-row label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 600; }
.accept-row label.check { flex-direction: row; align-items: center; margin: 0 0 6px; }
.accept-row select, .accept-row input:not([type=checkbox]) { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: .9rem; background: #fff; }
.pe-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pe-foot .app-actions { margin: 0; }
.status-dodane .status-tag { background: #e3f4e6; color: #2b7a3a; }
.application.status-dodane { border-left: 4px solid #46a35a; }
@media (max-width: 760px) {
  .profile-entry { grid-template-columns: 1fr; }
  .pe-photo img { width: 140px; }
}
.profile-entry .status-tag { white-space: nowrap; }
