:root {
  --bg-main: #09090b;
  --bg-card: #121215;
  --bg-input: #18181d;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(168, 85, 247, 0.5);
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent-purple: #9333ea;
  --accent-purple-glow: rgba(147, 51, 234, 0.25);
  --accent-blue: #3b82f6;
  --success: #10b981;
  --error: #ef4444;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Background mesh glow */
body::before {
  content: "";
  position: fixed;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(circle, rgba(147, 51, 234, 0.12) 0%, rgba(0, 0, 0, 0) 70%);
  pointer-events: none;
  z-index: 0;
}

/* Container */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
  position: relative;
  z-index: 1;
}

/* Auth / Card Centered */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 90vh;
  padding: 20px;
  position: relative;
  z-index: 1;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}

.brand-header {
  text-align: center;
  margin-bottom: 28px;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 9999px;
  background: rgba(147, 51, 234, 0.1);
  border: 1px solid rgba(147, 51, 234, 0.3);
  color: #c084fc;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.brand-title {
  font-size: 22px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.brand-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* Form Elements */
.tab-switch {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
  border: 1px solid var(--border-subtle);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn.active {
  background: #27272e;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.form-group {
  margin-bottom: 18px;
}

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

.form-input, .form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: #ffffff;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus, .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-purple-glow);
}

.btn-primary {
  width: 100%;
  background: #ffffff;
  color: #000000;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-top: 8px;
}

.btn-primary:hover {
  background: #e4e4e7;
  transform: translateY(-1px);
}

.btn-secondary {
  width: 100%;
  background: #27272e;
  color: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: #32323a;
}

/* Alert Notification */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.alert-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.alert-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

/* Navbar */
.navbar {
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(18, 18, 21, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
}

.nav-brand {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  text-decoration: none;
}

.nav-brand span {
  color: #c084fc;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-tag {
  font-size: 13px;
  color: var(--text-secondary);
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-logout:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-top: 28px;
}

@media (max-width: 860px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.section-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 4px;
}

.section-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* Device Item */
.device-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  transition: border-color 0.15s;
}

.device-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.device-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.device-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #23232b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.device-name {
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
}

.device-id {
  font-size: 12px;
  color: var(--text-muted);
  font-family: monospace;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  margin-right: 6px;
}

.status-badge {
  font-size: 12px;
  color: #a7f3d0;
  display: flex;
  align-items: center;
}

/* Code Snippet Box */
.code-box {
  background: #0d0d10;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: #e4e4e7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.btn-copy {
  background: #27272e;
  border: none;
  color: #a1a1aa;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}

.btn-copy:hover {
  color: #ffffff;
}

/* OAuth Integration Box */
.oauth-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.oauth-logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #10a37f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #ffffff;
}

.oauth-logo.claude {
  background: #d97706;
}

.oauth-logo.json {
  background: #2563eb;
}

/* Rich Host Card Styling (SentinelX-inspired + Multi-Platform Hub) */
.host-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.host-card:hover {
  border-color: rgba(147, 51, 234, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.host-header {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.015);
}

.host-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.host-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

.host-status-dot.offline {
  background: #ef4444;
  box-shadow: none;
}

.host-name {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
}

.host-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-family: ui-monospace, monospace;
}

.host-tags {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tag-pill {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.tag-pill.accent {
  background: rgba(147, 51, 234, 0.15);
  border-color: rgba(147, 51, 234, 0.35);
  color: #c084fc;
}

/* Connected Platforms Section inside Host Card */
.host-body {
  padding: 18px 20px;
}

.platform-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.platform-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.platform-card {
  background: #0e0e12;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: all 0.15s ease;
}

.platform-card.connected {
  border-color: rgba(16, 185, 129, 0.3);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.03), #0e0e12);
}

.platform-card.disconnected {
  opacity: 0.75;
}

.platform-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.platform-avatar {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  flex-shrink: 0;
}

.platform-details {
  line-height: 1.3;
}

.platform-name {
  font-size: 13px;
  font-weight: 500;
  color: #fff;
}

.platform-status {
  font-size: 11px;
  color: var(--text-muted);
}

.platform-status.online {
  color: #34d399;
}

.btn-platform-action {
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  background: #18181d;
  color: var(--text-primary);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-platform-action:hover {
  background: #27272e;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-platform-action.danger {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-platform-action.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
}

.btn-platform-action.connect-btn {
  background: rgba(147, 51, 234, 0.2);
  border-color: rgba(147, 51, 234, 0.4);
  color: #d8b4fe;
}

.btn-platform-action.connect-btn:hover {
  background: rgba(147, 51, 234, 0.35);
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 580px;
  padding: 28px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
}

.code-pre {
  background: #09090c;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: #7dd3fc;
  overflow-x: auto;
  margin: 12px 0 16px 0;
  white-space: pre-wrap;
  word-break: break-all;
}

