:root {
    --app-header-bg: var(--trilhas-header);
    --app-footer-bg: var(--trilhas-surface);
    --trilhas-bg: #f4f7fb;
    --trilhas-surface: #ffffff;
    --trilhas-soft: #eef4ff;
    --trilhas-text: #172744;
    --trilhas-muted: #60708f;
    --trilhas-line: rgba(28, 64, 133, 0.14);
    --trilhas-brand: #2196f3;
    --trilhas-brand-strong: #1565c0;
    --trilhas-header: #9c9113;
    --trilhas-header-strong: #9c9113;
    --trilhas-danger: #c62828;
    --trilhas-success: #2e7d32;
    --trilhas-shadow: 0 12px 30px rgba(27, 57, 122, 0.10);
    --branco: #ffffff;
    --cor-borda: var(--trilhas-line);
    --texto-claro: var(--trilhas-muted);
    --sombra-leve: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.trilhas-page {
    margin: 0;
    min-height: 100vh;
    background: var(--trilhas-bg);
    color: var(--trilhas-text);
    font-family: 'Poppins', Arial, sans-serif;
}

body.trilhas-page {
    display: flex;
    flex-direction: column;
}

.barra-topo .btn-voltar {
    position: static;
    color: var(--branco);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    font-weight: 500;
}

.barra-topo .btn-voltar:hover {
    color: var(--branco);
    text-decoration: none;
    opacity: 0.85;
}

.trilhas-shell {
    width: min(1180px, calc(100vw - 32px));
    flex: 1;
    margin: 24px auto 20px;
}

.trilhas-toolbar,
.trilhas-public-toolbar,
.trilhas-panel,
.trilhas-public-card {
    background: var(--trilhas-surface);
    border: 1px solid var(--trilhas-line);
    border-radius: 10px;
    box-shadow: var(--trilhas-shadow);
}

.trilhas-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 22px;
    margin-bottom: 18px;
}

.trilhas-toolbar h1,
.trilhas-toolbar p,
.trilhas-manage-header h2,
.trilhas-panel-header h2,
.trilhas-public-card h2,
.trilhas-public-hero h1,
.trilhas-public-hero p {
    margin: 0;
}

.trilhas-toolbar h1 {
    font-size: 22px;
    color: var(--trilhas-brand-strong);
}

.trilhas-toolbar p,
.trilhas-active-card-meta,

.trilhas-empty-state p {
    color: var(--trilhas-muted);
}

.trilhas-admin-grid {
    display: grid;
    grid-template-columns: clamp(380px, 30vw, 440px) minmax(0, 1fr);
    gap: 18px;
}

.trilhas-panel {
    padding: 18px;
}

.trilhas-panel-header,
.trilhas-manage-header,
.trilhas-track-row,
.trilhas-public-track-row,
.trilhas-player,
.trilhas-modal-header,
.trilhas-modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.trilhas-panel-header {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 14px;
}

.trilhas-card-header-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.trilhas-create-card-btn {
    min-height: 48px;
    padding: 0 18px;
    font-size: 17px;
    white-space: nowrap;
}

.trilhas-panel-header h2,
.trilhas-manage-header h2 {
    font-size: 18px;
}

.trilhas-search-field {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    border: 1px solid var(--trilhas-line);
    border-radius: 999px;
    background: #fff;
    padding: 0 14px;
    width: 100%;
    color: var(--trilhas-muted);
}

.trilhas-search-field input {
    width: 100%;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--trilhas-text);
    font: inherit;
}

.trilhas-card-list,
.trilhas-track-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.trilhas-track-list {
    position: relative;
    border-radius: 8px;
    transition: box-shadow 180ms ease, background 180ms ease, transform 180ms ease;
}

.trilhas-card-item,
.trilhas-track-row,
.trilhas-public-track-row {
    border: 1px solid var(--trilhas-line);
    background: #fff;
    border-radius: 8px;
}

.trilhas-card-item {
    width: 100%;
    text-align: left;
    padding: 12px;
    color: var(--trilhas-text);
    font: inherit;
    display: flex;
    align-items: center;
    gap: 10px;
}

.trilhas-card-select {
    flex: 1;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.trilhas-card-copy-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--trilhas-brand-strong);
    cursor: pointer;
    font: inherit;
    font-size: 17px;
    transition: 160ms ease;
}

.trilhas-card-copy-link:hover,
.trilhas-card-copy-link:focus-visible {
    background: var(--trilhas-soft);
    color: var(--trilhas-brand);
    outline: none;
}

.trilhas-card-item.active,
.trilhas-card-item:hover,
.trilhas-track-play.active,
.trilhas-public-track-play.active {
    border-color: rgba(33, 150, 243, 0.45);
    background: var(--trilhas-soft);
}

.trilhas-card-item strong {
    display: block;
    font-size: 14px;
}

.trilhas-card-item span {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    color: var(--trilhas-muted);
}

.trilhas-manage-header {
    align-items: flex-start;
    padding-bottom: 14px;
    border-bottom: 1px dashed var(--trilhas-line);
}

.trilhas-overline {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--trilhas-brand);
    text-transform: uppercase;
}

.trilhas-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.trilhas-btn,
.trilhas-icon-btn,
.trilhas-track-play,
.trilhas-public-track-play,
.trilhas-player-button {
    border: none;
    cursor: pointer;
    font: inherit;
    transition: 160ms ease;
}

.trilhas-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 8px;
    font-weight: 700;
}

.trilhas-btn-primary {
    color: #fff;
    background: var(--trilhas-brand);
}

.trilhas-btn-secondary {
    color: var(--trilhas-text);
    background: var(--trilhas-soft);
}

.trilhas-btn-public,
.trilhas-btn-voice {
    color: #fff;
    background: var(--trilhas-header);
    text-decoration: none;
    white-space: nowrap;
}

.trilhas-btn-public:hover,
.trilhas-btn-voice:hover {
    color: #fff;
    filter: brightness(1.04);
}

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

.trilhas-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.trilhas-icon-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--trilhas-soft);
    color: var(--trilhas-brand-strong);
}

.trilhas-danger {
    color: var(--trilhas-danger);
}

.trilhas-track-row,
.trilhas-public-track-row {
    padding: 7px 10px;
}

/* Faixa em execução na playlist */
.trilhas-public-track-row.is-current {
    border-color: var(--trilhas-brand);
    box-shadow: 0 0 0 1px var(--trilhas-brand), 0 6px 18px rgba(33, 150, 243, 0.16);
}

.trilhas-track-row {
    position: relative;
    cursor: grab;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease, opacity 180ms ease;
    will-change: transform;
}

.trilhas-track-row.is-dragging {
    opacity: 0.82;
    cursor: grabbing;
    transform: rotate(-0.6deg) scale(1.018);
    border-color: rgba(33, 150, 243, 0.62);
    background: #f8fbff;
    box-shadow: 0 14px 30px rgba(21, 101, 192, 0.18);
    z-index: 4;
}

.trilhas-track-row.is-drag-over {
    border-color: var(--trilhas-brand);
    background: var(--trilhas-soft);
    transform: translateY(6px);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.14), 0 10px 20px rgba(21, 101, 192, 0.10);
}

.trilhas-track-row.is-drag-over::before {
    content: "";
    position: absolute;
    top: -9px;
    left: 14px;
    right: 14px;
    height: 4px;
    border-radius: 999px;
    background: var(--trilhas-brand);
    box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.14);
    animation: trilhas-insert-line 700ms ease-in-out infinite alternate;
}

.trilhas-track-list.is-file-drag-over,
.trilhas-track-list.is-uploading {
    background: rgba(33, 150, 243, 0.08);
    box-shadow: inset 0 0 0 2px var(--trilhas-brand), 0 16px 34px rgba(21, 101, 192, 0.12);
    transform: scale(1.006);
    animation: trilhas-drop-zone-pulse 1100ms ease-in-out infinite alternate;
}

.trilhas-track-list.is-file-drag-over .trilhas-track-row,
.trilhas-track-list.is-file-drag-over .trilhas-empty-state,
.trilhas-track-list.is-uploading .trilhas-track-row,
.trilhas-track-list.is-uploading .trilhas-empty-state {
    transform: scale(0.985);
    opacity: 0.28;
    filter: blur(1px);
}

.trilhas-track-list.is-file-drag-over::after,
.trilhas-track-list.is-uploading::after {
    content: attr(data-drop-label);
    position: absolute;
    inset: 0;
    z-index: 5;
    display: grid;
    place-items: center;
    min-height: 100%;
    padding: 24px;
    border-radius: 8px;
    border: 2px dashed rgba(33, 150, 243, 0.65);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(238, 244, 255, 0.94));
    color: var(--trilhas-brand-strong);
    font-size: 17px;
    font-weight: 800;
    text-align: center;
    pointer-events: none;
    box-shadow: inset 0 0 0 8px rgba(33, 150, 243, 0.05);
    animation: trilhas-drop-message 360ms ease-out both;
}

.trilhas-track-list.is-file-drag-over::before,
.trilhas-track-list.is-uploading::before {
    content: "";
    position: absolute;
    top: calc(50% - 58px);
    left: calc(50% - 22px);
    z-index: 6;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid rgba(33, 150, 243, 0.22);
    border-top-color: var(--trilhas-brand);
    pointer-events: none;
    animation: trilhas-drop-icon 900ms linear infinite;
}

@keyframes trilhas-insert-line {
    from {
        opacity: 0.55;
        transform: scaleX(0.92);
    }
    to {
        opacity: 1;
        transform: scaleX(1);
    }
}

@keyframes trilhas-drop-zone-pulse {
    from {
        box-shadow: inset 0 0 0 2px rgba(33, 150, 243, 0.74), 0 12px 24px rgba(21, 101, 192, 0.10);
    }
    to {
        box-shadow: inset 0 0 0 4px rgba(33, 150, 243, 0.95), 0 18px 38px rgba(21, 101, 192, 0.18);
    }
}

@keyframes trilhas-drop-message {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes trilhas-drop-icon {
    to {
        transform: rotate(360deg);
    }
}

.trilhas-drag-handle {
    width: 30px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--trilhas-muted);
    cursor: grab;
    font-size: 20px;
}

.trilhas-drag-handle:hover {
    background: var(--trilhas-soft);
    color: var(--trilhas-brand-strong);
}

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

.trilhas-track-main strong,
.trilhas-public-track-main strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.15;
}

.trilhas-track-main small,
.trilhas-public-track-main small {
    color: var(--trilhas-muted);
    font-size: 12px;
    line-height: 1.1;
}

.trilhas-track-play,
.trilhas-public-track-play {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
    padding: 5px 6px;
    border-radius: 8px;
    background: transparent;
    text-align: left;
    color: var(--trilhas-text);
}

.trilhas-track-row .trilhas-icon-btn,
.trilhas-track-row .trilhas-download-link,
.trilhas-track-row .trilhas-track-share-link {
    width: 32px;
    height: 32px;
}

.trilhas-track-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
}

.trilhas-empty-state {
    min-height: 260px;
    display: grid;
    place-items: center;
    text-align: center;
}

.trilhas-feedback {
    position: fixed;
    top: 20px;
    left: 50%;
    z-index: 99999;
    width: auto;
    max-width: min(calc(100vw - 32px), 720px);
    min-width: min(310px, calc(100vw - 32px));
    transform: translateX(-50%) translateY(-10px);
    margin: 0;
    padding: 16px 34px;
    border-radius: 8px;
    background: #2e7d32;
    color: #fff;
    font-weight: 700;
    text-align: center;
    line-height: 1.35;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    animation: trilhasToastIn 180ms ease forwards;
}

.trilhas-feedback.error {
    background: #c62828;
    color: #fff;
}

@keyframes trilhasToastIn {
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.hidden {
    display: none !important;
}

/* A cor do tema da conta (definida no perfil) pinta o hero da página pública. */
.trilhas-public-hero {
    background: linear-gradient(135deg, var(--trilhas-hero-strong, #1565c0), var(--trilhas-hero, #2196f3));
    color: var(--trilhas-hero-text, #fff);
    padding: 28px 18px;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.trilhas-public-page .rodape {
    margin-top: 24px;
}

.trilhas-public-hero.collapsed {
    padding: 8px 18px;
}

.trilhas-public-hero.collapsed .trilhas-public-brand,
.trilhas-public-hero.collapsed h1 {
    display: none;
}

.trilhas-public-hero.collapsed .trilhas-public-hero-search {
    margin-top: 0;
}

.trilhas-hero-toggle {
    position: absolute;
    bottom: -14px;
    right: 24px;
    width: 28px;
    height: 28px;
    background: #fff;
    border: 1px solid var(--trilhas-line);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--trilhas-brand);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
    transition: all 0.25s ease;
    border: none;
    padding: 0;
    opacity: 0.5;
}

.trilhas-hero-toggle:hover {
    transform: scale(1.15);
    background: var(--trilhas-brand);
    color: #fff;
    opacity: 1;
}

.trilhas-public-hero-search {
    margin-top: 20px;
    width: 100%;
}

.trilhas-public-hero-search .trilhas-search-field {
    max-width: 720px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

.trilhas-public-hero-search .trilhas-search-field i {
    color: #fff !important;
}

.trilhas-public-hero-search .trilhas-search-field input {
    color: #fff !important;
    font-size: 15px;
}

.trilhas-public-hero-search .trilhas-search-field input::placeholder {
    color: rgba(255, 255, 255, 0.75);
}

@media (max-width: 820px) {
    .trilhas-public-hero-search .trilhas-search-field {
        margin: 0 auto;
        max-width: 100%;
    }
}

.trilhas-public-hero-inner {
    width: min(1000px, 100%);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 24px;
}

.trilhas-public-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.trilhas-company-logo-frame {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 200px;
    min-height: 90px;
    padding: 10px 14px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.trilhas-company-logo {
    width: 172px;
    height: auto;
    object-fit: contain;
}

.trilhas-public-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px;
    margin-bottom: 18px;
}

.trilhas-public-search {
    flex: 1;
    max-width: 680px;
}

.trilhas-public-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.trilhas-public-card-folder {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: var(--trilhas-surface);
    border: 1px solid var(--trilhas-line);
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(27, 57, 122, 0.05);
    cursor: pointer;
    transition: all 0.22s ease;
    position: relative;
    overflow: hidden;
}

.trilhas-public-card-folder:hover {
    transform: translateY(-3px);
    border-color: var(--trilhas-brand);
    box-shadow: 0 10px 24px rgba(27, 57, 122, 0.12);
    background: var(--trilhas-soft);
}

.trilhas-folder-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: var(--trilhas-soft);
    color: var(--trilhas-brand);
    font-size: 26px;
    flex-shrink: 0;
}

.trilhas-public-card-folder:hover .trilhas-folder-icon {
    background: #fff;
}

.trilhas-folder-content {
    flex: 1;
    min-width: 0;
}

.trilhas-folder-content h3 {
    margin: 0 0 2px 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--trilhas-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trilhas-folder-content span {
    font-size: 13px;
    font-weight: 500;
    color: var(--trilhas-muted);
}

.trilhas-folder-arrow {
    font-size: 18px;
    color: var(--trilhas-brand);
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.2s ease;
}

.trilhas-public-card-folder:hover .trilhas-folder-arrow {
    opacity: 1;
    transform: translateX(0);
}

.trilhas-public-detail {
    animation: trilhas-fade-up 0.35s ease-out;
}

.trilhas-public-detail-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

@media (max-width: 640px) {
    .trilhas-public-detail-header {
        grid-template-columns: 1fr auto 1fr;
        gap: 10px;
        margin-bottom: 20px;
    }
    
    .trilhas-public-detail-title h2 {
        font-size: 22px !important;
    }

    [data-action="back-to-grid"] {
        padding: 6px 12px;
        font-size: 13px;
    }

    .trilhas-header-spacer {
        display: block; /* Garante que o spacer ocupe espaço para centralizar */
    }
}

[data-action="back-to-grid"] {
    justify-self: start;
}

.trilhas-public-copy-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: end;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--trilhas-brand-strong);
    cursor: pointer;
    font-size: 18px;
    transition: 160ms ease;
}

.trilhas-public-copy-link:hover,
.trilhas-public-copy-link:focus-visible {
    background: var(--trilhas-soft);
    color: var(--trilhas-brand);
    outline: none;
}

.trilhas-public-detail-title {
    text-align: center;
}

.trilhas-public-detail-title h2 {
    margin: 0;
    font-size: 32px;
    font-weight: 800;
    color: var(--trilhas-brand-strong);
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.trilhas-header-spacer {
    content: "";
    flex: 1;
}

.trilhas-public-btn-wrapper {
    display: flex;
    justify-content: flex-start;
}

.trilhas-public-track-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 100px;
}

body.has-trilhas-player .trilhas-public-track-list {
    padding-bottom: 280px;
}

@media (max-width: 820px) {
    body.has-trilhas-player .trilhas-public-track-list {
        padding-bottom: 230px;
    }
}

@keyframes trilhas-fade-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.trilhas-btn-secondary {
    background: #fff;
    border: 1px solid var(--trilhas-line);
    color: var(--trilhas-text);
    padding: 10px 18px;
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.trilhas-btn-secondary:hover {
    background: var(--trilhas-soft);
    border-color: var(--trilhas-brand);
    color: var(--trilhas-brand);
}

.trilhas-file-upload {
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    margin-top: 6px;
    width: 100%;
    flex-wrap: wrap;
}

.trilhas-file-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    z-index: -1;
}

.trilhas-file-btn {
    pointer-events: none;
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 52px;
    border-radius: 14px;
    padding: 0 18px;
}

.trilhas-file-name {
    font-size: 14px;
    color: #5e6d89;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    font-style: italic;
    font-weight: 600;
    min-width: 220px;
}

.trilhas-modal-actions {
    margin-top: 2px;
    padding-top: 2px;
}

.trilhas-modal-actions .trilhas-btn {
    min-height: 48px;
    min-width: 132px;
    padding: 0 24px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 800;
}

.trilhas-modal-actions .trilhas-btn-primary {
    box-shadow: 0 12px 24px rgba(33, 150, 243, 0.18);
}

.trilhas-modal-actions .trilhas-btn-secondary {
    background: #fff;
    border-color: rgba(169, 186, 214, 0.72);
    color: #253a60;
}

.trilhas-download-link,
.trilhas-track-share-link {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 0;
    background: var(--trilhas-soft);
    color: var(--trilhas-brand-strong);
    text-decoration: none;
    cursor: pointer;
}

.trilhas-player {
    position: fixed;
    left: 50%;
    bottom: 16px;
    z-index: 80;
    width: min(760px, calc(100vw - 48px));
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid var(--trilhas-line);
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.trilhas-player-row-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
}

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

.trilhas-player-info span {
    display: block;
    color: var(--trilhas-brand);
    text-transform: uppercase;
    font-size: 10px;
    font-weight: 800;
    margin-bottom: 2px;
    letter-spacing: 0.05em;
}

.trilhas-player-info strong {
    display: block;
    font-size: 17px;
    color: var(--trilhas-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

.trilhas-player-track-title {
    overflow: hidden;
    white-space: nowrap;
}

.trilhas-player-track-title .trilhas-player-track-title-text {
    display: block;
    width: max-content;
    min-width: 100%;
    overflow: visible;
    text-overflow: clip;
}

.trilhas-player-track-title .trilhas-player-track-title-text.is-overflowing {
    padding-right: 32px;
    animation: trilhas-track-title-scroll 7s ease-in-out 900ms infinite alternate;
}

@keyframes trilhas-track-title-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(var(--trilhas-title-scroll-distance)); }
}

@media (prefers-reduced-motion: reduce) {
    .trilhas-player-track-title .trilhas-player-track-title-text.is-overflowing {
        animation: none;
    }
}

.trilhas-player-close {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: #d83a3f;
    color: #fff;
    cursor: pointer;
    font-size: 18px;
}

.trilhas-player-close:hover,
.trilhas-player-close:focus-visible {
    background: #b42328;
    outline: none;
}

.trilhas-player-row-middle {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

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

.trilhas-player-controls-main,
.trilhas-player-controls-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.trilhas-player-row-bottom {
    width: 100%;
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.trilhas-progress-time {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    color: var(--trilhas-muted);
    font-family: monospace;
    font-size: 15px;
    font-weight: 600;
}

.trilhas-player-button {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--trilhas-soft);
    color: var(--trilhas-brand-strong);
    font-size: 18px;
}

.trilhas-player-button.primary {
    width: 64px;
    height: 64px;
    background: var(--trilhas-brand);
    color: #fff;
    font-size: 22px;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.trilhas-player-button.rate {
    width: 66px;
    height: 64px;
    border-radius: 12px;
    background: var(--trilhas-brand);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.trilhas-player-button.hold-seek {
    width: clamp(72px, 21vw, 108px);
    height: 54px;
    border-radius: 999px;
    font-size: 16px;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.trilhas-player-button.hold-seek:focus-visible {
    outline: 3px solid rgba(33, 150, 243, 0.35);
    outline-offset: 3px;
}

.trilhas-player-button.hold-seek:active,
.trilhas-player-button.hold-seek.is-holding {
    background: #1976d2;
    color: #fff;
    transform: translateY(2px) scale(0.96);
    box-shadow: none;
}

.trilhas-player-button.active {
    background: var(--trilhas-brand);
    color: #fff;
}

.trilhas-player-button.is-unavailable,
.trilhas-player-button:disabled {
    opacity: 0.34;
    cursor: not-allowed;
    pointer-events: none;
}

.trilhas-progress {
    width: calc(100% - 24px);
    align-self: center;
    height: 12px;
    border: none;
    border-radius: 999px;
    background: #dce6f1;
    box-shadow: none;
    cursor: pointer;
    display: block;
    padding: 0;
    margin: 12px 0 8px;
    position: relative;
    touch-action: none;
}

.trilhas-progress:hover,
.trilhas-progress:focus-visible {
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
    outline: none;
}

.trilhas-progress-fill {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: inherit;
    background: var(--trilhas-brand);
    pointer-events: none;
}

.trilhas-progress-thumb {
    position: absolute;
    top: 50%;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 4px solid var(--trilhas-brand);
    box-shadow: 0 1px 5px rgba(15, 23, 42, 0.28);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.trilhas-modal-overlay {
    position: fixed;
    inset: 0;
    /* Acima da barra do topo (z-index 1000) e abaixo do player de vídeo (2000). */
    z-index: 1500;
    display: grid;
    place-items: center;
    background: rgba(12, 22, 42, 0.52);
    padding: 18px;
}

.trilhas-modal {
    width: min(720px, 100%);
    max-height: calc(100vh - 36px);
    overflow: auto;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
    padding: 20px 22px;
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.trilhas-modal--card {
    width: min(660px, 100%);
}

.trilhas-modal--track {
    width: min(760px, 100%);
}

.trilhas-modal-header {
    margin: -20px -22px 14px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 34px;
    background: var(--trilhas-header);
    border-radius: 18px 18px 0 0;
}

.trilhas-modal-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.trilhas-confirm-modal {
    width: min(575px, 100%);
    border-radius: 12px;
    padding: 24px;
    background: #fff;
}

.trilhas-confirm-header {
    align-items: flex-start;
    margin-bottom: 16px;
}

.trilhas-confirm-header h2 {
    color: #1f2f4d;
    font-size: 14px;
    line-height: 1.2;
    font-weight: 700;
}

.trilhas-confirm-close {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.16);
    color: #ef4444;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: 160ms ease;
}

.trilhas-confirm-close:hover {
    background: #ffffff;
    transform: scale(1.04);
}

.trilhas-modal-header .trilhas-icon-btn[data-modal-close] {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.16);
    color: #ef4444;
    font-size: 18px;
    line-height: 1;
}

.trilhas-modal-header .trilhas-icon-btn[data-modal-close]:hover {
    background: #ffffff;
    transform: scale(1.04);
}

.trilhas-confirm-message {
    margin: 0 0 26px;
    color: #5f6f93;
    font-size: 21px;
    line-height: 1.45;
}

.trilhas-confirm-actions {
    justify-content: center;
}

.trilhas-confirm-delete {
    min-height: 46px;
    border: none;
    border-radius: 8px;
    padding: 0 18px;
    font-family: inherit;
    font-size: 20px;
    font-weight: 800;
    cursor: pointer;
}

.trilhas-confirm-delete {
    min-width: 158px;
    color: #fff;
    background: #d12b2b;
}

.trilhas-confirm-delete:disabled {
    opacity: 0.72;
    cursor: wait;
}

.trilhas-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.trilhas-track-card-title {
    color: var(--trilhas-header-strong);
    font-size: 17px;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    margin-top: 2px;
}

.trilhas-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #66789b;
    font-size: 13px;
    font-weight: 700;
}

.trilhas-field input {
    height: 52px;
    border: 1px solid rgba(169, 186, 214, 0.62);
    border-radius: 14px;
    padding: 0 16px;
    color: var(--trilhas-text);
    font: inherit;
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.trilhas-field input:focus {
    outline: none;
    border-color: rgba(33, 150, 243, 0.75);
    box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.12);
}

.trilhas-field input[type="file"] {
    height: auto;
    padding: 10px;
}

.trilhas-upload-progress {
    height: 9px;
    background: var(--trilhas-soft);
    border-radius: 999px;
    overflow: hidden;
}

.trilhas-upload-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--trilhas-brand);
}

body.dark-mode.trilhas-page,
body.dark-mode .trilhas-page {
    --trilhas-bg: #2c2c2c;
    --trilhas-surface: #333333;
    --trilhas-soft: #404040;
    --trilhas-text: #ffffff;
    --trilhas-muted: #d8d8d8;
    --trilhas-line: rgba(255, 255, 255, 0.16);
}

body.dark-mode .trilhas-search-field,
body.dark-mode .trilhas-card-item,
body.dark-mode .trilhas-track-row,
body.dark-mode .trilhas-public-track-row,
body.dark-mode .trilhas-player,
body.dark-mode .trilhas-modal {
    background: #333333;
}

body.dark-mode .trilhas-modal {
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
}

body.dark-mode .trilhas-track-card-title {
    color: #f4f7ff;
}

body.dark-mode .trilhas-field {
    color: #d8d8d8;
}

body.dark-mode .trilhas-field input {
    background: #404040;
    border-color: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

body.dark-mode .trilhas-field input:focus {
    border-color: rgba(78, 166, 255, 0.82);
    box-shadow: 0 0 0 4px rgba(78, 166, 255, 0.16);
}

body.dark-mode .trilhas-file-name {
    color: #d8d8d8;
}

@media (max-width: 820px) {
    .trilhas-public-hero {
        padding: 32px 20px;
    }

    .trilhas-public-hero-inner {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }

    .trilhas-public-hero h1 {
        font-size: 28px;
    }

    .trilhas-public-hero p {
        font-size: 15px;
    }

    .trilhas-company-logo-frame {
        width: 150px;
        min-height: 70px;
        margin: 0 auto;
    }

    .trilhas-public-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .trilhas-public-track-row {
        padding: 12px;
        gap: 8px;
        flex-wrap: nowrap; /* Mantém horizontal mas cuidando do overflow */
    }

    .trilhas-track-play {
        padding: 4px;
    }

    .trilhas-public-track-main strong {
        font-size: 14px;
        white-space: normal; /* Permite quebra em mobile para evitar estouro */
        line-height: 1.2;
    }

    .trilhas-player {
        width: calc(100% - 32px);
        box-sizing: border-box;
        bottom: 16px;
        padding: 8px;
        overflow: hidden;
    }

    .trilhas-player-controls {
        gap: 2px;
        justify-content: center;
        max-width: 100%;
    }

    .trilhas-player-controls-main,
    .trilhas-player-controls-secondary {
        gap: 4px;
    }

    .trilhas-player-row-top,
    .trilhas-player-info {
        width: 100%;
        min-width: 0;
        overflow: hidden;
    }
}

@media (max-width: 480px) {
    .trilhas-player-info strong {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

}

@media (max-width: 360px) {
    .trilhas-player {
        width: calc(100% - 32px);
        padding: 6px;
    }

    .trilhas-player-controls {
        gap: 0;
    }

    .trilhas-player-controls-main,
    .trilhas-player-controls-secondary {
        gap: 2px;
    }
}

/* Pesquisa no cabeçalho principal: lupa que expande para o campo */
.trilhas-public-hero-search {
    display: none;
}

/* Sem a busca, o hero recolhido ficaria vazio: some ao abrir um card */
.trilhas-public-hero.collapsed,
.trilhas-public-page .trilhas-hero-toggle {
    display: none;
}

.trilhas-public-hero.collapsed + .trilhas-public-shell {
    margin-top: 16px;
}

.trilhas-topbar-search {
    position: absolute;
    top: 50%;
    right: 12px;
    left: auto;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.barra-topo.is-search-open .trilhas-topbar-search {
    left: 12px;
}

.barra-topo.is-search-open .titulo {
    visibility: hidden;
}

.trilhas-topbar-search input {
    width: 0;
    min-width: 0;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font: inherit;
    font-size: 16px; /* evita zoom automático do iOS ao focar */
    opacity: 0;
    pointer-events: none;
    outline: none;
    transition: width 0.25s ease, opacity 0.2s ease, padding 0.25s ease;
}

.trilhas-topbar-search input::placeholder {
    color: rgba(255, 255, 255, 0.75);
}

.barra-topo.is-search-open .trilhas-topbar-search input {
    flex: 1;
    width: 100%;
    padding: 0 12px;
    opacity: 1;
    pointer-events: auto;
}

.trilhas-topbar-search-toggle {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: var(--ui-header-control-bg);
    color: var(--ui-header-control-text);
    font-size: 18px;
    cursor: pointer;
}

.trilhas-topbar-search-toggle:hover,
.trilhas-topbar-search-toggle:focus-visible {
    background: var(--ui-header-control-bg-hover);
    outline: none;
}

@media (min-width: 821px) {
    .trilhas-topbar-search {
        right: 20px;
    }

    .barra-topo.is-search-open .trilhas-topbar-search {
        left: auto;
    }

    .barra-topo.is-search-open .titulo {
        visibility: visible;
    }

    .barra-topo.is-search-open .trilhas-topbar-search input {
        flex: none;
        width: 360px;
    }
}

/* Mobile: player ancorado em faixa própria; a página rola somente na área acima dele */
@media (max-width: 820px) {
    html.has-trilhas-player-docked {
        height: 100%;
        overflow: hidden;
    }

    html.has-trilhas-player-docked body.trilhas-page {
        height: calc(100vh - var(--trilhas-player-height, 0px));
        height: calc(100dvh - var(--trilhas-player-height, 0px));
        min-height: 0;
        overflow-y: auto;
    }

    html.has-trilhas-player-docked body.trilhas-page > * {
        flex-shrink: 0;
    }

    .trilhas-public-hero.collapsed + .trilhas-public-shell {
        margin-top: 0;
    }

    html.has-trilhas-player-docked .trilhas-public-track-list {
        padding-bottom: 24px;
    }

    html.has-trilhas-player-docked .trilhas-player {
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        transform: none;
        border-width: 1px 0 0;
        border-radius: 0;
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
        padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px));
    }

    /* Card aberto: cabeçalho do card fixo e a lista de faixas rola apenas na própria área */
    html.is-trilhas-detail-open {
        height: 100%;
        overflow: hidden;
    }

    html.is-trilhas-detail-open body.trilhas-page {
        height: calc(100vh - var(--trilhas-player-height, 0px));
        height: calc(100dvh - var(--trilhas-player-height, 0px));
        min-height: 0;
        overflow: hidden;
    }

    html.is-trilhas-detail-open .rodape {
        display: none;
    }

    html.is-trilhas-detail-open body.trilhas-page > .trilhas-public-shell {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        margin-bottom: 0;
    }

    html.is-trilhas-detail-open .trilhas-public-detail {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    html.is-trilhas-detail-open .trilhas-public-detail-header {
        flex-shrink: 0;
        margin: 0 -16px;
        padding: 10px 16px;
        background: var(--trilhas-bg);
        border-bottom: 1px solid var(--trilhas-line);
    }

    html.is-trilhas-detail-open .trilhas-public-track-list {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        margin: 0 -16px;
        padding: 12px 16px 24px;
    }
}

@media (min-width: 821px) and (max-width: 1180px) {
    .trilhas-public-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Botão "Sair" da topbar do gerenciamento (Showtrix Drive) */
.trilhas-logout-btn {
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
}

/* ============================================================
   CONTAS: visibilidade, espaço usado e perfil da página
   ============================================================ */

.trilhas-public-brand[hidden] {
    display: none;
}

.trilhas-field select {
    height: 52px;
    border: 1px solid rgba(169, 186, 214, 0.62);
    border-radius: 14px;
    padding: 0 12px;
    color: var(--trilhas-text);
    font: inherit;
    background: #fff;
}

.trilhas-field input[type="color"] {
    width: 96px;
    padding: 6px;
    cursor: pointer;
}

body.dark-mode .trilhas-field select {
    background: #404040;
    border-color: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.trilhas-visibility {
    display: inline-flex !important;
    align-items: center;
    gap: 3px;
    margin: 0 !important;
}

.trilhas-visibility--unlisted {
    color: var(--trilhas-brand-strong);
}

.trilhas-visibility--private {
    color: var(--trilhas-danger);
}

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

.trilhas-usage {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 280px;
    margin-top: 10px;
}

.trilhas-usage.hidden {
    display: none;
}

.trilhas-usage-bar {
    height: 8px;
    border-radius: 999px;
    background: var(--trilhas-soft);
    overflow: hidden;
}

.trilhas-usage-bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--trilhas-brand);
    transition: width 240ms ease;
}

.trilhas-usage.is-warning .trilhas-usage-bar span {
    background: #ef9a00;
}

.trilhas-usage.is-full .trilhas-usage-bar span {
    background: var(--trilhas-danger);
}

.trilhas-usage small {
    color: var(--trilhas-muted);
    font-size: 12px;
}

.trilhas-modal--profile {
    width: min(560px, 100%);
}

.trilhas-profile-address {
    color: var(--trilhas-muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.trilhas-profile-logo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
}

.trilhas-profile-logo-frame {
    width: 140px;
    min-height: 70px;
    box-shadow: none;
    border: 1px solid var(--trilhas-line);
    color: var(--trilhas-muted);
    font-size: 28px;
}

.trilhas-profile-logo-frame .trilhas-company-logo {
    width: 116px;
}

.trilhas-profile-logo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.trilhas-profile-logo-actions label {
    position: relative;
    cursor: pointer;
}

.trilhas-profile-password {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px dashed var(--trilhas-line);
}

.trilhas-profile-password h3 {
    color: var(--trilhas-text);
    font-size: 15px;
}

@media (max-width: 820px) {
    .trilhas-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Página pública: barra do topo sempre "Showtrix Drive", em branco gelo. */
.trilhas-public-page {
    --app-header-bg: #f4f6f8;
    --ui-header-control-bg: rgba(23, 39, 68, 0.06);
    --ui-header-control-bg-hover: rgba(23, 39, 68, 0.12);
    --ui-header-control-text: #172744;
}

.trilhas-public-page .barra-topo {
    color: #172744;
    border-bottom: 1px solid rgba(23, 39, 68, 0.08);
}

.trilhas-public-page .trilhas-topbar-search input {
    background: rgba(23, 39, 68, 0.06);
    color: #172744;
}

.trilhas-public-page .trilhas-topbar-search input::placeholder {
    color: rgba(23, 39, 68, 0.55);
}

/* Cor do tema clara: texto e busca do hero ficam escuros para manter o contraste. */
.trilhas-public-hero.is-light h1 {
    color: #172744;
}

.trilhas-public-hero.is-light .trilhas-public-hero-search .trilhas-search-field {
    background: rgba(23, 39, 68, 0.08);
    border-color: rgba(23, 39, 68, 0.18);
}

.trilhas-public-hero.is-light .trilhas-public-hero-search .trilhas-search-field i,
.trilhas-public-hero.is-light .trilhas-public-hero-search .trilhas-search-field input {
    color: #172744 !important;
}

.trilhas-public-hero.is-light .trilhas-public-hero-search .trilhas-search-field input::placeholder {
    color: rgba(23, 39, 68, 0.6);
}

/* Título longo: não encosta no botão de busca em telas estreitas. */
.trilhas-public-page .barra-topo .titulo {
    max-width: 100%;
    padding: 0 52px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================
   VÍDEOS: selo na lista e player em janela sobre a página
   ============================================================ */

.trilhas-media-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--trilhas-soft);
    color: var(--trilhas-brand-strong);
    font-size: 11px;
    font-weight: 700;
    vertical-align: middle;
}

html.has-trilhas-video-open,
html.has-trilhas-video-open body {
    overflow: hidden;
}

.trilhas-video-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(8, 12, 22, 0.82);
}

.trilhas-video-dialog {
    width: min(1100px, 100%);
    max-height: calc(100vh - 36px);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.trilhas-video-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #fff;
}

.trilhas-video-title {
    min-width: 0;
}

.trilhas-video-title .trilhas-overline {
    color: rgba(255, 255, 255, 0.7);
}

.trilhas-video-title strong {
    display: block;
    overflow: hidden;
    font-size: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trilhas-video-nav {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 8px;
}

.trilhas-video-nav .trilhas-player-button {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 18px;
}

.trilhas-video-nav .trilhas-player-button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.26);
}

.trilhas-video-nav .trilhas-player-button:disabled {
    opacity: 0.35;
    cursor: default;
}

.trilhas-video-nav .trilhas-player-close {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.trilhas-video-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: calc(100vh - 110px);
    border-radius: 12px;
    background: #000;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.trilhas-video-media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
    object-fit: contain;
}

@media (max-width: 820px) {
    .trilhas-video-overlay {
        padding: 10px;
    }

    .trilhas-video-frame {
        border-radius: 8px;
    }
}

/* Painel da conta com cor de tema clara: texto da barra do topo escuro. */
body.has-light-theme:not(.dark-mode) .barra-topo,
body.has-light-theme:not(.dark-mode) .barra-topo .btn-voltar {
    --ui-header-control-bg: rgba(23, 39, 68, 0.08);
    --ui-header-control-bg-hover: rgba(23, 39, 68, 0.16);
    --ui-header-control-text: #172744;
    color: #172744;
}

body.has-light-theme:not(.dark-mode) .trilhas-btn-public {
    color: #172744;
    border: 1px solid rgba(23, 39, 68, 0.18);
}

/* Painel da conta: título à esquerda e botões (Página Pública, tema, Perfil, Sair) à direita. */
.barra-topo .topbar-side--right {
    left: auto;
    right: 20px;
    gap: 10px;
}

/* Botões do topo só com ícone, no mesmo formato redondo do botão de tema. */
.topbar-icon-btn {
    padding: 0;
    text-decoration: none;
    font-size: inherit;
}

.barra-topo .titulo--painel {
    width: 100%;
    padding-right: 190px;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 820px) {
    .barra-topo .topbar-side--right {
        right: 12px;
        gap: 8px;
    }

    .barra-topo .titulo--painel {
        padding-right: 175px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .barra-topo .titulo--painel {
        font-size: 12px;
    }
}

/* Página pública: crédito em fonte pequena embaixo do nome do sistema. */
.trilhas-public-page .barra-topo .titulo {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.25;
}

.trilhas-public-page .titulo-nome,
.trilhas-public-page .titulo-credito {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trilhas-public-page .titulo-credito {
    font-size: 10px;
    font-weight: 500;
    opacity: 0.65;
}

/* Rodapé com crédito (login, painel da conta e painel do dono). */
.rodape-credito {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 12px 16px;
    line-height: 1.3;
}

.rodape-credito small {
    font-size: 10px;
    font-weight: 500;
    opacity: 0.75;
}

/* ============================================================
   PAINEL DA CONTA NO CELULAR
   Lista de cards e card aberto em telas separadas; mover mídias arrastando a alça ⋮⋮ com o dedo.
   ============================================================ */

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

@media (max-width: 820px) {
    .trilhas-admin-shell {
        width: calc(100vw - 20px);
        margin: 12px auto 16px;
    }

    .trilhas-admin-shell .trilhas-toolbar {
        padding: 14px 16px;
        margin-bottom: 12px;
    }

    .trilhas-admin-shell .trilhas-toolbar h1 {
        font-size: 19px;
    }

    /* No celular a descrição sai: sobra o título e o espaço usado. */
    .trilhas-admin-shell .trilhas-toolbar p {
        display: none;
    }

    .trilhas-admin-shell .trilhas-usage {
        max-width: none;
    }

    .trilhas-admin-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    /* Uma tela por vez: lista de cards OU o card aberto. */
    .trilhas-admin-grid:not(.is-mobile-card-open) .trilhas-manage-panel,
    .trilhas-admin-grid.is-mobile-card-open .trilhas-card-list-panel {
        display: none;
    }

    .trilhas-panel {
        padding: 14px;
    }

    .trilhas-create-card-btn {
        width: 100%;
    }

    .trilhas-card-header-actions {
        display: block;
    }

    .trilhas-card-item {
        padding: 12px 10px;
    }

    .trilhas-mobile-back {
        display: inline-flex;
        margin-bottom: 12px;
    }

    .trilhas-manage-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .trilhas-manage-title {
        min-width: 0;
    }

    .trilhas-manage-header h2 {
        overflow-wrap: anywhere;
    }

    .trilhas-actions {
        justify-content: flex-start;
        flex-wrap: nowrap;
    }

    .trilhas-actions #trilhas-add-track {
        flex: 1;
        min-height: 42px;
    }

    .trilhas-actions .trilhas-icon-btn {
        flex: 0 0 42px;
        width: 42px;
        height: 42px;
    }

    /* Linha da mídia: alça ⋮⋮ à esquerda, nome ocupando a largura, botões embaixo. */
    .trilhas-track-row {
        flex-wrap: wrap;
        gap: 6px 8px;
        padding: 8px;
        cursor: default;
    }

    /* Alça maior para o dedo; touch-action: none impede que o toque role a página em vez de arrastar. */
    .trilhas-track-row .trilhas-drag-handle {
        width: 34px;
        height: 44px;
        font-size: 24px;
        touch-action: none;
        background: var(--trilhas-soft);
        color: var(--trilhas-brand-strong);
    }

    .trilhas-track-row.is-touch-dragging {
        z-index: 5;
        transition: none;
        background: var(--trilhas-surface);
        border-color: var(--trilhas-brand);
        box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
    }

    .trilhas-track-row .trilhas-track-play {
        flex: 1 1 calc(100% - 46px);
        padding: 4px;
    }

    .trilhas-track-main strong {
        white-space: normal;
        overflow-wrap: anywhere;
        line-height: 1.25;
    }

    .trilhas-track-row .trilhas-track-buttons {
        width: 100%;
        justify-content: flex-end;
        padding-top: 6px;
        border-top: 1px dashed var(--trilhas-line);
    }

    .trilhas-track-row .trilhas-icon-btn,
    .trilhas-track-row .trilhas-download-link,
    .trilhas-track-row .trilhas-track-share-link {
        width: 38px;
        height: 38px;
    }

    .trilhas-empty-state {
        min-height: 160px;
    }

    /* Janelas (adicionar mídia, perfil): botões em largura total. */
    .trilhas-modal {
        padding: 16px;
    }

    .trilhas-modal-header {
        margin: -16px -16px 14px;
    }

    .trilhas-modal-actions {
        flex-wrap: wrap;
    }

    .trilhas-modal-actions .trilhas-btn {
        flex: 1 1 140px;
    }
}

/* Tema escuro do painel da conta: a barra do topo segue a cor do tema (o dashboard.css forçava o azul padrão).
   --trilhas-header-strong já é a versão escurecida quando a cor é clara, então o texto branco continua legível. */
body.dark-mode.has-account-theme header.barra-topo {
    background-color: var(--trilhas-header-strong) !important;
}

/* Tema escuro: botões secundários tinham fundo branco fixo com texto branco (ficavam invisíveis). */
body.dark-mode .trilhas-btn-secondary,
body.dark-mode .trilhas-modal-actions .trilhas-btn-secondary {
    background: #404040;
    border-color: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

body.dark-mode .trilhas-btn-secondary:hover {
    background: #4a4a4a;
    border-color: var(--trilhas-brand);
    color: #ffffff;
}

.trilhas-profile-address a {
    color: var(--trilhas-brand-strong);
    font-weight: 600;
}

body.dark-mode .trilhas-profile-address a {
    color: #ffffff;
}

/* Celular: cabeçalho só com o título; botões (Página Pública, tema, Perfil, Sair) no quadro do topo. */
.trilhas-toolbar-actions-slot:empty {
    display: none;
}

@media (max-width: 820px) {
    .barra-topo .titulo--painel {
        padding-right: 0;
        text-align: center;
    }

    /* Uma linha: card "Mídias" (pizza + título + status) à esquerda e os botões à direita, fora do card. */
    .trilhas-admin-shell .trilhas-toolbar {
        flex-direction: row;
        align-items: stretch;
        gap: 10px;
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .trilhas-admin-shell .trilhas-storage-card {
        flex: 1;
        min-width: 0;
        justify-content: flex-start;
        gap: 12px;
        padding: 12px 14px;
        border: 1px solid var(--trilhas-line);
        border-radius: 10px;
        background: var(--trilhas-surface);
        box-shadow: var(--trilhas-shadow);
    }

    .trilhas-admin-shell .trilhas-storage-pie {
        order: -1;
        width: 44px;
        height: 44px;
    }

    .trilhas-admin-shell .trilhas-storage-label {
        margin-top: 2px;
        font-size: 11px;
        line-height: 1.3;
    }

    .topbar-side.is-in-toolbar {
        position: static;
        display: grid;
        grid-template-columns: repeat(2, 40px);
        align-content: center;
        gap: 8px;
    }

    .topbar-side.is-in-toolbar .theme-toggle-btn {
        width: 40px;
        height: 40px;
        border: 1px solid var(--trilhas-line);
        background: var(--trilhas-soft);
        color: var(--trilhas-brand-strong);
    }

    body.dark-mode .topbar-side.is-in-toolbar .theme-toggle-btn {
        background: #404040;
        color: #ffffff;
    }
}

/* Tema escuro: título do quadro do topo legível sobre o fundo escuro. */
body.dark-mode .trilhas-toolbar h1 {
    color: #ffffff;
}

/* ============================================================
   ARMAZENAMENTO: pizza (usado x livre) no quadro "Mídias"
   ============================================================ */

/* Computador: título e descrição à esquerda, pizza à direita, tudo no mesmo quadro. */
.trilhas-storage-card {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.trilhas-storage-pie {
    --storage-color: var(--trilhas-brand);
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 50%;
    background: conic-gradient(var(--storage-color) 0 var(--storage-angle, 0deg), var(--trilhas-soft) var(--storage-angle, 0deg) 360deg);
    /* Anel na cor da superfície separa a pizza do fundo do quadro. */
    box-shadow: 0 0 0 2px var(--trilhas-surface), 0 0 0 3px var(--trilhas-line);
    cursor: help;
}

.trilhas-storage-pie.hidden,
.trilhas-storage-label.hidden {
    display: none;
}

/* Cores de status: sempre acompanhadas do texto ("quase cheio", "espaço esgotado"). */
.trilhas-storage-pie.is-warning {
    --storage-color: #ef9a00;
}

.trilhas-storage-pie.is-full {
    --storage-color: var(--trilhas-danger);
}

.trilhas-storage-label {
    display: block;
    margin-top: 8px;
    color: var(--trilhas-muted);
    font-size: 12px;
}


/* Celular: a primeira linha (card "Mídias" + botões) fica fixa sob o cabeçalho; o resto rola por baixo. */
@media (max-width: 820px) {
    .trilhas-admin-shell .trilhas-toolbar {
        position: sticky;
        top: var(--trilhas-header-height, 45px);
        z-index: 900; /* abaixo do cabeçalho (1000) e das janelas (1500) */
        margin: -12px -10px 12px;
        padding: 12px 10px 10px;
        background: var(--trilhas-bg);
    }
}

/* Celular (mockup): card "Mídias" compacto + quatro botões numa fileira, espaçados por igual. */
@media (max-width: 820px) {
    .trilhas-admin-shell .trilhas-toolbar {
        align-items: center;
    }

    .trilhas-admin-shell .trilhas-storage-card {
        flex: 0 1 auto;
        gap: 10px;
        padding: 10px 12px;
    }

    .trilhas-admin-shell .trilhas-storage-pie {
        width: 38px;
        height: 38px;
    }

    .trilhas-admin-shell .trilhas-toolbar h1 {
        font-size: 17px;
        line-height: 1.15;
    }

    .trilhas-admin-shell .trilhas-storage-label span {
        display: block;
        white-space: nowrap;
    }

    .trilhas-toolbar-actions-slot {
        flex: 1;
        min-width: 0;
    }

    .topbar-side.is-in-toolbar {
        display: flex;
        justify-content: space-around;
        gap: 6px;
    }

    .topbar-side.is-in-toolbar .theme-toggle-btn {
        flex: 0 0 38px;
        width: 38px;
        height: 38px;
    }
}

/* Janelas sem borda: a faixa do título encosta nas bordas (antes sobrava moldura branca na janela de excluir). */
.trilhas-modal,
.trilhas-confirm-modal,
body.dark-mode .trilhas-modal {
    border: 0;
}

.trilhas-confirm-modal {
    padding: 20px 22px; /* igual às outras janelas, para a faixa do título (margem -20px -22px) encostar nas bordas */
    border-radius: 18px;
}

.trilhas-confirm-header {
    align-items: center;
}

.trilhas-confirm-header h2 {
    color: #ffffff;
}

@media (max-width: 820px) {
    .trilhas-confirm-modal {
        padding: 16px;
    }
}

body.dark-mode .trilhas-confirm-message {
    color: #e0e0e0;
}

/* "Painel de Mídias" é mais longo: os botões mantêm o tamanho e o título quebra em duas linhas se faltar espaço. */
@media (max-width: 820px) {
    .trilhas-admin-shell .trilhas-storage-card {
        flex: 1 1 auto;
        min-width: 0;
    }

    .trilhas-admin-shell .trilhas-toolbar-main {
        min-width: 0;
    }

    .trilhas-toolbar-actions-slot {
        flex: 0 0 auto;
    }

    .topbar-side.is-in-toolbar {
        gap: 4px;
    }

    .topbar-side.is-in-toolbar .theme-toggle-btn {
        flex: 0 0 36px;
        width: 36px;
        height: 36px;
    }
}

/* ============================================================
   PERMISSÕES DO CARD (copiar link / download na página pública)
   ============================================================ */

.trilhas-permissions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--trilhas-line);
    border-radius: 14px;
}

.trilhas-permissions legend {
    padding: 0 6px;
    color: #66789b;
    font-size: 13px;
    font-weight: 700;
}

.trilhas-permission {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}

.trilhas-permission input {
    width: 20px;
    height: 20px;
    margin: 2px 0 0;
    flex-shrink: 0;
    accent-color: var(--trilhas-brand);
    cursor: pointer;
}

.trilhas-permission strong {
    display: block;
    color: var(--trilhas-text);
    font-size: 14px;
}

.trilhas-permission small {
    color: var(--trilhas-muted);
    font-size: 12px;
}

.trilhas-permission-off {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--trilhas-muted);
}

body.dark-mode .trilhas-permissions legend {
    color: #d8d8d8;
}

/* ============================================================
   SWITCH "NÃO EXECUTAR PRÓXIMA" (cabeçalho do card na página pública)
   ============================================================ */

.trilhas-public-detail-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    justify-self: end;
    gap: 12px;
}

.trilhas-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

/* O checkbox fica invisível, mas continua acessível pelo teclado e leitores de tela. */
.trilhas-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.trilhas-switch-track {
    position: relative;
    flex-shrink: 0;
    width: 40px;
    height: 22px;
    border-radius: 999px;
    background: #c5cee0;
    transition: background 160ms ease;
}

.trilhas-switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 160ms ease;
}

.trilhas-switch input:checked + .trilhas-switch-track {
    background: var(--trilhas-brand);
}

.trilhas-switch input:checked + .trilhas-switch-track .trilhas-switch-thumb {
    transform: translateX(18px);
}

.trilhas-switch input:focus-visible + .trilhas-switch-track {
    outline: 2px solid var(--trilhas-brand);
    outline-offset: 2px;
}

.trilhas-switch-label {
    color: var(--trilhas-text);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
}

@media (max-width: 640px) {
    .trilhas-public-detail-actions {
        gap: 6px;
    }

    .trilhas-switch {
        flex-direction: column;
        gap: 3px;
    }

    .trilhas-switch-label {
        max-width: 72px;
        font-size: 10px;
        text-align: center;
    }
}

@media (max-width: 640px) {
    .trilhas-switch-label {
        max-width: 84px;
    }
}

/* Nome do card no cabeçalho da página pública: um pouco menor. */
.trilhas-public-detail-title h2 {
    font-size: 26px;
}

@media (max-width: 640px) {
    .trilhas-public-detail-title h2 {
        font-size: 18px !important;
    }
}

/* ============================================================
   DOCUMENTOS: abas "Mídias / Documentos" e visualizador
   ============================================================ */

.trilhas-tabs {
    display: flex;
    gap: 6px;
    margin-top: 14px;
    border-bottom: 1px solid var(--trilhas-line);
}

.trilhas-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: -1px;
    padding: 10px 14px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: var(--trilhas-muted);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.trilhas-tab:hover {
    color: var(--trilhas-text);
}

.trilhas-tab.active {
    border-bottom-color: var(--trilhas-brand);
    color: var(--trilhas-brand-strong);
}

.trilhas-tab-count {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--trilhas-soft);
    color: var(--trilhas-text);
    font-size: 12px;
    text-align: center;
}

.trilhas-tabs--public {
    margin: -12px 0 16px;
}

body.dark-mode .trilhas-tab.active {
    color: #ffffff;
}

.trilhas-document-icon {
    font-size: 26px;
    color: var(--trilhas-brand-strong);
}

.trilhas-document-row .trilhas-track-main small,
.trilhas-document-row .trilhas-public-track-main small {
    text-transform: none;
}

.trilhas-document-dialog {
    height: calc(100vh - 36px);
}

.trilhas-document-frame-wrap {
    flex: 1;
    min-height: 0;
    position: relative;
    border-radius: 12px;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.trilhas-document-frame-wrap.is-image {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    box-shadow: none;
}

.trilhas-document-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.trilhas-video-nav a.trilhas-player-button {
    text-decoration: none;
}

@media (max-width: 820px) {
    /* No celular o cabeçalho do card é fixo com borda própria: as abas ficam logo abaixo, sem sobrepor. */
    .trilhas-tabs--public {
        flex-shrink: 0;
        margin: 10px 0 12px;
    }

    .trilhas-tab {
        padding: 9px 10px;
        font-size: 13px;
    }
}
