:root {
  --bg: #14110e;
  --bg-soft: #1d1915;
  --card: #221d18;
  --ink: #f5f1ea;
  --muted: #9c8e7d;
  --line: #3a322a;
  --accent: #c8a96a;
  --accent-ink: #14110e;
  --ok: #5fb37a;
  --off: #c25b4a;
  --radius: 16px;
  --shadow: 0 20px 60px rgba(0,0,0,.45);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1200px 600px at 80% -10%, #2a231c 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, #241d33 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
.loading { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

/* ---------- AUTH / CARD ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 24px; }
.card { width: 100%; max-width: 380px; background: linear-gradient(180deg, var(--card), var(--bg-soft)); border: 1px solid var(--line); border-radius: var(--radius); padding: 34px 30px 26px; box-shadow: var(--shadow); }
.card-wide { max-width: 480px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.brand.small { margin-bottom: 18px; }
.logo { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 22px; color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), #e7cd97); }
.brand h1 { font-size: 26px; letter-spacing: -.5px; font-weight: 800; }
.tagline { color: var(--muted); font-size: 14px; margin-bottom: 22px; line-height: 1.4; }

.tabs { display: flex; gap: 8px; margin-bottom: 18px; background: #1a1611; padding: 4px; border-radius: 10px; }
.tab { flex: 1; padding: 9px; border: none; background: transparent; color: var(--muted); font-family: inherit; font-size: 13px; font-weight: 600; border-radius: 7px; cursor: pointer; }
.tab.active { background: var(--card); color: var(--ink); }

.form { display: flex; flex-direction: column; gap: 13px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.row { display: flex; gap: 12px; }
.row label { flex: 1; }
input, textarea, select {
  background: #1a1611; border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px;
  color: var(--ink); font-size: 15px; font-family: inherit; width: 100%; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(200,169,106,.15); }

.btn-primary { background: linear-gradient(135deg, var(--accent), #e7cd97); color: var(--accent-ink); border: none; border-radius: 10px; padding: 12px 16px; font-size: 15px; font-weight: 700; font-family: inherit; cursor: pointer; transition: transform .08s, filter .15s; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 11px 16px; font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer; }
.btn-ghost:hover { border-color: var(--accent); }

.form-erro { color: var(--off); font-size: 13px; min-height: 16px; }
.hint { margin-top: 16px; font-size: 12px; color: var(--muted); text-align: center; }
.foot { color: #6b5f50; font-size: 12px; text-align: center; }

/* ---------- WIZARD ---------- */
.steps { display: flex; gap: 8px; justify-content: center; margin-bottom: 20px; }
.dotstep { width: 34px; height: 5px; border-radius: 3px; background: var(--line); }
.dotstep.on { background: var(--accent); }
.wizard h2 { font-size: 19px; margin-bottom: 4px; }
.wizard .sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.wizard label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 13px; }
.wizard-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; }
.nota { color: var(--muted); font-size: 13px; line-height: 1.5; margin-top: 8px; }

.paletas { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.paleta { display: flex; align-items: center; gap: 12px; background: #1a1611; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; font-family: inherit; color: var(--ink); font-size: 14px; }
.paleta:hover { border-color: var(--accent); }
.paleta.sel { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(200,169,106,.15); }
.paleta .sw { display: flex; gap: 4px; }
.paleta .sw i { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(255,255,255,.15); }
.upload-box { background: #1a1611; border: 1px dashed var(--line); border-radius: 12px; padding: 14px; color: var(--muted); font-size: 13px; }

.conn { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.conn-item { display: flex; align-items: center; justify-content: space-between; background: #1a1611; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.conn-item small { color: var(--muted); }
.badge { font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 20px; text-transform: lowercase; }
.badge.on { background: rgba(95,179,122,.18); color: var(--ok); }
.badge.off { background: rgba(156,142,125,.18); color: var(--muted); }

/* ---------- SHELL ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: linear-gradient(180deg, var(--bg-soft), var(--bg)); border-right: 1px solid var(--line); padding: 22px 16px; display: flex; flex-direction: column; gap: 6px; }
.side .brand { padding: 0 8px 14px; }
.side nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.navitem { display: flex; align-items: center; gap: 11px; background: transparent; border: none; color: var(--muted); font-family: inherit; font-size: 14.5px; font-weight: 600; padding: 11px 12px; border-radius: 10px; cursor: pointer; text-align: left; width: 100%; }
.navitem span { font-size: 16px; width: 20px; }
.navitem:hover { background: #1a1611; color: var(--ink); }
.navitem.active { background: #1a1611; color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }
.navitem.logout { color: #8a7a68; }

.main { display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 22px 30px; border-bottom: 1px solid var(--line); }
.topbar h2 { font-size: 20px; }
.who { color: var(--muted); font-size: 14px; }
.content { padding: 26px 30px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.cardbox { background: linear-gradient(180deg, var(--card), var(--bg-soft)); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 16px; }
.cardbox h3 { font-size: 16px; margin-bottom: 10px; }
.cardbox p { color: var(--muted); font-size: 14px; line-height: 1.5; margin-bottom: 14px; }
.cardbox label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 13px; }
.cardbox b.ok { color: var(--ok); } .cardbox b.pend { color: var(--accent); }
.empty { text-align: center; padding: 44px 22px; }
.empty .emoji { font-size: 40px; margin-bottom: 10px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 11px 10px; border-bottom: 1px solid #2a241d; }

/* ---------- TOAST ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--card); border: 1px solid var(--line); color: var(--ink); padding: 12px 20px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); opacity: 0; transition: all .3s; z-index: 100; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-off { border-color: var(--off); }

/* ---------- PREVIEW DO CARROSSEL ---------- */
.prev-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.lbl { font-size: 13px; color: var(--muted); margin: 16px 0 8px; }
.slides { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 12px; }
.slide {
  flex: 0 0 220px; width: 220px; aspect-ratio: 4/5;
  background: #f5f1ea; color: #2e2a27; border-radius: 14px; padding: 22px 18px;
  display: flex; flex-direction: column; gap: 10px; position: relative;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.slide-num { position: absolute; top: 12px; right: 14px; font-size: 12px; font-weight: 700; color: #a98f73; }
.slide-titulo { font-size: 19px; font-weight: 800; line-height: 1.2; letter-spacing: -.3px; }
.slide-texto { font-size: 13.5px; line-height: 1.5; color: #4a443d; overflow-y: auto; }
.legenda { background: #1a1611; border: 1px solid var(--line); border-radius: 10px; padding: 14px; font-family: inherit; font-size: 13.5px; line-height: 1.6; color: var(--ink); white-space: pre-wrap; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { background: rgba(200,169,106,.12); color: var(--accent); font-size: 12px; padding: 4px 9px; border-radius: 20px; }
.alt { color: var(--muted); font-size: 13px; margin-top: 12px; }
.alt b { color: var(--ink); }
.acoes { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.spin { display: inline-block; width: 13px; height: 13px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: girar .7s linear infinite; vertical-align: middle; margin-right: 6px; }
@keyframes girar { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; flex-wrap: wrap; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
}
