/* ============================================================
   COPIA E COLA SAAS – Design System
   Fonte: Sora (títulos) + DM Sans (corpo)
   Tema: Profissional/Utilitário com identidade verde-azulada
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=DM+Sans:ital,wght@0,400;0,500;0,600;1,400&display=swap');

/* ── TOKENS ─────────────────────────────────────────────────── */
:root {
  --primary:       #1d4ed8;
  --primary-light: #3b82f6;
  --primary-dark:  #1e3a8a;
  --primary-soft:  #eff6ff;
  --accent:        #06b6d4;
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --danger-soft:   #fef2f2;

  --bg:            #f8fafc;
  --surface:       #ffffff;
  --surface-2:     #f1f5f9;
  --border:        #e2e8f0;
  --border-strong: #cbd5e1;

  --text:          #0f172a;
  --text-muted:    #64748b;
  --text-faint:    #94a3b8;

  --radius:        12px;
  --radius-sm:     8px;
  --radius-lg:     16px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:     0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:     0 12px 40px rgba(0,0,0,.14);

  --font-display:  'Sora', sans-serif;
  --font-body:     'DM Sans', sans-serif;

  --sidebar-w:     240px;
  --header-h:      60px;
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

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

button { cursor: pointer; font-family: var(--font-body); }
input, select, textarea { font-family: var(--font-body); }

/* ── UTILITÁRIOS ────────────────────────────────────────────── */
.oculto { display: none !important; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex-1 { flex: 1; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .875rem; }
.font-600 { font-weight: 600; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }

/* ── BOTÕES ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 600; border: none;
  transition: all .18s ease; white-space: nowrap;
}
.btn-primary {
  background: var(--primary); color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-secondary {
  background: var(--surface); color: var(--text);
  border: 1.5px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-2); }

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

.btn-ghost {
  background: transparent; color: var(--text-muted);
  border: none; padding: 6px 10px;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-radius: var(--radius-sm); }

.btn-sm { padding: 5px 12px; font-size: .82rem; }
.btn-icon {
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 1rem;
  transition: all .15s;
}
.btn-icon:hover { background: var(--border); }
.btn-icon.danger:hover { background: var(--danger-soft); border-color: var(--danger); }

/* ── INPUTS ─────────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.input::placeholder { color: var(--text-faint); }

textarea.input { resize: vertical; min-height: 100px; line-height: 1.6; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.campo { margin-bottom: 16px; }
.campo label { display: block; font-size: .85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.campo-hint { font-size: .8rem; color: var(--text-faint); margin-top: 4px; }

/* ── SWITCH ─────────────────────────────────────────────────── */
.switch-label {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; font-size: .9rem; font-weight: 500; user-select: none;
}
.switch-input { display: none; }
.switch-track {
  width: 40px; height: 22px; background: var(--border-strong);
  border-radius: 99px; position: relative; transition: background .2s; flex-shrink: 0;
}
.switch-track::after {
  content: ''; position: absolute; width: 16px; height: 16px;
  background: #fff; border-radius: 50%; top: 3px; left: 3px;
  transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch-input:checked + .switch-track { background: var(--primary); }
.switch-input:checked + .switch-track::after { transform: translateX(18px); }

/* ── TAGS / BADGES ──────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 99px;
  font-size: .75rem; font-weight: 600; white-space: nowrap;
}
.tag-ativo    { background: #d1fae5; color: #065f46; }
.tag-inativo  { background: #fee2e2; color: #991b1b; }
.tag-pendente { background: #fef3c7; color: #92400e; }
.tag-aprovada { background: #d1fae5; color: #065f46; }
.tag-recusada { background: #fee2e2; color: #991b1b; }
.tag-cat      { background: #ede9fe; color: #5b21b6; }
.tag-imp      { background: #fff7ed; color: #c2410c; }
.tag-interno  { background: #fee2e2; color: #991b1b; }
.tag-info     { background: #dbeafe; color: #1e40af; }
.tag-alerta   { background: #fef3c7; color: #92400e; }
.tag-urgente  { background: #fee2e2; color: #991b1b; }
.tag-sucesso  { background: #d1fae5; color: #065f46; }

/* ── CARDS ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

/* ── MODAIS ─────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(4px);
}
.modal-box {
  position: relative; z-index: 1;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  animation: modalIn .2s ease;
}
.modal-box-lg { max-width: 820px; }
.modal-box-sm { max-width: 380px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-header h3 { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; }
.modal-body { padding: 20px 24px 24px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 0 24px 24px;
}
.btn-modal-close {
  background: none; border: none; font-size: 1.2rem;
  color: var(--text-muted); padding: 4px; border-radius: 6px;
}
.btn-modal-close:hover { background: var(--surface-2); color: var(--text); }

/* ── LISTA ITENS ────────────────────────────────────────────── */
.lista-itens { display: flex; flex-direction: column; gap: 10px; }
.item-lista {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  transition: box-shadow .2s;
}
.item-lista:hover { box-shadow: var(--shadow-md); }
.item-corpo { flex: 1; min-width: 0; }
.item-topo  { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 6px; }
.item-texto { margin: 0; color: var(--text-muted); font-size: .9rem; }
.item-acoes { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }

/* ── TOAST ──────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; align-items: center; gap: 10px;
  background: var(--text); color: #fff;
  padding: 12px 20px; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); font-size: .9rem; font-weight: 500;
  animation: toastIn .25s ease;
  max-width: 340px;
}
.toast.toast-erro  { background: var(--danger); }
.toast.toast-aviso { background: var(--warning); color: var(--text); }
@keyframes toastIn { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:none; } }

/* ── TELA DE LOGIN ──────────────────────────────────────────── */
.tela-login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 50%, #0369a1 100%);
  padding: 24px;
}
.login-box {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 40px 36px; width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg); text-align: center;
}
.login-logo { font-size: 2.5rem; margin-bottom: 8px; }
.login-titulo {
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 800;
  color: var(--text); margin-bottom: 4px;
}
.login-sub { color: var(--text-muted); font-size: .9rem; margin-bottom: 28px; }
.login-erro {
  background: var(--danger-soft); color: var(--danger);
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: .88rem; margin-bottom: 12px; text-align: left;
}
.senha-wrap { position: relative; }
.senha-wrap .input { padding-right: 42px; }
.btn-ver-senha {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; font-size: 1rem; color: var(--text-muted); padding: 4px;
}

/* ── SPINNER ────────────────────────────────────────────────── */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-wrap {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; padding: 60px 20px;
  color: var(--text-muted); font-size: .9rem;
}

/* ── VAZIO / ERRO ───────────────────────────────────────────── */
.estado-vazio, .estado-erro {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.estado-icone { font-size: 2.5rem; margin-bottom: 12px; }
.estado-titulo { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.estado-sub { font-size: .9rem; }

/* ── TABELAS ────────────────────────────────────────────────── */
.tabela-leituras { width: 100%; border-collapse: collapse; margin-top: 12px; }
.tabela-leituras th, .tabela-leituras td {
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--border); font-size: .9rem;
}
.tabela-leituras th { background: var(--surface-2); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }

/* ── MURAL DE AVISOS ────────────────────────────────────────── */
.mural { display: flex; flex-direction: column; gap: 8px; padding: 12px 20px; }
.aviso-banner {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: .9rem; line-height: 1.5;
}
.aviso-banner strong { font-weight: 700; }
.aviso-banner.info    { background: #dbeafe; border-left: 4px solid #3b82f6; color: #1e3a8a; }
.aviso-banner.alerta  { background: #fef3c7; border-left: 4px solid #f59e0b; color: #78350f; }
.aviso-banner.urgente { background: #fee2e2; border-left: 4px solid #ef4444; color: #7f1d1d; }
.aviso-banner.sucesso { background: #d1fae5; border-left: 4px solid #10b981; color: #064e3b; }

/* ── PREVIEW WHATSAPP ───────────────────────────────────────── */
.wa-preview {
  background: #e5ddd5 url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h200v200H0z' fill='%23e5ddd5'/%3E%3C/svg%3E");
  border-radius: var(--radius); padding: 16px; min-height: 200px;
}
.wa-topo {
  background: #075e54; color: #fff; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 10px 14px; display: flex; align-items: center; gap: 8px; font-size: .9rem;
  margin: -16px -16px 12px;
}
.wa-bolha {
  background: #fff; border-radius: 4px 12px 12px 12px;
  padding: 10px 14px; max-width: 85%; box-shadow: 0 1px 2px rgba(0,0,0,.1);
  font-size: .92rem; line-height: 1.6; white-space: pre-wrap;
}
.wa-meta { text-align: right; font-size: .72rem; color: #8e9eab; margin-top: 4px; }

/* ── RESPONSIVO ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .modal-box { margin: 0; border-radius: var(--radius) var(--radius) 0 0; max-height: 95vh; align-self: flex-end; }
  .modal { align-items: flex-end; padding: 0; }
  .login-box { padding: 28px 20px; }
}

/* ── LOGIN SUCESSO ───────────────────────────────────────────── */
.login-sucesso {
  background: #d1fae5; color: #065f46;
  border-radius: var(--radius-sm); padding: 12px 14px;
  font-size: .88rem; margin-bottom: 12px; line-height: 1.6;
}

/* ── BTN LINK TEXT ───────────────────────────────────────────── */
.btn-link-text {
  background: none; border: none; color: var(--primary);
  font-size: .88rem; cursor: pointer; padding: 0;
  text-decoration: underline; font-family: var(--font-body);
}
.btn-link-text:hover { color: var(--primary-dark); }

/* ── MODO ESCURO ─────────────────────────────────────────────── */
[data-tema="escuro"] {
  --bg:          #0f172a;
  --surface:     #1e293b;
  --surface-2:   #334155;
  --border:      #334155;
  --border-strong:#475569;
  --text:        #f1f5f9;
  --text-muted:  #94a3b8;
  --text-faint:  #64748b;
  --primary-soft:#1e3a8a;
}
[data-tema="escuro"] .msg-texto       { background: var(--surface-2); color: var(--text); }
[data-tema="escuro"] .aviso-banner.info    { background:#1e3a8a; color:#bfdbfe; }
[data-tema="escuro"] .aviso-banner.alerta  { background:#78350f; color:#fef3c7; }
[data-tema="escuro"] .aviso-banner.urgente { background:#7f1d1d; color:#fee2e2; }
[data-tema="escuro"] .aviso-banner.sucesso { background:#064e3b; color:#d1fae5; }
[data-tema="escuro"] .login-box       { background: var(--surface); }
[data-tema="escuro"] .tela-login      { background: linear-gradient(135deg,#020617 0%,#0f172a 60%,#0c1a2e 100%); }

/* ── HIGHLIGHT BUSCA ─────────────────────────────────────────── */
mark.busca-hl {
  background: #fef08a; color: #713f12;
  border-radius: 2px; padding: 0 2px;
}
[data-tema="escuro"] mark.busca-hl { background:#854d0e; color:#fef3c7; }

/* ── TAG FIXADA ──────────────────────────────────────────────── */
.tag-fixada { background:#f0fdf4; color:#166534; }
[data-tema="escuro"] .tag-fixada { background:#064e3b; color:#6ee7b7; }

/* ── RODAPÉ SUPERSAC ─────────────────────────────────────────── */
.supersac-footer {
  text-align: center;
  padding: 10px 20px;
  font-size: .75rem;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.supersac-footer a {
  color: var(--text-muted);
  font-weight: 500;
}
.supersac-footer a:hover { color: var(--primary); text-decoration: none; }

/* Rodapé nas telas de login */
.tela-login .supersac-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,.1);
  border: none;
  color: rgba(255,255,255,.5);
}
.tela-login .supersac-footer a { color: rgba(255,255,255,.7); }
