/* ==========================================================
   AUTOMAZA · app.css
   ========================================================== */
:root{
  --bg:#0b0f1a; --surface:#121827; --card:#161d2f; --card-2:#1a2238;
  --border:#1f2a40; --border-2:#2a3654; --muted:#8a94ad; --text:#e8ecf5;
  --accent:#6366f1; --accent-2:#8b5cf6; --pink:#ec4899; --emerald:#10b981;
  --sb-width:240px;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
html{scroll-behavior:smooth}
body{
  font-family:'Inter',ui-sans-serif,system-ui,sans-serif;
  color:var(--text); min-height:100vh;
  padding-left:var(--sb-width); transition:padding-left .25s ease;
  display:flex; flex-direction:column;
  background:
    radial-gradient(1200px 600px at 10% -10%,rgba(99,102,241,.18),transparent 60%),
    radial-gradient(900px 500px at 100% 0%,rgba(236,72,153,.12),transparent 60%),
    radial-gradient(900px 500px at 50% 100%,rgba(16,185,129,.10),transparent 60%),
    var(--bg);
}
main.wrap{flex:1 0 auto}
body.sb-collapsed{ --sb-width:0px; }
::selection{background:rgba(99,102,241,.35);color:#fff}
::-webkit-scrollbar{width:8px;height:8px}
::-webkit-scrollbar-track{background:var(--bg)}
::-webkit-scrollbar-thumb{background:var(--border);border-radius:10px}
::-webkit-scrollbar-thumb:hover{background:var(--border-2)}
a{color:inherit}

/* =============== SIDEBAR =============== */
#sidebar{
  position:fixed; top:0; left:0; bottom:0; width:240px; z-index:100;
  background:rgba(11,15,26,.95);
  backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px);
  border-right:1px solid var(--border);
  display:flex; flex-direction:column;
  transform:translateX(0); transition:transform .25s ease;
}
body.sb-collapsed #sidebar{ transform:translateX(-240px); }

#sb-head{
  display:flex; align-items:center; gap:10px;
  padding:14px 16px; border-bottom:1px solid var(--border);
  text-decoration:none; color:var(--text);
}
#sb-head img{width:30px;height:30px;object-fit:contain}
#sb-head .t{font-weight:800;font-size:14px;line-height:1.1;letter-spacing:-.01em}
#sb-head .s{font-size:10px;color:var(--muted);line-height:1.1;margin-top:2px}

#sb-home{
  display:flex; align-items:center; justify-content:center; gap:6px;
  margin:8px 10px 6px; padding:9px;
  background:rgba(99,102,241,.12); border:1px solid rgba(99,102,241,.3);
  border-radius:9px; color:#c7d2fe; text-decoration:none;
  font-size:12px; font-weight:700;
  transition:background .15s;
}
#sb-home:hover{background:rgba(99,102,241,.22)}
#sb-home svg{width:14px;height:14px}

#sb-list{flex:1; overflow-y:auto; padding:4px 8px 12px}
#sb-list::-webkit-scrollbar{width:5px}
#sb-list::-webkit-scrollbar-thumb{background:var(--border);border-radius:10px}

/* Grupo colapsável */
.sb-group{margin:2px 0}
.sb-cat-btn{
  width:100%; display:flex; align-items:center; gap:9px;
  padding:9px 10px; border-radius:9px; cursor:pointer;
  background:transparent; border:1px solid transparent;
  color:#c1c9d9; font-family:inherit;
  font-size:12.5px; font-weight:700; letter-spacing:.01em;
  transition:background .15s, color .15s;
  text-align:left;
}
.sb-cat-btn:hover{background:rgba(255,255,255,.04); color:#fff}
.sb-cat-ico{font-size:15px; width:20px; text-align:center; flex-shrink:0}
.sb-cat-label{flex:1}
.sb-cat-count{
  font-size:10px; font-weight:700; color:var(--muted);
  background:rgba(255,255,255,.04); border:1px solid var(--border);
  padding:2px 7px; border-radius:9999px; min-width:22px; text-align:center;
}
.sb-chev{
  width:13px; height:13px; color:var(--muted);
  transition:transform .2s ease;
  flex-shrink:0;
}
.sb-group.open .sb-chev{transform:rotate(90deg); color:var(--text)}
.sb-group.open .sb-cat-btn{background:rgba(99,102,241,.08); color:#fff}
.sb-group.open .sb-cat-count{background:rgba(99,102,241,.15); color:#c7d2fe; border-color:rgba(99,102,241,.3)}

.sb-sub{
  overflow:hidden; max-height:0;
  transition:max-height .25s ease;
  padding-left:8px;
}
.sb-group.open .sb-sub{max-height:1000px}

.sb-link{
  display:flex; align-items:center; gap:9px;
  padding:7px 10px 7px 14px; margin:1px 0; border-radius:8px;
  text-decoration:none; color:#a8b2c7;
  font-size:12px; font-weight:500;
  transition:background .15s, color .15s;
  border:1px solid transparent;
  position:relative;
}
.sb-link::before{
  content:''; position:absolute; left:4px; top:50%; transform:translateY(-50%);
  width:3px; height:3px; border-radius:50%; background:var(--border);
  transition:background .15s;
}
.sb-link:hover{background:rgba(99,102,241,.1); color:#fff}
.sb-link:hover::before{background:var(--accent)}
.sb-link.active{
  background:linear-gradient(135deg,rgba(99,102,241,.22),rgba(139,92,246,.14));
  color:#c7d2fe; border-color:rgba(99,102,241,.35); font-weight:700;
}
.sb-link.active::before{background:var(--pink)}
.sb-link .ic{font-size:13px; width:18px; text-align:center; flex-shrink:0}

#sb-home.active{
  background:linear-gradient(135deg,rgba(99,102,241,.28),rgba(139,92,246,.18));
  border-color:rgba(99,102,241,.5);
}

#sb-toggle{
  position:fixed; top:12px; left:248px; z-index:101;
  width:36px; height:36px; border-radius:10px;
  background:rgba(11,15,26,.9); border:1px solid var(--border); color:var(--text);
  display:inline-flex; align-items:center; justify-content:center;
  cursor:pointer; transition:left .25s ease, background .2s, border-color .2s;
  backdrop-filter:blur(10px);
}
#sb-toggle:hover{background:rgba(99,102,241,.15); border-color:rgba(99,102,241,.4)}
body.sb-collapsed #sb-toggle{left:8px}
#sb-toggle svg{width:16px;height:16px}

/* =============== TOPBAR =============== */
.topbar{
  position:sticky; top:0; z-index:40;
  backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px);
  background:rgba(11,15,26,.75);
  border-bottom:1px solid var(--border);
}
.topbar-inner{
  max-width:1500px; margin:0 auto; padding:10px 28px 10px 56px;
  display:flex; align-items:center; justify-content:space-between; gap:12px;
}
.topbar .crumb{
  display:flex; align-items:center; gap:8px;
  font-size:12px; color:var(--muted);
}
.topbar .crumb .sep{opacity:.4}
.topbar .crumb a{color:var(--muted); text-decoration:none; transition:color .15s}
.topbar .crumb a:hover{color:var(--text)}
.topbar .crumb .current{color:var(--text); font-weight:600}

/* =============== WRAP / HERO =============== */
.wrap{max-width:1500px; margin:0 auto; padding:14px 28px 20px; width:100%; display:flex; flex-direction:column}
.wrap > .card{flex:1; display:flex; flex-direction:column}
.wrap > .card > .grid-2{flex:1}

.hero{text-align:center; margin-bottom:10px}
.hero-chip{
  display:inline-flex; align-items:center; gap:6px;
  padding:3px 10px; border-radius:9999px;
  background:rgba(99,102,241,.12); border:1px solid rgba(99,102,241,.25);
  font-size:11px; font-weight:600; color:#c7d2fe; margin-bottom:6px;
}
.hero-chip .dot{width:5px;height:5px;border-radius:50%;background:var(--emerald);box-shadow:0 0 8px var(--emerald)}
h1.hero-title{
  font-size:clamp(1.35rem,2.2vw,1.9rem); font-weight:800; letter-spacing:-.02em;
  margin:0 0 4px;
  background:linear-gradient(135deg,#fff 0%,#c7d2fe 60%,#f0abfc 100%);
  -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; color:transparent;
}
.hero-sub{color:var(--muted); font-size:13px; max-width:640px; margin:0 auto}
.hero-sub .kbd{
  display:inline-block; padding:1px 7px; margin:0 1px; border-radius:5px;
  background:rgba(99,102,241,.15); color:#c7d2fe; font-weight:700; font-size:11px;
  border:1px solid rgba(99,102,241,.25);
}
.hero-sub .kbd.pink{background:rgba(236,72,153,.15); color:#fbcfe8; border-color:rgba(236,72,153,.25)}

/* =============== CARD =============== */
.card{
  background:linear-gradient(180deg,rgba(255,255,255,.04),rgba(255,255,255,.01)),
             radial-gradient(800px 400px at 100% 0%,rgba(139,92,246,.08),transparent 70%);
  border:1px solid var(--border); border-radius:16px; padding:14px;
  position:relative; overflow:hidden;
  box-shadow:0 20px 60px -30px rgba(0,0,0,.7),0 0 40px -30px rgba(99,102,241,.35),inset 0 1px 0 rgba(255,255,255,.05);
}
.card::before{
  content:''; position:absolute; top:0; left:0; right:0; height:1px;
  background:linear-gradient(90deg,transparent,rgba(99,102,241,.6),rgba(236,72,153,.4),transparent);
}

/* Grid 2 colunas (form | output) */
.grid-2{display:grid; grid-template-columns:1fr; gap:18px; align-items:stretch}
@media (min-width:1024px){.grid-2{grid-template-columns:1fr 1fr; gap:22px}}

.col{display:flex; flex-direction:column; gap:8px; min-width:0}

/* =============== SECTION =============== */
.section{
  background:rgba(255,255,255,.02); border:1px solid var(--border);
  border-radius:12px; padding:10px 12px;
}
.section-title{
  font-size:10px; font-weight:700; color:var(--muted);
  text-transform:uppercase; letter-spacing:.08em; margin:0 0 8px;
  display:flex; align-items:center; gap:6px;
}
.section-title::before{
  content:''; width:3px; height:13px; border-radius:2px;
  background:linear-gradient(180deg,var(--accent),var(--pink));
}

/* =============== FORM =============== */
.field{margin-bottom:10px}
.field:last-child{margin-bottom:0}
.field-label{display:block; font-size:12px; font-weight:600; margin:0 0 3px}
.field-hint{display:block; font-size:10px; color:var(--muted); margin:0 0 5px}
.row-2{display:grid; grid-template-columns:1fr 1fr; gap:10px}
@media(max-width:520px){.row-2{grid-template-columns:1fr}}

input[type=text], input[type=email], input[type=number], input[type=search], input[type=password], textarea{
  width:100%; padding:8px 11px;
  background:var(--card); color:var(--text);
  border:1px solid var(--border); border-radius:8px;
  font-family:inherit; font-size:13px;
  transition:border-color .2s, box-shadow .2s, background .2s;
}
input::placeholder, textarea::placeholder{color:var(--muted); opacity:1}
input:focus, textarea:focus{
  outline:none; border-color:rgba(99,102,241,.6);
  box-shadow:0 0 0 2px rgba(99,102,241,.15);
  background:var(--card-2);
}
textarea{resize:none; font-family:'JetBrains Mono',ui-monospace,monospace; font-size:12px; line-height:1.5}

/* =============== OUTPUT =============== */
.output-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:8px}
.output-head .lbl{font-size:12px; font-weight:600}
.counter{
  font-size:10px; font-weight:700; padding:3px 9px; border-radius:9999px;
  background:rgba(16,185,129,.12); color:#6ee7b7; border:1px solid rgba(16,185,129,.25);
}
.counter.hidden{display:none}
.output-box{
  background:var(--card); border:1px solid var(--border); border-radius:10px;
  padding:0; overflow:hidden;
  display:flex; flex:1; min-height:140px;
}
.output-box textarea{background:transparent; border:none; border-radius:0; flex:1; width:100%; min-height:140px}
.output-box textarea:focus{box-shadow:none; background:transparent}

/* =============== BUTTONS =============== */
.btn-row{display:grid; gap:8px; margin-top:8px}
.btn-row.cols-2{grid-template-columns:1fr 1fr}
.btn-row.cols-3{grid-template-columns:repeat(3,1fr)}
.btn-row.cols-4{grid-template-columns:repeat(4,1fr)}
@media(max-width:480px){.btn-row.cols-2,.btn-row.cols-3,.btn-row.cols-4{grid-template-columns:1fr 1fr}}

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  padding:9px 13px; border-radius:9px; border:none; cursor:pointer;
  font-family:inherit; font-size:13px; font-weight:700; color:#fff;
  transition:transform .15s, filter .2s, box-shadow .2s;
}
.btn:hover{transform:translateY(-1px); filter:brightness(1.1)}
.btn:active{transform:translateY(0); filter:brightness(.95)}
.btn svg{width:15px; height:15px}
.btn-primary{background:linear-gradient(135deg,#4f46e5,#6366f1); box-shadow:0 6px 18px -10px rgba(99,102,241,.6)}
.btn-success{background:linear-gradient(135deg,#059669,#10b981); box-shadow:0 6px 18px -10px rgba(16,185,129,.6)}
.btn-warning{background:linear-gradient(135deg,#d97706,#f59e0b); box-shadow:0 6px 18px -10px rgba(245,158,11,.5); color:#111}
.btn-danger {background:linear-gradient(135deg,#dc2626,#ef4444); box-shadow:0 6px 18px -10px rgba(239,68,68,.5)}
.btn-ghost{background:rgba(99,102,241,.12); border:1px solid rgba(99,102,241,.3); color:#c7d2fe; box-shadow:none}
.btn-ghost:hover{background:rgba(99,102,241,.2)}
.btn-small{padding:7px 10px; font-size:11.5px}

/* =============== UTIL =============== */
.example-box{
  background:var(--card); border:1px solid var(--border); border-radius:9px;
  padding:9px 11px; font-family:'JetBrains Mono',ui-monospace,monospace;
  font-size:11.5px; color:var(--muted); line-height:1.6;
}
.info-box{background:rgba(99,102,241,.08); border:1px solid rgba(99,102,241,.25); border-radius:9px; padding:9px 11px; font-size:12px; margin-top:8px}
.info-box .label{color:#c7d2fe; font-weight:700; font-size:10px; text-transform:uppercase; letter-spacing:.05em; margin-bottom:3px}
.info-box .line{color:var(--text); font-size:12.5px}
.info-box .max{color:#6ee7b7; font-weight:700}
.info-box.error{background:rgba(239,68,68,.08); border-color:rgba(239,68,68,.3)}
.info-box.error .label{color:#fca5a5}
.tips{background:rgba(99,102,241,.06); border:1px solid rgba(99,102,241,.2); border-radius:10px; padding:10px 12px; font-size:11.5px; color:var(--text); margin-top:10px}
.tips .cmd{font-family:'JetBrains Mono',ui-monospace,monospace; font-size:11.5px; color:#c7d2fe; background:var(--card); border:1px solid var(--border); padding:7px 9px; border-radius:7px; margin:6px 0; overflow-x:auto; white-space:nowrap}
.tips ul{margin:4px 0 0; padding-left:16px; color:var(--muted); line-height:1.6}
.placeholder-msg{text-align:center; color:var(--muted); padding:24px 12px; font-size:12.5px}
.mode-tabs{display:grid; grid-template-columns:1fr 1fr; gap:6px; margin-bottom:10px}
.mode-tab{padding:9px 12px; border-radius:9px; border:1px solid var(--border); background:rgba(255,255,255,.02); color:var(--muted); font-family:inherit; font-size:12px; font-weight:700; cursor:pointer; transition:all .2s}
.mode-tab:hover{background:rgba(255,255,255,.05); color:var(--text)}
.mode-tab.active{background:linear-gradient(135deg,rgba(99,102,241,.2),rgba(139,92,246,.15)); border-color:rgba(99,102,241,.5); color:#c7d2fe}
.hidden{display:none}
[hidden]{display:none!important}

/* =============== HOME =============== */
.home-hero{padding:40px 20px 18px; text-align:center}
.home-welcome{
  position:fixed; top:0; right:0; bottom:0;
  left:var(--sb-width);
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding:20px; text-align:center;
  transition:left .25s ease;
}
body.sb-collapsed .home-welcome{left:0}
@media(max-width:900px){.home-welcome{left:0}}

/* Na home, esconde footer e trava scroll */
body:has(.home-welcome){overflow:hidden}
body:has(.home-welcome) .footer{display:none}
body:has(.home-welcome) .wrap{padding:0}
.home-title{
  font-size:clamp(1.8rem,3.4vw,2.8rem); font-weight:800; letter-spacing:-.03em;
  margin:10px 0 8px; line-height:1.05;
}
.home-title .accent{
  background:linear-gradient(135deg,#818cf8 0%,#e879f9 60%,#f472b6 100%);
  -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; color:transparent;
}
.home-sub{color:var(--muted); font-size:15px; max-width:640px; margin:0 auto}
.search-wrap{max-width:560px; margin:22px auto 10px; position:relative}
.search-wrap input{padding-left:38px; padding-top:12px; padding-bottom:12px; font-size:14px; border-radius:12px}
.search-wrap svg{position:absolute; left:13px; top:50%; transform:translateY(-50%); width:16px; height:16px; color:var(--muted)}

.pill-row{display:flex; flex-wrap:wrap; justify-content:center; gap:8px; padding:0 20px 16px}
.pill{
  padding:7px 14px; border-radius:9999px; background:rgba(255,255,255,.03);
  border:1px solid var(--border); color:var(--muted);
  font-size:12px; font-weight:700; cursor:pointer; transition:all .2s;
  display:inline-flex; align-items:center; gap:6px;
}
.pill:hover{background:rgba(255,255,255,.06); color:var(--text); border-color:var(--border-2)}
.pill.active{background:linear-gradient(135deg,#4f46e5,#7c3aed); border-color:transparent; color:#fff; box-shadow:0 6px 18px -8px rgba(124,58,237,.55)}

.home-sections{padding:6px 20px 40px; max-width:1280px; margin:0 auto; display:flex; flex-direction:column; gap:26px}
.home-section-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:12px}
.home-section-head h2{font-size:18px; font-weight:800; letter-spacing:-.01em; margin:0; display:flex; align-items:center; gap:8px}
.home-section-head h2 .emoji{font-size:22px}
.home-section-head .count{font-size:11px; color:var(--muted); background:rgba(255,255,255,.03); border:1px solid var(--border); padding:3px 10px; border-radius:9999px; font-weight:600}

.tool-grid{display:grid; gap:12px; grid-template-columns:repeat(2,1fr)}
@media(min-width:640px){.tool-grid{grid-template-columns:repeat(3,1fr)}}
@media(min-width:1024px){.tool-grid{grid-template-columns:repeat(4,1fr); gap:14px}}
@media(min-width:1280px){.tool-grid{grid-template-columns:repeat(5,1fr)}}

.tool-card{
  position:relative; display:flex; flex-direction:column; gap:4px;
  padding:16px; border-radius:14px;
  background:linear-gradient(180deg,rgba(255,255,255,.04),rgba(255,255,255,.01));
  border:1px solid var(--border); text-decoration:none; color:var(--text);
  transition:transform .2s, border-color .2s, box-shadow .2s, background .2s;
  overflow:hidden;
}
.tool-card::after{
  content:''; position:absolute; inset:0;
  background:radial-gradient(400px 200px at 100% 0%,rgba(99,102,241,.15),transparent 60%);
  opacity:0; transition:opacity .25s;
  pointer-events:none;
}
.tool-card:hover{transform:translateY(-2px); border-color:rgba(99,102,241,.4); box-shadow:0 10px 30px -15px rgba(0,0,0,.6),0 0 25px -10px rgba(99,102,241,.35)}
.tool-card:hover::after{opacity:1}
.tool-card .ico{font-size:22px; margin-bottom:4px}
.tool-card .name{font-weight:700; font-size:13.5px; letter-spacing:-.005em}
.tool-card .desc{font-size:11px; color:var(--muted); line-height:1.4}

.empty-msg{text-align:center; padding:40px 20px; color:var(--muted); font-size:13px}

/* Cards de stats na home */
.home-stats{
  max-width:1200px; margin:0 auto; padding:10px 20px 40px;
  display:grid; gap:14px;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
}
.stat-card{
  display:flex; align-items:center; gap:14px;
  padding:16px 18px; border-radius:14px;
  background:linear-gradient(180deg,rgba(255,255,255,.04),rgba(255,255,255,.01));
  border:1px solid var(--border); text-decoration:none; color:var(--text);
  transition:transform .2s, border-color .2s, box-shadow .2s;
}
.stat-card:hover{
  transform:translateY(-2px);
  border-color:rgba(99,102,241,.4);
  box-shadow:0 10px 30px -15px rgba(0,0,0,.6), 0 0 25px -10px rgba(99,102,241,.35);
}
.stat-icon{
  width:44px; height:44px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  font-size:22px; border-radius:11px;
  background:linear-gradient(135deg,rgba(99,102,241,.2),rgba(139,92,246,.12));
  border:1px solid rgba(99,102,241,.25);
}
.stat-body{min-width:0}
.stat-label{font-weight:700; font-size:14px; letter-spacing:-.01em}
.stat-count{font-size:11px; color:var(--muted); margin-top:2px}

/* =============== FOOTER =============== */
.footer{
  text-align:center; padding:14px; color:var(--muted); font-size:11px;
  border-top:1px solid var(--border);
  flex-shrink:0;
}

/* =============== MOBILE =============== */
@media(max-width:900px){
  body{padding-left:0!important}
  #sidebar{transform:translateX(-240px); box-shadow:8px 0 40px rgba(0,0,0,.5)}
  body.sb-open #sidebar{transform:translateX(0)}
  #sb-toggle{left:8px!important}
  body.sb-open #sb-toggle{left:248px!important}
  .topbar-inner{padding:10px 16px 10px 56px}
}
@media(max-width:640px){
  .wrap{padding:12px 12px 20px}
  .card{padding:14px; border-radius:14px}
  .home-hero{padding:20px 14px 10px}
  .home-sections{padding:0 14px 30px}
}
