/* ─────────────────────────────────────────────────────────────────────────────
   Digital Signage – Admin Panel CSS
   Premium dark design with glassmorphism & micro-animations
───────────────────────────────────────────────────────────────────────────── */

/* Bez zewnętrznych fontów: CSP nie potrzebuje wyjątku na domenę Google,
   a adresy IP użytkowników nie wyciekają do firm trzecich (RODO). */

/* ─── Design Tokens ──────────────────────────────────────────────────────── */
:root {
  --bg:          #080810;
  --bg2:         #0e0e1a;
  --bg3:         #13131f;
  --glass:       rgba(255,255,255,0.045);
  --glass-hover: rgba(255,255,255,0.075);
  --border:      rgba(255,255,255,0.08);
  --border-h:    rgba(255,255,255,0.16);

  --accent:      #7c3aed;
  --accent2:     #6d28d9;
  --accent-glow: rgba(124,58,237,0.35);
  --blue:        #3b82f6;
  --blue-glow:   rgba(59,130,246,0.3);

  --text:        #e2e8f0;
  --text-2:      #94a3b8;
  --text-3:      #475569;

  --success:     #10b981;
  --danger:      #ef4444;
  --warning:     #f59e0b;
  --info:        #3b82f6;

  --r:           12px;
  --r-sm:        8px;
  --r-lg:        16px;
  --sidebar-w:   260px;
  --ease:        cubic-bezier(.4,0,.2,1);
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }
a { text-decoration: none; color: inherit; }

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar            { width: 6px; height: 6px; }
::-webkit-scrollbar-track      { background: transparent; }
::-webkit-scrollbar-thumb      { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover{ background: rgba(255,255,255,0.22); }

/* ─────────────────────────────────────────────────────────────────────────
   LOGIN SCREEN
───────────────────────────────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(124,58,237,.18) 0%, transparent 70%),
              radial-gradient(ellipse 60% 40% at 80% 80%, rgba(59,130,246,.12) 0%, transparent 60%),
              var(--bg);
  position: relative; overflow: hidden;
}
.login-bg-glow {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle 600px at 30% 20%, rgba(124,58,237,.06), transparent),
              radial-gradient(circle 400px at 70% 80%, rgba(59,130,246,.06), transparent);
}
.glass-card {
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.login-card {
  width: 100%; max-width: 400px;
  padding: 2.5rem;
  box-shadow: 0 32px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.04);
  animation: fadeUp .5s var(--ease);
}
.login-logo {
  display: flex; align-items: center; gap: .875rem;
  margin-bottom: 2rem;
}
.logo-icon { width: 44px; height: 44px; flex-shrink: 0; }
.logo-icon svg { width: 100%; height: 100%; }
.login-title { font-size: 1.4rem; font-weight: 700; line-height: 1.2; }
.login-subtitle { font-size: .8rem; color: var(--text-2); }

/* ─── Form ─────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block; font-size: .78rem; font-weight: 500;
  color: var(--text-2); text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: .4rem;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: .65rem .9rem;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-group select { appearance: none; cursor: pointer; }
.form-group-align { display: flex; flex-direction: column; justify-content: flex-end; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 2.5rem; }
.pw-toggle {
  position: absolute; right: .7rem; top: 50%; transform: translateY(-50%);
  color: var(--text-3); width: 20px; height: 20px; display: flex; align-items: center;
  transition: color .2s;
}
.pw-toggle:hover { color: var(--text-2); }
.pw-toggle svg { width: 18px; height: 18px; }
.link-text { color: var(--accent); cursor: pointer; }

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .6rem 1.1rem;
  border-radius: var(--r-sm); font-size: .875rem; font-weight: 500;
  transition: all .2s var(--ease); cursor: pointer; border: none;
  white-space: nowrap; flex-shrink: 0;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:active { transform: scale(.97); }
.btn-full { width: 100%; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #5b21b6);
  color: white;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #8b5cf6, var(--accent));
  box-shadow: 0 6px 24px var(--accent-glow);
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--glass);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--glass-hover); border-color: var(--border-h); color: var(--text); }
.btn-danger {
  background: rgba(239,68,68,.15);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,.25);
}
.btn-danger:hover { background: rgba(239,68,68,.25); }
.btn-success {
  background: rgba(16,185,129,.15);
  color: var(--success);
  border: 1px solid rgba(16,185,129,.25);
}
.btn-success:hover { background: rgba(16,185,129,.25); }
.btn-ghost { color: var(--text-2); padding: .5rem; }
.btn-ghost:hover { color: var(--text); background: var(--glass); border-radius: var(--r-sm); }
.btn-sm { padding: .4rem .75rem; font-size: .8rem; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-icon {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--r-sm);
  color: var(--text-3);
  transition: all .2s;
}
.btn-icon:hover { background: var(--glass); color: var(--text-2); }
.btn-icon svg { width: 18px; height: 18px; }

/* ─── Spinner ─────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

/* ─── Alerts ─────────────────────────────────────────────────────────── */
.alert {
  padding: .65rem 1rem; border-radius: var(--r-sm);
  font-size: .85rem; margin-bottom: .75rem;
}
.alert-danger  { background: rgba(239,68,68,.12); color: #fca5a5; border: 1px solid rgba(239,68,68,.2); }
.alert-success { background: rgba(16,185,129,.12); color: #6ee7b7; border: 1px solid rgba(16,185,129,.2); }

/* ─────────────────────────────────────────────────────────────────────────
   APP LAYOUT
───────────────────────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

/* ─── Sidebar ────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
}
.sidebar-logo {
  display: flex; align-items: center; gap: .75rem;
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.logo-icon-sm { width: 36px; height: 36px; flex-shrink: 0; }
.logo-icon-sm svg { width: 100%; height: 100%; }
.sidebar-brand { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; }

.sidebar-nav { flex: 1; padding: 1rem .75rem; display: flex; flex-direction: column; gap: .25rem; }
.nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .875rem;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: .875rem; font-weight: 500;
  transition: all .2s var(--ease);
  position: relative;
}
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-item:hover { background: var(--glass); color: var(--text); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(124,58,237,.2), rgba(59,130,246,.12));
  color: var(--text);
  border: 1px solid rgba(124,58,237,.2);
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 25%; bottom: 25%;
  width: 3px; background: var(--accent); border-radius: 0 2px 2px 0;
}

.sidebar-footer {
  padding: 1rem .75rem;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: .5rem;
}
.user-info { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; flex-shrink: 0;
}
.user-details { min-width: 0; }
.user-name { display: block; font-size: .82rem; font-weight: 600; truncate: ellipsis; }
.user-role { display: block; font-size: .72rem; color: var(--text-3); }

/* ─── Main content ────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 2rem 2.25rem;
  min-height: 100vh;
  background: radial-gradient(ellipse 100% 50% at 70% 0%, rgba(124,58,237,.05) 0%, transparent 70%),
              var(--bg);
}

/* ─── Tab panels ─────────────────────────────────────────────────────── */
.tab-panel { display: none; animation: fadeIn .25s var(--ease); }
.tab-panel.active { display: block; }

/* ─── Page header ────────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 1.75rem; gap: 1rem; flex-wrap: wrap;
}
.page-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.page-subtitle { font-size: .85rem; color: var(--text-2); margin-top: .2rem; }

/* ─────────────────────────────────────────────────────────────────────────
   MEDIA TAB
───────────────────────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  padding: 2.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
  transition: all .2s var(--ease);
  cursor: pointer;
  color: var(--text-2);
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(124,58,237,.06);
  color: var(--text);
}
.drop-icon svg {
  width: 44px; height: 44px;
  stroke: var(--text-3);
  margin-bottom: .75rem;
  transition: stroke .2s;
}
.drop-zone:hover .drop-icon svg,
.drop-zone.drag-over .drop-icon svg { stroke: var(--accent); }
.drop-hint { font-size: .78rem; color: var(--text-3); margin-top: .4rem; }

/* Upload queue */
.upload-queue { margin-bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.upload-item {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: .65rem 1rem;
  display: flex; align-items: center; gap: .75rem;
  animation: fadeIn .2s var(--ease);
}
.upload-item-name { flex: 1; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-progress {
  width: 120px; height: 5px;
  background: rgba(255,255,255,.08);
  border-radius: 3px; overflow: hidden; flex-shrink: 0;
}
.upload-progress-bar {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--blue));
  border-radius: 3px; transition: width .3s;
}
.upload-status { font-size: .75rem; color: var(--text-3); flex-shrink: 0; min-width: 60px; text-align: right; }

/* Media grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.media-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color .2s, transform .2s, box-shadow .2s;
  animation: fadeIn .25s var(--ease);
}
.media-card:hover {
  border-color: var(--border-h);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.media-thumb {
  width: 100%; height: 140px;
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-thumb .thumb-icon { opacity: .4; }
.media-thumb .thumb-icon svg { width: 48px; height: 48px; stroke: var(--text-2); }
.media-type-badge {
  position: absolute; top: .5rem; right: .5rem;
  padding: .2rem .5rem; border-radius: 4px;
  font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
}
.badge-video { background: rgba(124,58,237,.8); color: white; }
.badge-image { background: rgba(16,185,129,.8); color: white; }
.badge-pdf   { background: rgba(239,68,68,.8);  color: white; }

.media-info { padding: .875rem; }
.media-name {
  font-size: .88rem; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-bottom: .35rem;
}
.media-meta { display: flex; gap: .75rem; font-size: .76rem; color: var(--text-3); margin-bottom: .875rem; }
.media-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ─────────────────────────────────────────────────────────────────────────
   PLAYLISTS TAB
───────────────────────────────────────────────────────────────────────── */
.playlists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.playlist-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: border-color .2s, transform .2s, box-shadow .2s;
  animation: fadeIn .25s var(--ease);
  overflow: hidden;
}
.playlist-card:hover {
  border-color: var(--border-h);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,.35);
}
.playlist-card-header {
  padding: 1rem 1.1rem .75rem;
  background: linear-gradient(135deg, rgba(124,58,237,.12), rgba(59,130,246,.06));
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: .6rem;
}
.playlist-card-header-info { flex: 1; min-width: 0; }
.playlist-name {
  font-size: 1rem; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.playlist-meta-row {
  display: flex; align-items: center; gap: .6rem;
  margin-top: .3rem; font-size: .78rem; color: var(--text-2);
}
.online-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .15rem .55rem; border-radius: 20px;
  font-size: .72rem; font-weight: 600;
}
.online-badge::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
}
.badge-online { background: rgba(16,185,129,.15); color: var(--success); }
.badge-online::before { background: var(--success); box-shadow: 0 0 6px var(--success); animation: pulse-dot 1.5s infinite; }
.badge-offline { background: rgba(255,255,255,.05); color: var(--text-3); }
.badge-offline::before { background: var(--text-3); }

.playlist-card-body { padding: .875rem 1.1rem; }
.playlist-stats { display: flex; gap: 1.25rem; margin-bottom: .875rem; }
.pl-stat { font-size: .8rem; color: var(--text-2); }
.pl-stat-value { font-weight: 600; color: var(--text); }

.playlist-tags { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .875rem; }
.tag {
  padding: .18rem .55rem; border-radius: 20px;
  font-size: .72rem; font-weight: 500;
  background: rgba(255,255,255,.06); border: 1px solid var(--border);
  color: var(--text-2);
}
.tag-accent { background: rgba(124,58,237,.12); border-color: rgba(124,58,237,.25); color: #a78bfa; }
.playlist-url-row { margin-bottom: .875rem; }
.url-chip {
  display: flex; align-items: center; gap: .5rem;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: .35rem .65rem;
  font-size: .72rem; font-family: monospace; color: var(--text-3);
  overflow: hidden;
}
.url-chip span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.url-chip button { flex-shrink: 0; color: var(--text-3); }
.url-chip button:hover { color: var(--accent); }
.url-chip svg { width: 13px; height: 13px; }

.playlist-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ─────────────────────────────────────────────────────────────────────────
   SYSTEM TAB
───────────────────────────────────────────────────────────────────────── */
.system-grid { display: flex; flex-direction: column; gap: 1.5rem; }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat-card {
  padding: 1.25rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
}
.stat-icon {
  width: 44px; height: 44px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.media-icon  { background: rgba(124,58,237,.15); color: #a78bfa; }
.pl-icon     { background: rgba(59,130,246,.15);  color: #93c5fd; }
.online-icon { background: rgba(16,185,129,.15);  color: var(--success); }
.size-icon   { background: rgba(245,158,11,.15);  color: var(--warning); }
.stat-value  { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-label  { font-size: .78rem; color: var(--text-2); margin-top: .2rem; }

.sys-card { padding: 1.5rem; }
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: 1.25rem; }
.sys-form { max-width: 420px; }
.info-table { width: 100%; border-collapse: collapse; }
.info-table td {
  padding: .65rem .25rem; font-size: .85rem;
  border-bottom: 1px solid var(--border);
}
.info-table tr:last-child td { border-bottom: none; }
.info-table td:first-child { color: var(--text-2); width: 45%; }
.info-table code {
  background: var(--bg3); padding: .15rem .5rem;
  border-radius: 4px; font-size: .8rem; color: #93c5fd;
}
.badge-info { background: rgba(59,130,246,.15); color: #93c5fd; padding: .18rem .55rem; border-radius: 20px; font-size: .78rem; }

/* ─────────────────────────────────────────────────────────────────────────
   MODALS
───────────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fadeIn .15s var(--ease);
}
.modal-dialog {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  width: 100%; max-width: 520px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 40px 100px rgba(0,0,0,.8);
  animation: modalIn .2s var(--ease);
}
.modal-large { max-width: 780px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 600; }
.modal-close {
  width: 30px; height: 30px; border-radius: 6px;
  color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.modal-close:hover { background: var(--glass); color: var(--text); }
.modal-close svg { width: 18px; height: 18px; }
.modal-body { padding: 1.5rem; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: .6rem;
  flex-shrink: 0;
}

/* ─── Playlist Editor ───────────────────────────────────────────────── */
.pm-settings { margin-bottom: 1.25rem; }
.pm-settings-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .875rem; margin-top: .875rem; }
@media (max-width: 600px) { .pm-settings-row { grid-template-columns: 1fr; } }

.pm-items-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .5rem;
}
.pm-items-header h4 { font-size: .95rem; font-weight: 600; }
.pm-items-hint { font-size: .76rem; color: var(--text-3); margin-bottom: .875rem; }
.pm-items-list { display: flex; flex-direction: column; gap: .4rem; min-height: 60px; }

.pm-item {
  display: flex; align-items: center; gap: .65rem;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: .55rem .75rem;
  transition: border-color .2s, opacity .2s;
  cursor: default;
}
.pm-item.dragging { opacity: .45; border-color: var(--accent); }
.pm-item.drag-over { border-color: var(--accent); background: rgba(124,58,237,.08); }
.pm-item.disabled { opacity: .45; }
.drag-handle {
  color: var(--text-3); cursor: grab; flex-shrink: 0;
  padding: .1rem; transition: color .2s;
}
.drag-handle:hover { color: var(--text-2); }
.drag-handle svg { width: 15px; height: 15px; display: block; }
.pm-item-thumb {
  width: 44px; height: 32px; border-radius: 4px; overflow: hidden;
  background: var(--bg3); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.pm-item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pm-item-thumb svg { width: 18px; height: 18px; stroke: var(--text-3); }
.pm-item-info { flex: 1; min-width: 0; }
.pm-item-name { font-size: .82rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-item-meta { font-size: .72rem; color: var(--text-3); }
.pm-duration-wrap { display: flex; align-items: center; gap: .3rem; flex-shrink: 0; }
.pm-duration-wrap input[type="number"] {
  width: 58px; padding: .3rem .4rem; border-radius: 5px;
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  font-size: .78rem; text-align: center;
}
.pm-duration-wrap input[type="number"]:focus { border-color: var(--accent); outline: none; }
.pm-duration-wrap span { font-size: .75rem; color: var(--text-3); }

/* Toggle */
.toggle { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute; inset: 0;
  background: rgba(255,255,255,.1); border-radius: 20px;
  cursor: pointer; transition: background .2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 14px; height: 14px; border-radius: 50%;
  background: white; top: 3px; left: 3px;
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); box-shadow: 0 0 6px var(--accent-glow); }
.toggle-wrap { display: flex; align-items: center; gap: .6rem; padding-top: .4rem; }
.toggle-label { font-size: .82rem; color: var(--text-2); }

/* ─── Add Media Modal ─────────────────────────────────────────────── */
.search-input {
  width: 100%; padding: .6rem .9rem;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text); outline: none;
  margin-bottom: .875rem;
  transition: border-color .2s;
}
.search-input:focus { border-color: var(--accent); }
.am-list { display: flex; flex-direction: column; gap: .4rem; max-height: 340px; overflow-y: auto; }
.am-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .75rem; border-radius: var(--r-sm);
  border: 1px solid var(--border);
  cursor: pointer; transition: all .15s;
}
.am-item:hover { background: rgba(124,58,237,.08); border-color: rgba(124,58,237,.3); }
.am-item.already-added { opacity: .4; pointer-events: none; }
.am-thumb {
  width: 40px; height: 30px; border-radius: 4px; overflow: hidden;
  background: var(--bg3); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.am-thumb img { width: 100%; height: 100%; object-fit: cover; }
.am-thumb svg { width: 16px; height: 16px; stroke: var(--text-3); }
.am-info { flex: 1; min-width: 0; }
.am-name { font-size: .84rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.am-meta { font-size: .74rem; color: var(--text-3); }

/* Assign modal */
.assign-media-name { font-size: .88rem; color: var(--text-2); margin-bottom: .875rem; font-style: italic; }
.assign-list { display: flex; flex-direction: column; gap: .4rem; }
.assign-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem; border-radius: var(--r-sm);
  border: 1px solid var(--border); cursor: pointer; transition: all .15s;
}
.assign-item:hover { background: rgba(124,58,237,.08); border-color: rgba(124,58,237,.3); }

/* ─────────────────────────────────────────────────────────────────────────
   EMPTY STATE
───────────────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 3rem 1rem;
  color: var(--text-3); font-size: .88rem;
}
.empty-state-large {
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  padding: 4rem 1rem; color: var(--text-3);
}
.empty-state-large svg { width: 56px; height: 56px; stroke: var(--text-3); opacity: .5; }
.empty-state-large p { font-size: .9rem; }

/* ─────────────────────────────────────────────────────────────────────────
   TOASTS
───────────────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; top: 1.25rem; right: 1.25rem;
  z-index: 9999; display: flex; flex-direction: column; gap: .5rem;
  max-width: 340px; pointer-events: none;
}
.toast {
  padding: .75rem 1rem;
  border-radius: var(--r-sm);
  font-size: .84rem;
  display: flex; align-items: center; gap: .6rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  animation: toastIn .25s var(--ease);
  border: 1px solid;
  pointer-events: auto;
}
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast-success { background: rgba(16,185,129,.15); border-color: rgba(16,185,129,.3); color: #6ee7b7; }
.toast-error   { background: rgba(239,68,68,.15);  border-color: rgba(239,68,68,.3);  color: #fca5a5; }
.toast-info    { background: rgba(59,130,246,.15);  border-color: rgba(59,130,246,.3);  color: #93c5fd; }
.toast-warning { background: rgba(245,158,11,.15); border-color: rgba(245,158,11,.3); color: #fcd34d; }

/* ─────────────────────────────────────────────────────────────────────────
   ANIMATIONS
───────────────────────────────────────────────────────────────────────── */
@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp    { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin      { to { transform: rotate(360deg); } }
@keyframes pulse-dot { 0%,100% { opacity:1; } 50% { opacity:.4; } }
@keyframes toastIn   { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: translateX(0); } }
@keyframes modalIn   { from { opacity:0; transform: scale(.95) translateY(10px); } to { opacity:1; transform: scale(1) translateY(0); } }


/* ═══════════════════════════════════════════════════════════════════════════
   Dodatki v2: paski zużycia, ekrany, harmonogram tygodniowy, audyt
   ══════════════════════════════════════════════════════════════════════════ */

.alert-warning {
  background: rgba(245, 158, 11, .1);
  border: 1px solid rgba(245, 158, 11, .3);
  color: #fbbf24;
  padding: .7rem 1rem;
  border-radius: var(--r-sm);
  font-size: .85rem;
  margin-bottom: 1.25rem;
}

/* ─── Paski zużycia planu ─────────────────────────────────────────────────── */
.usage-bar-wrap { padding: .9rem 1.1rem; margin-bottom: 1.25rem; }
.usage-bar-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: .78rem; color: var(--text-2); margin-bottom: .5rem;
}
.usage-bar {
  height: 6px; border-radius: 3px;
  background: var(--bg3); overflow: hidden;
}
.usage-bar-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  border-radius: 3px;
  transition: width .4s ease;
}
.usage-bar-fill.warn   { background: linear-gradient(90deg, #f59e0b, #f97316); }
.usage-bar-fill.danger { background: linear-gradient(90deg, #ef4444, #dc2626); }

/* ─── Instrukcja parowania ────────────────────────────────────────────────── */
.info-callout { margin-bottom: 1.25rem; }
.steps-list {
  margin: .5rem 0 0 1.1rem;
  color: var(--text-2); font-size: .85rem; line-height: 1.9;
}
.steps-list code {
  background: var(--bg3); padding: .1rem .4rem;
  border-radius: 4px; font-size: .8rem; color: var(--text);
}

/* ─── Ekrany ──────────────────────────────────────────────────────────────── */
.screen-playlist-select {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  padding: .5rem .65rem;
  font-size: .85rem;
}
.screen-playlist-select:focus { outline: none; border-color: var(--accent); }

.tag-muted { opacity: .6; }

/* ─── Wybór dni tygodnia ──────────────────────────────────────────────────── */
.days-picker { display: flex; gap: .4rem; flex-wrap: wrap; }
.day-chip {
  min-width: 2.6rem;
  padding: .4rem .6rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text-2);
  font-size: .8rem;
  transition: all .15s;
}
.day-chip:hover { border-color: var(--border-h); color: var(--text); }
.day-chip.active {
  background: rgba(124, 58, 237, .18);
  border-color: var(--accent);
  color: #c4b5fd;
}

/* ─── Dziennik zdarzeń ────────────────────────────────────────────────────── */
.sys-card-wide { grid-column: 1 / -1; }
.audit-list { max-height: 22rem; overflow-y: auto; }
.audit-row {
  display: grid;
  grid-template-columns: 9.5rem 1fr 12rem 8rem;
  gap: .6rem;
  padding: .45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .76rem;
  color: var(--text-2);
}
.audit-row:last-child { border-bottom: none; }
.audit-action { color: var(--text); font-family: ui-monospace, monospace; }
.audit-ip { color: var(--text-3); }
@media (max-width: 900px) {
  .audit-row { grid-template-columns: 1fr; gap: .1rem; }
}

/* ─── Drobne ──────────────────────────────────────────────────────────────── */
.pm-item-static { font-size: .75rem; color: var(--text-3); }
.am-added-label { font-size: .72rem; color: var(--text-3); }
.upload-item-error .upload-status { color: var(--danger); }
.thumb-icon svg { width: 34px; height: 34px; }
.empty-state-large svg { width: 44px; height: 44px; }

/* ═══════════════════════════════════════════════════════════════════════════
   Dodatki v2.1: kanał na żywo, powiadomienia
   ══════════════════════════════════════════════════════════════════════════ */

/* ─── Wskaźnik połączenia na żywo ─────────────────────────────────────────── */
.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-left: auto;
  background: var(--success);
  box-shadow: 0 0 6px rgba(16, 185, 129, .8);
  transition: background .3s, box-shadow .3s;
  flex-shrink: 0;
}
.live-dot.offline {
  background: var(--text-3);
  box-shadow: none;
}

/* ─── Dzwonek z licznikiem ────────────────────────────────────────────────── */
.notif-btn { position: relative; }
.notif-badge {
  position: absolute;
  top: -2px; right: -2px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: .62rem;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
  pointer-events: none;
}

/* ─── Lista powiadomień ───────────────────────────────────────────────────── */
.notif-list {
  max-height: 26rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.notif-item {
  padding: .7rem .85rem;
  border-radius: var(--r-sm);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-3);
}
.notif-item.unread { background: var(--glass-hover); }
.notif-item.notif-error   { border-left-color: var(--danger); }
.notif-item.notif-warning { border-left-color: var(--warning); }
.notif-item.notif-success { border-left-color: var(--success); }
.notif-item.notif-info    { border-left-color: var(--blue); }

.notif-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  margin-bottom: .3rem;
}
.notif-level {
  font-size: .64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.notif-level-error   { color: var(--danger); }
.notif-level-warning { color: var(--warning); }
.notif-level-success { color: var(--success); }
.notif-level-info    { color: var(--blue); }

.notif-time    { font-size: .68rem; color: var(--text-3); }
.notif-title   { font-size: .85rem; color: var(--text); font-weight: 500; }
.notif-message { font-size: .78rem; color: var(--text-2); margin-top: .15rem; line-height: 1.5; }

/* ─── Formularze z kilkoma przyciskami ────────────────────────────────────── */
.form-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
