/* Create and the composer (docs/CONSOLE-REDESIGN.md §5, step 8; console/quick-entry.js). The Create split button's
   arrow, its menu (a popover beside the sidebar; a bottom sheet on a phone), the Create panel (a floating panel on a
   desktop, full screen on a phone) and the line with chips. Theme tokens only: a chip's colour is its kind's --k-*
   (tokens.css), its tint 14 % and its edge 40 % of that on its ground, its words --text. Flat: hairlines, no boxed
   cards; the only shadows are the menu and the panel, which float. Loaded after frame.css. Classes cz-. */

/* ---------- Create: the split button's arrow, shown only when the sidebar is wide (the ＋ stays centred collapsed) ---------- */
.s-create .menu-btn { display: none; flex: none; width: 30px; height: 100%; padding: 0; border: 0; background: none; color: inherit; place-items: center;
  border-left: 1px solid color-mix(in srgb, var(--canopy-ink) 28%, transparent); }
.s-create .menu-btn svg { width: 16px; height: 16px; display: block; }
.s-create .menu-btn:hover, .s-create .main-btn:hover { background: color-mix(in srgb, var(--canopy-ink) 10%, transparent); }
.s-create .menu-btn:focus-visible { outline-offset: -3px; }
.shell[data-side="open"] .s-create .menu-btn, .rail:hover .s-create .menu-btn, .rail.peek .s-create .menu-btn { display: grid; }

/* ---------- the Create menu ---------- */
.cz-menuwrap { position: fixed; inset: 0; z-index: var(--z-menu); pointer-events: none; }
.cz-menuwrap > * { pointer-events: auto; }
.cz-menu { position: fixed; width: 300px; max-height: calc(100vh - 16px); overflow-y: auto; padding: 6px; border-radius: 10px;
  background: var(--pop-bg); color: var(--text); box-shadow: var(--elev-2); --cz-ground: var(--pop-bg); }
.cz-mi { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 6px 10px; border: 0; border-radius: 6px; background: none;
  color: var(--text); font: 14px/1.25 var(--sans); text-align: left; cursor: pointer; }
.cz-mi svg { width: 17px; height: 17px; flex: none; color: var(--text-2); }
.cz-mi > span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cz-mi:hover, .cz-mi:focus-visible { background: var(--raised); }
.cz-mi[aria-disabled="true"] { color: var(--text-3); cursor: not-allowed; }
.cz-mi.dim { color: var(--text-3); cursor: default; font-size: 13px; }
.cz-mi kbd, .cz kbd { font: 11px var(--mono); color: var(--text-3); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 5px; line-height: 17px; flex: none; }
.cz-msub { flex: none; font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.cz-mh { padding: 10px 10px 4px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.cz-msep { height: 1px; margin: 6px 4px; background: var(--line); }
.cz-mwhy { margin: 6px 10px 4px; font-size: 12px; color: var(--text-3); }
.cz-mgrab { width: 36px; height: 4px; border-radius: 2px; margin: 2px auto 8px; background: var(--line-2); }
.cz-msheet .cz-menu { left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 82vh; border-radius: 14px 14px 0 0; padding: 8px 8px calc(10px + env(safe-area-inset-bottom)); }
.cz-msheet .cz-mi { min-height: 44px; font-size: 15px; }
.cz-msheet .cz-mi kbd { display: none; }

/* ---------- the Create panel ---------- */
.cz-dialog { position: fixed; inset: 0; z-index: var(--z-dialog); display: flex; justify-content: center; align-items: flex-start; }
.cz-scrim { position: fixed; inset: 0; background: var(--scrim); }
.cz-panel { position: relative; margin-top: 10vh; width: min(680px, calc(100vw - 32px)); max-height: 82vh; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 12px; background: var(--pop-bg); color: var(--text); box-shadow: var(--elev-3); }
.cz-host { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.cz [hidden], .cz-dialog [hidden] { display: none !important; }

/* ---------- the composer ---------- */
.cz { position: relative; display: flex; flex-direction: column; min-height: 0; --cz-ground: var(--content-bg); }
.cz-in-dialog { --cz-ground: var(--pop-bg); flex: 1; }
.cz-inline { max-width: 760px; }
.cz-top { display: flex; align-items: center; gap: 8px; padding: 8px 10px 0 12px; border-bottom: 1px solid var(--line); flex: none; }
.cz-tabs { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; flex: 1; }
.cz-tabs::-webkit-scrollbar { display: none; }
.cz-tab { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border: 0; border-bottom: 2px solid transparent; background: none;
  color: var(--text-2); font: 13.5px var(--sans); white-space: nowrap; cursor: pointer; }
.cz-tab svg { width: 15px; height: 15px; }
.cz-tab:hover { color: var(--text); }
.cz-tab.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.cz-x { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--text-2); flex: none; }
.cz-x svg { width: 16px; height: 16px; }
.cz-x:hover { background: var(--raised); color: var(--text); }
.cz-body { padding: 12px 18px 6px; overflow-y: auto; min-height: 0; flex: 1; }
.cz-inline .cz-body { padding: 0; overflow: visible; }

/* the line: one row of words and chips */
.cz-line { min-height: 28px; padding: 6px 0 8px; border-bottom: 1px solid var(--line-2); outline: 0; font: 16px/1.75 var(--sans); color: var(--text);
  white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; }
.cz-line:focus { border-bottom-color: var(--accent); }
.cz-line.cz-empty::before { content: attr(data-ph); color: var(--text-3); pointer-events: none; position: absolute; }
.cz-line[contenteditable="false"] { opacity: .6; cursor: not-allowed; }
.cz-line:focus-visible { outline: none !important; box-shadow: 0 2px 0 0 var(--focus); }

/* a chip: a button named by its kind, tinted by it, with × */
.cz-chip { display: inline-flex; align-items: center; vertical-align: baseline; margin: 0 1px; border-radius: 6px; line-height: 1.35; white-space: nowrap; max-width: 100%;
  background: color-mix(in srgb, var(--k) 14%, var(--cz-ground)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--k) 40%, var(--cz-ground)); user-select: none; }
.cz-chip-b { display: inline-flex; align-items: center; gap: 5px; padding: 1px 2px 1px 7px; border: 0; background: none; color: var(--text); font: 500 14px/1.35 var(--sans); cursor: default; min-width: 0; }
.cz-chip-b > span { overflow: hidden; text-overflow: ellipsis; }
.cz-chip-b svg { width: 14px; height: 14px; color: var(--k); flex: none; }
.cz-chip-x { border: 0; background: none; color: var(--text-3); padding: 0 7px 0 4px; font: 15px/1 var(--sans); cursor: pointer; align-self: stretch; border-radius: 0 6px 6px 0; }
.cz-chip-x:hover { color: var(--text); }
.cz-chip.ro .cz-chip-b { padding-right: 7px; }
.cz-chip.bad { --k: var(--bad); box-shadow: inset 0 0 0 1.5px var(--bad); }
.cz-chip.bad .cz-chip-b > span { text-decoration: line-through; text-decoration-color: var(--bad-2); }
.cz-chip.clash { box-shadow: inset 0 0 0 1.5px var(--warn); }

/* suggestions read from the words: dashed until taken */
.cz-sugs, .cz-free { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 0 0; }
.cz-sugs-h, .cz-free-h, .cz-tb-h { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-right: 2px; }
.cz-sug { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 6px; border: 1px dashed color-mix(in srgb, var(--k) 70%, var(--cz-ground));
  background: none; color: var(--text); font: 13px var(--sans); cursor: pointer; }
.cz-sug svg { width: 14px; height: 14px; color: var(--k); }
.cz-sug:hover, .cz-sug:focus-visible { background: color-mix(in srgb, var(--k) 14%, var(--cz-ground)); }
.cz-sug kbd { margin-left: 2px; }
.cz-freeb { border-style: solid; }

/* the picker under the line */
.cz-pick, .cz-tpls { margin-top: 6px; border-top: 1px solid var(--line); max-height: 300px; overflow-y: auto; }
.cz-ptabs { display: flex; gap: 2px; padding: 6px 0 4px; flex-wrap: wrap; }
.cz-ptab { height: 26px; padding: 0 9px; border: 0; border-radius: 6px; background: none; color: var(--text-2); font: 12.5px var(--sans); cursor: pointer; }
.cz-ptab.on { background: var(--raised); color: var(--text); font-weight: 600; }
.cz-pi { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 4px 8px; border-bottom: 1px solid var(--line); cursor: pointer; }
.cz-pi:hover, .cz-pi.on { background: var(--raised); box-shadow: inset 2px 0 0 var(--accent); }
.cz-pi.off { cursor: not-allowed; }
.cz-pi.off .cz-pi-t { color: var(--text-3); }
.cz-pi-i { display: grid; place-items: center; width: 22px; flex: none; color: var(--k); }
.cz-pi-i svg { width: 16px; height: 16px; }
.cz-pi-t { flex: 1; min-width: 0; font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cz-pi-n, .cz-pi-h { display: block; overflow: hidden; text-overflow: ellipsis; }
.cz-pi-h { font-size: 12px; color: var(--text-3); }
.cz-ph { margin: 0; padding: 6px 8px; font-size: 12.5px; color: var(--text-2); border-bottom: 1px solid var(--line); }
/* A name several people have: dashed, asking to be picked (tt-fix-tour), never mistaken for a chip that names someone. */
.cz-chip.ask { box-shadow: none; outline: 1.5px dashed var(--warn); outline-offset: -1.5px; }
.cz-chip.ask .cz-chip-b { cursor: pointer; }
.cz-pi-s { flex: 0 1 auto; max-width: 55%; font-size: 12px; color: var(--text-3); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cz-newtpl .cz-pi-t { color: var(--accent-text); }
.cz-h { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding: 10px 0 2px; }
.cz-g { font-size: 11.5px; color: var(--text-3); padding: 8px 0 2px; }
.cz-none { margin: 0; padding: 10px 0; font-size: 13px; color: var(--text-3); }

/* tools under the line: scroll sideways on a phone */
.cz-tools { display: flex; gap: 4px; padding: 10px 0 0; overflow-x: auto; scrollbar-width: none; }
.cz-tools::-webkit-scrollbar { display: none; }
.cz-tool { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 9px; border: 0; border-radius: 6px; background: none; color: var(--text-2); font: 13px var(--sans); white-space: nowrap; cursor: pointer; flex: none; }
.cz-tool svg { width: 14px; height: 14px; color: var(--k); }
.cz-tool:hover:not([disabled]) { background: var(--raised); color: var(--text); }
.cz-tool[disabled] { opacity: .5; cursor: not-allowed; }
.cz-toolbox { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; padding: 10px 0 2px; border-top: 1px solid var(--line); margin-top: 8px; }
.cz-tb-f { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--text-2); }
.cz-tb-f input, .cz-tb-f select { font: 14px var(--sans); }

/* what Create will do, the Gate's answers on the line */
.cz-will { margin: 10px 0 0; font-size: 13px; color: var(--text-2); min-height: 18px; }
.cz-will b { color: var(--text); font-weight: 600; }
.cz-need { color: var(--warn); }
.cz-err { margin: 8px 0 0; padding-left: 8px; border-left: 2px solid var(--bad); font-size: 13px; color: var(--bad-2); }
.cz-why { margin: 8px 0 0; font-size: 12.5px; color: var(--text-3); }
.cz-clash { margin-top: 10px; padding: 2px 0 2px 10px; border-left: 2px solid var(--warn); font-size: 13.5px; }
.cz-clash p { margin: 0 0 4px; }
.cz-small { font-size: 12px; }
.cz-opts { margin-top: 10px; }

/* the call's terms (calls.js callOptions) */
.cz-call { border-top: 1px solid var(--line); }
.cz-call-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.cz-call-k { width: 110px; flex: none; color: var(--text-2); }
.cz-call-v { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; flex: 1; min-width: 0; }
.cz-call-opt { display: inline-flex; align-items: center; gap: 6px; }
.cz-call-opt.off { color: var(--text-3); }
.cz-res { display: inline-flex; align-items: center; gap: 2px; padding: 0 0 0 8px; border-radius: 6px; font-size: 13px; --k: var(--k-call);
  background: color-mix(in srgb, var(--k) 14%, var(--cz-ground)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--k) 40%, var(--cz-ground)); }
.cz-res-x { border: 0; background: none; color: var(--text-3); padding: 2px 7px; cursor: pointer; }
.cz-res-in { width: 140px; font-size: 13px; }
.cz-callnote { margin: 8px 0 0; }

/* a template's own form, in the panel (§5.3) */
.cz-tpl, .cz-tpl.qe-tpl { padding: 0; margin: 0; border: 0; }
.cz-inline .cz-tpl { margin-top: 10px; }
.cz-tplhead { display: flex; align-items: flex-start; gap: 10px; padding: 4px 0 10px; border-bottom: 1px solid var(--line); }
.cz-tplic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; flex: none; color: var(--k); background: color-mix(in srgb, var(--k) 14%, var(--cz-ground)); }
.cz-tplic svg { width: 18px; height: 18px; }
.cz-tplt { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 1px; }
.cz-tplt b { font-size: 15.5px; }
.cz-tplt .dim { font-size: 12.5px; }
.cz-tplhead .linkbtn { background: none; border: 0; color: var(--text-2); font-size: 13px; padding: 4px 0; cursor: pointer; white-space: nowrap; }
.cz-tplhead .linkbtn:hover { color: var(--text); text-decoration: underline; }
.cz-quote { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--text-2); line-height: 1.9; }
.cz-quote-h { color: var(--text-3); }
.cz-desc { margin: 8px 0 0; font-size: 13px; color: var(--text-2); }
.cz-bad { color: var(--bad-2); }
.cz-form .sf { margin-top: 2px; }

/* the foot: keys, Cancel, the one button that says what it does */
.cz-foot { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-top: 1px solid var(--line); flex: none; }
.cz-inline .cz-foot { padding: 10px 0 0; border-top: 0; }
.cz-keys { flex: 1; min-width: 0; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cz-go kbd { color: inherit; background: none; border-color: color-mix(in srgb, currentColor 45%, transparent); margin-left: 6px; }
.cz-busy { opacity: .7; pointer-events: none; }

/* ---------- the phone: the same composer, full screen; tools sideways; Create full width above the home indicator ---------- */
@media (max-width: 780px) {
  .cz-panel { margin: 0; width: 100vw; height: 100%; max-height: none; border-radius: 0; padding-top: env(safe-area-inset-top); }
  .cz-body { padding: 10px 16px 6px; }
  .cz-top { padding: 4px 6px 0 8px; }
  .cz-foot { flex-wrap: wrap; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .cz-keys, .cz-cancel { display: none; }
  .cz-foot .cz-go { flex: 1 1 100%; min-height: 44px; justify-content: center; }
  .cz-line { font-size: 16px; } /* 16px keeps iOS from zooming on focus */
  .cz.cz-sheet { position: fixed; inset: 0; z-index: var(--z-sheet); background: var(--content-bg); padding: 0 16px; overflow-y: auto; max-width: none; }
  .cz-call-k { width: 100%; }
  .cz-pi-s { max-width: 45%; }
}

/* tt-gap-tasks: an address chip with its WGS 84 point, and a template's clash under its form */
.cz-pt { font: 500 9.5px/1 var(--mono); letter-spacing: .02em; color: var(--k); border-left: 1px solid var(--line-2); padding-left: 5px; margin-left: 1px; }
.cz-tclash { margin-top: 12px; }
