/* ============================================================
   01. TOKENS
   ============================================================ */
:root {
  /* AFLOR - Paleta Oficial Final */
  --accent: #FF5A00;
  --accent-hover: #E55300;
  --accent-active: #CC4A00;
  --accent-soft: #FFE5D6;
  --destructive: #DC2626;
  --destructive-soft: #FEE2E2;
  --muted: #404045;
  --text-dark: #0B0B0C;
  --bg-light: #FFFFFF;

  /* Aliases estruturais preservados para compatibilidade visual */
  --navy: #0B0B0C;
  --navy2: #0B0B0C;
  --navy3: #1A1A1D;
  --green: #FF5A00;
  --green2: #E55300;
  --gdim: #FFE5D6;
  --gtext: #CC4A00;
  --orange: #FF5A00;
  --odim: #FFE5D6;
  --otext: #CC4A00;
  --red: #DC2626;
  --rdim: #FEE2E2;
  --rtext: #DC2626;
  --yellow: #CC4A00;
  --ydim: #FFE5D6;
  --ytext: #CC4A00;
  --blue: #404045;
  --bdim: #F0F0F0;
  --btext: #0B0B0C;
  --bg: #F5F5F5;
  --white: #FFFFFF;
  --border: #E5E5EA;
  --border2: #C7C7CC;
  --t1: #0B0B0C;
  --t2: #404045;
  --t3: #8E8E93;
  --t4: #C7C7CC;
  --shadow: 0 1px 3px rgba(0, 0, 0, .07), 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .09);
  --r: 12px;
  --rs: 8px;
}

/* ============================================================
   02. RESET E BASE
   ============================================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  min-height: 100vh;
}

body {
  background: var(--bg);
  color: var(--t1);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  padding-top: 64px;
}

/* ============================================================
   03. LOADING
   ============================================================ */
#ld {
  position: fixed;
  inset: 0;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 10000;
  transition: opacity .4s;
}

#ld.gone {
  opacity: 0;
  pointer-events: none;
}

.ldring {
  width: 38px;
  height: 38px;
  border: 3px solid var(--navy3);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#ld-t {
  color: var(--t3);
  font-size: 12px;
  letter-spacing: .04em;
}

/* ============================================================
   04. TOPBAR
   ============================================================ */
.topbar {
  background: var(--navy);
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-search { min-width: 0; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-action {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .18);
  color: #fff;
  white-space: nowrap;
}

.topbar-action:hover,
.topbar-action:focus-visible {
  border-color: rgba(255, 255, 255, .45);
  color: #fff;
}

.brand-text .name {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -.3px;
}

.brand-text .name.brand-signature {
  align-items: center;
  color: #F3F4F6;
  display: flex;
  gap: 7px;
  letter-spacing: 0;
}

.brand-signature .brand-logo {
  display: block;
  height: auto;
  object-fit: contain;
  width: 72px;
}

.brand-text .sub {
  font-size: 10px;
  color: var(--t3);
  letter-spacing: .04em;
}

.aflor-wordmark { text-align: right; }

.aflor-title {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
}

.tn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #8E8E93;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  border: none;
  background: transparent;
}

.tn:hover {
  background: var(--navy3);
  color: #fff;
}

.tn.active {
  background: var(--green);
  color: #fff;
  box-shadow: 0 2px 8px rgba(255, 90, 0, .35);
}

.tn svg {
  flex-shrink: 0;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--navy3);
  border-radius: 20px;
  font-size: 11px;
  color: var(--t3);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(255, 90, 0, .35);
  }

  50% {
    opacity: .7;
    box-shadow: 0 0 0 4px rgba(255, 90, 0, 0);
  }
}

/* ============================================================
   05. QUICKBAR
   ============================================================ */
.qbar {
  position: sticky;
  top: 64px;
  z-index: 199;
  background: var(--navy2);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  padding: 10px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.qbar-left,
.qbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.qbar-lbl {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #8E8E93;
  font-weight: 600;
  margin-right: 4px;
}

.qa {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  text-decoration: none;
  border: none;
}

.qa-form {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 2px 8px rgba(255, 90, 0, .28);
}

.qa-form:hover {
  background: #ea6c0a;
}

.qa-sheet,
.qa-site,
.qa-ref {
  background: var(--navy3);
  border: 1px solid rgba(255, 255, 255, .08);
  color: var(--t3);
}

.qa-sheet:hover,
.qa-site:hover,
.qa-ref:hover {
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

.qa-ref {
  margin-left: auto;
}

.qbar-right .qa-ref {
  margin-left: 0;
}

.qa-ref.spin svg {
  animation: spin .7s linear infinite;
}

.ts-lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #fff;
}

/* ============================================================
   06. LAYOUT BASE
   ============================================================ */
.content {
  padding: 20px 28px;
  max-width: 1700px;
  margin: 0 auto;
}

.is-hidden {
  display: none !important;
}

/* ============================================================
   07. VIEW MODE
   ============================================================ */
.view-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
}

.view-tab {
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, .86);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}

.view-tab:hover {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .42);
  color: #fff;
}

.view-tab.is-active {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
  box-shadow: 0 1px 6px rgba(255, 90, 0, .22);
}

/* ============================================================
   08. KPI
   ============================================================ */
.ktools {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 10px;
}

.qbar .ktools {
  margin-bottom: 0;
  flex-shrink: 0;
}

.krow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.kcard {
  background: var(--white);
  border-radius: var(--r);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s, transform .15s;
}

.kcard:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.kcard-chart {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
}

.kcard-chart .k-top {
  margin-bottom: 4px;
}

.kcard-chart .cw {
  height: 170px;
  flex: 1;
  min-height: 0;
}

.k-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
}

.kcard .k-accent { background: var(--navy); }

.k-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.k-ico {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

.kg .k-ico { background: var(--gdim); }
.ko .k-ico { background: var(--odim); }
.kr .k-ico { background: var(--rdim); }
.ky .k-ico { background: var(--ydim); }
.kb .k-ico { background: var(--bdim); }

.k-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  font-size: 10px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 20px;
  background: var(--bg);
  color: var(--navy);
}

.k-badge svg { width: 13px; height: 13px; flex: 0 0 auto; }

.k-val {
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 3px;
  letter-spacing: -.5px;
  color: var(--t1);
}

.k-lbl {
  font-size: 11px;
  color: var(--t2);
}

/* ============================================================
   09. MICRO FUNIL
   ============================================================ */
.mfunnel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 20px;
}

.mfunnel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.mfunnel-head > div {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.mfunnel-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.mfunnel-col {
  min-width: 0;
  border-top: 2px solid var(--green);
  padding-top: 9px;
}

.mfunnel-col-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.mfunnel-col-head strong {
  color: var(--gtext);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 700;
}

.mfunnel-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mfunnel-item {
  --mfunnel-priority-color: var(--border);
  --mfunnel-category-base: transparent;
  --mfunnel-category-light: transparent;
  --mfunnel-category-dark: transparent;
  width: 100%;
  border: 1px solid var(--navy2);
  border-radius: 8px;
  background: #FAFAFA;
  color: var(--t1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font: inherit;
  padding: 8px 9px;
  position: relative;
  text-align: left;
  transition: border-color .15s, background .15s;
}

.mfunnel-item.mfunnel-category-accent::before {
  background: linear-gradient(180deg, var(--mfunnel-category-light), var(--mfunnel-category-base) 50%, var(--mfunnel-category-dark));
  border-radius: 999px;
  bottom: 4px;
  content: '';
  left: 1px;
  pointer-events: none;
  position: absolute;
  top: 4px;
  width: 3px;
}

.mfunnel-item.mfunnel-category-gold { --mfunnel-category-base: #C5A145; --mfunnel-category-light: #E0C56A; --mfunnel-category-dark: #A98027; }
.mfunnel-item.mfunnel-category-sapphire { --mfunnel-category-base: #315F9A; --mfunnel-category-light: #527EB8; --mfunnel-category-dark: #244A7A; }
.mfunnel-item.mfunnel-category-ruby { --mfunnel-category-base: #963F50; --mfunnel-category-light: #B85A6A; --mfunnel-category-dark: #74303D; }
.mfunnel-item.mfunnel-category-emerald { --mfunnel-category-base: #34785A; --mfunnel-category-light: #579474; --mfunnel-category-dark: #286247; }
.mfunnel-item.mfunnel-category-bronze { --mfunnel-category-base: #A66C3E; --mfunnel-category-light: #C58A59; --mfunnel-category-dark: #7D4F2D; }
.mfunnel-item.mfunnel-category-titanium { --mfunnel-category-base: #68727D; --mfunnel-category-light: #929CA6; --mfunnel-category-dark: #4A535C; }
.mfunnel-item.mfunnel-category-amethyst { --mfunnel-category-base: #705A8A; --mfunnel-category-light: #927DAA; --mfunnel-category-dark: #514166; }

.mfunnel-item:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.mfunnel-item.priority-media,
#msk .m-next-action-signal.priority-media { --mfunnel-priority-color: rgba(255, 90, 0, .35); }
.mfunnel-item.priority-alta,
#msk .m-next-action-signal.priority-alta { --mfunnel-priority-color: rgba(255, 90, 0, .70); }
.mfunnel-item.priority-critico,
#msk .m-next-action-signal.priority-critico { --mfunnel-priority-color: #FF5A00; }

.mfunnel-item.mfunnel-item-prioritized {
  background: #000;
  border-color: rgba(0, 0, 0, .72);
  box-shadow: none;
  color: #fff;
}

.mfunnel-item.mfunnel-item-prioritized:hover {
  background: #222;
  border-color: #222;
}

.mfunnel-item.mfunnel-item-prioritized.mfunnel-category-accent::before { opacity: .58; }

.mfunnel-priority-menu {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .14);
  display: grid;
  gap: 2px;
  padding: 4px;
  position: fixed;
  z-index: 10010;
}

.mfunnel-priority-menu button {
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: var(--t1);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  padding: 7px 9px;
  text-align: left;
  white-space: nowrap;
}

.mfunnel-priority-menu button:hover,
.mfunnel-priority-menu button:focus-visible {
  background: var(--bg);
  outline: none;
}

.mfunnel-priority-menu-separator {
  background: var(--border);
  height: 1px;
  margin: 2px 4px;
}

.mfunnel-company {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}

.mfunnel-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  white-space: nowrap;
}

.mfunnel-meta span {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--t2);
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  padding: 2px 5px;
}

.mfunnel-meta .mfunnel-signal { 
  background: transparent;
  border: 0;
  color: var(--t2);
  display: inline-flex;
  padding: 0;
}
.mfunnel-item.mfunnel-item-prioritized .mfunnel-signal:not(.mfunnel-followup) { color: #fff; }
.mfunnel-meta .mfunnel-signal.mfunnel-followup { color: var(--mfunnel-priority-color); }

.mfunnel-signal-icon {
  height: 14px;
  width: 14px;
}

.mfunnel-empty {
  color: var(--t3);
  font-size: 11px;
  padding: 7px 0;
}

/* ============================================================
   10. CHARTS
   ============================================================ */
.cgrid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.ph {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 4px;
}

.ph-title {
  align-items: center;
  display: flex;
  font-size: 14px;
  font-weight: 600;
  gap: 8px;
  color: var(--t1);
}

.ph-title .view-title {
  color: var(--text-dark);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.ph-title .aflor-leaf-mark {
  display: block;
  width: 20px;
  height: 20px;
}

.ph-sub {
  font-size: 11px;
  color: var(--t3);
  margin-bottom: 14px;
}

.cw {
  position: relative;
  height: 185px;
}

/* ============================================================
   10. FILTERS
   ============================================================ */
.fbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}

.sbox {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--white);
  border: 1px solid var(--border2);
  border-radius: var(--rs);
  padding: 0 12px;
  flex: 1;
  min-width: 190px;
  max-width: 300px;
  box-shadow: var(--shadow);
  position: relative;
}

.sbox input {
  background: transparent;
  border: none;
  color: var(--t1);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  padding: 8px 0;
  outline: none;
  width: 100%;
}

.sbox input::placeholder {
  color: var(--t3);
}

.search-clear {
  display: none;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, .08);
  color: var(--t3);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.search-clear.is-visible {
  display: flex;
}

.search-clear:hover {
  background: rgba(15, 23, 42, .14);
  color: var(--t1);
}

.sbox:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 90, 0, .1);
}

select {
  background: var(--white);
  border: 1px solid var(--border2);
  border-radius: var(--rs);
  color: var(--t2);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  padding: 8px 28px 8px 11px;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  box-shadow: var(--shadow);
  transition: border-color .15s;
}

select:focus {
  border-color: var(--green);
  outline: none;
}

.fcnt {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--t3);
  margin-left: auto;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 4px 10px;
}

.fbar .qa-sheet {
  background: var(--white);
  border: 1px solid var(--border2);
  color: var(--t2);
  box-shadow: var(--shadow);
  padding: 7px 12px;
}

.fbar .qa-sheet:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--t1);
}

.view-context {
  color: var(--t3);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 400;
}

.qbar-right .qa-neutral {
  background: var(--white);
  border: 1px solid var(--border2);
  color: var(--navy);
  box-shadow: var(--shadow);
}

.qbar-right .qa-neutral:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--t1);
}

/* ============================================================
   11. TABLE
   ============================================================ */
.tpanel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.tpanel-hdr {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tpanel-ttl {
  font-size: 14px;
  font-weight: 600;
  color: var(--t1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tpanel-ttl span {
  font-size: 10px;
  color: var(--t3);
  font-weight: 400;
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.tpanel-sub {
  font-size: 11px;
  color: var(--t3);
}

.tscroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead tr {
  border-bottom: 1px solid var(--border);
}

th {
  padding: 10px 14px;
  text-align: left;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--navy);
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  background: var(--bg);
}

th:hover {
  color: var(--t2);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
  cursor: pointer;
}

tbody tr.is-closed {
  opacity: .65;
}

tbody tr.is-closed:hover {
  background: #FEE2E2;
}

tbody tr.is-fechado {
  background: #FFF5EF;
}

tbody tr.is-fechado:hover {
  background: #FFE5D6;
}

tbody tr.is-status-group-start td {
  border-top: 1px solid var(--border2);
}

tbody tr.is-reuniao {
  background: #F5F5F5;
}

tbody tr.is-reuniao:hover {
  background: #EBEBEB;
}

tbody tr:hover {
  background: #FAFAFA;
}

tbody tr:last-child {
  border-bottom: none;
}

td {
  padding: 10px 14px;
  font-size: 12px;
  vertical-align: middle;
}

.te {
  font-weight: 600;
  max-width: 170px;
  color: var(--t1);
}

.tcn {
  color: var(--t2);
  font-size: 11px;
  max-width: 130px;
}

.tsg {
  color: var(--t3);
  font-size: 10px;
  max-width: 150px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: .03em;
}

.cA { background: var(--rdim); color: var(--rtext); border: 1px solid #fca5a5; }
.cM { background: var(--odim); color: var(--otext); border: 1px solid #fed7aa; }
.cB { background: var(--bdim); color: var(--btext); border: 1px solid #C7C7CC; }
.cS { background: var(--bg); color: var(--t2); border: 1px solid var(--border); font-family: 'JetBrains Mono', monospace; font-size: 8px; letter-spacing: 0; }
.cF { background: var(--gdim); color: var(--gtext); border: 1px solid #FDBA74; }
.cW { background: var(--bg); color: var(--t3); border: 1px solid var(--border); }
.cLost { background: #FEE2E2; color: #991b1b; border: 1px solid #fecaca; }
.cFechado { background: #FFE5D6; color: #CC4A00; border: 1px solid #FDBA74; font-weight: 700; }
.cInativo { background: #F1F3F5; color: #5F6368; border: 1px solid #DADCE0; }
.cReuniao { background: #F0F0F0; color: #404045; border: 1px solid #C7C7CC; }
.cDiag { background: #FFE5D6; color: #CC4A00; border: 1px solid #FDBA74; font-weight: 700; }
.cDiagNo { background: var(--bg); color: var(--t3); border: 1px solid var(--border); }

.pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
}

.pH { color: var(--gtext); }
.pM { color: var(--otext); }
.pL { color: var(--t3); }

.fudt {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--t3);
}

.fudt.ov {
  color: var(--rtext);
  font-weight: 600;
}

.fudt.sn {
  color: var(--otext);
  font-weight: 600;
}

/* ============================================================
   12. MODAL
   ============================================================ */
.msk {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 45, .7);
  z-index: 10000;
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

.msk.open {
  display: flex;
}

.mbox {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 90%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  z-index: 10001;
  animation: mIn .2s ease;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .18);
}

@media (min-width: 801px) {
  #newMbox { max-width: 780px; }
}

/* ============================================================
   13. FLOW HELP
   ============================================================ */
.flow-help-modal {
  position: fixed;
  inset: 0;
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 30, 45, .7);
  padding: 24px;
}

.flow-help-modal[hidden] {
  display: none;
}

.flow-help-panel {
  position: relative;
  width: min(920px, calc(100vw - 40px));
  max-height: min(82vh, 760px);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: #C8CDD4 transparent;
  scrollbar-width: thin;
  background: var(--white);
  color: var(--t1);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(15, 30, 45, .35);
  padding: 28px 32px;
}

@media (min-width: 801px) {
  .flow-help-panel::-webkit-scrollbar { width: 6px; }

  .flow-help-panel::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 999px;
    margin: 14px 0;
  }

  .flow-help-panel::-webkit-scrollbar-thumb {
    background: #C8CDD4;
    border: 1px solid transparent;
    background-clip: padding-box;
    border-radius: 999px;
  }

  .flow-help-panel::-webkit-scrollbar-thumb:hover { background: #AEB5BE; }
}

.flow-help-panel::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.flow-help-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border2);
  border-radius: 7px;
  background: var(--white);
  color: var(--t2);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
}

.flow-help-close:hover,
.flow-help-close:focus-visible {
  background: var(--bg);
  border-color: var(--border2);
  color: var(--t1);
  outline: none;
}

.flow-help-head {
  padding-right: 34px;
  margin-bottom: 14px;
}

.flow-help-title {
  color: var(--accent);
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
}

.flow-help-head p,
.flow-help-section p,
.flow-help-section li,
.flow-help-section dd {
  color: var(--t2);
  font-size: 12px;
  line-height: 1.55;
}

.flow-help-section {
  border-top: 1px solid var(--border);
  padding: 14px 0;
}

.flow-help-section summary {
  color: var(--t1);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.flow-help-section-ai summary { color: var(--t1); }

.flow-help-section ol,
.flow-help-section ul {
  margin: 10px 0 0 18px;
  padding: 0;
}

.flow-help-section dl {
  display: grid;
  grid-template-columns: minmax(150px, .42fr) 1fr;
  gap: 8px 14px;
  margin: 12px 0 0;
}

.flow-help-section dt {
  color: var(--t1);
  font-size: 12px;
  font-weight: 800;
}

.flow-help-section dd {
  margin: 0;
}

@keyframes mIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(.97);
  }
}

.mhdr {
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 10;
}

.mclose {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--t3);
  border-radius: 7px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all .15s;
}

.mclose:hover {
  color: var(--t1);
  border-color: var(--border2);
  background: var(--border);
}

.m-headline {
  padding-right: 34px;
}

.m-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.m-emp {
  font-size: 19px;
  font-weight: 700;
  color: var(--t1);
  letter-spacing: -.3px;
}

.m-sub {
  color: var(--t3);
  font-size: 11px;
  margin-bottom: 9px;
}

.m-primary-chips,
.m-secondary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.m-access-chip {
  color: var(--btext);
  text-decoration: none;
}

.m-access-chip:hover {
  border-color: var(--blue);
  background: var(--bdim);
}

.m-action-chip {
  align-items: center;
  background: var(--green);
  border: none;
  box-shadow: 0 2px 8px rgba(255, 90, 0, .22);
  color: #fff;
  font-weight: 600;
  padding: 7px 13px;
}
.intelligence-selector .intelligence-lead-option,
.intelligence-selector .intelligence-execution-item,
.intelligence-workspace-panel .int-edit-observations,
.intelligence-workspace-panel .int-history-item,
.intelligence-workspace-panel .int-latest-execution,
.intelligence-workspace-panel .intelligence-execution-item,
.intelligence-workspace-panel .intelligence-toggle {
  cursor: pointer;
}
.intelligence-selector .intelligence-lead-option:disabled,
.intelligence-selector .intelligence-execution-item:disabled,
.intelligence-workspace-panel .int-history-item:disabled,
.intelligence-workspace-panel .int-latest-execution:disabled,
.intelligence-workspace-panel .int-edit-observations:disabled,
.intelligence-workspace-panel .intelligence-execution-item:disabled,
.intelligence-workspace-panel .intelligence-toggle:disabled {
  cursor: not-allowed;
}

.m-action-chip:hover {
  background: var(--green2);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(255, 90, 0, .35);
  color: #fff;
}

.mbody {
  padding: 18px 24px;
}

.msec {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--t3);
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.msec::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.msec-first {
  margin-top: 2px;
}

.msec-note {
  color: var(--gtext);
  font-size: 8px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.mgrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.mfield label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--t3);
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

.mfield p {
  font-size: 12px;
  color: var(--t1);
}
.intelligence-workspace-panel .mfield p {
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}
.intelligence-workspace-panel .m-title-row {
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.intelligence-workspace-panel .m-emp {
  color: var(--accent);
  flex: 0 0 auto;
}
.intelligence-workspace-panel .mgrid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.intelligence-workspace-panel .msec {
  color: var(--accent);
}
.intelligence-workspace-panel .int-summary-cards {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  min-width: 0;
}
.intelligence-workspace-panel .int-summary-card {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(255,255,255,.04);
  color: var(--t1);
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  line-height: 1;
}
.intelligence-workspace-panel .int-summary-card span {
  color: var(--t2);
  font-size: 10px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.intelligence-workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}

.intelligence-selector,
.intelligence-workspace-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-width: 0;
}

.intelligence-selector {
  padding: 12px;
}

.intelligence-selector-title {
  color: var(--t3);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.intelligence-lead-options,
.intelligence-executions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 8px;
}

.intelligence-lead-options {
  display: flex;
}

.intelligence-analysis-title { color: var(--accent); }

.intelligence-lead-option {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--t1);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 8px 9px;
  text-align: left;
  width: 100%;
}

.intelligence-lead-option:hover,
.intelligence-lead-option.is-selected {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.intelligence-lead-option strong {
  font-size: 11px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.intelligence-lead-option span,
.intelligence-lead-option small {
  color: var(--t3);
  font-size: 10px;
  overflow-wrap: anywhere;
}

.intelligence-lead-option small {
  color: var(--accent-active);
  font-weight: 700;
}

.intelligence-executions {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.intelligence-execution-item {
  align-self: flex-start;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: left;
  white-space: nowrap;
}

.intelligence-index-chart-block {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 12px;
}

.intelligence-index-chart-wrap {
  height: 186px;
  margin-top: 8px;
  position: relative;
}

.intelligence-index-chart-wrap canvas {
  max-width: 100%;
}

.intelligence-workspace-panel {
  min-height: 420px;
  padding: 14px;
}

.intelligence-workspace-panel.mbox {
  animation: none;
  box-shadow: none;
  max-height: none;
  max-width: none;
  overflow: visible;
  padding: 0;
  position: relative;
  width: auto;
  z-index: 0;
}

.intelligence-workspace-panel .mhdr {
  position: static;
}

.intelligence-workspace-panel .m-headline {
  padding-right: 0;
}

.intelligence-workspace-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-width: 0;
  padding: 2px 0 12px;
}

.intelligence-workspace-header .m-emp {
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.intelligence-workspace-header .m-sub {
  color: var(--t3);
  font-size: 11px;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.intelligence-workspace-header .int-summary-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.intelligence-workspace-header .int-summary-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  display: inline-flex;
  padding: 5px 9px;
  white-space: nowrap;
}

.intelligence-workspace-header .int-summary-card span {
  color: var(--t2);
  font-size: 10px;
  font-weight: 700;
}

.intelligence-workspace-content {
  min-width: 0;
}

.intelligence-workspace-empty {
  color: var(--t3);
  font-size: 12px;
  line-height: 1.5;
  padding: 24px 12px;
  text-align: center;
}

.intelligence-search-empty {
  padding: 14px 6px;
}
.intelligence-workspace-panel .intelligence-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-top: 14px;
  background: #fff;
  overflow-wrap: anywhere;
}
.intelligence-workspace-panel .intelligence-block-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.intelligence-workspace-panel .intelligence-block-header h3 {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 5px;
}
.intelligence-workspace-panel .intelligence-block-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  color: var(--t3);
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
}
.intelligence-workspace-panel .intelligence-block-meta span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 7px;
  background: var(--bg);
  max-width: 100%;
  overflow-wrap: anywhere;
}
.intelligence-workspace-panel .intelligence-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.intelligence-workspace-panel .intelligence-metric {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #FAFAFA;
  padding: 9px 10px;
  min-width: 0;
}
.intelligence-workspace-panel .intelligence-metric label,
.intelligence-workspace-panel .intelligence-analysis label {
  color: var(--t3);
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .07em;
  margin-bottom: 4px;
  text-transform: uppercase;
}
.intelligence-workspace-panel .intelligence-metric strong {
  color: var(--t1);
  display: block;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.intelligence-workspace-panel .intelligence-analysis {
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 12px;
}
.intelligence-workspace-panel .intelligence-analysis p {
  color: var(--t1);
  font-size: 12px;
  line-height: 1.6;
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.intelligence-workspace-panel .intelligence-analysis p.intelligence-analysis-actions {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-top: 16px;
}
.intelligence-workspace-panel .intelligence-summary-grid-esg {
  margin-top: 8px;
}
.intelligence-workspace-panel .intelligence-toggle {
  background: var(--white);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--t2);
  cursor: pointer;
  flex: 0 0 auto;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 7px 10px;
  white-space: nowrap;
}
.intelligence-workspace-panel .intelligence-toggle:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-active);
}
.intelligence-workspace-panel .intelligence-details {
  margin-top: 14px;
}
.intelligence-workspace-panel .intelligence-details[hidden] {
  display: none;
}


#msk .msec,
#msk .mfield-obs label {
  color: var(--accent);
}

.field-note {
  color: var(--t3);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.field-note-strong {
  color: var(--gtext);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.mfield-dor {
  margin-bottom: 10px;
}

.mfield-obs {
  margin-bottom: 16px;
}

.efield,
.etarea {
  background: var(--white);
  border: 1px solid var(--border2);
  border-radius: var(--rs);
  padding: 8px 11px;
  font-size: 12px;
  color: var(--t1);
  font-family: 'Inter', sans-serif;
  width: 100%;
  outline: none;
  transition: all .15s;
}

.efield:focus,
.etarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 90, 0, .1);
}

.efield.esel {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

.etarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
}

.edit-note {
  font-size: 10px;
  color: var(--t3);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--gdim);
  padding: 7px 11px;
  border-radius: 7px;
  border: 1px solid #FDBA74;
}

.edit-note em {
  color: var(--gtext);
  font-style: normal;
  font-weight: 600;
}

#_reuniaoNote {
  display: none;
}

.save-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 24px;
  border-top: 1px solid var(--border);
  background: var(--white);
  position: sticky;
  bottom: 0;
  gap: 10px;
}

.btn-save {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  background: var(--green);
  border: none;
  color: #fff;
  border-radius: var(--rs);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all .18s;
  box-shadow: 0 2px 8px rgba(255, 90, 0, .22);
}

.btn-save:hover {
  background: var(--green2);
  box-shadow: 0 4px 12px rgba(255, 90, 0, .35);
}

.btn-save:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.save-status {
  font-size: 11px;
  color: var(--t3);
  font-family: 'JetBrains Mono', monospace;
}

.save-status.ok { color: var(--gtext); }
.save-status.err { color: var(--rtext); }

.import-mbox {
  width: min(calc(100vw - 48px), 1140px);
  max-width: 1140px;
}

.import-paste {
  box-sizing: border-box;
  min-height: 210px;
  width: 100%;
  font-family: 'JetBrains Mono', monospace;
  white-space: pre;
}

.import-results {
  margin-top: 18px;
}

.import-results-scroll {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.import-results table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.import-results th,
.import-results td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.import-results th {
  position: sticky;
  top: 0;
  background: var(--bg);
  color: var(--t2);
}

.import-result-importado { color: var(--gtext); font-weight: 700; }
.import-result-ignorado { color: var(--t2); font-weight: 700; }
.import-result-erro { color: var(--rtext); font-weight: 700; }

.import-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#msk .mbox {
  background: #FFFFFF;
  border: 1px solid rgba(20, 24, 32, .06);
  border-radius: 23px;
  box-shadow: 0 24px 60px rgba(10, 18, 28, .22);
  overflow-x: hidden;
  scrollbar-color: #C8CDD4 transparent;
  scrollbar-width: thin;
  width: min(calc(100vw - 48px), 1140px);
  max-width: 1140px;
}

@media (min-width: 801px) {
  #msk .mbox::-webkit-scrollbar { width: 6px; }

  #msk .mbox::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 999px;
    margin: 14px 0;
  }

  #msk .mbox::-webkit-scrollbar-thumb {
    background: #C8CDD4;
    border: 1px solid transparent;
    background-clip: padding-box;
    border-radius: 999px;
  }

  #msk .mbox::-webkit-scrollbar-thumb:hover { background: #AEB5BE; }
}

#msk .mbox::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

#msk .mhdr {
  background: #FFFFFF;
  border-bottom: 1px solid #E5E7EA;
  padding: 18px 28px 16px;
}

#msk .m-headline { padding-right: 32px; }

#msk .m-emp {
  color: #17191D;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.25;
}

#msk .m-sub {
  color: #8A8E96;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  margin: 3px 0 10px;
}

#msk .m-secondary-chips { align-items: center; flex-wrap: wrap; gap: 6px; }
#msk .m-quick-group {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#msk .m-quick-signal {
  align-items: center;
  background: transparent;
  border: 1px solid var(--navy2);
  border-radius: 6px;
  color: var(--t2);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 32px;
  height: 32px;
  justify-content: center;
  padding: 0;
}

#msk .m-quick-signal:hover,
#msk .m-quick-signal:focus-visible { color: var(--accent); outline: none; }
#msk .m-next-action-signal { color: var(--mfunnel-priority-color); }
#msk .m-next-action-signal:hover,
#msk .m-next-action-signal:focus-visible { color: var(--mfunnel-priority-color); }

#msk .m-quick-divider {
  align-self: center;
  background: rgba(23, 25, 29, .18);
  display: block;
  height: 18px;
  margin: 0 12px;
  width: 1px;
}
#msk .m-flow-ia,
.intelligence-workspace-panel .m-flow-ia {
  align-items: center;
  background: #000;
  border: 1px solid rgba(0, 0, 0, .72);
  box-shadow: none;
  color: #fff;
  display: inline-flex;
  gap: 6px;
}
#msk .m-flow-ia:hover,
#msk .m-flow-ia:focus-visible,
.intelligence-workspace-panel .m-flow-ia:hover,
.intelligence-workspace-panel .m-flow-ia:focus-visible {
  background: #222;
  border-color: #222;
  box-shadow: none;
  color: #fff;
}

.flow-ia-spark {
  flex: 0 0 14px;
  height: 14px;
  width: 14px;
}
.intelligence-inline-header .m-flow-ia {
  font-size: 13px;
  min-height: 30px;
  padding: 7px 11px;
}
.intelligence-inline-header .m-flow-ia .flow-ia-spark {
  flex-basis: 15px;
  height: 15px;
  width: 15px;
}
#msk .m-quick-group-primary .m-access-chip,
#msk .m-quick-group-secondary .m-access-chip {
  background: #34373D;
  border: 1px solid #34373D;
  box-shadow: none;
  color: #fff;
}
#msk .m-quick-group-primary .m-access-chip:hover,
#msk .m-quick-group-primary .m-access-chip:focus-visible,
#msk .m-quick-group-secondary .m-access-chip:hover,
#msk .m-quick-group-secondary .m-access-chip:focus-visible {
  background: #454A52;
  border-color: #454A52;
  box-shadow: none;
  color: #fff;
}

.intelligence-inline-header .m-title-row {
  flex-wrap: nowrap;
  justify-content: space-between;
}

.intelligence-inline-header .int-summary-cards {
  flex: 0 0 auto;
  margin-left: auto;
}

#msk .chip,
.import-mbox .chip {
  text-decoration: none;
  align-items: center;
  border-radius: 18px;
  font-size: 12px;
  font-weight: 600;
  min-height: 32px;
  padding: 0 11px;
}


#msk .m-action-chip {
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(255, 90, 0, .18);
  padding: 0 12px;
}

#msk .m-action-chip:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 10px rgba(255, 90, 0, .22);
}

#msk [data-open-aflow-ia],
.intelligence-workspace-panel .aflow-ia-diagnostics-global {
  background: #000;
  border-color: #000;
  box-shadow: none;
  color: #fff;
  cursor: pointer;
}

#msk [data-open-aflow-ia]:hover,
#msk [data-open-aflow-ia]:focus-visible,
.intelligence-workspace-panel .aflow-ia-diagnostics-global:hover,
.intelligence-workspace-panel .aflow-ia-diagnostics-global:focus-visible {
  background: #222;
  border-color: #222;
  box-shadow: none;
  color: #fff;
}

#msk .m-intel-chip {
  background: #F5F6F7;
  border: 1px solid #E1E4E8;
  box-shadow: none;
  color: #3B3E44;
  cursor: pointer;
  font: inherit;
}

#msk #eStatus { border-color: var(--accent); }
#msk #eUltima { border-color: var(--accent); }

#msk .mbody {
  background: #FAFAFB;
  padding: 18px 28px;
}

#msk .msec {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  margin-bottom: 11px;
  gap: 10px;
}

#msk .msec::after { background: #E2E5E9; }
#msk .msec-business::after { display: block; order: 1; }
#msk .msec-business #businessSelectorField { display: inline-flex; flex: 0 0 auto; margin-left: 0; order: 0; }
#msk .msec-business .msec-note { margin-left: auto; order: 2; }
#msk .msec-business .business-selector { color: var(--accent); height: 34px; min-width: 280px; padding-block: 0; width: 320px; }
#msk .msec-business .business-selector option { color: var(--text-dark); }
#msk .msec-business .business-selector.is-placeholder { color: var(--accent); }
#msk .msec-business .business-selector-state { color: var(--accent); font-size: 12px; line-height: 34px; min-width: 0; width: auto; }
#msk .msec-business .business-selector-state.is-empty { color: var(--accent); }

#msk .edit-identity-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--t2);
  cursor: pointer;
  display: flex;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  gap: 6px;
  margin: 0 0 12px;
  padding: 0;
}

#msk .edit-identity-toggle svg {
  height: 14px;
  transition: transform .15s ease;
  width: 14px;
}

#msk .edit-identity-toggle.is-open svg { transform: rotate(180deg); }

#msk .mgrid-edit-identification { grid-template-columns: repeat(3, minmax(0, 1fr)); }

#msk .mgrid-business { align-items: start; }

#msk .business-profile-card {
  background: #F5F6F7;
  border: 1px solid #E1E4E8;
  border-radius: 8px;
  padding: 12px;
}

#msk .business-profile-fields {
  display: grid;
  gap: 10px;
}

#msk .business-type-field {
  border: 0;
  margin: 0;
  min-width: 0;
  padding: 0;
}

#msk .business-type-field legend {
  color: #8A8E96;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
  line-height: 1.2;
  margin-bottom: 6px;
  text-transform: uppercase;
}

#msk .business-type-options {
  align-items: center;
  background: #FFFFFF;
  border: 1.5px solid #D5D8DE;
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-height: 42px;
  padding: 8px 12px;
}

#msk .business-type-options label {
  align-items: center;
  color: #303238;
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 600;
  gap: 5px;
  letter-spacing: 0;
  margin: 0;
  text-transform: none;
}

#msk .business-type-options input { accent-color: var(--accent); }

#msk .mgrid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

#msk .mgrid > .mfield { min-width: 0; }

#msk .mfield label {
  color: #8A8E96;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
  line-height: 1.2;
  margin-bottom: 6px;
}

#msk .efield,
#msk .etarea {
  background: #FFFFFF;
  border: 1.5px solid #D5D8DE;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .03);
  color: #303238;
  font-size: 13px;
  font-weight: 600;
  padding: 0 12px;
}

#msk .efield { height: 42px; }

#msk .efield:focus,
#msk .etarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 90, 0, .10);
}

#msk .efield.esel {
  background-position: right 12px center;
  padding-right: 34px;
}

#msk .business-product-dropdown { position: relative; }
#msk .business-product-trigger { cursor: pointer; text-align: left; width: 100%; }
#msk .business-product-trigger:disabled { cursor: not-allowed; opacity: .62; }
#msk .business-product-menu {
  background: #FFFFFF;
  border: 1.5px solid #D5D8DE;
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(0,0,0,.12);
  display: none;
  left: 0;
  max-height: 180px;
  overflow-y: auto;
  padding: 5px;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 3;
}
#msk .business-product-dropdown.is-open .business-product-menu { display: grid; gap: 2px; }
#msk .business-product-menu label { align-items: center; border-radius: 5px; color: #303238; cursor: pointer; display: flex; font-size: 12px; font-weight: 600; gap: 7px; letter-spacing: 0; margin: 0; padding: 7px; text-transform: none; }
#msk .business-product-menu label:hover { background: #F1F3F5; }
#msk .mgrid-business .efield:disabled,
#msk .mfield-obs .etarea:disabled { background: #F1F3F5; color: #8A8E96; cursor: not-allowed; }

#msk .etarea {
  font-size: 13px;
  line-height: 20px;
  min-height: 76px;
  padding: 10px 12px;
}

#msk .etarea.has-content { min-height: 152px; }

#msk .mfield-obs { margin-bottom: 18px; }

#msk .save-bar,
#newMsk .save-bar {
  background: #FFFFFF;
  border-top: 1px solid #E5E7EA;
  padding: 14px 28px;
}

#msk .save-meta,
#newMsk .save-meta { min-width: 0; }

#msk .save-context,
#newMsk .save-context {
  color: #777C84;
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap;
}

#msk .save-context strong,
#newMsk .save-context strong {
  color: #3B3E44;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
#msk .save-context strong { color: var(--accent); }
#newMsk .save-context strong { color: var(--accent); }

#msk .btn-save,
#newMsk .btn-save {
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(255, 90, 0, .22);
  font-size: 12px;
  min-height: 42px;
  padding: 0 24px;
}

#msk .btn-save:hover,
#newMsk .btn-save:hover { box-shadow: 0 5px 12px rgba(255, 90, 0, .24); }

.mlinks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.mlink {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--white);
  border: 1px solid var(--border2);
  color: var(--btext);
  border-radius: 6px;
  padding: 5px 11px;
  font-size: 10px;
  text-decoration: none;
  transition: all .15s;
  font-weight: 600;
  box-shadow: var(--shadow);
}

.mlink:hover {
  border-color: var(--blue);
  background: var(--bdim);
}

/* ============================================================
   13. FOOTER
   ============================================================ */
.footer {
  border-top: 1px solid var(--border);
  padding: 12px 28px;
  font-size: 10px;
  color: var(--t3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--white);
  text-align: center;
}

.footer-contact {
  display: flex;
  align-items: center;
  gap: 14px;
}

.footer a {
  color: inherit;
  text-decoration: none;
}

.footer a:hover {
  color: var(--t1);
}

/* ============================================================
   14. UTILITIES
   ============================================================ */
.empt {
  text-align: center;
  padding: 40px;
  color: var(--t3);
}

.empt span {
  font-size: 26px;
  display: block;
  margin-bottom: 6px;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--t3);
}

/* ============================================================
   15. RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
  .krow { grid-template-columns: repeat(2, 1fr); }
  .mfunnel-grid { grid-template-columns: repeat(2, 1fr); }
  .cgrid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 800px) {
  #msk .msec-business {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }
  #msk .msec-business .msec-note { align-self: flex-start; order: 2; }
  #msk .msec-business #businessSelectorField { order: 1; width: 100%; }
  #msk .msec-business .business-selector,
  #msk .msec-business .business-selector-state { min-width: 0; width: 100%; }
  #msk .msec-business::after { flex: 0 0 1px; order: 3; width: 100%; }

  #msk .m-secondary-chips { flex-wrap: wrap; }
  #msk .m-quick-divider { display: none; }
  #msk .m-quick-group-primary,
  #msk .m-quick-group-secondary { flex-wrap: nowrap; gap: 5px; width: 100%; }
  #msk .m-quick-group-primary { order: 1; }
  #msk .m-quick-group-secondary { order: 2; }
  #msk .m-quick-group-primary .m-action-chip,
  #msk .m-quick-group-secondary .m-action-chip { flex: 0 0 auto; padding-inline: 8px; white-space: nowrap; }
  #cadMsk .mgrid[data-cadencia-status] { grid-template-columns: 90px minmax(0, 1fr); }
  .intelligence-inline-header .m-title-row { flex-wrap: wrap; }
  .intelligence-inline-header .int-summary-cards { margin-left: 0; }
  .krow { grid-template-columns: 1fr 1fr; }
  .cgrid { grid-template-columns: 1fr; }
  .mgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #msk .msec + .mgrid { grid-template-columns: 1fr; }
  #msk .mgrid-business,
  #msk .mgrid-edit-identification { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .intelligence-workspace { grid-template-columns: minmax(0, 1fr); }
  .intelligence-selector,
  .intelligence-workspace-panel,
  .intelligence-index-chart-block,
  .intelligence-index-chart-wrap { width: 100%; min-width: 0; }
  .intelligence-workspace-panel,
  .intelligence-workspace-panel * { max-width: 100%; }
  .content { padding: 14px; }
  .view-context { display: none; }
}

@media (max-width: 580px) {
  .topbar,
  .qbar {
    padding: 0 14px;
  }

  .mfunnel-grid { grid-template-columns: 1fr; }
  .mgrid { grid-template-columns: 1fr; }
  #msk .mgrid-business,
  #msk .mgrid-edit-identification { grid-template-columns: 1fr; }

  .flow-help-modal {
    align-items: flex-start;
    padding: 14px;
  }

  .flow-help-panel {
    max-height: calc(100vh - 28px);
    padding: 20px;
  }

  .flow-help-section dl {
    grid-template-columns: 1fr;
    gap: 4px;
  }

}

@media (max-width: 800px) and (orientation: portrait) {
  .intelligence-workspace-panel .intelligence-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .intelligence-workspace-panel .intelligence-metric {
    min-width: 0;
    overflow-wrap: break-word;
    word-break: normal;
  }

  #msk .mbox,
  .import-mbox {
    box-sizing: border-box;
    width: calc(100vw - 28px);
    max-width: calc(100vw - 28px);
    min-width: 0;
  }

  #msk .mbody,
  #msk .save-bar,
  #msk .save-meta,
  #msk .mfield,
  #msk .mfield-obs {
    min-width: 0;
    max-width: 100%;
  }

  #msk .efield,
  #msk .etarea {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  #msk .save-bar {
    align-items: stretch;
    flex-direction: column;
  }

  #msk .save-context {
    white-space: normal;
    overflow-wrap: break-word;
  }

  #msk .btn-save {
    align-self: stretch;
    justify-content: center;
    min-height: 42px;
    width: 100%;
  }
}

/* ============================================================
   16. SIDEBAR DESKTOP LARGO
   ============================================================ */
.qbar-toggle { display: none; }
.qbar-divider { display: none; }
.qbar-period-icon { display: none; }

@media (min-width: 1201px) {
  .topbar {
    display: grid;
    grid-template-columns: 200px minmax(320px, 1fr) auto auto;
    gap: 12px;
    justify-content: initial;
    padding: 0 10px;
  }
  .topbar-search {
    background: var(--white);
    border-color: var(--border2);
    box-shadow: var(--shadow);
    width: 100%;
  }
  .topbar-search input { color: var(--t1); }
  .topbar-search input::placeholder { color: var(--t3); }
  .topbar-search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 90, 0, .1);
  }
  .qbar {
    position: fixed;
    top: 64px;
    bottom: 0;
    left: 0;
    width: 200px;
    padding: 10px;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: hidden;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, .06);
    border-bottom: 0;
  }

  .qbar-toggle {
    position: fixed;
    top: 50%;
    left: 192px;
    z-index: 300;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 34px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 6px;
    background: var(--navy3);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 18px;
    line-height: 1;
    opacity: .82;
    transform: translateY(-50%);
    transition: left .18s ease, opacity .18s ease;
  }

  .qbar-toggle:hover,
  .qbar-toggle:focus-visible { opacity: 1; outline: none; }

  .qbar-left,
  .qbar-right,
  .view-switch {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .qbar > .qbar-left > .view-switch { margin-top: 10px; }

  .qbar-left,
  .qbar-right { gap: 6px; }
  .qbar-divider {
    display: block;
    height: 1px;
    margin: 4px 0;
    background: rgba(255, 255, 255, .10);
  }
  .qbar-footer-divider { order: 2; margin-top: auto; }
  .qbar .ktools {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .qbar-period {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 0 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--rs);
    color: rgba(255, 255, 255, .86);
  }
  .qbar-filter {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: var(--rs);
    color: rgba(255, 255, 255, .86);
  }
  .qbar-period-icon { display: block; width: 16px; height: 16px; flex: 0 0 16px; }
  .qbar .ktools select,
  .qbar .qa { width: 100%; }
  .qbar .view-tab,
  .qbar .qa {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid transparent;
    background: transparent;
    color: rgba(255, 255, 255, .86);
    white-space: nowrap;
  }
  .qbar .view-tab { box-shadow: none; }
  .qbar-right .qa-neutral {
    background: transparent;
    border-color: transparent;
    color: rgba(255, 255, 255, .86);
    box-shadow: none;
  }
  .qbar .qa-form { box-shadow: none; }
  .qbar .ktools select {
    flex: 1;
    min-height: 40px;
    padding: 0 28px 0 0;
    background-color: transparent;
    border-color: transparent;
    color: rgba(255, 255, 255, .86);
    box-shadow: none;
    text-align: left;
    white-space: nowrap;
  }
  .qbar .view-tab:hover,
  .qbar .view-tab:focus-visible,
  .qbar .qa:hover,
  .qbar .qa:focus-visible,
  .qbar .ktools select:hover,
  .qbar .ktools select:focus {
    background-color: transparent;
    border-color: rgba(255, 255, 255, .45);
    color: #fff;
    outline: none;
  }
  .qbar-period:hover,
  .qbar-period:focus-within { border-color: rgba(255, 255, 255, .45); }
  .qbar-period select,
  .qbar-period select:hover,
  .qbar-period select:focus {
    width: 100%;
    min-width: 0;
    border-color: transparent;
    color: #fff;
  }
  .qbar-filter select,
  .qbar-filter select:hover,
  .qbar-filter select:focus {
    width: 100%;
    min-width: 0;
    flex: 1;
    border-color: transparent;
    color: #fff;
  }
  .qbar-period select,
  .qbar-period select:hover,
  .qbar-period select:focus,
  .qbar-filter select,
  .qbar-filter select:hover,
  .qbar-filter select:focus {
    border: 0;
    outline: 0;
    box-shadow: none;
    background-color: transparent;
  }
  .qbar-period select option { background: #fff; color: var(--navy); }
  .qbar-filter select option { background: #fff; color: var(--navy); }
  .qbar .view-tab.is-active,
  .qbar .view-tab.is-active:hover,
  .qbar .view-tab.is-active:focus-visible {
    background: #fff;
    border-color: #fff;
    color: var(--navy);
    box-shadow: none;
  }
  .qbar-item-icon { width: 16px; height: 16px; flex: 0 0 16px; }
  .qbar-filter:hover,
  .qbar-filter:focus-within { border-color: rgba(255, 255, 255, .45); }
  .qbar-right .qa-form { order: 1; }
  .qbar-right .qa-sheet { order: 2; }

  .content { margin-left: 200px; }

  body.qbar-is-collapsed .qbar {
    width: 48px;
    align-items: stretch;
    padding: 10px;
  }
  body.qbar-is-collapsed .qbar-left,
  body.qbar-is-collapsed .qbar-right,
  body.qbar-is-collapsed .view-switch {
    display: flex;
    width: 100%;
    align-items: stretch;
  }
  body.qbar-is-collapsed .qbar .view-tab,
  body.qbar-is-collapsed .qbar .qa {
    justify-content: center;
    gap: 0;
    padding: 0;
    font-size: 0;
  }
  body.qbar-is-collapsed .qbar-period,
  body.qbar-is-collapsed .qbar-filter {
    position: relative;
    justify-content: center;
    gap: 0;
    padding: 0;
  }
  body.qbar-is-collapsed .qbar .ktools select {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    min-height: 100%;
    padding: 0;
    opacity: 0;
    cursor: pointer;
  }
  body.qbar-is-collapsed .qbar-divider { width: 100%; }
  body.qbar-is-collapsed .qbar-toggle { left: 40px; }
  body.qbar-is-collapsed .qbar-toggle span { display: block; transform: rotate(180deg); }
  body.qbar-is-collapsed .content { margin-left: 48px; }
}

/* ============================================================
   17. MOBILE | TOPBAR E SIDEBAR RECOLHIDA
   ============================================================ */
@media (max-width: 800px) {
  .topbar {
    gap: 8px;
    justify-content: initial;
  }

  .brand { flex: 0 0 auto; }
  .brand-signature .brand-logo { width: 56px; }

  .topbar-search.sbox {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
  }

  .topbar-actions { flex: 0 0 auto; gap: 4px; }

  .topbar-action {
    width: 32px;
    min-width: 32px;
    height: 32px;
    justify-content: center;
    padding: 0;
    font-size: 0;
  }

  .topbar-action svg { width: 14px; height: 14px; }
  .topbar-action.aflow-auth-logout span { display: none; }
  .aflor-wordmark { display: none; }

  .krow.view-commercial .k-val,
  .krow.view-operational .kcard:not(.kcard-chart) .k-val,
  .intelligence-kpis .k-val { font-size: 22px; }

  .intelligence-workspace,
  .intelligence-workspace-panel.mbox {
    min-width: 0;
    max-width: 100%;
  }

  .intelligence-workspace-content {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  .intelligence-workspace-content > * {
    min-width: 560px;
    max-width: none;
  }

  #newMsk .mbox {
    box-sizing: border-box;
    width: calc(100vw - 28px);
    max-width: calc(100vw - 28px);
    min-width: 0;
    max-height: calc(100vh - 28px);
    overflow-x: hidden;
  }

  #newMsk .mbody,
  #newMsk .save-bar,
  #newMsk .save-meta,
  #newMsk .mfield {
    min-width: 0;
    max-width: 100%;
  }

  #newMsk .save-bar {
    align-items: stretch;
    flex-direction: column;
  }

  #newMsk .save-context {
    white-space: normal;
    overflow-wrap: break-word;
  }

  #newMsk .btn-save {
    align-self: stretch;
    justify-content: center;
    min-height: 42px;
    width: 100%;
  }
}

.multiselect-filter { position: relative; }

.multiselect-trigger {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.multiselect-trigger span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multiselect-trigger b { font-size: 13px; font-weight: 600; }

.qbar-filter.is-context-disabled,
.qbar-filter.is-context-disabled:hover,
.qbar-filter.is-context-disabled:focus-within { border-color: transparent; cursor: default; }
.qbar-filter.is-context-disabled .multiselect-trigger { cursor: default; pointer-events: none; }
.qbar-filter.is-context-disabled .multiselect-trigger b { display: none; }

.multiselect-menu {
  position: fixed;
  z-index: 10003;
  width: 220px;
  padding: 6px;
  border: 1px solid var(--border2);
  border-radius: var(--rs);
  background: var(--white);
  box-shadow: var(--shadow-md);
}

.multiselect-menu label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  color: var(--t1);
  font-size: 12px;
  cursor: pointer;
}

.multiselect-menu label:hover { background: var(--bg); }
.multiselect-menu input { accent-color: var(--accent); }

@media (min-width: 1201px) {
  .qbar .multiselect-trigger { min-height: 40px; color: rgba(255, 255, 255, .86); }
}

@media (min-width: 1201px) {
  body.qbar-is-collapsed .qbar .multiselect-trigger {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    opacity: 0;
  }
}

/* ============================================================
   18. SIDEBAR COMPACTA | ATÉ 1200PX
   ============================================================ */
@media (max-width: 1200px) {
  .qbar {
    position: fixed;
    top: 64px;
    right: auto;
    bottom: 0;
    left: 0;
    z-index: 199;
    width: 48px;
    padding: 10px;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: hidden;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, .06);
    border-bottom: 0;
    transition: width .18s ease;
  }

  .qbar-toggle {
    position: fixed;
    top: 50%;
    left: 40px;
    z-index: 300;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 34px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 6px;
    background: var(--navy3);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 18px;
    line-height: 1;
    opacity: .82;
    transform: translateY(-50%);
    transition: left .18s ease, opacity .18s ease;
  }

  .qbar-toggle:hover,
  .qbar-toggle:focus-visible { opacity: 1; outline: none; }

  .qbar-left,
  .qbar-right,
  .view-switch {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .qbar-left,
  .qbar-right { gap: 6px; }
  .qbar-divider { display: block; width: 100%; height: 1px; margin: 4px 0; background: rgba(255, 255, 255, .10); }
  .qbar-footer-divider { order: 2; margin-top: auto; }
  .qbar .ktools { width: 100%; flex-direction: column; align-items: stretch; gap: 6px; }
  .qbar-period,
  .qbar-filter { position: relative; display: flex; align-items: center; width: 100%; min-height: 40px; border: 1px solid transparent; border-radius: var(--rs); color: rgba(255, 255, 255, .86); }
  .qbar-period-icon { display: block; width: 16px; height: 16px; flex: 0 0 16px; }
  .qbar .ktools select,
  .qbar .qa { width: 100%; }
  .qbar-item-icon { width: 16px; height: 16px; flex: 0 0 16px; }
  .qbar .view-tab { box-shadow: none; }
  .qbar-right .qa-neutral { background: transparent; border-color: transparent; color: rgba(255, 255, 255, .86); box-shadow: none; }
  .qbar .qa-form { box-shadow: none; }
  .qbar .view-tab.is-active,
  .qbar .view-tab.is-active:hover,
  .qbar .view-tab.is-active:focus-visible { background: #fff; border-color: #fff; color: var(--navy); box-shadow: none; }
  .qbar-right .qa-form { order: 1; }
  .qbar-right .qa-sheet { order: 2; }

  .content {
    width: calc(100% - 48px);
    max-width: calc(100% - 48px);
    margin-left: 48px;
    margin-right: 0;
  }

  body.qbar-is-collapsed .qbar .view-tab,
  body.qbar-is-collapsed .qbar .qa {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    min-height: 40px;
    padding: 0;
    border: 1px solid transparent;
    background: transparent;
    color: rgba(255, 255, 255, .86);
    font-size: 0;
  }

  body.qbar-is-collapsed .qbar-period,
  body.qbar-is-collapsed .qbar-filter { justify-content: center; gap: 0; padding: 0; background: transparent; }
  body.qbar-is-collapsed .qbar .ktools select,
  body.qbar-is-collapsed .qbar .multiselect-trigger { position: absolute; inset: 0; z-index: 1; width: 100%; min-height: 100%; padding: 0; border: 0; outline: 0; opacity: 0; cursor: pointer; }
  body.qbar-is-collapsed .qbar-divider { width: 100%; }
  body.qbar-is-collapsed .qbar-toggle span { display: block; transform: rotate(180deg); }
  body.qbar-is-collapsed .qbar .view-tab:hover,
  body.qbar-is-collapsed .qbar .view-tab:focus-visible,
  body.qbar-is-collapsed .qbar .qa:hover,
  body.qbar-is-collapsed .qbar .qa:focus-visible,
  body.qbar-is-collapsed .qbar-period:hover,
  body.qbar-is-collapsed .qbar-period:focus-within,
  body.qbar-is-collapsed .qbar-filter:hover,
  body.qbar-is-collapsed .qbar-filter:focus-within { border-color: rgba(255, 255, 255, .45); color: #fff; outline: none; }
  body.qbar-is-collapsed .qbar-filter.is-context-disabled:hover,
  body.qbar-is-collapsed .qbar-filter.is-context-disabled:focus-within { border-color: transparent; color: rgba(255, 255, 255, .86); }

  body.qbar-is-collapsed .qbar .view-tab.is-active,
  body.qbar-is-collapsed .qbar .view-tab.is-active:hover,
  body.qbar-is-collapsed .qbar .view-tab.is-active:focus-visible,
  body:not(.qbar-is-collapsed) .qbar .view-tab.is-active,
  body:not(.qbar-is-collapsed) .qbar .view-tab.is-active:hover,
  body:not(.qbar-is-collapsed) .qbar .view-tab.is-active:focus-visible { background: #fff; border-color: #fff; color: var(--navy); box-shadow: none; }

  body:not(.qbar-is-collapsed) .qbar { width: 200px; z-index: 299; }
  body:not(.qbar-is-collapsed) .qbar-toggle { left: 192px; }
  body:not(.qbar-is-collapsed) .qbar-period,
  body:not(.qbar-is-collapsed) .qbar-filter { display: flex; align-items: center; gap: 10px; padding: 0 10px; }
  body:not(.qbar-is-collapsed) .qbar .view-tab,
  body:not(.qbar-is-collapsed) .qbar .qa { display: flex; align-items: center; justify-content: flex-start; gap: 10px; min-height: 40px; padding: 0 10px; border: 1px solid transparent; background: transparent; color: rgba(255, 255, 255, .86); font-size: 12px; white-space: nowrap; }
  body:not(.qbar-is-collapsed) .qbar .ktools select { position: static; flex: 1; min-height: 40px; padding: 0 28px 0 0; border: 0; outline: 0; background-color: transparent; color: rgba(255, 255, 255, .86); box-shadow: none; text-align: left; white-space: nowrap; opacity: 1; }
  body:not(.qbar-is-collapsed) .qbar .multiselect-trigger { position: static; inset: auto; z-index: auto; width: auto; min-height: 0; opacity: 1; }
  body:not(.qbar-is-collapsed) .qbar-period:hover,
  body:not(.qbar-is-collapsed) .qbar-period:focus-within,
  body:not(.qbar-is-collapsed) .qbar-filter:hover,
  body:not(.qbar-is-collapsed) .qbar-filter:focus-within { border-color: rgba(255, 255, 255, .45); }
  body:not(.qbar-is-collapsed) .qbar .view-tab:hover,
  body:not(.qbar-is-collapsed) .qbar .view-tab:focus-visible,
  body:not(.qbar-is-collapsed) .qbar .qa:hover,
  body:not(.qbar-is-collapsed) .qbar .qa:focus-visible { border-color: rgba(255, 255, 255, .45); color: #fff; outline: none; }
  body:not(.qbar-is-collapsed) .qbar-period select option,
  body:not(.qbar-is-collapsed) .qbar-filter select option { background: #fff; color: var(--navy); }
}
/* IA Flow integrated chat */
#aflowIaReadyModal #aflowIaNativeChat[hidden],
#aflowIaReadyModal #aflowIaDisabledNotice[hidden] {
  display: none !important;
}

#aflowIaReadyModal.is-disabled #aflowIaNativeChat {
  display: none !important;
}

#aflowIaReadyModal.is-disabled #aflowIaDisabledNotice {
  display: block;
}

#aflowIaReadyModal.is-disabled #aflowIaChatExpand {
  display: none !important;
}

#aflowIaReadyModal #aflowIaDisabledCta {
  text-decoration: none;
}

#aflowIaReadyModal .flow-help-panel {
  width: min(38vw, 620px);
  max-width: 620px;
  padding: 16px 20px;
}

#aflowIaReadyModal.is-native-chat .flow-help-panel {
  display: flex;
  flex-direction: column;
  height: min(calc(100vh - 48px), 760px);
  max-height: min(calc(100vh - 48px), 760px);
  max-width: 1140px;
  overflow: hidden;
  padding: 0;
  width: min(calc(100vw - 48px), 1140px);
}

#aflowIaReadyModal.is-native-chat.is-expanded {
  padding: 12px;
}

#aflowIaReadyModal.is-native-chat.is-expanded .flow-help-panel {
  height: calc(100vh - 24px);
  max-height: calc(100vh - 24px);
  max-width: calc(100vw - 24px);
  width: calc(100vw - 24px);
}

#aflowIaReadyModal .flow-help-head {
  margin-bottom: 8px;
}

#aflowIaReadyModal .flow-help-head p {
  margin: 4px 0 0;
}

#aflowIaReadyModal .aflow-ia-chat-title {
  align-items: center;
  display: flex;
  gap: 8px;
}

#aflowIaReadyModal .aflow-ia-chat-title .qbar-item-icon {
  height: 18px;
  width: 18px;
}

#aflowIaReadyModal.is-native-chat .flow-help-head {
  border-bottom: 1px solid #E5E7EA;
  flex: 0 0 auto;
  margin: 0;
  padding: 18px 88px 16px 28px;
}

#aflowIaReadyModal.is-native-chat #aflowIaReadyIntro {
  display: none;
}

.aflow-ia-modal-controls {
  display: flex;
  gap: 6px;
  position: absolute;
  right: 14px;
  top: 14px;
}

.aflow-ia-modal-control {
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--t3);
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  height: 28px;
  justify-content: center;
  padding: 0;
  transition: all .15s;
  width: 28px;
}

.aflow-ia-modal-control:hover,
.aflow-ia-modal-control:focus-visible {
  background: var(--border);
  border-color: var(--border2);
  color: var(--t1);
  outline: none;
}

.aflow-ia-restore {
  align-items: center;
  background: var(--navy2);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 999px;
  bottom: 20px;
  box-shadow: 0 12px 30px rgba(15, 30, 45, .24);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  gap: 4px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 700;
  min-height: 40px;
  padding: 9px 16px;
  position: fixed;
  right: 20px;
  z-index: 10001;
}

.aflow-ia-restore[hidden] {
  display: none;
}

.aflow-ia-restore:hover,
.aflow-ia-restore:focus-visible {
  background: var(--navy);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#aflowIaReadyModal .flow-help-section {
  padding: 10px 0;
}

#aflowIaReadyModal .save-bar {
  padding: 10px 0 0;
}

#aflowIaReadyModal .btn-save,
#aflowIaReadyModal .chip.cS {
  align-items: center;
  border-radius: var(--rs);
  display: inline-flex;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 700;
  justify-content: center;
  line-height: 1;
  min-height: 36px;
  padding: 9px 20px;
  white-space: nowrap;
}

#aflowIaReadyModal .aflow-ia-chat-history {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--rs);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  max-height: none;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
}

#aflowIaReadyModal .aflow-ia-chat-message {
  border-radius: 10px;
  color: var(--t1);
  font-size: 12px;
  line-height: 1.5;
  max-width: 88%;
  padding: 9px 11px;
  white-space: pre-wrap;
}

#aflowIaReadyModal .aflow-ia-chat-message.is-user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
}

#aflowIaReadyModal .aflow-ia-chat-message.is-assistant {
  align-self: flex-start;
  background: var(--white);
  border: 1px solid var(--border2);
  white-space: normal;
}

#aflowIaReadyModal .aflow-ia-chat-message.is-assistant > :first-child {
  margin-top: 0;
}

#aflowIaReadyModal .aflow-ia-chat-message.is-assistant > :last-child {
  margin-bottom: 0;
}

#aflowIaReadyModal .aflow-ia-chat-message.is-assistant h1,
#aflowIaReadyModal .aflow-ia-chat-message.is-assistant h2,
#aflowIaReadyModal .aflow-ia-chat-message.is-assistant h3 {
  color: var(--navy);
  line-height: 1.3;
  margin: 12px 0 6px;
}

#aflowIaReadyModal .aflow-ia-chat-message.is-assistant h1 { font-size: 16px; }
#aflowIaReadyModal .aflow-ia-chat-message.is-assistant h2 { font-size: 14px; }
#aflowIaReadyModal .aflow-ia-chat-message.is-assistant h3 { font-size: 13px; }

#aflowIaReadyModal .aflow-ia-chat-message.is-assistant p,
#aflowIaReadyModal .aflow-ia-chat-message.is-assistant ul,
#aflowIaReadyModal .aflow-ia-chat-message.is-assistant ol,
#aflowIaReadyModal .aflow-ia-chat-message.is-assistant pre,
#aflowIaReadyModal .aflow-ia-chat-message.is-assistant .aflow-ia-markdown-table {
  margin: 7px 0;
}

#aflowIaReadyModal .aflow-ia-chat-message.is-assistant ul,
#aflowIaReadyModal .aflow-ia-chat-message.is-assistant ol {
  padding-left: 20px;
}

#aflowIaReadyModal .aflow-ia-chat-message.is-assistant code {
  background: var(--bg);
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  padding: 1px 4px;
}

#aflowIaReadyModal .aflow-ia-chat-message.is-assistant pre {
  background: var(--navy);
  border-radius: 7px;
  color: #fff;
  max-width: 100%;
  overflow-x: auto;
  padding: 10px;
  white-space: pre;
}

#aflowIaReadyModal .aflow-ia-chat-message.is-assistant pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

#aflowIaReadyModal .aflow-ia-markdown-table {
  max-width: 100%;
  overflow-x: auto;
}

#aflowIaReadyModal .aflow-ia-markdown-table table {
  border-collapse: collapse;
  width: 100%;
}

#aflowIaReadyModal .aflow-ia-markdown-table th,
#aflowIaReadyModal .aflow-ia-markdown-table td {
  border: 1px solid var(--border2);
  padding: 6px 8px;
  text-align: left;
  white-space: nowrap;
}

#aflowIaReadyModal .aflow-ia-markdown-table th {
  background: var(--bg);
  color: var(--navy);
}

#aflowIaReadyModal .aflow-ia-chat-label {
  color: var(--t2);
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin: 10px 0 5px;
}

#aflowIaReadyModal .aflow-ia-chat-section-label {
  color: var(--t2);
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 8px;
}

#aflowIaReadyModal.is-native-chat #aflowIaNativeChat {
  display: grid;
  flex: 1 1 auto;
  grid-template-rows: minmax(0, 3fr) minmax(0, 2fr);
  min-height: 0;
}

#aflowIaReadyModal .aflow-ia-chat-conversation,
#aflowIaReadyModal .aflow-ia-chat-composer {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#aflowIaReadyModal .aflow-ia-chat-conversation {
  padding: 18px 28px 12px;
}

#aflowIaReadyModal .aflow-ia-chat-composer {
  border-top: 1px solid #E5E7EA;
  padding: 12px 28px 18px;
}

#aflowIaReadyModal .aflow-ia-chat-actions {
  align-items: center;
  background: #FFFFFF;
  border-top: 1px solid #E5E7EA;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  margin: 10px -28px 0;
  padding: 14px 28px;
}

#aflowIaReadyModal.is-native-chat #aflowIaChatInput {
  flex: 1 1 auto;
  min-height: 0;
  resize: vertical;
}

#aflowIaReadyModal #aflowIaChatStatus {
  color: var(--t3);
  display: block;
  font-size: 11px;
  justify-self: center;
  margin-top: 0;
}

#aflowIaReadyModal .aflow-ia-chat-actions .save-meta {
  display: contents;
}

#aflowIaReadyModal .aflow-ia-chat-actions .save-context {
  align-items: center;
  color: #777C84;
  display: inline-flex;
  font-size: 11px;
  gap: 8px;
  justify-self: start;
  line-height: 1.4;
  white-space: nowrap;
}

#aflowIaReadyModal .aflow-ia-chat-actions .btn-save {
  justify-self: end;
}

#aflowIaReadyModal .aflow-ia-footer-mark {
  display: block;
  height: 20px;
  width: 20px;
}

#aflowIaReadyModal .aflow-ia-observation-preview {
  background: var(--gdim);
  border: 1px solid #FDBA74;
  border-radius: var(--rs);
  margin-top: 10px;
  padding: 10px;
}

#aflowIaReadyModal .aflow-ia-observation-preview strong {
  color: var(--gtext);
  display: block;
  font-size: 11px;
  margin-bottom: 6px;
}

#aflowIaReadyModal .aflow-ia-observation-preview pre {
  color: var(--t1);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  line-height: 1.5;
  margin: 0 0 10px;
  white-space: pre-wrap;
}

@media (max-width: 800px) {
  .aflow-ia-restore {
    bottom: 12px;
    min-height: 38px;
    padding: 8px 14px;
    right: 12px;
  }

  .aflow-ia-restore-detail {
    display: none;
  }

  #aflowIaReadyModal .flow-help-panel {
    width: 92vw;
    max-width: 92vw;
    padding: 16px;
  }

  #aflowIaReadyModal.is-native-chat {
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    padding: calc(14px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom));
  }

  #aflowIaReadyModal.is-native-chat .flow-help-panel {
    height: 100%;
    max-height: 100%;
    width: 92vw;
    max-width: 92vw;
  }

  #aflowIaReadyModal.is-native-chat.is-expanded {
    padding: calc(8px + env(safe-area-inset-top)) 8px calc(8px + env(safe-area-inset-bottom));
  }

  #aflowIaReadyModal.is-native-chat.is-expanded .flow-help-panel {
    height: 100%;
    max-height: 100%;
    max-width: calc(100vw - 16px);
    width: calc(100vw - 16px);
  }

  #aflowIaReadyModal.is-native-chat #aflowIaNativeChat {
    grid-template-rows: minmax(0, 3fr) minmax(180px, 2fr);
  }

  #aflowIaReadyModal.is-native-chat .flow-help-head {
    padding: 16px 82px 14px 20px;
  }

  #aflowIaReadyModal .aflow-ia-chat-conversation {
    padding: 14px 20px 10px;
  }

  #aflowIaReadyModal .aflow-ia-chat-composer {
    padding: 10px 20px 14px;
  }

  #aflowIaReadyModal .aflow-ia-chat-actions {
    margin-left: -20px;
    margin-right: -20px;
    padding: 12px 20px;
  }

  #aflowIaReadyModal .aflow-ia-chat-actions .save-context {
    white-space: normal;
  }

  #aflowIaReadyModal .flow-help-head p {
    white-space: normal;
  }
}

/* AFLOR Flow | Auth */
#aflowAuthScreen {
  align-items: center;
  background: #000000;
  display: grid;
  font-family: inherit;
  inset: 0;
  justify-items: center;
  padding: 24px;
  position: fixed;
  z-index: 10000;
}

#aflowAuthCard {
  background: var(--navy);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--r);
  box-sizing: border-box;
  color: #fff;
  padding: 32px;
  width: min(100%, 390px);
}

#aflowAuthCard .aflow-auth-heading {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

#aflowAuthCard .aflow-auth-mark {
  display: block;
  height: 32px;
  object-fit: contain;
  width: 32px;
}

#aflowAuthCard h1 {
  font-size: 24px;
  letter-spacing: 0;
  margin: 0;
}

#aflowAuthCard p {
  color: rgba(255, 255, 255, .72);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 24px;
}

#aflowAuthForm {
  display: grid;
  gap: 14px;
}

#aflowAuthForm label {
  color: rgba(255, 255, 255, .86);
  display: grid;
  font-size: 13px;
  gap: 7px;
}

#aflowAuthForm input {
  background: #fff;
  border: 1px solid #fff;
  border-radius: var(--rs);
  box-sizing: border-box;
  color: var(--text-dark);
  font: inherit;
  padding: 12px;
  width: 100%;
}

#aflowAuthForm button {
  background: var(--accent);
  border: 0;
  border-radius: var(--rs);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  margin-top: 4px;
  padding: 12px;
}

#aflowAuthForm button:hover,
#aflowAuthForm button:focus-visible {
  background: var(--accent-hover);
}

#aflowAuthForm button:disabled,
.aflow-auth-logout:disabled {
  cursor: wait;
  opacity: .7;
}

#aflowAuthMessage {
  min-height: 0;
  margin: 0;
}

#aflowAuthSupport {
  color: rgba(255, 255, 255, .72);
  display: inline-flex;
  font-size: 13px;
  justify-self: center;
  margin: 0;
  max-width: 100%;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

#aflowAuthSupport:hover,
#aflowAuthSupport:focus-visible {
  color: #fff;
  text-decoration: none;
}

#aflowAuthCard .aflow-auth-error {
  color: #FCA5A5;
}

.aflow-auth-logout {
  align-items: center;
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  gap: 6px;
  padding: 7px 10px;
}

.aflow-auth-logout:hover,
.aflow-auth-logout:focus-visible {
  background: rgba(255, 255, 255, .08);
  border-color: transparent;
  color: #fff;
  outline: none;
}

@media (max-width: 480px) {
  #aflowAuthScreen { padding: 16px; }
  #aflowAuthCard { padding: 24px; }
}
