/* ═══════════════════════════════════════════════
   TempCloudDrive — Modern UI
   Style: dark sidebar + glass cards + gradients
   ═══════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────── */
:root {
  --bg:            #0f1117;
  --bg2:           #161b27;
  --surface:       rgba(255,255,255,0.05);
  --surface-hover: rgba(255,255,255,0.09);
  --border:        rgba(255,255,255,0.09);
  --border-strong: rgba(255,255,255,0.16);

  --accent:        #6366f1;
  --accent2:       #8b5cf6;
  --accent-glow:   rgba(99,102,241,0.35);
  --danger:        #f43f5e;
  --success:       #10b981;
  --warn:          #f59e0b;

  --text:          #f1f5f9;
  --text-2:        #94a3b8;
  --text-3:        #64748b;

  --sidebar-w:     240px;
  --topbar-h:      56px;
  --r:             12px;
  --r-sm:          8px;

  --shadow:        0 2px 12px rgba(0,0,0,.4);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.5);
  --t:             0.2s ease;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto,
          'Noto Sans SC', sans-serif;
}

/* ── Reset ──────────────────────────────────── */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{font-size:15px;-webkit-font-smoothing:antialiased}
body{font-family:var(--font);background:var(--bg);color:var(--text);
     min-height:100vh;line-height:1.5}
a{color:inherit;text-decoration:none}
button{font-family:inherit;cursor:pointer;border:none;background:none}
svg{display:block;flex-shrink:0}
input,textarea{font-family:inherit;font-size:inherit}
.hidden{display:none!important}

/* ── Scrollbar ──────────────────────────────── */
::-webkit-scrollbar{width:5px;height:5px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--border-strong);border-radius:99px}

/* ── Buttons ────────────────────────────────── */
.btn{
  display:inline-flex;align-items:center;gap:7px;
  padding:8px 18px;border-radius:var(--r-sm);
  font-size:.875rem;font-weight:500;
  transition:all var(--t);white-space:nowrap;cursor:pointer;
}
.btn svg{width:15px;height:15px}

.btn-primary{
  background:linear-gradient(135deg,var(--accent),var(--accent2));
  color:#fff;border:none;
  box-shadow:0 2px 16px var(--accent-glow);
}
.btn-primary:hover{
  filter:brightness(1.12);
  box-shadow:0 4px 24px var(--accent-glow);
  transform:translateY(-1px);
}
.btn-primary:active{transform:translateY(0)}
.btn-primary:disabled{opacity:.45;pointer-events:none;transform:none}

.btn-ghost{
  background:var(--surface);color:var(--text-2);
  border:1px solid var(--border);
}
.btn-ghost:hover{background:var(--surface-hover);color:var(--text);border-color:var(--border-strong)}

.btn-icon{
  padding:7px;border-radius:var(--r-sm);border:none;
  color:var(--text-3);background:transparent;
}
.btn-icon:hover{background:var(--surface-hover);color:var(--text-2)}
.btn-icon.btn-danger:hover{color:var(--danger);background:rgba(244,63,94,.12)}

.btn-sm{padding:5px 13px;font-size:.82rem}
.btn-block{width:100%;justify-content:center}

/* ── Refresh spinning ──────────────────────── */
@keyframes spin{to{transform:rotate(360deg)}}
.refresh-icon.spinning{animation:spin .5s linear infinite}

/* ═════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════ */
.login-page{
  display:flex;align-items:center;justify-content:center;
  min-height:100vh;min-height:100dvh;
  background:radial-gradient(ellipse at 50% 0%, #1e1b4b 0%, #0f1117 100%);
  position:relative;overflow:clip;
}
.login-page::before{
  content:'';position:absolute;top:-50%;left:-10%;width:120%;height:120%;
  background:radial-gradient(circle at 30% 50%,rgba(99,102,241,.15),transparent 50%),
             radial-gradient(circle at 70% 60%,rgba(139,92,246,.12),transparent 50%);
  animation:breathe 8s ease-in-out infinite;z-index:0;
}
@keyframes breathe{0%,100%{transform:scale(1)}50%{transform:scale(1.08)}}

.login-card{
  background:rgba(22,27,39,.75);backdrop-filter:blur(20px);
  border:1px solid var(--border-strong);border-radius:var(--r);
  box-shadow:var(--shadow-lg);padding:2.5rem 2rem;width:100%;max-width:380px;
  position:relative;z-index:1;
}
.login-logo{
  width:64px;height:64px;margin:0 auto 1.2rem;
  background:linear-gradient(135deg,var(--accent),var(--accent2));
  border-radius:50%;display:flex;align-items:center;justify-content:center;
  box-shadow:0 4px 20px var(--accent-glow);
}
.login-logo svg{width:32px;height:32px;stroke:#fff}
.login-logo-img{width:96px;height:96px;border-radius:18px;display:block}
.login-card h1{font-size:1.5rem;font-weight:700;text-align:center;margin-bottom:.3rem}
.login-subtitle{text-align:center;color:var(--text-2);font-size:.875rem;margin-bottom:2rem}

.field{margin-bottom:1rem}
.field label{display:block;font-size:.82rem;font-weight:600;color:var(--text-2);margin-bottom:.5rem}
.field input{
  width:100%;padding:10px 14px;background:var(--surface);
  border:1px solid var(--border);border-radius:var(--r-sm);
  color:var(--text);font-size:.9rem;outline:none;transition:all var(--t);
}
.field input:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px var(--accent-glow);
  background:rgba(255,255,255,.07);
}
/* ═══════════════════════════════════════════════
   Autofill override — kill Chrome yellow bg
   ═══════════════════════════════════════════════ */
/* 1) CSS animation runs on autofill, overriding Chrome's yellow
      (animation > browser default style) */
@keyframes autofix-bg {
  to {
    background: #1a1f2e;
    color: var(--text);
  }
}

/* 2) Apply to ALL inputs — covers password, text fields etc. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  animation: autofix-bg 1ms forwards !important;
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text) !important;
  transition: background-color 999999s ease-in-out 0s !important;
}

/* 3) Box-shadow inset — extra opaque layer */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus,
.field input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #1a1f2e inset !important;
  box-shadow: 0 0 0 1000px #1a1f2e inset !important;
  background-color: #1a1f2e !important;
}

/* 4) Target password specifically — highest specificity */
#password:-webkit-autofill,
#password:-webkit-autofill:hover,
#password:-webkit-autofill:focus,
#password:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #1a1f2e inset !important;
  box-shadow: 0 0 0 1000px #1a1f2e inset !important;
  background-color: #1a1f2e !important;
}

/* 5) Standard :autofill pseudo-class fallback for Firefox etc. */
input:autofill {
  background: #1a1f2e !important;
  -webkit-text-fill-color: var(--text) !important;
}
.error-msg{margin-top:.8rem;font-size:.85rem;color:var(--danger);text-align:center}

/* ══════════════════════════════════════
   APP LAYOUT
   ═════════════════════════════════════ */
.app-page{
  display:flex;height:100vh;overflow:hidden;
  background:radial-gradient(ellipse at bottom right,#1e1b4b,#0f1117 50%);
}

/* ── Topbar (mobile) ─────────────────── */
.topbar{
  display:none;position:fixed;top:0;left:0;right:0;height:var(--topbar-h);
  background:var(--bg2);backdrop-filter:blur(12px);
  border-bottom:1px solid var(--border);align-items:center;gap:12px;
  padding:0 16px;z-index:200;
}
.topbar-title{font-weight:700;font-size:1rem}
.menu-btn{padding:7px;border-radius:var(--r-sm);color:var(--text)}
.menu-btn:hover{background:var(--surface-hover)}
.menu-btn svg{width:20px;height:20px}

/* ── Sidebar ────────────── */
.sidebar{
  width:var(--sidebar-w);flex-shrink:0;
  background:var(--bg2);backdrop-filter:blur(12px);
  border-right:1px solid var(--border);display:flex;flex-direction:column;
  height:100vh;overflow-y:auto;position:relative;z-index:100;
}
.sidebar-header{
  display:flex;align-items:center;gap:10px;padding:22px 18px 18px;
  font-weight:700;font-size:1rem;border-bottom:1px solid var(--border);
}
.sidebar-icon{width:24px;height:24px;stroke:var(--accent)}
.sidebar-logo{width:72px;height:72px;border-radius:14px;flex-shrink:0}

.sidebar-nav{list-style:none;padding:12px 10px;flex:1}
.sidebar-nav li+li{margin-top:4px}
.nav-item{
  display:flex;align-items:center;gap:10px;width:100%;
  padding:9px 12px;border-radius:var(--r-sm);font-size:.875rem;font-weight:500;
  color:var(--text-3);transition:all var(--t);
}
.nav-item svg{width:17px;height:17px}
.nav-item:hover{background:var(--surface-hover);color:var(--text-2)}
.nav-item.active{
  background:linear-gradient(135deg,rgba(99,102,241,.18),rgba(139,92,246,.15));
  color:var(--text);border:1px solid rgba(99,102,241,.25);
  box-shadow:0 2px 8px rgba(99,102,241,.15);
}

.sidebar-footer{padding:14px 14px 18px;border-top:1px solid var(--border)}

/* ── Usage bar ──────────────────────────────── */
.usage-bar-wrap{margin-bottom:12px}
.usage-labels{
  display:flex;justify-content:space-between;font-size:.75rem;
  color:var(--text-3);margin-bottom:5px;
}
.usage-bar{
  height:6px;background:var(--surface);border-radius:99px;overflow:hidden;
}
.usage-bar-fill{
  height:100%;background:linear-gradient(90deg,var(--accent),var(--accent2));
  border-radius:99px;transition:width .4s ease;
}
.usage-bar-fill.warn{background:linear-gradient(90deg,#f59e0b,#f97316)}
.usage-bar-fill.danger{background:linear-gradient(90deg,#ef4444,#f43f5e)}

/* ── Main content ───────────────────── */
.main-content{flex:1;overflow-y:auto;padding:32px 36px}
.tab-panel{display:none}
.tab-panel.active{display:block}

.panel-header{
  display:flex;align-items:center;gap:12px;margin-bottom:24px;flex-wrap:wrap;
}
.panel-header h2{font-size:1.25rem;font-weight:700;flex:1}

/* ── Upload progress ────────────────── */
.upload-progress{
  display:flex;align-items:center;gap:14px;
  background:rgba(99,102,241,.1);border:1px solid rgba(99,102,241,.25);
  border-radius:var(--r);padding:12px 16px;margin-bottom:18px;
  font-size:.85rem;color:var(--text-2);
}
.upload-progress-bar{
  flex:1;height:5px;background:var(--surface);border-radius:99px;overflow:hidden;
}
.upload-progress-fill{
  height:100%;background:linear-gradient(90deg,var(--accent),var(--accent2));
  transition:width .1s linear;border-radius:99px;
}

/* ── File cards ─────────────────────── */
.file-list{display:flex;flex-direction:column;gap:8px}
.file-card{
  display:flex;align-items:center;gap:14px;
  background:var(--surface);border:1px solid var(--border);
  border-radius:var(--r);padding:14px 16px;
  transition:all var(--t);cursor:default;
}
.file-card:hover{
  background:var(--surface-hover);border-color:var(--border-strong);
  box-shadow:var(--shadow);transform:translateY(-1px);
}
.file-icon{font-size:1.6rem;line-height:1;flex-shrink:0}
.file-info{flex:1;min-width:0}
.file-name{
  display:block;font-weight:500;font-size:.9rem;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--text);
}
.file-meta{font-size:.78rem;color:var(--text-3);margin-top:2px}
.file-actions{display:flex;gap:2px;flex-shrink:0}

.drag-over{
  outline:2px dashed var(--accent);outline-offset:6px;
  border-radius:var(--r);background:rgba(99,102,241,.05);
}

/* ── Empty state ────────────────────── */
.empty-state{
  display:flex;flex-direction:column;align-items:center;
  justify-content:center;padding:64px 24px;
  color:var(--text-3);text-align:center;gap:14px;
}
.empty-state svg{width:52px;height:52px;opacity:.25;stroke:var(--accent2)}
.empty-state p{font-size:.875rem}

/* ── Text editor ────────────────────── */
.text-editor{
  background:var(--surface);border:1px solid var(--border);
  border-radius:var(--r);padding:16px;margin-bottom:18px;
  box-shadow:var(--shadow);
}
.text-title-input{
  width:100%;padding:9px 12px;background:rgba(255,255,255,.04);
  border:1px solid var(--border);border-radius:var(--r-sm);
  color:var(--text);font-size:.875rem;outline:none;
  transition:all var(--t);margin-bottom:10px;
}
.text-title-input:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-glow)}
.text-editor textarea{
  width:100%;padding:10px 12px;background:rgba(255,255,255,.04);
  border:1px solid var(--border);border-radius:var(--r-sm);
  color:var(--text);font-size:.875rem;line-height:1.65;
  resize:vertical;outline:none;transition:all var(--t);
}
.text-editor textarea:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-glow)}
.text-editor-actions{display:flex;gap:8px;margin-top:12px}

/* ── Text cards ─────────────────────── */
.text-list{display:flex;flex-direction:column;gap:8px}
.text-card{
  background:var(--surface);border:1px solid var(--border);
  border-radius:var(--r);padding:14px 16px;
  display:flex;flex-direction:column;gap:8px;
  transition:all var(--t);
}
.text-card:hover{
  background:var(--surface-hover);border-color:var(--border-strong);
  box-shadow:var(--shadow);transform:translateY(-1px);
}
.text-card-header{display:flex;flex-direction:column;gap:2px}
.text-card-title{
  font-weight:500;font-size:.9rem;color:var(--text);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.text-card-meta{font-size:.78rem;color:var(--text-3)}
.text-card-body{display:flex;flex-direction:column;gap:6px}
.text-card-preview{
  font-size:.82rem;color:var(--text-2);line-height:1.55;
  display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;
  overflow:hidden;word-break:break-word;
}
.text-card-content{
  font-size:.82rem;color:var(--text-2);line-height:1.55;
  white-space:pre-wrap;word-break:break-word;max-height:400px;
  overflow-y:auto;
}
.text-card-expand{
  align-self:flex-start;color:var(--accent);font-size:.78rem;
  padding:3px 8px;border-radius:var(--r-sm);
  background:rgba(99,102,241,.08);border:1px solid rgba(99,102,241,.15);
  transition:all var(--t);
}
.text-card-expand:hover{background:rgba(99,102,241,.16);color:var(--accent2)}
.text-card-actions{display:flex;gap:2px;flex-shrink:0;align-self:flex-end;margin-top:-4px}

/* ══════════════════════════════════════
   MEDIA TAB
   ══════════════════════════════════════ */
.media-list{display:flex;flex-direction:column;gap:8px}
.media-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
  gap:16px;
}
.media-card{
  background:var(--surface);border:1px solid var(--border);
  border-radius:var(--r);overflow:hidden;
  transition:all var(--t);cursor:pointer;
  display:flex;flex-direction:column;
}
.media-card:hover{
  background:var(--surface-hover);border-color:var(--border-strong);
  box-shadow:var(--shadow);transform:translateY(-2px);
}
.media-thumb-wrap{cursor:pointer;position:relative;overflow:hidden}
.media-thumb{
  width:100%;aspect-ratio:16/10;object-fit:cover;
  display:block;background:var(--bg2);
}
.media-thumb-placeholder{
  width:100%;aspect-ratio:16/10;
  display:flex;align-items:center;justify-content:center;
  background:var(--bg2);color:var(--text-3);font-size:2.5rem;
}
.media-card-body{padding:10px 14px 14px;flex:1;display:flex;flex-direction:column;gap:4px}
.media-card-name{
  font-size:.85rem;font-weight:500;color:var(--text);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.media-card-meta{font-size:.75rem;color:var(--text-3)}
.media-card-actions{
  display:flex;gap:2px;margin-top:6px;align-self:flex-end;
}

/* ── Video player modal (separate from audio) ── */
.video-player-overlay{
  position:fixed;inset:0;background:rgba(0,0,0,.85);
  backdrop-filter:blur(6px);z-index:400;
}
.video-player-modal{
  position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);
  z-index:401;width:90%;max-width:900px;max-height:90vh;
  display:flex;flex-direction:column;align-items:center;
}
.video-player-modal video{
  width:100%;max-height:80vh;border-radius:var(--r);
  background:#000;box-shadow:var(--shadow-lg);
}
.video-player-close{
  position:absolute;top:-40px;right:0;
  color:#fff;opacity:.7;padding:6px;
  border-radius:var(--r-sm);
}
.video-player-close:hover{opacity:1;background:rgba(255,255,255,.1)}
.video-player-close svg{width:24px;height:24px}
.video-player-title{
  color:#fff;font-size:.9rem;margin-top:12px;
  text-align:center;opacity:.8;
}

/* ── Audio table (playlist-style list in audio tab) ── */
.audio-list{display:flex;flex-direction:column;gap:8px}
.audio-table{display:flex;flex-direction:column;gap:4px}
.audio-table-item{
  display:flex;align-items:center;gap:12px;
  background:var(--surface);border:1px solid var(--border);
  border-radius:var(--r-sm);padding:10px 14px;
  transition:all var(--t);cursor:pointer;
}
.audio-table-item:hover{
  background:var(--surface-hover);border-color:var(--border-strong);
  box-shadow:var(--shadow);transform:translateY(-1px);
}
.audio-table-item.active{
  border-color:var(--accent);
  background:rgba(99,102,241,.08);
  box-shadow:0 0 0 1px var(--accent);
}
.audio-table-cover-wrap{
  width:44px;height:44px;flex-shrink:0;display:flex;
  align-items:center;justify-content:center;
  background:var(--surface);border-radius:var(--r-sm);
  overflow:hidden;position:relative;
}
.audio-table-cover{
  width:44px;height:44px;object-fit:cover;border-radius:var(--r-sm);
}
.audio-table-cover-placeholder{
  font-size:1.2rem;opacity:.6;position:absolute;
}
.audio-cover-img{
  width:44px;height:44px;object-fit:cover;border-radius:var(--r-sm);
  flex-shrink:0;display:block;
}
.audio-cover-img.hidden{display:none}
.audio-table-icon{font-size:1.3rem;flex-shrink:0;width:28px;text-align:center}
.audio-table-info{flex:1;min-width:0}
.audio-table-name{
  display:block;font-weight:500;font-size:.85rem;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--text);
}
.audio-table-meta{font-size:.75rem;color:var(--text-3);margin-top:1px}
.audio-table-action{
  flex-shrink:0;color:var(--text-3);padding:4px 8px;
  border-radius:var(--r-sm);font-size:.75rem;
  background:var(--surface);border:1px solid var(--border);
  transition:all var(--t);
}
.audio-table-action:hover{background:var(--surface-hover);color:var(--accent)}

/* ── Bottom audio player bar ── */
.has-player .main-content{padding-bottom:80px}
.has-player .sidebar{padding-bottom:72px}
.audio-player-bar{
  position:fixed;bottom:0;left:0;right:0;z-index:500;
  background:rgba(22,27,39,.96);backdrop-filter:blur(16px);
  border-top:1px solid var(--border-strong);
  box-shadow:0 -4px 32px rgba(0,0,0,.5);
  display:flex;align-items:center;padding:10px 20px;gap:16px;
  height:64px;
}
.audio-player-bar.hidden{display:none}

.audio-player-cover {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: #2a2a3a;
}

.audio-player-cover canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.audio-player-left{
  display:flex;align-items:center;gap:10px;min-width:180px;flex-shrink:0;
}
.audio-player-toggle{
  width:36px;height:36px;border-radius:50%;
  background:linear-gradient(135deg,var(--accent),var(--accent2));
  display:flex;align-items:center;justify-content:center;
  color:#fff;box-shadow:0 2px 12px var(--accent-glow);
  transition:all var(--t);flex-shrink:0;
}
.audio-player-toggle:hover{
  filter:brightness(1.12);transform:scale(1.05);
}
.audio-player-info{
  display:flex;flex-direction:column;gap:1px;min-width:0;
}
.audio-player-name{
  font-size:.82rem;font-weight:500;color:var(--text);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}

.audio-player-center{
  flex:1;display:flex;flex-direction:column;align-items:center;gap:4px;max-width:500px;margin:0 auto;
}
.audio-player-controls{
  display:flex;align-items:center;gap:12px;
}
.audio-player-btn{
  width:30px;height:30px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  color:var(--text-2);background:transparent;
  transition:all var(--t);
}
.audio-player-btn:hover{background:var(--surface-hover);color:var(--text)}
.audio-player-play{
  width:34px;height:34px;
  background:var(--surface);border:1px solid var(--border);
}
.audio-player-play:hover{background:var(--surface-hover);border-color:var(--border-strong)}
.audio-player-shuffle.active{color:var(--accent)}
.audio-player-progress{
  display:flex;align-items:center;gap:8px;width:100%;
}
.audio-player-time{
  font-size:.68rem;color:var(--text-3);min-width:32px;text-align:center;
  font-variant-numeric:tabular-nums;
}
.audio-progress-bar{
  flex:1;height:4px;background:var(--surface);border-radius:99px;
  cursor:pointer;position:relative;
}
.audio-progress-fill{
  height:100%;background:linear-gradient(90deg,var(--accent),var(--accent2));
  border-radius:99px;width:0%;transition:width .1s linear;
}
.audio-progress-thumb{
  position:absolute;top:50%;width:10px;height:10px;
  background:var(--text);border-radius:50%;transform:translate(-50%,-50%);
  left:0%;opacity:0;transition:opacity .15s;
  pointer-events:none;
}
.audio-progress-bar:hover .audio-progress-thumb{opacity:1}

.audio-player-right{
  display:flex;align-items:center;gap:8px;min-width:160px;flex-shrink:0;justify-content:flex-end;
}
.audio-player-queue-count{
  font-size:.68rem;color:var(--text-3);margin-left:-4px;
}
.audio-volume-wrap{
  display:flex;align-items:center;gap:6px;
}
.audio-volume-slider input[type=range]{
  width:70px;height:3px;-webkit-appearance:none;appearance:none;
  background:var(--surface);border-radius:99px;outline:none;
}
.audio-volume-slider input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none;width:10px;height:10px;
  border-radius:50%;background:var(--text);border:none;cursor:pointer;
}

/* ── Audio playlist dropdown ── */
.audio-playlist-dropdown{
  position:fixed;bottom:70px;right:20px;z-index:501;
  width:320px;max-height:360px;
  background:rgba(22,27,39,.98);backdrop-filter:blur(16px);
  border:1px solid var(--border-strong);border-radius:var(--r);
  box-shadow:var(--shadow-lg);display:flex;flex-direction:column;
  overflow:hidden;
}
.audio-playlist-dropdown.hidden{display:none}
.audio-playlist-header{
  display:flex;align-items:center;justify-content:space-between;
  padding:12px 14px;border-bottom:1px solid var(--border);
  font-size:.82rem;font-weight:600;color:var(--text-2);
}
.audio-playlist-items{
  overflow-y:auto;flex:1;padding:4px 0;
}
.audio-playlist-item{
  display:flex;align-items:center;gap:8px;
  padding:8px 14px;cursor:pointer;font-size:.8rem;
  color:var(--text-2);transition:all var(--t);
}
.audio-playlist-item:hover{background:var(--surface-hover);color:var(--text)}
.audio-playlist-item.active{color:var(--accent);background:rgba(99,102,241,.08)}
.audio-playlist-item .playlist-idx{
  width:20px;text-align:center;flex-shrink:0;
  font-size:.72rem;color:var(--text-3);
}
.audio-playlist-item .playlist-name{
  flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.audio-playlist-item .playlist-playing{
  color:var(--accent);font-size:.7rem;flex-shrink:0;
}

/* ── Lightbox ──────────────────────────── */
.lightbox-overlay{
  position:fixed;inset:0;background:rgba(0,0,0,.88);
  backdrop-filter:blur(6px);z-index:400;
}
.lightbox{
  position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);
  z-index:401;max-width:92vw;max-height:90vh;display:flex;
  align-items:center;justify-content:center;
}
.lightbox-img{
  max-width:100%;max-height:90vh;border-radius:var(--r);
  box-shadow:var(--shadow-lg);object-fit:contain;
}
.lightbox-close{
  position:absolute;top:-40px;right:0;
  color:#fff;opacity:.7;padding:6px;
  border-radius:var(--r-sm);
}
.lightbox-close:hover{opacity:1;background:rgba(255,255,255,.1)}
.lightbox-close svg{width:24px;height:24px}

/* ── Toast ──────────────────────────── */
.toast-container{
  position:fixed;bottom:28px;right:24px;
  display:flex;flex-direction:column;gap:8px;z-index:1000;
  pointer-events:none;
}
.toast{
  background:rgba(22,27,39,.95);backdrop-filter:blur(12px);
  border:1px solid var(--border-strong);
  color:var(--text);padding:12px 18px;border-radius:var(--r);
  font-size:.875rem;box-shadow:var(--shadow-lg);
  opacity:0;transform:translateY(12px) scale(.97);
  transition:opacity .22s ease,transform .22s ease;
  pointer-events:auto;max-width:320px;
}
.toast-show{opacity:1;transform:translateY(0) scale(1)}
.toast-success{border-left:3px solid var(--success)}
.toast-error  {border-left:3px solid var(--danger)}
.toast-info   {border-left:3px solid var(--accent)}

/* ── Overlay ────────────────────────── */
.overlay{
  position:fixed;inset:0;background:rgba(0,0,0,.5);
  backdrop-filter:blur(2px);z-index:99;
}

/* ── Modal ──────────────────────────── */
.modal-overlay{
  position:fixed;inset:0;background:rgba(0,0,0,.6);
  backdrop-filter:blur(3px);z-index:300;
}
.modal{
  position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);
  background:var(--bg2);border:1px solid var(--border-strong);
  border-radius:var(--r);box-shadow:var(--shadow-lg);
  width:90%;max-width:400px;z-index:301;padding:24px;
}
.modal-header{
  display:flex;align-items:center;justify-content:space-between;
  margin-bottom:16px;
}
.modal-header h3{font-size:1.1rem;font-weight:700}
.modal-footer{
  display:flex;gap:8px;justify-content:flex-end;margin-top:20px;
}
.btn-danger{
  background:rgba(244,63,94,.12);color:var(--danger);
  border:1px solid rgba(244,63,94,.2);
}
.btn-danger:hover{background:rgba(244,63,94,.22)}

/* ── Role-based visibility ─────────────────── */
.is-guest .admin-only{display:none!important}

/* ═════════════════════════════
   RESPONSIVE
   ═════════════════════════════ */
@media(max-width:640px){
  .topbar{display:flex}
  .app-page{padding-top:var(--topbar-h)}
  .sidebar{
    position:fixed;top:0;left:0;height:100%;
    transform:translateX(-100%);transition:transform var(--t);
    z-index:200;box-shadow:var(--shadow-lg);
  }
  .sidebar.open{transform:translateX(0)}
  .main-content{padding:16px}
  .panel-header h2{font-size:1.1rem}
  .toast-container{bottom:16px;right:12px;left:12px}
  .toast{max-width:100%}
}
@media(min-width:641px) and (max-width:1024px){
  :root{--sidebar-w:210px}
  .main-content{padding:24px 28px}
}
