:root {
    --blue: #0f6cbd;
    --blue-hover: #0c5aa3;
    --blue-soft: #cfe4fa;
    --blue-softer: #e8f3fc;
    --text: #242424;
    --text-2: #424242;
    --muted: #616161;
    --line: #e0e0e0;
    --pane: #f5f5f5;
    --surface: #ffffff;
    --danger: #c50f1f;
    --warn: #c47100;
    --ok: #0e7c3a;
    --title-h: 52px;
    --title-bg: #f3f5f4;
    --title-fg: #1c2b28;
    --title-muted: #5c6b66;
    --folder-w: 248px;
    --list-w: 352px;
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    overscroll-behavior-x: none;
    font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
    color: var(--text);
    background: var(--pane);
}

.title-bar {
    position: relative;
    height: var(--title-h);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px 0 12px;
    background: var(--title-bg);
    color: var(--title-fg);
    border-bottom: 1px solid #d8ddd9;
    flex-shrink: 0;
}

.title-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 240px;
}

.title-logo-link {
    display: block;
    flex-shrink: 0;
}

.title-logo {
    display: block;
    height: 40px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
    flex-shrink: 0;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(28, 43, 40, 0.08);
}

/* 应用页标题栏：左 logo、中间应用标题、右侧返回应用列表 */
.title-bar--app .title-logo-link {
    flex: 1;
}

.title-heading {
    min-width: 0;
    text-align: center;
}

.title-actions {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.title-heading h1 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.title-heading p {
    margin: 2px 0 0;
    font-size: 11px;
    color: var(--title-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    margin-left: auto;
    border: 1px solid #d4dad6;
    border-radius: 50%;
    background: #fff;
    color: var(--title-fg);
    text-decoration: none;
    cursor: pointer;
}

.home-btn:hover {
    border-color: #3d8a4a;
    color: #277a3a;
}

.home-btn:active {
    background: #f0f0f0;
}

.title-bar--hub .user-chip {
    margin-left: auto;
}

.title-bar--app .title-search {
    flex: 0 1 300px;
    max-width: 300px;
    margin-left: auto;
}

@media (max-width: 1000px) {
    .title-bar--app .title-search {
        flex-basis: 200px;
        max-width: 200px;
    }
}

.title-text h1 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.title-text p {
    margin: 0;
    font-size: 11px;
    color: var(--title-muted);
    white-space: nowrap;
}

.title-search {
    flex: 1;
    max-width: 520px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #d4dad6;
    border-radius: 4px;
    padding: 0 10px;
    color: var(--title-muted);
}

.title-search input {
    flex: 1;
    height: 32px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--title-fg);
    font-size: 13px;
}

.title-search input::placeholder {
    color: #8a9691;
}

.title-search:focus-within {
    border-color: #3d8a4a;
    box-shadow: 0 0 0 1px #3d8a4a;
}

.title-meta {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 12px;
    background: var(--title-bg);
    border-top: 1px solid #d8ddd9;
    z-index: 90;
}

.title-meta:empty {
    display: none;
}

body:has(.title-meta:not(:empty)) {
    padding-bottom: 32px;
}

.agent-pill,
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    background: #fff;
    border: 1px solid #d4dad6;
    color: var(--title-fg);
    border-radius: 14px;
    padding: 4px 10px;
    white-space: nowrap;
}

.agent-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #6bd16b;
    box-shadow: 0 0 0 3px rgba(107, 209, 107, 0.25);
}

.app-body {
    display: flex;
    height: calc(100% - var(--title-h));
    min-height: 0;
}

.folder-pane,
.list-pane,
.reading-pane {
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--surface);
}

.folder-pane {
    width: var(--folder-w);
    min-width: 180px;
    max-width: 420px;
    background: var(--pane);
    border-right: 1px solid var(--line);
}

.list-pane {
    width: var(--list-w);
    min-width: 260px;
    max-width: 560px;
    border-right: 1px solid var(--line);
}

.reading-pane {
    flex: 1;
    min-width: 320px;
}

.splitter {
    width: 4px;
    cursor: col-resize;
    background: transparent;
    flex-shrink: 0;
}

.splitter:hover,
.splitter.is-dragging {
    background: var(--blue-soft);
}

.pane-header {
    height: 44px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

.list-header {
    justify-content: space-between;
    height: auto;
    min-height: 56px;
    padding: 10px 12px;
}

.list-title {
    font-size: 14px;
    font-weight: 600;
}

.list-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.list-count {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 11px;
    background: var(--blue-softer);
    color: var(--blue);
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.list-toolbar {
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}


.conv-list {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

.send-btn {
    font-family: inherit;
}


.tag,
.status-pill {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 3px;
    background: #f0f0f0;
    color: var(--muted);
}

.status-pill.is-open {
    background: #fde7e9;
    color: var(--danger);
}

.status-pill.is-in-progress {
    background: #fff4ce;
    color: var(--warn);
}

.status-pill.is-done {
    background: #e6f4ea;
    color: var(--ok);
}

.pane-empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    gap: 6px;
}

.chat-empty p {
    margin: 0;
    font-size: 16px;
    color: var(--text-2);
}

.chat-empty span {
    font-size: 13px;
}

.chat-view {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.chat-view.is-hidden,
.chat-empty.is-hidden {
    display: none;
}

.chat-header {
    padding: 12px 18px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

.chat-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-header-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 6px;
    font-size: 12px;
    color: var(--muted);
}


.send-btn {
    height: 36px;
    padding: 0 16px;
    border: 0;
    border-radius: 4px;
    background: var(--blue);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
}

.send-btn:hover {
    background: var(--blue-hover);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

@media (max-width: 900px) {
    .title-text p,
    .agent-pill {
        display: none;
    }

    .folder-pane {
        min-width: 160px;
    }

    .list-pane {
        min-width: 220px;
    }
}

html.is-login,
html.is-login body {
    height: auto;
    min-height: 100%;
    overflow: auto;
}

.login-body {
    background:
        linear-gradient(180deg, #e9f2eb 0%, #f3f5f4 42%, #eef2f0 100%);
    color: var(--title-fg);
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

.login-shell {
    width: min(860px, 100%);
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #fff;
    border: 1px solid #e3e8e5;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 18px 48px rgba(28, 43, 40, 0.08);
}

.login-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 36px;
    background: #f7faf7;
    text-align: center;
}

.login-logo {
    display: block;
    width: min(280px, 100%);
    height: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 0 0 1px rgba(28, 43, 40, 0.06);
}

.login-hero h1 {
    margin: 8px 0 0;
    font-size: 22px;
    font-weight: 700;
}

.login-hero p {
    margin: 0;
    font-size: 13px;
    color: var(--title-muted);
    line-height: 1.5;
}

.login-card {
    padding: 42px 36px 28px;
}

.login-card h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

.login-lead {
    margin: 6px 0 22px;
    font-size: 13px;
    color: var(--title-muted);
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--title-fg);
}

.login-field input {
    height: 40px;
    padding: 0 12px;
    border: 1px solid #d4dad6;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    color: var(--title-fg);
    outline: none;
}

.login-field input:focus {
    border-color: #3d8a4a;
    box-shadow: 0 0 0 1px #3d8a4a;
}

.login-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 16px;
    font-size: 13px;
    color: var(--title-muted);
}

.login-error {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--danger);
}

.login-submit {
    width: 100%;
    height: 42px;
    border: 0;
    border-radius: 6px;
    background: #2f8f45;
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.login-submit:hover {
    background: #277a3a;
}

.login-submit:disabled {
    opacity: 0.6;
    cursor: default;
}

.login-hint {
    margin: 18px 0 0;
    font-size: 12px;
    color: #8a9691;
    text-align: center;
}

.user-chip {
    cursor: default;
}

.logout-btn {
    border: 1px solid #d4dad6;
    background: #fff;
    color: var(--title-fg);
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
}

.logout-btn:hover {
    border-color: #3d8a4a;
    color: #277a3a;
}

@media (max-width: 720px) {
    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-hero {
        padding: 32px 24px 20px;
    }

    .login-card {
        padding: 24px 24px 20px;
    }
}

.title-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.title-nav a {
    color: var(--title-fg);
    text-decoration: none;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 4px;
    white-space: nowrap;
}

.title-nav a:hover {
    background: #fff;
}

.title-nav a.is-active {
    background: #fff;
    font-weight: 600;
    box-shadow: 0 0 0 1px #d4dad6;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #d4dad6;
    border-radius: 50%;
    background: #fff;
    color: var(--title-fg);
    cursor: pointer;
    flex-shrink: 0;
    margin-left: auto;
}

.user-menu-btn:hover {
    border-color: #3d8a4a;
    color: #277a3a;
}

.user-menu-btn:active {
    background: #f0f0f0;
}

.user-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 16px;
    width: 200px;
    background: #fff;
    border: 1px solid #d4dad6;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(28, 43, 40, 0.12);
    padding: 4px;
    flex-direction: column;
    z-index: 300;
}

.user-menu.is-open {
    display: flex;
}

.user-menu .user-chip,
.user-menu .logout-btn {
    display: flex;
    align-items: center;
    width: 100%;
    margin-left: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    padding: 10px;
    font-size: 13px;
    text-align: left;
    white-space: nowrap;
}

.user-menu .user-chip {
    border-bottom: 1px solid var(--line);
    border-radius: 6px 6px 0 0;
    color: var(--text-2);
}

.user-menu .logout-btn {
    color: var(--title-fg);
    cursor: pointer;
}

.user-menu .logout-btn:hover {
    background: var(--blue-softer);
    color: #277a3a;
}

.nav-toggle-btn {
    display: none;
}

.nav-divider {
    display: none;
}

.mobile-sidebar {
    display: none;
}

.mobile-back-btn {
    display: none;
}

.autoplay-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--title-fg);
    white-space: nowrap;
    background: #fff;
    border: 1px solid #d4dad6;
    border-radius: 14px;
    padding: 4px 10px;
}

.ghost-btn,
.danger-btn,
.icon-btn,
.play-btn {
    font-family: inherit;
    cursor: pointer;
}

.ghost-btn {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text-2);
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 13px;
}

.ghost-btn:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.danger-btn {
    border: 1px solid #f3c6cb;
    background: #fff;
    color: var(--danger);
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 12px;
}

.danger-btn:hover {
    background: #fde7e9;
}

.music-slot-pane {
    width: 360px;
    min-width: 280px;
    max-width: 560px;
}

.music-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
}

.slot-create {
    padding: 10px 12px 12px;
    border-bottom: 1px solid var(--line);
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.slot-create.is-hidden {
    display: none;
}

.slot-create label,
.music-slot-meta label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--muted);
}

.slot-create input[type="text"],
.slot-create input[type="time"],
.slot-create input[type="date"],
.slot-create select,
.slot-name-input,
.music-slot-meta input[type="time"],
.music-slot-meta input[type="date"] {
    height: 32px;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 0 8px;
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    background: #fff;
}

.slot-create-times,
.music-slot-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.slot-create-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.slot-create-hint {
    margin: 0;
    font-size: 11px;
    color: var(--muted);
}

.day-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.day-chip {
    width: 28px;
    height: 28px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 14px;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    padding: 0;
}

.day-chip.is-on {
    background: var(--blue-softer);
    border-color: var(--blue);
    color: var(--blue-hover);
    font-weight: 600;
}

.slot-item {
    width: 100%;
    display: block;
    border: 0;
    border-bottom: 1px solid #f0f0f0;
    background: var(--surface);
    text-align: left;
    padding: 12px 14px;
    cursor: pointer;
    font-family: inherit;
}

.slot-item:hover {
    background: #f7f7f7;
}

.slot-item.is-active {
    background: var(--blue-softer);
}

.slot-item.is-now {
    box-shadow: inset 3px 0 0 var(--ok);
}

.slot-item.is-off {
    opacity: 0.62;
}

.slot-item.is-dragging {
    opacity: 0.4;
}

.slot-item.slot-drop-before {
    box-shadow: inset 0 2px 0 var(--blue);
}

.slot-item.slot-drop-after {
    box-shadow: inset 0 -2px 0 var(--blue);
}

.slot-item-top {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.slot-item-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.slot-item-time {
    font-size: 12px;
    color: var(--muted);
    flex-shrink: 0;
}

.slot-item-preview {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.slot-item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.music-main {
    background: #f7f8f8;
}

.music-slot-header {
    background: var(--surface);
}

.music-slot-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slot-name-input {
    flex: 1;
    height: 36px;
    font-size: 16px;
    font-weight: 600;
    border-color: transparent;
    padding-left: 4px;
}

.slot-name-input:hover,
.slot-name-input:focus {
    border-color: var(--line);
}

.enable-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-2);
    white-space: nowrap;
}

.player-card {
    display: flex;
    gap: 18px;
    margin: 16px 18px 0;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    flex-shrink: 0;
}

.player-cover {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--blue-softer);
    flex-shrink: 0;
}

.player-cover.is-playing svg {
    animation: spin-disc 8s linear infinite;
}

@keyframes spin-disc {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.player-info {
    flex: 1;
    min-width: 0;
}

.player-kicker {
    font-size: 11px;
    color: var(--ok);
    font-weight: 600;
}

.player-title {
    margin-top: 2px;
    font-size: 16px;
    font-weight: 600;
}

.player-artist {
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted);
}

.player-progress {
    margin-top: 10px;
}

.player-progress input[type="range"],
.vol-switch input[type="range"] {
    width: 100%;
    accent-color: var(--blue);
}

.player-time {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--muted);
}

.player-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.icon-btn {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 4px;
    height: 32px;
    padding: 0 10px;
    font-size: 12px;
    color: var(--text-2);
}

.play-btn {
    height: 36px;
    min-width: 72px;
    border: 0;
    border-radius: 18px;
    background: var(--blue);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 0 18px;
}

.play-btn:hover {
    background: var(--blue-hover);
}

.loop-switch,
.vol-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
    margin-left: 8px;
}

.vol-switch input {
    width: 90px;
}

.track-section {
    flex: 1;
    min-height: 0;
    margin: 14px 18px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.track-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

.track-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}

.preset-dropdown {
    position: relative;
}

.preset-dropdown-btn {
    height: 32px;
    font-size: 13px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 28px 0 10px;
    min-width: 120px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.preset-dropdown-btn:hover {
    border-color: var(--blue);
}

.preset-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    min-width: 220px;
    max-height: 280px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    margin-top: 4px;
}

.preset-dropdown-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid #f3f3f3;
}

.preset-dropdown-item:last-child {
    border-bottom: 0;
}

.preset-dropdown-item:hover {
    background: #f7f7f7;
}

.preset-dropdown-item-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preset-dropdown-item-count {
    color: var(--muted);
    font-size: 12px;
    flex-shrink: 0;
}

.preset-dropdown-item-del {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1;
    padding: 0;
}

.preset-dropdown-item-del:hover {
    background: #fee;
    color: #c33;
}

.preset-dropdown-empty {
    padding: 10px 12px;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

.preset-dropdown-menu.is-hidden {
    display: none;
}

.preset-track-list {
    max-height: 200px;
    overflow: auto;
    margin: 12px 0;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.preset-track-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #f3f3f3;
    font-size: 13px;
}

.preset-track-item:last-child {
    border-bottom: 0;
}

.preset-track-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.track-list {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

.track-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: 0;
    border-bottom: 1px solid #f3f3f3;
    background: transparent;
    padding: 10px 14px;
    text-align: left;
    font-family: inherit;
}

.track-row:hover {
    background: #f7f7f7;
}

.track-row.is-current {
    background: var(--blue-softer);
}

.track-index {
    width: 22px;
    font-size: 12px;
    color: var(--muted);
    text-align: right;
}

.track-body {
    flex: 1;
    min-width: 0;
}

.track-name {
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.track-meta {
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted);
}

.track-row-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.track-row-actions button {
    height: 26px;
    padding: 0 8px;
    font-size: 12px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(28, 43, 40, 0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    padding: 24px;
}

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

.modal-card {
    width: min(640px, 100%);
    max-height: min(80vh, 720px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 18px 48px rgba(28, 43, 40, 0.16);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 16px;
}

.modal-lead {
    margin: 6px 16px 10px;
    font-size: 12px;
    color: var(--muted);
}

.modal-body {
    padding: 0 16px 10px;
}

.modal-search {
    margin: 0 16px 10px;
    max-width: none;
}

.library-tabs {
    display: flex;
    gap: 2px;
    margin: 0 16px 8px;
    border-bottom: 1px solid var(--line);
}

.library-tabs button {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.library-tabs button:hover {
    color: var(--text);
}

.library-tabs button.is-active {
    color: var(--blue);
    font-weight: 600;
    border-bottom-color: var(--blue);
}

.library-tab-count {
    margin-left: 4px;
    font-size: 12px;
    color: var(--muted);
}

.library-list {
    flex: 1;
    overflow: auto;
    border-top: 1px solid var(--line);
    min-height: 180px;
}

.library-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid #f3f3f3;
    font-size: 13px;
    cursor: pointer;
    position: relative;
}

.library-item:hover {
    background: #f7f7f7;
}

.library-item input {
    margin-top: 3px;
}

.library-item > div {
    flex: 1;
    min-width: 0;
}

.library-item-name {
    font-weight: 600;
}

.library-item-meta {
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted);
}

.library-del-btn {
    flex-shrink: 0;
    padding: 4px 10px;
    font-size: 12px;
    height: 28px;
    align-self: center;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--line);
}

.modal-footer.library-footer {
    justify-content: space-between;
}

.library-m3u8-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.library-m3u8-label {
    color: var(--text, #222);
    font-weight: 600;
    white-space: nowrap;
}

.library-m3u8-bar input[type="number"] {
    width: 90px;
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 13px;
}

.library-m3u8-hint {
    font-size: 12px;
    color: var(--muted);
}

.library-m3u8-bar.is-hidden {
    display: none;
}

.library-footer-actions {
    display: flex;
    gap: 8px;
}

.upload-dialog {
    width: min(420px, 100%);
    max-height: none;
}

.upload-filename {
    margin: 0 16px 10px;
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-bar {
    margin: 0 16px;
    height: 8px;
    background: #ececec;
    border-radius: 4px;
    overflow: hidden;
}

.upload-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--blue);
    border-radius: 4px;
    transition: width 0.12s ease;
}

.upload-bar-fill.is-indeterminate {
    width: 36%;
    animation: upload-slide 1s ease-in-out infinite;
}

@keyframes upload-slide {
    0% {
        transform: translateX(-120%);
    }
    100% {
        transform: translateX(320%);
    }
}

.upload-stats {
    display: flex;
    justify-content: space-between;
    margin: 8px 16px 0;
    font-size: 12px;
    color: var(--muted);
}

#upload-modal {
    z-index: 30;
}

@media (max-width: 900px) {
    .title-nav a {
        padding: 6px 8px;
    }

    .player-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .track-section-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

.template-slot-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.template-slot-item:hover {
    background: var(--blue-softer);
}

.template-slot-item input[type="checkbox"] {
    margin: 0;
}

.template-slot-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
}

.template-slot-time {
    font-size: 12px;
    color: var(--muted);
}

.template-slot-list {
    max-height: 240px;
    overflow-y: auto;
    margin: 12px 0;
    padding: 0 16px;
}

.template-manage-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 6px;
    margin-bottom: 8px;
    background: var(--surface);
}

.template-manage-info {
    flex: 1;
    min-width: 0;
}

.template-manage-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.template-manage-meta {
    font-size: 12px;
    color: var(--muted);
}

.template-manage-list {
    max-height: 320px;
    overflow-y: auto;
    margin: 12px 0;
}

.empty-hint {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    padding: 24px 16px;
}

#save-template-modal label {
    display: block;
    padding: 0 16px;
    margin-bottom: 8px;
}

#save-template-modal label:first-of-type {
    margin-top: 8px;
}

#save-template-modal input[type="text"] {
    width: 100%;
    margin-top: 4px;
}

@media (max-width: 768px) {
    .title-bar {
        position: relative;
        height: 46px;
        padding: 0 10px;
        gap: 8px;
    }

    .title-brand { min-width: 0; flex-shrink: 1; }
    .title-text h1 { font-size: 13px; }
    .title-text p, .title-search, .agent-pill { display: none; }

    .title-heading { max-width: min(60%, 320px); }
    .title-heading h1 { font-size: 14px; }
    .title-heading p { display: none; }
    .home-btn { width: 32px; height: 32px; }
    .title-logo { height: 30px; max-width: 112px; }

    body {
        padding-bottom: 0;
    }

    .title-meta {
        position: static;
        left: auto;
        right: auto;
        bottom: auto;
        height: auto;
        justify-content: flex-start;
        background: transparent;
        border: 0;
        padding: 0;
        margin-left: auto;
    }

    .user-menu-btn {
        display: none;
    }

    .user-menu {
        display: block;
        position: static;
        top: auto;
        right: auto;
        width: auto;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        padding: 0;
    }

    .nav-toggle-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        border: 1px solid #d4dad6;
        border-radius: 4px;
        background: #fff;
        color: var(--title-fg);
        cursor: pointer;
        flex-shrink: 0;
    }

    .nav-toggle-btn:active { background: #f0f0f0; }

    .title-nav {
        display: none;
        position: absolute;
        top: 46px;
        left: 0;
        right: 0;
        background: #fff;
        border-bottom: 1px solid #d8ddd9;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        flex-direction: column;
        z-index: 200;
        padding: 6px 0;
    }

    .title-nav.is-open { display: flex; }

    .title-nav a {
        font-size: 14px;
        padding: 10px 16px;
        border-radius: 0;
    }

    .title-nav a:hover { background: var(--blue-softer); }

    .title-nav a.is-active {
        background: var(--blue-softer);
        font-weight: 600;
        box-shadow: none;
        color: var(--blue);
    }

    .nav-divider {
        display: block;
        height: 1px;
        background: var(--line);
        margin: 4px 16px;
    }

    .title-nav .user-chip {
        margin-left: 0;
        border-radius: 0;
        border: 0;
        border-bottom: 1px solid var(--line);
        padding: 10px 16px;
        font-size: 14px;
    }

    .title-nav .logout-btn {
        margin-left: 0;
        border: 0;
        border-radius: 0;
        padding: 10px 16px;
        font-size: 14px;
        text-align: left;
    }

    .app-body {
        position: relative;
        height: calc(100vh - 46px);
        overflow: hidden;
    }

    .folder-pane,
    .list-pane,
    .reading-pane,
    .splitter {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100% !important;
        transition: transform 0.2s ease;
    }

    .folder-pane { z-index: 1; }
    .list-pane { z-index: 2; }
    .reading-pane { z-index: 3; }

    .splitter { display: none; }

    .app-body:not(#music-app-body)[data-mobile-panel="list"] .folder-pane,
    .app-body:not(#music-app-body)[data-mobile-panel="list"] .reading-pane,
    .app-body:not(#music-app-body)[data-mobile-panel="chat"] .folder-pane,
    .app-body:not(#music-app-body)[data-mobile-panel="chat"] .list-pane {
        transform: translateX(-100%);
    }

    .app-body:not(#music-app-body)[data-mobile-panel="folder"] .list-pane,
    .app-body:not(#music-app-body)[data-mobile-panel="folder"] .reading-pane {
        transform: translateX(100%);
    }

    .app-body:not(#music-app-body):not([data-mobile-panel]) .list-pane,
    .app-body:not(#music-app-body):not([data-mobile-panel]) .reading-pane {
        transform: translateX(100%);
    }

    .mobile-sidebar {
        display: flex;
        position: fixed;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        z-index: 10;
        flex-direction: column;
        gap: 2px;
        background: rgba(255,255,255,0.95);
        border-radius: 0 8px 8px 0;
        box-shadow: 2px 0 8px rgba(0,0,0,0.1);
        padding: 4px 0;
    }

    .sidebar-icon {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 8px 10px;
        border: none;
        background: none;
        color: var(--text-3);
        font-size: 10px;
        cursor: pointer;
        border-radius: 0 6px 6px 0;
        transition: all 0.15s;
    }

    .sidebar-icon:active { background: var(--bg-2); }
    .sidebar-icon.is-active { color: var(--blue); background: var(--blue-softer); }

    .mobile-back-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        border: 1px solid var(--line);
        border-radius: 4px;
        background: #fff;
        color: var(--text-2);
        cursor: pointer;
        flex-shrink: 0;
    }

    .mobile-back-btn:active { background: var(--bg-2); }

    .list-header { gap: 6px; }

    .music-slot-pane {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100% !important;
        z-index: 1;
        transition: transform 0.2s ease;
    }

    .music-main {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100% !important;
        z-index: 2;
        transform: translateX(100%);
        transition: transform 0.2s ease;
    }

    #music-app-body[data-mobile-panel="detail"] .music-slot-pane {
        transform: translateX(-100%);
    }

    #music-app-body[data-mobile-panel="detail"] .music-main {
        transform: translateX(0);
    }

    #music-app-body:not([data-mobile-panel]) .music-main {
        transform: translateX(100%);
    }

    .music-slot-header .mobile-back-btn {
        margin-right: 8px;
    }

    .music-slot-title-row {
        flex-wrap: wrap;
    }
}
