/* RHChat v2 — interface baseada nas Human Interface Guidelines da Apple (Liquid Glass, iOS/macOS 26–27).
   Princípios aplicados: Liquid Glass só na camada funcional (barra lateral, barras flutuantes, sheets);
   conteúdo em materiais padrão; cor de destaque reservada para a ação principal; cores do sistema
   com variantes claro/escuro/alto contraste; respeito a "reduzir transparência" e "reduzir movimento". */

/* ------------------------------------------------------------------ Tokens */
:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  /* Cores do sistema (HIG › Color › Specifications) — padrão claro */
  --red: #FF383C; --orange: #FF8D28; --yellow: #FFCC00; --green: #34C759; --mint: #00C8B3; --teal: #00C3D0;
  --cyan: #00C0E8; --blue: #0088FF; --indigo: #6155F5; --purple: #CB30E0; --pink: #FF2D55; --brown: #AC7F5E; --gray: #8E8E93;
  /* variantes de alto contraste, usadas para texto colorido sobre fundo claro */
  --red-text: #E9152D; --orange-text: #C55300; --green-text: #008932; --blue-text: #1E6EF4; --purple-text: #B02FC2; --gray-text: #6C6C70;

  /* Cor de destaque (azul NetSpeed, contraste 4,7:1 com texto branco) */
  --accent: #0071E3;
  --accent-text: #0066CC;
  --accent-soft: rgba(0, 113, 227, .12);
  --on-accent: #FFFFFF;

  /* Fundos (agrupados) e rótulos */
  --bg: #F2F2F7;
  --bg-elevated: #FFFFFF;
  --bg-tertiary: #F2F2F7;
  --label: #000000;
  --label-2: rgba(60, 60, 67, .60);
  --label-3: rgba(60, 60, 67, .30);
  --label-4: rgba(60, 60, 67, .18);
  --fill: rgba(120, 120, 128, .20);
  --fill-2: rgba(120, 120, 128, .16);
  --fill-3: rgba(118, 118, 128, .12);
  --fill-4: rgba(116, 116, 128, .08);
  --separator: rgba(60, 60, 67, .29);
  --separator-soft: rgba(60, 60, 67, .12);

  /* Liquid Glass (regular) */
  --glass-bg: rgba(255, 255, 255, .76);
  --glass-strong: rgba(255, 255, 255, .80);
  --glass-edge: rgba(255, 255, 255, .75);
  --glass-shine: rgba(255, 255, 255, .95);
  --glass-shadow: 0 12px 40px rgba(0, 0, 0, .10), 0 2px 10px rgba(0, 0, 0, .05);
  --glass-blur: blur(30px) saturate(190%);

  --card-shadow: 0 0 0 .5px var(--separator-soft), 0 1px 2px rgba(0, 0, 0, .04);
  --scrim: rgba(0, 0, 0, .22);

  --r-xl: 28px; --r-lg: 22px; --r-md: 14px; --r-sm: 10px; --r-xs: 7px;
  --sidebar-w: 264px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .64, 1);
}

/* Tema escuro: automático (sistema) ou forçado pelo seletor de tema (data-theme no <html>) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --red: #FF4245; --orange: #FF9230; --yellow: #FFD600; --green: #30D158; --mint: #00DAC3; --teal: #00D2E0;
    --cyan: #3CD3FE; --blue: #0091FF; --indigo: #6D7CFF; --purple: #DB34F2; --pink: #FF375F; --brown: #B78A66; --gray: #8E8E93;
    --red-text: #FF6165; --orange-text: #FFA056; --green-text: #4AD968; --blue-text: #5CB8FF; --purple-text: #EA8DFF; --gray-text: #AEAEB2;

    --accent: #0071E3;
    --accent-text: #4DA6FF;
    --accent-soft: rgba(10, 132, 255, .20);

    --bg: #000000;
    --bg-elevated: #1C1C1E;
    --bg-tertiary: #2C2C2E;
    --label: #FFFFFF;
    --label-2: rgba(235, 235, 245, .60);
    --label-3: rgba(235, 235, 245, .30);
    --label-4: rgba(235, 235, 245, .16);
    --fill: rgba(120, 120, 128, .36);
    --fill-2: rgba(120, 120, 128, .32);
    --fill-3: rgba(118, 118, 128, .24);
    --fill-4: rgba(118, 118, 128, .18);
    --separator: rgba(84, 84, 88, .65);
    --separator-soft: rgba(84, 84, 88, .40);

    --glass-bg: rgba(38, 38, 42, .72);
    --glass-strong: rgba(44, 44, 48, .82);
    --glass-edge: rgba(255, 255, 255, .14);
    --glass-shine: rgba(255, 255, 255, .22);
    --glass-shadow: 0 12px 40px rgba(0, 0, 0, .45), 0 2px 10px rgba(0, 0, 0, .30);
    --card-shadow: 0 0 0 .5px var(--separator-soft);
    --scrim: rgba(0, 0, 0, .50);
  }
}
:root[data-theme="dark"] {
  --red: #FF4245; --orange: #FF9230; --yellow: #FFD600; --green: #30D158; --mint: #00DAC3; --teal: #00D2E0;
  --cyan: #3CD3FE; --blue: #0091FF; --indigo: #6D7CFF; --purple: #DB34F2; --pink: #FF375F; --brown: #B78A66; --gray: #8E8E93;
  --red-text: #FF6165; --orange-text: #FFA056; --green-text: #4AD968; --blue-text: #5CB8FF; --purple-text: #EA8DFF; --gray-text: #AEAEB2;

  --accent: #0071E3;
  --accent-text: #4DA6FF;
  --accent-soft: rgba(10, 132, 255, .20);

  --bg: #000000;
  --bg-elevated: #1C1C1E;
  --bg-tertiary: #2C2C2E;
  --label: #FFFFFF;
  --label-2: rgba(235, 235, 245, .60);
  --label-3: rgba(235, 235, 245, .30);
  --label-4: rgba(235, 235, 245, .16);
  --fill: rgba(120, 120, 128, .36);
  --fill-2: rgba(120, 120, 128, .32);
  --fill-3: rgba(118, 118, 128, .24);
  --fill-4: rgba(118, 118, 128, .18);
  --separator: rgba(84, 84, 88, .65);
  --separator-soft: rgba(84, 84, 88, .40);

  --glass-bg: rgba(38, 38, 42, .72);
  --glass-strong: rgba(44, 44, 48, .82);
  --glass-edge: rgba(255, 255, 255, .14);
  --glass-shine: rgba(255, 255, 255, .22);
  --glass-shadow: 0 12px 40px rgba(0, 0, 0, .45), 0 2px 10px rgba(0, 0, 0, .30);
  --card-shadow: 0 0 0 .5px var(--separator-soft);
  --scrim: rgba(0, 0, 0, .50);
}
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }

@media (prefers-contrast: more) {
  :root {
    --label-2: rgba(60, 60, 67, .85);
    --separator: rgba(60, 60, 67, .55);
    --separator-soft: rgba(60, 60, 67, .40);
    --glass-bg: rgba(255, 255, 255, .92);
    --fill-3: rgba(118, 118, 128, .22);
  }
  :root[data-theme="dark"] {
    --label-2: rgba(235, 235, 245, .85);
    --separator: rgba(160, 160, 168, .7);
    --separator-soft: rgba(160, 160, 168, .45);
    --glass-bg: rgba(28, 28, 30, .94);
    --fill-3: rgba(118, 118, 128, .32);
  }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --label-2: rgba(235, 235, 245, .85);
    --separator: rgba(160, 160, 168, .7);
    --separator-soft: rgba(160, 160, 168, .45);
    --glass-bg: rgba(28, 28, 30, .94);
    --fill-3: rgba(118, 118, 128, .32);
  }
}

/* ------------------------------------------------------------------ Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font: 15px/1.45 var(--font);
  letter-spacing: -.005em;
  color: var(--label);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent-text); }
img { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Camada de conteúdo com um leve brilho da marca — dá ao vidro algo para refratar */
.ambient {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vw 50vh at 8% -10%, color-mix(in srgb, var(--blue) 16%, transparent), transparent 70%),
    radial-gradient(50vw 45vh at 105% 15%, color-mix(in srgb, var(--cyan) 12%, transparent), transparent 70%),
    radial-gradient(40vw 40vh at 50% 120%, color-mix(in srgb, var(--indigo) 10%, transparent), transparent 70%),
    var(--bg);
}

/* ------------------------------------------------------------------ Liquid Glass */
.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-shine), inset 0 -.5px 0 rgba(255, 255, 255, .12), var(--glass-shadow);
  position: relative;
  isolation: isolate;
}
.glass::before { /* reflexo especular */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: linear-gradient(160deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, 0) 70%, rgba(255, 255, 255, .10));
  mix-blend-mode: soft-light;
}
@media (prefers-reduced-transparency: reduce) {
  .glass { background: var(--bg-elevated); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .glass::before { display: none; }
}

/* ------------------------------------------------------------------ Tipografia */
.large-title { font: 700 30px/1.15 var(--font-display); letter-spacing: -.022em; margin: 0; }
.title-2 { font: 700 22px/1.2 var(--font-display); letter-spacing: -.018em; margin: 0; }
.headline { font-weight: 600; font-size: 15px; letter-spacing: -.01em; margin: 0; }
.subhead { font-size: 13px; color: var(--label-2); }
.footnote { font-size: 12px; color: var(--label-2); }
.caption { font-size: 11px; color: var(--label-2); }
.mono { font-family: var(--font-mono); }
.tnum { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ Botões (cápsulas) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 999px;
  font-weight: 600; font-size: 14px; letter-spacing: -.01em; white-space: nowrap; text-decoration: none;
  background: var(--fill-3); color: var(--label);
  transition: transform .18s var(--spring), background-color .2s var(--ease), opacity .2s;
}
.btn:hover { background: var(--fill-2); }
.btn:active { transform: scale(.96); }
.btn:disabled { background: var(--fill-3); color: var(--label-3); box-shadow: none; pointer-events: none; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px rgba(0, 60, 140, .25), inset 0 1px 0 rgba(255, 255, 255, .22); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); }
.btn-danger { color: var(--red-text); }
.btn-danger-fill { background: var(--red); color: #fff; }
.btn-plain { background: transparent; color: var(--accent-text); padding: 0 8px; }
.btn-plain:hover { background: var(--fill-4); }
.btn-lg { height: 44px; padding: 0 22px; font-size: 15px; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 50%; }
.btn-icon.btn-sm { width: 30px; height: 30px; }

/* ------------------------------------------------------------------ Layout do app */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100dvh; }

.sidebar {
  position: sticky; top: 12px; margin: 12px 0 12px 12px; height: calc(100dvh - 24px);
  border-radius: var(--r-xl); padding: 16px 12px 12px; display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 18px; }
.app-icon {
  width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: linear-gradient(145deg, #3AA0FF 0%, #0071E3 55%, #2B3FD6 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -1px 2px rgba(0, 0, 0, .15), 0 4px 12px rgba(0, 90, 200, .30);
  color: #fff;
}
.app-icon svg { width: 21px; height: 21px; }
.brand .name { font: 700 17px/1.1 var(--font-display); letter-spacing: -.02em; }
img.app-logo {
  width: 38px; height: 38px; border-radius: 9px; flex: none; object-fit: cover; background: #0D26BD;
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .12), 0 4px 12px rgba(13, 38, 189, .28);
}
.brand .sub { font-size: 12px; color: var(--label-2); margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 11px; border-radius: 12px;
  color: var(--label); text-decoration: none; font-weight: 500; font-size: 14px;
  transition: background-color .15s var(--ease);
}
.nav a svg { width: 19px; height: 19px; color: var(--accent-text); flex: none; }
.nav a:hover { background: var(--fill-4); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav .badge { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--label-2); }
.nav a[aria-current="page"] .badge { color: var(--accent-text); }

.sidebar .spacer { flex: 1; }
.theme-switch { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; }
.theme-switch .label { font-size: 12px; color: var(--label-2); flex: 1; }
.theme-switch .segmented button { width: 34px; height: 28px; padding: 0; display: grid; place-items: center; }
.theme-switch .segmented svg { width: 16px; height: 16px; }
.only-mobile { display: none !important; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px 8px 4px; border-top: .5px solid var(--separator-soft); }
.me .who { min-width: 0; flex: 1; }
.me .who strong { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me form { margin: 0; }

.main { min-width: 0; padding: 0 28px 140px; }
.toolbar {
  position: sticky; top: 0; z-index: 20; padding: 26px 0 14px; margin: 0 -28px; padding-inline: 28px;
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
}
.toolbar::before { /* efeito de borda de rolagem (scroll edge effect) */
  content: ""; position: absolute; inset: 0 0 -18px; z-index: -1; pointer-events: none;
  -webkit-backdrop-filter: blur(14px) saturate(160%); backdrop-filter: blur(14px) saturate(160%);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 80%, transparent), color-mix(in srgb, var(--bg) 0%, transparent));
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent);
  mask-image: linear-gradient(to bottom, #000 60%, transparent);
  opacity: 0; transition: opacity .25s var(--ease);
}
.scrolled .toolbar::before { opacity: 1; }
.toolbar .titles { flex: 1; min-width: 220px; }
.toolbar .titles p { margin: 4px 0 0; }
.toolbar .actions { display: flex; gap: 8px; align-items: center; }

/* ------------------------------------------------------------------ Cartões e listas */
.card { background: var(--bg-elevated); border-radius: var(--r-lg); box-shadow: var(--card-shadow); min-width: 0; overflow: hidden; overflow: clip; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 10px; }
.card-head .headline { flex: 1; }
.card-body { padding: 0 18px 18px; }

.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--label-2); pointer-events: none; }
.search input {
  width: 100%; height: 36px; border: 0; border-radius: 999px; padding: 0 14px 0 34px;
  background: var(--fill-3); outline: none; font-size: 14px;
}
.search input::placeholder { color: var(--label-2); }
.search input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 18px 12px; max-height: 118px; overflow-y: auto; }
.chip {
  --c: var(--gray);
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px 0 10px; flex: none;
  border-radius: 999px; background: var(--fill-3); font-size: 13px; font-weight: 500;
  transition: background-color .15s var(--ease), transform .18s var(--spring);
}
.chip:active { transform: scale(.95); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.chip .n { color: var(--label-2); font-variant-numeric: tabular-nums; }
.chip[data-state="all"] { background: color-mix(in srgb, var(--c) 18%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 45%, transparent); }
.chip[data-state="some"] { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 45%, transparent); }
.chip .mark { width: 14px; height: 14px; display: none; color: var(--label); }
.chip[data-state="all"] .mark.all, .chip[data-state="some"] .mark.some { display: block; }
.chip[data-state="all"] .dot, .chip[data-state="some"] .dot { display: none; }

.c-red { --c: var(--red); } .c-orange { --c: var(--orange); } .c-yellow { --c: var(--yellow); } .c-green { --c: var(--green); }
.c-mint { --c: var(--mint); } .c-teal { --c: var(--teal); } .c-cyan { --c: var(--cyan); } .c-blue { --c: var(--blue); }
.c-indigo { --c: var(--indigo); } .c-purple { --c: var(--purple); } .c-pink { --c: var(--pink); } .c-brown { --c: var(--brown); } .c-gray { --c: var(--gray); }

.list { overflow-y: auto; overscroll-behavior: contain; }
.list-group { position: relative; }
.list-group-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px;
  padding: 10px 18px 6px; font-size: 13px; font-weight: 600; color: var(--label-2);
  background: color-mix(in srgb, var(--bg-elevated) 96%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.list-group-head .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.list-group-head .grow { flex: 1; }
.list-group-head .btn-plain { height: 24px; font-size: 12px; }

.row {
  position: relative; display: grid; grid-template-columns: auto 36px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  min-height: 54px; padding: 8px 18px; cursor: pointer; user-select: none;
  transition: background-color .12s var(--ease);
}
.row:hover { background: var(--fill-4); }
.row + .row::before { content: ""; position: absolute; top: 0; left: 104px; right: 0; height: .5px; background: var(--separator-soft); }
.row .meta { min-width: 0; }
.row .meta .t { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta .s { font-size: 12px; color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .trail { display: flex; align-items: center; gap: 8px; color: var(--label-2); font-size: 13px; }

.check {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none;
  box-shadow: inset 0 0 0 1.5px var(--label-3); color: transparent;
  transition: background-color .15s var(--ease), box-shadow .15s var(--ease), transform .2s var(--spring);
}
.check svg { width: 13px; height: 13px; }
[aria-checked="true"] > .check, .check.on { background: var(--accent); box-shadow: none; color: #fff; transform: scale(1.04); }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; display: grid; place-items: center;
  font-size: 13px; font-weight: 600; color: #fff; background: var(--c, var(--gray)); letter-spacing: 0;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.xs { width: 22px; height: 22px; font-size: 9px; }

.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; color: var(--label);
  background: color-mix(in srgb, var(--c, var(--gray)) 16%, transparent);
}
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c, var(--gray)); }

.empty { text-align: center; padding: 36px 18px; color: var(--label-2); }
.empty svg { width: 34px; height: 34px; margin: 0 auto 10px; color: var(--label-3); }
.empty strong { display: block; color: var(--label); font-size: 15px; margin-bottom: 4px; }

.list-foot { display: flex; align-items: center; gap: 10px; padding: 10px 18px 14px; border-top: .5px solid var(--separator-soft); font-size: 13px; }
.list-foot .grow { flex: 1; color: var(--label-2); }

/* ------------------------------------------------------------------ Nova mensagem */
.compose { display: grid; grid-template-columns: minmax(330px, 420px) minmax(0, 1fr); gap: 20px; align-items: start; }
.compose .recipients { position: sticky; top: 96px; display: flex; flex-direction: column; max-height: calc(100dvh - 96px - 96px); }
.compose .recipients .list { flex: 1; min-height: 160px; }
.compose .recipients > :not(.list) { flex: none; }
.composer-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.editor { border-radius: var(--r-lg); overflow: hidden; }
.editor-tools { display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-bottom: .5px solid var(--separator-soft); flex-wrap: wrap; }
.tool-group { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--fill-4); }
.tool {
  width: 32px; height: 30px; border-radius: 999px; display: grid; place-items: center; color: var(--label);
  font-size: 15px; transition: background-color .12s var(--ease);
}
.tool:hover { background: var(--fill-2); }
.tool[aria-pressed="true"] { background: var(--bg-elevated); color: var(--accent-text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.tool svg { width: 17px; height: 17px; }
.tool.wide { width: auto; padding: 0 12px; gap: 6px; display: inline-flex; font-size: 13px; font-weight: 600; }
.editor-tools .grow { flex: 1; }
.counter { font-size: 12px; color: var(--label-2); font-variant-numeric: tabular-nums; padding-right: 4px; }
.counter.over { color: var(--red-text); font-weight: 600; }

.rte {
  min-height: 230px; max-height: 52vh; overflow-y: auto; padding: 16px 20px 20px; outline: none;
  font-size: 15px; line-height: 1.55; word-wrap: break-word; position: relative;
}
.rte.is-empty::before { content: attr(data-placeholder); color: var(--label-3); position: absolute; pointer-events: none; }
.rte b, .rte strong, .rich b { font-weight: 650; }
.rte code, .rich code {
  font-family: var(--font-mono); font-size: .86em; padding: 1px 5px; border-radius: 5px;
  background: var(--fill-3); color: var(--red-text); box-shadow: inset 0 0 0 .5px var(--separator-soft);
}
.rte pre, .rich pre {
  font-family: var(--font-mono); font-size: 13px; line-height: 1.5; white-space: pre-wrap; margin: 6px 0;
  padding: 10px 12px; border-radius: var(--r-sm); background: var(--fill-4); box-shadow: inset 0 0 0 .5px var(--separator-soft);
}
.rte blockquote, .rich blockquote { margin: 4px 0; padding: 0 0 0 12px; border-left: 3px solid var(--label-4); color: var(--label-2); }
.rte ul, .rte ol, .rich ul, .rich ol { margin: 4px 0; padding-left: 26px; }
.rte a, .rich a { color: var(--accent-text); text-decoration: none; }
.rte a:hover { text-decoration: underline; }
.rich .var { background: color-mix(in srgb, var(--purple) 18%, transparent); border-radius: 4px; padding: 0 2px; }

.attach { padding: 0 20px 18px; }
.dropzone {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md);
  border: 1.5px dashed var(--separator); color: var(--label-2); font-size: 13px; cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--label); }
.dropzone svg { width: 22px; height: 22px; color: var(--accent-text); flex: none; }
.dropzone strong { color: var(--label); font-weight: 600; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin-top: 10px; }
.file { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 8px; border-radius: var(--r-md); background: var(--fill-4); min-width: 0; }
.file .thumb { width: 42px; height: 42px; border-radius: 9px; object-fit: cover; flex: none; background: var(--fill-3); }
.file .ext {
  width: 42px; height: 42px; border-radius: 9px; flex: none; display: grid; place-items: center;
  font-size: 10px; font-weight: 700; letter-spacing: .02em; color: #fff; background: var(--c, var(--gray)); text-transform: uppercase;
}
.file .info { min-width: 0; flex: 1; }
.file .info .t { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .info .s { font-size: 11px; color: var(--label-2); }

/* Prévia no estilo Slack */
.preview-card .card-head .subhead { margin-left: auto; }
.slack { padding: 4px 18px 18px; }
.slack .msg { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--bg-tertiary); }
.slack .msg .app-icon { width: 38px; height: 38px; border-radius: 9px; }
.slack .msg .bot-avatar { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; background: #0D26BD; }
.slack .msg-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.slack .msg-head strong { font-size: 15px; font-weight: 700; }
.slack .msg-head .app-tag { font-size: 10px; font-weight: 700; padding: 1px 4px; border-radius: 3px; background: var(--fill-2); color: var(--label-2); }
.slack .msg-head time { font-size: 12px; color: var(--label-2); }
.slack .rich { font-size: 15px; line-height: 1.5; margin-top: 2px; overflow-wrap: anywhere; }
.slack .rich:empty::before { content: "Sua mensagem aparece aqui."; color: var(--label-3); }
.slack .shared { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.slack .shared img { max-width: 220px; max-height: 160px; border-radius: 8px; box-shadow: 0 0 0 .5px var(--separator-soft); }
.slack .shared .doc { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--bg-elevated); box-shadow: 0 0 0 .5px var(--separator-soft); font-size: 13px; }
.slack .shared .doc .ext { width: 30px; height: 30px; font-size: 8px; border-radius: 6px; }
.preview-for select { border: 0; background: transparent; color: var(--accent-text); font-weight: 600; font-size: 13px; max-width: 180px; cursor: pointer; }

/* Barra de ação flutuante (Liquid Glass) */
.actionbar {
  position: fixed; z-index: 30; bottom: 18px; left: calc(var(--sidebar-w) + 12px + 28px); right: 28px;
  margin: 0 auto; max-width: 760px; display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 8px 20px; border-radius: 999px;
  transition: transform .35s var(--spring), opacity .25s;
}
.actionbar .summary { flex: 1; min-width: 0; font-size: 13px; color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actionbar .summary strong { color: var(--label); font-weight: 600; }
.actionbar .mini-progress { display: flex; align-items: center; gap: 8px; }

/* ------------------------------------------------------------------ Setores */
.sectors-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.sector-list { position: sticky; top: 96px; }
.sector-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 0 12px; height: 40px;
  border-radius: 12px; font-size: 14px; font-weight: 500;
}
.sector-item:hover { background: var(--fill-4); }
.sector-item[aria-current="true"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.sector-item .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.sector-item svg { width: 18px; height: 18px; color: var(--label-2); flex: none; }
.sector-item .n { margin-left: auto; color: var(--label-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.sector-items { padding: 0 8px 10px; display: flex; flex-direction: column; gap: 1px; }
.sector-items + .sector-items { border-top: .5px solid var(--separator-soft); padding-top: 10px; }

.bulkbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 16px; margin: 0 12px 10px; border-radius: 999px; background: var(--accent-soft); font-size: 13px; }
.bulkbar .grow { flex: 1; font-weight: 600; }

.popup {
  appearance: none; -webkit-appearance: none; height: 28px; border: 0; border-radius: 999px; padding: 0 28px 0 12px;
  background: var(--fill-3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2.5 3.8 5 6.3l2.5-2.5' fill='none' stroke='%238E8E93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  font-size: 13px; font-weight: 500; color: var(--label); cursor: pointer; max-width: 170px; text-overflow: ellipsis;
}
.popup:focus { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
select option { color: #000; background: #fff; }

/* ------------------------------------------------------------------ Histórico */
.segmented { display: inline-flex; padding: 2px; border-radius: 999px; background: var(--fill-3); gap: 2px; }
.segmented button { height: 30px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--label); transition: background-color .15s, box-shadow .15s; }
.segmented button[aria-pressed="true"] { background: var(--bg-elevated); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .14), 0 0 0 .5px rgba(0, 0, 0, .04); }

.job-row { grid-template-columns: 34px minmax(0, 1fr) auto; }
.job-row + .job-row::before { left: 64px; }
.status-glyph { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--c); }
.status-glyph svg { width: 17px; height: 17px; }
.job-row .meta .t { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-weight: 500; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.green { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green-text); }
.pill.red { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red-text); }
.pill.orange { background: color-mix(in srgb, var(--orange) 16%, transparent); color: var(--orange-text); }
.pill.blue { background: var(--accent-soft); color: var(--accent-text); }
.pill.gray { background: var(--fill-3); color: var(--label-2); }
.pill.purple { background: color-mix(in srgb, var(--purple) 15%, transparent); color: var(--purple-text); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 12px 14px; border-radius: var(--r-md); background: var(--fill-4); }
.stat .v { font: 700 24px/1.1 var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .l { font-size: 12px; color: var(--label-2); margin-top: 2px; }
.stat.ok .v { color: var(--green-text); }
.stat.bad .v { color: var(--red-text); }

/* ------------------------------------------------------------------ Sheets, menus e avisos */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: var(--scrim); animation: fade .2s var(--ease);
}
.sheet {
  width: min(540px, 100%); max-height: calc(100dvh - 32px); overflow: auto; border-radius: var(--r-xl);
  background: var(--glass-strong); padding: 22px 24px 20px; animation: rise .38s var(--spring);
}
.sheet.wide { width: min(760px, 100%); }
.sheet-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.sheet-head .grow { flex: 1; min-width: 0; }
.sheet-head p { margin: 4px 0 0; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.sheet-foot .grow { flex: 1; }
.sheet .group { background: var(--bg-elevated); border-radius: var(--r-md); box-shadow: var(--card-shadow); }
.kv { display: flex; align-items: center; gap: 12px; padding: 12px 14px; font-size: 14px; }
.kv + .kv { border-top: .5px solid var(--separator-soft); }
.kv .k { color: var(--label-2); min-width: 110px; }
.kv .v { flex: 1; min-width: 0; }
.kv .v .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); font-size: 13px; margin-top: 12px; }
.note svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.note.warn { background: color-mix(in srgb, var(--orange) 14%, transparent); color: var(--label); }
.note.warn svg { color: var(--orange-text); }
.note.ok { background: color-mix(in srgb, var(--green) 14%, transparent); }
.note.ok svg { color: var(--green-text); }
.note.err { background: color-mix(in srgb, var(--red) 12%, transparent); }
.note.err svg { color: var(--red-text); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--label-2); }
.field input[type="text"], .field input[type="url"] {
  height: 42px; border: 0; border-radius: 12px; padding: 0 14px; background: var(--fill-3); outline: none; font-size: 15px;
}
.field input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .15); display: grid; place-items: center; color: #fff; transition: transform .18s var(--spring); }
.swatch svg { width: 15px; height: 15px; opacity: 0; }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--bg-elevated), 0 0 0 4px var(--c); }
.swatch[aria-checked="true"] svg { opacity: 1; }
.swatch:active { transform: scale(.9); }

.popover {
  position: fixed; z-index: 120; min-width: 230px; padding: 6px; border-radius: 18px; background: var(--glass-strong);
  animation: pop .22s var(--spring);
}
.popover .item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 11px; font-size: 14px; }
.popover .item:hover, .popover .item:focus-visible { background: var(--accent); color: #fff; outline: none; }
.popover .item:hover .subhead, .popover .item:focus-visible .subhead { color: rgba(255, 255, 255, .8); }
.popover .item code { font-family: var(--font-mono); font-size: 12px; }
.popover .sep { height: .5px; background: var(--separator-soft); margin: 4px 8px; }
.popover .link-form { display: flex; gap: 6px; padding: 4px; }
.popover .link-form input { flex: 1; min-width: 220px; height: 34px; border: 0; border-radius: 10px; padding: 0 12px; background: var(--fill-3); outline: none; font-size: 14px; }

.toasts { position: fixed; z-index: 200; top: 16px; left: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 18px 10px 12px; border-radius: 999px; font-size: 14px; font-weight: 500; max-width: min(560px, calc(100vw - 32px)); animation: drop .4s var(--spring); pointer-events: auto; }
.toast svg { width: 20px; height: 20px; flex: none; }
.toast.ok svg { color: var(--green-text); }
.toast.err svg { color: var(--red-text); }
.toast.info svg { color: var(--accent-text); }
.toast.out { animation: lift .25s var(--ease) forwards; }

.ring { width: 132px; height: 132px; margin: 6px auto 12px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 11; stroke-linecap: round; }
.ring .track { stroke: var(--fill-3); }
.ring .bar { stroke: var(--accent); transition: stroke-dashoffset .6s var(--ease); }
.ring.done .bar { stroke: var(--green); }
.ring.warn .bar { stroke: var(--orange); }
.ring .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .pct { font: 700 30px/1 var(--font-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.ring .of { font-size: 12px; color: var(--label-2); margin-top: 4px; }
.progress-status { text-align: center; font-size: 13px; color: var(--label-2); min-height: 20px; margin: 4px 0 14px; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; opacity: .8; }
.loading-block { display: grid; place-items: center; padding: 40px; color: var(--label-2); }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.97); } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }
@keyframes drop { from { opacity: 0; transform: translateY(-16px) scale(.96); } }
@keyframes lift { to { opacity: 0; transform: translateY(-12px) scale(.96); } }
@keyframes spin { to { transform: rotate(360deg); } }


/* ------------------------------------------------------------------ v2.2: confirmação, reações e respostas */
.option-row {
  display: flex; align-items: center; gap: 12px; padding: 14px 20px 16px; border-top: .5px solid var(--separator-soft); cursor: pointer;
}
.option-row.disabled { cursor: default; }
.option-row.disabled .t, .option-row.disabled .opt-icon { opacity: .5; }
.option-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.option-row .t { font-size: 14px; font-weight: 600; }
.option-row .s { font-size: 12px; color: var(--label-2); }
.opt-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; background: var(--c); flex: none; }
.opt-icon svg { width: 18px; height: 18px; }

/* Switch no estilo iOS (verde quando ligado, como no sistema) */
.switch {
  appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 999px; flex: none; cursor: pointer;
  background: var(--fill); position: relative; transition: background-color .2s var(--ease); margin: 0;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18), 0 0 0 .5px rgba(0, 0, 0, .04); transition: transform .25s var(--spring);
}
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(18px); }
.switch:disabled { opacity: .45; cursor: default; }
.switch:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* Botão do Slack na prévia */
.slack-actions { margin-top: 8px; }
.slack-btn {
  display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 6px; font-size: 14px; font-weight: 700;
  color: #fff; background: #007A5A; box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}

/* Reações e respostas */
.rx-list { display: flex; flex-wrap: wrap; gap: 6px; }
.rx { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px; border-radius: 999px; background: var(--fill-3); font-size: 15px; }
.rx b { font-size: 12px; font-weight: 600; color: var(--label-2); font-variant-numeric: tabular-nums; }
.rx-inline { font-size: 15px; letter-spacing: 1px; }
.reply-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--accent-text); }
.reply-badge svg { width: 14px; height: 14px; }
.eng { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: 12px; color: var(--label-2); }
.eng span { display: inline-flex; align-items: center; gap: 4px; }
.eng svg { width: 13px; height: 13px; }
.eng .eng-ack { color: var(--orange-text); font-weight: 600; }
.eng .eng-ack.done { color: var(--green-text); }
.bar { height: 8px; border-radius: 999px; background: var(--fill-3); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .6s var(--ease); }
.bar.done span { background: var(--green); }
.pill.indigo { background: color-mix(in srgb, var(--indigo) 16%, transparent); color: var(--indigo); }
.pill svg { flex: none; }

.replies .reply { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; padding: 12px 18px; position: relative; }
.replies .reply + .reply::before { content: ""; position: absolute; top: 0; left: 58px; right: 0; height: .5px; background: var(--separator-soft); }
.reply .head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.reply .head strong { font-size: 14px; font-weight: 600; }
.reply .head time { font-size: 12px; color: var(--label-2); margin-left: auto; }
.reply .text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.reply .job-link { height: auto; min-height: 26px; padding: 2px 8px; margin: 6px 0 0 -8px; font-size: 12px; white-space: normal; text-align: left; justify-content: flex-start; }
.reply .job-link svg { width: 13px; height: 13px; }

.nav .badge.count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; display: grid; place-items: center; font-size: 11px; }
.tabbar a { position: relative; }
.dot-badge { position: absolute; top: 8px; right: calc(50% - 18px); width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--bg-elevated); }

/* ------------------------------------------------------------------ Login */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth .panel { width: min(420px, 100%); border-radius: 34px; padding: 34px 30px 26px; text-align: center; }
.auth .app-icon { width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 18px; }
.auth .app-icon svg { width: 38px; height: 38px; }
.auth img.app-logo { width: 84px; height: 84px; border-radius: 19px; margin: 0 auto 18px; display: block; }
.auth h1 { font: 700 28px/1.15 var(--font-display); letter-spacing: -.025em; margin: 0 0 6px; }
.auth p { color: var(--label-2); margin: 0 0 22px; }
.auth .btn { width: 100%; }
.auth .note { text-align: left; margin: 0 0 16px; }
.auth .foot { margin-top: 18px; font-size: 12px; color: var(--label-2); }
.auth code { font-family: var(--font-mono); background: var(--fill-3); padding: 2px 6px; border-radius: 6px; user-select: all; }

/* ------------------------------------------------------------------ Barra de abas (telas estreitas) */
.tabbar { display: none; }

@media (max-width: 1080px) {
  .compose { grid-template-columns: 1fr; }
  .compose .recipients { position: static; max-height: none; }
  .compose .recipients .list { max-height: 420px; }
  .sectors-layout { grid-template-columns: 1fr; }
  .sector-list { position: static; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .only-mobile { display: inline-flex !important; }
  .main { padding: 0 16px 170px; }
  .toolbar { position: static; margin: 0 -16px; padding: 20px 16px 12px; }
  .toolbar::before { display: none; }
  .large-title { font-size: 28px; }
  .tabbar {
    display: flex; position: fixed; z-index: 40; bottom: 12px; left: 50%; transform: translateX(-50%);
    padding: 6px; border-radius: 999px; gap: 2px;
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    width: 80px; height: 52px; border-radius: 999px; color: var(--label); text-decoration: none; font-size: 10px; font-weight: 600;
  }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a[aria-current="page"] { color: var(--accent-text); background: var(--fill-3); }
  .actionbar { left: 12px; right: 12px; bottom: 84px; padding-left: 16px; }
  .actionbar .summary { font-size: 12px; }
  .actionbar .btn-test-label { display: none; }
  .sheet-backdrop { place-items: end center; padding: 8px; }
  .sheet { border-radius: 30px; }
  .row + .row::before { left: 98px; }
  .stats .stat .v { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
