/* ================================================================
   style.css — MailSend v4  (black/white edition)
   ================================================================ */

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

:root {
  --bg-deep:    #000000;
  --bg:         #050505;
  --surface:    #0c0c0c;
  --surface-2:  #141414;
  --surface-3:  #1c1c1c;
  --border:     #1e1e1e;
  --border-2:   #2e2e2e;
  --text:       #f0f0f0;
  --text-2:     #666;
  --text-3:     #363636;
  --accent:     #ffffff;
  --accent-lo:  rgba(255,255,255,.06);
  --accent-med: rgba(255,255,255,.12);
  --green:      #2dd496;
  --green-lo:   rgba(45,212,150,.1);
  --red:        #e85858;
  --red-lo:     rgba(232,88,88,.1);
  --yellow:     #e8a835;
  --yellow-lo:  rgba(232,168,53,.1);

  --sidebar-w:     220px;
  --sidebar-mini:   52px;
  --topbar-h:       50px;
  --radius:          5px;
  --radius-sm:       4px;
  --radius-lg:      10px;
  --ease:          180ms ease;
  --ease-slow:     260ms ease;
}

html, body { height: 100%; overflow: hidden; }

body {
  background: var(--bg-deep);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.5;
}

/* ── Shell ─────────────────────────────────────────────── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width var(--ease-slow), min-width var(--ease-slow);
  overflow: hidden;
  z-index: 20;
  flex-shrink: 0;
}

.sidebar.mini { width: var(--sidebar-mini); min-width: var(--sidebar-mini); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-brand svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: var(--accent);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-text {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.3px;
  white-space: nowrap;
  transition: opacity var(--ease), transform var(--ease);
  color: var(--accent);
}

.sidebar.mini .brand-text { opacity: 0; transform: translateX(-8px); pointer-events: none; }

.sidebar-nav {
  flex: 1;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  width: 100%;
  overflow: hidden;
  transition: background var(--ease), color var(--ease);
  white-space: nowrap;
  position: relative;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); opacity: 1; }
.nav-item.active { background: var(--surface-3); color: var(--accent); }

.nav-icon {
  width: 14px; height: 14px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-label {
  font-size: 12px;
  font-weight: 500;
  transition: opacity var(--ease), transform var(--ease);
}
.sidebar.mini .nav-label { opacity: 0; transform: translateX(-6px); pointer-events: none; }

.sidebar.mini .nav-item::after {
  content: attr(data-label);
  position: absolute;
  left: calc(var(--sidebar-mini) + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  color: var(--text);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  z-index: 100;
  transition: opacity var(--ease);
}
.sidebar.mini .nav-item:hover::after { opacity: 1; }

.sidebar-divider { height: 1px; background: var(--border); margin: 4px 6px; }
.sidebar-footer { padding: 6px; border-top: 1px solid var(--border); flex-shrink: 0; }

/* ── Main ──────────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

/* ── Topbar ────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  flex-shrink: 0;
}

.topbar-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background var(--ease), color var(--ease);
}
.topbar-toggle:hover { background: var(--surface-2); color: var(--text); opacity: 1; }
.topbar-toggle svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.status-pill { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  transition: background var(--ease-slow), box-shadow var(--ease-slow);
  flex-shrink: 0;
}
.status-dot.on { background: var(--green); box-shadow: 0 0 8px rgba(45,212,150,.5); }

#status-text { font-size: 11px; color: var(--text-2); }

.topbar-sep { width: 1px; height: 20px; background: var(--border); flex-shrink: 0; }

.topbar-kpis { display: flex; align-items: center; gap: 18px; flex: 1; min-width: 0; overflow: hidden; }

.kpi { display: flex; flex-direction: column; align-items: flex-start; flex-shrink: 0; }
.kpi-val { font-size: 14px; font-weight: 700; line-height: 1; margin-bottom: 1px; }
.kpi-val.blue  { color: #6fa3f7; }
.kpi-val.green { color: var(--green); }
.kpi-val.red   { color: var(--red); }
.kpi-val.muted { color: var(--text-2); font-size: 11px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-lbl { font-size: 9px; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }

/* ── Content ───────────────────────────────────────────── */
.content { flex: 1; overflow-y: auto; padding: 16px 18px; }
.content::-webkit-scrollbar { width: 4px; }
.content::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

/* ── Tab ───────────────────────────────────────────────── */
.tab-content { display: none; }
.tab-content.active { display: block; animation: tabIn 160ms ease; }
@keyframes tabIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── Card ──────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card h3 { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: var(--text-2); margin-bottom: 14px; }
.card-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.card-row h3 { margin: 0; }

/* ── Buttons ───────────────────────────────────────────── */
button { cursor: pointer; border: none; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; padding: 6px 13px; transition: background var(--ease), opacity var(--ease), color var(--ease); white-space: nowrap; font-family: inherit; }
button:hover { opacity: .85; }
button:disabled { opacity: .35; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #000; font-weight: 600; }
.btn-danger  { background: var(--red); color: #fff; }
.btn-success { background: var(--green); color: #000; font-weight: 600; }
.btn-ghost   { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-2); }
.btn-ghost:hover { background: var(--surface-3); opacity: 1; }
.btn-sm { padding: 3px 9px; font-size: 11px; }
.btn-icon { width: 26px; height: 26px; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: transparent; color: var(--text-2); border: 1px solid var(--border); font-size: 12px; }
.btn-icon:hover { background: var(--surface-2); color: var(--text); opacity: 1; }
.btn-icon.red:hover { background: var(--red-lo); color: var(--red); border-color: var(--red); opacity: 1; }
.btn-icon.green:hover { background: var(--green-lo); color: var(--green); border-color: var(--green); opacity: 1; }

#toggle-btn { padding: 5px 18px; font-size: 12px; font-weight: 700; }

/* ── Forms ─────────────────────────────────────────────── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.form-row.single { grid-template-columns: 1fr; }
.form-row.triple { grid-template-columns: 1fr 1fr 1fr; }
.form-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; align-items: center; }

.field label { display: block; font-size: 10px; color: var(--text-2); margin-bottom: 4px; font-weight: 500; letter-spacing: .2px; }

.field input,
.field select,
.field textarea,
input:not([type=checkbox]):not([type=radio]),
select,
textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  font-size: 12px;
  outline: none;
  transition: border-color var(--ease);
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--border-2); }
input::placeholder { color: var(--text-3); }
input[type=checkbox] { width: 13px; height: 13px; accent-color: var(--accent); cursor: pointer; }
select option { background: var(--surface-2); }
.field-inline { display: flex; align-items: center; gap: 7px; }
.field-inline label { margin: 0; font-size: 12px; font-weight: 400; color: var(--text); text-transform: none; letter-spacing: 0; cursor: pointer; }

/* ── Table ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--bg); color: var(--text-3); font-size: 9px; text-transform: uppercase; letter-spacing: .6px; padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; font-weight: 700; }
td { padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 12px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

/* ── Badges ────────────────────────────────────────────── */
.badge { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; font-weight: 600; letter-spacing: .2px; }
.badge-green  { background: var(--green-lo);  color: var(--green); }
.badge-red    { background: var(--red-lo);    color: var(--red); }
.badge-blue   { background: var(--accent-lo); color: #6fa3f7; }
.badge-yellow { background: var(--yellow-lo); color: var(--yellow); }
.badge-grey   { background: rgba(113,117,133,.1); color: var(--text-2); }

/* ── SMTP Groups ───────────────────────────────────────── */
.send-mode-tabs { display: flex; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 3px; gap: 2px; margin-bottom: 14px; }
.send-mode-tab { flex: 1; padding: 7px 12px; border-radius: 3px; border: none; background: none; color: var(--text-2); font-size: 11px; font-weight: 600; cursor: pointer; transition: all var(--ease); text-align: center; letter-spacing: .2px; }
.send-mode-tab.active { background: var(--surface-3); color: var(--accent); }
.send-mode-tab:hover { opacity: 1; color: var(--text); }

.mode-config { background: var(--surface-2); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; border: 1px solid var(--border); }

.add-toggle { display: flex; align-items: center; gap: 9px; padding: 10px 12px; cursor: pointer; border: 1px solid var(--border); border-radius: var(--radius); user-select: none; margin-bottom: 8px; transition: border-color var(--ease), background var(--ease); }
.add-toggle:hover { border-color: var(--border-2); background: var(--surface-2); }
.add-toggle-title { font-size: 12px; font-weight: 600; }
.add-toggle-arrow { margin-left: auto; color: var(--text-3); transition: transform .2s; font-size: 11px; }
.add-toggle-arrow.open { transform: rotate(90deg); }
.add-body { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; background: var(--surface-2); }

.group-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; transition: border-color var(--ease); }
.group-card.active-group { border-color: rgba(45,212,150,.3); }
.group-header { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.group-name-input { background: transparent; border: none; color: var(--text); font-size: 12px; font-weight: 600; outline: none; cursor: text; padding: 2px 4px; border-radius: 3px; max-width: 140px; }
.group-name-input:focus { background: var(--surface-3); border: 1px solid var(--border-2); }
.group-badge { background: var(--surface-3); color: var(--text-2); border-radius: 10px; padding: 1px 7px; font-size: 10px; font-weight: 500; white-space: nowrap; }
.group-limit-text { font-size: 10px; color: var(--text-3); }
.group-actions { margin-left: auto; display: flex; gap: 3px; }

.account-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); transition: background var(--ease); }
.account-row:last-child { border-bottom: none; }
.account-row.is-active { background: rgba(45,212,150,.04); }

.provider-badge { width: 30px; height: 30px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; flex-shrink: 0; color: #fff; letter-spacing: 0; }
.prov-gmail   { background: #c53929; }
.prov-outlook,.prov-hotmail,.prov-live { background: #0072c6; }
.prov-mail,.prov-inbox,.prov-list.ru   { background: #005fe0; }
.prov-yahoo   { background: #5f01d1; }
.prov-icloud  { background: #3c3c3e; }
.prov-other   { background: var(--surface-3); }

.account-info { flex: 1; min-width: 0; }
.account-email { font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.account-from  { font-size: 10px; color: var(--text-2); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-prog  { display: flex; align-items: center; gap: 5px; margin-top: 4px; }
.progress-bar  { width: 72px; height: 2px; background: var(--surface-3); border-radius: 1px; overflow: hidden; flex-shrink: 0; }
.progress-fill { height: 100%; background: var(--green); border-radius: 1px; transition: width .3s; }
.progress-text { font-size: 9px; color: var(--text-3); white-space: nowrap; }

.acc-status { font-size: 10px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.acc-status.active  { color: var(--green); }
.acc-status.waiting { color: var(--text-3); }
.acc-status.err     { color: var(--red); }

.acc-actions { display: flex; gap: 3px; flex-shrink: 0; }

.ungrouped { border: 1px dashed var(--border-2); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.ungrouped-header { padding: 8px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }

.parallel-account { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background var(--ease); }
.parallel-account:last-child { border-bottom: none; }
.parallel-account:hover { background: var(--surface-2); }
.parallel-account.selected { background: rgba(45,212,150,.05); }

/* ── Validation stream ─────────────────────────────────── */
.import-stream { font-family: 'SF Mono', Consolas, monospace; font-size: 11px; max-height: 200px; overflow-y: auto; background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; margin-top: 10px; }
.import-row { display: flex; align-items: center; gap: 6px; padding: 2px 0; border-bottom: 1px solid var(--border); }
.import-row:last-child { border-bottom: none; }
.import-icon { font-size: 11px; flex-shrink: 0; }
.import-user { flex: 1; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-status { font-size: 10px; flex-shrink: 0; }
.import-status.ok  { color: var(--green); }
.import-status.err { color: var(--red); }
.import-status.checking { color: var(--yellow); }

/* ── Connection test result ────────────────────────────── */
.conn-result { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.conn-result.ok  { color: var(--green); }
.conn-result.err { color: var(--red); }
.warn-box { background: var(--yellow-lo); border: 1px solid rgba(232,168,53,.3); border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 8px; }
.warn-msg { font-size: 11px; color: var(--yellow); margin-bottom: 8px; }

/* ── Info box ──────────────────────────────────────────── */
.info-box { background: var(--accent-lo); border: 1px solid var(--accent-med); border-radius: var(--radius-sm); padding: 8px 11px; font-size: 11px; color: var(--text-2); margin-bottom: 12px; line-height: 1.65; }
.info-box strong { color: var(--text); }

/* ── Rotation inline edit ──────────────────────────────── */
.rot-inline { background: transparent; border: none; outline: none; color: var(--text); font-size: 12px; width: 100%; min-width: 0; padding: 0; font-family: inherit; }
.rot-inline:focus { background: var(--surface-2); border-radius: 3px; padding: 2px 5px; margin: -2px -5px; }

/* ── Pagination ────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; color: var(--text-2); font-size: 11px; }

/* ── Notice ────────────────────────────────────────────── */
.notice { text-align: center; padding: 26px 20px; color: var(--text-3); font-size: 12px; }

/* ── Stats ─────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px,1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.stat-val { font-size: 20px; font-weight: 700; line-height: 1.1; margin-bottom: 2px; }
.stat-lbl { font-size: 9px; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; }
.stat-val.green { color: var(--green); }
.stat-val.red   { color: var(--red); }
.stat-val.blue  { color: #6fa3f7; }

/* ── Current mark ──────────────────────────────────────── */
.current-mark { color: var(--green); font-size: 10px; margin-left: 4px; font-weight: 600; }

/* ── Modal ─────────────────────────────────────────────── */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 100; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.modal.open { display: flex; animation: tabIn 140ms ease; }
.modal-box { background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius-lg); width: 90vw; max-width: 820px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 24px 64px rgba(0,0,0,.7); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 12px; font-weight: 600; }
.modal-close { background: transparent; color: var(--text-2); font-size: 16px; padding: 0 4px; line-height: 1; }
.modal-close:hover { color: var(--text); opacity: 1; }
.modal-body { flex: 1; overflow: hidden; }
.modal-body iframe { width: 100%; height: 70vh; border: none; background: #fff; display: block; }

/* ── Toast ─────────────────────────────────────────────── */
#toast { position: fixed; bottom: 18px; right: 18px; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--radius-sm); padding: 9px 14px; font-size: 12px; z-index: 200; opacity: 0; transform: translateY(8px); transition: opacity .22s, transform .22s; pointer-events: none; max-width: 300px; }
#toast.show { opacity: 1; transform: none; }
#toast.ok  { border-color: var(--green); color: var(--green); }
#toast.err { border-color: var(--red);   color: var(--red); }

/* ── Debug ─────────────────────────────────────────────── */
.debug-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.filter-pills { display: flex; gap: 3px; flex-wrap: wrap; }
.filter-pill { padding: 2px 9px; border-radius: 12px; font-size: 10px; font-weight: 600; border: 1px solid var(--border); background: transparent; color: var(--text-2); cursor: pointer; letter-spacing: .3px; transition: all var(--ease); }
.filter-pill:hover { opacity: 1; color: var(--text); border-color: var(--border-2); }
.filter-pill.active-all  { background: var(--surface-3); color: var(--text); border-color: var(--border-2); }
.filter-pill.active-SEND { background: var(--green-lo); color: var(--green); border-color: transparent; }
.filter-pill.active-FETCH{ background: var(--yellow-lo); color: var(--yellow); border-color: transparent; }
.filter-pill.active-SMTP { background: var(--accent-lo); color: #6fa3f7; border-color: transparent; }
.filter-pill.active-SYS  { background: rgba(113,117,133,.1); color: var(--text-2); border-color: transparent; }
.filter-pill.active-ERR  { background: var(--red-lo); color: var(--red); border-color: transparent; }

#debug-console { background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-family: 'SF Mono','Fira Code',Consolas,monospace; font-size: 11px; height: 460px; overflow-y: auto; line-height: 1.7; }
#debug-console::-webkit-scrollbar { width: 3px; }
#debug-console::-webkit-scrollbar-thumb { background: var(--border-2); }

.log-entry { display: flex; gap: 8px; align-items: baseline; padding: 0 2px; border-radius: 2px; }
.log-entry:hover { background: rgba(255,255,255,.02); }
.log-time { color: var(--text-3); font-size: 10px; flex-shrink: 0; min-width: 68px; }
.log-tag { font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 2px; flex-shrink: 0; text-transform: uppercase; letter-spacing: .5px; min-width: 40px; text-align: center; }
.tag-SEND  { color: var(--green);  background: var(--green-lo); }
.tag-FETCH { color: var(--yellow); background: var(--yellow-lo); }
.tag-SMTP  { color: #6fa3f7;       background: var(--accent-lo); }
.tag-SYS   { color: var(--text-2); background: rgba(113,117,133,.1); }
.tag-ERR   { color: var(--red);    background: var(--red-lo); }
.log-msg { flex: 1; color: var(--text); word-break: break-all; }
.log-entry.is-err .log-msg  { color: var(--red); }
.log-entry.is-warn .log-msg { color: var(--yellow); }

/* ── Misc ──────────────────────────────────────────────── */
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 3px; padding: 1px 5px; font-size: 11px; font-family: 'SF Mono', Consolas, monospace; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

@media (max-width: 800px) {
  .form-row, .form-row.triple { grid-template-columns: 1fr; }
  .topbar-kpis { display: none; }
}

/* ══════════════════════════════════════════════════════
   ANIMATIONS & POLISH (v4 update)
══════════════════════════════════════════════════════ */

/* ── Keyframes ─────────────────────────────────────── */
@keyframes slideInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadeScaleIn {
  from { opacity: 0; transform: scale(.97); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes pulseGreen {
  0%,100% { box-shadow: 0 0 0 0 rgba(45,212,150,0); }
  50%     { box-shadow: 0 0 0 5px rgba(45,212,150,.15); }
}
@keyframes shimmer {
  from { background-position: -200% center; }
  to   { background-position: 200% center; }
}
@keyframes dotPulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%     { opacity: .6; transform: scale(.8); }
}

/* ── Tab transitions ───────────────────────────────── */
.tab-content.active { animation: slideInUp .22s cubic-bezier(.4,0,.2,1); }

/* ── Card entrance ─────────────────────────────────── */
.card { transition: border-color var(--ease); }
.card:hover { border-color: var(--border-2); }

/* ── Nav items ─────────────────────────────────────── */
.nav-item {
  transition: background var(--ease), color var(--ease), transform .12s ease, padding-left .12s ease;
}
.nav-item:hover  { transform: translateX(2px); opacity: 1; }
.nav-item.active { transform: translateX(2px); }

/* ── Buttons ───────────────────────────────────────── */
button { transition: background var(--ease), opacity var(--ease), transform .1s ease, box-shadow .15s ease; }
button:active:not(:disabled) { transform: scale(.96); }
.btn-primary:hover { box-shadow: 0 0 18px rgba(255,255,255,.1); opacity: 1; }
.btn-success:hover { box-shadow: 0 0 18px rgba(45,212,150,.25); opacity: 1; }

/* ── Table rows ────────────────────────────────────── */
tr { transition: background var(--ease); }

/* ── Account rows ──────────────────────────────────── */
.account-row {
  transition: background var(--ease), transform .12s ease;
}
.account-row:hover { background: var(--surface-2); transform: translateX(2px); }
.account-row.is-active { animation: pulseGreen 3s infinite; }

/* ── Rotation queue cards ──────────────────────────── */
.rot-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  background: var(--surface);
  position: relative;
  transition: border-color .18s ease, background .18s ease, transform .12s ease, box-shadow .18s ease;
  animation: slideInUp .2s ease both;
}
.rot-card:hover { border-color: var(--border-2); transform: translateY(-1px); box-shadow: 0 4px 20px rgba(0,0,0,.3); }
.rot-card.is-active { border-color: rgba(45,212,150,.4); background: rgba(45,212,150,.04); }
.rot-card.is-active:hover { border-color: rgba(45,212,150,.6); }
.rot-active-bar {
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--green); border-radius: var(--radius) 0 0 var(--radius);
}
.rot-card-num {
  font-size: 11px; color: var(--text-3); width: 20px; text-align: center;
  flex-shrink: 0; padding-top: 2px;
}
.rot-card-body { flex: 1; min-width: 0; }
.rot-card-title {
  font-size: 13px; font-weight: 600;
  color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-bottom: 8px;
  transition: color .15s;
}
.rot-card.is-active .rot-card-title { color: var(--green); }
.rot-card-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 12px;
}
.rot-field {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; color: var(--text-3);
}
.rot-field-label {
  white-space: nowrap; flex-shrink: 0; font-weight: 600;
  text-transform: uppercase; letter-spacing: .3px; font-size: 9px;
}
.rot-field-input {
  background: transparent; border: none;
  border-bottom: 1px solid transparent;
  outline: none; color: var(--text-2); font-size: 11px;
  width: 100%; min-width: 0; padding: 1px 2px;
  transition: border-color .15s, background .15s, color .15s;
  font-family: inherit;
}
.rot-field-input:focus {
  border-bottom-color: var(--border-2);
  background: var(--surface-3); border-radius: 3px;
  color: var(--text); padding: 2px 5px; margin: -1px -3px;
}
.rot-field-input::placeholder { color: var(--text-3); }
.rot-card-actions {
  display: flex; flex-direction: column; gap: 3px; flex-shrink: 0;
}
.rot-act-btn {
  width: 26px; height: 22px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-2); border-radius: 3px; cursor: pointer;
  font-size: 11px; transition: all .15s;
}
.rot-act-btn:hover { opacity: 1; background: var(--surface-2); color: var(--text); border-color: var(--border-2); }
.rot-act-btn.act   { color: var(--green); border-color: rgba(45,212,150,.4); background: var(--green-lo); }
.rot-act-btn.del   { color: var(--red);   border-color: rgba(232,88,88,.4);  background: var(--red-lo); }
.rot-act-btn.prev  { color: #6fa3f7; border-color: rgba(111,163,247,.3); }

/* ── Status dot animation ──────────────────────────── */
.status-dot.on { animation: dotPulse 2s infinite; }

/* ── Vars badge ────────────────────────────────────── */
.vars-hint {
  display: inline-flex; flex-wrap: wrap; gap: 4px; margin-top: 6px;
}
.var-chip {
  background: var(--surface-3); border: 1px solid var(--border-2);
  border-radius: 3px; padding: 1px 5px;
  font-size: 10px; font-family: 'SF Mono', Consolas, monospace;
  color: var(--yellow); cursor: pointer;
  transition: background .12s, border-color .12s;
  user-select: none;
}
.var-chip:hover { background: var(--yellow-lo); border-color: var(--yellow); opacity: 1; }

/* ── Defaults tab ──────────────────────────────────── */
.default-field-group {
  background: var(--surface-2); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 14px; margin-bottom: 10px;
}
.default-field-group h4 {
  font-size: 10px; font-weight: 700; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 10px;
}

/* ── Sidebar badge ─────────────────────────────────── */
.nav-badge {
  margin-left: auto; background: var(--accent-lo); color: var(--accent);
  border-radius: 10px; padding: 1px 6px; font-size: 9px; font-weight: 700;
}

/* ── Add-toggle smooth expand ──────────────────────── */
.add-body {
  transition: opacity .18s ease;
  animation: slideInUp .18s ease;
}

/* ── Progress bar fill animation ───────────────────── */
.progress-fill { transition: width .5s cubic-bezier(.4,0,.2,1); }

/* ── Import stream rows ────────────────────────────── */
.import-row { animation: slideInLeft .15s ease; }

/* ── Group card entrance ───────────────────────────── */
.group-card { animation: fadeScaleIn .2s ease; transition: border-color .2s ease; }

/* ── Tooltip ───────────────────────────────────────── */
[data-tip] { position: relative; cursor: help; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: var(--surface-3); border: 1px solid var(--border-2);
  color: var(--text); font-size: 10px; padding: 4px 8px;
  border-radius: 4px; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .15s; z-index: 50;
}
[data-tip]:hover::after { opacity: 1; }

/* ── Parallel group entrance ───────────────────────── */
.parallel-account { transition: background .15s ease, transform .1s ease; }
.parallel-account:hover { transform: translateX(2px); }

/* ── Send-mode tab switch ──────────────────────────── */
.send-mode-tab {
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.send-mode-tab.active {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}