/* Calendar: agenda, day, week, month. Hairline grid, tabular times, green = booked/confirmed, red = no-show, gray = done. */
.cal { padding-top: 22px; padding-bottom: 28px; }
.cal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.cal-title { font-size: 28px; line-height: 1.1; letter-spacing: -0.025em; }
.cal-sub { color: var(--gray); font-weight: 800; }
.cal-nav { display: flex; align-items: center; gap: 2px; flex: none; }
.cal-nav .icon-btn { width: 40px; height: 40px; }
.today-btn { flex: none; margin-top: 2px; }
.cal-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 16px 0 16px; }
.cal-seg { flex: 1; width: auto; }
@media (max-width: 899px) { .cal-title { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; align-self: center; } }
.cal-comma { color: var(--gray); }
@media (min-width: 900px) {
  .cal-title { font-size: 28px; }
  .cal-head { align-items: center; }
  .cal-seg { flex: none; display: inline-flex; }
}
.cal-body.in-next { animation: calNext 180ms var(--ease); }
.cal-body.in-prev { animation: calPrev 180ms var(--ease); }
@keyframes calNext { from { opacity: 0; transform: translateX(14px); } }
@keyframes calPrev { from { opacity: 0; transform: translateX(-14px); } }
.cal-empty { padding: 12px 2px 16px; color: var(--gray); }
.cal-loading { display: grid; gap: 8px; }

/* Cal status chips */
.cs { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 999px; font: 600 12px/1 var(--body); white-space: nowrap; flex: none; }
.cs-booked { background: var(--green); color: var(--black); }
.cs-confirmed { background: var(--green); color: var(--black); }
.cs-done { background: var(--soft); color: var(--gray); }
.cs-noshow { background: var(--red-bg); color: var(--red); }

/* Week strip */
.strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 18px; }
.strip-day { display: grid; justify-items: center; gap: 4px; padding: 8px 0 7px; border: 0; border-radius: 14px; background: transparent; transition: background-color 150ms var(--ease); }
.strip-day:active { transform: scale(.97); }
.sd-w { font: 500 12px var(--body); color: var(--gray); }
.sd-n { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 999px; font: 700 16px var(--body); font-variant-numeric: tabular-nums; }
.sd-dot { width: 5px; height: 5px; border-radius: 999px; background: transparent; }
.sd-dot.on { background: var(--black); }
.strip-day.today .sd-n { background: var(--black); color: var(--off); }
.strip-day.sel { background: var(--soft); }

/* Agenda */
.agenda { display: grid; gap: 22px; }
.ag-head { display: flex; align-items: baseline; justify-content: space-between; font-size: 20px; margin-bottom: 10px; }
.ag-date { font: 500 12px var(--body); color: var(--gray); }
.ag-day.before .ag-head { color: var(--gray); }
.ag-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ag { display: grid; grid-template-columns: 62px 1fr; gap: 12px; padding: 14px 14px 14px 12px; background: var(--card); border-radius: 14px; box-shadow: 0 0 0 1px var(--line-l); cursor: pointer; transition: transform 150ms var(--ease); }
.ag:active { transform: scale(.985); }
.ag.past { background: #FAFAF7; }
.ag.past .ag-name, .ag.past .ag-hm { color: var(--gray); }
.ag-time { display: grid; align-content: start; justify-items: end; padding-top: 1px; }
.ag-hm { font: 800 20px/1 var(--head); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ag-ap { font: 500 12px var(--mono); color: var(--gray); margin-top: 4px; }
.ag-main { min-width: 0; display: grid; gap: 3px; }
.ag-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ag-name { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-job { color: var(--gray); font-size: 14px; }
.ag-addr { display: flex; align-items: center; gap: 5px; color: var(--gray); font-size: 14px; }
.ag-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ag-empty { color: var(--gray); font-size: 14px; padding: 2px 2px 0; }

/* Time grid */
.tg { --gut: 46px; background: var(--card); border-radius: 14px; box-shadow: 0 0 0 1px var(--line-l); overflow: hidden; }
.tg > .cal-empty { padding: 14px 16px 0; }
.tg-head { display: grid; grid-template-columns: var(--gut) repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line-l); }
.tg-dh { display: grid; justify-items: center; gap: 3px; padding: 10px 0; border: 0; background: transparent; }
.tg-w { font: 500 12px var(--body); color: var(--gray); }
.tg-n { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 999px; font: 700 16px var(--body); font-variant-numeric: tabular-nums; }
.tg-dh.today .tg-n { background: var(--black); color: var(--off); }
.tg-body { display: grid; grid-template-columns: var(--gut) 1fr; padding: 12px 0 14px; }
.tg-gutter { display: grid; align-content: start; }
.tg-hr { position: relative; font: 500 12px var(--mono); color: var(--gray); text-align: right; padding-right: 8px; transform: translateY(-7px); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tg-cols { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.tg-col { position: relative; border-left: 1px solid var(--line-l); background-image: linear-gradient(to bottom, var(--line-l) 1px, transparent 1px); }
.tg-col.today { background-color: #FAFAF6; }
.tg-day .tg-col { border-left: 0; margin-right: 12px; }
.blk { position: absolute; display: grid; align-content: start; gap: 1px; padding: 5px 6px 5px 9px; border: 0; border-radius: 8px; background: var(--card); box-shadow: 0 0 0 1px var(--line-l), 0 1px 2px rgba(11, 11, 12, .05); text-align: left; overflow: hidden; cursor: pointer; transition: transform 150ms var(--ease), box-shadow 150ms var(--ease); }
.blk::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--green); }
.blk:hover { box-shadow: 0 0 0 1px #CFCFC8, 0 4px 12px rgba(11, 11, 12, .08); z-index: 2; }
.blk.b-done { background: #F4F4F0; }
.blk.b-done::before { background: var(--gray-d); }
.blk.b-done .blk-name { color: var(--gray); }
.blk.b-noshow::before { background: var(--red); }
.blk-name { padding-bottom: .12em; font-weight: 700; font-size: 14px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blk-job { padding-bottom: .12em; font-size: 12px; line-height: 1.3; color: var(--gray); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blk-time { font: 500 12px var(--mono); color: var(--gray); font-variant-numeric: tabular-nums; }
.blk.compact { padding: 3px 4px 3px 7px; }
.blk.compact .blk-name { font-size: 12px; }
.now { position: absolute; left: -1px; right: 0; height: 2px; background: var(--black); z-index: 1; pointer-events: none; }
.blk { z-index: 2; }
.now::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 999px; background: var(--black); }
.tg-week .tg-col.before { background-color: #FBFBF8; }
@media (max-width: 899px) { .tg { --gut: 40px; } .tg-week .blk { padding: 3px 3px 3px 6px; } .tg-hr { font-size: 12px; padding-right: 6px; } }

/* Month */
.month { background: var(--card); border-radius: 14px; box-shadow: 0 0 0 1px var(--line-l); overflow: hidden; }
.mw { display: grid; grid-template-columns: repeat(7, 1fr); padding: 10px 0 8px; border-bottom: 1px solid var(--line-l); }
.mw span { text-align: center; font: 500 12px var(--body); color: var(--gray); }
.mg { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line-l); }
.mc { display: grid; align-content: start; justify-items: center; gap: 4px; min-height: 58px; padding: 7px 2px; border: 0; background: var(--card); transition: background-color 150ms var(--ease); }
.mc:hover { background: #F8F8F4; }
.mc.out { background: #FAFAF7; }
.mc.out .mc-n { color: #B9BCBF; }
.mc.before:not(.today) .mc-n { color: var(--gray); }
.mc-n { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 999px; font: 600 14px var(--body); font-variant-numeric: tabular-nums; }
.mc.today .mc-n { background: var(--black); color: var(--off); font-weight: 700; }
.mc-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--green); color: var(--black); font: 600 12px/20px var(--body); }
.month > .cal-empty { padding: 14px 16px; }
@media (min-width: 900px) {
  .mc { min-height: 112px; justify-items: stretch; padding: 8px; }
  .mc-n { justify-self: start; }
  .mc-evs { display: grid; gap: 3px; min-width: 0; }
  .mc-ev { position: relative; display: block; padding: 3px 6px 3px 9px; border-radius: 8px; background: var(--off); font-size: 12px; font-weight: 600; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mc-ev::before { content: ''; position: absolute; left: 0; top: 3px; bottom: 3px; width: 3px; border-radius: 999px; background: var(--green); }
  .mc-ev.b-done::before { background: var(--gray-d); }
  .mc-ev.b-noshow::before { background: var(--red); }
  .mc-t { font: 500 12px var(--mono); color: var(--gray); }
  .mc-more { font: 500 12px var(--body); color: var(--gray); padding-left: 9px; text-align: left; }
}
.ag-list, .agenda { grid-template-columns: minmax(0, 1fr); }

/* Summary strip: the period in view */
.sum { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin-top: 18px; background: var(--line-l); border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 1px var(--line-l); }
@media (min-width: 900px) { .sum { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 20px; } }
.sum-cell { display: grid; gap: 8px; align-content: start; padding: 14px 16px 16px; background: var(--card); border: 0; text-align: left; min-width: 0; }
button.sum-cell { cursor: pointer; transition: background-color 150ms var(--ease); }
button.sum-cell:hover { background: #F8F8F4; }
button.sum-cell:active { transform: none; background: var(--soft); }
.sum-label { font: 500 12px var(--body); color: var(--gray); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.sum-cell .sum-label::after { content: ' ›'; }
.sum-num { font: 800 28px/1.05 var(--head); letter-spacing: -0.025em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 27px; }
.sum-cell.money .sum-num { color: var(--deep); }
.sum-cell.none .sum-num { font: 600 14px/27px var(--body); color: var(--gray); letter-spacing: 0; }
.sum-skel { display: block; width: 60%; height: 22px; }
@media (min-width: 900px) { .sum-num { font-size: 28px; min-height: 34px; } .sum-cell { padding: 18px 20px 20px; } }

/* Job value field */
.val { margin-top: 10px; }
.val-field { display: inline-flex; align-items: center; gap: 4px; height: 40px; width: 168px; padding: 0 12px; border-radius: 14px; background: var(--off); box-shadow: inset 0 0 0 1.5px var(--line-l); cursor: text; transition: box-shadow 150ms var(--ease); }
.val-field:focus-within { box-shadow: inset 0 0 0 1.5px var(--gray); background: #fff; }
.val-cur { font: 600 14px var(--mono); color: var(--gray); }
.val-input { width: 100%; min-width: 0; border: 0; background: transparent; font: 800 20px var(--head); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; color: var(--black); }
.val-input::placeholder { font: 500 14px var(--body); color: var(--gray); letter-spacing: 0; }
.val-input:focus { outline: none; }
.val.has .val-cur { color: var(--deep); }
.val.has .val-input { color: var(--deep); }
.val-chips { display: none; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.val:focus-within .val-chips { display: flex; }
.val-chip { height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--soft); font: 600 14px var(--mono); font-variant-numeric: tabular-nums; transition: transform 150ms var(--ease), background-color 150ms var(--ease); }
.val-chip:active { transform: scale(.97); background: #E2E2DC; }
.blk-val { color: var(--deep); font-weight: 600; }
.blk.compact .blk-val { font: 600 12px var(--body); }

/* Event sheet + jobs list */
.ev-panel { display: grid; gap: 4px; }
@media (min-width: 768px) { .ev-panel { left: 50%; top: 18%; width: 400px; transform: translateX(-50%); padding: 20px; transform-origin: top center; } }
.ev-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ev-head h2 { font-size: 20px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-when { font-size: 12px; color: var(--gray); margin-top: 2px; }
.ev-what { color: var(--gray); }
.ev-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.ev-open { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 50px; margin-top: 12px; padding: 0 2px; border: 0; border-top: 1px solid var(--line-l); background: none; font-weight: 600; }
.ev-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.dark-q { color: var(--gray); background: var(--soft); }
.sum-total { font: 800 20px var(--head); color: var(--deep); font-variant-numeric: tabular-nums; }
.jobs { list-style: none; margin: 10px 0 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.job { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 2px; border-top: 1px solid var(--line-l); cursor: pointer; }
.job-main { display: grid; min-width: 0; }
.job-main span { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-val { font: 800 16px var(--head); color: var(--deep); font-variant-numeric: tabular-nums; flex: none; }
.job-val.none { font: 500 12px var(--mono); color: var(--gray); }

/* Undo toast */
.toast { display: flex; align-items: center; gap: 16px; }
.toast.has-act { pointer-events: auto; }
.toast-act { border: 0; background: none; padding: 4px 0; color: var(--off); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* Agenda footer: value field and actions share one line; chips take their own line while typing */
.ag-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.ag-foot .val { margin-top: 0; }
.ag-foot .val:focus-within { flex-basis: 100%; }
.ag-foot .ag-acts { margin-top: 0; }
.ag-foot .val-field { width: 132px; height: 34px; border-radius: 14px; }
.ag-foot .val-input { font-size: 14px; }
.ag-foot .val-input::placeholder { font-size: 14px; }
@media (max-width: 899px) {
  .sum-cell { padding: 12px 14px 13px; gap: 6px; }
  .sum-num { font-size: 20px; min-height: 24px; }
  .sum-cell.none .sum-num { line-height: 24px; }
}

/* A toast never covers an open bottom sheet */
@media (max-width: 767px) { body:has(.picker:not([hidden])) .toast { bottom: auto; top: calc(12px + env(safe-area-inset-top, 0px)); } }

.sum.one { grid-template-columns: 1fr; }
.sum.one .sum-cell { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

/* In sheets the quick amounts stay visible, so buttons below never jump when the field loses focus. */
.ev-panel .val-chips { display: flex; }
.blk-name, .blk-job { line-height: 1.4; padding-bottom: .15em; }
.blk { display: flex; flex-direction: column; justify-content: flex-start; }
.blk > span { flex: none; }

/* Green only for money made (Won). A quote is not money yet. */
.blk-val.quote, .ag-val.quote { color: var(--gray); }
