:root {
    --bg: #0f172a;
    --panel: #111827;
    --card: #1f2937;
    --soft: #334155;
    --text: #f8fafc;
    --muted: #cbd5e1;
    --primary: #35c522;
    --zemra: #c52222;
    --danger: #ef4444;
    --warning: #f59e0b;
    --blue: #3b82f6;
    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    color: var(--text);
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    width: min(1440px, calc(100% - 40px));
    margin: 0 auto;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(10px);
    background: rgba(15, 23, 42, 0.85);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    gap: 12px;
}

.brand {
    font-size: 22px;
    font-weight: 700;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
}

.nav-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.hero {
    padding: 34px 0 22px;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(340px, 0.9fr);
    gap: 22px;
}

.panel,
.card {
    background: rgba(31, 41, 55, 0.9);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.panel {
    padding: 26px 28px;
}

.glass {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.92));
    border: 1px solid rgba(148, 163, 184, 0.14);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.title {
    margin: 0 0 10px;
    font-size: 34px;
    line-height: 1.1;
}

.subtitle {
    color: var(--muted);
    line-height: 1.6;
    margin: 0;
}

.stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat {
    padding: 18px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
}

.stat strong {
    display: block;
    font-size: 26px;
    margin-top: 8px;
}

.section {
    padding: 14px 0 44px;
}

.track-title {
    margin: 0;
    font-size: 22px;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 13px;
}

audio {
    width: 100%;
    margin: 10px 0 14px;
}

.vote-actions,
.inline-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    border: 0;
    cursor: pointer;
    border-radius: 12px;
    padding: 11px 16px;
    font-weight: 700;
    transition: transform 0.15s ease, opacity 0.15s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    color: #052e16;
}

.zemra {
    background: var(--zemra);
    color: #052e16;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-blue {
    background: var(--blue);
    color: #fff;
}

.btn-soft {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid var(--border);
}

.btn-warning {
    background: var(--warning);
    color: #111827;
}

.btn.active-like {
    outline: 2px solid #86efac;
}

.btn.active-dislike {
    outline: 2px solid #fca5a5;
}

.user-avatar-thumb {
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    transform-origin: center;
}

.user-avatar-thumb:hover {
    transform: scale(3.2);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.42);
    border-color: rgba(255, 255, 255, 0.28);
    position: relative;
    z-index: 5;
}

.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(1320px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    gap: 22px;
}

.auth-card.single {
    max-width: 760px;
    grid-template-columns: 1fr;
}

.form-group {
    margin-bottom: 14px;
}

label {
    display: block;
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--muted);
}

input[type="text"],
input[type="password"],
input[type="file"],
select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    outline: none;
}

select option {
    background: #1f2937;
    color: #f8fafc;
}

.notice {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 12px;
}

.notice.ok {
    background: rgba(34, 197, 94, 0.14);
    border: 1px solid rgba(34, 197, 94, 0.35);
}

.notice.err {
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.flash-toast {
    position: fixed;
    top: 84px;
    right: 22px;
    z-index: 120;
    width: min(420px, calc(100vw - 24px));
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid var(--border);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(10px);
    animation: flashToastIn 0.22s ease;
}

.flash-ok {
    background: linear-gradient(180deg, rgba(20, 83, 45, 0.96), rgba(15, 23, 42, 0.96));
    border-color: rgba(74, 222, 128, 0.32);
}

.flash-err {
    background: linear-gradient(180deg, rgba(127, 29, 29, 0.96), rgba(15, 23, 42, 0.96));
    border-color: rgba(248, 113, 113, 0.32);
}

.flash-toast-body {
    min-width: 0;
}

.flash-toast-title {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
}

.flash-toast-message {
    line-height: 1.5;
    color: var(--text);
    word-break: break-word;
}

.flash-toast-close {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.flash-toast.is-hiding {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

@keyframes flashToastIn {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.admin-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 22px;
    margin-bottom: 24px;
}

.sidebar {
    position: sticky;
    top: 92px;
    height: fit-content;
    padding: 18px;
    border-radius: 18px;
}

.sidebar h3 {
    margin-top: 0;
    margin-bottom: 14px;
}

.sidebar-nav {
    display: grid;
    gap: 10px;
}

.sidebar-nav a {
    display: block;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    transition: 0.2s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(34, 197, 94, 0.16));
    border-color: rgba(96, 165, 250, 0.45);
    transform: translateY(-1px);
}

.section-panel {
    display: none;
    animation: fadeSlide 0.24s ease;
}

.section-panel.active {
    display: block;
}

.admin-layout.focus-panel-mode {
    grid-template-columns: 1fr;
}

.admin-layout.focus-panel-mode .sidebar {
    display: none;
}

@keyframes fadeSlide {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-title {
    margin-top: 0;
    margin-bottom: 14px;
    font-size: 24px;
}

.mini-title {
    margin: 0 0 12px;
    font-size: 18px;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    margin-bottom: 24px;
}

.table-wrap {
    overflow-x: auto;
    border-radius: 14px;
    border: 1px solid var(--border);
}

.apk-versions-panel {
    min-height: 70vh;
}

.users-panel {
    min-height: 70vh;
}

.tracks-panel {
    min-height: 70vh;
}

.playlist-panel {
    min-height: 70vh;
}

.tracks-search-bar {
    margin-bottom: 14px;
}

.table-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.table-search {
    flex: 1 1 320px;
}

.table-search input {
    width: 100%;
}

.table-page-size {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
}

.table-page-size label {
    margin: 0;
    white-space: nowrap;
}

.table-page-size select {
    min-width: 110px;
}

.table-empty-state {
    margin-top: 14px;
}

.table-footer-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.table-pagination {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.table-page-indicator {
    color: var(--muted);
    min-width: 88px;
    text-align: center;
}

.table-page-numbers {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
    justify-content: center;
}

.table-page-btn {
    min-width: 44px;
    border-radius: 0;
    padding: 10px 14px;
}

.table-page-btn.is-edge-left {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.table-page-btn.is-edge-right {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

.table-page-btn.is-active {
    background: var(--blue);
    border-color: rgba(96, 165, 250, 0.65);
    color: #fff;
}

.panel-toolbar-spacer {
    width: 46px;
    height: 46px;
}

.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 220px));
    gap: 24px;
    justify-content: start;
}

.album-track-actions {
    justify-content: flex-end;
    width: auto;
}

.album-track-actions form {
    margin: 0;
}

.table-checkbox-cell {
    width: 48px;
}

.table-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--blue);
    cursor: pointer;
}

.album-card {
    padding: 14px;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.album-card-link {
    display: block;
    color: inherit;
}

.album-card-link:hover,
.album-card-link:focus-visible {
    transform: translateY(-6px);
    border-color: rgba(96, 165, 250, 0.48);
    box-shadow: 0 22px 42px rgba(0, 0, 0, 0.34);
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.16), rgba(15, 23, 42, 0.94));
}

.album-cover-wrap {
    margin-bottom: 12px;
    overflow: hidden;
    border-radius: 18px;
}

.album-cover-image,
.album-cover-fallback {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 18px;
    display: block;
    object-fit: cover;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    transition: transform 0.24s ease, filter 0.24s ease;
}

.album-cover-fallback {
    display: grid;
    place-items: center;
    font-size: 56px;
    font-weight: 700;
    color: var(--muted);
}

.album-card-link:hover .album-cover-image,
.album-card-link:hover .album-cover-fallback,
.album-card-link:focus-visible .album-cover-image,
.album-card-link:focus-visible .album-cover-fallback {
    transform: scale(1.04);
    filter: saturate(1.08);
}

.album-card-link:hover .album-title,
.album-card-link:focus-visible .album-title {
    color: #dbeafe;
}

.album-card-link:hover .album-count,
.album-card-link:focus-visible .album-count {
    color: #bfdbfe;
}

.album-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.album-title {
    margin-top: 10px;
    margin-bottom: 0;
}

.album-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.album-track-list {
    display: grid;
    gap: 10px;
}

.album-track-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
}

.album-track-index {
    color: var(--muted);
    font-weight: 700;
    min-width: 20px;
}

.album-track-text {
    min-width: 0;
}

.album-hero-card {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 18px;
    align-items: center;
}

.album-hero-media {
    width: 100%;
}

.album-hero-copy {
    min-width: 0;
}

.artist-image-form {
    margin-top: 18px;
}

.apk-versions-toolbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
    margin-bottom: 20px;
}

.apk-back-btn {
    width: 46px;
    height: 46px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    transition: 0.2s ease;
}

.apk-back-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(96, 165, 250, 0.45);
    background: rgba(59, 130, 246, 0.14);
}

.apk-add-btn {
    justify-self: end;
}

.apk-table-wrap {
    margin-top: 12px;
}

.apk-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 60;
}

.apk-modal.open {
    display: flex;
}

.apk-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(6px);
}

.apk-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(560px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
}

.apk-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.apk-modal-close {
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.apk-upload-form {
    display: grid;
    gap: 14px;
}

.apk-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 6px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

tbody tr {
    transition: background 0.18s ease, box-shadow 0.18s ease;
}

tbody tr:hover {
    background: rgba(59, 130, 246, 0.08);
}

.user-form-row {
    width: 100%;
}

.user-form-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.9fr 1.2fr auto;
    gap: 10px;
    align-items: center;
}

/* PLAYLIST */
.playlist-shell {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 18px;
    align-items: stretch;
}

.playlist-list {
    max-height: 78vh;
    overflow: auto;
    padding-right: 6px;
}

.track-item {
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.03));
    margin-bottom: 10px;
    cursor: pointer;
    transition: 0.2s ease;
}

.track-item:hover {
    transform: translateY(-1px);
    border-color: rgba(96, 165, 250, 0.35);
}

.track-item.active {
    outline: 2px solid rgba(59, 130, 246, 0.6);
    background: rgba(59, 130, 246, 0.12);
}

.track-item-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.track-item-main,
.track-item-text {
    flex: 1;
    min-width: 0;
}

.track-item-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.track-like-form {
    margin: 0;
    flex-shrink: 0;
}

.track-like-btn {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    outline: none;
    cursor: pointer;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: 0.18s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.track-like-btn:hover {
    transform: translateY(-1px) scale(1.05);
    background: rgba(239, 68, 68, 0.12);
}

.track-like-btn.active-like-inline {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(239, 68, 68, 0.18) !important;
    color: #ff2d55 !important;
    border: 1px solid rgba(239, 68, 68, 0.55) !important;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.35) !important;
}

/* PLAYER */
.player-stage {
    min-height: 520px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
}

.player-top {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-fullscreen-inner {
    width: 100%;
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    position: relative;
}

.player-main-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 10px;
    flex: 1;
}

.player-main-title {
    font-size: 32px;
    margin-top: 8px;
}

.player-main-artist {
    font-size: 16px;
}

.visualizer-wrap {
    width: 100%;
    max-width: 900px;
    height: 260px;
    margin: 10px auto 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
}

.visualizer-wrap.player-visualizer-only {
    max-width: 900px;
    margin: 12px auto 0;
}

#audioVisualizer {
    width: 100%;
    height: 260px;
    display: block;
}

.player-bottom-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.player-actions-row.compact-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: nowrap;
}

.player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 4px;
    margin-bottom: 4px;
}

.control-btn,
.icon-btn {
    border: 0;
    cursor: pointer;
    min-width: 52px;
    width: 52px;
    height: 52px;
    padding: 0;
    font-size: 20px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid var(--border);
    transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover,
.icon-btn:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.12);
}

.control-btn.primary,
.play-btn-large {
    min-width: 66px;
    width: 66px;
    height: 66px;
    font-size: 24px;
    border-radius: 18px;
    background: var(--blue);
    color: #fff;
}

.control-btn.disabled,
.control-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.centered-stats {
    justify-content: center;
}

.player-stats {
    margin-top: 6px;
    justify-content: center;
}

.close-player-btn {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 3;
}

.player-back-btn {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 3;
}

.swipe-hint {
    color: var(--muted);
    font-size: 13px;
    margin-top: 8px;
    text-align: center;
    line-height: 1.5;
}

.empty {
    text-align: center;
    padding: 28px;
    color: var(--muted);
    border: 1px dashed var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
}

.playlist-intro {
    margin-top: -6px;
    margin-bottom: 16px;
}

/* FULLSCREEN PLAYER MODE */
body.player-open .topbar,
body.player-open #listenerHero,
body.player-open #playlistHeading {
    display: none !important;
}

body.player-open #playlist-section {
    padding-top: 0;
}

body.player-open .container {
    width: min(100vw, 100%);
    max-width: 100%;
    margin: 0;
    padding: 0;
}

body.player-open #playlistShell {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

body.player-open #playerStage {
    order: 1;
    border-radius: 0;
    min-height: 100vh;
    width: 100vw;
    max-width: 100%;
    margin: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 24px 18px;
}

body.player-open #playlistList {
    order: 2;
    display: block !important;
    max-height: none;
    padding: 0 12px 20px;
    margin-top: 0;
}

/* PROGRESS BAR */
.progress-wrap {
    width: 100%;
    max-width: 900px;
    margin: 8px auto 0;
}

.progress-time {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 12px;
    font-variant-numeric: tabular-nums;
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
    cursor: pointer;
}

.progress-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(
        90deg,
        rgba(59, 130, 246, 0.95) 0%,
        rgba(34, 197, 94, 0.95) 50%,
        rgba(239, 68, 68, 0.95) 100%
    );
    transition: width 0.1s linear;
}

/* compatibilità eventuale con input range vecchio */
input.progress-bar {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    outline: none;
    cursor: pointer;
    overflow: visible;
}

input.progress-bar::-webkit-slider-runnable-track {
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        rgba(59, 130, 246, 0.95) 0%,
        rgba(34, 197, 94, 0.95) 50%,
        rgba(239, 68, 68, 0.95) 100%
    );
}

input.progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -5px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.9);
    background: #fff;
    cursor: pointer;
}

input.progress-bar::-moz-range-track {
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        rgba(59, 130, 246, 0.95) 0%,
        rgba(34, 197, 94, 0.95) 50%,
        rgba(239, 68, 68, 0.95) 100%
    );
}

input.progress-bar::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.9);
    background: #fff;
    cursor: pointer;
}

/* ADMIN PREVIEW */
.admin-preview-player {
    min-height: auto;
}

.admin-playlist-shell {
    margin-top: 18px;
}

.admin-preview-disabled {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.admin-preview-note {
    margin-top: 8px;
    text-align: center;
}

#playerStage audio {
    display: none;
}

.admin-preview-player .player-main-block {
    max-width: 1280px;
    margin: 0 auto;
}

.admin-preview-player .player-bottom-controls {
    margin-top: 8px;
}

/* TABLET */
@media (max-width: 900px) {
    .hero-grid,
    .auth-card,
    .admin-grid,
    .admin-layout,
    .playlist-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .title {
        font-size: 28px;
    }

    .stats {
        grid-template-columns: 1fr 1fr;
    }

    .apk-versions-toolbar {
        grid-template-columns: auto 1fr;
    }

    .apk-add-btn {
        grid-column: 1 / -1;
        justify-self: stretch;
    }

    .user-form-grid {
        grid-template-columns: 1fr;
    }

    .player-main-title {
        font-size: 26px;
    }

    .player-stage {
        min-height: auto;
    }

    .playlist-list {
        max-height: none;
    }

    .visualizer-wrap,
    .visualizer-wrap.player-visualizer-only {
        height: 220px;
    }

    #audioVisualizer {
        height: 220px;
    }
}

/* MOBILE */
@media (max-width: 640px) {
    body {
        font-size: 15px;
    }

    .container {
        width: min(100% - 18px, 100%);
    }

    .panel,
    .card {
        border-radius: 14px;
    }

    .panel,
    .card,
    .stat {
        padding: 14px;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .topbar-inner {
        align-items: stretch;
    }

    .flash-toast {
        top: 14px;
        right: 9px;
        left: 9px;
        width: auto;
    }

    .nav-actions,
    .inline-actions,
    .vote-actions {
        width: 100%;
    }

    .nav-actions .btn,
    .inline-actions .btn,
    .vote-actions form,
    .vote-actions .btn {
        width: 100%;
    }

    .track-title {
        font-size: 20px;
    }

    .title {
        font-size: 24px;
    }

    .subtitle {
        font-size: 15px;
    }

    .apk-modal {
        padding: 12px;
    }

    .apk-modal-dialog {
        max-height: calc(100vh - 24px);
    }

    .apk-modal-actions {
        flex-direction: column-reverse;
    }

    .apk-modal-actions .btn {
        width: 100%;
    }

    input[type="text"],
    input[type="password"],
    input[type="file"],
    select {
        font-size: 16px;
    }

    .playlist-shell {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .playlist-list {
        order: 2;
        max-height: none;
    }

    #playerStage {
        order: 1;
    }

    .player-fullscreen-inner {
        min-height: auto;
    }

    .visualizer-wrap,
    .visualizer-wrap.player-visualizer-only {
        height: 190px;
        border-radius: 18px;
    }

    #audioVisualizer {
        height: 190px;
    }

    .player-actions-row.compact-controls,
    .player-controls {
        gap: 8px;
    }

    .icon-btn,
    .control-btn {
        min-width: 46px;
        width: 46px;
        height: 46px;
        font-size: 18px;
    }

    .play-btn-large,
    .control-btn.primary {
        min-width: 58px;
        width: 58px;
        height: 58px;
        font-size: 22px;
    }

    .player-main-title {
        font-size: 22px;
    }

    .track-item-meta {
        flex-wrap: wrap;
    }

    body.player-open #playerStage {
        padding: 18px 12px;
        min-height: auto;
        width: 100%;
        border-radius: 18px 18px 0 0;
    }

    body.player-open #playlistList {
        display: block !important;
        margin-top: 16px;
        padding: 0 0 20px;
    }

    .progress-time {
        font-size: 12px;
    }

    .table-controls,
    .table-page-size {
        align-items: stretch;
    }

    .table-search,
    .table-page-size,
    .table-page-size select,
    .table-footer-controls,
    .table-pagination,
    .table-page-indicator,
    .table-page-numbers {
        width: 100%;
    }

    .table-page-indicator {
        text-align: left;
    }
}input[type="number"],
textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    outline: none;
}

textarea {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

.apk-link {
    color: #93c5fd;
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-word;
}

.album-metadata-form {
    margin-left: auto;
}

@media (max-width: 640px) {
    input[type="number"],
    textarea {
        font-size: 16px;
    }

    .album-metadata-form {
        width: 100%;
        margin-left: 0;
    }

.album-metadata-form .btn {
        width: 100%;
    }
}

.api-manager-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.api-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.api-metric-card,
.api-doc-card,
.api-card-list {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.api-metric-card {
    padding: 16px;
}

.api-metric-label {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
}

.api-metric-value {
    font-size: 28px;
    font-weight: 700;
}

.api-metric-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

.api-tab-bar {
    display: flex;
    gap: 6px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.api-tab {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    border-radius: 999px;
    padding: 9px 14px;
    cursor: pointer;
    font-weight: 700;
}

.api-tab.active {
    background: rgba(53, 197, 34, 0.16);
    color: var(--text);
    border-color: rgba(53, 197, 34, 0.4);
}

.api-pane {
    display: none;
}

.api-pane.active {
    display: block;
}

.api-card-list {
    overflow: hidden;
}

.api-key-row,
.api-activity-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}

.api-key-row:last-child,
.api-activity-row:last-child {
    border-bottom: 0;
}

.api-key-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.api-key-name {
    font-size: 14px;
    font-weight: 700;
}

.api-key-badge,
.api-key-scope {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.api-key-badge.is-active {
    background: rgba(53, 197, 34, 0.16);
    color: #b4ff9f;
}

.api-key-badge.is-inactive {
    background: rgba(255, 255, 255, 0.08);
    color: var(--muted);
}

.api-key-scope {
    background: rgba(59, 130, 246, 0.16);
    color: #bfdbfe;
}

.api-key-value,
.api-code-block {
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.7;
    background: rgba(15, 23, 42, 0.68);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 12px;
    padding: 10px 12px;
    color: #dbeafe;
    word-break: break-all;
}

.api-key-meta {
    font-size: 12px;
    color: var(--muted);
    margin-top: 8px;
}

.api-key-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.api-settings-form {
    margin-top: 18px;
}

.api-activity-row {
    grid-template-columns: auto 1fr auto auto;
    font-size: 12px;
}

.api-activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.api-activity-dot.is-ok {
    background: var(--primary);
}

.api-activity-dot.is-err {
    background: var(--danger);
}

.api-activity-path {
    font-family: Consolas, "Courier New", monospace;
    color: #bfdbfe;
}

.api-activity-status {
    font-weight: 700;
}

.api-activity-status.is-ok {
    color: #86efac;
}

.api-activity-status.is-err {
    color: #fca5a5;
}

.api-activity-time {
    color: var(--muted);
    white-space: nowrap;
}

.api-doc-card {
    padding: 18px;
}

.api-doc-card .api-code-block {
    margin-bottom: 16px;
}

.api-permission-grid,
.api-permission-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
}

.api-permission-grid {
    margin-top: 12px;
}

.api-permission-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}

.api-permission-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.api-table-key-cell code {
    font-family: Consolas, "Courier New", monospace;
    color: #dbeafe;
    font-size: 12px;
}

@media (max-width: 900px) {
    .api-metrics-grid {
        grid-template-columns: 1fr;
    }

    .api-manager-topbar,
    .api-key-row,
    .api-activity-row {
        grid-template-columns: 1fr;
    }

    .api-manager-topbar {
        align-items: stretch;
    }

    .api-key-actions,
    .api-manager-topbar form .btn {
        width: 100%;
    }

    .api-key-actions .btn,
    .api-manager-topbar form .btn {
        width: 100%;
    }
}
