:root {
  --gradient-start: #00f0b5;
  --gradient-mid: #00b8e6;
  --gradient-end: #0047a0;
  --ambibox-lime: #c0d725;
  --ink: #1d1d1b;
  --bg: #f8f9fa;
  --card-bg: #fff;
  --text: #1d1d1b;
  --muted: #6b7280;
  --border: rgba(0, 0, 0, 0.1);
  --shadow: 4px 8px 16px 0 rgba(0, 0, 0, 0.07);
  --danger: #d64545;
  --fonts: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17191c;
    --card-bg: #23262a;
    --text: #f3f4f6;
    --muted: #9ca3af;
    --border: rgba(255, 255, 255, 0.1);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg);
  color: var(--text);
  font-family: var(--fonts);
}

.brand-gradient {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-mid) 55%, var(--gradient-end));
}

.topbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.topbar img {
  height: 28px;
}

.topbar .app-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--muted);
}

.topbar .user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

main {
  width: 100%;
  max-width: 480px;
  margin: 2rem auto;
  padding: 0 1rem;
  flex: 1;
}

.card {
  background: var(--card-bg);
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  padding: 1.75rem;
}

.card + .card {
  margin-top: 1.25rem;
}

h1 {
  font-size: 1.3rem;
  margin: 0 0 1.25rem;
}

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

input[type='text'],
input[type='date'],
input[type='email'],
input[type='password'],
select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

.field {
  margin-bottom: 1.1rem;
  position: relative;
}

.autocomplete-list {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
  position: absolute;
  z-index: 10;
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.autocomplete-list li {
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  font-size: 0.95rem;
}

.autocomplete-list li:hover {
  background: var(--bg);
}

.scan-row {
  display: flex;
  gap: 0.5rem;
}

.scan-row input {
  flex: 1;
}

button {
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  border-radius: 0.5rem;
  padding: 0.65rem 1rem;
}

button.primary {
  color: #fff;
  font-weight: 600;
  width: 100%;
}

button.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  white-space: nowrap;
}

button.link {
  background: none;
  color: var(--muted);
  padding: 0.3rem 0.5rem;
}

.message {
  margin-top: 1rem;
  font-size: 0.9rem;
  min-height: 1.2em;
}

.message.success {
  color: #0a8a4a;
  font-weight: 600;
}

.message.error {
  color: var(--danger);
  font-weight: 600;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: var(--card-bg);
  border-radius: 0.75rem;
  padding: 1.25rem;
  width: 90%;
  max-width: 420px;
}

.modal-content h2 {
  margin-top: 0;
  font-size: 1.05rem;
}

#reader {
  width: 100%;
}

.login-page main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
}

.login-page .card {
  width: 100%;
}

.login-logo {
  display: block;
  margin: 0 auto 1.5rem;
  max-width: 220px;
  height: auto;
}

.accent-lime {
  color: var(--ambibox-lime);
}
