:root {
  --font-size-base: 14px;
  --font-size-sm: 12px;
  --font-size-xs: 11px;
  --bg: #faf9f7;
  --surface: #ffffff;
  --surface2: #f0eee9;
  --surface3: #e5e3dc;
  --border: rgba(50, 78, 68, 0.08);
  --border2: rgba(50, 78, 68, 0.15);
  --text: #1a2820;
  --text2: #3d5248;
  --text3: #5a6b65;
  --accent: #d95338;
  --accent-h: #b8412a;
  --accent-light: #f5d0c8;
  --accent-mid: #e8957f;
  --accent-glow: rgba(217, 83, 56, 0.12);
  --green: #1a4a1a;
  --green-bg: #d0e8d0;
  --green-b: #9fcc9f;
  --amber: #6b3a00;
  --amber-bg: #f5e0c0;
  --amber-b: #d4a870;
  --red: #7a1f10;
  --red-bg: #f5d0c8;
  --red-b: #e8957f;
  --blue: #0c447c;
  --blue-bg: #e6f1fb;
  --blue-b: #b5d4f4;
  --pmm-dark: #324e44;
  --pmm-teal: #5dcaa5;
  --pmm-cream: #ebeccd;
  --r: 8px;
  --rl: 12px;
  --font: "Plus Jakarta Sans", "DM Sans", sans-serif;
  --mono: "DM Mono", monospace;
  --px: 28px;
  --sh: 0 1px 3px rgba(50, 78, 68, 0.06), 0 1px 2px rgba(50, 78, 68, 0.03);
  --sh-md: 0 4px 14px rgba(50, 78, 68, 0.08), 0 2px 4px rgba(50, 78, 68, 0.04);
}
@media (max-width: 640px) {
  :root {
    --font-size-base: 14px;
    --font-size-sm: 12px;
    --font-size-xs: 11px;
    --px: 16px;
  }
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 14px;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  line-height: 1.5;
}

/* A11Y — skip link (WCAG 2.4.1 Bypass Blocks) */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: var(--color-text-inverse);
  padding: 8px 16px;
  z-index: 10000;
  text-decoration: none;
  border-radius: 0 0 var(--r) 0;
  font-weight: 600;
}
.skip-link:focus {
  top: 0;
}

/* A11Y — visually hidden helper (sr-only) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* LOGIN */
#loginScreen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.login-box {
  width: 100%;
  max-width: 420px;
}
.login-logo {
  text-align: center;
  margin-bottom: 22px;
}
.login-mark {
  width: 44px;
  height: 44px;
  background: var(--color-brand-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--color-brand-accent);
  letter-spacing: var(--font-letter-spacing-wide);
  margin: 0 auto 12px;
}
.login-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text);
  letter-spacing: var(--font-letter-spacing-tight);
}
.login-title span {
  color: var(--accent);
}
.login-sub {
  font-size: 12px;
  color: var(--text3);
  margin-top: 4px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--rl);
  padding: 24px;
  box-shadow: var(--sh-md);
}
.login-section {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 12px;
}
.who-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 4px;
}
.who-btn {
  padding: 10px 6px;
  border-radius: var(--r);
  border: 1px solid var(--border2);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  font-family: var(--font);
}
.who-btn:hover {
  border-color: var(--accent-mid);
  background: var(--accent-light);
}
.who-btn.sel {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.who-av {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-inverse);
  margin: 0 auto 5px;
}
.who-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}
.who-role {
  font-size: 12px;
  color: var(--text3);
  margin-top: 1px;
}
#pwSection {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 14px;
}
.l-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: block;
}
.l-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border2);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 10px 12px;
  border-radius: var(--r);
  outline: none;
  transition: all 0.15s;
  margin-bottom: 12px;
}
.l-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.l-btn {
  width: 100%;
  background: var(--accent);
  color: var(--color-brand-cream);
  border: none;
  padding: 11px;
  border-radius: 20px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.l-btn:hover {
  background: var(--accent-h);
}
.l-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.l-err {
  color: var(--red);
  font-size: 12px;
  margin-top: 8px;
  text-align: center;
  min-height: 18px;
}

/* APP */
#app {
  display: none;
}
.topbar {
  background: var(--color-brand-primary);
  border-bottom: none;
  padding: 10px var(--px);
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-topbar);
  overflow: visible;
}
.tb-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.tb-greeting {
  font-size: 17px;
  font-weight: 600;
  color: var(--color-brand-cream);
}
.tb-phrase {
  font-size: 12px;
  color: var(--color-brand-accent);
  opacity: 0.9;
  margin-top: 1px;
}
.tb-greeting-center {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-align: center;
  pointer-events: none;
}
.tb-logo {
  width: 32px;
  height: 32px;
  background: var(--color-brand-accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--color-brand-cream);
  letter-spacing: 0.03em;
}
.tb-brand {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.tb-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-brand-cream);
  letter-spacing: 0.01em;
}
.tb-subtitle-brand {
  font-size: 9px;
  font-weight: 500;
  color: var(--color-brand-cream-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tb-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-semantic-success-strong);
  animation: pulse 2s ease-in-out infinite;
}
.sync-dot.syncing {
  background: var(--color-semantic-warning-strong);
  animation: none;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  border-radius: 20px;
  border: 1px solid var(--color-surface-overlay-on-dark-border);
  background: var(--color-surface-overlay-on-dark);
  cursor: pointer;
  transition: all 0.15s;
}
.user-chip:hover {
  background: var(--color-surface-overlay-on-dark-strong);
}
.user-av {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-inverse);
  flex-shrink: 0;
}
.user-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-brand-cream-bright);
}

/* TABS */
.tabs-bar {
  background: var(--bg);
  border-bottom: 1px solid var(--color-surface-border-soft);
  padding: 0 var(--px);
  display: flex;
}
.tab-btn {
  padding: 12px 12px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: var(--text3);
  background: transparent;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}
.tab-btn:hover {
  color: var(--text2);
}
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab-count {
  font-size: 12px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--surface3);
  color: var(--text3);
  font-weight: 600;
}
.tab-btn.active .tab-count {
  background: var(--accent-light);
  color: var(--accent);
}
.tab-panel {
  display: none;
  width: 100%;
}
.tab-panel.active {
  display: block;
  width: 100%;
}
#dashboardView {
  width: 100%;
  background: var(--bg);
}
@media (max-width: 640px) {
  .tabs-bar {
    overflow-x: auto;
    padding: 0;
  }
  .tab-btn {
    flex: 1;
    justify-content: center;
    padding: 11px 6px;
    font-size: 12px;
  }
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 20px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: var(--color-brand-cream);
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-h);
}
.btn-ghost {
  background: var(--surface);
  color: var(--text2);
  border-color: var(--border2);
  border-radius: 8px;
}
.btn-ghost:hover {
  background: var(--surface2);
  color: var(--text);
}
.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}
.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red-b);
  border-radius: 8px;
}

/* TOOLBAR */
.toolbar {
  padding: 14px var(--px) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.toolbar-left {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  flex: 1;
}
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
@media (max-width: 640px) {
  .toolbar {
    flex-wrap: wrap;
  }
  .toolbar-left {
    width: 100%;
    order: 2;
  }
  .toolbar-right {
    order: 1;
    width: 100%;
    justify-content: flex-end;
  }
}

/* FILTERS */
.filter-group {
  display: flex;
  gap: 3px;
}
.filter-btn {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text3);
  font-family: var(--font);
  transition: all 0.15s;
  white-space: nowrap;
}
.filter-btn.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent-mid);
}
.filter-btn:hover:not(.active) {
  color: var(--text);
  background: var(--surface2);
}
.est-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text3);
  font-family: var(--font);
  transition: all 0.15s;
  white-space: nowrap;
}
.est-chip.active {
  background: var(--ec-bg, var(--accent-light));
  color: var(--ec, var(--accent));
  border-color: var(--ec, var(--accent-mid));
}
.ef-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.search-wrap {
  position: relative;
}
.search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 12px;
  pointer-events: none;
}
.search-input {
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 6px 12px 6px 28px;
  border-radius: var(--r);
  width: 185px;
  outline: none;
  transition: all 0.15s;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-input::placeholder {
  color: var(--text3);
}
@media (max-width: 640px) {
  .search-input {
    width: 100%;
  }
}

/* STATS */
.stats-bar {
  padding: 10px var(--px) 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.stat-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
}
.stat-pill.total {
  background: var(--surface2);
  color: var(--text2);
}
.stat-pill.pend {
  background: var(--amber-bg);
  color: var(--amber);
  border-color: var(--amber-b);
}
.stat-pill.done {
  background: var(--green-bg);
  color: var(--green);
  border-color: var(--green-b);
}
.stat-pill.prog {
  background: var(--blue-bg);
  color: var(--blue);
  border-color: var(--blue-b);
}
.stat-pill .n {
  font-weight: 700;
  font-size: 13px;
}

/* TABLE */
.table-wrap {
  padding: 12px var(--px) 40px;
  overflow-x: auto;
}
.cards-wrap {
  padding: 10px var(--px) 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--rl);
  overflow: hidden;
  border: 1px solid var(--border);
  min-width: 1454px;
  box-shadow: var(--sh);
  font-size: 13px;
}
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
  background: var(--surface2);
}
thead th:hover {
  color: var(--text2);
}
thead th.ns {
  cursor: default;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
tbody tr:last-child {
  border-bottom: none;
}
tbody tr:hover {
  background: var(--surface2);
}
tbody tr.done-row {
  opacity: 0.45;
}
tbody tr.late-row {
  background: var(--color-semantic-error-strong-bg-soft);
}
tbody tr.late-row:hover {
  background: var(--color-semantic-error-strong-bg-hover);
}
td {
  padding: 10px 14px;
  vertical-align: middle;
  font-size: 15px;
  color: var(--text);
  overflow: hidden;
}
@media (max-width: 640px) {
  .table-wrap {
    display: none;
  }
  .cards-wrap {
    display: flex;
  }
}
@media (min-width: 641px) {
  .table-wrap {
    display: block;
  }
  .cards-wrap {
    display: none;
  }
}

/* TASK NAME */
.tn {
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.1s;
  word-break: break-word;
  display: block;
}
.tn:hover {
  background: var(--surface3);
}
.tn[contenteditable="true"] {
  outline: none;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 2px 6px;
}
.align-title-wrap {
  display: block;
  word-break: break-word;
  cursor: text;
}

/* BADGES */
.prio-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: var(--font);
  white-space: nowrap;
}
.prio-badge.alta {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-b);
}
.prio-badge.media {
  background: var(--amber-bg);
  color: var(--amber);
  border: 1px solid var(--amber-b);
}
.prio-badge.baixa {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-b);
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: var(--font);
  white-space: nowrap;
}
.status-badge.pendente {
  background: var(--amber-bg);
  color: var(--amber);
  border: 1px solid var(--amber-b);
}
.status-badge.andamento {
  background: var(--blue-bg);
  color: var(--blue);
  border: 1px solid var(--blue-b);
}
.status-badge.realizado {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-b);
}
.health-badge {
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.health-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.hb-engajado {
  background: var(--color-semantic-success-strong-bg);
  color: var(--color-semantic-success-strong-text);
}
.hb-engajado::before {
  background: var(--color-semantic-success-strong);
}
.hb-estavel {
  background: var(--color-semantic-info-bg);
  color: var(--color-semantic-info);
}
.hb-estavel::before {
  background: var(--color-semantic-info-strong);
}
.hb-atencao {
  background: var(--color-semantic-warning-strong-bg);
  color: var(--color-semantic-warning-strong-text);
}
.hb-atencao::before {
  background: var(--color-semantic-warning-strong);
}
.hb-risco {
  background: var(--color-semantic-error-strong-bg);
  color: var(--color-semantic-error-strong-text);
}
.hb-risco::before {
  background: var(--color-semantic-error-strong);
}
.hb-critico {
  background: var(--color-semantic-error-critical-bg);
  color: var(--color-semantic-error-critical-text);
}
.hb-critico::before {
  background: var(--color-semantic-error-critical);
}
.hb-inativo {
  background: var(--color-semantic-neutral-strong-bg);
  color: var(--color-semantic-neutral-strong-text);
}
.hb-inativo::before {
  background: var(--color-semantic-neutral-strong);
}

/* EST DROPDOWN */
.est-dd-wrap {
  position: relative;
  display: inline-block;
}
.est-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--ec-bg, var(--accent-light));
  color: var(--ec, var(--accent));
  border: 1px solid var(--ec, var(--accent-mid));
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
}
.est-badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.est-dd {
  position: fixed;
  z-index: 80;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--rl);
  padding: 5px;
  min-width: 160px;
  box-shadow: var(--sh-md);
  display: none;
}
.est-dd.open {
  display: block;
}
.est-dd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  color: var(--text);
}
.est-dd-item:hover {
  background: var(--surface2);
}
.d-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* CLIENT BADGE */
.client-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--accent-mid);
  white-space: nowrap;
}
.client-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.no-client {
  font-size: 13px;
  color: var(--text3);
}

/* DAYS */
.days-badge {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 13px;
  font-family: var(--mono);
  font-weight: 500;
  white-space: nowrap;
}
.days-badge.fresh {
  background: var(--surface3);
  color: var(--text3);
}
.days-badge.moderate {
  background: var(--amber-bg);
  color: var(--amber);
}
.days-badge.urgent {
  background: var(--red-bg);
  color: var(--red);
}
.days-badge.done {
  color: var(--text3);
}
.date-cell {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text3);
  white-space: nowrap;
}
.date-cell.ok {
  color: var(--text2);
}

/* CIENTE CHIPS */
.ciente-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.ciente-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid;
  font-family: var(--font);
  white-space: nowrap;
}
.ciente-chip.nao {
  background: transparent;
  color: var(--text3);
  border-color: var(--border2);
}
.ciente-chip.sim {
  background: var(--ec-bg, var(--accent-light));
  color: var(--ec, var(--accent));
  border-color: var(--ec, var(--accent-mid));
}
.ciente-chip .c-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}
.ciente-chip.sim .c-dot {
  background: currentColor;
}
.ciente-chip.nao .c-dot {
  background: var(--text3);
}

/* DROP ZONE */
.dz {
  min-height: 30px;
  border: 1px dashed var(--border2);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text3);
  font-size: 13px;
  padding: 3px 8px;
}
.dz:hover,
.dz.hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}
.dz.has-img {
  border-style: solid;
  border-color: var(--border);
  padding: 2px;
  width: 38px;
  min-height: 38px;
}
.dz img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

/* COMMENT BTN */
.comment-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text3);
  font-family: var(--font);
  transition: all 0.15s;
  white-space: nowrap;
}
.comment-btn:hover {
  background: var(--surface2);
  color: var(--text);
}
.comment-btn.has-c {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent-mid);
}

/* ACTION BTNS */
.action-btn {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.15s;
}
.action-btn:hover {
  background: var(--surface3);
  color: var(--text);
}
.action-btn.del:hover {
  background: var(--red-bg);
  color: var(--red);
}

/* LATE */
.late-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--red-bg);
  color: var(--red);
  font-size: 12px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--red-b);
}
.upd-late {
  font-size: 13px;
  color: var(--red);
  font-family: var(--mono);
  display: flex;
  align-items: center;
  gap: 3px;
}
.upd-late::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--red);
  flex-shrink: 0;
}

/* MOBILE CARD */
.m-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--rl);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--sh);
}
.m-card.late-c {
  border-color: var(--color-semantic-error-border-tint);
  background: var(--color-semantic-error-tint);
}
.m-card.done-c {
  opacity: 0.45;
}
.m-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.m-card-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
  cursor: pointer;
  word-break: break-word;
}
.m-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.m-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.m-card-date {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text3);
}
.m-card-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* CARTEIRA */
.cart-body {
  padding: 16px var(--px) 40px;
}
.cart-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
@media (max-width: 640px) {
  .cart-summary {
    grid-template-columns: repeat(2, 1fr);
  }
}
.cs-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  padding: 14px 16px;
  box-shadow: var(--sh);
}
.cs-label {
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 4px;
  font-weight: 500;
}
.cs-val {
  font-size: 22px;
  font-weight: 600;
}
.est-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (max-width: 640px) {
  .est-cards-grid {
    grid-template-columns: 1fr;
  }
}
.est-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--sh);
}
.est-card:hover {
  border-color: var(--accent-mid);
  box-shadow: var(--sh-md);
  transform: translateY(-1px);
}
.est-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.est-av {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-inverse);
  flex-shrink: 0;
}
.est-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.est-card-sub {
  font-size: 13px;
  color: var(--text3);
}
.est-alert {
  margin-left: auto;
  background: var(--red-bg);
  color: var(--red);
  font-size: 13px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid var(--red-b);
  display: flex;
  align-items: center;
  gap: 3px;
}
.est-alert::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--red);
}
.est-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.est-stat {
  background: var(--surface2);
  border-radius: var(--r);
  padding: 8px;
  text-align: center;
  border: 1px solid var(--border);
}
.est-stat-v {
  font-size: 17px;
  font-weight: 600;
}
.est-stat-l {
  font-size: 12px;
  color: var(--text3);
  margin-top: 1px;
}
.health-bar {
  display: flex;
  gap: 2px;
  height: 5px;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 7px;
}
.health-legend {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.hl {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: var(--text2);
}
.hl-dot {
  width: 6px;
  height: 6px;
  border-radius: 2px;
  flex-shrink: 0;
}
.est-card-footer {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.est-cta {
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
}
.cart-hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px var(--px);
}
.ch-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.ch-av {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-inverse);
  flex-shrink: 0;
}
.ch-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}
.ch-sub {
  font-size: 13px;
  color: var(--text3);
}
.ch-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.ch-stat {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 8px 14px;
  text-align: center;
}
.ch-stat-v {
  font-size: 17px;
  font-weight: 600;
}
.ch-stat-l {
  font-size: 12px;
  color: var(--text3);
}

/* CLIENT MODAL */
.cm-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: var(--color-surface-scrim-modal);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  padding: 20px;
  -webkit-overflow-scrolling: touch;
}
.cm-overlay.vis {
  opacity: 1;
  pointer-events: all;
}
.cm-box {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 14px;
  width: 100%;
  max-width: 1200px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--sh-md);
  transform: translateY(10px);
  transition: transform 0.2s;
  overflow: hidden;
}
.cm-overlay.vis .cm-box {
  transform: translateY(0);
}
.cm-hdr {
  padding: 16px 20px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cm-hdr-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.cm-av {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-inverse);
  flex-shrink: 0;
}
.cm-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}
.cm-spec {
  font-size: 14px;
  color: var(--text3);
}
.cm-close {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}
.cm-close:hover {
  background: var(--surface2);
}
.cm-tabs {
  display: flex;
}
.cm-tab {
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text2);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.cm-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.cm-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 20px;
  font-size: 15px;
}

/* TIMELINE */
.tl {
  display: flex;
  flex-direction: column;
}
.tl-item {
  display: flex;
  gap: 10px;
  padding-bottom: 14px;
  position: relative;
}
.tl-item::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 20px;
  bottom: 0;
  width: 1px;
  background: var(--border);
}
.tl-item:last-child::before {
  display: none;
}
.tl-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.tl-upd {
  background: var(--color-semantic-success-strong-bg);
  border: 1px solid var(--color-semantic-success-strong-border);
}
.tl-status {
  background: var(--color-semantic-warning-strong-bg);
  border: 1px solid var(--color-semantic-warning-strong-border);
}
.tl-task {
  background: var(--color-semantic-info-bg);
  border: 1px solid var(--color-semantic-info-border);
}
.tl-bdy {
  flex: 1;
}
.tl-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.tl-type {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tl-time {
  font-size: 12px;
  color: var(--text3);
  font-family: var(--mono);
  margin-left: auto;
}
.tl-ro {
  font-size: 12px;
  color: var(--text3);
  background: var(--surface2);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.tl-text {
  font-size: 16px;
  color: var(--text);
  line-height: 1.6;
}
.tl-sc {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  margin-top: 4px;
}
.sc-from {
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border);
}
.sc-to {
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--color-semantic-success-strong-bg);
  color: var(--color-semantic-success-strong-text);
  border: 1px solid var(--color-semantic-success-strong-border);
}
.upd-form {
  background: var(--surface2);
  border-radius: var(--r);
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
}
.upd-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.upd-save {
  background: var(--accent);
  color: var(--color-text-inverse);
  border: none;
  padding: 8px 16px;
  border-radius: var(--r);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
}
.upd-save:hover {
  background: var(--accent-h);
}

/* TASK IN CLIENT MODAL */
.ts-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.ts-pill {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}
.task-item-m {
  background: var(--surface2);
  border-radius: var(--r);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  margin-bottom: 6px;
}
.task-item-m.done-t {
  opacity: 0.5;
}
.ti-check {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--border2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ti-check.done-c {
  background: var(--color-semantic-success-strong);
  border-color: var(--color-semantic-success-strong);
}
.ti-check.and-c {
  background: var(--color-semantic-info);
  border-color: var(--color-semantic-info);
}
.ti-name-m {
  font-size: 13px;
  flex: 1;
  color: var(--text);
}
.ti-name-m.struck {
  text-decoration: line-through;
  color: var(--text3);
}
.ti-origin {
  font-size: 12px;
  color: var(--text3);
  background: var(--surface);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.new-task-box {
  background: var(--surface2);
  border: 1px dashed var(--border2);
  border-radius: var(--r);
  padding: 12px;
  margin-top: 10px;
}
.ntb-row {
  display: flex;
  gap: 8px;
}

/* INFO GRID */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.info-field {
  background: var(--surface2);
  border-radius: var(--r);
  padding: 10px 12px;
  border: 1px solid var(--border);
}
.if-label {
  font-size: 13px;
  color: var(--text3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.if-val {
  font-size: 16px;
  color: var(--text);
}

/* GENERIC MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--color-surface-scrim-modal);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.vis {
  opacity: 1;
  pointer-events: all;
}
@media (min-width: 641px) {
  .modal-overlay {
    align-items: center;
  }
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 14px 14px 0 0;
  width: 100%;
  max-width: 780px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--sh-md);
  transform: translateY(14px);
  transition: transform 0.2s;
}
.modal-overlay.vis .modal {
  transform: translateY(0);
}
@media (min-width: 641px) {
  .modal {
    border-radius: 14px;
  }
}
.modal-hdr {
  padding: 20px 24px 0;
  flex-shrink: 0;
}
.modal-h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}
.modal-scroll {
  overflow-y: auto;
  padding: 0 24px 24px;
  flex: 1;
}

/* =====================================================================
   Story 3.4 — UX-010 native <dialog> foundation
   ===================================================================== */
dialog.dlg {
  /* Reset do user-agent: <dialog> é unstyled por padrão */
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 0;
  max-width: 480px;
  width: calc(100% - 32px);
  box-shadow: var(--sh-md);
  /* fade+scale animation no abrir */
  animation: dlg-in 120ms ease-out;
}
dialog.dlg::backdrop {
  background: var(--color-surface-scrim-dialog);
  backdrop-filter: blur(5px);
  animation: dlg-backdrop-in 120ms ease-out;
}
dialog.dlg .dlg-box {
  margin: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
dialog.dlg .dlg-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}
dialog.dlg .dlg-msg {
  font-size: 15px;
  line-height: 1.45;
  margin: 0;
  color: var(--text2);
}
dialog.dlg .dlg-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 6px;
}
/* Story 4.1 — input usado em dlg-prompt; herda visual do design system */
dialog.dlg .dlg-input {
  width: 100%;
  font: inherit;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 120ms ease;
}
dialog.dlg .dlg-input:focus {
  border-color: var(--brand, var(--color-brand-indigo));
  box-shadow: 0 0 0 3px var(--color-brand-indigo-glow);
}
@keyframes dlg-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes dlg-backdrop-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@media (max-width: 640px) {
  dialog.dlg {
    border-radius: 14px 14px 0 0;
    margin: auto auto 0 auto;
    width: 100%;
    max-width: none;
  }
}
/* Story 4.5 — Modal cascade Batch 2: variante "wide" para forms maiores
   (status de saúde, permissões, etc) e container .dlg-body que envolve
   o HTML originalmente inserido em #gModalBody. */
dialog.dlg.dlg-wide {
  max-width: 780px;
}
dialog.dlg .dlg-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: calc(90vh - 80px);
  overflow-y: auto;
}

.m-field {
  margin-bottom: 13px;
}
.m-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 5px;
  display: block;
}
.m-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 9px 12px;
  border-radius: var(--r);
  outline: none;
  transition: border 0.15s;
}
.m-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.m-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.m-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: var(--surface2);
  border-radius: var(--r);
  font-size: 13px;
  border: 1px solid var(--border);
}
.m-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}
.sec-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 10px;
  margin-top: 16px;
}

/* COMMENTS PANEL */
.cp-overlay {
  position: fixed;
  inset: 0;
  z-index: 700;
  pointer-events: none;
}
.cp-overlay.vis {
  pointer-events: all;
}
.cp-bg {
  position: absolute;
  inset: 0;
  background: var(--color-surface-scrim-medium);
  opacity: 0;
  transition: opacity 0.25s;
}
.cp-overlay.vis .cp-bg {
  opacity: 1;
}
.cp-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 400px;
  max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--border2);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--sh-md);
}
@media (max-width: 640px) {
  .cp-panel {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border2);
    top: auto;
    height: 85vh;
    transform: translateY(100%);
  }
}
.cp-overlay.vis .cp-panel {
  transform: translateX(0);
}
@media (max-width: 640px) {
  .cp-overlay.vis .cp-panel {
    transform: translateY(0);
  }
}
.cp-hdr {
  padding: 16px 18px 13px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}
.cp-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.cp-sub {
  font-size: 12px;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 36px);
}
.cp-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}
.cp-close:hover {
  background: var(--surface2);
}
.cp-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cp-msg {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cp-msg-head {
  display: flex;
  align-items: center;
  gap: 7px;
}
.cp-av {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: var(--color-text-inverse);
  flex-shrink: 0;
}
.cp-msg-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.cp-msg-time {
  font-size: 12px;
  color: var(--text3);
  font-family: var(--mono);
  margin-left: auto;
}
.cp-msg-body {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 0 10px 10px 10px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  word-break: break-word;
  margin-left: 29px;
}
.cp-msg-body a {
  color: var(--accent);
  text-decoration: underline;
}
.cp-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--text3);
}
.cp-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.cp-who {
  display: flex;
  gap: 5px;
  margin-bottom: 9px;
  flex-wrap: wrap;
}
.cp-who-btn {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text3);
  font-family: var(--font);
  transition: all 0.15s;
}
.cp-who-btn.active {
  background: var(--ec-bg, var(--accent-light));
  color: var(--ec, var(--accent));
  border-color: var(--ec, var(--accent-mid));
}
.cp-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.cp-textarea {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 9px 12px;
  border-radius: var(--r);
  outline: none;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  line-height: 1.5;
  transition: border 0.15s;
}
.cp-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.cp-textarea::placeholder {
  color: var(--text3);
}
.cp-send {
  width: 38px;
  height: 38px;
  border-radius: var(--r);
  background: var(--accent);
  color: var(--color-text-inverse);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cp-send:hover {
  background: var(--accent-h);
}

/* IMG PREVIEW */
.img-prev-ov {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--color-surface-scrim-image);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.img-prev-ov.vis {
  opacity: 1;
  pointer-events: all;
}
.img-prev-ov img {
  max-width: 92vw;
  max-height: 82vh;
  border-radius: 8px;
}
.img-prev-close {
  position: fixed;
  top: 14px;
  right: 14px;
  font-size: 20px;
  color: var(--color-text-inverse);
  cursor: pointer;
  background: var(--color-surface-scrim-modal-strong);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-prev-rm {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-b);
  padding: 7px 16px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font);
  font-weight: 500;
}

/* LOADING / EMPTY / TOAST */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  gap: 12px;
  color: var(--text3);
  font-size: 14px;
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text3);
}
.empty-icon {
  font-size: 28px;
  margin-bottom: 10px;
  opacity: 0.35;
}
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  z-index: 600;
  background: var(--text);
  color: var(--surface);
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--sh-md);
  opacity: 0;
  transition: all 0.25s;
  white-space: nowrap;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast.err {
  background: var(--red);
}

/* COLOR SWATCHES */
.color-swatches {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
}
.swatch.sel {
  border-color: var(--text);
  transform: scale(1.2);
}

input[type="file"] {
  display: none;
}

/* PERSON PANEL */
.person-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--rl);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
  min-width: 0;
}
.person-card:hover {
  border-color: var(--pc, var(--accent-mid));
  background: var(--surface2);
}
.person-card.active {
  border-color: var(--pc, var(--accent));
  background: var(--accent-light);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--pc, var(--accent)) 20%, transparent);
}
.pc-av {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-inverse);
  flex-shrink: 0;
}
.pc-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}
.pc-meta {
  font-size: 13px;
  color: var(--text3);
}

/* PRAZO BADGE */
.prazo-btn {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 13px;
  font-family: var(--mono);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  font-family: var(--font);
  transition: all 0.15s;
}
.prazo-btn.empty {
  background: transparent;
  color: var(--text3);
  border: 1px dashed var(--border2);
}
.prazo-btn.empty:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.prazo-btn.ok {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-b);
}
.prazo-btn.soon {
  background: var(--amber-bg);
  color: var(--amber);
  border: 1px solid var(--amber-b);
}
.prazo-btn.late {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-b);
  font-weight: 600;
}

/* STATUS/PRIO POPUP */
.field-pop {
  position: fixed;
  z-index: 600;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--rl);
  padding: 6px;
  min-width: 170px;
  box-shadow: var(--shadow-popover);
}
.pop-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 4px 10px 6px;
}
.pop-item {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.pop-item:hover {
  background: var(--surface2);
}
.pop-active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
}
.pop-active::after {
  content: "✓";
  margin-left: auto;
  font-size: 12px;
}

/* PERSON PANEL - full width grid */
#personPanel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 8px;
  padding: 12px var(--px) 0;
}
.person-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--rl);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
}
.person-card:hover {
  border-color: var(--accent-mid);
  background: var(--accent-light);
}
.person-card.active {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 0 2px var(--color-brand-indigo-glow-soft);
}
.pc-av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-inverse);
  flex-shrink: 0;
}
.pc-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}
.pc-role-lbl {
  font-size: 12px;
  color: var(--text3);
}
.pc-meta {
  font-size: 12px;
  color: var(--text2);
  margin-top: 2px;
}

/* CALENDAR POPUP */
.cal-pop {
  position: fixed;
  z-index: 600;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--rl);
  padding: 14px;
  width: 268px;
  box-shadow: var(--shadow-popover);
}
.cal-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.cal-nav-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border2);
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-nav-btn:hover {
  background: var(--surface2);
}
.cal-month-lbl {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-dow {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  color: var(--text3);
  padding: 3px 0;
  text-transform: uppercase;
}
.cal-day {
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
}
.cal-day:hover {
  background: var(--surface3);
}
.cal-day.other-month {
  color: var(--text3);
}
.cal-day.is-today {
  background: var(--accent);
  color: var(--color-text-inverse);
  font-weight: 600;
}
.cal-day.is-today:hover {
  background: var(--accent-h);
}
.cal-day.is-selected {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
  border: 1px solid var(--accent-mid);
}
.cal-footer {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.cal-save-btn {
  flex: 1;
  background: var(--accent);
  color: var(--color-text-inverse);
  border: none;
  padding: 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
}
.cal-save-btn:hover {
  background: var(--accent-h);
}
.cal-clear-btn {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border2);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font);
}

/* Dynamic health badge (replaces hb-* classes) */
.hb-custom {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.hb-custom::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ── PROGRAMA ────────────────────────────────────────────────────────────── */
.prog-etapa {
  border: 1px solid var(--border);
  border-radius: var(--rl);
  overflow: visible;
  margin-bottom: 10px;
}
.prog-etapa-hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface2);
  cursor: pointer;
  user-select: none;
}
.prog-etapa-hdr:hover {
  background: var(--surface3);
}
.prog-etapa-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.prog-etapa-nome {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.prog-etapa-count {
  font-size: 13px;
  color: var(--text3);
  font-family: var(--mono);
  white-space: nowrap;
  flex-shrink: 0;
}
.prog-etapa-bar {
  width: 60px;
  height: 5px;
  background: var(--surface3);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}
.prog-etapa-chevron {
  font-size: 12px;
  color: var(--text3);
  flex-shrink: 0;
}
.prog-tarefas {
  padding: 6px 8px;
}
.prog-task {
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: background 0.1s;
}
.prog-task:hover {
  background: var(--surface2);
  border-color: var(--border);
}
.prog-task.prog-done {
  opacity: 0.45;
}
.prog-task-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.prog-check {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid var(--border2);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--color-text-inverse);
  flex-shrink: 0;
  transition: all 0.15s;
}
.prog-check:hover {
  border-color: var(--accent);
}
.prog-check.chk-done {
  background: var(--color-semantic-success-strong);
  border-color: var(--color-semantic-success-strong);
}
.prog-check.chk-prog {
  background: var(--color-semantic-info-strong);
  border-color: var(--color-semantic-info-strong);
}
.prog-task-nome {
  font-size: 12px;
  color: var(--text);
  flex: 1;
  line-height: 1.4;
}
.prog-task-nome.prog-struck {
  text-decoration: line-through;
  color: var(--text3);
}
.prog-task-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.prog-expand-btn {
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text3);
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
}
.prog-expand-btn:hover {
  background: var(--surface2);
  color: var(--text);
}
.prog-task-detail {
  padding: 8px 0 4px 26px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
}
.prog-add-task {
  display: block;
  width: 100%;
  padding: 7px;
  border: 1px dashed var(--border2);
  border-radius: 6px;
  background: transparent;
  color: var(--text3);
  font-size: 13px;
  cursor: pointer;
  margin-top: 4px;
  font-family: var(--font);
  text-align: left;
}
.prog-add-task:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* ETAPA BADGE */
.etapa-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.15s;
}
.etapa-badge:hover {
  filter: brightness(0.94);
}

/* PROG POPUP - inside drawer, position absolute to bypass transform context */
.prog-pop {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--rl);
  padding: 6px;
  min-width: 170px;
  box-shadow: var(--shadow-popover-strong);
  z-index: 99999;
}

/* ── RICH COMMENT EDITOR ──────────────────────────────────────────────────── */
.cp-input-wrap {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border2);
  border-radius: var(--rl);
  overflow: hidden;
  background: var(--surface);
  margin: 0 12px 12px;
}
.cp-toolbar {
  display: flex;
  gap: 2px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.cp-tb-btn {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}
.cp-tb-btn:hover {
  background: var(--surface3);
}
.cp-input-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 6px 8px;
}
.cp-editor {
  flex: 1;
  min-height: 36px;
  max-height: 160px;
  overflow-y: auto;
  font-size: 14px;
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  outline: none;
  word-break: break-word;
}
.cp-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text3);
  pointer-events: none;
}
.cp-editor img {
  max-width: 100%;
  border-radius: 6px;
  margin: 2px 0;
  display: block;
}
.cp-editor a {
  color: var(--accent);
  text-decoration: underline;
}
.cp-editor b,
.cp-editor strong {
  font-weight: 600;
}
.cp-editor i,
.cp-editor em {
  font-style: italic;
}

/* ── RICH MESSAGE RENDERING ───────────────────────────────────────────────── */
.cp-msg-body img {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 4px;
  display: block;
  cursor: pointer;
}
.cp-msg-body a {
  color: var(--accent);
  text-decoration: underline;
  word-break: break-all;
}

/* ── PROG CARDS (aba Programa) ──────────────────────────────────────────── */
.prog-group-hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  margin-bottom: 6px;
  cursor: pointer;
  user-select: none;
}
.prog-group-hdr:hover {
  background: var(--surface3);
}
.prog-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--rl);
  margin-bottom: 6px;
  overflow: hidden;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.prog-card:hover {
  border-color: var(--border2);
}
.prog-card.prog-card-open {
  border-color: var(--accent-mid);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.prog-card-summary {
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
}
.pcs-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.pcs-av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-inverse);
  flex-shrink: 0;
}
.pcs-info {
  flex: 1;
  min-width: 0;
}
.pcs-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}
.pcs-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.pcs-badge {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.pcs-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text2);
}
.pcs-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  flex-shrink: 0;
}
.pcs-chevron {
  font-size: 9px;
  color: var(--text3);
  margin-top: 3px;
}

/* Timeline inside card */
.pcs-timeline {
  display: flex;
  gap: 0;
  padding: 0 16px 6px;
  cursor: pointer;
}
.pcs-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
}
.pcs-step-line::before {
  content: "";
  position: absolute;
  right: 50%;
  top: 9px;
  width: 100%;
  height: 1px;
  background: var(--border);
  z-index: 0;
}
.pcs-step-done.pcs-step-line::before,
.pcs-step-done + .pcs-step-prog.pcs-step-line::before {
  background: var(--color-semantic-success-strong);
}
.pcs-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border2);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  position: relative;
  z-index: 1;
}
.dot-done {
  background: var(--color-semantic-success-strong);
  border-color: var(--color-semantic-success-strong);
  color: var(--color-text-inverse);
}
.dot-prog {
  background: var(--color-semantic-info-strong);
  border-color: var(--color-semantic-info-strong);
  color: var(--color-text-inverse);
}
.pcs-step-lbl {
  font-size: 8px;
  color: var(--text3);
  margin-top: 3px;
  text-align: center;
  max-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pcs-progbar {
  height: 3px;
  background: var(--surface3);
  margin: 0 16px 10px;
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
}
.pcs-progfill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s;
}

/* Card detail panel */
.prog-card-detail {
  border-top: 0.5px solid var(--border);
  background: var(--surface);
}
.pcd-tabs {
  display: flex;
  padding: 0 16px;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface2);
}
.pcd-tab {
  font-size: 12px;
  padding: 8px 0;
  margin-right: 18px;
  color: var(--text3);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  user-select: none;
}
.pcd-tab.active {
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 500;
}
.pcd-body {
  padding: 14px 16px;
  max-height: 480px;
  overflow-y: auto;
}

/* ── CHECKUP ─────────────────────────────────────────────────────────────── */
.checkup-btn {
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--text3);
  cursor: pointer;
  font-size: 12px;
  padding: 3px 7px;
  transition: all 0.15s;
}
.checkup-btn:hover {
  background: var(--color-semantic-success-strong-bg);
  color: var(--color-semantic-success-strong);
  border-color: var(--color-semantic-success-strong-mid);
}
.tl-checkup {
  background: var(--color-semantic-success-strong);
}

/* ── NOTAS ──────────────────────────────────────────────────────────────── */
.nota-editor-wrap {
  border: 1px solid var(--border2);
  border-radius: var(--rl);
  overflow: hidden;
  background: var(--surface);
}
.nota-toolbar {
  display: flex;
  gap: 2px;
  padding: 5px 8px;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface2);
}
.nota-tb-btn {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}
.nota-tb-btn:hover {
  background: var(--surface3);
}
.nota-editor {
  min-height: 80px;
  max-height: 200px;
  overflow-y: auto;
  font-size: 14px;
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  outline: none;
  padding: 10px 12px;
  word-break: break-word;
}
.nota-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text3);
  pointer-events: none;
}
.nota-editor img {
  max-width: 100%;
  border-radius: 6px;
  margin: 4px 0;
  display: block;
}
.nota-editor a {
  color: var(--accent);
  text-decoration: underline;
}
.nota-item {
  border: 0.5px solid var(--border);
  border-radius: var(--rl);
  overflow: hidden;
  margin-bottom: 10px;
  background: var(--surface);
}
.nota-item-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface2);
  border-bottom: 0.5px solid var(--border);
}
.nota-item-body {
  padding: 12px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
}
.nota-item-body img {
  max-width: 100%;
  border-radius: 6px;
  margin: 4px 0;
  display: block;
  cursor: pointer;
}
.nota-item-body a {
  color: var(--accent);
  text-decoration: underline;
  word-break: break-all;
}
.nota-anexos {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-top: 0.5px solid var(--border);
}
.nota-anexo-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--surface2);
  border: 0.5px solid var(--border2);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text2);
  text-decoration: none;
  cursor: pointer;
}
.nota-anexo-chip:hover {
  background: var(--surface3);
  color: var(--accent);
}

/* ── PROG TABLE (new style matching carteira) ────────────────────────────── */
.prog-table-wrap {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--rl);
  overflow: hidden;
  margin-bottom: 10px;
}
.prog-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.prog-table-wrap th {
  text-align: left;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.prog-table-wrap td {
  padding: 10px 14px;
  vertical-align: middle;
  border-bottom: 0.5px solid var(--border);
}
.prog-table-wrap tr:last-child td {
  border-bottom: none;
}
.prog-trow {
  cursor: pointer;
  transition: background 0.1s;
}
.prog-trow:hover {
  background: var(--surface2);
}
.prog-trow.trow-open {
  background: var(--accent-light);
}
.prog-expand-td td {
  padding: 0;
  background: var(--surface);
}

/* ── FONT SIZE BUMP ───────────────────────────────────────────────────────── */
.prog-table-wrap td {
  font-size: 13px;
}
.prog-table-wrap th {
  font-size: 11px;
}
.cm-tab {
  font-size: 13px;
}
.pcd-tab {
  font-size: 15px;
}
.tab-btn {
  font-size: 14px;
}
.stat-pill {
  font-size: 12px;
}
.badge-est {
  font-size: 12px;
}

/* VINCULAR CLIENTE BTN */
.vincular-btn {
  font-size: 13px;
  color: var(--text3);
  background: transparent;
  border: 1px dashed var(--border2);
  padding: 2px 8px;
  border-radius: 20px;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
  white-space: nowrap;
}
.vincular-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}
.client-badge {
  font-size: 12px;
  color: var(--text2);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.client-badge:hover {
  background: var(--surface2);
}

/* ── PROGRAMA TASK TABLE — única fonte de verdade ──────────────────────── */
/* Aba Programa (standalone) e modal da ficha: mesmas regras */
.prog-etapa table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.prog-etapa table th {
  text-align: left;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  overflow: hidden;
}
.prog-etapa table td {
  padding: 7px 10px;
  font-size: 12px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.prog-etapa table td:first-child {
  font-size: 13px;
}
.prog-etapa table td:not(:first-child) {
  white-space: nowrap;
  text-overflow: ellipsis;
}
.prog-etapa table td:last-child {
  text-align: center;
  padding: 4px 6px;
}
.prog-etapa table tr:last-child td {
  border-bottom: none;
}
button[id^="ptask-cmt-"] {
  min-width: 32px;
  justify-content: center;
}

/* prog-table-wrap (aba Programa principal) */
.prog-table-wrap td {
  padding: 10px 14px;
  font-size: 13px;
  vertical-align: middle;
  border-bottom: 0.5px solid var(--border);
}
.prog-table-wrap th {
  padding: 8px 14px;
  font-size: 11px;
}

/* ── NOTIFICATION BELL ────────────────────────────────────────────────────── */
.notif-bell {
  position: relative;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.15s;
}
.notif-bell:hover {
  background: var(--color-surface-overlay-on-dark-soft);
}
.notif-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--color-semantic-error-critical);
  color: var(--color-text-inverse);
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
  line-height: 1.4;
}
.notif-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: var(--color-surface-scrim-light);
}
.notif-panel {
  position: absolute;
  top: 52px;
  right: 16px;
  width: 360px;
  max-height: 500px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--rl);
  box-shadow: var(--sh-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.notif-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.notif-hdr span {
  flex: 1;
}
.notif-body {
  overflow-y: auto;
  flex: 1;
}
.notif-item {
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  transition: background 0.1s;
}
.notif-item:hover {
  background: var(--surface2);
}
.notif-item.unread {
  background: var(--accent-light);
}
.notif-item.unread:hover {
  background: var(--color-brand-indigo-bg);
}
.notif-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.notif-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
}
.notif-time {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}

/* ── DASHBOARD ──────────────────────────────────────────────────────────── */
.dash-wrap {
  padding: 20px var(--px) 40px;
}
.dash-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.dash-sub {
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 20px;
}
.dash-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  padding: 16px 18px;
}
.dash-card-n {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}
.dash-card-l {
  font-size: 12px;
  color: var(--text3);
}
.dash-section {
  margin-bottom: 24px;
}
.dash-section-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 10px;
}
.dash-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 6px;
}
.dash-row:hover {
  background: var(--surface2);
}
.dash-row-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
}
.dash-row-meta {
  font-size: 12px;
  color: var(--text3);
}
.dash-row-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}
.dash-est-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.dash-est-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  padding: 14px 16px;
}
.dash-est-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-est-stat {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 0.5px solid var(--border);
}
.dash-est-stat:last-child {
  border-bottom: none;
}
.dash-est-stat-l {
  color: var(--text3);
}
.dash-est-stat-v {
  font-weight: 600;
  color: var(--text);
}

/* ── ATIVIDADE ──────────────────────────────────────────────────────────── */
.atv-wrap {
  padding: 20px var(--px) 40px;
}
.atv-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}
.atv-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 11px 14px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 6px;
}
.atv-item:hover {
  background: var(--surface2);
}
.atv-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.atv-text {
  font-size: 14px;
  color: var(--text);
  flex: 1;
  line-height: 1.4;
}
.atv-time {
  font-size: 11px;
  color: var(--text3);
  white-space: nowrap;
}
.last-seen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}
.ls-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ls-av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--color-text-inverse);
  flex-shrink: 0;
}
.ls-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.ls-time {
  font-size: 11px;
  color: var(--text3);
}
.ls-online {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-semantic-success-strong);
  margin-left: auto;
  flex-shrink: 0;
}

/* ── INFO BAR ───────────────────────────────────────────────────────────── */
.cm-info-bar {
  padding: 10px 16px 10px;
  border-bottom: 0.5px solid var(--border);
}
.ib-grid-top {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.ib-grid-bot {
  display: grid;
  grid-template-columns: 180px 180px 1fr 1fr;
  gap: 8px;
}
.ib-card {
  border-radius: 10px;
  padding: 10px 13px;
  position: relative;
  transition: filter 0.12s;
  cursor: pointer;
}
.ib-card:hover {
  filter: brightness(0.96);
}
.ib-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.ib-val {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
}
.ib-date {
  font-size: 13px;
}
.ib-edit {
  position: absolute;
  top: 7px;
  right: 8px;
  font-size: 10px;
  opacity: 0;
  transition: opacity 0.12s;
}
.ib-card:hover .ib-edit {
  opacity: 1;
}
.ib-status {
  background: var(--color-semantic-info-strong-bg);
}
.ib-status .ib-label {
  color: var(--color-semantic-info-strong);
}
.ib-status .ib-edit {
  color: var(--color-semantic-info-strong);
}
.ib-saude {
  background: var(--color-brand-teal-tint);
}
.ib-saude .ib-label {
  color: var(--color-brand-teal-deep);
}
.ib-saude .ib-edit {
  color: var(--color-brand-teal-deep);
}
.ib-etapa {
  background: var(--color-brand-indigo-bg-soft);
}
.ib-etapa .ib-label {
  color: var(--color-brand-indigo);
}
.ib-etapa .ib-edit {
  color: var(--color-brand-indigo);
}
.ib-estrat {
  background: var(--color-brand-indigo-bg-neutral);
}
.ib-estrat .ib-label {
  color: var(--color-brand-indigo-text);
}
.ib-estrat .ib-edit {
  color: var(--color-brand-indigo-text);
}
.ib-venda {
  background: var(--color-brand-indigo-bg-neutral);
}
.ib-venda .ib-label {
  color: var(--color-brand-indigo-text);
}
.ib-venda .ib-edit {
  color: var(--color-brand-indigo-text);
}
.ib-onboard {
  background: var(--color-brand-indigo-bg-neutral);
}
.ib-onboard .ib-label {
  color: var(--color-brand-indigo-text);
}
.ib-onboard .ib-edit {
  color: var(--color-brand-indigo-text);
}
.ib-gargalo {
  background: var(--color-semantic-warning-strong-tint);
}
.ib-gargalo .ib-label {
  color: var(--color-semantic-warning-strong);
}
.ib-gargalo .ib-edit {
  color: var(--color-semantic-warning-strong);
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVO MOBILE — breakpoint 640px
   ══════════════════════════════════════════════════════════════════════════ */

/* Evita overflow horizontal em qualquer elemento */
@media (max-width: 640px) {
  /* NÃO usar overflow:hidden em html/body — quebra position:fixed no iOS */
  #app {
    max-width: 100vw;
    overflow-x: clip;
  }

  /* ── TOPBAR ─────────────────────────────────────────────────────────── */
  .topbar {
    min-height: 52px !important;
    padding: 8px 12px !important;
    gap: 2px !important;
  }
  .tb-greeting-center {
    display: none !important;
  }
  .tb-title {
    font-size: 12px !important;
  }
  .tb-logo {
    width: 20px !important;
    height: 20px !important;
    font-size: 10px !important;
  }
  .user-name {
    display: none !important;
  }
  .sync-dot {
    display: none !important;
  }
  /* sub-texto "programa multiplique e monetize" */
  .topbar .tb-left > div > div:last-child {
    display: none !important;
  }

  /* ── ABAS ────────────────────────────────────────────────────────────── */
  .tabs-bar {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none !important;
    padding: 0 4px !important;
  }
  .tabs-bar::-webkit-scrollbar {
    display: none !important;
  }
  .tab-btn {
    flex: none !important;
    padding: 10px 10px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }

  /* ── DASHBOARD — forçar 1 coluna nos grids inline ────────────────────── */
  #dashboardView {
    overflow-x: hidden !important;
    width: 100% !important;
  }
  /* Todos os grids de 4 colunas viram 2 colunas */
  #dashboardView [style*="repeat(4,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  #dashboardView [style*="repeat(3,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  #dashboardView [style*="1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  /* Cards do dashboard com padding menor */
  #dashboardView [style*="padding:28px"] {
    padding: 14px !important;
  }
  #dashboardView [style*="padding:20px"] {
    padding: 12px !important;
  }
  /* Seções com margin menor */
  #dashboardView [style*="margin-bottom:20px"] {
    margin-bottom: 12px !important;
  }
  /* Fontes inline menores */
  #dashboardView [style*="font-size:36px"] {
    font-size: 26px !important;
  }
  #dashboardView [style*="font-size:30px"] {
    font-size: 22px !important;
  }
  #dashboardView [style*="font-size:22px"] {
    font-size: 17px !important;
  }
  #dashboardView [style*="font-size:19px"] {
    font-size: 15px !important;
  }
  #dashboardView [style*="font-size:17px"] {
    font-size: 14px !important;
  }
  #dashboardView [style*="font-size:16px"] {
    font-size: 14px !important;
  }
  #dashboardView [style*="font-size:15px"] {
    font-size: 13px !important;
  }

  /* ── MEU DIA ─────────────────────────────────────────────────────────── */
  #meuDiaView {
    overflow-x: hidden !important;
  }
  #meuDiaView [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  #meuDiaView [style*="repeat(4,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* ── MODAL FICHA DO CLIENTE ──────────────────────────────────────────── */
  .cm-overlay {
    padding: 0 !important;
    align-items: flex-end !important;
  }
  .cm-box {
    max-width: 100% !important;
    max-height: 96vh !important;
    border-radius: 16px 16px 0 0 !important;
  }
  .cm-hdr {
    padding: 12px 14px 0 !important;
  }
  .cm-name {
    font-size: 16px !important;
  }
  .cm-tab {
    padding: 10px 10px !important;
    font-size: 13px !important;
  }
  .cm-body {
    padding: 12px 14px !important;
    font-size: 14px !important;
  }

  /* ── INFOBAR ─────────────────────────────────────────────────────────── */
  .ib-grid-top {
    grid-template-columns: 1fr 1fr !important;
    gap: 5px !important;
  }
  .ib-grid-bot {
    grid-template-columns: 1fr 1fr !important;
    gap: 5px !important;
  }
  .ib-gargalo {
    grid-column: span 2 !important;
  }
  .cm-info-bar {
    padding: 8px 10px !important;
  }
  .ib-card {
    padding: 8px 10px !important;
  }

  /* ── CARTEIRA ────────────────────────────────────────────────────────── */
  .cart-body {
    padding: 12px 12px 40px !important;
  }
  .cart-summary {
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
  }
  .est-cards-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── MODAL GENÉRICO ──────────────────────────────────────────────────── */
  .modal-overlay {
    align-items: flex-end !important;
  }
  .modal {
    border-radius: 16px 16px 0 0 !important;
    max-width: 100% !important;
    max-height: 94vh !important;
  }

  /* ── INFO GRID ───────────────────────────────────────────────────────── */
  .info-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── PROGRAMA ────────────────────────────────────────────────────────── */
  .pcd-body {
    padding: 10px 12px !important;
  }
  .pcd-tab {
    font-size: 13px !important;
    margin-right: 8px !important;
  }

  /* ── COMENTÁRIOS PANEL ───────────────────────────────────────────────── */
  .cp-panel {
    width: 100% !important;
    border-left: none !important;
    border-top: 1px solid var(--border2) !important;
    top: auto !important;
    height: 88vh !important;
    transform: translateY(100%) !important;
  }
  .cp-overlay.vis .cp-panel {
    transform: translateY(0) !important;
  }

  /* ── NOTIFICAÇÕES ────────────────────────────────────────────────────── */
  .notif-panel {
    right: 8px !important;
    left: 8px !important;
    width: auto !important;
  }

  /* ── TOAST ───────────────────────────────────────────────────────────── */
  .toast {
    left: 14px !important;
    right: 14px !important;
    width: auto !important;
    transform: translateY(16px) !important;
    white-space: normal !important;
    text-align: center !important;
  }
  .toast.show {
    transform: translateY(0) !important;
  }

  /* ── INPUTS — evita zoom no iOS ──────────────────────────────────────── */
  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  /* ── PADDING GLOBAL DAS VIEWS ────────────────────────────────────────── */
  .table-wrap {
    display: none !important;
  }
  .cards-wrap {
    display: flex !important;
    padding: 10px 12px 32px !important;
  }
  .stats-bar {
    padding: 8px 12px 0 !important;
  }
  .toolbar {
    padding: 10px 12px 0 !important;
  }
}

/* ── TABLET (641-1024px) ──────────────────────────────────────────────── */
@media (min-width: 641px) and (max-width: 1024px) {
  :root {
    --px: 18px;
  }
  .cm-box {
    max-width: 95vw;
  }
  .cart-summary {
    grid-template-columns: repeat(3, 1fr);
  }
  .est-cards-grid {
    grid-template-columns: 1fr 1fr;
  }
  .ib-grid-top {
    grid-template-columns: repeat(4, 1fr);
  }
  .ib-grid-bot {
    grid-template-columns: 180px 180px 1fr 1fr;
  }
  .dash-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .tab-btn {
    padding: 10px 10px;
    font-size: 12px;
  }
}

/* ── MOBILE REFINADO ──────────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Reembolsos: 4 cards em linha → 2x2 */
  .r-stats-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Dashboard: tabela de demandas → lista */
  .dash-dem-table {
    display: none;
  }
  .dash-dem-list {
    display: flex;
    flex-direction: column;
  }

  /* Demandas: esconder personPanel no mobile */
  #personPanel {
    display: none;
  }

  /* Demandas: mostrar select de filtro por pessoa (mobile only) */
  #demMobileFilter {
    display: block;
  }

  /* Demandas: resumo da pessoa selecionada (mobile only) */
  #demMobileSummary {
    display: block;
  }
}

@media (min-width: 641px) {
  /* Desktop: esconder elementos exclusivos do mobile */
  #demMobileFilter {
    display: none;
  }
  #demMobileSummary {
    display: none;
  }
  .dash-dem-list {
    display: none;
  }
  .dash-dem-table {
    display: block;
  }
}

/* =============================================================== */
/* Mobile-first patches: UX-022, UX-024, UX-027 — Story 4.4         */
/* Aditivo apenas. Não altera regras desktop existentes (>=1024px). */
/* Referência: docs/architecture/css-mobile-strategy.md             */
/* =============================================================== */

/* Mobile-first patches: UX-022 — Touch targets >=44x44 px (WCAG 2.5.5 / Apple HIG)
   Aplicado somente em ponteiros grosseiros (touch) para preservar UI compacta no desktop. */
@media (pointer: coarse) {
  .btn,
  .btn-sm,
  .filter-btn,
  .tab-btn,
  .action-btn,
  .vincular-btn,
  .prazo-btn,
  .est-chip,
  .notif-bell,
  button[id^="ptask-cmt-"] {
    min-width: 44px;
    min-height: 44px;
  }
  /* Inputs de seleção pequenos: aumentar área tátil sem mudar a aparência visual. */
  input[type="checkbox"],
  input[type="radio"] {
    min-width: 24px;
    min-height: 24px;
  }
  /* Labels associados a checkbox/radio: padding extra para hit area de 44px. */
  label:has(> input[type="checkbox"]),
  label:has(> input[type="radio"]) {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  /* Links de navegação em barras/menus precisam de altura mínima clicável. */
  nav a,
  .skip-link,
  a[role="button"] {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

/* Mobile-first patches: UX-024 — Overflow / scrollable containers
   Evita layout quebrado em telas estreitas. Não muda desktop. */
@media (max-width: 768px) {
  /* Tabelas: garante scroll horizontal em qualquer wrapper que ainda não tenha. */
  .table-wrap,
  .prog-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Cards genéricos: nunca extrapolam a viewport. */
  .m-card,
  .person-card,
  .stat-pill {
    max-width: 100%;
  }
  /* Toolbars/tabs: permitem quebrar em múltiplas linhas. */
  .toolbar,
  .toolbar-left,
  .toolbar-right,
  .filter-group {
    flex-wrap: wrap;
  }
  /* Tabs-bar: scroll horizontal quando houver muitas abas. */
  .tabs-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Mobile-first patches: UX-027 — Mobile breakpoints + viewport
   Consolida regras phone (<=480px) e tablet (<=768px). iOS auto-zoom prevention. */
/* iOS: prevenir auto-zoom em foco quando font-size < 16px. */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="tel"],
  input[type="url"],
  input[type="number"],
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"],
  textarea,
  select {
    font-size: 16px;
  }
}

/* Tablet (<=768px) — ajustes de espaçamento e wrap. */
@media (max-width: 768px) {
  :root {
    --px: 20px;
  }
}

/* Phone (<=480px) — mais compacto e proteção de overflow. */
@media (max-width: 480px) {
  :root {
    --px: 14px;
  }
  body {
    overflow-x: hidden;
  }
  /* Reduz min-width de tabela quando dentro de wrapper rolável. */
  .prog-etapa table {
    min-width: 480px;
  }
}
