@font-face {
    font-family: Kelson;
    src: url('https://ik-sls.com/fonts/Kelson-Sans-Regular.ttf') format('truetype');
    font-display: swap;
}

:root {
    --yellow: #ffd400;
    --yellow-hover: #ffe04a;
    --bg: #111318;
    --sidebar: #17191f;
    --panel: #191c23;
    --panel-light: #20232b;
    --border: #2b2f39;
    --text: #f4f4f4;
    --muted: #858a96;
    --green: #4bd69a;
    --red: #ff6868;
    font-family: Kelson, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.app { min-height: 100vh; }

.topbar {
    height: 68px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #15171d;
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
}

.brand-mark {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    background: var(--yellow);
    color: #111318;
    font-size: 23px;
    font-weight: 900;
    transform: skew(-9deg);
}

.brand-name {
    font-size: 16px;
    letter-spacing: 1.5px;
}

.brand-name b { color: var(--yellow); font-weight: 400; }

.topbar-right, .connection {
    display: flex;
    align-items: center;
    gap: 20px;
}

.connection {
    gap: 8px;
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 1px;
}

.connection i, .server-indicator i {
    width: 7px;
    height: 7px;
    display: inline-block;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 9px #4bd69a77;
}

.sync-button {
    height: 36px;
    padding: 0 14px;
    border: 1px solid #454958;
    border-radius: 5px;
    background: transparent;
    color: var(--text);
    font-size: 12px;
}

.sync-button:hover { border-color: var(--yellow); color: var(--yellow); }
.sync-button:disabled { opacity: .5; cursor: wait; }
.sync-icon { margin-right: 7px; font-size: 18px; vertical-align: -1px; }

.workspace {
    display: grid;
    grid-template-columns: 245px minmax(0, 1fr);
    min-height: calc(100vh - 68px);
}

.sidebar {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 27px 15px 20px;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
}

.sidebar-label, .folders-heading, .eyebrow, .stat-label, th {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 1.2px;
}

.sidebar-label { padding: 0 10px 15px; }

.nav-item {
    width: 100%;
    height: 43px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 11px;
    border: 0;
    border-radius: 4px;
    color: #c4c6ce;
    background: transparent;
    text-align: left;
    font-size: 13px;
}

.nav-item.active {
    color: var(--yellow);
    background: #ffd40013;
}

.nav-icon { font-size: 18px; }
.nav-count {
    margin-left: auto;
    color: var(--muted);
    font-size: 11px;
}

.sidebar-divider {
    height: 1px;
    margin: 22px 5px 20px;
    background: var(--border);
}

.folders-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 9px 12px;
}

.folders-heading button {
    width: 25px;
    height: 25px;
    border: 1px solid #464a56;
    border-radius: 4px;
    background: transparent;
    color: var(--yellow);
    font-size: 19px;
}

.folders-heading button:hover { background: #ffd40018; }

.folder-tree { display: flex; flex-direction: column; gap: 3px; }

.folder-node {
    min-height: 36px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 9px;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #b9bdc7;
    font-size: 12px;
    cursor: pointer;
}

.folder-node:hover, .folder-node.selected {
    color: var(--yellow);
    background: #ffd40010;
}

.folder-node.drag-over {
    border-color: var(--yellow);
    background: #ffd40020;
}

.folder-symbol { color: var(--yellow); font-size: 15px; }
.folder-node .folder-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-node .folder-number { margin-left: auto; color: #777d89; font-size: 10px; }

.sidebar-empty {
    padding: 8px 10px;
    color: #707581;
    font-size: 11px;
    line-height: 1.6;
}

.sidebar-bottom {
    margin-top: auto;
    padding: 18px 10px 0;
    border-top: 1px solid var(--border);
}

.server-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #c6c9d0;
    font-size: 10px;
    letter-spacing: 1px;
}

.server-caption { margin-top: 8px; color: #6e7380; font-size: 10px; }

.main {
    min-width: 0;
    padding: 38px 38px 50px;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 27px;
}

.eyebrow { margin-bottom: 9px; color: var(--yellow); }

h1 {
    margin: 0;
    font-size: clamp(25px, 3vw, 34px);
    font-weight: 400;
    letter-spacing: -.5px;
}

.page-heading p, .modal-header p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.heading-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.button {
    min-height: 36px;
    padding: 0 13px;
    border-radius: 4px;
    font-size: 11px;
    transition: .15s ease;
}

.button-primary {
    border: 1px solid var(--yellow);
    background: var(--yellow);
    color: #151515;
}

.button-primary:hover { background: var(--yellow-hover); }

.button-secondary {
    border: 1px solid #454a57;
    background: transparent;
    color: var(--text);
}

.button-secondary:hover { border-color: var(--yellow); }

.button-danger {
    border: 1px solid #633a40;
    background: transparent;
    color: #ff8585;
}

.button-danger:hover { background: #ff686817; }

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.stat-card {
    min-height: 91px;
    padding: 17px 18px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--panel);
}

.stat-label { display: block; font-size: 9px; }

.stat-card strong {
    display: block;
    margin-top: 11px;
    font-size: 23px;
    font-weight: 400;
}

.stat-card strong.yellow { color: var(--yellow); }
.stat-sync strong { font-size: 13px; color: #d6d8de; }

.content-panel {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--panel);
}

.toolbar {
    min-height: 66px;
    padding: 12px 17px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    border-bottom: 1px solid var(--border);
}

.toolbar-title { font-size: 13px; }

.toolbar-controls { display: flex; align-items: center; gap: 9px; }

.search-box {
    width: min(260px, 27vw);
    height: 34px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    border: 1px solid #353a46;
    border-radius: 4px;
    color: var(--muted);
}

.search-box span { font-size: 19px; }

.search-box input, .modal-search {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 11px;
}

.search-box input::placeholder, .modal-search::placeholder { color: #777d89; }

select {
    height: 34px;
    padding: 0 9px;
    border: 1px solid #353a46;
    border-radius: 4px;
    outline: 0;
    background: #20232b;
    color: #d7d9df;
    font-size: 11px;
}

.table-wrap { width: 100%; overflow-x: auto; }

table { width: 100%; border-collapse: collapse; text-align: left; }

th {
    height: 40px;
    padding: 0 14px;
    border-bottom: 1px solid var(--border);
    font-size: 9px;
    white-space: nowrap;
}

td {
    height: 57px;
    padding: 8px 14px;
    border-bottom: 1px solid #292d36;
    color: #bfc2ca;
    font-size: 11px;
    white-space: nowrap;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #ffffff05; }
.file-col { width: 43%; }

.file-cell {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 220px;
}

.file-icon {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    display: grid;
    place-items: center;
    border: 1px solid #3a3e49;
    border-radius: 4px;
    background: #22252d;
    color: var(--yellow);
    font-size: 12px;
}

.file-name {
    max-width: 460px;
    overflow: hidden;
    color: #ececf0;
    text-overflow: ellipsis;
    font-size: 11px;
}

.file-sub { margin-top: 4px; color: #777d89; font-size: 9px; }

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--green);
    font-size: 10px;
}

.status::before {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

.status.missing { color: var(--red); }

.row-action {
    width: 29px;
    height: 29px;
    border: 1px solid #3b404c;
    border-radius: 4px;
    background: transparent;
    color: var(--yellow);
    font-size: 17px;
}

.row-action:hover { border-color: var(--yellow); }

.loading-cell, .empty-cell {
    height: 120px;
    color: var(--muted);
    text-align: center;
}

.panel-footer {
    min-height: 43px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 0 16px;
    border-top: 1px solid var(--border);
    color: #7d828e;
    font-size: 10px;
}

.drag-hint { color: #858a96; }

.notice {
    position: fixed;
    right: 25px;
    bottom: 25px;
    z-index: 20;
    max-width: min(400px, calc(100vw - 40px));
    padding: 13px 17px;
    border: 1px solid #454a55;
    border-left: 3px solid var(--yellow);
    border-radius: 4px;
    background: #20232b;
    color: var(--text);
    font-size: 12px;
    box-shadow: 0 12px 35px #0008;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    padding: 20px;
    background: #000b;
}

.modal-backdrop[hidden] { display: none; }

.modal {
    width: min(600px, 100%);
    max-height: min(720px, 90vh);
    display: flex;
    flex-direction: column;
    padding: 22px;
    border: 1px solid #3b404c;
    border-radius: 6px;
    background: #191c23;
    box-shadow: 0 20px 70px #0009;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 18px;
}

.modal-header h2 { margin: 0; font-size: 22px; font-weight: 400; }
.modal-close {
    width: 30px;
    height: 30px;
    border: 1px solid #444955;
    border-radius: 4px;
    background: transparent;
    color: white;
    font-size: 20px;
}

.modal-search {
    height: 38px;
    flex: 0 0 38px;
    padding: 0 11px;
    border: 1px solid #3b404c;
    border-radius: 4px;
    background: #20232b;
}

.modal-file-list {
    min-height: 100px;
    overflow-y: auto;
    margin: 12px 0;
}

.modal-file {
    min-height: 43px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 9px;
    border-bottom: 1px solid #2b2f39;
    color: #d8dae0;
    font-size: 11px;
}

.modal-file:hover { background: #ffffff06; }
.modal-file input { accent-color: var(--yellow); }
.modal-file span { overflow: hidden; text-overflow: ellipsis; }

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 11px;
}

@media (max-width: 1000px) {
    .main { padding: 28px 22px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-sync strong { font-size: 12px; }
}

@media (max-width: 700px) {
    .topbar { height: 60px; padding: 0 15px; }
    .connection { display: none; }
    .workspace { grid-template-columns: 1fr; }
    .sidebar {
        padding: 12px 13px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
    .sidebar-label, .sidebar-divider, .sidebar-bottom { display: none; }
    .nav-item { width: auto; display: inline-flex; }
    .folders-heading { padding-top: 13px; }
    .folder-tree { max-height: 125px; overflow-y: auto; }
    .main { padding: 24px 13px; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .heading-actions { width: 100%; }
    .stats { gap: 8px; }
    .stat-card { min-height: 78px; padding: 13px; }
    .stat-card strong { font-size: 20px; }
    .toolbar { align-items: stretch; flex-direction: column; }
    .toolbar-controls { width: 100%; }
    .search-box { width: 100%; }
    .toolbar-controls select { max-width: 125px; }
    .drag-hint { display: none; }
    .panel-footer { padding: 0 10px; }
}

/* SLS AUTOPILOT — PLAYLISTS */

[hidden] {
    display: none !important;
}

.playlists-view {
    min-width: 0;
}

.playlist-layout {
    display: grid;
    grid-template-columns: minmax(220px, 265px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.playlist-panel,
.playlist-editor {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--panel);
}

.playlist-panel-heading {
    min-height: 53px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 1.1px;
}

.playlist-panel-heading span:last-child {
    color: var(--yellow);
    letter-spacing: 0;
}

.playlist-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 9px;
}

.playlist-entry {
    width: 100%;
    min-height: 57px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: .15s ease;
}

.playlist-entry:hover {
    background: #ffffff08;
    border-color: #353a46;
}

.playlist-entry.active {
    border-color: #ffd40055;
    background: #ffd40012;
}

.playlist-entry-icon {
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    display: grid;
    place-items: center;
    border: 1px solid #414653;
    border-radius: 4px;
    color: var(--yellow);
    font-size: 16px;
}

.playlist-entry.active .playlist-entry-icon {
    border-color: #ffd40066;
}

.playlist-entry-main {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.playlist-entry-name {
    overflow: hidden;
    color: #e5e6eb;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.playlist-entry-meta {
    color: var(--muted);
    font-size: 10px;
}

.playlist-entry-mode {
    flex: 0 0 auto;
    color: var(--yellow);
    font-size: 9px;
    letter-spacing: .5px;
}

.playlist-empty {
    padding: 28px 12px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.6;
    text-align: center;
}

.playlist-editor-header {
    min-height: 91px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 17px;
    border-bottom: 1px solid var(--border);
}

.playlist-editor-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 400;
    overflow-wrap: anywhere;
}

.playlist-editor-header p {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.playlist-editor-actions,
.playlist-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.playlist-toolbar {
    min-height: 65px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
}

.playlist-mode {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 1px;
}

.playlist-mode select {
    min-width: 105px;
    color: var(--yellow);
    font-size: 10px;
    letter-spacing: .5px;
}

.playlist-toolbar button:disabled,
.playlist-editor-actions button:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.playlist-table-wrap {
    min-height: 145px;
}

.playlist-table {
    min-width: 590px;
}

.playlist-table th,
.playlist-table td {
    padding-left: 11px;
    padding-right: 11px;
}

.playlist-order-col {
    width: 42px;
}

.playlist-row {
    cursor: grab;
}

.playlist-row.dragging {
    opacity: .4;
}

.playlist-row.drag-over {
    outline: 1px solid var(--yellow);
    outline-offset: -1px;
    background: #ffd40010;
}

.playlist-row-number {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.playlist-file-name {
    display: block;
    max-width: 360px;
    overflow: hidden;
    color: #e1e3e9;
    text-overflow: ellipsis;
}

.playlist-file-subtitle {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 9px;
}

.playlist-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
}

.playlist-status::before {
    width: 6px;
    height: 6px;
    display: inline-block;
    border-radius: 50%;
    background: #54c58b;
    content: "";
}

.playlist-status.missing {
    color: #ff8585;
}

.playlist-status.missing::before {
    background: #ff6666;
}

.playlist-row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 5px;
}

.playlist-row-actions button {
    width: 27px;
    height: 27px;
    border: 1px solid #3b404c;
    border-radius: 4px;
    background: transparent;
    color: #aeb3bf;
    cursor: pointer;
}

.playlist-row-actions button:hover {
    border-color: var(--yellow);
    color: var(--yellow);
}

.playlist-row-actions button.remove:hover {
    border-color: #a94d56;
    color: #ff8585;
}

@media (max-width: 1050px) {
    .playlist-layout {
        grid-template-columns: minmax(190px, 230px) minmax(0, 1fr);
        gap: 10px;
    }

    .playlist-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 700px) {
    .playlist-layout {
        grid-template-columns: 1fr;
    }

    .playlist-panel {
        max-height: 220px;
        overflow-y: auto;
    }

    .playlist-editor-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .playlist-toolbar {
        align-items: stretch;
    }

    .playlist-toolbar-actions {
        width: 100%;
    }

    .playlist-toolbar-actions button {
        flex: 1;
    }

    .playlist-editor-actions {
        width: 100%;
    }
}

/* Дополнительное оформление окна выбора файлов плейлиста */
.playlist-modal {
    width: min(720px, calc(100vw - 32px));
    max-height: min(82vh, 760px);
    overflow-y: auto;
}

.playlist-modal .modal-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--panel, #191c23);
}

.playlist-modal .modal-header p {
    color: var(--muted, #9298a5);
    margin: 7px 0 0;
    font-size: 13px;
}

.playlist-modal-selection {
    padding: 10px 0;
    color: var(--yellow);
    font-size: 13px;
}

.playlist-modal .modal-file-list {
    max-height: 390px;
    overflow-y: auto;
}

.playlist-file-option {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 10px 12px;
    cursor: pointer;
}

.playlist-file-option input {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
}

.playlist-file-option-name {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    overflow-wrap: anywhere;
}

.playlist-file-option-name small {
    color: var(--muted, #9298a5);
    font-size: 11px;
}

.playlist-modal-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    color: var(--muted, #9298a5);
    font-size: 12px;
}

.playlist-modal .modal-footer {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: var(--panel, #191c23);
}

.playlist-modal .modal-footer button:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.playlist-folder-picker {
    display: flex;
    flex-direction: column;
    gap: 7px;
    max-height: 430px;
    overflow-y: auto;
}

.playlist-folder-picker .playlist-entry {
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.playlist-folder-picker .playlist-entry:disabled {
    opacity: .5;
    cursor: wait;
}

.playlist-row.drag-over {
    outline: 1px solid var(--yellow);
    background: #ffd40012;
}

.playlist-row.dragging {
    opacity: .4;
}

.playlist-row-disabled {
    opacity: .55;
}

.playlist-file-subtitle {
    display: block;
    margin-top: 4px;
    color: var(--muted, #9298a5);
    font-size: 11px;
}

@media (max-width: 640px) {
    .playlist-modal-pagination {
        flex-wrap: wrap;
    }

    .playlist-modal .modal-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }
}

/* Редактирование названий выпусков в папках */
.folder-title-input {
    display: block;
    width: min(100%, 390px);
    min-width: 180px;
    height: 30px;
    padding: 0 9px;
    border: 1px solid #353a46;
    border-radius: 4px;
    outline: none;
    background: #20232b;
    color: #f0f0f3;
    font-size: 11px;
}

.folder-title-input:focus {
    border-color: var(--yellow);
    box-shadow: 0 0 0 2px #ffd40018;
}

.save-folder-title {
    color: var(--green);
    font-size: 14px;
}

.save-folder-title:hover {
    border-color: var(--green);
}


/* Исправление ширины редактора названия выпуска */
.file-cell {
    min-width: 0;
    width: 100%;
}

.file-cell > div {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
}

.folder-title-input {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}


/* Корректная ширина элементов в строке файла */
.file-cell {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    min-width: 0;
}

.file-cell > .file-icon {
    width: 32px;
    min-width: 32px;
    max-width: 32px;
    height: 32px;
    flex: 0 0 32px;
}

.file-cell > div:last-child {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
}

.folder-title-input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

