/* ============================================================
   style.css — Task Performance
   Dark mode global — SEPTE / S7.DC Data Center do Brasil
   ============================================================ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-base:       #0d1117;
  --bg-surface:    #161b22;
  --bg-elevated:   #1c2128;
  --bg-hover:      #21262d;
  --border:        #30363d;
  --border-subtle: #21262d;

  --text-primary:  #e6edf3;
  --text-secondary:#8b949e;
  --text-muted:    #484f58;

  --accent:        #2d8cff;
  --accent-hover:  #58a6ff;
  --accent-glow:   rgba(45,140,255,.15);

  --green:         #3fb950;
  --green-bg:      #0f2a1a;
  --yellow:        #d29922;
  --yellow-bg:     #2a1f00;
  --red:           #f85149;
  --red-bg:        #2a0f0f;
  --orange:        #e67e22;

  --status-pendente: #f0ad4e;
  --status-andamento:#5bc0de;
  --status-contencao:#e67e22;
  --status-concluida:#3fb950;
  --status-atrasada: #f85149;

  --radius:        8px;
  --radius-sm:     4px;
  --shadow:        0 4px 16px rgba(0,0,0,.4);
  --shadow-sm:     0 2px 8px rgba(0,0,0,.3);

  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Cascadia Code', 'Fira Code', monospace;

  --sidebar-w:     280px;
  --topbar-h:      56px;
}

html, body {
  height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ── Tema Claro (White Mode) ──────────────────────────────── */
body.theme-light {
  --bg-base:       #f0f2f5;
  --bg-surface:    #ffffff;
  --bg-elevated:   #f8f9fb;
  --bg-hover:      #eef0f3;
  --border:        #d8dde5;
  --border-subtle: #e8ebf0;

  --text-primary:  #1a1d23;
  --text-secondary:#52596a;
  --text-muted:    #8a92a0;

  --accent:        #05466A;
  --accent-hover:  #0a6a9e;
  --accent-glow:   rgba(5,70,106,.12);

  --green:         #1a7a3c;
  --green-bg:      #e8f5ec;
  --yellow:        #a06a00;
  --yellow-bg:     #fff8e1;
  --red:           #c0392b;
  --red-bg:        #fdecea;
  --orange:        #c0600a;

  --shadow:        0 4px 16px rgba(0,0,0,.1);
  --shadow-sm:     0 2px 8px rgba(0,0,0,.06);
}

body.theme-light ::-webkit-scrollbar-track { background: #f0f2f5; }
body.theme-light ::-webkit-scrollbar-thumb { background: #c8cdd5; }

body.theme-light .sidebar { background: #ffffff; border-right-color: #e0e4ea; }
body.theme-light .topbar  { background: #ffffff; border-bottom-color: #e0e4ea; }
/* Logo S7.DC / SEPTE — inverte cores no tema claro */
body.theme-light .topbar-brand-s7dc   { color: #05466A !important; }
body.theme-light .topbar-brand-sep    { color: rgba(5,70,106,.55) !important; }
body.theme-light .topbar-brand-pipe   { color: rgba(5,70,106,.3) !important; }
body.theme-light .topbar-brand-tp     { color: rgba(5,70,106,.4) !important; }
body.theme-light .topbar-brand { color: var(--accent) !important; }
body.theme-light .topbar-brand span { color: var(--text-secondary) !important; }
/* Topbar buttons em tema claro */
body.theme-light #theme-toggle,
body.theme-light #notif-btn { color: #52596a !important; }
body.theme-light .topbar-user .nome { color: #1a1d23; }
body.theme-light .sidebar-item { color: var(--text-secondary); }
body.theme-light .sidebar-item:hover, body.theme-light .sidebar-item.active { background: #eef0f3; color: var(--accent); }
body.theme-light .card { background: #fff; border-color: #e0e4ea; }
body.theme-light .stat-card { background: #fff; border-color: #e0e4ea; }
body.theme-light .stat-card .label { color: var(--text-muted); }
body.theme-light .btn-ghost { background: transparent; border-color: #d0d5de; color: var(--text-secondary); }
body.theme-light .btn-ghost:hover { background: #eef0f3; }
body.theme-light .form-control { background: #fff; border-color: #d0d5de; color: var(--text-primary); }
body.theme-light .topbar-user .perfil-badge { background: rgba(5,70,106,.08); border-color: var(--accent); color: var(--accent); }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

input, textarea, select, button { font-family: inherit; font-size: inherit; }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Layout Principal ─────────────────────────────────────── */
.app-wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 1rem;
  z-index: 100;
}

.topbar-brand {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -.3px;
  white-space: nowrap;
}

.topbar-brand span { color: var(--text-secondary); font-weight: 400; }

.topbar-spacer { flex: 1; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: .6rem;
  cursor: pointer;
  padding: .3rem .6rem;
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.topbar-user:hover { background: var(--bg-hover); }

.topbar-user .nome { font-size: .85rem; color: var(--text-secondary); }
.topbar-user .perfil-badge {
  font-size: .7rem;
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 1px 6px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding-top: var(--topbar-h);
  overflow-y: auto;
}

.sidebar-section {
  padding: 1rem 1rem .5rem;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  overflow: visible;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem 1rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  margin: 1px .5rem;
  transition: background .15s, color .15s;
  cursor: pointer;
}
.sidebar-item:hover, .sidebar-item.active {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.sidebar-item.active { color: var(--accent); }
.sidebar-item .icon { width: 18px; text-align: center; font-size: 1rem; }
.sidebar-item .label { font-size: .875rem; }
.sidebar-item .badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

/* ── Sidebar compacta (modo ícones) ──────────────────────── */
.app-wrapper.sidebar-compact .sidebar { width: 56px; transition: width .2s ease; }
.app-wrapper.sidebar-compact .sidebar-section { display: none; }
.app-wrapper.sidebar-compact .sidebar-item { justify-content: center; padding: .55rem 0; margin: 1px 4px; position: relative; }
.app-wrapper.sidebar-compact .sidebar-item .label { display: none; }
.app-wrapper.sidebar-compact .sidebar-item .badge { position: absolute; top: 2px; right: 2px; }
.app-wrapper.sidebar-compact .sidebar-item:hover::after {
  content: attr(data-label);
  position: absolute;
  left: 60px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: .3rem .6rem;
  font-size: .8rem;
  white-space: nowrap;
  z-index: 999;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  pointer-events: none;
}
.app-wrapper.sidebar-compact #sidebar-toggle { justify-content: center; }

/* ── Conteúdo principal ───────────────────────────────────── */
.main-content {
  flex: 1;
  padding-top: var(--topbar-h);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.page-body {
  padding: 1.5rem;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.3px;
}

.page-subtitle {
  font-size: .9rem;
  color: var(--text-secondary);
  margin-top: .25rem;
}

/* ── Cards / Painéis ──────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.card-header {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border-subtle);
}

/* ── Botões ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary   { background: var(--accent);  color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-success   { background: #238636; color: #fff; }
.btn-success:hover { background: var(--green); }

.btn-danger    { background: #b91c1c; color: #fff; }
.btn-danger:hover { background: var(--red); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-lg { padding: .7rem 1.4rem; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Formulários ──────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: .4rem;
}

.form-control {
  width: 100%;
  padding: .55rem .8rem;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  transition: border-color .15s;
  outline: none;
}
.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--text-muted); }

textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }

.form-hint {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .3rem;
}

.form-row {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* ── Status badges ────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.status-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-pendente_aceite      { color: var(--status-pendente);  background: rgba(240,173,78,.1); }
.status-em_andamento         { color: var(--status-andamento); background: rgba(91,192,222,.1); }
.status-contencao            { color: var(--status-contencao); background: rgba(230,126,34,.1); }
.status-aguardando_aprovacao { color: #9b59b6; background: rgba(155,89,182,.1); }
.status-concluida            { color: var(--status-concluida); background: rgba(63,185,80,.1); }
.status-atrasada             { color: var(--status-atrasada);  background: rgba(248,81,73,.1); }

/* ── Lista de Tasks (estilo WhatsApp) ─────────────────────── */
.task-list { display: flex; flex-direction: column; }

.task-list-item {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background .15s;
  text-decoration: none;
  color: inherit;
}
.task-list-item:hover { background: var(--bg-hover); }
.task-list-item.atrasada { border-left: 3px solid var(--red); }
.task-list-item.contencao { border-left: 3px solid var(--orange); }

.task-list-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  overflow: hidden;
}
.task-list-avatar img { width: 100%; height: 100%; object-fit: cover; }

.task-list-body { flex: 1; min-width: 0; }

.task-list-titulo {
  font-size: .9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-list-preview {
  font-size: .78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.task-list-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .3rem;
  flex-shrink: 0;
}

.task-list-time {
  font-size: .72rem;
  color: var(--text-muted);
}

.task-list-icons {
  display: flex;
  gap: .3rem;
  align-items: center;
}

/* ── Conversa da Task ─────────────────────────────────────── */
.task-view {
  display: grid;
  grid-template-columns: 200px 1fr 280px;
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
}

/* Linha do tempo */
.timeline-panel {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1rem .6rem;
}

.timeline-item {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: .45rem;
  position: relative;
  padding-bottom: 1.25rem;
  cursor: pointer;
}
.timeline-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 32px;
  width: 2px;
  height: calc(100% - 32px);
  background: var(--border);
}

.timeline-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
  z-index: 1;
  transition: border-color .15s;
}
.timeline-item:hover .timeline-dot { border-color: var(--accent); }

.timeline-label {
  font-size: .65rem;
  color: var(--text-muted);
  text-align: left;
  padding-top: .35rem;
  line-height: 1.3;
}

/* ── Temas do Chat ─────────────────────────────────────────── */

/* Amoled — preto puro */
.chat-theme-amoled .chat-messages        { background: #000; }
.chat-theme-amoled .chat-header          { background: #0a0a0a; border-bottom-color: #1a1a1a; }
.chat-theme-amoled .chat-input           { background: #0a0a0a; border-top-color: #1a1a1a; }
.chat-theme-amoled .chat-input textarea  { background: #111; border-color: #222; }
.chat-theme-amoled .msg.recebida .msg-bubble { background: #1a1a1a; border-color: #222; }
.chat-theme-amoled .msg.sistema .msg-bubble  { color: #555; }

/* Light — estilo WhatsApp */
.chat-theme-light .chat-messages         { background: #e5ddd5; }
.chat-theme-light .chat-header           { background: #075e54; border-bottom-color: #064e45; }
.chat-theme-light .chat-header *         { color: #fff !important; }
.chat-theme-light .chat-header .status-badge { background: rgba(255,255,255,.15); }
.chat-theme-light .chat-input            { background: #f0f0f0; border-top-color: #ddd; }
.chat-theme-light .chat-input textarea   { background: #fff; border-color: #ddd; color: #111; }
.chat-theme-light .chat-input textarea::placeholder { color: #999; }
.chat-theme-light .msg.enviada .msg-bubble  { background: #dcf8c6; color: #111111; }
.chat-theme-light .msg.enviada .msg-bubble * { color: #111111; }
.chat-theme-light .msg.recebida .msg-bubble { background: #fff; color: #111111; border-color: #e0e0e0; }
.chat-theme-light .msg.sistema .msg-bubble  { color: #666; }
.chat-theme-light .msg-sistema-box          { color: #444; }
.chat-theme-light .msg-time                { color: #888; }
.chat-theme-light .msg.enviada .mencao     { color: #128c7e !important; font-weight:700; }
.chat-theme-light .msg.recebida .mencao    { color: #128c7e; font-weight:700; }
/* Hora da mensagem no tema WhatsApp */
.chat-theme-light .msg.enviada  .msg-time { color: #667781; }
.chat-theme-light .msg.recebida .msg-time { color: #8696a0; }
.chat-theme-light .msg-reply             { background: #f5f5f5; border-left-color: #25d366; }
.chat-theme-light .timeline-panel        { background: #f7f7f7; border-right-color: #ddd; }
.chat-theme-light .timeline-dot          { background: #fff; border-color: #ddd; }
.chat-theme-light .timeline-label        { color: #888; }
.chat-theme-light .ia-panel              { background: #f7f7f7; border-left-color: #ddd; }
.chat-theme-light .ia-panel *            { color: #333; }
.chat-theme-light .ia-panel .text-muted  { color: #888; }

/* Área de conversa */
.chat-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  padding: .75rem 1rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .75rem;
}

.chat-header-info { flex: 1; }
.chat-header-titulo { font-size: .95rem; font-weight: 600; }
.chat-header-meta { font-size: .75rem; color: var(--text-secondary); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

/* Balão de mensagem */
.msg {
  display: flex;
  flex-direction: column;
  max-width: 72%;
}
.msg.enviada { align-self: flex-end; align-items: flex-end; }
.msg.recebida { align-self: flex-start; align-items: flex-start; }
.msg.sistema { align-self: center; max-width: 90%; }

.msg-bubble {
  padding: .55rem .85rem;
  border-radius: var(--radius);
  font-size: .875rem;
  line-height: 1.45;
  word-break: break-word;
}
.msg.enviada  .msg-bubble { background: var(--accent);    color: #fff; border-bottom-right-radius: 2px; }
.msg.enviada  .msg-bubble .mencao { color: rgba(255,255,255,.85); font-weight:700; text-decoration:underline; text-underline-offset:2px; }
.msg.recebida .msg-bubble .mencao { color: var(--accent); font-weight:700; }
.msg.recebida .msg-bubble { background: var(--bg-elevated); border: 1px solid var(--border); border-bottom-left-radius: 2px; }

/* Bubble de imagem — sem fundo, sem padding extra */
.msg-bubble-img {
  background: transparent !important;
  padding: 4px !important;
  box-shadow: none !important;
  border: none !important;
}
.msg-bubble-img img {
  max-width: 280px;
  max-height: 320px;
  border-radius: 10px;
  cursor: zoom-in;
  display: block;
  border: 1px solid var(--border);
}
.msg.sistema  .msg-bubble {
  background: transparent;
  color: var(--text-muted);
  font-size: .78rem;
  font-style: italic;
  text-align: center;
  border: none;
  padding: .2rem .5rem;
}

.msg-reply {
  font-size: .75rem;
  color: var(--text-muted);
  padding: .3rem .6rem;
  border-left: 2px solid var(--accent);
  margin-bottom: .3rem;
  border-radius: 0 4px 4px 0;
  background: var(--bg-elevated);
  cursor: pointer;
}

.msg-time {
  font-size: .65rem;
  color: var(--text-muted);
  margin-top: .2rem;
  padding: 0 .2rem;
}

/* Áudio */
.msg-audio {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .8rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 200px;
}
.msg-audio .play-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.msg-audio .waveform {
  flex: 1;
  height: 28px;
  background: repeating-linear-gradient(
    90deg, var(--text-muted) 0px, var(--text-muted) 2px, transparent 2px, transparent 4px
  );
  border-radius: 2px;
  opacity: .5;
}
.msg-audio .duration { font-size: .72rem; color: var(--text-muted); }

/* Input de mensagem */
.chat-input {
  padding: .75rem 1rem;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  display: flex;
  gap: .6rem;
  align-items: flex-end;
}
.chat-input textarea {
  flex: 1;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: .6rem .8rem;
  resize: none;
  max-height: 120px;
  outline: none;
  line-height: 1.4;
}
.chat-input textarea:focus { border-color: var(--accent); }

/* Painel de resumo IA */
.ia-panel {
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ia-panel-title {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
}

.ia-resumo {
  font-size: .82rem;
  color: var(--text-secondary);
  line-height: 1.7;
  overflow-wrap: break-word;
  word-break: break-word;
  white-space: pre-line;
  overflow: hidden;
}

/* Dado sensível */
.dado-sensivel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .6rem .8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.dado-sensivel .chave { font-size: .78rem; color: var(--text-secondary); font-weight: 600; }
.dado-sensivel .valor { font-family: var(--font-mono); font-size: .82rem; letter-spacing: .5px; color: var(--text-primary); }
.dado-sensivel .valor.mascarado { color: var(--text-muted); }
.dado-sensivel .revelar-btn {
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  cursor: pointer;
  font-size: .78rem;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  font-weight: 600;
}
.dado-sensivel .revelar-btn:hover { background: var(--accent-glow); }
/* Tema claro */
body.theme-light .dado-sensivel { background: #f8f9fb; border-color: #d0d5de; }
body.theme-light .dado-sensivel .chave { color: #52596a; }
body.theme-light .dado-sensivel .valor { color: #1a1d23; }
body.theme-light .dado-sensivel .valor.mascarado { color: #8a92a0; }

/* ── Mensagens Sistema — Boxes coloridos ──────────────────── */
.msg-sistema-box {
  margin: .3rem auto;
  max-width: 90%;
  border-radius: var(--radius-sm);
  padding: .6rem 1rem;
  border-left: 3px solid var(--border);
  background: rgba(255,255,255,.04);
  text-align: left;
  font-size: .82rem;
  line-height: 1.5;
}
.msg-sistema-box.tipo-reuniao       { border-left-color: #e74c3c; background: rgba(231,76,60,.08); }
.msg-sistema-box.tipo-sensivel      { border-left-color: #2d8cff; background: rgba(45,140,255,.08); }
.msg-sistema-box.tipo-conclusao     { border-left-color: #3fb950; background: rgba(63,185,80,.08); }
.msg-sistema-box.tipo-elegba        { border-left-color: #9b59b6; background: rgba(155,89,182,.08); }
.msg-sistema-box.tipo-contencao     { border-left-color: #e67e22; background: rgba(230,126,34,.08); }
.msg-sistema-box.tipo-resumo-ia     { border-left-color: #6366F1; background: rgba(99,102,241,.07);
                                       font-size:.82rem; line-height:1.8; white-space:pre-line;
                                       overflow-wrap:break-word; word-break:break-word; }

body.theme-light .msg-sistema-box                { background: rgba(0,0,0,.03); border-left-color: #ccc; }
body.theme-light .msg-sistema-box.tipo-reuniao   { background: rgba(231,76,60,.06); }
body.theme-light .msg-sistema-box.tipo-sensivel  { background: rgba(45,140,255,.06); }
body.theme-light .msg-sistema-box.tipo-conclusao { background: rgba(63,185,80,.06); }
body.theme-light .msg-sistema-box.tipo-elegba    { background: rgba(155,89,182,.06); }
body.theme-light .msg-sistema-box.tipo-contencao { background: rgba(230,126,34,.06); }
body.theme-light .msg-sistema-box.tipo-resumo-ia { background: rgba(99,102,241,.05); }

/* ── Alertas / Mensagens de feedback ─────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.alert-success { background: var(--green-bg);  border: 1px solid #238636; color: var(--green); }
.alert-danger  { background: var(--red-bg);    border: 1px solid #f85149; color: var(--red); }
.alert-warning { background: var(--yellow-bg); border: 1px solid #d29922; color: var(--yellow); }
.alert-info    { background: var(--accent-glow); border: 1px solid var(--accent); color: var(--accent-hover); }

/* ── Tabelas ──────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
th {
  text-align: left;
  padding: .6rem .8rem;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
td {
  padding: .7rem .8rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
tr:hover td { background: var(--bg-hover); }

/* ── Avatar / Iniciais ────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: var(--accent);
  overflow: hidden;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg  { width: 48px; height: 48px; font-size: .9rem; }
.avatar.sm  { width: 28px; height: 28px; font-size: .65rem; }

/* ── Login ────────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: 1rem;
}

.login-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo h1 { font-size: 1.4rem; color: var(--accent); font-weight: 700; }
.login-logo p  { font-size: .8rem; color: var(--text-muted); margin-top: .3rem; }

/* ── Dashboard / Painel ───────────────────────────────────── */
.stats-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  transition: box-shadow .2s;
}
.stat-card:hover { box-shadow: var(--shadow-sm); }
.stat-card .label {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  margin-bottom: .6rem;
}
.stat-card .value {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -1px;
}
.stat-card .sub {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .3rem;
}
.stat-card.destaque { border-color: var(--accent); }
.stat-card.danger   { border-color: var(--red); }
.stat-card.warning  { border-color: var(--yellow); }
.stat-card.success  { border-color: var(--green); }

/* ── Gamificação / Ranking ────────────────────────────────── */
.ranking-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--border-subtle);
}
.ranking-pos {
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  width: 20px;
  text-align: center;
}
.ranking-pos.top1 { color: #f1c40f; }
.ranking-pos.top2 { color: #8b949e; }
.ranking-pos.top3 { color: #e67e22; }
.ranking-nome { flex: 1; font-size: .875rem; }
.ranking-pts  { font-size: .875rem; font-weight: 700; color: var(--accent); }

.badge-icon { font-size: 1.1rem; }

/* ── Prorrogação / Contenção ──────────────────────────────── */
.prorrogacao-badge {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  font-size: .7rem;
  color: var(--yellow);
  background: var(--yellow-bg);
  border: 1px solid var(--yellow);
  padding: 1px 6px;
  border-radius: 99px;
}

/* ── Dados sensíveis — card na criação ───────────────────── */
.ds-lista { display: flex; flex-direction: column; gap: .5rem; margin-top: .5rem; }
.ds-par {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: .5rem;
  align-items: center;
}

/* ── Responsivo básico ────────────────────────────────────── */
@media (max-width: 900px) {
  .task-view { grid-template-columns: 1fr; }
  .timeline-panel, .ia-panel { display: none; }
}

@media (max-width: 640px) {
  .sidebar { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Utilitários ──────────────────────────────────────────── */
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; }
.gap-sm       { gap: .5rem; }
.gap-md       { gap: 1rem; }
.mt-1         { margin-top: .5rem; }
.mt-2         { margin-top: 1rem; }
.mt-3         { margin-top: 1.5rem; }
.mb-1         { margin-bottom: .5rem; }
.mb-2         { margin-bottom: 1rem; }
.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: .8rem; }
.text-right   { text-align: right; }
.fw-600       { font-weight: 600; }
.w-full       { width: 100%; }
.hidden       { display: none !important; }
