:root {
  --bg: #f7fbf8;
  --panel: #ffffff;
  --text: #1e2a24;
  --muted: #5f7268;
  --primary: #1e8462;
  --primary-soft: #d8efe6;
  --warning: #d26d1d;
  --danger: #b63434;
  --border: #dce7e1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  background: radial-gradient(circle at top left, #edf7f1 0%, var(--bg) 45%, #f8faf9 100%);
  color: var(--text);
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  gap: 20px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  display: grid;
  gap: 12px;
}

.auth-switch {
  display: flex;
  gap: 8px;
}

.auth-switch button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.auth-message {
  min-height: 20px;
  color: var(--muted);
}

.muted-note {
  color: var(--muted);
  font-size: 12px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

p {
  color: var(--muted);
}

.session-box {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.session-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

#session-role {
  text-transform: capitalize;
}

#session-role.engineer {
  background: var(--primary-soft);
  color: var(--primary);
}

#session-role.surveyor {
  background: #fff4e8;
  color: var(--warning);
}

#session-role.admin {
  background: #e8ecff;
  color: #3b4d9e;
}

button {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}

.calendar-panel,
.view,
section:last-child {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.day-name,
.day-cell {
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 84px;
  padding: 8px;
}

.day-name {
  min-height: auto;
  text-align: center;
  font-weight: 700;
  background: #f2f7f4;
}

.day-cell {
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.day-cell.clickable {
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.day-cell.clickable:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.day-cell.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft) inset;
}

.day-cell.inactive {
  opacity: 0.4;
}

.date-number {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  width: fit-content;
}

.badge.pending {
  background: #fff4e8;
  color: var(--warning);
}

.badge.accepted {
  background: var(--primary-soft);
  color: var(--primary);
}

.badge.rejected {
  background: #fdeaea;
  color: var(--danger);
}

.card {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  font: inherit;
}

.list {
  display: grid;
  gap: 10px;
}

.item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.item-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.item small {
  color: var(--muted);
}

.admin-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.actions input {
  max-width: 280px;
}

.quick-modal {
  position: fixed;
  inset: 0;
  background: rgba(9, 23, 17, 0.34);
  display: grid;
  place-items: center;
  z-index: 50;
}

.quick-box {
  width: min(520px, calc(100% - 24px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 14px;
  display: grid;
  gap: 10px;
}

.quick-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#quick-close,
#surveyor-close,
#detail-close {
  border-radius: 8px;
  line-height: 1;
  padding: 8px 10px;
}

.day-meta {
  display: grid;
  gap: 4px;
}

.day-reservation-line {
  font-size: 11px;
  line-height: 1.2;
  border-radius: 8px;
  background: #eef3ff;
  color: #33406f;
  padding: 3px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compact {
  gap: 8px;
}

.surveyor-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.hidden {
  display: none;
}

@media (max-width: 760px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .session-box {
    justify-items: start;
  }

  .calendar-grid {
    grid-template-columns: repeat(7, minmax(32px, 1fr));
    gap: 6px;
  }

  .day-cell,
  .day-name {
    padding: 6px;
    min-height: 66px;
  }
}
