/* ==========================================================================
   Owner portal + staff app (shares tokens, fonts and buttons with site.css)
   ========================================================================== */
body.app { background: var(--sand-soft); min-height: 100vh; padding-bottom: 0; }
.app-bar {
  position: sticky; top: 0; z-index: 40; background: var(--ink); color: var(--on-ink);
  padding-top: env(safe-area-inset-top, 0px);
}
.app-bar__inner { display: flex; align-items: center; gap: 14px; height: 64px; }
.app-bar img { height: 40px; width: auto; }
.app-bar__title { font: 600 1.05rem/1 var(--display); letter-spacing: .03em; }
.app-bar__spacer { flex: 1; }
.app-bar button, .app-bar a.bar-link {
  background: none; border: 1px solid var(--line-light); color: var(--on-ink);
  font: 500 .98rem var(--text); padding: 8px 14px; cursor: pointer; text-decoration: none;
}
.app-bar button:hover, .app-bar a.bar-link:hover { border-color: var(--on-ink); }
.app-bar .back { border: 0; padding: 8px 6px; font-weight: 600; }
.app-main { padding: clamp(22px, 4vw, 40px) 0 clamp(60px, 8vw, 96px); }
.app-main .wrap { max-width: 1040px; }
.app-main h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.muted { color: var(--dust); }

/* Auth card */
.auth { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 28px 16px 60px; }
.auth__card { width: min(420px, 100%); background: var(--paper); padding: 32px 28px; border-top: 6px solid var(--red); box-shadow: 0 20px 50px rgba(14,14,14,.12); }
.auth__card img { width: 112px; margin: 0 auto 16px; }
.auth__card h1 { text-align: center; font-size: 1.9rem; margin-bottom: .3em; }
.auth__card > p { text-align: center; color: var(--dust); margin-bottom: 22px; }
.stack { display: grid; gap: 14px; }
.stack .btn { width: 100%; }
.auth__foot { margin-top: 18px; font-size: .95rem; color: var(--dust); text-align: center; }

/* Fields (match site form) */
.app .field input, .app .field select, .app .field textarea { width: 100%; }

/* Horse cards */
.horse-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; margin-top: 24px; }
.horse-card { display: block; background: var(--paper); text-decoration: none; color: var(--ink); border: 1px solid var(--line); transition: transform .18s ease, box-shadow .18s ease; }
.horse-card:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(14,14,14,.12); }
.horse-card__img { aspect-ratio: 4 / 3; background: var(--ink); position: relative; overflow: hidden; }
.horse-card__img img { width: 100%; height: 100%; object-fit: cover; }
.horse-card__body { padding: 16px 18px 18px; border-top: 4px solid var(--red); }
.horse-card h2 { font-size: 1.5rem; margin-bottom: .2em; }
.horse-card p { margin: 0; color: var(--dust); font-size: 1rem; }
.silhouette { position: absolute; inset: 18% 22%; background: var(--sand);
  -webkit-mask: url("../img/horse.svg") center / contain no-repeat; mask: url("../img/horse.svg") center / contain no-repeat; }

/* Horse feed */
.horse-head { display: grid; grid-template-columns: 120px 1fr; gap: 20px; align-items: center; margin-bottom: 28px; }
.horse-head__img { width: 120px; height: 120px; background: var(--ink); position: relative; overflow: hidden; }
.horse-head__img img { width: 100%; height: 100%; object-fit: cover; }
.horse-head h1 { margin-bottom: .15em; }
.horse-head p { margin: 0; color: var(--dust); }
@media (max-width: 520px) { .horse-head { grid-template-columns: 84px 1fr; gap: 14px; } .horse-head__img { width: 84px; height: 84px; } }

.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; max-width: 680px; }
.post { background: var(--paper); border: 1px solid var(--line); }
.post__head { display: flex; justify-content: space-between; gap: 12px; padding: 14px 18px 0; font-size: .95rem; color: var(--dust); }
.post__head strong { color: var(--ink); }
.post__caption { padding: 8px 18px 16px; margin: 0; white-space: pre-wrap; }
.post__media { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; }
.post__media.one { grid-template-columns: 1fr; }
.post__media button { padding: 0; border: 0; cursor: zoom-in; background: var(--ink); aspect-ratio: 1; overflow: hidden; }
.post__media.one button { aspect-ratio: auto; max-height: 560px; }
.post__media img { width: 100%; height: 100%; object-fit: cover; }
.post__media.one img { height: auto; max-height: 560px; object-fit: contain; }
.post__media video { width: 100%; max-height: 560px; background: #000; display: block; grid-column: 1 / -1; }
.post__tools { padding: 0 18px 14px; }
.day-label { font: 600 1rem var(--display); color: var(--dust); margin: 10px 0 -6px; }

.empty-box { background: var(--paper); border: 1px dashed rgba(14,14,14,.3); padding: 28px 24px; max-width: 620px; }
.empty-box h2 { font-size: 1.35rem; }
.empty-box p:last-child { margin-bottom: 0; }

/* Lightbox */
.lightbox { padding: 0; border: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
.lightbox::backdrop { background: rgba(0,0,0,.92); }
.lightbox img { max-width: 100%; max-height: 100%; margin: auto; position: absolute; inset: 0; object-fit: contain; }
.lightbox button { position: absolute; right: 14px; top: calc(14px + env(safe-area-inset-top, 0px)); z-index: 2; background: rgba(255,255,255,.14); color: #fff; border: 0; width: 46px; height: 46px; font-size: 1.8rem; cursor: pointer; }

/* Toast */
.app-toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 90;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--on-ink); padding: 12px 18px; font-weight: 600; border-left: 4px solid var(--red);
  transition: opacity .2s ease, transform .2s ease; max-width: calc(100% - 32px);
}
.app-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Staff app ---------- */
.tabs-nav { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: calc(64px + env(safe-area-inset-top, 0px)); z-index: 35; }
.tabs-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; overflow-x: auto; }
.tabs-nav a { display: flex; align-items: center; gap: 8px; padding: 14px 14px 12px; text-decoration: none; font-weight: 600; color: var(--dust); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--red); }
.tabs-nav b { background: var(--red); color: #fff; font-size: .78rem; padding: 1px 7px; border-radius: 10px; }
.tabs-nav b:empty { display: none; }

.panel { background: var(--paper); border: 1px solid var(--line); padding: clamp(18px, 3vw, 28px); }
.panel + .panel { margin-top: 18px; }
.panel h2 { font-size: 1.4rem; }
.toolbar-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
.chip { font: 600 .95rem var(--text); border: 1px solid var(--line); background: var(--paper); padding: 8px 14px; cursor: pointer; color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }

.cards { display: grid; gap: 14px; }
.card { background: var(--paper); border: 1px solid var(--line); padding: 18px 20px; }
.card__top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 8px; }
.card__top h3 { margin: 0; font-size: 1.25rem; }
.card dl { display: grid; grid-template-columns: 8.5em 1fr; gap: 6px 12px; margin: 10px 0 14px; font-size: 1rem; }
.card dt { color: var(--dust); }
.card dd { margin: 0; }
.card .btn-row { gap: 10px; }
.btn--sm { min-height: 42px; padding: 0 1.1em; font-size: .98rem; }
.btn--ghost { border-color: var(--line); }
.status { font-size: .82rem; font-weight: 600; padding: 3px 9px; border: 1px solid currentColor; white-space: nowrap; }
.status--pending { color: #9a5b00; background: #FFF4DE; }
.status--confirmed { color: #1f6b3a; background: #E8F4EC; }
.status--declined, .status--cancelled { color: #777; }
.status--completed { color: var(--ink); }
.status--invite { color: #9a5b00; }

.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 16px; }
/* iPhone draws date and time boxes at their own width with the text centered; line them up with the other fields */
.field input[type="date"], .field input[type="time"] { -webkit-appearance: none; appearance: none; display: block; width: 100%; min-width: 0; max-width: 100%; text-align: left; }
.field input[type="date"]::-webkit-date-and-time-value, .field input[type="time"]::-webkit-date-and-time-value { text-align: left; }
.field { min-width: 0; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 4px; }
.inline-error { color: var(--red-deep); font-weight: 600; margin: 0; }

.uploader { border: 2px dashed rgba(14,14,14,.3); background: var(--sand-soft); padding: 22px; text-align: center; cursor: pointer; display: block; }
.uploader:hover, .uploader:focus-within { border-color: var(--red); }
.uploader input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.uploader strong { display: block; font-size: 1.1rem; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 12px; }
.thumbs figure { position: relative; margin: 0; aspect-ratio: 1; background: var(--ink); overflow: hidden; }
.thumbs img, .thumbs video { width: 100%; height: 100%; object-fit: cover; }
.thumbs figcaption { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.65); color: #fff; font-size: .75rem; padding: 1px 6px; }
.thumbs button { position: absolute; right: 4px; top: 4px; width: 28px; height: 28px; border: 0; background: rgba(0,0,0,.7); color: #fff; cursor: pointer; font-size: 1.1rem; line-height: 1; }
.progress { height: 6px; background: var(--line); margin-top: 8px; }
.progress i { display: block; height: 100%; width: 0; background: var(--red); transition: width .2s ease; }

.invite-box { margin-top: 14px; background: var(--sand-soft); border-left: 4px solid var(--red); padding: 14px 16px; }
.invite-box code { display: block; word-break: break-all; font-size: .9rem; background: var(--paper); padding: 8px 10px; margin: 8px 0 10px; border: 1px solid var(--line); }

.stall-rows { border-top: 3px solid var(--ink); }
.stall-row { border-bottom: 1px solid var(--line); }
.stall-row > button {
  width: 100%; display: grid; grid-template-columns: 1.4fr 1fr 1fr 9em; gap: 10px; align-items: center; text-align: left;
  background: none; border: 0; padding: 14px 4px; cursor: pointer; font: inherit; color: var(--ink);
}
.stall-row > button:hover { background: var(--sand-soft); }
.stall-row__edit { padding: 6px 4px 20px; }
.photo-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.photo-strip figure { position: relative; margin: 0; width: 110px; height: 82px; background: var(--sand); }
.photo-strip img { width: 100%; height: 100%; object-fit: cover; }
.photo-strip button { position: absolute; right: 3px; top: 3px; width: 26px; height: 26px; border: 0; background: rgba(0,0,0,.7); color: #fff; cursor: pointer; }
@media (max-width: 600px) { .stall-row > button { grid-template-columns: 1fr auto; } .stall-row > button .hide-sm { display: none; } }

/* Toast with an action (Undo) */
.app-toast { display: flex; align-items: center; gap: 14px; }
.app-toast.has-action { pointer-events: auto; }
.app-toast button { background: none; border: 1px solid rgba(246,240,229,.5); color: var(--on-ink); font: 600 .95rem var(--text); padding: 6px 12px; cursor: pointer; }
.app-toast button:hover { border-color: var(--on-ink); }

.photo-strip figcaption { position: absolute; left: 0; bottom: 0; right: 0; background: rgba(14,14,14,.7); color: #fff; font-size: .75rem; padding: 2px 6px; }

/* ---------- Pricing board ---------- */
.pricing .seg { display: inline-grid; grid-auto-flow: column; background: var(--paper); border: 1px solid var(--line); padding: 4px; gap: 4px; }
.pricing .seg button { font: 600 1rem var(--text); border: 0; background: none; padding: 10px 18px; cursor: pointer; color: var(--dust); }
.pricing .seg button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.pricing__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px 24px; margin-bottom: 20px; }
.pricing__head h1 { margin-bottom: .2em; }
.pricing__head p { margin: 0; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--sand); padding: 14px 16px; display: grid; gap: 2px; }
.kpi span { font-size: .9rem; color: var(--dust); font-weight: 500; }
.kpi strong { font: 600 1.55rem/1.15 var(--display); }
.kpi small { color: var(--dust); font-size: .88rem; }
.kpi--dark { background: var(--ink); color: var(--on-ink); border-color: var(--ink); border-top-color: var(--red); }
.kpi--dark span, .kpi--dark small { color: rgba(246,240,229,.72); }
@media (max-width: 900px) { .kpis { grid-template-columns: 1fr 1fr; } }

.app-main .wrap.pricing { max-width: 1240px; }
/* Wide screens: the editor floats over the empty arena on the map */
.pricing__grid { position: relative; }
@media (max-width: 1099px) { .pricing__grid { display: grid; grid-template-columns: 1fr; gap: 18px; } }
.board { background: var(--paper); border: 1px solid var(--line); }
.board__tools { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 16px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.quick .chip { padding: 6px 11px; font-size: .9rem; }
.legend-bar { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--dust); }
.legend-bar i { width: 90px; height: 10px; background: linear-gradient(90deg, rgb(236,214,170), rgb(167,27,33)); display: inline-block; }
.legend-bar .legend-none { width: 14px; height: 10px; margin-left: 8px; background: repeating-linear-gradient(45deg, #f6f0e5 0 3px, #d9cdb6 3px 5px); border: 1px solid var(--line); display: inline-block; }
.board__map { background: #2b2b2b; }
#pb-svg { display: block; width: 100%; height: auto; max-width: none; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.pb-stall { cursor: pointer; outline: none; }
.pb-stall rect { stroke: rgba(14,14,14,.55); stroke-width: 1.5; transition: transform .15s ease; }
.pb-stall:hover rect { stroke: #fff; stroke-width: 2.5; }
.pb-stall:focus-visible rect { stroke: #fff; stroke-width: 3.5; }
.pb-stall.is-sel rect { stroke: #fff; stroke-width: 4; }
.pb-stall.is-off { cursor: not-allowed; }
.pb-price { font-family: var(--text); font-weight: 700; text-anchor: middle; pointer-events: none; }
.pb-num { font-family: var(--text); font-weight: 600; font-size: 10px; opacity: .8; pointer-events: none; }
.pb-lasso { fill: rgba(255,255,255,.14); stroke: #fff; stroke-width: 2; stroke-dasharray: 6 4; pointer-events: none; }

.editor { background: var(--paper); border: 1px solid var(--line); border-top: 6px solid var(--red); padding: 20px 20px 22px; }
@media (min-width: 1100px) {
  .editor { position: absolute; top: 70px; right: 18px; width: 360px; max-height: min(600px, calc(100% - 200px)); overflow: auto; box-shadow: 0 22px 50px rgba(0,0,0,.4); }
}
.editor h2 { font-size: 1.45rem; margin-bottom: .35em; }
.tips { margin: 0 0 14px; padding-left: 1.1em; display: grid; gap: 6px; }
.sel-chips { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.sel-chips li { display: flex; align-items: center; gap: 2px; background: var(--sand-soft); border: 1px solid var(--line); padding: 2px 2px 2px 9px; font-size: .9rem; font-weight: 600; }
.sel-chips li.more { padding: 2px 9px; color: var(--dust); }
.sel-chips button { border: 0; background: none; cursor: pointer; font-size: 1.05rem; line-height: 1; padding: 2px 6px; color: var(--dust); }
.now { margin: 0 0 14px; }
.set-form { display: grid; gap: 8px; margin-bottom: 14px; }
.set-form label { font-weight: 600; }
.set-form .btn { width: 100%; }
.money-input { display: flex; align-items: stretch; border: 1px solid rgba(14,14,14,.35); background: var(--paper); }
.money-input span { display: grid; place-items: center; padding: 0 10px; background: var(--sand-soft); color: var(--dust); font-weight: 600; border-right: 1px solid var(--line); }
.money-input input { border: 0; font: 600 1.4rem var(--text); padding: 8px 12px; width: 100%; min-width: 0; background: none; color: var(--ink); }
.money-input:focus-within { outline: 3px solid var(--red); outline-offset: 0; }
.money-input input:focus { outline: none; }
.money-input--sm input { font-size: 1rem; padding: 6px 8px; }
.money-input--sm span { padding: 0 7px; }
.nudges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.nudges .chip { padding: 6px 10px; font-size: .92rem; }
.preview { list-style: none; margin: 0 0 12px; padding: 10px 12px; background: var(--sand-soft); max-height: 220px; overflow: auto; display: grid; gap: 4px; font-size: .95rem; }
.preview li { display: flex; justify-content: space-between; gap: 10px; }
.preview li.up span:last-child { color: #1f6b3a; font-weight: 600; }
.preview li.down span:last-child { color: var(--red-deep); font-weight: 600; }
.one-facts { display: grid; grid-template-columns: 7em 1fr; gap: 4px 10px; margin: 14px 0 8px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .98rem; }
.one-facts dt { color: var(--dust); }
.one-facts dd { margin: 0; }
.linklike { border: 0; background: none; padding: 6px 0; color: var(--dust); font: 500 .95rem var(--text); text-decoration: underline; cursor: pointer; }
.linklike:hover { color: var(--red-deep); }

.sheet-wrap { overflow-x: auto; }
.price-sheet { width: 100%; border-collapse: collapse; min-width: 560px; }
.price-sheet th, .price-sheet td { text-align: left; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); font-size: .98rem; vertical-align: middle; }
.price-sheet thead th { font-size: .88rem; color: var(--dust); font-weight: 600; }
.price-sheet td .money-input { max-width: 150px; }
.price-sheet tr.is-sel { background: #fff4f1; }
.price-sheet tr.is-sel th { box-shadow: inset 4px 0 0 var(--red); }
.price-sheet tr.is-off { color: var(--dust); }
.rowpick { border: 0; background: none; font: 600 1rem var(--text); padding: 6px 8px; cursor: pointer; text-align: left; color: var(--ink); }
.rowpick:hover { text-decoration: underline; }
.money-input input.is-saved { background: #e6f4ea; transition: background .2s ease; }
.money-input input.is-bad { background: #fde8e8; }
@media (max-width: 640px) { .price-sheet .hide-sm { display: none; } .price-sheet { min-width: 0; } }

.pricing__bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.pricing__bottom .panel + .panel { margin-top: 0; }
@media (max-width: 860px) { .pricing__bottom { grid-template-columns: 1fr; } }
.history__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.history__head h2 { margin: 0; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .96rem; }
.history time { color: var(--dust); white-space: nowrap; font-size: .9rem; }
.history li.is-undone span { text-decoration: line-through; color: var(--dust); }

/* Waivers */
.search { font: inherit; font-size: 1.02rem; border: 1px solid rgba(14,14,14,.35); background: var(--paper); padding: 10px 14px; min-height: 46px; width: min(460px, 100%); }
.search:focus { outline: 3px solid var(--red); outline-offset: 0; }
.link-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }

/* ---------- My shift ---------- */
.shift { max-width: 760px; }
.clock { text-align: center; padding: clamp(24px, 5vw, 40px) 20px; border-top: 6px solid var(--line); }
.clock.is-on { border-top-color: #1f6b3a; }
.clock.is-break { border-top-color: #c98a00; background: #fffaf0; }
.clock__state { font: 600 1.15rem var(--text); margin: 0 0 6px; }
.clock__time { font: 600 clamp(2.6rem, 10vw, 3.6rem)/1.05 var(--text); font-variant-numeric: tabular-nums; margin: 0 0 18px; }
.clock__time small { font: 500 1rem var(--text); color: var(--dust); }
.clock__big { min-height: 72px; font-size: 1.3rem; width: min(100%, 360px); margin: 12px 0 10px; }
.clock__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 460px; margin: 0 auto 12px; }
.clock__actions .btn { min-height: 60px; font-size: 1.1rem; }
.clock__hint { margin: 0; font-size: .95rem; }
.clock .inline-error { margin-top: 10px; }
.check-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.check-count { font-weight: 600; color: var(--dust); }
.check-sec { border: 0; padding: 0; margin: 18px 0 0; }
.check-sec legend { font: 600 1.1rem var(--display); padding: 0 0 6px; }
.check-item { display: flex; gap: 12px; align-items: flex-start; padding: 11px 4px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 1.04rem; }
.check-item input { width: 24px; height: 24px; margin-top: 1px; accent-color: #1f6b3a; flex: none; }
.check-item input:checked + span { color: var(--dust); text-decoration: line-through; text-decoration-color: rgba(14,14,14,.35); }
.notes { list-style: none; margin: 14px 0 0; padding: 0; }
.notes li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.urgent { color: var(--red-deep); }
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { display: grid; grid-template-columns: 1fr 1.3fr auto; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.out-sheet { width: min(480px, calc(100% - 24px)); border: 0; padding: 0; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.out-sheet::backdrop { background: rgba(14,14,14,.55); }
.out-sheet .sheet__body { padding: 22px 24px; }
.choice { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.choice input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--red); flex: none; }

/* ---------- Hours ---------- */
.app-main .wrap.hours { max-width: 1240px; }
.hours__pick { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.hours__pick input[type="date"] { font: inherit; border: 1px solid rgba(14,14,14,.35); padding: 9px 12px; min-height: 46px; background: var(--paper); }
.hours .seg { display: inline-grid; grid-auto-flow: column; background: var(--paper); border: 1px solid var(--line); padding: 4px; gap: 4px; }
.hours .seg button { font: 600 1rem var(--text); border: 0; background: none; padding: 9px 16px; cursor: pointer; color: var(--dust); }
.hours .seg button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.now-on { margin-bottom: 18px; }
.now-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; }
.hours-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.hours-table th, .hours-table td { text-align: left; padding: 9px 10px 9px 0; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: .98rem; }
.hours-table thead th { font-size: .88rem; color: var(--dust); }
.hours-table .edit-row td { background: var(--sand-soft); padding: 14px; }
.flag { color: var(--red-deep); font-weight: 600; font-size: .92rem; }
.ok { color: #1f6b3a; font-weight: 600; }
.add-shift { margin-top: 16px; background: var(--sand-soft); padding: 16px; }
.hours-settings summary { cursor: pointer; list-style: none; }
.hours-settings summary::-webkit-details-marker { display: none; }
.hours-settings summary h2 { display: inline; }
.hours-settings summary::after { content: " +"; font-weight: 600; color: var(--red); }
.hours-settings[open] summary::after { content: " –"; }
.hours-settings form { margin-top: 16px; }
.geo-box { background: var(--sand-soft); padding: 14px 16px; }
.geo-box p { margin: 4px 0 10px; }
.inline-field { flex-direction: row !important; align-items: center; gap: 8px; font-weight: 600; }
.inline-field input { width: 90px; }
.hours textarea[name="checklistText"] { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92rem; }
.pos-select { font: 600 .95rem var(--text); border: 1px solid var(--line); padding: 8px 10px; min-height: 42px; background: var(--paper); }
.btn--danger:hover { border-color: var(--red-deep); color: var(--red-deep); background: transparent; }

.doc-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 12px; }
.doc-chip { font-size: .85rem; font-weight: 600; padding: 3px 10px; border: 1px solid var(--line); color: var(--dust); }
.doc-chip.is-signed { color: #1f6b3a; border-color: #b9dcc6; background: #eef7f1; }
.doc-chip.is-req { color: #9a5b00; border-color: #f0d9a8; background: #fff6e2; }

.bulk-res { margin: 12px 0 0; padding-left: 18px; }
.bulk-res li { margin: 4px 0; }
.ok-line { color: #1f6b3a; font-weight: 600; }

/* ==========================================================================
   Stall board (#/board)
   ========================================================================== */
.board-page .panel { margin-bottom: 18px; }
.board-page .panel + .panel { margin-top: 0; }
.board-day { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.board-day input[type="date"] { font: 600 1rem var(--text); border: 1px solid var(--line); padding: 7px 10px; background: var(--paper); color: var(--ink); }
.board-day__label { margin-left: 6px; font-size: 1.05rem; }
.board-sub { font-size: 1.1rem; margin: 22px 0 8px; }
.board-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 14px 0 0; font-size: .92rem; color: var(--dust); }
.board-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 16px; height: 16px; border: 1px solid var(--line); display: inline-block; }

/* The barn: left side, aisle, right side; stalls 1 and 11 at the bottom by the doors */
.barn { display: grid; grid-template-columns: minmax(0, 1fr) 46px minmax(0, 1fr); gap: 6px 0; max-width: 760px; }
.barn__side { font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--dust); text-align: center; }
.barn__aisle { background: var(--sand-soft); }
.barn__aisle--head, .barn__aisle--foot { background: none; font-size: .72rem; color: var(--dust); text-align: center; text-transform: uppercase; letter-spacing: .05em; align-self: center; }
.outdoor { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }

.stall-tile {
  position: relative; display: grid; gap: 1px; align-content: center; text-align: left; min-height: 64px; padding: 8px 10px 8px 46px;
  font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); cursor: pointer;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; /* press and hold drags, it doesn't select text */
}
.stall-tile:hover:not(:disabled) { border-color: var(--ink); }
/* Dragging a horse to another stall */
.stall-tile.is-lifted { opacity: .35; }
.stall-tile.is-target { outline: 3px solid var(--red); outline-offset: -3px; }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; box-shadow: 0 12px 30px rgba(14,14,14,.35); opacity: .95; }
.board-hint { font-size: .92rem; margin: 0 0 10px; }
.stall-tile:focus-visible { outline: 3px solid var(--red); outline-offset: 1px; }
.stall-tile__num { position: absolute; left: 0; top: 0; bottom: 0; width: 38px; display: grid; place-items: center; font: 600 1.05rem var(--display); background: rgba(14,14,14,.06); }
.stall-tile__who { font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.stall-tile__sub, .stall-tile__tags { font-size: .84rem; color: var(--dust); line-height: 1.25; }
.stall-tile__tags { font-weight: 600; color: var(--ink); }
.stall-tile__warn { font-size: .82rem; font-weight: 600; color: var(--red-deep); line-height: 1.25; }
.stall-tile:disabled { cursor: default; }

/* The same colors on tiles, the calendar and the legend */
.is-free { background: #EEF6F0; }
.stall-tile.is-free .stall-tile__who { color: #1f6b3a; }
.is-monthly, .is-horse { background: var(--sand); }
.is-nightly { background: #F6D9D6; }
.is-ours { background: repeating-linear-gradient(135deg, #E9E6E1 0 6px, #F5F3EF 6px 12px); }
.is-off { background: repeating-linear-gradient(135deg, #CFCAC2 0 4px, #E2DED7 4px 8px); color: var(--dust); }

/* Two weeks, stall by stall */
.cal-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); }
.cal-table { border-collapse: collapse; font-size: .85rem; min-width: 100%; }
.cal-table th, .cal-table td { border: 1px solid rgba(14,14,14,.08); }
.cal-table thead th { padding: 6px 4px; font-weight: 600; text-align: center; white-space: nowrap; background: var(--paper); min-width: 58px; }
.cal-table thead th small { display: block; font-weight: 500; color: var(--dust); }
.cal-table thead th.is-today { background: var(--ink); color: var(--on-ink); }
.cal-table thead th.is-today small { color: rgba(246,240,229,.72); }
.cal-table tbody th { position: sticky; left: 0; z-index: 1; background: var(--paper); text-align: left; padding: 6px 10px; white-space: nowrap; font-weight: 600; }
.cal-table tbody th small { color: var(--dust); font-weight: 500; }
.cal { height: 34px; padding: 0 4px; cursor: pointer; max-width: 58px; overflow: hidden; white-space: nowrap; }
.cal span { font-size: .78rem; font-weight: 600; }
.cal.is-start:not(.is-free):not(.is-off) { border-left: 3px solid var(--ink); }
.cal.is-move { box-shadow: inset 0 -3px 0 var(--red); }
.cal.is-off { cursor: default; }
.cal:hover:not(.is-off) { outline: 2px solid var(--ink); outline-offset: -2px; }

/* Stall assistant */
.board-ai { border-top: 4px solid var(--red); }
.ai-log { display: grid; gap: 10px; max-height: 360px; overflow-y: auto; margin: 6px 0 14px; padding: 4px 2px; }
.ai-msg { max-width: 88%; padding: 10px 14px; }
.ai-msg p { margin: 0; }
.ai-msg .btn-row { margin-top: 8px; gap: 10px; align-items: center; }
.ai-msg--user { justify-self: end; background: var(--ink); color: var(--on-ink); }
.ai-msg--assistant { justify-self: start; background: var(--sand-soft); border: 1px solid var(--line); }
.ai-form { display: flex; gap: 10px; align-items: stretch; }
.ai-form textarea { flex: 1; font: inherit; border: 1px solid var(--line); padding: 10px 12px; resize: vertical; min-height: 54px; background: var(--paper); color: var(--ink); }
.ai-form textarea:focus { outline: 3px solid var(--red); outline-offset: 0; }
@media (max-width: 560px) { .ai-form { flex-direction: column; } }

/* Find stalls */
.board-find summary { cursor: pointer; list-style: none; }
.board-find summary::-webkit-details-marker { display: none; }
.board-find summary h2 { display: inline; }
.board-find summary::after { content: "+"; float: right; font: 600 1.4rem/1 var(--text); }
.board-find[open] summary::after { content: "\2212"; }
.find-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) auto; gap: 12px; align-items: end; margin-top: 14px; }
.find-grid .form-actions { margin: 0; }
@media (max-width: 900px) { .find-grid { grid-template-columns: 1fr 1fr; } }
.find-opt .card__top h3 { font-size: 1.05rem; }

/* Stall details and the add / edit form */
/* Kept clear of the phone's status bar and home bar (dvh = the screen actually visible), so the X is always reachable */
.board-dlg {
  border: 0; padding: 0; width: min(640px, calc(100vw - 24px)); background: var(--sand-soft); color: var(--ink); overflow-y: auto; overscroll-behavior: contain;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  margin-top: max(12px, env(safe-area-inset-top, 0px));
}
.board-dlg::backdrop { background: rgba(14,14,14,.55); }
.board-dlg__body { position: relative; padding: 0 22px 22px; }
.board-dlg__body h2 { font-size: 1.45rem; padding-right: 40px; margin-top: -26px; }
/* The close button stays on top while the content scrolls under it */
.board-dlg__bar { position: sticky; top: 0; z-index: 3; display: flex; justify-content: flex-end; padding: 6px 6px 0; pointer-events: none; }
.board-dlg__x { pointer-events: auto; width: 46px; height: 46px; border: 0; background: var(--sand-soft); border-radius: 50%; font-size: 1.9rem; line-height: 1; cursor: pointer; color: var(--ink); }
.phone-rows { display: grid; gap: 8px; }
.phone-row { display: flex; gap: 8px; }
.phone-row input { flex: 1 1 0; width: auto; min-width: 0; font: inherit; font-size: 1.05rem; border: 1px solid rgba(14, 14, 14, .35); padding: 12px 14px; min-height: 50px; background: var(--paper); color: var(--ink); }
.phone-row [data-del-phone] { flex: 0 0 50px; width: 50px; min-width: 0; padding: 0; font-size: 1.3rem; }
.horse-rows > [data-add-row], .field > [data-add-phone] { align-self: flex-start; justify-self: start; }
.board-dlg .card { margin-top: 12px; }
.board-dlg .field textarea { min-height: 70px; }
.horse-rows { display: grid; gap: 6px; }
.field-label { font-weight: 600; font-size: 1rem; }
.horse-row [data-del-row] { min-width: 42px; padding: 0; font-size: 1.3rem; }
@media (max-width: 600px) { .barn { grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr); } .barn__aisle--head, .barn__aisle--foot { font-size: 0; } .stall-tile { padding-left: 40px; } .stall-tile__num { width: 32px; } }
.horse-row { display: grid; grid-template-columns: 140px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.horse-row select, .horse-row input[name="horse"] { font: inherit; border: 1px solid var(--line); padding: 9px 10px; background: var(--paper); color: var(--ink); min-width: 0; }
.horse-row .choice { align-items: center; }
.horse-row .choice input { margin-top: 0; }
@media (max-width: 520px) { .horse-row { grid-template-columns: 1fr auto auto; } .horse-row select { grid-column: 1 / -1; } }
.seg { display: flex; flex-wrap: wrap; gap: 18px; }
.stay-card.is-ours { border-left: 4px solid #9b958c; }
.stay-card.is-monthly { border-left: 4px solid #C9AE7C; }
.stay-card.is-nightly { border-left: 4px solid var(--red); }
/* Schedule: a row per day, an AM and a PM cell with the names in it */
.sched-grid { display: grid; grid-template-columns: minmax(78px, 130px) 1fr 1fr; gap: 6px; }
.sched-h { font: 600 .85rem var(--text); letter-spacing: .08em; color: var(--dust); padding: 0 4px; }
.sched-day { display: flex; flex-direction: column; justify-content: center; padding: 6px 4px; font-size: .95rem; }
.sched-day small { color: var(--dust); font-size: .78rem; }
.sched-day.is-today strong { color: var(--red); }
.sched-slot { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; min-height: 52px; padding: 6px; background: var(--sand-soft, #F3EDE2); border: 1px dashed transparent; }
.sched-slot.is-past { opacity: .55; }
.sched-slot.is-target { border-color: var(--red); background: #FBE9E9; }
.sched-palette { background: none; padding: 0; min-height: 0; }
.sched-empty { color: var(--dust); font-size: .88rem; align-self: center; }
.sched-chip { display: inline-flex; align-items: center; gap: 4px; font: 600 .92rem var(--text); background: var(--paper); border: 1px solid var(--line); padding: 6px 10px; color: var(--ink);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.sched-chip.is-me { border-color: var(--ink); box-shadow: inset 3px 0 0 var(--red); }
.sched-chip[role="button"] { cursor: pointer; }
.sched-chip.is-lifted { opacity: .35; }
.sched-chip.is-target { outline: 3px solid var(--red); outline-offset: -1px; }
.sched-x { border: 0; background: none; font-size: 1.1rem; line-height: 1; padding: 0 0 0 4px; color: var(--dust); cursor: pointer; }
.sched-requests ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.sched-requests li { border-left: 4px solid var(--red); padding: 4px 0 4px 12px; }
.sched-requests li p { margin: 0 0 6px; }
.sched-requests .btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sched-dialog { border: 0; padding: 22px 20px 20px; width: min(440px, calc(100vw - 32px)); background: var(--paper); border-top: 6px solid var(--red); }
.sched-dialog::backdrop { background: rgba(14,14,14,.45); }
.sched-dialog h2 { font-size: 1.3rem; margin: 0 28px 4px 0; }
.sched-dialog__x { position: absolute; top: 8px; right: 8px; margin: 0; }
.sched-dialog__x button { border: 0; background: none; font-size: 1.6rem; cursor: pointer; color: var(--ink); }
.sched-dialog .field input { width: 100%; }
@media (max-width: 520px) { .sched-grid { grid-template-columns: 70px 1fr 1fr; gap: 4px; } .sched-chip { font-size: .85rem; padding: 5px 7px; } }
