/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--r-ctl);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text);
  font-weight: 500; font-size: 14px; white-space: nowrap; cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-strong); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--bad-text); }
.btn.danger:hover { background: var(--bad-soft); border-color: transparent; }
.btn.ok { background: var(--ok); border-color: transparent; color: #fff; }
.btn.ok:hover { filter: brightness(1.06); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; gap: 6px; }
.btn.xs { height: 26px; padding: 0 9px; font-size: 12px; gap: 5px; border-radius: 8px; }
.btn.icon { width: 38px; padding: 0; }
.btn.icon.sm { width: 32px; }
.btn .spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- surfaces ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--shadow-1); min-width: 0;
}
.card.pad { padding: 20px; }
.card.tight { padding: 14px 16px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px 0; }
.card-head h2 { flex: 1; font-size: 15.5px; }
.card-body { padding: 14px 20px 20px; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.section-title h2 { flex: 1; }
.well { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }

/* ---------- badges & chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: var(--r-pill); font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.badge.ok { background: var(--ok-soft); color: var(--ok-text); }
.badge.warn { background: var(--warn-soft); color: var(--warn-text); }
.badge.bad { background: var(--bad-soft); color: var(--bad-text); }
.badge.live { background: var(--live-soft); color: var(--live); }
.badge.outline { background: transparent; border: 1px solid var(--line-2); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--surface);
  font-size: 13px; color: var(--text-2); cursor: pointer; white-space: nowrap;
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.on { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--r-pill); background: var(--warn); color: #1c1300; font-size: 11.5px; font-weight: 700;
  font-family: var(--mono);
}

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field .help { font-size: 12px; color: var(--text-3); }
.field .error { font-size: 12px; color: var(--bad-text); }
.input, .textarea, .select {
  width: 100%; min-height: 40px; padding: 8px 12px; border-radius: var(--r-ctl);
  border: 1px solid var(--line-2); background-color: var(--surface-2); color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--accent); background-color: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.7; }
.select { appearance: none; padding-inline-end: 36px; cursor: pointer; background-repeat: no-repeat;
  background-position: left 12px center; background-size: 14px 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a94a8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.input.ltr { direction: ltr; text-align: left; }

.toggle { position: relative; display: inline-block; width: 40px; height: 23px; flex: none; cursor: pointer; vertical-align: middle; }
.toggle input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.toggle span { position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--line-2); transition: background var(--t-fast); }
.toggle span::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 17px; height: 17px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform var(--t-med) var(--ease); }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { transform: translateX(-17px); }
.toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--surface-3); }
.seg button { height: 30px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2);
  font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background var(--t-fast), color var(--t-fast); }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.seg.accent button.on { background: var(--accent); color: var(--on-accent); }
.seg.sm button { height: 26px; padding: 0 9px; font-size: 12px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { position: relative; height: 42px; padding: 0 14px; border: 0; background: none; color: var(--text-2);
  font-weight: 500; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); }
.tabs button.on::after { content: ''; position: absolute; inset-inline: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }

/* ---------- data ---------- */
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat .v { font-family: var(--mono); font-size: 24px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.2; }
.stat .k { font-size: 12.5px; color: var(--text-2); }
.stat .d { font-size: 12px; font-family: var(--mono); }
.stat .d.up { color: var(--ok-text); } .stat .d.down { color: var(--bad-text); }
.meter { height: 6px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width var(--t-med) var(--ease); }
.meter.warn > i { background: var(--warn); } .meter.bad > i { background: var(--bad); } .meter.ok > i { background: var(--ok); }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: start; font-weight: 500; color: var(--text-3); font-size: 12px; padding: 8px 10px; }
.table td { padding: 10px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tr:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }

.list { display: flex; flex-direction: column; }
.list > .item { display: flex; gap: 12px; align-items: center; padding: 12px 4px; border-top: 1px solid var(--line); min-width: 0; }
.list > .item:first-child { border-top: 0; }
.list > .item.click { cursor: pointer; border-radius: 10px; padding-inline: 10px; }
.list > .item.click:hover { background: var(--surface-2); }

/* ---------- identity marks ---------- */
.mark { display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 11px;
  background: var(--surface-3); color: var(--text-2); }
.mark.sm { width: 26px; height: 26px; border-radius: 8px; }
.mark.lg { width: 44px; height: 44px; border-radius: 14px; }
.mark.ch-tiktok { background: color-mix(in srgb, var(--c-tiktok) 16%, transparent); color: var(--c-tiktok); }
.mark.ch-instagram { background: color-mix(in srgb, var(--c-instagram) 15%, transparent); color: var(--c-instagram); }
.mark.ch-x { background: color-mix(in srgb, var(--c-x) 18%, transparent); color: var(--text); }
.mark.ch-whatsapp { background: color-mix(in srgb, var(--c-whatsapp) 15%, transparent); color: var(--c-whatsapp); }
.mark.ch-linkedin { background: color-mix(in srgb, var(--c-linkedin) 15%, transparent); color: var(--c-linkedin); }
.mark.agent { background: var(--accent-soft); color: var(--accent-text); }

.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-3); }
.status-dot.working { background: var(--live); box-shadow: 0 0 0 4px var(--live-soft); animation: breathe 1.6s ease-in-out infinite; }
.status-dot.waiting { background: var(--warn); } .status-dot.error { background: var(--bad); } .status-dot.idle { background: var(--ok); }
.status-dot.paused { background: var(--text-3); }
@keyframes breathe { 50% { box-shadow: 0 0 0 7px transparent; } }

/* ---------- states ---------- */
.skeleton { border-radius: 10px; background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%);
  background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 40px 20px; color: var(--text-2); }
.empty .mark { width: 52px; height: 52px; border-radius: 16px; }
.empty h3 { color: var(--text); }
.empty p { max-width: 46ch; font-size: 13.5px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 13.5px;
  background: var(--accent-soft); color: var(--text); }
.notice.warn { background: var(--warn-soft); } .notice.bad { background: var(--bad-soft); } .notice.ok { background: var(--ok-soft); }
.notice .grow > b { display: block; margin-bottom: 2px; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; background: var(--overlay); animation: fade var(--t-med) var(--ease); }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; z-index: 41; top: 0; bottom: 0; inset-inline-start: 0; width: min(560px, 100vw);
  background: var(--surface); border-inline-end: 1px solid var(--line); box-shadow: var(--shadow-2);
  display: flex; flex-direction: column; animation: slide-in var(--t-med) var(--ease); }
.drawer.wide { width: min(760px, 100vw); }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { flex: 1; min-width: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-foot { display: flex; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal { position: fixed; z-index: 41; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px); overflow-y: auto; background: var(--surface); border-radius: var(--r-card);
  box-shadow: var(--shadow-2); border: 1px solid var(--line); animation: pop var(--t-med) var(--ease); }
.modal.wide { width: min(820px, calc(100vw - 32px)); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -48%) scale(0.98); } }
.modal-head { padding: 18px 20px 4px; display: flex; gap: 10px; align-items: center; }
.modal-head h2 { flex: 1; }
.modal-body { padding: 12px 20px 20px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-start; padding: 0 20px 20px; flex-wrap: wrap; }

.toasts { position: fixed; z-index: 60; bottom: 20px; left: 20px; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 40px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--surface);
  border: 1px solid var(--line-2); box-shadow: var(--shadow-2); font-size: 13.5px; animation: pop-up var(--t-med) var(--ease); }
.toast .mark { width: 28px; height: 28px; border-radius: 9px; }
.toast.ok .mark { background: var(--ok-soft); color: var(--ok-text); }
.toast.bad .mark { background: var(--bad-soft); color: var(--bad-text); }
.toast.warn .mark { background: var(--warn-soft); color: var(--warn-text); }
@keyframes pop-up { from { opacity: 0; transform: translateY(8px); } }

.menu { position: absolute; z-index: 30; min-width: 220px; padding: 6px; border-radius: 14px; background: var(--surface);
  border: 1px solid var(--line-2); box-shadow: var(--shadow-2); animation: pop-up var(--t-fast) var(--ease); }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none;
  border-radius: 9px; color: var(--text); font-size: 13.5px; cursor: pointer; text-align: start; text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--surface-2); }

/* ---------- media ---------- */
.thumb { position: relative; border-radius: 12px; overflow: hidden; background: var(--surface-3); aspect-ratio: 1; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb .kind { position: absolute; bottom: 8px; inset-inline-start: 8px; display: grid; place-items: center; width: 26px; height: 26px;
  border-radius: 8px; background: rgba(8, 12, 22, 0.62); color: #fff; }
.sim { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--warn-text); }
