:root {
  --bg: #0b1220;
  --surface: #131c2e;
  --surface2: #1a2740;
  --text: #e8eef7;
  --muted: #8fa3bf;
  --accent: #6366f1;
  --accent2: #22d3ee;
  --ok: #34d399;
  --danger: #f87171;
  --radius: 14px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --font: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, rgba(99, 102, 241, 0.25), transparent),
    radial-gradient(900px 500px at 100% 0%, rgba(34, 211, 238, 0.12), transparent),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  width: min(960px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0 1rem;
}

.brand {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-sub {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  border: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  color: #fff;
}

.btn-primary:hover { filter: brightness(1.08); text-decoration: none; }

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-danger {
  background: rgba(248, 113, 113, 0.15);
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.card {
  background: rgba(19, 28, 46, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
}

.hero {
  padding: 2rem 0 1rem;
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.15;
}

.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 42rem;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0.75rem 0 0.35rem;
  color: var(--muted);
}

input[type=text],
input[type=password],
textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--surface2);
  color: var(--text);
  font: inherit;
}

textarea { min-height: 120px; resize: vertical; }

.flash {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  margin: 0 0 1rem;
  font-size: 0.92rem;
}

.flash-ok {
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: #a7f3d0;
}

.flash-err {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: top;
}

th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  border-radius: 8px;
}

.muted { color: var(--muted); }

code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  word-break: break-all;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.login-card {
  width: min(420px, 100%);
}

.q-layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem 1rem;
}

.q-card {
  width: min(520px, 100%);
  text-align: center;
}

.q-title {
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  margin: 0 0 1rem;
  line-height: 1.25;
}

.qr-wrap {
  margin: 1rem auto 1.25rem;
  padding: 0.75rem;
  background: #fff;
  border-radius: 12px;
  display: inline-block;
}

.qr-wrap img {
  display: block;
  width: 220px;
  height: 220px;
}
.qr-wrap--large img {
  width: 300px;
  height: 300px;
}

.q-form { text-align: left; margin-top: 1rem; }

.cloud-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.cloud-head {
  padding: 0.85rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(11, 18, 32, 0.85);
  backdrop-filter: blur(8px);
}

.cloud-head h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.cloud-meta {
  font-size: 0.82rem;
  color: var(--muted);
}

.cloud-stage {
  flex: 1;
  position: relative;
  min-height: 60vh;
}

#cloudCanvas {
  width: 100%;
  height: calc(100vh - 72px);
  display: block;
}

.cloud-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  pointer-events: none;
}

.pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  margin-right: 0.35rem;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}

@media (max-width: 640px) {
  .site-head { flex-direction: column; align-items: flex-start; }
}
