/* ── Reset & variáveis ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:       #f5f4f0;
  --surface:  #ffffff;
  --surface2: #f0efe9;
  --border:   #e4e2da;
  --border2:  #ccc9be;
  --accent-bg:#1a1a1a;
  --green:    #2d7a3a;
  --danger:   #c0392b;
  --danger-bg:#fdecea;
  --text:     #1a1a1a;
  --muted:    #6b6960;
  --muted2:   #a09d94;
  --sans:     'Geist', sans-serif;
  --mono:     'Geist Mono', monospace;
}

/* ── Base ──────────────────────────────────────────────────────────────── */
html, body { min-height: 100vh; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; }

/* ── Nav ───────────────────────────────────────────────────────────────── */
nav { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.nav-inner { max-width: 1100px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; height: 56px; }
.nav-brand { font-family: var(--mono); font-size: 13px; font-weight: 500; }
.nav-links { display: flex; gap: 4px; }
.nav-link { padding: 6px 14px; border-radius: 6px; font-size: 13px; color: var(--muted); text-decoration: none; transition: all .12s; }
.nav-link:hover { background: var(--surface2); color: var(--text); }
.nav-link.active { background: var(--accent-bg); color: #fff; }

/* ── Layout ────────────────────────────────────────────────────────────── */
.page { max-width: 1100px; margin: 0 auto; padding: 32px 24px 64px; position: relative; z-index: 1; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.page-title { font-size: 24px; font-weight: 500; letter-spacing: -.02em; }
.page-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.header-actions { display: flex; align-items: center; gap: 10px; }

/* ── Stats cards ───────────────────────────────────────────────────────── */
.stats { display: grid; gap: 12px; margin-bottom: 28px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; }
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.stat-value { font-family: var(--mono); font-size: 22px; font-weight: 500; }
.stat-value.green { color: var(--green); }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn { font-family: var(--sans); font-size: 13px; padding: 8px 16px; border-radius: 7px; border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer; transition: all .12s; }
.btn:hover { background: var(--surface2); color: var(--text); border-color: var(--border2); }
.btn-primary { background: var(--text); color: #fff; border-color: var(--text); }
.btn-primary:hover { background: #333; border-color: #333; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-danger { color: var(--danger); border-color: #f5c0bb; }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.btn-full { flex: 1; }
.refresh-btn { font-size: 12px; padding: 7px 14px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; transition: all .12s; font-family: var(--mono); }
.refresh-btn:hover { background: var(--surface2); color: var(--text); border-color: var(--border2); }
.refresh-btn:disabled { opacity: .5; cursor: default; }

/* ── Badge ─────────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 500; }

/* ── Toast ─────────────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--text); color: #fff; font-size: 13px; padding: 11px 18px; border-radius: 8px; z-index: 999; opacity: 0; transform: translateY(6px); transition: all .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--danger); }

/* ── Modal compartilhado ───────────────────────────────────────────────── */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.35); backdrop-filter: blur(3px); z-index: 200; align-items: flex-end; justify-content: center; }
.overlay.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px 16px 0 0; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: 0 -8px 40px rgba(0,0,0,0.12); animation: mIn .18s ease; }
@keyframes mIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.modal-head { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 15px; font-weight: 500; }
.modal-title small { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 6px; font-family: var(--mono); }
.x-btn { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; transition: all .12s; }
.x-btn:hover { background: var(--surface2); color: var(--text); }
.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label { font-size: 12px; font-weight: 500; color: var(--muted); }
label em { font-style: normal; color: var(--muted2); font-weight: 400; }
input, textarea { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-family: var(--sans); font-size: 14px; padding: 10px 13px; outline: none; width: 100%; transition: border-color .15s; }
input:focus, textarea:focus { border-color: var(--text); background: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--muted2); }
textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.modal-foot { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .page { padding: 16px 14px 48px; }
  .nav-inner { padding: 0 14px; }
  .nav-brand { font-size: 12px; }
  .nav-link { padding: 5px 10px; font-size: 12px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .header-actions { width: 100%; }
  .header-actions button, .header-actions .btn { flex: 1; font-size: 11px; padding: 8px 6px; }
  .page-title { font-size: 20px; }
  .stat-value { font-size: 18px; }
  .form-row { grid-template-columns: 1fr; }
  .modal-body { padding: 16px 18px; gap: 14px; }
  .modal-head { padding: 16px 18px 14px; }
  .modal-foot { padding: 12px 18px; }
  .btn-primary { width: 100%; }
}
