@charset "UTF-8";
/* Modern Glassmorphism Audio Editor CSS */

/* ====== NỀN & BODY ====== */
body {
    background: linear-gradient(120deg, #f3f6ff 0%, #e3ebff 100%);
    min-height: 100vh;
    font-family: 'Segoe UI', Arial, sans-serif;
    color: #2a3554;
    letter-spacing: 0;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    z-index: 0;
    inset: 0;
    background: url('../img/bg-blur.jpg') center/cover no-repeat;
    opacity: 0.13;           /* Độ mờ hình nền (0.1 - 0.3 là đẹp) */
    filter: blur(12px);      /* Độ blur, chỉnh cao/thấp tùy ý */
    pointer-events: none;    /* Không ảnh hưởng thao tác */
    transition: opacity 0.4s;
}
.selected-region {
    border: 2px solid #f25252 !important;
    box-shadow: 0 0 0 2px #ffd6d6;
}

/* ====== HEADER ====== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 70px;
    background:
        linear-gradient(90deg, rgba(29, 34, 47, 0.98) 0%, rgba(52, 59, 87, 0.98) 58%, rgba(84, 75, 130, 0.98) 100%) !important;
    box-shadow: 0 8px 28px #1b20301f;
    border-bottom: 1px solid #ffffff1c;
}
.brand-lockup img {
    height: 42px;
    width: 42px;
    object-fit: contain;
    box-shadow: 0 8px 24px #0b102433;
    border-radius: 8px;
}
.brand-title {
    font-size: 1.34rem;
    font-weight: 800;
    letter-spacing: 0;
    color: #f7faff;
    white-space: nowrap;
}
.app-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}
.app-nav a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 700;
    opacity: 0.94;
    transition: background .16s, color .16s, transform .16s;
    text-decoration: none;
}
.app-nav a:hover {
    background: rgba(255,255,255,0.12);
    color: #ffffff !important;
    transform: translateY(-1px);
}

/* ====== TABS ====== */
.nav-tabs {
    background: rgba(255,255,255,0.82);
    border-radius: 8px;
    padding: 7px;
    box-shadow: 0 8px 28px #9fb4d21f;
    border: none;
    gap: 6px;
}
.nav-tabs .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1.02rem;
    padding: 10px 24px;
    border-radius: 8px !important;
    background: none;
    border: none;
    color: #3e4a77;
    transition: background .2s ease, color .2s ease, box-shadow .2s ease, transform .2s ease;
    margin-right: 0;
    font-weight: 750;
}
.nav-tabs .nav-link.active, .nav-tabs .nav-link:focus {
    background: linear-gradient(120deg, #ecf3ff 0%, #ffffff 100%);
    color: #6b44d8 !important;
    border: none;
    box-shadow: 0 8px 18px #6880bd26;
    transform: translateY(-1px);
}
.tab-pane.fade {
    transform: translateY(8px);
    transition: opacity .22s ease, transform .22s ease;
}
.tab-pane.fade.show {
    transform: translateY(0);
}

/* ====== FORM VÀ INPUT ====== */
.form-control, .form-select {
    border-radius: 8px;
    border: 1.5px solid #e2e9f5;
    font-size: 1.01rem;
    background: rgba(251,253,255,0.94);
    box-shadow: 0 2px 8px #c6d9fa12;
    transition: border-color .16s, box-shadow .16s;
}
.form-control:focus, .form-select:focus {
    border-color: #7a3df0;
    box-shadow: 0 0 6px #aab5e9;
}

/* ====== TRACKS VÀ TIMELINE ====== */
:root {
    --track-header-width: 188px;
}
#timeline {
    position: relative;
    min-height: 300px;
    background: #15181f !important;
    border-color: #2a3240 !important;
    color: #dce6f7;
    box-shadow: inset 0 1px 0 #ffffff12, inset 0 -1px 0 #0006;
}
.mix-session-toolbar,
.mix-edit-toolbar {
    position: sticky;
    left: 0;
    z-index: 20;
    width: max-content;
    max-width: calc(100vw - 32px);
    background: #eef3ff;
    color: #25304b;
    border: 1px solid #cfd9ef;
    border-radius: 8px;
    padding: 8px 10px;
    box-shadow: 0 8px 22px #00000020;
}
.mix-edit-toolbar {
    background: #f7f9ff;
}
.mix-session-ruler {
    display: grid;
    grid-template-columns: var(--track-header-width) max-content;
    min-height: 34px;
    margin-bottom: 6px;
    border: 1px solid #2d3441;
    border-radius: 6px;
    overflow: visible;
    background: #11141a;
}
.mix-ruler-left {
    position: sticky;
    left: 0;
    z-index: 12;
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: #20242d;
    border-right: 1px solid #343b48;
    color: #aeb9ca;
    font-size: 0.84rem;
    font-weight: 700;
    text-transform: uppercase;
}
.mix-ruler-grid {
    position: relative;
    min-height: 34px;
    background:
        repeating-linear-gradient(90deg, #ffffff20 0 1px, transparent 1px 80px),
        linear-gradient(180deg, #181c24 0%, #11141a 100%);
}
.ruler-tick {
    position: absolute;
    top: 8px;
    transform: translateX(-1px);
    color: #aeb9ca;
    font-size: 0.78rem;
    line-height: 1;
    padding-left: 5px;
    border-left: 1px solid #6d7684;
    white-space: nowrap;
}
.track-timeline {
    position: relative;
    display: grid;
    grid-template-columns: var(--track-header-width) max-content;
    margin-bottom: 6px;
    background: #171b22;
    border-radius: 6px;
    border: 1px solid #303846;
    min-height: 64px;
    padding: 0;
    box-shadow: none;
    transition: border-color .15s, box-shadow .15s;
    overflow: visible;
}
.track-timeline:hover {
    border-color: color-mix(in srgb, var(--track-accent, #34c486) 55%, #3b4453);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--track-accent, #34c486) 32%, transparent);
}
.track-controls {
    position: sticky;
    left: 0;
    z-index: 14;
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: var(--track-header-width);
    min-width: var(--track-header-width);
    padding: 10px 10px 9px;
    background: linear-gradient(180deg, #242933 0%, #1d222b 100%);
    border-right: 1px solid #384150;
    color: #e7eefc;
    font-size: 0.86rem;
}
.track-title-row {
    display: grid;
    gap: 2px;
}
.track-number {
    color: var(--track-accent, #34c486);
    font-size: 0.98rem;
    font-weight: 800;
    line-height: 1.15;
}
.track-file-name {
    color: #cbd5e5;
    font-size: 0.78rem;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.track-button-row {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.track-slider-row {
    display: grid;
    grid-template-columns: 1fr 72px;
    gap: 6px;
    align-items: center;
    color: #b7c1d2;
}
.track-slider-row b {
    color: #ffffff;
    font-weight: 700;
}
.track-slider-row input[type="range"] {
    width: 72px;
    accent-color: var(--track-accent, #34c486);
}
.track-controls .btn {
    background: #262d38;
    color: #dce6f7;
    border-color: #606b7a;
}
.track-controls .btn:hover,
.track-controls .btn:focus {
    background: #323b49;
    color: #ffffff;
    border-color: var(--track-accent, #34c486);
}
.track-lane {
    position: relative;
    overflow-x: visible;
    min-height: 100%;
    padding: 8px 0;
    background:
        repeating-linear-gradient(90deg, #ffffff16 0 1px, transparent 1px 80px),
        repeating-linear-gradient(90deg, transparent 0 399px, #ffffff24 399px 400px),
        linear-gradient(180deg, #20252e 0%, #191d24 100%);
}
.track-lane::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg, #00000030, transparent 36px);
}
.track-clip {
    position: relative;
    min-width: 260px;
    border: 1px solid color-mix(in srgb, var(--track-accent, #34c486) 72%, #ffffff);
    border-radius: 5px;
    background: var(--track-clip-bg, rgba(17, 106, 74, 0.92));
    box-shadow: inset 0 1px 0 #ffffff20, 0 6px 14px #00000030;
    transition: box-shadow .15s, transform .15s;
    overflow: hidden;
}
.track-clip.is-dragging {
    box-shadow: 0 0 0 2px #fff2, 0 12px 24px #00000055;
}
.track-clip.mix-selected-clip::after,
.single-cutter-clip.mix-selected-clip::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 24px;
    bottom: 24px;
    z-index: 4;
    background: linear-gradient(90deg, rgba(52, 196, 134, 0.22), rgba(52, 196, 134, 0.12));
    box-shadow: inset 0 0 0 2px rgba(52, 196, 134, 0.55);
    pointer-events: none;
}
.clip-titlebar {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 24px;
    padding: 0 9px;
    background: linear-gradient(180deg, #ffffff20 0%, #00000016 100%);
    color: #f8fbff;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    cursor: grab;
    touch-action: none;
    user-select: none;
}
.clip-titlebar span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.track-waveform {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    height: 54px;
    cursor: crosshair;
    background: transparent;
    border-radius: 0;
    border: none;
    box-shadow: none;
    margin-bottom: 0;
    transition: border-color .15s;
}
.volume-automation {
    position: absolute;
    left: 0;
    right: 0;
    top: 24px;
    z-index: 8;
    pointer-events: none;
}
.volume-automation svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}
.automation-line-shadow,
.automation-line,
.automation-line-hit {
    fill: none;
    vector-effect: non-scaling-stroke;
}
.automation-line-shadow {
    stroke: rgba(0,0,0,0.55);
    stroke-width: 5;
}
.automation-line {
    stroke: #fff3a8;
    stroke-width: 2.4;
    filter: drop-shadow(0 0 5px rgba(255, 219, 97, 0.45));
}
.automation-line-hit {
    stroke: transparent;
    stroke-width: 16;
    pointer-events: stroke;
    cursor: copy;
}
.automation-node {
    fill: #fff7b8;
    stroke: #222734;
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
    pointer-events: all;
    cursor: ns-resize;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.45));
}
.automation-node:hover {
    fill: #ffffff;
    stroke: #ffd15f;
}
.dragging-automation,
.dragging-automation * {
    cursor: ns-resize !important;
    user-select: none;
}
.wavesurfer-timeline {
    background: rgba(6, 10, 16, 0.3);
}
.clip-drag-handle,
.clip-titlebar {
    cursor: grab;
}
.dragging-track,
.dragging-track * {
    cursor: grabbing !important;
    user-select: none;
}
.track-waveform:active, .track-waveform:focus {
    outline: 1px solid var(--track-accent, #34c486);
}
.track-muted {
    opacity: 0.55;
    filter: grayscale(0.65) brightness(0.88);
}
.segment-selected, .wavesurfer-region {
    background: rgba(79, 166, 255, 0.18) !important;
    border: 2px dashed #4fa6ff !important;
    transition: background .18s, border-color .18s, box-shadow .18s;
}
.wavesurfer-region.selected-all-region {
    background: rgba(52, 196, 134, 0.48) !important;
    border: 2px solid #34c486 !important;
    box-shadow: inset 0 0 0 999px rgba(52, 196, 134, 0.16), inset 0 0 0 2px #d3ffe660, 0 0 18px #34c48670;
    z-index: 7 !important;
}
.wavesurfer-region.selected-region {
    border: 2px solid #ffd15f !important;
    box-shadow: inset 0 0 0 2px #fff6c850, 0 0 14px #ffd15f66;
}
.wavesurfer-region[data-label]::after {
    content: attr(data-label);
    display: inline-block;
    position: absolute;
    top: -26px;
    left: 10px;
    background: #20242d;
    color: #fff;
    padding: 1px 10px;
    border-radius: 6px;
    font-size: 0.85em;
    opacity: 0.92;
    pointer-events: none;
}

/* ====== SINGLE FILE CUTTER ====== */
:root {
    --cutter-header-width: 188px;
}
.single-cutter-shell {
    display: grid;
    gap: 10px;
}
.single-cutter-topbar,
.single-cutter-toolbar,
.single-cutter-editbar,
.cutter-exportbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: rgba(248,251,255,0.96);
    border: 1px solid #dbe5f4;
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 8px 22px #9fb4d21f;
}
.single-cutter-topbar {
    justify-content: space-between;
}
.single-cutter-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.single-cutter-title > i {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #e6fff4;
    background: linear-gradient(135deg, #1f9f72 0%, #5967d8 100%);
    box-shadow: 0 8px 18px #255f7430;
}
.single-cutter-title h5 {
    color: #24304c;
    font-weight: 850;
}
.cutter-file-name {
    display: block;
    max-width: min(58vw, 820px);
    color: #64748b;
    font-size: 0.88rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.single-cutter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cutter-file-picker {
    background: #252b35;
    color: #e9f0fb;
    border-color: #657286;
}
.single-cutter-toolbar,
.single-cutter-editbar {
    background: #eef3ff;
}
.single-cutter-editbar {
    background: #f8fbff;
}
.tool-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    color: #25304b;
}
.tool-control span {
    font-size: 0.92rem;
    color: #40506d;
    font-weight: 650;
}
.tool-control b {
    min-width: 52px;
    color: #24304c;
    font-weight: 750;
}
.single-cutter-selected {
    color: #667085;
    font-weight: 650;
    min-width: 112px;
}
.single-cutter-editor {
    position: relative;
    overflow: auto;
    min-height: 262px;
    background: #15181f;
    border: 1px solid #2a3240;
    border-top: 8px solid #15181f;
    border-radius: 8px;
    color: #dce6f7;
    box-shadow: inset 0 1px 0 #ffffff12, inset 0 -1px 0 #0006;
}
.single-cutter-editor.is-file-dragover {
    border-color: #7fe3ad;
    box-shadow: inset 0 1px 0 #ffffff12, inset 0 -1px 0 #0006, 0 0 0 3px #7fe3ad4d;
}
.single-cutter-editor.is-file-dragover::after {
    content: "Thả file audio vào timeline";
    position: absolute;
    inset: 8px;
    z-index: 35;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #a8f5c9;
    border-radius: 8px;
    background: rgba(12, 18, 28, 0.72);
    color: #e9fff3;
    font-weight: 800;
    pointer-events: none;
}
.single-cutter-lane.is-file-dragover,
.single-cutter-clip.is-file-dragover {
    outline: 2px solid #7fe3ad;
    outline-offset: -2px;
}
.single-cutter-ruler {
    display: grid;
    grid-template-columns: var(--cutter-header-width) max-content;
    min-height: 36px;
    border-bottom: 1px solid #2e3644;
    background: #11141a;
}
.single-cutter-ruler-left {
    position: sticky;
    left: 0;
    z-index: 18;
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: #20242d;
    border-right: 1px solid #343b48;
    color: #aeb9ca;
    font-size: 0.84rem;
    font-weight: 800;
    text-transform: uppercase;
}
.single-cutter-ruler-grid {
    position: relative;
    min-height: 36px;
    background:
        repeating-linear-gradient(90deg, #ffffff20 0 1px, transparent 1px 80px),
        linear-gradient(180deg, #181c24 0%, #11141a 100%);
}
.single-cutter-track {
    display: grid;
    grid-template-columns: var(--cutter-header-width) max-content;
    min-height: 188px;
    border-bottom: 1px solid #2e3644;
}
.single-cutter-track-head {
    position: sticky;
    left: 0;
    z-index: 18;
    display: flex;
    flex-direction: column;
    gap: 9px;
    width: var(--cutter-header-width);
    min-width: var(--cutter-header-width);
    padding: 12px 10px;
    background: linear-gradient(180deg, #242933 0%, #1d222b 100%);
    border-right: 1px solid #384150;
    color: #e7eefc;
}
.single-cutter-track-head .track-file-name {
    max-width: 150px;
}
.single-cutter-lane {
    position: relative;
    min-width: 640px;
    padding: 12px 12px 34px 0;
    background:
        repeating-linear-gradient(90deg, #ffffff16 0 1px, transparent 1px 80px),
        repeating-linear-gradient(90deg, transparent 0 399px, #ffffff24 399px 400px),
        linear-gradient(180deg, #20252e 0%, #191d24 100%);
}
.single-cutter-clip {
    position: relative;
    min-width: 640px;
    border: 1px solid #7fe3ad;
    border-radius: 5px;
    background: rgba(17, 106, 74, 0.92);
    box-shadow: inset 0 1px 0 #ffffff20, 0 6px 14px #00000030;
    overflow: hidden;
}
.single-cutter-waveform {
    width: 100%;
    min-height: 70px;
    cursor: crosshair;
    background: transparent;
}
.single-cutter-waveform wave,
.single-cutter-waveform canvas {
    background: transparent !important;
}
.cutter-volume-automation {
    top: 24px;
}
.cutter-region-list {
    display: flex;
    align-items: stretch;
    gap: 8px;
    flex-wrap: wrap;
    min-height: 36px;
}
.cutter-region-chip {
    display: inline-grid;
    grid-template-columns: minmax(0, 1fr) 34px;
    align-items: stretch;
    min-width: 188px;
    max-width: 260px;
    border: 1px solid #d5deed;
    border-left: 4px solid #34c486;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 6px 16px #8ca4d014;
}
.cutter-region-chip.active {
    border-color: #ffd15f;
    box-shadow: 0 0 0 2px #ffd15f42, 0 8px 18px #8ca4d020;
}
.cutter-region-chip button {
    border: 0;
    background: transparent;
}
.chip-main {
    display: grid;
    gap: 1px;
    min-width: 0;
    padding: 7px 9px;
    text-align: left;
}
.chip-main b,
.chip-main span,
.chip-main small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chip-main b {
    color: #24304c;
    font-size: 0.88rem;
}
.chip-main span,
.chip-main small {
    color: #64748b;
    font-size: 0.76rem;
}
.chip-play {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #34a575;
    border-left: 1px solid #e3eaf5 !important;
}
.chip-play:hover,
.chip-main:hover {
    background: #f4f9ff;
}
.cutter-exportbar {
    background: rgba(255,255,255,0.9);
}
.mp3-inline {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #40506d;
    font-size: 0.9rem;
    font-weight: 700;
}

/* ====== ADVANCED CONVERTER ====== */
.convert-shell {
    display: grid;
    gap: 12px;
    padding: 12px;
}
.convert-topbar,
.convert-actionbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: rgba(248,251,255,0.96);
    border: 1px solid #dbe5f4;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 8px 22px #9fb4d21f;
}
.convert-topbar {
    justify-content: space-between;
}
.convert-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.convert-title > i {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #eff8ff;
    background: linear-gradient(135deg, #4667f2 0%, #35b88a 100%);
    box-shadow: 0 8px 18px #255f7430;
}
.convert-title h5 {
    color: #24304c;
    font-weight: 850;
}
.convert-title span {
    display: block;
    color: #64748b;
    font-size: 0.9rem;
}
.convert-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.convert-dropzone {
    display: grid;
    place-items: center;
    gap: 6px;
    min-height: 128px;
    border: 1.5px dashed #b9c8e4;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.82), rgba(238,245,255,0.82)),
        repeating-linear-gradient(135deg, transparent 0 12px, rgba(122,61,240,0.04) 12px 24px);
    color: #40506d;
    cursor: pointer;
    transition: border-color .16s, background .16s, box-shadow .16s;
}
.convert-dropzone:focus-visible {
    outline: 3px solid #7a3df040;
    outline-offset: 2px;
}
.convert-dropzone.is-dragover {
    border-color: #34c486;
    background: #ecfff6;
    box-shadow: inset 0 0 0 2px #34c48640;
}
.convert-file-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    color: #ffffff;
    background: #252b35;
    cursor: pointer;
    font-weight: 800;
    box-shadow: 0 8px 18px #22324d24;
}
.convert-file-trigger:hover {
    background: #303846;
}
.convert-file-trigger input[type="file"] {
    display: none;
}
.convert-dropzone small {
    color: #64748b;
    text-align: center;
}
.convert-queue {
    display: grid;
    gap: 8px;
}
.convert-empty {
    position: static;
    inset: auto;
    display: block;
    padding: 12px;
    border: 1px solid #dbe5f4;
    border-radius: 8px;
    background: rgba(255,255,255,0.72);
    color: #708097;
}
.convert-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) minmax(140px, 220px) auto auto auto;
    gap: 9px;
    align-items: center;
    padding: 9px;
    border: 1px solid #dbe5f4;
    border-left: 4px solid #7a8aa6;
    border-radius: 8px;
    background: rgba(255,255,255,0.88);
    box-shadow: 0 6px 16px #8ca4d014;
}
.convert-row[data-status="running"] {
    border-left-color: #4667f2;
}
.convert-row[data-status="done"] {
    border-left-color: #34c486;
}
.convert-row[data-status="error"] {
    border-left-color: #d14c5a;
}
.convert-row-index {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: #eef3ff;
    color: #40506d;
    font-weight: 850;
}
.convert-row-main {
    display: grid;
    gap: 2px;
    min-width: 0;
}
.convert-row-main b,
.convert-row-main span,
.convert-row-main small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.convert-row-main b {
    color: #24304c;
}
.convert-row-main span {
    color: #64748b;
    font-size: 0.82rem;
}
.convert-error {
    color: #c84a55;
}
.convert-row-progress,
.convert-progress {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #dfe7f4;
}
.convert-row-progress > div,
.convert-progress > div {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #4667f2, #34c486);
    transition: width .18s ease;
}
.convert-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 92px;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 800;
}
.convert-status.queued {
    background: #eef2fa;
    color: #637083;
}
.convert-status.running {
    background: #e7edff;
    color: #4667f2;
}
.convert-status.done {
    background: #e2f8ed;
    color: #25845b;
}
.convert-status.error {
    background: #ffeded;
    color: #c84a55;
}
.convert-settings-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.convert-panel {
    display: block;
    min-width: 0;
    padding: 12px;
    border: 1px solid #dbe5f4;
    border-radius: 8px;
    background: rgba(255,255,255,0.86);
    box-shadow: 0 8px 22px #9fb4d21a;
}
.convert-panel h6 {
    margin: 0 0 9px;
    color: #24304c;
    font-weight: 850;
}
.convert-inline-slider {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 54px;
    gap: 8px;
    align-items: center;
}
.convert-inline-slider input[type="range"] {
    width: 100%;
}
.convert-check {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #40506d;
    font-weight: 650;
}
.convert-check input {
    width: 17px;
    height: 17px;
    accent-color: #34c486;
}
.convert-two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}
.convert-two-cols label {
    display: grid;
    gap: 4px;
    color: #40506d;
    font-size: 0.9rem;
    font-weight: 650;
}
.convert-actionbar {
    background: rgba(255,255,255,0.92);
}
.convert-progress {
    flex: 1 1 240px;
    min-width: 180px;
}
#convertProgressText {
    min-width: 44px;
    color: #40506d;
    font-weight: 800;
}
.convert-results {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.convert-results-title {
    flex-basis: 100%;
    color: #24304c;
    font-weight: 850;
}
.convert-result-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 360px;
    border: 1px solid #b4eac8;
    border-radius: 8px;
    background: #f0fff8;
    color: #25845b;
    padding: 7px 10px;
    font-weight: 800;
}
.convert-result-pill span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.convert-result-pill small {
    color: #64748b;
    font-weight: 700;
}

/* ====== AI VOCAL SEPARATOR ====== */
.ai-separator-shell {
    display: grid;
    gap: 12px;
    padding: 12px;
}
.ai-separator-topbar,
.ai-separator-actionbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: rgba(248,251,255,0.96);
    border: 1px solid #dbe5f4;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 8px 22px #9fb4d21f;
}
.ai-separator-topbar {
    justify-content: space-between;
}
.ai-separator-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.ai-separator-title > i {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #f7fbff;
    background: linear-gradient(135deg, #7a3df0 0%, #4667f2 48%, #34c486 100%);
    box-shadow: 0 10px 22px #3d4fa435;
}
.ai-separator-title h5 {
    color: #24304c;
    font-weight: 850;
}
.ai-separator-title span {
    display: block;
    color: #64748b;
    font-size: 0.9rem;
}
.ai-separator-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.ai-separator-chip {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #dbe5f4;
    background: #eef3ff;
    color: #40506d;
    font-size: 0.82rem;
    font-weight: 850;
}
.ai-separator-chip.ready {
    background: #e2f8ed;
    border-color: #b8e8cd;
    color: #25845b;
}
.ai-separator-chip.warn {
    background: #fff6df;
    border-color: #f4dfaa;
    color: #9b6a16;
}
.ai-separator-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
    gap: 12px;
}
.ai-separator-import,
.ai-separator-settings,
.ai-stem-card {
    min-width: 0;
    border: 1px solid #dbe5f4;
    border-radius: 8px;
    background: rgba(255,255,255,0.88);
    box-shadow: 0 8px 22px #9fb4d21a;
}
.ai-separator-import {
    display: grid;
    gap: 10px;
    padding: 12px;
}
.ai-separator-settings {
    padding: 12px;
}
.ai-separator-settings h6 {
    margin: 0 0 9px;
    color: #24304c;
    font-weight: 850;
}
.ai-separator-setting-help {
    display: block;
    margin-top: 4px;
    color: #71809a;
    font-size: 0.76rem;
    line-height: 1.35;
}
.ai-separator-check-help {
    margin-left: 25px;
}
.ai-separator-dropzone {
    display: grid;
    place-items: center;
    gap: 8px;
    min-height: 170px;
    border: 1.5px dashed #b9c8e4;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.82), rgba(238,245,255,0.82)),
        repeating-linear-gradient(135deg, transparent 0 12px, rgba(70,103,242,0.045) 12px 24px);
    color: #40506d;
    transition: border-color .16s, background .16s, box-shadow .16s;
}
.ai-separator-dropzone.is-dragover {
    border-color: #34c486;
    background: #ecfff6;
    box-shadow: inset 0 0 0 2px #34c48640;
}
.ai-separator-file-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 11px 15px;
    border-radius: 8px;
    color: #ffffff;
    background: #252b35;
    cursor: pointer;
    font-weight: 850;
    box-shadow: 0 8px 18px #22324d24;
}
.ai-separator-file-trigger:hover {
    background: #303846;
}
.ai-separator-file-trigger input[type="file"] {
    display: none;
}
.ai-separator-dropzone small {
    color: #64748b;
    text-align: center;
    padding: 0 12px;
}
.ai-separator-filecard {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 420px);
    gap: 12px;
    align-items: center;
    padding: 11px;
    border-radius: 8px;
    background: #f7faff;
    border: 1px solid #e2e9f5;
}
.ai-separator-filecard > div {
    display: grid;
    gap: 2px;
    min-width: 0;
}
.ai-separator-filecard b,
.ai-separator-filecard span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ai-separator-filecard b {
    color: #24304c;
    font-weight: 850;
}
.ai-separator-filecard span {
    color: #64748b;
    font-size: 0.86rem;
}
.ai-separator-filecard audio,
.ai-stem-card audio {
    width: 100%;
    height: 38px;
}
.ai-separator-check {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #40506d;
    font-weight: 650;
}
.ai-separator-check input {
    width: 17px;
    height: 17px;
    accent-color: #4667f2;
}
.ai-separator-progress {
    flex: 1 1 260px;
    min-width: 220px;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #dfe7f4;
}
.ai-separator-progress > div {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #7a3df0, #4667f2, #34c486);
    transition: width .18s ease;
}
#separatorProgressText {
    min-width: 54px;
    color: #40506d;
    font-weight: 850;
}
.ai-separator-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.ai-stem-card {
    display: grid;
    gap: 10px;
    padding: 12px;
}
.ai-stem-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.ai-stem-card-head > div {
    display: grid;
    min-width: 0;
}
.ai-stem-card-head b {
    color: #24304c;
    font-weight: 850;
}
.ai-stem-card-head span {
    color: #64748b;
    font-size: 0.84rem;
}
.speech-text-shell .ai-separator-title > i {
    background: linear-gradient(135deg, #256fd9 0%, #22a6a6 55%, #34c486 100%);
}
.speech-text-shell .ai-separator-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr);
}
.speech-text-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.speech-text-settings-grid label,
.speech-text-glossary {
    display: grid;
    gap: 5px;
    min-width: 0;
    color: #34435f;
    font-size: .84rem;
    font-weight: 800;
}
.speech-text-settings-grid label:first-child {
    grid-column: 1 / -1;
}
.speech-text-settings-grid .form-select,
.speech-text-glossary .form-control {
    border-color: #d6e1f0;
    border-radius: 8px;
    color: #24304c;
    font-size: .9rem;
}
.speech-text-glossary {
    margin-top: 10px;
}
.speech-text-glossary > span small,
.speech-text-glossary > small {
    color: #71809a;
    font-size: .76rem;
    font-weight: 600;
}
.speech-text-glossary textarea {
    min-height: 64px;
    resize: vertical;
}
.speech-text-format-box {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding: 10px;
    border: 1px solid #dbe5f4;
    border-radius: 8px;
    background: #f7faff;
}
.speech-text-format-box > span,
.speech-text-note {
    color: #64748b;
    font-size: 0.86rem;
    font-weight: 700;
}
.speech-text-format-box > span {
    flex: 1 0 100%;
}
.speech-text-format-box .ai-separator-check {
    flex: 1 1 58px;
    justify-content: center;
    min-width: 58px;
}
.speech-text-note {
    display: block;
    margin-top: 8px;
    line-height: 1.4;
}
.speech-text-results {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid #dbe5f4;
    border-radius: 8px;
    background: rgba(255,255,255,0.92);
    box-shadow: 0 8px 22px #9fb4d21a;
}

/* ====== TEXT TO SPEECH ====== */
.tts-shell {
    --tts-blue: #256fd9;
    --tts-ink: #17233b;
    --tts-muted: #66758f;
    --tts-border: #d9e3ef;
    display: grid;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--tts-border);
    border-radius: 10px;
    background: #f6f9fc;
    color: var(--tts-ink);
}
.tts-header,
.tts-section-head,
.tts-section-head > div,
.tts-library-head,
.tts-library-head > div,
.tts-history-head,
.tts-heading,
.tts-health,
.tts-result,
.tts-result > div,
.tts-editor-meta,
.tts-voice-card-main,
.tts-voice-actions,
.tts-history-item,
.tts-history-actions,
.tts-history-head-actions,
.tts-result-actions,
.tts-history-badges {
    display: flex;
    align-items: center;
}
.tts-header {
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--tts-border);
}
.tts-heading { gap: 12px; min-width: 0; }
.tts-heading-icon,
.tts-result-icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 9px;
    background: var(--tts-blue);
    color: #fff;
    font-size: 1.25rem;
}
.tts-heading h5,
.tts-heading p,
.tts-section-head h6,
.tts-section-head p,
.tts-library-head h6,
.tts-library-head p,
.tts-history-head h6,
.tts-history-head p,
.tts-result h6,
.tts-result p {
    margin: 0;
}
.tts-heading h5 { font-weight: 850; color: var(--tts-ink); }
.tts-heading p,
.tts-section-head p,
.tts-library-head p,
.tts-history-head p,
.tts-result p { color: var(--tts-muted); font-size: .86rem; }
.tts-health { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.tts-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(290px, .75fr);
    gap: 16px;
}
.tts-editor,
.tts-settings,
.tts-library,
.tts-history,
.tts-result,
.tts-clone {
    border: 1px solid var(--tts-border);
    border-radius: 9px;
    background: #fff;
}
.tts-editor,
.tts-settings,
.tts-library,
.tts-history,
.tts-clone { padding: 16px; }
.tts-section-head,
.tts-library-head,
.tts-history-head { justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.tts-section-head > div,
.tts-library-head > div { gap: 10px; min-width: 0; }
.tts-step {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #eaf2fd;
    color: var(--tts-blue);
    font-size: .83rem;
    font-weight: 900;
}
.tts-section-head h6,
.tts-library-head h6,
.tts-history-head h6,
.tts-result h6 { color: var(--tts-ink); font-weight: 850; }
.tts-editor-head-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.tts-language-context {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid #cddbf0;
    border-radius: 7px;
    background: #f4f8fe;
    color: #315f9c;
    font-size: .78rem;
    font-weight: 800;
    white-space: nowrap;
}
.tts-import-button { position: relative; overflow: hidden; white-space: nowrap; }
.tts-import-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
#ttsText {
    width: 100%;
    min-height: 290px;
    resize: vertical;
    padding: 15px;
    border: 1px solid #cbd8e7;
    border-radius: 8px;
    outline: none;
    background: #fbfdff;
    color: var(--tts-ink);
    font: inherit;
    font-size: 1rem;
    line-height: 1.65;
    transition: border-color .18s ease, box-shadow .18s ease;
}
#ttsText:focus { border-color: var(--tts-blue); box-shadow: 0 0 0 3px #256fd91c; background: #fff; }
.tts-editor-meta { justify-content: space-between; gap: 12px; margin-top: 7px; color: var(--tts-muted); font-size: .82rem; }
#ttsCharacterCount.is-over { color: #c43b3b; }
.tts-find-replace {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) auto;
    gap: 8px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #edf1f5;
}
.tts-selected-voice {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 14px;
    padding: 10px;
    border: 1px solid #cddbf0;
    border-radius: 8px;
    background: #f5f9ff;
    color: var(--tts-ink);
    text-align: left;
}
.tts-selected-voice:hover { border-color: var(--tts-blue); }
.tts-selected-voice > span:nth-child(2) { display: grid; min-width: 0; }
.tts-selected-voice b,
.tts-selected-voice small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tts-selected-voice small { color: var(--tts-muted); }
.tts-avatar {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #dfeaf8;
    color: #1b5bac;
    font-size: .78rem;
    font-weight: 900;
    overflow: hidden;
}
.tts-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tts-avatar > span { display: inline-grid; place-items: center; width: 100%; height: 100%; }
.tts-setting-grid { display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(0, 1.14fr) minmax(0, .82fr); align-items: start; gap: 6px; }
.tts-setting-grid label,
.tts-setting-field { display: grid; gap: 4px; min-width: 0; color: #40506a; font-size: .76rem; font-weight: 780; }
.tts-setting-grid .form-select { min-width: 0; min-height: 38px; padding: .36rem 1.65rem .36rem .52rem; font-size: .75rem; line-height: 1.2; }
.tts-setting-grid label > small { min-height: 27px; color: var(--tts-muted); font-size: .64rem; font-weight: 550; line-height: 1.3; }
.tts-setting-picker {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 5px;
    min-height: 38px;
    padding: 5px 6px;
    border: 1px solid #ced9e7;
    border-radius: 7px;
    color: #33445f;
    background: #fff;
    text-align: left;
}
.tts-setting-picker:hover { border-color: var(--tts-blue); background: #f8fbff; }
.tts-setting-picker > i:first-child { color: var(--tts-blue); }
.tts-setting-picker > i:last-child { color: #8290a3; font-size: .75rem; }
.tts-setting-picker > span { display: grid; min-width: 0; }
.tts-setting-picker b,
.tts-setting-picker small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tts-setting-picker b { font-size: .72rem; }
.tts-setting-picker small { color: var(--tts-muted); font-size: .61rem; font-weight: 550; }
.tts-background-picker {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    width: 100%;
    margin-top: 10px;
    padding: 9px 10px;
    border: 1px solid var(--tts-border);
    border-radius: 8px;
    color: #33445f;
    background: #fbfcfe;
    text-align: left;
}
.tts-background-picker:hover,
.tts-background-picker.is-active { border-color: #a8c5ea; background: #f3f8ff; }
.tts-background-picker-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 7px; color: var(--tts-blue); background: #e8f2ff; }
.tts-background-picker > span:nth-child(2) { display: grid; min-width: 0; }
.tts-background-picker b,
.tts-background-picker small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tts-background-picker b { color: var(--tts-ink); font-size: .84rem; }
.tts-background-picker small { color: var(--tts-muted); font-size: .72rem; }
.tts-background-picker > i { color: #8290a3; font-size: .8rem; }
.tts-dictionary { margin-top: 14px; padding: 11px; border: 1px solid var(--tts-border); border-radius: 8px; background: #fbfcfe; }
.tts-dictionary summary { cursor: pointer; color: #33445f; font-size: .9rem; font-weight: 800; }
.tts-dictionary summary span { margin-left: 4px; color: var(--tts-blue); }
.tts-dictionary > p { margin: 8px 0; color: var(--tts-muted); font-size: .8rem; }
#ttsDictionaryRows { display: grid; gap: 7px; margin-bottom: 8px; }
.tts-dictionary-row { display: grid; grid-template-columns: minmax(0, 1fr) 32px; align-items: center; gap: 6px 8px; padding: 9px; border: 1px solid #e2e9f2; border-radius: 8px; background: #fff; }
.tts-dictionary-row > label { grid-column: 1; display: grid; gap: 4px; min-width: 0; }
.tts-dictionary-row > label > span { color: #52647c; font-size: .7rem; font-weight: 800; }
.tts-dictionary-row > i { grid-column: 1; justify-self: center; color: #7291b7; line-height: 1; }
.tts-dictionary-row > button {
    display: inline-grid;
    place-items: center;
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #efd0d0;
    border-radius: 7px;
    background: #fff5f5;
    color: #ad3939;
    line-height: 1;
}
.tts-dictionary-row > button i { display: grid; place-items: center; line-height: 1; }
.tts-create-button { width: 100%; min-height: 44px; margin-top: 14px; font-weight: 850; }
.tts-cancel-button { width: 100%; margin-top: 8px; }
.tts-progress { margin-top: 12px; }
.tts-progress > div { height: 8px; overflow: hidden; border-radius: 6px; background: #e3eaf2; }
.tts-progress > div > span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--tts-blue); transition: width .25s ease; }
.tts-progress p { margin: 5px 0 0; color: var(--tts-muted); font-size: .8rem; }
.tts-quota-note { margin: 12px 0 0; color: var(--tts-muted); font-size: .78rem; line-height: 1.4; }
.tts-quota-note i { color: #26936b; }
.tts-result { justify-content: space-between; gap: 14px; padding: 14px 16px; border-color: #b8decf; background: #f4fbf8; }
.tts-result > div { gap: 10px; min-width: 0; }
.tts-result-icon { width: 38px; height: 38px; background: #2a9872; }
.tts-result audio { flex: 1 1 320px; max-width: 520px; min-width: 220px; height: 38px; }
.tts-result-actions { gap: 8px; flex: 0 0 auto; }
.tts-clone-head,
.tts-clone-head > div,
.tts-clone-actions {
    display: flex;
    align-items: center;
}
.tts-clone-head { justify-content: space-between; gap: 14px; }
.tts-clone-head > div { gap: 10px; min-width: 0; }
.tts-clone-head h6,
.tts-clone-head p { margin: 0; }
.tts-clone-head h6 { color: var(--tts-ink); font-weight: 850; }
.tts-clone-head p { color: var(--tts-muted); font-size: .84rem; }
.tts-clone-icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: #e9f2fd;
    color: var(--tts-blue);
    font-size: 1.1rem;
}
.tts-clone-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid #edf1f5; }
.tts-clone-grid { display: grid; grid-template-columns: 1.35fr repeat(4, minmax(120px, .72fr)); gap: 9px; }
.tts-clone-grid label,
.tts-reference-text { display: grid; gap: 5px; color: #40506a; font-size: .82rem; font-weight: 750; }
.tts-reference-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, .7fr); align-items: center; gap: 12px; margin-top: 12px; }
.tts-reference-file {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 70px;
    padding: 10px 12px;
    border: 1px dashed #9fb6d4;
    border-radius: 8px;
    background: #f7faff;
    color: var(--tts-blue);
    cursor: pointer;
}
.tts-reference-file > i { font-size: 1.3rem; text-align: center; }
.tts-reference-file > span { display: grid; color: var(--tts-ink); }
.tts-reference-file small { color: var(--tts-muted); font-weight: 500; }
.tts-reference-file input { grid-column: 1 / -1; width: 100%; font-size: .78rem; color: var(--tts-muted); }
.tts-reference-grid audio { width: 100%; height: 40px; }
.tts-reference-text { margin-top: 12px; }
.tts-community-option { margin-top: 12px; padding: 12px; border: 1px solid #cfe0f4; border-radius: 9px; background: #f7fbff; }
.tts-community-toggle { display: flex; align-items: flex-start; gap: 9px; color: #31425b; cursor: pointer; }
.tts-community-toggle > input { flex: 0 0 auto; margin-top: 3px; }
.tts-community-toggle > span { display: grid; gap: 2px; }
.tts-community-toggle b { color: var(--tts-ink); font-size: .84rem; }
.tts-community-toggle small { color: var(--tts-muted); font-size: .75rem; font-weight: 500; line-height: 1.35; }
.tts-community-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #dce7f4; }
.tts-community-fields[hidden] { display: none; }
.tts-community-fields label { display: grid; gap: 5px; color: #40506a; font-size: .79rem; font-weight: 750; }
.tts-community-fields label > span small { color: var(--tts-muted); font-weight: 500; }
.tts-community-fields .tts-community-description { grid-column: span 2; }
.tts-community-fields .tts-community-consent { grid-column: 1 / -1; display: flex; align-items: flex-start; gap: 8px; padding: 9px; border-radius: 7px; background: #edf5ff; color: #34577f; line-height: 1.4; }
.tts-consent-box { display: grid; gap: 7px; margin-top: 12px; padding: 11px; border: 1px solid #e2d7b7; border-radius: 8px; background: #fffbef; }
.tts-consent-box label { display: flex; align-items: flex-start; gap: 8px; color: #5d5132; font-size: .82rem; line-height: 1.4; }
.tts-consent-box input { margin-top: 2px; }
.tts-clone-actions { justify-content: space-between; gap: 12px; margin-top: 12px; }
.tts-clone-actions > span { color: var(--tts-muted); font-size: .78rem; text-align: right; }
.tts-library-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    justify-content: stretch;
    width: 100%;
    gap: 12px;
}
.tts-library-head > .tts-library-title { display: flex; align-items: center; gap: 10px; width: 100%; }
.tts-library-title-copy { display: grid; min-width: 0; gap: 3px; }
.tts-library-heading-row { display: flex; align-items: center; gap: 9px; min-width: 0; flex-wrap: wrap; }
.tts-library-count {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    padding: 0 9px;
    border: 1px solid #cfe0f4;
    border-radius: 999px;
    background: #f3f8ff;
    color: #315f9c;
    font-size: .74rem;
    font-weight: 800;
    white-space: nowrap;
}
.tts-library-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 5px; border: 1px solid #dce7f4; border-radius: 9px; background: #f3f7fb; }
.tts-library-tabs button { min-width: 0; min-height: 42px; padding: 8px 11px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: 7px; color: #536781; background: transparent; font-size: .82rem; font-weight: 800; text-align: left; }
.tts-library-tabs button:hover { color: #245fae; background: #fff; }
.tts-library-tabs button.is-active { border-color: #bcd2ee; color: #1858b5; background: #fff; box-shadow: 0 3px 10px rgba(45, 81, 123, .08); }
.tts-library-tabs button b { min-width: 28px; padding: 2px 6px; border-radius: 999px; background: #e9f2fd; font-size: .7rem; text-align: center; }
.tts-library-head > .tts-library-tools {
    display: grid;
    grid-template-columns: minmax(300px, 1.8fr) repeat(5, minmax(160px, 1fr));
    align-items: stretch;
    justify-self: stretch;
    box-sizing: border-box;
    width: 100%;
    gap: 8px;
    padding: 10px;
    border: 1px solid #dce7f4;
    border-radius: 9px;
    background: linear-gradient(135deg, #f8fbff 0%, #f4f8fd 100%);
}
.tts-library-tools label { display: flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 10px; border: 1px solid #ced9e7; border-radius: 7px; background: #fff; color: #8491a3; }
.tts-library-tools input { min-width: 0; width: 100%; border: 0; outline: 0; font-size: .86rem; }
.tts-library-tools .form-select { min-width: 0; min-height: 38px; padding-right: 2.15rem; border-color: #ced9e7; background-color: #fff; color: #33445f; font-size: .82rem; font-weight: 650; }
.tts-voice-results { display: grid; gap: 16px; }
.tts-voice-group {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid #dce5ef;
    border-radius: 9px;
    background: #f9fbfd;
}
.tts-voice-group.is-featured { border-color: #c8dcf6; background: linear-gradient(135deg, #f2f7ff 0%, #f8fbff 58%, #fffaf0 100%); }
.tts-voice-group-head { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 9px; }
.tts-voice-group-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: #e4eefb; color: #2b67b5; }
.tts-voice-group.is-featured .tts-voice-group-icon { background: #fff0c9; color: #9a6711; }
.tts-voice-group-head > div { display: grid; min-width: 0; }
.tts-voice-group-head b { color: var(--tts-ink); font-size: .9rem; }
.tts-voice-group-head small { overflow: hidden; color: var(--tts-muted); font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.tts-voice-group-head > span:last-child { color: #536781; font-size: .74rem; font-weight: 800; white-space: nowrap; }
.tts-voice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tts-voice-card { display: grid; grid-template-rows: auto 1fr auto; min-height: 172px; padding: 12px; border: 1px solid var(--tts-border); border-radius: 8px; background: #fff; transition: border-color .18s ease, box-shadow .18s ease; }
.tts-voice-card:hover { border-color: #9ebae0; box-shadow: 0 7px 18px #335f9412; }
.tts-voice-card.is-featured { border-color: #c9dcf4; box-shadow: inset 3px 0 0 #7aa8df; }
.tts-voice-card.is-featured:hover { border-color: #7aa8df; box-shadow: inset 3px 0 0 #4d84c6, 0 8px 20px #335f9417; }
.tts-voice-card.is-selected { border-color: var(--tts-blue); box-shadow: 0 0 0 2px #256fd916; }
.tts-voice-card-main { gap: 9px; min-width: 0; }
.tts-voice-card-main > div { display: grid; min-width: 0; }
.tts-voice-card-main b { overflow: hidden; color: var(--tts-ink); text-overflow: ellipsis; white-space: nowrap; }
.tts-voice-card-main span:not(.tts-avatar) { color: var(--tts-muted); font-size: .78rem; }
.tts-voice-card-main em { margin-left: auto; padding: 2px 6px; border-radius: 5px; background: #eaf2fd; color: #2565b6; font-size: .68rem; font-style: normal; font-weight: 800; }
.tts-voice-card-main em i { margin-right: 2px; }
.tts-voice-card-main em.is-pilot { border: 1px solid #ead49e; background: #fff8e8; color: #7a5811; }
.tts-voice-card-main em.is-community { border: 1px solid #c7e6dc; background: #effaf6; color: #23765c; }
.tts-voice-card > p { min-height: 36px; margin: 8px 0; color: var(--tts-muted); font-size: .8rem; line-height: 1.4; }
.tts-community-credit { display: block; margin: -3px 0 8px; overflow: hidden; color: #6b7d94; font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.tts-voice-actions { justify-content: flex-start; gap: 7px; padding-top: 9px; border-top: 1px solid #edf1f5; }
.tts-voice-actions > .btn { flex: 1 1 auto; min-height: 34px; }
.tts-preview-button,
.tts-history-actions button,
.tts-voice-delete,
.tts-voice-manage {
    display: inline-grid;
    place-items: center;
    width: auto;
    min-width: 32px;
    height: 32px;
    border: 1px solid #c8d7e9;
    border-radius: 7px;
    background: #f7faff;
    color: var(--tts-blue);
}
.tts-preview-button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 92px; padding: 0 10px; font-size: .78rem; font-weight: 800; }
.tts-preview-button:hover,
.tts-preview-button.is-playing { border-color: var(--tts-blue); background: var(--tts-blue); color: #fff; }
.tts-voice-delete { width: 34px; margin-left: 0; border-radius: 7px; border-color: #ead0d0; background: #fff8f8; color: #a64040; }
.tts-voice-delete:hover { background: #a64040; color: #fff; }
.tts-voice-manage { width: 34px; border-color: #c9d9ee; background: #f5f9ff; color: #2e66ae; }
.tts-voice-manage:hover { border-color: #2e66ae; background: #2e66ae; color: #fff; }
.tts-community-dialog { width: min(720px, calc(100vw - 28px)); max-width: none; padding: 0; border: 1px solid #d5e0ed; border-radius: 11px; color: var(--tts-ink); background: #fff; box-shadow: 0 24px 70px rgba(20, 38, 63, .28); }
.tts-community-dialog::backdrop { background: rgba(16, 29, 47, .5); backdrop-filter: blur(4px); }
.tts-community-dialog > form { padding: 16px; }
.tts-community-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 13px; border-bottom: 1px solid #e7edf4; }
.tts-community-dialog-head > div { display: flex; align-items: center; gap: 10px; }
.tts-community-dialog-head > div > span { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; color: #256fd9; background: #eaf3ff; }
.tts-community-dialog-head h6, .tts-community-dialog-head p { margin: 0; }
.tts-community-dialog-head h6 { font-weight: 850; }
.tts-community-dialog-head p { color: var(--tts-muted); font-size: .78rem; }
.tts-community-dialog-head > button { width: 34px; height: 34px; flex: 0 0 34px; padding: 0; display: grid; place-items: center; border: 1px solid #d8e1ec; border-radius: 7px; color: #52657c; background: #fff; line-height: 1; }
.tts-community-dialog-head > button i { display: grid; place-items: center; width: 100%; height: 100%; line-height: 1; }
.tts-community-dialog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.tts-community-dialog-grid label { display: grid; gap: 5px; color: #40506a; font-size: .8rem; font-weight: 750; }
.tts-community-dialog-grid .is-wide { grid-column: 1 / -1; }
.tts-community-dialog > form > .tts-community-consent { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; padding: 9px; border-radius: 7px; color: #34577f; background: #edf5ff; font-size: .78rem; }
.tts-community-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 15px; padding-top: 13px; border-top: 1px solid #e7edf4; }
.tts-settings-dialog { width: min(680px, calc(100vw - 28px)); }
.tts-pause-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.tts-pause-grid > label { display: grid; gap: 9px; padding: 11px; border: 1px solid #dce5ef; border-radius: 8px; background: #fbfcfe; }
.tts-pause-grid > label > span:first-child { display: grid; }
.tts-pause-grid b { color: var(--tts-ink); font-size: .84rem; }
.tts-pause-grid small { color: var(--tts-muted); font-size: .7rem; font-weight: 500; line-height: 1.35; }
.tts-number-control { display: grid; grid-template-columns: 34px minmax(58px, 74px) 38px 34px; align-items: center; justify-content: start; width: min(100%, 180px); overflow: hidden; border: 1px solid #cdd8e6; border-radius: 7px; background: #fff; }
.tts-number-control button { height: 36px; border: 0; color: #315f99; background: #f4f8fd; font-size: 1.05rem; }
.tts-number-control button:hover { background: #e7f1ff; }
.tts-number-control input { min-width: 0; height: 36px; padding: 0 4px; border: 0; outline: 0; color: #243b5a; background: #fff; text-align: center; font-weight: 800; }
.tts-number-control input::-webkit-inner-spin-button { display: none; }
.tts-number-control em { height: 36px; display: grid; place-items: center; padding: 0 5px; border-left: 1px solid #edf1f5; color: #74849a; font-size: .68rem; font-style: normal; white-space: nowrap; }
.tts-dialog-note { display: flex; align-items: flex-start; gap: 7px; margin: 12px 0 0; padding: 9px 10px; border-radius: 7px; color: #536781; background: #f2f6fb; font-size: .74rem; line-height: 1.4; }
.tts-dialog-note i { flex: 0 0 auto; margin-top: 1px; color: var(--tts-blue); }
.tts-background-upload { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; margin-top: 14px; padding: 12px; border: 1px dashed #a9bfdc; border-radius: 8px; color: #315f99; background: #f7faff; cursor: pointer; }
.tts-background-upload:hover { border-color: var(--tts-blue); background: #f0f6ff; }
.tts-background-upload > i { font-size: 1.3rem; }
.tts-background-upload > span { display: grid; }
.tts-background-upload b { color: var(--tts-ink); font-size: .84rem; }
.tts-background-upload small { color: var(--tts-muted); font-size: .72rem; }
.tts-background-upload input { grid-column: 1 / -1; width: 100%; font-size: .76rem; color: var(--tts-muted); }
.tts-background-preview { width: 100%; height: 40px; margin-top: 10px; }
.tts-background-volume { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .85fr); align-items: center; gap: 14px; margin-top: 12px; padding: 11px 12px; border: 1px solid #dce5ef; border-radius: 8px; background: #fff; }
.tts-background-volume > span:first-child { display: grid; }
.tts-background-volume b { color: var(--tts-ink); font-size: .84rem; }
.tts-background-volume small { color: var(--tts-muted); font-size: .7rem; }
.tts-background-volume > span:last-child { display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: center; gap: 9px; }
.tts-background-volume input { width: 100%; accent-color: var(--tts-blue); }
.tts-background-volume output { color: #245fae; font-size: .8rem; font-weight: 850; text-align: right; }
.tts-background-rights { display: flex; align-items: flex-start; gap: 9px; margin-top: 12px; padding: 10px; border: 1px solid #eadfbf; border-radius: 8px; color: #6b5b31; background: #fffbef; }
.tts-background-rights > i { flex: 0 0 auto; margin-top: 2px; color: #b07a12; }
.tts-background-rights b,
.tts-background-rights p { margin: 0; }
.tts-background-rights b { font-size: .82rem; }
.tts-background-rights p { margin-top: 2px; font-size: .72rem; line-height: 1.4; }
.tts-history-head { align-items: flex-start; }
.tts-history-head-actions { gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.tts-saved-counter { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 10px; border: 1px solid #cddbf0; border-radius: 7px; background: #f5f9ff; color: #405f87; font-size: .78rem; }
.tts-history-list { display: grid; }
.tts-history-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 162px;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 12px 2px;
    border-top: 1px solid #edf1f5;
}
.tts-history-item:first-child { border-top: 0; }
.tts-history-copy { display: grid; min-width: 0; flex: 1 1 auto; }
.tts-history-copy b { overflow: hidden; color: var(--tts-ink); text-overflow: ellipsis; white-space: nowrap; }
.tts-history-copy span,
.tts-history-copy small { color: var(--tts-muted); font-size: .78rem; }
.tts-history-status { display: inline-flex; align-items: center; justify-content: center; min-height: 28px; flex: 0 0 auto; padding: 4px 9px; border-radius: 6px; background: #eef2f6; color: #5b687b; font-size: .73rem; font-weight: 800; white-space: nowrap; }
.tts-history-status.complete { background: #e6f5ee; color: #207755; }
.tts-history-status.processing { background: #eaf2fd; color: #205fae; }
.tts-history-status.error { background: #f7e8e8; color: #aa3535; }
.tts-history-status.saved { display: inline-flex; align-items: center; gap: 4px; background: #edf3ff; color: #245fae; }
.tts-history-badges { gap: 5px; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; }
.tts-history-actions {
    display: grid;
    grid-template-columns: repeat(4, 36px);
    align-items: center;
    justify-content: end;
    gap: 6px;
    width: 162px;
    min-height: 36px;
}
.tts-history-actions button {
    box-sizing: border-box;
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    padding: 0;
    border-radius: 8px;
    line-height: 1;
}
.tts-history-actions button i { display: grid; place-items: center; width: 100%; height: 100%; font-size: .95rem; line-height: 1; }
.tts-history-actions [data-history-play] { grid-column: 1; }
.tts-history-actions [data-history-download] { grid-column: 2; }
.tts-history-actions [data-history-save],
.tts-history-actions .is-saved { grid-column: 3; }
.tts-history-actions [data-history-delete],
.tts-history-actions [data-history-track] { grid-column: 4; }
.tts-history-actions button.is-saved { border-color: #c9d9f2; background: #edf3ff; color: #245fae; opacity: 1; }
.tts-history-actions button.is-danger { border-color: #efd2d2; background: #fff8f8; color: #ad3e3e; }
.tts-history-actions button.is-danger:hover { border-color: #ad3e3e; background: #ad3e3e; color: #fff; }
.tts-empty { grid-column: 1 / -1; margin: 0; padding: 18px; color: var(--tts-muted); text-align: center; }
.tts-status { min-height: 20px; color: var(--tts-muted); font-size: .86rem; }
.tts-status.success { color: #207755; }
.tts-status.warning { color: #956a13; }
.tts-status.error { color: #b33c3c; }
.tts-status.info { color: #2565b6; }
.speech-text-result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.speech-text-result-head > div:first-child {
    display: grid;
    gap: 2px;
}
.speech-text-result-head b {
    color: #24304c;
    font-weight: 850;
}
.speech-text-result-head span {
    color: #64748b;
    font-size: 0.86rem;
}
.speech-text-downloads {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.speech-text-downloads .btn {
    min-width: 72px;
}
.speech-text-transcript {
    min-height: 220px;
    max-height: 420px;
    overflow: auto;
    margin: 0;
    padding: 12px;
    border: 1px solid #e2e9f5;
    border-radius: 8px;
    background: #f8fbff;
    color: #24304c;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.92rem;
    line-height: 1.55;
}

.speech-text-timestamp {
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: #256fd9;
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}
.speech-text-timestamp:focus-visible {
    outline: 2px solid #256fd9;
    outline-offset: 2px;
    border-radius: 3px;
}
.speech-text-timestamp.is-review-required {
    color: #92400e;
    background: #fff7ed;
    text-decoration-style: double;
}
.speech-text-timestamp:disabled {
    color: inherit;
    text-decoration: none;
    cursor: default;
}

/* ====== LIST, SIDEBAR ====== */
#sidebar {
    background: rgba(248,251,255,0.98);
    border-radius: 8px;
    box-shadow: 0 8px 24px #8ca4d016;
    border: 1.5px solid #eaf0fa;
    padding: 12px;
}
#sidebar h5 {
    margin: 0;
    color: #2f3a59;
    font-weight: 850;
}
.sidebar-head {
    gap: 10px;
}
.icon-plus-btn {
    width: 40px;
    height: 40px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.list-group {
    background: transparent;
    border-radius: 8px;
    border: none;
    padding: 0;
    gap: 7px;
    display: grid;
}
.tracklist-track.active,
.list-group-item.active,
.list-group-item:focus {
    background: linear-gradient(90deg, #eef4ff 0%, #f8fbff 100%) !important;
    border-color: color-mix(in srgb, var(--track-accent, #7a3df0) 45%, #cbd7ef);
    color: #1f2b4f;
}
.list-group-item {
    font-size: 0.95rem;
    border: 1px solid #e2eaf7;
    border-left: 4px solid var(--track-accent, #7a3df0);
    border-radius: 8px !important;
    background: rgba(255,255,255,0.78);
    transition: background .14s, border-color .14s, transform .14s, box-shadow .14s;
    padding: 10px;
}
.list-group-item:hover {
    background: #f7fbff !important;
    border-color: color-mix(in srgb, var(--track-accent, #7a3df0) 40%, #cbd7ef);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px #90a6cc20;
}
.tracklist-track {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    cursor: pointer;
}
.tracklist-main {
    min-width: 0;
    display: grid;
    gap: 2px;
}
.tracklist-index {
    color: #1f2b4f;
    font-size: 0.95rem;
    font-weight: 850;
    line-height: 1.1;
}
.tracklist-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #2d3448;
    line-height: 1.25;
}
.tracklist-status {
    width: fit-content;
    padding: 2px 7px;
    border-radius: 7px;
    background: #eef2fa;
    color: #708097;
    font-size: 0.72rem;
    font-weight: 750;
}
.tracklist-status.loaded {
    background: #e2f8ed;
    color: #25845b;
}
.tracklist-actions {
    display: grid;
    grid-auto-flow: column;
    gap: 6px;
    align-items: center;
}
.sidebar-icon-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d5deed;
    border-radius: 8px;
    background: #ffffff;
    color: #46546f;
    transition: background .14s, color .14s, border-color .14s;
}
.sidebar-icon-btn:hover {
    background: #edf4ff;
    color: #293d72;
    border-color: #b8c8e6;
}
.sidebar-icon-btn.danger {
    color: #c54b55;
    border-color: #ffd0d0;
}
.sidebar-icon-btn.danger:hover {
    background: #fff0f0;
    border-color: #ffb5b5;
}
input[type="range"] {
    width: 104px;
    accent-color: #7a3df0;
    cursor: pointer;
}

/* ====== FILE & BUTTON ====== */
input[type="file"] {
    background: #f7fafd;
    border-radius: 8px;
    border: 1px solid #e4eafc;
    font-size: 0.97rem;
    padding: 3px 7px;
}
.file-icon-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #6f7a8d;
    border-radius: 8px;
    color: #dce6f7;
    background: #2a303b;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .15s;
}
.file-icon-btn:hover {
    background: #333b49;
    border-color: var(--track-accent, #34c486);
    transform: translateY(-1px);
}
.file-icon-btn input[type="file"] {
    display: none;
}
.icon-only-btn {
    width: 34px;
    height: 34px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
}
.btn {
    font-size: 0.97rem;
    border-radius: 8px !important;
    padding: 5px 15px !important;
    box-shadow: 0 1px 3px #cad9f80d;
    transition: background .15s, color .15s, box-shadow .17s;
}
.btn.icon-only-btn {
    width: 34px;
    height: 34px;
    padding: 0 !important;
}
.btn-primary { background: #7a3df0; border: none; }
.btn-primary:hover, .btn-primary:focus { background: #6549c7; }
.btn-outline-secondary { color: #333; border: 1.2px solid #b4bbd6; }
.btn-outline-secondary:hover { background: #f6f6f9; }
.btn-success { background: #43b78a; border: none; }
.btn-outline-success { color: #43b78a; border: 1.2px solid #b4eac8;}
.btn-outline-success:hover { background: #e8fbf4;}
.btn-outline-primary { color: #6a6cd5; border: 1.2px solid #b4bbf0;}
.btn-outline-primary:hover { background: #eaf0ff; }
.btn-danger, .btn-outline-danger { border: 1.2px solid #ffc2c2; background: #ffeded; color: #ca3d45;}
.btn-outline-danger:hover { background: #ffe2e2; }

.alert-info {
    background: linear-gradient(90deg, #eef3ff 80%, #f8faff 100%);
    color: #294078;
    border-radius: 8px;
    border: 1.2px solid #bedafd;
}

/* ====== STATUS, TOOLTIP ====== */
#exportStatus, #cutterExportStatus, #convertStatus {
    min-height: 28px;
    font-size: 1.08rem;
    font-weight: 500;
    margin-top: 8px;
}
#region-tooltip {
    position: fixed;
    z-index: 9999;
    background: #212333eb;
    color: #fff;
    padding: 4px 15px;
    border-radius: 8px;
    font-size: 1.05rem;
    pointer-events: none;
    display: none;
    box-shadow: 0 4px 16px #4443;
    letter-spacing: 0.01em;
    font-weight: 500;
}

.mobile-rotate-tip {
    display: none;
}

/* ====== GUIDE MODAL ====== */
.guide-modal-dialog {
    width: min(1420px, calc(100vw - 32px));
    max-width: min(1420px, calc(100vw - 32px));
}
.guide-modal {
    max-height: calc(100vh - 42px);
    overflow: hidden;
    border: 1px solid #dbe5f4;
    border-radius: 10px;
}
.guide-modal-header {
    align-items: center;
    gap: 16px;
    background: linear-gradient(120deg, #eef3ff 0%, #f8fbff 100%);
    border-bottom: 1px solid #dbe5f4;
}
.guide-modal-header h5 {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: #24304c;
    font-size: 1.24rem;
}
.guide-modal-header span {
    display: block;
    margin-top: 3px;
    color: #64748b;
    font-size: 0.9rem;
}
.guide-modal-body {
    padding: 0;
    background: #f7faff;
}
.guide-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    min-height: 430px;
    max-height: calc(100vh - 168px);
}
.guide-tabs {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 14px;
    overflow-y: auto;
    border-right: 1px solid #dbe5f4;
    background: #eef3ff;
}
.guide-tabs .nav-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    width: 100%;
    min-height: 42px;
    padding: 9px 11px !important;
    border: 1px solid transparent;
    border-radius: 8px !important;
    color: #40506d;
    font-weight: 800;
    text-align: left;
    white-space: nowrap;
}
.guide-tabs .nav-link i {
    width: 19px;
    text-align: center;
}
.guide-tabs .nav-link.active {
    background: #ffffff;
    color: #6b44d8 !important;
    border-color: #d6e0f3;
    box-shadow: 0 8px 18px #6880bd1c;
}
.guide-content {
    min-width: 0;
    padding: 14px;
    overflow: auto;
}
.guide-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 12px;
}
.guide-card {
    min-width: 0;
    min-height: 142px;
    padding: 14px;
    border: 1px solid #dbe5f4;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 8px 18px #9fb4d214;
}
.guide-card h6 {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 9px;
    color: #24304c;
    font-size: 0.98rem;
    font-weight: 850;
}
.guide-card h6 i {
    color: #6b44d8;
}
.guide-card p {
    margin: 0;
    color: #40506d;
    font-size: 0.94rem;
    line-height: 1.55;
}
.guide-card code {
    color: #6b44d8;
    background: #eef3ff;
    border-radius: 6px;
    padding: 1px 5px;
}
.guide-card kbd {
    border-radius: 6px;
    background: #222936;
    box-shadow: inset 0 -1px 0 #00000040;
}
.guide-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 7px;
    background: #4667f2;
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 850;
    white-space: nowrap;
}

/* ====== FOOTER ====== */
.footer-main {
    box-shadow: 0 -2px 16px #b9cbe930;
    letter-spacing: 0.01em;
    background: rgba(255, 248, 220, 0.96);
	text-decoration: none !important;
}
.footer-main a:hover {
    color: #7a3df0 !important;
    text-decoration: underline !important;
}

/* ====== MOBILE RESPONSIVE ====== */
@media (max-width: 991px) {
    :root { --track-header-width: 170px; --cutter-header-width: 170px; }
    .track-controls {gap: 6px; font-size: 0.82rem;}
    .track-waveform {min-width:180px;}
    .track-slider-row { grid-template-columns: 1fr 62px; }
    .track-slider-row input[type="range"] { width: 62px; }
    .single-cutter-track-head .track-file-name {max-width: 132px;}
    .convert-settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .convert-row { grid-template-columns: 34px minmax(0, 1fr) minmax(110px, 170px) auto auto auto; }
    .ai-separator-grid,
    .ai-separator-results { grid-template-columns: 1fr; }
    .speech-text-shell .ai-separator-grid { grid-template-columns: 1fr; }
    .ai-separator-filecard { grid-template-columns: 1fr; }
    .guide-layout { grid-template-columns: 1fr; min-height: 0; }
    .guide-tabs {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        border-right: 0;
        border-bottom: 1px solid #dbe5f4;
    }
    .guide-tabs .nav-link { width: auto; }
    .guide-card-grid { grid-template-columns: 1fr; }
    .tts-workspace { grid-template-columns: 1fr; }
    .tts-voice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tts-library-tools { width: 100%; }
}
@media (min-width: 768px) and (max-width: 1399px) {
    .tts-clone-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tts-clone-grid label:first-child { grid-column: span 2; }
    .tts-library-head > .tts-library-tools { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .tts-library-search { grid-column: 1 / -1; }
    #ttsVoiceLanguage,
    #ttsVoiceRegion,
    #ttsVoiceGender { grid-column: span 2; }
    #ttsVoiceAge,
    #ttsVoiceCharacter { grid-column: span 3; }
}
@media (min-width: 992px) and (max-width: 1099px) {
    .tts-voice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
    .speech-text-settings-grid { grid-template-columns: 1fr; }
    .speech-text-settings-grid label:first-child { grid-column: auto; }
    .speech-text-downloads { width: 100%; }
    .speech-text-downloads .btn { flex: 1 1 86px; }
    .footer-main {font-size: 0.94rem;}
    :root { --track-header-width: 156px; --cutter-header-width: 156px; }
    .track-controls {gap: 5px;}
    .track-waveform {min-width:90px; height: 33px;}
    .tracklist-track, .list-group-item {padding: 8px 9px;}
    .container-fluid {padding-left: 3px !important; padding-right: 3px !important;}
    header {padding-left: 5px !important; padding-right: 5px !important;}
    .single-cutter-toolbar,
    .single-cutter-editbar,
    .cutter-exportbar {align-items: flex-start;}
    .tool-control {width: 100%; justify-content: flex-start;}
    .single-cutter-track-head .track-file-name {max-width: 118px;}
    .convert-topbar,
    .convert-actionbar {align-items: flex-start;}
    .convert-settings-grid { grid-template-columns: 1fr; }
    .convert-row {
        grid-template-columns: 30px minmax(0, 1fr) auto auto;
    }
    .convert-row-progress,
    .convert-status {
        grid-column: 2 / -1;
    }
    .convert-progress { flex-basis: 100%; }
    .ai-separator-topbar,
    .ai-separator-actionbar {align-items: flex-start;}
    .ai-separator-progress {flex-basis: 100%; min-width: 100%;}
    .ai-stem-card-head {align-items: flex-start; flex-direction: column;}
    .ai-separator-top-actions {width: 100%;}
    .guide-modal-dialog {
        width: calc(100vw - 12px);
        max-width: calc(100vw - 12px);
        margin: 6px auto;
    }
    .guide-modal {max-height: calc(100vh - 12px);}
    .guide-modal-header h5 {font-size: 1.04rem;}
    .guide-modal-header span {font-size: 0.82rem;}
    .guide-layout {max-height: calc(100vh - 160px);}
    .guide-content {padding: 10px;}
    .guide-card {min-height: auto; padding: 12px;}
    .tts-shell { padding: 10px; gap: 10px; border-left: 0; border-right: 0; }
    .tts-header,
    .tts-result { align-items: flex-start; flex-direction: column; }
    .tts-health { justify-content: flex-start; }
    .tts-editor,
    .tts-settings,
    .tts-library,
    .tts-history,
    .tts-clone { padding: 12px; }
    #ttsText { min-height: 250px; }
    .tts-find-replace,
    .tts-setting-grid,
    .tts-clone-grid,
    .tts-reference-grid,
    .tts-community-fields,
    .tts-community-dialog-grid,
    .tts-voice-grid { grid-template-columns: 1fr; }
    .tts-community-fields .tts-community-description,
    .tts-community-dialog-grid .is-wide { grid-column: auto; }
    .tts-library-tabs { grid-template-columns: 1fr; }
    .tts-library-tabs button { min-height: 40px; }
    .tts-library-head > .tts-library-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tts-library-tools label { grid-column: 1 / -1; }
    #ttsVoiceCharacter { grid-column: 1 / -1; }
    .tts-section-head { align-items: flex-start; }
    .tts-editor-head-actions { width: 100%; justify-content: space-between; }
    .tts-library-head > .tts-library-title { align-items: flex-start; }
    .tts-library-heading-row { align-items: flex-start; gap: 6px; }
    .tts-voice-group { padding: 9px; }
    .tts-voice-group-head { grid-template-columns: 30px minmax(0, 1fr); }
    .tts-voice-group-head > span:last-child { grid-column: 2; }
    .tts-editor-meta { align-items: flex-start; flex-direction: column; gap: 2px; }
    .tts-result audio { width: 100%; min-width: 0; flex-basis: auto; }
    .tts-result-actions { width: 100%; }
    .tts-result .btn { width: 100%; }
    .tts-clone-head,
    .tts-clone-actions { align-items: flex-start; flex-direction: column; }
    .tts-clone-actions > span { text-align: left; }
    .tts-community-dialog { width: calc(100vw - 16px); }
    .tts-community-dialog > form { padding: 12px; }
    .tts-pause-grid,
    .tts-background-volume { grid-template-columns: 1fr; }
    .tts-community-dialog-actions { flex-wrap: wrap; }
    .tts-community-dialog-actions .btn { flex: 1 1 140px; }
    .tts-history-item { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
    .tts-history-copy { grid-column: 1; }
    .tts-history-head-actions { width: 100%; justify-content: space-between; }
    .tts-history-badges { grid-column: 2; margin-left: auto; }
    .tts-history-actions { grid-column: 1 / -1; width: 162px; margin-left: auto; justify-content: end; }
}

::-webkit-scrollbar {height: 8px;}
::-webkit-scrollbar-thumb {background: #dbe2f4;border-radius:7px;}
::-webkit-scrollbar-track {background: #f8faff;}

/* ====== MOBILE APP SHELL ====== */
@media (max-width: 767px) {
    html {
        min-height: 100%;
        background: #eef3ff;
    }

    body {
        min-height: 100svh;
        padding-bottom: calc(78px + env(safe-area-inset-bottom));
        background: #eef3ff;
        overscroll-behavior-y: contain;
    }

    body::before {
        opacity: 0.08;
        filter: blur(10px);
    }

    .app-header {
        min-height: 56px;
        padding-top: calc(8px + env(safe-area-inset-top)) !important;
        padding-bottom: 8px !important;
        gap: 8px;
        flex-wrap: nowrap;
        box-shadow: 0 10px 24px #11182730;
    }

    .brand-lockup {
        flex: 1 1 auto;
        min-width: 0;
        gap: 8px !important;
        padding-right: 88px;
    }

    .brand-lockup img {
        width: 34px;
        height: 34px;
        border-radius: 8px;
    }

    .brand-title {
        max-width: calc(100vw - 150px);
        overflow: hidden;
        white-space: normal;
        font-size: 0.9rem;
        line-height: 1.12;
    }

    .app-nav {
        position: fixed;
        top: calc(8px + env(safe-area-inset-top));
        right: 8px;
        z-index: 120;
        flex: 0 0 auto;
        gap: 6px;
        margin-left: auto;
    }

    .app-nav a {
        width: 38px;
        height: 38px;
        justify-content: center;
        padding: 0;
        border-radius: 10px;
        background: rgba(255,255,255,0.08);
        color: #ffffff !important;
        font-size: 0.95rem;
    }

    .app-nav a span {
        display: none;
    }

    .app-nav a i,
    .app-nav a i::before {
        font-size: 1.08rem;
    }

    .mobile-rotate-tip {
        position: sticky;
        top: calc(56px + env(safe-area-inset-top));
        z-index: 90;
        align-items: flex-start;
        gap: 9px;
        margin: 8px;
        padding: 10px 12px;
        border: 1px solid #cdd9ee;
        border-left: 4px solid #4667f2;
        border-radius: 12px;
        background: rgba(248, 251, 255, 0.96);
        color: #263452;
        box-shadow: 0 10px 22px #1b2c4f1c;
        backdrop-filter: blur(12px);
        font-size: 0.86rem;
        line-height: 1.35;
    }

    .mobile-rotate-tip i {
        color: #4667f2;
        font-size: 1.2rem;
        line-height: 1.15;
    }

    .mobile-rotate-tip span {
        min-width: 0;
    }

    .app-shell {
        margin-top: 8px !important;
        margin-bottom: 0 !important;
        padding: 0 8px calc(88px + env(safe-area-inset-bottom)) !important;
    }

    #editorTabs {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 4px;
        width: 100%;
        box-sizing: border-box;
        margin: 0 !important;
        padding: 6px max(8px, env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-right));
        border-radius: 16px 16px 0 0;
        border-top: 1px solid rgba(206, 217, 238, 0.92);
        background: rgba(248, 251, 255, 0.96);
        box-shadow: 0 -12px 28px #18233a2e;
        backdrop-filter: blur(14px);
    }

    #editorTabs .nav-item {
        flex: 1 1 0 !important;
        min-width: 0;
        max-width: 25%;
        width: auto !important;
    }

    #editorTabs .nav-link {
        width: 100%;
        min-height: 56px;
        flex-direction: column;
        justify-content: center;
        gap: 3px;
        padding: 5px 2px !important;
        border-radius: 12px !important;
        font-size: 0.68rem;
        line-height: 1.08;
        text-align: center;
        white-space: normal;
    }

    #editorTabs .nav-link i {
        font-size: 1.16rem;
        line-height: 1;
    }

    #tabMixer > .row {
        gap: 8px;
        margin: 0;
    }

    #sidebar {
        padding: 10px;
        margin-bottom: 8px;
        border-right: 0 !important;
        border-radius: 12px;
    }

    .sidebar-head {
        margin-bottom: 8px !important;
    }

    .list-group {
        display: flex;
        flex-direction: row;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 2px;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .tracklist-track {
        flex: 0 0 min(260px, 82vw);
        min-height: 74px;
        scroll-snap-align: start;
    }

    #mainArea {
        padding: 0 !important;
    }

    #mainArea > .mb-2.d-flex {
        position: sticky;
        top: calc(64px + env(safe-area-inset-top));
        z-index: 35;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        margin: 0 0 8px !important;
        padding: 8px;
        border: 1px solid #dbe5f4;
        border-radius: 12px;
        background: rgba(248, 251, 255, 0.96);
        box-shadow: 0 8px 18px #1b2c4f16;
        -webkit-overflow-scrolling: touch;
    }

    #mainArea > .mb-2.d-flex .btn {
        flex: 0 0 auto;
        min-height: 40px;
        white-space: nowrap;
    }

    :root {
        --track-header-width: 142px;
        --cutter-header-width: 142px;
    }

    #timeline,
    .single-cutter-editor {
        min-height: calc(100svh - 286px) !important;
        padding: 8px !important;
        border-radius: 12px !important;
        overflow: auto !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-x pan-y;
    }

    .mix-session-toolbar,
    .mix-edit-toolbar {
        max-width: calc(100vw - 28px);
        overflow-x: auto;
        flex-wrap: nowrap !important;
        border-radius: 10px;
        -webkit-overflow-scrolling: touch;
    }

    .mix-session-toolbar > *,
    .mix-edit-toolbar > * {
        flex: 0 0 auto;
    }

    .track-controls,
    .single-cutter-track-head {
        padding: 8px;
        gap: 6px;
    }

    .track-file-name,
    .single-cutter-track-head .track-file-name {
        max-width: 112px;
    }

    .track-slider-row {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .track-slider-row input[type="range"] {
        width: 100%;
    }

    .btn,
    .file-icon-btn,
    .sidebar-icon-btn,
    .icon-only-btn {
        min-height: 40px;
    }

    .btn.icon-only-btn,
    .file-icon-btn,
    .sidebar-icon-btn {
        width: 40px;
        height: 40px;
    }

    .single-cutter-shell,
    .convert-shell,
    .ai-separator-shell {
        gap: 10px;
        padding: 0;
    }

    .single-cutter-topbar,
    .convert-topbar,
    .ai-separator-topbar,
    .single-cutter-toolbar,
    .single-cutter-editbar,
    .cutter-exportbar,
    .convert-actionbar,
    .ai-separator-actionbar {
        align-items: stretch;
        border-radius: 12px;
        padding: 10px;
    }

    .single-cutter-topbar,
    .convert-topbar,
    .ai-separator-topbar {
        flex-direction: column;
    }

    .single-cutter-title > i,
    .convert-title > i,
    .ai-separator-title > i {
        width: 36px;
        height: 36px;
        flex: 0 0 36px;
    }

    .cutter-file-name,
    .convert-title span,
    .ai-separator-title span {
        max-width: 100%;
        font-size: 0.82rem;
        white-space: normal;
    }

    .single-cutter-actions,
    .convert-top-actions,
    .ai-separator-top-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .tool-control {
        flex: 1 1 100%;
        min-width: 0;
    }

    .tool-control input[type="range"] {
        flex: 1 1 auto;
        width: auto;
        min-width: 96px;
    }

    .tool-control.ms-auto {
        margin-left: 0 !important;
    }

    .cutter-region-list {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
    }

    .cutter-region-chip {
        flex: 0 0 220px;
    }

    .mp3-inline {
        flex: 1 1 100%;
        flex-wrap: wrap;
    }

    .convert-dropzone,
    .ai-separator-dropzone {
        min-height: 112px;
        padding: 12px;
        border-radius: 12px;
    }

    .convert-file-trigger,
    .ai-separator-file-trigger {
        width: 100%;
        justify-content: center;
        min-height: 46px;
        text-align: center;
    }

    .convert-panel,
    .ai-separator-import,
    .ai-separator-settings,
    .ai-stem-card {
        border-radius: 12px;
    }

    .convert-two-cols {
        grid-template-columns: 1fr;
    }

    .convert-row {
        grid-template-columns: 30px minmax(0, 1fr) auto;
        gap: 8px;
    }

    .convert-row-progress,
    .convert-status {
        grid-column: 2 / -1;
    }

    .convert-row .icon-only-btn {
        width: 38px;
        height: 38px;
    }

    .convert-progress,
    .ai-separator-progress {
        flex-basis: 100%;
        min-width: 100%;
    }

    .ai-separator-top-actions > *,
    .ai-separator-actionbar .btn,
    .convert-actionbar .btn,
    .cutter-exportbar .btn {
        flex: 1 1 auto;
    }

    .ai-separator-filecard {
        border-radius: 12px;
    }

    .ai-separator-filecard audio,
    .ai-stem-card audio {
        min-width: 0;
    }

    .footer-main {
        display: none;
    }
}

@media (max-width: 767px) and (orientation: portrait) {
    .mobile-rotate-tip {
        display: flex;
    }
}

@media (max-width: 767px) and (orientation: landscape) {
    body {
        padding-bottom: calc(64px + env(safe-area-inset-bottom));
    }

    .app-header {
        min-height: 48px;
        padding-top: calc(5px + env(safe-area-inset-top)) !important;
        padding-bottom: 5px !important;
    }

    .brand-lockup img {
        width: 30px;
        height: 30px;
    }

    .brand-title {
        max-width: 46vw;
        font-size: 0.86rem;
        white-space: nowrap;
    }

    .app-shell {
        padding-bottom: calc(70px + env(safe-area-inset-bottom)) !important;
    }

    #editorTabs {
        padding-top: 4px;
    }

    #editorTabs .nav-link {
        min-height: 48px;
        font-size: 0.66rem;
    }

    #timeline,
    .single-cutter-editor {
        min-height: calc(100svh - 198px) !important;
    }
}

@media (max-height: 480px) and (orientation: landscape) {
    .app-header {
        min-height: 50px;
        padding-top: calc(6px + env(safe-area-inset-top)) !important;
        padding-bottom: 6px !important;
    }

    .brand-lockup img {
        width: 32px;
        height: 32px;
    }

    .brand-title {
        font-size: 0.98rem;
    }

    .app-shell {
        margin-top: 8px !important;
    }

    .nav-tabs {
        padding: 5px;
        gap: 4px;
    }

    .nav-tabs .nav-link {
        min-height: 42px;
        padding: 7px 12px !important;
        font-size: 0.94rem;
    }

    #sidebar {
        max-height: calc(100svh - 150px);
        overflow: auto;
    }

    #timeline,
    .single-cutter-editor {
        min-height: calc(100svh - 178px) !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-x pan-y;
    }

    .footer-main {
        display: none;
    }
}
/* Shared workspace identity; AI Voice and Audio Tools keep the same design tokens. */
.audio-workspace-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 4px 8px;
    color: #256fd9;
    font-size: 14px;
    font-weight: 700;
}
