:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
  background: #f3f4f6;
  --primary: #111827;
  --accent: #2563eb;
  --danger: #dc2626;
  --success: #059669;
  --warning: #d97706;
  --muted: #6b7280;
  --card: #ffffff;
  --border: #d1d5db;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 64px;
  padding: 10px 18px;
  background: #111827;
  color: white;
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: #fff; color: #111827; border-radius: 9px; font-size: 14px;
}
.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.container { width: min(1180px, calc(100% - 24px)); margin: 24px auto 60px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }

.btn {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 11px 15px;
  font-weight: 750;
  background: #e5e7eb;
  color: #111827;
}
.btn:hover { filter: brightness(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-light { background: white; color: #111827; }
.btn-small { padding: 8px 11px; font-size: 14px; }

.hero {
  padding: 22px;
  border-radius: 18px;
  background: linear-gradient(135deg, #111827, #1f2937);
  color: white;
  margin-bottom: 18px;
}
.hero h1 { margin: 0 0 8px; font-size: clamp(26px, 4vw, 42px); }
.hero p { margin: 0; max-width: 780px; color: #d1d5db; line-height: 1.5; }

.stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px,1fr));
  gap: 10px;
  margin: 18px 0;
}
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}
.stat strong { display: block; font-size: 28px; }
.stat span { color: var(--muted); font-size: 13px; }

.toolbar {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr auto;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 14px;
  margin-bottom: 14px;
}
.field { display: grid; gap: 6px; }
.field label { font-weight: 700; font-size: 14px; }
.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  background: white;
  color: #111827;
}
.textarea { min-height: 112px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: 3px solid rgba(37,99,235,.18); border-color: var(--accent); }

.issue-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 14px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 3px 12px rgba(17,24,39,.05);
}
.card-strip { height: 10px; }
.card-body { padding: 14px; }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.card h3 { margin: 0; font-size: 18px; }
.card p { line-height: 1.45; }
.card-meta { display: grid; gap: 6px; color: var(--muted); font-size: 13px; margin: 12px 0; }
.card-photo { width: 100%; aspect-ratio: 16/10; object-fit: cover; background: #e5e7eb; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
}
.badge-open { background: #fee2e2; color: #991b1b; }
.badge-in_progress { background: #dbeafe; color: #1e40af; }
.badge-ready { background: #fef3c7; color: #92400e; }
.badge-closed { background: #d1fae5; color: #065f46; }
.badge-reopened { background: #fce7f3; color: #9d174d; }
.badge-free { background: #e5e7eb; color: #374151; }

.tag-shell {
  max-width: 780px;
  margin: 0 auto;
}
.tag-banner {
  padding: 20px;
  border-radius: 18px 18px 0 0;
  border: 1px solid rgba(0,0,0,.12);
}
.tag-banner h1 { margin: 0; font-size: clamp(28px, 6vw, 52px); }
.tag-banner .tag-code { font-weight: 900; letter-spacing: .08em; margin-top: 6px; }
.tag-content {
  background: white;
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 18px 18px;
  padding: 20px;
}
.section { margin-top: 22px; }
.section h2 { margin: 0 0 12px; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
}
.detail {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
}
.detail span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.timeline { display: grid; gap: 12px; }
.timeline-item {
  border-left: 4px solid #d1d5db;
  background: #f9fafb;
  padding: 12px;
  border-radius: 0 12px 12px 0;
}
.timeline-item img { max-width: 100%; border-radius: 10px; margin-top: 10px; }
.timeline-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.timeline-item strong { color: #111827; }

.form-grid { display: grid; gap: 13px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.inline-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.help { font-size: 13px; color: var(--muted); line-height: 1.4; }
.photo-preview { max-width: 100%; max-height: 360px; border-radius: 12px; margin-top: 8px; }
.callout {
  border-radius: 12px;
  padding: 12px 14px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
}
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  background: white;
  border: 1px dashed var(--border);
  border-radius: 14px;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 100;
  background: #111827;
  color: white;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
  max-width: min(90vw, 540px);
}
.toast.error { background: #991b1b; }
.toast.success { background: #065f46; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(17,24,39,.6);
  display: grid; place-items: center;
  padding: 14px;
}
.modal {
  width: min(640px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: white;
  border-radius: 16px;
  position: relative;
  box-shadow: 0 22px 70px rgba(0,0,0,.35);
}
.modal-close {
  position: absolute; right: 12px; top: 10px;
  border: 0; background: #f3f4f6;
  border-radius: 50%; width: 38px; height: 38px;
  font-size: 24px; z-index: 2;
}
.modal-content { padding: 24px; }

.network {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 40;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
  color: white;
}
.network.offline { background: #b45309; }
.network.online { background: #047857; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(3,1fr); }
  .issue-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .toolbar { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .container { width: min(100% - 16px, 1180px); margin-top: 12px; }
  .topbar { padding: 8px 10px; }
  .top-actions .hide-mobile { display: none; }
  .stats { grid-template-columns: repeat(2,1fr); }
  .issue-grid { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr; }
  .detail-grid, .form-row { grid-template-columns: 1fr; }
  .tag-content { padding: 15px; }
}

.cached-banner {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
}
.batch-list { display: grid; gap: 8px; margin-bottom: 20px; }
.batch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 12px;
}
.modal-content h2 { margin: 22px 0 10px; }
.modal-content h2:first-child { margin-top: 0; }

.app-footer {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto 84px;
  padding: 14px 4px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}
.app-footer strong { color: #111827; }
.app-footer a { color: var(--accent); text-decoration: none; font-weight: 700; }
.app-footer a:hover { text-decoration: underline; }
.footer-sep { color: var(--border); }

/* ---- Indítóképernyő ---- */
.home {
  max-width: 640px;
  margin: 8vh auto 0;
  text-align: center;
}
.home-brand h1 { margin: 0 0 8px; font-size: clamp(28px, 6vw, 40px); }
.home-brand p { margin: 0 0 32px; color: var(--muted); line-height: 1.5; }
.home-choices { display: grid; gap: 14px; }
.choice {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 28px 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
  color: #111827;
  box-shadow: 0 3px 12px rgba(17,24,39,.05);
  transition: transform .12s ease, box-shadow .12s ease;
}
.choice:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(17,24,39,.1); }
.choice:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.choice-primary { background: var(--accent); color: white; border-color: var(--accent); }
.choice-icon { display: grid; place-items: center; margin-bottom: 4px; }
.choice strong { font-size: 19px; }
.choice-help { font-size: 14px; opacity: .75; }
.link-btn {
  margin-top: 22px;
  background: none;
  border: 0;
  color: var(--muted);
  text-decoration: underline;
  font-size: 14px;
}
.link-btn:hover { color: #111827; }

/* ---- Beolvasó ---- */
.scanner { max-width: 560px; margin: 0 auto; text-align: center; }
.scan-stage {
  position: relative;
  aspect-ratio: 1;
  max-height: 70vh;
  margin: 0 auto;
  border-radius: 18px;
  overflow: hidden;
  background: #111827;
  display: grid;
  place-items: center;
}
.scan-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.scan-frame {
  position: absolute;
  inset: 18%;
  border: 3px solid rgba(255,255,255,.9);
  border-radius: 14px;
  box-shadow: 0 0 0 100vmax rgba(17,24,39,.35);
  pointer-events: none;
}
.scan-stage.scan-error { background: #7f1d1d; }
.scan-stage.scan-error .scan-frame { display: none; }
.scan-hint {
  margin: 16px 0 12px;
  color: var(--muted);
  line-height: 1.5;
}
.scan-hint strong { color: #111827; }
.scan-actions { display: flex; justify-content: center; gap: 8px; }

@media (max-width: 620px) {
  .home { margin-top: 4vh; }
  .choice { padding: 22px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .choice { transition: none; }
  .choice:hover { transform: none; }
}
