:root {
  --bg: #0d1118;
  --sidebar: #0a0e14;
  --panel: #151b25;
  --panel-2: #1a2230;
  --panel-3: #202a39;
  --line: #293446;
  --line-soft: rgba(136, 151, 176, .14);
  --text: #f1f4f8;
  --muted: #8f9bb0;
  --muted-2: #667287;
  --accent: #ffb21a;
  --accent-soft: rgba(255, 178, 26, .12);
  --good: #35d39a;
  --good-soft: rgba(53, 211, 154, .12);
  --busy: #5b93ff;
  --busy-soft: rgba(91, 147, 255, .12);
  --warn: #ff7369;
  --warn-soft: rgba(255, 115, 105, .12);
  --purple: #b28cff;
  --shadow: 0 22px 65px rgba(0, 0, 0, .2);
  --sidebar-width: 258px;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    var(--bg);
  background-size: 72px 72px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: rgba(10, 14, 20, .97);
  border-right: 1px solid var(--line-soft);
  box-shadow: 15px 0 45px rgba(0,0,0,.08);
}
.brand {
  min-height: 90px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line-soft);
}
.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 178, 26, .38);
  border-radius: 8px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 22px;
  font-weight: 900;
}
.brand strong { display: block; font-size: 15px; letter-spacing: .08em; }
.brand span { display: block; margin-top: 3px; color: var(--accent); font-size: 11px; letter-spacing: .13em; text-transform: uppercase; }

.nav-list { flex: 1; overflow-y: auto; padding: 18px 12px 28px; scrollbar-width: thin; }
.nav-section { margin: 22px 12px 8px; color: var(--muted-2); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.nav-item {
  width: 100%;
  min-height: 43px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 3px 0;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: .18s ease;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.035); }
.nav-item.active {
  color: var(--text);
  background: linear-gradient(90deg, var(--accent-soft), rgba(255,255,255,.025));
  border-color: rgba(255, 178, 26, .16);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  width: 3px;
  height: 25px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  box-shadow: 0 0 16px rgba(255,178,26,.35);
}
.nav-icon { width: 20px; color: currentColor; text-align: center; font-size: 18px; }
.nav-item span:last-child { font-size: 13px; font-weight: 650; }
.sidebar-footer { padding: 18px 24px 22px; border-top: 1px solid var(--line-soft); }
.sidebar-footer a { display: block; margin-bottom: 6px; color: var(--text); font-size: 12px; text-decoration: none; }
.sidebar-footer a:hover { color: var(--accent); }
.sidebar-footer span { color: var(--muted-2); font-size: 10px; letter-spacing: .09em; text-transform: uppercase; }

.app-main { min-height: 100vh; margin-left: var(--sidebar-width); display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px clamp(22px, 3vw, 42px);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(13,17,24,.9);
  backdrop-filter: blur(18px);
}
.menu-button { display: none; border: 0; background: transparent; font-size: 22px; cursor: pointer; }
.topbar-title span { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.topbar-title h1 { margin: 5px 0 0; font-size: clamp(20px, 2.2vw, 29px); line-height: 1; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.connection-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}
.connection-dot { width: 7px; height: 7px; border-radius: 99px; background: var(--accent); animation: pulse 1.15s infinite; }
.connection-pill[data-state="ok"] .connection-dot { background: var(--good); box-shadow: 0 0 10px var(--good); animation: none; }
.connection-pill[data-state="error"] .connection-dot { background: var(--warn); box-shadow: 0 0 10px var(--warn); animation: none; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 5px 10px 5px 5px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.avatar { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 6px; background: var(--panel-3); color: var(--accent); font-size: 11px; font-weight: 800; }
.user-copy strong, .user-copy small { display: block; }
.user-copy strong { font-size: 11px; }
.user-copy small { margin-top: 2px; color: var(--muted); font-size: 9px; text-transform: uppercase; }

.content { width: min(1450px, 100%); flex: 1; margin: 0 auto; padding: clamp(24px, 4vw, 46px); }
.view { display: none; animation: reveal .24s ease; }
.view.active { display: block; }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: 10px; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 35px;
  padding: clamp(25px, 4vw, 45px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 85% 25%, rgba(255,178,26,.12), transparent 34%),
    linear-gradient(135deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow);
}
.hero-panel h2 { max-width: 760px; margin: 0; font-size: clamp(28px, 4.6vw, 58px); line-height: 1.02; letter-spacing: -.035em; }
.hero-panel p:not(.eyebrow) { max-width: 690px; margin: 18px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.hero-version { min-width: 180px; padding: 22px; border: 1px solid rgba(255,178,26,.22); border-radius: 10px; background: rgba(10,14,20,.46); text-align: center; }
.hero-version span, .hero-version small { display: block; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.hero-version strong { display: block; margin: 8px 0; color: var(--accent); font-size: 52px; line-height: 1; }

.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 38px 0 18px; }
.section-heading h2 { margin: 0; font-size: clamp(22px, 3vw, 32px); }
.section-description { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.text-button, .secondary-button, .ghost-button {
  border-radius: 7px;
  cursor: pointer;
  transition: .16s ease;
}
.text-button { padding: 8px 0; border: 0; background: transparent; color: var(--accent); font-size: 12px; font-weight: 750; }
.text-button:hover { transform: translateX(3px); }
.secondary-button { padding: 10px 14px; border: 1px solid rgba(255,178,26,.28); background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 750; }
.secondary-button:hover { background: rgba(255,178,26,.18); }
.ghost-button { padding: 10px 14px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 12px; }
.ghost-button:hover { color: var(--text); background: var(--panel-3); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card { position: relative; min-height: 133px; padding: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, var(--panel-2), var(--panel)); }
.metric-card::after { content: ""; position: absolute; right: -24px; bottom: -42px; width: 105px; height: 105px; border-radius: 50%; background: rgba(255,255,255,.025); }
.metric-card span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.metric-card strong { display: block; margin: 12px 0 5px; font-size: 32px; line-height: 1; }
.metric-card small { color: var(--muted-2); font-size: 10px; }
.metric-card.good strong { color: var(--good); }
.metric-card.busy strong { color: var(--busy); }
.metric-card.accent strong { color: var(--accent); }
.metric-card.warn strong { color: var(--warn); }
.metric-grid.compact { margin-bottom: 18px; }
.metric-grid.compact .metric-card { min-height: 105px; padding: 17px; }
.metric-grid.compact .metric-card strong { font-size: 27px; }
.loading-card { opacity: .72; }

.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(21,27,37,.92); box-shadow: 0 16px 45px rgba(0,0,0,.12); }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 21px 22px; border-bottom: 1px solid var(--line-soft); }
.panel-header h3 { margin: 0; font-size: 17px; }
.status-breakdown { padding: 9px 22px 20px; }
.status-row { display: grid; grid-template-columns: 110px minmax(0,1fr) 35px; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.status-row:last-child { border-bottom: 0; }
.status-label { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.status-bar { height: 7px; overflow: hidden; border-radius: 99px; background: var(--panel-3); }
.status-bar span { display: block; height: 100%; border-radius: inherit; background: var(--busy); }
.status-row[data-type="disponivel"] .status-bar span { background: var(--good); }
.status-row[data-type="em-rota"] .status-bar span { background: var(--busy); }
.status-row[data-type="ferias"] .status-bar span { background: var(--accent); }
.status-value { color: var(--text); font-family: ui-monospace, monospace; font-size: 12px; text-align: right; }
.progress-label { padding: 5px 8px; border: 1px solid rgba(255,178,26,.18); border-radius: 6px; color: var(--accent); background: var(--accent-soft); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.progress-track { height: 5px; margin: 20px 22px 0; overflow: hidden; border-radius: 99px; background: var(--panel-3); }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #ffd36f); }
.migration-list { margin: 15px 0 0; padding: 0 22px 22px; list-style: none; }
.migration-list li { position: relative; padding: 8px 0 8px 27px; color: var(--muted-2); font-size: 12px; }
.migration-list li::before { content: ""; position: absolute; left: 2px; top: 10px; width: 11px; height: 11px; border: 1px solid var(--line); border-radius: 50%; }
.migration-list li.done { color: var(--muted); }
.migration-list li.done::before { content: "✓"; display: grid; place-items: center; border-color: var(--good); color: var(--good); font-size: 8px; }
.migration-list li.current { color: var(--text); font-weight: 700; }
.migration-list li.current::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 12px rgba(255,178,26,.35); }
.skeleton-line { height: 38px; margin: 8px 0; border-radius: 6px; background: linear-gradient(90deg, var(--panel-2), var(--panel-3), var(--panel-2)); background-size: 220% 100%; animation: shimmer 1.2s linear infinite; }

.resources-heading { margin-top: 0; }
.resources-panel { overflow: hidden; }
.filters { display: grid; grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(135px, .7fr)) auto; gap: 10px; padding: 18px; border-bottom: 1px solid var(--line-soft); }
.filters input, .filters select { width: 100%; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px; outline: none; background: var(--panel-2); color: var(--text); font-size: 12px; }
.filters input::placeholder { color: var(--muted-2); }
.filters input:focus, .filters select:focus { border-color: rgba(255,178,26,.55); box-shadow: 0 0 0 3px rgba(255,178,26,.08); }
.filters select option { background: var(--panel-2); }
.table-meta { display: flex; justify-content: space-between; gap: 20px; padding: 13px 18px; color: var(--muted); font-size: 11px; border-bottom: 1px solid var(--line-soft); }
.table-wrap { width: 100%; overflow-x: auto; }
.resource-table { width: 100%; min-width: 860px; border-collapse: collapse; }
.resource-table th { padding: 12px 15px; color: var(--muted-2); background: rgba(255,255,255,.018); font-size: 9px; letter-spacing: .12em; text-align: left; text-transform: uppercase; }
.resource-table td { padding: 13px 15px; border-top: 1px solid var(--line-soft); font-size: 12px; }
.resource-table tbody tr { transition: .14s ease; }
.resource-table tbody tr:hover { background: rgba(255,255,255,.022); }
.resource-table tbody tr td:first-child { border-left: 3px solid var(--muted-2); font-family: ui-monospace, monospace; color: var(--muted); }
.resource-table tbody tr[data-status="DISPONÍVEL"] td:first-child { border-left-color: var(--good); }
.resource-table tbody tr[data-status="EM ROTA"] td:first-child { border-left-color: var(--busy); }
.resource-table tbody tr[data-status="FÉRIAS"] td:first-child { border-left-color: var(--accent); }
.person-name { font-weight: 700; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); font-family: ui-monospace, monospace; font-size: 9px; white-space: nowrap; }
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); }
.status-badge[data-status="DISPONÍVEL"]::before { background: var(--good); }
.status-badge[data-status="EM ROTA"]::before { background: var(--busy); }
.status-badge[data-status="FÉRIAS"]::before { background: var(--accent); }
.table-state { padding: 50px 20px; color: var(--muted); text-align: center; font-size: 13px; }
.table-state.error { color: var(--warn); }
.table-state code { color: var(--accent); }

.placeholder-panel { min-height: 62vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 50px 25px; border: 1px dashed var(--line); border-radius: var(--radius); background: radial-gradient(circle at 50% 30%, rgba(255,178,26,.07), transparent 28%), rgba(21,27,37,.7); text-align: center; }
.placeholder-icon { width: 62px; height: 62px; display: grid; place-items: center; margin-bottom: 24px; border: 1px solid rgba(255,178,26,.25); border-radius: 14px; background: var(--accent-soft); color: var(--accent); font-size: 27px; }
.placeholder-panel h2 { margin: 0; font-size: clamp(26px, 4vw, 45px); }
.placeholder-panel > p:not(.eyebrow) { max-width: 570px; margin: 15px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.phase-badge { margin-top: 24px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: var(--panel); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.app-footer { display: flex; justify-content: space-between; gap: 20px; padding: 18px clamp(22px, 3vw, 42px); border-top: 1px solid var(--line-soft); color: var(--muted-2); font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.mobile-overlay { position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.6); backdrop-filter: blur(2px); }

@keyframes pulse { 50% { opacity: .3; } }
@keyframes shimmer { to { background-position: -220% 0; } }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .filters { grid-template-columns: 1fr 1fr 1fr; }
  .search-field { grid-column: span 2; }
}
@media (max-width: 850px) {
  .sidebar { transform: translateX(-102%); transition: transform .22s ease; }
  .sidebar.open { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .menu-button { display: block; }
  .topbar { min-height: 76px; }
  .user-chip { display: none; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .hero-panel { grid-template-columns: 1fr; }
  .hero-version { width: 100%; min-width: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; text-align: left; }
  .hero-version strong { margin: 0 14px; }
  .hero-version small { text-align: right; }
}
@media (max-width: 620px) {
  .content { padding: 22px 15px 32px; }
  .topbar { padding: 13px 15px; }
  .topbar-title h1 { font-size: 20px; }
  .connection-pill { padding: 8px 9px; }
  .connection-pill span:last-child { max-width: 95px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hero-panel { padding: 24px 20px; }
  .hero-panel h2 { font-size: 34px; }
  .hero-version { display: block; text-align: center; }
  .hero-version strong { margin: 8px 0; }
  .hero-version small { text-align: center; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { min-height: 116px; padding: 15px; }
  .metric-card strong { font-size: 27px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .filters { grid-template-columns: 1fr; }
  .search-field { grid-column: auto; }
  .table-meta { align-items: flex-start; flex-direction: column; gap: 4px; }
  .app-footer { flex-direction: column; gap: 6px; }
}
