@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700;800;900&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:            #08070C;
  --sidebar:       #0C0912;
  --surface:       #100E17;
  --card:          #121018;
  --card2:         #171420;
  --card3:         #1E1B2A;
  --border:        rgba(255,255,255,.06);
  --border-soft:   rgba(255,255,255,.03);

  --accent:        #8B5CF6;
  --accent-dim:    rgba(139,92,246,.12);
  --accent-glow:   rgba(139,92,246,.28);
  --accent-border: rgba(139,92,246,.22);
  --accent-hover:  #7C3AED;
  --accent-2:      #A78BFA;
  --accent-3:      #C084FC;

  --green:         #22c55e;
  --green-dim:     rgba(34,197,94,.12);
  --yellow:        #f59e0b;
  --yellow-dim:    rgba(245,158,11,.1);

  --text:          #FFFFFF;
  --text-muted:    #6B7280;
  --text-sub:      #A1A1AA;

  --sidebar-w:     224px;
  --sidebar-w-collapsed: 68px;
  --topbar-h:      58px;
  --r:             18px;
  --r-sm:          12px;
  --r-xs:          8px;

  --font-title:    'Sora', system-ui, sans-serif;
  --font-body:     'Inter', system-ui, sans-serif;
}

html { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(139,92,246,.3);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(139,92,246,.5); }

/* ═══════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width .18s ease;
}

/* Sidebar colapsada (icon-only) — estado persistido em localStorage, ver toggleSidebar() */
html.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
html.sidebar-collapsed .main { margin-left: var(--sidebar-w-collapsed); }
html.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 18px 8px 16px; }
html.sidebar-collapsed .sidebar-user { justify-content: center; padding: 12px 8px; }
html.sidebar-collapsed .sidebar nav a { justify-content: center; padding: 8px; }
html.sidebar-collapsed .sidebar-footer a { justify-content: center; }
html.sidebar-collapsed .brand-text,
html.sidebar-collapsed .user-info,
html.sidebar-collapsed .user-power,
html.sidebar-collapsed .nav-txt,
html.sidebar-collapsed .nav-section-label,
html.sidebar-collapsed .footer-label {
  display: none;
}
html.sidebar-collapsed #sidebar-toggle-icon { transform: rotate(180deg); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.brand-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 20px var(--accent-glow), 0 0 40px rgba(139,92,246,.1);
}
.brand-icon svg { width: 16px; height: 16px; color: #fff; }

.brand-name  {
  font-family: var(--font-title);
  font-size: 13px; font-weight: 700; letter-spacing: .02em;
}
.brand-sub   { font-size: 10px; color: var(--text-muted); margin-top: 1px; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.user-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--accent-dim), var(--card2));
  border-radius: 50%;
  border: 1px solid var(--accent-border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-avatar svg { width: 14px; height: 14px; color: var(--accent-2); }

.user-name { font-size: 12.5px; font-weight: 600; }
.user-role { font-size: 9.5px; color: var(--text-muted); letter-spacing: .04em; text-transform: uppercase; }

.user-power {
  width: 26px; height: 26px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  text-decoration: none;
  color: var(--text-muted);
  transition: all .2s;
  margin-left: auto;
}
.user-power svg { width: 13px; height: 13px; }
.user-power:hover {
  background: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent-2);
}

.sidebar nav {
  flex: 1;
  padding: 8px 10px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  padding: 16px 8px 6px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-xs);
  text-decoration: none;
  color: var(--text-sub);
  transition: all .2s;
  position: relative;
}
.sidebar nav a:hover  {
  background: rgba(139,92,246,.07);
  color: var(--text);
}
.sidebar nav a.active {
  background: var(--accent-dim);
  color: var(--text);
}
.sidebar nav a.active::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 10px var(--accent-glow);
}

.nav-ic {
  width: 28px; height: 28px;
  border-radius: var(--r-xs);
  background: rgba(255,255,255,.04);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .2s;
}
.nav-ic svg { width: 14px; height: 14px; }
.sidebar nav a.active .nav-ic {
  background: var(--accent-dim);
  color: var(--accent-2);
}
.sidebar nav a:hover  .nav-ic { background: rgba(139,92,246,.1); }

.nav-title { font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.nav-desc  { font-size: 10px; color: var(--text-muted); margin-top: 1px; }
.sidebar nav a.active .nav-desc { color: var(--text-sub); }

.sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--border);
}
.sidebar-footer a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-xs);
  text-decoration: none; color: var(--text-muted);
  font-size: 12.5px; transition: all .2s;
}
.sidebar-footer a svg { width: 14px; height: 14px; }
.sidebar-footer a:hover {
  background: rgba(255,255,255,.04);
  color: var(--text-sub);
}

/* ═══════════════════════════════════════════════
   MAIN LAYOUT
═══════════════════════════════════════════════ */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .18s ease;
}

/* ═══════════════════════════════════════════════
   TOPBAR
═══════════════════════════════════════════════ */
.topbar {
  height: var(--topbar-h);
  display: grid;
  grid-template-columns: 240px 1fr auto;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--sidebar);
  position: sticky; top: 0; z-index: 50;
}

.topbar-fat {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-fat-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 12px var(--accent-glow);
}
.topbar-fat-icon svg { width: 15px; height: 15px; color: var(--accent-2); }

.fat-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 9.5px; font-weight: 700;
  letter-spacing: .1em; color: var(--text-muted);
  text-transform: uppercase; margin-bottom: 3px;
}

.fat-pct {
  background: var(--accent-dim);
  color: var(--accent-2);
  border-radius: 20px;
  padding: 1px 7px;
  font-size: 9px; font-weight: 800;
  letter-spacing: .04em;
}

.fat-value { display: flex; align-items: baseline; gap: 5px; }

.fat-num {
  font-family: var(--font-title);
  font-size: 14px; font-weight: 700;
  letter-spacing: -.3px;
  font-variant-numeric: tabular-nums;
}

.fat-goal { font-size: 10px; color: var(--text-muted); }

.fat-bar {
  width: 72px; height: 2px;
  background: rgba(255,255,255,.05);
  border-radius: 2px; margin-top: 5px; overflow: hidden;
}
.fat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
  border-radius: 2px;
  box-shadow: 0 0 6px var(--accent-glow);
  transition: width .5s ease;
}

.topbar-center { text-align: center; }

.topbar-greeting {
  font-family: var(--font-title);
  font-size: 15px; font-weight: 600; letter-spacing: -.2px;
}
.topbar-greeting em { color: var(--accent-2); font-style: normal; }

.topbar-date {
  font-size: 10px; letter-spacing: .1em;
  color: var(--text-muted); text-transform: uppercase; margin-top: 2px;
}

.topbar-right { display: flex; align-items: center; gap: 4px; }

.topbar-icon {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-xs); color: var(--text-muted);
  text-decoration: none; transition: all .2s;
}
.topbar-icon svg { width: 16px; height: 16px; }
.topbar-icon:hover { background: var(--card2); color: var(--text); }

/* ═══════════════════════════════════════════════
   CONTENT
═══════════════════════════════════════════════ */
.content { padding: 24px; flex: 1; }

/* ═══════════════════════════════════════════════
   PERIOD ROW
═══════════════════════════════════════════════ */
.period-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}

.period-row-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 10px; font-weight: 700;
  letter-spacing: .1em; color: var(--text-muted);
  text-transform: uppercase;
}
.period-row-label svg { width: 13px; height: 13px; }

.period-tabs { display: flex; gap: 3px; }

.period-tab {
  padding: 5px 14px; border-radius: var(--r-xs);
  font-size: 12px; font-weight: 600;
  text-decoration: none; color: var(--text-muted);
  transition: all .2s;
}
.period-tab:hover { color: var(--text); background: var(--card2); }
.period-tab.active {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 0 14px var(--accent-glow);
}

/* ═══════════════════════════════════════════════
   METRIC CARDS
═══════════════════════════════════════════════ */
.card {
  background: linear-gradient(160deg, #141120 0%, var(--card) 100%);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: border-color .25s, transform .2s, box-shadow .25s;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.04),
    0 1px 4px rgba(0,0,0,.35);
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139,92,246,.12), transparent);
}

.card:hover {
  border-color: rgba(139,92,246,.2);
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.055),
    0 16px 40px rgba(0,0,0,.5),
    0 0 0 1px rgba(139,92,246,.07);
}

.card-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
}

.card-icon {
  width: 32px; height: 32px;
  background: var(--accent-dim);
  border-radius: var(--r-xs);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--accent-border);
  box-shadow: 0 0 12px rgba(139,92,246,.12);
}
.card-icon svg { width: 15px; height: 15px; color: var(--accent-2); }

.card-lbl {
  font-size: 12.5px; font-weight: 500;
  color: var(--text-sub); letter-spacing: .01em;
}

.card-val {
  font-family: var(--font-title);
  font-size: 42px; font-weight: 700;
  letter-spacing: -2px; line-height: 1;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
.card-val.money {
  font-family: var(--font-title);
  font-size: 30px; letter-spacing: -1px;
}

.card-info {
  font-size: 12px; color: var(--text-muted); line-height: 1.5;
}
.card-info b { color: var(--text-sub); font-weight: 600; }

.card-bar {
  height: 4px;
  background: rgba(255,255,255,.05);
  border-radius: 4px; overflow: hidden;
  margin-top: 16px;
}
.card-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
  border-radius: 4px;
  box-shadow: 0 0 8px var(--accent-glow);
  transition: width .8s ease;
}

.card-bar-row {
  display: flex; justify-content: space-between;
  margin-top: 6px; font-size: 10px; color: var(--text-muted);
}
.card-bar-row b { color: var(--text-sub); font-weight: 600; }

/* donut */
.card-donut {
  position: relative; width: 92px; height: 92px;
  margin: 8px auto 6px;
}
.card-donut-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-title);
  font-size: 17px; font-weight: 700; letter-spacing: -.5px;
}

/* KPI compacto (dashboard premium) */
.kpi-card {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kpi-card .card-head { margin-bottom: 0; gap: 9px; }
.kpi-card .card-icon { width: 28px; height: 28px; border-radius: 8px; }
.kpi-card .card-icon svg { width: 13px; height: 13px; }
.kpi-card .card-lbl { font-size: 11.5px; }
.kpi-val {
  font-family: var(--font-title);
  font-size: 30px; font-weight: 700;
  letter-spacing: -1px; line-height: 1;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}
.kpi-sub {
  font-size: 12px; color: var(--text-muted);
  line-height: 1.4; margin-top: 2px;
}
.kpi-sub b { color: var(--text-sub); font-weight: 600; }

/* Conversão — horizontal compacto */
.kpi-conv { justify-content: space-between; }
.kpi-conv-body {
  display: flex; align-items: center;
  gap: 14px; margin-top: 4px;
}
.kpi-conv-donut {
  position: relative;
  width: 52px; height: 52px;
  flex-shrink: 0;
}
.kpi-conv-donut-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-title);
  font-size: 13px; font-weight: 800;
  letter-spacing: -.5px;
  color: var(--accent-2);
}
.kpi-conv-donut-label span { font-size: 9px; margin-top: -4px; }
.kpi-conv-info { flex: 1; min-width: 0; }
.kpi-conv-pct {
  font-family: var(--font-title);
  font-size: 24px; font-weight: 700;
  letter-spacing: -1px; line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.kpi-conv-sub {
  font-size: 11.5px; color: var(--text-muted);
  margin-top: 4px;
}
.kpi-conv-sub b { color: var(--text-sub); font-weight: 600; }

/* Venda row (últimas vendas) */
.venda-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border-soft);
  transition: background .15s;
}
.venda-row:hover { background: rgba(139,92,246,.04); }
.venda-row:last-child { border-bottom: none; }
.venda-icon {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--green-dim);
  border: 1px solid rgba(34,197,94,.18);
  color: var(--green);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.venda-info { flex: 1; min-width: 0; }
.venda-bot {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.venda-time {
  font-size: 11px; color: var(--text-muted);
  font-variant-numeric: tabular-nums; margin-top: 1px;
}
.venda-valor {
  font-family: var(--font-title);
  font-size: 14px; font-weight: 700;
  color: var(--green);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* mini bars */
.card-minibars {
  display: flex; align-items: flex-end; gap: 3px;
  height: 36px; margin-top: 14px;
}
.mini-bar {
  flex: 1;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  opacity: .45; transition: opacity .2s; min-height: 3px;
}
.mini-bar:hover { opacity: 1; }

/* ═══════════════════════════════════════════════
   DASHBOARD LAYOUT
═══════════════════════════════════════════════ */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.dash-mid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
  align-items: stretch;
}

.dash-bot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .dash-mid { grid-template-columns: 1fr; }
  .dash-bot { grid-template-columns: 1fr; }
}

.chart-panel {
  background: linear-gradient(160deg, #141120 0%, var(--card) 100%);
  border: 1px solid var(--border);
  border-radius: var(--r); padding: 22px;
  display: flex; flex-direction: column;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  position: relative;
  min-height: 360px;
}

.chart-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139,92,246,.1), transparent);
}

.chart-panel-title {
  font-family: var(--font-title);
  font-size: 14px; font-weight: 600;
}
.chart-panel-sub {
  font-size: 9.5px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-muted); margin-top: 2px; margin-bottom: 18px;
}

.chart-legend {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-sub); margin-bottom: 14px;
}
.chart-legend::before {
  content: '';
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.chart-canvas-wrap { flex: 1; min-height: 0; position: relative; }

/* ═══════════════════════════════════════════════
   TABLE
═══════════════════════════════════════════════ */
.table-wrap {
  background: linear-gradient(160deg, #141120, var(--card));
  border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}

.table-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}

.table-header-ic {
  width: 28px; height: 28px;
  background: var(--accent-dim);
  border-radius: var(--r-xs);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--accent-border);
}
.table-header-ic svg { width: 14px; height: 14px; color: var(--accent-2); }

.table-header h2  {
  font-family: var(--font-title);
  font-size: 13px; font-weight: 600;
}
.table-header p   { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.table-header-actions { margin-left: auto; }

table { width: 100%; border-collapse: collapse; }

th {
  font-size: 10px; font-weight: 700;
  letter-spacing: .08em; color: var(--text-muted);
  text-transform: uppercase;
  padding: 10px 20px; text-align: left;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 20px; border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(139,92,246,.03); }

/* ═══════════════════════════════════════════════
   PAGE HEADER
═══════════════════════════════════════════════ */
.page-header { margin-bottom: 24px; }

.page-back {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text-muted); text-decoration: none;
  font-size: 13px; margin-bottom: 14px;
  transition: color .2s;
}
.page-back svg { width: 14px; height: 14px; }
.page-back:hover { color: var(--text); }

.page-header h1 {
  font-family: var(--font-title);
  font-size: 28px; font-weight: 700;
  letter-spacing: -.5px; line-height: 1.1;
}
.page-header .page-sub {
  color: var(--text-muted); font-size: 13px; margin-top: 6px;
}

.page-actions {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 20px;
}

/* ═══════════════════════════════════════════════
   FORMS
═══════════════════════════════════════════════ */
.form-card {
  background: linear-gradient(160deg, #141120, var(--card));
  border: 1px solid var(--border);
  border-radius: var(--r); padding: 24px;
  margin-bottom: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}

.form-card-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.form-card-header span {
  font-size: 10px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-sub);
}

.divider-label {
  display: flex; align-items: center; gap: 12px;
  margin: 22px 0 18px;
}
.divider-label::before, .divider-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.divider-label span {
  font-size: 10px; font-weight: 700;
  letter-spacing: .12em; color: var(--text-muted);
  text-transform: uppercase; white-space: nowrap;
}

.form-group { margin-bottom: 16px; }

.form-group label {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; color: var(--text-sub);
  margin-bottom: 7px;
}
.req { color: var(--accent-2); }

input[type=text], input[type=password], input[type=number],
input[type=email], textarea, select {
  width: 100%;
  background: rgba(0,0,0,.4);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--r-sm);
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
  font-family: var(--font-body);
  -webkit-appearance: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139,92,246,.12);
  background: rgba(0,0,0,.55);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { resize: vertical; min-height: 90px; }
textarea.autosize { resize: none; overflow-y: hidden; }
input:disabled { opacity: .3; cursor: not-allowed; }

.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 5px; line-height: 1.4; }

.input-prefix-wrap {
  display: flex; align-items: center;
  background: rgba(0,0,0,.4);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--r-sm);
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.input-prefix-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139,92,246,.12);
}
.input-prefix {
  padding: 10px 10px 10px 14px;
  font-size: 14px; color: var(--text-muted);
  flex-shrink: 0; background: transparent;
}
.input-prefix-wrap input {
  flex: 1; background: transparent;
  border: none; border-radius: 0;
  padding: 10px 14px 10px 0;
}
.input-prefix-wrap input:focus { box-shadow: none; border: none; }

/* ═══════════════════════════════════════════════
   TUTORIAL STEPS
═══════════════════════════════════════════════ */
.steps { display: flex; flex-direction: column; gap: 20px; }

.step { display: flex; gap: 14px; align-items: flex-start; }

.step-badge {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-title);
  font-size: 11px; font-weight: 700;
  color: var(--accent); flex-shrink: 0; margin-top: 1px;
  box-shadow: 0 0 10px rgba(139,92,246,.15);
}

.step-body {}
.step-title {
  font-family: var(--font-title);
  font-size: 13px; font-weight: 600; margin-bottom: 4px;
}
.step-desc  { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

.code-pill {
  display: inline-block;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 11px; font-weight: 700;
  color: var(--accent-2);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  margin-top: 4px;
}

.step-link {
  color: var(--accent-2); text-decoration: none; font-size: 12px;
  display: inline-flex; align-items: center; gap: 4px;
}
.step-link:hover { text-decoration: underline; }

.step-success {
  font-size: 11px; color: var(--green);
  margin-top: 4px; display: flex; align-items: center; gap: 4px;
}

.tutorial-panel {
  background: linear-gradient(160deg, #141120, var(--card));
  border: 1px solid var(--border);
  border-radius: var(--r); padding: 24px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}

.tutorial-panel h3 {
  font-family: var(--font-title);
  font-size: 15px; font-weight: 600; margin-bottom: 5px;
}
.tutorial-panel .t-sub {
  font-size: 12px; color: var(--text-muted); margin-bottom: 22px; line-height: 1.4;
}

/* ═══════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 20px; border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 13px; font-weight: 600;
  border: none; cursor: pointer;
  text-decoration: none;
  transition: all .2s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: var(--accent); color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--card2); color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--card3); border-color: rgba(255,255,255,.1); }

.btn-danger {
  background: transparent; color: #f87171;
  border: 1px solid rgba(248,113,113,.2);
}
.btn-danger:hover {
  background: rgba(248,113,113,.08);
  border-color: rgba(248,113,113,.3);
}

.btn-ghost {
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: rgba(255,255,255,.12); }

.btn-sm   { padding: 5px 13px; font-size: 12px; border-radius: var(--r-xs); }
.btn-lg   { padding: 12px 28px; font-size: 14px; }

.btn-row  { display: flex; gap: 10px; align-items: center; }

.form-actions {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 22px 0 4px;
}

/* ═══════════════════════════════════════════════
   BADGES
═══════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
}

.badge-green  { background: var(--green-dim); color: var(--green); border: 1px solid rgba(34,197,94,.16); }
.badge-red    { background: rgba(248,113,113,.1); color: #f87171; border: 1px solid rgba(248,113,113,.2); }
.badge-yellow { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(245,158,11,.15); }
.badge-gray   { background: var(--card2); color: var(--text-muted); border: 1px solid var(--border); }
.badge-purple { background: var(--accent-dim); color: var(--accent-2); border: 1px solid var(--accent-border); }

.pulse {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  animation: pulse-anim 2s infinite;
}
@keyframes pulse-anim {
  0%  { box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
  70% { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
  100%{ box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

/* ═══════════════════════════════════════════════
   ALERTS
═══════════════════════════════════════════════ */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 16px; border-radius: var(--r-sm);
  margin-bottom: 16px; font-size: 13px; line-height: 1.5;
}
.alert svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.alert-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }

.alert-success { background: rgba(34,197,94,.07);  border: 1px solid rgba(34,197,94,.2);  color: #4ade80; }
.alert-error   { background: rgba(248,113,113,.07); border: 1px solid rgba(248,113,113,.2); color: #f87171; }
.alert-warning {
  background: rgba(245,158,11,.08);
  border: 1px solid rgba(245,158,11,.2);
  color: var(--yellow);
}
.alert-warning strong { color: #fbbf24; }

/* ═══════════════════════════════════════════════
   LOGIN
═══════════════════════════════════════════════ */
.login-page {
  width: 100%;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 40%, rgba(139,92,246,.1) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 70%, rgba(167,139,250,.06) 0%, transparent 50%);
}

.login-box {
  background: linear-gradient(160deg, #141120, #0F0D18);
  border: 1px solid var(--border);
  border-radius: 20px; padding: 40px; width: 380px;
  box-shadow:
    0 24px 80px rgba(0,0,0,.7),
    0 0 0 1px rgba(139,92,246,.06),
    inset 0 1px 0 rgba(255,255,255,.04);
}

.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; }

.login-logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 28px var(--accent-glow), 0 0 56px rgba(139,92,246,.12);
}
.login-logo-icon svg { width: 18px; height: 18px; color: #fff; }

.login-logo-name {
  font-family: var(--font-title);
  font-size: 16px; font-weight: 700;
}
.login-logo-sub  { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

.login-title {
  font-family: var(--font-title);
  font-size: 18px; font-weight: 700; letter-spacing: -.2px;
}
.login-sub   { color: var(--text-muted); font-size: 13px; margin-top: 4px; margin-bottom: 26px; }

/* ═══════════════════════════════════════════════
   MISC
═══════════════════════════════════════════════ */
.text-muted   { color: var(--text-muted); }
.text-sub     { color: var(--text-sub); }
.text-accent  { color: var(--accent-2); }
.text-green   { color: var(--green); }

.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.mt-12        { margin-top: 12px; }
.mt-16        { margin-top: 16px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.empty-state { text-align: center; padding: 72px 20px; color: var(--text-muted); }
.empty-state svg   { width: 44px; height: 44px; margin-bottom: 16px; opacity: .4; }
.empty-state h3    {
  font-family: var(--font-title);
  font-size: 15px; color: var(--text-sub); margin-bottom: 8px; font-weight: 600;
}
.empty-state p     { font-size: 13px; margin-bottom: 20px; }

code {
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 6px; padding: 2px 7px;
  font-size: 12px; color: var(--text-sub);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.section-divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

/* toggle */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.toggle input { display: none; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--card3); border: 1px solid var(--border);
  border-radius: 22px; cursor: pointer; transition: .2s;
}
.toggle input:checked + .toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 16px; height: 16px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%; transition: .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* page fade-in */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.content { animation: fade-up .25s ease; }

/* flow editor — page shell (largura ampliada, centralizada) */
.page-shell { max-width: 1320px; margin: 0 auto; }

.media-utility-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding-bottom: 16px; margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.media-utility-row input[type="text"] { width: 200px; margin: 0; }

/* tabs (flow editor) */
.tabs-row { display: flex; gap: 4px; margin: 16px 0; border-bottom: 1px solid var(--border); }
.tab-btn {
  background: none; border: none; color: var(--text-muted);
  padding: 10px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; border-bottom: 2px solid transparent;
}
.tab-btn.active, .tab-btn:hover { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel { margin-bottom: 16px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* fluxo — boas-vindas tab (Shark blueprint pass 2: full layout) */
.bv-layout { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.bv-col-main > * + * { margin-top: 24px; }
.bv-col-side > * + * { margin-top: 24px; }
@media (max-width: 1100px) { .bv-layout { grid-template-columns: 1fr; } }

.toggle-card {
  background: linear-gradient(160deg, #141120, var(--card));
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 24px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}
.toggle-card-header { display: flex; align-items: center; justify-content: space-between; }
.toggle-card-header .title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.toggle-card-hint { font-size: 11px; color: var(--text-muted); margin: 4px 0 10px; }
.toggle-card-body { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.toggle-card-badge-novo {
  font-size: 9px; font-weight: 700; letter-spacing: .04em;
  background: var(--accent); color: #fff; border-radius: 4px; padding: 1px 6px;
}

.segmented { display: inline-flex; background: var(--card3); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.segmented button {
  background: none; border: none; color: var(--text-muted);
  font-size: 12px; font-weight: 600; padding: 6px 14px; border-radius: 6px; cursor: pointer;
}
.segmented button.active { background: var(--accent); color: #fff; }

/* pill checkbox — multi-select independente (não é mutuamente exclusivo como .segmented) */
.pill-checkbox { display: inline-flex; }
.pill-checkbox input { display: none; }
.pill-checkbox span {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card3); border: 1px solid var(--border); color: var(--text-muted);
  font-size: 12px; font-weight: 600; padding: 7px 14px; border-radius: 999px; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.pill-checkbox input:checked + span { background: var(--accent-dim); border-color: var(--accent-border); color: var(--accent-2); }

/* media gallery — big thumbnails (Shark parity) */
.media-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.media-thumb {
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--card3); overflow: hidden;
  transition: border-color .15s;
}
.media-thumb-select-area { display: block; cursor: pointer; }
.media-thumb-preview {
  position: relative; width: 100%; aspect-ratio: 3/4;
  background: linear-gradient(160deg, #1a1730, #100e1c);
  display: flex; align-items: center; justify-content: center;
}
.media-thumb-preview img { width: 100%; height: 100%; object-fit: cover; }
.media-thumb-play {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.media-thumb-video-badge {
  position: absolute; top: 8px; left: 8px; font-size: 10px; font-weight: 700;
  background: rgba(0,0,0,.6); color: #fff; padding: 2px 8px; border-radius: 4px;
}

.media-thumb-filename { font-size: 11px; color: var(--text-muted); padding: 4px 8px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-thumb-empty {
  aspect-ratio: 3/4; border: 1px dashed var(--border); border-radius: var(--r);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--text-muted); font-size: 12px; cursor: pointer;
}
.media-thumb-empty:hover { border-color: var(--accent); color: var(--text); }
.media-thumb-empty-plus { font-size: 22px; line-height: 1; }

/* seletor de mídia com preview (Order Bump / Upsell / Downsell) */
.media-pick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.media-pick-thumb { cursor: pointer; position: relative; display: block; }
.media-pick-thumb input { display: none; }
.media-pick-thumb:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-border); }
.media-pick-check {
  position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; z-index: 1;
  border-radius: 50%; background: rgba(0,0,0,.5); border: 1.5px solid rgba(255,255,255,.5);
  display: flex; align-items: center; justify-content: center; font-size: 12px; color: transparent;
}
.media-pick-thumb:has(input:checked) .media-pick-check { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Bump/Upsell: grid mais denso, thumb menor (a versão "gallery" de 3/4 é grande demais pra um picker) */
.media-pick-grid-compact { grid-template-columns: repeat(auto-fill, minmax(90px, 100px)); gap: 10px; }
.media-pick-grid-compact .media-thumb-preview { aspect-ratio: 1/1; }
.media-pick-grid-compact .media-thumb-actions { padding: 3px 6px 0; }
.media-pick-grid-compact .media-thumb-x { width: 20px; height: 20px; font-size: 10px; }

/* rich text editor (Boas-vindas / Mensagem) */
.rich-toolbar {
  display: flex; align-items: center; gap: 4px; margin-bottom: 8px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.rich-toolbar button {
  width: 28px; height: 28px; border-radius: 6px; border: 1px solid transparent;
  background: none; color: var(--text-muted); cursor: pointer; font-size: 13px;
}
.rich-toolbar button:hover { background: var(--card3); color: var(--text); border-color: var(--border); }
.rich-toolbar .spacer { flex: 1; }
.rich-toolbar .char-count { font-size: 11px; color: var(--text-muted); }
.emoji-picker {
  position: absolute; z-index: 20; margin-top: 4px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r);
  padding: 8px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.emoji-picker button { width: 28px; height: 28px; font-size: 15px; border: none; background: none; cursor: pointer; border-radius: 4px; }
.emoji-picker button:hover { background: var(--card3); }

.editable-rich {
  min-height: 160px; background: var(--card3); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px; font-size: 13px; line-height: 1.6; color: var(--text);
  outline: none; white-space: pre-wrap;
}
.editable-rich:empty::before { content: attr(data-placeholder); color: var(--text-muted); }

.var-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.var-chip {
  font-size: 11px; font-family: monospace; background: var(--card3);
  border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px;
  color: var(--text-muted); cursor: pointer;
}
.var-chip:hover { border-color: var(--accent); color: var(--text); }

/* cores do botão de plano (Telegram) */
:root {
  --cor-padrao:   #3f3b52;
  --cor-azul:     #2563eb;
  --cor-vermelho: #dc2626;
  --cor-verde:    #16a34a;
}

/* ═══════════════════════════════════════════════
   PLANOS — offer builder (accordion)
═══════════════════════════════════════════════ */
.planos-layout { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
@media (max-width: 1100px) { .planos-layout { grid-template-columns: 1fr; } }

.planos-count { margin-left: auto; font-size: 11px; color: var(--text-muted); font-weight: 600; }

.plano-card {
  background: linear-gradient(160deg, #141120, var(--card));
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color .15s;
}
.plano-card.expanded { border-color: var(--accent-border); }

.plano-card-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
}
.plano-card-icon { background: var(--card2); flex-shrink: 0; }
.plano-card-summary { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.plano-summary-nome { font-size: 13.5px; font-weight: 700; }
.plano-summary-meta { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plano-chevron {
  color: var(--text-muted); font-size: 16px; flex-shrink: 0;
  transition: transform .2s;
}
.plano-card.expanded .plano-chevron { transform: rotate(180deg); color: var(--accent-2); }

.plano-card-body { display: none; padding: 0 20px 20px; }
.plano-card.expanded .plano-card-body { display: block; }

.plano-fields-grid {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 16px;
  margin-bottom: 20px;
}

.plano-block { margin-bottom: 18px; }
.plano-block-label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-sub); margin-bottom: 9px;
}
.plano-block-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.plano-block-title { font-size: 13px; font-weight: 700; }
.card-icon-sm {
  width: 22px; height: 22px; flex-shrink: 0;
  background: var(--card2); border-radius: var(--r-xs);
  display: flex; align-items: center; justify-content: center; font-size: 11px;
}

.plano-cor-picker button[data-cor="padrao"].active   { background: var(--cor-padrao); color: #fff; }
.plano-cor-picker button[data-cor="azul"].active     { background: var(--cor-azul); color: #fff; }
.plano-cor-picker button[data-cor="verde"].active    { background: var(--cor-verde); color: #fff; }
.plano-cor-picker button[data-cor="vermelho"].active { background: var(--cor-vermelho); color: #fff; }

.plano-entrega-custom { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }

.plano-bump-block .toggle-card-hint,
.plano-bump-off-hint { margin: 0 0 4px; }
.plano-bump-fields { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

.plano-remove-btn { width: 100%; justify-content: center; margin-top: 4px; }

.btn-add-plano {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: transparent;
  border: 1.5px dashed var(--border);
  border-radius: var(--r-sm);
  padding: 14px;
  color: var(--text-sub);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.btn-add-plano:hover { border-color: var(--accent-border); color: var(--accent-2); background: var(--accent-dim); }
.btn-add-plano-icon { font-size: 16px; line-height: 1; }

.toggle-card-info-box {
  margin-top: 12px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-xs);
  padding: 10px 12px;
  font-size: 11.5px; line-height: 1.5;
  color: var(--text-sub);
}

/* ═══════════════════════════════════════════════
   DOWNSELL — sequências (accordion, tema roxo)
═══════════════════════════════════════════════ */
.ds-series-btn.active { background: var(--accent); color: #fff; }

.ds-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 48px 20px;
  border: 1px dashed var(--border); border-radius: var(--r-sm);
  color: var(--text-muted); margin-bottom: 12px;
}
.ds-empty-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--card2); display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--text-muted);
}

.ds-card {
  background: linear-gradient(160deg, #141120, var(--card));
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color .15s;
}
.ds-card.expanded { border-color: var(--accent-border); }
.ds-card-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; cursor: pointer; user-select: none;
}
.ds-card-icon { background: var(--card2); flex-shrink: 0; }
.ds-card-body { display: none; padding: 0 20px 20px; }
.ds-card.expanded .ds-card-body { display: block; }
.ds-card .plano-chevron { transition: transform .2s; }
.ds-card.expanded .plano-chevron { transform: rotate(180deg); color: var(--accent-2); }

.ds-icon-btn {
  width: 28px; height: 28px; flex-shrink: 0;
  background: var(--card2); border: 1px solid var(--border); border-radius: var(--r-xs);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; cursor: pointer; color: var(--text-sub);
}
.ds-icon-btn:hover { background: var(--card3); }
.ds-icon-danger:hover { border-color: rgba(248,113,113,.4); color: #f87171; }

.ds-media-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 80px)); gap: 10px; }
.ds-media-grid .media-thumb-preview { aspect-ratio: 1/1; }
.ds-media-grid .media-thumb-empty { aspect-ratio: 1/1; }
.ds-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.ds-copy-textarea { min-height: 90px; resize: vertical; }

.ds-plano-existente-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 8px;
  background: var(--card2); border: 1px solid var(--border); border-radius: var(--r-xs);
  cursor: pointer; font-size: 13px;
}
.ds-plano-existente-row input[type=checkbox] { display: none; }
.ds-plano-check {
  width: 18px; height: 18px; flex-shrink: 0; border-radius: 50%;
  background: var(--card3); border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: transparent;
}
.ds-plano-existente-row:has(input:checked) { border-color: var(--accent-border); }
.ds-plano-existente-row:has(input:checked) .ds-plano-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.ds-plano-nome { font-weight: 600; flex: 1; }
.ds-plano-preco { font-size: 12px; color: var(--text-muted); display: flex; gap: 6px; }
.ds-plano-preco s { color: var(--text-muted); }

.ds-custom-plano-card {
  background: var(--card2); border: 1px solid var(--border); border-radius: var(--r-xs);
  padding: 14px; margin-bottom: 10px;
}
.ds-custom-plano-header {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 700; margin-bottom: 12px;
}

/* media gallery — draggable */
.media-thumb {
  cursor: grab;
  transition: border-color .15s, box-shadow .15s;
}
.media-thumb:active { cursor: grabbing; }
.media-thumb.dragging { opacity: .4; }
.media-thumb-preview { cursor: pointer; }
.media-thumb-preview:hover { opacity: .85; }
.media-thumb-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 0;
}
.media-thumb-x {
  width: 24px; height: 24px;
  background: rgba(248,113,113,.15);
  border: 1px solid rgba(248,113,113,.3);
  border-radius: 50%;
  color: #f87171;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.media-thumb-x:hover {
  background: rgba(248,113,113,.3);
  border-color: #f87171;
}
.media-thumb-order {
  width: 20px; height: 20px;
  background: var(--accent);
  border-radius: 50%;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ═══════════════════════════════════════════════
   MEUS FLUXOS — dashboard de fluxos (grid de cards)
═══════════════════════════════════════════════ */
.flows-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.flows-title { font-family: var(--font-title); font-size: 26px; font-weight: 800; }
.flows-header-actions { display: flex; gap: 10px; flex-shrink: 0; }

.flows-summary-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-bottom: 18px;
}
@media (max-width: 900px) { .flows-summary-row { grid-template-columns: repeat(2, 1fr); } }
.flows-summary-card {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(160deg, #141120, var(--card));
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 12px 14px;
}
.flows-summary-card .card-icon { flex-shrink: 0; width: 30px; height: 30px; font-size: 14px; }
.flows-summary-label { display: block; font-size: 10.5px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.flows-summary-value { display: block; font-size: 18px; font-weight: 800; font-family: var(--font-title); margin-top: 1px; }

.flows-filters-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.flows-chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.flows-chip {
  background: var(--card2); border: 1px solid var(--border); border-radius: 20px;
  padding: 7px 16px; font-size: 12.5px; font-weight: 600; color: var(--text-sub);
  cursor: pointer; transition: all .15s;
}
.flows-chip:hover { border-color: var(--accent-border); color: var(--text); }
.flows-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.flows-search-wrap { position: relative; flex-shrink: 0; width: 260px; }
.flows-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; opacity: .6; pointer-events: none; }
#flows-search { margin: 0; padding-left: 34px; }

.flows-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
@media (max-width: 1200px) { .flows-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) { .flows-grid { grid-template-columns: 1fr; } }

.flow-card {
  background: linear-gradient(160deg, #141120, var(--card));
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 16px; display: flex; flex-direction: column; gap: 11px;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.flow-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-border);
  box-shadow: 0 12px 28px rgba(0,0,0,.35);
}

.flow-card-top { display: flex; align-items: flex-start; gap: 12px; }
.flow-card-icon { background: var(--card2); flex-shrink: 0; }
.flow-card-titles { flex: 1; min-width: 0; }
.flow-card-nome {
  display: block; font-weight: 700; font-size: 14.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
}
.flow-card-rename-icon { font-size: 11px; opacity: 0; transition: opacity .15s; }
.flow-card-nome:hover .flow-card-rename-icon { opacity: .8; }
.flow-card-badges { display: flex; gap: 6px; margin-top: 5px; flex-wrap: wrap; }

.flow-card-menu { position: relative; flex-shrink: 0; }
.flow-menu-btn {
  width: 26px; height: 26px; flex-shrink: 0;
  background: none; border: none; border-radius: var(--r-xs);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1; color: var(--text-muted);
  cursor: pointer; transition: background .15s, color .15s;
}
.flow-menu-btn:hover { background: var(--card2); color: var(--text); }
.flow-context-menu {
  display: none; position: absolute; top: 30px; right: 0; z-index: 30;
  background: var(--card3); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 6px; min-width: 220px;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
}
.flow-context-menu.open { display: block; }
.flow-context-menu a, .flow-context-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: none; text-align: left;
  padding: 8px 10px; border-radius: var(--r-xs);
  font-size: 12.5px; color: var(--text-sub); text-decoration: none;
  cursor: pointer;
}
.flow-context-menu a:hover, .flow-context-menu button:not(:disabled):hover { background: var(--card2); color: var(--text); }
.flow-context-menu button:disabled { color: var(--text-muted); cursor: not-allowed; opacity: .55; }
.flow-context-menu form { margin: 0; }
.flow-context-menu-item-danger { color: #f87171 !important; }
.flow-context-menu-divider { height: 1px; background: var(--border); margin: 6px 4px; }

.flow-card-bot { font-size: 12.5px; color: var(--text-sub); }

.flow-progress-block { display: flex; flex-direction: column; gap: 6px; }
.flow-progress-head { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--text-sub); font-weight: 600; }
.flow-progress-pct { color: var(--accent-2); font-weight: 800; }
.flow-progress-track { height: 5px; border-radius: 3px; background: var(--card2); overflow: hidden; }
.flow-progress-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .3s; }
.flow-progress-sub { font-size: 10.5px; color: var(--text-muted); }

.flow-card-kpis {
  display: flex; align-items: stretch;
  border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft);
  padding: 10px 0;
}
.flow-kpi {
  flex: 1; text-align: center; display: flex; flex-direction: column; gap: 2px;
  border-right: 1px solid var(--border-soft);
}
.flow-kpi:last-child { border-right: none; }
.flow-kpi-label { font-size: 9.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; font-weight: 700; }
.flow-kpi-value { font-size: 15px; font-weight: 800; font-family: var(--font-title); }

.flow-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.flow-card-footer-meta { font-size: 11px; color: var(--text-muted); }
.flow-card-cta {
  font-size: 12.5px; font-weight: 700; color: var(--accent-2);
  text-decoration: none; white-space: nowrap; transition: opacity .15s;
}
.flow-card-cta:hover { opacity: .75; }
