/* =========================================================
   Mail — folha de estilo
   Inspirado no layout do Gmail, porém mais leve e arejado.
   ========================================================= */

:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-2: #f2f6fc;
  --surface-3: #e9eef6;
  --text: #1f1f1f;
  --text-dim: #5f6368;
  --text-faint: #8b8f95;
  --border: #e3e6ec;
  --accent: #0b57d0;
  --accent-2: #1a73e8;
  --accent-soft: #d3e3fd;
  --hover: #f1f3f4;
  --selected: #d3e3fd;
  --danger: #d93025;
  --star: #f4b400;
  --ok: #1e8e3e;
  --shadow-1: 0 1px 2px rgba(60, 64, 67, .14), 0 1px 3px 1px rgba(60, 64, 67, .08);
  --shadow-2: 0 6px 18px rgba(60, 64, 67, .16), 0 2px 6px rgba(60, 64, 67, .10);
  --shadow-3: 0 16px 48px rgba(32, 33, 36, .24), 0 4px 12px rgba(32, 33, 36, .12);
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-pill: 999px;
  --sidebar-w: 256px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 64px;
}

[data-theme="dark"] {
  --bg: #101012;
  --surface: #1b1c1e;
  --surface-2: #232427;
  --surface-3: #2c2e31;
  --text: #e6e6e6;
  --text-dim: #a6a9ad;
  --text-faint: #7c8085;
  --border: #303236;
  --accent: #a8c7fa;
  --accent-2: #8ab4f8;
  --accent-soft: #0842a0;
  --hover: #27292c;
  --selected: #1f3a63;
  --danger: #f28b82;
  --star: #fdd663;
  --ok: #81c995;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-2: 0 8px 22px rgba(0, 0, 0, .55);
  --shadow-3: 0 18px 52px rgba(0, 0, 0, .68);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.sprite { display: none; }

.ic {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] { display: none !important; }
.hidden { display: none !important; }

::selection { background: var(--accent-soft); }

/* ---------- scrollbars ---------- */
*::-webkit-scrollbar { width: 12px; height: 12px; }
*::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text-faint) 40%, transparent);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--text-faint) 65%, transparent);
  background-clip: content-box;
}
*::-webkit-scrollbar-track { background: transparent; }

/* =========================================================
   BARRA DE PROGRESSO
   ========================================================= */
#progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 400;
  background: transparent;
  overflow: hidden;
  pointer-events: none;
}
#progress.on::after {
  content: "";
  display: block;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, transparent, var(--accent-2), var(--accent), transparent);
  animation: slide 1.1s ease-in-out infinite;
}
@keyframes slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* =========================================================
   BOTÕES BASE
   ========================================================= */
button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  color: var(--text-dim);
  transition: background .15s, color .15s;
  flex: 0 0 auto;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm .ic { width: 17px; height: 17px; }
.icon-btn.on { color: var(--accent); }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow-1);
  transition: filter .15s, transform .12s, box-shadow .15s;
}
[data-theme="dark"] .btn-primary { color: #062a63; }
.btn-primary:hover { filter: brightness(1.08); box-shadow: var(--shadow-2); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .55; cursor: default; box-shadow: none; }
.btn-primary.sm { height: 36px; padding: 0 18px; box-shadow: none; }

.btn-ghost {
  height: 40px;
  padding: 0 18px;
  border-radius: var(--r-pill);
  color: var(--text-dim);
  font-weight: 500;
  font-size: 13.5px;
  border: 1px solid var(--border);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-ghost .ic { width: 17px; height: 17px; flex: 0 0 auto; }
.btn-ghost.sm { height: 34px; padding: 0 16px; font-size: 13px; }
.btn-ghost.sm .ic { width: 15px; height: 15px; }

.link-btn {
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 6px;
}
.link-btn:hover { background: var(--hover); }

/* =========================================================
   TELA DE LOGIN
   ========================================================= */
.gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 620px at 15% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    radial-gradient(900px 520px at 110% 110%, color-mix(in srgb, #7b61ff 14%, transparent), transparent 60%),
    var(--bg);
  z-index: 300;
}

.gate-card {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 42px 40px 34px;
  box-shadow: var(--shadow-3);
  text-align: center;
  animation: rise .5s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(16px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.gate-logo {
  width: 68px;
  height: 68px;
  margin: 0 auto 22px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  color: #fff;
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 45%, transparent);
}
.gate-logo .ic { width: 32px; height: 32px; stroke-width: 1.8; }

.gate h1 {
  font-size: 23px;
  line-height: 1.28;
  font-weight: 700;
  letter-spacing: -.015em;
  margin: 0 0 10px;
}
.gate-sub {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0 0 28px;
  line-height: 1.55;
}
.gate .btn-primary { width: 100%; }
.gate .btn-ghost { width: 100%; margin-top: 10px; border-color: transparent; }
.gate-note {
  margin: 22px 0 0;
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.6;
}
.gate-diag {
  margin: 12px 0 0;
  font-size: 10.5px;
  color: var(--text-faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
  opacity: .85;
}
.gate-error {
  margin: 16px 0 0;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
  font-size: 12.5px;
  text-align: left;
  white-space: pre-wrap;
}

/* =========================================================
   APPBAR
   ========================================================= */
.app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px 0 10px;
  background: var(--bg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--text);
  padding: 0 8px 0 2px;
  white-space: nowrap;
  user-select: none;
}
.brand-ic { width: 22px; height: 22px; color: var(--accent); }

.search {
  flex: 1 1 auto;
  max-width: 720px;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px 0 8px;
  margin: 0 auto;
  background: var(--surface-3);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  transition: background .18s, border-color .18s, box-shadow .18s;
}
.search:focus-within {
  background: var(--surface);
  border-color: transparent;
  box-shadow: var(--shadow-2);
}
[data-theme="dark"] .search:focus-within { background: var(--surface-2); }
.search input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  outline: none;
}
.search input::placeholder { color: var(--text-faint); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

/* ---------- avatar / menu da conta ---------- */
.avatar-wrap { position: relative; }

.avatar {
  width: 36px;
  height: 36px;
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
  transition: box-shadow .15s, transform .12s;
  position: relative;
  overflow: hidden;
  padding: 0;
  user-select: none;
}
[data-theme="dark"] .avatar { background: var(--surface-2); color: var(--text-dim); }
.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar:hover { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.rp { width: 40px; height: 40px; font-size: 14px; flex: 0 0 auto; }

.menu-pop {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  padding: 8px;
  z-index: 200;
  animation: pop .16s ease-out both;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(-6px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
.menu-pop-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.menu-name { font-weight: 600; font-size: 14px; }
.menu-mail { font-size: 12px; color: var(--text-dim); word-break: break-all; }
.menu-pop button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  color: var(--text-dim);
  font-size: 13.5px;
  text-align: left;
}
.menu-pop button:hover { background: var(--hover); color: var(--text); }
.menu-pop button .ic { width: 17px; height: 17px; }

/* =========================================================
   CORPO: SIDEBAR + CONTEÚDO
   ========================================================= */
.shell {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  gap: 0;
  padding: 0 12px 0 0;
}

/* ---------- sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  padding: 4px 8px 10px 12px;
  transition: width .22s cubic-bezier(.4, 0, .2, 1);
  min-height: 0;
}

.compose-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 54px;
  height: 54px;
  padding: 0 16px;
  margin: 0 0 8px 0;
  border-radius: var(--r-lg);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 14.5px;
  transition: box-shadow .16s, filter .16s, transform .12s;
  white-space: nowrap;
  flex: 0 0 auto;
  overflow: hidden;
}
[data-theme="dark"] .compose-btn { color: var(--accent); }
.compose-btn:hover { box-shadow: var(--shadow-2); filter: brightness(1.03); }
.compose-btn:active { transform: scale(.985); }
.compose-btn .ic { width: 21px; height: 21px; flex: 0 0 auto; }
.compose-btn span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.rooms-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  height: 44px;
  padding: 0 16px;
  margin: 0 0 14px 0;
  border-radius: var(--r-pill);
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: background .15s, color .15s;
}
.rooms-btn:hover { background: var(--hover); color: var(--text); }
.rooms-btn .ic { width: 19px; height: 19px; flex: 0 0 auto; }

.folders {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  min-height: 0;
}

.folder {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 34px;
  padding: 0 12px 0 14px;
  margin-bottom: 1px;
  border-radius: var(--r-pill);
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  transition: background .14s, color .14s;
}
.folder:hover { background: var(--hover); color: var(--text); }
.folder .ic { width: 18px; height: 18px; }
.folder .label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
}
.folder .n {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-faint);
  padding-left: 6px;
  min-width: 18px;
  text-align: right;
}
.folder .n.hot {
  color: #fff;
  background: var(--accent);
  font-weight: 700;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  display: inline-grid;
  place-items: center;
  font-size: 11.5px;
  line-height: 1;
}
[data-theme="dark"] .folder .n.hot { color: #062a63; }
.folder.unread .label { font-weight: 700; color: var(--text); }
.folder .n.muted { color: var(--text-faint); font-weight: 500; opacity: .8; }
.folder.active .n { color: var(--accent); }
.folder.active .n.hot { color: #fff; }
[data-theme="dark"] .folder.active .n.hot { color: #062a63; }
.folder.active .n.muted { color: var(--text-dim); }
.folder.active {
  background: var(--selected);
  color: var(--text);
  font-weight: 700;
}
.folder.active .ic { color: var(--accent); }
.folder.unread .label { font-weight: 700; color: var(--text); }

.folder.sub .ic { width: 15px; height: 15px; opacity: .65; }
.folder.sub .label { font-size: 13px; }

.folder-sep {
  height: 1px;
  background: var(--border);
  margin: 12px 14px;
}

.folder-heading {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-faint);
  padding: 10px 16px 6px;
}

.sidebar-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 4px;
  font-size: 11.5px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  flex: 0 0 auto;
}
.dot.off { background: var(--danger); }

/* sidebar recolhida */
.app.collapsed .sidebar { width: var(--sidebar-w-collapsed); padding-right: 4px; }
.app.collapsed .compose-btn { padding: 0; justify-content: center; margin-left: 0; }
.app.collapsed .compose-btn span,
.app.collapsed .folder .label,
.app.collapsed .folder .n,
.app.collapsed .folder-heading,
.app.collapsed .sidebar-foot { display: none; }
.app.collapsed .folder { justify-content: center; padding: 0; }
.app.collapsed .folder-sep { margin: 12px 8px; }

/* =========================================================
   LISTA + LEITURA
   ========================================================= */
.content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  gap: 0;
  padding-bottom: 12px;
}

/* com o leitor aberto, a lista fica com 42% e o leitor com o resto */
.content:has(> .reading-pane:not([hidden])) > .list-pane { flex: 0 1 42%; }

.list-pane {
  flex: 1 1 auto;
  min-width: 330px;
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}

.list-head {
  flex: 0 0 auto;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 0 20px;
  border-bottom: 1px solid var(--border);
}
.list-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-head-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.count { font-size: 12px; color: var(--text-faint); }

.list-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  outline: none;
}

/* ---------- linha de mensagem ---------- */
.row {
  position: relative;
  display: grid;
  grid-template-columns: 24px 24px minmax(120px, 200px) 1fr 84px;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px 0 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  cursor: pointer;
  transition: box-shadow .12s;
  background: var(--surface);
}
.row:hover {
  box-shadow: inset 1px 0 0 var(--border), inset -1px 0 0 var(--border), 0 1px 3px rgba(0, 0, 0, .1);
  z-index: 2;
  border-bottom-color: transparent;
  background: var(--surface);
}
[data-theme="dark"] .row:hover { background: var(--hover); }

.row .star-btn {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text-faint);
  opacity: .9;
}
.row .star-btn:hover { background: var(--hover); color: var(--star); }
.row .star-btn .ic { width: 16px; height: 16px; }
.row .star-btn.on { color: var(--star); }
.row .star-btn.on .ic { fill: var(--star); stroke: var(--star); }

.row .dot-unread {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  justify-self: center;
  opacity: 0;
}
.row.unread .dot-unread { opacity: 1; }

.row .sender {
  font-size: 14px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row.unread .sender { font-weight: 700; }

.row .subject {
  font-size: 14px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.row.unread .subject { color: var(--text); font-weight: 600; }
.row .snippet { font-weight: 400; color: var(--text-dim); }

.row .side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}
.row.unread .side .date { font-weight: 700; color: var(--text); }
.row .clip { width: 15px; height: 15px; color: var(--text-faint); }

.row .quick {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.row:hover .quick { display: flex; }
.row:hover .side .date,
.row:hover .side .clip { visibility: hidden; }
[data-theme="dark"] .row .quick { background: var(--surface-2); }

.row.selected { background: var(--selected); }
.row.selected:hover { background: var(--selected); }
[data-theme="dark"] .row.selected,
[data-theme="dark"] .row.selected:hover { background: var(--selected); }

/* cursor de teclado (j/k) */
.row.cursor {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  z-index: 3;
}

.row .imp { color: var(--danger); }

/* ---------- estados ---------- */
.state {
  padding: 72px 24px;
  text-align: center;
  color: var(--text-dim);
}
.state .ic { width: 44px; height: 44px; color: var(--text-faint); opacity: .6; margin-bottom: 14px; stroke-width: 1.4; }
.state h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; color: var(--text); }
.state p { margin: 0; font-size: 13px; }

.skel {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.skel i {
  display: block;
  height: 9px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
}
.skel i:nth-child(1) { width: 120px; }
.skel i:nth-child(2) { flex: 1; }
.skel i:nth-child(3) { width: 44px; }
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -40% 0; }
}

.list-foot {
  display: grid;
  place-items: center;
  padding: 16px;
}

/* =========================================================
   PAINEL DE LEITURA
   ========================================================= */
.reading-pane {
  flex: 1 1 0;
  min-width: 380px;
  max-width: 62%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);  margin-left: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-1);
  animation: paneIn .22s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes paneIn {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: none; }
}

.rp-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px 6px 14px;
  border-bottom: 1px solid var(--border);
}
.rp-head .rp-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; }

.rp-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 22px 26px 40px;
  min-height: 0;
}

.rp-subject {
  margin: 0 0 18px;
  font-size: 21px;
  line-height: 1.32;
  font-weight: 600;
  letter-spacing: -.015em;
  word-break: break-word;
}

.rp-meta {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}
.rp-from { flex: 1 1 auto; min-width: 0; }
.rp-from .who {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.rp-from .who .addr { font-weight: 400; color: var(--text-dim); font-size: 12.5px; }
.rp-from .to {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 3px;
  word-break: break-word;
}
.rp-date { font-size: 12px; color: var(--text-faint); white-space: nowrap; padding-top: 2px; }

.badge {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-dim);
  letter-spacing: .01em;
}
.badge.warn { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

.rp-body {
  border: 0;
  width: 100%;
  min-height: 200px;
  display: block;
  background: transparent;
}

.attachments-box {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.attachments-box h4 {
  margin: 0 0 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
}
.att-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.att {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 240px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: 12.5px;
  color: var(--text);
  transition: background .14s, border-color .14s;
}
.att:hover { background: var(--hover); border-color: var(--accent-2); }
.att span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att small { color: var(--text-faint); flex: 0 0 auto; }

.rp-replybar {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.rp-replybar .btn-ghost {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
}
.rp-replybar .btn-ghost .ic { width: 16px; height: 16px; }

/* =========================================================
   COMPOSER FLUTUANTE
   ========================================================= */
.compose {
  position: fixed;
  right: 24px;
  bottom: 0;
  width: 540px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 90px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  box-shadow: var(--shadow-3);
  z-index: 250;
  animation: composeIn .2s cubic-bezier(.2, .8, .2, 1) both;
  overflow: hidden;
}
@keyframes composeIn {
  from { opacity: 0; transform: translateY(18px) scale(.99); }
  to   { opacity: 1; transform: none; }
}
.compose.min {
  height: 48px;
  overflow: hidden;
}
.compose.min .compose-fields,
.compose.min .compose-body,
.compose.min .compose-foot { display: none; }

.compose-head {
  flex: 0 0 auto;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  cursor: default;
}
.compose-title {
  font-size: 13.5px;
  font-weight: 600;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compose-head-actions { display: flex; gap: 2px; }

.compose-fields { flex: 0 0 auto; padding: 0 16px; }
.cfield {
  display: flex;
  align-items: center;
  height: 40px;
  border-bottom: 1px solid var(--border);
}
.cfield input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
}
.cfield input::placeholder { color: var(--text-faint); }
.cc-toggle-row { height: 30px; border-bottom: 0; justify-content: flex-end; }

.compose-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  min-height: 120px;
  word-break: break-word;
}
.compose-body:empty::before {
  content: attr(data-placeholder);
  color: var(--text-faint);
  pointer-events: none;
}
.compose-body blockquote {
  margin: 12px 0 0;
  padding-left: 12px;
  border-left: 2px solid var(--border);
  color: var(--text-dim);
}

.compose-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  min-height: 58px;
}
.compose-foot .spacer { margin-left: auto; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 4px 0 10px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  font-size: 12px;
  color: var(--text);
  max-width: 220px;
}
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; color: var(--text-dim); }
.chip button:hover { background: var(--hover); color: var(--text); }
.chip .ic { width: 12px; height: 12px; }

/* =========================================================
   TOAST
   ========================================================= */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(10px);
  padding: 12px 20px;
  border-radius: var(--r-pill);
  background: #202124;
  color: #f1f3f4;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-3);
  z-index: 500;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  max-width: min(520px, 90vw);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast.err { background: var(--danger); color: #fff; }

.toast-action {
  border: 0;
  background: transparent;
  color: #a8c7fa;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  flex: 0 0 auto;
}
.toast-action:hover { background: rgba(255, 255, 255, .12); }
.toast.err .toast-action { color: #fff; }

/* =========================================================
   RESPONSIVO
   ========================================================= */
@media (max-width: 1180px) {
  .row { grid-template-columns: 24px 24px minmax(100px, 150px) 1fr 76px; }
}

@media (max-width: 980px) {
  .reading-pane {
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    max-width: none;
    margin: 0;
    border-radius: 0;
    z-index: 150;
  }
  .content { padding-bottom: 0; }
  .list-pane { border-radius: 14px 14px 0 0; }
}

@media (max-width: 760px) {
  :root { --topbar-h: 58px; }
  .topbar { padding: 0 6px; }
  .brand span { display: none; }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    z-index: 180;
    background: var(--bg);
    box-shadow: var(--shadow-3);
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.4, 0, .2, 1);
    width: var(--sidebar-w);
  }
  .app.nav-open .sidebar { transform: none; }
  .shell { padding: 0; }
  .row {
    grid-template-columns: 26px 1fr auto;
    grid-template-areas:
      "star sender side"
      "star subject subject";
    grid-template-rows: auto auto;
    height: auto;
    min-height: 58px;
    padding: 7px 10px 7px 4px;
    row-gap: 1px;
  }
  .row .dot-unread { display: none; }
  .row .star-btn { grid-area: star; align-self: start; margin-top: 2px; }
  .row .sender { grid-area: sender; font-size: 13px; }
  .row .subject { grid-area: subject; font-size: 12.5px; }
  .row .side { grid-area: side; }
  .row .snippet { display: none; }
  .row:hover .side .date { visibility: visible; }
  .compose {
    right: 0;
    left: 0;
    bottom: 0;
    width: auto;
    max-width: none;
    height: calc(100vh - 60px);
    border-radius: 14px 14px 0 0;
  }
  .search { max-width: none; }
  .topbar-actions .icon-btn#btn-refresh { display: none; }
}

/* =========================================================
   GRUPOS DE PASTAS (recolhíveis)
   ========================================================= */
.fgroup { margin-bottom: 2px; }

.fgroup-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px 0 14px;
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  border-radius: var(--r-sm);
  transition: color .14s, background .14s;
}
.fgroup-head:hover { color: var(--text); background: var(--hover); }
.fgroup-head .chev {
  width: 14px;
  height: 14px;
  transition: transform .2s cubic-bezier(.4, 0, .2, 1);
  flex: 0 0 auto;
}
.fgroup.closed .fgroup-head .chev { transform: rotate(-90deg); }
.fgroup-head .cnt {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.fgroup-items {
  overflow: hidden;
  max-height: 800px;
  transition: max-height .24s cubic-bezier(.4, 0, .2, 1), opacity .18s;
  opacity: 1;
}
.fgroup.closed .fgroup-items { max-height: 0; opacity: 0; }

.app.collapsed .fgroup-head { justify-content: center; padding: 0; }
.app.collapsed .fgroup-head .fgroup-label,
.app.collapsed .fgroup-head .cnt,
.app.collapsed .fgroup-head .chev { display: none; }
.app.collapsed .rooms-btn span { display: none; }
.app.collapsed .rooms-btn { justify-content: center; padding: 0; }

/* =========================================================
   DESTAQUE DA BUSCA
   ========================================================= */
mark.hl {
  background: #ffd08a;
  color: #4a2c00;
  border-radius: 3px;
  padding: 0 1px;
  font-weight: 700;
}
[data-theme="dark"] mark.hl { background: #8a5a00; color: #ffe1b0; }

/* =========================================================
   CITAÇÃO E ASSINATURA NO COMPOSER
   ========================================================= */
.quote-block {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 13px;
  max-height: 220px;
  overflow-y: auto;
  user-select: text;
}
.quote-block .qhead {
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.sig-block {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 13px;
}
.sig-block img { max-width: 100%; height: auto; }

#c-top { min-height: 1.6em; outline: none; }

/* =========================================================
   MODAL
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 21, 24, .48);
  backdrop-filter: blur(2px);
  animation: fadeIn .16s ease-out both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: min(440px, 100%);
  max-height: min(86vh, 780px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-3);
  overflow: hidden;
  animation: modalIn .2s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.modal.wide { width: min(760px, 100%); }
.modal.ev-modal { width: min(980px, 100%); }

.modal-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 14px 14px 24px;
}
.modal-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.01em;
  flex: 1 1 auto;
}
.modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0 24px 4px;
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.6;
}
.modal-body p { margin: 0 0 12px; }
.modal-foot {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px 20px;
}
.modal-foot .btn-ghost:only-child { margin-right: auto; }

/* ---- assinatura ---- */
.modal.sig-modal { width: min(760px, 100%); }
.sig-lede { margin: 0 0 14px; font-size: 13px; color: var(--text-dim); }

.sig-builder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 18px;
  align-items: start;
}
.sig-form { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.sig-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.sig-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.sig-grid input {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  text-transform: none;
  letter-spacing: 0;
}
.sig-grid input:focus { outline: none; border-color: var(--accent-2); }
.sig-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sig-row-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-right: 2px;
}
.sig-inline-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.sig-inline-label select {
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

.sig-side { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.sig-side-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.sig-side-hint { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text-faint); font-size: 11.5px; }
.sig-preview {
  min-height: 168px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: #fff;
  color: #1f1f1f;
  overflow: auto;
  font-size: 13px;
}
[data-theme="dark"] .sig-preview { background: #fff; color: #1f1f1f; }
.sig-preview:empty::before { content: "A prévia aparece aqui conforme você preenche."; color: #8b8f95; font-size: 12.5px; }
.sig-preview img { max-width: 100%; height: auto; }
.sig-editor-wrap { margin-top: 4px; }
.sig-editor {
  min-height: 110px;
  max-height: 220px;
  overflow-y: auto;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  outline: none;
}
.sig-editor-full {
  min-height: 120px;
  max-height: none;
  overflow: visible;
  padding: 20px 22px;
  background: #fff;
  color: #1f2328;
  font-size: 13.5px;
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
.sig-editor:focus { border-color: var(--accent-2); }
.sig-editor:empty::before {
  content: "Sua assinatura aparece aqui.";
  color: var(--text-faint);
  font-family: inherit;
}
}
.sig-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  flex-wrap: wrap;
}
.sig-hint { font-size: 12px; color: var(--text-faint); }

/* amostras de assinatura puxadas das mensagens enviadas */
.sig-samples { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.sig-samples:empty { display: none; }
.sig-sample {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
}
.sig-sample-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}
.sig-sample-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sig-sample-body {
  padding: 10px 12px;
  max-height: 140px;
  overflow: auto;
  font-size: 13px;
  line-height: 1.5;
}
.sig-sample-body img { max-width: 100%; height: auto; }
.sig-sample-body img[src^="cid:"] { display: none; }
.sig-sample-empty {
  padding: 10px 2px;
  font-size: 12.5px;
  color: var(--text-faint);
}

/* ---- salas ---- */
.rooms-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: flex-end;
}
.rooms-field { display: flex; flex-direction: column; gap: 5px; }
.rooms-field label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-faint);
}
.rooms-field input, .rooms-field select {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
}
.rooms-field input:focus, .rooms-field select:focus { border-color: var(--accent-2); }
.rooms-field.grow { flex: 1 1 180px; }
.rooms-search { position: relative; flex: 1 1 100%; }
.rooms-search .ic {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--text-faint);
}
.rooms-search input { width: 100%; padding-left: 38px; }

.rooms-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.room {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color .14s, background .14s;
}
.room:hover { background: var(--surface-2); border-color: var(--accent-2); }

/* ---- detalhe da sala / agendamento ---- */
#room-detail { margin-top: 14px; }
.rd-card {
  border: 1px solid var(--accent-2);
  border-radius: var(--r-md);
  padding: 14px;
  background: var(--surface-2);
}
.rd-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.rd-title { font-size: 14.5px; font-weight: 600; color: var(--text); }
.rd-sub { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.rd-warn {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
  font-size: 12px;
}
.rd-fields { display: flex; flex-direction: column; gap: 8px; }
.rd-fields input {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
}
.rd-fields select {
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
}
.rd-fields select:focus { border-color: var(--accent-2); }
.rd-fields input:focus { border-color: var(--accent-2); }
.rd-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.room .r-ic {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--text-dim);
  flex: 0 0 auto;
}
.room .r-main { flex: 1 1 auto; min-width: 0; }
.room .r-name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room .r-sub { font-size: 11.5px; color: var(--text-faint); }
.room .r-status {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.room .r-status.free { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.room .r-status.busy { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.room .r-status.load { background: var(--surface-3); color: var(--text-faint); }
.room .r-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.rooms-empty { padding: 28px; text-align: center; color: var(--text-faint); font-size: 13px; }

@media (max-width: 760px) {
  .modal { width: 100%; max-height: 92vh; border-radius: 18px; }
  .modal.wide { width: 100%; }
  .modal-body { padding: 0 18px 4px; }
  .modal-head { padding: 16px 10px 12px 18px; }
  .rooms-form { gap: 8px; }
  .rooms-field.grow { flex: 1 1 100%; }
}

/* =========================================================
   SELEÇÃO EM MASSA
   ========================================================= */
.bulkbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 10px 8px 16px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
  animation: fadeIn .14s ease-out both;
}
[data-theme="dark"] .bulkbar { background: var(--selected); }
.bulkbar .spacer { margin-left: auto; }
.bulkbar .icon-btn:disabled { opacity: .35; cursor: default; }
.bulkbar .icon-btn:disabled:hover { background: none; color: var(--text-dim); }
.bulk-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  margin-right: 10px;
}
[data-theme="dark"] .bulk-count { color: var(--accent); }

.row .chk {
  width: 22px;
  height: 22px;
  display: none;
  place-items: center;
  border: 2px solid var(--text-faint);
  border-radius: 6px;
  color: transparent;
  justify-self: center;
  transition: background .12s, border-color .12s, color .12s;
}
.row .chk .ic { width: 13px; height: 13px; stroke-width: 3; }
.app.selecting .row .chk { display: grid; }
.app.selecting .row .star-btn { display: none; }
.app.selecting .row .quick { display: none !important; }
.app.selecting .row:hover .side .date { visibility: visible; }

.row.checked { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.row.checked .chk {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
[data-theme="dark"] .row.checked .chk { color: #062a63; }

/* =========================================================
   ETIQUETAS / SUGESTÕES DA VARREDURA
   ========================================================= */
.tag-add {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 32px;
  padding: 0 12px 0 14px;
  margin-top: 2px;
  border-radius: var(--r-pill);
  color: var(--text-faint);
  font-size: 13px;
  font-weight: 500;
  width: 100%;
  transition: background .14s, color .14s;
}
.tag-add:hover { background: var(--hover); color: var(--accent); }
.tag-add .ic { width: 16px; height: 16px; }

.scan-block { margin-bottom: 18px; }
.scan-block h4 {
  margin: 0 0 8px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-faint);
}
.scan-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--text);
}
.scan-item:hover { background: var(--surface-2); }
.scan-item .s-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scan-item .s-count { font-size: 12px; color: var(--text-faint); }
.scan-item button {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  flex: 0 0 auto;
}
.scan-item button:hover { background: var(--accent-soft); }

.pref-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--text-faint);
  cursor: pointer;
}
.pref-row input { margin-top: 2px; flex: 0 0 auto; }

/* =========================================================
   AUTOCOMPLETE DE DESTINATÁRIOS
   ========================================================= */
.ac-pop {
  position: fixed;
  z-index: 700;
  display: flex;
  flex-direction: column;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
  max-height: 260px;
  overflow-y: auto;
}
.ac-pop button {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.ac-pop button.on,
.ac-pop button:hover { background: var(--accent-soft); }
.ac-pop .ac-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-pop .ac-mail {
  font-size: 12px;
  color: var(--text-dim);
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================================
   PARTICIPANTES NA AGENDA
   ========================================================= */
.rooms-people {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 4px;
}
.people-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.p-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 3px 10px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
}
.p-chip button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 2px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: .75;
}
.p-chip button:hover { opacity: 1; background: color-mix(in srgb, var(--text) 12%, transparent); }
.p-chip .ic { width: 13px; height: 13px; }

.people-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.room.person .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--surface-3);
  flex: 0 0 auto;
}

/* =========================================================
   DETALHE DO EVENTO
   ========================================================= */
.ev-sheet { display: flex; flex-direction: column; gap: 18px; }

.ev-hero { display: flex; gap: 14px; align-items: flex-start; }
.ev-hero-badge {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
}
[data-theme="dark"] .ev-hero-badge { color: #a8c7fa; background: rgba(168, 199, 250, .16); }
.ev-hero-badge .ic { width: 22px; height: 22px; }
.ev-hero-main { min-width: 0; flex: 1 1 auto; }
.ev-kind {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.ev-hero h3 {
  margin: 2px 0 9px;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.015em;
  word-break: break-word;
}
.ev-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.ev-fact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.ev-fact .ic { width: 14px; height: 14px; flex: 0 0 auto; }

.ev-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(248px, .9fr);
  gap: 14px;
  align-items: start;
}
.ev-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}
.ev-card h4,
.ev-side h4 {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.ev-card h4:not(:first-child) { margin-top: 9px; }
.ev-side {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.ev-side h4 { color: var(--text); }

.ev-people { display: flex; flex-wrap: wrap; gap: 6px; }
.ev-group h5 {
  margin: 0 0 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.ev-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 4px 11px 4px 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
}
.ev-chip.block {
  display: flex;
  width: 100%;
  margin-bottom: 6px;
  border-radius: var(--r-md);
}
.ev-av {
  width: 26px;
  height: 26px;
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-3);
  color: var(--text-dim);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  user-select: none;
}
[data-theme="dark"] .ev-av { background: var(--surface-3); }
.ev-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ev-chip-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ev-chip-txt b {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ev-chip-txt small { font-size: 11px; color: var(--text-faint); }
.ev-chip.ok .ev-chip-txt small { color: var(--ok); }
.ev-chip.no .ev-chip-txt small { color: var(--danger); }
.ev-chip.maybe .ev-chip-txt small { color: var(--star); }

.ev-body { min-width: 0; }
.ev-body iframe {
  border: 0;
  width: 100%;
  min-height: 70px;
  display: block;
  background: transparent;
}

.ev-empty { font-size: 12.5px; color: var(--text-faint); }
.ev-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.ev-link .ic { width: 15px; height: 15px; }
.ev-link:hover { text-decoration: underline; }

@media (max-width: 860px) {
  .ev-cols { grid-template-columns: 1fr; }
  .ev-hero h3 { font-size: 17px; }
}

/* =========================================================
   CALENDÁRIO
   ========================================================= */
.cal-pane {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.cal-top {
  flex: 0 0 auto;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
}
.cal-title {
  margin: 0 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-top .spacer { flex: 1 1 auto; }
.app.cal-mode #btn-calendar {
  background: var(--selected);
  color: var(--text);
}
.app.cal-mode #btn-calendar .ic { color: var(--accent); }
.cal-seg {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: var(--r-pill);
}
.cal-seg button {
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 12.5px;
  padding: 5px 13px;
  border-radius: var(--r-pill);
  cursor: pointer;
}
.cal-seg button:hover { color: var(--text); }
.cal-seg button.on {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-1);
}

.cal-main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

.cal-weekhead {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
}
.cal-weekhead span {
  padding: 9px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.cal-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  overflow: hidden;
}
.cal-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
  padding: 6px 7px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
}
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell:nth-child(n+36) { border-bottom: 0; }
.cal-cell:hover { background: var(--hover); }
.cal-cell.out { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.cal-cell.out .cal-date { color: var(--text-faint); }
.cal-cell.today .cal-date {
  background: var(--accent);
  color: #fff;
}
.cal-cell.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-date {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  flex: 0 0 auto;
}
.cal-cell.today .cal-date { font-weight: 700; }
.cal-chip {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 4px;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  color: var(--text);
  font-size: 11.5px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-chip.all-day {
  border-left-color: var(--ok);
  background: color-mix(in srgb, var(--ok) 16%, transparent);
}
.cal-more {
  flex: 0 0 auto;
  padding-left: 7px;
  font-size: 11px;
  color: var(--text-dim);
}

.cal-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 20px 28px;
}
.cal-list:has(.cal-empty) { padding-top: 28px; }
.cal-empty { padding: 22px 4px; color: var(--text-dim); font-size: 13.5px; }
.cal-day h4 {
  margin: 0 0 8px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
}
.cal-event {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}
.cal-event + .cal-event { margin-top: 8px; }
.cal-time {
  flex: 0 0 auto;
  width: 96px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
}
.cal-event.all-day .cal-time { color: var(--text-dim); }
.cal-info { flex: 1 1 auto; min-width: 0; }
.cal-subject {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-meta {
  font-size: 12px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================================
   CONVERSAS
   ========================================================= */
.row .tcount {
  display: inline-block;
  margin: 0 5px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-dim);
}

.rp-thread { display: flex; flex-direction: column; }
.rp-msg {
  padding: 18px 0;
  border-top: 1px solid var(--border);
}
.rp-msg:first-child { border-top: 0; padding-top: 2px; }
.rp-msg:last-child { padding-bottom: 0; }
.rp-msg .rp-body { min-height: 120px; }
.rp-msg .rp-meta { margin-bottom: 14px; }

/* =========================================================
   DENSIDADE DA LISTA
   ========================================================= */
[data-density="comfortable"] .row {
  height: 56px;
}
[data-density="comfortable"] .row .subject {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 18px;
}
[data-density="comfortable"] .row .snippet { font-size: 12.5px; }

[data-density="compact"] .row {
  height: 34px;
  gap: 6px;
  padding: 0 12px 0 6px;
}
[data-density="compact"] .row .sender,
[data-density="compact"] .row .subject { font-size: 12.5px; }
[data-density="compact"] .row .side { font-size: 11.5px; }
[data-density="compact"] .row .star-btn { width: 22px; height: 22px; }

/* leitura em página inteira, como no Gmail (lista some até voltar) */
.content.reading-full > .list-pane { display: none; }
.content.reading-full > .reading-pane {
  flex: 1 1 100%;
  max-width: none;
  min-width: 0;
}

.avatar .ic { width: 19px; height: 19px; color: var(--text-faint); stroke-width: 1.7; }
.avatar.lg .ic { width: 22px; height: 22px; }
.ev-av .ic { width: 15px; height: 15px; color: var(--text-faint); stroke-width: 1.7; }
@container (max-width: 560px) {
  .row .snippet { display: none; }
  .row { grid-template-columns: 24px 24px minmax(90px, 32%) 1fr 72px; gap: 6px; }
}
[data-density="compact"] .list-head { padding-block: 10px; }
[data-density="compact"] .state { padding: 48px 24px; }

@media (max-width: 760px) {
  [data-density="comfortable"] .row { min-height: 72px; }
  [data-density="compact"] .row {
    min-height: 46px;
    padding: 4px 10px 4px 4px;
  }
  [data-density="compact"] .row .sender { font-size: 12.5px; }
  [data-density="compact"] .row .subject { font-size: 12px; }
}

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