.guided-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .95fr); gap: 1.5rem; align-items: start; }
.guided-entry { display: grid; gap: 1.35rem; min-width: 0; }
.guided-section, .guided-explanation { padding: 1.5rem; margin: 0; }
.guided-step-heading { display: flex; align-items: center; gap: .65rem; margin: 0 0 1.1rem; font: 700 1.05rem var(--font-sans, sans-serif); }
.guided-step { display: inline-grid; place-items: center; width: 1.65rem; height: 1.65rem; border-radius: 50%; background: #235e50; color: white; font-size: .85rem; flex: 0 0 auto; }
.guided-kind-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.guided-kind-card { display: flex; align-items: start; gap: .65rem; padding: 1rem; min-height: 7rem; background: transparent; border: 1px solid #cfd9cb; border-radius: .6rem; color: inherit; text-align: left; text-decoration: none; cursor: pointer; font: inherit; }
.guided-kind-card.selected, .guided-answer.selected { border: 2px solid #276653; padding: calc(1rem - 1px); background: #f0f5ef; }
.guided-kind-card strong, .guided-answer strong { display: block; line-height: 1.4; }
.guided-kind-card small, .guided-answer small { display: block; color: #53665f; margin-top: .35rem; line-height: 1.5; font-size: .82rem; font-weight: 400; }
.guided-choice-dot { display: inline-grid; place-items: center; width: 1rem; height: 1rem; margin-top: .2rem; border: 1px solid currentColor; border-radius: 50%; color: #276653; flex: 0 0 auto; font-size: .55rem; }
.guided-scope { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; padding: .9rem; background: #f0f4ea; border-radius: .5rem; margin-bottom: 1rem; }
.guided-main-fields { display: grid; gap: 1rem; }
.guided-timing { border: 0; margin: 1.2rem 0; padding: 0; min-width: 0; }
.guided-timing legend { font-weight: 650; margin-bottom: .7rem; }
.guided-answer { display: flex; align-items: start; gap: .7rem; padding: 1rem; border: 1px solid #cfd9cb; border-radius: .55rem; margin: .6rem 0; cursor: pointer; }
.guided-answer input[type=radio] { accent-color: #276653; width: 1rem; min-height: 1rem; margin: .2rem 0 0; flex: 0 0 auto; }
.guided-more { margin-top: 1rem; padding: .8rem 1rem; border: 1px solid #d8dfd4; border-radius: .6rem; }
.guided-more .form-grid { margin-top: .8rem; }
.guided-explanation { position: sticky; top: 1rem; border-color: #c5d8be; }
.guided-narrative { background: #edf3e8; border-radius: .6rem; padding: 1rem; line-height: 1.65; }
.guided-awaiting-preview { border: 1px solid #dce3d7; border-radius: .65rem; padding: 1rem; margin: 1rem 0; background: #f9faf6; }
.guided-awaiting-preview p, .guided-source-note, .guided-explanation .muted { font-size: .85rem; line-height: 1.6; }
.guided-source-note { border: 1px dashed #cad6c2; padding: 1rem; border-radius: .6rem; }
.guided-confirm { border-top: 1px solid #dce3d7; padding-top: 1rem; margin: 1rem 0; }
.guided-preview .panel { padding: 0; border: 0; box-shadow: none; }
.guided-preview .number { font-variant-numeric: tabular-nums; text-align: right; }
.guided-context { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.guided-template-scope { min-height: 8rem; }
@media (max-width: 1100px) { .guided-layout { grid-template-columns: minmax(0, 1fr); } .guided-explanation { position: static; } }
@media (max-width: 600px) { .guided-kind-cards, .guided-scope { grid-template-columns: minmax(0, 1fr); } .guided-section, .guided-explanation { padding: 1rem; } .guided-kind-card { min-height: auto; } }


/* Keep the guided form field context close to its input and visible to assistive tech. */
.guided-field-hint,
.guided-date-hint {
  display: block;
  color: var(--muted, #697586);
  font-size: .875rem;
  line-height: 1.4;
  margin-top: .35rem;
}

.guided-date-hint {
  font-variant-numeric: tabular-nums;
}

.guided-input-affix {
  display: flex;
  align-items: stretch;
}

.guided-input-affix input {
  min-width: 0;
  flex: 1 1 auto;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.guided-input-affix [data-guided-currency-suffix] {
  display: inline-flex;
  align-items: center;
  padding: 0 .8rem;
  border: 1px solid var(--line, #d8dee8);
  border-left: 0;
  border-radius: 0 .55rem .55rem 0;
  background: var(--surface-muted, #f5f7fa);
  color: var(--muted, #697586);
  font-variant-numeric: tabular-nums;
}

.guided-preview-context {
  display: block;
  margin-top: .2rem;
  color: var(--muted, #697586);
  font-size: .875rem;
  line-height: 1.35;
}

.guided-preview-balance td {
  border-top: 1px solid var(--line, #d8dee8);
  font-weight: 650;
}


/* The shared workspace form label rule is more specific than .guided-answer. */
.guided-entry.workspace-form .guided-timing .guided-answer {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: .7rem;
}

.guided-entry.workspace-form .guided-timing .guided-answer input[type="radio"] {
  flex: 0 0 auto;
  margin: .2rem 0 0;
}

.guided-main-fields .form-grid { align-items: start; }

/* The recording page: one form, three cards. */
.guided-cards { display: grid; gap: 1.35rem; min-width: 0; }
.guided-modebar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: 1rem; }
.guided-lock-note { margin: 0; color: var(--muted, #697586); font-size: .9rem; }
.guided-mode-toggle { display: inline-flex; align-items: center; gap: .6rem; margin-left: auto; }
.guided-mode-label { color: var(--muted, #697586); font-size: .85rem; }
.guided-mode-option { padding: .4rem .85rem; border: 1px solid #cfd9cb; border-radius: 999px; color: inherit; text-decoration: none; font-size: .9rem; }
.guided-mode-option.selected { background: #276653; border-color: #276653; color: #fff; }
.guided-kinds.compact .guided-kind-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.guided-kinds.compact .guided-kind-card { min-height: auto; align-items: center; }
.guided-kinds.compact .guided-kind-card small { display: none; }
.guided-more-hint { margin: 1rem 0 0; padding: .9rem 1rem; border: 1px dashed #cad6c2; border-radius: .6rem; color: var(--muted, #697586); font-size: .9rem; }
.callout-warning { background: #fff4de; border: 1px solid #e8c77f; border-radius: .6rem; padding: .8rem 1rem; margin: 1rem 0 0; }
.guided-readonly-scope { margin: 0 0 1rem; font-weight: 650; }
.guided-input-affix select.amount-currency { flex: 0 0 auto; width: auto; border: 1px solid var(--line, #d8dee8); border-left: 0; border-radius: 0 .55rem .55rem 0; background: var(--surface-muted, #f5f7fa); padding: 0 .6rem; font-variant-numeric: tabular-nums; }
.guided-warning { margin: .5rem 0 0; padding: .6rem .8rem; background: #fff4de; border: 1px solid #e8c77f; border-radius: .5rem; font-size: .9rem; }
.error-summary ol { margin: .5rem 0 .5rem 1.2rem; padding: 0; }
.error-summary a { color: inherit; font-weight: 650; }
.error-summary-footer { margin: .5rem 0 0; font-weight: 650; }
.guided-explanation .guided-actions { margin-top: 1rem; }
.guided-explanation .guided-actions .button { width: 100%; justify-content: center; }
.guided-explanation .guided-note { margin: .6rem 0 0; font-size: .85rem; line-height: 1.5; }
.guided-balanced { display: inline-block; margin: .8rem 0 .4rem; padding: .25rem .7rem; border-radius: 999px; background: #e3f1e6; color: #1d5c3d; font-weight: 650; font-size: .85rem; }
.guided-lines-table td, .guided-lines-table th { vertical-align: top; }
/* Without JavaScript the card has no live preview, so offer explicit buttons. */
.js .guided-nojs { display: none; }
@media (max-width: 600px) {
  .guided-kinds.compact .guided-kind-cards { grid-template-columns: minmax(0, 1fr); }
  .guided-kind-card small, .guided-answer small { display: none; }
  .guided-lines-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .guided-lines-table tr { display: block; padding: .6rem 0; border-bottom: 1px solid var(--line, #d8dee8); }
  .guided-lines-table td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .15rem 0; }
  .guided-lines-table td::before { content: attr(data-label); color: var(--muted, #697586); font-size: .85rem; }
  .guided-lines-table td:first-child { display: block; }
  .guided-lines-table td:first-child::before { content: none; }
}

/* The journal-lines page: the same grid as corrections, with a running total and a plain-words sentence. */
button.guided-mode-option { background: transparent; font: inherit; font-size: .9rem; cursor: pointer; }
button.guided-mode-option:hover:not(:disabled) { background: #eef3ea; }
.lines-form { display: grid; gap: 1.35rem; min-width: 0; }
.lines-form > .panel { margin: 0; }
.lines-card .panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; }
.lines-card .panel-head p { margin: 0; font-size: .85rem; }
.lines-summary-row { margin: 0 0 .75rem; font-weight: 650; overflow-wrap: anywhere; }
.line-add-row p { margin: .4rem 0 0; font-size: .8rem; }
.line-totals { margin: .9rem 0 0; padding: .7rem .9rem; border: 1px solid #dce4d5; border-radius: .6rem; background: #f9faf6; min-height: 2.6rem; }
.line-totals-row { display: grid; grid-template-columns: 2rem minmax(0, 3fr) minmax(0, .8fr) minmax(0, .8fr); gap: .6rem; align-items: center; }
.line-totals-row > :first-child { grid-column: 1 / 3; }
.line-totals-row > .review-chip { justify-self: start; }
.line-totals-row .numeric { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.line-totals p { margin: .5rem 0 0; font-size: .85rem; }
.lines-sentence:empty, .lines-explain:empty { display: none; }
.lines-sentence { margin: .9rem 0 0; }
.lines-actions .form-actions { margin-top: .9rem; }
.lines-actions .guided-note { margin: .5rem 0 0; }
@media (max-width: 600px) {
  .line-totals-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .line-totals-row > :first-child { grid-column: 1 / -1; }
}

/* Submit lock and lost-connection banner */
form[aria-busy="true"] { cursor: progress; }
.button-spinner {
  display: inline-block; width: 0.9em; height: 0.9em; margin-inline-end: 0.5em; vertical-align: -0.1em;
  border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%;
  animation: button-spin 0.7s linear infinite;
}
@keyframes button-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .button-spinner { animation-duration: 2s; } }
.request-failed {
  display: grid; gap: 0.5rem; justify-items: start; margin-bottom: 1rem; padding: 0.9rem 1rem;
  border: 1px solid var(--danger, #b42318); border-radius: 0.5rem; background: color-mix(in srgb, var(--danger, #b42318) 8%, transparent);
}
.request-failed[hidden] { display: none; }
.request-failed p { margin: 0; }
.guided-layout > .request-failed { grid-column: 1 / -1; margin-bottom: 0; }
