:root {
  --brand-primary: #2563eb;
  --brand-secondary: #1e293b;
  --color-bg: #f4f5f7;
  --color-surface: #ffffff;
  --color-border: #e5e7eb;
  --color-text: #111827;
  --color-text-muted: #6b7280;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { color: var(--brand-secondary); line-height: 1.25; }
h1 { font-size: 1.75rem; margin: 0 0 1rem; }
h2 { font-size: 1.25rem; margin: 1.75rem 0 0.75rem; }

a { color: var(--brand-primary); }
a:hover { text-decoration: none; }

p.hint { color: var(--color-text-muted); font-size: 0.85rem; margin: 0.25rem 0 0; }

/* Header / nav */
.site-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 2rem;
  background: var(--brand-secondary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.site-header .brand { font-weight: 700; font-size: 1.1rem; }
.brand-link { color: #fff; text-decoration: none; display: flex; align-items: center; gap: 0.5rem; }
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; }
.site-header nav a, .site-header nav .link-button {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.925rem;
  transition: color 0.15s ease;
}
.site-header nav a:hover, .site-header nav .link-button:hover { color: #fff; }

/* Layout */
.container { max-width: 720px; margin: 2rem auto; padding: 0 1.25rem 3rem; }

/* Buttons */
.link-button { background: none; border: none; padding: 0; cursor: pointer; font: inherit; text-decoration: underline; color: inherit; }
.inline-form { display: inline; }

.btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  background: var(--brand-primary);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.05s ease;
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: translateY(1px); }
.btn-danger { background: #b91c1c; }

/* Flash messages */
.flashes { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.flash { padding: 0.7rem 1rem; margin-bottom: 0.5rem; border-radius: var(--radius); font-size: 0.925rem; }
.flash-success { background: #d1fae5; color: #065f46; }
.flash-error { background: #fee2e2; color: #991b1b; }

/* Forms */
form.stacked { display: flex; flex-direction: column; }
form.stacked label { margin-top: 1rem; font-weight: 600; font-size: 0.9rem; }
form.stacked label:first-child { margin-top: 0; }
form.stacked input[type=text], form.stacked input[type=email], form.stacked input[type=password],
form.stacked input[type=number] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  margin-top: 0.35rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
form.stacked input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 20%, transparent);
}
form.stacked button {
  margin-top: 1.5rem;
  align-self: flex-start;
  padding: 0.65rem 1.4rem;
  border: none;
  border-radius: 999px;
  background: var(--brand-primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
form.stacked button:hover { opacity: 0.9; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin: 1rem 0; background: var(--color-surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
table th, table td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--color-border); font-size: 0.925rem; }
table th { color: var(--color-text-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; background: #fafafa; }
table tbody tr:last-child td { border-bottom: none; }
table tbody tr:hover { background: #fafbfc; }

/* Cards */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.card h2:first-child { margin-top: 0; }

/* Badges */
.badge { display: inline-block; padding: 0.2rem 0.65rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: #e5e7eb; color: #374151; }
.badge-on { background: #d1fae5; color: #065f46; }
.badge-off { background: #fee2e2; color: #991b1b; }

.qr-code { display: block; margin: 1rem 0; }

@media (max-width: 640px) {
  .site-header { padding: 0.75rem 1.25rem; }
  .container { margin: 1.25rem auto; }
}
