/* ==========================================================
   Recursos v2: avisos (sino), desfazer, rascunho de resposta,
   atalhos, automações, agenda, planilhas, histórico, config.
   ========================================================== */

/* ---------- Sino de avisos ---------- */
.bell { position: relative; }
.bell__count {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center;
  border-radius: 9px; font-size: 11px; font-weight: 600;
  color: #fff; background: var(--danger); box-shadow: 0 0 0 2px var(--bg);
}
.bell__panel {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 40;
  width: min(420px, calc(100vw - 32px)); height: auto; max-height: 70vh;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  background: #0B1736;
}
.bell__panel .list { max-height: calc(70vh - 70px); }
.aviso { display: flex; align-items: flex-start; gap: 10px; padding: 10px 6px; border-bottom: 1px solid rgba(140, 180, 255, 0.08); }
.aviso--novo { background: rgba(var(--accent-rgb), 0.08); border-radius: 10px; }
.aviso__txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.aviso__txt b { font-weight: 500; }
.aviso__txt span { color: var(--text-2); overflow-wrap: anywhere; }
.aviso .pill { flex: none; }
@media (max-width: 680px) {
  .hide-sm { display: none; }
  .bell__panel { position: fixed; left: 16px; right: 16px; top: 70px; width: auto; }
}

/* ---------- Avisos com botão (Desfazer) ---------- */
.toast { display: flex; align-items: center; gap: 14px; pointer-events: auto; }
.toast span { flex: 1; }
.toast__btn {
  flex: none; padding: 6px 12px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--accent-light);
  background: rgba(var(--accent-rgb), 0.15); border: 1px solid rgba(var(--accent-rgb), 0.4);
}
.toast__btn:hover { background: rgba(var(--accent-rgb), 0.3); color: #fff; }

/* ---------- Utilitários ---------- */
.hint { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--text-muted); display: flex; gap: 6px; align-items: flex-start; }
.hint a { color: var(--accent-light); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.inline--between { justify-content: space-between; }
code { font-size: 12px; padding: 1px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.06); }

/* ---------- Rascunho de resposta ---------- */
.compose {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px; border-radius: 12px;
  background: rgba(var(--accent-rgb), 0.08); border: 1px solid rgba(var(--accent-rgb), 0.35);
}
.compose__instr { flex: 1 1 240px; }

/* ---------- Atalhos de teclado ---------- */
.fchip--key { margin-left: auto; }
.keys { height: auto; margin-top: 12px; flex-direction: row; flex-wrap: wrap; gap: 10px 22px; padding: 12px 16px; font-size: 13px; color: var(--text-2); }
kbd {
  display: inline-block; min-width: 22px; padding: 2px 7px; margin-right: 4px;
  border-radius: 6px; font: 600 12px/1.4 var(--font); text-align: center;
  color: var(--text-strong); background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(160, 195, 255, 0.25); border-bottom-width: 2px;
}
@media (pointer: coarse) { .fchip--key, .keys { display: none; } }

/* ---------- Automações ---------- */
.rules { gap: 10px; max-height: calc(100dvh / var(--zoom, 1) - 280px); }
.rule {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px; border-radius: 14px;
  background: var(--chip-bg); border: 1px solid var(--border-chip);
}
.rule--ativa { border-color: rgba(110, 231, 183, 0.3); }
.rule--revisar { border-color: rgba(255, 138, 138, 0.45); }
.rule--cancelada { opacity: .6; }
.rule__top { display: flex; align-items: flex-start; gap: 10px; }
.rule__top .pill { gap: 6px; }
.rule__pedido { font-size: 13px; color: var(--text-3); font-style: italic; line-height: 1.4; }
.rule__regra { margin: 0; display: flex; gap: 8px; align-items: flex-start; font-size: 14.5px; line-height: 1.4; }
.rule__regra svg { flex: none; margin-top: 3px; }
.rule__regra b { font-weight: 500; color: var(--text-strong); }
.rule__duvida { margin: 0; font-size: 13.5px; line-height: 1.45; color: #FFD2D2; }
.rule__info { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 13px; }
.rule__info dt { color: var(--text-muted); }
.rule__info dd { margin: 0; color: var(--text-2); overflow-wrap: anywhere; }
.rule__actions { display: flex; flex-wrap: wrap; gap: 6px; }
.editor { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.18); }
.days { display: flex; flex-wrap: wrap; gap: 4px; }
.day { position: relative; }
.day input { position: absolute; opacity: 0; pointer-events: none; }
.day span {
  display: inline-grid; place-items: center; min-width: 42px; height: 34px; padding: 0 8px;
  border-radius: 8px; font-size: 13px; cursor: pointer;
  color: var(--text-2); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border-chip);
}
.day input:checked + span { color: #fff; background: rgba(var(--accent-rgb), 0.8); border-color: transparent; }
.day input:focus-visible + span { outline: 2px solid var(--accent-light); outline-offset: 2px; }
.sim { padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, 0.18); font-size: 13px; }
.sim ul { margin: 6px 0 0; padding-left: 18px; color: var(--text-2); }
.caps { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; line-height: 1.45; color: var(--text-2); }

/* ---------- Agenda ---------- */
.agenda { height: auto; margin-top: 18px; gap: 4px; padding: 8px 18px 18px; }
.day-block { padding: 14px 0; border-bottom: 1px solid rgba(140, 180, 255, 0.08); }
.day-block:last-child { border-bottom: 0; }
.day-block__name { margin: 0 0 10px; font-size: 13px; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; color: var(--text-3); }
.day-block--hoje .day-block__name { color: var(--accent-light); }
.evs { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.ev {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 12px; border-radius: 12px;
  background: var(--chip-bg); border: 1px solid var(--border-chip); border-left: 3px solid rgba(var(--accent-rgb), 0.6);
}
.ev--agora { border-left-color: var(--success); background: rgba(110, 231, 183, 0.08); }
.ev--prox { border-left-color: var(--accent-light); background: rgba(var(--accent-rgb), 0.12); }
.ev--tentativo { border-left-style: dashed; }
.ev__hora { flex: none; width: 54px; display: flex; flex-direction: column; font-size: 15px; font-weight: 500; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.ev__hora small { font-size: 12px; font-weight: 400; color: var(--text-muted); }
.ev__info { flex: 1; min-width: 0; }
.ev__titulo { margin: 0; font-size: 14px; color: var(--text-strong); overflow-wrap: anywhere; }
.ev__meta { margin: 2px 0 0; font-size: 12.5px; color: var(--text-3); overflow-wrap: anywhere; }
.day-block__tasks { margin: 8px 0 0; font-size: 13px; color: var(--text-3); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.day-block__tasks a { color: var(--text-2); }

/* ---------- Planilhas ---------- */
.md--sheets { grid-template-columns: minmax(280px, 0.7fr) minmax(0, 1.6fr); }
.pl-path { flex: 1; min-width: 0; }
.sheet .detail__body { gap: 12px; }
.sheet__head { display: flex; flex-direction: column; gap: 8px; }
.kpis--sm { margin-top: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis--sm .stat__value { font-size: 24px; }
.table-wrap { flex: none; overflow: auto; border-radius: 10px; border: 1px solid rgba(140, 180, 255, 0.12); max-height: 280px; }
.table-wrap--prev { max-height: 420px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 7px 10px; text-align: left; white-space: nowrap; border-bottom: 1px solid rgba(140, 180, 255, 0.08); }
.tbl th { position: sticky; top: 0; z-index: 1; font-weight: 500; color: var(--text-strong); background: #12224A; }
.tbl td { color: var(--text-2); max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.tbl tbody tr:hover td { background: rgba(255, 255, 255, 0.03); }
.cols { display: flex; flex-wrap: wrap; gap: 6px; }
.colchip { padding: 4px 9px; border-radius: 8px; font-size: 12px; color: var(--text-2); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-chip); }
.colchip small { color: #FFD2D2; }
.colchip--vazio { border-color: rgba(255, 138, 138, 0.35); }

/* ---------- Histórico ---------- */
.hist-card { height: auto; margin-top: 14px; }
.hist-card .list { max-height: calc(100dvh / var(--zoom, 1) - 300px); gap: 0; }
.hist__dia { list-style: none; padding: 14px 4px 6px; font-size: 12px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.hist { display: flex; align-items: center; gap: 12px; padding: 9px 6px; border-bottom: 1px solid rgba(140, 180, 255, 0.07); font-size: 13.5px; }
.hist--erro { background: rgba(255, 110, 110, 0.06); }
.hist__hora { flex: none; width: 42px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.hist .pill { flex: none; }
.hist__txt { flex: 1; min-width: 0; color: var(--text-2); display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.hist__txt small { color: var(--danger); }
.hist__origem { flex: none; font-size: 12px; color: var(--text-muted); }

/* ---------- Configurações ---------- */
.cfg { height: auto; gap: 16px; }
.cfg .field { gap: 6px; }
.pastas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pastas label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-3); }

/* ---------- Responsivo ---------- */
@media (max-width: 900px) {
  .md--sheets { grid-template-columns: minmax(0, 1fr); }
  .rules, .hist-card .list { max-height: none; }
  .hist__origem { display: none; }
  .pastas { grid-template-columns: minmax(0, 1fr); }
}
/* Menu com 9 telas: em telas médias, compacta o topo */
@media (max-width: 1680px) and (min-width: 1181px) {
  .nav { gap: 18px; font-size: 14px; }
  .status__text { display: none; }
  .status { width: 36px; padding: 0; justify-content: center; }
}

/* Planilhas: campo de filtro não estica dentro da coluna */
.md__list > .search, .md__list > form { flex: none; }
