:root {
  --bg: #f7f7f5;
  --panel: #ffffff;
  --sidebar: #10110f;
  --sidebar-soft: #1a1b18;
  --ink: #171814;
  --muted: #74766f;
  --line: #e8e9e4;
  --accent: #b9f227;
  --accent-dark: #496800;
  --purple: #8574f5;
  --shadow: 0 12px 35px rgba(25, 27, 20, .08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-width: 320px; min-height: 100%; }

body { overflow: hidden; }

button, a { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  height: 100dvh;
  background: var(--bg);
  transition: grid-template-columns .25s ease;
}

.sidebar {
  position: relative;
  z-index: 30;
  display: flex;
  min-width: 0;
  flex-direction: column;
  color: #fff;
  background: var(--sidebar);
  overflow: hidden;
  transition: width .25s ease, transform .25s ease;
}

.brand-row {
  height: 76px;
  padding: 0 15px 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex: 0 0 auto;
}

.brand {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #15170f;
  background: var(--accent);
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35);
}

.brand-copy, .nav-copy, .company-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  white-space: nowrap;
  opacity: 1;
  transition: opacity .15s ease;
}

.brand-copy strong { font-family: Georgia, serif; font-size: 16px; letter-spacing: -.01em; }
.brand-copy small { margin-top: 2px; color: #8c8f86; font-size: 10px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #62655d;
  background: #fff;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease, transform .15s ease;
}

.icon-button:hover { color: var(--ink); border-color: #cfd1c9; background: #fafaf8; }
.icon-button:active { transform: scale(.96); }
.icon-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.sidebar-toggle {
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  color: #92958c;
  border-color: rgba(255,255,255,.1);
  background: rgba(255,255,255,.05);
}

.sidebar-toggle:hover { color: #fff; border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.08); }

.navigation { padding: 24px 12px; flex: 1; }

.nav-label {
  margin: 0 10px 10px;
  color: #666a60;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav-item {
  position: relative;
  width: 100%;
  height: 58px;
  margin-bottom: 6px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #a9aca3;
  background: transparent;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: color .18s ease, background .18s ease;
}

.nav-item:hover { color: #f2f3ee; background: rgba(255,255,255,.05); }
.nav-item.active { color: #fff; background: var(--sidebar-soft); }

.nav-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #bcc0b5;
  background: rgba(255,255,255,.06);
}

.nav-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.active .nav-icon-gerador { color: #1d2508; background: var(--accent); }
.active .nav-icon-notas { color: #fff; background: var(--purple); }

.nav-copy { flex: 1; }
.nav-copy strong { color: inherit; font-size: 13px; font-weight: 650; }
.nav-copy small { margin-top: 3px; color: #6f7369; font-size: 11px; }
.active .nav-copy small { color: #9da096; }

.active-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: transparent;
}

.active .active-dot { background: var(--accent); box-shadow: 0 0 0 3px rgba(185,242,39,.1); }

.sidebar-footer {
  min-height: 70px;
  margin: 0 12px 12px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.025);
  overflow: hidden;
}

.company-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #d7d9d2;
  background: #2a2c27;
  font-size: 10px;
  font-weight: 800;
}

.company-copy { flex: 1; }
.company-copy strong { font-size: 11px; }
.company-copy small { margin-top: 3px; color: #6f7369; font-size: 10px; }

.status-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; background: #72d95b; box-shadow: 0 0 0 3px rgba(114,217,91,.09); }

.workspace { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 76px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
  background: rgba(247,247,245,.94);
}

.topbar-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-title h1 { margin: 3px 0 0; font-size: 19px; line-height: 1.15; letter-spacing: -.025em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eyebrow { margin: 0; color: #92958d; font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.live-badge {
  height: 28px;
  padding: 0 10px;
  border: 1px solid #dfe5d9;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #50713d;
  background: #f7fcf3;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.live-badge span { width: 6px; height: 6px; border-radius: 50%; background: #68bd4d; }
.mobile-menu { display: none; }

.app-stage {
  position: relative;
  min-height: 0;
  flex: 1;
  margin: 0;
  background: #fff;
  overflow: hidden;
}

.app-frame { width: 100%; height: 100%; border: 0; display: block; background: #fff; opacity: 0; transition: opacity .18s ease; }
.app-frame.loaded { opacity: 1; }

.loading-state, .error-state {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: #fbfbf9;
}

.loading-state strong { margin-top: 17px; color: #34362f; font-size: 13px; }
.loading-state small { margin-top: 5px; font-size: 11px; }

.loading-mark {
  position: relative;
  width: 39px;
  height: 39px;
  border: 2px solid #e3e5de;
  border-top-color: var(--accent-dark);
  border-radius: 50%;
  animation: rotate .8s linear infinite;
}

.loading-mark span { position: absolute; inset: 9px; border-radius: 50%; background: var(--accent); }
@keyframes rotate { to { transform: rotate(360deg); } }

.error-state[hidden], .loading-state[hidden] { display: none; }
.error-state { text-align: center; }
.error-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: #a04638; background: #fff0ed; }
.error-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.error-state h2 { margin: 16px 0 6px; color: var(--ink); font-size: 16px; }
.error-state p { margin: 0; font-size: 12px; }
.error-state button { margin-top: 18px; padding: 9px 14px; border: 0; border-radius: 9px; color: #1d2508; background: var(--accent); font-size: 12px; font-weight: 750; cursor: pointer; }

.sidebar-backdrop { display: none; }

.app-shell.collapsed { grid-template-columns: 76px minmax(0, 1fr); }
.collapsed .brand-row { padding-inline: 20px; }
.collapsed .brand-copy, .collapsed .nav-copy, .collapsed .company-copy, .collapsed .nav-label, .collapsed .active-dot, .collapsed .sidebar-toggle { opacity: 0; pointer-events: none; }
.collapsed .brand { flex: 0 0 auto; }
.collapsed .navigation { padding-inline: 11px; }
.collapsed .nav-item { padding-inline: 10px; }
.collapsed .sidebar-footer { padding: 9px; min-height: 54px; }

@media (max-width: 760px) {
  .app-shell, .app-shell.collapsed { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, 86vw); transform: translateX(-101%); box-shadow: 20px 0 50px rgba(0,0,0,.25); }
  .app-shell.menu-open .sidebar { transform: translateX(0); }
  .sidebar-toggle { display: none; }
  .workspace { height: 100dvh; }
  .topbar { height: 68px; padding: 0 13px; }
  .mobile-menu { display: grid; }
  .topbar-title h1 { font-size: 16px; }
  .eyebrow { font-size: 9px; }
  .live-badge { display: none; }
  .topbar-actions .icon-button { width: 34px; height: 34px; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 25; width: 100%; border: 0; background: rgba(0,0,0,.42); opacity: 0; pointer-events: none; display: block; transition: opacity .2s ease; }
  .app-shell.menu-open + .sidebar-backdrop { opacity: 1; pointer-events: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

