:root {
  --navy: #191e45;
  --navy-2: #12162f;
  --ink-bg: #07080f;
  --paper: #0b0c16;
  --paper-2: #14172a;
  --ink: #f4f2ff;
  --ink-soft: #c5c1d8;
  --muted: #8b87a0;
  --line: rgba(255, 255, 255, 0.1);
  --forest: #05060c;
  --forest-2: #0c0e1c;
  --moss: #6d4aff;
  --leaf: rgba(140, 0, 255, 0.18);
  --copper: #8c00ff;
  --copper-soft: rgba(140, 0, 255, 0.2);
  --sand: #3a3d55;
  --rose: #ff4d6d;
  --rose-soft: rgba(255, 77, 109, 0.16);
  --sky: #6b8cff;
  --sky-soft: rgba(107, 140, 255, 0.18);
  --ok: #5ee0b5;
  --ok-soft: rgba(94, 224, 181, 0.14);
  --warn: #c9a227;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --sidebar: 292px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1000px 480px at 0% -10%, rgba(140, 0, 255, 0.16), transparent 52%),
    radial-gradient(900px 420px at 100% 0%, rgba(25, 30, 69, 0.7), transparent 48%),
    var(--ink-bg);
  font-family: Inter, Outfit, "Segoe UI", sans-serif;
  font-weight: 500;
  letter-spacing: 0.01em;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }

.app {
  min-height: 100%;
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  background: linear-gradient(180deg, #000 0%, #080910 58%, #0c1020 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 22px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-close-bar { display: none; }
.sidebar-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  gap: 22px;
  align-content: start;
}
.sidebar-backdrop {
  display: none;
}

.brand {
  display: grid;
  gap: 10px;
  padding: 4px 4px 8px;
}

.brand-logo {
  display: block;
  width: min(100%, 220px);
  height: auto;
}

.mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--copper);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: Outfit, Inter, sans-serif;
  font-weight: 700;
  font-size: 18px;
}

.brand h1 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
  font-family: Outfit, Inter, sans-serif;
  font-weight: 600;
  color: #fff;
}
.brand small {
  display: block;
  margin-top: 2px;
  color: #b7b3c9;
  font-size: 12px;
}

.side-block h2,
.panel-head h2,
.col-head h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.side-block h2 { color: #9d98b5; margin-bottom: 10px; }

.project-nav, .stage-nav { display: grid; gap: 6px; }

.nav-item, .icon-btn, .btn, .chip, .tab {
  border: 0;
  background: transparent;
}

.nav-item {
  width: 100%;
  text-align: left;
  padding: 10px 10px;
  border-radius: 12px;
  color: #f0edf8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.nav-item:hover, .nav-item.active { background: rgba(140, 0, 255, 0.14); }
.nav-item.active { outline: 1px solid rgba(140, 0, 255, 0.35); }
.nav-item b { display: block; font-weight: 600; font-size: 14px; }
.nav-item span { color: #a9a4bd; font-size: 12px; }
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.count-pill {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(140, 0, 255, 0.28);
  color: #f3e8ff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 650;
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 8px;
}
.side-user {
  padding: 8px 4px 2px;
  color: #b7b3c9;
}
.side-user small {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.side-user b {
  display: block;
  margin-top: 2px;
  color: #fff;
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  background: #1c2144;
  color: #fff;
  font-weight: 600;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost {
  background: rgba(255,255,255,0.04);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.1);
}
.btn.soft {
  background: #161a33;
  border: 1px solid var(--line);
  color: var(--ink);
}
.btn.primary { background: var(--copper); color: #fff; }
.btn.danger { background: var(--rose); color: #fff; }
.btn.wide { width: 100%; }

.workspace { min-width: 0; }
.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 32px 8px;
}
.crumb { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.crumb a { color: #d7c6ff; text-decoration: none; }
.topbar h2 {
  margin: 0;
  font-family: Outfit, Inter, sans-serif;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.topbar p { margin: 6px 0 0; color: var(--ink-soft); max-width: 62ch; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.page { padding: 18px 32px 40px; }

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.stats.flow {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.stats-extra { margin: -10px 0 18px; }
.chip.action-chip { cursor: pointer; }
.chip.action-chip:hover, .chip.action-chip.active {
  border-color: rgba(140, 0, 255, 0.45);
  color: #fff;
}
.stat, .project-card, .panel, .issue-card, .row-card, .kanban-col {
  background: rgba(18, 22, 47, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.stat, .project-card, .panel, .kanban-col { border-radius: var(--radius); }
.stat { padding: 16px 18px; }
.stat em { display: block; font-style: normal; color: var(--muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 650; }
.stat strong { display: block; margin-top: 6px; font-size: 28px; font-family: Outfit, Inter, sans-serif; }

.grid-projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.project-card {
  padding: 20px;
  text-align: left;
  display: grid;
  gap: 14px;
  transition: transform .18s ease, box-shadow .18s ease;
}
.project-card:hover { transform: translateY(-3px); box-shadow: 0 22px 40px rgba(0, 0, 0, 0.4); }
.project-card header { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.project-card h3 {
  margin: 0;
  font-family: Outfit, Inter, sans-serif;
  font-size: 22px;
  font-weight: 600;
}
.project-card .client { color: var(--muted); font-size: 13px; margin-top: 4px; }
.progress {
  height: 8px;
  border-radius: 99px;
  background: #0d1020;
  overflow: hidden;
}
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--navy), var(--copper)); }
.meta-row, .chip-row, .toolbar, .tabs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.meta-row span, .chip {
  font-size: 12px;
  color: var(--ink-soft);
  background: #0d1020;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
}

.toolbar {
  justify-content: space-between;
  margin: 8px 0 16px;
}
.tabs { background: #0d1020; padding: 4px; border-radius: 14px; }
.tab {
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--ink-soft);
  font-weight: 600;
}
.tab.active { background: var(--navy); color: #fff; box-shadow: inset 0 0 0 1px rgba(140, 0, 255, 0.35); }

.select, .search, .field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #101428;
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
  color: var(--ink);
}
.search { width: 240px; }
.field textarea { min-height: 92px; resize: vertical; }
.field { display: grid; gap: 6px; }
.field label { font-size: 12px; font-weight: 650; color: var(--ink-soft); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.kanban-col { min-height: 420px; padding: 12px; }
.col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 8px 12px;
}
.col-head span { color: var(--muted); font-size: 12px; }
.col-encontrado { background: linear-gradient(180deg, #171b38 0%, rgba(12, 14, 28, 0.72) 100%); }
.col-em_correcao { background: linear-gradient(180deg, #23143a 0%, rgba(12, 14, 28, 0.72) 100%); }
.col-validacao { background: linear-gradient(180deg, #2a2212 0%, rgba(12, 14, 28, 0.72) 100%); }
.col-backlog { background: linear-gradient(180deg, #161824 0%, rgba(12, 14, 28, 0.72) 100%); }
.col-concluido { background: linear-gradient(180deg, #142033 0%, rgba(12, 14, 28, 0.72) 100%); }
.drop-on { outline: 2px dashed var(--copper); outline-offset: -6px; }

.cards { display: grid; gap: 10px; min-height: 80px; }
.issue-card, .row-card {
  border-radius: 16px;
  padding: 14px;
  text-align: left;
  border: 1px solid rgba(255,255,255,0.08);
  background: #101428;
}
.issue-card { cursor: grab; }
.issue-card:active { cursor: grabbing; }
.issue-card.prio-alta { box-shadow: inset 3px 0 0 var(--rose); }
.issue-card.prio-media { box-shadow: inset 3px 0 0 var(--copper); }
.issue-card.prio-baixa { box-shadow: inset 3px 0 0 #4b5070; }
.issue-card h4, .row-card h4 {
  margin: 8px 0 6px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}
.desc { margin: 0 0 10px; color: var(--ink-soft); font-size: 13px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge.erro { background: var(--rose-soft); color: #ff8da0; }
.badge.melhoria { background: var(--sky-soft); color: #9bb4ff; }
.badge.etapa { background: var(--leaf); color: #e3c6ff; }
.badge.prio { background: var(--copper-soft); color: #d7b3ff; }
.badge.validacao { background: rgba(201, 162, 39, 0.18); color: #e8c96a; }
.badge.backlog { background: rgba(255,255,255,0.08); color: #c5c1d8; }

.who {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
}
.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 650;
  color: #fff;
}

.list { display: grid; gap: 18px; }
.panel { padding: 8px; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 10px 6px;
}
.row-card {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  align-items: start;
  width: 100%;
  margin: 8px;
  width: calc(100% - 16px);
}
.check {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--copper);
}
.row-card.done h4 { text-decoration: line-through; color: var(--muted); }
.row-side { display: grid; justify-items: end; gap: 8px; }
.backlog-panel { padding: 8px 8px 16px; }
.backlog-lead {
  margin: 0 10px 8px;
  color: var(--ink-soft);
  font-size: 13px;
  max-width: 72ch;
}
.backlog-row { grid-template-columns: 1fr auto; }
.backlog-actions { justify-content: flex-end; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 12, 0.72);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 20;
}
.modal {
  width: min(640px, 100%);
  background: #12162f;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  color: var(--ink);
}
.modal h3 {
  margin: 0 0 16px;
  font-family: Outfit, Inter, sans-serif;
  font-size: 26px;
  font-weight: 600;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.chips-edit { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-edit button {
  border: 0;
  background: #101428;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 10px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.toast-wrap {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  z-index: 30;
}
.toast {
  background: #000;
  color: #fff;
  border: 1px solid rgba(140, 0, 255, 0.35);
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.menu-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 11;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: #000;
  color: #fff;
}
.menu-btn.is-hidden {
  visibility: hidden;
  pointer-events: none;
}

.empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
}
.empty b { display: block; color: var(--ink); margin-bottom: 4px; }

.login-screen {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 28px 18px;
  background:
    radial-gradient(900px 420px at 50% -20%, rgba(140, 0, 255, 0.2), transparent 55%),
    #000;
}
.login-card {
  width: min(420px, 100%);
  background: #0b0d16;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.login-card header {
  background: #000;
  color: #fff;
  padding: 26px 26px 18px;
}
.login-card .brand { padding: 0; }
.login-card .brand-logo { width: min(100%, 240px); }
.login-form {
  display: grid;
  gap: 14px;
  padding: 8px 26px 26px;
}
.login-lead {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.45;
}
.login-error {
  background: var(--rose-soft);
  color: #ff8da0;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
}
.login-error[hidden] { display: none; }

.people-bar {
  display: grid;
  gap: 12px;
  margin: -4px 0 16px;
}
.tabs.mini { width: fit-content; }
.person-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: #101428;
  border-radius: 999px;
  padding: 6px 10px 6px 6px;
  color: var(--ink-soft);
  font-size: 13px;
}
.person-chip .avatar { width: 22px; height: 22px; font-size: 9px; }
.person-chip i {
  font-style: normal;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #0d1020;
  font-size: 11px;
  font-weight: 650;
}
.person-chip.active {
  background: var(--copper);
  color: #fff;
  border-color: transparent;
}
.person-chip.active i { background: rgba(255,255,255,0.16); color: #fff; }

.chart-panel { padding: 8px 8px 14px; margin-bottom: 22px; }
.chart { display: grid; gap: 10px; padding: 8px 12px 4px; }
.chart-row {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 1fr;
  gap: 12px;
  align-items: center;
}
.chart-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chart-who b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-track {
  position: relative;
  display: flex;
  height: 28px;
  border-radius: 999px;
  background: #0d1020;
  overflow: hidden;
}
.chart-seg { display: block; height: 100%; }
.chart-total {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 650;
  color: #fff;
  text-shadow: 0 0 8px rgba(0,0,0,0.6);
}
.seg-encontrado, .legend-item .seg-encontrado { background: #4a5488; }
.seg-em_correcao, .legend-item .seg-em_correcao { background: var(--copper); }
.seg-validacao, .legend-item .seg-validacao { background: #c9a227; }
.seg-backlog, .legend-item .seg-backlog { background: #6b6680; }
.seg-concluido, .legend-item .seg-concluido { background: #5ee0b5; }
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 14px 6px;
  color: var(--ink-soft);
  font-size: 12px;
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-item i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}
.user-row { grid-template-columns: 36px 1fr auto; }

@media (max-width: 1200px) {
  .chart-row { grid-template-columns: 1fr; gap: 6px; }
  .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats.flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  body.nav-open { overflow: hidden; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    height: 100dvh;
    max-height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    gap: 10px;
    transform: translateX(-105%);
    transition: transform .2s ease;
    z-index: 12;
  }
  .sidebar.open { transform: none; }
  .sidebar-close-bar {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 2;
    margin: -10px -12px 0;
    padding: 8px 12px;
    background: #000;
  }
  .sidebar-close {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 10px;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
  }
  .sidebar-close span { font-size: 22px; line-height: 1; }
  .sidebar .brand { gap: 6px; padding: 0 2px 2px; }
  .sidebar .brand-logo { width: min(100%, 168px); }
  .sidebar .brand h1 { font-size: 13px; }
  .sidebar-body {
    flex: 1 1 auto;
    overflow: visible;
    gap: 12px;
  }
  .side-block h2 { margin-bottom: 6px; }
  .project-nav, .stage-nav { gap: 4px; }
  .nav-item { padding: 8px; }
  .nav-item b { font-size: 13px; }
  .sidebar-foot {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin-top: auto;
    gap: 6px;
    padding-top: 10px;
    background: linear-gradient(180deg, transparent, #080910 14px, #0c1020 100%);
  }
  .sidebar-foot .btn { min-height: 36px; }
  .side-user { padding: 4px 4px 0; }
  .sidebar-backdrop.show {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 11;
    border: 0;
    padding: 0;
    background: rgba(4, 5, 12, 0.62);
    cursor: pointer;
  }
  .menu-btn { display: grid; place-items: center; }
  .kanban, .form-grid { grid-template-columns: 1fr; }
  .stats,
  .stats.flow {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
  }
  .stat { padding: 10px 10px; }
  .stat em { font-size: 9px; letter-spacing: 0.04em; }
  .stat strong { margin-top: 3px; font-size: 18px; }
  .backlog-row { grid-template-columns: 1fr; }
  .backlog-row .row-side { justify-items: start; }
  .page { padding-left: 16px; padding-right: 16px; }
  .topbar {
    align-items: flex-start;
    padding: 14px 16px 8px 64px;
    gap: 10px;
  }
  .topbar h2 { font-size: 22px; line-height: 1.2; }
  .top-actions { flex: 0 0 auto; }
  .search { width: 100%; }
}
