:root {
  --primary: #a81815;
  --primary-dark: #8a1210;
  --bg: #f6f8fa;
  --card-bg: #ffffff;
  --text: #1a2733;
  --border: #d1dbe8;
  --success-bg: #e6eeff;
  --success-text: #003d99;
  --tab-inactive: #e1e4e8;
  --tab-active-bg: #fff;
  --tab-active-text: #a81815;
}
body {
  background: var(--bg);
  font-family: 'Segoe UI', Arial, sans-serif;
  margin: 0; padding: 0;
  color: var(--text);
}

/* HEADER STYLES */
.header {
  background: var(--primary);
  color: #fff;
  padding: 20px 40px;
  border-radius: 0 0 16px 16px;
  box-shadow: 0 2px 8px rgba(24, 119, 242, 0.07);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 50px;
  gap: 4px;
}
.header-title {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: 1px;
}
.header-subtitle {
  font-size: 1.05rem;
  font-weight: 400;
  opacity: 0.9;
}

/* TAB NAVIGATION STYLES */
.tab-nav {
  display: flex;
  justify-content: center;
  margin-top: 30px;
  gap: 10px;
}
.tab-btn {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  font-weight: 600;
  color: #666;
  padding: 12px 30px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}
.tab-btn:hover {
  color: var(--primary);
  background: rgba(0,0,0,0.02);
}
.tab-btn.active {
  color: var(--primary);
  border-bottom: 3px solid var(--primary);
}

.card {
  background: var(--card-bg);
  max-width: 740px;
  margin: 20px auto;
  padding: 32px 40px 28px 40px;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(44, 62, 80, .07);
  min-height: 400px;
}

.form-section { margin-bottom: 36px; }
.section-title {
  font-size: 1.15rem;
  color: var(--primary);
  margin-bottom: 18px;
  font-weight: 500;
  letter-spacing: .5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}
.form-row {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}
.form-row-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 5px;
}
.split-input-group { flex: 1; display: flex; gap: 10px; }
label {
  min-width: 175px; 
  font-size: 1.02rem;
  font-weight: 500;
}
input[type="text"], input[type="number"], input[type="date"], select, input[type="file"] {
  flex: 1;
  padding: 8px 10px;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fcfcfc;
  transition: border-color .14s;
}
input:focus, select:focus { border-color: var(--primary); outline: none; }
.hidden { display: none !important; }

/* Button Group Styling */
.btn-group { display: flex; gap: 10px; margin-top: 25px; }
button {
  flex: 1;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: background .18s, transform 0.1s;
}
button:hover { background: #393939; }
button:active { transform: translateY(1px); }
button.secondary { background: #5c6ac4; }
button.secondary:hover { background: #4a56a0; }
button.outline { background: #fff; color: #555; border: 1px solid #ccc; }
button.outline:hover { background: #f0f0f0; }
button.small-btn { padding: 5px 10px; font-size: 0.9rem; flex: none; width: auto; }

.util-group { display: flex; gap: 10px; }

/* Status Bar */
.status-bar {
  padding: 12px 18px;
  border-radius: 9px;
  font-size: 1rem;
  margin-top: 20px;
  font-weight: 500;
  display: none;
}
.status-bar.success { background: var(--success-bg); color: var(--success-text); border: 1px solid #b3ccff; }
.status-bar.error { background: #ffe6e6; color: #a40000; border: 1px solid #ffb3b3; }
hr { border: none; border-top: 1px solid #e1e4e8; margin: 32px 0; }

/* Table Styling */
.local-data-container, .search-results-container {
  margin-top: 20px;
  border: 1px solid #e1e4e8;
  border-radius: 8px;
  overflow: hidden;
}
.table-scroll { max-height: 300px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th {
  background: #f1f3f5;
  position: sticky;
  top: 0;
  text-align: left;
  padding: 10px;
  font-weight: 600;
  color: #444;
  border-bottom: 2px solid #ddd;
}
td { padding: 8px 10px; border-bottom: 1px solid #eee; vertical-align: middle; }
tr:nth-child(even) { background: #fafbfc; }

/* Edit Button in table */
.edit-cell-btn {
  background: transparent;
  color: #666;
  padding: 4px 8px;
  border: 1px solid #ccc;
  box-shadow: none;
  width: auto;
  flex: none;
}
.edit-cell-btn:hover {
  background: #fff;
  color: var(--primary);
  border-color: var(--primary);
}

/* Modal Styles */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex; justify-content: center; align-items: center;
  z-index: 1000;
  display: none;
}
.modal {
  background: #fff;
  padding: 30px;
  border-radius: 12px;
  width: 500px;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}
.modal-wide { width: 800px; }
.map-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid #eee;
}
.map-row label { min-width: auto; flex: 1; }
.map-row select { flex: 1; }
.modal-actions { margin-top: 20px; display: flex; justify-content: flex-end; gap: 10px; }

/* Helper Text */
.file-meta { font-size: 0.9rem; color: #666; margin-left: 10px; font-style: italic; }
.hint-text { font-size: 0.85rem; color: #666; margin-left: 187px; margin-top: 4px; font-style: italic; }

@media (max-width: 780px) {
  .header { padding: 20px; }
  .card { padding: 16px; margin: 20px auto; }
  label { min-width: 100px; font-size: .95rem; }
  .form-row { flex-wrap: wrap; }
  input[type="text"], input[type="number"], input[type="date"], select { min-width: 100%; }
  .split-input-group { flex-direction: column; gap: 5px; }
  .btn-group { flex-direction: column; }
  .hint-text { margin-left: 0; margin-top: 5px; }
}