/* ============================================
   Titanium Mobile Analytics - Theme System
   ============================================ */

/* Dark Theme (Default) */
:root,
[data-theme="dark"] {
    /* Core Colors */
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-tertiary: #18181b;
    --bg-card: #141416;
    --bg-hover: #1f1f23;
    
    /* Borders */
    --border-color: #27272a;
    --border-subtle: #1f1f23;
    
    /* Text */
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    
    /* Accent - Titanium Orange */
    --accent: #f06f36;
    --accent-hover: #ff8a50;
    --accent-muted: rgba(240, 111, 54, 0.15);
    
    /* Status Colors */
    --success: #22c55e;
    --success-muted: rgba(34, 197, 94, 0.15);
    --danger: #ef4444;
    --danger-muted: rgba(239, 68, 68, 0.15);
    --warning: #eab308;
    
    /* Chart Colors */
    --chart-primary: #f06f36;
    --chart-secondary: #6366f1;
    --chart-ios: #007aff;
    --chart-android: #34d399;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    
    /* Sizing */
    --sidebar-width: 240px;
    --header-height: 64px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    
    /* Fonts */
    --font-sans: 'Rajdhani', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Code Syntax */
    --code-comment: #6b7280;
    --code-keyword: #c678dd;
    --code-string: #98c379;
    --code-function: #61afef;
    --code-property: #e5c07b;
}

/* Light Theme */
[data-theme="light"] {
    /* Core Colors */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-hover: #e2e8f0;
    
    /* Borders */
    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;
    
    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    /* Accent - Titanium Orange */
    --accent: #ea580c;
    --accent-hover: #f97316;
    --accent-muted: rgba(234, 88, 12, 0.12);
    
    /* Status Colors */
    --success: #16a34a;
    --success-muted: rgba(22, 163, 74, 0.12);
    --danger: #dc2626;
    --danger-muted: rgba(220, 38, 38, 0.12);
    --warning: #ca8a04;
    
    /* Chart Colors */
    --chart-primary: #ea580c;
    --chart-secondary: #4f46e5;
    --chart-ios: #0066cc;
    --chart-android: #059669;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

    /* Code Syntax */
    --code-comment: #6b7280;
    --code-keyword: #7c3aed;
    --code-string: #059669;
    --code-function: #2563eb;
    --code-property: #d97706;
}

/* ============================================
   Reset & Base
   ============================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

select {
    font-family: inherit;
}

/* ============================================
   App Layout
   ============================================ */

.app {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), #ff8a50);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 17px;
    color: #000;
}

.logo-text {
    font-weight: 600;
    font-size: 22px;
    letter-spacing: -0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-muted);
    color: var(--accent);
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s ease;
}

.user-info:hover {
    background: var(--bg-hover);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 19px;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 500;
    font-size: 19px;
}

.user-plan {
    font-size: 19px;
    color: var(--text-muted);
}

/* ============================================
   Main Content
   ============================================ */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px;
    background: var(--bg-primary);
    min-height: 100vh;
}

/* ============================================
   Header
   ============================================ */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.page-title {
    font-size: 31px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.breadcrumb {
    color: var(--text-muted);
    font-size: 19px;
    margin-top: 2px;
    display: block;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.app-selector select {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 32px 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 19px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.app-selector select:hover {
    border-color: var(--accent);
}

.date-selector {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.date-btn {
    padding: 8px 14px;
    font-size: 17px;
    color: var(--text-secondary);
    border-right: 1px solid var(--border-color);
    transition: all 0.15s ease;
}

.date-btn:last-child {
    border-right: none;
}

.date-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.date-btn.active {
    background: var(--accent);
    color: #000;
    font-weight: 500;
}

/* ============================================
   Stats Grid
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: var(--border-subtle);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 19px;
}

.stat-badge {
    font-size: 19px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
}

.stat-badge.up {
    background: var(--success-muted);
    color: var(--success);
}

.stat-badge.down {
    background: var(--danger-muted);
    color: var(--danger);
}

.stat-value {
    font-size: 38px;
    font-weight: 600;
    letter-spacing: -1px;
    margin-bottom: 12px;
}

.stat-chart {
    height: 40px;
}

/* ============================================
   Charts
   ============================================ */

.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-title {
    font-size: 22px;
    font-weight: 500;
}

.chart-legend {
    display: flex;
    gap: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 17px;
    color: var(--text-secondary);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot.primary {
    background: var(--chart-primary);
}

.dot.secondary {
    background: var(--chart-secondary);
}

.chart-body {
    height: 280px;
    position: relative;
}

.devices-legend {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
}

.device-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.device-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.device-dot.ios {
    background: var(--chart-ios);
}

.device-dot.android {
    background: var(--chart-android);
}

.device-name {
    flex: 1;
    font-size: 19px;
}

.device-value {
    font-weight: 600;
    font-size: 19px;
}

/* ============================================
   Bottom Row
   ============================================ */

.bottom-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
}

.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.table-title {
    font-size: 22px;
    font-weight: 500;
}

.table-link {
    font-size: 17px;
    color: var(--accent);
    transition: color 0.15s ease;
}

.table-link:hover {
    color: var(--accent-hover);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 19px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
    padding: 12px;
    font-size: 19px;
    border-bottom: 1px solid var(--border-subtle);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: var(--bg-hover);
}

.screen-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 17px;
}

.screen-icon {
    font-size: 19px;
}

.trend {
    font-size: 17px;
    font-weight: 500;
}

.trend.up {
    color: var(--success);
}

.trend.down {
    color: var(--danger);
}

.trend.neutral {
    color: var(--text-muted);
}

/* ============================================
   Realtime Card
   ============================================ */

.realtime-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.realtime-header {
    margin-bottom: 20px;
}

.realtime-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 500;
}

.pulse {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

.realtime-value {
    text-align: center;
    margin-bottom: 20px;
}

.realtime-number {
    display: block;
    font-size: 58px;
    font-weight: 600;
    letter-spacing: -2px;
    color: var(--accent);
}

.realtime-label {
    font-size: 19px;
    color: var(--text-muted);
}

.realtime-chart {
    height: 60px;
    margin-bottom: 20px;
}

.realtime-events {
    border-top: 1px solid var(--border-subtle);
    padding-top: 16px;
}

.event-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    font-size: 17px;
    border-bottom: 1px solid var(--border-subtle);
}

.event-item:last-child {
    border-bottom: none;
}

.event-time {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 19px;
    min-width: 40px;
}

.event-text {
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1200px) {
    .charts-row,
    .bottom-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .header-right {
        width: 100%;
        flex-wrap: wrap;
    }
}

/* ============================================
   Analytics Page Styles
   ============================================ */

.metrics-overview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card-lg {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    gap: 20px;
    transition: all 0.2s ease;
}

.metric-card-lg:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.metric-icon svg {
    width: 24px;
    height: 24px;
}

.metric-icon.users {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
}

.metric-icon.sessions {
    background: rgba(240, 111, 54, 0.15);
    color: #f06f36;
}

.metric-icon.retention {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.metric-icon.engagement {
    background: rgba(236, 72, 153, 0.15);
    color: #ec4899;
}

.metric-content {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 19px;
    color: var(--text-muted);
}

.metric-value {
    font-size: 34px;
    font-weight: 600;
    letter-spacing: -1px;
}

.metric-change {
    font-size: 17px;
    margin-top: 4px;
}

.metric-change.up {
    color: var(--success);
}

.metric-change.down {
    color: var(--danger);
}

.chart-section {
    margin-bottom: 24px;
}

.chart-card.full-width {
    width: 100%;
}

.chart-body.tall {
    height: 350px;
}

.chart-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: var(--radius-sm);
}

.chart-tab {
    padding: 6px 12px;
    font-size: 17px;
    color: var(--text-secondary);
    border-radius: 4px;
    transition: all 0.15s ease;
}

.chart-tab:hover {
    color: var(--text-primary);
}

.chart-tab.active {
    background: var(--accent);
    color: #000;
    font-weight: 500;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.date-range {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-input {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 19px;
}

.date-separator {
    color: var(--text-muted);
}

/* Versions List */
.versions-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.version-item {
    display: grid;
    grid-template-columns: 1fr 2fr auto;
    align-items: center;
    gap: 12px;
}

.version-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.version-name {
    font-family: var(--font-mono);
    font-size: 19px;
}

.version-tag {
    font-size: 17px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.version-tag.latest {
    background: var(--success-muted);
    color: var(--success);
}

.version-tag.old {
    background: var(--danger-muted);
    color: var(--danger);
}

.version-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.version-progress {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
}

.version-percent {
    font-size: 19px;
    font-weight: 500;
    min-width: 40px;
    text-align: right;
}

/* Retention Grid */
.retention-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.retention-header,
.retention-row {
    display: grid;
    grid-template-columns: 80px repeat(5, 1fr);
    gap: 8px;
}

.retention-header span {
    font-size: 19px;
    color: var(--text-muted);
    text-align: center;
}

.cohort-label {
    font-size: 17px;
    color: var(--text-secondary);
}

.retention-cell {
    text-align: center;
    padding: 8px;
    border-radius: 4px;
    font-size: 17px;
    font-weight: 500;
    background: var(--bg-tertiary);
}

.retention-cell.high {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.retention-cell.medium {
    background: rgba(234, 179, 8, 0.2);
    color: var(--warning);
}

.retention-cell.low {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* Funnel */
.funnel-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.funnel-step {
    display: flex;
    align-items: center;
    gap: 12px;
}

.funnel-bar {
    background: var(--accent);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 48px;
}

.funnel-label {
    font-size: 19px;
    color: #000;
    font-weight: 500;
}

.funnel-value {
    font-size: 17px;
    font-weight: 600;
    color: #000;
}

.funnel-percent {
    font-size: 19px;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 50px;
}

/* Geo */
.geo-grid {
    padding-top: 8px;
}

.geo-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.geo-item {
    display: grid;
    grid-template-columns: 32px 140px 1fr 50px;
    align-items: center;
    gap: 12px;
}

.geo-flag {
    font-size: 29px;
}

.geo-name {
    font-size: 19px;
}

.geo-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.geo-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #ff8a50);
    border-radius: 4px;
}

.geo-value {
    font-size: 19px;
    font-weight: 500;
    text-align: right;
}

/* ============================================
   Apps Page Styles
   ============================================ */

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    color: #000;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 19px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 19px;
    font-weight: 500;
    border: 1px solid var(--border-color);
    transition: all 0.15s ease;
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.app-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.2s ease;
}

.app-card:hover {
    border-color: var(--accent);
}

.app-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px;
    padding-bottom: 0;
}

.app-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 29px;
}

.app-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 19px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 20px;
}

.app-status.active {
    background: var(--success-muted);
    color: var(--success);
}

.app-status.paused {
    background: rgba(234, 179, 8, 0.15);
    color: var(--warning);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.app-card-body {
    padding: 20px;
}

.app-name {
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 8px;
}

.app-id {
    font-size: 17px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.app-id code {
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.app-stats {
    display: flex;
    gap: 24px;
}

.app-stat-value {
    display: block;
    font-size: 29px;
    font-weight: 600;
}

.app-stat-label {
    font-size: 17px;
    color: var(--text-muted);
}

.app-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.app-platform {
    font-size: 17px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-actions {
    display: flex;
    gap: 4px;
}

.app-card.add-new {
    border-style: dashed;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    cursor: pointer;
}

.app-card.add-new:hover {
    background: var(--bg-hover);
}

.add-new-content {
    text-align: center;
    color: var(--text-muted);
}

.add-new-icon {
    margin-bottom: 12px;
}

.add-new-text {
    font-size: 17px;
}

/* Section Card */
.section-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title {
    font-size: 19px;
    font-weight: 600;
}

/* API Keys */
.api-keys-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.api-key-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.api-key-info {
    flex: 1;
}

.api-key-name {
    display: block;
    font-weight: 500;
    margin-bottom: 2px;
}

.api-key-created {
    font-size: 17px;
    color: var(--text-muted);
}

.api-key-value {
    display: flex;
    align-items: center;
    gap: 8px;
}

.api-key-value code {
    font-family: var(--font-mono);
    font-size: 17px;
    color: var(--text-secondary);
}

.api-key-status {
    font-size: 19px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
}

.api-key-status.active {
    background: var(--success-muted);
    color: var(--success);
}

/* Integration */
.integration-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
}

.integration-tab {
    padding: 8px 16px;
    font-size: 19px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.integration-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.integration-tab.active {
    background: var(--accent);
    color: #000;
    font-weight: 500;
}

.code-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.code-lang {
    font-size: 17px;
    color: var(--text-muted);
}

.code-content {
    padding: 16px;
    margin: 0;
    font-family: var(--font-mono);
    font-size: 19px;
    line-height: 1.6;
    overflow-x: auto;
}

.code-comment { color: var(--code-comment); }
.code-keyword { color: var(--code-keyword); }
.code-string { color: var(--code-string); }
.code-function { color: var(--code-function); }
.code-property { color: var(--code-property); }

/* Theme Toggle Button */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.theme-toggle:hover svg {
    transform: rotate(15deg);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

[data-theme="light"] .theme-toggle .icon-moon {
    display: block;
}

/* Default (dark) */
:root .theme-toggle .icon-sun {
    display: block;
}

:root .theme-toggle .icon-moon {
    display: none;
}

/* Theme Transition */
.theme-transitioning,
.theme-transitioning * {
    transition: background-color 0.3s ease, 
                border-color 0.3s ease, 
                color 0.3s ease,
                box-shadow 0.3s ease !important;
}

/* Light theme specific adjustments */
[data-theme="light"] .logo-icon {
    color: #fff;
}

[data-theme="light"] .funnel-bar {
    color: #fff;
}

[data-theme="light"] .funnel-label,
[data-theme="light"] .funnel-value {
    color: #fff;
}

[data-theme="light"] .chart-tab.active,
[data-theme="light"] .date-btn.active,
[data-theme="light"] .integration-tab.active {
    color: #fff;
}

[data-theme="light"] .btn-primary {
    color: #fff;
}

[data-theme="light"] .toggle input:checked + .toggle-slider:before {
    background: #fff;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
    font-size: 22px;
    font-weight: 600;
}

.modal-close {
    color: var(--text-muted);
    padding: 4px;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 19px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-input,
.form-select {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 17px;
    transition: border-color 0.15s ease;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    margin-top: 24px;
}

.checkbox-group {
    display: flex;
    gap: 16px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 19px;
    cursor: pointer;
}

/* ============================================
   Settings Page Styles
   ============================================ */

.settings-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 32px;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: sticky;
    top: 24px;
    height: fit-content;
}

.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 17px;
    transition: all 0.15s ease;
}

.settings-nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.settings-nav-item.active {
    background: var(--accent-muted);
    color: var(--accent);
}

.settings-content {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.settings-section {
    scroll-margin-top: 24px;
}

.settings-section-title {
    font-size: 29px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

/* Profile */
.profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.profile-avatar-section {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.profile-avatar-large {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 29px;
    font-weight: 600;
}

/* Plan Card */
.plan-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.plan-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.plan-badge {
    font-size: 19px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.plan-name {
    font-size: 34px;
    font-weight: 600;
    margin: 4px 0;
}

.plan-price {
    font-size: 29px;
    font-weight: 500;
}

.plan-price span {
    font-size: 17px;
    color: var(--text-muted);
}

.plan-features {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.plan-feature {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 19px;
    color: var(--text-secondary);
}

.plan-usage {
    margin-top: 16px;
}

.usage-item {
    margin-bottom: 16px;
}

.usage-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.usage-label {
    font-size: 19px;
    color: var(--text-secondary);
}

.usage-value {
    font-size: 19px;
    font-weight: 500;
}

.usage-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.usage-progress {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
}

/* Invoices */
.invoices-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.card-title {
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 16px;
}

.invoices-table {
    width: 100%;
    border-collapse: collapse;
}

.invoices-table th,
.invoices-table td {
    padding: 12px;
    text-align: left;
    font-size: 19px;
}

.invoices-table th {
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--border-subtle);
}

.invoices-table td {
    border-bottom: 1px solid var(--border-subtle);
}

.status-badge {
    font-size: 19px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
}

.status-badge.paid {
    background: var(--success-muted);
    color: var(--success);
}

.link-download {
    color: var(--accent);
    font-size: 17px;
}

/* Team */
.team-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.team-count {
    font-size: 19px;
    color: var(--text-muted);
}

.team-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.team-member {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.member-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 600;
}

.member-info {
    flex: 1;
}

.member-name {
    display: block;
    font-weight: 500;
    font-size: 17px;
}

.member-email {
    font-size: 17px;
    color: var(--text-muted);
}

.owner-badge {
    font-size: 17px;
    background: var(--accent-muted);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

.member-role {
    font-size: 17px;
    color: var(--text-secondary);
}

.role-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 17px;
}

/* Notifications */
.notifications-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.notification-group-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.notification-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-name {
    display: block;
    font-weight: 500;
    margin-bottom: 2px;
}

.notification-desc {
    font-size: 17px;
    color: var(--text-muted);
}

/* Toggle */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-tertiary);
    border-radius: 24px;
    transition: 0.2s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: 0.2s;
}

.toggle input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(20px);
    background: #000;
}

/* Security */
.security-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.security-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.security-item:last-child {
    border-bottom: none;
}

.security-title {
    font-weight: 500;
    margin-bottom: 2px;
}

.security-desc {
    font-size: 17px;
    color: var(--text-muted);
}

/* Danger Zone */
.danger-zone {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.danger-title {
    color: var(--danger);
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 16px;
}

.danger-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.danger-info h4 {
    font-weight: 500;
    margin-bottom: 2px;
}

.danger-info p {
    font-size: 17px;
    color: var(--text-muted);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 19px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.btn-danger:hover {
    background: #dc2626;
}

