:root {
    --primary: #00897B;
    --primary-light: #4DB6AC;
    --primary-dark: #00695C;
    --bg: #f5f7fa;
    --bg-white: #ffffff;
    --text: #1a1a2e;
    --text-muted: #6c757d;
    --border: #e0e0e0;
    --success: #00C853;
    --warning: #FF9800;
    --error: #F44336;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 16px;
    --radius-sm: 10px;
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}
.page { display: flex; flex-direction: column; min-height: 100vh; }
.page.hidden, .hidden { display: none !important; }

.login-wrapper {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 24px; padding-top: calc(24px + var(--safe-top));
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}
.login-card {
    background: var(--bg-white); border-radius: var(--radius); padding: 40px 32px;
    width: 100%; max-width: 400px; box-shadow: var(--shadow-lg);
}
.login-header { text-align: center; margin-bottom: 32px; }
.logo { height: 44px; margin-bottom: 20px; }
.login-header h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 6px; }
.login-header p { color: var(--text-muted); font-size: 0.9rem; }
.input-group { margin-bottom: 20px; }
.input-group label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; }
.input-group input {
    width: 100%; padding: 14px 16px; border: 2px solid var(--border); border-radius: var(--radius-sm); font-size: 16px;
}
.input-group input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(0,137,123,0.1); }
.error { color: var(--error); font-size: 0.85rem; margin-bottom: 16px; min-height: 20px; text-align: center; }
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 14px 24px; border: none; border-radius: var(--radius-sm);
    font-size: 0.95rem; font-weight: 600; cursor: pointer;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; }
.btn-full { width: 100%; }
.btn-danger { background: var(--error); color: white; }
.btn-sm { padding: 10px 16px; font-size: 0.85rem; }
.btn-icon {
    background: transparent; border: none; width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.btn-icon svg { width: 20px; height: 20px; }
.btn-icon:hover { background: rgba(0,0,0,0.05); }
.login-domain { text-align: center; margin-top: 24px; }
.chip { display: inline-block; background: var(--bg); padding: 8px 16px; border-radius: 50px; font-size: 0.8rem; color: var(--text-muted); }
.login-footer { margin-top: 32px; color: rgba(255,255,255,0.7); font-size: 0.8rem; }

.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 20px; padding-top: calc(12px + var(--safe-top));
    background: var(--bg-white); border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-logo { height: 32px; }
.topbar h1 { font-size: 1.1rem; font-weight: 700; color: var(--primary); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-chip { font-size: 0.85rem; color: var(--text-muted); }

.content { flex: 1; padding: 20px; padding-bottom: calc(20px + var(--safe-bottom)); max-width: 800px; margin: 0 auto; width: 100%; }
.search-section { margin-bottom: 20px; }
.search-bar {
    display: flex; align-items: center; gap: 12px; background: var(--bg-white);
    padding: 8px 8px 8px 16px; border-radius: var(--radius); box-shadow: var(--shadow);
}
.search-icon { width: 20px; height: 20px; color: var(--text-muted); }
.search-bar input { flex: 1; border: none; font-size: 16px; padding: 8px 0; background: transparent; }
.search-bar input:focus { outline: none; }

.status-pill {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px;
    background: var(--bg-white); border-radius: 50px; font-size: 0.85rem; margin-bottom: 20px; box-shadow: var(--shadow);
}
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-muted); }
.status-pill.connected .status-dot { background: var(--success); }
.status-pill.error .status-dot { background: var(--error); }

.card { background: var(--bg-white); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.card-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-header h2 { font-size: 1rem; font-weight: 600; }
.counter { background: var(--primary); color: white; padding: 4px 12px; border-radius: 50px; font-size: 0.8rem; }

.sessions-container { padding: 16px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state.small { padding: 24px; }

.session-item { background: var(--bg); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 12px; }
.session-item:last-child { margin-bottom: 0; }
.session-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.session-user { font-weight: 600; font-size: 1rem; }
.session-vda { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }
.session-status {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
    border-radius: 50px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
}
.session-status.active { background: rgba(0,200,83,0.15); color: #00a344; }
.session-status.disconnected { background: rgba(255,152,0,0.15); color: #e68900; }
.session-status .dot { width: 8px; height: 8px; border-radius: 50%; }
.session-status.active .dot { background: var(--success); }
.session-status.disconnected .dot { background: var(--warning); }
.session-meta { display: flex; gap: 16px; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 12px; }
.session-actions { display: flex; justify-content: flex-end; }

.history-container { padding: 12px; }
.history-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; background: var(--bg); border-radius: var(--radius-sm);
    margin-bottom: 8px; cursor: pointer;
}
.history-item:hover { background: #e8e8e8; }
.history-info { flex: 1; }
.history-users { font-weight: 500; font-size: 0.9rem; }
.history-time { font-size: 0.8rem; color: var(--text-muted); }
.history-badge { padding: 6px 12px; border-radius: 50px; font-size: 0.75rem; font-weight: 600; }
.history-badge.success { background: rgba(0,200,83,0.15); color: #00a344; }
.history-badge.error { background: rgba(244,67,54,0.15); color: var(--error); }

.bottombar {
    display: flex; justify-content: space-between; padding: 12px 20px;
    padding-bottom: calc(12px + var(--safe-bottom));
    background: var(--bg-white); border-top: 1px solid var(--border); font-size: 0.75rem; color: var(--text-muted);
}

.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.modal-box { position: relative; background: var(--bg-white); border-radius: var(--radius); padding: 24px; width: 100%; max-width: 440px; max-height: 80vh; overflow-y: auto; }
.modal-header { margin-bottom: 20px; }
.modal-header h3 { font-size: 1.2rem; margin-bottom: 4px; }
.modal-header p { color: var(--text-muted); font-size: 0.9rem; }
.modal-body { margin-bottom: 20px; }
.step-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.step-item:last-child { border-bottom: none; }
.step-icon { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; background: var(--bg); }
.step-icon.success { background: var(--success); color: white; }
.step-icon.error { background: var(--error); color: white; }
.step-icon.running { background: var(--primary); color: white; }
.step-title { flex: 1; font-size: 0.9rem; }
.step-time { font-size: 0.8rem; color: var(--text-muted); }
.modal-result { text-align: center; font-weight: 600; padding: 16px; border-radius: var(--radius-sm); margin-bottom: 16px; }
.modal-result.success { background: rgba(0,200,83,0.1); color: #00a344; }
.modal-result.error { background: rgba(244,67,54,0.1); color: var(--error); }
.modal-result:empty { display: none; }

@media (max-width: 480px) {
    .topbar h1 { font-size: 1rem; }
    .search-bar { flex-wrap: wrap; }
    .search-bar input { width: 100%; }
}
