/* The Applications app on the dashboard (#applications, applications.js). Built from the
   dashboard's shared tokens and controls (base.css, dashboard.css), scoped under .apps so nothing
   leaks onto other pages. */

.apps .top-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; margin-top: 8px; }
.apps .sub-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 20px 0 12px; }
.apps .apps-search { width: 240px; }
.apps .muted { color: var(--idle); font-size: 13px; }
.apps .fail { color: var(--down); font-size: 13px; margin-left: 8px; white-space: normal; }
.apps .ok { color: var(--up); font-size: 13px; }
.apps .notice { padding: 10px 14px; margin: 14px 0; border-radius: var(--radius); background: var(--hover); font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }

/* Inline Google Form URL importer strip. */
.apps .import-bar { margin: 16px 0 8px; padding: 14px 16px; border-radius: var(--radius); background: var(--hover); display: flex; flex-direction: column; gap: 10px; max-width: 820px; }
.apps .import-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.apps .import-row .filter { flex: 1 1 320px; }

/* Submissions and Forms list: flat hairline entries matching Hub and Fixes, zero horizontal overflow. */
.apps .entry { padding: 16px 0 18px; border-bottom: 1px solid var(--line); }
.apps .entry-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.apps .entry-head b { font-size: 15px; font-weight: 600; }
.apps .entry-head .acts { margin-left: auto; flex-wrap: wrap; }
.apps .form-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--radius); background: var(--control); font-size: 12px; font-weight: 500; }
.apps .filter.note { height: 28px; width: 210px; }
.apps dl.answers { display: grid; grid-template-columns: 185px minmax(0, 1fr) 185px minmax(0, 1fr); gap: 8px 16px; max-width: 1040px; margin: 12px 0 0; }
.apps dl.answers dt { font-size: 13px; color: var(--idle); }
.apps dl.answers dd { margin: 0; overflow-wrap: anywhere; }
.apps dl.answers dd.skipped { color: var(--idle); }
.apps dl.answers dt.long { grid-column: 1; }
.apps dl.answers dd.long { grid-column: 2 / -1; white-space: pre-wrap; }

/* Form entry meta strip: public URL, question count, submissions link, and Discord config. */
.apps .form-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-top: 10px; font-size: 13px; }
.apps .form-desc { margin-top: 6px; font-size: 13px; color: var(--idle); }
.apps .link-cell { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.apps .link-btn { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 2px; }
.apps .link-btn:hover { color: var(--up); }
.apps .act-link { display: inline-flex; align-items: center; height: 28px; padding: 0 11px; background: var(--control); border-radius: var(--radius); font-size: 13px; text-decoration: none; white-space: nowrap; }
.apps .act-link:hover { background: var(--control-hover); }

/* Spinner on busy action buttons. */
.apps .act[aria-busy="true"] { display: inline-flex; align-items: center; gap: 6px; cursor: progress; color: var(--text); }
.apps .spin { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--control-hover); border-top-color: var(--text); animation: apps-spin .7s linear infinite; flex: none; }
@keyframes apps-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .apps .spin { animation-duration: 2.4s; } }

/* Form editor: clean two-column settings + ordered question rows. */
.apps .editor-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 8px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.apps .editor-head h2 { font-size: 17px; }
.apps .editor-head .acts { margin-left: auto; flex-wrap: wrap; }
.apps .editor-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; margin-top: 20px; }
.apps .editor-layout.with-preview { grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.9fr); align-items: start; }

.apps .editor-form { display: flex; flex-direction: column; gap: 12px; max-width: 820px; }
.apps .editor-form .row { display: grid; grid-template-columns: 160px minmax(0, 1fr); align-items: start; gap: 6px 14px; }
.apps .editor-form .row > label, .apps .editor-form .row > span { padding-top: 6px; font-size: 13px; color: var(--idle); }
.apps .editor-form .field-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.apps .editor-form textarea.filter { height: auto; min-height: 68px; padding: 8px 10px; resize: vertical; }
.apps .editor-form .pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.apps .editor-form .inline-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; margin-left: 12px; }
.apps .editor-form .inline-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Questions builder. */
.apps .q-section { margin-top: 28px; max-width: 820px; }
.apps .q-section > header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.apps .q-list { display: flex; flex-direction: column; gap: 12px; }
.apps .q-card { padding: 14px 16px; border-radius: var(--radius); background: var(--hover); display: flex; flex-direction: column; gap: 10px; }
.apps .q-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.apps .q-num { font-family: var(--mono); font-size: 12px; color: var(--idle); min-width: 24px; }
.apps .q-top .q-label { flex: 1 1 240px; }
.apps .q-top .pick { max-width: 170px; }
.apps .q-req { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.apps .q-meta { display: grid; grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.apps .q-meta.short-meta { grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1fr) 96px; }
.apps .q-options { display: flex; flex-direction: column; gap: 4px; }
.apps .q-options textarea.filter { height: auto; min-height: 96px; padding: 8px 10px; resize: vertical; font-family: var(--mono); font-size: 12px; line-height: 1.5; }
.apps .q-foot { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Live public form preview inside the editor, matching site/style.css warm charcoal + tomato look. */
.apps .preview-pane { position: sticky; top: 76px; border-radius: 6px; background: #15110F; color: #F6EFE7; padding: 24px 22px 28px; }
.apps .preview-badge { font-size: 12px; color: #FF7A6B; font-weight: 600; margin-bottom: 6px; }
.apps .preview-title { margin: 0 0 4px; font-size: 21px; font-weight: 600; color: #F6EFE7; line-height: 1.3; }
.apps .preview-lead { margin: 0 0 18px; font-size: 14px; color: #B8ACA1; white-space: pre-wrap; }
.apps .preview-closed { color: #FF7A6B; font-weight: 600; font-size: 14px; margin: 12px 0 0; }
.apps .preview-questions { display: flex; flex-direction: column; gap: 16px; }
.apps .preview-q { display: flex; flex-direction: column; gap: 5px; }
.apps .preview-ask { font-size: 14px; font-weight: 600; color: #F6EFE7; }
.apps .preview-opt { font-weight: 400; font-size: 12px; color: #B8ACA1; margin-left: 6px; }
.apps .preview-hint { font-size: 12px; color: #B8ACA1; }
.apps .preview-input { width: 100%; padding: 8px 10px; border: 1px solid #3A302B; border-radius: 6px; background: #211B18; color: #F6EFE7; font-size: 13px; }
.apps .preview-choices { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: #F6EFE7; }
.apps .preview-choice { display: inline-flex; align-items: center; gap: 6px; }
.apps .preview-choice input { accent-color: #D32F2F; margin: 0; }
.apps .preview-submit { margin-top: 6px; align-self: flex-start; padding: 10px 20px; border: 0; border-radius: 6px; background: #D32F2F; color: #FFFFFF; font-size: 14px; font-weight: 600; cursor: default; }

@media (max-width: 1180px) {
  .apps dl.answers { grid-template-columns: 200px minmax(0, 1fr); }
  .apps .editor-layout.with-preview { grid-template-columns: minmax(0, 1fr); }
  .apps .preview-pane { position: static; }
}

@media (max-width: 860px) {
  .apps dl.answers { grid-template-columns: 160px minmax(0, 1fr); }
  .apps .entry-head .acts { margin-left: 0; }
  .apps .editor-form .row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .apps .editor-form .row > label, .apps .editor-form .row > span { padding-top: 0; }
  .apps .editor-form .pair { grid-template-columns: minmax(0, 1fr); }
  .apps .q-meta, .apps .q-meta.short-meta { grid-template-columns: minmax(0, 1fr); }
  .apps .apps-search { width: 100%; }
}
