/* Casca da aplicação: barra de ícones, barra lateral, área de trabalho, cabeçalho. */

.app {
  display: grid; grid-template-columns: var(--rail-w) var(--side-w) minmax(0, 1fr);
  height: 100vh; height: 100dvh; overflow: hidden; background: var(--c-shell);
}

/* ---------- Barra de ícones ---------- */
.rail {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--c-rail); border-right: 1px solid var(--c-rail-border); padding: 12px 0 12px; min-height: 0;
}
.rail-brand {
  width: 32px; height: 32px; border-radius: 8px; background: var(--c-coral); color: #252525;
  display: grid; place-items: center; font-weight: 700; font-size: 20px; line-height: 1; margin-bottom: 10px; text-decoration: none;
}
.rail-brand:hover { text-decoration: none; filter: brightness(1.05); }
.rail-nav { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.rail-btn {
  position: relative; width: 36px; height: 36px; border-radius: 6px; color: #a8a8aa;
  display: grid; place-items: center; flex-shrink: 0; transition: background .12s, color .12s;
}
.rail-btn:hover { background: #3a3a3a; color: #fff; text-decoration: none; }
.rail-btn.active { background: var(--c-side-active); color: #fff; }
.rail-btn svg { width: 19px; height: 19px; }
.rail-count {
  position: absolute; top: 1px; right: -1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--c-coral); color: #2a1a16; font-size: 9.5px; font-weight: 600; line-height: 16px; text-align: center;
  box-shadow: 0 0 0 2px var(--c-rail); font-variant-numeric: tabular-nums;
}
.rail-spacer { flex: 1; }
.rail-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: #debaad; color: #402d29; font-size: 10.5px; font-weight: 600;
  display: grid; place-items: center; margin-top: 6px; flex-shrink: 0; cursor: pointer; transition: box-shadow .12s;
}
.rail-avatar:hover, .rail-avatar[aria-expanded=true] { box-shadow: 0 0 0 2px #5a5a5e; }
.rail-avatar.manager { background: #b9cdf2; color: #24375f; }

/* ---------- Barra lateral ---------- */
.sidebar { display: flex; flex-direction: column; background: var(--c-side); color: var(--c-side-text); min-height: 0; overflow: hidden; }
.side-title {
  height: 60px; min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 14px 0 20px; color: #fafafa; font-size: var(--fs-lg); font-weight: 600;
}
.side-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-close { display: none; color: #a8a8aa; width: 28px; height: 28px; border-radius: 5px; place-items: center; }
.side-close:hover { background: var(--c-side-hover); color: #fff; }
.side-scroll { flex: 1; overflow: auto; padding: 0 10px 16px; scrollbar-width: thin; scrollbar-color: #515151 transparent; }
.side-action {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; margin-bottom: 14px; border-radius: 5px;
  color: #c9c9cc; font-size: var(--fs-md); text-align: left;
}
.side-action:hover { color: #fff; background: var(--c-side-hover); }
.side-action svg { width: 15px; height: 15px; }
.side-group { margin-bottom: 18px; }
.side-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--c-side-muted);
  padding: 0 10px; margin: 6px 0 8px;
}
.side-section > summary {
  display: flex; align-items: center; gap: 4px; list-style: none; cursor: pointer; user-select: none;
  font-size: var(--fs-sm); color: #9b9b9e; padding: 6px 6px; border-radius: 4px;
}
.side-section > summary::-webkit-details-marker { display: none; }
.side-section > summary:hover { color: #d8d8da; }
.side-section > summary svg { width: 12px; height: 12px; transition: transform .15s var(--ease); }
.side-section:not([open]) > summary svg { transform: rotate(-90deg); }
.side-section .side-link { padding-left: 18px; }
.side-link {
  display: flex; align-items: center; gap: 9px; width: 100%; min-height: 32px; padding: 6px 10px; border-radius: 5px;
  color: var(--c-side-text); font-size: var(--fs-md); text-align: left; line-height: 1.35; text-decoration: none;
}
.side-link:hover { background: var(--c-side-hover); color: #ededee; text-decoration: none; }
.side-link.active { background: var(--c-side-active); color: #fff; }
.side-link svg { width: 15px; height: 15px; color: #9f9fa1; }
.side-link.active svg { color: #e8e8e8; }
.side-link-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-count { margin-left: auto; font-size: var(--fs-xs); color: #a3a3a6; font-variant-numeric: tabular-nums; }
.side-link.active .side-count { color: #f3f3f3; }
.side-count.alert { color: #2a1a16; background: var(--c-coral); border-radius: 8px; padding: 0 6px; font-weight: 600; line-height: 16px; }
.side-dot { width: 7px; height: 7px; border-radius: 2px; flex-shrink: 0; background: #72a9ed; }
.side-dot.critical { background: #e57a6c; } .side-dot.high { background: #e2a755; }
.side-dot.medium { background: #d9c25e; } .side-dot.low { background: #7ebda3; }
.side-dot.blue { background: #72a9ed; } .side-dot.purple { background: #b884c9; } .side-dot.green { background: #7ebda3; }
.side-dot.pink { background: #e28ba0; } .side-dot.neutral { background: #8a8a90; }
.side-empty { font-size: var(--fs-sm); color: #8a8a8f; padding: 4px 10px 8px; line-height: 1.5; }
.side-foot {
  border-top: 1px solid var(--c-side-line); display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  font-size: var(--fs-sm); color: #ddd;
}
.side-foot small { display: block; font-size: 10.5px; color: #8b8b90; margin-top: 2px; }
.side-foot .ws-icon { width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; background: #3e3e42; color: #d1d1d5; font-weight: 600; }

/* ---------- Área de trabalho ---------- */
.main {
  min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--c-bg);
  margin: 8px 8px 8px 0; border-radius: var(--r-lg); overflow: hidden;
}
.demo-banner {
  display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 6px 16px; flex-shrink: 0;
  background: var(--c-demo-bg); border-bottom: 1px solid var(--c-demo-line); color: var(--c-demo-fg); font-size: var(--fs-sm);
}
.demo-banner svg { width: 14px; height: 14px; }
.demo-banner button { margin-left: auto; color: var(--c-demo-fg); font-size: var(--fs-sm); display: inline-flex; align-items: center; gap: 5px; border-radius: 4px; padding: 2px 4px; }
.demo-banner button:hover { color: #5e4824; }
.demo-banner button svg { width: 13px; height: 13px; }

.topbar {
  display: flex; align-items: center; gap: 12px; height: var(--topbar-h); min-height: var(--topbar-h); padding: 0 20px 0 24px;
  background: var(--c-surface); border-bottom: 1px solid var(--c-border);
}
.topbar .topbar-toggle { display: none; }
.topbar-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex: 1; }
.topbar-title h1 { font-size: var(--fs-lg); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
.topbar-title .sub { color: var(--c-muted); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-filters, .topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
/* O seletor de período tem sempre a mesma largura (cabe '01/11/2026 – 10/11/2026'): trocar de período não desloca o resto do cabeçalho. */
.topbar-filters > .dd-trigger:last-child { width: 208px; }
.topbar-actions:empty { display: none; }
.topbar-sep { width: 1px; height: 22px; background: var(--c-border); }

.view-wrap { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.view { flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: #d6d6dc transparent; }
.view.view-pad > .page, .page { padding: var(--sp-6) var(--sp-6) var(--sp-10); }
.page { max-width: 1480px; }
.page.page-full { max-width: none; }
/* Página que ocupa toda a altura (lista + detalhe): sem scroll externo, cada coluna tem o seu. */
.view.view-fill { overflow: hidden; display: flex; flex-direction: column; }

/* Barra lateral recolhida (abaixo de ~1100 px de largura) */
.side-scrim { display: none; }
@media (max-width: 1100px) {
  .app { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: var(--z-side); left: var(--rail-w); top: 0; bottom: 0; width: var(--side-w);
    transform: translateX(calc(-100% - var(--rail-w))); transition: transform .2s var(--ease); box-shadow: 8px 0 30px rgba(0,0,0,.25);
  }
  .app.side-open .sidebar { transform: none; }
  .app.side-open .side-scrim { display: block; position: fixed; inset: 0 0 0 var(--rail-w); z-index: calc(var(--z-side) - 1); background: rgba(20,20,25,.25); }
  .sidebar .side-close { display: grid; }
  .main { margin-left: 8px; }
  .topbar { padding-left: 12px; }
  .topbar .topbar-toggle { display: inline-grid; }
}
@media (max-width: 760px) {
  .topbar { height: auto; min-height: var(--topbar-h); flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .topbar-title { flex-basis: calc(100% - 50px); }
  .page { padding: var(--sp-4) var(--sp-4) var(--sp-8); }
}

/* ---------- Entrada (login e escolher password) ---------- */
.auth-screen {
  position: fixed; inset: 0; z-index: calc(var(--z-modal) + 50); overflow: auto; background: var(--c-shell);
  display: flex; align-items: center; justify-content: center; padding: 32px 16px;
}
.auth-card {
  width: min(380px, 100%); background: var(--c-surface); border-radius: 12px; box-shadow: 0 24px 60px rgba(0,0,0,.35);
  padding: 32px 30px 26px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-logo {
  width: 38px; height: 38px; border-radius: 9px; background: var(--c-coral); color: #252525; display: grid; place-items: center;
  font-weight: 700; font-size: 22px; line-height: 1; flex-shrink: 0;
}
.auth-brand h1 { font-size: var(--fs-xl); font-weight: 600; margin: 0; line-height: 1.2; }
.auth-brand .sub { font-size: var(--fs-sm); color: var(--c-muted); margin-top: 2px; }
.auth-card form { display: flex; flex-direction: column; }
.auth-card .callout { margin-bottom: 16px; }
.auth-error { margin-top: 14px; }
.auth-error:empty { display: none; }
.auth-card .btn.block { margin-top: 20px; height: 38px; }
.auth-foot { margin-top: 18px; font-size: var(--fs-sm); color: var(--c-muted); line-height: 1.5; text-align: center; }
.auth-foot button { color: var(--c-primary); font-size: inherit; }
.auth-foot button:hover { text-decoration: underline; }
