*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-bg);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.app {
  display: grid;
  grid-template-columns: var(--rail-w) var(--pane-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  height: 100vh;
  min-width: 0;
  width: 100%;
}

.icon-btn.menu-toggle,
.icon-btn.search-toggle,
.nav-scrim,
.mobile-tabbar {
  display: none;
}

.topbar {
  grid-column: 1 / -1;
  /* acima do .stage (que vira contexto de empilhamento pelo view-transition-name), abaixo da ai-bar e do menu móvel */
  position: relative;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 168px;
  font-family: var(--font-brand);
}

.brand-symbol {
  width: 36px;
  height: 36px;
  display: block;
  flex-shrink: 0;
}

.brand-wordmark {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--color-text);
  line-height: 1;
}

.search {
  flex: 1;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 34px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
}

.search input {
  border: none;
  background: transparent;
  width: 100%;
  outline: none;
  color: var(--color-text);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: var(--color-text-muted);
  transition: background var(--transition);
}

.icon-btn:hover {
  background: var(--color-surface-muted);
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  background: #6161ff;
}

.avatar.sm {
  width: 24px;
  height: 24px;
  font-size: 10px;
}

.avatar.lg {
  width: 40px;
  height: 40px;
  font-size: 14px;
}

.rail {
  background: var(--color-rail);
  color: #c5c7d0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-3) 0;
  gap: var(--space-1);
}


.rail-btn {
  width: 44px;
  min-height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 9px;
  color: #c5c7d0;
  transition: background var(--transition), color var(--transition);
}

.rail-btn:hover,
.rail-btn.active {
  background: var(--color-rail-hover);
  color: white;
}

.rail-btn svg {
  width: 18px;
  height: 18px;
}

.pane {
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.workspace-switcher {
  position: relative;
  padding: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.ws-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  transition: background var(--transition);
}

.ws-btn:hover {
  background: var(--color-surface-muted);
}

.ws-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: white;
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.02em;
}

.ws-icon.lg {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 20px;
}

.ws-meta {
  flex: 1;
  text-align: left;
  min-width: 0;
}

.ws-meta strong {
  display: block;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-meta span {
  display: block;
  font-size: 11px;
  color: var(--color-text-muted);
}

.ws-dropdown {
  display: none;
  position: absolute;
  top: calc(100% - 4px);
  left: var(--space-3);
  right: var(--space-3);
  z-index: 30;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-2);
}

.ws-dropdown.open {
  display: block;
}

.ws-dropdown input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0 var(--space-3);
  margin-bottom: var(--space-2);
}

.ws-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow: auto;
}

.ws-list button {
  width: 100%;
  display: flex;
  align-items: center;
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.ws-list button:hover,
.ws-list button.active {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

.pane-nav {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: auto;
}

.nav-label {
  margin: var(--space-3) 0 var(--space-1);
  padding: 0 var(--space-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-soft);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--color-text);
  transition: background var(--transition);
}

.nav-item:hover {
  background: var(--color-surface-muted);
}

.nav-item.active {
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-weight: 600;
}

.nav-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: #a25ddc;
  flex-shrink: 0;
}

.nav-item-muted {
  color: var(--color-text-soft);
  font-size: 12px;
}

.nav-project {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-md);
  text-align: left;
  margin-bottom: 2px;
}

.nav-project:hover,
.nav-project.active {
  background: var(--color-surface-muted);
}

.nav-project-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.nav-project-meta strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-project-meta em {
  font-style: normal;
  font-size: 11px;
  color: #e2445c;
  font-weight: 700;
}

.nav-tree {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0 0 8px 8px;
  padding-left: 10px;
  border-left: 2px solid var(--color-border);
}

.nav-child {
  font-size: 12.5px;
  padding: 6px 10px;
  flex-wrap: wrap;
}

.nav-hint {
  width: 100%;
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-soft);
  margin-left: 0;
}

.main {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: var(--color-bg);
  /* espaço pra ai-bar fixa não cobrir o fim das telas */
  padding-bottom: 96px;
}

.view {
  display: none;
  height: 100%;
}

.view.active {
  display: block;
}

/* troca de projeto: a tela anterior fica esmaecida até os itens do novo chegarem (segue clicável: dá para escolher outro projeto) */
.stage[aria-busy="true"] > .view {
  opacity: 0.45;
}

.stage[aria-busy="true"]::before {
  content: "Carregando projeto…";
  position: absolute;
  top: 16px;
  left: 50%;
  z-index: 5;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--color-text);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
}

/* Home */
.home {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--space-5);
  padding: var(--space-6);
  max-width: 1280px;
}

.pulse-panel {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
  position: relative;
  z-index: 1;
}

.home .tabs {
  position: relative;
  z-index: 2;
  background: var(--color-bg);
}

.pulse-hero-top {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.pulse-hero h2 {
  margin: 4px 0 6px;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.pulse-hero .eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.pulse-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.kpi {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
}

.kpi-val {
  display: block;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.kpi-val.warn {
  color: #e2445c;
}

.kpi-val.ok {
  color: #00c875;
}

.kpi-label {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 600;
}

.pulse-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.pulse-grid > .card {
  min-width: 0;
  overflow: hidden;
}

.pulse-projects {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pulse-project {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  text-align: left;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}

.pulse-project strong {
  grid-column: 2;
}

.pulse-project .muted {
  grid-column: 2;
  font-size: 12px;
}

.timeline-feed li {
  padding: 8px 0;
}

.timeline-copy {
  min-width: 0;
}

.timeline-copy strong {
  display: block;
  line-height: 1.35;
  font-weight: 700;
}

.home-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.home-header h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.home-header p {
  margin: 4px 0 0;
  color: var(--color-text-muted);
  font-size: 13px;
}

.tabs {
  grid-column: 1 / -1;
  display: flex;
  gap: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.tab {
  padding: 10px 2px;
  font-size: 14px;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
  font-weight: 600;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}

.ai-card h2 {
  margin: 0 0 var(--space-2);
  font-size: 18px;
}

.ai-card .hint {
  margin: 0 0 var(--space-4);
  color: var(--color-text-muted);
  font-size: 13px;
}

.ai-input-row {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.ai-input-row input {
  flex: 1;
  height: 42px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0 var(--space-3);
}

.btn {
  height: 36px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  transition: background var(--transition), color var(--transition);
}

.btn-primary {
  background: var(--color-accent);
  color: white;
}

.btn-primary:hover {
  background: var(--color-accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.btn-ghost:hover {
  background: var(--color-surface-muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chip {
  height: 32px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  color: var(--color-text);
  font-size: 12px;
}

.chip:hover {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

.section-title {
  margin: var(--space-5) 0 var(--space-3);
  font-size: 14px;
  font-weight: 700;
}

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.recent-list button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  text-align: left;
}

.recent-list button:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.side-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.side-stack h3 {
  margin: 0 0 var(--space-3);
  font-size: 14px;
}

.member-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  font-size: 13px;
}

.dropzone {
  border: 1.5px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  text-align: center;
  color: var(--color-text-muted);
  font-size: 12px;
  background: var(--color-surface-muted);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.muted-box {
  padding: var(--space-6);
  color: var(--color-text-muted);
  font-size: 14px;
}

/* Board */
.board {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.board-header {
  padding: var(--space-5) var(--space-6) var(--space-3);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.board-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}

.board-title-row h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.board-links {
  display: flex;
  gap: var(--space-3);
  font-size: 13px;
  color: var(--color-text-muted);
}

.board-links button:hover {
  color: var(--color-accent);
}

.view-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.view-tab {
  padding: 8px 2px;
  font-size: 14px;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
}

.view-tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
  font-weight: 600;
}

.view-menu-wrap {
  position: relative;
}

.view-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  min-width: 200px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-2);
}

.view-menu.open {
  display: block;
}

.view-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.view-menu button:hover {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.toolbar .btn-primary {
  height: 32px;
}

.tool {
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tool:hover {
  background: var(--color-surface-muted);
  color: var(--color-text);
}

.board-body {
  flex: 1;
  overflow: auto;
  padding: var(--space-5) var(--space-6) 100px;
}

.group {
  margin-bottom: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.group-header {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 12px;
  background: var(--color-surface);
}

.group-toggle {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  color: var(--color-text-muted);
}

.group-toggle:hover {
  background: var(--color-surface-muted);
}

.group-name {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: 14px;
}

.group-name .count {
  font-weight: 500;
  color: var(--color-text-muted);
  font-size: 12px;
}

.group.todo .group-name {
  color: var(--color-group-todo);
}

.group.done .group-name {
  color: var(--color-group-done);
}

.summary-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.status-summary {
  display: flex;
  width: 120px;
  height: 8px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: var(--color-surface-muted);
}

.status-summary span {
  height: 100%;
}

.status-summary .done {
  background: var(--color-success);
}

.status-summary .working {
  background: var(--color-warning);
}

.status-summary .stuck {
  background: var(--color-danger);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-soft);
  padding: 8px 12px;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  background: #fafbfc;
}

.table td {
  padding: 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: none;
}

.cell {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  gap: var(--space-2);
}

.row-accent {
  width: 6px;
  align-self: stretch;
  margin: 0;
  padding: 0;
}

.group.todo .row-accent {
  background: var(--color-group-todo);
}

.group.done .row-accent {
  background: var(--color-group-done);
}

.task-name {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 0;
  outline: none;
  min-width: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: 100%;
  height: 28px;
  padding: 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 4px;
  color: white;
  font-size: 12px;
  font-weight: 700;
  width: 100%;
}

.status-pill.working {
  background: var(--color-warning);
}

.status-pill.done {
  background: var(--color-success);
}

.status-pill.stuck {
  background: var(--color-danger);
}

.status-pill.empty {
  background: var(--color-surface-muted);
  color: var(--color-text-soft);
}

.date-pill {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-size: 12px;
  font-weight: 600;
}

.timeline-bar {
  height: 10px;
  width: 100%;
  max-width: 140px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, #579bfc, #0073ea);
}

.add-row {
  width: 100%;
  text-align: left;
  padding: 10px 12px 10px 34px;
  color: var(--color-text-muted);
  font-size: 13px;
}

.add-row:hover {
  background: var(--color-surface-muted);
  color: var(--color-accent);
}

.add-group {
  margin-top: var(--space-2);
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 4px;
}

.add-group:hover {
  color: var(--color-accent);
}

.group.collapsed .group-body {
  display: none;
}

/* Cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-4);
}

.task-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.task-card-hero {
  height: 120px;
  background: var(--color-surface-muted);
  display: grid;
  place-items: center;
}

.task-card-body {
  padding: var(--space-4);
  overflow-wrap: anywhere;
}

.task-card-body h3 {
  margin: 0 0 var(--space-4);
  font-size: 16px;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  font-size: 12px;
  color: var(--color-text-muted);
}

.meta-row .status-pill {
  min-width: 110px;
  width: auto;
}

/* AI floating */
.ai-bar {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: min(420px, calc(100vw - 80px));
  height: 48px;
  padding: 0 8px 0 16px;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
}

.ai-bar-icon {
  color: var(--color-accent);
  font-size: 14px;
}

.ai-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
}

.ai-bar .send {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-accent);
  color: white;
  display: grid;
  place-items: center;
}

.ai-panel {
  display: none;
  position: fixed;
  right: 20px;
  bottom: 80px;
  width: 320px;
  z-index: 41;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-4);
  max-height: calc(100dvh - 100px);
  overflow-y: auto;
}

.ai-panel.open {
  display: block;
}

#ai-panel-body {
  max-height: calc(100dvh - 240px);
  overflow: auto;
  overflow-wrap: anywhere;
}

.ai-panel h4 {
  margin: 0 0 var(--space-2);
}

.ai-panel p {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.45;
}

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(480px, calc(100vw - 32px));
  overflow-wrap: anywhere;
  z-index: 90;
  background: var(--color-text);
  color: white;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.toast.show {
  opacity: 1;
}

.hidden {
  display: none !important;
}

.page {
  padding: var(--space-6);
  padding-bottom: 96px;
  max-width: 1100px;
}

.page-activity {
  max-width: none;
  width: 100%;
  box-sizing: border-box;
}

.activity-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: var(--space-4);
  align-items: start;
  min-height: calc(100vh - 220px);
}

.activity-feed {
  min-height: 520px;
  padding: 0;
  overflow: hidden;
}

.activity-stream {
  list-style: none;
  margin: 0;
  padding: 0;
}

.activity-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
}

.activity-row:hover {
  background: var(--color-surface-muted);
}

.activity-body strong {
  display: block;
  font-size: 14px;
}

.activity-aside h3 {
  margin: 0 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-soft);
}

.activity-stat {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
}

.activity-stat strong {
  font-size: 18px;
}

.attention-item {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}

.board-embed {
  min-height: 420px;
}

.field-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

.field-grid-2 .wp-field {
  grid-template-columns: 1fr;
  gap: 4px;
  margin-bottom: 10px;
}

.field-grid-2 .wp-field .label {
  padding-top: 0;
  font-size: 11px;
}

.attr-more {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--color-border);
}

.attr-more summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 8px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.page-header > :first-child {
  min-width: 0;
}

.page-header h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.page-header p {
  margin: 6px 0 0;
  color: var(--color-text-muted);
  font-size: 14px;
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.map-card,
.settings-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), transform var(--transition);
}

.map-card:hover,
.settings-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-1px);
}

.map-card strong,
.settings-card strong {
  font-size: 15px;
}

.map-card span,
.settings-card span {
  font-size: 13px;
  color: var(--color-text-muted);
}

.map-card em {
  font-style: normal;
  font-size: 12px;
  color: var(--color-accent);
  font-weight: 700;
}

.note-card h3 {
  margin: 0 0 var(--space-2);
  font-size: 15px;
}

.note-card p {
  margin: 0 0 var(--space-3);
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1.45;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.table-card {
  padding: 0;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  font-size: 13px;
}

#projects-table td:first-child {
  overflow-wrap: anywhere;
}

.data-table th {
  color: var(--color-text-soft);
  font-weight: 600;
  background: #fafbfc;
}

.proj-status {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
}

.proj-status.risk {
  background: #fde8ec;
  color: var(--color-danger);
}

.proj-status.ok {
  background: #e5f8ef;
  color: var(--color-success);
}

.proj-status.watch {
  background: #fff3e0;
  color: #c77700;
}

.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.split-2 h3 {
  margin: 0 0 var(--space-4);
  font-size: 15px;
}

.res-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-3);
  font-size: 13px;
}

.bar-track {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-crest-blue), var(--color-crest-magenta));
}

.hours {
  font-weight: 700;
  color: var(--color-text);
}

.bar-fill.over {
  background: var(--color-danger);
}

.hours.over {
  color: var(--color-danger);
}

.type-chip {
  --type-color: #676879;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  height: 24px;
  padding: 0 8px 0 4px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--type-color) 14%, #fff);
  color: var(--color-text);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
}

.type-chip__icon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: var(--type-color);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  line-height: 1;
  flex-shrink: 0;
}

.type-chip__label {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.type-chip--epic { --type-color: #a25ddc; }
.type-chip--story { --type-color: #00c875; }
.type-chip--bug { --type-color: #e2445c; }
.type-chip--feature { --type-color: #579bfc; }
.type-chip--milestone { --type-color: #0073ea; }
.type-chip--task { --type-color: #0073ea; }
.type-chip--other { --type-color: #676879; }

.table th:nth-child(3),
.table td:nth-child(3) {
  width: 128px;
  max-width: 128px;
}

.table th:nth-child(5),
.table td:nth-child(5) {
  width: 118px;
  max-width: 140px;
}

.task-link {
  text-align: left;
  color: var(--color-text);
  font-weight: 600;
  padding: 0;
  overflow-wrap: anywhere;
}

.task-link:hover {
  color: var(--color-accent);
}

.task-link.title {
  font-size: 16px;
  margin-bottom: var(--space-3);
  display: block;
}

.child-cell {
  padding-left: 18px;
}

span.cal-day-num,
span.cal-day-num:hover {
  display: inline-block;
  cursor: default;
  color: inherit;
}

.kanban-card[draggable="false"] {
  cursor: default;
}

.plain-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.plain-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: none;
  height: auto;
  background: none;
  border-radius: 0;
}

.timeline li {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
  min-width: 0;
}

.timeline li > div {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}

.timeline .when {
  color: var(--color-text-soft);
  font-size: 12px;
  white-space: nowrap;
}

.muted {
  color: var(--color-text-muted);
  font-size: 13px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(50, 51, 56, 0.35);
  z-index: 60;
}

.drawer-backdrop.open {
  display: block;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100vw);
  height: 100vh;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  z-index: 70;
  transform: translateX(105%);
  transition: transform var(--transition);
  display: flex;
  flex-direction: column;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.drawer-head h2 {
  margin: 4px 0 0;
  font-size: 20px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-soft);
}

.drawer-tabs {
  display: flex;
  gap: var(--space-2);
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--color-border);
  overflow: auto;
}

.drawer-tab {
  padding: 12px 8px;
  font-size: 13px;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.drawer-tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
  font-weight: 700;
}

.drawer-body {
  padding: var(--space-5);
  overflow: auto;
}

.field-grid {
  display: grid;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.field-grid .label,
.hierarchy .label,
.field > span {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-soft);
  margin-bottom: 6px;
}

.hierarchy > div {
  margin-bottom: var(--space-4);
}

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  place-items: center;
  background: rgba(50, 51, 56, 0.35);
  z-index: 80;
}

.modal-backdrop.open {
  display: grid;
}

.modal {
  width: min(420px, calc(100vw - 32px));
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  padding: var(--space-5);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}

.modal-head h3 {
  margin: 0;
  font-size: 18px;
}

.modal-copy {
  margin: 0 0 var(--space-4);
  color: var(--color-text-muted);
  font-size: 13px;
}

.field {
  display: block;
  margin-bottom: var(--space-3);
}

.field input,
.field select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0 var(--space-3);
  background: var(--color-surface);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

/* Mobile e app */
@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: var(--header-h) 1fr;
    height: 100dvh;
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  .icon-btn.menu-toggle,
  .icon-btn.search-toggle {
    display: grid;
  }

  .hide-mobile {
    display: none !important;
  }

  .brand {
    min-width: 0;
    flex: 1;
  }

  .brand-wordmark {
    font-size: 22px;
  }

  .brand-symbol {
    width: 30px;
    height: 30px;
  }

  .topbar {
    gap: var(--space-2);
    padding: 0 var(--space-3);
  }

  .search {
    display: none;
  }

  .app.search-open .search {
    display: flex;
    position: fixed;
    top: calc(var(--header-h) + 6px);
    left: 12px;
    right: 12px;
    max-width: none;
    margin: 0;
    z-index: 36;
    background: var(--color-surface);
    box-shadow: var(--shadow-md);
  }

  .rail,
  .pane {
    display: none;
    position: fixed;
    z-index: 55;
  }

  .app.nav-open .nav-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(50, 51, 56, 0.4);
    z-index: 54;
  }

  .app.nav-open .rail {
    display: flex;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--rail-w);
  }

  .app.nav-open .pane {
    display: flex;
    left: var(--rail-w);
    top: 0;
    bottom: 0;
    width: min(280px, calc(100vw - var(--rail-w)));
    box-shadow: var(--shadow-md);
  }

  .main {
    grid-column: 1;
  }

  .home {
    grid-template-columns: 1fr;
    padding: var(--space-4);
    gap: var(--space-4);
  }

  .home-header {
    flex-wrap: wrap;
  }

  .home-header h1 {
    font-size: 22px;
  }

  .side-stack {
    order: 3;
  }

  .page {
    padding: var(--space-4);
    padding-bottom: 72px;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header h1 {
    font-size: 22px;
  }

  .split-2 {
    grid-template-columns: 1fr;
  }

  .map-grid,
  .settings-grid,
  .cards-grid {
    grid-template-columns: 1fr;
  }

  .board-header {
    padding: var(--space-4) var(--space-4) var(--space-3);
  }

  .board-title-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .board-title-row h1 {
    font-size: 22px;
  }

  .board-links {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .toolbar {
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .toolbar > * {
    flex-shrink: 0;
  }

  .toolbar .btn {
    width: auto;
  }

  .view-tabs {
    gap: var(--space-2);
    overflow-x: auto;
  }

  .view-tabs .view-menu-wrap {
    display: none;
  }

  .tool {
    padding: 0 8px;
  }

  .board {
    height: auto;
  }

  .view-tabs {
    flex-wrap: wrap;
  }

  .board-body {
    padding: var(--space-3) var(--space-3) 120px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .group {
    min-width: 640px;
  }

  .table th:nth-child(3),
  .table td:nth-child(3) {
    display: none;
  }

  .ai-bar {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    width: calc(100vw - 24px);
    left: 50%;
  }

  .ai-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: calc(130px + env(safe-area-inset-bottom, 0px));
    max-height: calc(100dvh - 150px - env(safe-area-inset-bottom, 0px));
  }

  .drawer {
    width: 100vw;
  }

  .modal {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 48px);
    overflow: auto;
  }

  .mobile-tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 16px rgba(50, 51, 56, 0.06);
  }

  .tabbar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 2px;
    font-size: 10px;
    font-weight: 700;
    color: var(--color-text-muted);
    border-radius: var(--radius-sm);
  }

  .tabbar-btn span {
    font-size: 16px;
    line-height: 1;
  }

  .tabbar-btn.active {
    color: var(--color-accent);
    background: var(--color-accent-soft);
  }

  .toast {
    top: auto;
    bottom: calc(140px + env(safe-area-inset-bottom, 0px));
    right: 12px;
    left: 12px;
    transform: none;
    max-width: none;
  }

  .res-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .timeline li {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 480px) {
  .brand-wordmark {
    font-size: 20px;
  }

  .chips {
    flex-direction: column;
  }

  .chip,
  .btn {
    width: 100%;
    justify-content: center;
  }

  .ai-input-row {
    flex-direction: column;
  }

  .status-pill {
    min-width: 96px;
  }
}

/* Auth */
.auth-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(0, 115, 234, 0.12), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(255, 61, 135, 0.1), transparent 42%),
    var(--color-bg);
}

.auth-screen.is-hidden {
  display: none;
}

.app.is-locked {
  display: none;
}

body:has(.app.is-locked) .ai-bar,
body:has(.app.is-locked) .ai-panel,
body:has(.app.is-locked) .mobile-tabbar,
body:has(.app.is-locked) .drawer,
body:has(.app.is-locked) .drawer-backdrop,
body:has(.app.is-locked) .modal-backdrop,
body:has(.app.is-locked) .notif-panel,
body:has(.app.is-locked) .notif-scrim {
  display: none !important;
}

.auth-card {
  width: min(400px, 100%);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  padding: 28px;
}

.auth-brand {
  text-align: center;
  margin-bottom: 24px;
}

.auth-brand h1 {
  margin: 12px 0 4px;
  font-family: var(--font-brand);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.auth-brand p {
  margin: 0;
  color: var(--color-text-muted);
}

.auth-submit {
  width: 100%;
  height: 44px;
  margin-top: 8px;
}

.auth-foot {
  margin: 16px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--color-text-soft);
}

/* Notifications */
.notif-btn {
  position: relative;
}

.notif-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--color-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  display: none;
}

.notif-scrim {
  position: fixed;
  inset: 0;
  background: rgba(50, 51, 56, 0.25);
  z-index: 58;
}

.notif-panel {
  position: fixed;
  top: calc(var(--header-h) + 8px);
  right: 16px;
  width: min(360px, calc(100vw - 24px));
  max-height: min(70vh, 520px);
  overflow: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  z-index: 59;
  display: none;
}

.notif-panel.open {
  display: block;
}

.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
}

.notif-head h3 {
  margin: 0;
  font-size: 15px;
}

.notif-item {
  width: 100%;
  display: flex;
  gap: 12px;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
}

.notif-item:hover {
  background: var(--color-surface-muted);
}

.notif-item.unread {
  background: var(--color-accent-soft);
}

.notif-item strong {
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
}

/* Overview */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.overview-grid .card h3 {
  margin: 0 0 12px;
  font-size: 14px;
}

.phase-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.phase-list li {
  padding: 8px 0 8px 14px;
  border-left: 3px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 13px;
}

.phase-list li.done {
  border-left-color: var(--color-success);
  color: var(--color-text);
}

.phase-list li.active {
  border-left-color: var(--color-accent);
  color: var(--color-accent);
  font-weight: 700;
}

.wp-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wp-bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 28px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}

/* Gantt */
.gantt-card {
  padding: 0;
  overflow: hidden;
  overflow: clip;
}

.gantt-head,
.gantt-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  min-height: 44px;
}

.gantt-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fafbfc;
  font-size: 12px;
  color: var(--color-text-soft);
  font-weight: 600;
}

.gantt-label {
  padding: 0 14px;
  font-size: 13px;
  text-align: left;
}

.gantt-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  padding-right: 12px;
}

.gantt-track {
  position: relative;
  height: 28px;
  margin-right: 12px;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent calc(100% / 7 - 1px),
    var(--color-border) calc(100% / 7 - 1px),
    var(--color-border) calc(100% / 7)
  );
}

.gantt-bar {
  position: absolute;
  top: 6px;
  height: 16px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
}

.gantt-bar.working {
  background: var(--color-warning);
}

.gantt-bar.stuck {
  background: var(--color-danger);
}

.gantt-bar.done {
  background: var(--color-success);
}

.gantt-bar.milestone {
  width: 14px !important;
  height: 14px;
  top: 7px;
  margin-left: -7px;
  border-radius: 2px;
  transform: rotate(45deg);
}

.gantt-row.is-child .gantt-label {
  padding-left: 28px;
  color: var(--color-text-muted);
}

@media (max-width: 900px) {
  .overview-grid {
    grid-template-columns: 1fr;
  }

  .gantt-head,
  .gantt-row {
    grid-template-columns: 120px 1fr;
  }

  .gantt-card {
    overflow-x: auto;
  }

  .gantt-head,
  .gantt-row {
    min-width: 560px;
  }

  .auth-card {
    padding: 22px;
  }

  .notif-panel {
    top: auto;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    right: 12px;
    left: 12px;
    width: auto;
    max-height: 50vh;
  }
}

.page-wide {
  max-width: 1400px;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: var(--space-3);
  overflow-x: auto;
  padding-bottom: var(--space-4);
}

.kanban-col {
  background: var(--color-surface-muted);
  border-radius: var(--radius-lg);
  min-height: 420px;
  display: flex;
  flex-direction: column;
}

.kanban-col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-top: 4px solid var(--color-accent);
  font-size: 13px;
}

.kanban-col-head span {
  color: var(--color-text-muted);
  font-weight: 700;
}

.kanban-col-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.kanban-card {
  min-width: 0;
  overflow-wrap: anywhere;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-sm);
}

.kanban-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.kanban-moves {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}

.move-pill {
  border: none;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
}

.kanban-empty {
  padding: 16px;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.cal-day {
  min-height: 120px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px;
}

.cal-day-num {
  font-weight: 800;
  margin-bottom: 8px;
}

.cal-chip {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 4px;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  border: none;
  color: white;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-more {
  padding: 0;
  font-size: 11px;
  cursor: pointer;
}

.cal-chip.working { background: var(--color-warning); }
.cal-chip.stuck { background: var(--color-danger); }
.cal-chip.done { background: var(--color-success); }
.cal-chip.meeting { background: var(--color-accent); }

.backlog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.backlog-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.cost-big {
  margin: 0;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--color-accent);
}

@media (max-width: 900px) {
  .kanban-board {
    grid-template-columns: repeat(4, minmax(240px, 1fr));
  }

  .calendar-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 3px;
  }

  .calendar-grid .cal-day {
    min-height: 64px;
    padding: 4px;
  }

  .cal-chip {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .backlog-grid {
    grid-template-columns: 1fr;
  }
}

/* Item full view (WP completo) */
.item-full {
  padding: var(--space-4) var(--space-5) 120px;
  max-width: 1400px;
}

.item-chrome {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.breadcrumb {
  font-size: 13px;
}

.item-toolbar {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.item-title-block {
  min-width: 0;
  max-width: 100%;
}

.item-title-block h1 {
  margin: 8px 0 6px;
  font-size: 26px;
  letter-spacing: -0.03em;
  outline: none;
  overflow-wrap: anywhere;
}

.item-type-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
  justify-content: flex-end;
}

.item-split {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(340px, 1.05fr);
  gap: var(--space-5);
  align-items: start;
}

.item-attrs {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.attr-group {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.attr-group h3 {
  margin: 0 0 14px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-soft);
}

.description-box {
  min-height: 96px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
  font-size: 14px;
  line-height: 1.45;
  outline: none;
}

.wp-field {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  align-items: start;
  margin-bottom: 12px;
  font-size: 13px;
}

.wp-field .label {
  margin: 0;
  padding-top: 8px;
}

.wp-field-value {
  min-height: 32px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.cf-input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0 10px;
}

.cf-type {
  font-style: normal;
  font-weight: 500;
  color: var(--color-text-soft);
  text-transform: none;
  letter-spacing: 0;
}

.pct {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.pct .bar-track {
  flex: 1;
}

.item-tabs-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 520px;
  display: flex;
  flex-direction: column;
}

.item-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  border-bottom: 1px solid var(--color-border);
  padding: 0 8px;
}

.item-tab {
  padding: 12px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.item-tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.item-tab-body {
  padding: var(--space-4);
  overflow: auto;
  flex: 1;
}

.activity-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.activity-filters .chip.active {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

.comment-compose textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px;
  margin: 12px 0;
  font: inherit;
  resize: vertical;
}

.comment-bubble {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 8px;
  row-gap: 4px;
}

.comment-bubble p {
  grid-column: 2;
  margin: 0;
}

.upload-zone {
  margin-bottom: 16px;
}

.upload-zone strong {
  display: block;
  margin-bottom: 6px;
}

.upload-fake {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.more-wrap {
  position: relative;
}

.more-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 220px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(50, 51, 56, 0.16);
  padding: 6px;
  z-index: 20;
}

.more-wrap.open .more-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.more-menu button {
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.more-menu button:hover {
  background: var(--color-surface-muted);
}

.cf-textarea {
  height: auto;
  min-height: 56px;
  padding: 8px 10px;
  resize: vertical;
}

.cf-bool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.cf-users {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.badge-internal {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fff0f5;
  color: #c2185b;
  font-size: 11px;
  font-weight: 700;
}

.reaction-row {
  grid-column: 2;
  display: flex;
  gap: 4px;
}

.file-list,
.plain-list.tight {
  list-style: none;
  margin: 0;
  padding: 0;
}

.file-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}

.storage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.storage-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--color-surface-muted);
}

.storage-card strong {
  display: block;
  margin-bottom: 4px;
}

.rel-add {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

.rel-kinds {
  margin-top: 8px;
}

.validation-card h3 {
  margin: 0 0 12px;
  font-size: 14px;
}

.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.check-list li {
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--color-border);
}

.check-list .ok {
  color: var(--color-success);
  font-weight: 800;
  margin-right: 6px;
}

#validation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-3);
}

@media (max-width: 900px) {
  .item-split {
    grid-template-columns: 1fr;
  }

  .wp-field {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .item-toolbar {
    flex-direction: column;
  }

  .item-actions {
    justify-content: flex-start;
  }

  .pulse-kpis {
    grid-template-columns: repeat(2, 1fr);
  }

  .pulse-grid,
  .activity-layout,
  .field-grid-2 {
    grid-template-columns: 1fr;
  }

  .activity-row {
    grid-template-columns: 64px 1fr;
  }

  .activity-row .btn {
    grid-column: 2;
    justify-self: start;
  }
}

/* v20: busca, menus, popover, board ligado ao OpenProject */
button.brand { display: flex; align-items: center; gap: 8px; padding: 0; }
.search { position: relative; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60; max-height: 360px; overflow: auto; padding: 6px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: var(--shadow-md); }
.search-results button { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 8px 10px; text-align: left; border-radius: var(--radius-sm); overflow-wrap: anywhere; }
.search-results button:hover, .search-results button:focus-visible { background: var(--color-accent-soft); }
.search-results p { margin: 8px 10px; }
button.avatar { cursor: pointer; }
.user-menu { left: auto; right: 0; }
.user-menu strong { display: block; padding: 8px 10px; font-size: 13px; }
.view-menu a, .popover a { display: block; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; color: var(--color-text); text-decoration: none; }
.view-menu a:hover, .popover a:hover { background: var(--color-accent-soft); color: var(--color-accent); }
.popover { position: fixed; z-index: 75; min-width: 200px; max-width: 320px; max-height: 340px; overflow: auto; padding: 6px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: var(--shadow-md); }
.popover button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; text-align: left; font-size: 13px; border-radius: var(--radius-sm); }
.popover button:hover, .popover button.active { background: var(--color-accent-soft); color: var(--color-accent); }
.popover button.danger { color: var(--color-danger); }
.popover .dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.popover input { margin-bottom: 6px; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.cell-btn { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 0; color: inherit; text-align: left; cursor: pointer; }
.cell-btn:hover { color: var(--color-accent); }
.date-pill { cursor: pointer; }
.date-pill.late { background: #fde8ec; color: var(--color-danger); }
.tool.active { color: var(--color-accent); background: var(--color-accent-soft); }
.tool-search { width: 180px; height: 32px; padding: 0 10px; font-size: 13px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.board-links a { color: inherit; text-decoration: none; }
.board-links a:hover { color: var(--color-accent); }
.board-note { margin: 0 0 12px; }
.gantt-note { margin: 0; padding: 12px 14px; }
.gantt-days { grid-template-columns: repeat(var(--cols, 7), minmax(0, 1fr)); }
.gantt-days span { min-width: 0; white-space: nowrap; }
.gantt-card.sparse .gantt-days span { text-align: left; }
.gantt-days .today { color: var(--color-accent); font-weight: 800; box-shadow: inset 0 -3px var(--color-accent); }
.gantt-track { background: repeating-linear-gradient(90deg, transparent, transparent calc(100% / var(--cols, 7) - 1px), var(--color-border) calc(100% / var(--cols, 7) - 1px), var(--color-border) calc(100% / var(--cols, 7))); }
.cal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-nav strong { min-width: 160px; text-align: center; }
.cal-nav strong::first-letter { text-transform: uppercase; }
.cal-week { margin-bottom: 6px; }
.cal-week span { font-size: 11px; font-weight: 700; text-align: center; color: var(--color-text-soft); }
.cal-day { min-height: 96px; }
.cal-day.out { opacity: 0.45; }
.cal-day.today { border-color: var(--color-accent); }
.cal-day-num { padding: 0; font-weight: 800; cursor: pointer; }
.cal-day-num:hover { color: var(--color-accent); }
.empty-state { display: grid; justify-items: center; gap: 12px; padding: 32px; text-align: center; }
.op-html { overflow-wrap: anywhere; }
.op-html p { margin: 0 0 6px; }
.op-html img, .op-html video { max-width: 100%; height: auto; }
.op-html li:has(> .op-uc-list--task-checkbox, > p > .op-uc-list--task-checkbox) { list-style: none; }
.op-html pre, .op-html figure { max-width: 100%; margin: 0 0 6px; overflow-x: auto; }
.op-html table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; overflow-wrap: normal; }
.op-html th, .op-html td { padding: 4px 8px; border: 1px solid var(--color-border); }
.item-attrs, .item-tabs-panel { min-width: 0; }
.op-html .change-line { font-size: 13px; color: var(--color-text-muted); }
.timeline .op-html { margin-top: 4px; }
.auth-native { display: block; margin-top: 12px; text-align: center; font-size: 13px; color: var(--color-accent); }
.auth-native[hidden], .view-menu a[hidden] { display: none; }
.settings-card { color: inherit; text-decoration: none; }
.settings-card em { font-size: 12px; font-style: normal; font-weight: 700; color: var(--color-accent); }
.upload-zone { display: block; margin-bottom: 16px; cursor: pointer; }
.kanban-card { cursor: grab; }
#nav-project-status { color: var(--color-text-muted); }
.item-type-status .status-pill { width: auto; }
