/* Cards */
.card {
  background: var(--surface);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.card:hover {
  border-color: var(--border-active);
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px var(--border-active), 0 4px 24px rgba(0,212,255,0.06);
}
.card-title { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 8px; }
.card-value { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; color: var(--text); }
.card-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px;
  font-size: 0.8rem; font-weight: 600; font-family: var(--font);
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), opacity var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; }

.btn-primary  { background: var(--brand); color: #000; border-color: var(--brand); }
.btn-primary:hover:not(:disabled)  { background: #00eeff; box-shadow: 0 0 12px rgba(0,212,255,0.4); }
.btn-success  { background: var(--success); color: #000; }
.btn-success:hover:not(:disabled)  { background: #00f0a0; }
.btn-warning  { background: var(--warning); color: #000; }
.btn-warning:hover:not(:disabled)  { background: #ffc55e; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled)   { background: #ff6b82; }
.btn-ghost    { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover:not(:disabled)    { background: var(--surface-hover); border-color: rgba(255,255,255,0.14); }
.btn-sm { padding: 5px 10px; font-size: 0.75rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 7px; }

/* Forms */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-group label { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.form-group small { font-size: 0.75rem; color: var(--text-muted); }

input[type=text], input[type=password], input[type=url], input[type=email],
input[type=number], input[type=color], textarea, select {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  padding: 8px 12px;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.15);
}
input[type=color] { height: 36px; padding: 4px 8px; cursor: pointer; }
select option { background: #060912; color: var(--text); }
textarea { resize: vertical; min-height: 100px; }
textarea.mono { font-family: var(--font-mono); font-size: 0.8rem; }

.form-error { color: var(--danger); font-size: 0.8rem; margin-top: 4px; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }

.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 100px;
  font-size: 0.7rem; font-weight: 600; white-space: nowrap;
}
.badge-success { background: var(--success-dim); color: var(--success); }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-danger  { background: var(--danger-dim);  color: var(--danger); }
.badge-info    { background: var(--brand-dim);   color: var(--brand); }
.badge-muted   { background: var(--surface-high); color: var(--text-muted); }

/* Table */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 10px 14px; font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); text-align: left;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
  white-space: nowrap;
}
tbody td {
  padding: 10px 14px; font-size: 0.825rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-hover); }
tbody tr.selected td { background: var(--brand-dim); }

/* Toasts */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  min-width: 280px; max-width: 380px;
  background: #141928; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  display: flex; align-items: flex-start; gap: 10px;
  box-shadow: var(--shadow); backdrop-filter: var(--blur);
  animation: toastIn 0.2s ease;
}
.toast.removing { animation: toastOut 0.2s ease forwards; }
.toast-icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.toast-message { flex: 1; font-size: 0.825rem; line-height: 1.4; color: var(--text); }
.toast-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0; font-size: 1rem; line-height: 1; }
.toast.success { border-left: 3px solid var(--success); }
.toast.success .toast-icon { color: var(--success); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.error   .toast-icon { color: var(--danger); }
.toast.info    { border-left: 3px solid var(--brand); }
.toast.info    .toast-icon { color: var(--brand); }
@keyframes toastIn  { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastOut { from { opacity:1; transform:translateY(0); } to { opacity:0; transform:translateY(10px); } }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px); z-index: 500;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #0d1220; border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: min(700px, 100%);
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity:0; transform:scale(0.96); } to { opacity:1; transform:scale(1); } }
.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.modal-header h3 { font-size: 1rem; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; padding: 2px 6px; border-radius: var(--radius-sm); }
.modal-close:hover { background: var(--surface-hover); color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; flex-shrink: 0; }

/* Login card */
.login-card {
  background: var(--surface); backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 36px 32px; width: min(400px, 100%);
  box-shadow: var(--shadow-lg);
}
.login-logo { display: flex; align-items: center; gap: 10px; color: var(--brand); font-weight: 700; margin-bottom: 24px; }
.login-title { font-size: 1.4rem; margin-bottom: 20px; }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.search-input { flex: 1; min-width: 200px; }
.toolbar-right { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.bulk-bar { display: none; align-items: center; gap: 8px; background: var(--brand-dim); border: 1px solid var(--border-active); border-radius: var(--radius); padding: 8px 14px; margin-bottom: 12px; font-size: 0.8rem; }
.bulk-bar.visible { display: flex; }
.bulk-count { font-weight: 600; color: var(--brand); }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 24px; }

/* Divider */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* Empty state */
.empty-state { padding: 48px 20px; text-align: center; color: var(--text-muted); }
.empty-state svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: 0.3; }
.empty-state p { font-size: 0.875rem; }

/* Spinner */
.spinner {
  width: 18px; height: 18px; border: 2px solid var(--border);
  border-top-color: var(--brand); border-radius: 50%;
  animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Copy block */
.copy-block {
  background: rgba(0,0,0,0.3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  font-family: var(--font-mono); font-size: 0.75rem; line-height: 1.6;
  max-height: 340px; overflow-y: auto; white-space: pre-wrap; word-break: break-all;
  color: var(--text);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(0,214,143,0.6); }
  50% { opacity: 0.8; box-shadow: 0 0 0 4px rgba(0,214,143,0); }
}
.ws-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  display: inline-block;
  animation: pulse-dot 2s ease infinite;
  flex-shrink: 0;
}
.ws-dot.reconnecting { background: var(--warning); animation: none; }
.ws-dot.offline { background: var(--text-dim); animation: none; }

/* Mono data values */
.mono { font-family: var(--font-mono) !important; }

/* Geo bar (dashboard mini geo preview) */
.geo-bar { display: flex; flex-direction: column; gap: 6px; }
.geo-bar-row { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; }
.geo-bar-label { width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.geo-bar-fill-wrap { flex: 1; height: 6px; background: var(--surface-high); border-radius: 3px; }
.geo-bar-fill { height: 100%; border-radius: 3px; background: var(--brand); }
.geo-bar-count { width: 36px; text-align: right; color: var(--text-muted); font-family: var(--font-mono); font-size: 0.75rem; }

/* Sparkline SVG */
.sparkline { display: block; }

/* Two-column form layout */
.form-two-col { display: grid; grid-template-columns: 200px 1fr; gap: 12px 20px; align-items: start; }
.form-two-col .form-section-title {
  grid-column: 1 / -1;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--brand);
  padding-bottom: 8px; margin-top: 8px;
  border-bottom: 1px solid var(--border);
}
.form-two-col label { padding-top: 8px; font-size: 0.825rem; font-weight: 600; color: var(--text); }
.form-two-col small { grid-column: 2; margin-top: -8px; font-size: 0.75rem; color: var(--text-muted); }
