:root{
  color-scheme:light;
  --bg:#f4faf5;
  --surface:#fff;
  --ink:#192820;
  --muted:#617168;
  --line:#d8e3db;
  --accent:#22694f;
  --soft:#d7ecdd;
  --shadow:0 18px 60px #142d2110;
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  font-size:16px
}
html[data-theme=dark]{
  color-scheme:dark;
  --bg:#11170f;
  --surface:#1b2319;
  --ink:#e7eee3;
  --muted:#a9b5a4;
  --line:#3b4836;
  --accent:#acd58f;
  --soft:#354a2e;
  --shadow:none
}
*{
  box-sizing:border-box
}
body{
  margin:0;
  background:var(--bg);
  color:var(--ink)
}
a{
  color:inherit;
  text-decoration:none
}
button,input,select,textarea{
  font:inherit;
  color:inherit
}
button,.primary,summary{
  cursor:pointer
}
button,input,select,textarea{
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--surface);
  padding:10px 14px
}
button,summary,.primary{
  min-height:44px
}
button:hover,a.card:hover{
  border-color:var(--accent);
  background-color:var(--soft)
}
:focus-visible{
  outline:3px solid #1876dc;
  outline-offset:3px
}
a:hover{
  text-decoration:underline
}
h1,h2,p{
  margin-top:0
}
h1{
  font-size:clamp(26px,2.8vw,38px);
  font-weight:650;
  letter-spacing:-.035em;
  line-height:1.2
}
h2{
  font-size:23px
}
p{
  line-height:1.6
}
button:disabled{
  opacity:.55;
  cursor:wait
}
.app-header{
  padding:16px clamp(12px,3vw,48px);
  display:flex;
  justify-content:space-between;
  gap:20px;
  align-items:center;
  border-bottom:1px solid var(--line)
}
.brand{
  font-size:22px;
  font-weight:800;
  letter-spacing:-1px
}
.brand span{
  font-weight:400;
  margin-left:6px
}
.header-actions{
  display:flex;
  align-items:center;
  gap:14px
}
.header-actions form{
  margin:0
}
main{
  max-width:1920px;
  margin:0 auto;
  padding:30px clamp(10px,3vw,48px) 0
}
.back{
  display:inline-block;
  font-size:14px;
  color:var(--muted);
  margin:0 0 22px
}
.eyebrow{
  font-size:12px;
  font-weight:650;
  color:var(--muted);
  letter-spacing:.07em;
  text-transform:uppercase;
  margin-bottom:9px
}
.muted{
  color:var(--muted);
  font-size:14px
}
.primary{
  display:inline-flex;
  justify-content:center;
  align-items:center;
  padding:12px 22px;
  border-radius:24px;
  background:var(--accent);
  color:var(--bg);
  border:0;
  font-weight:600;
  text-align:center
}
.primary:hover{
  background:var(--accent);
  opacity:.9;
  text-decoration:none
}
.cards{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr));
  gap:20px;
  margin-top:32px
}
.card{
  padding:28px;
  border:1px solid var(--line);
  border-radius:18px;
  background:var(--surface)
}
.card h2{
  margin:24px 0
}
.login,.editor,.detail{
  max-width:720px;
  margin:24px auto 60px;
  background:var(--surface);
  padding:clamp(20px,4vw,46px);
  border:1px solid var(--line);
  border-radius:22px;
  box-shadow:var(--shadow)
}
.login{
  max-width:560px
}
.login h1{
  font-size:42px
}
.login form,label{
  display:flex;
  flex-direction:column;
  gap:8px
}
.login form{
  gap:20px;
  margin-top:30px
}
input:not([type=checkbox]),select,textarea{
  max-width:100%;
  width:100%
}
textarea{
  resize:vertical
}
input[type=checkbox]{
  width:20px;
  height:20px;
  accent-color:var(--accent)
}
.editor form>p{
  margin:24px 0
}
.editor label{
  font-size:14px;
  font-weight:550;
  margin-bottom:7px
}
.date-fields{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:0 20px
}
.range-switch{
  grid-column:1/-1;
  flex-direction:row;
  align-items:center;
  margin-bottom:16px!important
}
.date-fields p{
  margin-bottom:12px
}
.date-fields p:first-child{
  grid-column:1/-1
}
.date-fields:has(#end-date-field:not([hidden])) p:first-child{
  grid-column:auto
}
fieldset{
  border:0;
  padding:0;
  margin:18px 0
}
legend{
  font-size:14px;
  margin-bottom:10px
}
.palette{
  display:flex;
  gap:8px;
  overflow-x:auto;
  padding:4px;
  scrollbar-width:thin
}
.swatch{
  flex:0 0 44px;
  padding:5px;
  border:2px solid transparent;
  background:none
}
.swatch span{
  display:block;
  width:30px;
  height:30px;
  border-radius:50%;
  background:var(--booking-color);
  border:1px solid #0002
}
.swatch[aria-pressed=true]{
  border-color:var(--accent)
}
.swatch[aria-pressed=true] span:after{
  content:"✓";
  display:grid;
  place-items:center;
  color:#fff;
  font-weight:800;
  text-shadow:0 1px 2px #000
}
.color-preview{
  background:var(--booking-color);
  color:#fff;
  border-radius:8px;
  padding:12px;
  font-weight:600
}
.detail-heading{
  display:flex;
  align-items:center;
  gap:18px
}
.detail-heading h1{
  overflow-wrap:anywhere;
  margin:0
}
.color-marker{
  display:inline-block;
  width:22px;
  height:22px;
  flex-shrink:0;
  background:var(--booking-color);
  border-radius:5px
}
.date-range{
  margin:24px 0;
  font-size:19px
}
dt{
  font-size:13px;
  color:var(--muted);
  margin-bottom:6px
}
dd{
  margin:0 0 28px;
  overflow-wrap:anywhere
}
.comment{
  white-space:pre-wrap
}
.errorlist,[role=alert]{
  color:#b32d24
}
.calendar-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:24px;
  margin-bottom:14px
}
.calendar-toolbar h1{
  margin:0;
  text-transform:capitalize
}
.calendar-actions{
  display:flex;
  align-items:center;
  gap:8px
}
.calendar-actions>button{
  background:transparent
}
.date-control input{
  max-width:170px
}
.calendar-actions details{
  position:relative
}
.calendar-actions summary{
  display:grid;
  place-items:center;
  border-radius:50%;
  width:44px;
  font-size:23px;
  list-style:none
}
.calendar-actions summary::-webkit-details-marker{
  display:none
}
.settings-panel{
  position:absolute;
  right:0;
  top:50px;
  z-index:9;
  width:280px;
  padding:20px;
  border:1px solid var(--line);
  border-radius:16px;
  background:var(--surface);
  box-shadow:var(--shadow)
}
.settings-panel label{
  margin-bottom:18px
}
.settings-panel p{
  margin:0
}
.calendar-bottom{
  position:sticky;
  bottom:0;
  padding:14px 0;
  background:var(--bg);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  z-index:5;
  border-top:1px solid var(--line)
}
.view-tabs{
  display:flex;
  gap:4px;
  background:var(--soft);
  padding:4px;
  border-radius:28px
}
.view-tabs button{
  border:0;
  background:transparent;
  border-radius:23px;
  min-width:105px
}
.view-tabs button[aria-pressed=true]{
  background:var(--accent);
  color:var(--bg)
}
#calendar-status{
  font-size:14px;
  color:var(--muted);
  min-height:24px;
  margin:0 0 8px
}
#calendar-viewport{
  min-height:calc(100vh - 340px);
  overflow-x:auto
}
.week-row,.weekday-headers{
  display:grid;
  grid-template-columns:repeat(var(--days),minmax(44px,1fr));
  gap:6px;
  min-width:calc(var(--days)*44px + (var(--days) - 1)*6px)
}
.weekday-headers{
  position:sticky;
  top:0;
  background:var(--bg);
  padding:10px 0;
  color:var(--muted);
  font-size:12px;
  text-align:center
}
.week-row{
  margin-bottom:30px
}
.date-heading{
  text-align:center;
  min-height:52px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:5px;
  font-size:16px
}
.date-badge{
  width:34px;
  height:34px;
  display:inline-grid;
  place-items:center;
  border-radius:50%
}
.date-badge.today{
  background:#1876ed;
  color:#fff
}
.outside-month .date-heading{
  color:var(--muted)
}
.day-column{
  min-width:0
}
.booking{
  height:44px;
  position:relative;
  display:flex;
  align-items:center;
  min-width:0;
  padding:0 9px;
  color:#FFFFFF;
  font-size:13px;
  font-weight:650;
  text-decoration:none!important;
  isolation:isolate
}
.booking:before{
  content:"";
  position:absolute;
  inset:2px 0;
  background:var(--booking-color);
  border-radius:8px;
  z-index:-1
}
.booking span{
  display:block;
  white-space:nowrap;
  overflow:hidden;
  line-height:1.3
}
.booking:hover:before{
  outline:2px solid var(--accent);
  outline-offset:-2px
}
.booking:focus-visible{
  outline-offset:0
}
.blank-create{
  display:grid;
  place-items:center;
  min-height:48px;
  color:var(--muted);
  border-radius:8px;
  font-size:22px
}
.blank-create:hover{
  background:var(--soft);
  text-decoration:none
}
.day-mode .week-row{
  display:block;
  max-width:1100px;
  margin:0 auto
}
.day-mode .date-heading{
  justify-content:flex-start;
  font-size:21px;
  padding-bottom:12px
}
.day-mode .booking{
  height:64px;
  font-size:16px;
  padding:0 16px
}
.day-mode .weekday-headers{
  display:none
}
.day-mode .blank-create{
  border:1px dashed var(--line);
  margin:10px 0 28px
}
.sr-only{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap
}
.calendar-message{
  padding:48px 12px;
  max-width:640px
}
.calendar-message a{
  text-decoration:underline
}
[hidden]{
  display:none!important
}
@media(max-width:760px){
  .app-header{
    padding:12px;
    gap:8px
  }
  .brand{
    font-size:18px
  }
  .header-actions{
    gap:6px;
    font-size:13px
  }
  .header-actions button{
    padding:8px
  }
  .header-actions>a{
    display:none
  }
  main{
    padding:18px 8px 0
  }
  .calendar-toolbar{
    flex-wrap:wrap;
    gap:14px
  }
  .calendar-actions{
    width:100%;
    gap:5px;
    flex-wrap:wrap
  }
  .calendar-actions input{
    max-width:145px
  }
  .calendar-toolbar h1{
    font-size:28px
  }
  .calendar-toolbar .eyebrow{
    margin-bottom:4px
  }
  .calendar-bottom{
    gap:5px;
    padding:8px 0
  }
  .view-tabs{
    gap:0;
    flex:1
  }
  .view-tabs button{
    min-width:0;
    flex:1;
    padding:8px;
    font-size:13px
  }
  .calendar-bottom .primary{
    padding:10px;
    font-size:0;
    min-width:44px
  }
  .calendar-bottom .primary:before{
    content:"+";
    font-size:24px
  }
  .booking{
    padding:0 4px;
    font-size:12px
  }
  .week-row{
    gap:6px
  }
  .login,.editor,.detail{
    margin-top:12px;
    padding:20px;
    border-radius:16px
  }
  .date-fields{
    display:block
  }
  .settings-panel{
    right:0
  }
  .calendar-actions details{
    margin-left:auto
  }
}
/* One scroll viewport for the whole period: controls stay reachable on dense days. */
#calendar-viewport{
  min-height:220px;
  overflow:auto;
  overscroll-behavior:contain;
  scroll-padding-top:90px
}
.weekday-headers{
  z-index:4
}
.date-heading{
  position:sticky;
  top:34px;
  background:var(--bg);
  z-index:3
}
.day-mode .date-heading{
  top:0
}
.settings-panel select{
  margin-bottom:18px
}
.app-header{
  flex-wrap:wrap
}

fieldset{min-inline-size:0;max-width:100%}
.palette{min-width:0;max-width:100%}
.search-filters{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px;margin:12px 0}.search-result{padding:12px 0;border-bottom:1px solid var(--line);overflow-wrap:anywhere}.search-result .booking{display:flex;max-width:700px;min-height:44px}.search-result p{margin:6px 0}#search-q{width:100%;max-width:760px}#search-form{max-width:1100px}#search-form>button{margin:8px 8px 8px 0}
.palette-label{background:var(--booking-color);color:#FFFFFF;border-radius:8px;padding:10px 12px;max-width:700px;overflow-wrap:anywhere}#preset-form,#default-form{max-width:700px;display:grid;gap:10px;margin:20px 0}#preset-form label,#default-form label{display:grid;gap:6px}#preset-list button{margin:4px}

#preset-form label.toggle{display:flex;flex-direction:row;align-items:center;min-height:44px}#preset-picker{height:48px;padding:4px}.palette-options{display:grid;grid-template-columns:repeat(auto-fit,minmax(100px,1fr));gap:8px;max-width:700px}.palette-options p{margin:0;min-height:44px}
