@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Space+Grotesk:wght@700;800&family=Syne:wght@400;500;600&display=swap');

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

:root {
  --bg:         #05080e;
  --bg2:        #0a0e17;
  --bg3:        #0f1520;
  --bg4:        #161d2b;
  --bg5:        #1c2535;
  --accent:     #00e5ff;
  --accent2:    #00b8d4;
  --accent-dim: rgba(0,229,255,0.06);
  --accent-mid: rgba(0,229,255,0.12);
  --accent-hi:  rgba(0,229,255,0.22);
  --success:    #00e676;
  --success-bg: rgba(0,230,118,0.1);
  --warning:    #ffb300;
  --warning-bg: rgba(255,179,0,0.12);
  --danger:     #ff5252;
  --danger-bg:  rgba(255,82,82,0.1);
  --info:       #00e5ff;
  --info-bg:    rgba(0,229,255,0.08);
  --text:       #e8edf5;
  --text-muted: #9aacbe;
  --text3:      #5a6b80;
  --border:     rgba(0,229,255,0.07);
  --border2:    rgba(0,229,255,0.14);
  --border3:    rgba(0,229,255,0.28);
  --surface:    #0f1520;
  --font:       'Syne', sans-serif;
  --font-title: 'Space Grotesk', sans-serif;
  --mono:       'IBM Plex Mono', monospace;
  --radius:     12px;
  --radius-sm:  8px;
  --shadow:     0 4px 16px rgba(0,0,0,.4);
  --sidebar-w:  240px;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

/* ── Layout ──────────────────────────────────────────────────────────────────── */
#app { display: flex; min-height: 100vh; }
#app.hidden { display: none; }

#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
#sidebar::before {
  content: '';
  position: absolute;
  top: -80px; left: -80px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(0,229,255,0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

#content {
  flex: 1;
  overflow-y: visible;
  padding: 24px 28px;
  background: var(--bg);
}

/* ── Sidebar ─────────────────────────────────────────────────────────────────── */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 1;
}
.sidebar-logo {
  font-size: 18px;
  width: 26px;
  text-align: center;
  filter: drop-shadow(0 0 6px rgba(0,229,255,0.4));
}
.sidebar-title {
  color: var(--text);
  font-weight: 800;
  font-size: 17px;
  font-family: var(--font-title);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.sidebar-nav { padding: 12px 0; flex: 1; position: relative; z-index: 1; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  position: relative;
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: var(--text); background: var(--accent-dim); }
.nav-link.active {
  color: var(--accent);
  background: linear-gradient(90deg, var(--accent-mid), transparent);
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  box-shadow: 0 0 8px rgba(0,229,255,0.6);
}
.nav-icon { font-size: 17px; flex-shrink: 0; opacity: 0.8; line-height: 1; }
.nav-link.active .nav-icon { opacity: 1; }
.ti { vertical-align: -0.125em; line-height: 1; }
.ti-icon-ok { color: var(--success); }
.ti-icon-err { color: var(--danger); }

.sidebar-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 1;
}
.user-name {
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Page header ─────────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-title { font-size: 28px; font-weight: 800; font-family: var(--font-title); color: var(--text); letter-spacing: -0.02em; }
.page-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; font-family: var(--mono); }

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  transition: border-color 0.2s;
}
.card:hover { border-color: var(--border2); }
.card-body { padding: 20px; }
.card-title {
  font-size: 12px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, rgba(0,229,255,0.15), rgba(0,229,255,0.05));
  border-color: var(--border3);
  color: var(--accent);
  box-shadow: inset 0 1px 0 rgba(0,229,255,0.08);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(0,229,255,0.22), rgba(0,229,255,0.1));
  box-shadow: 0 0 16px rgba(0,229,255,0.1), inset 0 1px 0 rgba(0,229,255,0.12);
}

.btn-danger {
  background: var(--danger-bg);
  border-color: rgba(255,82,82,0.3);
  color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(255,82,82,0.18);
  border-color: rgba(255,82,82,0.5);
}

.btn-success {
  background: var(--success-bg);
  border-color: rgba(0,230,118,0.3);
  color: var(--success);
}
.btn-success:hover:not(:disabled) { background: rgba(0,230,118,0.18); }

.btn-warning {
  background: var(--warning-bg);
  border-color: rgba(255,179,0,0.3);
  color: var(--warning);
}
.btn-warning:hover:not(:disabled) { background: rgba(255,179,0,0.2); }

.btn-ghost {
  background: var(--bg3);
  border-color: var(--border2);
  color: var(--text-muted);
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border3); background: var(--bg4); }

.btn-sm { padding: 4px 10px; font-size: 11px; }

/* ── Forms ───────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-hint { font-size: 11px; color: var(--text3); margin-top: 4px; font-family: var(--mono); }

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg4);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input::placeholder, .form-select::placeholder, .form-textarea::placeholder {
  color: var(--text3);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,229,255,0.08);
}
.form-select option { background: var(--bg4); color: var(--text); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.radio-group { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.radio-label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; color: var(--text-muted); }
.radio-label input[type="radio"] { accent-color: var(--accent); }

/* ── Tables ──────────────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 700px; }

th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--bg4);
  border-bottom: 1px solid var(--border);
}
td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text); font-size: 14px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg4); }
.actions { white-space: nowrap; width: 1%; vertical-align: middle; }
.actions .btn + .btn { margin-left: 4px; }
.td-toggle { width: 32px; padding: 0 4px !important; }
.btn-row-toggle { background: none; border: none; cursor: pointer; padding: 4px; color: var(--text3); border-radius: 4px; line-height: 1; transition: color .15s; }
.btn-row-toggle:hover { color: var(--text1); }
.btn-row-toggle i { display: block; transition: transform .2s; }
.btn-row-toggle--open i { transform: rotate(90deg); }
.group-detail-row td { background: var(--bg3); padding: 12px 16px !important; border-top: none !important; }
tr:hover .group-detail-row td { background: var(--bg3); }
.group-detail-grid { display: flex; gap: 40px; flex-wrap: wrap; }
.group-detail-item { display: flex; flex-direction: column; gap: 4px; }
.group-detail-label { font-size: .72rem; color: var(--text3); text-transform: uppercase; letter-spacing: .05em; }
.group-detail-value { font-size: .85rem; font-family: monospace; color: var(--text1); }

/* ── Status badges ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}
.badge-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(0,230,118,0.2); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(255,82,82,0.2); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(255,179,0,0.2); }
.badge-info    { background: var(--info-bg);    color: var(--accent);  border: 1px solid var(--border2); }
.badge-gray    { background: var(--bg4); color: var(--text-muted); border: 1px solid var(--border2); }
.badge-purple  { background: rgba(139,92,246,0.1); color: #a78bfa; border: 1px solid rgba(139,92,246,0.2); }
.badge-count {
  background: var(--danger);
  color: white;
  font-size: 10px;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 99px;
  padding: 0 5px;
  margin-left: auto;
}

/* ── Toasts ──────────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg3);
  border: 1px solid var(--border2);
  box-shadow: 0 4px 24px rgba(0,0,0,.6);
  font-size: 13px;
  min-width: 250px;
  max-width: 400px;
  animation: slideIn 0.2s ease;
  pointer-events: all;
  color: var(--text);
}
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--accent); }
@keyframes slideIn {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Loading ─────────────────────────────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--text-muted);
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Alerts ──────────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(255,82,82,0.2); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(255,179,0,0.2); }
.alert-info    { background: var(--info-bg);    color: var(--accent);  border: 1px solid var(--border2); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(0,230,118,0.2); }
.alert-body { flex: 1; }
.alert-title { font-weight: 600; margin-bottom: 4px; }

/* ── Stats grid ──────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}
.stat-card:hover { border-color: var(--border2); }
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 50px; height: 50px;
  border-radius: 0 var(--radius) 0 50px;
  background: var(--accent-dim);
  pointer-events: none;
}
.stat-value { font-size: 28px; font-weight: 800; font-family: var(--font-title); color: var(--text); letter-spacing: -0.03em; line-height: 1; }
.stat-label {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-muted);
  margin-top: 5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── File picker ─────────────────────────────────────────────────────────────── */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding: 2px;
}
.file-item {
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 8px;
  cursor: pointer;
  background: var(--bg4);
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.file-item:hover { border-color: var(--border3); background: var(--bg5); }
.file-item.selected { border-color: var(--accent); background: var(--accent-dim); }
.file-item-icon { font-size: 24px; text-align: center; margin-bottom: 6px; }
.file-item-name { font-size: 11px; word-break: break-all; line-height: 1.3; color: var(--text); margin-top: 6px; }
.file-item-size { font-size: 10px; color: var(--text-muted); margin-top: 3px; font-family: var(--mono); }
.selected-count { font-size: 12px; color: var(--text-muted); margin-top: 8px; font-family: var(--mono); }

/* ── Thumbnail ───────────────────────────────────────────────────────────────── */
.file-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg3);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
}
.file-thumb video,
.file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.file-thumb-icon { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 28px; }
.file-thumb-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: rgba(0,0,0,0.35);
  opacity: 0;
  transition: opacity 0.15s;
}
.file-thumb:hover .file-thumb-play { opacity: 1; }

/* ── Lightbox ────────────────────────────────────────────────────────────────── */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 92vw;
  max-height: 92vh;
}
.lightbox-header {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  justify-content: space-between;
}
.lightbox-name {
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70vw;
}
.lightbox-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); }
.lightbox-media { max-width: 90vw; max-height: 82vh; border-radius: var(--radius); }
.lightbox-unsupported { color: rgba(255,255,255,0.7); text-align: center; padding: 40px; }

/* ── Media browser ───────────────────────────────────────────────────────────── */
.media-niche-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.media-niche-card {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.media-niche-card:hover { border-color: var(--accent); background: var(--bg4); }
.media-niche-emoji { font-size: 36px; margin-bottom: 8px; }
.media-niche-name { font-weight: 600; color: var(--text); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-niche-path { font-size: 11px; color: var(--text-muted); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-niche-count { margin-top: 8px; }
.count-loading { font-size: 11px; color: var(--text3); font-family: var(--mono); }
.count-value   { font-size: 12px; color: var(--accent); font-family: var(--mono); font-weight: 500; }
.count-error   { font-size: 11px; color: var(--text3); font-family: var(--mono); }

.media-unmapped-card { border-color: rgba(255,179,0,0.25); margin-top: 20px; }
.media-unmapped-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; line-height: 1.6; }
.media-unmapped-desc .link { color: var(--accent); text-decoration: none; }
.media-unmapped-desc .link:hover { text-decoration: underline; }
.media-unmapped-list { display: flex; flex-direction: column; gap: 8px; }
.media-unmapped-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg4);
  border-radius: var(--radius-sm);
  gap: 12px;
}
.media-unmapped-folder { font-size: 13px; color: var(--text); }
.media-unmapped-path { font-size: 11px; font-family: var(--mono); color: var(--warning); background: rgba(255,179,0,0.08); padding: 2px 7px; border-radius: 4px; }
.media-folder {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  margin-bottom: 12px;
  margin-right: 8px;
}
.media-folder:hover { border-color: var(--accent); }
.media-file-item { cursor: default; }
.media-info-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255,152,0,0.08);
  border: 1px solid rgba(255,152,0,0.3);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}
.media-info-banner i { color: #ff9800; margin-top: 1px; flex-shrink: 0; }

/* ── Histórico de postagens ───────────────────────────────────────────────────── */
.history-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255,179,0,0.07);
  border: 1px solid rgba(255,179,0,0.2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}
.history-warning i { color: var(--warning); margin-top: 1px; flex-shrink: 0; }
.history-file-item { cursor: pointer; position: relative; }
.history-file-item:hover .file-thumb { outline: 2px solid var(--accent); border-radius: 6px; }
.history-file-item.history-selected .file-thumb { outline: 2px solid var(--success); border-radius: 6px; }
.history-check-overlay {
  display: none;
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  background: var(--success);
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
}
.history-selected .history-check-overlay { display: flex; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { opacity: 0.85; }

/* ── Tabs ────────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border2);
  margin-bottom: 20px;
  overflow: hidden;
}
.tab {
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  user-select: none;
  text-transform: uppercase;
  transition: color 0.15s;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab:hover:not(.active) { color: var(--text); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Publisher wizard steps ──────────────────────────────────────────────────── */
.wizard-steps {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
  align-items: stretch;
}
.wizard-step {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.wizard-step.active { color: var(--accent); border-bottom-color: var(--accent); }
.wizard-step.done   { color: var(--success); border-bottom-color: var(--success); }
.wizard-steps-actions { margin-left: auto; padding: 10px 0; }

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state-desc { font-size: 13px; max-width: 300px; margin: 0 auto 16px; font-family: var(--mono); }

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.7);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 22px; font-weight: 800; font-family: var(--font-title); color: var(--text); letter-spacing: -0.02em; }
.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  padding: 2px;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.modal--wide { max-width: 680px; }

/* ── How-it-works steps ──────────────────────────────────────────────────────── */
.hiw-steps { display: flex; flex-direction: column; gap: 0; }
.hiw-step {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.hiw-step:last-child { border-bottom: none; }
.hiw-step__num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-mid);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--mono);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hiw-step__icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-mid);
  border: 1px solid var(--border2);
  color: var(--accent);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hiw-step__body { flex: 1; }
.hiw-step__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.hiw-step__desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}
.hiw-step__desc strong { color: var(--text); }
.hiw-step__nav {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: 4px;
}

/* ── Pre / code ──────────────────────────────────────────────────────────────── */
pre {
  background: var(--bg4);
  color: var(--accent);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  overflow: auto;
  max-height: 200px;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: var(--mono);
  border: 1px solid var(--border2);
}

/* ── Dashboard layout ────────────────────────────────────────────────────────── */
.dash-layout {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 16px;
  align-items: start;
}
.dash-main { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.dash-side  { display: flex; flex-direction: column; gap: 0; position: sticky; top: 24px; }

/* ── Service cards ───────────────────────────────────────────────────────────── */
.svc-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.svc-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: border-color 0.2s;
}
.svc-card:hover { border-color: var(--border2); }
.svc-card__icon { font-size: 18px; line-height: 1; margin-top: 1px; flex-shrink: 0; }
.svc-card__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.svc-card__name  { font-size: 11px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.svc-card__state { display: flex; align-items: center; gap: 5px; }
.svc-card__detail { font-size: 10px; color: var(--text3); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Status dot + label ──────────────────────────────────────────────────────── */
.sdot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sdot--ok      { background: var(--success); box-shadow: 0 0 5px rgba(0,230,118,0.7); }
.sdot--err     { background: var(--danger);  box-shadow: 0 0 5px rgba(255,82,82,0.7); }
.sdot--off     { background: var(--text3); }
.sdot--unknown { background: var(--warning); }

.slabel { font-size: 12px; font-weight: 500; }
.slabel--ok      { color: var(--success); }
.slabel--err     { color: var(--danger); }
.slabel--off     { color: var(--text3); }
.slabel--unknown { color: var(--warning); }

/* ── Groups grid ─────────────────────────────────────────────────────────────── */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}
.group-tile {
  background: var(--bg4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.2s;
}
.group-tile:hover { border-color: var(--border2); }
.group-tile--inactive { opacity: 0.4; }
.group-tile__top   { display: flex; align-items: center; justify-content: space-between; }
.group-tile__emoji { font-size: 18px; line-height: 1; }
.group-tile__name  { font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.3; }
.group-tile__state { display: flex; align-items: center; gap: 4px; }

/* ── Sidebar: quick actions + metrics ────────────────────────────────────────── */
.quick-actions { display: flex; flex-direction: column; gap: 8px; }
.quick-action-btn { width: 100%; justify-content: flex-start; }

.metric-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.metric-row:last-child { border-bottom: none; padding-bottom: 0; }
.metric-label { font-size: 11px; color: var(--text-muted); }
.metric-value { font-size: 13px; font-weight: 600; color: var(--text); text-align: right; }
.metric-value--danger { color: var(--danger); }
.metric-value--mono   { font-family: var(--mono); font-size: 10px; font-weight: 400; }

/* ── Empty hint ──────────────────────────────────────────────────────────────── */
.empty-hint { padding: 4px 0; color: var(--text-muted); font-size: 13px; }

/* ── Emoji picker ────────────────────────────────────────────────────────────── */
.emoji-picker-wrap {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}
emoji-picker {
  --background: #1d2029;
  --border-color: #252830;
  --border-radius: 12px;
  --outline-color: var(--accent);
  --indicator-color: var(--accent);
  --input-border-color: #252830;
  --input-font-color: #e8eaf0;
  --input-placeholder-color: #8892a4;
  --input-background: #16181d;
  --button-hover-background: rgba(255,255,255,0.07);
  --button-active-background: rgba(255,255,255,0.12);
  --category-font-color: #8892a4;
  --emoji-size: 1.35rem;
  --emoji-padding: 0.3rem;
  --num-columns: 8;
  width: 340px;
  height: 400px;
}
.emoji-open-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  padding: 0 8px;
  height: 36px;
  margin-left: 6px;
  vertical-align: middle;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.emoji-open-btn:hover { color: var(--text); border-color: var(--accent); }

/* ── Supergroup hint ─────────────────────────────────────────────────────────── */
.supergroup-hint {
  background: var(--warning-bg);
  border: 1px solid rgba(255,179,0,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}
.supergroup-hint strong { color: var(--warning); }
.supergroup-hint code { font-family: var(--mono); color: var(--text); background: var(--bg4); padding: 1px 5px; border-radius: 3px; }
.supergroup-hint em { color: var(--text); font-style: normal; font-weight: 500; }

/* ── Niches table ────────────────────────────────────────────────────────────── */
.niche-row--inactive td { opacity: 0.5; }
.niche-row--inactive td:last-child { opacity: 1; }
.niche-emoji-display { font-size: 18px; }
.niche-emoji-input   { width: 52px; font-size: 18px; padding: 2px 6px; text-align: center; }
.niche-folder-input  { width: 200px; font-size: 12px; padding: 4px 8px; }
.niche-slug          { font-size: 11px; }
.niche-verifying     { font-size: 11px; color: var(--text-muted); font-family: var(--mono); }
.niche-verify-ok     { font-size: 11px; color: var(--success); font-family: var(--mono); }
.niche-verify-warn   { font-size: 11px; color: var(--warning); font-family: var(--mono); }
.niche-verify-err    { font-size: 11px; color: var(--danger);  font-family: var(--mono); }

/* ── Utilities ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-muted   { color: var(--text-muted); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-sm  { font-size: 12px; }
.text-xs  { font-size: 11px; }
.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-3 { margin-top: 12px; }
.mb-0 { margin-bottom: 0; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.section { margin-bottom: 28px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Form variants ───────────────────────────────────────────────────────────── */
.form-group--narrow { max-width: 400px; }
.form-input--emoji  { max-width: 80px; }
.form-input--date   { max-width: 280px; }

/* ── Section / pagination helpers ────────────────────────────────────────────── */
.section-actions {
  display: flex;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 0;
}
.pagination-info { font-size: 13px; }
