/* view styles: calendar module (calendars.js, calendar.js) */
.cal-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-toolbar .range { font-weight: 650; font-size: 15px; min-width: 150px; }
.cal-toolbar .grow { flex: 1; }

/* week grid */
.wk { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; max-height: calc(100vh - 250px); min-height: 360px; }
.wk-inner { min-width: 760px; position: relative; }
.wk-head { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); position: sticky; top: 0; z-index: 4; background: var(--surface); border-bottom: 1px solid var(--border); }
.wk-head > div { padding: 8px 6px; text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; border-left: 1px solid var(--border); }
.wk-head > div:first-child { border-left: 0; }
.wk-head .num { display: block; font-size: 18px; color: var(--ink); font-weight: 650; line-height: 1.2; }
.wk-head .today .num { color: #fff; background: var(--accent); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto; }
.wk-body { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); }
.wk-hours > div { height: var(--hh, 48px); font-size: 11px; color: var(--faint); text-align: right; padding: 0 6px; transform: translateY(-7px); }
.wk-hours > div:first-child { transform: none; }
.wk-col { position: relative; border-left: 1px solid var(--border); background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hh, 48px) - 1px), var(--border) calc(var(--hh, 48px) - 1px), var(--border) var(--hh, 48px)); }
.wk-col.today { background-color: color-mix(in srgb, var(--accent) 4%, white); }
.wk-ev { position: absolute; border-radius: 6px; padding: 3px 6px; font-size: 12px; line-height: 1.25; overflow: hidden; cursor: pointer; border-left: 3px solid var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 16%, white); color: var(--ink); text-align: left; border-top: 0; border-right: 0; border-bottom: 0; font-family: inherit; }
.wk-ev:hover { background: color-mix(in srgb, var(--c, var(--accent)) 28%, white); z-index: 2; }
.wk-ev .t { font-weight: 650; display: block; }
.wk-ev .n { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-ev.confirmed { background: color-mix(in srgb, var(--c, var(--accent)) 30%, white); }
.wk-ev.completed { opacity: .65; }
.wk-ev.no_show { opacity: .65; background: var(--warn-soft); border-left-color: var(--warn); }
.wk-ev.cancelled { opacity: .5; text-decoration: line-through; background: var(--surface-2); border-left-color: var(--faint); }
.wk-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--bad); z-index: 3; pointer-events: none; }
.wk-now::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }

/* list view */
.ap-day { padding: 8px 16px; background: var(--surface-2); font-size: 12px; font-weight: 650; color: var(--muted); border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: .03em; }
.ap-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.ap-row:hover { background: var(--surface-2); }
.ap-row .bar { width: 4px; align-self: stretch; border-radius: 2px; background: var(--c, var(--accent)); flex: none; }
.ap-row .time { width: 108px; flex: none; font-variant-numeric: tabular-nums; font-weight: 600; }
.ap-row .who { flex: 1; min-width: 0; }

/* appointment modal */
.ap-status { display: flex; gap: 6px; flex-wrap: wrap; }
.ap-meta { display: grid; grid-template-columns: 90px 1fr; gap: 6px 10px; font-size: 13.5px; margin-bottom: 14px; }
.ap-meta dt { color: var(--muted); }
.ap-meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* typeahead */
.ta { position: relative; }
.ta-list { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin-top: 2px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-height: 220px; overflow-y: auto; }
.ta-list button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; font: inherit; cursor: pointer; }
.ta-list button:hover { background: var(--surface-2); }
.ta-picked { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 6px 10px; background: var(--accent-soft); }

/* calendar cards */
.cal-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.cal-card { border-top: 4px solid var(--c, var(--accent)); }
.cal-card .copy-row { display: flex; gap: 6px; }
.cal-card .copy-row .input { font-family: var(--mono); font-size: 12px; }
.cal-card textarea.input { height: 64px; padding: 6px 10px; font-family: var(--mono); font-size: 12px; resize: none; }

/* calendar settings */
.cs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.cs-grid .full { grid-column: 1 / -1; }
.cs-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.av-day { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: start; }
.av-day:last-child { border-bottom: 0; }
.av-ranges { display: flex; flex-direction: column; gap: 6px; }
.av-range { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.av-range .input { width: 118px; }
.av-off { color: var(--faint); padding-top: 6px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 4px 0 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; font-size: 12.5px; }
.chip button { border: 0; background: none; cursor: pointer; color: inherit; font-size: 15px; line-height: 1; padding: 0 4px; }
.q-row { display: grid; grid-template-columns: minmax(0, 1fr) 130px auto auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.cs-link { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.color-in { width: 44px; height: 34px; padding: 2px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }

@media (max-width: 720px) {
  .cs-grid, .cs-grid.three { grid-template-columns: 1fr; }
  .av-day { grid-template-columns: 1fr; }
  .q-row { grid-template-columns: 1fr 1fr; }
  .cal-cards { grid-template-columns: 1fr; }
  .ap-row .time { width: 84px; }
}
