:root {
    --gv-black: #0a0a0a;
    --gv-dark: #111111;
    --gv-dark-2: #1a1a1a;
    --gv-dark-3: #222222;
    --gv-primary: #541533;
    --gv-primary-light: #7a2550;
    --gv-primary-dark: #3d0f26;
    --gv-gradient: linear-gradient(135deg, #541533 0%, #2a0b1a 50%, #0a0a0a 100%);
    --gv-gradient-h: linear-gradient(90deg, #541533 0%, #3d0f26 50%, #1a1a1a 100%);
    --gv-gradient-card: linear-gradient(145deg, #1e1e1e 0%, #151515 100%);
    --gv-text: #e8e8e8;
    --gv-text-muted: #888888;
    --gv-border: #2a2a2a;
    --gv-success: #28a745;
    --gv-danger: #dc3545;
    --gv-warning: #ffc107;
    --gv-info: #17a2b8;
}

* { box-sizing: border-box; }

body {
    background-color: var(--gv-black);
    color: var(--gv-text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

a { color: var(--gv-primary-light); text-decoration: none; }
a:hover { color: #c44080; }

/* ─── AUTH PAGES ─── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gv-gradient);
    padding: 2rem;
}

.auth-card {
    background: var(--gv-dark);
    border: 1px solid var(--gv-border);
    border-radius: 16px;
    padding: 3rem;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(84, 21, 51, 0.3);
}

.auth-card .logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-card .logo h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #c44080, #541533);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    letter-spacing: 2px;
}

.auth-card .logo p {
    color: var(--gv-text-muted);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* ─── FORM CONTROLS ─── */
.gv-form-group { margin-bottom: 1.25rem; }

.gv-form-group label {
    display: block;
    color: var(--gv-text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    font-weight: 500;
}

.gv-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--gv-dark-2);
    border: 1px solid var(--gv-border);
    border-radius: 8px;
    color: var(--gv-text);
    font-size: 0.95rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.gv-input:focus {
    outline: none;
    border-color: var(--gv-primary);
    box-shadow: 0 0 0 3px rgba(84, 21, 51, 0.3);
}

.gv-input::placeholder { color: #555; }

.gv-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--gv-dark-2);
    border: 1px solid var(--gv-border);
    border-radius: 8px;
    color: var(--gv-text);
    font-size: 0.95rem;
    appearance: none;
    cursor: pointer;
}

.gv-select:focus {
    outline: none;
    border-color: var(--gv-primary);
    box-shadow: 0 0 0 3px rgba(84, 21, 51, 0.3);
}

/* ─── BUTTONS ─── */
.gv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.gv-btn-primary {
    background: linear-gradient(135deg, #541533, #7a2550);
    color: #fff;
}
.gv-btn-primary:hover {
    background: linear-gradient(135deg, #7a2550, #541533);
    box-shadow: 0 4px 20px rgba(84, 21, 51, 0.5);
    transform: translateY(-1px);
    color: #fff;
}

.gv-btn-outline {
    background: transparent;
    border: 1px solid var(--gv-primary);
    color: var(--gv-primary-light);
}
.gv-btn-outline:hover {
    background: var(--gv-primary-dark);
    color: #fff;
}

.gv-btn-danger {
    background: var(--gv-danger);
    color: #fff;
}
.gv-btn-danger:hover { opacity: 0.9; }

.gv-btn-sm { padding: 0.4rem 0.9rem; font-size: 0.85rem; }
.gv-btn-block { width: 100%; }

/* ─── LAYOUT ─── */
.gv-layout {
    display: flex;
    min-height: 100vh;
}

/* ─── SIDEBAR ─── */
.gv-sidebar {
    width: 260px;
    height: 100vh;
    background: var(--gv-dark);
    border-right: 1px solid var(--gv-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: transform 0.3s;
}

.gv-sidebar-brand {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gv-border);
    text-align: center;
}

.gv-sidebar-brand h2 {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #c44080, #541533);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    letter-spacing: 2px;
}

.gv-sidebar-brand small {
    color: var(--gv-text-muted);
    font-size: 0.7rem;
    display: block;
    margin-top: 2px;
}

.gv-sidebar-logo {
    max-width: 100%;
    max-height: 55px;
    object-fit: contain;
    border-radius: 6px;
}

.gv-sidebar-nav {
    flex: 1;
    min-height: 0;
    padding: 1rem 0;
    overflow-y: auto;
}
.gv-sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.gv-sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.gv-sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}
.gv-sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}

.gv-nav-section {
    padding: 0.5rem 1.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--gv-text-muted);
    margin-top: 0.5rem;
}

.gv-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.5rem;
    color: var(--gv-text-muted);
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.gv-nav-item:hover {
    color: var(--gv-text);
    background: var(--gv-dark-2);
    border-left-color: var(--gv-primary);
}

.gv-nav-item.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(84, 21, 51, 0.3), transparent);
    border-left-color: var(--gv-primary-light);
}

.gv-nav-item i { font-size: 1.1rem; width: 20px; text-align: center; }

.gv-sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gv-border);
}

.gv-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.gv-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gv-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
}

.gv-user-details { flex: 1; overflow: hidden; }
.gv-user-details .name { font-size: 0.85rem; font-weight: 600; color: var(--gv-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gv-user-details .role { font-size: 0.7rem; color: var(--gv-text-muted); text-transform: capitalize; }

/* ─── MAIN CONTENT ─── */
.gv-main {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
}

/* ─── TOPBAR ─── */
.gv-topbar {
    height: 64px;
    background: var(--gv-dark);
    border-bottom: 1px solid var(--gv-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 500;
}

.gv-topbar-title { font-size: 1.15rem; font-weight: 600; }

.gv-topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.gv-topbar-btn {
    background: transparent;
    border: none;
    color: var(--gv-text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 6px;
    transition: all 0.2s;
    position: relative;
}

.gv-topbar-btn:hover { color: var(--gv-text); background: var(--gv-dark-2); }

.gv-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: var(--gv-danger);
    border-radius: 50%;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
}

/* ─── CONTENT AREA ─── */
.gv-content { padding: 2rem; }

/* ─── CARDS ─── */
.gv-card {
    background: var(--gv-gradient-card);
    border: 1px solid var(--gv-border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s;
}

.gv-card:hover {
    border-color: var(--gv-primary-dark);
    box-shadow: 0 4px 20px rgba(84, 21, 51, 0.15);
}

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

.gv-card-title {
    font-size: 0.85rem;
    color: var(--gv-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.gv-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gv-text);
}

.gv-card-change {
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.gv-card-change.positive { color: var(--gv-success); }
.gv-card-change.negative { color: var(--gv-danger); }
.gv-card-change.neutral { color: var(--gv-text-muted); }

/* ─── EXECUTION SCORE ─── */
.gv-score-ring {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: conic-gradient(var(--gv-primary-light) calc(var(--score) * 3.6deg), var(--gv-dark-3) 0deg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    position: relative;
}

.gv-score-ring::before {
    content: '';
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--gv-dark);
    position: absolute;
}

.gv-score-value {
    position: relative;
    z-index: 1;
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #c44080, #541533);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ─── CATEGORY TABS ─── */
.gv-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.gv-tab {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gv-text-muted);
    background: var(--gv-dark-2);
    border: 1px solid var(--gv-border);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.gv-tab:hover { border-color: var(--gv-primary); color: var(--gv-text); }

.gv-tab.active {
    background: linear-gradient(135deg, #541533, #7a2550);
    color: #fff;
    border-color: transparent;
}

.gv-tab .count {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    margin-left: 0.3rem;
}

/* ─── TOOL CARDS ─── */
.gv-tool-card {
    background: var(--gv-gradient-card);
    border: 1px solid var(--gv-border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.gv-tool-card:hover {
    border-color: var(--gv-primary);
    box-shadow: 0 8px 30px rgba(84, 21, 51, 0.2);
    transform: translateY(-2px);
}

.gv-tool-card.connected { border-color: var(--gv-success); }

.gv-tool-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--gv-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #fff;
    margin-bottom: 1rem;
}

.gv-tool-name { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.25rem; }
.gv-tool-category { font-size: 0.75rem; color: var(--gv-primary-light); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.5rem; }
.gv-tool-desc { font-size: 0.82rem; color: var(--gv-text-muted); line-height: 1.5; flex: 1; }
.gv-tool-kpi-count { font-size: 0.8rem; color: var(--gv-text-muted); margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--gv-border); }
.gv-tool-actions { margin-top: 1rem; }

/* ─── AI CHAT ─── */
.gv-ai-container { max-width: 900px; margin: 0 auto; }

.gv-ai-header {
    text-align: center;
    padding: 2rem 0;
}

.gv-ai-header h2 {
    font-size: 1.5rem;
    background: linear-gradient(135deg, #c44080, #541533);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gv-ai-messages {
    max-height: 500px;
    overflow-y: auto;
    padding: 1rem 0;
}

.gv-ai-message {
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.6;
}

.gv-ai-message.user {
    background: linear-gradient(135deg, rgba(84, 21, 51, 0.4), rgba(84, 21, 51, 0.2));
    border: 1px solid rgba(84, 21, 51, 0.3);
    margin-left: 3rem;
}

.gv-ai-message.assistant {
    background: var(--gv-dark-2);
    border: 1px solid var(--gv-border);
    margin-right: 3rem;
}

.gv-ai-input-bar {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 0;
    position: sticky;
    bottom: 0;
    background: var(--gv-black);
}

.gv-ai-input-bar input {
    flex: 1;
    padding: 0.85rem 1.25rem;
    background: var(--gv-dark-2);
    border: 1px solid var(--gv-border);
    border-radius: 25px;
    color: var(--gv-text);
    font-size: 0.95rem;
}

.gv-ai-input-bar input:focus {
    outline: none;
    border-color: var(--gv-primary);
    box-shadow: 0 0 0 3px rgba(84, 21, 51, 0.3);
}

/* ─── TABLE ─── */
.gv-table {
    width: 100%;
    border-collapse: collapse;
}

.gv-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gv-text-muted);
    border-bottom: 1px solid var(--gv-border);
    font-weight: 600;
}

.gv-table td {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--gv-border);
}

.gv-table tbody tr:hover { background: var(--gv-dark-2); }

/* ─── STATUS BADGES ─── */
.gv-status {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.gv-status-connected { background: rgba(40, 167, 69, 0.2); color: var(--gv-success); }
.gv-status-disconnected { background: rgba(220, 53, 69, 0.2); color: var(--gv-danger); }
.gv-status-pending { background: rgba(255, 193, 7, 0.2); color: var(--gv-warning); }

/* ─── GRID HELPERS ─── */
.gv-grid { display: grid; gap: 1.5rem; }
.gv-grid-2 { grid-template-columns: repeat(2, 1fr); }
.gv-grid-3 { grid-template-columns: repeat(3, 1fr); }
.gv-grid-4 { grid-template-columns: repeat(4, 1fr); }
.gv-grid-6 { grid-template-columns: repeat(6, 1fr); }

/* ─── ALERT MESSAGES ─── */
.gv-alert {
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border-left: 4px solid;
}

.gv-alert-success { background: rgba(40, 167, 69, 0.1); border-color: var(--gv-success); color: var(--gv-success); }
.gv-alert-danger { background: rgba(220, 53, 69, 0.1); border-color: var(--gv-danger); color: var(--gv-danger); }
.gv-alert-warning { background: rgba(255, 193, 7, 0.1); border-color: var(--gv-warning); color: var(--gv-warning); }
.gv-alert-info { background: rgba(23, 162, 184, 0.1); border-color: var(--gv-info); color: var(--gv-info); }

/* ─── DROPDOWN (Modernized) ─── */
.dropdown-menu {
    background: var(--gv-dark) !important;
    border: 1px solid var(--gv-border) !important;
    border-radius: 10px !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5) !important;
    padding: 6px !important;
    min-width: 180px;
    animation: gvDropIn 0.15s ease;
}
.dropdown-menu .dropdown-item {
    color: var(--gv-text) !important;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.84rem;
    transition: all 0.15s;
}
.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus {
    background: rgba(84,21,51,0.2) !important;
    color: #e8a0b8 !important;
}
.dropdown-menu .dropdown-item:active {
    background: var(--gv-primary) !important;
    color: #fff !important;
}
.dropdown-menu .dropdown-divider {
    border-color: var(--gv-border) !important;
    margin: 4px 0;
}
.dropdown-menu .dropdown-header {
    color: var(--gv-text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 12px 4px;
}
@keyframes gvDropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Select / native dropdown override */
select.gv-input,
.gv-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 2rem !important;
    cursor: pointer;
}
select.gv-input:focus,
.gv-select:focus {
    border-color: var(--gv-primary);
    box-shadow: 0 0 0 2px rgba(84,21,51,0.25);
}

/* ─── MODAL ─── */
.gv-modal-content {
    background: var(--gv-dark) !important;
    border: 1px solid var(--gv-border) !important;
    border-radius: 12px !important;
    color: var(--gv-text);
}

.gv-modal-content .modal-header { border-bottom-color: var(--gv-border); }
.gv-modal-content .modal-footer { border-top-color: var(--gv-border); }
.gv-modal-content .btn-close { filter: invert(1); }

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--gv-dark); }
::-webkit-scrollbar-thumb { background: var(--gv-primary-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gv-primary); }

/* ─── RESPONSIVE ─── */
@media (max-width: 1200px) {
    .gv-grid-4 { grid-template-columns: repeat(3, 1fr); }
    .gv-grid-6 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 992px) {
    .gv-grid-3, .gv-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .gv-grid-6 { grid-template-columns: repeat(2, 1fr); }
    .gv-sidebar { transform: translateX(-100%); }
    .gv-sidebar.open { transform: translateX(0); }
    .gv-main { margin-left: 0; }
}

@media (max-width: 768px) {
    .gv-grid-2, .gv-grid-3, .gv-grid-4, .gv-grid-6 { grid-template-columns: 1fr; }
    .gv-content { padding: 1rem; }
    .auth-card { padding: 2rem 1.5rem; }
}
