/* CycleWright Calendar and contacts (round 21): an event, the invitation card, find a time (calevent.js). Light and
   dark through the app's variables; on a phone (up to 760 px) the dialog is full screen, inputs are 16 px and targets
   44 px. */

/* ------------------------------------------------------------------ the event dialog */
.modal-bg.center.cev-bg .modal.cev-modal { width: min(780px, 100%); }
.cev-bg.busy .modal { cursor: progress; }
.cev-modal .modal-head h2 { flex: 0 1 auto; }
.cev-modal .modal-head > button:last-child { margin-left: auto; }
.cev-calname { --c: #2563eb; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); margin-right: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cev-calname i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }
.cev-body { display: flex; flex-direction: column; gap: 14px; padding-top: 16px; }
.cev-err:empty { display: none; }
.cev-err .callout { margin: 0; }
.cev-orgline { display: flex; align-items: center; gap: 5px; }
.cev-title { width: 100%; height: 44px; font-size: 19px; font-weight: 600; border-color: transparent; background: var(--surface-2); }
.cev-title:hover { border-color: var(--border-2); }
.cev-sec { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; }
.cev-ic { color: var(--text-3); padding-top: 9px; display: flex; justify-content: center; }
.cev-secb { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cev-when { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cev-wpart { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cev-to { color: var(--text-3); font-size: 13px; }
.cev-when input[type=date] { min-width: 0; width: 150px; }
.cev-endday { color: var(--text-3); font-weight: 500; }
.cev-wopts { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.cev-repwrap { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); min-width: 0; }
.cev-repwrap select { max-width: 330px; color: var(--text); }
.cev-custom:empty, .cev-ends:empty, .cev-reptext:empty, .cev-roomnote:empty { display: none; }
.cev-custom { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.cev-crow { display: flex; align-items: center; gap: 8px; }
.cev-num { width: 74px; }
.cev-wdays { display: flex; gap: 4px; flex-wrap: wrap; }
.cev-wd { width: 38px; height: 34px; padding: 0; border-radius: 99px; font-size: 12.5px; box-shadow: none; }
.cev-wd.on, .cev-wd.on:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.cev-ends { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; font-size: 13px; }
.cev-endsl { color: var(--text-3); }
.cev-endopt { display: inline-flex; align-items: center; gap: 6px; }
.cev-endopt input[type=date] { width: 150px; min-width: 0; }
.cev-reptext { display: flex; align-items: center; gap: 5px; }
.cev-zone { display: flex; align-items: center; gap: 4px; }
.cev-zone[hidden] { display: none; }

/* the time boxes: typed or picked */
.cev-tbox { position: relative; display: inline-block; }
.cev-time { width: 112px; }
.cev-time.bad, .cev-bg select.bad { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.cev-tlist { position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; min-width: 160px; max-height: 240px; overflow-y: auto; padding: 4px;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 10px; box-shadow: var(--shadow); }
.cev-tlist[hidden] { display: none; }
.cev-titem { display: flex; justify-content: space-between; gap: 12px; padding: 6px 9px; border-radius: 7px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.cev-titem small { color: var(--text-3); }
.cev-titem.cur { background: var(--hover); }
.cev-titem.on { color: var(--accent); font-weight: 600; }

/* where */
.cev-where { display: grid; grid-template-columns: 1fr minmax(0, 280px); gap: 8px; }
.cev-where input, .cev-where select { width: 100%; }
.cev-roomnote { display: flex; align-items: center; gap: 5px; color: var(--ok); }
.cev-roomnote.bad { color: var(--bad); }
.cev-link { color: var(--accent); font-weight: 600; }

/* people */
.cev-ppl { display: flex; align-items: flex-start; gap: 8px; }
.cev-chips { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 6px; min-height: 40px;
  border: 1px solid var(--border-2); border-radius: 9px; background: var(--input-bg); cursor: text; }
.cev-chips:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.cev-pin { flex: 1; min-width: 180px; border: 0; background: transparent; height: 30px; padding: 0 4px; box-shadow: none !important; }
.cev-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; height: 28px; padding: 0 4px 0 9px; border-radius: 99px; background: var(--accent-soft); color: var(--text); font-size: 13px; }
.cev-chip.opt { background: var(--surface-3); }
.cev-chip-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cev-coll { display: inline-block; padding: 1px 6px; border-radius: 99px; font-size: 10.5px; font-weight: 600; color: var(--ok); background: var(--ok-soft); white-space: nowrap; }
.cev-role { height: 20px; padding: 0 6px; font-size: 10.5px; font-weight: 600; color: var(--text-3); background: transparent; border: 1px solid var(--border-2); border-radius: 99px; box-shadow: none; }
button.cev-role:hover { color: var(--text); }
.cev-chip-x { width: 20px; height: 20px; padding: 0; border: 0; border-radius: 99px; background: transparent; box-shadow: none; color: var(--text-3); }
.cev-chip-x:hover { background: var(--hover); color: var(--bad); }
.cev-ans { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 99px; font-size: 11px; font-weight: 700; flex: none; }
.cev-ans.a-ok { color: #fff; background: var(--ok); }
.cev-ans.a-warn { color: #fff; background: var(--warn); }
.cev-ans.a-bad { color: #fff; background: var(--bad); }
.cev-ans.a-none { color: var(--text-3); background: var(--surface-3); }
.cev-pbtns { display: flex; flex-direction: column; gap: 6px; flex: none; }
.cev-pbtns button.on { border-color: var(--accent); color: var(--accent); }
.cev-pbtns button[hidden] { display: none; }
.cev-mailwarn { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; color: var(--warn); }
.cev-mailwarn[hidden] { display: none; }

/* find a time */
.cev-find { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px 12px; background: var(--surface-2); }
.cev-find[hidden] { display: none; }
.cev-find-wait { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.cev-find-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 13.5px; }
.cev-legend { display: inline-flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-3); }
.cev-legend i { display: inline-block; width: 12px; height: 10px; border-radius: 3px; margin-left: 4px; }
.cev-grid2 { display: grid; grid-template-columns: minmax(90px, 160px) 1fr; }
.cev-names { display: flex; flex-direction: column; }
.cev-hours-pad { height: 20px; }
.cev-name { height: 30px; display: flex; align-items: center; gap: 6px; padding-right: 8px; font-size: 12.5px; min-width: 0; }
.cev-name-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cev-name small { white-space: nowrap; }
.cev-tracks { position: relative; cursor: pointer; min-width: 0; }
.cev-hours { position: relative; height: 20px; }
.cev-hours span { position: absolute; top: 2px; transform: translateX(-50%); font-size: 10.5px; color: var(--text-3); white-space: nowrap; }
.cev-hours span:first-child { transform: none; }
.cev-track { position: relative; height: 30px; border-top: 1px solid var(--border); background-image: linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: calc(100% / 9) 100%; }
.cev-track:last-child { border-bottom: 1px solid var(--border); }
.cev-track.unknown { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--track) 6px 12px); }
.cev-noinfo { position: absolute; left: 8px; top: 7px; font-size: 11.5px; color: var(--text-3); }
.cev-busy { position: absolute; top: 5px; bottom: 5px; border-radius: 4px; min-width: 3px; }
.s-busy { background: #3b82f6; }
.s-tentative { background: repeating-linear-gradient(135deg, #60a5fa 0 4px, rgba(96, 165, 250, .35) 4px 8px); }
.s-away { background: #a855f7; }
.s-free { background: transparent; border: 1px dashed var(--text-3); }
.cev-band { position: absolute; top: 20px; bottom: 0; border: 2px solid var(--accent); border-radius: 6px; background: var(--accent-soft); cursor: grab; touch-action: none; min-width: 6px; }
.cev-band.drag { cursor: grabbing; box-shadow: var(--shadow); }
.cev-band:focus-visible { outline: none; box-shadow: var(--ring); }
.cev-find-note { margin: 8px 0 0; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.cev-sugg { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cev-schip { height: 30px; padding: 0 11px; border-radius: 99px; font-size: 12.5px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.cev-schip:hover { background: var(--accent); color: #fff; }

/* more */
.cev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 14px; }
.cev-grid select, .cev-more label.f > input { width: 100%; }
.cev-private { display: inline-flex; align-items: center; gap: 6px; }
.cev-private small { font-weight: 400; }
.cev-notes { font-family: inherit; font-size: 13.5px; }
.cev-more { display: flex; flex-direction: column; gap: 10px; }

/* the foot and the buttons */
.cev-foot { padding: 0 24px; }
.cev-foot:has(> [hidden]:first-child + [hidden]) { display: none; }
.cev-notelink { margin: 8px 0 4px; }
.cev-notelink[hidden], .cev-note[hidden] { display: none; }
.cev-note textarea { font-family: inherit; font-size: 13.5px; min-height: 56px; margin: 8px 0; }
.cev-actions { flex-wrap: wrap; }
.cev-actions .spacer { flex: 1; }
.cev-sendinfo { max-width: 340px; display: flex; align-items: center; gap: 4px; line-height: 1.35; }
.cev-sendinfo:empty { display: none; }
.cev-quiet[hidden] { display: none; }
.cev-help { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-2); }
.cev-savednote { display: inline-flex; align-items: center; gap: 4px; color: var(--ok); }

/* small dialogs: series scope, answers, cancel */
.modal-bg.center.cev-small-bg .modal.cev-small { width: min(520px, 100%); }
.cev-scope { display: flex; flex-direction: column; gap: 8px; }
.cev-scope-b { height: auto; min-height: 52px; padding: 10px 14px; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; white-space: normal; }
.cev-scope-b span { font-weight: 400; font-size: 12.5px; color: var(--text-2); }
.cev-scope-q { margin-top: 0; }
.cev-small textarea { font-family: inherit; font-size: 13.5px; }
.cev-small label.f { margin-bottom: 10px; }
.cev-propose { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }

/* ------------------------------------------------------------------ the card of an event */
.cev-card { --c: #2563eb; position: fixed; z-index: 90; width: 380px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px; box-shadow: var(--shadow-lg); outline: none; animation: pop .16s ease; }
.cev-card-head { display: flex; align-items: flex-start; gap: 8px; padding: 14px 12px 6px 16px; }
.cev-card-dot { width: 12px; height: 12px; border-radius: 4px; background: var(--c); flex: none; margin-top: 5px; }
.cev-card-head h3 { flex: 1; margin: 0; font-size: 16px; line-height: 1.3; word-break: break-word; }
.cev-card-head h3.declined { text-decoration: line-through; color: var(--text-3); }
.cev-card-body { display: flex; flex-direction: column; gap: 10px; padding: 6px 16px 10px; }
.cev-cl { display: grid; grid-template-columns: 18px 1fr; gap: 10px; align-items: start; font-size: 13.5px; line-height: 1.4; }
.cev-cl > svg { color: var(--text-3); margin-top: 2px; }
.cev-bad { color: var(--bad); font-weight: 600; }
.cev-joinrow { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cev-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cev-plist { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.cev-plist li { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.cev-pn { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cev-pcomment { flex-basis: 100%; padding-left: 24px; }
.cev-prop { flex-basis: 100%; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 6px 8px; margin-left: 24px; border-radius: 8px; background: var(--warn-soft); }
.cev-desc { white-space: pre-wrap; word-break: break-word; max-height: 160px; overflow-y: auto; }
.cev-card-foot { display: flex; flex-direction: column; gap: 8px; padding: 10px 16px 14px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }
.cev-state { display: flex; align-items: center; gap: 5px; color: var(--warn); font-weight: 600; }
.cev-state.ok { color: var(--ok); }
.cev-card-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.cev-card-btns button.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.cev-myrem { display: flex; align-items: center; gap: 4px; color: var(--text-2); }
.cev-myrem select { height: 30px; font-size: 12.5px; }
.cev-card.sheet { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100%; max-width: none; max-height: 85vh; border-radius: 16px 16px 0 0;
  padding-bottom: env(safe-area-inset-bottom); }

/* ------------------------------------------------------------------ the invitation on an email */
.cev-inv { margin: 4px 0 14px; padding: 12px 14px; border: 1px solid var(--border-2); border-left: 4px solid var(--accent); border-radius: 10px; background: var(--surface-2);
  display: flex; flex-direction: column; gap: 6px; }
.cev-inv[data-method="cancel"] { border-left-color: var(--bad); }
.cev-inv[data-method="reply"], .cev-inv[data-method="counter"] { border-left-color: var(--ok); }
.cev-inv-wait { display: flex; align-items: center; gap: 6px; }
.cev-inv-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.cev-inv-ic { display: inline-flex; color: var(--accent); }
.cev-inv[data-method="cancel"] .cev-inv-ic { color: var(--bad); }
.cev-inv-mine { margin-left: auto; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 11.5px; }
.cev-inv-title { font-size: 16px; font-weight: 650; word-break: break-word; }
.cev-inv-title.struck { text-decoration: line-through; color: var(--text-3); }
.cev-inv-l { display: grid; grid-template-columns: 18px 1fr; gap: 8px; align-items: start; font-size: 13.5px; }
.cev-inv-l > svg { color: var(--text-3); margin-top: 2px; }
.cev-inv-conf { color: var(--warn); }
.cev-inv-conf > svg, .cev-inv-free > svg { color: inherit; }
.cev-inv-free { color: var(--ok); }
.cev-inv-comment { font-style: italic; }
.cev-inv-prop { padding: 6px 8px; border-radius: 8px; background: var(--warn-soft); }
.cev-inv-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.cev-inv-btns button.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ------------------------------------------------------------------ calendar settings */
.cset-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cset-head .spacer { flex: 1; }
.cset { display: flex; flex-direction: column; gap: 0; max-width: 980px; }
.cset-cal, .cset-room { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.cset-cal:first-of-type, .cset-room:first-of-type { border-top: 0; }
.cset-room.inactive { opacity: .7; }
.cset-sw { --c: #2563eb; width: 22px; height: 22px; min-width: 22px; padding: 0; border-radius: 6px; background: var(--c); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-2); }
.cset-sw:hover { background: var(--c); filter: brightness(1.1); }
.cset-sw.on { box-shadow: 0 0 0 2px var(--text); }
.cset-colours { position: fixed; z-index: 95; display: grid; grid-template-columns: repeat(4, 30px); gap: 8px; padding: 10px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 12px; box-shadow: var(--shadow); }
.cset-colours .cset-sw { width: 30px; height: 30px; }
.cset-calt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cset-calt b { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cset-def, .cset-inact { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.cset-inact { background: var(--surface-3); color: var(--text-3); }
.cset-trouble { color: var(--warn); display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.cset-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cset-room-ic { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: var(--surface-2); color: var(--text-2); flex: none; }
.cset-note { margin: 10px 0 0; display: flex; align-items: center; gap: 4px; }
.cset-h3 { font-size: 13.5px; margin: 14px 0 8px; display: flex; align-items: center; gap: 6px; }
.cset-see { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.cset-opt { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--border-2); border-radius: 12px; cursor: pointer; }
.cset-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.cset-opt > span { display: flex; flex-direction: column; gap: 3px; }
.cset-opt input { margin-top: 2px; }
.cset-form { margin-bottom: 0; }

/* ------------------------------------------------------------------ phone */
@media (max-width: 760px) {
  .modal-bg.center.cev-bg { padding: 0; }
  .modal-bg.center.cev-bg .modal.cev-modal { width: 100%; min-height: 100%; border-radius: 0; border: 0; }
  .modal-bg.center.cev-bg .modal.cev-modal { overflow: visible; }    /* the head and the buttons stick to the screen */
  .cev-bg .modal-head { position: sticky; top: 0; z-index: 3; background: var(--surface); }
  .cev-bg .actions { position: sticky; bottom: 0; z-index: 3; }
  .cev-body input, .cev-body select, .cev-body textarea, .cev-small input, .cev-small select, .cev-small textarea,
  .cev-card select, .cev-foot textarea, .cset input, .cset select { font-size: 16px; }
  .cev-body input:not([type=checkbox]):not([type=radio]), .cev-body select, .cev-small input:not([type=checkbox]):not([type=radio]), .cev-small select { min-height: 44px; }
  .cev-title { font-size: 18px; }
  .cev-when { flex-direction: column; align-items: stretch; }
  .cev-wpart { display: grid; grid-template-columns: 1fr 1fr; }
  .cev-when input[type=date], .cev-time { width: 100%; }
  .cev-tbox { display: block; }
  .cev-to { display: none; }
  .cev-where { grid-template-columns: 1fr; }
  .cev-ppl { flex-direction: column; align-items: stretch; }
  .cev-pbtns { flex-direction: row; }
  .cev-pbtns button { flex: 1; }
  .cev-pin { min-width: 120px; }
  .cev-grid2 { grid-template-columns: 84px 1fr; }
  .cev-name { height: 34px; font-size: 12px; }
  .cev-track { height: 34px; }
  .cev-coll { display: none; }
  .cev-chip .cev-coll { display: inline-block; }
  .cev-legend { display: none; }
  .cev-actions { gap: 8px; }
  .cev-actions .spacer, .cev-help, .cev-sendinfo { display: none; }
  .cev-actions button { min-height: 44px; }
  .cev-actions .cev-main { flex: 1 1 100%; order: -1; height: 48px; font-size: 15px; }
  .cev-actions .cev-quiet, .cev-actions > button:not(.cev-main):not(.cev-del) { flex: 1; }
  .cev-foot { padding: 0 16px; }
  .cev-wd { width: 44px; height: 44px; }
  .cev-endopt { min-height: 44px; }
  .cev-card button, .cev-card .btn, .cev-inv button, .cev-inv .btn, .cset-acts button, .cset-acts .btn, .cset-card .ch-actions button, .cset .card-save button, .cev-schip { min-height: 44px; }
  .cev-chip .cev-role { min-height: 0 !important; height: 22px; }
  .cev-chip .cev-chip-x { min-height: 0 !important; width: 28px; height: 28px; }
  .cev-hours span.odd { display: none; }
  .cset .cset-sw { min-height: 0; }
  .cev-card .cev-card-head button { min-height: 0; width: 40px; height: 40px; }
  .cev-scope-b { min-height: 56px; }
  .cset-cal, .cset-room { flex-wrap: wrap; }
  .cset-acts { width: 100%; justify-content: flex-start; }
  .cset-sw { width: 32px; height: 32px; min-width: 32px; }
}

/* round 21 invites: cancelled copies, .ics */
.cev-struck { text-decoration: line-through; color: var(--text-3); }
.cev-state.bad { color: var(--bad); }
.cev-ics { color: var(--accent); }

/* round 21 fixes: an invitation's people without others' answers; waiting for new answers */
.cev-ans.a-blank { background: transparent; }
.cev-waiting { font-weight: 400; }
