/* ============================================================
   COVIL DAS PROMOS — style.css (enxuto, premium)
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;
  --bg: #14161a;
  --panel: #1c1f24;
  --panel-2: #23272e;
  --line: #2a2e35;
  --line-strong: #383d45;
  --text: #e8eaed;
  --text-muted: #9aa0a6;
  --text-faint: #6b7280;
  --accent: #fbbf24;
  --accent-hover: #fcd34d;
  --accent-soft: rgba(251, 191, 36, 0.10);
  --accent-text: #1a1507;
  --success: #4ade80;
  --success-soft: #12251a;
  --warning: #fbbf24;
  --warning-soft: #2a2211;
  --danger: #f87171;
  --danger-soft: #2a1717;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar-w: 220px;
  --topbar-h: 60px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --panel-2: #f1f3f5;
  --line: #e4e7eb;
  --line-strong: #d1d5db;
  --text: #1a1d21;
  --text-muted: #5f6673;
  --text-faint: #9aa0a6;
  --accent-soft: rgba(251, 191, 36, 0.15);
  --success-soft: #ecfdf5;
  --warning-soft: #fffbeb;
  --danger-soft: #fef2f2;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

/* ---------- Layout ---------- */
.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.main-area {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-content {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 32px;
}

/* ---------- Sidebar ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 24px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 18px;
  font-weight: 900;
  flex-shrink: 0;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-copy strong {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.brand-copy b {
  font-size: 15px;
  font-weight: 700;
}

.brand-copy b span { color: var(--accent); }

.nav-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 12px;
  margin-bottom: 8px;
}

.main-nav { display: grid; gap: 2px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
  transition: background 0.12s, color 0.12s;
}

.nav-link:hover { background: var(--panel-2); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }

.nav-icon {
  width: 16px;
  text-align: center;
  font-size: 14px;
  opacity: 0.7;
}

.nav-link.active .nav-icon { opacity: 1; }

.nav-group { display: grid; gap: 0; }

.nav-sub-link {
  display: block;
  margin-left: 28px;
  padding: 6px 12px;
  border-left: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.nav-sub-link:hover { color: var(--text); }
.nav-sub-link.active { color: var(--accent); border-left-color: var(--accent); }

.sidebar-bottom {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.connection-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

.connection-card strong { font-weight: 500; color: var(--text); }
.connection-card small { display: block; font-size: 10px; color: var(--text-faint); }

.connection-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.logout-button {
  background: none;
  border: 0;
  color: var(--text-muted);
  padding: 8px 12px;
  text-align: left;
  width: 100%;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.logout-button:hover { background: var(--panel-2); color: var(--text); }

/* ---------- Topbar ---------- */
.top-status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 500;
}

.top-status i {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
}

.avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--accent);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
}

.theme-toggle {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
}

.theme-toggle:hover { background: var(--panel-2); color: var(--text); }

.mobile-brand { display: none; }

/* ---------- Títulos ---------- */
.page-title-row { margin-bottom: 32px; }

.page-title-row h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0;
}

.page-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------- Botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.08s;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.15);
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-outline {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--text);
}

.btn-outline:hover { background: var(--panel-2); }

.btn-danger-outline {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--danger);
}

.btn-danger-outline:hover { background: var(--danger-soft); border-color: var(--danger); }

.btn-full { width: 100%; padding: 11px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-row .btn { width: 100%; }

/* ---------- Forms ---------- */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-stack label,
.form-premium label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.form-stack input,
.form-stack textarea,
.form-stack select,
.form-premium input,
.form-premium textarea,
.form-premium select {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 11px 14px;
  color: var(--text);
  outline: none;
  font-size: 14px;
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
}

.form-stack textarea,
.form-premium textarea { resize: vertical; min-height: 90px; line-height: 1.6; }

.form-stack input:focus,
.form-stack textarea:focus,
.form-stack select:focus,
.form-premium input:focus,
.form-premium textarea:focus,
.form-premium select:focus {
  border-color: var(--accent);
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-stack input::placeholder,
.form-stack textarea::placeholder,
.form-premium input::placeholder,
.form-premium textarea::placeholder { color: var(--text-faint); }

.form-premium {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-premium .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-premium .form-grid > div { display: flex; flex-direction: column; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-grid > div { display: flex; flex-direction: column; gap: 4px; }

.form-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 8px;
}

.url-lookup-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.url-lookup-row input { flex: 1; }
.url-lookup-row .btn { flex: none; }

/* ---------- Painéis ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}

.panel + .panel { margin-top: 16px; }

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.section-heading h3 { font-size: 15px; font-weight: 600; margin: 0; }

/* ---------- Stat cards ---------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px;
}

.stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.1; }
.stat-value.accent { color: var(--accent); }
.stat-sub { font-size: 11px; color: var(--text-faint); margin-top: 4px; }

/* ---------- Tabelas ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th {
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-faint);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}

td { padding: 12px 16px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }

/* ---------- Catálogo ---------- */
.catalog-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.catalog-count { font-size: 13px; color: var(--text-muted); }
.catalog-count strong { color: var(--text); font-weight: 600; }

.catalog-toolbar input[type="search"] {
  width: min(100%, 320px);
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 13px;
}

.catalog-toolbar input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.product-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.12s;
}

.product-card:hover { border-color: var(--line-strong); }
.product-card[hidden] { display: none; }

.product-image {
  position: relative;
  aspect-ratio: 1;
  background: var(--panel-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12px;
}

.product-image > span:not(.discount-badge) {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text-faint);
  font-weight: 600;
}

.discount-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 10px;
  font-weight: 700;
}

.product-info { padding: 12px; }

.product-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 10px;
  color: var(--text-faint);
  margin-bottom: 8px;
}

.product-info h4 {
  font-size: 13px;
  line-height: 1.4;
  margin: 0 0 8px;
  font-weight: 500;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 36px;
}

.old-price {
  font-size: 11px;
  color: var(--text-faint);
  text-decoration: line-through;
  margin: 0;
}

.price {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin: 0 0 12px;
}

.product-bottom {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.product-bottom .btn { flex: 1; font-size: 11px; padding: 7px 8px; }
.product-bottom form { flex: 1; margin: 0; }
.product-bottom form .btn { width: 100%; }

/* ---------- Empty / disclaimer ---------- */
.empty-state {
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 48px 24px;
  background: var(--panel);
}

.empty-state h3 { font-size: 15px; font-weight: 600; margin: 12px 0 8px; }
.empty-state p { font-size: 13px; color: var(--text-muted); margin: 0 auto 16px; max-width: 400px; }

.empty-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 20px;
}

.empty-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }

.disclaimer {
  color: var(--text-faint);
  font-size: 11px;
  line-height: 1.6;
  margin: 12px 0;
}

.lookup-status { font-size: 12px; line-height: 1.5; color: var(--text-muted); margin: 8px 0; }
.status-success { color: var(--success); }
.status-warning { color: var(--warning); }
.status-error { color: var(--danger); }

/* ---------- Image preview ---------- */
.image-preview {
  margin: 8px 0;
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  max-width: 180px;
}

.image-preview img { width: 100%; height: 130px; object-fit: contain; }

/* ---------- Flash ---------- */
.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--panel);
  font-size: 13px;
}

.flash-success { border-color: rgba(74,222,128,0.3); color: var(--success); background: var(--success-soft); }
.flash-error { border-color: rgba(248,113,113,0.3); color: var(--danger); background: var(--danger-soft); }
.flash-warning { border-color: rgba(251,191,36,0.3); color: var(--warning); background: var(--warning-soft); }

.flash-close {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  opacity: 0.6;
  padding: 0 4px;
}

.flash-close:hover { opacity: 1; }

/* ---------- Layout status ---------- */
.layout-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 24px;
}

.layout-status .layout-name { font-weight: 600; color: var(--text); }
.layout-status .layout-empty { color: var(--text-faint); font-size: 12px; }
.layout-status .btn { margin-left: auto; font-size: 11px; padding: 6px 10px; }

/* ---------- Product picker ---------- */
.product-picker {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-height: 360px;
  overflow-y: auto;
  background: var(--panel-2);
}

.product-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.1s;
}

.product-picker-row:hover { background: var(--panel); }
.product-picker-row:last-child { border-bottom: 0; }

.product-picker-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}

.picker-title {
  flex: 1;
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-price { font-size: 12px; color: var(--text-muted); font-weight: 500; flex-shrink: 0; }
.picker-discount { font-size: 10px; color: var(--accent); font-weight: 600; flex-shrink: 0; }

/* ---------- Promo textarea ---------- */
.promo-textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 14px;
  color: var(--text);
  outline: none;
  font-size: 14px;
  line-height: 1.7;
  min-height: 180px;
  resize: vertical;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
}

.promo-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------- Send actions ---------- */
.send-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Schedule list ---------- */
.schedule-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.schedule-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.schedule-item:last-child { border-bottom: 0; }
.schedule-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schedule-time { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.schedule-item .btn { font-size: 11px; padding: 5px 10px; }

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-card {
  width: min(100%, 380px);
  padding: 32px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius-lg);
}

.login-brand { padding: 0; margin-bottom: 24px; }

.login-card h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0 0 8px;
}

.login-card h1 span { color: var(--accent); }

.muted-text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 24px;
}

.muted-text code {
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}

.login-footnote {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-faint);
  font-size: 11px;
  margin: 16px 0 0;
}

/* ---------- Footer ---------- */
.footer-note {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 32px;
  color: var(--text-faint);
  font-size: 11px;
}

.footer-note span { color: var(--accent); padding: 0 4px; }

/* ---------- Utilitários ---------- */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.live-pill i {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
}

/* ---------- Responsivo ---------- */
@media (max-width: 850px) {
  :root { --sidebar-w: 200px; }
  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .form-grid,
  .form-premium .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .sidebar {
    position: static;
    width: auto;
    height: auto;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand { padding: 0 0 12px; }
  .nav-label, .sidebar-bottom { display: none; }

  .main-nav { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; }
  .nav-link { font-size: 12px; white-space: nowrap; padding: 6px 10px; }
  .nav-sub-link { display: none; }

  .main-area { margin-left: 0; }

  .topbar {
    height: 52px;
    padding: 0 12px;
    justify-content: space-between;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
  }

  .mobile-brand .brand-mark {
    width: 24px;
    height: 24px;
    font-size: 14px;
    border-radius: 6px;
  }

  .top-status { display: none; }
  .page-content { padding: 16px 12px; }
  .page-title-row h1 { font-size: 20px; }
  .panel { padding: 16px; }

  .url-lookup-row { flex-direction: column; }
  .url-lookup-row .btn { width: 100%; }

  .send-actions { display: grid; grid-template-columns: 1fr; }
  .send-actions .btn { width: 100%; }

  .btn-row { grid-template-columns: 1fr; }

  .product-grid { grid-template-columns: 1fr; }

  .catalog-toolbar { flex-direction: column; align-items: stretch; }
  .catalog-toolbar input[type="search"] { width: 100%; }

  .login-card { padding: 24px; }
}

/* Correção: esconder linhas filtradas */
.product-picker-row[hidden] { display: none !important; }

/* Filtros da lista de produtos */
.send-filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}
.send-filter-row input[type="search"] {
  flex: 1;
  min-width: 180px;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
}
.send-filter-row input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}
.check-inline input[type="checkbox"] { accent-color: var(--accent); }
.btn-sm { font-size: 11px; padding: 6px 10px; }

/* Badge "Enviado hoje" na linha */
.picker-sent {
  font-size: 10px;
  font-weight: 600;
  color: var(--success);
  background: var(--success-soft);
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* Histórico */
.history-day { margin-bottom: 16px; }
.history-day:last-child { margin-bottom: 0; }
.history-day-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.history-list { display: flex; flex-direction: column; gap: 4px; }
.history-item {
  display: flex;
  gap: 12px;
  font-size: 12px;
  padding: 4px 0;
}
.history-time { color: var(--text-faint); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.history-title { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* ============================================================
   HISTÓRICO DE ENVIOS (cards por dia)
   ============================================================ */

.history-day {
  margin-bottom: var(--space-5);
}

.history-day:last-child {
  margin-bottom: 0;
}

.history-day-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--line);
}

.history-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-faint);
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-3);
}

.history-card {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.12s;
}

.history-card:hover {
  border-color: var(--line-strong);
}

.history-thumb {
  position: relative;
  aspect-ratio: 1;
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.history-thumb > span:not(.discount-badge) {
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--text-faint);
  font-weight: 600;
}

.history-info {
  padding: 10px;
}

.history-meta {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 10px;
  color: var(--text-faint);
  margin-bottom: 6px;
}

.history-meta .history-time {
  color: var(--accent);
  font-weight: 600;
}

.history-title-text {
  font-size: 12px;
  line-height: 1.35;
  margin: 0 0 6px;
  font-weight: 500;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 32px;
}

.history-info .old-price {
  font-size: 10px;
  margin: 0;
}

.history-info .price {
  font-size: 15px;
  margin: 0 0 8px;
}

@media (max-width: 620px) {
  .history-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
  }
}

/* ============================================================
   LOGO + USERS + LOGIN v2
   ============================================================ */

.brand-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
}

.login-brand-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-5);
}

.login-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 14px;
}

.login-logo-fallback {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 14px;
  font-size: 34px;
  font-weight: 900;
}

.logo-preview {
  margin: var(--space-3) 0;
  padding: var(--space-3);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: inline-flex;
}

.logo-preview img {
  max-height: 80px;
  max-width: 200px;
  object-fit: contain;
}

.form-inline {
  display: flex;
  gap: 6px;
  align-items: center;
}

.form-inline input[type="text"] {
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  width: 100%;
}

.inline-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-actions input[type="password"] {
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

/* Mobile adjustments for the users table */
@media (max-width: 850px) {
  .form-inline,
  .inline-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Campo de afiliado nas ofertas capturadas */
.affiliate-row {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.affiliate-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  outline: none;
}

.affiliate-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.affiliate-save-btn {
  font-size: 11px;
  padding: 6px 8px;
}

.affiliate-status {
  margin: 4px 0 6px;
  font-size: 10px;
  min-height: 14px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-backdrop[hidden] { display: none; }

.modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 420px;
}

.modal-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.modal-heading h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.modal-close {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

/* Indicador de modo (manual / automático) */
.mode-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px;
}

.mode-indicator .mode-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mode-indicator.mode-manual {
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  color: var(--text-muted);
}

.mode-indicator.mode-manual .mode-dot {
  background: var(--text-faint);
}

.mode-indicator.mode-auto {
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.3);
  color: var(--success);
}

.mode-indicator.mode-auto .mode-dot {
  background: var(--success);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.next-run-timer {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.3);
    color: var(--success);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 16px;
}
.next-run-icon {
    font-size: 14px;
    animation: pulse 2s infinite;
}

/* Mini status do dashboard */
.mini-status {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel-2);
}
.mini-status-label {
    font-size: 11px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.mini-status-value {
    font-size: 13px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}
.dot-green, .dot-gray, .dot-red {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot-green { background: var(--success); box-shadow: 0 0 6px rgba(74,222,128,0.5); }
.dot-gray  { background: var(--text-faint); }
.dot-red   { background: var(--danger); }

@media (max-width: 620px) {
    .stats-row { grid-template-columns: 1fr; }
}

.btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--panel-2) !important;
    color: var(--text-muted) !important;
    border-color: var(--line-strong) !important;
}