/* Painel do lojista. Cores, fontes e medidas seguem o preview aprovado. */

:root {
  --bg: #F7F7F5;
  --surface: #FFFFFF;
  --border: #E4E4E7;
  --border-input: #D4D4D8;
  --text: #18181B;
  --text-2: #3F3F46;
  --muted: #52525B;
  --accent: #0F766E;
  --accent-hover: #115E59;
  --accent-strong: #0F5F58;
  --accent-soft: #E6F4F1;
  --avatar-bg: #CCE9E4;
  --wa-bg: #EFEAE2;
  --wa-out: #D9FDD3;
  --wa-text: #111B21;
  --wa-time: #4B5B63;
  --ok: #166534;
  --ok-dot: #16A34A;
  --warn: #92400E;
  --warn-dot: #D97706;
  --warn-bg: #FEF3C7;
  --danger: #B91C1C;
  --danger-bg: #FEF2F2;
  --font: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; }
button, input, select, textarea { font-family: inherit; font-size: 14px; color: var(--text); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Layout com menu lateral ------------------------------------------------- */

.layout { min-height: 100vh; display: flex; flex-wrap: wrap; }

.sidebar {
  flex: 1 1 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; text-decoration: none; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark { width: 32px; height: 32px; flex: 0 0 auto; display: block; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -0.02em; }
.brand-ai { font-weight: 500; color: var(--accent); }

.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 500;
}
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link[aria-current='page'] { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.nav-link svg { flex: 0 0 auto; }

.store-card { margin-top: 24px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; display: flex; flex-direction: column; gap: 6px; }
.store-card-name { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.status { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.status::before { content: ''; width: 8px; height: 8px; border-radius: 4px; background: currentColor; }
.status-ok { color: var(--ok); }
.status-ok::before { background: var(--ok-dot); }
.status-warn { color: var(--warn); }
.status-warn::before { background: var(--warn-dot); }
.logout {
  margin-top: 6px; align-self: flex-start; background: none; border: none; padding: 6px 0; min-height: 32px;
  color: var(--muted); font-size: 13px; cursor: pointer; text-decoration: underline;
}
.logout:hover { color: var(--text); }

.main { flex: 999 1 560px; min-width: 0; padding: 32px 40px; display: flex; flex-direction: column; gap: 24px; }

.page-form { display: flex; flex-direction: column; gap: 24px; }
.page-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 16px; }
.page-header h1 { font-size: 28px; }
.page-header p { margin: 6px 0 0; font-size: 15px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.save-state { font-size: 13px; color: var(--muted); }
.save-state.dirty { color: var(--warn); }

/* Botões ------------------------------------------------------------------- */

.btn {
  min-height: 44px; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--border-input);
  background: var(--surface); color: var(--text); font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn:hover { border-color: #A1A1AA; color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.btn-block { width: 100%; }
.link-btn { background: none; border: none; padding: 0; color: var(--muted); font-size: 13px; text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: var(--danger); }

/* Cartões e campos --------------------------------------------------------- */

.columns { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.col-main { flex: 3 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.col-side { flex: 2 1 320px; min-width: 0; position: sticky; top: 24px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.card h2 { font-size: 18px; }
.card-hint { margin: 0; font-size: 14px; color: var(--muted); }
.card-head p { margin: 6px 0 0; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border-input);
  border-radius: 8px; background: var(--surface); font-weight: 400;
}
.textarea { resize: vertical; min-height: 88px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); outline-offset: 0; }
.input[aria-invalid='true'], .textarea[aria-invalid='true'] { border-color: var(--danger); }
.field-error { font-size: 13px; font-weight: 500; color: var(--danger); }
.field-error:empty { display: none; }
.field-help { font-size: 13px; font-weight: 400; color: var(--muted); }

.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; color: var(--text); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: 0 0 auto; }

.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.segment {
  min-height: 44px; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--border-input);
  background: var(--surface); color: var(--text-2); font-weight: 500; cursor: pointer;
}
.segment[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }

.label { font-size: 14px; font-weight: 500; color: var(--text-2); }

/* Identidade */
.identity { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.avatar {
  width: 72px; height: 72px; border-radius: 36px; background: var(--avatar-bg); color: var(--accent-strong);
  display: flex; align-items: center; justify-content: center; font-family: var(--font-display);
  font-size: 28px; font-weight: 600; overflow: hidden; flex: 0 0 auto;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.identity-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.identity-buttons { display: flex; align-items: center; gap: 12px; }

/* Horário */
.hours { display: flex; flex-direction: column; gap: 4px; }
.hour-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 52px; }
.hour-day { flex: 1 1 160px; display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.hour-day input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.time { min-height: 44px; padding: 8px 10px; border: 1px solid var(--border-input); border-radius: 8px; background: var(--surface); }
.time[aria-invalid='true'] { border-color: var(--danger); }
.hour-times { display: inline-flex; align-items: center; gap: 12px; flex-wrap: nowrap; }
.until { color: var(--muted); }
.pill { padding: 4px 10px; border-radius: 999px; background: #F4F4F5; color: var(--text-2); font-size: 13px; font-weight: 500; }
.hour-row .field-error { flex-basis: 100%; }

/* Valor do pedido */
.money { display: inline-flex; align-items: center; gap: 6px; }
.money .input { width: 120px; min-height: 36px; padding: 6px 10px; }

/* Prévia do WhatsApp -------------------------------------------------------- */

.phone { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.phone-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--accent-strong); color: #fff; }
.phone-avatar {
  width: 36px; height: 36px; border-radius: 18px; background: var(--avatar-bg); color: var(--accent-strong);
  display: flex; align-items: center; justify-content: center; font-weight: 600; overflow: hidden; flex: 0 0 auto;
}
.phone-avatar img { width: 100%; height: 100%; object-fit: cover; }
.phone-title { display: flex; flex-direction: column; min-width: 0; }
.phone-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone-sub { font-size: 12px; color: #D7EEEA; }
.phone-body { background: var(--wa-bg); padding: 16px; display: flex; flex-direction: column; gap: 10px; min-height: 260px; }
.bubble { max-width: 85%; padding: 8px 12px; border-radius: 8px; font-size: 14px; line-height: 1.45; color: var(--wa-text); white-space: pre-line; overflow-wrap: anywhere; }
.bubble-in { align-self: flex-end; max-width: 80%; background: var(--wa-out); }
.bubble-out { align-self: flex-start; background: #fff; }
.bubble-time { display: block; font-size: 11px; color: var(--wa-time); text-align: right; margin-top: 2px; }

/* Avisos -------------------------------------------------------------------- */

.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #FECACA; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 12px 18px; border-radius: 8px; font-size: 14px; font-weight: 500;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18); z-index: 10;
}

/* Login e cadastro ---------------------------------------------------------- */

.auth { min-height: 100vh; display: flex; flex-wrap: wrap; }
.auth-form-side { flex: 1 1 440px; display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-box { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 24px; }
.auth-box .brand { padding: 0; }
.auth-box h1 { font-size: 28px; }
.auth-box .lead { margin: 6px 0 0; font-size: 15px; color: var(--muted); }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-switch { font-size: 14px; color: var(--muted); margin: 0; }

.auth-art {
  flex: 1 1 440px; background: var(--accent-strong); color: #fff; padding: 48px;
  display: flex; flex-direction: column; justify-content: center; gap: 28px;
}
.auth-art h2 { font-size: 30px; line-height: 1.2; max-width: 440px; }
.auth-art p { margin: 0; color: #D7EEEA; font-size: 16px; max-width: 440px; }
.auth-art .phone { max-width: 380px; border-color: rgba(255, 255, 255, 0.2); }
.auth-art .phone-head { background: #0B4A45; }
.auth-art .phone-body { min-height: 0; }

/* Em construção */
.empty-state { align-items: flex-start; }
.empty-state h2 { font-size: 20px; }

/* Telas estreitas ------------------------------------------------------------ */

@media (max-width: 720px) {
  .main { padding: 24px 16px; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--border); }
  .col-side { position: static; }
  .auth-art { padding: 32px 24px; }
}

/* ======================================================================== */
/* Componentes das abas                                                      */
/* ======================================================================== */

.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--warn-dot); color: #fff; font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}

.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 13px; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.btn-danger:hover { background: #991B1B; border-color: #991B1B; color: #fff; }
.btn-ghost { background: none; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg); border-color: transparent; color: var(--text); }
.btn-ghost.danger:hover { color: var(--danger); }

/* Indicadores */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.stat-value { font-family: var(--font-display); font-size: 26px; font-weight: 600; }
.stat-label { font-size: 14px; color: var(--muted); }
.stat-warn { background: var(--warn-bg); border-color: #FCD34D; }
.stat-warn .stat-value { color: #78350F; }
.stat-warn .stat-label { color: var(--warn); }
button.stat { text-align: left; cursor: pointer; font: inherit; color: inherit; }
button.stat:hover { border-color: var(--border-input); }

/* Abas */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); }
.tab {
  min-height: 44px; padding: 10px 16px; border: none; border-bottom: 2px solid transparent; background: none;
  color: var(--muted); font-weight: 500; cursor: pointer;
}
.tab[aria-selected='true'] { border-bottom-color: var(--accent); color: var(--accent-strong); font-weight: 600; }
.tab:hover { color: var(--text); }

/* Tabelas */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; display: flex; flex-direction: column; }
.table-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.table-tools .field { flex: 1 1 260px; font-size: 13px; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 13px; font-weight: 500; color: var(--muted); padding: 12px; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table td { padding: 12px; border-top: 1px solid #F0F0F1; vertical-align: middle; }
.table .num { text-align: right; white-space: nowrap; }
.table .actions-cell { text-align: right; white-space: nowrap; }
.cell-main { font-weight: 500; }
.cell-sub { font-size: 13px; color: var(--muted); }

/* Selos */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-ok { background: #DCFCE7; color: var(--ok); }
.badge-off { background: #FEE2E2; color: #991B1B; }
.badge-info { background: #E0E7FF; color: #3730A3; }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-muted { background: #F4F4F5; color: var(--text-2); }
.badge-accent { background: var(--accent-soft); color: var(--accent-strong); }

/* Listas em cartão */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px 20px; border-top: 1px solid #F0F0F1; }
.list-row:first-child { border-top: none; }
.list-row-main { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-row-title { font-weight: 600; overflow-wrap: anywhere; }
.list-row-text { color: var(--text-2); overflow-wrap: anywhere; white-space: pre-line; }
.list-row-actions { display: flex; gap: 8px; align-items: center; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.section-head h2 { font-size: 16px; }

.empty { padding: 40px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-title { margin: 0; font-weight: 600; font-size: 15px; }
.empty-text { margin: 0; color: var(--muted); max-width: 420px; }

/* Janelas */
.dialog {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: none; border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); color: var(--text);
}
.dialog-wide { width: min(720px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(24, 24, 27, 0.45); }
.dialog-head { padding: 20px 24px 0; }
.dialog-head h2 { font-size: 18px; }
.dialog-form { padding: 16px 24px 24px; display: flex; flex-direction: column; gap: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 12px; padding-top: 4px; }
.dialog-text { margin: 0; color: var(--text-2); }
.form-row { display: flex; flex-wrap: wrap; gap: 16px; }
.form-row > * { flex: 1 1 180px; }
.option-row { display: flex; gap: 8px; align-items: flex-start; }
.option-row .input { min-height: 40px; }
.option-row .opt-name { flex: 1 1 auto; }
.option-row .opt-price { width: 120px; flex: 0 0 auto; }
.check-list { display: flex; flex-direction: column; gap: 2px; max-height: 200px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; }
.check-list .check { min-height: 36px; }

/* Chat (testar agente e conversas) */
.chat { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.chat .phone-head { padding: 12px 16px; }
.chat-body { background: var(--wa-bg); padding: 20px; display: flex; flex-direction: column; gap: 10px; min-height: 420px; max-height: 60vh; overflow-y: auto; }
.chat-note { align-self: center; max-width: 90%; background: #FFF8E1; color: #6B4E00; font-size: 12px; padding: 6px 12px; border-radius: 8px; text-align: center; }
.chat-form { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface); }
.chat-form .input { border-radius: 999px; padding: 10px 16px; }
.icon-btn { width: 44px; height: 44px; flex: 0 0 auto; border-radius: 22px; border: none; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.bubble-human { align-self: flex-start; background: #E8F0FE; }
.bubble-author { display: block; font-size: 11px; font-weight: 600; color: var(--wa-time); margin-bottom: 2px; }
.bubble-failed { outline: 1px solid var(--danger); }
.typing { align-self: flex-start; background: #fff; padding: 8px 14px; border-radius: 8px; color: var(--muted); font-size: 13px; }

.side-stack { display: flex; flex-direction: column; gap: 16px; }
.tool-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tool-item { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.tool-item svg { flex: 0 0 auto; margin-top: 2px; }
.tool-detail { display: block; font-size: 12px; color: var(--muted); }
.cart-box { white-space: pre-line; font-size: 13px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }

/* Conversas */
.inbox { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.inbox-list { flex: 1 1 300px; min-width: 0; max-width: 100%; }
.inbox-thread { flex: 999 1 420px; min-width: 0; }
.conv-item {
  width: 100%; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: none; border-top: 1px solid #F0F0F1;
  background: var(--surface); text-align: left; cursor: pointer; color: var(--text);
}
.conv-item:first-child { border-top: none; }
.conv-item:hover { background: var(--bg); }
.conv-item[aria-current='true'] { background: var(--accent-soft); }
.conv-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.conv-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.conv-last { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.thread-who { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.thread-who .badge { margin-top: 4px; text-decoration: none; }
.link-sm { font-size: 13px; color: var(--accent, #0F766E); font-weight: 500; margin-top: 4px; }
.plain-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.thread-banner { padding: 10px 16px; font-size: 13px; background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid #FCD34D; }

/* Pedidos */
.order-lines { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; font-size: 14px; }
.totals .total { font-weight: 700; }
.order-card { padding: 16px 20px; border-top: 1px solid #F0F0F1; display: flex; flex-direction: column; gap: 10px; }
.order-card:first-child { border-top: none; }
.order-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; }
.order-meta { font-size: 13px; color: var(--muted); }
.order-body { display: flex; flex-wrap: wrap; gap: 24px; }
.order-body > * { flex: 1 1 260px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter { min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border-input); background: var(--surface); color: var(--text-2); font-weight: 500; cursor: pointer; }
.filter[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Resultados */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding: 8px 4px 0; }
.bar-col { flex: 1 1 0; min-width: 4px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bar { width: 100%; max-width: 36px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar-zero { background: var(--border); }
.bar-label { font-size: 11px; color: var(--muted); white-space: nowrap; }
.bars-legend { font-size: 13px; color: var(--muted); }

/* Conexão */
.connect-options { display: flex; flex-wrap: wrap; gap: 20px; }
.connect-option { flex: 1 1 320px; min-width: 0; background: var(--surface); border: 2px solid var(--border); border-radius: 12px; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.connect-option.recommended { border-color: var(--accent); }
.connect-option-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.connect-option-head h2 { font-size: 18px; flex: 1 1 auto; }
.connect-option ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.risk { color: var(--warn); }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.warn-box { background: var(--warn-bg); border: 1px solid #FCD34D; border-radius: 12px; padding: 16px 20px; color: #78350F; display: flex; flex-direction: column; gap: 8px; }
.warn-box ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; overflow-wrap: anywhere; }
.connected { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.connected-icon { width: 48px; height: 48px; border-radius: 24px; background: #DCFCE7; color: var(--ok); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.badge-btn { border: none; cursor: pointer; min-height: 28px; }
.badge-btn:hover { filter: brightness(0.95); }
/* Conversas vistas pela loja: cliente à esquerda, loja à direita */
.msg-customer { align-self: flex-start; background: #fff; }
.msg-store { align-self: flex-end; max-width: 80%; background: var(--wa-out); }
.msg-human { background: #DCEBFF; }
.card > .btn, .card > form > .btn, form.card > .btn { align-self: flex-start; }
.order-actions { align-items: flex-end; }
.connected-icon { font-size: 22px; font-weight: 700; }
/* Itens dentro de colunas flexíveis podem encolher: tabelas largas rolam dentro do cartão, não a página. */
.page-form > *, .table-card, [role='tabpanel'] { min-width: 0; }
.table-scroll { position: relative; }
.question-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.question-row .input { flex: 1 1 260px; }
.question-row .check { min-height: 36px; }
.question-row .field-error { flex-basis: 100%; }
.check-disabled { color: var(--muted); cursor: default; }
/* Contatos */
.answers { margin: 0; display: grid; grid-template-columns: minmax(140px, auto) 1fr; gap: 6px 16px; font-size: 14px; }
.answers dt { color: var(--muted); }
.answers dd { margin: 0; overflow-wrap: anywhere; }
.lead-summary { margin: 0; }
.answers { grid-template-columns: minmax(120px, 2fr) 3fr; }
.order-body > .answers { flex: 2 1 380px; }

/* Agenda ---------------------------------------------------------------------- */
.alert-warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #FCD34D; }
.alert-warn a { color: #78350F; font-weight: 600; }
.week-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.week-label { font-family: var(--font-display); font-weight: 600; font-size: 16px; min-width: 190px; text-align: center; }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; min-height: 76px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--text); }
.week-day:hover { border-color: var(--accent); }
.week-day-name { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.week-day-num { font-family: var(--font-display); font-size: 20px; font-weight: 600; line-height: 1.2; }
.week-day-sub { font-size: 12px; color: var(--muted); text-align: center; }
.week-day-today .week-day-num { color: var(--accent); }
.week-day-off { background: #FAFAFA; }
.week-day-off .week-day-num { color: var(--muted); }
.week-day[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: #fff; }
.week-day[aria-pressed='true'] .week-day-name, .week-day[aria-pressed='true'] .week-day-sub, .week-day[aria-pressed='true'] .week-day-num { color: #fff; }
.agenda-day-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.agenda-day-head h2 { font-size: 17px; }
.agenda-row { display: flex; gap: 16px; padding: 14px 20px; border-top: 1px solid #F0F0F1; }
.agenda-day-head + .agenda-row { border-top: none; }
.agenda-time { display: flex; flex-direction: column; min-width: 56px; font-variant-numeric: tabular-nums; }
.agenda-time strong { font-size: 16px; }
.agenda-time span { font-size: 13px; color: var(--muted); }
.agenda-main { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.agenda-notes { font-size: 13px; color: var(--text-2); background: #FAFAFA; border-radius: 8px; padding: 6px 10px; }
.agenda-row-cancelled .agenda-time, .agenda-row-cancelled .list-row-title { color: var(--muted); text-decoration: line-through; }
.agenda-row-block { background: repeating-linear-gradient(135deg, #FAFAFA 0 10px, #F4F4F5 10px 20px); }
@media (max-width: 640px) {
  .week-strip { display: flex; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 4px; }
  .week-day { flex: 0 0 76px; scroll-snap-align: start; padding: 8px 4px; min-height: 70px; }
  .week-day-sub { font-size: 11px; }
  .agenda-row { gap: 12px; padding: 12px 16px; }
  .agenda-time { min-width: 46px; }
  .agenda-main .order-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .agenda-main .order-actions .field { grid-column: 1 / -1; }
  .agenda-main .order-actions .btn { justify-content: center; text-align: center; }
}
.stat-link { text-decoration: none; color: var(--accent); }
.stat-link:hover { border-color: var(--accent); }
.tool-cancelled > span { text-decoration: line-through; color: var(--muted); }

/* Conexão por QR Code ---------------------------------------------------------- */
.qr-layout { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; }
.qr-box { flex: 0 0 auto; width: 264px; height: 264px; border: 1px solid var(--border); border-radius: 12px; background: #fff; display: flex; align-items: center; justify-content: center; padding: 8px; }
.qr-svg { width: 100%; height: 100%; display: block; }
.qr-placeholder { color: var(--muted); font-size: 14px; text-align: center; padding: 16px; }
.qr-status { font-size: 14px; color: var(--text-2); margin: 0; }
.qr-layout > .side-stack { flex: 1 1 260px; }
.connected-icon-warn { background: var(--warn-bg); color: var(--warn); }
@media (max-width: 640px) { .qr-box { width: 100%; max-width: 300px; height: auto; aspect-ratio: 1; margin: 0 auto; } }

/* ======================================================================== */
/* Primeiros passos                                                          */
/* ======================================================================== */

.nav-badge-soft { background: var(--accent-soft); color: var(--accent-strong); }

.setup-card { display: flex; flex-direction: column; gap: 16px; }
.setup-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.setup-pct { font-family: var(--font-display); font-size: 28px; font-weight: 600; color: var(--accent-strong); line-height: 1; }
.progress { height: 8px; border-radius: 4px; background: var(--accent-soft); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s ease; }
.progress-fill.w-0 { width: 0%; }
.progress-fill.w-5 { width: 5%; }
.progress-fill.w-10 { width: 10%; }
.progress-fill.w-15 { width: 15%; }
.progress-fill.w-20 { width: 20%; }
.progress-fill.w-25 { width: 25%; }
.progress-fill.w-30 { width: 30%; }
.progress-fill.w-35 { width: 35%; }
.progress-fill.w-40 { width: 40%; }
.progress-fill.w-45 { width: 45%; }
.progress-fill.w-50 { width: 50%; }
.progress-fill.w-55 { width: 55%; }
.progress-fill.w-60 { width: 60%; }
.progress-fill.w-65 { width: 65%; }
.progress-fill.w-70 { width: 70%; }
.progress-fill.w-75 { width: 75%; }
.progress-fill.w-80 { width: 80%; }
.progress-fill.w-85 { width: 85%; }
.progress-fill.w-90 { width: 90%; }
.progress-fill.w-95 { width: 95%; }
.progress-fill.w-100 { width: 100%; }

.step-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.step-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); }
.step-row:first-child { border-top: 0; }
.step-next { background: var(--accent-soft); border-radius: 10px; padding: 14px; margin: 4px -14px; border-top-color: transparent; }
.step-next + .step-row { border-top-color: transparent; }
.step-mark {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; border: 1.5px solid var(--border-input); color: var(--muted); background: var(--surface);
}
.step-mark-done { background: var(--accent); border-color: var(--accent); color: #fff; }
.step-mark-next { border-color: var(--accent); color: var(--accent-strong); }
.step-mark-skipped { border-style: dashed; }
.step-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.step-title { font-weight: 600; }
.step-done .step-title { color: var(--muted); }
.step-why { color: var(--muted); font-size: 13px; }
.step-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.setup-review summary { cursor: pointer; font-weight: 600; }
.setup-review[open] summary { margin-bottom: 8px; }

.shortcuts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.shortcut {
  display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1px solid var(--border); border-radius: 10px;
  text-decoration: none; color: var(--text); background: var(--surface);
}
.shortcut:hover { border-color: var(--accent); color: var(--text); }
.shortcut span { color: var(--muted); font-size: 13px; }

.welcome-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.welcome-steps li span { display: block; color: var(--muted); font-size: 13px; }

.guide-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--accent-soft); border: 1px solid #BFE3DC; border-radius: 12px; padding: 14px 16px; margin-bottom: 20px;
}
.guide-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 320px; }
.guide-step { font-size: 12px; font-weight: 600; color: var(--accent-strong); text-transform: uppercase; letter-spacing: .04em; }
.guide-text span:last-child { color: var(--text-2); }
.guide-actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .step-row { flex-wrap: wrap; }
  .step-actions { width: 100%; justify-content: flex-start; padding-left: 44px; }
  .step-next { margin: 4px -10px; padding: 12px 10px; }
}
