/* ==================== BASE / RESET / VARIABLES ==================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e8ebef;
  --border: #d4d9e1;
  --border-light: #e2e6ec;
  --text: #1a2332;
  --text-muted: #5a6578;
  --text-dim: #8b95a5;
  --accent: #1a56db;
  --accent-dim: rgba(26, 86, 219, 0.08);
  --green: #1a9a4a;
  --green-bg: rgba(26, 154, 74, 0.08);
  --orange: #c4760a;
  --orange-bg: rgba(196, 118, 10, 0.08);
  --red: #c43a3a;
  --radius: 8px;
  --radius-sm: 5px;
  --blue: #1a56db;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ==================== HEADER ==================== */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.header-badge {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 5px 8px;
  border-radius: 3px;
  flex-shrink: 0;
}

.header-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 20px;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1;
}

.header-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .header {
    padding: 10px 14px;
    gap: 8px;
  }

  .header-title {
    font-size: 16px;
  }

  .header-subtitle {
    display: none;
  }

  .header-right {
    gap: 6px;
  }

}

/* ==================== BUTTONS ==================== */
.btn {
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  box-sizing: border-box;
  white-space: nowrap;
}

.btn svg {
  flex-shrink: 0;
}

.btn:hover {
  opacity: 0.85;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  padding: 6px 16px;
  font-size: 13px;
}

.btn-config {
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 14px;
  padding: 6px 10px;
}

.btn-back {
  background: var(--surface-2);
  color: var(--text-muted);
}

.btn-save {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.btn-outline {
  background: var(--surface-3);
  color: var(--text-muted);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  opacity: 1;
}

.btn-danger {
  background: var(--surface-3);
  color: var(--text-muted);
}

.btn-danger:hover {
  border-color: var(--red);
  color: var(--red);
  opacity: 1;
}


/* ==================== CONNECTION STATUS ==================== */
.conn-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.conn-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.conn-status.online .dot {
  background: var(--green);
}

.conn-status.online {
  color: var(--green);
  background: var(--green-bg);
}

.conn-status.offline .dot {
  background: var(--orange);
}

.conn-status.offline {
  color: var(--orange);
  background: var(--orange-bg);
}

.conn-status.local .dot {
  background: var(--text-dim);
}

.conn-status.local {
  color: var(--text-muted);
  background: var(--surface-2);
}

/* ==================== LOADING ==================== */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.empty-state-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.empty-state-text {
  font-size: 13px;
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #b0b8c4;
}