:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --ok-bg: #ecfdf5;
  --ok-text: #047857;
  --err-bg: #fef2f2;
  --err-text: #b91c1c;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  height: 3.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.topbar nav { display: flex; align-items: center; gap: 1rem; }
.topbar nav a { color: var(--muted); text-decoration: none; }
.topbar nav a.active, .topbar nav a:hover { color: var(--text); }

main { max-width: 60rem; margin: 2rem auto; padding: 0 1.25rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.5rem;
}
.auth-card { max-width: 24rem; margin: 3rem auto; }
.auth-card h1 { margin-top: 0; font-size: 1.3rem; }

label { display: block; margin: 0.9rem 0 0.25rem; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number], select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  background: var(--card);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.hint { color: var(--muted); font-size: 0.85rem; margin-top: 0.25rem; }

button, .btn {
  display: inline-block;
  margin-top: 1.1rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 7px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .btn:hover { background: var(--accent-dark); }
button.link {
  background: none;
  color: var(--muted);
  padding: 0;
  margin: 0;
  font-weight: 400;
}
button.link:hover { color: var(--text); background: none; }
form.inline { display: inline; }

.flash { padding: 0.7rem 1rem; border-radius: 8px; margin-bottom: 1.25rem; }
.flash-ok { background: var(--ok-bg); color: var(--ok-text); }
.flash-error { background: var(--err-bg); color: var(--err-text); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 0.85rem; }

.muted { color: var(--muted); }
h1 { font-size: 1.5rem; }

.status {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--line);
}
.status-running { background: var(--ok-bg); color: var(--ok-text); }
.status-stopped { background: var(--line); color: var(--muted); }
.status-provisioning, .status-deleting { background: #fef9c3; color: #a16207; }
.status-error { background: var(--err-bg); color: var(--err-text); }

button.danger { background: #dc2626; }
button.danger:hover { background: #b91c1c; }

[x-cloak] { display: none !important; }

.audit-success { background: var(--ok-bg); color: var(--ok-text); }
.audit-failure { background: var(--err-bg); color: var(--err-text); }
.audit-denied { background: #fef9c3; color: #a16207; }

.invoice-paid { background: var(--ok-bg); color: var(--ok-text); }
.invoice-unpaid { background: #fef9c3; color: #a16207; }
.invoice-overdue { background: var(--err-bg); color: var(--err-text); }
.invoice-void { background: var(--line); color: var(--muted); }

@media print {
  .topbar, .no-print, .flash { display: none !important; }
  body { background: #fff; }
  main { max-width: none; margin: 0; }
  .card { border: 0; padding: 0; }
}
