/* Estilo das páginas próprias (login, conta, usuários), no visual do design Terra Mundi */
:root {
  --navy: #1E3264;
  --blue: #314E91;
  --orange: #EF4323;
  --bg: #f8f9fa;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: rgba(0, 0, 0, 0.08);
  --ok: #10b981;
  --err: #dc2626;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--navy); }
[hidden] { display: none !important; }

/* ---------- Login ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 20% -10%, rgba(49, 78, 145, 0.18), transparent 60%),
              radial-gradient(900px 500px at 110% 110%, rgba(239, 67, 35, 0.12), transparent 60%), var(--bg);
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 36px 32px; box-shadow: 0 20px 60px rgba(30, 50, 100, 0.12);
}
.auth-logo { display: block; height: 56px; margin: 0 auto 20px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--orange); margin: 0 0 4px; }
h1 { margin: 0 0 6px; font-size: 24px; font-weight: 800; color: #111827; }
.sub { margin: 0 0 24px; color: var(--muted); font-size: 14px; }

/* ---------- Formulários ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin: 0 0 6px; }
.field { margin-bottom: 16px; }
input, select {
  width: 100%; font: inherit; font-size: 14px; padding: 11px 12px; border: 1px solid #d1d5db; border-radius: 10px;
  background: #fff; color: var(--text); transition: border-color 150ms, box-shadow 150ms;
}
input:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(49, 78, 145, 0.15); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: 14px; font-weight: 600;
  padding: 11px 18px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; transition: all 200ms; white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-primary { background: linear-gradient(135deg, #EF4323 0%, #ff6b3d 100%); color: #fff; box-shadow: 0 4px 16px rgba(239, 67, 35, 0.28); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(239, 67, 35, 0.35); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover:not(:disabled) { background: var(--blue); }
.btn-ghost { background: #fff; border-color: var(--line); color: #374151; }
.btn-ghost:hover:not(:disabled) { background: #f3f4f6; }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--err); }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }

.alert { border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 16px; }
.alert-err { background: #fee2e2; color: #991b1b; }
.alert-ok { background: #d1fae5; color: #065f46; }

/* ---------- Páginas internas ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar img { height: 34px; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 13px; color: var(--muted); }
.topbar .who strong { color: var(--navy); }
.container { max-width: 960px; margin: 0 auto; padding: 28px 16px 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 24px; margin-bottom: 20px; }
.card h2 { margin: 0 0 4px; font-size: 18px; font-weight: 700; color: #111827; }
.card .sub { margin-bottom: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } .topbar { padding: 10px 16px; } .topbar .who { display: none; } }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; padding: 8px; border-bottom: 1px solid var(--line); }
td { padding: 10px 8px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table-wrap { overflow-x: auto; }
td select { width: auto; min-width: 170px; padding: 7px 10px; }

/* Telas estreitas (celular): cada usuário vira um cartão em vez de linha de tabela */
@media (max-width: 760px) {
  .rtable thead { display: none; }
  .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
  .rtable tr { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 12px; }
  .rtable td { border: none; padding: 6px 0; }
  .rtable td[data-label]::before {
    content: attr(data-label); display: block; font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--muted); margin-bottom: 2px;
  }
  td select { width: 100%; }
}
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #eef2fa; color: var(--blue); }
.badge.off { background: #f3f4f6; color: var(--muted); }
.badge.warn { background: #fee2e2; color: var(--err); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; word-break: break-all; background: #f3f4f6; padding: 8px 10px; border-radius: 8px; }

/* ---------- Fase 2: vencimentos e eventos ---------- */
.container.wide { max-width: 1180px; }
.topnav { display: flex; gap: 4px; margin-left: 8px; }
.topnav a { padding: 7px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; color: #4b5563; }
.topnav a:hover { background: #f3f4f6; color: var(--navy); }
.topnav a[aria-current="page"] { background: #eff6ff; color: var(--navy); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar select, .toolbar input { width: auto; min-width: 170px; }
.toolbar .spacer { flex: 1; }
textarea { width: 100%; font: inherit; font-size: 14px; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 10px; resize: vertical; }
textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(49, 78, 145, 0.15); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 4px 0 14px; }
.check input { width: auto; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; }
.stat strong { font-size: 26px; font-weight: 800; color: #111827; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat.warn strong { color: var(--err); }
.stat.alert strong { color: #ea580c; }
.stat.soon strong { color: #b45309; }
.badge.alert { background: #ffedd5; color: #c2410c; }
.badge.soon { background: #fef3c7; color: #92400e; }

dialog { border: none; border-radius: 18px; padding: 0; width: min(720px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(17, 24, 39, 0.25); }
dialog::backdrop { background: rgba(17, 24, 39, 0.45); }
dialog form { padding: 24px; }
dialog h2 { margin: 0 0 16px; font-size: 20px; }
.dlg-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.dlg-actions .spacer { flex: 1; }

.event-list { display: flex; flex-direction: column; gap: 10px; }
.event { display: flex; gap: 14px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.event-date { width: 58px; flex-shrink: 0; text-align: center; background: var(--navy); color: #fff; border-radius: 10px; padding: 6px 0; display: flex; flex-direction: column; }
.event-date strong { font-size: 20px; line-height: 1.1; }
.event-date span { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.85; }
.event-body { flex: 1; min-width: 0; }
.event-desc { margin: 6px 0 0; font-size: 14px; color: #374151; white-space: pre-wrap; }

@media (max-width: 760px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .topnav { display: none; }
  .toolbar select, .toolbar input { flex: 1 1 100%; }
}
