/* ============================================
   ML AUTO-RESPONDER — DESIGN SYSTEM
   Tema: Dark mode + Mercado Livre (Amarelo + Azul)
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---- CSS Variables ---- */
:root {
    --ml-yellow: #FFE600;
    --ml-yellow-dark: #e6cf00;
    --ml-blue: #3483FA;
    --ml-blue-dark: #2968c8;
    --ml-green: #00a650;
    --ml-red: #ff4444;
    --ml-orange: #ff7733;
    
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.8);
    --bg-card-hover: rgba(26, 35, 55, 0.9);
    --bg-input: rgba(255, 255, 255, 0.05);
    
    --text-primary: #f0f0f0;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 230, 0, 0.25);
    
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.06);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(255, 230, 0, 0.1);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 0%, rgba(255, 230, 0, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(52, 131, 250, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ---- Login Screen ---- */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: linear-gradient(135deg, rgba(17,24,39,0.9), rgba(17,24,39,0.7));
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 48px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 40px rgba(255,230,0,0.05);
    animation: fadeInUp 0.6s ease;
}

.login-logo {
    font-size: 56px;
    margin-bottom: 8px;
}

.login-card h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--ml-yellow), var(--ml-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.login-card .subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 32px;
}

.login-card .form-group {
    margin-bottom: 16px;
    text-align: left;
}

.login-card label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.login-card input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.login-card input:focus {
    outline: none;
    border-color: var(--ml-yellow);
    box-shadow: 0 0 0 3px rgba(255, 230, 0, 0.1);
}

/* ---- Layout Principal ---- */
.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* ---- Sidebar ---- */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, rgba(17,24,39,0.95), rgba(10,14,26,0.98));
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    box-shadow: inset -1px 0 0 rgba(255,255,255,0.05), 4px 0 30px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand .icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--ml-yellow), var(--ml-blue));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.sidebar-brand h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-brand small {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 8px;
    margin-bottom: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
    user-select: none;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(255,230,0,0.12), transparent);
    color: var(--ml-yellow);
    box-shadow: inset 3px 0 0 var(--ml-yellow);
}

.nav-item .nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--ml-red);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--ml-blue), var(--ml-yellow));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--bg-primary);
}

.user-details {
    flex: 1;
}

.user-details .name {
    font-size: 13px;
    font-weight: 600;
}

.user-details .role {
    font-size: 11px;
    color: var(--text-muted);
}

/* ---- Main Content ---- */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 24px 32px;
    min-height: 100vh;
    overflow-y: auto;
}

/* ---- Top Bar ---- */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.page-title h1 {
    font-size: 26px;
    font-weight: 700;
}

.page-title p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ---- Agent Toggle ---- */
.agent-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 8px 20px;
}

.agent-toggle-wrapper .label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.toggle-switch {
    position: relative;
    width: 52px;
    height: 28px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 28px;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    left: 2px;
    bottom: 2px;
    background: linear-gradient(135deg, #ffffff, #e0e0e0);
    border-radius: 50%;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #00e65a, #00c850);
    border-color: rgba(0,230,90,0.3);
    box-shadow: 0 0 20px rgba(0, 230, 90, 0.4), 0 0 40px rgba(0, 230, 90, 0.1);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
    box-shadow: 0 2px 8px rgba(0,230,90,0.3);
}

.agent-status {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
}

.agent-status.online {
    background: rgba(0, 166, 80, 0.15);
    color: var(--ml-green);
}

.agent-status.offline {
    background: rgba(255, 68, 68, 0.15);
    color: var(--ml-red);
}

/* ---- Stat Cards Grid ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: linear-gradient(135deg, rgba(17,24,39,0.9), rgba(17,24,39,0.6));
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.4), var(--shadow-glow);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
}

.stat-card.yellow::before { background: linear-gradient(90deg, var(--ml-yellow), #ffd000); }
.stat-card.blue::before { background: linear-gradient(90deg, var(--ml-blue), #5b9bff); }
.stat-card.green::before { background: linear-gradient(90deg, var(--ml-green), #33cc77); }
.stat-card.orange::before { background: linear-gradient(90deg, var(--ml-orange), #ff9955); }

.stat-card.yellow:hover { box-shadow: 0 12px 40px rgba(0,0,0,0.3), 0 0 30px rgba(255,230,0,0.15); }
.stat-card.blue:hover { box-shadow: 0 12px 40px rgba(0,0,0,0.3), 0 0 30px rgba(52,131,250,0.15); }
.stat-card.green:hover { box-shadow: 0 12px 40px rgba(0,0,0,0.3), 0 0 30px rgba(0,166,80,0.15); }
.stat-card.orange:hover { box-shadow: 0 12px 40px rgba(0,0,0,0.3), 0 0 30px rgba(255,119,51,0.15); }

.stat-card .stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.stat-card .stat-icon {
    font-size: 28px;
    opacity: 0.9;
}

.stat-card .stat-trend {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
}

.stat-card .stat-trend.up {
    background: rgba(0, 166, 80, 0.15);
    color: var(--ml-green);
}

.stat-card .stat-value {
    font-size: 36px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ---- Cards & Panels ---- */
.card {
    background: linear-gradient(135deg, rgba(17,24,39,0.8), rgba(17,24,39,0.5));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-lg);
    overflow: visible;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: rgba(255,255,255,0.02);
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-header .card-actions {
    display: flex;
    gap: 8px;
}

.card-body {
    padding: 20px 24px;
}

/* ---- Sections Grid ---- */
.sections-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.sections-grid.full {
    grid-template-columns: 1fr;
}

/* ---- Timeline / Activity Feed ---- */
.activity-feed {
    max-height: 500px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    border-radius: var(--radius-sm);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item:hover {
    background: rgba(255,230,0,0.03);
    transform: translateX(4px);
}

.activity-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.activity-dot.question {
    background: rgba(255, 230, 0, 0.15);
}

.activity-dot.message {
    background: rgba(52, 131, 250, 0.15);
}

.activity-dot.success {
    background: rgba(0, 166, 80, 0.15);
}

.activity-dot.error {
    background: rgba(255, 68, 68, 0.15);
}

.activity-dot.system {
    background: rgba(255, 255, 255, 0.08);
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 3px;
}

.activity-desc {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-time {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ---- Response Log Table ---- */
.log-table {
    width: 100%;
    border-collapse: collapse;
}

.log-table th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255,255,255,0.02);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 5;
}

.log-table td {
    padding: 14px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

.log-table tr:hover td {
    background: rgba(255,230,0,0.03);
}

.log-table tr:hover td:first-child {
    border-left: 2px solid var(--ml-yellow);
}

.log-table tbody tr:nth-child(even) td {
    background: rgba(255,255,255,0.01);
}

.log-table .type-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
}

.type-badge.question {
    background: rgba(255, 230, 0, 0.15);
    color: var(--ml-yellow);
}

.type-badge.message {
    background: rgba(52, 131, 250, 0.15);
    color: var(--ml-blue);
}

.status-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

.status-badge.success {
    background: rgba(0, 166, 80, 0.15);
    color: var(--ml-green);
    position: relative;
    padding-left: 18px;
}

.status-badge.success::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 6px;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ml-green);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(0,166,80,0.4); }
    50% { opacity: 0.7; box-shadow: 0 0 0 4px rgba(0,166,80,0); }
}

.status-badge.failed {
    background: rgba(255, 68, 68, 0.15);
    color: var(--ml-red);
}

.status-badge.pending {
    background: rgba(255, 119, 51, 0.15);
    color: var(--ml-orange);
}

.status-badge.skipped {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

.truncate {
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Schedule Configuration ---- */
.schedule-config {
    padding: 12px 0;
    overflow: visible;
}

.day-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.day-btn {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    background: rgba(255,255,255,0.02);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.day-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255,230,0,0.15), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.day-btn:hover {
    border-color: var(--ml-yellow);
    color: var(--ml-yellow);
    background: rgba(255,230,0,0.05);
    transform: translateY(-2px);
}

.day-btn:hover::after { opacity: 1; }

.day-btn.active {
    background: linear-gradient(135deg, var(--ml-yellow), #f0d000);
    border-color: var(--ml-yellow);
    color: var(--bg-primary);
    box-shadow: 0 6px 20px rgba(255,230,0,0.35);
    transform: translateY(-2px) scale(1.05);
}

.day-btn.active::after { opacity: 0; }

.time-range {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    background: rgba(255,255,255,0.02);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.time-range label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 30px;
}

.time-range input[type="time"] {
    padding: 12px 16px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    transition: var(--transition);
    letter-spacing: 1px;
}

.time-range input[type="time"]:focus {
    outline: none;
    border-color: var(--ml-yellow);
    box-shadow: 0 0 0 3px rgba(255,230,0,0.1);
    background: rgba(255,230,0,0.05);
}

/* ---- Settings Panel ---- */
.settings-group {
    margin-bottom: 32px;
    padding-bottom: 28px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.settings-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.settings-group h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--ml-yellow);
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: none;
    border-radius: var(--radius-md);
    margin-bottom: 6px;
    background: rgba(255,255,255,0.015);
    border: 1px solid transparent;
    transition: all 0.25s ease;
    max-width: 650px;
}

.setting-row:hover {
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.05);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-label {
    flex: 1;
    padding-right: 24px;
    min-width: 0;
}

.setting-label .label-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.setting-label .label-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.5;
}

.setting-control {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    min-width: 60px;
    justify-content: flex-end;
}

/* ---- Range Slider Enhancement ---- */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.1);
    outline: none;
    transition: all 0.2s;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00e65a, #00c850);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,230,90,0.3);
    transition: all 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 15px rgba(0,230,90,0.4);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00e65a, #00c850);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0,230,90,0.3);
}

/* ---- AI Tone Selector ---- */
.tone-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tone-option {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.tone-option:hover {
    border-color: var(--ml-blue);
    color: var(--ml-blue);
}

.tone-option.active {
    background: var(--ml-blue);
    border-color: var(--ml-blue);
    color: white;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--ml-yellow), #f0d000);
    color: var(--bg-primary);
    box-shadow: 0 4px 15px rgba(255,230,0,0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255,230,0,0.3);
}

.btn-blue {
    background: linear-gradient(135deg, var(--ml-blue), var(--ml-blue-dark));
    color: white;
}

.btn-blue:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(52, 131, 250, 0.3);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--ml-yellow);
    color: var(--ml-yellow);
}

.btn-danger {
    background: rgba(255, 68, 68, 0.15);
    color: var(--ml-red);
}

.btn-danger:hover {
    background: rgba(255, 68, 68, 0.25);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

/* ---- Connection Status ---- */
.connection-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.connection-card.connected {
    border-color: rgba(0, 166, 80, 0.3);
    background: rgba(0, 166, 80, 0.05);
}

.connection-card.disconnected {
    border-color: rgba(255, 68, 68, 0.3);
    background: rgba(255, 68, 68, 0.05);
}

.connection-icon {
    font-size: 36px;
}

.connection-info h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.connection-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ---- Custom Prompt Textarea ---- */
.prompt-textarea {
    width: 100%;
    min-height: 120px;
    padding: 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: var(--transition);
    line-height: 1.5;
}

.prompt-textarea:focus {
    outline: none;
    border-color: var(--ml-yellow);
    box-shadow: 0 0 0 3px rgba(255, 230, 0, 0.1);
}

/* ---- Toast Notifications ---- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast.success { border-left: 4px solid var(--ml-green); }
.toast.error { border-left: 4px solid var(--ml-red); }
.toast.info { border-left: 4px solid var(--ml-blue); }

.toast .toast-icon { font-size: 20px; }
.toast .toast-msg { font-size: 13px; flex: 1; }

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h4 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 13px;
    max-width: 300px;
    margin: 0 auto;
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 0;
}

.pagination .page-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

.pagination .page-btn:hover {
    border-color: var(--ml-yellow);
    color: var(--ml-yellow);
}

.pagination .page-btn.active {
    background: var(--ml-yellow);
    border-color: var(--ml-yellow);
    color: var(--bg-primary);
}

.pagination .page-info {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 12px;
}

/* ---- Search / Filter Bar ---- */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-bar input,
.filter-bar select {
    padding: 9px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    transition: var(--transition);
}

.filter-bar input:focus,
.filter-bar select:focus {
    outline: none;
    border-color: var(--ml-yellow);
}

.filter-bar input { flex: 1; min-width: 200px; }
.filter-bar select { min-width: 140px; }

/* ---- Select / Dropdown Dark Theme ---- */
select {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

select:focus {
    outline: none;
    border-color: var(--ml-yellow);
    box-shadow: 0 0 0 3px rgba(255,230,0,0.1);
}

select option {
    background-color: #1a2332;
    color: #e0e0e0;
    padding: 8px;
}

select option:hover,
select option:checked {
    background-color: #2a3a4a;
    color: #ffffff;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ---- Animations ---- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse {
    animation: pulse 2s infinite;
}

/* ---- Loading Skeleton ---- */
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 400% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---- Mobile Menu Button ---- */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: rgba(255, 230, 0, 0.1);
    border: 1px solid rgba(255, 230, 0, 0.25);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.mobile-menu-btn span {
    display: block;
    width: 22px;
    height: 3px;
    background: var(--ml-yellow);
    border-radius: 2px;
    transition: var(--transition);
    transform-origin: center;
}

.mobile-menu-btn:active {
    background: rgba(255, 230, 0, 0.2);
}

.mobile-menu-btn:hover {
    border-color: var(--ml-yellow);
}

.mobile-menu-btn:hover span {
    background: var(--ml-yellow);
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* ---- Mobile Overlay ---- */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* ---- Responsive: Tablet ---- */
@media (max-width: 1024px) {
    .sections-grid {
        grid-template-columns: 1fr;
    }
    
    .main-content {
        padding: 20px 24px;
    }
}

/* ---- Responsive: Mobile ---- */
@media (max-width: 768px) {
    /* Show hamburger */
    .mobile-menu-btn {
        display: flex;
    }
    
    /* Sidebar becomes slide-over */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
        z-index: 200;
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.5);
    }
    
    /* Main content full width */
    .main-content {
        margin-left: 0;
        padding: 16px;
        max-height: none;
    }
    
    /* Top Bar */
    .top-bar {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .page-title h1 {
        font-size: 20px;
    }
    
    .page-title p {
        font-size: 12px;
    }
    
    /* Agent toggle responsive */
    .agent-toggle-wrapper {
        padding: 8px 14px;
        justify-content: space-between;
    }
    
    .top-actions {
        width: 100%;
    }
    
    .agent-toggle-wrapper {
        width: 100%;
    }
    
    /* Stats Grid: 2 columns on mobile */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .stat-card {
        padding: 14px;
    }
    
    .stat-card .stat-value {
        font-size: 24px;
    }
    
    .stat-card .stat-label {
        font-size: 11px;
    }
    
    .stat-card .stat-icon {
        font-size: 22px;
    }
    
    /* Card adjustments */
    .card-header {
        padding: 14px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .card-header h3 {
        font-size: 14px;
    }
    
    .card-body {
        padding: 14px 16px;
    }
    
    /* Sections grid single column */
    .sections-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    
    /* Activity Feed */
    .activity-feed {
        max-height: 400px;
    }
    
    .activity-item {
        gap: 10px;
        padding: 12px 0;
    }
    
    .activity-item:hover {
        margin: 0 -16px;
        padding: 12px 16px;
    }
    
    .activity-dot {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .activity-title {
        font-size: 13px;
    }
    
    .activity-desc {
        font-size: 12px;
    }
    
    .activity-time {
        font-size: 11px;
    }
    
    /* Filter bar */
    .filter-bar {
        flex-direction: column;
    }
    
    .filter-bar input {
        min-width: 0;
        width: 100%;
    }
    
    .filter-bar select {
        min-width: 0;
        width: 100%;
    }
    
    /* Log Table - Mobile cards view */
    .log-table thead {
        display: none;
    }
    
    .log-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        gap: 6px 12px;
        padding: 14px 0;
        border-bottom: 1px solid var(--border-color);
        cursor: pointer;
    }
    
    .log-table td {
        padding: 0;
        border: none;
        font-size: 12px;
    }
    
    .log-table td:nth-child(1) {
        order: 1;
    }
    
    .log-table td:nth-child(5) {
        order: 2;
    }
    
    .log-table td:nth-child(7) {
        order: 3;
        margin-left: auto;
        color: var(--text-muted);
    }
    
    .log-table td:nth-child(2) {
        order: 4;
        width: 100%;
        font-size: 13px;
        font-weight: 500;
    }
    
    .log-table td:nth-child(3) {
        order: 5;
        width: 100%;
        color: var(--text-secondary);
    }
    
    .log-table td:nth-child(4),
    .log-table td:nth-child(6) {
        display: none;
    }
    
    .log-table .truncate {
        max-width: 100%;
        white-space: normal;
    }
    
    /* Schedule */
    .day-selector {
        gap: 6px;
    }
    
    .day-btn {
        width: 42px;
        height: 42px;
        font-size: 12px;
    }
    
    .time-range {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .time-range input[type="time"] {
        flex: 1;
        min-width: 0;
    }
    
    /* Tone selector */
    .tone-selector {
        flex-direction: column;
    }
    
    .tone-option {
        width: 100%;
        text-align: center;
    }
    
    /* Connection card */
    .connection-card {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        padding: 20px 16px;
    }
    
    .connection-icon {
        font-size: 32px;
    }
    
    /* Buttons */
    .btn {
        padding: 10px 16px;
        font-size: 13px;
        width: 100%;
        justify-content: center;
    }
    
    .btn-sm {
        width: auto;
        padding: 6px 12px;
        font-size: 12px;
    }
    
    /* Settings */
    .setting-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .setting-control {
        align-self: flex-start;
    }
    
    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .pagination .page-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    /* Toast */
    .toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
    }
    
    .toast {
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }
    
    /* Modal */
    .modal-overlay {
        padding: 12px;
        align-items: flex-end;
    }
    
    .modal {
        max-height: 85vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    }
    
    .modal-header {
        padding: 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    /* Login/Setup cards */
    .login-card {
        padding: 32px 24px;
    }
    
    .setup-card {
        padding: 32px 24px;
    }
    
    /* Prompt textarea */
    .prompt-textarea {
        min-height: 100px;
        font-size: 14px;
    }
    
    /* Config guide code blocks */
    .card-body code {
        word-break: break-all;
        font-size: 11px;
    }
    
    /* Empty states */
    .empty-state {
        padding: 40px 16px;
    }
    
    .empty-state .empty-icon {
        font-size: 36px;
    }
}

/* ---- Responsive: Small Mobile (≤400px) ---- */
@media (max-width: 400px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .stat-card {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 14px;
    }
    
    .stat-card .stat-header {
        margin-bottom: 0;
    }
    
    .stat-card .stat-value {
        font-size: 20px;
    }
    
    .page-title h1 {
        font-size: 18px;
    }
    
    .day-btn {
        width: 38px;
        height: 38px;
        font-size: 11px;
    }
}

/* ---- Safe area for notched phones ---- */
@supports (padding: env(safe-area-inset-bottom)) {
    @media (max-width: 768px) {
        .main-content {
            padding-bottom: calc(16px + env(safe-area-inset-bottom));
        }
        
        .sidebar-footer {
            padding-bottom: calc(16px + env(safe-area-inset-bottom));
        }
    }
}

/* ---- Setup Screen ---- */
.setup-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.setup-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 48px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease;
}

.setup-card h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}

.setup-card .subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 32px;
    text-align: center;
}

.setup-steps {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 28px;
}

.setup-step {
    width: 32px;
    height: 4px;
    border-radius: 2px;
    background: var(--border-color);
    transition: var(--transition);
}

.setup-step.active {
    background: var(--ml-yellow);
    width: 48px;
}

.setup-step.done {
    background: var(--ml-green);
}

/* ---- Page Sections (hidden by default) ---- */
.page-section {
    display: none;
    animation: fadeInUp 0.4s ease;
}

.page-section.active {
    display: block;
}

/* ---- Response Detail Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    animation: fadeInUp 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 68, 68, 0.2);
    color: var(--ml-red);
}

.modal-body {
    padding: 24px;
}

.modal-field {
    margin-bottom: 18px;
}

.modal-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.modal-field .value {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-input);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
}

.page-btn:hover {
    background: rgba(255, 230, 0, 0.1);
    border-color: var(--ml-yellow);
    color: var(--ml-yellow);
}

.page-btn.active {
    background: var(--ml-yellow);
    border-color: var(--ml-yellow);
    color: var(--bg-primary);
    font-weight: 700;
}

.page-info {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 4px;
}

/* ---- Response Tabs ---- */
.resp-tab {
    padding: 8px 16px !important;
    font-weight: 500 !important;
    transition: var(--transition) !important;
    border: none !important;
    cursor: pointer;
}

.resp-tab.active {
    background: var(--ml-blue) !important;
    color: #fff !important;
}

.resp-tab:not(.active) {
    background: transparent !important;
    color: var(--text-secondary) !important;
}

.resp-tab:not(.active):hover {
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-primary) !important;
}

/* ---- Filter Bar ---- */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-bar input[type="search"] {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.filter-bar input[type="search"]:focus {
    outline: none;
    border-color: var(--ml-yellow);
    box-shadow: 0 0 0 3px rgba(255, 230, 0, 0.1);
}

.filter-bar select {
    padding: 10px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.filter-bar select:focus {
    outline: none;
    border-color: var(--ml-blue);
}

/* ============================================
   CONNECTION BANNERS
   ============================================ */
.connection-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    animation: slideDown 0.3s ease;
}

.connection-banner.connection-lost {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fff;
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.3);
}

.connection-banner.offline-mode {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #fff;
    box-shadow: 0 4px 20px rgba(217, 119, 6, 0.3);
}

.banner-icon {
    font-size: 16px;
}

.banner-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   LAST SYNC INDICATOR
   ============================================ */
.last-sync {
    font-size: 12px;
    color: var(--text-muted);
    padding: 4px 10px;
    background: var(--bg-input);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    white-space: nowrap;
    transition: var(--transition);
}

.last-sync:hover {
    color: var(--text-secondary);
    border-color: var(--border-hover);
}

/* ============================================
   PWA INSTALL PROMPT
   ============================================ */
.pwa-install-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pwa-install-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.95), rgba(26, 35, 55, 0.95));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    max-width: 360px;
}

.pwa-install-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.pwa-install-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.pwa-install-text strong {
    font-size: 14px;
    color: var(--text-primary);
}

.pwa-install-text span {
    font-size: 12px;
    color: var(--text-secondary);
}

.pwa-install-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    line-height: 1;
    transition: var(--transition);
    flex-shrink: 0;
}

.pwa-install-close:hover {
    color: var(--text-primary);
}

@keyframes slideUp {
    from { transform: translateX(-50%) translateY(100px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ============================================
   PWA STANDALONE MODE
   ============================================ */
@media (display-mode: standalone) {
    body {
        /* Extra padding for standalone PWA status bar */
        padding-top: env(safe-area-inset-top);
    }
    
    .connection-banner {
        padding-top: calc(10px + env(safe-area-inset-top));
    }
    
    .pwa-install-prompt {
        display: none !important;
    }
}

/* ============================================
   MOBILE ADJUSTMENTS FOR NEW COMPONENTS
   ============================================ */
@media (max-width: 768px) {
    .last-sync {
        display: none;
    }
    
    .pwa-install-content {
        max-width: calc(100vw - 40px);
    }
    
    .connection-banner {
        font-size: 12px;
        padding: 8px 16px;
    }
}

@media (max-width: 400px) {
    .pwa-install-content {
        padding: 10px 12px;
        gap: 8px;
    }
    
    .pwa-install-icon {
        font-size: 24px;
    }
}

/* ============================================ */
/* PASSWORD VISIBILITY TOGGLE                  */
/* ============================================ */
.password-wrapper {
    position: relative;
    width: 100%;
}

.password-wrapper input {
    width: 100%;
    padding-right: 48px !important;
    box-sizing: border-box;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
    z-index: 2;
    backdrop-filter: blur(4px);
}

.toggle-password:hover {
    color: var(--ml-yellow);
    background: rgba(255, 230, 0, 0.12);
    transform: translateY(-50%) scale(1.08);
}

.toggle-password:active {
    transform: translateY(-50%) scale(0.95);
}

.toggle-password svg {
    pointer-events: none;
    width: 18px;
    height: 18px;
}

/* ---- Enhanced Animations ---- */
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.page-section { animation: fadeInScale 0.4s ease; }
.stats-grid .stat-card { animation: slideInLeft 0.5s ease backwards; }
.stats-grid .stat-card:nth-child(1) { animation-delay: 0.05s; }
.stats-grid .stat-card:nth-child(2) { animation-delay: 0.1s; }
.stats-grid .stat-card:nth-child(3) { animation-delay: 0.15s; }
.stats-grid .stat-card:nth-child(4) { animation-delay: 0.2s; }

/* ---- Card Header Button Enhancement ---- */
.card-header .btn {
    box-shadow: 0 4px 15px rgba(255,230,0,0.2);
}
.card-header .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255,230,0,0.3);
}
