/* ═══ LAYOUT ══════════════════════════════════ */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ═══ SIDEBAR ════════════════════════════════ */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  gap: 2px;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 20px;
  font-size: 13px; font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 8px;
}

.sidebar-logo-icon {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  box-shadow: 0 0 12px var(--accent-glow);
  flex-shrink: 0;
}

.sidebar-logo-img {
  width: 28px; height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 6px;
}

.sidebar-section {
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 14px 10px 6px;
}

.sidebar-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s;
  border: 1px solid transparent;
  text-decoration: none;
}

.sidebar-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.sidebar-item.active,
.sidebar-item[aria-current] {
  color: var(--text-primary);
  background: var(--accent-dim);
  border-color: var(--border-subtle);
}

.sidebar-item.active .si-icon,
.sidebar-item[aria-current] .si-icon {
  color: var(--accent-light);
}

.si-icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-bottom {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  border-radius: var(--r-md);
}

.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
  color: var(--text-primary);
}

.user-name { font-size: 12px; font-weight: 500; color: var(--text-primary); }
.user-role { font-size: 10px; color: var(--text-tertiary); }

/* Theme toggle */
.theme-track {
  width: 32px; height: 18px;
  border-radius: 999px;
  background: var(--bg-overlay);
  border: 1px solid var(--border-subtle);
  position: relative;
  transition: background 0.3s;
  flex-shrink: 0;
}
.theme-track.on { background: var(--accent); border-color: var(--border-subtle); }
.theme-thumb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--text-tertiary);
  position: absolute; top: 2px; left: 2px;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), background 0.3s;
}
.theme-track.on .theme-thumb {
  transform: translateX(14px);
  background: var(--text-primary);
}

/* ═══ MAIN AREA ══════════════════════════════ */
.main-area {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-base);
}

/* ═══ TOPBAR ═════════════════════════════════ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-base);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(12px);
}
.topbar-left { display: flex; flex-direction: column; gap: 2px; }
.topbar-title { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.topbar-breadcrumb { font-size: 11px; color: var(--text-tertiary); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ═══ PAGE CONTENT ═══════════════════════════ */
.page-content { padding: 24px 28px; }

/* ═══ BUTTONS ════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--r-md);
  font-size: 13px; font-weight: 500;
  border: none; cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 0 16px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-light); }
.btn-primary:disabled, .btn-primary[disabled] {
  opacity: 0.5; cursor: not-allowed;
  box-shadow: none;
}
.btn-secondary {
  background: var(--bg-elevated); color: var(--text-primary);
  border: 1px solid var(--border-default);
}
.btn-secondary:hover { border-color: var(--border-strong); }
.btn-ghost {
  background: transparent; color: var(--text-secondary);
  border: 1px solid transparent;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }
.btn-danger { background: var(--rose-dim); color: var(--rose); border: 1px solid rgba(244,63,94,0.2); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ═══ BADGES ═════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.badge-accent  { background: var(--accent-dim);  color: var(--accent-light); border: 1px solid rgba(99,102,241,0.2); }
.badge-amber   { background: var(--amber-dim);   color: var(--amber-light);  border: 1px solid rgba(245,158,11,0.2); }
.badge-emerald { background: var(--emerald-dim); color: var(--emerald);      border: 1px solid rgba(16,185,129,0.2); }
.badge-rose    { background: var(--rose-dim);    color: var(--rose);         border: 1px solid rgba(244,63,94,0.2); }
.badge-sky     { background: var(--sky-dim);     color: var(--sky);          border: 1px solid rgba(56,189,248,0.2); }

/* ═══ INPUTS ═════════════════════════════════ */
.form-control {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: 9px 14px;
  color: var(--text-primary);
  font-size: 13px; font-family: var(--font-sans);
  outline: none; width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-control::placeholder { color: var(--text-tertiary); }

.form-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: 9px 14px;
  color: var(--text-primary);
  font-size: 13px; font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ═══ CARDS ══════════════════════════════════ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: 20px;
}

/* ═══ KPI CARDS ══════════════════════════════ */
.kpi-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 24px; }
.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  position: relative; overflow: hidden;
  transition: border-color 0.2s;
}
.kpi-card:hover { border-color: var(--border-default); }
.kpi-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
}
.kpi-card.c-accent::before  { background: linear-gradient(90deg, var(--accent), transparent); }
.kpi-card.c-amber::before   { background: linear-gradient(90deg, var(--amber), transparent); }
.kpi-card.c-emerald::before { background: linear-gradient(90deg, var(--emerald), transparent); }
.kpi-card.c-sky::before     { background: linear-gradient(90deg, var(--sky), transparent); }
.kpi-card.c-rose::before    { background: linear-gradient(90deg, var(--rose), transparent); }
.kpi-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.kpi-label  { font-size: 11px; font-weight: 500; color: var(--text-secondary); }
.kpi-icon   { width: 32px; height: 32px; border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; font-size: 15px; }
.kpi-icon.c-accent  { background: var(--accent-dim); }
.kpi-icon.c-amber   { background: var(--amber-dim); }
.kpi-icon.c-emerald { background: var(--emerald-dim); }
.kpi-icon.c-sky     { background: var(--sky-dim); }
.kpi-icon.c-rose    { background: var(--rose-dim); }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; margin-bottom: 6px; }
.kpi-delta { font-size: 11px; color: var(--text-secondary); }
.kpi-delta .pos { color: var(--emerald); font-weight: 600; }
.kpi-delta .neg { color: var(--rose); font-weight: 600; }

/* ═══ TABLES ═════════════════════════════════ */
.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.table-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border-subtle);
}
.table-title { font-size: 13px; font-weight: 600; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 10px 20px;
  text-align: left; font-size: 10px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-tertiary);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
}
tbody tr { border-bottom: 1px solid var(--border-subtle); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
td { padding: 12px 20px; font-size: 12px; color: var(--text-secondary); }
td.td-main { color: var(--text-primary); font-weight: 500; }
.td-mono { font-family: var(--font-mono); font-size: 11px; }

/* ═══ CARGO CARDS ════════════════════════════ */
.cargo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.cargo-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: 18px; cursor: pointer;
  transition: all 0.15s; position: relative; overflow: hidden;
}
.cargo-card:hover { border-color: var(--border-default); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.cargo-card.selected { border-color: rgba(99,102,241,0.4); background: linear-gradient(135deg, rgba(99,102,241,0.06), transparent); }
.cargo-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.cargo-dept { font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); }
.cargo-nome { font-size: 14px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 4px; line-height: 1.3; color: var(--text-primary); }
.cargo-footer { display: flex; justify-content: space-between; align-items: center; }
.cargo-salario { font-size: 15px; font-weight: 700; letter-spacing: -0.03em; font-family: var(--font-mono); }
.cargo-pts { font-size: 10px; color: var(--text-tertiary); }

/* ═══ PROGRESS ═══════════════════════════════ */
.progress-bar { height: 6px; background: var(--bg-overlay); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-light)); }

/* ═══ SEARCH / FILTERS ═══════════════════════ */
.search-wrap { position: relative; }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-tertiary); }
.search-input {
  width: 100%; background: var(--bg-surface);
  border: 1px solid var(--border-default); border-radius: var(--r-md);
  padding: 8px 12px 8px 34px; color: var(--text-primary);
  font-size: 13px; font-family: var(--font-sans); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.search-input::placeholder { color: var(--text-tertiary); }

/* ═══ FORM LABELS ════════════════════════════ */
.form-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; display: block; }
.form-group { margin-bottom: 16px; }

/* ═══ LIST GROUP ═════════════════════════════ */
.list-group { list-style: none; padding: 0; margin: 0; }
.list-group-item {
  padding: 10px 16px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
}
.list-group-item + .list-group-item { border-top: none; }
.list-group-item:first-child { border-radius: var(--r-md) var(--r-md) 0 0; }
.list-group-item:last-child { border-radius: 0 0 var(--r-md) var(--r-md); }
.list-group-item:only-child { border-radius: var(--r-md); }

/* ═══ ALERTS ═════════════════════════════════ */
.alert { padding: 14px 18px; border-radius: var(--r-md); font-size: 13px; margin-bottom: 16px; }
.alert-warning { background: var(--amber-dim); color: var(--amber-light); border: 1px solid rgba(245,158,11,0.2); }
.alert-danger  { background: var(--rose-dim);  color: var(--rose);        border: 1px solid rgba(244,63,94,0.2); }
.alert-success { background: var(--emerald-dim); color: var(--emerald);   border: 1px solid rgba(16,185,129,0.2); }
.alert-info    { background: var(--sky-dim);   color: var(--sky);         border: 1px solid rgba(56,189,248,0.2); }

/* ═══ MONO VALUES ════════════════════════════ */
.mono { font-family: var(--font-mono); }
.text-accent { color: var(--accent-light); }
.text-emerald { color: var(--emerald); }
.text-amber { color: var(--amber-light); }
.text-rose { color: var(--rose); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-tertiary); }

/* ═══ UTILITY ════════════════════════════════ */
.d-flex { display: flex; }
.d-none { display: none; }
.align-items-center { align-items: center; }
.align-middle { vertical-align: middle; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.fw-bold { font-weight: 700; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.table-responsive { overflow-x: auto; }
.table-success { background: var(--emerald-dim); }
.table-warning { background: var(--amber-dim); }

.row { display: flex; flex-wrap: wrap; margin: 0 -0.5rem; }
.row.g-2 { gap: 0.5rem; margin: 0; }
.row.g-3 { gap: 1rem; margin: 0; }
.col-md-3 { flex: 0 0 auto; width: 25%; padding: 0 0.5rem; }
.col-md-4 { flex: 0 0 auto; width: 33.333%; padding: 0 0.5rem; }
.col-md-5 { flex: 0 0 auto; width: 41.667%; padding: 0 0.5rem; }

.btn-outline-primary {
  background: transparent; color: var(--accent-light);
  border: 1px solid var(--accent); border-radius: var(--r-md);
  padding: 8px 16px; font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: var(--font-sans); transition: all 0.15s;
}
.btn-outline-primary:hover { background: var(--accent-dim); }
.btn-outline-primary:disabled, .btn-outline-primary[disabled] {
  opacity: 0.4; cursor: not-allowed;
}
.btn-outline-danger {
  background: transparent; color: var(--rose);
  border: 1px solid rgba(244,63,94,0.3); border-radius: var(--r-md);
  padding: 4px 10px; font-size: 12px; cursor: pointer;
  font-family: var(--font-sans); transition: all 0.15s;
}
.btn-outline-danger:hover { background: var(--rose-dim); }

.form-control-sm { padding: 6px 10px; font-size: 12px; }

/* ═══ BLAZOR INFRASTRUCTURE ══════════════════ */
.valid.modified:not([type=checkbox]) {
  outline: 1px solid var(--emerald);
}
.invalid {
  outline: 1px solid var(--rose);
}
.validation-message {
  color: var(--rose);
  font-size: 12px;
}

#blazor-error-ui {
  background: var(--rose-dim);
  color: var(--rose);
  bottom: 0;
  box-shadow: var(--shadow-md);
  box-sizing: border-box;
  display: none;
  left: 0;
  padding: 0.6rem 1.25rem 0.7rem 1.25rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
}
#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  right: 0.75rem;
  top: 0.5rem;
}

.blazor-error-boundary {
  background: var(--rose-dim);
  padding: 1rem;
  color: var(--rose);
  border-radius: var(--r-md);
}
.blazor-error-boundary::after {
  content: "An error has occurred.";
}

/* ═══ ONBOARDING LAYOUT ═════════════════════ */
.onboarding-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
}

.onboarding-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.9rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.onboarding-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.onboarding-main {
  flex: 1;
  padding: 2rem 1rem 90px 1rem;
  overflow-y: auto;
}

.onboarding-footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border-subtle);
}

.loading-progress {
  position: absolute;
  display: block;
  width: 8rem;
  height: 8rem;
  inset: 20vh 0 auto 0;
  margin: 0 auto;
}
.loading-progress circle {
  fill: none;
  stroke: #1c2028;
  stroke-width: 0.6rem;
  transform-origin: 50% 50%;
  transform: rotate(-90deg);
}
.loading-progress circle:last-child {
  stroke: #6366f1;
  stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
  transition: stroke-dasharray 0.05s ease-in-out;
}
.loading-progress-text {
  position: absolute;
  text-align: center;
  font-weight: bold;
  inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
  color: #94a3b8;
}