/* Rwanda Market Validation Tracker
   Palette chosen for a field tool used on patchy mobile data in Rwanda:
   system fonts only (no external font requests), high-contrast for
   outdoor screen glare, big tap targets. */

:root {
  --ink: #0E2124;
  --ink-soft: #4F7178;
  --paper: #F4F8F8;
  --card: #FFFFFF;
  --line: #DAE7E7;
  --deep: #00667B;       /* GreEnviro brand teal */
  --deep-dark: #012D35;  /* GreEnviro brand deep teal */
  --footer-bg: #003F46;  /* matches GreEnviro footer strip */
  --amber: #C9862B;
  --good: #2F855A;
  --good-bg: #E4F4EA;
  --warn: #B7791F;
  --warn-bg: #FBF0DA;
  --bad: #C0392B;
  --bad-bg: #FBE7E4;
  --neutral-bg: #ECF3F3;
  --shadow-sm: 0 4px 14px rgba(1,45,53,0.07);
  --shadow-md: 0 10px 26px rgba(1,45,53,0.14);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em; }

a { color: var(--deep); text-decoration: none; }

/* ---------- Login screen ---------- */
.login-body {
  min-height: 100vh;
  margin: 0;
  background: var(--deep-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-shell {
  width: 100%;
  max-width: 420px;
  min-height: 100vh;
  background: var(--paper);
  display: flex;
  flex-direction: column;
}
.login-hero {
  position: relative;
  background: linear-gradient(150deg, var(--deep-dark), var(--deep) 85%);
  padding: 52px 28px 72px;
  text-align: center;
  overflow: hidden;
}
.login-hero::before {
  content: "";
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}
.login-hero::after {
  content: "";
  position: absolute;
  bottom: -90px; left: -50px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}
.login-hero-wave {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  width: 100%; height: 34px;
  display: block;
}
.login-hero-logo { height: 42px; width: auto; margin-bottom: 20px; position: relative; z-index: 1; }
.login-hero-title {
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  max-width: 260px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
.login-hero-sub {
  color: #B9DDE2;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 8px;
  position: relative;
  z-index: 1;
}
.login-middle {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
}
.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--card);
  border-radius: 20px;
  padding: 28px 24px;
  margin-top: -46px;
  box-shadow: 0 16px 40px rgba(1,45,53,0.18);
  position: relative;
  z-index: 2;
}
.login-card h1 {
  font-size: 1.25rem;
  color: var(--deep-dark);
  margin: 0 0 18px;
  text-align: center;
}
.login-card .field input {
  text-align: left;
}
.login-card .btn-primary { margin-top: 6px; }
.hint { color: var(--ink-soft); font-size: 0.8rem; margin-top: 16px; text-align: center; }
.error { color: var(--bad); font-size: 0.9rem; margin-bottom: 8px; text-align: center; }

/* ---------- App shell ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(135deg, var(--deep-dark), var(--deep) 80%);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.topbar::before {
  content: "";
  position: absolute;
  top: -30px; right: 40px;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 7px; position: relative; z-index: 1; }
.brand img { height: 20px; width: auto; display: block; }
.brand .tag {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #CFEFF3;
  border-left: 1px solid rgba(255,255,255,0.35);
  padding-left: 7px;
}
.topbar-title { font-size: 1.05rem; font-weight: 700; }
.role-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  position: relative;
  z-index: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.role-admin { background: linear-gradient(135deg, #DDA24A, var(--amber)); color: #3A2A0C; }
.role-viewer { background: rgba(255,255,255,0.22); color: #fff; box-shadow: none; }

.content {
  padding: 16px 14px 90px;
  max-width: 640px;
  margin: 0 auto;
}

.bottomnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 18px rgba(1,45,53,0.08);
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
  z-index: 10;
}
.bottomnav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  color: var(--ink-soft);
  font-size: 0.65rem;
}
.bottomnav a span { font-size: 1.25rem; }
.bottomnav a.active { color: var(--deep); font-weight: 700; }
.bottomnav a.logout { color: var(--bad); }

/* ---------- Cards / lists ---------- */
.card {
  background: linear-gradient(165deg, #ffffff, #f9fcfc);
  border: 1px solid rgba(1,45,53,0.05);
  border-radius: 16px;
  padding: 15px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
a.card:active { box-shadow: 0 2px 8px rgba(1,45,53,0.10); transform: translateY(1px); }
.card h3 { margin: 0 0 4px; font-size: 1rem; }
.card .meta { color: var(--ink-soft); font-size: 0.82rem; margin-bottom: 6px; }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad  { background: var(--bad-bg);  color: var(--bad); }
.badge.neutral { background: var(--neutral-bg); color: var(--ink-soft); }

/* ---------- Dashboard KPI grid ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.kpi {
  background: linear-gradient(165deg, #ffffff, #f7fbfb);
  border: 1px solid rgba(1,45,53,0.05);
  border-radius: 16px;
  padding: 15px 13px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--deep), var(--amber));
  opacity: 0.7;
}
.kpi .num { font-size: 1.65rem; font-weight: 700; color: var(--deep-dark); line-height: 1.1; }
.kpi .label { font-size: 0.76rem; color: var(--ink-soft); margin-top: 2px; }
.kpi .target { font-size: 0.7rem; color: var(--ink-soft); opacity: 0.8; }

.section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--deep-dark);
  margin: 22px 0 10px;
  padding-left: 10px;
  border-left: 3px solid var(--amber);
}

.recommend-box {
  border-radius: 16px;
  padding: 18px 16px;
  margin-bottom: 18px;
  font-weight: 700;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: none !important;
}
.recommend-box.good { background: linear-gradient(135deg, #E4F4EA, #CFEEDC); color: var(--good); }
.recommend-box.warn { background: linear-gradient(135deg, #FBF0DA, #F7E2B8); color: var(--warn); }
.recommend-box.bad  { background: linear-gradient(135deg, #FBE7E4, #F6D2CC); color: var(--bad); }

/* ---------- Forms ---------- */
form.stack { display: flex; flex-direction: column; gap: 12px; }
.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--deep);
  box-shadow: 0 0 0 3px rgba(0,102,123,0.12);
}
.field textarea { min-height: 70px; resize: vertical; }
.score-grid {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 8px;
  align-items: center;
}
.score-grid label { font-size: 0.85rem; }
.score-grid select { padding: 8px; }

.btn {
  display: inline-block;
  padding: 13px 18px;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}
.btn-primary {
  background: linear-gradient(135deg, var(--deep-dark), var(--deep));
  color: #fff;
  width: 100%;
  box-shadow: 0 6px 16px rgba(1,45,53,0.25);
}
.btn-primary:active { background: var(--deep-dark); box-shadow: 0 2px 8px rgba(1,45,53,0.25); }
.btn-ghost { background: var(--neutral-bg); color: var(--ink); }
.btn-danger { background: var(--bad-bg); color: var(--bad); }
.btn-row { display: flex; gap: 10px; margin-top: 4px; }
.btn-row .btn { flex: 1; }

.fab {
  position: fixed;
  right: 18px;
  bottom: 76px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, #DDA24A, var(--amber));
  color: #fff;
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(201,134,43,0.45);
  z-index: 9;
  border: none;
}
.fab:active { box-shadow: 0 3px 10px rgba(201,134,43,0.45); }

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  padding: 40px 20px;
  font-size: 0.9rem;
}

.notice {
  background: var(--warn-bg);
  color: var(--warn);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  margin-bottom: 14px;
}

table.simple { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.simple th, table.simple td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
}
.scroll-x { overflow-x: auto; }

/* ---------- Simple one-line footer (login page only) ---------- */
.simple-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 16px;
  font-size: 0.7rem;
  color: #B9DDE2;
  background: var(--footer-bg);
  margin-top: auto;
}
.simple-footer img { height: 15px; width: auto; opacity: 0.95; }
.simple-footer b { color: #fff; font-weight: 700; }
