/* ============================================================
   Portal RH Irradial — design system
   Cores oficiais: #0F5AA5 (azul Irradial) | #D23C2D (vermelho)
   ============================================================ */

:root {
  --brand-blue: #0F5AA5;
  --brand-blue-dark: #0A4078;
  --brand-blue-light: #E8F0F9;
  --brand-red: #D23C2D;
  --brand-red-dark: #A82E22;

  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --border: #E2E7EF;
  --text: #1B2433;
  --text-soft: #5A6473;
  --text-mute: #8A93A3;

  --success: #1F8B4C;
  --success-bg: #E8F5EE;
  --warning: #B57A11;
  --warning-bg: #FBF3E1;
  --danger: #C03A2B;
  --danger-bg: #FBE9E7;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(15, 90, 165, 0.05);
  --shadow: 0 4px 16px rgba(15, 90, 165, 0.08);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- LAYOUT ---------- */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 6px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.sidebar .brand img { height: 36px; width: auto; }
.sidebar .brand-name {
  font-weight: 700; color: var(--brand-blue); font-size: 15px;
  line-height: 1.1;
}
.sidebar .brand-name small {
  display: block; color: var(--text-mute); font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .04em; margin-top: 2px;
}
.nav-section {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-mute); padding: 14px 10px 6px; font-weight: 600;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-soft); font-weight: 500;
  margin-bottom: 2px;
}
.nav-link:hover { background: var(--brand-blue-light); color: var(--brand-blue); text-decoration: none; }
.nav-link.active { background: var(--brand-blue); color: #fff; }
.nav-link.active:hover { background: var(--brand-blue-dark); }
.nav-link .ico { width: 18px; opacity: .9; }

.main { padding: 28px 36px 60px; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 22px;
}
.topbar h1 {
  margin: 0; font-size: 22px; font-weight: 700; color: var(--text);
  letter-spacing: -.01em;
}
.topbar .subtitle { color: var(--text-mute); font-size: 13px; margin-top: 2px; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 6px 12px 6px 6px; border-radius: 999px; box-shadow: var(--shadow-sm);
}
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand-blue); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.user-chip form { display: inline; }
.user-chip button {
  background: none; border: none; color: var(--text-mute); cursor: pointer;
  font-size: 12px; padding: 0;
}
.user-chip button:hover { color: var(--brand-red); }

/* ---------- CARDS ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-weight: 700; font-size: 15px; margin: 0 0 14px;
  display: flex; align-items: center; justify-content: space-between;
  color: var(--text);
}

/* KPI grid */
.kpis {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-bottom: 22px;
}
.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  border-top: 3px solid var(--brand-blue);
}
.kpi.alt { border-top-color: var(--brand-red); }
.kpi.green { border-top-color: var(--success); }
.kpi.amber { border-top-color: var(--warning); }
.kpi .label { font-size: 12px; color: var(--text-mute); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.kpi .value { font-size: 28px; font-weight: 700; color: var(--text); margin-top: 4px; letter-spacing: -.02em; }
.kpi .hint { font-size: 12px; color: var(--text-soft); margin-top: 2px; }

/* dashboard duas colunas */
.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; margin-bottom: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

/* barra de distribuição */
.bar-row { display: grid; grid-template-columns: 160px 1fr 50px; align-items: center; gap: 10px; margin: 8px 0; font-size: 13px; }
.bar-row .label-cell { color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { background: var(--brand-blue-light); height: 8px; border-radius: 4px; overflow: hidden; }
.bar-fill { background: var(--brand-blue); height: 100%; border-radius: 4px; transition: width .5s ease; }
.bar-row .count { text-align: right; font-weight: 600; color: var(--text); }

/* ---------- TABELAS ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td {
  text-align: left; padding: 12px 14px; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.tbl th { background: #FAFBFD; color: var(--text-soft); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: #FAFBFD; }

/* ---------- BADGES / STATUS ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
  background: var(--brand-blue-light); color: var(--brand-blue);
}
.badge.green { background: var(--success-bg); color: var(--success); }
.badge.amber { background: var(--warning-bg); color: var(--warning); }
.badge.red   { background: var(--danger-bg); color: var(--danger); }
.badge.gray  { background: #ECEFF4; color: var(--text-soft); }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  background: var(--brand-blue); color: #fff;
  font-weight: 600; font-size: 13.5px;
  border: none; cursor: pointer; text-decoration: none;
  transition: background .15s ease;
}
.btn:hover { background: var(--brand-blue-dark); text-decoration: none; }
.btn.secondary { background: var(--surface); color: var(--brand-blue); border: 1px solid var(--border); }
.btn.secondary:hover { background: var(--brand-blue-light); }
.btn.danger { background: var(--brand-red); }
.btn.danger:hover { background: var(--brand-red-dark); }
.btn.ghost { background: transparent; color: var(--text-soft); border: 1px solid var(--border); }
.btn.ghost:hover { background: #FAFBFD; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; }

/* ---------- FORMS ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.full { grid-column: 1/-1; }
.field label {
  font-size: 12px; color: var(--text-soft); font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
}
.field input, .field select, .field textarea {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(15, 90, 165, .12);
}
.field textarea { min-height: 80px; resize: vertical; }
.field .hint { font-size: 11px; color: var(--text-mute); }

.section-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--brand-blue);
  margin: 28px 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.section-title:first-child { margin-top: 0; }

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

/* ---------- TOOLBAR / FILTERS ---------- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.toolbar .filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar input[type="text"], .toolbar select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; background: var(--surface);
}

/* ---------- TABS (detalhe) ---------- */
.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px;
  overflow-x: auto;
}
.tabs a {
  padding: 10px 16px; font-size: 13px; font-weight: 600; color: var(--text-soft);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a.active { color: var(--brand-blue); border-bottom-color: var(--brand-blue); }
.tabs a:hover { color: var(--brand-blue); text-decoration: none; }

.tab-section { display: none; }
.tab-section.active { display: block; }

/* ---------- FLASH ---------- */
.flash {
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px;
  font-size: 13.5px; font-weight: 500;
}
.flash.success { background: var(--success-bg); color: var(--success); border-left: 3px solid var(--success); }
.flash.error   { background: var(--danger-bg); color: var(--danger); border-left: 3px solid var(--danger); }

/* ---------- LOGIN ---------- */
.login-page {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg, #0F5AA5 0%, #0A4078 100%);
  padding: 20px;
}
.login-card {
  background: #fff; padding: 40px 36px; border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0,0,0,.2);
  width: 100%; max-width: 400px;
}
.login-card .brand-logo {
  text-align: center; margin-bottom: 22px;
}
.login-card .brand-logo img { height: 60px; width: auto; }
.login-card h2 {
  text-align: center; margin: 0 0 6px; color: var(--text); font-size: 19px; font-weight: 700;
}
.login-card .tagline {
  text-align: center; color: var(--text-mute); font-size: 13px; margin-bottom: 26px;
}
.login-card .field { margin-bottom: 14px; }
.login-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: 14px; }
.login-card .footer-tip {
  margin-top: 18px; padding: 10px; background: var(--brand-blue-light);
  border-radius: var(--radius-sm); font-size: 12px; color: var(--brand-blue-dark); text-align: center;
}

/* ---------- DETAIL HEADER ---------- */
.detail-header {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; margin-bottom: 18px;
  display: grid; grid-template-columns: 70px 1fr auto; gap: 18px; align-items: center;
}
.detail-header .avatar-lg {
  width: 70px; height: 70px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark));
  color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 22px;
}
.detail-header h2 { margin: 0; font-size: 20px; }
.detail-header .meta { color: var(--text-mute); font-size: 13px; margin-top: 4px; }
.detail-header .actions { display: flex; gap: 8px; }

/* timeline */
.timeline { border-left: 2px solid var(--brand-blue-light); padding: 4px 0 0 16px; margin-left: 6px; }
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item::before {
  content: ''; position: absolute; left: -22px; top: 6px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--brand-blue);
}
.timeline-item .when { font-size: 12px; color: var(--text-mute); }
.timeline-item .what { font-weight: 600; color: var(--text); margin: 2px 0; }
.timeline-item .desc { color: var(--text-soft); font-size: 13px; }

/* responsive */
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .main { padding: 20px; }
}

/* utilidades */
.muted { color: var(--text-mute); }
.right { text-align: right; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
hr.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.empty {
  text-align: center; padding: 40px 20px; color: var(--text-mute);
  background: #FAFBFD; border-radius: var(--radius); border: 1px dashed var(--border);
}
.empty .icon { font-size: 32px; margin-bottom: 8px; opacity: .5; }
