:root {
  color-scheme: dark;
  --bg: #1c1b22;
  --bg-2: #15141a;
  --bg-3: #0f0e13;
  --surface: #232229;
  --surface-2: #2a2932;
  --border: rgba(255,255,255,.08);
  --border-strong: rgba(255,255,255,.14);
  --fg: #e7e7ea;
  --fg-2: #a1a1aa;
  --fg-3: #71717a;
  --acc: #7c5cff;
  --acc-2: #22d3ee;
  --acc-3: #f472b6;
  --ok: #22c55e;
  --warn: #eab308;
  --err: #ef4444;
  --shadow: 0 4px 24px rgba(0,0,0,.4);
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

.studio {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: 56px 1fr;
  grid-template-areas: "side head" "side main";
  height: 100vh;
  overflow: hidden;
}
.studio .sidebar { grid-area: side; }
.studio .header  { grid-area: head; }
.studio .main    { grid-area: main; overflow: hidden; }

.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 3px; }

.sb-brand {
  padding: 4px 16px 16px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.sb-brand svg { width: 26px; height: 26px; color: var(--acc); }
.sb-brand .name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }

.sb-group {
  padding: 12px 12px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--fg-3);
  font-weight: 600;
}

.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  margin: 1px 8px;
  color: var(--fg-2);
  text-decoration: none;
  font-size: 13px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 80ms, color 80ms;
  border: none;
  background: transparent;
  width: calc(100% - 16px);
  text-align: left;
}
.sb-item .ico { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.sb-item .label { flex: 1; }
.sb-item .badge {
  font-size: 9px;
  background: var(--acc);
  color: white;
  padding: 1px 5px;
  border-radius: 999px;
  font-weight: 700;
}
.sb-item:hover { background: var(--surface); color: var(--fg); }
.sb-item.active {
  background: linear-gradient(90deg, rgba(124,92,255,.18), transparent);
  color: var(--fg);
  border-left: 2px solid var(--acc);
  padding-left: 12px;
}

.header {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.header h1 {
  font-size: 16px;
  margin: 0;
  font-weight: 600;
  display: flex; align-items: center; gap: 10px;
}
.header h1 .ico { font-size: 20px; }
.header h1 .desc { color: var(--fg-3); font-size: 12px; font-weight: 400; margin-left: 8px; }

.head-actions { display: flex; align-items: center; gap: 12px; }
.head-actions .credit {
  font-size: 12px;
  background: var(--surface);
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--fg-2);
  border: 1px solid var(--border);
}
.head-actions .credit strong { color: var(--fg); }
.head-actions .user {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--acc), var(--acc-3));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: white;
  cursor: pointer;
}

.main {
  display: grid;
  grid-template-columns: 320px 1fr 280px;
  height: 100%;
}
.main.no-right { grid-template-columns: 320px 1fr; }
.main.full { grid-template-columns: 1fr; }

.panel-left, .panel-right {
  background: var(--bg-2);
  overflow-y: auto;
  padding: 20px;
}
.panel-left { border-right: 1px solid var(--border); }
.panel-right { border-left: 1px solid var(--border); }
.panel-center {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.field { margin-bottom: 18px; }
.field label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--fg-2);
  margin-bottom: 6px;
  font-weight: 500;
}
.field label .hint { color: var(--fg-3); font-weight: 400; font-size: 11px; }

.field input[type="text"], .field input[type="number"], .field input[type="file"], .field textarea, .field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  transition: border-color 120ms;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--acc);
}
.field textarea { resize: vertical; min-height: 80px; font-family: inherit; line-height: 1.5; }
.field .row { display: flex; gap: 8px; }
.field .row > * { flex: 1; }

.field input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  background: transparent;
  margin: 8px 0 4px;
}
.field input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; background: var(--surface-2); border-radius: 2px;
}
.field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px;
  background: var(--acc);
  border-radius: 50%;
  margin-top: -6px;
  box-shadow: 0 0 0 4px rgba(124,92,255,.15);
  cursor: pointer;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background 100ms, border-color 100ms, transform 60ms;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: scale(.98); }
.btn.primary {
  background: linear-gradient(135deg, var(--acc), #6b4eef);
  border-color: transparent;
  color: white;
}
.btn.primary:hover { background: linear-gradient(135deg, #8b6fff, #7c5cff); }
.btn.primary:disabled { opacity: .5; cursor: not-allowed; }
.btn.danger { color: var(--err); border-color: rgba(239,68,68,.3); }
.btn.danger:hover { background: rgba(239,68,68,.08); }
.btn.icon-only { padding: 8px; width: 36px; }
.btn.block { width: 100%; padding: 12px; font-size: 14px; }

.output-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--fg-3);
  text-align: center;
  padding: 40px;
}
.output-empty .ico { font-size: 64px; margin-bottom: 16px; opacity: .4; }
.output-empty h3 { font-size: 18px; color: var(--fg-2); margin: 0 0 6px; font-weight: 500; }
.output-empty p { font-size: 13px; max-width: 400px; line-height: 1.6; }

.toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 12px 18px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--fg);
  font-size: 13px;
  opacity: 0; transform: translateY(10px);
  transition: all 220ms;
  z-index: 100;
  max-width: 360px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { border-left: 3px solid var(--ok); }
.toast.err { border-left: 3px solid var(--err); }

.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--acc);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* SCROLLBARS visíveis (global) */
* { scrollbar-width: auto; scrollbar-color: #7c5cff #15141a; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #15141a; border-radius: 5px; }
::-webkit-scrollbar-thumb { background: rgba(124,92,255,.45); border-radius: 5px; border: 2px solid #15141a; }
::-webkit-scrollbar-thumb:hover { background: rgba(124,92,255,.7); }

/* Garantir scroll funcional em main areas */
.main, .panel-center, .panel-left, .panel-right { overflow-y: auto !important; }

/* MOBILE: hamburger button + sidebar drawer */
.sb-hamburger {
  display: none; background: transparent; border: 0;
  color: var(--fg, #fff); font-size: 24px; cursor: pointer;
  padding: 6px 10px; border-radius: 5px; margin-right: 6px;
  align-self: center; flex-shrink: 0;
}
.sb-hamburger:hover { background: rgba(255,255,255,.06); }
.sb-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 90;
  display: none; backdrop-filter: blur(2px);
}
.sb-backdrop.open { display: block; }

@media (max-width: 1024px) {
  .main { grid-template-columns: 280px 1fr; }
  .main .panel-right { display: none; }
}

@media (max-width: 900px) {
  .studio { grid-template-columns: 1fr; grid-template-areas: "head" "main"; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 270px; max-width: 80vw;
    z-index: 100; transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 8px 0 28px rgba(0,0,0,.55);
  }
  .sidebar.open { transform: translateX(0); }
  .sb-hamburger { display: inline-block; }
  .header {
    grid-column: 1; padding: 10px 14px;
    display: flex; align-items: center; gap: 8px;
    position: sticky; top: 0; z-index: 50;
  }
  .header h1 { font-size: 15px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .header h1 .ico { font-size: 18px; margin-right: 6px; }
  .header h1 .desc { display: none; }
  .head-actions { gap: 6px; flex-shrink: 0; }
  .head-actions .credit { font-size: 11px; padding: 4px 8px; }
  .head-actions .credit strong { font-size: 11px; }
  .head-actions .user { width: 32px; height: 32px; font-size: 13px; }
  .main { grid-template-columns: 1fr; }
  .main .panel-left, .main .panel-right { display: none; }
  .panel-center { padding: 14px; }
}

@media (max-width: 480px) {
  .header h1 { font-size: 14px; }
  .sb-hamburger { font-size: 22px; padding: 5px 8px; }
}

/* ============================================================
 * MOBILE FIX v2026-05-27 — Roger confirmou aplicar
 * Override agressivo pra forçar 1-col em viewports <= 780px.
 * Sobrepõe styles inline em translate.html, personas, etc.
 * ============================================================ */
@media (max-width: 780px) {
  body > .studio,
  html .studio {
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-template-rows: 56px 1fr !important;
    grid-template-areas: "head" "main" !important;
    width: 100vw !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
  .studio > .sidebar,
  .studio aside.sidebar,
  body .studio .sidebar {
    position: fixed !important;
    left: 0 !important; top: 0 !important; bottom: 0 !important;
    width: 280px !important; max-width: 80vw !important;
    z-index: 1000 !important;
    transform: translateX(-100%) !important;
    transition: transform .25s ease !important;
    box-shadow: 8px 0 28px rgba(0,0,0,.55) !important;
    grid-area: unset !important;
    grid-row: unset !important;
    grid-column: unset !important;
  }
  .studio > .sidebar.open,
  body .studio .sidebar.open {
    transform: translateX(0) !important;
  }
  .studio > .header,
  body .studio .header,
  body .studio header.header {
    grid-area: head !important;
    grid-column: 1 !important;
    grid-row: 1 !important;
  }
  .studio > main,
  .studio > main.host,
  body .studio main {
    grid-area: main !important;
    grid-column: 1 !important;
    grid-row: 2 !important;
    width: 100% !important;
    max-width: 100vw !important;
  }
  /* Hide floater bots in mobile */
  .sx-floater, .floater-bot, .salix-assistant-floater,
  [data-role="floater"], [data-widget="bot-floater"],
  #sx-floater, #salix-bot-floater,
  #salix-provider-chip,
  .copilot-floater, .ai-floater,
  .bot-fab, .floating-bot {
    display: none !important;
  }
}
