:root {
  --bg: #070a10;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-solid: #0e1420;
  --line: rgba(255, 255, 255, 0.085);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #e9eefb;
  --muted: #8a95ab;
  --accent: #6c8cff;
  --accent-soft: rgba(108, 140, 255, 0.14);
  --lime: #a3e635;
  --amber: #fbbf24;
  --red: #f87171;
  --cyan: #22d3ee;
  --radius: 20px;
  --shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.9);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

.glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.glow-a { width: 620px; height: 620px; top: -220px; left: -140px; background: rgba(108, 140, 255, 0.18); }
.glow-b { width: 520px; height: 520px; bottom: -240px; right: -100px; background: rgba(34, 211, 238, 0.10); }

/* ---------- topbar ---------- */

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 34px 10px;
  max-width: 1500px;
  margin: 0 auto;
}

.brand { display: flex; align-items: center; gap: 14px; }

.logo {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(108, 140, 255, 0.25), rgba(108, 140, 255, 0.05));
  border: 1px solid rgba(108, 140, 255, 0.35);
  color: #b9c6ff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.logo svg { width: 24px; height: 24px; }

.brand-text h1 { margin: 0; font-size: 21px; letter-spacing: -0.02em; font-weight: 650; }
.brand-text p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); letter-spacing: 0.01em; }

.topbar-right { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; justify-content: flex-end; }

.clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
#clock-time {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
#clock-date { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.badges { display: flex; gap: 8px; }

.badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-live { color: var(--lime); border-color: rgba(163, 230, 53, 0.35); background: rgba(163, 230, 53, 0.08); }
.badge-off { color: var(--amber); border-color: rgba(251, 191, 36, 0.32); background: rgba(251, 191, 36, 0.08); }

.top-actions { display: flex; gap: 8px; }

button.ghost, a.ghost {
  appearance: none;
  font: inherit;
  font-size: 12.5px;
  color: var(--text);
  text-decoration: none;
  padding: 8px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: border-color .16s, background .16s, transform .16s;
  white-space: nowrap;
}
button.ghost:hover, a.ghost:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.07); }
button.ghost:active { transform: translateY(1px); }

/* ---------- layout ---------- */

.layout {
  position: relative;
  z-index: 1;
  max-width: 1500px;
  margin: 0 auto;
  padding: 18px 34px 40px;
  display: grid;
  grid-template-columns: 384px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.content { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  min-width: 0;
}

.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px;
}
.card-head h2 { margin: 0; font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.card-head .hint { font-size: 11.5px; color: var(--muted); }
.card-head > div:first-child { display: flex; flex-direction: column; gap: 3px; }
.head-actions { display: flex; align-items: center; gap: 10px; }

.pill {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 10px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.pill-live { color: var(--lime); border-color: rgba(163, 230, 53, 0.3); background: rgba(163, 230, 53, 0.07); display: inline-flex; align-items: center; gap: 6px; }
.pill-live i { width: 6px; height: 6px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 0 rgba(163, 230, 53, .7); animation: pulse 2s infinite; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(163, 230, 53, .55); }
  70% { box-shadow: 0 0 0 8px rgba(163, 230, 53, 0); }
  100% { box-shadow: 0 0 0 0 rgba(163, 230, 53, 0); }
}

/* ---------- terminal ---------- */

.terminal { position: sticky; top: 22px; }

.scanner {
  position: relative;
  height: 230px;
  border-radius: 16px;
  border: 1px solid rgba(108, 140, 255, 0.18);
  background: radial-gradient(circle at 50% 40%, rgba(108, 140, 255, 0.13), rgba(7, 10, 16, 0.4) 62%), #0a0f19;
  overflow: hidden;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  transition: border-color .3s, background .3s;
}
.scanner.scanning { border-color: rgba(163, 230, 53, 0.5); background: radial-gradient(circle at 50% 40%, rgba(163, 230, 53, 0.14), rgba(7, 10, 16, 0.4) 62%), #0a0f19; }
.scanner.done { border-color: rgba(163, 230, 53, 0.35); }

.scanner-inner { position: relative; display: grid; place-items: center; width: 100%; }

.fp {
  width: 168px; height: 168px;
  color: #7f96ff;
  filter: drop-shadow(0 0 18px rgba(108, 140, 255, 0.35));
  transition: color .3s, filter .3s, transform .3s;
}
.scanner.scanning .fp { color: var(--lime); filter: drop-shadow(0 0 26px rgba(163, 230, 53, 0.5)); animation: breathe 1.1s ease-in-out infinite; }
.scanner.done .fp { color: var(--lime); }

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}

.scanline {
  position: absolute;
  left: 12%; right: 12%;
  height: 2px;
  top: 0;
  background: linear-gradient(90deg, transparent, rgba(163, 230, 53, 0.9), transparent);
  opacity: 0;
  filter: blur(1px);
}
.scanner.scanning .scanline { opacity: 1; animation: sweep 1.1s cubic-bezier(.4, 0, .2, 1) infinite; }

@keyframes sweep {
  0% { top: 18%; opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { top: 82%; opacity: 0; }
}

.scanner-caption {
  position: absolute;
  bottom: 16px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
  transition: color .2s;
}
.scanner.scanning .scanner-caption { color: var(--lime); }

.fp-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.fp-item {
  appearance: none;
  font: inherit;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
  min-width: 0;
}
.fp-item:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--line-strong); }
.fp-item:active { transform: scale(0.985); }
.fp-item:disabled { opacity: .55; cursor: progress; }
.fp-item .avatar { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: #0a0f18; flex: none; }
.fp-item .meta { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.fp-item .name { font-size: 12.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-item .role { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.terminal-foot {
  margin-top: 14px;
  display: flex; align-items: center; gap: 8px;
  font-size: 10.8px;
  color: var(--muted);
  line-height: 1.4;
}
.terminal-foot .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); flex: none; }

/* ---------- stats ---------- */

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

.stat {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px 16px;
  min-width: 0;
}
.stat .label { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 26px; font-weight: 620; letter-spacing: -0.03em; margin-top: 7px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.stat.accent .value { color: var(--lime); }
.stat.warn .value { color: var(--amber); }
.stat.danger .value { color: var(--red); }

/* ---------- lists ---------- */

.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }

.row {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 6px;
  border-radius: 10px;
  min-width: 0;
}
.row + .row { border-top: 1px solid rgba(255, 255, 255, 0.045); }
.row .avatar { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #0a0f18; flex: none; }
.row .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row .name { font-size: 12.8px; font-weight: 540; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.row .sub { font-size: 11px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .right { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.row .time { font-size: 13px; font-variant-numeric: tabular-nums; font-weight: 550; }
.row .tag { font-size: 10px; color: var(--muted); margin-top: 2px; }

.chip {
  font-size: 9.6px;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 3px 7px;
  border-radius: 6px;
  font-weight: 650;
  white-space: nowrap;
}
.chip-in { color: #d9f99d; background: rgba(163, 230, 53, 0.14); border: 1px solid rgba(163, 230, 53, 0.25); }
.chip-out { color: #c4d0ff; background: rgba(108, 140, 255, 0.13); border: 1px solid rgba(108, 140, 255, 0.25); }
.chip-late { color: #fde68a; background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.25); }

.empty { font-size: 12px; color: var(--muted); padding: 14px 6px; text-align: center; }

/* ---------- alerts ---------- */

.alerts .row { align-items: flex-start; }
.alert-icon {
  width: 28px; height: 28px; border-radius: 9px; flex: none;
  display: grid; place-items: center; font-size: 13px;
  border: 1px solid var(--line);
}
.alerts .danger .alert-icon { color: var(--red); background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.25); }
.alerts .warn .alert-icon { color: var(--amber); background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.25); }
.alerts .info .alert-icon { color: var(--cyan); background: rgba(34, 211, 238, 0.1); border-color: rgba(34, 211, 238, 0.22); }
.alerts .title { font-size: 12.5px; font-weight: 560; display: block; }
.alerts .text { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.45; display: block; }

/* ---------- table ---------- */

.table-wrap { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 620px; }
thead th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  font-weight: 550;
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--line);
}
thead th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody td { padding: 11px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

.emp-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.emp-cell .avatar { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; color: #0a0f18; flex: none; }
.emp-cell .name { font-weight: 540; white-space: nowrap; display: block; }
.emp-cell .role { font-size: 10.5px; color: var(--muted); display: block; }

.bar-col { width: 30%; min-width: 150px; }
.bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #6c8cff, #a3e635); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-row .pct { font-size: 10.5px; color: var(--muted); min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }

.foot { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0 10px; }

/* ---------- toasts ---------- */

.toasts {
  position: fixed;
  right: 22px; bottom: 22px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 50;
  max-width: 340px;
}

.toast {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 15px;
  border-radius: 14px;
  background: rgba(16, 22, 34, 0.96);
  border: 1px solid var(--line-strong);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.9);
  animation: toast-in .28s cubic-bezier(.2, .9, .2, 1);
  backdrop-filter: blur(10px);
}
.toast.ok { border-color: rgba(163, 230, 53, 0.4); }
.toast.err { border-color: rgba(248, 113, 113, 0.45); }
.toast .t-icon { font-size: 15px; line-height: 1.3; }
.toast .t-title { font-size: 12.8px; font-weight: 600; }
.toast .t-text { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.toast.out .t-icon { color: var(--accent); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.shake { animation: shake .3s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}


/* ---------- tabs ---------- */

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  align-self: flex-start;
  margin-bottom: 4px;
}

.tab {
  appearance: none;
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--muted);
  background: transparent;
  border: 0;
  padding: 7px 16px;
  border-radius: 9px;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: #0a0f18; background: linear-gradient(180deg, #cfe0ff, #a9c2ff); }

.view { display: flex; flex-direction: column; gap: 20px; }
.view[hidden] { display: none !important; }

/* ---------- filtros ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 150px; }
.field.grow { flex: 1; min-width: 190px; }
.field span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }

.field input, .field select {
  appearance: none;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  outline: none;
  color-scheme: dark;
  transition: border-color .15s, background .15s;
  width: 100%;
}
.field input:hover, .field select:hover { border-color: var(--line-strong); }
.field input:focus, .field select:focus { border-color: rgba(108, 140, 255, 0.55); background: rgba(108, 140, 255, 0.08); }
.field select option { background: #0e1420; color: var(--text); }

.quick { display: flex; gap: 6px; padding-bottom: 1px; }

.tramos { display: flex; flex-wrap: wrap; gap: 6px; }
.tramo {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  padding: 3px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.tramo.open { color: var(--lime); border-color: rgba(163, 230, 53, 0.28); background: rgba(163, 230, 53, 0.08); }

.rep-day { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rep-day b { font-weight: 560; }
.rep-day span { display: block; font-size: 10.5px; color: var(--muted); }

@media (max-width: 860px) {
  .filters { gap: 10px; }
  .field { flex: 1 1 140px; }
  .quick { width: 100%; }
  .quick .ghost { flex: 1; }
  .tabs { width: 100%; }
  .tab { flex: 1; }
}

/* ---------- responsive ---------- */

@media (max-width: 1180px) {
  .layout { grid-template-columns: 1fr; }
  .terminal { position: static; }
  .fp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .topbar { flex-direction: column; align-items: flex-start; padding: 20px 18px 6px; gap: 14px; }
  .topbar-right { width: 100%; justify-content: space-between; gap: 12px; }
  .layout { padding: 14px 18px 30px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
  .fp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .badges { display: none; }
  .head-actions .hint { display: none; }
}

@media (max-width: 520px) {
  #clock-time { font-size: 24px; }
  .brand-text h1 { font-size: 18px; }
  .stat .value { font-size: 22px; }
  .scanner { height: 200px; }
  .fp { width: 140px; height: 140px; }
}
