:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --ink: #172033;
  --muted: #667085;
  --line: #d9e0ea;
  --blue: #2563eb;
  --teal: #0f766e;
  --amber: #b45309;
  --red: #b42318;
  --violet: #6d28d9;
  --sidebar: #111827;
  --sidebar-soft: #1f2937;
  --shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
}
.sidebar {
  background: var(--sidebar);
  color: #e5e7eb;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  min-height: 58px;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: white;
  font-weight: 900;
}
.brand strong, .brand small { display: block; }
.brand small { color: #aeb7c5; margin-top: 2px; }
.nav { margin-top: 18px; display: grid; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 10px;
  border-radius: 8px;
  color: #cbd5e1;
}
.nav-item span {
  width: 24px;
  display: inline-grid;
  place-items: center;
  color: #93c5fd;
}
.nav-item:hover, .nav-item.active {
  background: var(--sidebar-soft);
  color: #fff;
}
.nav-item.active { box-shadow: inset 3px 0 0 var(--blue); }
.main { min-width: 0; padding: 24px; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}
.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  font-weight: 800;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 1.75rem; line-height: 1.15; }
h2 { margin-bottom: 0; font-size: 1rem; }
h3 { font-size: 0.9rem; margin-bottom: 12px; }
.muted { color: var(--muted); }
.userbox {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 8px 10px 8px 14px;
  border-radius: 8px;
}
.userbox a { color: var(--blue); font-weight: 800; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.metrics-grid.tight { grid-template-columns: repeat(2, minmax(220px, 1fr)); max-width: 760px; }
.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
  min-height: 118px;
}
.metric small, .metric span { display: block; color: var(--muted); }
.metric strong { display: block; font-size: 1.85rem; margin: 8px 0 4px; }
.metric.warn { border-top: 4px solid var(--amber); }
.metric.money { border-top: 4px solid var(--teal); }

.workspace-grid, .split-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.split-grid { grid-template-columns: minmax(300px, 420px) minmax(0, 1fr) minmax(0, 1fr); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}
.btn.primary { background: var(--blue); border-color: var(--blue); color: white; }
.btn.ghost { background: var(--surface-2); color: var(--blue); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th {
  text-align: left;
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 12px 8px;
  border-bottom: 1px solid #edf1f6;
  vertical-align: top;
}
td a { color: var(--blue); font-weight: 800; }
small { color: var(--muted); }
.empty { color: var(--muted); padding: 14px 0; }

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  background: #eef2ff;
  color: #3730a3;
}
.pill.normal, .pill.neutral, .pill.pago, .pill.concluída { background: #ecfdf3; color: #067647; }
.pill.atenção, .pill.alta, .pill.alto, .pill.aberto { background: #fffaeb; color: var(--amber); }
.pill.crítica, .pill.critico, .pill.crítico, .pill.atrasado, .pill.alto { background: #fef3f2; color: var(--red); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.form-grid.one { grid-template-columns: 1fr; }
.full { grid-column: 1 / -1; }
label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-height: 39px;
  padding: 9px 10px;
  color: var(--ink);
}
textarea { resize: vertical; }
.search input { min-width: 280px; }
.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}
.inline-form.compact { grid-template-columns: 1fr; }

.stack-list, .timeline, .calendar-list, .roadmap, .check-list { display: grid; gap: 10px; }
.list-row, .calendar-item, .timeline-item, .task-card, .roadmap div {
  border: 1px solid var(--line);
  background: #fbfcfe;
  border-radius: 8px;
  padding: 11px;
}
.list-row { display: grid; gap: 4px; }
.list-row span, .calendar-item span { color: var(--muted); }
.calendar-item {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.calendar-item time {
  display: grid;
  place-items: center;
  min-height: 56px;
  border-radius: 8px;
  background: var(--surface-2);
}
.calendar-item time strong { font-size: 1.3rem; }
.calendar-item em { color: var(--teal); font-style: normal; font-weight: 900; }

.data-list {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 9px 12px;
}
.data-list dt { color: var(--muted); font-weight: 900; }
.data-list dd { margin: 0; }
.note-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: #344054;
}
.timeline-item strong, .timeline-item small { display: block; }
.timeline-item p { margin: 6px 0 0; }

.kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.kanban-col {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  min-height: 260px;
}
.task-card {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}
.task-card em { justify-self: start; font-style: normal; }

.bar-list { display: grid; gap: 12px; }
.bar-list div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: center;
}
.bar-list i {
  grid-column: 1 / -1;
  display: block;
  height: 8px;
  max-width: 100%;
  border-radius: 999px;
  background: var(--blue);
}
.bar-list.alt i { background: var(--violet); }
.check-list { padding-left: 18px; color: #344054; }
.roadmap div { display: grid; gap: 4px; }
.roadmap span { color: var(--muted); }

.flash-stack { display: grid; gap: 8px; margin-bottom: 14px; }
.flash {
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #eef4ff;
  color: #1849a9;
  font-weight: 800;
}
.flash.success { background: #ecfdf3; color: #067647; }
.flash.danger { background: #fef3f2; color: var(--red); }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #111827 0%, #1f2937 42%, #0f766e 100%);
}
.login-shell { width: min(440px, calc(100vw - 32px)); }
.login-panel {
  background: var(--surface);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.28);
}
.login-brand { padding: 0 0 18px; color: var(--ink); }
.login-panel h1 { font-size: 1.6rem; margin-bottom: 8px; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main { padding: 16px; }
  .metrics-grid, .workspace-grid, .split-grid, .kanban { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: span 1; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .calendar-item { grid-template-columns: 58px minmax(0, 1fr); }
  .calendar-item em { grid-column: 2; }
  .inline-form { grid-template-columns: 1fr; }
}
