@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;600;700;800&family=Barlow:wght@400;500;600&display=swap');

:root {
  --sky: #4FC3E8;
  --sky-dark: #3AAECC;
  --earth1: #C4956A;
  --earth2: #8B6347;
  --earth3: #5C3D2E;
  --white: #FFFFFF;
  --off-white: #F5F7FA;
  --text-dark: #1A1A2E;
  --text-mid: #4A4A6A;
  --text-light: #8A8AAA;
  --border: #DDE3EC;
  --success: #2ECC71;
  --danger: #E74C3C;
  --warning: #F39C12;
  --shadow: 0 4px 24px rgba(79,195,232,0.12);
  --shadow-md: 0 8px 32px rgba(26,26,46,0.12);
  --nav-height: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Barlow', sans-serif;
  background: var(--off-white);
  min-height: 100vh;
  color: var(--text-dark);
}

/* ─── AUTH SCREEN ─── */
.auth-screen {
  display: none;
  min-height: 100vh;
  background: var(--text-dark);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 24px;
}
.auth-screen.active { display: flex; }

.auth-card {
  background: var(--white);
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.3);
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo img { height: 60px; }
.auth-logo h2 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-top: 12px;
  letter-spacing: 0.5px;
}
.auth-logo p {
  font-size: 0.85rem;
  color: var(--text-mid);
  margin-top: 4px;
}

.auth-tabs {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-mid);
  transition: all 0.2s;
  background: var(--off-white);
}
.auth-tab.active {
  background: var(--sky);
  color: white;
}

.auth-form { display: none; }
.auth-form.active { display: block; }

.auth-field { margin-bottom: 16px; }
.auth-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}
.auth-field input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-family: 'Barlow', sans-serif;
  font-size: 0.95rem;
  color: var(--text-dark);
  background: var(--off-white);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-field input:focus {
  outline: none;
  border-color: var(--sky);
  background: white;
  box-shadow: 0 0 0 3px rgba(79,195,232,0.15);
}

.auth-btn {
  width: 100%;
  padding: 13px;
  background: var(--sky);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 8px;
}
.auth-btn:hover { background: var(--sky-dark); }
.auth-btn:active { transform: scale(0.98); }

.auth-msg {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  display: none;
}
.auth-msg.error { background: #fdecea; color: var(--danger); display: block; }
.auth-msg.success { background: #eafaf1; color: #27ae60; display: block; }
.auth-msg.warning { background: #fef9e7; color: var(--warning); display: block; }

/* ─── PENDING / DENIED SCREENS ─── */
.status-screen {
  display: none;
  min-height: 100vh;
  background: var(--off-white);
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.status-screen.active { display: flex; }
.status-card {
  background: white;
  border-radius: 20px;
  padding: 48px 40px;
  text-align: center;
  max-width: 440px;
  box-shadow: var(--shadow-md);
}
.status-icon { font-size: 3rem; margin-bottom: 16px; }
.status-card h2 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 12px;
}
.status-card p { color: var(--text-mid); line-height: 1.6; }
.status-card .signout-link {
  display: inline-block;
  margin-top: 20px;
  color: var(--sky);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}

/* ─── MAIN APP ─── */
.app-screen { display: none; }
.app-screen.active { display: block; }

/* ─── HEADER ─── */
.header {
  background: var(--text-dark);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-sky {
  background: var(--sky);
  padding: 0 20px;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo-mark {
  width: 44px;
  height: 44px;
  border-radius: 9px;
  overflow: hidden;
  flex-shrink: 0;
}
.logo-mark img { width: 100%; height: 100%; object-fit: contain; }
.header-title { flex: 1; }
.header-title h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  color: white;
  letter-spacing: 0.5px;
  line-height: 1;
}
.header-title p {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.8);
  font-weight: 500;
  margin-top: 2px;
}
.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-name {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.9);
  font-weight: 600;
  display: none;
}
@media (min-width: 480px) { .user-name { display: block; } }
.signout-btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.signout-btn:hover { background: rgba(255,255,255,0.35); }

.header-soil { display: flex; height: 6px; }
.soil-layer { flex: 1; }
.soil-layer:nth-child(1) { background: var(--earth1); flex: 2; }
.soil-layer:nth-child(2) { background: var(--earth2); flex: 3; }
.soil-layer:nth-child(3) { background: var(--earth3); flex: 2; }

/* ─── NAV ─── */
.nav-bar {
  background: var(--text-dark);
  padding: 0 16px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-bar::-webkit-scrollbar { display: none; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  color: rgba(255,255,255,0.6);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.4px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.nav-link:hover { color: rgba(255,255,255,0.9); }
.nav-link.active { color: var(--sky); border-bottom-color: var(--sky); }
.nav-link .nav-icon { font-size: 1rem; }

/* ─── PAGE CONTENT ─── */
.page-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.page-header {
  margin-bottom: 24px;
}
.page-header h2 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: 0.3px;
}
.page-header p {
  color: var(--text-mid);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* ─── CARDS ─── */
.card {
  background: var(--white);
  border-radius: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.card-header {
  background: linear-gradient(135deg, var(--sky) 0%, var(--sky-dark) 100%);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-header.earth {
  background: linear-gradient(135deg, var(--earth2) 0%, var(--earth3) 100%);
}
.card-header.dark {
  background: linear-gradient(135deg, var(--text-dark) 0%, #2d2d4a 100%);
}
.card-icon {
  width: 28px; height: 28px;
  background: rgba(255,255,255,0.25);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.card-header h2 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: white;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.card-body { padding: 18px; }

/* ─── FORM ELEMENTS ─── */
.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }

label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}
label .req { color: var(--sky); margin-left: 2px; }

input[type="text"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="email"],
select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-family: 'Barlow', sans-serif;
  font-size: 0.95rem;
  color: var(--text-dark);
  background: var(--off-white);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  -webkit-appearance: none; appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--sky);
  background: white;
  box-shadow: 0 0 0 3px rgba(79,195,232,0.15);
}
input[readonly] { opacity: 0.7; cursor: not-allowed; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234FC3E8' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

@media (max-width: 500px) {
  .two-col { grid-template-columns: 1fr; }
  .three-col { grid-template-columns: 1fr 1fr; }
}

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 9px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.btn-primary { background: var(--sky); color: white; }
.btn-primary:hover { background: var(--sky-dark); }
.btn-earth { background: var(--earth2); color: white; }
.btn-earth:hover { background: var(--earth3); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-ghost {
  background: var(--off-white);
  color: var(--text-mid);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--border); }
.btn-sm { padding: 7px 12px; font-size: 0.8rem; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.submit-btn {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, var(--sky) 0%, var(--sky-dark) 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(79,195,232,0.4);
  transition: all 0.2s;
}
.submit-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(79,195,232,0.5); }
.submit-btn:active { transform: translateY(0); }
.submit-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ─── BADGES ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.badge-success { background: #eafaf1; color: #27ae60; }
.badge-danger { background: #fdecea; color: var(--danger); }
.badge-warning { background: #fef9e7; color: #d68910; }
.badge-info { background: #e8f6fd; color: var(--sky-dark); }
.badge-gray { background: #f0f0f5; color: var(--text-light); }

/* ─── TABLE ─── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  background: var(--off-white);
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-dark);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(79,195,232,0.04); }

/* ─── GPS ALERT ─── */
.gps-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 14px;
}
.gps-status.acquiring { background: #fef9e7; color: #d68910; }
.gps-status.success { background: #eafaf1; color: #27ae60; }
.gps-status.error { background: #fdecea; color: var(--danger); }

/* ─── LATE FLAG ─── */
.late-banner {
  background: #fdecea;
  border: 1.5px solid var(--danger);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 0.88rem;
  color: var(--danger);
  font-weight: 600;
}

/* ─── SUCCESS OVERLAY ─── */
.success-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,26,46,0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
}
.success-overlay.show { display: flex; }
.success-card {
  background: white;
  border-radius: 20px;
  padding: 40px 32px;
  text-align: center;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow-md);
}
.success-icon {
  width: 64px; height: 64px;
  background: var(--success);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  color: white;
  margin: 0 auto 16px;
}
.success-card h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.success-card p { color: var(--text-mid); font-size: 0.9rem; line-height: 1.5; }

/* ─── DIVIDER ─── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ─── FORM NOTE ─── */
.form-note {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 16px;
  line-height: 1.6;
}

/* ─── ERROR STYLES ─── */
.field-error {
  display: none;
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 4px;
  font-weight: 500;
}
.field-error.show { display: block; }
input.error, select.error, textarea.error { border-color: var(--danger); }

/* ─── LOADING ─── */
.loading-spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── STAT CARDS ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: white;
  border-radius: 12px;
  padding: 18px;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-number {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--sky);
}
.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-top: 4px;
}
.stat-card.danger .stat-number { color: var(--danger); }
.stat-card.success .stat-number { color: var(--success); }
.stat-card.warning .stat-number { color: var(--warning); }

/* ─── RECEIPT UPLOAD ─── */
.receipt-upload {
  border: 2px dashed var(--border);
  border-radius: 9px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.receipt-upload:hover { border-color: var(--sky); background: rgba(79,195,232,0.04); }
.receipt-upload input { display: none; }
.receipt-upload .upload-icon { font-size: 1.5rem; margin-bottom: 6px; }
.receipt-upload p { font-size: 0.82rem; color: var(--text-mid); }
.receipt-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.receipt-thumb {
  width: 64px; height: 64px;
  border-radius: 6px;
  object-fit: cover;
  border: 1.5px solid var(--border);
}

/* ─── TOTAL BAR ─── */
.total-bar {
  background: linear-gradient(135deg, var(--sky) 0%, var(--sky-dark) 100%);
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
  margin-top: 4px;
}
.total-bar .total-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  opacity: 0.9;
}
.total-bar .total-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
}
