/* Conectyse.ai — Design System Claude-like v4 */

:root {
  --verde:       #1D9E75;
  --verde-dark:  #0F6E56;
  --verde-light: rgba(29,158,117,0.12);
  --texto:       #ececec;
  --texto-2:     #a0a0a0;
  --texto-3:     #6b6b6b;
  --borda:       #2d2d2d;
  --borda-2:     #252525;
  --fundo:       #1a1a1a;
  --card:        #212121;
  --surface-1:   #252525;
  --surface-2:   #2d2d2d;
  --radius:      10px;
  --radius-sm:   7px;
  --shadow:      0 1px 3px rgba(0,0,0,.4);
  --shadow-md:   0 4px 12px rgba(0,0,0,.5);
  --sidebar-w:   220px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  font-size: 14px; color: var(--texto); background: var(--fundo);
  line-height: 1.6; -webkit-font-smoothing: antialiased;
}

h1 { font-size: 19px; font-weight: 700; letter-spacing: -.3px; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 13px; font-weight: 600; }

.logo { font-size: 16px; font-weight: 800; letter-spacing: -.5px; color: var(--texto); }
.logo span { color: var(--verde); }

/* ── Botões ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 15px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all .15s;
  text-decoration: none; white-space: nowrap; font-family: inherit;
}
.btn-primary   { background: var(--verde); color: #fff; }
.btn-primary:hover { background: var(--verde-dark); }
.btn-secondary { background: var(--surface-1); color: var(--texto-2); border-color: var(--borda); }
.btn-secondary:hover { background: var(--surface-2); color: var(--texto); }
.btn-danger    { background: var(--surface-1); color: #f87171; border-color: #5a2020; }
.btn-danger:hover { background: rgba(220,38,38,.1); }
.btn-full      { width: 100%; justify-content: center; }
.btn:disabled  { opacity: .4; cursor: not-allowed; }

/* ── Inputs ── */
input, select, textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--borda); border-radius: var(--radius-sm);
  font-size: 13px; color: #ececec; background: var(--surface-2);
  transition: border-color .15s, box-shadow .15s; outline: none; font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--verde); box-shadow: 0 0 0 3px rgba(29,158,117,.15);
}
select option { background: var(--surface-2); color: var(--texto); }
textarea { resize: vertical; min-height: 80px; }
.form-group { margin-bottom: 15px; }
.form-group label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--texto-2); margin-bottom: 5px; letter-spacing: .02em;
}
.form-hint { font-size: 11px; color: var(--texto-3); margin-top: 4px; line-height: 1.5; }
.form-row  { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Cards ── */
.card {
  background: var(--card); border: 1px solid var(--borda);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card:last-child { margin-bottom: 0; }
.card-title {
  font-size: 11px; font-weight: 700; color: var(--texto-3);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 14px;
}

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
}
.badge-ok   { background: rgba(34,197,94,.15); color: #4ade80; }
.badge-off  { background: rgba(239,68,68,.15); color: #f87171; }
.badge-warn { background: rgba(234,179,8,.15); color: #facc15; }
.badge-lock { background: var(--surface-2); color: var(--texto-3); border: 1px solid var(--borda); }

/* ── Toggle ── */
.toggle {
  width: 38px; height: 22px; border-radius: 11px;
  border: none; cursor: pointer; position: relative;
  transition: background .2s; flex-shrink: 0;
}
.toggle.on  { background: var(--verde); }
.toggle.off { background: #3d3d3d; }
.toggle-dot {
  position: absolute; top: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: left .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.toggle.on  .toggle-dot { left: 19px; }
.toggle.off .toggle-dot { left: 3px; }

/* ── Layout principal ── */
.app {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

/* SIDEBAR STICKY — fixed para garantir que segue o scroll em qualquer altura de conteúdo */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--card); border-right: 1px solid var(--borda);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
}
.sidebar-logo {
  padding: 18px 14px 14px;
  border-bottom: 1px solid var(--borda);
  flex-shrink: 0;
}
nav { padding: 8px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 500; color: var(--texto-2); cursor: pointer;
  transition: all .12s; text-decoration: none; border: none;
  background: none; width: 100%; text-align: left; margin-bottom: 1px;
}
.nav-item:hover { background: var(--surface-2); color: var(--texto); }
.nav-item.active { background: var(--verde-light); color: var(--verde); font-weight: 600; }
.nav-item i { font-size: 15px; flex-shrink: 0; width: 16px; }
.nav-item.nav-locked { color: var(--texto-3); }
.nav-item.nav-locked:hover { background: var(--surface-1); }
.nav-lock { margin-left: auto; font-size: 10px; background: var(--surface-2); padding: 1px 6px; border-radius: 10px; border: 1px solid var(--borda); color: var(--texto-3); }
.nav-section {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: var(--texto-3);
  padding: 0 10px; margin: 16px 0 5px;
}
.sidebar-footer { padding: 10px 8px; border-top: 1px solid var(--borda); flex-shrink: 0; }

/* MAIN */
.main { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; min-width: 0; overflow-x: hidden; }

/* Seções */
.page-section {
  padding: 28px 32px;
  border-bottom: 1px solid var(--borda);
  scroll-margin-top: 20px;
}
.page-section:last-child { border-bottom: none; }
.page-header { margin-bottom: 20px; }
.page-subtitle { color: var(--texto-3); font-size: 13px; }

.section-header {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: -28px -32px 20px -32px;
  padding: 14px 32px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--borda);
  border-left: 3px solid var(--verde);
}
.section-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--verde-light); color: var(--verde);
  display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0;
}
.section-title { font-size: 17px; font-weight: 700; color: var(--texto); letter-spacing: -.3px; }
.section-sub { font-size: 12px; color: var(--texto-3); margin-top: 2px; }

/* Métricas */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.metric {
  background: var(--card); border: 1px solid var(--borda);
  border-radius: var(--radius); padding: 16px;
}
.metric-label { font-size: 10px; font-weight: 700; color: var(--texto-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.metric-value { font-size: 26px; font-weight: 700; letter-spacing: -.5px; color: var(--texto); }
.metric-sub   { font-size: 10px; color: var(--texto-3); margin-top: 3px; }

/* Pendências */
.pending-box {
  background: var(--card); border: 1px solid #5a3a00;
  border-radius: var(--radius); overflow: hidden; margin-bottom: 16px;
}
.pending-header {
  padding: 10px 16px; background: rgba(90,58,0,.3);
  border-bottom: 1px solid #5a3a00;
  font-size: 11px; font-weight: 700; color: #facc15;
  display: flex; align-items: center; gap: 7px;
}
.pending-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--borda);
  font-size: 12px;
}
.pending-item:last-child { border-bottom: none; }
.pending-item i { color: #f59e0b; font-size: 15px; flex-shrink: 0; }
.pending-item span { flex: 1; color: var(--texto-2); }
.btn-fix {
  padding: 5px 12px; background: var(--verde); color: #fff;
  border: none; border-radius: 6px; font-size: 11px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}

/* Canal */
.canal-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; background: var(--surface-1); border: 1px solid var(--borda);
  border-radius: var(--radius); margin-bottom: 8px;
}
.canal-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--borda);
  display: flex; align-items: center; justify-content: center;
  color: var(--verde); font-size: 17px; flex-shrink: 0;
}
.canal-info { flex: 1; }
.canal-nome { font-size: 13px; font-weight: 600; color: var(--texto); }
.canal-desc { font-size: 11px; color: var(--texto-3); margin-top: 1px; }

/* Warning */
.notice-warning {
  background: rgba(90,58,0,.2); border: 1px solid #5a3a00;
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px;
}
.notice-warning i { color: #f59e0b; margin-top: 1px; flex-shrink: 0; font-size: 16px; }
.notice-warning-body strong { display: block; font-size: 13px; font-weight: 600; color: #facc15; margin-bottom: 4px; }
.notice-warning-body p { font-size: 12px; color: #f59e0b; line-height: 1.55; }

/* Upgrade */
.upgrade-banner {
  background: var(--verde-light); border: 1px solid rgba(29,158,117,.25);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; align-items: center; gap: 12px; margin-top: 10px;
}
.upgrade-banner i { color: var(--verde); font-size: 20px; flex-shrink: 0; }
.upgrade-banner-info strong { display: block; font-size: 13px; font-weight: 700; color: var(--verde); margin-bottom: 2px; }
.upgrade-banner-info span { font-size: 11px; color: var(--texto-2); }
.btn-upgrade {
  padding: 8px 15px; background: var(--verde); color: #fff;
  border: none; border-radius: var(--radius-sm); font-size: 12px;
  font-weight: 600; cursor: pointer; white-space: nowrap;
}

/* Planos */
.planos-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.plano-card {
  background: var(--card); border: 1px solid var(--borda);
  border-radius: var(--radius); padding: 18px;
}
.plano-card.atual { border: 1.5px solid var(--verde); }
.plano-atual-label { font-size: 10px; font-weight: 700; color: var(--verde); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.plano-nome  { font-size: 15px; font-weight: 700; margin-bottom: 4px; color: var(--texto); }
.plano-preco { font-size: 24px; font-weight: 800; margin-bottom: 2px; color: var(--texto); }
.plano-preco span { font-size: 12px; font-weight: 400; color: var(--texto-3); }
.plano-desc  { font-size: 11px; color: var(--texto-3); margin-bottom: 12px; }
.plano-feat  { font-size: 12px; color: var(--texto-3); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.plano-feat.ok { color: var(--texto-2); }
.plano-feat i { font-size: 13px; }
.btn-plano {
  width: 100%; padding: 9px; border: 1px solid var(--borda);
  border-radius: var(--radius-sm); font-size: 12px; font-weight: 600;
  cursor: pointer; background: var(--surface-1); color: var(--texto); margin-top: 14px;
}
.btn-plano.primary { background: var(--verde); color: #fff; border-color: var(--verde); }

/* List item */
.list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 0; border-bottom: 1px solid var(--borda);
}
.list-item:last-child { border-bottom: none; }

/* Status dot */
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.status-dot.online  { background: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,.2); }
.status-dot.offline { background: #4b4b4b; }

/* Toast */
#toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--surface-2); color: var(--texto); padding: 12px 18px;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  transform: translateY(80px); opacity: 0; transition: all .25s;
  z-index: 9999; box-shadow: var(--shadow-md); max-width: 320px;
  border: 1px solid var(--borda);
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.ok   { background: rgba(34,197,94,.15); border-color: #14532d; color: #4ade80; }
#toast.erro { background: rgba(239,68,68,.15); border-color: #7f1d1d; color: #f87171; }

/* Login */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; background: var(--fundo);
}
.login-box { width: 100%; max-width: 400px; padding: 20px; }
.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo .logo { font-size: 24px; }
.login-logo p { color: var(--texto-3); font-size: 13px; margin-top: 6px; }

/* Onboarding */
.onboarding-wrap {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; background: var(--fundo); padding: 20px;
}
.onboarding-box { width: 100%; max-width: 520px; }
.onboarding-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.steps { display: flex; gap: 6px; align-items: center; }
.step-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--borda); transition: background .2s; }
.step-dot.active { background: var(--verde); }
.step-dot.done   { background: #166534; }
.step-label { font-size: 11px; color: var(--texto-3); margin-left: 8px; }
.step-actions { display: flex; gap: 10px; margin-top: 22px; }

/* Toggle 24h */
.toggle-24h {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-1); border: 1px solid var(--borda);
  border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: 12px;
}
.toggle-24h-info strong { display: block; font-size: 13px; font-weight: 600; color: var(--texto); }
.toggle-24h-info span   { font-size: 11px; color: var(--texto-3); }

/* Chat */
.chat-msgs {
  min-height: 200px; max-height: 320px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 12px; padding: 4px;
}
.chat-msg { max-width: 80%; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; }
.chat-msg.bot  { background: var(--surface-2); color: var(--texto); align-self: flex-start; }
.chat-msg.user { background: var(--verde); color: #fff; align-self: flex-end; }
.chat-input-row { display: flex; gap: 8px; }
.chat-input-row input { flex: 1; }
.chat-seg-label { font-size: 10px; font-weight:700; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-3); margin-bottom: 10px; }

/* Info grid */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Responsivo */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .page-section { padding: 20px 16px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .planos-grid { grid-template-columns: 1fr; }
  /* Grid canais/status no dashboard */
  #sec-dashboard > div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
}

/* ── Mobile: sidebar vira drawer ── */
@media (max-width: 768px) {
  .app { flex-direction: column; }
  .sidebar {
    display: flex !important;
    position: fixed; left: 0; top: 0; height: 100vh;
    transform: translateX(-100%); transition: transform .25s;
    z-index: 200; width: 240px;
    flex-direction: column;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.6); z-index: 199;
  }
  .sidebar-overlay.open { display: block; }
  .main { margin-left: 0; }
  .page-section { padding: 16px; }
  .section-header { margin: -16px -16px 16px -16px; padding: 12px 16px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .planos-grid { grid-template-columns: 1fr; }
  /* Grid canais/status no dashboard */
  #sec-dashboard > div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  /* Top nav mobile */
  .mob-topnav {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 16px; background: var(--card);
    border-bottom: 1px solid var(--borda);
    position: sticky; top: 0; z-index: 100;
  }
}
@media (min-width: 769px) {
  .mob-topnav { display: none; }
  .sidebar-overlay { display: none !important; }
}

