:root {
  --ink: #17252f;
  --muted: #667985;
  --line: #d9e2e6;
  --soft: #f5f8f7;
  --panel: #ffffff;
  --brand: #00a66c;
  --brand-dark: #007f5f;
  --accent: #0f79a8;
  --warning: #f4b942;
  --danger: #db5b57;
  --shadow: 0 16px 42px rgba(23, 37, 47, 0.12);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #eef4f2;
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.auth-shell {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
  max-width: 440px;
  padding: 24px;
  width: 100%;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-details {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.auth-details summary {
  color: var(--brand-dark);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.auth-details .auth-form {
  margin-top: 12px;
}

.status-banner {
  background: #ecfbf4;
  border: 1px solid #bcebd6;
  color: #007f5f;
  font-size: 13px;
  font-weight: 800;
  padding: 10px 18px;
}

.app-shell > .status-banner {
  border-left: 0;
  border-right: 0;
}

.topbar {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 18px 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand-block h1 {
  font-size: 22px;
  line-height: 1.1;
  margin: 0;
}

.brand-block p {
  color: var(--muted);
  margin: 4px 0 0;
}

.toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.icon-button,
.primary-button,
.ghost-button,
.danger-button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  display: inline-flex;
  font-weight: 700;
  gap: 8px;
  min-height: 40px;
  padding: 0 13px;
}

.icon-button {
  background: var(--soft);
  border-color: var(--line);
  width: 42px;
  justify-content: center;
}

.primary-button {
  background: var(--brand);
  color: white;
}

.ghost-button {
  background: white;
  border-color: var(--line);
  color: var(--ink);
}

.danger-button {
  background: #fff3f2;
  border-color: #ffd4d0;
  color: #a33b37;
}

.year-control,
.user-control {
  align-items: center;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  display: inline-flex;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px;
}

.year-control strong {
  min-width: 48px;
  text-align: center;
}

.user-control select {
  background: transparent;
  border: 0;
  color: var(--ink);
  font-weight: 700;
  outline: none;
}

.layout {
  display: grid;
  gap: 18px;
  grid-template-columns: 286px minmax(0, 1fr);
  padding: 18px;
}

.sidebar,
.settings-panel,
.calendar-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sidebar {
  align-self: start;
  display: grid;
  gap: 18px;
  padding: 18px;
  position: sticky;
  top: 90px;
}

.filter-group {
  display: grid;
  gap: 10px;
}

.filter-group h2,
.settings-panel h2 {
  font-size: 14px;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

.check-row {
  align-items: center;
  display: flex;
  gap: 10px;
  min-height: 30px;
}

.check-row input {
  accent-color: var(--brand);
}

.swatch {
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  display: inline-block;
  height: 13px;
  width: 13px;
}

.avatar {
  align-items: center;
  background-position: center;
  background-size: cover;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  color: white;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 9px;
  font-weight: 900;
  height: 20px;
  justify-content: center;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
  width: 20px;
}

.filter-avatar {
  border-color: rgba(23, 37, 47, 0.12);
  height: 24px;
  width: 24px;
}

.content {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.settings-panel {
  display: none;
  gap: 14px;
  padding: 18px;
}

.settings-panel.is-open {
  display: grid;
}

.admin-dashboard {
  display: grid;
  gap: 14px;
}

.settings-heading {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

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

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

.admin-card h3 {
  font-size: 15px;
  margin: 0;
}

.admin-list {
  display: grid;
  gap: 8px;
}

.admin-row {
  align-items: center;
  border: 1px solid #edf2f3;
  border-radius: 7px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(220px, 1.2fr) minmax(160px, 1fr) minmax(120px, 0.5fr);
  padding: 10px;
}

.assistant-row {
  grid-template-columns: minmax(200px, 1fr) minmax(200px, 1fr) minmax(100px, 0.35fr);
}

.admin-person {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.admin-person div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.admin-person strong,
.admin-person span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-person span {
  color: var(--muted);
  font-size: 12px;
}

.admin-row input,
.admin-row select {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 36px;
  padding: 0 9px;
  width: 100%;
}

.empty-state {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 0;
}

.category-editor {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

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

.category-card label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 700;
  gap: 5px;
}

.category-card input {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 36px;
  padding: 0 10px;
}

.color-value-row {
  align-items: center;
  display: grid;
  gap: 9px;
  grid-template-columns: minmax(0, 1fr) 34px;
}

.color-splotch {
  border: 2px solid white;
  border-radius: 999px;
  box-shadow: 0 0 0 1px var(--line);
  display: inline-block;
  height: 28px;
  width: 28px;
}

.category-actions {
  display: flex;
  justify-content: flex-end;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.preset-swatch {
  border: 2px solid white;
  border-radius: 999px;
  box-shadow: 0 0 0 1px var(--line);
  height: 25px;
  width: 25px;
}

.calendar-card {
  min-width: 0;
  overflow: hidden;
}

.weekday-header,
.month-row {
  display: grid;
  grid-template-columns: 84px repeat(var(--calendar-days), minmax(22px, 1fr));
}

.weekday-header {
  background: #f7faf9;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.weekday-header div {
  border-left: 1px solid var(--line);
  min-height: 32px;
  padding-top: 9px;
  text-align: center;
}

.weekday-header .month-spacer {
  border-left: 0;
}

.month-row {
  min-height: 112px;
  position: relative;
}

.month-row + .month-row {
  border-top: 1px solid var(--line);
}

.month-label {
  align-items: center;
  background: #fbfdfc;
  border-right: 1px solid var(--line);
  color: var(--ink);
  display: flex;
  font-size: 13px;
  font-weight: 800;
  justify-content: center;
  min-height: 112px;
  position: sticky;
  left: 0;
  z-index: 8;
}

.day-cell {
  border-left: 1px solid #edf2f3;
  min-height: 112px;
  padding: 5px 3px;
  position: relative;
  user-select: none;
}

.day-cell.is-weekend {
  background: #f7fbf9;
}

.day-cell.is-outside {
  background: repeating-linear-gradient(135deg, #f8faf9, #f8faf9 6px, #f1f5f4 6px, #f1f5f4 12px);
}

.day-cell.is-today::after {
  border: 2px solid var(--brand);
  border-radius: 5px;
  content: "";
  inset: 3px;
  pointer-events: none;
  position: absolute;
}

.day-number {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  position: relative;
  z-index: 2;
}

.selection-fill {
  background: rgba(0, 166, 108, 0.18);
  border: 1px solid rgba(0, 127, 95, 0.35);
  border-radius: 6px;
  inset: 30px 3px 6px;
  position: absolute;
  z-index: 1;
}

.event-bar {
  align-items: center;
  border: 1px solid rgba(23, 37, 47, 0.16);
  border-radius: 6px;
  color: white;
  display: flex;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
  height: 24px;
  left: 3px;
  line-height: 1;
  overflow: hidden;
  padding: 0 7px;
  position: absolute;
  right: 3px;
  text-overflow: ellipsis;
  top: 30px;
  white-space: nowrap;
  z-index: 4;
}

.event-avatars {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  max-width: 66px;
  min-width: 0;
}

.event-avatar {
  box-shadow: 0 0 0 1px rgba(23, 37, 47, 0.1);
  height: 18px;
  width: 18px;
}

.event-avatar + .event-avatar {
  margin-left: -7px;
}

.avatar-overflow {
  background: rgba(23, 37, 47, 0.78);
  font-size: 8px;
}

.event-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-bar.is-declined {
  opacity: 0.48;
}

.mobile-events {
  display: none;
}

.mobile-day {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 14px;
}

.mobile-day h3 {
  font-size: 13px;
  margin: 0;
}

.mobile-event {
  border-left: 5px solid var(--brand);
  display: grid;
  gap: 4px;
  padding: 6px 0 6px 10px;
  text-align: left;
}

.mobile-event strong {
  align-items: center;
  display: flex;
  gap: 7px;
  font-size: 14px;
  min-width: 0;
}

.mobile-event .event-avatars {
  max-width: none;
}

.mobile-event > span {
  color: var(--muted);
  font-size: 12px;
}

.modal-backdrop {
  align-items: center;
  background: rgba(23, 37, 47, 0.36);
  display: none;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  z-index: 50;
}

.modal-backdrop.is-open {
  display: flex;
}

.modal {
  background: white;
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(23, 37, 47, 0.25);
  max-height: min(760px, 92vh);
  max-width: 720px;
  overflow: auto;
  padding: 20px;
  width: min(720px, 100%);
}

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

.modal-header h2 {
  font-size: 20px;
  margin: 0;
}

.event-form {
  display: grid;
  gap: 13px;
}

.form-grid {
  display: grid;
  gap: 13px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field input,
.field select,
.field textarea {
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  min-height: 40px;
  padding: 0 10px;
}

.field textarea {
  min-height: 92px;
  padding: 10px;
  resize: vertical;
}

.employee-picker {
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 4px;
  max-height: 150px;
  overflow: auto;
  padding: 8px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin-top: 4px;
}

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

.status-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 5px 9px;
}

.status-chip.accepted {
  background: #ecfbf4;
  color: #007f5f;
}

.status-chip.declined {
  background: #fff3f2;
  color: #a33b37;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .admin-row {
    grid-template-columns: 1fr;
  }
}

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

  .brand-block p {
    display: none;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .layout {
    padding: 12px;
  }

  .calendar-card {
    display: none;
  }

  .mobile-events {
    display: grid;
    gap: 10px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}
