:root {
    --rt-navy: #14213d;
    --rt-navy-soft: #243657;
    --rt-blue: #2563eb;
    --rt-blue-soft: #eff6ff;
    --rt-bg: #f5f7fb;
    --rt-surface: #ffffff;
    --rt-border: #e3e8f0;
    --rt-text: #172033;
    --rt-muted: #64748b;
    --rt-radius: 1rem;
    --rt-shadow: 0 10px 30px rgba(20, 33, 61, 0.07);
}

html { scroll-behavior: smooth; }

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--rt-bg);
    color: var(--rt-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

.app-navbar {
    background: var(--rt-navy);
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.16);
}

.navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -.02em;
}

.navbar-logo {
    display: block;
    flex-shrink: 0;
    width: auto;
    height: 44px;
    object-fit: contain;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: .65rem;
    background: #fff;
    color: var(--rt-navy);
    font-size: 1rem;
}

.navbar-toggler {
    min-width: 44px;
    min-height: 44px;
    border-color: rgba(255,255,255,.28);
    border-radius: .75rem;
}

.navbar-toggler:focus { box-shadow: 0 0 0 .2rem rgba(255,255,255,.18); }
.navbar .nav-link { color: rgba(255,255,255,.78); font-size: .92rem; font-weight: 600; }
.navbar .nav-link:hover, .navbar .nav-link:focus { color: #fff; }
.nav-logout { margin-left: .6rem; }
.nav-user { color: rgba(255,255,255,.72); padding: .75rem 0; }
.nav-user small, .nav-user strong { display: block; }

.app-main { flex: 1; padding-top: 2rem; padding-bottom: 3rem; }
.app-footer { color: var(--rt-muted); font-size: .82rem; padding: 1.25rem 0 1.75rem; text-align: center; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1, .page-title {
    margin: 0;
    font-size: clamp(1.65rem, 4vw, 2.25rem);
    font-weight: 800;
    letter-spacing: -.035em;
}

.page-subtitle { color: var(--rt-muted); margin: .3rem 0 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: .65rem; }

.card {
    border: 1px solid var(--rt-border) !important;
    border-radius: var(--rt-radius);
    box-shadow: var(--rt-shadow) !important;
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--rt-border);
}

.card-body { padding: 1.2rem; }
.section-title { font-size: 1.05rem; font-weight: 750; margin: 0; }

.stat-card { height: 100%; }
.stat-card .card-body { display: flex; flex-direction: column; justify-content: center; min-height: 118px; }
.stat-label { color: var(--rt-muted); font-size: .85rem; font-weight: 650; margin-bottom: .35rem; }
.stat-value { font-size: clamp(1.5rem, 5vw, 2rem); font-weight: 800; line-height: 1.15; letter-spacing: -.03em; }
.stat-note { color: var(--rt-muted); font-size: .8rem; margin-top: .25rem; }

.btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .75rem;
    padding: .55rem 1rem;
    font-weight: 700;
}

.btn-sm { min-height: 38px; padding: .4rem .75rem; border-radius: .65rem; }
.btn-dark { background: var(--rt-navy); border-color: var(--rt-navy); }
.btn-dark:hover, .btn-dark:focus { background: var(--rt-navy-soft); border-color: var(--rt-navy-soft); }
.btn-outline-dark { color: var(--rt-navy); border-color: #aab5c6; }

.form-control, .form-select {
    min-height: 46px;
    border-color: #cfd7e3;
    border-radius: .75rem;
    padding: .65rem .8rem;
}

textarea.form-control { min-height: 110px; }
.form-control:focus, .form-select:focus { border-color: #7da5f5; box-shadow: 0 0 0 .22rem rgba(37,99,235,.12); }
.form-label { font-weight: 700; font-size: .9rem; }
.form-text { color: var(--rt-muted); }
.form-actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1.5rem; }
.form-card { max-width: 820px; }
.errorlist { list-style: none; padding: .45rem .7rem; margin: .4rem 0 0; border-radius: .55rem; background: #fef2f2; color: #b91c1c; font-size: .85rem; }

.badge { padding: .45em .7em; border-radius: 999px; font-weight: 700; }
.alert { border: 0; border-radius: .85rem; box-shadow: var(--rt-shadow); }

.table { --bs-table-bg: transparent; color: var(--rt-text); }
.table thead th { color: #536177; font-size: .75rem; text-transform: uppercase; letter-spacing: .045em; font-weight: 800; border-bottom-color: var(--rt-border); padding: .85rem 1rem; white-space: nowrap; }
.table tbody td { padding: .9rem 1rem; border-bottom-color: #edf0f5; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-responsive { scrollbar-color: #aab5c6 transparent; }
.table-responsive::-webkit-scrollbar { height: 8px; }
.table-responsive::-webkit-scrollbar-thumb { background: #aab5c6; border-radius: 999px; }
.cell-primary { font-weight: 700; }
.empty-state { color: var(--rt-muted); text-align: center; padding: 2.5rem 1rem; }

.document-card .badge { align-self: flex-start; }
.document-card .card-body { min-height: 230px; }
.folder-card { color: var(--rt-text); transition: transform .15s ease, box-shadow .15s ease; }
.folder-card:hover, .folder-card:focus-visible { color: var(--rt-text); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15, 23, 42, .12); }
.folder-icon { flex: 0 0 auto; font-size: 2.25rem; line-height: 1; }
.folder-details { min-width: 0; flex: 1; }
.folder-name { display: block; overflow: hidden; color: var(--rt-navy); font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.folder-meta { display: block; margin-top: .2rem; color: var(--rt-muted); font-size: .82rem; }
.meta-line { color: var(--rt-muted); font-size: .82rem; }
.login-brand { margin-top: 1rem; }

.login-logo {
    display: block;
    width: 100%;
    max-width: 270px;
    height: auto;
    margin-right: auto;
    margin-left: auto;
    object-fit: contain;
}

.ranking-card .card-header { padding: .9rem 1rem; }
.ranking-list { display: flex; flex-direction: column; }
.ranking-row {
    display: grid;
    grid-template-columns: 2.25rem minmax(0, 1fr) auto;
    align-items: center;
    gap: .75rem;
    min-height: 54px;
    padding: .55rem 1rem;
    border-bottom: 1px solid #edf0f5;
}
.ranking-row:last-child { border-bottom: 0; }
.ranking-row:first-child { background: #f8fbff; }
.ranking-position {
    display: inline-grid;
    place-items: center;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 999px;
    background: #eef2f7;
    color: var(--rt-muted);
    font-size: .8rem;
    font-weight: 800;
}
.ranking-row:first-child .ranking-position { background: var(--rt-navy); color: #fff; }
.ranking-name {
    min-width: 0;
    overflow: hidden;
    color: var(--rt-text);
    font-weight: 700;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ranking-name:hover, .ranking-name:focus { color: var(--rt-blue); }
.ranking-value { color: var(--rt-navy); font-weight: 800; white-space: nowrap; }
.ranking-empty { color: var(--rt-muted); padding: 1.5rem 1rem; text-align: center; }
.fpf-video-card iframe { border: 0; }
.decision-panel { height: 100%; padding: 1rem; border: 1px solid var(--rt-border); border-radius: .8rem; background: #f8fafc; }
.decision-panel strong { display: block; margin-bottom: .65rem; color: var(--rt-navy); }

@media (max-width: 1199.98px) {
    .navbar-collapse { margin-top: .8rem; padding: .5rem 0 1rem; border-top: 1px solid rgba(255,255,255,.12); max-height: calc(100vh - 76px); overflow-y: auto; }
    .navbar .nav-link { display: flex; align-items: center; min-height: 46px; padding: .65rem .5rem; border-bottom: 1px solid rgba(255,255,255,.07); }
    .nav-logout { margin: .75rem 0 0; }
    .nav-logout .btn { width: 100%; }
}

@media (max-width: 767.98px) {
    .navbar-logo { height: 40px; }
    .login-logo { max-width: 230px; }
    .app-main { padding-top: 1.25rem; padding-bottom: 2rem; }
    .page-header { align-items: stretch; flex-direction: column; margin-bottom: 1.15rem; }
    .page-actions { display: grid; grid-template-columns: 1fr; }
    .page-actions .btn { width: 100%; }
    .card-body { padding: 1rem; }
    .stat-card .card-body { min-height: 104px; }
    .form-actions { display: grid; grid-template-columns: 1fr; }
    .form-actions .btn { width: 100%; }
    .ranking-row { min-height: 50px; padding: .5rem .8rem; gap: .55rem; }
    .ranking-card .card-header { padding: .8rem 1rem; }

    .responsive-table-wrap { overflow: visible; }
    .responsive-table { display: block; }
    .responsive-table thead { display: none; }
    .responsive-table tbody { display: grid; gap: .8rem; padding: .8rem; }
    .responsive-table tbody tr { display: block; border: 1px solid var(--rt-border); border-radius: .9rem; background: var(--rt-surface); box-shadow: 0 4px 14px rgba(20,33,61,.05); overflow: hidden; }
    .responsive-table tbody td { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; width: 100%; padding: .68rem .85rem; text-align: right !important; border-bottom: 1px solid #edf0f5; }
    .responsive-table tbody td::before { content: attr(data-label); flex: 0 0 42%; color: var(--rt-muted); font-size: .75rem; font-weight: 800; text-align: left; text-transform: uppercase; letter-spacing: .03em; }
    .responsive-table tbody td:last-child { border-bottom: 0; }
    .responsive-table tbody td.cell-primary { display: block; text-align: left !important; background: #f8fafc; font-size: 1rem; }
    .responsive-table tbody td.cell-primary::before { display: block; margin-bottom: .25rem; }
    .responsive-table tbody td.cell-actions { display: block; }
    .responsive-table tbody td.cell-actions::before { display: none; }
    .responsive-table tbody td.cell-actions .btn, .responsive-table tbody td.cell-actions form { width: 100%; }
    .responsive-table tbody td.cell-actions .d-flex { display: grid !important; grid-template-columns: 1fr 1fr; }
    .responsive-table tbody tr.empty-table-row { box-shadow: none; }
    .responsive-table tbody tr.empty-table-row td { display: block; text-align: center !important; padding: 2rem 1rem; }
    .responsive-table tbody tr.empty-table-row td::before { display: none; }
    .responsive-table-card { background: transparent; border: 0 !important; box-shadow: none !important; overflow: visible; }
    .responsive-table-card > .card-header { border: 1px solid var(--rt-border); border-radius: var(--rt-radius); margin-bottom: .7rem; }
}

@media (min-width: 1200px) {
    .navbar .nav-link { padding-left: .4rem; padding-right: .4rem; font-size: .82rem; }
}
