/* ===== UPLIFT FIELD OPERATIONS PORTAL — STYLES ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:     #1a6b4a;
  --brand2:    #0f4a32;
  --brandL:    #e8f5ee;
  --brandXL:   #f2faf5;
  --brandGold: #f5c842;
  --brandGoldD:#c9980f;
  --ink:       #0d1117;
  --ink3:      #374151;
  --muted:     #6b7280;
  --muted2:    #9ca3af;
  --muted3:    #d1d5db;
  --line:      #e5e7eb;
  --lineL:     #f3f4f6;
  --bg:        #f8fafc;
  --white:     #ffffff;
  --red:       #dc2626;
  --redL:      #fef2f2;
  --redB:      #fecaca;
  --amber:     #d97706;
  --amberL:    #fffbeb;
  --amberB:    #fde68a;
  --blue:      #2563eb;
  --blueL:     #eff6ff;
  --teal:      #0d9488;
  --tealL:     #f0fdfa;
  --purple:    #7c3aed;
  --purpleL:   #f5f3ff;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
}

/* ===== LOGIN ===== */
.login-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #0f4a32 0%, #1a6b4a 60%, #1e8a5e 100%);
  padding: 20px 16px;
  position: relative;
}
.login-dots {
  position: fixed;
  inset: 0;
  opacity: .04;
  background-image: radial-gradient(circle at 25% 25%, white 1px, transparent 1px),
                    radial-gradient(circle at 75% 75%, white 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}
.login-box {
  width: 100%;
  max-width: 400px;
  position: relative;
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-icon {
  width: 64px; height: 64px;
  border-radius: 18px;
  margin: 0 auto 14px;
  background: linear-gradient(135deg, #f5c842, #c9980f);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
}
.login-title {
  font-family: 'Syne', sans-serif;
  font-size: 28px; font-weight: 800;
  color: #fff;
  letter-spacing: 3px;
  text-shadow: 0 2px 12px rgba(0,0,0,.3);
}
.login-sub {
  font-size: 12px;
  color: rgba(255,255,255,.55);
  letter-spacing: 4px;
  font-weight: 500;
  margin-top: 4px;
}
.login-card {
  background: #fff;
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: 0 32px 80px rgba(0,0,0,.4);
}
.login-card-title {
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 18px;
  color: var(--ink);
  margin-bottom: 4px;
  text-align: center;
}
.login-card-sub {
  font-size: 12px; color: var(--muted2);
  text-align: center; margin-bottom: 22px;
}
.login-error {
  background: var(--redL);
  border: 1px solid var(--redB);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--red);
  margin-bottom: 14px;
}

/* ===== LAYOUT ===== */
.app-wrap { min-height: 100dvh; background: var(--bg); }

/* ===== TOPBAR ===== */
.topbar {
  background: var(--brand2);
  padding: 0 24px;
  display: flex; align-items: center; gap: 16px;
  height: 56px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.topbar-logo {
  font-family: 'Syne', sans-serif;
  font-size: 18px; font-weight: 800;
  color: #fff; letter-spacing: 2px;
}
.topbar-badge {
  background: var(--brandGold);
  color: var(--brand2);
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
  letter-spacing: .5px;
}
.topbar-spacer { flex: 1; }
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  color: rgba(255,255,255,.8);
  font-size: 13px;
}
.topbar-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--brandGold);
  color: var(--brand2);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.topbar-signout {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.8);
  font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 8px;
  cursor: pointer; font-family: inherit;
  transition: .15s;
}
.topbar-signout:hover { background: rgba(255,255,255,.2); }

/* ===== NAV TABS ===== */
.nav-tabs {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  display: flex; overflow-x: auto;
  padding: 0 16px;
  gap: 2px;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 14px 16px;
  font-size: 13px; font-weight: 600;
  color: var(--muted);
  border: none; background: none;
  cursor: pointer; font-family: inherit;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: .15s;
}
.nav-tab:hover { color: var(--brand); }
.nav-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}
.nav-tab-icon { font-size: 15px; }

/* ===== MAIN CONTENT ===== */
.main-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

/* ===== DASHBOARD ===== */
.dash-header {
  margin-bottom: 24px;
}
.dash-title {
  font-family: 'Syne', sans-serif;
  font-size: 22px; font-weight: 800;
  color: var(--ink);
}
.dash-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.dash-card {
  background: var(--white);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.dash-card-icon { font-size: 24px; margin-bottom: 10px; }
.dash-card-val {
  font-family: 'Syne', sans-serif;
  font-size: 28px; font-weight: 800;
  color: var(--ink);
}
.dash-card-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.dash-recent-title {
  font-weight: 700; font-size: 15px;
  color: var(--ink); margin-bottom: 14px;
}
.dash-empty {
  text-align: center; padding: 40px 20px;
  color: var(--muted2); font-size: 14px;
}
.dash-empty-icon { font-size: 36px; margin-bottom: 10px; }
.dash-list { display: flex; flex-direction: column; gap: 10px; }
.dash-item {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
}
.dash-item-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dash-item-info { flex: 1; min-width: 0; }
.dash-item-name {
  font-weight: 600; font-size: 14px;
  color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-item-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.dash-item-badge {
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
  flex-shrink: 0;
}

/* ===== SECTION HEADER ===== */
.section-hdr {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--brandL);
}
.section-hdr-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.section-hdr-title {
  font-family: 'Syne', sans-serif;
  font-size: 17px; font-weight: 800;
  color: var(--ink);
}
.section-hdr-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ===== FORM CARD ===== */
.form-card {
  background: var(--white);
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.form-card-title {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 14px;
  color: var(--ink);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--lineL);
}
.form-card-icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
@media (max-width: 700px) { .form-row-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .form-row-3 { grid-template-columns: 1fr; } }

/* ===== FIELD ===== */
.field-wrap { margin-bottom: 0; }
.field-label {
  display: block;
  font-size: 11px; font-weight: 700;
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .7px;
}
.field-label .req { color: var(--red); margin-left: 3px; }
.field-input, .field-select, .field-textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  font-size: 14px;
  color: var(--ink);
  background: var(--white);
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.field-input:focus, .field-select:focus, .field-textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26,107,74,.1);
}
.field-input.error, .field-select.error { border-color: var(--red); }
.field-select { appearance: none; cursor: pointer; }
.field-textarea { resize: vertical; min-height: 80px; }
.field-hint { font-size: 11px; color: var(--muted2); margin-top: 4px; }
.field-error { font-size: 11px; color: var(--red); margin-top: 4px; }

/* Pincode field */
.pincode-wrap { position: relative; }
.pincode-status {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 12px; font-weight: 600;
}
.pincode-status.found { color: var(--brand); }
.pincode-status.notfound { color: var(--red); }
.pincode-status.loading { color: var(--muted2); }

/* ===== SUBMIT BUTTON ===== */
.btn-submit {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  background: var(--brand);
  color: var(--white);
  border: none;
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 20px rgba(26,107,74,.33);
  transition: .2s;
  margin-top: 8px;
}
.btn-submit:hover { background: var(--brand2); transform: translateY(-1px); }
.btn-submit:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.btn-secondary {
  padding: 10px 20px;
  border-radius: 10px;
  background: var(--brandXL);
  color: var(--brand);
  border: 1.5px solid var(--brandL);
  font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: .15s;
}
.btn-secondary:hover { background: var(--brandL); }

.btn-danger {
  padding: 7px 14px;
  border-radius: 8px;
  background: var(--redL);
  color: var(--red);
  border: 1px solid var(--redB);
  font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: .15s;
}
.btn-danger:hover { background: var(--redB); }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--ink);
  color: var(--white);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
  z-index: 9999;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
  white-space: nowrap;
  max-width: 90vw;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--brand); }
.toast.error { background: var(--red); }
.toast.info { background: var(--blue); }

/* ===== MANAGE ACCESS ===== */
.access-section {
  background: var(--brandXL);
  border: 1px solid var(--brandL);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 24px;
}
.access-section-title {
  font-weight: 600; font-size: 13px;
  color: var(--brand);
  margin-bottom: 14px;
}
.access-list { display: flex; flex-direction: column; gap: 10px; }
.access-item {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
}
.access-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  color: var(--white);
  flex-shrink: 0;
}
.access-info { flex: 1; min-width: 0; }
.access-name { font-weight: 600; font-size: 14px; color: var(--ink); }
.access-email { font-size: 12px; color: var(--muted); margin-top: 2px; }
.access-meta { font-size: 11px; color: var(--muted2); margin-top: 3px; }
.access-empty {
  text-align: center; padding: 32px 20px;
  color: var(--muted2); font-size: 13px;
}

/* ===== PROJECT SECTION ===== */
.project-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.project-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex; align-items: flex-start; gap: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.project-card-icon {
  width: 42px; height: 42px;
  border-radius: 11px;
  background: var(--brandXL);
  border: 1px solid var(--brandL);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.project-card-body { flex: 1; min-width: 0; }
.project-card-name {
  font-weight: 700; font-size: 15px;
  color: var(--ink);
}
.project-card-prog {
  font-size: 12px; color: var(--brand);
  font-weight: 600; margin-top: 3px;
}
.project-card-loc {
  font-size: 12px; color: var(--muted);
  margin-top: 4px;
  display: flex; align-items: center; gap: 4px;
}
.project-card-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 8px;
}
.project-tag {
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
  background: var(--brandXL);
  color: var(--brand);
  border: 1px solid var(--brandL);
}
.project-card-actions {
  display: flex; gap: 8px;
  flex-shrink: 0;
}

/* ===== CREATE PROJECT MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--white);
  border-radius: 20px;
  padding: 28px;
  width: 100%; max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 32px 80px rgba(0,0,0,.3);
}
.modal-title {
  font-family: 'Syne', sans-serif;
  font-size: 18px; font-weight: 800;
  color: var(--ink);
  margin-bottom: 4px;
}
.modal-sub { font-size: 13px; color: var(--muted); margin-bottom: 22px; }
.modal-footer {
  display: flex; gap: 10px;
  margin-top: 20px;
}
.modal-footer .btn-submit { flex: 1; margin-top: 0; }

/* ===== POSTCODE LOOKUP RESULT ===== */
.postcode-result {
  background: var(--brandXL);
  border: 1px solid var(--brandL);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 8px;
  font-size: 13px;
}
.postcode-result-title {
  font-weight: 700; font-size: 12px;
  color: var(--brand);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.postcode-result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
}
.postcode-result-row { font-size: 12px; color: var(--ink3); }
.postcode-result-row span { color: var(--muted); }

/* ===== API KEY BANNER ===== */
.api-key-banner {
  background: var(--amberL);
  border: 1px solid var(--amberB);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  display: flex; align-items: flex-start; gap: 10px;
}
.api-key-banner-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.api-key-banner-text { font-size: 13px; color: var(--amber); }
.api-key-banner-text strong { display: block; font-weight: 700; margin-bottom: 4px; }
.api-key-input-row {
  display: flex; gap: 8px; margin-top: 10px;
}
.api-key-input-row input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--amberB);
  border-radius: 8px;
  font-size: 13px;
  font-family: monospace;
  background: var(--white);
  outline: none;
}
.api-key-input-row input:focus { border-color: var(--amber); }
.btn-save-key {
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--amber);
  color: var(--white);
  border: none;
  font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}

/* ===== MISC ===== */
.divider { height: 1px; background: var(--line); margin: 20px 0; }
.badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
}
.badge-green { background: var(--brandXL); color: var(--brand); border: 1px solid var(--brandL); }
.badge-amber { background: var(--amberL); color: var(--amber); border: 1px solid var(--amberB); }
.badge-blue  { background: var(--blueL);  color: var(--blue);  border: 1px solid #bfdbfe; }
.badge-red   { background: var(--redL);   color: var(--red);   border: 1px solid var(--redB); }

.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted2);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state-title { font-weight: 700; font-size: 15px; color: var(--ink3); margin-bottom: 6px; }
.empty-state-sub { font-size: 13px; }