:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #3d9cf5;
  --accent-hover: #5aadff;
  --success: #3dd68c;
  --warning: #f5b83d;
  --danger: #f55d5d;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(160deg, #0a0e14 0%, #121c2e 50%, #0f1419 100%);
  color: var(--text);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem;
}

@media (max-width: 480px) {
  .container {
    padding: 0.75rem;
  }

  header h1 {
    font-size: 1.5rem;
  }
}

header {
  text-align: center;
  margin-bottom: 0.75rem;
}

header h1 {
  margin: 0 0 0.25rem;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

header p {
  margin: 0;
  color: var(--muted);
}

header p.header-lead {
  font-size: 1.15rem;
  line-height: 1.45;
  margin-bottom: 1em;
}

.nav {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 0.75rem 0 1rem;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.nav a.active,
.nav a:hover {
  color: var(--accent);
}

.card-panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

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

input[type='email'],
input[type='text'],
input[type='search'] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: 16px;
  margin-bottom: 1rem;
}

button,
.btn {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  min-height: 44px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:hover,
.btn:hover {
  background: var(--accent-hover);
}

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

button.secondary,
.btn.secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

button.secondary:hover,
.btn.secondary:hover {
  background: #2d3d56;
}

button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(245, 93, 93, 0.4);
}

.actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.actions button,
.actions .btn {
  flex: 1 1 auto;
  min-width: min(100%, 140px);
}

.error {
  background: rgba(245, 93, 93, 0.15);
  border: 1px solid var(--danger);
  color: #ffb4b4;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.success {
  background: rgba(61, 214, 140, 0.12);
  border: 1px solid var(--success);
  color: #9ef0c5;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}

.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--success);
  font-size: 0.8rem;
  font-weight: 600;
}

.live-dot::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(61, 214, 140, 0.2);
}

.live-dot.offline {
  color: var(--warning);
}

.live-dot.offline::before {
  background: var(--warning);
  box-shadow: none;
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.item-card {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 0.75rem;
  align-items: center;
  background: var(--surface2);
  border-radius: 12px;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.item-card img,
.item-photo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: #0f1419;
  border-radius: 8px;
}

.item-photo.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.7rem;
  text-align: center;
  padding: 0.25rem;
}

.item-card h3 {
  margin: 0 0 0.15rem;
  font-size: 1rem;
}

.item-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.item-card .barcode {
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
}

.item-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.item-actions button {
  min-width: 88px;
  padding: 0.55rem 0.7rem;
}

.needs-lookup h3 {
  color: var(--warning);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
}

.session-row,
.member-row,
.scanner-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.site-footer {
  margin-top: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.site-footer a {
  color: var(--muted);
}

.undo-bar {
  position: sticky;
  bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--success);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-top: 1rem;
}

.add-form {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
