:root {
  --bg: #f4faf1;
  --card: #ffffff;
  --green: #3f9d4a;
  --green-dark: #245c2b;
  --mint: #e4f5dc;
  --text: #1e3320;
  --text-sub: #6b7d63;
  --border: #ddeedd;
  --shadow: 0 2px 12px rgba(35,56,33,0.08);
  --shadow-sm: 0 1px 4px rgba(35,56,33,0.06);
  --danger: #c0392b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ---- AUTH PAGE ---- */
.auth-body {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #e0f5d7 0%, #f4faf1 60%);
  padding: 2rem 1rem;
  gap: 2rem;
}

.auth-container { width: 100%; max-width: 420px; }

.auth-deco {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 280px;
}

.auth-deco img { max-width: 100%; border-radius: 16px; }

@media (max-width: 800px) { .auth-deco { display: none; } }

.auth-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-brand-icon { font-size: 48px; display: block; margin-bottom: 8px; }

.auth-brand h1 {
  margin: 0;
  font-size: 28px;
  color: var(--green-dark);
  font-weight: 700;
}

.auth-brand p {
  margin: 4px 0 0;
  color: var(--text-sub);
  font-size: 14px;
}

/* ---- SITE HEADER / NAV ---- */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 1.5rem;
  max-width: 960px;
  margin: 0 auto;
  gap: 8px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand-icon { font-size: 22px; }
.brand-name { font-weight: 700; font-size: 18px; color: var(--green-dark); }

.site-header .links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

.site-header .links #welcome {
  font-size: 14px;
  color: var(--text-sub);
  padding: 6px 10px;
}

.site-header .links a {
  color: var(--green-dark);
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 20px;
  transition: background 0.15s;
  font-weight: 500;
}

.site-header .links a:hover { background: var(--mint); }

#linkLogout {
  color: var(--text-sub) !important;
  font-weight: 400 !important;
}

/* ---- LAYOUT ---- */
.wrap { max-width: 960px; margin: 0 auto; padding: 1.5rem; }

/* ---- CARDS ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

/* ---- TYPOGRAPHY ---- */
h1, h2, h3 { color: var(--text); margin-top: 0; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 600; color: var(--green-dark); }

/* ---- FORMS ---- */
label {
  display: block;
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 4px;
  font-weight: 500;
}

input, select, textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  outline: none;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(63,157,74,0.14);
}

/* ---- BUTTONS ---- */
button {
  background: var(--green);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
  font-family: inherit;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}

button:hover {
  background: var(--green-dark);
  box-shadow: 0 2px 8px rgba(36,92,43,0.22);
}

button:active { transform: scale(0.97); }

button.secondary {
  background: transparent;
  color: var(--green-dark);
  border: 1.5px solid var(--green);
}

button.secondary:hover {
  background: var(--mint);
  box-shadow: none;
}

button.lang-btn.active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

/* ---- BADGES ---- */
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--mint);
  color: var(--green-dark);
}

.badge-todo { background: #f0f0f0; color: #666; }
.badge-in_progress { background: #fef3c7; color: #92400e; }
.badge-done { background: var(--mint); color: var(--green-dark); }

/* ---- CHIPS (time logging) ---- */
.chip {
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--green);
  color: var(--green-dark);
  background: transparent;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s;
}

.chip:hover { background: var(--mint); box-shadow: none; }
.chip.active { background: var(--mint); }

/* ---- ERROR ---- */
.error { color: var(--danger); font-size: 13px; margin-bottom: 10px; }

/* ---- ROW ---- */
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }

/* ---- MAP CANVAS ---- */
#mapCanvas {
  background: #f5eed8;
  border-radius: 12px;
  cursor: crosshair;
  width: 100%;
  display: block;
  border: 1.5px solid var(--border);
}

#mapCanvas.panning { cursor: grab; }
#mapCanvas.panning:active { cursor: grabbing; }

/* ---- TABLES ---- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }

th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--border);
  color: var(--text-sub);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td { padding: 8px 10px; border-bottom: 1px solid var(--border); }

tbody tr:hover { background: var(--bg); }
tbody tr:last-child td { border-bottom: none; }

/* ---- FOOTER ---- */
.site-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 12px;
  color: var(--text-sub);
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

.auth-footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 1.5rem;
}

/* ---- MOBILE ---- */
@media (max-width: 600px) {
  .card { padding: 1rem; }
  .wrap { padding: 0.75rem; }

  .site-header nav { padding: 0.5rem 0.75rem; gap: 4px; }
  .site-header .links a { padding: 5px 10px; font-size: 13px; }

  table { display: block; overflow-x: auto; white-space: nowrap; }

  /* stack rows vertically on small screens in admin inputs */
  .row > input, .row > select { min-width: 0; flex: 1 1 120px; }

  h2 { font-size: 17px; }
  h3 { font-size: 14px; }
}

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(20,40,20,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
  backdrop-filter: blur(2px);
}

.modal-content {
  max-width: 540px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  margin: 0;
  box-shadow: 0 8px 40px rgba(20,40,20,0.2);
}
