/* Page-specific components: wizard, board, threads, answers, form builder. */

.empty-line { padding: 18px 20px; color: var(--text-2); font-size: var(--fs-sm); }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.strong-link { color: var(--text); font-weight: 500; }
.strong-link:hover { color: var(--accent-text); }
.row-link { cursor: pointer; }
.card-link { color: var(--text-2); }
.card-link:hover { color: var(--accent-text); }
.stat-value.small-value { font-size: 1.0625rem; font-weight: 650; font-stretch: 100%; letter-spacing: 0; line-height: 1.4; }
.tab-count { margin-left: 4px; font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.tag-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.req { color: var(--danger); }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.icon-btn-sm { width: 28px; height: 28px; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
.form-section { margin: 24px 0 12px; padding-top: 18px; border-top: 1px solid var(--border); font-size: var(--fs-base); }
dialog.modal-wide { width: min(680px, calc(100vw - 32px)); }
.modal-body { max-height: calc(100vh - 220px); overflow-y: auto; }
.toolbar-bare { padding: 0 0 16px; border: 0; }
.input-file { padding: 7px 10px; height: auto; }

/* Segmented links (list / board) */
.seg-link { display: inline-flex; align-items: center; gap: 6px; min-height: 2.5rem; padding: 0 .875rem; color: var(--ink); font-size: var(--fs-ui); font-weight: 600; text-decoration: none !important; }
.seg-link .icon { width: 15px; height: 15px; }
.seg-link[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* Dashboard first-run block */
.start { border-color: var(--border-strong); }
.start-body { padding: 28px; max-width: 640px; }
.start-body h2 { font-size: var(--fs-lg); }
.start-body p { margin-top: 6px; }

/* Calendar date chip in deadline lists */
.date-chip { width: 40px; flex-shrink: 0; text-align: center; font-size: 10.5px; color: var(--text-2); line-height: 1.1; border: 1px solid var(--border); border-radius: 6px; padding: 4px 0; }
.date-chip span { display: block; font-size: var(--fs-md); font-weight: 600; color: var(--text); }
.date-chip.is-late, .date-chip.is-late span { color: var(--danger); }

/* ---------- Service picker ---------- */
.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.service-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); color: var(--text); transition: border-color var(--dur), background var(--dur); }
.service-card:hover { border-color: var(--accent); background: var(--surface-2); }
.service-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.service-icon { color: var(--accent-text); margin-bottom: 6px; }
.service-name { font-weight: 600; }
.service-desc { font-size: var(--fs-sm); color: var(--text-2); }

/* ---------- Wizard ---------- */
.wizard { max-width: 860px; }
.wizard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.wizard-head h1 { font-size: clamp(2.25rem, 1.6rem + 2.4vw, 3.5rem); font-weight: 800; font-stretch: 62%; line-height: .92; letter-spacing: -.02em; }
.wizard-head p { margin-top: .625rem; }
.wizard-steps { list-style: none; margin: 0 0 16px; padding: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.wizard-steps li { flex: 1 1 0; min-width: 110px; }
.wizard-steps button { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 0 0; border: 0; border-top: 3px solid var(--border); background: none; text-align: left; color: var(--text-3); font-size: var(--fs-xs); }
.wizard-steps button:disabled { cursor: default; }
.wizard-steps .is-done button { border-top-color: var(--accent); color: var(--text-2); }
.wizard-steps .is-current button { border-top-color: var(--accent); color: var(--text); font-weight: 600; }
.step-n { font-variant-numeric: tabular-nums; color: inherit; }
.step-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.wizard-card .card-body { padding: 28px; min-height: 280px; }
.wizard-card h2 { font-size: var(--fs-lg); }
.wizard-fields { margin-top: 22px; display: grid; gap: 20px; }
.wizard-fields .field + .field { margin-top: 0; }
.wizard-foot { justify-content: flex-start; }
.wizard-foot form { display: contents; }
.wizard-foot [hidden] { display: none !important; }

.choice { border: 0; padding: 0; margin: 0; }
.choice legend { margin-bottom: 8px; padding: 0; }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.choices-inline { grid-template-columns: repeat(2, minmax(0, 140px)); }
.choice-item { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; font-size: var(--fs-base); background: var(--surface); transition: border-color var(--dur), background var(--dur); }
.choice-item:hover { border-color: var(--text-3); }
.choice-item input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; flex-shrink: 0; }
.choice-item:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice-item:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.file-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.file-list li { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: var(--fs-sm); }
.file-list li .truncate { flex: 1; min-width: 0; }
.file-link { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--accent-text); font-size: var(--fs-sm); }

/* ---------- Answers summary ---------- */
.answers-step + .answers-step { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.answers-step h3 { font-size: var(--fs-sm); font-weight: 600; margin-bottom: 10px; }
.answers { display: grid; grid-template-columns: minmax(140px, 38%) 1fr; gap: 8px 16px; margin: 0; font-size: var(--fs-sm); }
.answers dt { color: var(--text-2); }
.answers dd { margin: 0; }

/* ---------- Request progress ---------- */
.progress-steps { list-style: none; display: flex; margin: 0 0 20px; padding: 0; gap: 4px; }
.progress-steps li { flex: 1; padding-top: 8px; border-top: 3px solid var(--border); font-size: var(--fs-sm); color: var(--text-3); }
.progress-steps li.is-done { border-top-color: var(--accent); color: var(--text-2); }
.progress-steps li.is-current { border-top-color: var(--accent); color: var(--text); font-weight: 600; }

/* ---------- Threads ---------- */
.thread { list-style: none; margin: 0; padding: 8px 20px; }
.msg { padding: 14px 0; border-bottom: 1px solid var(--border); }
.msg:last-child { border-bottom: 0; }
.msg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: var(--fs-sm); }
.msg-head time { margin-left: auto; }
.msg-body { margin-top: 6px; padding-left: 32px; font-size: var(--fs-base); }
.msg.is-internal { background: var(--warning-soft); margin: 0 -20px; padding: 14px 20px; border-bottom-color: transparent; }
.composer { padding: 14px 20px 16px; border-top: 1px solid var(--border); display: grid; gap: 10px; background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* ---------- Checklists (tasks, milestones) ---------- */
.checklist { list-style: none; margin: 0; padding: 6px 20px; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-base); }
.checklist li:last-child { border-bottom: 0; }
.checklist li.is-done .grow { color: var(--text-3); text-decoration: line-through; }
.check-dot { width: 18px; height: 18px; flex-shrink: 0; display: grid; place-items: center; border: 1.5px solid var(--border-strong); border-radius: 50%; background: var(--surface); color: #fff; padding: 0; }
.check-dot .icon-sm { width: 12px; height: 12px; }
.is-done .check-dot { background: var(--accent); border-color: var(--accent); }
.check-dot.is-button:hover { border-color: var(--accent); }
.inline-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--border); }
.inline-add .grow { min-width: 180px; }

/* ---------- Board ---------- */
.board { display: grid; grid-template-columns: repeat(6, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.board-col { background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-lg); min-height: 160px; transition: background var(--dur); }
.board-col.is-over { background: var(--accent-soft); border-color: var(--accent); }
.board-col-head { display: flex; justify-content: space-between; padding: 12px 14px 8px; font-size: var(--fs-sm); font-weight: 600; }
.board-count { color: var(--text-3); font-weight: 500; font-variant-numeric: tabular-nums; }
.board-list { display: grid; gap: 8px; padding: 0 8px 10px; }
.board-card { display: flex; flex-direction: column; gap: 4px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none !important; }
.board-card:hover { border-color: var(--border-strong); }
.board-card[draggable="true"] { cursor: grab; }
.board-card.is-dragging { opacity: 0.5; }
.board-card-title { font-weight: 500; font-size: var(--fs-base); }

/* ---------- Form builder ---------- */
.fb-step .card-header { gap: 8px; }
.fb-step .step-n { width: 24px; height: 24px; flex-shrink: 0; display: grid; place-items: center; border-radius: 6px; background: var(--bg-subtle); font-size: var(--fs-xs); font-weight: 600; }
.fb-step-title { font-weight: 600; }
.fb-field { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); display: grid; gap: 8px; }
.fb-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fb-row .select { width: auto; }
.fb-options { min-height: 72px; font-size: var(--fs-sm); }

@media (max-width: 640px) {
  .wizard-card .card-body { padding: 20px; }
  .answers { grid-template-columns: 1fr; gap: 2px; }
  .answers dd { margin-bottom: 8px; }
  .wizard-head { flex-direction: column; }
  .msg-body { padding-left: 0; }
}

/* Narrow side panels always stack form fields. */
aside .field-row, .grid-main > aside .field-row { grid-template-columns: 1fr; }
.inline-add .input, .inline-add .select, .fb-row .input, .fb-row .select { width: auto; }
.inline-add .grow, .fb-row .grow { flex: 1 1 200px; }
aside .field-row .field + .field { margin-top: 0; }

/* Balance */
.balance-value { font-size: 2rem; }
.balance-pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px solid var(--border); border-radius: 6px; color: var(--text-2); font-size: var(--fs-sm); text-decoration: none !important; }
.balance-pill strong { color: var(--text); font-variant-numeric: tabular-nums; }
.seg-radio { flex: 1; position: relative; }
.seg-radio input { position: absolute; opacity: 0; }
.seg-radio span { display: flex; align-items: center; justify-content: center; min-height: 2.5rem; font-size: var(--fs-ui); font-weight: 600; color: var(--ink); cursor: pointer; }
.seg-radio input:checked + span { background: var(--accent); color: var(--on-accent); }
.seg-radio input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Balance */
.balance-value { font-size: 2rem; }
.balance-pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px solid var(--border); border-radius: 6px; color: var(--text-2); font-size: var(--fs-sm); text-decoration: none !important; }
.balance-pill strong { color: var(--text); font-variant-numeric: tabular-nums; }
.seg-radio { flex: 1; position: relative; }
.seg-radio input { position: absolute; opacity: 0; }
.seg-radio span { display: flex; align-items: center; justify-content: center; min-height: 2.5rem; font-size: var(--fs-ui); font-weight: 600; color: var(--ink); cursor: pointer; }
.seg-radio input:checked + span { background: var(--accent); color: var(--on-accent); }
.seg-radio input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.table .text-right { text-align: right; }

/* Quotes */
.quote-lines td { vertical-align: top; }
.quote-totals { display: grid; grid-template-columns: 1fr auto; gap: 6px 0; margin: 18px 0 0 auto; max-width: 320px; font-size: var(--fs-base); font-variant-numeric: tabular-nums; }
.quote-totals dt { color: var(--text-2); }
.quote-totals dd { margin: 0; padding-left: 24px; text-align: right; }
.quote-totals .grand { padding-top: 10px; border-top: 1px solid var(--border-strong); font-weight: 600; font-size: var(--fs-md); color: var(--text); }
.quote-terms { border-top: 1px solid var(--border); }
.quote-terms h3 { font-size: var(--fs-sm); margin: 14px 0 6px; }
.quote-terms h3:first-child { margin-top: 0; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.quote-edit td { padding: 8px 6px; vertical-align: top; }
.quote-edit td:first-child { padding-left: 20px; }
.quote-edit .textarea { min-height: 34px; resize: none; overflow: hidden; line-height: 1.4; padding-top: 7px; }
.quote-edit [data-line-total] { padding-top: 15px; }
.input.text-right { text-align: right; }
.list-item[aria-current="page"] { background: var(--accent-soft); }

/* Holds */
.hold-row { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.hold-row:last-child { border-bottom: 0; }
.hold-row form { display: inline; }
.input-prefix { position: relative; max-width: 260px; }
.input-prefix > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-2); pointer-events: none; }
.input-prefix > .input { padding-left: 28px; font-variant-numeric: tabular-nums; }

/* Legal pages */
.legal-body h2 { font-size: var(--fs-lg); margin: 26px 0 8px; }
.legal-body h3 { font-size: var(--fs-md); margin: 20px 0 6px; }
.legal-body p, .legal-body ul { margin: 8px 0; color: var(--text-2); line-height: 1.65; }
.legal-body ul { padding-left: 20px; }
.legal-body li + li { margin-top: 4px; }
.legal-body strong { color: var(--text); }
.legal-source { font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.55; min-height: 520px; }
.legal-preview { max-height: 760px; overflow-y: auto; }
