/* ==========================================================================
   UDBot Studio — Pure Black & White (Monochrome Minimalist)
   ========================================================================== */
:root {
  --bg: #000000;
  --bg-2: #090909;
  --surface: #0f0f0f;
  --surface-2: #181818;
  --surface-solid: #141414;
  --border: #222222;
  --border-strong: #333333;
  --text: #ffffff;
  --text-2: #a1a1aa;
  --text-3: #71717a;
  --accent: #ffffff;
  --accent-2: #e4e4e7;
  --accent-3: #d4d4d8;
  --grad: #ffffff;
  --ok: #ffffff;
  --warn: #a1a1aa;
  --danger: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
  --glow: 0 0 0 1px #333333;
  --font: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sidebar: 248px;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-2: #f4f4f5;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --surface-solid: #ffffff;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #09090b;
  --text-2: #52525b;
  --text-3: #71717a;
  --accent: #09090b;
  --accent-2: #27272a;
  --accent-3: #3f3f46;
  --grad: #09090b;
  --ok: #09090b;
  --warn: #71717a;
  --danger: #dc2626;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  --glow: 0 0 0 1px #e4e4e7;
}

[data-theme="light"] .sidebar { background: #fafafa; }
[data-theme="light"] .brand-logo { background: #000000; color: #ffffff; }
[data-theme="light"] .btn-primary { background: #000000 !important; color: #ffffff !important; border-color: #000000 !important; }
[data-theme="light"] .btn-primary:hover { background: #27272a !important; border-color: #27272a !important; }
[data-theme="light"] .input, [data-theme="light"] .textarea, [data-theme="light"] .select { background: #ffffff; color: #000000; border-color: #d4d4d8; }
[data-theme="light"] .stat, [data-theme="light"] .batch-card, [data-theme="light"] .card, [data-theme="light"] .modal, [data-theme="light"] .login-card { background: #ffffff; }
[data-theme="light"] .file-row { background: #fafafa; border-color: #e4e4e7; }
[data-theme="light"] .file-row:hover { background: #f4f4f5; }
[data-theme="light"] .file-row .name { color: #09090b; }
[data-theme="light"] .dropzone { background: #fafafa; border-color: #d4d4d8; }
[data-theme="light"] .dropzone:hover { background: #f4f4f5; border-color: #000000; }
[data-theme="light"] .dropzone svg { color: #000000; }
[data-theme="light"] .savebar { background: #ffffff; color: #000000; border-color: #d4d4d8; box-shadow: 0 10px 30px rgba(0,0,0,0.12); }
[data-theme="light"] .savebar .dot { background: #000000; }
[data-theme="light"] .toast { background: #ffffff; color: #000000; border-color: #e4e4e7; }
[data-theme="light"] .tg-preview { background: #f4f4f5; }
[data-theme="light"] .tg-bubble { background: #ffffff; border-color: #e4e4e7; }
[data-theme="light"] .tg-bubble .cap { color: #000000; }
[data-theme="light"] .tg-btn { background: #e4e4e7; color: #000000; border-color: #d4d4d8; }
[data-theme="light"] .chart .area { fill: rgba(0, 0, 0, 0.05); }
[data-theme="light"] .chart .line { stroke: #000000; }
[data-theme="light"] .chart .gridline { stroke: #e4e4e7; }
[data-theme="light"] .chart .pt { fill: #000000; }
[data-theme="light"] .chart-tip { background: #ffffff; color: #000000; border-color: #d4d4d8; }
[data-theme="light"] .switch span { background: #e4e4e7; }
[data-theme="light"] .switch input:checked + span { background: #000000; border-color: #000000; }
[data-theme="light"] .switch input:checked + span::after { background: #ffffff; }
[data-theme="light"] .nav a.active { background: #f4f4f5; color: #000000; border-color: #d4d4d8; }
[data-theme="light"] .nav a:hover { background: #f4f4f5; color: #000000; }
[data-theme="light"] .btn { background: #ffffff; color: #000000; border-color: #d4d4d8; }
[data-theme="light"] .btn:hover { background: #f4f4f5; border-color: #a1a1aa; }
[data-theme="light"] .btn-ghost { background: transparent; color: var(--text-2); border-color: transparent; }
[data-theme="light"] .btn-ghost:hover { background: #f4f4f5; color: #000000; }
[data-theme="light"] .sidebar-backdrop { background: rgba(0,0,0,0.35); }
[data-theme="light"] .hero .link { background: #fafafa; border-color: #e4e4e7; }
[data-theme="light"] .hero-cover { background: #f4f4f5; border-color: #d4d4d8; }
[data-theme="light"] .audio-bar-art { background: #f4f4f5; border-color: #e4e4e7; }
[data-theme="light"] .file-row .idx { color: #71717a; }


* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Zero background blur or colored gradients */
body::before, body::after { display: none !important; }

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: #ffffff; color: #000000; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #000000; }
::-webkit-scrollbar-thumb { background: #27272a; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3f3f46; }

.hidden { display: none !important; }
.mono { font-family: var(--mono); font-size: .88em; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.grad-text { color: #ffffff !important; background: none !important; }

/* ---------------------------------------------------------------- layout */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 22px 14px; display: flex; flex-direction: column; gap: 6px;
  border-right: 1px solid var(--border); background: #000000;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }
.brand-logo {
  width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center;
  background: #ffffff; color: #000000; font-weight: 800; font-size: 16px;
}
.brand h1 { font-size: 16px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.brand small { display: block; color: var(--text-3); font-size: 11.5px; font-weight: 500; }

.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; color: var(--text-2);
  font-weight: 550; font-size: 13.5px; transition: all .15s ease; border: 1px solid transparent;
}
.nav a:hover { background: #121212; color: #ffffff; }
.nav a.active { background: #181818; color: #ffffff; border-color: var(--border-strong); }
.nav a.active::before { display: none; }
.nav svg { width: 18px; height: 18px; flex: none; stroke: currentColor; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }

.main { padding: 28px clamp(18px, 3vw, 40px) 120px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 26px; letter-spacing: -.02em; font-weight: 800; }
.page-head p { margin: 4px 0 0; color: var(--text-2); font-size: 13.5px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.view { animation: viewIn .25s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } }

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 14px; font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card h3 .dim { font-weight: 500; font-size: 12.5px; }
.grid { display: grid; gap: 16px; }
.stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat {
  position: relative; overflow: hidden; background: #0c0c0c; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; transition: border-color .15s;
}
.stat:hover { border-color: var(--border-strong); }
.stat .label { color: var(--text-2); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; display: flex; align-items: center; gap: 8px; }
.stat .value { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; color: #ffffff; }
.stat .sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.stat .ico {
  position: absolute; right: 10px; bottom: 8px; width: 44px; height: 44px; opacity: .06; color: #ffffff;
}
.dash-grid { grid-template-columns: 2fr 1fr; margin-top: 18px; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: #181818; color: #ffffff; font-weight: 600; font-size: 13px;
  cursor: pointer; transition: all .15s ease; white-space: nowrap; user-select: none;
}
.btn:hover { background: #242424; border-color: #444444; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: #ffffff !important; color: #000000 !important; border-color: #ffffff !important;
  font-weight: 700; box-shadow: none !important;
}
.btn-primary:hover {
  background: #e4e4e7 !important; border-color: #e4e4e7 !important;
}
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #181818; color: #ffffff; border-color: transparent; }
.btn-danger { color: #ffffff; border-color: #3f1a1a; background: #1a0d0d; }
.btn-danger:hover { background: #2b1212; border-color: #5c2020; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-icon { padding: 6px; width: 32px; height: 32px; }
.btn-icon.btn-sm { width: 28px; height: 28px; padding: 5px; }

/* ---------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; display: flex; justify-content: space-between; }
.field .hint { font-size: 12px; color: var(--text-3); }
.input, .textarea, .select {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border-strong); background: #0c0c0c;
  color: #ffffff; outline: none; transition: border-color .15s; font-size: 13.5px;
}
.input:focus, .textarea:focus, .select:focus { border-color: #ffffff; }
.textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23888888' stroke-width='2'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.select option { background: #141414; color: #ffffff; }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; color: var(--text-3); }
.search .input { padding-left: 38px; min-width: 250px; }
.counter.over { color: #ef4444; }

.switch { position: relative; width: 40px; height: 22px; flex: none; cursor: pointer; }
.switch input { display: none; }
.switch span { position: absolute; inset: 0; border-radius: 30px; background: #27272a; transition: .2s ease; border: 1px solid var(--border-strong); }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; border-radius: 50%; background: #ffffff; transition: .2s ease; }
.switch input:checked + span { background: #ffffff; border-color: #ffffff; }
.switch input:checked + span::after { transform: translateX(18px); background: #000000; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.toggle-row:last-child { border-bottom: 0; }
.toggle-row b { display: block; font-size: 13.5px; }
.toggle-row small { color: var(--text-3); font-size: 12px; }

/* ---------------------------------------------------------------- pills & chips */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 4px; font-size: 11.5px; font-weight: 700; border: 1px solid; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-ok { color: #ffffff; background: #181818; border-color: #383838; }
.pill-off { color: #71717a; background: #0c0c0c; border-color: #222222; }
.chips { display: flex; gap: 12px; flex-wrap: wrap; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.chips span { display: inline-flex; align-items: center; gap: 5px; }
.chips svg { width: 14px; height: 14px; opacity: .8; }

/* ---------------------------------------------------------------- batch grid */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.batch-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.batch-card {
  position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; transition: border-color .15s, transform .15s;
}
.batch-card:hover { border-color: #555555; transform: translateY(-2px); }
.batch-card .cover { aspect-ratio: 1; position: relative; overflow: hidden; background: #141414; }
.batch-card .cover img { width: 100%; height: 100%; object-fit: cover; transition: opacity .3s; opacity: 0; }
.batch-card .cover img.loaded { opacity: 1; }
.batch-card .cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.9)); }
.batch-card .cover .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); }
.batch-card .cover .ph svg { width: 38px; height: 38px; opacity: .4; }
.batch-card .badge { position: absolute; top: 8px; left: 8px; z-index: 2; background: #000000; border: 1px solid #333333; }
.batch-card .count { position: absolute; top: 8px; right: 8px; z-index: 2; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; background: #000000; border: 1px solid #333333; color: #ffffff; }
.batch-card .body { padding: 12px 14px 14px; }
.batch-card .title { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 6px; }
.batch-card.disabled .cover img { filter: grayscale(1) brightness(.6); }

.shimmer { background: #181818; border-radius: var(--radius); }

.card-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------------------------------------------------------------- editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 1180px) { .editor { grid-template-columns: 1fr; } }
.editor-side { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 16px; }
.editor-pane { display: block; }
.hero { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.hero-top { display: flex; gap: 16px; align-items: center; }
.hero-details { flex: 1; min-width: 0; }
.hero-bottom { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.hero-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hero-cover {
  width: 110px; height: 110px; border-radius: 12px; flex: none; position: relative; overflow: hidden; cursor: pointer;
  background: #141414; border: 1px solid var(--border-strong);
}
.hero-cover img { width: 100%; height: 100%; object-fit: cover; }
.hero-cover .over { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,0.75); opacity: 0; transition: opacity .15s; font-weight: 700; font-size: 11.5px; text-align: center; color: #ffffff; }
.hero-cover .over svg { width: 20px; height: 20px; display: block; margin: 0 auto 4px; }
.hero-cover:hover .over { opacity: 1; }
.hero h2 { margin: 0 0 6px; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.hero .link { display: inline-flex; gap: 8px; align-items: center; padding: 6px 10px; border-radius: 6px; background: #0c0c0c; border: 1px solid var(--border); font-size: 12.5px; }

.files { display: flex; flex-direction: column; gap: 6px; }
.file-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 12px; border-radius: 8px; background: #0c0c0c; border: 1px solid var(--border); transition: background .12s, border-color .12s;
}
.file-row:hover { background: #161616; border-color: var(--border-strong); }
.file-row.dragging { opacity: .4; }
.file-row.drop-before { border-top: 2px solid #ffffff; }
.file-row.drop-after { border-bottom: 2px solid #ffffff; }
.file-row.new { border-color: #ffffff; background: #141414; }
.file-row-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.file-row-info { flex: 1; min-width: 0; }
.file-row-acts { display: flex; align-items: center; gap: 4px; flex: none; }
.file-row .handle { cursor: grab; color: var(--text-3); display: grid; place-items: center; flex: none; }
.file-row .handle svg { width: 14px; }
.file-row .idx { color: var(--text-3); font-weight: 700; font-size: 12px; min-width: 20px; text-align: center; font-variant-numeric: tabular-nums; flex: none; }
.file-row .art { width: 38px; height: 38px; border-radius: 6px; overflow: hidden; display: grid; place-items: center; background: #181818; color: var(--text-2); border: 1px solid var(--border); flex: none; }
.file-row .art img { width: 100%; height: 100%; object-fit: cover; }
.file-row .art svg { width: 16px; }
.file-row .name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #ffffff; }
.file-row .meta { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row .dur { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.file-row .play.playing { color: #000000; background: #ffffff; }

.dropzone {
  margin-top: 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--text-2);
  transition: all .15s ease; cursor: pointer; background: #080808;
}
.dropzone:hover, .dropzone.over { border-color: #ffffff; background: #121212; color: #ffffff; }
.dropzone svg { width: 30px; height: 30px; color: #ffffff; margin-bottom: 6px; }
.dropzone b { color: #ffffff; }
.uploads { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.upload-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 12.5px; padding: 8px 10px; border-radius: 6px; background: #141414; border: 1px solid var(--border); }
.upload-item .bar { grid-column: 1 / -1; height: 3px; border-radius: 3px; background: #222222; overflow: hidden; }
.upload-item .bar i { display: block; height: 100%; width: 0; background: #ffffff; transition: width .15s; }
.upload-item.err { color: #ef4444; border-color: #3f1a1a; }
.upload-item.done .bar i { background: #ffffff; }

/* Telegram-style preview */
.tg-preview { background: #080808; border-radius: var(--radius); padding: 16px; border: 1px solid var(--border); }
.tg-bubble { background: #141414; border: 1px solid var(--border-strong); border-radius: 12px; overflow: hidden; max-width: 310px; margin: 0 auto; }
.tg-bubble img { width: 100%; display: block; aspect-ratio: 1; object-fit: cover; background: #000000; }
.tg-bubble .cap { padding: 8px 10px; white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.45; max-height: 240px; overflow: auto; color: #ffffff; }
.tg-btn { margin: 6px auto 0; max-width: 310px; text-align: center; padding: 8px; border-radius: 8px; background: #222222; border: 1px solid #333333; font-weight: 600; font-size: 13px; color: #ffffff; }

/* ---------------------------------------------------------------- savebar */
.savebar {
  position: fixed; left: calc(var(--sidebar) + 50%); transform: translate(-50%, 160%); bottom: 20px; z-index: 90;
  display: flex; align-items: center; gap: 14px; padding: 8px 12px 8px 16px; border-radius: 10px;
  background: #000000; border: 1px solid var(--border-strong); box-shadow: 0 10px 30px rgba(0,0,0,0.9);
  transition: transform .3s ease, opacity .2s ease; font-weight: 600; font-size: 13px;
  opacity: 0; pointer-events: none;
}
.savebar.show { transform: translate(calc(-50% - var(--sidebar) / 2), 0); opacity: 1; pointer-events: auto; }
.savebar .dot { width: 8px; height: 8px; border-radius: 50%; background: #ffffff; flex: none; }

/* ---------------------------------------------------------------- audio bar */
.audio-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 85;
  background: #000000; border-top: 1px solid var(--border-strong); padding: 8px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  transition: all .2s ease;
}
[data-theme="light"] .audio-bar { background: #ffffff; border-top-color: var(--border-strong); }
.audio-bar-info { display: flex; align-items: center; gap: 10px; min-width: 140px; max-width: 260px; }
.audio-bar-art { width: 36px; height: 36px; border-radius: 6px; background: #141414; border: 1px solid var(--border); display: grid; place-items: center; overflow: hidden; flex: none; }
.audio-bar-text { overflow: hidden; }
.audio-bar-title { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.audio-bar-artist { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-bar-player { flex: 1; max-width: 500px; }
.audio-bar-close { flex: none; }

/* ---------------------------------------------------------------- chart */
.chart { width: 100%; height: 220px; display: block; }
.chart .area { fill: rgba(255, 255, 255, 0.05); }
.chart .line { fill: none; stroke: #ffffff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .gridline { stroke: #1f1f1f; }
.chart text { fill: var(--text-3); font-size: 10.5px; font-family: var(--font); }
.chart .pt { fill: #ffffff; opacity: 0; transition: opacity .15s; }
.chart .hit:hover + .pt, .chart .pt.on { opacity: 1; }
.chart-tip { position: absolute; pointer-events: none; padding: 4px 8px; border-radius: 6px; background: #141414; border: 1px solid #333333; font-size: 11.5px; font-weight: 600; color: #ffffff; white-space: nowrap; transform: translate(-50%, -120%); }

.top-list { display: flex; flex-direction: column; gap: 4px; }
.top-item { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 8px; cursor: pointer; transition: background .12s; }
.top-item:hover { background: #161616; }
.top-item img, .top-item .ph { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: #161616; flex: none; border: 1px solid var(--border); }
.top-item .rank { width: 20px; font-weight: 700; color: var(--text-3); text-align: center; font-size: 12px; }
.top-item .t { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #ffffff; }

.progress { height: 6px; border-radius: 6px; background: #222222; overflow: hidden; margin: 10px 0 6px; }
.progress i { display: block; height: 100%; background: #ffffff; transition: width .3s ease; }

/* ---------------------------------------------------------------- table */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 700; padding: 9px 10px; border-bottom: 1px solid var(--border); }
td { padding: 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
tr:hover td { background: #121212; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: 12px; background: #27272a; color: #ffffff; margin-right: 8px; vertical-align: middle; border: 1px solid #3f3f46; }

/* ---------------------------------------------------------------- login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: #000000; }
.login-card { width: 100%; max-width: 380px; padding: 32px 24px; text-align: center; border: 1px solid var(--border); border-radius: 12px; background: #0c0c0c; }
.login-card .brand-logo { width: 56px; height: 56px; font-size: 24px; border-radius: 12px; margin: 0 auto 16px; background: #ffffff; color: #000000; }
.login-card h1 { margin: 0 0 6px; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.login-card p { margin: 0 0 20px; color: var(--text-2); font-size: 13px; }
.login-card .divider { margin: 20px 0 12px; display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12px; }
.login-card .divider::before, .login-card .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------------------------------------------------------------- toast & modal */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  min-width: 240px; max-width: 360px; padding: 10px 14px; border-radius: 8px; background: #141414;
  border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-weight: 600; font-size: 13px; display: flex; gap: 10px; align-items: center;
  animation: toastIn .2s ease; color: #ffffff; pointer-events: auto;
}
.toast.out { animation: toastOut .2s ease forwards; }
.toast.ok { border-left: 3px solid #ffffff; }
.toast.err { border-left: 3px solid #ef4444; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

.modal-bg { position: fixed; inset: 0; z-index: 150; background: rgba(0,0,0,0.85); display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.modal { width: 100%; max-width: 420px; background: #0c0c0c; border: 1px solid var(--border-strong); border-radius: 12px; padding: 22px; }
.modal h3 { font-size: 17px; margin-top: 0; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }

.empty { text-align: center; padding: 50px 20px; color: var(--text-2); }
.empty svg { width: 40px; height: 40px; color: var(--text-3); margin-bottom: 8px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #333333; border-top-color: #ffffff; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- mobile specific */
.mobile-bar { display: none; }
.mobile-nav { display: none; }
.mobile-close-btn { display: none; }
.mobile-editor-tabs { display: none; }
.sidebar-backdrop {
  position: fixed; inset: 0; z-index: 95; background: rgba(0,0,0,0.7); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.sidebar-backdrop.show { opacity: 1; pointer-events: auto; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 100; left: 0; top: 0; bottom: 0; width: 280px;
    transform: translateX(-100%); transition: transform .25s ease; background: #000000;
    box-shadow: 0 0 40px rgba(0,0,0,0.9);
  }
  [data-theme="light"] .sidebar { background: #ffffff; box-shadow: 0 0 30px rgba(0,0,0,0.15); }
  .sidebar.open { transform: translateX(0); }
  .mobile-close-btn { display: inline-flex; }

  .mobile-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0;
    z-index: 40; background: #000000;
  }
  [data-theme="light"] .mobile-bar { background: #ffffff; }

  .main { padding: 14px 14px calc(76px + env(safe-area-inset-bottom, 0px)); }

  /* Mobile bottom navigation */
  .mobile-nav {
    display: flex; align-items: center; justify-content: space-around;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
    background: #000000; border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    height: calc(58px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
  }
  [data-theme="light"] .mobile-nav { background: #ffffff; border-top-color: var(--border); }
  .mobile-nav-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    padding: 4px 6px; border-radius: 8px; color: var(--text-2);
    font-size: 10px; font-weight: 600; text-decoration: none; min-width: 50px;
    line-height: 1.1;
    transition: all .15s ease; user-select: none;
  }
  .mobile-nav-item svg { width: 18px; height: 18px; flex: none; }
  .mobile-nav-item span { display: block; font-size: 10px; }
  .mobile-nav-item.active { color: #ffffff; font-weight: 700; }
  [data-theme="light"] .mobile-nav-item.active { color: #000000; }
  .mobile-nav-item:active { transform: scale(0.92); }

  /* Mobile Editor Tabs */
  .mobile-editor-tabs {
    display: flex; gap: 4px; background: var(--surface-2); padding: 4px;
    border-radius: 10px; margin-bottom: 14px; border: 1px solid var(--border);
  }
  .mobile-tab-btn {
    flex: 1; padding: 9px 4px; border-radius: 8px; border: 1px solid transparent;
    background: transparent; color: var(--text-2); font-size: 11.5px; font-weight: 700;
    cursor: pointer; text-align: center; white-space: nowrap; transition: all .15s ease;
  }
  .mobile-tab-btn.active {
    background: var(--bg); color: var(--text); border-color: var(--border-strong);
  }
  [data-theme="light"] .mobile-tab-btn.active {
    background: #ffffff; color: #000000; border-color: #d4d4d8; box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  }
  .editor-pane { display: none; }
  .editor-pane.active { display: block !important; animation: fadeIn .15s ease; }
  @keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
  .editor { grid-template-columns: 1fr; gap: 14px; }
  .editor-side { position: static; gap: 14px; }

  /* Touch-friendly cards and file rows */
  .card { padding: 14px; }
  .card-head-row {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    margin-bottom: 14px !important;
  }
  .card-head-row h3 {
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }
  .card-actions {
    display: flex !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .card-actions .btn {
    flex: 1 1 0 !important;
    justify-content: center !important;
  }

  .main, .view, .editor, .editor-pane, .card, .files {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .file-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding: 10px !important;
    border-radius: 10px !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  .file-row-main {
    width: 100% !important;
    min-width: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
  }
  .file-row-info {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    max-width: calc(100% - 75px) !important;
    overflow: hidden !important;
  }
  .file-row-info .name, .file-row-info .meta {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    display: block !important;
  }
  .file-row-acts {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 5px !important;
    width: 100% !important;
    padding-top: 8px !important;
    border-top: 1px solid var(--border) !important;
    box-sizing: border-box !important;
  }
  .file-row-acts .btn {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 36px !important;
    padding: 0 !important;
    font-size: 14px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Hero header on mobile */
  .hero { gap: 12px; margin-bottom: 16px; }
  .hero-top { align-items: center; gap: 12px; }
  .hero-cover { width: 80px; height: 80px; border-radius: 10px; }
  .hero h2 { font-size: 18px; }
  .hero-bottom { flex-direction: column; align-items: stretch; gap: 8px; }
  .hero .link { width: 100%; justify-content: space-between; }
  .hero .link code { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
  .hero-actions { width: 100%; display: flex; gap: 6px; }
  .hero-actions .btn { flex: 1; padding: 8px 4px; font-size: 12px; justify-content: center; }

  /* Floating savebar above mobile bottom nav */
  .savebar {
    left: 50% !important; transform: translate(-50%, 200%) !important;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
    width: calc(100% - 24px); max-width: 420px; padding: 8px 12px; justify-content: space-between;
    opacity: 0; pointer-events: none;
  }
  .savebar.show { transform: translate(-50%, 0) !important; opacity: 1; pointer-events: auto; }

  /* Audio player above mobile bottom nav */
  .audio-bar {
    bottom: calc(52px + env(safe-area-inset-bottom, 0px)); padding: 6px 10px; gap: 8px;
  }
  .audio-bar-info { max-width: 120px; }

  /* Form inputs: prevent iOS auto-zoom */
  input, textarea, select, .input, .textarea, .select { font-size: 16px !important; }

  /* Toolbar & Grid */
  .toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .toolbar .search, .toolbar .search .input { width: 100%; min-width: 0; }
  .batch-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
  .batch-card .body { padding: 8px 10px 10px; }
  .batch-card .title { font-size: 13px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
  .stat { padding: 12px !important; }
  .stat .value { font-size: 22px !important; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 16px; }
  .page-head h2 { font-size: 22px; }
  .page-actions { width: 100%; }
  .page-actions .btn { width: 100%; }

  /* Modals: bottom sheet layout on mobile */
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100% !important; border-radius: 16px 16px 0 0 !important;
    padding: 20px 16px calc(24px + env(safe-area-inset-bottom, 0px)) !important;
  }
}
