@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Newsreader:opsz,wght@6..72,600&display=swap');

:root {
    --app-ink: #18211d;
    --app-muted: #68736d;
    --app-primary: #176b52;
    --app-primary-dark: #0f503d;
    --app-accent: #d9a441;
    --app-surface: #ffffff;
    --app-canvas: #f3f6f4;
    --app-border: #dce4df;
    --app-danger: #a63e3e;
}

* {
    box-sizing: border-box;
    letter-spacing: 0;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--app-ink);
    background:
        linear-gradient(135deg, rgba(23, 107, 82, 0.06), transparent 38%),
        var(--app-canvas);
    font-family: "DM Sans", sans-serif;
}

.app-header {
    position: sticky;
    z-index: 80;
    top: 0;
    border-bottom: 1px solid rgba(220, 228, 223, 0.9);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 4px 24px rgba(24, 33, 29, 0.04);
    backdrop-filter: blur(16px);
}

.app-header-inner {
    display: grid;
    grid-template-columns: minmax(210px, 1fr) auto minmax(70px, 1fr);
    align-items: center;
    width: min(1180px, calc(100% - 32px));
    min-height: 72px;
    margin: 0 auto;
    gap: 24px;
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    width: fit-content;
    color: var(--app-ink);
    text-decoration: none;
}

.brand-symbol {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 7px;
    color: #fff;
    background: var(--app-primary);
    font-family: "Newsreader", serif;
    font-weight: 600;
}

.brand-copy {
    display: grid;
    line-height: 1.08;
}

.brand-copy strong {
    font-family: "Newsreader", serif;
    font-size: 1.08rem;
}

.brand-copy small {
    margin-top: 3px;
    color: var(--app-muted);
    font-size: 0.68rem;
}

.app-nav {
    display: flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--app-border);
    border-radius: 7px;
    background: var(--app-canvas);
}

.app-nav a {
    padding: 8px 13px;
    border-radius: 5px;
    color: #536059;
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.app-nav a:hover,
.app-nav a.active {
    color: var(--app-primary-dark);
    background: #fff;
    box-shadow: 0 2px 8px rgba(24, 33, 29, 0.07);
}

.nav-icon,
.nav-short-label {
    display: none;
}

.logout-form {
    justify-self: end;
}

.user-menu {
    display: flex;
    align-items: center;
    justify-self: end;
    gap: 10px;
}

.current-user {
    max-width: 140px;
    overflow: hidden;
    color: var(--app-ink);
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-logout {
    border: 0;
    color: var(--app-muted);
    background: transparent;
    font-size: 0.85rem;
    font-weight: 600;
}

.header-logout:hover {
    color: var(--app-danger);
}

h1, h2, h3, .display-title {
    font-family: "Newsreader", serif;
    font-weight: 600;
}

.app-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 72px;
}

.form-shell {
    max-width: 760px;
}

.role-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.role-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.role-option span,
.role-badge {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    padding: 7px 12px;
    border: 1px solid var(--app-border);
    border-radius: 18px;
    color: #45534c;
    background: #f7f9f8;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.role-option > span {
    gap: 7px;
    border-width: 2px;
    transition: color 140ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.role-check {
    display: grid !important;
    width: 18px;
    min-height: 18px !important;
    padding: 0 !important;
    place-items: center;
    border: 1px solid #aebbb4 !important;
    border-radius: 4px !important;
    color: transparent !important;
    background: #fff !important;
    font-size: 12px !important;
    line-height: 1;
}

.role-option:has(input[type="checkbox"]:checked) > span {
    border-color: #0f503d !important;
    color: #fff !important;
    background: #176b52 !important;
    box-shadow: 0 0 0 3px rgba(23, 107, 82, 0.16);
}

.role-option:has(input[type="checkbox"]:checked) .role-check {
    border-color: #fff !important;
    color: #176b52 !important;
}

.role-option:has(input[type="checkbox"]:focus-visible) > span {
    outline: 3px solid rgba(23, 107, 82, 0.25);
    outline-offset: 2px;
}

.role-badge {
    min-height: 28px;
    padding: 4px 9px;
    cursor: default;
}

.dashboard-welcome {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 34px;
    border-radius: 8px;
    color: #fff;
    background: #174d3d;
}

.dashboard-welcome .page-eyebrow,
.dashboard-welcome p {
    color: #c8ddd4;
}

.dashboard-welcome h1 {
    margin: 0;
    font-size: clamp(2.2rem, 5vw, 3.6rem);
}

.dashboard-welcome p {
    margin: 5px 0 0;
}

.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 18px 0 36px;
}

.metric-card {
    display: grid;
    min-height: 118px;
    align-content: center;
    padding: 20px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    color: var(--app-ink);
    background: #fff;
    text-decoration: none;
}

.metric-value {
    font-family: "Newsreader", serif;
    font-size: 1.8rem;
    font-weight: 600;
}

.metric-label {
    overflow: hidden;
    color: var(--app-muted);
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-heading h2 {
    margin: 0;
}

.section-heading a {
    color: var(--app-primary);
    font-weight: 700;
    text-decoration: none;
}

.empty-state {
    display: grid;
    gap: 4px;
    padding: 28px;
    border: 1px dashed #b9c8c0;
    border-radius: 8px;
    color: var(--app-muted);
    background: rgba(255, 255, 255, 0.55);
}

.empty-state strong {
    color: var(--app-ink);
}

.page-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
    padding: 8px 0 22px;
    border-bottom: 1px solid var(--app-border);
}

.page-eyebrow {
    margin-bottom: 6px;
    color: var(--app-primary);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.page-intro h1 {
    margin: 0;
    font-size: clamp(2.2rem, 5vw, 3.4rem);
}

.page-intro p {
    max-width: 620px;
    margin: 6px 0 0;
    color: var(--app-muted);
}

.collection-list {
    display: grid;
    gap: 10px;
}

.collection-item {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    color: var(--app-ink);
    background: rgba(255, 255, 255, 0.94);
    text-decoration: none;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.collection-item:hover {
    border-color: #9db9aa;
    color: var(--app-ink);
    box-shadow: 0 10px 28px rgba(24, 33, 29, 0.07);
    transform: translateY(-2px);
}

.collection-index {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 6px;
    color: var(--app-primary-dark);
    background: #e7f0eb;
    font-weight: 700;
}

.collection-copy {
    display: grid;
    min-width: 0;
}

.collection-copy strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.collection-copy small {
    color: var(--app-muted);
}

.collection-arrow {
    color: var(--app-primary);
    font-size: 1.2rem;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 32px;
}

.app-brand {
    color: var(--app-ink);
    font-family: "Newsreader", serif;
    font-size: 1.35rem;
    font-weight: 600;
    text-decoration: none;
}

.app-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.page-heading {
    margin-bottom: 28px;
}

.page-heading h1,
.page-heading h2 {
    margin-bottom: 4px;
    font-size: clamp(2rem, 5vw, 3rem);
}

.page-heading p {
    margin: 0;
    color: var(--app-muted);
}

.btn {
    min-height: 42px;
    border-radius: 6px;
    font-weight: 600;
}

.btn-primary {
    border-color: var(--app-primary);
    background: var(--app-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    border-color: var(--app-primary-dark);
    background: var(--app-primary-dark);
}

.btn-outline-secondary {
    border-color: #aebbb4;
    color: #34423b;
}

.btn-outline-danger {
    border-color: #d9b2b2;
    color: var(--app-danger);
}

.form-control,
.form-select {
    min-height: 46px;
    border-color: var(--app-border);
    border-radius: 6px;
    background-color: var(--app-surface);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 3px rgba(23, 107, 82, 0.14);
}

.card,
.content-panel {
    border: 1px solid var(--app-border);
    border-radius: 8px;
    background: var(--app-surface);
    box-shadow: 0 12px 36px rgba(24, 33, 29, 0.06);
}

.content-panel {
    padding: 24px;
}

.list-group {
    gap: 10px;
}

.list-group-item {
    border: 1px solid var(--app-border) !important;
    border-radius: 7px !important;
    background: rgba(255, 255, 255, 0.92);
    padding: 16px 18px;
}

.list-group-item-action:hover,
.list-group-item-action:focus {
    border-color: #9db9aa !important;
    background: #fff;
    transform: translateY(-1px);
}

.badge {
    border-radius: 4px;
    padding: 7px 10px;
}

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.login-panel {
    width: min(100%, 430px);
    padding: 36px;
}

.login-mark {
    width: 48px;
    height: 5px;
    margin-bottom: 24px;
    border-radius: 2px;
    background: var(--app-accent);
}

.song-sheet {
    overflow: visible;
    padding: 28px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    background: #fffefb;
    box-shadow: 0 14px 40px rgba(24, 33, 29, 0.07);
}

.performance-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
    gap: 24px;
}

.performance-sidebar {
    position: sticky;
    top: 96px;
}

.media-panel {
    overflow: hidden;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    background: #101714;
    box-shadow: 0 14px 36px rgba(24, 33, 29, 0.12);
}

.media-panel iframe {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
}

.media-caption {
    padding: 11px 14px;
    color: #e7eeea;
    font-size: 0.78rem;
}

.performance-tools {
    position: fixed;
    z-index: 70;
    right: 24px;
    bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 7px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 16px 42px rgba(24, 33, 29, 0.18);
    backdrop-filter: blur(14px);
}

.scroll-toggle {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border: 0;
    border-radius: 6px;
    color: #fff;
    background: var(--app-primary);
    font-size: 1rem;
}

.scroll-speed {
    display: grid;
    gap: 2px;
    min-width: 130px;
}

.scroll-speed label {
    color: var(--app-muted);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
}

.scroll-speed input {
    accent-color: var(--app-primary);
}

.cifra-scroll {
    overflow-x: auto;
    overflow-y: visible;
    padding: 8px 4px 160px;
    margin-bottom: -140px;
}

.cifra-viewport {
    min-width: 0;
}

.cifra {
    width: max-content;
    min-width: 100%;
    font-family: "Courier New", monospace;
    font-size: 18px;
}

.linha-cifra {
    position: relative;
    min-height: 46px;
    margin-bottom: 12px;
}

.acordes {
    position: relative;
    height: 22px;
}

.linha-so-acordes {
    min-height: 38px;
    margin-bottom: 14px;
}

.linha-so-acordes .acordes {
    display: flex;
    align-items: center;
    gap: 28px;
    height: auto;
    min-height: 28px;
}

.linha-so-acordes .acorde {
    position: relative;
    left: auto !important;
    display: inline-block;
}

.acorde {
    position: absolute;
    top: 0;
    color: var(--app-primary);
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.letra {
    line-height: 1.55;
    white-space: pre;
}

@media (max-width: 767px) {
    :root {
        --app-nav-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        --app-nav-height: 68px;
        --app-nav-clearance: calc(var(--app-nav-bottom) + var(--app-nav-height) + 10px);
    }

    body:has(.app-nav) {
        padding-bottom: var(--app-nav-clearance);
    }

    .app-header {
        position: static;
        padding-top: env(safe-area-inset-top, 0px);
        backdrop-filter: none;
    }

    .app-header-inner {
        grid-template-columns: 1fr auto;
        width: min(100% - 24px, 1180px);
        min-height: 66px;
        gap: 10px;
    }

    .user-menu {
        gap: 4px;
    }

    .current-user {
        max-width: 86px;
    }

    .brand-copy small {
        display: none;
    }

    .app-nav {
        position: fixed;
        z-index: 100;
        right: max(8px, env(safe-area-inset-right, 0px));
        bottom: var(--app-nav-bottom);
        left: max(8px, env(safe-area-inset-left, 0px));
        min-height: var(--app-nav-height);
        align-items: stretch;
        gap: 2px;
        padding: 4px;
        border-radius: 18px;
        background: rgba(255, 255, 255, 0.97);
        box-shadow: 0 -8px 26px rgba(24, 33, 29, 0.08);
    }

    .app-nav a {
        display: flex;
        flex: 1 1 0;
        min-width: 0;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 6px 0;
        border-radius: 12px;
        font-size: clamp(9px, 2.5vw, 12px);
        line-height: 1.2;
        text-align: center;
    }

    .app-nav .nav-full-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }

    .nav-short-label,
    .nav-icon {
        display: block;
    }

    .nav-icon {
        width: 22px;
        height: 22px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .app-nav a.active {
        color: #fff;
        background: var(--app-primary);
    }

    .page-intro {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }

    .dashboard-welcome {
        align-items: flex-start;
        flex-direction: column;
        padding: 24px;
    }

    .dashboard-welcome .btn {
        width: 100%;
    }

    .dashboard-metrics {
        grid-template-columns: 1fr 1fr;
    }

    .profile-summary {
        grid-column: 1 / -1;
    }

    .page-intro .btn {
        width: 100%;
    }

    .collection-item {
        grid-template-columns: 40px minmax(0, 1fr) auto;
        gap: 12px;
        padding: 13px;
    }

    .collection-index {
        width: 38px;
        height: 38px;
    }

    .performance-layout {
        display: flex;
        flex-direction: column;
    }

    .performance-main,
    .performance-sidebar {
        width: 100%;
    }

    .performance-sidebar {
        position: static;
        order: -1;
    }

    .performance-tools {
        right: 12px;
        bottom: var(--app-nav-clearance);
        left: 12px;
        justify-content: center;
    }

    .app-shell {
        width: min(100% - 24px, 1120px);
        padding: 18px 0 40px;
    }

    .app-topbar {
        position: sticky;
        z-index: 50;
        top: 0;
        margin: 0 -12px 24px;
        padding: 10px 12px;
        border-bottom: 1px solid var(--app-border);
        background: rgba(243, 246, 244, 0.96);
        backdrop-filter: blur(12px);
    }

    .app-actions {
        width: 100%;
    }

    .app-actions .btn,
    .app-actions form {
        flex: 1 1 auto;
    }

    .app-actions form .btn {
        width: 100%;
    }

    .content-panel,
    .song-sheet,
    .login-panel {
        padding: 20px;
    }

    .page-heading h1,
    .page-heading h2 {
        font-size: 2rem;
    }

    .song-sheet {
        margin-right: -12px;
        margin-left: -12px;
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }

    .cifra {
        font-size: 17px;
    }

    .cifra-scroll {
        overflow-x: hidden;
        margin-bottom: 0;
        padding-bottom: 8px;
    }

    .cifra-viewport {
        overflow: visible;
    }

    .cifra {
        width: 100%;
        min-width: 0;
        font-size: 17px;
    }

    .linha-cifra {
        min-height: 43px;
    }

    .linha-so-acordes .acordes {
        gap: 22px;
    }

    .table-responsive {
        border: 1px solid var(--app-border);
        border-radius: 7px;
        background: #fff;
    }
}

.song-heading {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.transpose-control {
    display: inline-flex;
    align-items: stretch;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--app-border);
    border-radius: 7px;
    background: var(--app-surface);
    box-shadow: 0 6px 18px rgba(24, 33, 29, 0.06);
    transition: opacity 160ms ease;
}

.transpose-control.is-loading {
    opacity: 0.55;
    pointer-events: none;
}

.transpose-button {
    display: grid;
    width: 42px;
    min-height: 42px;
    place-items: center;
    border-radius: 5px;
    color: var(--app-primary);
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
}

.transpose-button:hover,
.transpose-button:focus {
    color: #fff;
    background: var(--app-primary);
}

.transpose-button.disabled {
    color: #aab2ad;
    pointer-events: none;
}

.transpose-key {
    display: grid;
    min-width: 62px;
    place-content: center;
    text-align: center;
}

.transpose-key small {
    color: var(--app-muted);
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
}

.transpose-key strong {
    color: var(--app-ink);
    font-size: 1.15rem;
}
