:root {
  --color-bg: #0F1B47;
  --color-bg-deep: #0A1336;
  --color-orange: #F5A623;
  --color-orange-bg: #8B4A0A;
  --color-red: #DC2626;
  --color-red-bg: #7A1414;
  --color-red-bg-deep: #4B0606;
  --color-text: #FFFFFF;
  --color-text-muted: rgba(255, 255, 255, 0.6);
  --color-success: #5DCAA5;
  --color-paused: #1F1F2E;
  --color-panel: #18213D;
  --color-panel-2: #1E2A4D;
  --color-border: rgba(255, 255, 255, 0.08);
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --font-stack: "Inter", "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-stack);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
}

a {
  color: var(--color-orange);
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  background: var(--color-panel-2);
  color: var(--color-text);
  transition: background 120ms, transform 80ms;
}

button:hover { background: #2a3a64; }
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

button.primary { background: var(--color-orange); color: #1a1300; }
button.primary:hover { background: #ffba3d; }
button.danger { background: var(--color-red); color: #fff; }
button.danger:hover { background: #ef3434; }
button.success { background: var(--color-success); color: #06251a; }
button.ghost { background: transparent; border: 1px solid var(--color-border); }

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-panel-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--color-orange);
}

label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.field { margin-bottom: 14px; }
.field > input,
.field > select,
.field > textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 0; }
.muted { color: var(--color-text-muted); font-size: 13px; }
.tabular { font-variant-numeric: tabular-nums; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--color-bg-deep);
  border-bottom: 1px solid var(--color-border);
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.02em;
}

.topbar .brand img {
  height: 32px;
  width: auto;
}

.topbar nav {
  display: flex;
  gap: 8px;
}

.topbar nav a {
  color: var(--color-text);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 14px;
}

.topbar nav a.active,
.topbar nav a:hover {
  background: var(--color-panel-2);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.card {
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 600;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 160ms, transform 160ms;
  pointer-events: none;
  z-index: 100;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: var(--color-red); }

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  font-weight: 600;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--color-panel-2);
}

.badge.green { background: rgba(93, 202, 165, 0.18); color: var(--color-success); }
.badge.orange { background: rgba(245, 166, 35, 0.2); color: var(--color-orange); }
.badge.red { background: rgba(220, 38, 38, 0.22); color: #ff8d8d; }
.badge.gray { background: rgba(255, 255, 255, 0.08); color: var(--color-text-muted); }

.empty {
  padding: 40px;
  text-align: center;
  color: var(--color-text-muted);
}

/* ==== Modal generico ==== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 120ms ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
.modal {
  width: min(560px, 92vw);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  background: var(--color-panel);
  animation: pop 160ms ease-out;
}
@keyframes pop {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-header {
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 18px;
  font-weight: 600;
}
.modal-header .modal-icon { font-size: 28px; }
.modal-body {
  padding: 24px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text);
}
.modal-body p { margin: 0 0 12px; }
.modal-body p:last-child { margin-bottom: 0; }
.modal-body strong { color: #ffb1b1; }
.modal-actions {
  padding: 16px 24px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.modal-actions button { padding: 10px 18px; }

/* Variante perigosa: header em vermelho chamativo */
.modal-danger {
  border: 2px solid var(--color-red);
  background: var(--color-bg);
}
.modal-danger .modal-header {
  background: var(--color-red);
  color: #fff;
  letter-spacing: 0.02em;
}
.modal-danger .modal-body {
  background: var(--color-bg);
}
.modal-danger .modal-actions {
  background: var(--color-panel);
  border-top: 1px solid var(--color-border);
}
