*, *::before, *::after { box-sizing: border-box; }

html { color-scheme: light; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.25rem;
  line-height: 1.5;
  color: #1f2937;
  background: #fff;
}

a { color: #2563eb; }
a:hover { color: #1d4ed8; }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}
header h1 { margin: 0; font-size: 1.4rem; }
header h1 a { text-decoration: none; color: inherit; }
.muted { color: #6b7280; font-weight: 400; }
.subtitle { color: #6b7280; margin-top: -0.25rem; }
.nowrap { white-space: nowrap; }

.card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}
.card h2 { margin-top: 0; }

h2 { font-size: 1.15rem; margin: 1.5rem 0 0.75rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 0.5rem; }

form label {
  display: block;
  margin-bottom: 0.85rem;
  font-weight: 600;
  font-size: 0.92rem;
}
form input[type="text"],
form input[type="password"],
form input[type="file"],
form input:not([type]),
form textarea {
  display: block;
  width: 100%;
  padding: 0.55rem 0.7rem;
  margin-top: 0.3rem;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  font-size: 1rem;
  font-family: inherit;
  font-weight: normal;
  background: #fff;
}
form textarea { min-height: 4rem; resize: vertical; }
form small { display: block; margin-top: 0.25rem; font-weight: 400; color: #6b7280; }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}
@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr; }
}

button, .btn {
  display: inline-block;
  padding: 0.55rem 1rem;
  border: 0;
  background: #2563eb;
  color: #fff;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.95rem;
  font-family: inherit;
  text-decoration: none;
  line-height: 1.2;
}
button:hover, .btn:hover { background: #1d4ed8; color: #fff; }

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

button.link {
  background: transparent;
  color: #2563eb;
  padding: 0;
  font-weight: 500;
}
button.link:hover { background: transparent; color: #1d4ed8; text-decoration: underline; }

.btn.secondary { background: #6b7280; }
.btn.secondary:hover { background: #4b5563; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  padding: 0.75rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: top;
}
th {
  background: #f3f4f6;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #4b5563;
}
.desc { font-size: 0.85rem; color: #6b7280; margin-top: 0.25rem; }
.actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  white-space: nowrap;
}
.actions form { display: inline; margin: 0; }

code {
  background: #eef2ff;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-size: 0.9em;
}

.msg, .err {
  padding: 0.75rem 1rem;
  border-radius: 5px;
  margin-bottom: 1rem;
  border: 1px solid;
}
.msg { background: #ecfdf5; color: #065f46; border-color: #6ee7b7; }
.err { background: #fef2f2; color: #991b1b; border-color: #fca5a5; }

.qr {
  display: block;
  max-width: 320px;
  width: 100%;
  height: auto;
  margin: 0.5rem 0 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  background: #fff;
}

body.login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  max-width: none;
  background: #f3f4f6;
}
body.login .card { width: 100%; max-width: 380px; }
body.login h1 { margin: 0 0 0.25rem; }
