/*
 * DTA Field Card — styles.css
 * Fonts are self-hosted (see /fonts/) — no external CDN requests.
 * This satisfies the font-src 'self' Content-Security-Policy directive.
 *
 * Font stack falls back to system-ui if font files are not present,
 * so the app is functional before fonts finish loading.
 */

/* ── SELF-HOSTED FONTS ── */
@font-face {
  font-family: 'BarlowCondensed';
  src: url('fonts/BarlowCondensed-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'BarlowCondensed';
  src: url('fonts/BarlowCondensed-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'BarlowCondensed';
  src: url('fonts/BarlowCondensed-ExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow';
  src: url('fonts/Barlow-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow';
  src: url('fonts/Barlow-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow';
  src: url('fonts/Barlow-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ── CUSTOM PROPERTIES ── */
:root {
  --fire:       #E84A1A;
  --fire-dark:  #C03A10;
  --ember:      #F5A623;
  --smoke:      #2D2D2D;
  --ash:        #1A1A1A;
  --safe:       #3DAA5A;
  --warn:       #F5A623;
  --danger:     #E84A1A;
  --surface:    #F5F0EA;
  --card:       #FEFCF8;
  --border:     #D9CFC2;
  --muted:      #7A6E63;
  --text:       #1E1A16;
  --safe-bg:    #DFF5E8;
  --danger-bg:  #FFE8E0;
  --warn-bg:    #FFF3D0;

  --font-display: 'BarlowCondensed', 'Barlow Condensed', ui-rounded, system-ui, sans-serif;
  --font-body:    'Barlow', system-ui, -apple-system, sans-serif;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

/* ── SKIP LINK (accessibility) ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--fire);
  color: white;
  padding: 8px 16px;
  z-index: 9999;
  font-weight: 700;
}
.skip-link:focus { top: 0; }

/* ── LAYOUT ── */
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── INSTALL BANNER ── */
#installBanner {
  background: var(--fire);
  color: white;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
#installBanner[hidden] { display: none; }
#installBanner #installBtn {
  background: white;
  color: var(--fire);
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
}
#installBanner #dismissBanner {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.75);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
}

/* ── HEADER ── */
.header {
  background: var(--ash);
  color: white;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 16px rgba(0,0,0,0.5);
  padding-top: env(safe-area-inset-top);
}

.header-stripe {
  background: var(--fire);
  height: 4px;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.dta-badge {
  background: var(--fire);
  color: white;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 1.5px;
  padding: 5px 11px;
  border-radius: 6px;
  line-height: 1.1;
  flex-shrink: 0;
  user-select: none;
}

.header-titles h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.2;
}
.header-titles p {
  font-size: 10px;
  color: #AAA;
  margin-top: 2px;
}

/* ── STEP NAV ── */
.step-nav {
  display: flex;
  background: #111;
  border-bottom: 1px solid #2A2A2A;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.step-nav::-webkit-scrollbar { display: none; }
.step-nav[hidden] { display: none; }

.step-btn {
  flex: 0 0 auto;
  padding: 10px 13px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: #555;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  gap: 5px;
}
.step-btn:focus-visible {
  outline: 2px solid var(--fire);
  outline-offset: -2px;
}
.step-btn .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #3A3A3A;
  flex-shrink: 0;
  transition: background 0.2s;
}
.step-btn.active            { color: var(--ember); border-bottom-color: var(--fire); }
.step-btn.active .dot       { background: var(--fire); }
.step-btn.done              { color: var(--safe); }
.step-btn.done .dot         { background: var(--safe); }

/* ── PROGRESS BAR ── */
.progress-bar {
  height: 3px;
  background: #2A2A2A;
}
[role=progressbar][hidden] { display: none; }
.progress-fill {
  height: 100%;
  background: var(--safe);
  transition: width 0.35s ease;
}

/* ── CONTENT ── */
.content {
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  flex: 1;
}

/* ── SECTION HEADER ── */
.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.section-icon {
  width: 38px; height: 38px;
  background: var(--fire);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}
.section-head h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
}
.section-head p {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

/* ── CARDS ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 15px;
  margin-bottom: 12px;
}
.card-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

/* ── FORM ELEMENTS ── */
.field-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  color: var(--smoke);
  margin-bottom: 5px;
  margin-top: 12px;
  display: block;
}
.field-label:first-child { margin-top: 0; }

.field-error {
  color: var(--fire-dark);
  font-size: 12px;
  margin-top: 4px;
  font-weight: 600;
}

input[type=text],
input[type=email],
input[type=date],
input[type=time],
input[type=number],
select,
textarea {
  width: 100%;
  background: #F8F4EE;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s, background 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--fire);
  background: white;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--fire);
  outline-offset: 1px;
}
textarea  { resize: none; min-height: 80px; font-size: 14px; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── PILLS ── */
.pills { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; }
.pill {
  padding: 7px 13px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: #F8F4EE;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  color: var(--smoke);
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.pill:focus-visible { outline: 2px solid var(--fire); outline-offset: 2px; }
.pill.active        { background: var(--fire); border-color: var(--fire); color: white; }

/* Species pills — code + common name stacked */
.pills-species       { gap: 6px; }
.pill-species        { display: flex; flex-direction: column; align-items: center; padding: 7px 10px; border-radius: 10px; min-width: 58px; }
.pill-species .pill-code { font-size: 14px; font-weight: 700; line-height: 1.2; }
.pill-species .pill-name { font-size: 9px; font-weight: 400; color: var(--muted); line-height: 1.2; margin-top: 2px; white-space: nowrap; }
.pill-species.active .pill-name { color: rgba(255,255,255,0.8); }

/* Tree class pills — number + description stacked */
.pills-classes       { gap: 6px; }
.pill-class          { display: flex; flex-direction: column; align-items: center; padding: 8px 10px; border-radius: 10px; min-width: 56px; max-width: 72px; }
.pill-class .pill-code { font-size: 17px; font-weight: 800; line-height: 1; }
.pill-class .pill-name { font-size: 8.5px; font-weight: 400; color: var(--muted); line-height: 1.25; margin-top: 3px; text-align: center; }
.pill-class.active .pill-name { color: rgba(255,255,255,0.8); }
/* Dead classes (4–9) get a subtle amber border to distinguish from live */
.pill-class-dead     { border-color: #D4A44C; background: #FFFBF0; }
.pill-class-dead.active { background: #B8821A; border-color: #B8821A; }

.tree-class-hint {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

/* Card label hint — right-aligned sub-label */
.card-label-hint {
  float: right;
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  margin-top: 1px;
}

/* GPS row — input + button side by side */
.location-row { display: flex; gap: 8px; align-items: center; }
.location-row input { flex: 1; }
.btn-gps {
  flex-shrink: 0;
  padding: 10px 12px;
  background: var(--smoke);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-gps:hover  { background: var(--ash); }
.btn-gps:disabled { opacity: 0.6; cursor: not-allowed; }
.gps-status { font-size: 11px; margin-top: 5px; padding: 4px 8px; border-radius: 5px; }
.gps-ok     { background: #EDF7ED; color: #2D6A2D; }
.gps-error  { background: #FFF0F0; color: #9B2C2C; }

/* ── CHECK ITEMS ── */
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: #F8F4EE;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 8px;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.check-item:focus-visible { outline: 2px solid var(--fire); outline-offset: 1px; }
.check-item.checked       { background: #FFF5F0; border-color: var(--fire); }

.check-box {
  width: 20px; height: 20px;
  border-radius: 5px;
  flex-shrink: 0;
  margin-top: 1px;
  border: 2px solid #CCC;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  color: white;
  transition: all 0.15s;
}
.check-item.checked .check-box {
  background: var(--fire);
  border-color: var(--fire);
}
.check-item .item-text { font-size: 13px; line-height: 1.4; }

/* ── RADIO OPTIONS ── */
.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  background: #F8F4EE;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 8px;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.radio-option:focus-visible    { outline: 2px solid var(--fire); outline-offset: 1px; }
.radio-option.selected-danger  { background: #FFF5F0; border-color: var(--fire); }
.radio-option.selected-safe    { background: #F0FFF4; border-color: var(--safe); }

.radio-dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
  border: 2px solid #CCC;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.radio-option.selected-danger .radio-dot { background: var(--fire); border-color: var(--fire); }
.radio-option.selected-safe   .radio-dot { background: var(--safe); border-color: var(--safe); }
.radio-inner {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: white;
  display: none;
}
.radio-option.selected-danger .radio-inner,
.radio-option.selected-safe   .radio-inner { display: block; }
.radio-label { font-size: 14px; font-weight: 500; line-height: 1.3; }
.radio-sub   { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── LOD GRID ── */
.lod-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.lod-card {
  padding: 11px;
  border-radius: 9px;
  border: 1.5px solid var(--border);
  background: #F8F4EE;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.lod-card:focus-visible { outline: 2px solid var(--fire); outline-offset: 1px; }
.lod-card.selected      { background: #FFF5F0; border-color: var(--fire); }
.lod-level {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--fire-dark);
  margin-bottom: 4px;
}
.lod-card.selected .lod-level { color: var(--fire); }
.lod-example { font-size: 10px; color: var(--muted); line-height: 1.3; }

/* ── INFO BOX ── */
.info-box {
  background: #FFF8E8;
  border: 1px solid #F5E0A0;
  border-left: 4px solid var(--ember);
  border-radius: 0 9px 9px 0;
  padding: 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #5A4A20;
  margin-bottom: 12px;
}

/* ── BUTTONS ── */
.btn-primary {
  flex: 2;
  padding: 14px 16px;
  background: var(--fire);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:active      { background: var(--fire-dark); transform: scale(0.98); }
.btn-primary:focus-visible { outline: 2px solid white; outline-offset: 2px; }

.btn-secondary {
  flex: 1;
  padding: 13px 16px;
  background: transparent;
  color: var(--smoke);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-secondary:active       { background: #EEE; }
.btn-secondary:focus-visible { outline: 2px solid var(--fire); outline-offset: 2px; }

.nav-row { display: flex; gap: 10px; margin-top: 10px; }

/* ── DARK CARD ── */
.dark-card {
  background: var(--ash);
  color: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.dark-card input          { background: #2D2D2D; border-color: #444; color: white; }
.dark-card input:focus    { background: #333; border-color: var(--fire); }
.dark-card .field-label   { color: #CCC; }
.dark-card .card-label    { color: #888; }

/* ── TAGS ── */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.5px;
}
.tag-safe   { background: var(--safe-bg);   color: #1A7A3A; }
.tag-danger { background: var(--danger-bg); color: #C03A10; }
.tag-warn   { background: var(--warn-bg);   color: #8A5A00; }

/* ── SUMMARY ROWS ── */
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  gap: 12px;
}
.summary-row:last-child { border-bottom: none; }
.s-key { color: var(--muted); flex-shrink: 0; }
.s-val { font-weight: 600; text-align: right; word-break: break-word; }

/* ── PHOTO ZONE ── */
.camera-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px;
  background: var(--ash);
  color: white;
  border: none;
  border-radius: 9px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  margin-bottom: 8px;
  -webkit-tap-highlight-color: transparent;
}
.camera-btn:active       { background: #333; }
.camera-btn:focus-visible { outline: 2px solid var(--fire); outline-offset: 2px; }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 11px;
  padding: 26px 16px;
  text-align: center;
  cursor: pointer;
  background: #F8F4EE;
  transition: all 0.2s;
}
.drop-zone:focus-visible { outline: 2px solid var(--fire); outline-offset: 2px; }
.drop-zone.drag          { border-color: var(--fire); background: #FFF5F0; }
.drop-zone-icon          { font-size: 34px; margin-bottom: 6px; }
.drop-zone-title         { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--smoke); }
.drop-zone-sub           { font-size: 11px; color: var(--muted); margin-top: 3px; }

.photo-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--fire);
  color: white;
  padding: 3px 10px;
  border-radius: 20px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  margin-top: 10px;
}

.photo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 10px;
}
.photo-thumb {
  position: relative;
  border-radius: 9px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  aspect-ratio: 4 / 3;
  background: #DDD;
}
.photo-thumb img        { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-remove {
  position: absolute;
  top: 5px; right: 5px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: white;
  border: none;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.6);
  border: none;
  color: white;
  font-size: 10px;
  padding: 4px 7px;
  width: 100%;
  outline: none;
  font-family: var(--font-body);
  border-radius: 0;
}
.photo-caption::placeholder { color: rgba(255,255,255,0.55); }

/* ── SUCCESS SCREEN ── */
.success-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  min-height: 70vh;
}
.success-icon {
  font-size: 68px;
  margin-bottom: 18px;
  color: var(--safe);
  line-height: 1;
}
.success-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 30px;
  color: var(--safe);
  margin-bottom: 10px;
}
.success-sub {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 280px;
  margin: 0 auto 6px;
}

/* Success screen — offline backup actions */
.success-actions {
  width: 100%;
  max-width: 320px;
  margin: 16px auto 0;
  background: #F7F4EE;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  text-align: left;
}
.success-actions-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.btn-success-action {
  display: block;
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 7px;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--smoke);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-success-action:last-child { margin-bottom: 0; }
.btn-success-action:hover { border-color: var(--fire); background: #FFF8F5; }

/* Saved reports button row */
.success-archive-row {
  margin-top: 14px;
}
.btn-archive-open {
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 8px 18px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--smoke);
  cursor: pointer;
  transition: border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-archive-open:hover { border-color: var(--smoke); }

/* Archive overlay and panel */
.archive-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity:0 } to { opacity:1 } }
.archive-panel {
  background: white;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform:translateY(40px); opacity:0 } to { transform:translateY(0); opacity:1 } }
.archive-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.archive-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  color: var(--smoke);
}
.archive-count {
  display: inline-block;
  background: var(--fire);
  color: white;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 12px;
  margin-left: 6px;
}
.archive-close {
  background: #F0EDE8;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 14px;
  cursor: pointer;
  color: var(--smoke);
  display: flex;
  align-items: center;
  justify-content: center;
}
.archive-list {
  overflow-y: auto;
  flex: 1;
  padding: 8px 0;
}
.archive-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid #F0EDE8;
  gap: 12px;
}
.archive-item:last-child { border-bottom: none; }
.archive-fire {
  font-weight: 700;
  font-size: 14px;
  color: var(--smoke);
  margin-bottom: 2px;
}
.archive-date {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 3px;
}
.archive-stats { font-size: 12px; color: var(--muted); }
.archive-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.archive-item-actions button {
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: white;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: var(--smoke);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.archive-item-actions button:hover { border-color: var(--fire); color: var(--fire); }
.archive-empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
.archive-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  flex-shrink: 0;
}
.success-photos {
  width: 100%;
  max-width: 420px;
  margin: 16px auto 0;
  text-align: left;
  background: #FFFBF2;
  border: 1.5px solid #E8C96A;
  border-radius: 10px;
  padding: 14px;
}
.success-photos-title {
  font-size: 13px;
  font-weight: 700;
  color: #7A5200;
  margin-bottom: 10px;
}
.success-photo-group { margin-bottom: 10px; }
.success-photo-group:last-child { margin-bottom: 0; }
.success-photo-tree-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.success-photo-links { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-dl-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  width: 88px;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s;
}
.photo-dl-btn:hover  { border-color: var(--fire); }
.photo-dl-btn img    { width: 76px; height: 60px; object-fit: cover; border-radius: 4px; display: block; }
.photo-dl-btn span   { font-size: 9.5px; color: var(--smoke); text-align: center; line-height: 1.3; word-break: break-word; }

/* ── OFFLINE TOAST ── */
.offline-toast {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ash);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  white-space: nowrap;
}
.offline-toast.show { opacity: 1; }

/* ── FOCUS RING GLOBAL RESET ── */
/* Only show focus rings for keyboard users */
:focus:not(:focus-visible) { outline: none; }

/* ── RESPONSIVE ── */
@media (max-width: 380px) {
  .dta-badge         { font-size: 18px; }
  .header-titles h1  { font-size: 15px; }
  .content           { padding: 13px; }
  .step-btn          { padding: 9px 10px; font-size: 10px; }
}

/* ── TREE ROSTER (Page 3) ── */

/* Stats bar at top of roster */
.tree-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  align-items: center;
}
.ts-count   { font-family: var(--font-display); font-weight: 700; font-size: 13px; color: var(--smoke); }
.ts-safe    { background: var(--safe-bg);   color: #1A7A3A; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 20px; }
.ts-danger  { background: var(--danger-bg); color: #C03A10; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 20px; }
.ts-unrated { background: #EEE; color: var(--muted); font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 20px; }

/* Individual tree row card */
.tree-row {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 11px;
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.tree-row.tree-row-open {
  border-color: var(--fire);
  box-shadow: 0 2px 12px rgba(232,74,26,0.12);
}

/* Collapsed header row */
.tree-row-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.tree-row-header:focus-visible { outline: 2px solid var(--fire); outline-offset: -2px; }

.tr-num {
  width: 28px; height: 28px;
  background: var(--fire);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

.tr-meta { flex: 1; min-width: 0; }
.tr-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tr-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  align-items: center;
}

/* Rating badge inside tree row */
.tr-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.tr-badge-safe    { background: var(--safe-bg);   color: #1A7A3A; }
.tr-badge-danger  { background: var(--danger-bg); color: #C03A10; }
.tr-badge-pending { background: #EEE; color: var(--muted); }

/* Small defect code chips */
.def-chip {
  display: inline-block;
  padding: 1px 6px;
  background: #EDE8E0;
  color: var(--smoke);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 0.3px;
}

/* Right side of header: delete + chevron */
.tr-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.tr-delete {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.tr-delete:active       { background: var(--danger-bg); border-color: var(--fire); color: var(--fire); }
.tr-delete:focus-visible { outline: 2px solid var(--fire); outline-offset: 1px; }
.tr-chevron { font-size: 10px; color: var(--muted); }

/* Expanded form body */
.tree-row-body {
  padding: 0 13px 14px;
  border-top: 1px solid var(--border);
}

/* Save/Done button inside expanded tree */
.btn-tree-done {
  width: 100%;
  padding: 12px;
  background: var(--ash);
  color: white;
  border: none;
  border-radius: 9px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.6px;
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-tree-done:active        { background: var(--fire-dark); }
.btn-tree-done:focus-visible { outline: 2px solid var(--fire); outline-offset: 2px; }

/* + Add Tree button */
.btn-add-tree {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: transparent;
  color: var(--fire);
  border: 2px dashed var(--fire);
  border-radius: 11px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 4px;
  -webkit-tap-highlight-color: transparent;
}
.btn-add-tree:active        { background: var(--danger-bg); }
.btn-add-tree:focus-visible { outline: 2px solid var(--fire); outline-offset: 2px; }
.btn-add-tree span          { font-size: 22px; line-height: 1; margin-top: -2px; }

/* Empty state */
.tree-empty {
  text-align: center;
  padding: 36px 24px;
}
.tree-empty-icon  { font-size: 48px; margin-bottom: 10px; }
.tree-empty-title { font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--smoke); margin-bottom: 6px; }
.tree-empty-sub   { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* Review rows on submit page (P5) */
.tree-review-row {
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}
.tree-review-row:last-child { border-bottom: none; }
.trr-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.trr-num     { font-family: var(--font-display); font-weight: 800; font-size: 13px; color: var(--fire); flex-shrink: 0; }
.trr-species { font-size: 13px; font-weight: 600; flex: 1; color: var(--smoke); }
.trr-chips   { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.trr-notes   { font-size: 11px; color: var(--muted); margin-top: 4px; font-style: italic; line-height: 1.4; }

/* ── PER-TREE PHOTO WIDGET ── */
.tp-card { background: #F5F0EA; border-color: #D0C8BA; }

.tp-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.tp-camera-btn,
.tp-gallery-btn {
  flex: 1;
  padding: 10px 8px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--smoke);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.tp-camera-btn:active,
.tp-gallery-btn:active  { background: #E8E2D8; border-color: var(--fire); }
.tp-camera-btn:focus-visible,
.tp-gallery-btn:focus-visible { outline: 2px solid var(--fire); outline-offset: 2px; }

/* Photo count badge on card-label */
.tp-count {
  float: right;
  background: var(--fire);
  color: white;
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* Thumbnail grid (2-up) */
.tp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}
.tp-thumb {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  aspect-ratio: 4/3;
  background: #DDD;
}
.tp-thumb img { width:100%; height:100%; object-fit:cover; display:block; }
.tp-remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: white;
  border: none;
  font-size: 10px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.tp-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.6);
  border: none;
  color: white;
  font-size: 10px;
  padding: 4px 6px;
  width: 100%;
  outline: none;
  font-family: var(--font-body);
}
.tp-caption::placeholder { color: rgba(255,255,255,0.5); }

/* Photo count chip shown on collapsed tree row header */
.tp-chip {
  display: inline-block;
  padding: 1px 7px;
  background: #1A1A1A;
  color: #CCC;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-display);
}

/* Photo count in tree review (submit page) */
.trr-photo-count {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* Stats bar photo badge */
.ts-photos {
  background: #1A1A1A;
  color: #CCC;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
}

/* ── PRINT ── */
@media print {
  .header, .step-nav, .progress-bar, .nav-row, .install-banner { display: none; }
  body { background: white; }
  .card { border: 1px solid #CCC; break-inside: avoid; }
}

/* ══════════════════════════════════════════════════════════════
   LICENCE GATE
   Full-screen overlay shown on first launch and after revocation.
   Matches the app's visual language — same fonts, colours, radius.
   ══════════════════════════════════════════════════════════════ */

.gate-screen {
  position: fixed;
  inset: 0;
  background: var(--ash);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top, 16px) 20px env(safe-area-inset-bottom, 16px);
  min-height: 100dvh;
  animation: gateFadeIn 0.3s ease;
}
@keyframes gateFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.gate-inner {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header — mirrors app header identity */
.gate-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.gate-badge {
  width: 52px;
  height: 52px;
  background: var(--fire);
  color: white;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  flex-shrink: 0;
}
.gate-titles h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: white;
  line-height: 1.2;
  margin-bottom: 2px;
}
.gate-titles p {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  line-height: 1.3;
}

/* Revocation banner */
.gate-revocation {
  background: rgba(232,74,26,0.15);
  border: 1px solid rgba(232,74,26,0.4);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  color: #FFB199;
  line-height: 1.5;
}
.gate-revocation strong {
  display: block;
  color: #FF8060;
  margin-bottom: 3px;
}

/* Code entry card */
.gate-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 22px 20px;
}
.gate-card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: white;
  margin-bottom: 6px;
}
.gate-card-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  line-height: 1.55;
  margin-bottom: 18px;
}

.gate-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  margin-bottom: 7px;
}

.gate-input {
  width: 100%;
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  color: white;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 13px 14px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  -webkit-appearance: none;
  margin-bottom: 10px;
}
.gate-input::placeholder       { color: rgba(255,255,255,0.22); font-weight: 400; letter-spacing: 0; }
.gate-input:focus              { border-color: var(--fire); background: rgba(255,255,255,0.11); }
.gate-input-error              { border-color: #E84A1A !important; background: rgba(232,74,26,0.08) !important; }
.gate-input-success            { border-color: #3DAA5A !important; background: rgba(61,170,90,0.08) !important; }

.gate-error {
  font-size: 13px;
  color: #FF8060;
  line-height: 1.5;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: rgba(232,74,26,0.1);
  border-radius: 8px;
}

.gate-btn {
  width: 100%;
  background: var(--fire);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.04em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
  min-height: 50px;
}
.gate-btn:hover:not(:disabled) { background: var(--fire-dark); }
.gate-btn:disabled             { opacity: 0.6; cursor: not-allowed; }

/* Spinner inside button */
.gate-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: gateSpin 0.7s linear infinite;
}
@keyframes gateSpin {
  to { transform: rotate(360deg); }
}

/* Footer */
.gate-footer {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.gate-footer p {
  font-size: 13px;
  color: rgba(255,255,255,0.35);
}
.gate-link {
  color: rgba(255,255,255,0.6);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.gate-link:hover { color: white; }
.gate-version {
  font-size: 11px !important;
  color: rgba(255,255,255,0.2) !important;
}
