/* ── Tokens ──────────────────────────────────────────── */
:root {
  --bg:        #0f1117;
  --bg-elev:   #13192a;
  --bg-card:   #161b27;
  --bg-input:  #1a1f2e;
  --bg-hover:  #1a2030;
  --border:    #1e2a3a;
  --border-2:  #2d3748;
  --text:      #e2e8f0;
  --muted:     #a0aec0;
  --muted-2:   #718096;
  --muted-3:   #4a5568;
  --accent:    #63b3ed;
  --accent-2:  #2b6cb0;
  --accent-3:  #3182ce;
  --green:     #68d391;
  --red:       #fc8181;
  --orange:    #f6ad55;
}

/* ── Reset ──────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: var(--bg); }
*::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted-3); }
* { scrollbar-width: thin; scrollbar-color: var(--border-2) var(--bg); }

body {
  font-family: 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header partilhado ─────────────────────────────── */
.app-header {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
}
.app-header .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-header h1 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header .nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.nav-link {
  font-size: .78rem;
  color: var(--accent);
  text-decoration: none;
  background: #1a2a3a;
  border: 1px solid #2b4a7a;
  border-radius: 5px;
  padding: 5px 12px;
  transition: background .15s;
}
.nav-link:hover { background: #1e3a50; }
.nav-link.active {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
}
.nav-sep {
  width: 1px; height: 18px; background: var(--border);
  display: inline-block; margin: 0 4px; align-self: center;
}
.nav-link-admin { color: #edb663; }
.nav-perfil { color: var(--muted-2); font-style: italic; }

/* Toasts — feedback visível das ações (sucesso/erro), canto superior direito */
#toasts {
  position: fixed; top: 16px; right: 16px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; max-width: 340px;
}
.toast {
  padding: 10px 14px; border-radius: 8px; font-size: .82rem;
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  animation: toast-in .18s ease-out;
}
.toast-ok   { border-left: 3px solid var(--green); }
.toast-erro { border-left: 3px solid var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.nav-logout { margin: 0; }
.nav-logout button {
  font-size: .78rem;
  color: var(--red);
  background: #2a1a1a;
  border: 1px solid #5a2a2a;
  border-radius: 5px;
  padding: 5px 12px;
  cursor: pointer;
  transition: background .15s;
}
.nav-logout button:hover { background: #3a1f1f; }
.last-update {
  font-size: .78rem;
  color: var(--muted-3);
  margin-left: 4px;
}

/* Botão "burger" mobile (visível só onde a view ativa) */
.btn-menu {
  display: none;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 5px;
  line-height: 1;
  flex-shrink: 0;
}
.btn-menu:hover { background: var(--border); color: var(--text); }

/* ── Botões base ────────────────────────────────────── */
.btn {
  background: var(--accent-2);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 7px 16px;
  font-size: .81rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s;
  white-space: nowrap;
}
.btn:hover { background: var(--accent-3); }
.btn:disabled { background: var(--border); color: var(--muted-3); cursor: not-allowed; }
.btn-ghost {
  background: var(--bg-input);
  border: 1px solid var(--border-2);
  color: var(--muted);
}
.btn-ghost:hover { background: var(--border); color: var(--text); border-color: var(--muted-3); }

/* ── Form fields ────────────────────────────────────── */
input[type=text], input[type=password], select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 7px 12px;
  font-size: .81rem;
  outline: none;
  transition: border-color .2s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted-3); }

.empty-msg {
  text-align: center;
  padding: 50px 20px;
  color: var(--border-2);
  font-size: .88rem;
}

/* ── Responsive header ─────────────────────────────── */
@media (max-width: 768px) {
  .app-header { padding: 10px 14px; gap: 8px; }
  .app-header h1 { font-size: .95rem; }
  .btn-menu.responsive { display: block; }
  .nav-link { font-size: .72rem; padding: 4px 8px; }
  .nav-logout button { font-size: .72rem; padding: 4px 8px; }
  .last-update { display: none; }
}
@media (max-width: 480px) {
  .app-header h1 { font-size: .88rem; }
  .app-header .nav-links { gap: 6px; }
}
