:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --accent: #8b5cf6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.bg-animated {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    filter: blur(80px);
}

.blob {
    position: absolute;
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    opacity: 0.3;
    animation: move 20s infinite alternate;
}

.blob:nth-child(2) {
    background: #ec4899;
    left: 60%;
    top: 20%;
    animation-delay: -5s;
}

.blob:nth-child(3) {
    background: #06b6d4;
    left: 20%;
    top: 60%;
    animation-delay: -10s;
}

@keyframes move {
    from {
        transform: translate(-10%, -10%) scale(1);
    }

    to {
        transform: translate(10%, 10%) scale(1.2);
    }
}

.glass-container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 48px;
    width: 100%;
    max-width: 480px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 1;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.logo .icon {
    font-size: 32px;
}

.logo h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 32px;
}

.auth-box {
    margin-bottom: 40px;
}

.auth-box p {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 24px;
    color: var(--text-dim);
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 24px;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.google-btn {
    background: white;
    color: #1f2937;
}

.google-btn:hover {
    background: #f3f4f6;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

footer p {
    font-size: 12px;
    color: var(--text-dim);
    opacity: 0.6;
}

/* Dashboard Styles */
.dashboard-page {
    display: flex;
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
    padding: 0;
    justify-content: flex-start;
    align-items: stretch;
}

.sidebar {
    width: 220px;
    min-height: 100vh;
    background: rgba(255, 255, 255, 0.04);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 24px 20px;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-logo .icon {
    font-size: 22px;
}

.sidebar-logo h1 {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    padding: 10px 14px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(99, 102, 241, 0.2);
    color: #fff;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    display: block;
    text-align: center;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.3);
}

.main-content {
    flex: 1;
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
}

#dashboardContent,
#rankingsContent,
#utilizacaoContent,
#usageContent,
.page-panel {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.dashboard-title {
    margin-bottom: 16px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.2px;
}

.rankings-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.rankings-title-row .dashboard-title {
    margin-bottom: 0;
}

.btn-back-rankings {
    appearance: none;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(30, 41, 59, 0.6);
    color: var(--text-main);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-back-rankings:hover {
    border-color: rgba(99, 102, 241, 0.45);
    background: rgba(51, 65, 85, 0.7);
}

.ranking-detail-count {
    color: var(--text-dim);
    font-size: 13px;
    margin: 0 0 12px;
}

#mainFrame {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
}


.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.llm-period-toolbar-wrap {
    margin-bottom: 24px;
}

.llm-period-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 12px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.llm-period-toolbar-block {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
}

.llm-period-toolbar-heading {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
    white-space: nowrap;
    flex-shrink: 0;
}

.llm-period-rail {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    min-width: 0;
}

.llm-period-btn {
    appearance: none;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(30, 41, 59, 0.6);
    color: var(--text-main);
    font-size: 0.76rem;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.llm-period-btn:hover {
    border-color: rgba(99, 102, 241, 0.45);
    background: rgba(51, 65, 85, 0.7);
}

.llm-period-btn--active {
    border-color: rgba(99, 102, 241, 0.65);
    background: rgba(99, 102, 241, 0.22);
    color: #c7d2fe;
    font-weight: 600;
}

.dashboard-period-scope {
    margin-bottom: 24px;
}

.dashboard-period-scope .llm-period-toolbar-wrap {
    margin-bottom: 20px;
}

.js-period-suffix,
.js-rankings-period-suffix,
.js-util-period-suffix {
    color: var(--text-dim);
    font-weight: 600;
}

.llm-org-filter-block {
    flex: 0 0 auto;
    padding-left: 8px;
    border-left: 1px solid rgba(148, 163, 184, 0.15);
}

.llm-org-select {
    appearance: none;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(30, 41, 59, 0.6);
    color: var(--text-main);
    font-size: 0.76rem;
    padding: 6px 10px;
    border-radius: 8px;
    min-width: 180px;
    max-width: 280px;
    cursor: pointer;
}

.llm-org-select:hover,
.llm-org-select:focus {
    border-color: rgba(99, 102, 241, 0.45);
    outline: none;
}

.llm-org-select option {
    background: var(--bg-dark);
    color: var(--text-main);
}

.table-container--clickable {
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.table-container--clickable:hover,
.table-container--clickable:focus-visible {
    border-color: rgba(99, 102, 241, 0.45);
    background: rgba(255, 255, 255, 0.07);
    outline: none;
}

.table-container--clickable h2 {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    font-size: 16px;
    margin-bottom: 12px;
}

.ranking-see-all {
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: #a5b4fc;
    white-space: nowrap;
}

.table-container--clickable:hover .ranking-see-all {
    text-decoration: underline;
}

.ranking-detail-table-wrap {
    max-height: calc(100vh - 260px);
    overflow: auto;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.table-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 1200px) {
    .table-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

.stat-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 24px;
}

.stat-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 800;
    color: #fff;
}

.table-container {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 24px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 12px;
    color: var(--text-dim);
    font-size: 13px;
    border-bottom: 1px solid var(--glass-border);
}

td {
    padding: 16px 12px;
    border-bottom: 1px solid var(--glass-border);
    font-size: 14px;
}

.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-blue {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

.badge-green {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.badge-cyan {
    background: rgba(6, 182, 212, 0.2);
    color: #22d3ee;
}

.badge-orange {
    background: rgba(249, 115, 22, 0.2);
    color: #fb923c;
}

.badge-purple {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
}

.badge-yellow {
    background: rgba(234, 179, 8, 0.2);
    color: #facc15;
}

.badge-pink {
    background: rgba(236, 72, 153, 0.2);
    color: #f472b6;
}

.badge-red {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Filtros - selects no tema do projeto */
.filters-row select {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    min-width: 180px;
    font-size: 14px;
    cursor: pointer;
}

.filters-row select:hover,
.filters-row select:focus {
    border-color: var(--primary);
    outline: none;
}

.filters-row select option {
    background: var(--bg-dark);
    color: var(--text-main);
}

.filters-row .btn-filtrar {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    background: var(--accent);
    color: white;
    border: none;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.2s;
}

.filters-row .btn-filtrar:hover {
    background: var(--primary-hover);
}