/* ==========================================================================
   Challan — blank canvas (document blocks + builder UI), rent period box,
   clause editor. Loaded by the studio; document styles also by other pages.
   ========================================================================== */

/* ---------- Document: canvas blocks ---------- */
.cv-doc { display: flex; flex-direction: column; gap: 14px; }
.cv-doc::before { display: none; }
.cv-doc.tpl-modern { border-top: 5px solid var(--acc); }
.cv-doc.tpl-professional, .cv-doc.tpl-luxury, .cv-doc.tpl-creative { padding: var(--pad-y) var(--pad-x) 48px; }
.cb { position: relative; break-inside: avoid; }
.al-center { text-align: center; justify-content: center; justify-items: center; margin-inline: auto; }
.al-end { text-align: end; justify-content: flex-end; justify-items: end; margin-inline-start: auto; }
.cb-h { margin: 0; color: var(--acc-ink); letter-spacing: -.02em; line-height: 1.15; font-weight: 650; }
.cb-h.sz-md { font-size: 16px; } .cb-h.sz-lg { font-size: 21px; } .cb-h.sz-xl { font-size: 28px; } .cb-h.sz-xxl { font-size: 44px; letter-spacing: -.035em; }
.cb-text { font-size: 1.08em; line-height: 1.75; color: var(--ink); }
.cb-text.muted { color: var(--soft); font-size: 1em; }
.cb-text b { font-weight: 650; }
.cb-ph { color: var(--mute); font-style: italic; font-weight: 400; }
.cb-ph-box { border: 1.5px dashed var(--rule-2); border-radius: 8px; padding: 14px; color: var(--mute); font-size: 12px; display: flex; gap: 8px; align-items: center; }
.cb-fields { margin: 0; display: grid; gap: 8px 28px; }
.cb-fields.cols-1 { grid-template-columns: 1fr; } .cb-fields.cols-2 { grid-template-columns: 1fr 1fr; } .cb-fields.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.cb-fields dt { color: var(--mute); font-size: .88em; }
.cb-fields dd { margin: 0; font-weight: 500; }
.cb-hr { border: 0; margin: 2px 0; height: 0; border-top: 1px solid var(--rule-2); }
.cb-hr.st-dashed { border-top-style: dashed; } .cb-hr.st-double { border-top: 3px double var(--ink); } .cb-hr.st-accent { border-top: 3px solid var(--acc); }
.cb-img { display: flex; } .cb-img img { max-width: 100%; height: auto; }
.cb-biz { display: flex; gap: 16px; align-items: flex-start; }
.cb-biz.al-center { flex-direction: column; align-items: center; }
.cb-biz.al-end { flex-direction: row-reverse; }
.cb-info { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 28px; }
.cb-info dt { color: var(--mute); font-size: .88em; }
.cb-info dd { margin: 0; font-weight: 600; }
.cb-totals { display: flex; justify-content: flex-end; }
.cb-totals .rc-totals { width: 300px; }
.cb-amount { display: grid; gap: 2px; width: max-content; max-width: 100%; padding: 16px 22px; border-radius: 10px; background: var(--acc-tint); }
.cb-amount span { color: var(--soft); font-size: .92em; }
.cb-amount b { font-size: 28px; color: var(--acc-ink); letter-spacing: -.02em; }
.cb-amount small { color: var(--soft); font-size: .9em; }
.cb-status { margin-top: 8px; }
.cb-qr { display: grid; width: max-content; }
.cb .rc-sign { margin-top: 18px; }
.cb .rc-agree { margin-top: 0; }

/* Studio-only affordances */
.is-editable .cv-doc .cb { outline: 1px dashed transparent; outline-offset: 6px; border-radius: 4px; transition: outline-color var(--d-fast); cursor: pointer; }
.is-editable .cv-doc .cb:hover { outline-color: #A5B4FC; }
.is-editable .cv-doc .cb.is-selected { outline: 2px solid var(--brand, #4338CA); outline-offset: 6px; }
.cv-doc.dragging-over .cb { pointer-events: none; }
.cb-empty { min-height: 600px; display: grid; place-items: center; border: 2px dashed #C7D2FE; border-radius: 12px; background: #F8F9FF; }
.cb-empty-in { display: grid; justify-items: center; gap: 8px; text-align: center; color: #64748B; padding: 24px; font-family: var(--font-ui); }
.cb-empty-in .i-lg { width: 32px; height: 32px; color: #818CF8; }
.cb-empty-in b { color: #1E1B4B; font-size: 16px; }
.cb-starters { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.cb-line { position: absolute; height: 3px; border-radius: 3px; background: var(--brand, #4338CA); box-shadow: 0 0 0 3px rgba(67, 56, 202, .18); z-index: 6; pointer-events: none; }
.cb-line::before, .cb-line::after { content: ""; position: absolute; top: -4px; width: 11px; height: 11px; border-radius: 50%; background: var(--brand, #4338CA); }
.cb-line::before { left: -6px; } .cb-line::after { right: -6px; }
.cb-bar { position: absolute; z-index: 7; display: flex; align-items: center; gap: 2px; padding: 3px; background: var(--ink, #111827); border-radius: 8px; box-shadow: var(--e-2); }
.cb-bar button, .cb-grip { width: 28px; height: 26px; display: grid; place-items: center; color: #fff; border-radius: 6px; }
.cb-bar button:hover, .cb-grip:hover { background: rgba(255, 255, 255, .14); }
.cb-grip { cursor: grab; }
.cb-bar .i { width: 15px; height: 15px; }
.i.flip { transform: rotate(180deg); }

/* ---------- Left panel: palette + block editor ---------- */
.pal-group { display: grid; gap: 6px; }
.pal-h { font-size: 11.5px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; }
.pal { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pal-item { display: grid; justify-items: center; gap: 5px; padding: 10px 4px 8px; border: 1px solid var(--border); border-radius: var(--r-field); background: var(--surface); font-size: 11.5px; font-weight: 500; color: var(--ink-2); cursor: grab; text-align: center; line-height: 1.2; transition: border-color var(--d-fast), background var(--d-fast), transform var(--d-fast); }
.pal-item .i { width: 18px; height: 18px; color: var(--brand); }
.pal-item:hover { border-color: var(--brand); background: var(--brand-tint); }
.pal-item:active { cursor: grabbing; transform: scale(.97); }
.bk-edit { display: grid; gap: 12px; padding: 12px; border: 1.5px solid var(--brand); border-radius: var(--r-md); background: var(--brand-tint); }
.bk-edit .subhead > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.bk-edit .input, .bk-edit .textarea, .bk-edit .seg { background-color: var(--surface); }
.bk-acts { display: flex; gap: 0; }
.chip-xs { height: 22px; padding: 0 7px; font-size: 11px; font-family: var(--font-mono); }

/* ---------- Rent period box ---------- */
.rent-box { display: grid; gap: 12px; padding: 12px; border-radius: var(--r-md); background: var(--brand-tint); border: 1px solid var(--brand-tint-2); }
.rent-box .subhead { justify-content: flex-start; gap: 6px; color: var(--brand); }
.rent-box .input, .rent-box .input-group, .rent-box .seg { background-color: var(--surface); }

/* ---------- Clause editor ---------- */
.cl-list { display: grid; gap: 8px; }
.cl-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 6px; align-items: start; }
.cl-n { width: 22px; height: 22px; border-radius: 50%; background: var(--brand-tint); color: var(--brand); font-size: 11px; font-weight: 600; display: grid; place-items: center; margin-top: 8px; }
.cl-row .textarea { min-height: 64px; font-size: 13px; line-height: 1.5; }
.cl-tools { display: grid; gap: 0; }
.cl-tools .btn { height: 24px; width: 26px; }
code { font-family: var(--font-mono); font-size: .9em; background: #F2F4F7; padding: 1px 4px; border-radius: 4px; }

@media (max-width: 760px) {
  .pal { grid-template-columns: repeat(3, 1fr); }
  .pal-item { padding: 12px 4px; font-size: 12px; }
}
