:root {
  --color-primary: #0f6e4f;
  --color-primary-dark: #0a4f38;
  --color-accent: #e07a1f;
  --color-danger: #c0392b;
  --color-bg: #f4f6f5;
  --color-surface: #ffffff;
  --color-border: #e1e5e3;
  --color-text: #1c2b26;
  --color-text-muted: #5b6b65;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: "Segoe UI", "Noto Sans Bengali", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

#app-root {
  padding: 12px 12px calc(76px + var(--safe-bottom));
  min-height: 100vh;
}

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow);
}
.app-header__title { font-weight: 700; font-size: 1.05rem; }
.app-header__user { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; }

/* ---------- Bottom Nav ---------- */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: flex;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding-bottom: var(--safe-bottom);
}
.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 2px 6px;
  text-decoration: none;
  color: var(--color-text-muted);
  font-size: 0.68rem;
}
.bottom-nav__item.is-active { color: var(--color-primary); font-weight: 600; }
.bottom-nav__icon { font-size: 1.1rem; }

/* ---------- Generic layout ---------- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}
.page-title { font-size: 1.15rem; font-weight: 700; margin: 4px 0 14px; }
.section-title { font-size: 0.95rem; font-weight: 700; margin: 0 0 10px; color: var(--color-primary-dark); }
.muted { color: var(--color-text-muted); font-size: 0.85rem; }

.grid { display: grid; gap: 12px; }
.grid--2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 420px) { .grid--2 { grid-template-columns: 1fr; } }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.dash-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 12px;
  text-align: center;
  text-decoration: none;
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
}
.dash-card:active { border-color: var(--color-primary); }
.dash-card__icon { font-size: 1.8rem; color: var(--color-primary); }
.dash-card__label { font-weight: 600; font-size: 0.88rem; }

/* ---------- Forms ---------- */
label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 4px; color: var(--color-text-muted); }
.field { margin-bottom: 12px; }
input[type="text"], input[type="number"], input[type="date"], input[type="password"],
select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: #fff;
  color: var(--color-text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--color-primary); outline-offset: 1px; }
input[type="file"] { width: 100%; font-size: 0.85rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--color-primary);
  color: #fff;
}
.btn:active { background: var(--color-primary-dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--block { width: 100%; }
.btn--sm { padding: 6px 10px; font-size: 0.78rem; }
.btn--ghost { background: rgba(255,255,255,0.15); color: #fff; }
.btn--outline { background: transparent; color: var(--color-primary); border: 1px solid var(--color-primary); }
.btn--danger { background: var(--color-danger); }
.btn--accent { background: var(--color-accent); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Table ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.data-table th, .data-table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.data-table th { color: var(--color-text-muted); font-weight: 600; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Badge ---------- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #e5f3ec;
  color: var(--color-primary-dark);
}
.badge--active { background: #e6f7ec; color: #1c7c3e; }
.badge--paused { background: #fdf0dd; color: var(--color-accent); }
.badge--completed { background: #e7eef5; color: #35587a; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; }
.tab {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
  cursor: pointer;
}
.tab.is-active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ---------- Map ---------- */
#map-container { width: 100%; height: 60vh; min-height: 360px; border-radius: var(--radius); overflow: hidden; }
.map-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 0.78rem; }
.map-legend__dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(86px + var(--safe-bottom));
  transform: translateX(-50%);
  background: #1c2b26;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 200;
  max-width: 90vw;
  text-align: center;
  box-shadow: var(--shadow);
}
.toast--error { background: var(--color-danger); }
.toast--success { background: var(--color-primary); }

/* ---------- Login ---------- */
.login-wrap {
  min-height: calc(100vh - 20px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card { width: 100%; max-width: 360px; }
.login-logo { text-align: center; font-weight: 800; font-size: 1.3rem; color: var(--color-primary-dark); margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--color-text-muted); font-size: 0.85rem; margin-bottom: 20px; }

/* ---------- Utility ---------- */
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mb-0 { margin-bottom: 0; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff;
  animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 30px 10px; color: var(--color-text-muted); }
