/* ══════════════════════════════════════════════════════
   theme-forms.css — InvoiceFlow Pro v3
   Form containers, inputs, grids, buyer sections, toggles
   ══════════════════════════════════════════════════════ */

/* ══ SIDE PANELS ══ */
.side-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  box-shadow: var(--sh);
  overflow: hidden;
}

/* ══ SECTION COLLAPSE ══ */
.side-panels {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ══ CLIENT AREA — CSS Grid container ══ */
.client-area {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  width: 100%;
  transition: grid-template-columns 0.3s ease;
}

.client-area.split {
  grid-template-columns: 1fr 1fr;
  align-items: start;
}

/* ══ BUYER SECTIONS ══ */
.buyer-section {
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.buyer-section:last-child { border-bottom: none; }

/* FIX (this session — Billing Address / Ship-to GSTIN overlap): was
   gap:4px. This is the row-to-row spacing between whole field-blocks in
   the Contact & Address section (buyer.html) — Billing Address's .fg is
   a direct child here, immediately followed by the .g3 row containing
   Ship-to GSTIN. At 4px it was actually SMALLER than .fg's own internal
   label-to-input gap (6px, below) — the space between one field's bottom
   and the NEXT field's label was tighter than the space between a single
   field's own label and its own input. Every other row-spacing value in
   this file is 6px or larger (.side-panels: 10px; .g2/.g3/.g4: 25px row-
   gap) — 4px was the one outlier. Raised to 10px, matching .side-panels'
   convention for spacing between stacked sibling blocks. */
.buyer-sec-body { padding: 10px 0 14px 0; display: flex; flex-direction: column; gap: 10px; }

.buyer-section.collapsed .compliance-row { border-bottom: none; padding: 6px 0; }

/* ══ FORM GRIDS ══ */
.g2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px 10px;
}

.g3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 25px 10px;
}

.g4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 25px 10px;
}

.fg { display: flex; flex-direction: column; gap: 6px; }

/* ══ FORM LABELS ══ */
.fl {
  font-size: 11px;
  font-weight: 700;
  color: var(--s3);
  text-transform: none;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  /* Defensive addition (this session): most .fa-bl action buttons in
     buyer.html sit inside a .fl-actions wrapper, but Billing Address's
     "From GSTIN" button is a bare direct child of .fl instead. Without
     wrap, a bare child here has nothing to gracefully drop to a second
     line the way .fl > span already does by design — at a narrow enough
     width it would overflow .fl's box rather than wrap, which can read
     as bleeding into whatever sits below. Harmless for every other .fl
     in the file: a label+single short button pair never needs to wrap
     at normal widths, so this only ever activates when something
     genuinely doesn't fit.
  */
  flex-wrap: wrap;
}
/* Sublabel inside label — drops to second line */
.fl > span {
  display: block;
  font-size: 9px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 1px;
  letter-spacing: 0;
  text-transform: none;
}
/* Actions stay inline-flex on same row as label text */
.fl .fl-actions {
  display: inline-flex;
  margin-left: auto;
}


/* ══ FORM INPUTS ══ */
.fi,
.fs,
.fta {
  padding: 7px 10px;
  border: 1px solid var(--border2);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 12px;
  color: var(--slate);
  background: white;
  outline: none;
  transition: all .12s;
  width: 100%;
}

.fi:focus,
.fs:focus,
.fta:focus {
  border-color: var(--pu);
  box-shadow: 0 0 0 3px var(--pu-glow);
}

.fi::placeholder { color: var(--muted); }

.fi.mono,
.fs.mono { font-family: var(--mono); font-size: 11px; }

.fi[readonly] {
  background: var(--bg);
  color: var(--s4);
  cursor: default;
}

.fta {
  resize: vertical;
  min-height: 70px;
  line-height: 1.5;
}

/* ══ INPUT HINT ══ */
.hint {
  font-size: 9px;
  color: var(--muted);
  margin-top: 3px;
  font-style: italic;
}

/* ══ CARD HEADER ══ */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  box-shadow: var(--sh);
  overflow: hidden;
}

.ch-t {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--s3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.cb-body { padding: 14px; }

/* ══ SECTION LABEL ══ */
.section-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--s4);
  margin: 12px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

/* ══ OIDAR TOGGLE ROW ══ */
.oidar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(99,102,241,.05);
  border: 1px solid rgba(99,102,241,.2);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 8px 0;
  gap: 10px;
}

.oidar-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.oidar-icon { font-size: 16px; }

.oidar-row.active {
  background: rgba(99,102,241,.12);
  border-color: rgba(99,102,241,.4);
}

/* ══ TOGGLE SWITCH ══ */
.toggle-sw {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.toggle-sw input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border2);
  border-radius: 20px;
  transition: .2s;
}

.toggle-slider:before {
  content: '';
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: .2s;
}

.toggle-sw input:checked + .toggle-slider { background: var(--in); }
.toggle-sw input:checked + .toggle-slider:before { transform: translateX(16px); }

/* ══ PAN BADGES ══ */
.pan-badge-active {
  background: rgba(16,185,129,.15);
  color: #059669;
  border: 1px solid rgba(16,185,129,.3);
}

.pan-badge-inoperative {
  background: rgba(245,158,11,.15);
  color: #D97706;
  border: 1px solid rgba(245,158,11,.3);
}

/* ══ CHIP ══ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
  border: 1px solid transparent;
}

.chip-wa {
  background: rgba(34,197,94,.1);
  color: var(--gr);
  border-color: rgba(34,197,94,.2);
}

/* ══ BIZ HEADER STRIP ══ */
.biz-header-strip {
  background: linear-gradient(135deg, rgba(124,58,237,.08), rgba(99,102,241,.05));
  border: 1px solid rgba(124,58,237,.2);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
}

.biz-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.biz-header-left { flex: 1; min-width: 0; }

.biz-header-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--s2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.biz-header-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 3px;
  font-size: 10px;
  color: var(--muted);
  font-family: var(--mono);
}

.biz-header-right { flex-shrink: 0; }

/* ══ IC (icon) helper ══ */
.ic { font-size: 14px; }

/* == VERIFY CHIPS == */
.vchip { display:inline-flex;align-items:center;gap:4px;padding:3px 9px;border-radius:20px;font-size:10px;font-weight:700;letter-spacing:.2px;border:1px solid transparent;transition:all .2s ease;white-space:nowrap;vertical-align:middle;box-shadow:0 1px 3px rgba(0,0,0,.08); }
.vchip.ok  { background:var(--gr-bg);  color:var(--gr);  border-color:rgba(16,185,129,.3); }
.vchip.err { background:var(--re-bg);  color:var(--re);  border-color:rgba(239,68,68,.3);  }
.vchip.wrn { background:var(--am-bg);  color:var(--am);  border-color:rgba(245,158,11,.3); }
.vchip.inf { background:var(--bg);     color:var(--s4);  border-color:var(--border2);      }
/* == VERIFY HINTS == */
.vhint     { font-size:11px;margin-top:3px;display:block;font-weight:500; }
.vhint.ok  { color:var(--gr); }
.vhint.err { color:var(--re); }
.vhint.wrn { color:var(--am); }
.vhint.inf { color:var(--muted); }
/* == PAN ENTITY BADGE == */
.pan-entity-badge { display:inline-block;margin-left:6px;padding:1px 7px;border-radius:10px;font-size:9px;font-weight:700;vertical-align:middle;border:1px solid transparent; }
.pan-entity-badge.ok  { background:var(--gr-bg);color:var(--gr);border-color:rgba(16,185,129,.25); }
.pan-entity-badge.err { background:var(--re-bg);color:var(--re);border-color:rgba(239,68,68,.25);  }
.pan-entity-badge.wrn { background:var(--am-bg);color:var(--am);border-color:rgba(245,158,11,.25); }

/* ── Field saved state ── */
.fi.field-saved, .fs.field-saved, .fta.field-saved {
  color: var(--gr) !important;
  font-weight: 700 !important;
  border-color: var(--gr) !important;
}
