:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #252923;
  background: #f3f4ef;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
body.modal-open { overflow: hidden; }

.container {
  width: min(100% - 32px, 960px);
  margin: 0 auto;
  padding: 32px 0 56px;
}

.admin-container { width: min(100% - 32px, 1180px); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(1.7rem, 3vw, 2.2rem); letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 1.15rem; }
h3 { margin-bottom: 0; font-size: 1rem; }

.card {
  margin: 18px 0;
  padding: 22px;
  border: 1px solid #e1e3dc;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 30px rgba(37, 41, 35, .045);
}

.login-card { max-width: 440px; margin: 10vh auto 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.admin-header { margin-bottom: 20px; }
.admin-header p { margin-bottom: 0; color: #70766c; }

label { display: block; margin: 14px 0; color: #3b4038; font-size: .9rem; font-weight: 650; }
label small { display: block; margin-top: 3px; color: #7b8077; font-weight: 400; }
input, textarea {
  width: 100%;
  margin-top: 7px;
  padding: 10px 11px;
  border: 1px solid #ccd0c7;
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: inherit;
  font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus { border-color: #66785d; box-shadow: 0 0 0 3px rgba(102, 120, 93, .14); }
textarea { resize: vertical; }

button {
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  background: #33452f;
  color: #fff;
  font: inherit;
  font-weight: 650;
}
button:hover { filter: brightness(.95); }
button:focus-visible { outline: 3px solid rgba(80, 104, 70, .28); outline-offset: 2px; }
button:disabled { cursor: wait; opacity: .65; }
button.secondary { background: #70766c; }
button.ghost { border: 1px solid #d6d9d1; background: #fff; color: #50564d; }

.admin-grid { display: grid; grid-template-columns: minmax(0, .88fr) minmax(420px, 1.12fr); gap: 20px; align-items: start; }
.admin-grid > .card { height: 100%; margin: 0; }
.form-card { scroll-margin-top: 16px; }
.date-grid { display: grid; grid-template-columns: .72fr .72fr 1.4fr; gap: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.form-message { min-height: 1.4em; margin: 13px 0 0; color: #666d63; font-size: .9rem; }
.error { color: #a12d2d; }
.success { color: #26713b; }

.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.eyebrow { margin-bottom: 4px; color: #7b8077; font-size: .72rem; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }

.calendar-toolbar { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 10px; margin-bottom: 22px; }
.calendar-toolbar h2 { text-align: center; text-transform: capitalize; }
.icon-button { width: 40px; height: 40px; padding: 0; border: 1px solid #dfe2da; background: #f7f8f4; color: #374034; font-size: 1.7rem; line-height: 1; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.calendar-weekdays { margin-bottom: 7px; color: #858a81; font-size: .72rem; font-weight: 700; text-align: center; text-transform: uppercase; }
.calendar-empty { aspect-ratio: 1; }
.calendar-day {
  position: relative;
  display: flex;
  aspect-ratio: 1;
  min-width: 0;
  align-items: center;
  justify-content: center;
  padding: 3px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #3b4038;
  font-size: .92rem;
  font-weight: 600;
}
.calendar-day:hover { background: #eef1e9; filter: none; }
.calendar-day.is-today { border-color: #95a28d; }
.calendar-day.is-selected { border-color: #33452f; background: #33452f; color: #fff; }
.calendar-day small { position: absolute; top: 4px; right: 5px; min-width: 16px; padding: 1px 4px; border-radius: 999px; background: #dfe8d9; color: #405039; font-size: .62rem; }
.calendar-day.is-selected small { background: #fff; color: #33452f; }
.calendar-help { display: flex; align-items: center; gap: 7px; margin: 17px 0 0; color: #7b8077; font-size: .8rem; }
.event-dot { width: 8px; height: 8px; border-radius: 50%; background: #90a686; }

.selected-card { margin-top: 20px; }
.count-badge { min-width: 28px; padding: 4px 8px; border-radius: 999px; background: #edf0e9; color: #596153; font-size: .8rem; text-align: center; }
.compact-list { border-top: 1px solid #eceee8; }
.event-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 2px; border-bottom: 1px solid #eceee8; }
.event-main { display: flex; min-width: 0; align-items: center; gap: 10px; }
.event-main h3 { overflow-wrap: anywhere; }
.event-year { flex: 0 0 auto; padding: 3px 7px; border-radius: 6px; background: #f0f1ed; color: #656b62; font-size: .75rem; font-weight: 700; }
.event-actions { display: flex; flex: 0 0 auto; gap: 7px; }
.small-button { display: inline-flex; align-items: center; gap: 5px; padding: 7px 10px; background: #eef1e9; color: #394235; font-size: .78rem; }
.small-button.view { background: #e8eef3; color: #344e63; }
.small-button.danger { background: #f7e9e7; color: #8f302a; }
.empty-state { margin: 0; padding: 20px 2px 4px; color: #7b8077; font-size: .9rem; }

.modal {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(25, 29, 24, .58);
  backdrop-filter: blur(3px);
}
.modal-dialog {
  position: relative;
  display: flex;
  width: min(100%, 680px);
  max-height: min(88vh, 820px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(14, 18, 13, .28);
}
.modal-content { overflow-y: auto; padding: 30px 30px 22px; }
.modal-close-icon {
  position: absolute;
  z-index: 1;
  top: 13px;
  right: 13px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #dfe2da;
  border-radius: 50%;
  background: rgba(255, 255, 255, .94);
  color: #4b5148;
  font-size: 1.45rem;
  line-height: 1;
}
.modal-date { margin: 0 46px 7px 0; color: #70776c; font-size: .86rem; font-weight: 700; }
.modal-title { margin: 0 46px 20px 0; font-size: clamp(1.35rem, 3vw, 1.8rem); line-height: 1.2; }
.modal-image-container { margin-bottom: 22px; overflow: hidden; border-radius: 11px; background: #f0f2ed; }
.modal-image-container img { display: block; width: 100%; max-height: 380px; object-fit: contain; }
.modal-no-image { margin: 0; padding: 40px 20px; color: #7b8077; font-size: .9rem; text-align: center; }
.modal-summary { margin: 0; color: #3c4239; line-height: 1.65; white-space: pre-wrap; }
.modal-footer { display: flex; justify-content: flex-end; padding: 14px 30px; border-top: 1px solid #e7e9e3; background: #fafbf8; }

.recent-section { margin-top: 28px; padding: 0 4px; }
.recent-section .section-heading { margin-bottom: 10px; }
.recent-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 18px; }
.recent-item { display: flex; min-width: 0; gap: 10px; padding: 7px 0; border-bottom: 1px solid #dde0d8; font-size: .82rem; }
.recent-item span { flex: 0 0 auto; color: #81867d; }
.recent-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

code { display: block; margin: 7px 0; padding: 8px; border-radius: 5px; background: #eee; }

/* Public API documentation */
.api-page { background: #f5f7f4; color: #20271f; }
.api-shell { width: min(100% - 36px, 1060px); margin: 0 auto; }
.api-hero { border-bottom: 1px solid #dfe5dc; background: linear-gradient(145deg, #f9fbf7 0%, #edf3eb 100%); }
.api-nav { display: flex; align-items: center; justify-content: space-between; padding: 20px 0; }
.api-brand { color: #263923; font-weight: 800; letter-spacing: -.02em; text-decoration: none; }
.api-admin-link { padding: 8px 12px; border: 1px solid #cbd5c8; border-radius: 8px; color: #445440; font-size: .84rem; font-weight: 700; text-decoration: none; }
.api-admin-link:hover { background: #fff; }
.api-intro { max-width: 750px; padding: 70px 0 76px; }
.api-intro h1 { margin: 14px 0 16px; font-size: clamp(2.25rem, 7vw, 4.25rem); line-height: .98; letter-spacing: -.055em; }
.api-intro > p { max-width: 690px; margin-bottom: 0; color: #5b6658; font-size: clamp(1rem, 2vw, 1.18rem); line-height: 1.65; }
.api-status { display: inline-flex; align-items: center; gap: 8px; color: #486245; font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.api-status i { width: 8px; height: 8px; border-radius: 50%; background: #57a44f; box-shadow: 0 0 0 4px rgba(87, 164, 79, .13); }
.api-docs { padding-top: 0; padding-bottom: 72px; }

.api-summary { display: grid; grid-template-columns: repeat(3, 1fr); margin: -26px 0 72px; overflow: hidden; border: 1px solid #dfe5dc; border-radius: 13px; background: #fff; box-shadow: 0 12px 35px rgba(38, 53, 35, .06); }
.api-summary div { display: flex; min-width: 0; flex-direction: column; gap: 5px; padding: 19px 22px; border-right: 1px solid #e5e9e2; }
.api-summary div:last-child { border-right: 0; }
.api-summary span { color: #788176; font-size: .72rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.api-summary strong { overflow-wrap: anywhere; font-size: .9rem; }

.api-section { margin-top: 66px; }
.api-section-heading { max-width: 680px; margin-bottom: 27px; }
.api-section-heading > span { color: #71806c; font-size: .73rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.api-section-heading h2 { margin: 5px 0 8px; font-size: clamp(1.6rem, 3vw, 2.1rem); letter-spacing: -.035em; }
.api-section-heading p { margin-bottom: 0; color: #6d756a; line-height: 1.55; }
.api-page p code, .api-section-heading code, .fields-row code { display: inline; margin: 0; padding: 2px 5px; border-radius: 4px; background: #e9eee6; color: #40513d; font-size: .88em; }

.endpoint-list { display: grid; gap: 16px; }
.endpoint-card { padding: 24px; border: 1px solid #dfe4dc; border-radius: 13px; background: #fff; box-shadow: 0 5px 18px rgba(35, 45, 32, .025); }
.endpoint-card.endpoint-featured { border-color: #adbea8; box-shadow: 0 8px 28px rgba(58, 83, 53, .07); }
.endpoint-header { display: flex; align-items: center; gap: 11px; }
.endpoint-header .method { flex: 0 0 auto; padding: 5px 7px; border-radius: 5px; background: #dfeedd; color: #2f6a34; font-size: .68rem; font-weight: 850; letter-spacing: .04em; }
.endpoint-header code { display: block; min-width: 0; margin: 0; padding: 0; overflow-wrap: anywhere; background: transparent; color: #273126; font-size: .96rem; font-weight: 750; }
.endpoint-card > p { margin: 15px 0 18px; color: #626b5f; line-height: 1.55; }
.endpoint-example { padding: 11px 13px; overflow: hidden; border: 1px solid #e1e6de; border-radius: 8px; background: #f7f9f6; }
.endpoint-example span { display: block; margin-bottom: 5px; color: #81897e; font-size: .68rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.endpoint-example code { display: block; margin: 0; padding: 0; overflow-x: auto; background: transparent; color: #40513d; font-size: .8rem; white-space: nowrap; }
.endpoint-card details { margin-top: 15px; border-top: 1px solid #eaede8; }
.endpoint-card summary { padding: 14px 2px 0; cursor: pointer; color: #52604f; font-size: .82rem; font-weight: 750; }
.endpoint-card pre { margin: 14px 0 0; padding: 17px; overflow-x: auto; border-radius: 9px; background: #20271f; color: #e8eee6; font-size: .76rem; line-height: 1.55; }
.endpoint-card pre code { display: inline; margin: 0; padding: 0; background: transparent; color: inherit; font: inherit; white-space: pre; }

.fields-section { margin-top: 76px; }
.fields-table { overflow: hidden; border: 1px solid #dfe4dc; border-radius: 12px; background: #fff; }
.fields-row { display: grid; grid-template-columns: minmax(130px, .34fr) 1fr; align-items: center; min-height: 52px; border-top: 1px solid #e8ebe6; }
.fields-row:first-child { border-top: 0; }
.fields-row > * { padding: 13px 17px; }
.fields-row > code { margin-left: 17px; justify-self: start; }
.fields-row > span { color: #626b5f; font-size: .88rem; line-height: 1.45; }
.fields-head { background: #f0f4ee; color: #687164; font-size: .7rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.fields-head span { color: inherit; font-size: inherit; }
.api-footer { padding: 25px 0; border-top: 1px solid #dfe4dc; color: #7c8579; font-size: .78rem; }

@media (max-width: 860px) {
  .admin-grid { grid-template-columns: 1fr; }
  .admin-grid > .card { height: auto; }
}

@media (max-width: 600px) {
  .container, .admin-container { width: min(100% - 20px, 1180px); padding-top: 18px; }
  .card { padding: 17px; border-radius: 11px; }
  .date-grid { grid-template-columns: 1fr 1fr; }
  .date-grid label:last-child { grid-column: 1 / -1; }
  .calendar-weekdays, .calendar-grid { gap: 3px; }
  .calendar-day { border-radius: 7px; font-size: .84rem; }
  .calendar-day small { top: 2px; right: 2px; min-width: 13px; padding: 0 3px; }
  .event-row { align-items: flex-start; flex-direction: column; gap: 10px; }
  .event-actions { width: 100%; }
  .event-actions button { flex: 1; justify-content: center; }
  .recent-list { grid-template-columns: 1fr; }
  .modal { padding: 10px; }
  .modal-dialog { max-height: 94vh; border-radius: 12px; }
  .modal-content { padding: 24px 18px 18px; }
  .modal-footer { padding: 12px 18px; }
  .modal-image-container img { max-height: 45vh; }
  .api-shell { width: min(100% - 22px, 1060px); }
  .api-nav { padding: 15px 0; }
  .api-intro { padding: 49px 0 57px; }
  .api-summary { grid-template-columns: 1fr; margin-bottom: 53px; }
  .api-summary div { padding: 14px 17px; border-right: 0; border-bottom: 1px solid #e5e9e2; }
  .api-summary div:last-child { border-bottom: 0; }
  .api-section { margin-top: 50px; }
  .endpoint-card { padding: 18px; }
  .endpoint-header { align-items: flex-start; flex-direction: column; gap: 7px; }
  .endpoint-card pre { margin-right: -7px; margin-left: -7px; padding: 14px; }
  .fields-row { grid-template-columns: 1fr; padding: 12px 15px; }
  .fields-row > *, .fields-row > code { margin: 0; padding: 2px 0; }
  .fields-head { display: none; }
}
