/* ============================================================
   iRoadTech Field Capture — mobile prototype
   Design tokens ported from portal/style.css (Kimi dark theme)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-primary: #08080d;
  --bg-secondary: #0f0f17;
  --bg-card: #16161f;
  --bg-card-hover: #1c1c28;
  --bg-input: #0c0c13;

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.10);
  --border-hover: rgba(255, 255, 255, 0.18);

  --text-primary: #f0f0f4;
  --text-secondary: #a3a3b3;
  --text-muted: #6c6c80;
  --text-inverse: #0a0a10;

  --accent: #00b8f0;
  --accent-soft: rgba(0, 184, 240, 0.12);
  --violet: #7b5cff;
  --violet-soft: rgba(123, 92, 255, 0.12);
  --warm: #ff6b4a;
  --warm-soft: rgba(255, 107, 74, 0.12);
  --mint: #00f0a0;
  --mint-soft: rgba(0, 240, 160, 0.12);
  --amber: #ffb547;
  --amber-soft: rgba(255, 181, 71, 0.12);

  --font-heading: 'Outfit', -apple-system, sans-serif;
  --font-body: 'DM Sans', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.2), 0 4px 14px rgba(0, 0, 0, 0.25);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  color: var(--text-primary);
  background: #010103;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input { font: inherit; color: inherit; }

.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }

/* ============ PHONE FRAME ============ */

.phone {
  position: relative;
  max-width: 430px;
  height: 100dvh;
  max-height: 932px;
  margin: 0 auto;
  overflow: hidden;
  background:
    radial-gradient(ellipse 600px 300px at 30% -10%, rgba(0, 184, 240, 0.07), transparent 60%),
    radial-gradient(ellipse 400px 300px at 100% 100%, rgba(123, 92, 255, 0.05), transparent 60%),
    var(--bg-primary);
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
}

/* ============ SCREENS ============ */

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  animation: screenIn 0.28s var(--ease);
}
.screen.active { display: flex; }

@keyframes screenIn {
  from { opacity: 0; transform: translateX(14px); }
  to   { opacity: 1; transform: translateX(0); }
}

.screen__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 96px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.screen__footer {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(8, 8, 13, 0.92) 36%);
}

/* ============ ICONS ============
   Icons are injected as inline SVG by icons.js (so they work from
   file://). The same artwork lives as standalone files in
   assets/icons/ for later Android Studio use. Tinted via color. */

.icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.icon--lg { width: 26px; height: 26px; }
.icon--mint { color: var(--mint); }
.icon--muted { color: var(--text-muted); }
.icon--dark { color: var(--text-inverse); }

/* ============ SHARED PRIMITIVES ============ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 16px;
}

.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot--mint  { background: var(--mint); box-shadow: 0 0 6px var(--mint); }
.dot--amber { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.dot--warm  { background: var(--warm); box-shadow: 0 0 6px var(--warm); }
.dot--grey  { background: var(--text-muted); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 4px 10px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 16px;
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
}
.btn:active { opacity: 0.85; transform: scale(0.98); }
.btn--primary { background: var(--accent); color: var(--text-inverse); }
.btn--primary:disabled { background: var(--bg-card-hover); color: var(--text-muted); cursor: default; }

.section-title {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-top: 4px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 36px 16px;
  text-align: center;
  color: var(--text-secondary);
  line-height: 1.5;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 130px;
  transform: translateX(-50%) translateY(10px);
  background: rgba(12, 12, 19, 0.9);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  backdrop-filter: blur(12px);
  z-index: 40;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ TOP BAR ============ */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(8, 8, 13, 0.7);
  backdrop-filter: blur(16px);
}
.topbar__logo { width: 34px; height: 34px; border-radius: 9px; }
.topbar__titles { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar__title { font-family: var(--font-heading); font-weight: 600; font-size: 16px; }
.topbar__org { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.back-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  font-size: 22px;
  line-height: 1;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  padding-bottom: 3px;
}

/* ============ HOME ============ */

.hero-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  padding: 22px 20px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(0, 184, 240, 0.95), rgba(123, 92, 255, 0.9));
  color: #fff;
  box-shadow: 0 0 34px rgba(0, 184, 240, 0.22);
  transition: transform 0.15s var(--ease);
  text-align: left;
}
.hero-btn:active { transform: scale(0.98); }
.hero-btn__label { font-family: var(--font-heading); font-size: 22px; font-weight: 700; }
.hero-btn__sub { font-size: 13px; opacity: 0.85; }
.hero-btn__dots { display: flex; gap: 14px; margin-top: 8px; }
.readiness { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; opacity: 0.95; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 14px 12px; }
.stat__value { font-family: var(--font-heading); font-size: 24px; font-weight: 700; color: var(--accent); }
.stat__value--warm { color: var(--warm); }
.stat__label { font-size: 11.5px; color: var(--text-muted); }

.session-list { display: flex; flex-direction: column; gap: 10px; }

.session-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: background 0.15s var(--ease);
}
.session-row:active { background: var(--bg-card-hover); }
.session-row__icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
}
.session-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.session-row__name { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-row__meta { font-size: 12px; color: var(--text-muted); }

.status-chip {
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}
.status-chip--draft     { background: var(--bg-card-hover); color: var(--text-secondary); }
.status-chip--queued    { background: var(--bg-card-hover); color: var(--text-secondary); }
.status-chip--uploading { background: var(--accent-soft); color: var(--accent); }
.status-chip--processing{ background: var(--violet-soft); color: var(--violet); animation: pulse 1.2s infinite; }
.status-chip--live      { background: var(--mint-soft); color: var(--mint); }
.status-chip--failed    { background: var(--warm-soft); color: var(--warm); }

@keyframes pulse { 50% { opacity: 0.55; } }

/* ============ SURVEY SETUP ============ */

.form-card { display: flex; flex-direction: column; gap: 10px; }
.field-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
  width: 100%;
}
.input:focus { border-color: var(--accent); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s var(--ease);
}
.chip .icon { width: 16px; height: 16px; }
.chip--warm.active   { background: var(--warm-soft);   border-color: var(--warm);   color: var(--warm); }
.chip--violet.active { background: var(--violet-soft); border-color: var(--violet); color: var(--violet); }
.chip--cyan.active   { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.segmented {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
}
.segmented__opt {
  flex: 1;
  padding: 9px 4px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s var(--ease);
}
.segmented__opt.active { background: var(--bg-card-hover); color: var(--text-primary); border: 1px solid var(--border); }

.preflight { display: flex; flex-direction: column; gap: 14px; }
.preflight__item { display: flex; align-items: center; gap: 10px; }
.preflight__item .icon { color: var(--text-muted); }
.preflight__label { flex: 1; font-size: 14px; color: var(--text-secondary); }
.preflight__state { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; }

/* ============ LIVE CAPTURE ============ */

.screen--live { background: #000; }

.viewfinder {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: linear-gradient(#1a1d26 0%, #14161d 55%, #23262e 55%, #191b21 100%);
}
/* fake road centre-line scrolling toward the viewer */
.viewfinder__road {
  position: absolute;
  left: 50%;
  top: 55%;
  bottom: 0;
  width: 5px;
  transform: translateX(-50%);
  background: repeating-linear-gradient(#c9cbd4 0 26px, transparent 26px 52px);
  opacity: 0.5;
  animation: roadScroll 0.7s linear infinite;
}
@keyframes roadScroll { from { background-position-y: 0; } to { background-position-y: 52px; } }
.viewfinder__grain {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(0, 184, 240, 0.05), transparent),
    radial-gradient(ellipse 120% 60% at 50% 100%, rgba(0, 0, 0, 0.5), transparent);
}

.hud {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: rgba(12, 12, 19, 0.72);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  font-size: 14px;
  font-weight: 500;
}
.hud--tl { top: 14px; left: 14px; }
.hud--tr { top: 14px; right: 14px; }
.hud--bl { bottom: 14px; left: 14px; }
.hud--br { bottom: 14px; right: 14px; }
.hud--warn { border-color: var(--amber); color: var(--amber); }
.hud__sep { color: var(--text-muted); }

.rec-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--warm);
  box-shadow: 0 0 8px var(--warm);
  animation: pulse 1.1s infinite;
}

.tag-row {
  display: flex;
  gap: 10px;
  padding: 14px 14px 10px;
  background: var(--bg-primary);
}
.tag-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-height: 76px;
  padding: 12px 4px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  transition: transform 0.1s var(--ease), background 0.1s var(--ease);
}
.tag-btn:active { transform: scale(0.94); background: var(--bg-card-hover); }
.tag-btn--warm   { color: var(--warm); }
.tag-btn--amber  { color: var(--amber); }
.tag-btn--violet { color: var(--violet); }
.tag-btn--cyan   { color: var(--accent); }

.end-btn {
  position: relative;
  margin: 0 14px calc(16px + env(safe-area-inset-bottom));
  min-height: 54px;
  border-radius: 14px;
  border: 1px solid var(--warm);
  color: var(--warm);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 15px;
  overflow: hidden;
  background: var(--bg-primary);
}
.end-btn__fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: var(--warm-soft);
  transition: none;
}
.end-btn.holding .end-btn__fill { width: 100%; transition: width 1.5s linear; }
.end-btn__label { position: relative; }

/* ============ REVIEW ============ */

.summary-strip {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px;
}
.summary-strip .sum {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sum__v { font-family: var(--font-heading); font-weight: 700; font-size: 18px; }
.sum__l { font-size: 11px; color: var(--text-muted); }

.detection-list { display: flex; flex-direction: column; gap: 10px; }

.det-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: border-color 0.2s var(--ease), opacity 0.2s var(--ease);
}
.det-card.confirmed { border-color: rgba(0, 240, 160, 0.4); }
.det-card__top { display: flex; align-items: center; gap: 10px; }
.det-card__type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 999px;
  padding: 5px 11px;
}
.det-card__type .icon { width: 14px; height: 14px; }
.det-type--pothole  { background: var(--warm-soft);   color: var(--warm); }
.det-type--cracking { background: var(--amber-soft);  color: var(--amber); }
.det-type--kerb     { background: var(--violet-soft); color: var(--violet); }
.det-type--sign     { background: var(--accent-soft); color: var(--accent); }
.det-card__time { margin-left: auto; font-size: 12px; color: var(--text-muted); }
.det-card__coords { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }

.det-card__bottom { display: flex; align-items: center; gap: 8px; }
.sev-row { display: flex; gap: 4px; flex: 1; }
.sev {
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.sev.active { background: var(--bg-card-hover); color: var(--text-primary); border-color: var(--border-hover); }
.sev.active.sev--high { color: var(--warm); border-color: var(--warm); background: var(--warm-soft); }

.det-act {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
}
.det-act--confirm.done { border-color: var(--mint); color: var(--mint); background: var(--mint-soft); }
.det-act--delete:active { border-color: var(--warm); color: var(--warm); }

/* ============ SYNC ============ */

.sync-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}
.sync-card__top { display: flex; align-items: center; gap: 10px; }
.sync-card__name { flex: 1; font-weight: 600; font-size: 14.5px; }
.sync-card__meta { font-size: 12px; color: var(--text-muted); }
.progress {
  height: 4px;
  border-radius: 999px;
  background: var(--bg-input);
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  transition: width 0.25s linear;
}
.sync-card__result { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.link-portal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 600;
  font-size: 13.5px;
  text-decoration: none;
}

/* ============ SPLASH ============ */

.splash {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.splash__logo { width: 108px; height: 108px; animation: splashIn 0.6s var(--ease); }
@keyframes splashIn { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: scale(1); } }
.splash__title { font-family: var(--font-heading); font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.splash__sub { font-size: 14px; color: var(--text-secondary); }
.splash__bar {
  width: 140px; height: 2px;
  margin-top: 26px;
  border-radius: 999px;
  background: var(--bg-card-hover);
  overflow: hidden;
}
.splash__bar-fill {
  height: 100%; width: 0%;
  background: var(--accent);
  animation: splashBar 1.4s var(--ease) forwards;
}
@keyframes splashBar { to { width: 100%; } }
.splash__hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ============ TAB BAR ============ */

.tabbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  border-top: 1px solid var(--border-subtle);
  background: rgba(8, 8, 13, 0.85);
  backdrop-filter: blur(16px);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 30;
}
.tabbar__tab {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 0 12px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
}
.tabbar__tab .icon { width: 21px; height: 21px; }
.tabbar__tab.active { color: var(--accent); }
.tabbar__badge {
  position: absolute;
  top: 6px;
  left: calc(50% + 8px);
  min-width: 17px; height: 17px;
  border-radius: 999px;
  background: var(--warm);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
