* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0f172a; --bg2: #1e293b; --bg3: #334155;
  --text: #f1f5f9; --text2: #94a3b8; --text3: #64748b;
  --blue: #3b82f6; --blue2: #2563eb; --green: #22c55e; --red: #ef4444;
  --orange: #f59e0b; --radius: 12px;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* Login */
.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; }
.login-box { background: var(--bg2); border-radius: var(--radius); padding: 40px; width: 100%; max-width: 400px; }
.login-box h1 { text-align: center; margin-bottom: 8px; font-size: 24px; }
.login-box .subtitle { text-align: center; color: var(--text2); margin-bottom: 32px; font-size: 14px; }
.login-box input { width: 100%; padding: 12px 16px; background: var(--bg3); border: 1px solid transparent; border-radius: 8px; color: var(--text); font-size: 16px; margin-bottom: 16px; outline: none; transition: border-color .2s; }
.login-box input:focus { border-color: var(--blue); }
.login-box button { width: 100%; padding: 14px; background: var(--blue); color: #fff; border: none; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; transition: background .2s; }
.login-box button:hover { background: var(--blue2); }
.login-error { color: var(--red); text-align: center; margin-top: 12px; font-size: 14px; display: none; }

/* Dashboard */
.dashboard { display: none; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; background: var(--bg2); border-bottom: 1px solid var(--bg3); position: sticky; top: 0; z-index: 100; }
.topbar h1 { font-size: 18px; }
.topbar .actions { display: flex; gap: 8px; align-items: center; }
.btn { padding: 8px 16px; border-radius: 8px; border: none; font-size: 14px; font-weight: 500; cursor: pointer; transition: all .2s; display: inline-flex; align-items: center; gap: 6px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue2); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--bg3); }
.btn-ghost:hover { background: var(--bg3); color: var(--text); }
.btn-orange { background: var(--orange); color: #000; }
.btn-orange:hover { background: #d97706; }

/* VPN tabs */
.vpn-tabs { display: flex; gap: 0; padding: 16px 20px 0; }
.vpn-tab { padding: 10px 24px; background: var(--bg3); color: var(--text2); border: none; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s; border-radius: 8px 8px 0 0; }
.vpn-tab.active { background: var(--bg2); color: var(--text); }
.vpn-tab .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot-green { background: var(--green); }
.dot-red { background: var(--red); }
.dot-gray { background: var(--text3); }

/* Status card */
.content { padding: 0 20px 20px; }
.status-card { background: var(--bg2); border-radius: 0 var(--radius) var(--radius) var(--radius); padding: 20px; margin-bottom: 20px; }
.status-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 12px; }
.status-header h2 { font-size: 16px; }
.vpn-controls { display: flex; gap: 8px; }
.status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat-item { background: var(--bg); border-radius: 8px; padding: 14px; }
.stat-label { font-size: 12px; color: var(--text3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.stat-value { font-size: 20px; font-weight: 700; }
.stat-value.running { color: var(--green); }
.stat-value.stopped { color: var(--red); }

/* Users */
.users-section { background: var(--bg2); border-radius: var(--radius); padding: 20px; }
.users-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 12px; }
.users-header h2 { font-size: 16px; }
.user-card { background: var(--bg); border-radius: 8px; padding: 16px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.user-info { display: flex; align-items: center; gap: 12px; }
.user-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--blue); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; flex-shrink: 0; }
.user-name { font-weight: 600; }
.user-ip { font-size: 13px; color: var(--text3); }
.user-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.no-users { text-align: center; color: var(--text3); padding: 40px 20px; }

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 200; justify-content: center; align-items: center; padding: 20px; }
.modal-overlay.active { display: flex; }
.modal { background: var(--bg2); border-radius: var(--radius); padding: 24px; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; }
.modal h2 { margin-bottom: 16px; font-size: 18px; }
.modal input { width: 100%; padding: 12px 16px; background: var(--bg); border: 1px solid var(--bg3); border-radius: 8px; color: var(--text); font-size: 16px; margin-bottom: 16px; outline: none; }
.modal input:focus { border-color: var(--blue); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Share modal */
.share-content { background: var(--bg); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.share-text { font-size: 13px; white-space: pre-wrap; word-break: break-all; color: var(--text2); max-height: 300px; overflow-y: auto; line-height: 1.5; }
.qr-container { text-align: center; margin: 16px 0; }
.qr-container img { max-width: 200px; border-radius: 8px; background: #fff; padding: 8px; }
.share-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Toast */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--green); color: #fff; padding: 12px 24px; border-radius: 8px; font-size: 14px; font-weight: 500; z-index: 300; opacity: 0; transition: opacity .3s; pointer-events: none; }
.toast.show { opacity: 1; }
.toast.error { background: var(--red); }

/* Responsive */
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .topbar h1 { font-size: 16px; }
  .vpn-tabs { padding: 12px 16px 0; }
  .vpn-tab { padding: 8px 16px; font-size: 13px; }
  .content { padding: 0 16px 16px; }
  .status-grid { grid-template-columns: repeat(2, 1fr); }
  .status-header { flex-direction: column; align-items: flex-start; }
  .user-card { flex-direction: column; align-items: flex-start; }
  .user-actions { width: 100%; }
  .user-actions .btn { flex: 1; justify-content: center; }
  .modal { padding: 20px; }
  .share-actions { flex-direction: column; }
  .share-actions .btn { width: 100%; justify-content: center; }
}
