/* =============================================
   V2 MÍDIA — shared.css
   CSS compartilhado por todos os módulos.
   Carregar ANTES do style.css de cada módulo:
   <link rel="stylesheet" href="../../shared.css" />
   <link rel="stylesheet" href="style.css" />
   ============================================= */

/* ═══════════════════════════════════════════
   TEMAS — Dark / Light / Auto
   ═══════════════════════════════════════════ */

:root,
[data-theme="dark"] {
  --bg:            #0e0f13;
  --bg-surface:    #16181f;
  --bg-card:       #1e2029;
  --bg-card-hover: #24273a;
  --border:        #2a2d3a;
  --border-md:     #353848;
  --text:          #e8eaf0;
  --text-dim:      #8b8fa8;
  --text-muted:    #6b7080;
  --accent:        #a78bfa;
  --accent-light:  #c4b5fd;
  --accent-dim:    rgba(167, 139, 250, 0.14);
  --green:         #4ade80;
  --green-dim:     #1a3a27;
  --blue:          #60a5fa;
  --blue-dim:      #0f2040;
  --yellow:        #fbbf24;
  --yellow-dim:    #3a2e0a;
  --red:           #f87171;
  --red-dim:       #3a1a1a;
  --purple:        #a78bfa;
  --purple-dim:    rgba(167, 139, 250, 0.14);
  --teal:          #2dd4bf;
  --teal-dim:      #0f2e2a;
  --orange:        #fb923c;
  --orange-dim:    #2e1a0a;
  --scrollbar:     #2a2d3e;
}

[data-theme="light"] {
  --bg:            #f0f1f5;
  --bg-surface:    #ffffff;
  --bg-card:       #ffffff;
  --bg-card-hover: #f5f6fa;
  --border:        rgba(0, 0, 0, 0.09);
  --border-md:     rgba(0, 0, 0, 0.14);
  --text:          #111218;
  --text-dim:      #4a4e68;
  --text-muted:    #9395a8;
  --accent:        #7c3aed;
  --accent-light:  #6d28d9;
  --accent-dim:    rgba(124, 58, 237, 0.10);
  --green:         #16a34a;
  --green-dim:     rgba(22, 163, 74, 0.10);
  --blue:          #0ea5e9;
  --blue-dim:      rgba(14, 165, 233, 0.10);
  --yellow:        #d97706;
  --yellow-dim:    rgba(217, 119, 6, 0.10);
  --red:           #ef4444;
  --red-dim:       rgba(239, 68, 68, 0.10);
  --purple:        #7c3aed;
  --purple-dim:    rgba(124, 58, 237, 0.10);
  --teal:          #0d9488;
  --teal-dim:      rgba(13, 148, 136, 0.10);
  --orange:        #ea6c0a;
  --orange-dim:    rgba(234, 108, 10, 0.10);
  --scrollbar:     #d1d3e0;
}

@media (prefers-color-scheme: light) {
  [data-theme="auto"] {
    --bg:            #f0f1f5;
    --bg-surface:    #ffffff;
    --bg-card:       #ffffff;
    --bg-card-hover: #f5f6fa;
    --border:        rgba(0, 0, 0, 0.09);
    --border-md:     rgba(0, 0, 0, 0.14);
    --text:          #111218;
    --text-dim:      #4a4e68;
    --text-muted:    #9395a8;
    --accent:        #7c3aed;
    --accent-light:  #6d28d9;
    --accent-dim:    rgba(124, 58, 237, 0.10);
    --green:         #16a34a;
    --green-dim:     rgba(22, 163, 74, 0.10);
    --blue:          #0ea5e9;
    --blue-dim:      rgba(14, 165, 233, 0.10);
    --yellow:        #d97706;
    --yellow-dim:    rgba(217, 119, 6, 0.10);
    --red:           #ef4444;
    --red-dim:       rgba(239, 68, 68, 0.10);
    --purple:        #7c3aed;
    --purple-dim:    rgba(124, 58, 237, 0.10);
    --teal:          #0d9488;
    --teal-dim:      rgba(13, 148, 136, 0.10);
    --orange:        #ea6c0a;
    --orange-dim:    rgba(234, 108, 10, 0.10);
    --scrollbar:     #d1d3e0;
  }
}
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --bg:            #0e0f13;
    --bg-surface:    #16181f;
    --bg-card:       #1e2029;
    --bg-card-hover: #24273a;
    --border:        #2a2d3a;
    --border-md:     #353848;
    --text:          #e8eaf0;
    --text-dim:      #8b8fa8;
    --text-muted:    #6b7080;
    --accent:        #a78bfa;
    --accent-light:  #c4b5fd;
    --accent-dim:    rgba(167, 139, 250, 0.14);
    --green:         #4ade80;
    --green-dim:     #1a3a27;
    --blue:          #60a5fa;
    --blue-dim:      #0f2040;
    --yellow:        #fbbf24;
    --yellow-dim:    #3a2e0a;
    --red:           #f87171;
    --red-dim:       #3a1a1a;
    --purple:        #a78bfa;
    --purple-dim:    rgba(167, 139, 250, 0.14);
    --teal:          #2dd4bf;
    --teal-dim:      #0f2e2a;
    --orange:        #fb923c;
    --orange-dim:    #2e1a0a;
    --scrollbar:     #2a2d3e;
  }
}

/* ─── DIMENSÕES E TIPOGRAFIA (invariáveis) ───── */
:root {
  --radius:    12px;
  --radius-sm: 8px;
  --font:      'IBM Plex Sans', sans-serif;
  --mono:      'IBM Plex Mono', monospace;
}

/* ─── ÍCONES (Font Awesome) ──────────────────── */
.fas, .far, .fab, .fa { color: var(--text-dim); }

/* ═══════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  transition: background-color 0.25s ease;
}

html, body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar       { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 99px; }

/* ═══════════════════════════════════════════
   TEMA — SINCRONIZAÇÃO COM O HUB
   Snippet JS a incluir no topo de cada script:

   (function(){
     var t = localStorage.getItem('v2_theme') || 'light';
     document.documentElement.setAttribute('data-theme', t);
   })();
   window.addEventListener('storage', function(e){
     if (e.key === 'v2_theme')
       document.documentElement.setAttribute('data-theme', e.newValue || 'light');
   });
   ═══════════════════════════════════════════ */

/* ═══════════════════════════════════════════
   BOTÕES
   ═══════════════════════════════════════════ */

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary:hover    { background: var(--accent-light); transform: translateY(-1px); }
.btn-primary:active   { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border-md);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn-ghost:hover { border-color: var(--border-md); color: var(--text); background: rgba(128,128,128,.06); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
  flex-shrink: 0;
}
.btn-icon:hover { background: rgba(128,128,128,.08); color: var(--text); border-color: var(--border-md); }
.btn-icon--danger:hover { background: var(--red-dim); color: var(--red); border-color: transparent; }

/* ═══════════════════════════════════════════
   FORMULÁRIOS
   ═══════════════════════════════════════════ */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* Input base — usado por módulos que aplicam seletor global */
.sh-input,
.sh-select,
.sh-textarea {
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  caret-color: var(--accent);
  width: 100%;
}
.sh-input:focus, .sh-select:focus, .sh-textarea:focus { border-color: var(--accent); }
.sh-input::placeholder, .sh-textarea::placeholder { color: var(--text-muted); }
.sh-textarea { resize: vertical; min-height: 72px; line-height: 1.5; }

/* ═══════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════ */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  color: var(--text);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 500;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.show    { opacity: 1; transform: translateY(0); }
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error   { border-color: var(--red);   color: var(--red);   }
.toast.info    { border-color: var(--blue);  color: var(--blue);  }

/* ═══════════════════════════════════════════
   MENSAGEM DE ERRO
   ═══════════════════════════════════════════ */

.msg-erro {
  background: var(--red-dim);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  gap: 14px;
}
.empty-state .empty-icon { font-size: 48px; line-height: 1; }
.empty-state h3 { font-size: 18px; font-weight: 700; color: var(--text); }
.empty-state p  { font-size: 13.5px; color: var(--text-dim); max-width: 360px; line-height: 1.6; }

/* ═══════════════════════════════════════════
   UTILITÁRIOS DE COR
   ═══════════════════════════════════════════ */

.text-green  { color: var(--green);  }
.text-blue   { color: var(--blue);   }
.text-yellow { color: var(--yellow); }
.text-red    { color: var(--red);    }
.text-orange { color: var(--orange); }
.text-teal   { color: var(--teal);   }
.text-purple { color: var(--purple); }
.text-accent { color: var(--accent); }
.text-muted  { color: var(--text-muted); }
.text-dim    { color: var(--text-dim); }

/* ═══════════════════════════════════════════
   TAGS SEMÂNTICAS
   ═══════════════════════════════════════════ */

.tag {
  font-family: var(--mono);
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 99px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 500;
  white-space: nowrap;
  display: inline-block;
}
.tag-fixed  { background: var(--green-dim);  color: var(--green);  }
.tag-var    { background: var(--yellow-dim); color: var(--yellow); }
.tag-annual { background: var(--blue-dim);   color: var(--blue);   }
.tag-pj     { background: var(--accent-dim); color: var(--accent); }
.tag-teal   { background: var(--teal-dim);   color: var(--teal);   }
.tag-orange { background: var(--orange-dim); color: var(--orange); }
.tag-red    { background: var(--red-dim);    color: var(--red);    }

/* ═══════════════════════════════════════════
   ALERTAS
   ═══════════════════════════════════════════ */

.sh-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.6;
}
.sh-alert .fas, .sh-alert .far { color: inherit; }
.sh-alert-ok   { background: var(--green-dim);  border: 1px solid var(--green);  color: var(--green);  }
.sh-alert-warn { background: var(--yellow-dim); border: 1px solid var(--yellow); color: var(--yellow); }
.sh-alert-red  { background: var(--red-dim);    border: 1px solid var(--red);    color: var(--red);    }
.sh-alert-info { background: var(--blue-dim);   border: 1px solid var(--blue);   color: var(--blue);   }

/* ═══════════════════════════════════════════
   BOTÃO ADICIONAR (dashed)
   ═══════════════════════════════════════════ */

.add-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  background: none;
  border: 1px dashed var(--border-md);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  cursor: pointer;
  width: 100%;
  margin-top: 12px;
  transition: color 0.15s, border-color 0.15s;
}
.add-btn:hover { color: var(--text); border-color: var(--accent); }
.add-btn .fas  { color: inherit; }

/* ═══════════════════════════════════════════
   BOTÃO PERIGO + MODIFICADOR PEQUENO
   ═══════════════════════════════════════════ */

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn-danger:hover  { background: #e95f5f; transform: translateY(-1px); }
.btn-danger:active { transform: scale(0.98); }

/* Modificador de tamanho — aplica em qualquer .btn-* */
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ═══════════════════════════════════════════
   TIPOGRAFIA UTILITÁRIA
   ═══════════════════════════════════════════ */

/* Valor numérico ou monetário em destaque */
.mono-value {
  font-family: var(--mono);
  font-weight: 600;
}

/* Rótulo de seção — uppercase mono pequeno */
.section-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}

/* ═══════════════════════════════════════════
   CARD PADRÃO
   ═══════════════════════════════════════════ */

.sh-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

/* ═══════════════════════════════════════════
   TABELA PADRÃO
   ═══════════════════════════════════════════ */

.sh-table {
  width: 100%;
  border-collapse: collapse;
}
.sh-table th {
  padding: 12px 16px;
  text-align: left;
  background: rgba(128, 128, 128, 0.04);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.sh-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text);
  vertical-align: middle;
}
.sh-table tbody tr:last-child td { border-bottom: none; }
.sh-table tbody tr:hover td      { background: rgba(128, 128, 128, 0.03); }
.sh-table .fas, .sh-table .far   { color: inherit; }

/* ═══════════════════════════════════════════
   BADGES DE STATUS (retangular)
   ═══════════════════════════════════════════ */

.sh-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}
.sh-badge .fas, .sh-badge .far { color: inherit; }

.sh-badge-green  { background: var(--green-dim);  color: var(--green);  }
.sh-badge-red    { background: var(--red-dim);    color: var(--red);    }
.sh-badge-yellow { background: var(--yellow-dim); color: var(--yellow); }
.sh-badge-blue   { background: var(--blue-dim);   color: var(--blue);   }
.sh-badge-orange { background: var(--orange-dim); color: var(--orange); }
.sh-badge-teal   { background: var(--teal-dim);   color: var(--teal);   }
.sh-badge-accent { background: var(--accent-dim); color: var(--accent); }

/* ═══════════════════════════════════════════
   MODAL PADRÃO
   ═══════════════════════════════════════════ */

.sh-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.sh-modal.open { display: flex; }

.sh-modal-content {
  background: var(--bg-card);
  padding: 32px;
  border-radius: 16px;
  width: 480px;
  max-width: 100%;
  border: 1px solid var(--border);
  max-height: 90vh;
  overflow-y: auto;
}

.sh-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
}

.sh-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

/* Modal de confirmação — centralizado com ícone */
.sh-modal-confirm {
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 32px 28px 28px;
}
.sh-modal-confirm p {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  max-width: 300px;
}

.sh-confirm-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.sh-confirm-icon--red    { background: var(--red-dim);    border: 1px solid rgba(248,113,113,0.25); color: var(--red);    }
.sh-confirm-icon--yellow { background: var(--yellow-dim); border: 1px solid rgba(251,191,36,0.25);  color: var(--yellow); }
.sh-confirm-icon--green  { background: var(--green-dim);  border: 1px solid rgba(74,222,128,0.25);  color: var(--green);  }

/* ═══════════════════════════════════════════
   BARRAS DE PROGRESSO
   ═══════════════════════════════════════════ */

.sh-progress {
  background: var(--bg-card-hover);
  border-radius: 99px;
  overflow: hidden;
}
.sh-progress--sm { height: 4px;  }
.sh-progress--md { height: 8px;  }
.sh-progress--lg { height: 10px; }

.sh-progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s ease;
  background: var(--accent);
}