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

body, html {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  height: 100%;
  background-color: #0f172a;
  color: #f8fafc;
  overflow: hidden;
}

.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Sidebar Styling */
.sidebar {
  width: 380px;
  background: #1e293b;
  border-right: 1px solid #334155;
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 16px;
  z-index: 1000;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #38bdf8;
}

.brand .icon-brand {
  font-size: 32px;
}

.brand h2 {
  font-size: 20px;
  font-weight: 700;
  color: #f8fafc;
}

.card {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 14px;
}

.config-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.form-group label {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 4px;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 8px 12px;
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 6px;
  color: #f8fafc;
  font-size: 13px;
}

.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: #38bdf8;
}

.btn {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: none;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.2s;
  margin-bottom: 8px;
}

.btn-primary {
  background: #0284c7;
  color: #ffffff;
}

.btn-primary:hover {
  background: #0369a1;
}

.btn-secondary {
  background: #3b82f6;
  color: #ffffff;
}

.btn-outline {
  background: transparent;
  border: 1px solid #475569;
  color: #94a3b8;
}

.btn-outline:hover {
  background: #334155;
  color: #ffffff;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 12px;
  margin-top: 6px;
}

.status-badge.connected {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.status-badge.disconnected {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  background: #0f172a;
  padding: 4px;
  border-radius: 8px;
}

.tab-btn {
  flex: 1;
  padding: 8px;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
}

.tab-btn.active {
  background: #3b82f6;
  color: #ffffff;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 10px;
}

.btn-icon {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
}

.device-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 350px;
  overflow-y: auto;
}

.device-card {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.device-card:hover {
  border-color: #38bdf8;
}

.device-card .device-header {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
}

.device-card .device-meta {
  font-size: 11px;
  color: #94a3b8;
}

.empty-state {
  font-size: 12px;
  color: #64748b;
  text-align: center;
  padding: 20px 0;
}

.history-summary {
  margin-top: 12px;
}

.history-summary.hidden {
  display: none;
}

.history-summary h4 {
  font-size: 13px;
  margin-bottom: 8px;
  color: #38bdf8;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 4px;
}

.summary-item strong {
  color: #f8fafc;
}

/* Map Area */
.map-view {
  flex: 1;
  position: relative;
}

#map {
  height: 100%;
  width: 100%;
}

/* Auth & account panel */
.hidden {
  display: none !important;
}

.hint {
  font-size: 11px;
  color: #64748b;
  line-height: 1.5;
  margin-top: 2px;
}

.auth-error {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  font-size: 12px;
  line-height: 1.4;
}

.account-email {
  font-size: 13px;
  font-weight: 600;
  color: #f8fafc;
  word-break: break-all;
}

.group-filter {
  margin-top: 12px;
}
