:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface2: #22263a;
    --border: #2e3348;
    --primary: #6c63ff;
    --primary-hover: #574fd6;
    --success: #22c55e;
    --danger: #ef4444;
    --text: #e8eaf0;
    --muted: #6b7280;
    --radius: 8px;
    --font: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    height: 100vh;
    overflow: hidden;
}

a { color: var(--primary); text-decoration: none; }

/* ── SIDEBAR ── */
.sidebar-nav {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 260px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 1.1rem 1.25rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    display: block;
    white-space: nowrap;
}

.sidebar-logo:hover { color: var(--primary); }

.sidebar-band {
    padding: .8rem 1.25rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: .95rem;
    color: var(--primary);
}

.sidebar-section {
    flex: 1;
    padding: .5rem 0;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem 1.25rem;
    color: var(--muted);
    font-size: .9rem;
    transition: .15s;
    border-left: 3px solid transparent;
}

.sidebar-nav-item:hover {
    background: var(--surface2);
    color: var(--text);
}

.sidebar-nav-item.active {
    background: var(--surface2);
    color: var(--text);
    border-left-color: var(--primary);
}

.sidebar-sub-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .1rem 1.25rem .35rem calc(4rem - 5px);
    font-size: .85rem;
    color: var(--text);
    opacity: .75;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding: .5rem 0;
}

/* ── MAIN CONTENT ── */
.main-content {
    margin-left: 260px;
    padding: 2rem 1.5rem;
    height: 100vh;
    overflow-y: auto;
}

/* ── LAYOUT ── */
.btn-block { width: 100%; justify-content: center; }
.container.narrow { max-width: 480px; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.page-header h2 { flex: 1; }

.page-header h2 { font-size: 1.4rem; }

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    font-size: .875rem;
    cursor: pointer;
    transition: .15s;
    white-space: nowrap;
}

.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }

.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }

.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.1); color: #fff; }

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

/* ── BAND CARDS ── */
.band-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: flex-start;
}

.band-card {
    width: 360px;
}

.band-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.band-card h3 { margin-bottom: .75rem; font-size: 1.1rem; }

.band-logo-wrap {
    width: 110px;
    min-height: 100%;
    background: var(--surface2);
    border-right: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
    overflow: hidden; color: var(--muted); font-size: 1.5rem;
    transition: background .2s, color .2s;
}
.band-logo-wrap:hover { background: var(--surface); color: var(--primary); }
.band-logo-wrap img { width: 100%; height: auto; object-fit: contain; }

.band-card-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    width: 100%;
}
.band-card-actions .btn { flex: 1; display: flex; justify-content: center; }

/* ── SETLIST CARDS ── */
.setlist-list { display: flex; flex-direction: column; gap: .75rem; max-width: 700px; }

.setlist-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    gap: 1rem;
}

.setlist-info { flex: 1; min-width: 0; }
.setlist-info h3 { font-size: 1rem; margin-bottom: .15rem; }
.setlist-meta { font-size: .95rem; color: #8b92a8; }
.setlist-actions { display: flex; gap: .5rem; flex-shrink: 0; }

/* ── TABLE ── */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
    background: var(--surface);
}

.table-scroll {
    overflow-y: auto;
    max-height: calc(100vh - 210px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.data-table th {
    text-align: left;
    padding: .7rem .6rem;
    font-size: .8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    background: var(--surface2);
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: .45rem .6rem;
    border-bottom: 1px solid var(--border);
    font-size: .9rem;
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table .center { text-align: center; }

/* ── BASS DROP BADGE ── */
.bass-drop-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    background: rgba(108, 99, 255, .15);
    border: 1px solid rgba(108, 99, 255, .4);
    color: #a5a0ff;
    padding: .15rem .5rem;
    border-radius: 20px;
    font-size: .8rem;
}

.bass-drop-badge.sm { font-size: .75rem; padding: .1rem .4rem; }

/* ── BASS SELECTOR ── */
.bass-selector {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.bass-icon { font-size: 1.4rem; color: var(--primary); }

/* ── SETLIST EDITOR ── */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    align-items: start;
}

.editor-left, .editor-right {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.editor-left h3, .editor-right h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.song-count {
    font-size: .8rem;
    color: var(--muted);
    font-weight: 400;
}

.setlist-sortable {
    list-style: none;
    overflow-y: auto;
    max-height: calc(100vh - 280px);
}

.setlist-song-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem .5rem;
    border-bottom: 1px solid var(--border);
    cursor: default;
}

.setlist-song-item:last-child { border-bottom: none; }

.drag-handle {
    cursor: grab;
    color: var(--muted);
    padding: 0 .25rem;
}

.drag-handle:active { cursor: grabbing; }

.song-num {
    min-width: 1.5rem;
    font-size: .8rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.song-details { flex: 1; }
.song-details strong { display: block; font-size: .9rem; }
.song-meta { font-size: .8rem; color: var(--muted); }

.remove-song-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: .25rem .4rem;
    border-radius: 4px;
    transition: .15s;
}

.remove-song-btn:hover { color: var(--danger); background: rgba(239,68,68,.1); }

.song-extra-menu { position: relative; }

.extra-btn { font-size: .75rem; padding: .2rem .5rem; color: var(--muted); }

.extra-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 140px;
    box-shadow: 0 4px 16px rgba(0,0,0,.4);
    z-index: 50;
}

.extra-dropdown.open { display: block; }

.extra-dropdown button {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    padding: .6rem 1rem;
    background: none;
    border: none;
    color: var(--text);
    font-size: .85rem;
    cursor: pointer;
    text-align: left;
}

.extra-dropdown button:hover { background: var(--surface2); }

.extra-divider-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .75rem;
    border: 2px dashed #d4a017;
    border-radius: var(--radius);
    color: #d4a017;
    font-weight: 700;
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    cursor: grab;
    margin: .25rem 0;
    background: rgba(212,160,23,.07);
}
.extra-divider-item .remove-song-btn { margin-left: auto; color: #d4a017; opacity: .6; }
.extra-divider-item .remove-song-btn:hover { opacity: 1; }

.extra-separator {
    font-size: .8rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 1rem 0 .25rem 2.5rem;
    border-top: 2px dashed var(--border);
    margin-top: .5rem;
}

.extra-num-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: .25rem .4rem;
    border-radius: 4px;
    font-size: .9rem;
    transition: .15s;
}

.extra-num-btn:hover { color: #f59e0b; }
.extra-num-btn.active { color: #f59e0b; }

.seg-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: .25rem .4rem;
    border-radius: 4px;
    font-size: .9rem;
    transition: .15s;
}

.seg-btn:hover { color: #a855f7; }
.seg-btn.active { color: #a855f7; }

.pause-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: .25rem .4rem;
    border-radius: 4px;
    font-size: .8rem;
    transition: .15s;
    white-space: nowrap;
}

.pause-btn:hover { color: #f59e0b; }
.pause-btn.active { color: #f59e0b; }
.pause-btn:disabled { opacity: .3; cursor: not-allowed; }

/* Seg Into */
.setlist-song-item.seg-into {
    border-bottom: none;
    border-left: 3px solid #a855f7;
    padding-left: 8px;
    margin-bottom: 0;
}

.setlist-song-item.seg-into + .setlist-song-item {
    border-left: 3px solid #a855f7;
    padding-left: 8px;
}

.available-songs {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: .4rem;
    overflow-y: auto;
    max-height: calc(100vh - 220px);
}

.available-songs li {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .75rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: .15s;
}

.available-songs li:hover {
    background: var(--surface2);
}

/* ── MODAL ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

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

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.75rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

.modal h3 { margin-bottom: 1.25rem; font-size: 1.1rem; }

.modal label {
    display: block;
    font-size: .8rem;
    color: var(--muted);
    margin-bottom: .3rem;
    margin-top: .9rem;
}

.modal label:first-of-type { margin-top: 0; }

.modal input, .modal select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: .6rem .75rem;
    font-size: .9rem;
    font-family: var(--font);
    appearance: none;
    -webkit-appearance: none;
}

.modal input:focus, .modal select:focus {
    outline: none;
    border-color: var(--primary);
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: .5rem;
    margin-top: 1.25rem;
}

/* ── LOGIN ── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 360px;
}

.login-box h1 { text-align: center; margin-bottom: 1.75rem; font-size: 1.5rem; }

.login-box label {
    display: block;
    font-size: .8rem;
    color: var(--muted);
    margin-bottom: .3rem;
    margin-top: .9rem;
}

.login-box input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: .65rem .8rem;
    font-size: .95rem;
}

.login-box input:focus { outline: none; border-color: var(--primary); }

.login-box button {
    width: 100%;
    margin-top: 1.5rem;
    padding: .7rem;
    font-size: 1rem;
}

/* ── FORM CARD ── */
.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.form-card label {
    display: block;
    font-size: .8rem;
    color: var(--muted);
    margin-bottom: .3rem;
    margin-top: .9rem;
}

.form-card input, .form-card select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: .6rem .75rem;
    font-size: .9rem;
    margin-bottom: .25rem;
}


.table-body {
    border-top: none;
}

/* ── SORT LINKS ── */
.sort-link {
    color: var(--muted);
    text-decoration: none;
    text-transform: uppercase;
    font-size: .8rem;
    letter-spacing: .05em;
}
.sort-link:hover { color: var(--text); }

/* ── CONFIRM DIALOG ── */
.confirm-modal {
    max-width: 360px;
    text-align: center;
}

.confirm-message {
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: .5rem;
}

.confirm-modal .modal-actions {
    justify-content: center;
    gap: .75rem;
    margin-top: 1.5rem;
}

/* ── MISC ── */
.empty-state { color: var(--muted); font-style: italic; padding: 1rem 0; }
.muted { color: var(--muted); }
.error { color: var(--danger); margin-bottom: 1rem; }
.success { color: var(--success); margin-bottom: 1rem; }

.role-badge {
    display: inline-block;
    padding: .15rem .6rem;
    border-radius: 20px;
    font-size: .75rem;
}

.role-badge.admin { background: rgba(108,99,255,.2); color: #a5a0ff; }
.role-badge.user { background: var(--surface2); color: var(--muted); }

.setlist-editor h2 small {
    font-size: .9rem;
    color: var(--muted);
    font-weight: 400;
    margin-left: .5rem;
}

@media (max-width: 700px) {
    .editor-layout { grid-template-columns: 1fr; }
    .setlist-card { flex-direction: column; align-items: flex-start; }
}
