/* ============================================================
   OdinFlow Developers Dashboard — Styles
   ============================================================ */

/* ---------- Reset & Tokens ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Palette */
  --color-bg:          #0f1117;
  --color-surface:     #1a1d27;
  --color-surface-alt: #22252f;
  --color-border:      #2e3140;
  --color-text:        #e2e4eb;
  --color-text-muted:  #8b8fa3;
  --color-primary:     #6366f1;
  --color-primary-hover: #818cf8;
  --color-success:     #22c55e;
  --color-warning:     #f59e0b;
  --color-danger:      #ef4444;

  /* Typography */
  --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono:   'Cascadia Code', 'Fira Code', 'Consolas', monospace;

  /* Sizing */
  --radius: 8px;
  --topbar-h: 56px;
  --tab-h: 44px;
}

html, body {
  height: 100%;
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-bg);
}

/* ---------- Utility Classes ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.btn:hover { opacity: 0.9; }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--color-primary-hover); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.btn-outline:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- Login Page ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--color-bg);
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 40px 32px;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-primary);
}
.login-subtitle {
  margin-top: 4px;
  color: var(--color-text-muted);
  font-size: 14px;
}

.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--color-text-muted);
}
.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--color-primary);
}

.error-text {
  color: var(--color-danger);
  font-size: 13px;
  margin-bottom: 12px;
  text-align: center;
}

/* ---------- Top Bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 24px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar-user {
  color: var(--color-text-muted);
  font-size: 13px;
}

/* ---------- Tab Bar ---------- */
.tab-bar {
  display: flex;
  gap: 0;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0 24px;
  position: sticky;
  top: var(--topbar-h);
  z-index: 99;
}
.tab-btn {
  position: relative;
  padding: 12px 22px;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s;
}
.tab-btn:hover {
  color: var(--color-text);
}
.tab-btn.active {
  color: var(--color-primary);
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-primary);
  border-radius: 2px 2px 0 0;
}

/* ---------- Dashboard Content ---------- */
.dashboard-body {
  min-height: 100vh;
  background: var(--color-bg);
}
.dashboard-content {
  padding: 24px;
  max-width: 1280px;
  margin: 0 auto;
}

/* Tab Panels */
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

/* Panel Header */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.panel-header h2 {
  font-size: 20px;
  font-weight: 600;
}

/* ---------- Status Cards ---------- */
.card-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.status-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.status-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
}
.status-value {
  font-size: 20px;
  font-weight: 600;
}
.status-value.ok      { color: var(--color-success); }
.status-value.warning { color: var(--color-warning); }
.status-value.error   { color: var(--color-danger); }

/* ---------- Data Table ---------- */
.table-container {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
  overflow-x: auto;
}
.table-container h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
}
.data-table th {
  color: var(--color-text-muted);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}
.data-table tbody tr:hover {
  background: var(--color-surface-alt);
}
.data-table .empty-row td {
  text-align: center;
  color: var(--color-text-muted);
  padding: 30px;
}

.method-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.method-badge.get    { background: #1e3a5f; color: #60a5fa; }
.method-badge.post   { background: #1a3d2e; color: #4ade80; }
.method-badge.put    { background: #3d3419; color: #facc15; }
.method-badge.delete { background: #3d1919; color: #f87171; }
.method-badge.patch  { background: #2d1f3d; color: #c084fc; }

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.status-dot.green  { background: var(--color-success); }
.status-dot.yellow { background: var(--color-warning); }
.status-dot.red    { background: var(--color-danger); }
.status-dot.gray   { background: var(--color-text-muted); }

/* ---------- Response Viewer ---------- */
.response-viewer {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 24px;
}
.response-viewer h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
}
.response-box {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--color-text-muted);
  max-height: 400px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- Auto-refresh label ---------- */
.auto-refresh-label {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-right: 10px;
}

/* ---------- 5-column card row ---------- */
.card-row-5 {
  grid-template-columns: repeat(5, 1fr);
}
@media (max-width: 900px) {
  .card-row-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
  .card-row-5 { grid-template-columns: 1fr 1fr; }
}

.status-value-sm {
  font-size: 15px;
}

/* ---------- Key-Value Grid ---------- */
.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.kv-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kv-key {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
}
.kv-val {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ---------- Counter Grid ---------- */
.counter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}
.counter-item {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.counter-val {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-mono);
}
.counter-val.ok    { color: var(--color-success); }
.counter-val.error { color: var(--color-danger); }
.counter-key {
  font-size: 11px;
  color: var(--color-text-muted);
  text-transform: capitalize;
}
.badge-muted {
  font-size: 11px;
  font-weight: 400;
  color: var(--color-text-muted);
  margin-left: 6px;
}
.text-muted {
  color: var(--color-text-muted);
  font-size: 13px;
}

/* ---------- Action Cards ---------- */
.actions-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 24px;
}
.action-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
}
.action-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
}
.action-card .form-group {
  margin-bottom: 12px;
}
.action-card select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  outline: none;
}
.action-card select:focus {
  border-color: var(--color-primary);
}
.form-inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.action-btns {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

/* ---------- Danger Button ---------- */
.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-danger:hover {
  background: #dc2626;
}

/* ---------- Action Divider ---------- */
.action-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 14px 0 4px;
}

/* ---------- Table Cell Colors ---------- */
.cell-danger  { color: var(--color-danger); font-weight: 600; }
.cell-warning { color: var(--color-warning); font-weight: 600; }

/* ---------- Selected Row ---------- */
.data-table tbody tr.row-selected {
  background: var(--color-surface-alt);
  border-left: 3px solid var(--color-primary);
}

/* ---------- Scrollbar Styling ---------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--color-bg);
}
::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* ---------- Search / Filter Row ---------- */
.search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.search-input {
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 13px;
  min-width: 200px;
}
.search-input::placeholder { color: var(--color-text-muted); }
.filter-select {
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 13px;
}
.inline-label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--color-text-muted);
  font-size: 13px;
  cursor: pointer;
}

/* ---------- Pagination ---------- */
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Badges ---------- */
.badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}
.badge-ok   { background: rgba(16,185,129,.15); color: #10b981; }
.badge-warn { background: rgba(245,158,11,.15); color: #f59e0b; }
.badge-err  { background: rgba(239,68,68,.15);  color: #ef4444; }
.badge-muted {
  background: transparent;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 400;
}
.badge-info    { background: rgba(59,130,246,.15);  color: #3b82f6; }
.badge-success { background: rgba(16,185,129,.15);  color: #10b981; }
.badge-warning { background: rgba(245,158,11,.15);  color: #f59e0b; }
.badge-error   { background: rgba(239,68,68,.15);   color: #ef4444; }
.badge-danger  { background: rgba(220,38,38,.15);   color: #dc2626; }

/* ---------- 5-column card row ---------- */
.card-row-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 768px) {
  .card-row-5 { grid-template-columns: 1fr 1fr; }
}

/* ---------- Truncated cell — see Clickable / Expandable Cells section ---------- */

/* ---------- Form elements for Messages panel ---------- */
.form-group {
  margin-bottom: 12px;
}
.form-group label {
  display: block;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}
.form-group input[type="text"],
.form-group select,
.form-textarea {
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 13px;
  font-family: inherit;
}
.form-textarea { resize: vertical; }

/* ---------- Auto-refresh label ---------- */
.auto-refresh-label {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* ---------- Responsive ---------- */

/* ---- Tablet (≤ 768px) ---- */
@media (max-width: 768px) {
  .dashboard-content { padding: 16px; }
  .card-row { grid-template-columns: 1fr 1fr; }

  /* Top bar */
  .topbar { padding: 0 14px; gap: 8px; }
  .topbar-brand { font-size: 16px; }
  .topbar-right { gap: 8px; }
  #logout-btn { display: none; }           /* use dropdown logout instead */

  /* Tab bar — horizontal scroll instead of overflow */
  .tab-bar {
    padding: 0 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;                  /* Firefox */
  }
  .tab-bar::-webkit-scrollbar { display: none; }
  .tab-btn {
    padding: 10px 14px;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Tables — ensure horizontal scroll */
  .table-container { overflow-x: auto; }
  .data-table { min-width: 500px; }

  /* Action cards */
  .actions-row { grid-template-columns: 1fr; }
  .form-inline { grid-template-columns: 1fr; }

  /* Panel header */
  .panel-header { flex-wrap: wrap; gap: 10px; }
  .panel-actions { width: 100%; display: flex; justify-content: flex-end; gap: 8px; }

  /* Search row */
  .search-row { flex-direction: column; align-items: stretch; }
  .search-input { min-width: 0; width: 100%; }

  /* Response viewer */
  .response-box { max-height: 250px; font-size: 12px; }

  /* KV grid */
  .kv-grid { grid-template-columns: 1fr 1fr; }

  /* Counter grid */
  .counter-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }

  /* Modal */
  .modal-card { margin: 16px; padding: 22px 20px; }
}

/* ---- Phone (≤ 480px) ---- */
@media (max-width: 480px) {
  .card-row { grid-template-columns: 1fr; }
  .card-row-5 { grid-template-columns: 1fr 1fr; }

  /* Top bar — tighter */
  .topbar {
    padding: 0 10px;
    height: 48px;
  }
  :root { --topbar-h: 48px; }
  .topbar-brand { font-size: 15px; }
  .topbar-user { font-size: 12px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-right { gap: 6px; }

  /* Tab bar */
  .tab-bar { padding: 0 6px; }
  .tab-btn { padding: 8px 10px; font-size: 12px; }

  /* Content */
  .dashboard-content { padding: 12px; }
  .panel-header h2 { font-size: 17px; }
  .table-container { padding: 14px; }
  .table-container h3 { font-size: 14px; }

  /* Data table cells */
  .data-table th, .data-table td { padding: 8px 8px; font-size: 12px; }
  .data-table { min-width: 420px; }

  /* Status cards */
  .status-card { padding: 14px 14px; }
  .status-value { font-size: 17px; }

  /* KV grid single column */
  .kv-grid { grid-template-columns: 1fr; }

  /* Action buttons */
  .action-btns { flex-direction: column; }
  .action-btns .btn { width: 100%; }

  /* Pagination */
  .pagination-controls { flex-wrap: wrap; justify-content: center; }

  /* Modal — full width */
  .modal-card { margin: 10px; padding: 20px 16px; max-width: none; }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; }

  /* Response viewer */
  .response-box { max-height: 200px; font-size: 11px; padding: 10px; }

  /* Counter grid */
  .counter-grid { grid-template-columns: 1fr 1fr; }
  .counter-val { font-size: 16px; }

  /* Badges & method badges */
  .method-badge { font-size: 10px; padding: 2px 6px; }

  /* Cell truncation tighter */
  .cell-truncate { max-width: 150px; }
}

/* ---------- Account Dropdown ---------- */
.account-menu {
  position: relative;
}
.account-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
}
.account-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 190px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  z-index: 200;
  overflow: hidden;
}
.account-dropdown.hidden { display: none; }
.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}
.dropdown-item:hover {
  background: var(--color-surface-alt);
}
.dropdown-item-danger { color: var(--color-danger); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}
.modal-overlay.hidden { display: none; }
.modal-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 28px 32px;
  width: 100%;
  max-width: 400px;
  animation: modalIn .18s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-12px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(100px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(100px); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h3 {
  font-size: 17px;
  font-weight: 600;
}
.modal-close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}
.modal-close:hover { color: var(--color-text); background: var(--color-surface-alt); }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
.success-text {
  color: var(--color-success);
  font-size: 13px;
  margin-bottom: 8px;
  text-align: center;
}

/* ---------- Clickable / Expandable Cells ---------- */
.cell-truncate {
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  position: relative;
}
.cell-truncate:hover {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-style: dotted;
}
.cell-truncate::after {
  content: ' ↗';
  font-size: 10px;
  color: var(--color-text-muted);
  opacity: 0;
  transition: opacity 0.12s;
}
.cell-truncate:hover::after {
  opacity: 1;
}

/* ---------- Conversation Patterns ---------- */
.cp-pattern-cell {
  font-family: var(--font-mono);
  font-size: 12px;
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.cp-pattern-cell:hover {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-style: dotted;
}
.cp-enabled-yes { color: var(--color-success); font-weight: 600; }
.cp-enabled-no  { color: var(--color-text-muted); }
.cp-category-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(99,102,241,.15);
  color: var(--color-primary);
}
.cp-test-match   { background: rgba(16,185,129,.15); color: #10b981; }
.cp-test-nomatch { background: rgba(239,68,68,.15);  color: #ef4444; }

/* ---------- SMTP Services Panel ---------- */
.smtp-active-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 24px;
  font-size: 14px;
}
.smtp-active-icon {
  font-size: 20px;
}
.smtp-active-banner .badge {
  margin-left: auto;
}

.smtp-provider-card {
  position: relative;
}
.smtp-provider-card.smtp-active {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary), 0 0 12px rgba(99,102,241,.15);
}
.smtp-provider-card.smtp-standby {
  opacity: 0.7;
}
.smtp-provider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.smtp-provider-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}
.smtp-provider-badge.active   { background: rgba(16,185,129,.15); color: #10b981; }
.smtp-provider-badge.standby  { background: rgba(139,143,163,.15); color: var(--color-text-muted); }
.smtp-provider-badge.degraded { background: rgba(245,158,11,.15); color: #f59e0b; }
.smtp-provider-badge.error    { background: rgba(239,68,68,.15);  color: #ef4444; }

.smtp-quota-text {
  font-size: 12px;
  color: var(--color-text-muted);
}

.smtp-test-result {
  font-size: 13px;
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 6px;
}
.smtp-test-result.smtp-test-ok {
  background: rgba(16,185,129,.1);
  color: var(--color-success);
}
.smtp-test-result.smtp-test-err {
  background: rgba(239,68,68,.1);
  color: var(--color-danger);
}

/* ---- Inbox Panel ---- */
.smtp-inbox-container {
  margin-top: 6px;
}
.smtp-inbox-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.smtp-inbox-header h3 {
  margin: 0;
}
.smtp-inbox-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}
.smtp-inbox-select {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 12px;
}
.smtp-inbox-select option {
  background: #1a1d27;
  color: #e2e4eb;
}
.smtp-inbox-row {
  cursor: pointer;
  transition: background .15s;
}
.smtp-inbox-row:hover {
  background: rgba(99,102,241,.08);
}
.smtp-inbox-row.smtp-unread td {
  font-weight: 600;
}
.smtp-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.smtp-unread-dot.unread {
  background: var(--color-primary);
}
.smtp-inbox-snippet {
  color: var(--text-muted);
  font-size: 12px;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Email Viewer Modal ---- */
.smtp-email-viewer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.smtp-email-viewer[hidden] {
  display: none;
}
.smtp-email-viewer-content {
  background: #1a1a2e;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  width: 100%;
  max-width: 720px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
}
.smtp-email-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 12px;
}
.smtp-email-viewer-header h3 {
  margin: 0;
  font-size: 16px;
  word-break: break-word;
}
.smtp-email-viewer-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.7;
}
.smtp-email-viewer-meta strong {
  color: var(--text-primary);
}
.smtp-email-viewer-body {
  background: #0f0f1a;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
  color: #e0e0e0;
  min-height: 120px;
  max-height: 400px;
  overflow-y: auto;
  word-break: break-word;
}
.smtp-email-viewer-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
}

/* ============================================================
   GUIDE / DOCUMENTATION STYLES
   ============================================================ */

.guide-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.guide-section h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 12px;
}

.guide-section h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin-top: 20px;
  margin-bottom: 10px;
}

.guide-section p {
  line-height: 1.6;
  margin-bottom: 16px;
}

.guide-steps {
  list-style: none;
  counter-reset: step-counter;
  padding-left: 0;
}

.guide-steps li {
  counter-increment: step-counter;
  position: relative;
  padding-left: 40px;
  margin-bottom: 20px;
  line-height: 1.6;
}

.guide-steps li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  background: var(--color-primary);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.guide-steps ul {
  margin-top: 8px;
  margin-bottom: 8px;
  padding-left: 20px;
}

.guide-steps li {
  margin-bottom: 16px;
}

.guide-steps ul li {
  margin-bottom: 6px;
  line-height: 1.5;
}

.guide-link {
  color: var(--color-primary);
  text-decoration: none;
  word-break: break-all;
}

.guide-link:hover {
  text-decoration: underline;
}

.guide-code {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-primary);
  word-break: break-all;
}

.guide-email {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-success);
}

.guide-code-block {
  margin: 16px 0;
}

.guide-code-block h4 {
  font-size: 14px;
  margin-bottom: 8px;
}

.guide-code-block pre {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  margin: 0;
}

.guide-code-block code {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text);
}

.guide-note {
  background: rgba(99, 102, 241, 0.1);
  border-left: 3px solid var(--color-primary);
  padding: 12px 16px;
  margin-top: 16px;
  border-radius: 4px;
  font-size: 14px;
}

.guide-subsection {
  margin-bottom: 20px;
}

.guide-list {
  padding-left: 20px;
  line-height: 1.8;
}

.guide-list li {
  margin-bottom: 6px;
}

.guide-list code {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-primary);
}

/* Responsive guide */
@media (max-width: 768px) {
  .guide-section {
    padding: 16px;
  }
  
  .guide-steps li {
    padding-left: 32px;
  }
  
  .guide-steps li::before {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
}
