/* ============================================================
   UPDF eLTE Site Survey — Clean Military Theme
   Palette: white/light grey base, olive green accents
   Tone: subtle, understated, professional
   Fonts: Rajdhani (headings) · Source Sans 3 (body) · Share Tech Mono (data)
   ============================================================ */

:root {
  /* ── Base surfaces ── */
  --bg-page:       #f4f5f2;        /* warm off-white */
  --bg-panel:      #ffffff;
  --bg-card:       #ffffff;
  --bg-input:      #f8f9f7;
  --bg-hover:      #f0f2ee;
  --bg-nav:        #1e2820;        /* deep military green */
  --bg-topbar:     #1e2820;

  /* ── Borders ── */
  --border-light:  #dde0da;
  --border-mid:    #c8cdc3;
  --border-strong: #a8b0a2;

  /* ── Olive green accent ── */
  --accent:        #5a7a45;        /* primary olive green */
  --accent-light:  #7a9c62;
  --accent-pale:   #eef2ea;        /* very pale green for backgrounds */
  --accent-dim:    rgba(90,122,69,.15);

  /* ── Status colours — muted ── */
  --green:         #3d7a4a;
  --green-pale:    #eaf3ec;
  --amber:         #8a6a1e;
  --amber-pale:    #fdf6e3;
  --red:           #8a2a2a;
  --red-pale:      #fdf0f0;
  --blue:          #2a5a8a;
  --blue-pale:     #eef4fb;

  /* ── Text ── */
  --text-primary:  #1a2218;        /* near black, warm */
  --text-secondary:#4a5845;        /* mid olive-grey */
  --text-muted:    #8a9485;        /* light muted */
  --text-inverse:  #f4f5f2;        /* on dark backgrounds */

  /* ── Fonts ── */
  --font-head:     'Rajdhani', sans-serif;
  --font-body:     'Source Sans 3', sans-serif;
  --font-mono:     'Share Tech Mono', monospace;

  /* ── Shape & motion ── */
  --radius:        4px;
  --radius-lg:     8px;
  --radius-xl:     12px;
  --shadow-sm:     0 1px 4px rgba(30,40,26,.08);
  --shadow-md:     0 2px 12px rgba(30,40,26,.10);
  --shadow-lg:     0 4px 24px rgba(30,40,26,.13);
  --transition:    .16s ease;

  /* ── Layout ── */
  --nav-w:         220px;
  --top-h:         56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--top-h);
  background: var(--bg-topbar);
  border-bottom: 3px solid var(--accent);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.4rem; z-index: 1000;
  box-shadow: var(--shadow-md);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: .8rem; }
.topbar-center { display: flex; align-items: center; gap: 1.4rem; flex: 1; justify-content: center; }

.topbar-logo { display: flex; align-items: center; gap: .75rem; }
.logo-icon    { font-size: 1.5rem; color: var(--accent-light); }
.logo-title   { font-family: var(--font-head); font-weight: 700; font-size: 1.1rem;
                letter-spacing: .08em; color: #ffffff; line-height: 1.1; }
.logo-sub     { font-family: var(--font-mono); font-size: .58rem;
                color: rgba(255,255,255,.45); letter-spacing: .12em; }

.contract-badge {
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .1em;
  color: var(--accent-light);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius); padding: .2rem .7rem;
}
.status-indicators { display: flex; align-items: center; gap: .5rem; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.status-dot.green  { background: var(--accent-light); box-shadow: 0 0 5px var(--accent-light); }
.status-dot.orange { background: #c8901a; }
.status-dot.pulse  { animation: pulseAnim 1.6s ease-in-out infinite; }
@keyframes pulseAnim { 0%,100%{opacity:1;} 50%{opacity:.35;} }
.status-label { font-family: var(--font-mono); font-size: .62rem;
                color: rgba(255,255,255,.45); letter-spacing: .07em; margin-right: .3rem; }

.user-info    { text-align: right; }
.user-rank    { font-family: var(--font-mono); font-size: .58rem; color: rgba(255,255,255,.4); letter-spacing: .1em; }
.user-name    { font-family: var(--font-head); font-weight: 600; font-size: .95rem; color: #fff; }
.user-role    { font-family: var(--font-mono); font-size: .56rem; letter-spacing: .1em;
                padding: .1rem .4rem; border-radius: 2px; display: inline-block; }
.role-admin      { background: rgba(138,42,42,.3);  color: #e8a0a0; }
.role-surveyor   { background: rgba(138,106,30,.3); color: #e8cc80; }
.role-data_entry { background: rgba(42,90,138,.3);  color: #a0c0e8; }
.role-viewer     { background: rgba(61,122,74,.3);  color: #a0d0a8; }

.btn-logout {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.6); text-decoration: none; font-size: 1rem;
  transition: var(--transition);
}
.btn-logout:hover { background: var(--red-pale); border-color: var(--red); color: var(--red); }

/* ── Side Nav ────────────────────────────────────────────── */
.sidenav {
  position: fixed; top: var(--top-h); left: 0; width: var(--nav-w);
  height: calc(100vh - var(--top-h));
  background: var(--bg-nav);
  border-right: 1px solid rgba(255,255,255,.06);
  display: flex; flex-direction: column; padding: 1rem 0;
  z-index: 900;
}
.nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem 1.4rem; text-decoration: none;
  color: rgba(255,255,255,.5);
  font-family: var(--font-head); font-weight: 500;
  font-size: .92rem; letter-spacing: .04em;
  border-left: 3px solid transparent;
  transition: var(--transition);
}
.nav-item:hover  { background: rgba(255,255,255,.05); color: rgba(255,255,255,.85); border-left-color: rgba(255,255,255,.2); }
.nav-item.active { background: rgba(90,122,69,.2); color: var(--accent-light); border-left-color: var(--accent-light); }
.nav-icon { font-size: .95rem; width: 20px; text-align: center; }
.nav-spacer { flex: 1; }
.nav-classified {
  padding: .9rem 1.4rem;
  font-family: var(--font-mono); font-size: .58rem;
  color: rgba(255,255,255,.2); letter-spacing: .14em;
  border-top: 1px solid rgba(255,255,255,.06); line-height: 1.8;
}

/* ── Main layout ─────────────────────────────────────────── */
.main-content {
  margin-left: var(--nav-w); margin-top: var(--top-h);
  min-height: calc(100vh - var(--top-h));
  display: flex; flex-direction: column;
}
.page-header-bar {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-light);
  padding: .85rem 2rem;
  display: flex; align-items: baseline; justify-content: space-between;
  box-shadow: var(--shadow-sm);
}
.page-title { font-family: var(--font-head); font-weight: 700;
               font-size: 1.4rem; letter-spacing: .05em; color: var(--text-primary); }
.page-breadcrumb { font-family: var(--font-mono); font-size: .62rem;
                   color: var(--text-muted); letter-spacing: .08em; }
.content-area { flex: 1; padding: 1.8rem 2rem; }
.app-footer {
  margin-left: var(--nav-w); background: var(--bg-panel);
  border-top: 1px solid var(--border-light);
  padding: .6rem 2rem; display: flex; gap: 2rem;
  font-family: var(--font-mono); font-size: .6rem;
  color: var(--text-muted); letter-spacing: .07em;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  opacity: .5;
}
.card-title {
  font-family: var(--font-head); font-weight: 600; font-size: 1rem;
  letter-spacing: .05em; color: var(--accent); margin-bottom: .9rem;
}
.mb-2 { margin-bottom: 1rem; }

/* ── KPI tiles ───────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(160px,1fr));
            gap: 1rem; margin-bottom: 1.6rem; }
.kpi-tile {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: var(--transition);
}
.kpi-tile:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: var(--border-mid); }
.kpi-tile-label { font-family: var(--font-mono); font-size: .58rem;
                  color: var(--text-muted); letter-spacing: .12em; margin-bottom: .3rem; }
.kpi-tile-value { font-family: var(--font-head); font-weight: 700;
                  font-size: 2.2rem; line-height: 1; color: var(--text-primary); }
.kpi-tile-sub   { font-size: .74rem; color: var(--text-muted); margin-top: .2rem; }
.kpi-corner     { position: absolute; bottom: .6rem; right: .8rem;
                  font-size: 1.5rem; opacity: .06; }
.kpi-tile.accent .kpi-tile-value { color: var(--accent); }
.kpi-tile.amber  .kpi-tile-value { color: var(--amber);  }
.kpi-tile.red    .kpi-tile-value { color: var(--red);    }
.kpi-tile.green  .kpi-tile-value { color: var(--green);  }

/* ── Progress bar ────────────────────────────────────────── */
.progress-wrap { margin-bottom: 1.4rem; }
.progress-label { font-family: var(--font-mono); font-size: .63rem; color: var(--text-muted);
                  letter-spacing: .07em; margin-bottom: .4rem;
                  display: flex; justify-content: space-between; }
.progress-bar  { height: 5px; background: var(--border-light); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px;
                 background: linear-gradient(90deg, var(--accent), var(--accent-light));
                 transition: width .5s ease; }

/* ── Tables ──────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th {
  font-family: var(--font-head); font-weight: 600; font-size: .76rem;
  letter-spacing: .08em; color: var(--text-muted); text-transform: uppercase;
  padding: .6rem 1rem; border-bottom: 2px solid var(--border-light);
  text-align: left; background: var(--bg-page);
}
.data-table td { padding: .65rem 1rem; border-bottom: 1px solid var(--border-light); color: var(--text-secondary); vertical-align: middle; }
.data-table tr:hover td { background: var(--accent-pale); color: var(--text-primary); }
.data-table .mono { font-family: var(--font-mono); font-size: .78rem; }

/* ── Badges ──────────────────────────────────────────────── */
.badge { display: inline-block; padding: .18rem .55rem; border-radius: 3px;
         font-family: var(--font-mono); font-size: .62rem; letter-spacing: .07em;
         font-weight: 600; border: 1px solid transparent; }
.badge-green { background: var(--green-pale); color: var(--green); border-color: rgba(61,122,74,.25); }
.badge-amber { background: var(--amber-pale); color: var(--amber); border-color: rgba(138,106,30,.25); }
.badge-red   { background: var(--red-pale);   color: var(--red);   border-color: rgba(138,42,42,.25); }
.badge-blue  { background: var(--blue-pale);  color: var(--blue);  border-color: rgba(42,90,138,.25); }
.badge-gray  { background: var(--bg-page);    color: var(--text-muted); border-color: var(--border-mid); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  font-family: var(--font-head); font-weight: 600; font-size: .92rem;
  letter-spacing: .05em; padding: .55rem 1.3rem; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: .45rem;
  transition: var(--transition); white-space: nowrap;
}
.btn-primary  { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-light); border-color: var(--accent-light); }
.btn-outline  { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-outline:hover { background: var(--accent-pale); }
.btn-danger   { background: var(--red-pale); color: var(--red); border-color: rgba(138,42,42,.3); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-amber    { background: var(--amber-pale); color: var(--amber); border-color: rgba(138,106,30,.3); }
.btn-sm       { padding: .32rem .8rem; font-size: .8rem; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-label { font-family: var(--font-head); font-weight: 600; font-size: .88rem;
              color: var(--text-primary); letter-spacing: .03em; }
.form-label .req, .req { color: var(--red); margin-left: 2px; }
.form-hint  { font-size: .73rem; color: var(--text-muted); font-style: italic; line-height: 1.3; }

input[type=text], input[type=date], input[type=number],
input[type=email], input[type=password], select, textarea {
  background: var(--bg-input); border: 1px solid var(--border-mid);
  border-radius: var(--radius); color: var(--text-primary);
  font-family: var(--font-body); font-size: .9rem;
  padding: .5rem .75rem; width: 100%; outline: none;
  transition: var(--transition); -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim);
}
textarea { resize: vertical; min-height: 72px; }
select option { background: #fff; }

/* ── Flash messages ──────────────────────────────────────── */
.flash { padding: .8rem 1.1rem; border-radius: var(--radius);
         margin-bottom: 1.1rem; font-size: .88rem; border-left: 3px solid; }
.flash-success { background: var(--green-pale); border-color: var(--green); color: var(--green); }
.flash-error   { background: var(--red-pale);   border-color: var(--red);   color: var(--red); }
.flash-info    { background: var(--blue-pale);  border-color: var(--blue);  color: var(--blue); }

/* ── Dashboard layout ────────────────────────────────────── */
.dashboard-grid { display: grid; grid-template-columns: 1fr 340px; gap: 1.4rem; }
@media(max-width:1100px){ .dashboard-grid{ grid-template-columns:1fr; } }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
@media(max-width:700px){ .grid-2{ grid-template-columns:1fr; } }

/* ── Login page ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg-page); position: relative;
}
.login-bg { position: absolute; inset: 0; overflow: hidden;
  background: linear-gradient(135deg, #1e2820 0%, #2d3d25 60%, #f4f5f2 100%); }
.login-grid {
  position: absolute; inset: 0; opacity: .03;
  background-image: linear-gradient(var(--border-mid) 1px,transparent 1px),
                    linear-gradient(90deg,var(--border-mid) 1px,transparent 1px);
  background-size: 40px 40px;
}
.login-card {
  position: relative; width: 100%; max-width: 400px;
  background: var(--bg-panel); border: 1px solid var(--border-mid);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius-lg); padding: 2.4rem;
  box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 1.8rem; }
.login-logo .hex { font-size: 2.6rem; color: var(--accent); display: block; margin-bottom: .4rem; }
.login-logo h1 { font-family: var(--font-head); font-weight: 700; font-size: 1.6rem;
                 letter-spacing: .1em; color: var(--text-primary); }
.login-logo div { font-family: var(--font-mono); font-size: .62rem;
                  color: var(--text-muted); letter-spacing: .12em; margin-top: .2rem; }
.login-classified {
  text-align: center; margin-bottom: 1.4rem;
  background: var(--red-pale); border: 1px solid rgba(138,42,42,.2);
  border-radius: var(--radius); padding: .4rem;
  font-family: var(--font-mono); font-size: .62rem; color: var(--red); letter-spacing: .1em;
}
.login-form { display: flex; flex-direction: column; gap: .9rem; }
.login-input-wrap label { font-family: var(--font-head); font-size: .86rem;
                          font-weight: 600; letter-spacing: .03em;
                          color: var(--text-secondary); display: block; margin-bottom: .3rem; }

/* ── Survey Tab System ───────────────────────────────────── */
.survey-tab-nav {
  display: flex; flex-wrap: wrap; gap: .3rem;
  margin-bottom: .8rem; padding: .6rem;
  background: var(--bg-panel); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.survey-tab {
  display: flex; align-items: center; gap: .3rem;
  padding: .38rem .7rem; border-radius: var(--radius);
  border: 1px solid var(--border-light);
  text-decoration: none; color: var(--text-muted);
  font-family: var(--font-head); font-size: .8rem; font-weight: 500;
  letter-spacing: .03em; transition: var(--transition); white-space: nowrap;
  background: var(--bg-page);
}
.survey-tab:hover  { background: var(--accent-pale); color: var(--accent); border-color: var(--accent); }
.survey-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.survey-tab.done   { border-color: var(--green); color: var(--green); background: var(--green-pale); }
.survey-tab.done.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tab-icon  { font-size: .8rem; }
.tab-num   { font-family: var(--font-mono); font-size: .65rem; opacity: .65; }
.survey-tab.active .tab-num { opacity: .8; }
.tab-label { font-size: .8rem; }
.tab-done  { font-size: .68rem; margin-left: .1rem; }

.tab-progress-wrap { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.2rem; }
.tab-progress-bar  { flex: 1; height: 4px; background: var(--border-light); border-radius: 3px; overflow: hidden; }
.tab-progress-fill { height: 100%; background: linear-gradient(90deg,var(--accent),var(--accent-light)); border-radius: 3px; transition: width .4s ease; }
.tab-progress-label { font-family: var(--font-mono); font-size: .62rem; color: var(--text-muted); white-space: nowrap; letter-spacing: .07em; }

.tab-panel {
  background: var(--bg-panel); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 1.6rem;
  margin-bottom: 1rem; min-height: 300px; box-shadow: var(--shadow-sm);
}
.tab-title    { font-family: var(--font-head); font-weight: 700; font-size: 1.15rem;
                letter-spacing: .05em; color: var(--accent); margin-bottom: .2rem; }
.tab-subtitle { font-size: .8rem; color: var(--text-muted); font-style: italic; margin-bottom: 1.3rem; }
.tab-actions  { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap;
                padding: .9rem 0; border-top: 1px solid var(--border-light); }

/* ── Compact question grid ───────────────────────────────── */
.cq-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.cq-group { display: flex; flex-direction: column; gap: .28rem; }
.cq-group.full { grid-column: 1 / -1; }
.cq-label { font-family: var(--font-head); font-weight: 600; font-size: .86rem;
            color: var(--text-primary); letter-spacing: .03em; }
.cq-hint  { font-size: .72rem; color: var(--text-muted); font-style: italic; line-height: 1.3; }
@media(max-width:700px){ .cq-grid{ grid-template-columns:1fr; } }

/* ── Site picker / search dropdowns ─────────────────────── */
.compact-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 600;
  background: var(--bg-panel); border: 1px solid var(--border-mid);
  border-top: none; border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-md);
}
.dd-opt {
  padding: .42rem .8rem; cursor: pointer; font-size: .86rem;
  color: var(--text-secondary); transition: var(--transition); border-bottom: 1px solid var(--border-light);
}
.dd-opt:last-child { border-bottom: none; }
.dd-opt:hover { background: var(--accent-pale); color: var(--accent); }
.dd-group {
  padding: .28rem .8rem; font-family: var(--font-mono); font-size: .58rem;
  letter-spacing: .1em; color: var(--accent); background: var(--bg-page);
  border-top: 1px solid var(--border-light); border-bottom: 1px solid var(--border-light);
  text-transform: uppercase;
}
.dd-add {
  padding: .42rem .8rem; cursor: pointer; font-size: .84rem;
  color: var(--accent); border-top: 1px solid var(--border-light);
  font-style: italic;
}
.dd-add:hover { background: var(--accent-pale); }

.site-picker-wrap { display: flex; flex-direction: column; gap: .4rem; position: relative; }
.site-search-input { width: 100%; }
.selected-tag {
  display: flex; align-items: center; gap: .6rem;
  background: var(--accent-pale); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: .38rem .8rem;
}
.tag-code  { font-family: var(--font-mono); font-size: .8rem; color: var(--accent); font-weight: 600; }
.tag-name  { font-size: .84rem; color: var(--text-primary); flex: 1; }
.tag-clear { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: .9rem; padding: 0; transition: var(--transition); }
.tag-clear:hover { color: var(--red); }
.btn-add-inline {
  align-self: flex-start; background: none; border: 1px dashed var(--border-mid);
  border-radius: var(--radius); color: var(--accent); font-size: .76rem;
  padding: .22rem .65rem; cursor: pointer; transition: var(--transition);
  font-family: var(--font-body);
}
.btn-add-inline:hover { border-color: var(--accent); background: var(--accent-pale); }

/* ── Modals ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(30,40,26,.45);
  z-index: 9000; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-box {
  background: var(--bg-panel); border: 1px solid var(--border-mid);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-lg); padding: 1.8rem;
  width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
}
.modal-title { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem;
               color: var(--accent); margin-bottom: 1rem; letter-spacing: .05em; }

/* ── Submissions filter card ─────────────────────────────── */
.filter-bar { background: var(--bg-panel); border: 1px solid var(--border-light);
              border-radius: var(--radius-lg); padding: 1rem 1.2rem;
              margin-bottom: 1.2rem; box-shadow: var(--shadow-sm); }

/* ── Utility ─────────────────────────────────────────────── */
.text-accent   { color: var(--accent); }
.text-amber    { color: var(--amber); }
.text-red      { color: var(--red); }
.text-green    { color: var(--green); }
.text-mid      { color: var(--text-secondary); }
.text-muted    { color: var(--text-muted); }
.text-mono     { font-family: var(--font-mono); }
.text-head     { font-family: var(--font-head); }
.flex-between  { display: flex; justify-content: space-between; align-items: center; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; }

/* ── Scan line removed (light theme) ────────────────────── */
.scan-line { display: none; }

/* ── OSM map controls ────────────────────────────────────── */
#osm-map .leaflet-control-attribution { background: rgba(244,245,242,.85) !important; font-size: .6rem !important; }
#osm-map .leaflet-bar a { background: var(--bg-panel) !important; color: var(--text-primary) !important; border-color: var(--border-mid) !important; }
#osm-map .leaflet-bar a:hover { background: var(--accent-pale) !important; color: var(--accent) !important; }

/* ── Admin role permissions matrix ──────────────────────── */
.perm-check { color: var(--green); font-size: 1rem; font-weight: 700; }
.perm-cross { color: var(--text-muted); }

/* ── Print ───────────────────────────────────────────────── */
@media print {
  .sidenav, .topbar, .app-footer, .page-header-bar, .btn, button { display: none !important; }
  .main-content { margin: 0 !important; }
  .card::before { display: none; }
  body { background: white; }
}

/* ── Responsive ──────────────────────────────────────────── */
@media(max-width:768px){
  .sidenav { transform: translateX(-100%); }
  .main-content, .app-footer { margin-left: 0; }
  .topbar-center { display: none; }
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Site code / name split picker ──────────────────────────── */
.site-code-wrap { position: relative; }

/* Dropdown items: code badge + name + district inline */
.dd-site-item {
  display: flex; align-items: baseline; gap: .6rem;
  padding: .45rem .9rem; cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
}
.dd-site-item:last-child { border-bottom: none; }
.dd-site-item:hover { background: var(--accent-pale); }
.dd-site-code {
  font-family: var(--font-mono); font-size: .78rem; font-weight: 700;
  color: var(--accent); white-space: nowrap; min-width: 160px;
}
.dd-site-name  { font-size: .86rem; color: var(--text-primary); flex: 1; }
.dd-site-dist  { font-size: .75rem; color: var(--text-muted); white-space: nowrap; }

/* Selected state — shown below the search input */
.site-selected-tag {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--accent-pale); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: .32rem .75rem;
  margin-top: .3rem;
}
.site-selected-tag .tag-code {
  font-family: var(--font-mono); font-size: .82rem;
  font-weight: 700; color: var(--accent);
}

/* Compact dropdown scrollbar */
.compact-dropdown::-webkit-scrollbar { width: 5px; }
.compact-dropdown::-webkit-scrollbar-track { background: var(--bg-page); }
.compact-dropdown::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 3px; }

/* ── Map z-index fix — keep below topbar and sidenav ─────────── */
#osm-map { z-index: 1 !important; }
.leaflet-top,
.leaflet-bottom { z-index: 400 !important; }   /* below topbar (1000) and sidenav (900) */

/* Prevent map from creeping over topbar when scrolled */
#osm-map .leaflet-control-container { z-index: 400 !important; }

/* ── Photo upload grid ───────────────────────────────────────── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .9rem;
  margin-bottom: .5rem;
}
.photo-slot {
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: .9rem;
  display: flex; flex-direction: column; gap: .4rem;
  transition: var(--transition);
}
.photo-slot:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.photo-slot-label {
  font-family: var(--font-head); font-weight: 600; font-size: .84rem;
  color: var(--text-primary); line-height: 1.3;
}
.photo-preview-wrap {
  width: 100%; aspect-ratio: 4/3; overflow: hidden;
  border-radius: var(--radius); background: var(--border-light);
  display: flex; align-items: center; justify-content: center;
}
.photo-thumb {
  width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius);
}
.photo-preview-name {
  font-family: var(--font-mono); font-size: .62rem; color: var(--text-muted);
  text-overflow: ellipsis; overflow: hidden; white-space: nowrap;
  margin-top: .2rem;
}
.photo-slot-actions {
  display: flex; gap: .4rem; flex-wrap: wrap; margin-top: auto;
}
.btn-photo-action {
  flex: 1; min-width: 0; cursor: pointer;
  background: var(--bg-panel); border: 1px solid var(--border-mid);
  border-radius: var(--radius); padding: .35rem .5rem;
  font-size: .78rem; font-family: var(--font-body);
  color: var(--accent); text-align: center;
  transition: var(--transition); display: block;
}
.btn-photo-action:hover { background: var(--accent-pale); border-color: var(--accent); }
.btn-photo-clear {
  background: var(--red-pale); border: 1px solid rgba(138,42,42,.2);
  border-radius: var(--radius); padding: .35rem .6rem;
  font-size: .78rem; color: var(--red); cursor: pointer;
  transition: var(--transition);
}
.btn-photo-clear:hover { background: var(--red); color: #fff; }

/* ── DC requirement radio buttons ───────────────────────────── */
.dc-req-btn {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem 1rem; border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg); cursor: pointer;
  flex: 1; transition: var(--transition);
  font-size: .9rem; font-family: var(--font-body);
  color: var(--text-secondary);
}
.dc-req-btn:hover { border-color: var(--accent); background: var(--accent-pale); }
.dc-req-btn input[type=radio] {
  width: 16px; height: 16px; min-width: 16px; accent-color: var(--accent);
  border: none; background: transparent; box-shadow: none; padding: 0; width: auto;
}
.dc-req-btn:has(input:checked) {
  border-color: var(--accent); background: var(--accent-pale); color: var(--accent); font-weight: 600;
}

/* ── Camera modal video ──────────────────────────────────────── */
#cameraVideo {
  width: 100%;
  max-height: 360px;
  border-radius: var(--radius);
  display: block;
  background: #000;
}

/* ── View page compact table ─────────────────────────────────── */
.view-table { width:100%; border-collapse:collapse; font-size:.82rem; }
.view-table td { padding:.28rem .5rem; border-bottom:1px solid var(--border-light); vertical-align:top; }
.view-table td:first-child { color:var(--text-muted); font-family:var(--font-mono); font-size:.68rem; letter-spacing:.06em; width:42%; }
.view-table td:last-child  { color:var(--text-primary); }

/* ── Locked tabs ─────────────────────────────────────────────── */
.survey-tab.locked {
  opacity: .38;
  cursor: not-allowed !important;
  pointer-events: none;
  filter: grayscale(0.4);
}
