/* ✨ Hisaab Assistant - the chat window (public/js/assistant.js). Uses the app's own colour tokens (app.css). */
.asst { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); z-index: 900; display: flex; flex-direction: column; background: var(--card, #fff);
  border-left: 1px solid var(--line, #e3e8f0); box-shadow: -8px 0 30px rgba(15, 42, 92, .14); padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.asst[hidden] { display: none !important; }
.asst-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line, #e3e8f0); background: var(--navy, #0f2a5c); color: #fff; }
.asst-head b { flex: 1; font-size: 15px; }
.asst-head .btn.ghost { color: #fff; border-color: rgba(255, 255, 255, .35); }
.asst-x { background: none; border: 0; color: #fff; font-size: 18px; width: 36px; height: 36px; cursor: pointer; border-radius: 8px; }
.asst-x:hover { background: rgba(255, 255, 255, .12); }
.asst-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--bg, #f3f5fa); }
.asst-msg { max-width: 92%; padding: 10px 12px; border-radius: 12px; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; min-width: 0; }
.asst-msg p { margin: 0 0 4px; }
.asst-msg p:last-child { margin-bottom: 0; }
.asst-msg.me { align-self: flex-end; background: var(--blue, #2563eb); color: #fff; border-bottom-right-radius: 4px; }
.asst-msg.bot { align-self: flex-start; background: var(--card, #fff); border: 1px solid var(--line, #e3e8f0); border-bottom-left-radius: 4px; }
.asst-msg.card { max-width: 100%; width: 100%; }
.asst-msg.err { border-color: var(--red, #b91c1c); background: var(--red-l, #fee2e2); color: var(--red, #b91c1c); }
.asst-msg.ok { border-color: var(--green, #15803d); background: var(--green-l, #dcfce7); }
.asst-amt { font-size: 18px; font-weight: 700; }
.asst-dots { color: var(--muted, #64708a); font-style: italic; }
.asst-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.asst-chip { border: 1px solid var(--line2, #cfd7e4); background: var(--blue-l, #eaf1ff); color: var(--navy, #0f2a5c); border-radius: 16px; padding: 6px 11px; font-size: 13px; cursor: pointer; text-align: left; }
.asst-chip:hover { border-color: var(--blue, #2563eb); }
.asst-chip.new { background: var(--amber-l, #fef3c7); }
.asst-chip small { color: var(--muted, #64708a); }
.asst-chip:disabled { opacity: .55; cursor: default; }
.asst-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.asst-row .fi { flex: 1; min-width: 0; }
.asst-card-h { margin-bottom: 4px; }
.asst-new { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; font-size: 10px; font-weight: 700; background: var(--amber-l, #fef3c7); color: var(--amber, #b45309); vertical-align: middle; }
.asst-tbl { overflow-x: auto; margin: 6px 0; }
.asst-tbl table { width: 100%; border-collapse: collapse; font-size: 13px; }
.asst-tbl th, .asst-tbl td { padding: 5px 4px; border-bottom: 1px solid var(--line, #e3e8f0); text-align: left; vertical-align: top; }
.asst-tbl th { color: var(--muted, #64708a); font-weight: 600; font-size: 12px; }
.asst-tbl .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.asst-shade { background: var(--amber-l, #fef3c7); }
.asst-note { background: var(--blue-l, #eaf1ff); border-radius: 8px; padding: 6px 8px; font-size: 13px; margin: 6px 0; }
.asst-note ul, .asst-list { margin: 4px 0 0 18px; padding: 0; }
.asst-tot { display: grid; grid-template-columns: auto auto; justify-content: end; gap: 2px 14px; font-variant-numeric: tabular-nums; margin-top: 6px; }
.asst-tot b { text-align: right; }
.asst-tot .big { font-size: 16px; }
.asst-foot { display: flex; gap: 6px; align-items: flex-end; padding: 10px; border-top: 1px solid var(--line, #e3e8f0); background: var(--card, #fff); }
.asst-in { flex: 1; min-width: 0; resize: none; border: 1px solid var(--line2, #cfd7e4); border-radius: 10px; padding: 9px 10px; font: inherit; font-size: 14px; max-height: 120px; }
.asst-in:focus { outline: 2px solid var(--blue, #2563eb); outline-offset: 0; border-color: transparent; }
.asst-tool, .asst-send { width: 40px; height: 40px; padding: 0; justify-content: center; flex: none; font-size: 17px; }
.asst-fab { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 800; width: 54px; height: 54px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--blue, #2563eb), var(--navy, #0f2a5c)); color: #fff; font-size: 24px; box-shadow: 0 6px 18px rgba(15, 42, 92, .35); }
.asst-fab[hidden] { display: none; }
.asst-open .asst-fab { display: none; }
a.asst-nav { font-weight: 700; }
a.asst-nav[hidden] { display: none; }
@media (max-width: 760px) {
  .asst { width: 100vw; border-left: 0; }
  .asst-fab { bottom: calc(var(--ui-bar, 58px) + 14px + env(safe-area-inset-bottom, 0px)); right: 14px; }
}
@media print { .asst, .asst-fab { display: none !important; } }
.asst-form { display: grid; gap: 8px; margin: 6px 0; }
.asst-form label { display: grid; grid-template-columns: minmax(0, 1fr) minmax(110px, 50%); gap: 8px; align-items: center; font-size: 13px; }
.asst-form label span { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 420px) { .asst-form label { grid-template-columns: 1fr 96px; } }
.asst-edit { width: 100%; border-collapse: collapse; font-size: 13px; }
.asst-edit th { text-align: left; font-size: 11px; color: var(--muted, #64708a); padding: 2px 3px; }
.asst-edit td { padding: 2px 3px; }
.asst-edit td:first-child { min-width: 120px; }
.asst-edit .fi { width: 100%; min-width: 56px; padding: 5px 6px; }
.asst-edit td:nth-child(3) .fi { min-width: 84px; }
