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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2a2f45;
  --accent: #25d366;
  --accent-dark: #1aad52;
  --danger: #e05c5c;
  --text: #e8eaf0;
  --text-muted: #6b7290;
  --text-dim: #9098b8;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,.4);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* HEADER */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

/* TABS */
.tabs {
  display: flex;
  gap: 2px;
}
.tab {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
}
.tab:hover { background: var(--surface2); color: var(--text-dim); }
.tab.active { background: var(--surface2); color: var(--accent); }

/* MAIN */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* TWO COLUMN */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 768px) {
  .two-col { grid-template-columns: 1fr; }
}

/* PANEL */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel-narrow { max-width: 480px; }
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.panel-header h2 {
  font-size: 15px;
  font-weight: 600;
}
.panel-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }

/* MESSAGE TEXTAREA */
.message-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 14px;
  font-size: 14px;
  resize: vertical;
  min-height: 140px;
  outline: none;
  font-family: inherit;
  transition: border-color .15s;
}
.message-input:focus { border-color: var(--accent); }
.message-input::placeholder { color: var(--text-muted); }

/* MENTION TOGGLE */
.mention-toggle {
  display: flex;
  cursor: pointer;
  user-select: none;
}
.mention-toggle input[type="checkbox"] { display: none; }
.mention-toggle-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-dim);
  width: 100%;
  transition: all .15s;
}
.mention-toggle-box svg { flex-shrink: 0; }
.mention-toggle:hover .mention-toggle-box { border-color: var(--accent); color: var(--text); }
.mention-toggle input:checked + .mention-toggle-box {
  border-color: var(--accent);
  background: rgba(37,211,102,.08);
  color: var(--accent);
}

/* IMAGE ZONE */
.image-zone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  min-height: 90px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
  overflow: hidden;
}
.image-zone:hover { border-color: var(--accent); background: rgba(37,211,102,.04); }
.image-zone.dragover { border-color: var(--accent); background: rgba(37,211,102,.08); }
.image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 90px;
  color: var(--text-muted);
  font-size: 13px;
}
.image-placeholder svg { color: var(--text-muted); }
.image-placeholder em { font-style: normal; color: var(--text-muted); opacity: .7; }
.image-preview {
  position: relative;
  width: 100%;
  max-height: 200px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
}
.image-preview img {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
  display: block;
}
.btn-remove-img {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: rgba(0,0,0,.6);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.btn-remove-img:hover { background: var(--danger); }

/* DELAY ROW */
.delay-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.delay-row label { font-size: 13px; color: var(--text-dim); white-space: nowrap; }
.delay-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.delay-inputs input {
  width: 64px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
  text-align: center;
  transition: border-color .15s;
}
.delay-inputs input:focus { border-color: var(--accent); }

/* GROUPS */
.groups-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.select-all-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.select-all-label input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

.search-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }

.groups-list {
  max-height: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.groups-list::-webkit-scrollbar { width: 4px; }
.groups-list::-webkit-scrollbar-track { background: transparent; }
.groups-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.group-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .1s;
  user-select: none;
}
.group-item:hover { background: var(--surface2); }
.group-item input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; }
.group-item-info { flex: 1; min-width: 0; }
.group-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.group-meta { font-size: 11px; color: var(--text-muted); }

.groups-counter {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}
.error-state {
  color: var(--danger);
  font-size: 13px;
  padding: 12px;
  background: rgba(224,92,92,.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(224,92,92,.2);
}

/* BUTTONS */
.btn-primary {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s, transform .1s;
  width: 100%;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-ghost.danger { color: var(--danger); border-color: rgba(224,92,92,.3); }
.btn-ghost.danger:hover { background: rgba(224,92,92,.1); }

.btn-send { font-size: 15px; padding: 13px; }

/* FORM */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; color: var(--text-dim); font-weight: 500; }
.form-group input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.form-group input:focus { border-color: var(--accent); }
.form-group input::placeholder { color: var(--text-muted); }

.config-status {
  font-size: 13px;
  min-height: 20px;
  text-align: center;
}
.config-status.ok { color: var(--accent); }
.config-status.err { color: var(--danger); }

/* PROGRESS MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  margin: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal-header {
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.progress-counter { font-size: 13px; color: var(--text-muted); }

.progress-bar-wrap {
  height: 4px;
  background: var(--border);
  margin: 0 24px;
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width .3s ease;
}

.progress-log {
  max-height: 260px;
  overflow-y: auto;
  padding: 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.progress-log::-webkit-scrollbar { width: 4px; }
.progress-log::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.log-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
}
.log-item.success .log-icon { color: var(--accent); }
.log-item.error .log-icon { color: var(--danger); }
.log-item.pending .log-icon { color: var(--text-muted); }
.log-icon { font-size: 14px; flex-shrink: 0; }
.log-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-status { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }

.modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.progress-summary { font-size: 13px; color: var(--text-dim); }
.progress-summary strong { color: var(--accent); }
.progress-summary .fail-count { color: var(--danger); }
.modal-footer .btn-primary { width: auto; padding: 9px 24px; }

/* REPORTS */
.report-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 12px;
}
.report-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  transition: background .1s;
  gap: 12px;
}
.report-card-header:hover { background: rgba(255,255,255,.03); }
.report-meta { flex: 1; min-width: 0; }
.report-date { font-size: 12px; color: var(--text-muted); }
.report-msg {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  margin-top: 2px;
}
.report-badge {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
}
.badge.ok { background: rgba(37,211,102,.15); color: var(--accent); }
.badge.fail { background: rgba(224,92,92,.15); color: var(--danger); }

.report-detail {
  display: none;
  padding: 0 16px 14px;
  border-top: 1px solid var(--border);
}
.report-detail.open { display: block; }
.report-full-msg {
  font-size: 13px;
  color: var(--text-dim);
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}
.detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 4px 0;
}
.detail-row .icon-ok { color: var(--accent); }
.detail-row .icon-fail { color: var(--danger); }
.detail-group-name { flex: 1; color: var(--text-dim); }

/* LOADING SPINNER */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  color: var(--text-muted);
  font-size: 13px;
  justify-content: center;
}

/* LOGOUT BUTTON */
.btn-logout {
  font-size: 12px;
  padding: 5px 12px;
}

/* CONFIG STACK */
.config-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 480px;
}
.config-info {
  font-size: 13px;
  color: var(--text-muted);
}
.btn-sync {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* SYNC MODAL */
.modal-lg {
  max-width: 600px;
}
.modal-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.btn-icon {
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sync-search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px 12px;
}
.sync-search-row .search-input { flex: 1; }
.sync-groups-list {
  max-height: 360px;
  margin: 0 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-y: auto;
  padding: 4px;
}
.footer-actions {
  display: flex;
  gap: 8px;
}
.btn-save-sync {
  width: auto;
  padding: 9px 20px;
}

/* LOGIN PAGE */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 32px;
  justify-content: center;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-error {
  font-size: 13px;
  color: var(--danger);
  min-height: 18px;
  text-align: center;
}
.login-hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 20px;
}
.login-hint code {
  background: var(--surface2);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: monospace;
  color: var(--text-dim);
}

/* ── log lines (progress) ───────────────────────────────────── */
.log-line { font-size: 13px; padding: 4px 0; }
.log-line.success { color: var(--accent); }
.log-line.error   { color: var(--danger); }
.log-line.pending { color: var(--text-muted); }

/* ── reports (new flat style) ───────────────────────────────── */
.report-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.report-header { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.report-time { font-size: 12px; color: var(--text-muted); }
.report-stats { font-size: 12px; color: var(--text-dim); margin-left: auto; }
.report-img-tag { font-size: 12px; }
.report-msg { font-size: 13px; color: var(--text-dim); margin-bottom: 10px; white-space: pre-wrap; word-break: break-word; }
.report-results { display: flex; flex-wrap: wrap; gap: 4px; }
.report-result {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-result.success { background: rgba(37,211,102,.12); color: var(--accent); }
.report-result.error   { background: rgba(224,92,92,.12);  color: var(--danger); }

/* ── account selector ───────────────────────────────────────── */
.acct-wrap { position: relative; }
.acct-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 200px;
  transition: border-color .15s;
}
.acct-btn:hover { border-color: var(--accent); }
.acct-btn #acctName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.acct-drop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 300;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 220px;
  display: none;
  overflow: hidden;
}
.acct-drop.open { display: block; }
.acct-list { max-height: 240px; overflow-y: auto; padding: 4px; }
.acct-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: background .1s;
}
.acct-item:hover { background: var(--surface2); }
.acct-item.active { color: var(--accent); }
.acct-item.disabled { color: var(--text-muted); cursor: default; }
.acct-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-drop-footer { border-top: 1px solid var(--border); padding: 6px; }
.acct-new-btn {
  width: 100%;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background .1s, color .1s;
}
.acct-new-btn:hover { background: var(--surface2); color: var(--text); }
.acct-active-tag {
  font-size: 10px;
  background: rgba(37,211,102,.15);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 20px;
  font-weight: 600;
}

/* ── scheduled cards ────────────────────────────────────────── */
.sched-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
}
.sched-card.status-cancelled,
.sched-card.status-done { opacity: .6; }
.sched-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.sched-card-info { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.sched-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-actions { display: flex; gap: 6px; flex-shrink: 0; }
.sched-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.badge-active    { background: rgba(37,211,102,.15); color: var(--accent); }
.badge-paused    { background: rgba(255,193,7,.15);  color: #ffc107; }
.badge-running   { background: rgba(33,150,243,.15); color: #2196f3; }
.badge-done      { background: rgba(107,114,144,.15);color: var(--text-muted); }
.badge-error     { background: rgba(224,92,92,.15);  color: var(--danger); }
.badge-cancelled { background: rgba(107,114,144,.15);color: var(--text-muted); }
.sched-card-body { padding: 12px 16px; }
.sched-msg-preview { font-size: 13px; color: var(--text-dim); margin-bottom: 8px; white-space: pre-wrap; word-break: break-word; }
.sched-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-muted); }

/* ── tab badge ──────────────────────────────────────────────── */
.tab-badge {
  display: none;
  background: var(--accent);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
  border-radius: 20px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
}

/* ── saved messages list ────────────────────────────────────── */
.saved-msg-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.saved-msg-item:last-child { border-bottom: none; }
.saved-msg-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.saved-msg-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-msg-preview { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-msg-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── schedule modal scroll body ─────────────────────────────── */
.modal-scroll-body {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sched-groups-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ── remove group button ────────────────────────────────────── */
.btn-remove-group {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
}
.group-item:hover .btn-remove-group { opacity: 1; }
.btn-remove-group:hover { background: rgba(224,92,92,.15); color: var(--danger); }

/* ── sync: already-saved group row ─────────────────────────── */
.group-already-saved { opacity: .65; cursor: default; }
.group-already-saved:hover { background: transparent; }
.sync-saved-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(37,211,102,.12);
  color: var(--accent);
  flex-shrink: 0;
  letter-spacing: .3px;
}

/* ── connection status dot ──────────────────────────────────── */
.conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
  transition: background .3s;
}
.conn-dot.connected    { background: var(--accent); box-shadow: 0 0 6px rgba(37,211,102,.6); }
.conn-dot.disconnected { background: var(--danger); }
.conn-dot.connecting   { background: #ffc107; animation: pulse-dot 1s ease-in-out infinite; }
.conn-dot.unknown      { background: var(--text-muted); }

.conn-dot-lg {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
  transition: background .3s;
}
.conn-dot-lg.connected    { background: var(--accent); box-shadow: 0 0 8px rgba(37,211,102,.6); }
.conn-dot-lg.disconnected { background: var(--danger); }
.conn-dot-lg.connecting   { background: #ffc107; animation: pulse-dot 1s ease-in-out infinite; }
.conn-dot-lg.unknown      { background: var(--text-muted); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

.conn-status-block { display: flex; flex-direction: column; gap: 12px; }
.conn-status-row   { display: flex; align-items: center; gap: 10px; }
.conn-label        { font-size: 14px; font-weight: 600; }
.conn-instance     { font-size: 12px; color: var(--text-muted); font-family: monospace; }
.conn-actions      { display: flex; gap: 8px; align-items: center; }

/* ── QR code modal ──────────────────────────────────────────── */
.qr-body { padding: 16px 24px; }
.qr-img-wrap {
  display: flex;
  justify-content: center;
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
}
.qr-img { width: 220px; height: 220px; object-fit: contain; display: block; }
.qr-hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

/* ── form helpers ───────────────────────────────────────────── */
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.flex-1 { flex: 1; }
.label-optional { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.form-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  width: 100%;
  transition: border-color .15s;
  cursor: pointer;
}
.form-select:focus { border-color: var(--accent); }
.form-group input[type="datetime-local"] { color-scheme: dark; }

/* ── btn-sm variants ────────────────────────────────────────── */
.btn-sm { font-size: 11px; padding: 4px 9px; }
.btn-sm-primary {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s;
}
.btn-sm-primary:hover { background: var(--accent-dark); }

/* ── group-size badge ───────────────────────────────────────── */
.group-size {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface2);
  padding: 1px 6px;
  border-radius: 20px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
