:root {
  --color-primary-dark: #1469e3;
  --color-primary-darkest: #033e91;
  --color-primary-light: #207cff;
  --color-primary-lightest: #6babff;
  --color-primary-medium: #0669f7;
  --color-primary-ultradark: #011532;
  --color-primary-ultralight: #cce2ff;
  --color-neutral-dark: #747880;
  --color-neutral-darkest: #181818;
  --color-neutral-light: #eff0f1;
  --color-neutral-lightest: #fff;
  --color-neutral-medium: #d6d7da;
  --color-sucess-dark: #194e31;
  --color-sucess-medium: #2e844a;
  --color-warning-dark: #bf5900;
  --color-warning-medium: #fe7501;
  --color-error-dark: #8e030f;
  --color-error-medium: #ba0517;

  --wm-primary: var(--color-primary-medium);
  --wm-primary-hover: var(--color-primary-dark);
  --wm-primary-press: var(--color-primary-darkest);
  --wm-primary-subtle: var(--color-primary-ultralight);
  --wm-surface: var(--color-neutral-lightest);
  --wm-surface-alt: #fdfdfd;
  --wm-surface-disabled: var(--color-neutral-light);
  --wm-surface-row-hover: var(--color-primary-ultralight);
  --wm-sidebar-bg: var(--color-primary-dark);
  --wm-sidebar-active: var(--color-primary-darkest);
  --wm-text: var(--color-neutral-darkest);
  --wm-text-muted: var(--color-neutral-dark);
  --wm-text-secondary: rgb(87, 96, 106);
  --wm-text-on-brand: #fff;
  --wm-text-link: var(--color-primary-medium);
  --wm-border: var(--color-neutral-medium);
  --wm-success-dark: var(--color-sucess-dark);
  --wm-warning-dark: var(--color-warning-dark);
  --wm-error-dark: var(--color-error-dark);

  --wm-font-menu: "Blinker", sans-serif;
  --wm-font-body: "DM Sans", sans-serif;
  --wm-text-entity: 24px;
  --wm-text-menu: 16px;
  --wm-text-menu-sm: 14px;
  --wm-text-body: 14px;
  --wm-text-caption: 12px;

  --wm-radius-xsm: 4px;
  --wm-radius-sm: 8px;
  --wm-radius-md: 16px;
  --wm-radius-stage: 4px 24px 24px 4px;
  --wm-shadow-bar: 0 4px 8px rgba(0, 0, 0, 0.16);
  --wm-shadow-card: 0 4px 8px rgba(0, 0, 0, 0.16);
  --wm-shadow-dropdown: 0 8px 24px rgba(0, 0, 0, 0.25);
  --wm-transition-fast: 120ms ease;
  --wm-focus-ring: 0 0 0 3px rgba(6, 105, 247, 0.28);
  --wm-page: rgb(240, 241, 243);
}

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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--wm-page);
  color: var(--wm-text);
  font-family: var(--wm-font-body);
  font-size: var(--wm-text-body);
  overflow: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

:focus { outline: none; }

:focus-visible { box-shadow: var(--wm-focus-ring); }

.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-weight: 400;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  width: 1em;
  height: 1em;
  overflow: hidden;
  flex: 0 0 auto;
  user-select: none;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background: var(--wm-page);
  overflow: hidden;
}

.screen {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wm-btn {
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--wm-radius-xsm);
  background: transparent;
  font-family: var(--wm-font-menu);
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
  transition: background var(--wm-transition-fast), color var(--wm-transition-fast), box-shadow var(--wm-transition-fast);
}

.wm-btn .material-symbols-outlined { font-size: 18px; color: currentColor; }

.wm-btn.fill { background: var(--wm-primary); color: #fff; }

.wm-btn.fill:hover { background: var(--wm-primary-press); }

.wm-btn.outline {
  color: var(--wm-primary);
  box-shadow: inset 0 0 0 1px var(--wm-primary);
}

.wm-btn.outline:hover { color: var(--wm-primary-press); box-shadow: inset 0 0 0 1px var(--wm-primary-press); }

.wm-btn.ghost { color: var(--wm-primary); }

.wm-btn.ghost:hover { background: var(--wm-primary-subtle); color: var(--wm-primary-press); }

.wm-btn.sm { height: 30px; padding: 6px 12px; font-size: 14px; }

.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--wm-radius-xsm);
  background: transparent;
  color: var(--wm-primary);
  padding: 0;
}

.icon-btn:hover { background: var(--wm-primary-subtle); }

.icon-btn .material-symbols-outlined { font-size: 22px; }

.list-bar,
.ficha-head {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  background: var(--wm-surface);
  box-shadow: var(--wm-shadow-bar);
}

.list-bar {
  padding: 20px 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.list-title,
.list-actions,
.crumb,
.head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.list-title { gap: 14px; }

.list-title .material-symbols-outlined { font-size: 22px; color: var(--wm-primary-press); }

.list-title strong {
  font-family: var(--wm-font-menu);
  font-weight: 600;
  font-size: var(--wm-text-entity);
  line-height: 1.2;
}

.list-title em {
  font-style: normal;
  font-size: var(--wm-text-caption);
  color: var(--wm-text-muted);
  white-space: nowrap;
}

.recorte-row {
  flex: 0 0 auto;
  padding: 16px 28px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.recorte-label {
  font-family: var(--wm-font-menu);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--wm-text-muted);
}

.recorte {
  font-family: var(--wm-font-menu);
  font-weight: 600;
  font-size: 14px;
  padding: 8px 14px;
  border: none;
  border-radius: var(--wm-radius-xsm);
  background: var(--wm-surface);
  color: var(--wm-primary);
  box-shadow: inset 0 0 0 1px var(--wm-border);
}

.recorte:hover { filter: brightness(0.97); }

.recorte.is-on {
  background: var(--wm-primary);
  color: #fff;
  box-shadow: none;
}

.sep { width: 1px; height: 22px; background: var(--wm-border); }

.recorte-desc { font-size: var(--wm-text-caption); color: var(--wm-text-muted); }

.list-wrap {
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px 28px 20px;
  display: flex;
}

.table-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--wm-surface);
  border-radius: var(--wm-radius-md);
  box-shadow: var(--wm-shadow-card);
  overflow: hidden;
}

.table-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; }

.grid-row {
  display: grid;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
}

.col-head {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 40px;
  min-height: 40px;
  background: var(--wm-surface-alt);
  border-bottom: 1px solid var(--wm-border);
  font-weight: 700;
  font-size: var(--wm-text-caption);
  color: var(--wm-text-muted);
}

.col-label { position: relative; min-width: 0; padding-right: 10px; }

.col-resize {
  position: absolute;
  top: -12px;
  right: 0;
  width: 9px;
  height: 40px;
  cursor: col-resize;
  border-right: 1px solid var(--wm-border);
}

.col-resize:hover { border-right: 2px solid var(--wm-primary); }

.lead-row {
  border-bottom: 1px solid var(--wm-border);
  cursor: pointer;
}

.lead-row:hover { background: var(--wm-surface-row-hover) !important; }

.lead-row .nome {
  color: var(--wm-text-link);
  text-decoration: underline;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub {
  display: block;
  font-size: var(--wm-text-caption);
  color: var(--wm-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-muted {
  font-size: var(--wm-text-caption);
  color: var(--wm-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 12px;
}

.stage {
  display: inline-block;
  font-family: var(--wm-font-menu);
  font-weight: 600;
  font-size: var(--wm-text-caption);
  line-height: 1;
  padding: 6px 12px;
  border-radius: var(--wm-radius-stage);
  white-space: nowrap;
}

.bulk {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  background: var(--wm-primary-subtle);
  border-top: 1px solid var(--wm-border);
  font-family: var(--wm-font-menu);
  font-weight: 600;
  font-size: 14px;
  color: var(--wm-primary-press);
}

.ficha-head { padding: 18px 28px 0; }

.head-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.crumb { gap: 8px; }

.crumb-back,
.crumb-mod {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  border-radius: var(--wm-radius-xsm);
  padding: 4px;
  font-family: var(--wm-font-menu);
  font-weight: 600;
  font-size: 20px;
  line-height: 1;
  color: var(--wm-primary-press);
}

.crumb-back { color: var(--wm-primary); padding: 4px 2px 4px 6px; }

.crumb-back:hover,
.crumb-mod:hover { background: var(--wm-primary-subtle); }

.crumb-back .material-symbols-outlined,
.crumb-mod .material-symbols-outlined { font-size: 20px; color: inherit; }

.crumb-name {
  min-width: 0;
  font-family: var(--wm-font-menu);
  font-weight: 600;
  font-size: 20px;
  line-height: 1;
  color: var(--wm-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fases {
  display: flex;
  gap: 4px;
  margin-top: 18px;
  padding: 0 2px;
}

.fase {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fase i {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: var(--wm-border);
}

.fase.is-done i { background: var(--wm-primary); }

.fase span {
  font-size: var(--wm-text-caption);
  color: var(--wm-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fase.is-now span {
  font-weight: 600;
  color: var(--wm-primary-press);
}

.abas {
  display: flex;
  flex-wrap: nowrap;
  gap: 28px;
  align-items: center;
  margin-top: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.abas::-webkit-scrollbar { display: none; }

.aba {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  padding: 10px 0 12px;
  font-size: 14px;
  color: var(--wm-text-secondary);
  white-space: nowrap;
}

.aba.is-on {
  color: var(--wm-primary);
  box-shadow: inset 0 -2px 0 var(--wm-primary);
}

.aba-count {
  margin-left: auto;
  padding-left: 20px;
  font-size: var(--wm-text-caption);
  color: var(--wm-text-muted);
  white-space: nowrap;
}

.ficha-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 28px 32px;
  container-type: inline-size;
}

.ficha-cols {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-start;
}

.ficha-main {
  flex: 1 1 560px;
  min-width: 0;
  display: grid;
  gap: 20px;
}

.card {
  background: var(--wm-surface);
  border-radius: var(--wm-radius-md);
  box-shadow: var(--wm-shadow-card);
  padding: 22px 24px;
}

.card-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  font-family: var(--wm-font-menu);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--wm-text-muted);
}

.card-kicker span:last-child {
  font-family: var(--wm-font-body);
  font-weight: 400;
  letter-spacing: 0;
  font-size: var(--wm-text-caption);
}

.resumo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 20px 28px;
  margin-top: 18px;
}

.sum,
.sum-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  padding: 0;
  border: none;
  background: transparent;
  text-align: left;
}

.sum-k { font-size: var(--wm-text-caption); color: var(--wm-text-muted); }

.sum-v {
  font-family: var(--wm-font-menu);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
  color: var(--wm-text);
}

.sum-s {
  max-width: 100%;
  font-size: var(--wm-text-caption);
  color: var(--wm-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sum-btn .sum-s { text-decoration: underline; }

.sum-btn:hover .sum-v { color: var(--wm-primary-press); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  font-family: var(--wm-font-menu);
  font-weight: 600;
  font-size: var(--wm-text-caption);
  line-height: 1;
  padding: 6px 10px;
  border-radius: var(--wm-radius-xsm);
  background: var(--wm-primary-subtle);
  color: var(--wm-primary-press);
  white-space: nowrap;
}

.sec-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.sec-toggle {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0;
  text-align: left;
}

.sec-toggle .material-symbols-outlined {
  font-size: 18px;
  color: var(--wm-primary-press);
  align-self: center;
}

.sec-title {
  font-family: var(--wm-font-menu);
  font-weight: 600;
  font-size: 16px;
  color: var(--wm-primary-press);
}

.sec-count {
  font-size: var(--wm-text-caption);
  color: var(--wm-text-muted);
  white-space: nowrap;
}

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr));
  gap: 18px 16px;
  margin-top: 18px;
}

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.field label,
.dialog label {
  font-size: 12px;
  color: var(--wm-text-muted);
}

.field-input { display: block; width: 100%; min-width: 0; overflow: hidden; }

.field input,
.field select,
.tl-form textarea,
.dialog select,
.dialog textarea {
  display: block;
  width: 100%;
  height: 37px;
  box-sizing: border-box;
  padding: 0 12px;
  border: 1px solid var(--wm-border);
  border-radius: var(--wm-radius-xsm);
  background: var(--wm-surface);
  font-size: 14px;
  color: var(--wm-text);
  transition: border-color var(--wm-transition-fast), box-shadow var(--wm-transition-fast);
}

.field input.is-empty,
.field select.is-empty { color: var(--wm-text-muted); }

.field input:hover,
.field select:hover,
.tl-form textarea:hover,
.dialog select:hover,
.dialog textarea:hover { border-color: var(--wm-primary); }

.field input:focus,
.field select:focus,
.tl-form textarea:focus,
.dialog select:focus,
.dialog textarea:focus {
  border-color: var(--wm-primary);
  box-shadow: var(--wm-focus-ring);
}

.readonly {
  display: block;
  padding-top: 2px;
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

.field-note,
.sec-note {
  margin: 0;
  font-size: var(--wm-text-caption);
  line-height: 1.4;
  text-wrap: pretty;
}

.field-note { color: var(--wm-warning-dark); }

.sec-note { margin-top: 16px; color: var(--wm-text-muted); }

.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 2px;
}

.switch button {
  position: relative;
  width: 38px;
  height: 22px;
  flex: 0 0 38px;
  border: none;
  border-radius: 999px;
  padding: 0;
  background: var(--wm-surface-disabled);
  box-shadow: inset 0 0 0 1px var(--wm-border);
  transition: background var(--wm-transition-fast);
}

.switch button.is-on { background: var(--wm-primary); }

.switch button i {
  position: absolute;
  top: 3px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--wm-surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: left var(--wm-transition-fast);
}

.switch button.is-on i { left: 20px; }

.switch em {
  font-style: normal;
  font-size: 14px;
}

.switch em.is-off { color: var(--wm-text-muted); }

.wm-table {
  margin-top: 18px;
  border: 1px solid var(--wm-border);
  border-radius: var(--wm-radius-md);
  overflow: hidden;
}

.wm-tr {
  display: flex;
  gap: 16px;
  padding: 10px 16px;
}

.wm-th {
  background: var(--wm-surface-alt);
  border-bottom: 1px solid var(--wm-border);
  font-weight: 700;
  font-size: 12px;
  color: var(--wm-text-muted);
}

.wm-row { border-bottom: 1px solid var(--wm-border); font-size: 12px; }

.wm-row.is-link { cursor: pointer; }

.wm-row.is-link:hover { background: var(--wm-surface-row-hover); }

.wm-cell {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wm-empty {
  padding: 20px 16px;
  font-size: var(--wm-text-caption);
  color: var(--wm-text-muted);
}

.wm-foot {
  padding: 10px 16px;
  border-top: 1px solid var(--wm-border);
  font-size: var(--wm-text-caption);
  color: var(--wm-text-muted);
}

.timeline {
  flex: 0 1 330px;
  width: 100%;
  max-width: 330px;
  align-self: stretch;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  background: var(--wm-surface);
  border-radius: var(--wm-radius-md);
  box-shadow: var(--wm-shadow-card);
  padding: 0;
}

.timeline-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--wm-border);
  font-family: var(--wm-font-menu);
  font-weight: 600;
  font-size: 16px;
  color: var(--wm-primary-press);
}

.timeline-head .material-symbols-outlined { font-size: 18px; color: var(--wm-primary); }

.timeline-action {
  padding: 14px 20px 0;
}

.timeline-action > .wm-btn { width: 100%; }

.tl-form { display: grid; gap: 12px; }

.tl-form textarea { height: 72px; padding: 8px 12px; resize: vertical; }

.tl-form .field { gap: 4px; }

.tl-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.timeline-body {
  padding: 16px 20px 20px;
  display: grid;
  gap: 16px;
}

.tl-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.tl-when {
  font-size: var(--wm-text-caption);
  color: var(--wm-text-muted);
  white-space: nowrap;
}

.tl-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  border-left: 2px solid var(--wm-border);
  padding-left: 12px;
}

.tl-body strong {
  font-family: var(--wm-font-menu);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
}

.tl-body span {
  font-size: var(--wm-text-caption);
  color: var(--wm-text-secondary);
}

@container (max-width: 920px) {
  .timeline {
    flex-basis: 100%;
    max-width: none;
    position: static;
  }
}

.pop { position: relative; display: inline-flex; }

.menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 5;
  min-width: 240px;
  padding: 6px;
  background: var(--wm-surface);
  border-radius: var(--wm-radius-sm);
  box-shadow: var(--wm-shadow-dropdown);
}

.menu button {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  border: none;
  background: transparent;
  border-radius: var(--wm-radius-xsm);
  padding: 8px 10px;
  text-align: left;
  font-size: 14px;
}

.menu button:hover { background: var(--wm-primary-subtle); }

.menu button small {
  font-size: 12px;
  color: var(--wm-text-muted);
}

.menu .hint {
  padding: 6px 10px 4px;
  font-size: 12px;
  color: var(--wm-text-muted);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.4);
}

.dialog {
  width: min(480px, 100%);
  background: var(--wm-surface);
  border-radius: var(--wm-radius-sm);
  box-shadow: var(--wm-shadow-dropdown);
  padding: 20px 24px 16px;
}

.dialog h2 {
  margin: 0 0 16px;
  font-family: var(--wm-font-menu);
  font-weight: 600;
  font-size: 18px;
  color: var(--wm-primary-press);
}

.dialog textarea { height: 96px; padding: 10px 12px; resize: vertical; }

.dialog .field { margin-bottom: 14px; }

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(520px, calc(100% - 32px));
  padding: 12px 14px;
  border-radius: var(--wm-radius-sm);
  background: var(--wm-text);
  color: #fff;
  font-size: 14px;
  box-shadow: var(--wm-shadow-dropdown);
}

.toast button {
  border: none;
  background: transparent;
  color: #fff;
  padding: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
  }
}
