@font-face {
  font-family: "Outfit";
  src: url("../fonts/outfit-light.woff2") format("woff2");
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: "Outfit";
  src: url("../fonts/outfit-regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Outfit";
  src: url("../fonts/outfit-semibold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Outfit";
  src: url("../fonts/outfit-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Outfit";
  src: url("../fonts/outfit-extrabold.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}

:root {
  --ink: #1E323D;
  --slate: #475561;
  --card: #F8EFDB;
  --sand: #EFE3C9;
  --taupe: #8C7F65;
  --amber: #FF8D00;
  --clay: #C56400;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 6px 20px rgba(30, 50, 61, 0.10);
}

* { box-sizing: border-box; }

/* Component classes below set their own `display` (flex/grid/block), which
   otherwise wins the cascade over the browser's default [hidden] rule at
   equal specificity. Force hidden elements to stay hidden regardless. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--card);
  color: var(--ink);
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 { font-weight: 700; margin: 0 0 6px; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 19px; }
h3 { font-size: 15px; color: var(--slate); }
p { margin: 0 0 12px; line-height: 1.45; }

.muted { color: var(--slate); }
.small { font-size: 13px; }

/* ---------- Lock screens ---------- */
.screen-centered {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--ink);
}

.lock-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow);
}

.lock-logo { width: 96px; height: auto; margin-bottom: 20px; }

.pin-input {
  width: 100%;
  font-family: inherit;
  font-size: 24px;
  letter-spacing: 8px;
  text-align: center;
  padding: 14px 12px;
  margin-bottom: 12px;
  border: 2px solid var(--sand);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
}
.pin-input:focus { outline: none; border-color: var(--amber); }

/* ---------- Buttons ---------- */
.btn {
  font-family: inherit;
  font-weight: 600;
  font-size: 15px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  cursor: pointer;
  transition: transform 0.05s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-block { width: 100%; display: block; }
.btn-sm { padding: 8px 12px; font-size: 13px; }

.btn-primary { background: var(--amber); color: var(--ink); }
.btn-primary:hover { background: var(--clay); color: #fff; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-outline {
  background: transparent;
  border: 2px solid var(--ink);
  color: var(--ink);
}
.btn-outline:hover { background: var(--ink); color: var(--card); }

.btn-ghost { background: transparent; color: var(--ink); text-decoration: underline; }

.icon-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--ink);
  padding: 6px;
}

/* ---------- App shell ---------- */
#app-shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

.app-header {
  background: var(--ink);
  color: var(--card);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  padding-top: max(14px, env(safe-area-inset-top));
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-logo { height: 26px; width: auto; }
.header-title { font-weight: 600; font-size: 15px; opacity: 0.85; }

.badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 100px;
}
.badge-offline { background: var(--clay); color: #fff; }

#app-main {
  flex: 1;
  overflow-y: auto;
  padding: 18px 18px 90px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}

.screen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  margin-top: 22px;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--taupe);
}

/* ---------- Dashboard ---------- */
.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--sand);
  border: 1px solid var(--taupe);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 10px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-card-accent { background: var(--ink); color: var(--card); }
.stat-card-accent .stat-label { color: var(--sand); }
.stat-value { display: block; font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.stat-label { display: block; font-size: 11px; color: var(--slate); text-transform: uppercase; letter-spacing: 0.03em; }

.recent-list { list-style: none; margin: 10px 0 0; padding: 0; }
.recent-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  font-size: 14px;
}
.recent-list .recent-status {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--clay);
  background: var(--sand);
  padding: 3px 8px;
  border-radius: 100px;
}
.recent-empty { color: var(--slate); font-size: 13px; padding: 8px 2px; }

/* ---------- Capture form ---------- */
.scan-btn { margin-bottom: 18px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.scan-icon { font-size: 18px; }

.scan-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--sand);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 13px;
}
.spinner {
  width: 18px; height: 18px;
  border: 3px solid var(--taupe);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.lead-form .field {
  display: block;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate);
}
.lead-form .field span { display: block; margin-bottom: 6px; }
.lead-form input,
.lead-form select,
.lead-form textarea,
.text-input {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  font-weight: 400;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--sand);
  border-radius: var(--radius-sm);
  padding: 12px 12px;
}
.lead-form input:focus,
.lead-form select:focus,
.lead-form textarea:focus,
.text-input:focus {
  outline: none;
  border-color: var(--amber);
}
.lead-form textarea { resize: vertical; }

.field-error {
  color: #B3261E;
  font-size: 13px;
  font-weight: 600;
}
.field-hint { font-size: 12px; color: var(--slate); margin-top: 6px; }

/* ---------- Settings ---------- */
.settings-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.settings-card .text-input { margin-bottom: 10px; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--sand);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}
.nav-btn {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 0 8px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--slate);
  cursor: pointer;
}
.nav-btn .nav-icon { font-size: 20px; }
.nav-btn.active { color: var(--amber); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--card);
  padding: 12px 20px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 100;
  max-width: 90vw;
  text-align: center;
}
.toast.toast-error { background: #B3261E; }

@media (min-width: 640px) {
  .app-header, #app-main { max-width: 560px; margin: 0 auto; }
}
