:root {
  --bg: #14081f;
  --bg-elev: #1f102e;
  --card: #2a163d;
  --card-2: #351c4c;
  --line: rgba(245, 208, 254, 0.14);
  --text: #f8f0ff;
  --muted: #c4b5fd;
  --purple: #8b5cf6;
  --pink: #ec4899;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Vazirmatn", "Tahoma", system-ui, sans-serif;
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(236, 72, 153, 0.18), transparent 50%),
    radial-gradient(900px 500px at -10% 0%, rgba(124, 58, 237, 0.28), transparent 45%),
    var(--bg);
  color: var(--text);
  min-height: 100%;
}

.app { max-width: 980px; margin: 0 auto; padding: 16px 16px 110px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 46px; height: 46px; border-radius: 14px;
  background: linear-gradient(135deg, #7c3aed, #db2777);
  display: grid; place-items: center; font-weight: 800; box-shadow: var(--shadow);
}
.brand h1 { font-size: 18px; line-height: 1.3; }
.brand p { color: var(--muted); font-size: 12px; }

.btn {
  border: 0; cursor: pointer; border-radius: 14px;
  padding: 11px 14px; font: inherit; color: #fff;
  background: var(--card-2); border: 1px solid var(--line);
}
.btn.primary {
  background: linear-gradient(135deg, #7c3aed, #db2777);
  border: 0; font-weight: 700;
}
.btn.ghost { background: transparent; }
.btn.ok { background: #065f46; }
.btn.danger { background: #9f1239; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.full { width: 100%; }

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px;
}
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; text-align: center;
}
.stat b { display: block; font-size: 20px; }
.stat span { color: var(--muted); font-size: 12px; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
}
.toolbar input, .toolbar select, .field input, .field textarea, .field select {
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font: inherit; outline: none; width: 100%;
}
.toolbar input { flex: 1; min-width: 180px; }
.toolbar select { width: auto; }

.list { display: grid; gap: 10px; }
.empty {
  background: var(--card); border: 1px dashed var(--line);
  border-radius: var(--radius); padding: 36px 16px; text-align: center; color: var(--muted);
}

.check-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.check-card header {
  display: flex; justify-content: space-between; gap: 8px; align-items: start;
}
.sayad {
  font-family: ui-monospace, "Courier New", monospace;
  letter-spacing: .5px; font-weight: 700; direction: ltr; text-align: right;
}
.meta { color: var(--muted); font-size: 13px; margin-top: 6px; display: grid; gap: 3px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag {
  font-size: 11px; padding: 3px 8px; border-radius: 999px;
  background: rgba(139, 92, 246, .18); color: #ddd6fe;
}
.actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.actions .btn { padding: 8px 10px; font-size: 13px; }

.fab {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; z-index: 20;
}
.fab .btn { min-width: 150px; box-shadow: var(--shadow); }

.sheet {
  position: fixed; inset: 0; background: rgba(8, 4, 14, .72);
  display: none; align-items: flex-end; z-index: 40;
}
.sheet.open { display: flex; }
.sheet-body {
  background: #1a0d27; width: 100%; max-height: 94vh; overflow: auto;
  border-radius: 24px 24px 0 0; padding: 16px; border-top: 1px solid var(--line);
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: grid; gap: 6px; margin-bottom: 10px; }
.field label { font-size: 13px; color: var(--muted); }
.preview {
  width: 100%; max-height: 220px; object-fit: contain; border-radius: 12px;
  background: #000; margin-bottom: 12px;
}
.ltr { direction: ltr; text-align: left; font-family: ui-monospace, Tahoma, sans-serif; }
#reader, #cameraBox {
  width: 100%; min-height: 240px; border-radius: 16px; overflow: hidden;
  background: #000; margin-bottom: 10px;
}
.hint {
  background: rgba(251, 191, 36, .1); color: #fde68a;
  border: 1px solid rgba(251, 191, 36, .25);
  padding: 10px 12px; border-radius: 12px; font-size: 13px; margin-bottom: 12px;
}
.progress {
  height: 8px; background: #3b0764; border-radius: 99px; overflow: hidden; margin: 8px 0 14px;
}
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #7c3aed, #ec4899); }

.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  background: #4c1d95; color: #fff; padding: 10px 16px; border-radius: 999px;
  display: none; z-index: 80; font-size: 14px;
}
.toast.show { display: block; }

.install-banner {
  display: none; margin-bottom: 12px; background: var(--card-2);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
  align-items: center; justify-content: space-between; gap: 8px;
}
.install-banner.show { display: flex; }

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
}
