:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --primary: #1f6feb;
  --primary-dark: #1a5fd0;
  --text: #1c1e21;
  --muted: #65676b;
  --border: #dadde1;
  --ok: #2e7d32;
  --warn: #c9760a;
  --error: #c62828;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
.topbar__title { font-size: 1rem; }
.topbar__user { font-size: 0.85rem; opacity: 0.95; }

#app { max-width: 480px; margin: 0 auto; padding: 16px; }

.screen { display: block; }
[hidden] { display: none !important; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}
.card h2 { margin: 0 0 12px; font-size: 1.2rem; }

label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }

.pin-input, .select, .textarea {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 14px;
}
.pin-input { letter-spacing: 0.4em; text-align: center; font-size: 1.4rem; }
.textarea { resize: vertical; }

.btn {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  border: none;
  border-radius: 10px;
  background: #e7e9ec;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}
.btn:active { transform: scale(0.99); }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:active { background: var(--primary-dark); }
.btn--ghost { background: transparent; color: var(--muted); margin-top: 8px; }

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.action { background: #fff; border: 1px solid var(--border); }
.action.selected { background: var(--primary); color: #fff; border-color: var(--primary); }
.action--warn.selected { background: var(--warn); border-color: var(--warn); }

.filelabel {
  display: block;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 14px;
}
.filelabel.has-file { color: var(--ok); border-color: var(--ok); }

.geo { font-size: 0.9rem; padding: 8px 0; }
.geo.ok { color: var(--ok); }
.geo.warn { color: var(--warn); }
.geo.err { color: var(--error); }

.confirm { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; margin-bottom: 16px; }
.confirm dt { color: var(--muted); font-size: 0.85rem; }
.confirm dd { margin: 0; font-weight: 500; }

.result { text-align: center; }
.result__icon { font-size: 3rem; margin-bottom: 8px; }
.result.ok .result__icon::after { content: "✅"; }
.result.err .result__icon::after { content: "❌"; }

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

.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.25);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.spinner {
  width: 42px; height: 42px;
  border: 4px solid #fff;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
