/* Scroll remains native (wheel, touch and keyboard); only its chrome is hidden. */
*, *::before, *::after { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }
body { min-width: 0; }
#garden-companion-slot:empty { display: none; }
body input:not([type='checkbox']), body select, body textarea { font-size: max(16px, 1rem); }
input[type='number'] { appearance: textfield; -moz-appearance: textfield; }
input::-webkit-inner-spin-button, input::-webkit-outer-spin-button { appearance: none; margin: 0; }
input[aria-invalid='true'], textarea[aria-invalid='true'] { border-color: #a74242; box-shadow: 0 0 0 3px #a7424214; }
.form-error { padding: 12px 16px; border-radius: 14px; background: #fce8e5; color: #823f37; }
input.date-input[type='text'] { cursor: pointer; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%23171a19' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Crect x='3' y='5' width='18' height='16' rx='3'/%3E%3Cpath d='M16 3v4M8 3v4M3 11h18M8 15h2M14 15h2'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.date-control input.date-input[type='text'] { width: 158px; font-size: 16px; padding: 10px 36px 10px 12px; }
.date-control input[type='hidden'] { display: none; }

/* The calendar enters the top layer, so neither a scrolling panel nor a dialog clips it. */
.flatpickr-calendar { position: fixed !important; inset: auto; margin: 0; width: min(324px,calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 12px; background: #fff; color: var(--ink); border: 1px solid var(--ink); border-radius: 24px; box-shadow: 0 12px 40px #17251d20; font: 500 14px/1.5 var(--font-sans, 'Quicksand', sans-serif); }
.flatpickr-calendar::before,.flatpickr-calendar::after { display: none; }
.flatpickr-calendar::backdrop { background: transparent; }
.flatpickr-months { align-items: center; margin-bottom: 10px; }
.flatpickr-months .flatpickr-month { height: 44px; }
.flatpickr-current-month { display: flex; align-items: center; justify-content: center; height: 44px; padding: 0; font-size: 16px; }
.flatpickr-current-month .cur-month { font-weight: 650; }
.flatpickr-current-month input.cur-year { font-weight: 600; font-size: 16px; padding: 0 2px; border: 0; }
.flatpickr-months .flatpickr-prev-month,.flatpickr-months .flatpickr-next-month { top: 12px; width: 40px; height: 44px; display: grid; place-items: center; border-radius: 14px; padding: 10px; }
.flatpickr-months .flatpickr-prev-month { left: 12px; }
.flatpickr-months .flatpickr-next-month { right: 12px; }
.flatpickr-months .flatpickr-prev-month:hover,.flatpickr-months .flatpickr-next-month:hover { background: var(--sky); }
.flatpickr-months .flatpickr-prev-month:hover svg,.flatpickr-months .flatpickr-next-month:hover svg { fill: var(--ink); }
.flatpickr-innerContainer,.flatpickr-rContainer,.flatpickr-days,.dayContainer { width: 100%; min-width: 0; max-width: none; }
.flatpickr-weekdays { height: 32px; }
span.flatpickr-weekday { font-size: 12px; font-weight: 600; color: #64736b; }
.dayContainer { justify-content: flex-start; }
.flatpickr-day { max-width: none; flex: 0 0 calc(100% / 7); height: 40px; line-height: 38px; border-radius: 13px; font-weight: 600; }
.flatpickr-day.today { border-color: #89a780; }
.flatpickr-day.selected,.flatpickr-day.selected:hover,.flatpickr-day.selected:focus { background: var(--ink); border-color: var(--ink); color: white; }
.flatpickr-day:hover,.flatpickr-day:focus { background: var(--mint); border-color: transparent; }
.flatpickr-day.flatpickr-disabled { color: #a4aaa6; }
.calendar-footer { display: flex; gap: 6px; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.calendar-footer button { min-height: 44px; padding: 8px 12px; border-radius: 16px; border: 0; font: inherit; color: var(--ink); background: var(--paper); }
.calendar-footer button:first-child { background: var(--mint); }
.calendar-footer button:last-child { margin-left: auto; }

.ts-wrapper { margin-top: 8px; font: inherit; }
.ts-wrapper.single .ts-control,.ts-wrapper.single.input-active .ts-control { min-height: 46px; padding: 11px 36px 11px 13px; border: 1px solid #b7c5bc; border-radius: 15px; background: white; box-shadow: none; color: var(--ink); }
.ts-control,.ts-control input,.ts-dropdown { font: 500 16px/1.5 var(--sans); color: var(--ink); }
.ts-wrapper.focus .ts-control { border-color: var(--ink); box-shadow: 0 0 0 3px #eedafb; }
.ts-control input { min-height: 22px; margin: 0 !important; padding: 0 !important; border: 0; background: transparent; box-shadow: none; }
.ts-control input:focus { outline: none; }
.ts-wrapper.single .ts-control::after { border: solid var(--ink); border-width: 0 1.5px 1.5px 0; width: 7px; height: 7px; transform: rotate(45deg); right: 16px; margin-top: -5px; }
.ts-wrapper.single.dropdown-active .ts-control::after { margin-top: -1px; transform: rotate(225deg); }
.ts-wrapper.single.dropdown-active .ts-control::after { border: solid var(--ink); border-width: 0 1.5px 1.5px 0; }
.ts-control input[readonly] { position: absolute !important; inset: 0 !important; width: 100% !important; height: 100%; min-height: 0; opacity: 0; cursor: pointer; }
.ts-control .item { overflow-wrap: anywhere; }
.ts-dropdown[popover] { position: fixed; inset: auto; margin: 0; padding: 7px; border: 1px solid var(--ink); border-radius: 18px; background: white; box-shadow: 0 10px 32px #17251d20; overflow: hidden; }
.ts-dropdown-content { max-height: min(250px,50dvh); }
.ts-dropdown .option,.ts-dropdown .create { min-height: 44px; padding: 10px 12px; border-radius: 11px; }
.ts-dropdown .active { background: var(--mint); color: var(--ink); }
.ts-dropdown .selected { background: var(--sky); color: var(--ink); }
.ts-dropdown .no-results { padding: 12px; color: var(--muted); font-size: .875rem; }
.ts-dropdown .highlight { background: transparent; font-weight: 700; }

.swal2-container { padding: 16px; font-family: inherit; }
.swal2-container[popover] { inset: 0; margin: 0; width: 100%; height: 100%; max-width: none; max-height: none; border: 0; color: inherit; }
.swal2-container.swal2-backdrop-show { background: #182c345c; backdrop-filter: blur(4px); }
.swal2-popup.study-confirm { width: min(460px,100%); padding: 30px; border: 1.5px solid var(--ink); border-radius: 28px; color: var(--ink); background: var(--paper); text-align: left; }
.study-confirm .swal2-title { padding: 0; font-size: 1.4rem; letter-spacing: -.035em; font-weight: 650; text-align: left; }
.study-confirm .swal2-html-container { margin: 16px 0 0; padding: 0; font-size: .9375rem; line-height: 1.7; color: #526158; text-align: left; overflow-wrap: anywhere; }
.study-confirm .swal2-actions { gap: 10px; margin: 26px 0 0; justify-content: flex-end; width: 100%; }
.study-confirm .swal2-actions button { margin: 0; }
.control-enter { animation: control-enter 180ms ease-out; }
.control-leave { animation: control-leave 120ms ease-in forwards; }
@keyframes control-enter { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes control-leave { to { opacity: 0; transform: translateY(4px); } }

.notyf[popover] { position: fixed; inset: auto 0 max(20px,env(safe-area-inset-bottom)) 0; margin: 0 auto; width: min(480px,calc(100% - 32px)); height: auto; max-width: none; border: 0; padding: 0; background: transparent; overflow: visible; pointer-events: none; }
.notyf__toast { width: 100%; max-width: none; min-width: 0; margin: 8px 0 0; padding: 0 16px; border-radius: 20px; box-shadow: 0 6px 24px #171a1924; pointer-events: auto; }
.notyf__wrapper { padding: 15px 0; }
.notyf__message { font: 500 .875rem/1.6 'Quicksand',sans-serif; overflow-wrap: anywhere; }
.notyf__dismiss { width: 44px; }
.notyf__dismiss-btn { opacity: .8; }
.notyf__toast--dismissible .notyf__wrapper { padding-right: 30px; }

/* Small screens stack controls and cards; larger screens retain the existing desk layout. */
.heading-copy,.page-heading > div,.form-row > label,.dialog-actions { min-width: 0; }
.study-card .task-title,.task-note,.question-card h2,.question-note { overflow-wrap: anywhere; }
.date-tools { flex-wrap: wrap; }
.app-header { padding-top: max(9px,env(safe-area-inset-top)); }
@media (max-width: 700px) {
  body { padding-inline: max(9px,env(safe-area-inset-left)) max(9px,env(safe-area-inset-right)); }
  .demo-banner { flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 14px; }
  .demo-banner a { white-space: nowrap; }
  .app-main:not(.view-overview),.view-overview { padding-inline: clamp(12px,4vw,22px); }
  .question-filters { width: 100%; }
  .question-filter { flex: 1 1 auto; min-height: 44px; }
  .filter { min-height: 44px; }
  .dialog-actions { flex-wrap: wrap; }
  dialog { max-height: calc(100dvh - 24px); padding: clamp(16px,5vw,24px); }
  .date-tools { gap: 4px; }
  .daily-heading .heading-copy { flex-basis: 100%; }
  .daily-heading { gap: 12px; }
  .daily-heading > .button { margin-left: auto; }
  body:not([data-view='overview']) .workspace { padding-bottom: 112px; }
  body:not([data-view='overview']) .garden-companion { height: 104px; }
  body:not([data-view='overview']) .garden-companion .garden-current { width: 96px; height: 96px; bottom: 16px; }
  .date-tools .date-control { flex: 1 1 142px; }
  .date-tools .date-control input.date-input[type='text'] { width: 100%; }
  .page-heading .empty-actions .button { flex: 1 1 auto; }
  .study-confirm .swal2-actions { flex-wrap: wrap; }
  .study-confirm .swal2-actions .button { flex: 1 1 auto; }
}
@media (max-width: 360px) {
  .progress-intro { grid-template-columns: 1fr; }
  .progress-intro > div { flex-direction: row; align-items: center; justify-content: space-between; }
  .app-header .nav-list { gap: 0; }
  .day-strip { gap: 0; }
  .day-button { min-width: 0; }
  .focus-dashboard .today-widget { padding: 15px; }
  .focus-task-meta { flex-wrap: wrap; }
  .focus-dashboard .digital-clock { font-size: clamp(3rem,17vw,3.8rem); }
}
/* A short landscape viewport needs content space more than a large tree dock. */
@media (max-height: 540px) {
  body:not([data-view='overview']) .workspace { padding-bottom: 74px; }
  body:not([data-view='overview']) .garden-companion { height: 70px; width: 150px; bottom: 16px; }
  body:not([data-view='overview']) .garden-companion .garden-current { width: 66px; height: 66px; bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .control-enter,.control-leave,.notyf__toast,.notyf__wrapper,.notyf__dismiss { animation: none !important; transition: none !important; }
  /* Notyf removes dismissed nodes on animationend; keep that event without motion. */
  .notyf__toast.notyf__toast--disappear { animation: notyf-reduced-dismiss 1ms linear forwards !important; }
  @keyframes notyf-reduced-dismiss { to { opacity: 0; } }
}

/* One page scroll, at every width. No fixed-height inner panel or empty tree band. */
body .workspace,body:not([data-view='overview']) .workspace {
  display: block; height: auto; min-height: calc(100dvh - 120px);
  padding-bottom: 0; overflow: visible;
}
.app-main,.app-main:not(.view-overview) {
  flex: none; overflow: visible; min-height: 0; height: auto;
  padding-bottom: 150px;
}
.view-overview { min-height: calc(100dvh - 120px); padding-bottom: 28px; }

/* On phones the tree gets its own footer, so it cannot cover study controls or notes. */
@media (max-width:700px), (max-width:1000px) and (max-height:500px) {
  body:not([data-view='overview']) .workspace { min-height: 0; }
  body:not([data-view='overview']) .app-main { padding-bottom: 24px; }
  body:not([data-view='overview']) #garden-companion-slot { background: var(--paper); padding: 0 clamp(14px,4vw,22px) max(20px,env(safe-area-inset-bottom)); }
  #garden-companion-slot .garden-companion { position: relative; inset: auto; display: block; width: 100%; height: 100px; padding: 20px; margin: 0; border-radius: 24px; background: #e5f2df; text-align: left; z-index: auto; }
  #garden-companion-slot .garden-companion::before { display: none; }
  #garden-companion-slot .garden-companion .garden-current { left: auto; right: 8px; bottom: 3px; width: 94px; height: 94px; transform: none; }
  #garden-companion-slot .companion-title { display: block; margin-right: 96px; color: #304630; font-size: .9375rem; font-weight: 650; }
  #garden-companion-slot .companion-label { position: static; display: block; max-width: calc(100% - 96px); margin-top: 6px; padding: 0; border-radius: 0; background: none; color: #53674f; font-size: .8125rem; text-align: left; }
}
.app-header { position: sticky; top: 0; z-index: 5; background: var(--ink); }
@media (max-width: 700px) {
  body .workspace,body:not([data-view='overview']) .workspace { min-height: calc(100dvh - 88px); }
  .view-overview { padding-bottom: 24px; }
}
