/* ==========================================================
   Módulos: cartão base + estilos de cada módulo
   ========================================================== */

/* ---------- Cartão base (vidro) ---------- */
.card {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: var(--r-card);
  color: var(--text);
  background: linear-gradient(180deg, var(--card-top) 0%, var(--card-bottom) 100%);
  border: 1px solid var(--border);
  box-shadow:
    inset 0 1px 0 var(--highlight),
    0 0 0 6px rgba(var(--accent-rgb), 0.05),
    0 24px 60px rgba(0, 0, 0, 0.35);
  contain: layout paint;   /* redesenhar um cartão não mexe no resto da página */
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.card__title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 17px;
  font-weight: 500;
}
.card__meta { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.card__meta b { font-weight: 500; }
.card__sub { margin: -6px 0 0; font-size: 12px; color: var(--text-3); }

.tone-danger { color: var(--danger) !important; }

/* ---------- Lista rolável (tarefas, e-mails, pedidos) ---------- */
.list {
  flex: 1;
  min-height: 0;
  margin: 0 -6px;
  padding: 0 6px;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(160, 195, 255, 0.25) transparent;
}
.list::-webkit-scrollbar { width: 6px; }
.list::-webkit-scrollbar-thumb { background: rgba(160, 195, 255, 0.25); border-radius: 3px; }

.empty { margin: 0; padding: 14px 4px; font-size: 14px; color: var(--text-3); text-align: center; }
.empty--box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.empty--box p { margin: 0; }

/* Etiquetas */
.pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(160, 195, 255, 0.16);
}
.pill--accent  { color: #CFE3FF; background: rgba(var(--accent-rgb), 0.22); border-color: rgba(var(--accent-rgb), 0.5); }
.pill--danger  { color: #FFD2D2; background: rgba(255, 110, 110, 0.16); border-color: rgba(255, 138, 138, 0.45); }
.pill--success { color: #C9F7E3; background: rgba(110, 231, 183, 0.12); border-color: rgba(110, 231, 183, 0.4); }
.pill--muted   { color: var(--text-muted); background: transparent; }

/* ---------- Tarefas ---------- */
.task {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 4px 10px 4px 4px;
  border-radius: 12px;
  background: var(--chip-bg);
  border: 1px solid var(--border-chip);
  transition: background .15s;
}
.task:hover { background: rgba(255, 255, 255, 0.08); }
.task__label {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  cursor: pointer;
}
.task__check {
  flex: none;
  width: 20px; height: 20px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.task__text {
  min-width: 0;
  font-size: 14px;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.task--done .task__text { color: var(--text-muted); text-decoration: line-through; }

/* ---------- E-mails ---------- */
.mail {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--chip-bg);
  border: 1px solid var(--border-chip);
}
.mail__top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mail__from {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail__due { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--accent-light); }
.mail__subject {
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail__text {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-2);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.mail__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.resolved {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(140, 180, 255, 0.12);
  font-size: 13px;
  color: var(--text-2);
}
.resolved small { color: var(--text-muted); font-size: 12px; }

/* Botões pequenos dentro dos cartões */
.mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 500;
  color: #fff;
  background: rgba(var(--accent-rgb), 0.85);
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: filter .15s;
}
.mini:hover:not(:disabled) { filter: brightness(1.12); }
.mini--ghost { color: var(--text); background: rgba(255, 255, 255, 0.05); border-color: var(--border); }

.spin {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid rgba(var(--accent-rgb), 0.3);
  border-top-color: var(--accent-light);
  animation: atlas-spin .8s linear infinite;
}

/* ---------- Automações ---------- */
.flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}
.flow__step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 12px;
  padding: 5px 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(160, 195, 255, 0.2);
}
.flow__step span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow__step--pending { color: var(--text-muted); background: transparent; border-style: dashed; }
.flow__arrow { color: var(--accent); font-size: 13px; }

.list--compact { gap: 4px; }
.auto {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
  background: var(--chip-bg);
  border: 1px solid var(--border-chip);
}
.auto svg { flex: none; }
.auto__text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Campo de envio (tarefa nova / automação) ---------- */
.prompt {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 5px 5px 14px;
  border-radius: var(--r-ctl);
  background: var(--input-bg);
  border: 1px solid rgba(160, 195, 255, 0.22);
  transition: border-color .2s, box-shadow .2s;
}
.prompt:focus-within {
  border-color: rgba(var(--accent-rgb), 0.7);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.prompt__input {
  flex: 1;
  min-width: 0;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--text-strong);
  font-size: 14px;
}
.prompt__input::placeholder { color: var(--text-muted); }
.prompt__input:focus, .prompt__select:focus { outline: none; }
.prompt__select {
  flex: none;
  height: 34px;
  max-width: 108px;
  padding: 0 6px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-chip);
}
.prompt__select option { color: #0B1530; }
.prompt__send {
  width: 36px; height: 36px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  color: #fff;
  background: var(--accent);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 16px var(--accent-glow);
}

/* ---------- Gráfico (produtividade) ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #D6E4FF;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(160, 195, 255, 0.2);
}
.badge--up svg { color: var(--success); }
.badge--down svg { color: var(--danger); }

.chart {
  flex: 1;
  display: flex;
  gap: 10px;
  min-height: 150px;
}
.chart__axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 0 20px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}
.chart__bars {
  flex: 1;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: clamp(6px, 1.2vw, 12px);
  align-items: end;
}
.chart__col {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
}
.chart__value { height: 16px; font-size: 11px; color: var(--text-3); text-align: center; }
.chart__bar {
  height: calc((100% - 40px) * var(--h, 0));
  min-height: 4px;
  border-radius: 7px 7px 4px 4px;
  background: linear-gradient(180deg, rgba(150, 200, 255, 0.85) 0%, rgba(var(--accent-rgb), 0.55) 100%);
  border: 1px solid rgba(190, 220, 255, 0.3);
  transform-origin: bottom;
  animation: atlas-grow .9s cubic-bezier(.2, .8, .2, 1) both;
}
.chart__bar--hot {
  background: linear-gradient(180deg, #BFDDFF 0%, rgba(var(--accent-rgb), 0.95) 100%);
  border-color: rgba(190, 220, 255, 0.6);
  box-shadow: 0 0 18px rgba(var(--accent-rgb), 0.7);
}
.chart__label { height: 16px; font-size: 11px; color: var(--text-3); text-align: center; }

@keyframes atlas-grow {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}

/* ---------- Celular ---------- */
@media (pointer: fine) {
  .mail__actions .mini { min-height: 30px; }
}

@media (max-width: 680px) {
  .card { padding: 16px; }
  .list { max-height: 380px; }
  .chart { min-height: 180px; }
  .prompt__input { font-size: 16px; }   /* evita o zoom automático do iPhone */
  .mini { min-height: 38px; }
}

/* Telas de toque: ações sempre grandes o bastante */
@media (pointer: coarse) {
  .task__check { width: 22px; height: 22px; }
  .mini { min-height: 40px; padding: 0 14px; }
}
