:root {
  --bg: #0a1119;
  --panel: #131c2c;
  --line: #2a3a52;
  --text: #e2e8f0;
  --muted: #8aa0b6;
  --accent: #4ade80;            /* verde principal */
  --accent-soft: rgba(74,222,128,.18);
  --accent-glow: rgba(74,222,128,.32);
  --lime: #a3e635;              /* botão Login */
  --neon-blue: #38bdf8;         /* título neon */
  --good: #22c55e;
  --warn: #f59e0b;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, "Segoe UI", system-ui, sans-serif; }
a { color: var(--accent); }

/* ============ views ============ */
.view.hidden { display: none; }

/* ============ login ============ */
#login-view {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 30% 20%, #1e293b 0%, #0f172a 60%);
  overflow: hidden;
}
#antigravity-bg {
  position: absolute; inset: 0;
  z-index: 0;
  pointer-events: none;  /* não rouba clique do form */
}
.login-box {
  position: relative; z-index: 1;
  background:
    linear-gradient(180deg, rgba(20,30,46,.85) 0%, rgba(11,18,30,.88) 100%);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(74,222,128,.18);
  border-radius: 14px; padding: 2.2rem 2.4rem 2.4rem;
  width: min(92vw, 380px);
  box-shadow:
    0 24px 60px rgba(0,0,0,.55),
    0 0 90px rgba(74,222,128,.08),
    inset 0 1px 0 rgba(255,255,255,.03);
  text-align: center;
}
.login-box h1 { margin: 0 0 1.4rem; font-size: 1.5rem; font-weight: 600; letter-spacing: .02em; }

/* neon azul piscando bem disfarçado */
.neon-title {
  color: var(--neon-blue);
  text-shadow:
    0 0 6px  rgba(56,189,248,.55),
    0 0 14px rgba(56,189,248,.30),
    0 0 28px rgba(56,189,248,.15);
  animation: neon-blink 3.2s ease-in-out infinite;
}
@keyframes neon-blink {
  0%, 100% { opacity: .92; text-shadow: 0 0 5px rgba(56,189,248,.40), 0 0 12px rgba(56,189,248,.22); }
  48%      { opacity: 1;   text-shadow: 0 0 9px rgba(56,189,248,.70), 0 0 22px rgba(56,189,248,.42); }
  52%      { opacity: .85; text-shadow: 0 0 4px rgba(56,189,248,.30), 0 0 10px rgba(56,189,248,.18); }
}
#login-form { display: flex; flex-direction: column; gap: .7rem; }
#login-form input {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: .75rem .9rem; font-size: .95rem;
}
#login-form input:focus { border-color: var(--accent); outline: none; }
#login-form button {
  margin-top: .4rem; padding: .85rem;
  background: var(--lime); color: #0a1119;
  border: none; border-radius: 8px;
  font-weight: 700; font-size: .95rem; letter-spacing: .02em;
  cursor: pointer; transition: all .15s ease-out;
  box-shadow: 0 4px 14px rgba(163,230,53,.18);
}
#login-form button:hover {
  filter: brightness(1.06);
  border: none;
  box-shadow: 0 6px 20px rgba(163,230,53,.34), 0 0 0 1px rgba(163,230,53,.4);
  transform: translateY(-1px);
}
.error { color: #fca5a5; font-size: .85rem; margin: 0; }
.hidden { display: none !important; }

/* ============ userbox no header ============ */
.userbox { display: inline-flex; align-items: center; gap: .55rem; padding-left: .8rem; margin-left: .4rem; border-left: 1px solid var(--line); }
.userbox #userName { font-size: .9rem; }
.role-chip {
  font-size: .7rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  padding: .15rem .45rem; border-radius: 4px;
  background: rgba(56,189,248,.12); color: var(--accent);
}
.role-chip[data-role="1"] { background: rgba(239,68,68,.15); color: #fca5a5; }
.role-chip[data-role="2"] { background: rgba(245,158,11,.15); color: #fbbf24; }
.role-chip[data-role="0"] { background: rgba(34,197,94,.15); color: #86efac; }
.logout-btn { font-size: .9rem; padding: .25rem .55rem; }

/* ============ barra de inboxes dentro do modal ============ */
.inbox-bar {
  display: flex; flex-wrap: wrap; gap: .4rem;
  padding: .7rem 1.3rem; border-bottom: 1px solid var(--line);
  background: rgba(0,0,0,.15);
}
.inbox-chip {
  background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  padding: .3rem .8rem; font-size: .8rem; font-weight: 500;
  cursor: pointer; transition: all .15s ease-out;
}
.inbox-chip:hover { color: var(--text); border-color: var(--accent); }
.inbox-chip.active {
  background: var(--accent); color: #0a1119; border-color: var(--accent);
  box-shadow: 0 0 16px rgba(74,222,128,.35), 0 0 0 1px rgba(74,222,128,.3);
}

header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: .9rem 1.5rem; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.header-spacer { /* coluna esquerda vazia pra balancear o grid */ }
header h1 { margin: 0; font-size: 1.1rem; font-weight: 600; letter-spacing: .02em; text-align: center; grid-column: 2; }
header .meta { grid-column: 3; justify-self: end; }
.meta { display: flex; gap: .6rem; align-items: center; }
.meta input[type=date] {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px; padding: .35rem .55rem;
}
button {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px;
  padding: .35rem .6rem; cursor: pointer;
}
button:hover { border-color: var(--accent); }

.muted { color: var(--muted); font-size: .85rem; }

.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: .8rem; padding: 1.2rem 1.5rem;
}
.kpi {
  background: linear-gradient(180deg, var(--panel) 0%, #0e1626 100%);
  border: 1px solid rgba(74,222,128,.14);
  border-radius: 10px; padding: 1rem 1.1rem;
  display: flex; flex-direction: column;
  box-shadow:
    0 1px 0 rgba(255,255,255,.02) inset,
    0 8px 24px rgba(0,0,0,.28),
    0 0 0 0 var(--accent-soft);
  transition: transform .15s ease-out, box-shadow .15s ease-out;
}
.kpi:hover {
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255,255,255,.03) inset,
    0 12px 30px rgba(0,0,0,.32),
    0 0 0 1px var(--accent-soft),
    0 0 28px rgba(74,222,128,.08);
}
.kpi-label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 2rem; font-weight: 600; margin-top: .3rem; }

.grid { padding: 0 1.5rem 2rem; }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 1rem 1.2rem;
}
.card h2 { margin: 0 0 .8rem; font-size: 1rem; font-weight: 600; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td {
  text-align: left; padding: .55rem .65rem;
  border-bottom: 1px solid var(--line);
}
th { color: var(--muted); font-weight: 500; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: rgba(74,222,128,.07); }
.zero { color: var(--muted); }

/* backdrop atrás do modal — começa abaixo do header, clicar fecha */
.backdrop {
  position: fixed; top: 56px; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.55);
  z-index: 8;
  opacity: 1; transition: opacity .18s ease-out;
}
.backdrop.hidden { opacity: 0; pointer-events: none; }

/* modal central (era "drawer") — fica abaixo do header, com bordas visíveis */
.drawer {
  position: fixed;
  top: 88px;            /* abaixo do header */
  left: 48px;
  right: 48px;
  bottom: 48px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,.55);
  transition: opacity .15s ease-out, transform .15s ease-out;
  z-index: 9;
  overflow: hidden;
}
.drawer.hidden {
  opacity: 0;
  transform: translateY(8px) scale(.98);
  pointer-events: none;
}
.drawer-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.3rem; border-bottom: 1px solid var(--line);
  gap: 1rem;
}
.drawer-head h2 { margin: 0; font-size: 1.1rem; font-weight: 600; }
.close-btn {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px;
  padding: .4rem .8rem; font-size: .9rem; font-weight: 500;
  white-space: nowrap; cursor: pointer;
}
.close-btn:hover { border-color: var(--accent); color: var(--accent); }
.drawer-tabs { display: flex; gap: .3rem; padding: .7rem 1.3rem 0; border-bottom: 1px solid var(--line); }
.tab { background: transparent; border: none; border-bottom: 2px solid transparent; color: var(--muted); padding: .55rem .9rem; border-radius: 0; }
.tab.active {
  color: var(--text); border-bottom-color: var(--accent);
  text-shadow: 0 0 8px rgba(74,222,128,.35);
}
.tab:hover { color: var(--text); }
.drawer-body { padding: 1rem 1.3rem; overflow-y: auto; flex: 1; }
.tab-pane { animation: fadein .15s ease-out; }
.tab-pane.hidden { display: none; }
.tab-pane h3 { margin: .2rem 0 .5rem; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 500; }

/* aba CLT Dashboard — espaçamento mais arejado */
[data-pane="cltdash"]              { padding: .3rem 0; }
[data-pane="cltdash"] h3           { font-size: .95rem; margin: .3rem 0 .9rem; color: var(--text); letter-spacing: .03em; text-transform: none; font-weight: 600; }
[data-pane="cltdash"] h3 + table   { margin-bottom: 2.2rem; }
[data-pane="cltdash"] table th,
[data-pane="cltdash"] table td     { padding: .8rem .9rem; }
[data-pane="cltdash"] table thead th { font-size: .78rem; }
[data-pane="cltdash"] > h3:nth-of-type(2) {
  margin-top: 1.6rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 720px) {
  .kpis { padding: 1rem; }
  .grid { padding: 0 1rem 2rem; }
  header { padding: .8rem 1rem; }
  .drawer { top: 72px; left: 12px; right: 12px; bottom: 12px; }
}
