/* HLAM-OS — design tokens
   Palette drawn from the subject: night sky over the field (ink),
   sun-bleached parchment reports (canvas), savanna ochre for the
   primary action (accent), acacia green for confirmation/success. */
:root {
  --ink: #14261F;
  --ink-soft: #3A4A42;
  --canvas: #F7F4EC;
  --surface: #FFFFFF;
  --border: #E1DBC8;
  --accent: #C97A2B;
  --accent-ink: #7A4B18;
  --accent-2: #2E6E5E;
  --success: #2E6E5E;
  --success-bg: #E4EEE9;
  --warning: #C97A2B;
  --warning-bg: #F7EBDB;
  --danger: #A5382A;
  --danger-bg: #F6E4E0;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(20,38,31,0.06), 0 1px 8px rgba(20,38,31,0.05);
  --font-display: Georgia, "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--canvas);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font-family: inherit; font-size: 1rem; }
a { color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

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

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-name { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; letter-spacing: 0.01em; }
.brand-sub { font-size: 0.68rem; color: var(--ink-soft); letter-spacing: 0.08em; text-transform: uppercase; }

.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }
.lang-toggle {
  display: flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden;
  background: var(--canvas);
}
.lang-toggle button {
  border: none; background: transparent; padding: 0.3rem 0.65rem; font-size: 0.78rem;
  font-weight: 600; color: var(--ink-soft); cursor: pointer;
}
.lang-toggle button.active { background: var(--ink); color: var(--canvas); }

.offline-banner {
  background: var(--warning-bg); color: var(--accent-ink); font-size: 0.82rem;
  padding: 0.4rem 1rem; text-align: center; display: none; font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.offline-banner.show { display: block; }

main { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 1rem 1rem 5.5rem; }

/* ---------- Bottom nav (phone) / side nav (desktop) ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface);
  border-top: 1px solid var(--border); display: flex; z-index: 10;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav button {
  flex: 1; border: none; background: transparent; padding: 0.55rem 0.2rem 0.5rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
  color: var(--ink-soft); font-size: 0.66rem; cursor: pointer; font-weight: 600;
}
.bottom-nav button.active { color: var(--accent-ink); }
.bottom-nav svg { width: 20px; height: 20px; }

@media (min-width: 860px) {
  #app { flex-direction: row; }
  .topbar { position: fixed; top: 0; left: 0; right: 0; }
  .side-nav {
    position: fixed; top: 0; left: 0; bottom: 0; width: 220px;
    background: var(--surface); border-right: 1px solid var(--border);
    padding-top: 4.2rem; display: flex; flex-direction: column; gap: 0.15rem;
  }
  .side-nav button {
    display: flex; align-items: center; gap: 0.7rem; border: none; background: transparent;
    padding: 0.65rem 1.1rem; text-align: left; font-size: 0.9rem; font-weight: 600;
    color: var(--ink-soft); cursor: pointer; border-left: 3px solid transparent;
  }
  .side-nav button.active { color: var(--accent-ink); background: var(--warning-bg); border-left-color: var(--accent); }
  .side-nav svg { width: 18px; height: 18px; }
  .bottom-nav { display: none; }
  main { margin-left: 220px; max-width: 640px; padding: 5.5rem 2rem 3rem; }
}

/* ---------- Cards / layout primitives ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--shadow);
}
.card + .card { margin-top: 0.75rem; }
.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }

h1 { font-family: var(--font-display); font-size: 1.4rem; margin: 0 0 0.9rem; }
h2 { font-family: var(--font-display); font-size: 1.1rem; margin: 0 0 0.5rem; }
.eyebrow { font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; }
.muted { color: var(--ink-soft); font-size: 0.85rem; }

.stat { text-align: center; padding: 0.75rem 0.4rem; }
.stat .num { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat .label { font-size: 0.68rem; color: var(--ink-soft); margin-top: 0.3rem; }

.badge { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.72rem; font-weight: 700;
  padding: 0.2rem 0.55rem; border-radius: 999px; }
.badge.synced { background: var(--success-bg); color: var(--success); }
.badge.pending { background: var(--warning-bg); color: var(--accent-ink); }
.badge.error { background: var(--danger-bg); color: var(--danger); }

.report-item { display: flex; justify-content: space-between; align-items: center; padding: 0.65rem 0;
  border-bottom: 1px solid var(--border); }
.report-item:last-child { border-bottom: none; }
.report-item .title { font-weight: 600; font-size: 0.92rem; }
.report-item .meta { font-size: 0.76rem; color: var(--ink-soft); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  border: none; border-radius: var(--radius-sm); padding: 0.7rem 1.1rem; font-weight: 700;
  cursor: pointer; font-size: 0.92rem; width: 100%;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:active { background: var(--accent-ink); }
.btn-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--border); }
.btn-ghost { background: transparent; color: var(--accent-ink); }
.btn-block-row { display: flex; gap: 0.6rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- Forms ---------- */
label { display: block; font-size: 0.78rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 0.3rem; }
input[type=text], input[type=number], input[type=email], input[type=password], select, textarea {
  width: 100%; padding: 0.65rem 0.7rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
}
textarea { min-height: 70px; resize: vertical; }
.field { margin-bottom: 0.9rem; }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-row input { width: auto; }
.gps-row { display: flex; gap: 0.5rem; align-items: center; }
.gps-status { font-size: 0.78rem; color: var(--ink-soft); }
.photo-grid { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }
.photo-thumb { width: 64px; height: 64px; border-radius: var(--radius-sm); object-fit: cover; border: 1px solid var(--border); }

/* ---------- Empty / error / login ---------- */
.empty-state { text-align: center; padding: 2.2rem 1rem; color: var(--ink-soft); }
.empty-state svg { width: 40px; height: 40px; margin-bottom: 0.6rem; opacity: 0.6; }
.error-banner { background: var(--danger-bg); color: var(--danger); border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem; font-size: 0.85rem; margin-bottom: 0.8rem; font-weight: 600; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-card { max-width: 360px; width: 100%; }
.login-mark { width: 56px; height: 56px; margin: 0 auto 1rem; display: block; }
.login-title { text-align: center; font-family: var(--font-display); font-size: 1.5rem; margin-bottom: 0.1rem; }
.login-sub { text-align: center; color: var(--ink-soft); font-size: 0.85rem; margin-bottom: 1.5rem; }

.hidden { display: none !important; }
