/* Orbit DP/RH — sistema de design da aplicação (light mode, intranet corporativa) */

:root {
  color-scheme: light;

  /* Superfícies */
  --page-plane: #f4f5f7;
  --surface-1: #ffffff;
  --surface-2: #fbfbfa;

  /* Tinta */
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --border: rgba(11, 11, 11, 0.10);
  --border-strong: rgba(11, 11, 11, 0.16);

  /* Marca / categórico (paleta validada da skill dataviz) */
  --brand: #2a78d6;
  --brand-dark: #184f95;
  --brand-soft: #eaf2fc;
  --series-2-orange: #eb6834;
  --series-3-aqua: #1baf7a;
  --series-4-yellow: #eda100;
  --series-7-violet: #4a3aa7;

  /* Status (fixo, nunca reaproveitado como série) */
  --good: #0ca30c;
  --good-soft: #e6f6e6;
  --warning: #b9790a;
  --warning-soft: #fdf1da;
  --critical: #d03b3b;
  --critical-soft: #fbe8e8;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 2px rgba(11, 11, 11, 0.04), 0 4px 16px rgba(11, 11, 11, 0.05);
  --shadow-pop: 0 8px 24px rgba(11, 11, 11, 0.12);

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--page-plane);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-weight: 600;
  margin: 0 0 4px 0;
  letter-spacing: -0.01em;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }

p { margin: 0 0 0.75em 0; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

/* ---------- Layout ---------- */

.app-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.card[id] {
  scroll-margin-top: 84px;
}

.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
  white-space: nowrap;
}

.brand:hover { text-decoration: none; }

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--series-7-violet));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.brand-sub {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.92rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.nav-link:hover { background: var(--page-plane); text-decoration: none; color: var(--text-primary); }
.nav-link.is-active { color: var(--brand-dark); background: var(--brand-soft); }

.nav-group { position: relative; }

.nav-group-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.92rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  font-family: inherit;
}

.nav-group-trigger:hover { background: var(--page-plane); color: var(--text-primary); }
.nav-group.is-open .nav-group-trigger { background: var(--page-plane); color: var(--text-primary); }

.nav-group-trigger .chevron { transition: transform 0.15s ease; font-size: 0.7em; }
.nav-group.is-open .chevron { transform: rotate(180deg); }

.nav-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 240px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  display: none;
}

.nav-group.is-open .nav-dropdown { display: block; }

.nav-dropdown a, .nav-dropdown .nav-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
}

.nav-dropdown a:hover { background: var(--page-plane); text-decoration: none; }

.nav-dropdown-item.is-disabled {
  color: var(--text-muted);
  cursor: default;
}

.badge-em-breve {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--page-plane);
  border-radius: 999px;
  padding: 2px 8px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.user-role {
  display: block;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

main.content {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

main.content.content-auth {
  max-width: none;
  padding: 0;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.page-header .subtitle { color: var(--text-secondary); font-size: 0.92rem; }

.breadcrumb {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.breadcrumb a { color: var(--text-muted); }

.app-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 18px 20px 28px;
}

/* ---------- Cartões / cards ---------- */

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 22px;
}

.card + .card { margin-top: 20px; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.card-header h2, .card-header h3 { margin: 0; }

/* ---------- Cartões de indicador (dashboard) ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-tile-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.stat-tile-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-tile-value {
  font-size: 1.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

a.stat-tile {
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

a.stat-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover, 0 8px 20px rgba(0, 0, 0, 0.08));
  border-color: var(--brand);
}

a.stat-tile:hover .stat-tile-label {
  color: var(--brand-dark, var(--brand));
}

.charts-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
  align-items: stretch;
}

.chart-card { display: flex; flex-direction: column; }

.chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: 280px;
}

.chart-canvas-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

.chart-empty-msg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 0 20px;
  pointer-events: none;
}

.period-filter {
  display: inline-flex;
  background: var(--page-plane);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.period-filter button {
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
}

.period-filter button.is-active {
  background: var(--surface-1);
  color: var(--brand-dark);
  box-shadow: 0 1px 3px rgba(11, 11, 11, 0.12);
}

.activity-feed { list-style: none; margin: 0; padding: 0; }

.activity-feed li {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.87rem;
}

.activity-feed li:last-child { border-bottom: none; }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-when { color: var(--text-muted); font-size: 0.78rem; white-space: nowrap; }

/* ---------- Botões ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  line-height: 1.2;
}

.btn:hover { text-decoration: none; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }

.btn-secondary { background: var(--surface-1); color: var(--text-primary); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--page-plane); }

.btn-danger { background: var(--surface-1); color: var(--critical); border-color: var(--critical); }
.btn-danger:hover { background: var(--critical-soft); }

.btn-ghost { background: none; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--page-plane); }

.btn-sm { padding: 6px 11px; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.btn-icon-only {
  width: 34px;
  height: 34px;
  padding: 0;
}

/* ---------- Formulários ---------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 20px;
}

.form-grid .field-full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }

.field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.hint { font-size: 0.78rem; color: var(--text-muted); }

.field input[type="text"],
.field input[type="password"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="number"],
.field input[type="date"],
.field input[type="file"],
.field select,
.field textarea {
  font-family: inherit;
  font-size: 0.92rem;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  color: var(--text-primary);
  width: 100%;
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.field.field-error input,
.field.field-error select,
.field.field-error textarea {
  border-color: var(--critical);
}

.campo-senha-wrap { position: relative; display: flex; }
.campo-senha-wrap input { padding-right: 72px; }
.btn-toggle-senha {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
}
.btn-toggle-senha:hover { text-decoration: underline; }

.field-error-msg {
  font-size: 0.78rem;
  color: var(--critical);
  font-weight: 500;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-direction: row;
}

.checkbox-field input { width: 16px; height: 16px; }
.checkbox-field label { font-weight: 500; }

.busca-selecionavel { position: relative; }

.busca-selecionavel-lista {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 260px;
  overflow-y: auto;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.busca-selecionavel-item {
  padding: 8px 12px;
  font-size: 0.88rem;
  color: var(--text-primary);
  cursor: pointer;
}

.busca-selecionavel-item:hover {
  background: var(--page-plane);
}

.busca-selecionavel-vazio {
  color: var(--text-muted);
  cursor: default;
}

.busca-selecionavel-vazio:hover {
  background: none;
}

.form-section-title {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  align-items: center;
}

.search-bar input[type="text"], .search-bar select {
  font-family: inherit;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  font-size: 0.88rem;
  background: var(--surface-1);
}

.search-bar input[type="text"] { flex: 1; min-width: 180px; }

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ---------- Tabelas ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table thead th {
  text-align: left;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-2); }

.data-table .col-actions {
  text-align: right;
  white-space: nowrap;
}

.row-title { font-weight: 600; color: var(--text-primary); }
.row-subtitle { color: var(--text-muted); font-size: 0.8rem; }

/* ---------- Badges / status ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-ativo { background: var(--good-soft); color: #0a6b0a; }
.badge-inativo { background: var(--page-plane); color: var(--text-muted); }
.badge-papel { background: var(--brand-soft); color: var(--brand-dark); }
.badge-neutro { background: var(--page-plane); color: var(--text-secondary); }

/* ---------- Alertas / flash ---------- */

.flash-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  border: 1px solid transparent;
}

.alert-sucesso { background: var(--good-soft); color: #0a5c0a; border-color: rgba(12, 163, 12, 0.25); }
.alert-erro { background: var(--critical-soft); color: #9c2c2c; border-color: rgba(208, 59, 59, 0.25); }
.alert-info { background: var(--brand-soft); color: var(--brand-dark); border-color: rgba(42, 120, 214, 0.25); }
.alert-aviso { background: var(--warning-soft); color: #8a5c07; border-color: rgba(185, 121, 10, 0.25); }

.alert-icon { flex-shrink: 0; margin-top: 1px; }

.alert-close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  color: inherit;
  opacity: 0.55;
  padding: 0 0 0 8px;
}

.alert-close:hover { opacity: 1; }

/* ---------- Estado vazio ---------- */

.empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: var(--page-plane);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.empty-state h3 { color: var(--text-primary); margin-bottom: 4px; }
.empty-state p { max-width: 380px; margin: 0 auto 16px; }

/* ---------- Paginação ---------- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
}

.pagination a, .pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.pagination a:hover { background: var(--page-plane); text-decoration: none; }
.pagination .is-current { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 700; }
.pagination .is-disabled { opacity: 0.4; }

/* ---------- Auth (login / troca de senha) ---------- */

.auth-shell {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top left, #eef4fc 0%, var(--page-plane) 55%);
  padding: 20px;
  box-sizing: border-box;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 34px 30px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 22px;
}

.auth-title { text-align: center; margin-bottom: 4px; }
.auth-subtitle { text-align: center; color: var(--text-secondary); font-size: 0.88rem; margin-bottom: 26px; }

.auth-footnote {
  text-align: center;
  margin-top: 20px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* ---------- Importação de planilha ---------- */

.dropzone-hint {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 20px;
  background: var(--page-plane);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 18px;
}

.dropzone-hint code {
  background: var(--surface-1);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.82em;
}

.result-summary {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.result-pill {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--page-plane);
}

.result-pill.is-good { background: var(--good-soft); color: #0a5c0a; }
.result-pill.is-bad { background: var(--critical-soft); color: #9c2c2c; }

.error-list { max-height: 320px; overflow-y: auto; font-size: 0.85rem; }
.error-list li { padding: 6px 0; border-bottom: 1px dashed var(--border); }

/* ---------- Utilidades ---------- */

.stack-sm > * + * { margin-top: 10px; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }

/* ---------- Responsivo ---------- */

@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .nav-toggle { display: flex; }

  .main-nav {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--surface-1);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    box-shadow: var(--shadow-pop);
  }

  .app-shell.nav-open .main-nav { display: flex; }

  .nav-group-trigger, .nav-link { width: 100%; justify-content: space-between; }
  .nav-dropdown { position: static; box-shadow: none; border: none; padding-left: 12px; display: none; }
  .nav-group.is-open .nav-dropdown { display: block; }

  .user-menu { margin-left: 0; }
  .stat-grid { grid-template-columns: 1fr; }
}

/* Impressão — usada nas telas com botão "Imprimir" (ex.: Ficha de RH):
   some navegação, botões e histórico; deixa só o conteúdo relevante. */
@media print {
  .topbar, .app-footer, .flash-stack, .no-imprimir { display: none !important; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; margin-bottom: 12px; }
}
