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

html, body { height: 100%; font-family: sans-serif; font-size: 15px; color: #1a1a1a; background: #f5f5f3; }

/* Navbar */
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 52px; padding: 0 1.25rem;
  background: #fff; border-bottom: 1px solid #e0dfd8;
  position: sticky; top: 0; z-index: 1000;
}
.navbar-brand { font-weight: 600; font-size: 16px; text-decoration: none; color: #1a1a1a; }
.navbar-right { display: flex; align-items: center; gap: 1rem; }
.navbar-user { font-size: 13px; color: #666; }
.alert-badge {
  background: #e8520a; color: #fff; font-size: 12px; font-weight: 600;
  padding: 3px 8px; border-radius: 20px; text-decoration: none;
}

/* Flash */
.flash-container { padding: 0.5rem 1rem; }
.flash { padding: 10px 14px; border-radius: 6px; font-size: 14px; margin-bottom: 6px; }
.flash-success { background: #e6f4ea; color: #1d6b35; }
.flash-error   { background: #fdecea; color: #9b2020; }
.flash-warning { background: #fff8e1; color: #7a5700; }

/* Auth */
.auth-container { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 52px); }
.auth-card { background: #fff; border: 1px solid #e0dfd8; border-radius: 10px; padding: 2rem; width: 360px; }
.auth-card h1 { font-size: 20px; font-weight: 600; margin-bottom: 1.5rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 13px; color: #555; margin-bottom: 4px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #ccc; border-radius: 6px;
  font-size: 14px; background: #fff;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: #3a9e3a;
}
.optional { color: #999; font-size: 12px; }
.btn-primary {
  width: 100%; padding: 9px; background: #3a9e3a; color: #fff;
  border: none; border-radius: 6px; font-size: 14px; font-weight: 500;
  cursor: pointer;
}
.btn-primary:hover { background: #2e842e; }
.btn-secondary {
  width: 100%; padding: 8px; background: #fff; color: #444;
  border: 1px solid #ccc; border-radius: 6px; font-size: 13px; cursor: pointer;
  margin-top: 6px;
}
.btn-secondary:hover { background: #f5f5f3; }
.btn-link { background: none; border: none; color: #3a9e3a; font-size: 13px; cursor: pointer; text-decoration: underline; }
.auth-link { margin-top: 1rem; font-size: 13px; color: #666; text-align: center; }
.auth-link a { color: #3a9e3a; }

/* Map layout */
.map-layout { display: flex; height: calc(100vh - 52px); position: relative; }

#map { flex: 1; z-index: 1; }

/* Sidebar */
.sidebar {
  width: 260px; background: #fff; border-right: 1px solid #e0dfd8;
  display: flex; flex-direction: column; overflow-y: auto; z-index: 10;
}
.sidebar-header { padding: 1rem; border-bottom: 1px solid #e0dfd8; }
.sidebar-header h2 { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.sidebar-header .btn-primary { width: 100%; padding: 7px; font-size: 13px; }

.year-bar {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 8px 0; background: #f5f5f3; border-bottom: 1px solid #e0dfd8;
}
.year-bar button { background: none; border: 1px solid #ccc; border-radius: 4px; padding: 2px 8px; cursor: pointer; font-size: 14px; }
#year-display { font-weight: 600; font-size: 15px; min-width: 40px; text-align: center; }

.fields-list { flex: 1; padding: 8px; }
.empty-msg { font-size: 13px; color: #999; padding: 10px 4px; }

.field-item {
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; gap: 6px; margin-bottom: 4px;
  flex-wrap: wrap;
}
.field-item:hover { background: #f0f0ec; }
.field-item.active { background: #e8f5e8; }
.field-name { font-size: 13px; font-weight: 500; flex: 1; }
.crop-badge {
  font-size: 11px; padding: 2px 7px; border-radius: 12px;
  color: #fff; font-weight: 500;
}
.crop-empty { background: #ccc; color: #666; }
.field-area { font-size: 11px; color: #888; }

/* Alerts panel */
.alerts-panel { border-top: 1px solid #f0c0a0; padding: 10px; background: #fffaf5; }
.alerts-panel h3 { font-size: 13px; font-weight: 600; color: #c0500a; margin-bottom: 8px; }
.alert-item { font-size: 12px; margin-bottom: 10px; }
.alert-item strong { color: #333; }
.alert-item p { color: #666; margin: 3px 0; line-height: 1.4; }

/* Form panel */
.form-panel {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 280px; background: #fff;
  border-left: 1px solid #e0dfd8;
  z-index: 20; display: flex; flex-direction: column;
  box-shadow: -2px 0 8px rgba(0,0,0,0.06);
}
.form-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 1rem; border-bottom: 1px solid #e0dfd8;
}
.form-panel-header h3 { font-size: 14px; font-weight: 600; }
.btn-close { background: none; border: none; font-size: 16px; cursor: pointer; color: #888; }
.form-panel-body { padding: 1rem; overflow-y: auto; flex: 1; }
.form-panel-body .form-group label { font-size: 12px; }
.form-panel-body .form-group { margin-bottom: 12px; }
.form-panel-body .btn-primary { width: 100%; font-size: 13px; padding: 8px; }
.form-actions { margin-top: 4px; }
.area-value { font-weight: 600; color: #3a9e3a; }

.btn-danger {
  width: 100%; padding: 8px; background: #fff; color: #c0392b;
  border: 1px solid #e0b0a8; border-radius: 6px; font-size: 13px; cursor: pointer;
  margin-top: 6px;
}
.btn-danger:hover { background: #fdf0ee; }