/* Shell v2 — casca escura (menu + barra superior) com área de conteúdo clara.
   Todas as telas já suportam [data-theme="light"], então a área de conteúdo só recebe
   esse atributo (shell-v2.js) e cada tela passa a aparecer clara sem reescrever nada. */

body.shell-v2 {
  --sh-bg: #071a24;
  --sh-bg2: #0a2630;
  --sh-line: rgba(148, 197, 190, .14);
  --sh-text: #d5e6e6;
  --sh-muted: #7fa3a8;
  --sh-green: #16a86e;
  --sh-green2: #22d3a0;
  --sh-cyan: #22d3ee;
  background: radial-gradient(900px 500px at 15% -10%, rgba(34, 211, 160, .10), transparent 60%), radial-gradient(800px 500px at 100% 0, rgba(34, 211, 238, .08), transparent 60%), var(--sh-bg);
}
body.shell-v2 .app-container { background: transparent; gap: 0; }

/* ---------- Menu lateral ---------- */
body.shell-v2 .sidebar {
  width: 262px; min-width: 262px;
  background: linear-gradient(180deg, rgba(10, 38, 48, .96), rgba(7, 26, 36, .98));
  border-right: 1px solid var(--sh-line);
  color: var(--sh-text);
}
body.shell-v2 .sidebar .sidebar-header { border-bottom: 1px solid var(--sh-line) !important; padding: 18px 16px !important; }
body.shell-v2 .sidebar #providerBrandName { color: #fff; font-size: 1.05rem !important; letter-spacing: -.02em; }
body.shell-v2 .sidebar .btn-toggle-sidebar { color: var(--sh-muted); }
body.shell-v2 .sidebar-nav { padding: 10px 12px 8px; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: rgba(148, 197, 190, .25) transparent; }
body.shell-v2 .sidebar-nav .nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }

body.shell-v2 .sidebar .nav-item {
  display: flex; align-items: center; gap: 11px; margin: 0; padding: 10px 12px; border-radius: 10px;
  color: var(--sh-text); font-size: .86rem; font-weight: 600; cursor: pointer; border: 0; background: transparent;
  transition: background .18s ease, color .18s ease;
}
body.shell-v2 .sidebar .nav-item .material-icons { font-size: 19px; color: var(--sh-muted); }
body.shell-v2 .sidebar .nav-item:hover { background: rgba(34, 211, 160, .08); color: #fff; }
body.shell-v2 .sidebar .nav-item.active {
  background: linear-gradient(90deg, var(--sh-green), #19b97a); color: #fff; box-shadow: 0 8px 22px -12px rgba(22, 168, 110, .9);
}
body.shell-v2 .sidebar .nav-item.active .material-icons { color: #fff; }
body.shell-v2 .sidebar .nav-item.active::before { display: none; }

/* grupos com submenu */
body.shell-v2 .nav-group { list-style: none; }
body.shell-v2 .nav-group-head {
  width: 100%; display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; border: 0; background: transparent;
  color: var(--sh-text); font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; text-align: left;
}
body.shell-v2 .nav-group-head:hover { background: rgba(34, 211, 160, .08); color: #fff; }
body.shell-v2 .nav-group-icon { font-size: 19px; color: var(--sh-muted); }
body.shell-v2 .nav-group-label { flex: 1; }
body.shell-v2 .nav-group-chev { font-size: 18px; color: var(--sh-muted); transition: transform .2s ease; }
body.shell-v2 .nav-group.open > .nav-group-head .nav-group-chev { transform: rotate(180deg); }
body.shell-v2 .nav-group.has-active > .nav-group-head { color: #fff; }
body.shell-v2 .nav-group.has-active > .nav-group-head .nav-group-icon { color: var(--sh-green2); }
body.shell-v2 .nav-sub { list-style: none; margin: 2px 0 4px 18px; padding: 0 0 0 10px; border-left: 1px solid var(--sh-line); display: none; gap: 2px; }
body.shell-v2 .nav-group.open > .nav-sub { display: grid; }
body.shell-v2 .sidebar .nav-subitem { padding: 8px 10px; font-size: .82rem; font-weight: 500; }
body.shell-v2 .sidebar .nav-subitem .material-icons { font-size: 17px; }

/* rodapé do menu */
body.shell-v2 .sb-footer { padding: 10px 12px 14px; border-top: 1px solid var(--sh-line); display: grid; gap: 8px; }
body.shell-v2 .sb-card { padding: 12px; border-radius: 14px; border: 1px solid rgba(34, 211, 160, .28); background: linear-gradient(140deg, rgba(22, 168, 110, .18), rgba(34, 211, 238, .08)); }
body.shell-v2 .sb-card-top { display: flex; gap: 10px; align-items: center; }
body.shell-v2 .sb-card-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: linear-gradient(135deg, var(--sh-green), var(--sh-cyan)); color: #04241c; font-size: 20px; }
body.shell-v2 .sb-card strong { display: block; color: #fff; font-size: .9rem; }
body.shell-v2 .sb-card small { color: var(--sh-green2); font-size: .72rem; font-weight: 600; }
body.shell-v2 .sb-card p { margin: 8px 0 10px; color: var(--sh-muted); font-size: .74rem; line-height: 1.4; }
body.shell-v2 .sb-card-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px; border-radius: 9px; border: 0; cursor: pointer; font: inherit; font-size: .78rem; font-weight: 700; color: #04241c; background: linear-gradient(90deg, var(--sh-green2), var(--sh-cyan)); }
body.shell-v2 .sb-card-btn .material-icons { font-size: 16px; }
body.shell-v2 .sb-logout .nav-item { color: #f59d9d; }
body.shell-v2 .sb-logout .nav-item .material-icons, body.shell-v2 .sb-logout .nav-item span { color: #f59d9d !important; }

/* ---------- Corpo (barra superior + conteúdo) ---------- */
body.shell-v2 .app-body { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; padding: 0 14px 14px 0; }
body.shell-v2 .topbar { height: 68px; flex-shrink: 0; display: flex; align-items: center; gap: 16px; padding: 0 6px 0 18px; }
body.shell-v2 .tb-search { position: relative; flex: 1; max-width: 620px; display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--sh-line); background: rgba(255, 255, 255, .05); color: var(--sh-muted); }
body.shell-v2 .tb-search:focus-within { border-color: rgba(34, 211, 160, .55); background: rgba(255, 255, 255, .08); }
body.shell-v2 .tb-search input { flex: 1; min-width: 0; border: 0 !important; outline: 0 !important; box-shadow: none !important; background: transparent !important; color: #fff !important; font: inherit; font-size: .88rem; padding: 0 !important; height: auto !important; }
body.shell-v2 .tb-search input::placeholder { color: var(--sh-muted); }
body.shell-v2 .tb-search kbd { font: inherit; font-size: .68rem; padding: 3px 7px; border-radius: 6px; border: 1px solid var(--sh-line); color: var(--sh-muted); }
body.shell-v2 .tb-results { position: absolute; top: 48px; left: 0; right: 0; z-index: 500; padding: 6px; border-radius: 12px; border: 1px solid var(--sh-line); background: #0b2531; box-shadow: 0 20px 40px -20px rgba(0, 0, 0, .8); }
body.shell-v2 .tb-res { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--sh-text); font-size: .84rem; cursor: pointer; }
body.shell-v2 .tb-res .material-icons { font-size: 18px; color: var(--sh-muted); }
body.shell-v2 .tb-res.sel, body.shell-v2 .tb-res:hover { background: rgba(34, 211, 160, .14); color: #fff; }
body.shell-v2 .tb-res.vazio { color: var(--sh-muted); cursor: default; }
body.shell-v2 .tb-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
body.shell-v2 .tb-icon { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; border: 1px solid var(--sh-line); background: rgba(255, 255, 255, .05); color: var(--sh-text); cursor: pointer; }
body.shell-v2 .tb-icon:hover { border-color: rgba(34, 211, 160, .55); color: #fff; }
body.shell-v2 .tb-badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ef4444; color: #fff; font-size: .66rem; font-weight: 800; display: grid; place-items: center; }
body.shell-v2 .tb-badge[hidden] { display: none; }
body.shell-v2 .tb-user { display: flex; align-items: center; gap: 10px; padding-left: 4px; }
body.shell-v2 .tb-avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #04241c; background: linear-gradient(135deg, var(--sh-green2), var(--sh-cyan)); }
body.shell-v2 .tb-user strong { display: block; color: #fff; font-size: .82rem; line-height: 1.15; }
body.shell-v2 .tb-user small { color: var(--sh-muted); font-size: .7rem; }
body.shell-v2 .tb-company { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--sh-line); background: rgba(255, 255, 255, .05); color: #fff; font-size: .84rem; }
body.shell-v2 .tb-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--sh-green2); box-shadow: 0 0 0 4px rgba(34, 211, 160, .2); }

/* área de conteúdo: o painel claro/escuro arredondado */
body.shell-v2 .app-body .main-content {
  flex: 1; min-height: 0; border-radius: 18px; border: 1px solid var(--sh-line); overflow: hidden;
  background: var(--body-bg); box-shadow: 0 30px 60px -40px rgba(0, 0, 0, .8);
}

/* botão do James (avisos): dentro da barra superior, ao lado da lua */
body.shell-v2 #jam-fab.jam-na-barra { position: relative; left: auto; right: auto; bottom: auto; z-index: 700; }
body.shell-v2 #jam-fab.jam-na-barra #jam-btn { width: 40px; height: 40px; }
body.shell-v2 #jam-fab.jam-na-barra .jam-avatar-img { width: 30px; height: 30px; }
body.shell-v2 #jam-fab.jam-na-barra .jam-card { bottom: auto; top: 50px; left: auto; right: 0; transform-origin: top right; }
body.shell-v2 #jam-fab.jam-na-barra #jam-bubble { transform-origin: top right; }
body.shell-v2 #jam-fab:not(.jam-na-barra) { visibility: hidden; } /* evita piscar no canto antes de ir pra barra */

@media (max-width: 900px) {
  body.shell-v2 .app-body { padding: 0; }
  body.shell-v2 .tb-search kbd, body.shell-v2 .tb-company, body.shell-v2 .tb-user div { display: none; }
  body.shell-v2 .app-body .main-content { border-radius: 0; border: 0; }
}

/* botão "Visual antigo" */

/* ---------- menu recolhido (só ícones) + submenu flutuante ---------- */
body.shell-v2 .sidebar.collapsed, body.shell-v2 #mainSidebar.collapsed { width: 68px !important; min-width: 68px !important; }
body.shell-v2 .sidebar.collapsed .sidebar-nav { padding: 10px 8px; overflow-x: hidden; }
body.shell-v2 .sidebar.collapsed .nav-group-label, body.shell-v2 .sidebar.collapsed .nav-group-chev,
body.shell-v2 .sidebar.collapsed .nav-item > span:not(.material-icons),
body.shell-v2 .sidebar.collapsed .sb-logout .nav-item > span:not(.material-icons) { display: none !important; }
body.shell-v2 .sidebar.collapsed .nav-sub { display: none !important; }
body.shell-v2 .sidebar.collapsed .nav-item, body.shell-v2 .sidebar.collapsed .nav-group-head { justify-content: center; padding: 11px 0 !important; }
body.shell-v2 .sidebar.collapsed .nav-group.has-active > .nav-group-head { background: linear-gradient(90deg, var(--sh-green), #19b97a); color: #fff; }
body.shell-v2 .sidebar.collapsed .nav-group.has-active > .nav-group-head .nav-group-icon { color: #fff; }
body.shell-v2 .sidebar.collapsed .sidebar-header { justify-content: center; flex-direction: column; gap: 10px; padding: 14px 6px !important; }
body.shell-v2 .sidebar.collapsed #providerBrandName, body.shell-v2 .sidebar.collapsed #providerCustomLogo { display: none !important; }

.nav-flyout { position: fixed; z-index: 9000; min-width: 210px; padding: 8px; border-radius: 14px; border: 1px solid rgba(148, 197, 190, .22); background: linear-gradient(180deg, #0d2b37, #0a2029); box-shadow: 0 24px 50px -20px rgba(0, 0, 0, .85); animation: nfIn .14s ease-out; }
@keyframes nfIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
.nav-flyout-title { padding: 6px 10px 8px; font-size: .66rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #7fa3a8; }
.nav-flyout-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; color: #d5e6e6; font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; text-align: left; }
.nav-flyout-item .material-icons { font-size: 18px; color: #7fa3a8; }
.nav-flyout-item:hover { background: rgba(34, 211, 160, .14); color: #fff; }
.nav-flyout-item.active { background: linear-gradient(90deg, #16a86e, #19b97a); color: #fff; }
.nav-flyout-item.active .material-icons { color: #fff; }

/* botão de novidades (changelog) */
body.shell-v2 .tb-icon.tb-news { width: auto; padding: 0 12px; gap: 6px; display: inline-flex; align-items: center; font: inherit; font-size: .76rem; font-weight: 700; }
body.shell-v2 .tb-icon.tb-news .material-icons { font-size: 18px; color: #22d3a0; }
@media (max-width: 1250px) { body.shell-v2 .tb-news-txt { display: none; } }

/* categorias do menu (grupos) com borda fina, para não parecerem itens de menu */
body.shell-v2 .nav-group-head {
  border: 1px solid var(--sh-line); background: rgba(148, 197, 190, .05);
}
body.shell-v2 .nav-group { margin-bottom: 4px; }
body.shell-v2 .nav-group.open > .nav-group-head, body.shell-v2 .nav-group-head:hover { border-color: rgba(34, 211, 160, .35); }
body.shell-v2 .sidebar.collapsed .nav-group-head { border-color: transparent; background: transparent; }
