/* Ticket creation uses the available workspace, with a stacked mobile layout. */
main:has(#ticket-form) .topbar{padding-bottom:12px;margin-bottom:18px}
.ticket-create-card{width:100%;max-width:none;padding:18px;margin-bottom:0}
.ticket-create-layout{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);gap:24px;align-items:start}
.ticket-create-main,.ticket-create-properties{display:flex;flex-direction:column;gap:10px;min-width:0}
.ticket-create-properties{gap:8px;padding-left:24px;border-left:1px solid var(--border-soft)}
.ticket-create-main .request-field-description{display:flex;flex-direction:column}
.request-field label,.request-create-files>.field-label-text{display:block;margin-bottom:8px}
.ticket-create-card .request-field label,.ticket-create-card .request-create-files>.field-label-text{margin-bottom:4px}
.ticket-create-card .request-create-files>.field-label-text{font-size:12px;font-weight:600}
.ticket-create-card .request-field small,.ticket-create-card .request-create-files>small{margin:4px 0 0;font-size:10px;line-height:1.4}
.ticket-create-card .request-create-files{margin:0}.ticket-create-card .request-create-files .file-drop{min-height:56px;padding:8px 12px;margin:0;gap:2px 10px}
.ticket-create-card .form-actions{justify-content:flex-end;padding-top:10px;border-top:1px solid var(--border-soft);margin-top:12px;background:var(--surface);position:sticky;bottom:0;z-index:2}
.ticket-create-card .request-field input:not([type=hidden]):not([type=radio]):not([type=checkbox]),.ticket-create-card .ui-select-trigger{width:100%;height:38px;min-height:38px;padding:7px 12px}
.ticket-create-card .deadline-clear{height:38px;min-height:38px}
.ticket-create-card .selected-files{max-height:100px;overflow:auto}
.ticket-create-card .file-drop{align-content:center}.ticket-create-card .file-drop>.icon{grid-column:1;grid-row:1/3}.ticket-create-card .file-drop>strong{grid-row:1}.ticket-create-card .file-drop>span{grid-row:2}
.inline-editor{min-width:0;border:1px solid var(--border);border-radius:11px;overflow:hidden;background:var(--input)}
.inline-editor:focus-within{border-color:var(--accent-edge);box-shadow:0 0 0 3px var(--accent-soft)}
.inline-editor-toolbar{display:flex;gap:12px;align-items:center;flex-wrap:wrap;padding:10px 12px;background:var(--surface-raised);border-bottom:1px solid var(--border-soft)}
.inline-editor-toolbar button{min-height:34px;padding:6px 10px;font-size:11px}.inline-editor-toolbar small{margin:0;font-size:10px;flex:1 1 160px}
.inline-editor-surface{padding:14px;min-height:125px;max-height:650px;overflow:auto;outline:none;white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;line-height:1.65;color:var(--text);cursor:text}
.ticket-create-main .inline-editor-toolbar{padding:6px 10px;gap:8px}
.ticket-create-main .inline-editor-surface{min-height:clamp(160px,24dvh,260px);height:auto;max-height:none;padding:12px}
.inline-editor-surface.is-empty:before{content:attr(data-placeholder);color:var(--muted);pointer-events:none}
.inline-editor-image{display:block;position:relative;width:fit-content;max-width:100%;margin:10px 0;padding:5px;border:1px solid var(--border);border-radius:9px;background:var(--surface)}
.inline-editor-image img{display:block;max-width:100%;max-height:320px;object-fit:contain;border-radius:5px}
.inline-editor-image button{position:absolute;top:7px;right:7px;min-height:30px;width:30px;padding:0;border:1px solid var(--border);background:var(--surface);color:var(--text)}
.inline-editor>.file-error{padding:0 12px}.inline-editor-surface.is-drop-target{box-shadow:inset 0 0 0 2px var(--accent)}
.inline-image{display:block;width:fit-content;max-width:100%;margin:12px 0;border:1px solid var(--border);border-radius:9px;overflow:hidden;background:var(--surface-raised)}
.inline-image img{display:block;max-width:100%;max-height:360px;object-fit:contain}
.inline-image-missing{display:block;color:var(--muted);margin:8px 0;font-size:12px}
.description-image-upload{margin-top:12px}.comment-body{overflow-wrap:anywhere}.comment-files .comment-file-image{display:block;max-width:100%}.comment-file-image img{display:block;max-width:100%;max-height:180px;border-radius:8px;margin-bottom:6px}
/* Keep the actions outside the scrolling fields on short desktop windows. */
@media(min-width:1001px){
  .ticket-create-layout{grid-template-columns:minmax(0,1.15fr) minmax(408px,1fr)}
  .ticket-create-card{display:flex;flex-direction:column;max-height:calc(100dvh - 120px)}
  #ticket-form{display:flex;flex-direction:column;min-height:0}
  .ticket-create-layout{min-height:0;overflow:auto;padding:4px 8px 8px 4px;scroll-padding:12px;scrollbar-width:thin}
  #ticket-form>.form-actions{flex-shrink:0}
}
@media(min-width:1001px) and (max-height:760px){main:has(#ticket-form){padding-top:14px}main:has(#ticket-form) .topbar{margin-bottom:12px;padding-bottom:8px}.ticket-create-card{max-height:calc(100dvh - 100px);padding:14px}.ticket-create-main,.ticket-create-properties{gap:6px}}
@media(min-width:1001px) and (max-height:700px){
  .ticket-create-main,.ticket-create-properties{gap:4px}
  .ticket-create-card .request-field label{margin-bottom:3px}
  .ticket-create-card .request-field input:not([type=hidden]):not([type=radio]):not([type=checkbox]),.ticket-create-card .ui-select-trigger,.ticket-create-card .deadline-clear{height:32px;min-height:32px;padding-top:4px;padding-bottom:4px}
  .ticket-create-card .request-create-files .file-drop{min-height:48px;padding:5px 10px}
  .ticket-create-main .inline-editor-surface{min-height:150px}
}
@media(max-width:1000px){.ticket-create-layout{grid-template-columns:minmax(0,1fr);gap:20px}.ticket-create-properties{padding:18px 0 0;border-left:0;border-top:1px solid var(--border-soft)}.ticket-create-main .inline-editor-surface{min-height:160px;height:auto}.ticket-create-card{padding:14px}.ticket-create-card .form-actions{flex-wrap:wrap;padding-bottom:8px}.inline-editor-toolbar{gap:8px}}

.ticket-create-main .request-template-fields{margin-top:12px;padding-top:16px}.ticket-create-main .request-template-fields .request-field{margin-top:12px}

.request-properties-paired>.request-initiator,.request-properties-paired>.request-self-assignment{grid-area:3/1/auto/-1}
/* Keep each related pair together, including when optional fields are absent. */
.request-properties-paired{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 14px;align-items:start}
.request-properties-paired>.request-field,.request-properties-paired>.request-create-files{min-width:0;margin:0}
.request-properties-paired>.request-field-direction{grid-area:1/1}
.request-properties-paired>.request-field-category{grid-area:1/2}
.request-properties-paired>.request-field-subcategory{grid-area:2/1}
.request-properties-paired>.request-field-priority{grid-area:2/2}
.request-properties-paired:not(:has(>.request-field-subcategory:not([hidden])))>.request-field-priority{grid-column:1/-1}
.request-properties-paired>.request-field-assignees{grid-area:4/1}
.request-properties-paired>.request-field-participants{grid-area:4/2}
.request-properties-paired:not(:has(>.request-field-assignees))>.request-field-participants{grid-column:1/-1}
.request-properties-paired:not(:has(>.request-field-participants))>.request-field-assignees{grid-column:1/-1}
.request-properties-paired>.request-field-deadline{grid-area:5/1}
.request-properties-paired>.request-create-files{grid-area:5/2}
.ticket-create-card .request-properties-paired .file-drop{height:38px;min-height:38px;padding:3px 8px;gap:0 6px}
.request-properties-paired .file-drop>strong{font-size:11px;line-height:1.2}
.request-properties-paired .file-drop>span{font-size:9px;line-height:1.2}
@media(min-width:1001px) and (max-height:700px){.ticket-create-card .request-properties-paired .file-drop{height:32px;min-height:32px}}
@media(max-width:560px){.request-properties-paired{grid-template-columns:minmax(0,1fr);gap:12px}.request-properties-paired>.request-field,.request-properties-paired>.request-create-files{grid-area:auto!important}.ticket-create-card .request-properties-paired .file-drop{height:44px;min-height:44px}}

.ticket-create-card .request-field-heading{display:flex;align-items:center;gap:6px;margin-bottom:4px;min-height:18px}
.ticket-create-card .request-field-heading>label{margin:0}
.ticket-create-card .request-help-button{display:inline-flex;align-items:center;justify-content:center;flex:none;width:18px;height:18px;min-height:18px;margin:0;padding:0;border:1px solid var(--border);border-radius:50%;font-size:11px;font-weight:600;line-height:1;background:var(--surface);color:var(--muted);box-shadow:none}
.ticket-create-card .request-help-button:hover,.ticket-create-card .request-help-button[aria-expanded=true]{border-color:var(--accent);color:var(--accent);background:var(--accent-soft)}
.request-help-popover{position:fixed;inset:auto;margin:0;width:min(280px,calc(100vw - 24px));padding:12px;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--text);box-shadow:var(--shadow);font-size:12px;line-height:1.5;overflow-wrap:anywhere}
.request-help-popover::backdrop{background:transparent}
@media(max-width:560px){.request-properties-paired>.request-initiator,.request-properties-paired>.request-self-assignment{grid-area:auto}}

.ticket-create-properties>.request-field>label{min-height:18px}
@media(min-width:1001px) and (max-height:700px){.ticket-create-card .request-field-heading{margin-bottom:3px}}

/* Date controls stay inside the input so clearing never narrows its column. */
.request-properties-paired{--request-control-height:38px}
.request-properties-paired .date-deadline{position:relative;width:100%;grid-template-columns:minmax(0,1fr);gap:0}
.ticket-create-card .request-properties-paired .request-field-deadline .uk-date-field>input:not([type=hidden]){height:var(--request-control-height);min-height:var(--request-control-height);padding-right:43px}
.ticket-create-card .request-properties-paired .date-deadline:has(.deadline-clear:not([hidden])) input:not([type=hidden]){padding-right:70px}
.request-properties-paired .date-deadline:has(.deadline-clear:not([hidden])) .uk-date-trigger{right:30px}
.ticket-create-card .request-properties-paired .deadline-clear{position:absolute;right:4px;top:50%;transform:translateY(-50%);width:24px;height:28px;min-height:28px;margin:0;padding:0;z-index:1;border-radius:6px}
.ticket-create-card .request-properties-paired .deadline-clear[hidden]{display:none}
.ticket-create-card .request-properties-paired .file-drop{height:var(--request-control-height);min-height:var(--request-control-height)}
@media(min-width:1001px) and (max-height:700px){.request-properties-paired{--request-control-height:32px}}

/* On phones, keep actions in the document flow so they cannot cover fields. */
@media(max-width:700px){
  main:has(#ticket-form){padding:12px 10px}
  main:has(#ticket-form) .topbar{margin-bottom:12px;padding-bottom:10px}
  .ticket-create-card{padding:10px;border-radius:14px}
  .ticket-create-layout{gap:12px;overflow:visible}
  .ticket-create-main,.ticket-create-properties{gap:8px}
  .ticket-create-properties{padding-top:12px}
  .ticket-create-card .request-field{min-width:0}
  .ticket-create-card .request-field input:not([type=hidden]):not([type=radio]):not([type=checkbox]),.ticket-create-card .request-field textarea{font-size:16px;min-width:0;max-width:100%}
  .ticket-create-card .request-field input:not([type=hidden]):not([type=radio]):not([type=checkbox]){height:44px;min-height:44px;padding:8px 10px}
  .ticket-create-card .ui-select-trigger{height:auto;min-height:44px;padding:8px 10px;font-size:14px}
  .ticket-create-card .ui-select-value{white-space:normal;overflow-wrap:anywhere;line-height:1.35;text-overflow:clip}
  .ticket-create-card .ui-select-value.multi-value{font-size:14px}
  body:has(#ticket-form) .field-popover :is(input,select){font-size:16px;min-height:44px}
  body:has(#ticket-form) .field-popover .quick-option,body:has(#ticket-form) .select-menu-actions button{min-height:44px;font-size:13px}
  .request-mobile-menu{overflow-y:auto;overscroll-behavior:contain}
  .request-mobile-menu .quick-options{min-height:88px;max-height:none}
  .request-mobile-menu .select-menu-actions{padding-top:6px;margin-top:6px}
  .request-mobile-menu .people-picker-selection{padding-bottom:4px}
  body:has(#ticket-form) .uk-date-popup :is(input,select){font-size:16px}
  .ticket-create-main .inline-editor-toolbar{padding:4px 8px}
  .ticket-create-main .inline-editor-toolbar button{min-height:44px;font-size:13px;padding:8px 10px}
  .ticket-create-main .inline-editor-toolbar small{display:none}
  .ticket-create-main .inline-editor-surface{min-height:104px;padding:10px;font-size:16px;line-height:1.45}
  .ticket-create-main .request-template-fields{margin-top:8px;padding-top:10px}
  .ticket-create-main .request-template-fields .request-field{margin-top:8px}
  .ticket-create-card .request-help-button{width:28px;height:28px;min-height:28px;font-size:13px}
  .request-properties-paired{--request-control-height:44px;gap:8px}
  .ticket-create-card .request-properties-paired .request-field-deadline .uk-date-field>input:not([type=hidden]){padding-right:46px}
  .ticket-create-card .request-properties-paired .date-deadline:has(.deadline-clear:not([hidden])) input:not([type=hidden]){padding-right:88px}
  .ticket-create-card .uk-date-field>.uk-date-trigger{width:40px;height:40px;min-height:40px;right:2px}
  .ticket-create-card .request-properties-paired .date-deadline:has(.deadline-clear:not([hidden])) .uk-date-trigger{right:42px}
  .ticket-create-card .request-properties-paired .deadline-clear{width:36px;height:40px;min-height:40px;right:2px}
  .request-properties-paired .file-drop>strong{font-size:13px}
  .request-properties-paired .file-drop>span{font-size:10px}
  .ticket-create-card .selected-files{max-height:none;overflow:visible}
  .ticket-create-card .selected-files li{padding:4px 6px;gap:6px}
  .ticket-create-card .selected-files button{width:40px;height:40px;min-height:40px}
  .ticket-create-card .form-actions{position:static;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:stretch;gap:8px;margin-top:10px;padding:10px 0 max(2px,env(safe-area-inset-bottom));min-width:0}
  .ticket-create-card .form-actions>:is(a,button){display:flex;align-items:center;justify-content:center;min-width:0;min-height:44px;margin:0;padding:8px;font-size:13px;line-height:1.3;text-align:center;white-space:normal;overflow-wrap:anywhere}
  .ticket-create-card .form-actions>:nth-child(3){grid-column:1/-1}
}
@media(min-width:380px) and (max-width:560px){
  .request-properties-paired:has(>.request-field-subcategory:not([hidden])){grid-template-columns:repeat(2,minmax(0,1fr))}
  .request-properties-paired>:is(.request-field,.request-create-files,.request-initiator,.request-self-assignment){grid-column:1/-1!important}
  .request-properties-paired>.request-field-subcategory{grid-column:1!important}
  .request-properties-paired:has(>.request-field-subcategory:not([hidden]))>.request-field-priority{grid-column:2!important}
}

/* Keep attachment help on the label line, aligned with the deadline control. */
.ticket-create-card .request-create-files>.request-field-heading {margin-bottom:4px;min-height:18px;font-size:12px;font-weight:600;line-height:18px}
.ticket-create-card .request-create-files .request-field-heading>.block-help {margin:0}
.ticket-create-card .request-create-files .block-help-trigger {width:18px;height:18px;font-size:11px;min-height:18px}
@media(pointer:coarse){
 .ticket-create-card .request-create-files>.request-field-heading,
 .ticket-create-card .request-field-deadline>label {min-height:32px;display:flex;align-items:center}
 .ticket-create-card .request-create-files .block-help-trigger {width:32px;height:32px;min-height:32px}
}
