/* web/modules/custom/easytax_documents/css/components/easytax-cma.css
   CMA Report generator page. Layout + the bridge that maps Drupal Form-API
   markup onto the Balance Sheet wizard's reused rw-* design system (loaded via
   techprosolutions/report_wizard). Report styling lives in css/print.css.
   Every dimension is a 4px multiple; colours use the wizard :root tokens. */

/* ---------- Page + hero ---------- */
.etd-page--cma { max-width: 75rem; margin: 0 auto; padding: 32px 16px 96px; font-family: 'Manrope', system-ui, sans-serif; }
.etd-cma-hero { margin-bottom: 24px; }
.etd-cma-hero__row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.etd-cma-hero .rw-h1 { font-size: 2rem; }

/* ---------- Two-column shell ---------- */
.etd-cma-shell { display: grid; grid-template-columns: 288px 1fr; gap: 24px; align-items: start; }
.etd-cma-rail { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 16px; }
.etd-cma-main { min-width: 0; display: flex; flex-direction: column; gap: 20px; }

/* ---------- Rail: on-this-page nav (rw-sec) ---------- */
.etd-cma-toc { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.etd-cma-toc .rw-sec { text-decoration: none; border-left: 3px solid transparent; }
.etd-cma-toc .rw-sec.is-active { background: var(--green-soft, #E8F5EF); border-left-color: var(--green, #1D9E75); }
.etd-cma-toc .rw-sec.is-active .rw-sec__label { color: var(--navy, #1C3557); }

/* ---------- Rail: report includes ---------- */
.etd-cma-inchead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.etd-cma-includes { display: flex; flex-direction: column; gap: 8px; }
.etd-cma-inc { display: flex; align-items: center; gap: 8px; font-size: 0.86rem; color: var(--navy, #1C3557); font-weight: 600; }
.etd-cma-inc__ic { flex: none; width: 20px; height: 20px; border-radius: 9999px; background: var(--green-soft, #E8F5EF); color: var(--green, #1D9E75); display: flex; align-items: center; justify-content: center; }
.etd-cma-inc__label em { color: var(--green-dark, #167A5B); font-style: normal; font-weight: 600; font-size: 0.72rem; }
.etd-cma-inc.is-blue-only.is-hidden { display: none; }

/* ---------- Rail: download ---------- */
.etd-cma-dlhint { margin: 8px 0 0; font-size: 0.8rem; color: var(--muted, #64748b); }

/* ---------- Cards: 2-column field grid inside each rw-card ---------- */
.etd-cma-card { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
.etd-cma-card > .rw-hd,
.etd-cma-card > .rw-note,
.etd-cma-card > .etd-cma-drop,
.etd-cma-card > .etd-cma-files,
.etd-cma-card > .etd-cma-readrow,
.etd-cma-card > .etd-repeatable,
.etd-cma-card > .etd-cma-full { grid-column: 1 / -1; }
.etd-cma-card .form-item { margin: 0 0 16px; }

/* ---------- Field + label bridge (Drupal markup → rw-field / rw-label) ---------- */
.etd-cma-form .form-item > label { font-size: 0.82rem; font-weight: 600; color: var(--navy, #1C3557); margin-bottom: 6px; display: block; }
.etd-cma-form .form-item > label .form-required { color: var(--green, #1D9E75); }
/* Most controls carry .rw-field (added server-side); the repeatable-row inputs
   are built by shared code and cannot, so apply the SAME wizard field spec
   (identical tokens, not a new palette) to every CMA input for one consistent
   look. */
.etd-cma-form input[type="text"],
.etd-cma-form input[type="number"],
.etd-cma-form select,
.etd-cma-form textarea {
  width: 100%;
  max-width: none;
  background: var(--field, #f5f7fa);
  border: 1.5px solid transparent;
  border-radius: var(--r-sm, 10px);
  padding: 11px 14px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--navy, #1C3557);
  line-height: 1.3;
  outline: none;
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.etd-cma-form input::placeholder,
.etd-cma-form textarea::placeholder { color: #aeb8c4; }
.etd-cma-form input[type="text"]:hover,
.etd-cma-form input[type="number"]:hover,
.etd-cma-form select:hover { background: var(--field-hover, #eef2f6); }
.etd-cma-form input[type="text"]:focus,
.etd-cma-form input[type="number"]:focus,
.etd-cma-form select:focus,
.etd-cma-form textarea:focus { background: #fff; border-color: var(--green, #1D9E75); box-shadow: 0 0 0 4px var(--green-ring, rgba(29,158,117,.18)); }

/* Rupee affix on money fields. */
.etd-cma-form .etd-affix { position: relative; }
.etd-cma-form .etd-affix .field-prefix {
  position: absolute; left: 14px; bottom: 0; height: 44px;
  display: flex; align-items: center; color: var(--muted, #64748b);
  font-weight: 600; font-size: 0.9rem; pointer-events: none;
}
.etd-cma-form .etd-affix input.rw-field { padding-left: 28px; }

/* ---------- Setup & Upload dropzone (rw-drop) ---------- */
.etd-cma-drop { cursor: pointer; }
.etd-cma-drop.is-dragover { border-color: var(--green, #1D9E75); background: var(--green-soft, #E8F5EF); }
.etd-cma-drop:focus-visible { outline: 2px solid var(--green, #1D9E75); outline-offset: 2px; }
.etd-cma-drop__text { font-size: 0.92rem; color: var(--navy, #1C3557); }
.etd-cma-drop__text strong { font-weight: 700; }
.etd-cma-drop__hint { font-size: 0.74rem; color: var(--muted-2, #94a3b8); margin-top: 6px; }

/* Per-file chips (rw-files) with fiscal-year tagging. */
.etd-cma-files { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.etd-cma-file { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line, #edf1f5); border-radius: var(--r-md, 12px); background: #fff; font-size: 0.82rem; }
.etd-cma-file__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--navy, #1C3557); font-weight: 700; }
.etd-cma-file__fy { border: 1px solid var(--line, #edf1f5); background: var(--field, #f5f7fa); border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 0.74rem; }
.etd-cma-file__state { font-size: 0.72rem; font-weight: 700; }
.etd-cma-file__state[data-state="reading"] { color: #8A5A00; }
.etd-cma-file__state[data-state="done"] { color: var(--green-dark, #167A5B); }
.etd-cma-file__state[data-state="review"] { color: #b42318; }
.etd-cma-file__remove { border: 0; background: none; color: var(--muted-2, #94a3b8); cursor: pointer; font-size: 1.125rem; line-height: 1; padding: 0 4px; }
.etd-cma-readrow { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.etd-cma-read { white-space: nowrap; }
.etd-cma-read.is-disabled { opacity: .5; pointer-events: none; }

/* OCR-prefilled / review field states. */
.etd-cma-form .cma-prefilled input { background: var(--green-soft, #E8F5EF); }
.etd-cma-form .cma-review input { background: #fff3f2; border-color: #E4A11B; }

/* ---------- Historical figures repeatable ---------- */
.etd-cma-form .etd-repeatable { margin-bottom: 8px; }
.etd-cma-form .etd-rep-row { display: grid; grid-template-columns: repeat(6, 1fr) 32px; gap: 8px; align-items: end; margin-bottom: 8px; }
.etd-cma-form .etd-rep-row input.rw-field { padding: 8px 10px; font-size: 0.82rem; }
.etd-cma-form .etd-rep-remove { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line, #edf1f5); background: #fff; color: var(--muted, #64748b); cursor: pointer; }
.etd-cma-form .etd-rep-add { margin-top: 8px; border-radius: 9999px; border: 1px solid var(--green, #1D9E75); background: var(--green-soft, #E8F5EF); color: var(--green-dark, #167A5B); padding: 8px 16px; font-weight: 700; }

/* ---------- Advanced assumptions (collapsible rw-card) ---------- */
.etd-cma-advanced { padding: 20px 28px; }
.etd-cma-advanced > summary { font-weight: 700; color: var(--navy, #1C3557); cursor: pointer; padding: 8px 0; list-style-position: inside; }
.etd-cma-advanced[open] { display: block; }
.etd-cma-advanced[open] > *:not(summary) { }

/* ---------- Sticky CTA (rw-genbar) ---------- */
.etd-cma-form .etd-cma-cta { position: sticky; bottom: 16px; z-index: 5; border-radius: var(--r-lg, 16px); box-shadow: var(--shadow-lg, 0 22px 48px -18px rgba(16,32,55,.30)); margin-top: 4px; }
.etd-cma-form .etd-cma-cta .form-submit { margin: 0; }

/* ---------- Focus ---------- */
.etd-cma-form :focus-visible { outline: 2px solid var(--green, #1D9E75); outline-offset: 2px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .etd-cma-shell { grid-template-columns: 1fr; }
  .etd-cma-rail { position: static; flex-direction: row; flex-wrap: wrap; }
  .etd-cma-rail > .rw-card { flex: 1 1 240px; }
  .etd-cma-rail > nav.rw-card { display: none; }
}
@media (max-width: 640px) {
  .etd-cma-card { grid-template-columns: 1fr; }
  .etd-cma-form .etd-rep-row { grid-template-columns: 1fr 1fr; }
  .etd-cma-hero .rw-h1 { font-size: 1.6rem; }
}
