:root {
  color-scheme: light;
  --ink: #293023;
  --muted: #68705f;
  --cream: #f7f1e4;
  --paper: #fffdf8;
  --line: #d8d1c2;
  --olive: #4c5b32;
  --olive-dark: #354122;
  --terracotta: #a65336;
  --gold: #d4a84f;
  --reserved: #dfe6cd;
  --shadow: 0 18px 50px rgba(39, 43, 31, 0.15);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--cream); }
body { margin: 0; color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: linear-gradient(135deg, #f9f5eb, #eee4cf); min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

h1, h2 { font-family: Georgia, "Times New Roman", serif; margin: 0; line-height: 1.08; }
h1 { font-size: clamp(2rem, 4vw, 4rem); }
h2 { font-size: clamp(1.35rem, 2vw, 2rem); }
p { line-height: 1.55; }
.eyebrow { margin: 0 0 0.35rem; color: var(--terracotta); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 2rem; }
.login-card { width: min(960px, 100%); min-height: 540px; display: grid; grid-template-columns: 1.25fr 0.75fr; overflow: hidden; border: 1px solid rgba(76, 91, 50, 0.2); border-radius: 24px; background: var(--paper); box-shadow: var(--shadow); }
.login-photo { background: linear-gradient(180deg, transparent 50%, rgba(24, 30, 18, 0.42)), url('/FarmSunetImage.JPG') center / cover; }
.login-content { display: flex; flex-direction: column; justify-content: center; padding: clamp(2rem, 5vw, 4rem); }
.login-content h1 { font-size: clamp(2rem, 3.5vw, 3.3rem); }
.login-content label { display: block; margin-top: 1.4rem; font-weight: 700; }
.login-content input { width: 100%; margin-top: 0.5rem; }
.text-button { border: 0; color: var(--olive); background: transparent; margin-top: 1.2rem; text-decoration: underline; }

.hero { position: relative; min-height: 230px; display: flex; align-items: end; justify-content: space-between; padding: clamp(1.5rem, 4vw, 3.5rem); color: white; background: url('/FarmSunetImage.JPG') center 52% / cover; }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(27, 31, 20, 0.78), rgba(27, 31, 20, 0.08) 70%, rgba(27, 31, 20, 0.35)); }
.hero-content, .hero-actions { position: relative; z-index: 1; }
.hero-kicker { margin: 0 0 0.5rem; color: #f3cf80; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.hero-actions { align-self: flex-start; display: flex; align-items: center; gap: 0.7rem; }
.admin-badge { border: 1px solid rgba(255,255,255,.5); border-radius: 999px; padding: .45rem .75rem; background: rgba(53,65,34,.8); font-size: .78rem; font-weight: 800; }
.ghost-button { border: 1px solid rgba(255,255,255,.6); border-radius: 999px; padding: .55rem .9rem; color: white; background: rgba(0,0,0,.2); }

.layout { width: min(1500px, calc(100% - 2rem)); margin: -26px auto 3rem; position: relative; z-index: 2; display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.sidebar, .calendar-panel { border: 1px solid rgba(76,91,50,.14); border-radius: 18px; background: rgba(255,253,248,.97); box-shadow: 0 12px 36px rgba(39,43,31,.1); }
.sidebar { padding: 1rem; position: sticky; top: 1rem; }
.reserve-button { width: 100%; font-size: 1rem; padding: .9rem 1rem; }
.reserve-button span { font-size: 1.3rem; margin-right: .3rem; }
.upcoming-panel { margin: 1.3rem 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; padding: .2rem .25rem .8rem; border-bottom: 1px solid var(--line); }
.section-heading h2 { font-size: 1.35rem; }
.count-pill { display: grid; place-items: center; min-width: 2rem; height: 2rem; padding: 0 .5rem; border-radius: 999px; color: white; background: var(--olive); font-weight: 800; }
.upcoming-list { min-height: 200px; }
.upcoming-item { width: 100%; display: grid; grid-template-columns: 52px 1fr; gap: .75rem; align-items: center; padding: .85rem .25rem; text-align: left; border: 0; border-bottom: 1px solid #e8e2d7; background: transparent; color: var(--ink); }
.upcoming-item:hover { background: #f7f2e7; }
.date-tile { display: grid; place-items: center; height: 52px; border-radius: 10px; color: white; background: var(--terracotta); line-height: 1; }
.date-tile strong { font-size: 1.2rem; }
.date-tile span { font-size: .65rem; text-transform: uppercase; }
.upcoming-item strong, .upcoming-item small { display: block; }
.upcoming-item small { color: var(--muted); margin-top: .25rem; }
.empty-state { padding: 2rem .5rem; text-align: center; color: var(--muted); }
.pagination { display: flex; align-items: center; justify-content: center; gap: .8rem; padding-top: .8rem; }
.pagination span { font-size: .82rem; color: var(--muted); }
.sidebar-note { margin: 1rem .25rem .25rem; color: var(--muted); font-size: .8rem; }

.calendar-panel { overflow: hidden; }
.calendar-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 1rem; padding: 1.25rem; border-bottom: 1px solid var(--line); }
.month-navigation, .jump-controls { display: flex; align-items: center; gap: .8rem; }
.jump-controls label { display: grid; gap: .25rem; color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; }
.jump-controls select { min-width: 108px; }
.calendar-help { display: flex; flex-wrap: wrap; gap: 1rem; padding: .75rem 1.25rem; color: var(--muted); background: #f8f4eb; font-size: .78rem; }
.calendar-help span { display: flex; align-items: center; gap: .35rem; }
.legend { width: 12px; height: 12px; display: inline-block; border-radius: 3px; }
.legend.reserved { background: var(--reserved); border: 1px solid #aab58e; }
.legend.today { background: var(--paper); border: 2px solid var(--terracotta); }
.calendar-wrap { padding: 0 1rem 1rem; touch-action: pan-y; }
.weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays span { padding: .85rem .35rem .55rem; text-align: center; color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.calendar-grid { border-top: 1px solid var(--line); border-left: 1px solid var(--line); user-select: none; }
.day { position: relative; min-height: 112px; padding: .45rem; overflow: hidden; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; color: var(--ink); background: var(--paper); }
.day:hover { background: #f8f3e8; }
.day.outside { color: #a5a598; background: #f3efe7; }
.day.today::after { content: ""; position: absolute; inset: 3px; border: 2px solid var(--terracotta); border-radius: 7px; pointer-events: none; }
.day.selected { background: #f8e5b9; }
.day.reserved { background: var(--reserved); }
.day-number { position: relative; z-index: 1; display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%; font-size: .82rem; font-weight: 800; }
.day.reserved .day-number { color: var(--olive-dark); }
.reservation-chip { position: relative; z-index: 1; display: block; margin-top: .35rem; padding: .38rem .45rem; overflow: hidden; border-left: 4px solid var(--olive); border-radius: 4px; color: var(--olive-dark); background: rgba(255,255,255,.65); font-size: .72rem; font-weight: 800; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.reservation-chip.continuing { font-size: 0; height: 8px; padding: 0; border-left-width: 0; background: var(--olive); opacity: .55; }

.button { border: 1px solid transparent; border-radius: 9px; padding: .72rem 1rem; font-weight: 800; transition: transform .12s, background .12s; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: white; background: var(--olive); }
.button.primary:hover { background: var(--olive-dark); }
.button.secondary { border-color: #b8b6a9; color: var(--ink); background: #f6f3eb; }
.button.danger { color: white; background: #9a3d32; }
.button.compact { padding: .56rem .8rem; }
.button.full { width: 100%; }
.icon-button, .close-button { display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--olive-dark); background: var(--paper); }
.icon-button { width: 2rem; height: 2rem; }
.icon-button.large { width: 2.65rem; height: 2.65rem; font-size: 1.8rem; }
.close-button { width: 2.3rem; height: 2.3rem; font-size: 1.6rem; }
input, select, textarea { width: 100%; border: 1px solid #bcb7aa; border-radius: 8px; padding: .7rem .75rem; color: var(--ink); background: white; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(212,168,79,.32); border-color: var(--olive); }

.modal { width: min(720px, calc(100% - 1.5rem)); max-height: calc(100vh - 2rem); padding: 0; border: 0; border-radius: 18px; background: transparent; box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(23,29,18,.68); backdrop-filter: blur(3px); }
.modal-card { margin: 0; background: var(--paper); }
.modal-header, .modal-footer { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.25rem; }
.modal-header { justify-content: space-between; border-bottom: 1px solid var(--line); }
.modal-footer { border-top: 1px solid var(--line); }
.modal-body { padding: 1.25rem; max-height: calc(100vh - 220px); overflow-y: auto; }
.footer-spacer { flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-grid label { color: var(--ink); font-size: .82rem; font-weight: 800; }
.form-grid label > span { color: var(--terracotta); }
.form-grid input, .form-grid select, .form-grid textarea { margin-top: .4rem; font-weight: 400; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid small { display: block; min-height: 1em; margin-top: .25rem; color: #a12f25; font-weight: 600; }
.form-message { min-height: 1.2em; color: #a12f25; font-size: .85rem; font-weight: 700; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.detail { padding: .8rem; border-radius: 9px; background: #f3eee3; }
.detail.wide { grid-column: 1 / -1; }
.detail span, .detail strong { display: block; }
.detail span { color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.detail strong { margin-top: .25rem; }
.detail p { margin: .3rem 0 0; white-space: pre-wrap; }
.toast-region { position: fixed; z-index: 10; right: 1rem; bottom: 1rem; display: grid; gap: .6rem; }
.toast { max-width: 360px; padding: .9rem 1rem; border-radius: 9px; color: white; background: var(--olive-dark); box-shadow: var(--shadow); font-weight: 700; }
.toast.warning { background: var(--terracotta); }

@media (max-width: 900px) {
  .login-card { grid-template-columns: 1fr; }
  .login-photo { min-height: 220px; }
  .layout { grid-template-columns: 1fr; margin-top: 1rem; }
  .sidebar { position: static; }
  .upcoming-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 .8rem; }
  .calendar-toolbar { align-items: stretch; flex-direction: column; }
  .jump-controls { justify-content: center; }
}

@media (max-width: 620px) {
  .login-screen { padding: 0; }
  .login-card { min-height: 100vh; border: 0; border-radius: 0; }
  .login-photo { min-height: 180px; }
  .hero { min-height: 210px; padding: 1.25rem; }
  .hero-actions { flex-direction: column; align-items: end; }
  .layout { width: calc(100% - 1rem); }
  .upcoming-list { grid-template-columns: 1fr; }
  .jump-controls { flex-wrap: wrap; }
  .jump-controls label { flex: 1; }
  .calendar-wrap { padding: 0 .3rem .3rem; overflow-x: auto; }
  .weekdays, .calendar-grid { min-width: 620px; }
  .day { min-height: 94px; }
  .calendar-help span:last-child { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .modal-footer { flex-wrap: wrap; }
  .footer-spacer { display: none; }
  .modal-footer .button { flex: 1; }
}
