/* =========================================================
   SHAREBUY — ops.css
   Reports, AI assistant, intelligence, tax, approvals,
   documents, audit, users and settings.
   ========================================================= */

/* ---------- Reports ---------- */
.rep-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 18px; align-items: start; }
.rep-list { padding: 8px; position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; }
.rep-item { display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; padding: 10px; border: 1px solid transparent; border-radius: 12px; background: none; cursor: pointer; color: var(--text-2); transition: all .2s; }
.rep-item:hover { background: rgba(255,255,255,.03); color: var(--text); }
.rep-item.active { background: var(--gold-dim); border-color: var(--gold-line); color: var(--text); }
.rep-item .kpi-ic { width: 32px; height: 32px; flex: none; }
.rep-item b { display: block; font-size: 13px; font-weight: 500; }
.rep-item small { display: block; font-size: 11px; color: var(--text-3); line-height: 1.35; }
.rep-filters { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.rep-filter-row { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 12px; }
.rep-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.rep-kpi { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.rep-kpi span { font-size: 11.5px; color: var(--text-2); }
.rep-kpi b { display: block; font-size: 19px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep-note { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); margin-top: 12px; }
.rep-note.gold { color: var(--gold-2); }
.rep-note svg { width: 14px; height: 14px; }
.rep-table .rep-sec td { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); font-weight: 600; padding-top: 18px; background: rgba(214,173,96,.03); }
.rep-table .rep-tot td { font-weight: 600; border-top: 1px solid var(--line-2); background: rgba(255,255,255,.015); }

/* ---------- AI assistant ---------- */
.ai-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.ai-chat { display: flex; flex-direction: column; padding: 0; height: calc(100vh - var(--topbar) - 170px); min-height: 520px; overflow: hidden; }
.ai-chat-head { padding: 16px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(214,173,96,.06), transparent); }
.ai-chat-head b { display: block; font-size: 14px; }
.ai-chat-head small { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-2); }
.live-dot { width: 8px !important; height: 8px !important; color: var(--success); fill: var(--success); }
.ai-av { width: 34px; height: 34px; border-radius: 50%; flex: none; }
.ai-av.mark { display: grid; place-items: center; border-radius: 10px; }
.ai-av.mark svg { width: 34px; height: 34px; }
.ai-thread { flex: 1; overflow-y: auto; padding: 22px 20px; display: flex; flex-direction: column; gap: 18px; scroll-behavior: smooth; }
.ai-msg { display: flex; gap: 12px; align-items: flex-start; animation: viewIn .4s var(--ease) both; }
.ai-msg.user { justify-content: flex-end; }
.ai-msg.user .ai-bubble { background: linear-gradient(180deg, #E2BD74, #C99B4B); color: #17120A; border: 0; font-weight: 500; border-radius: 16px 16px 4px 16px; max-width: 70%; }
.ai-bubble { background: var(--elev); border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; padding: 14px 16px; max-width: min(760px, 88%); min-width: 0; }
.ai-msg.bot .ai-bubble { flex: 1; }
.ai-lead { font-size: 14.5px; line-height: 1.6; margin-bottom: 12px; }
.ai-lead b.gold { color: var(--gold-2); font-weight: 600; }
.ai-answer > *:last-child { margin-bottom: 0; }
.ai-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.ai-kpi { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.ai-kpi span { font-size: 11px; color: var(--text-2); display: block; }
.ai-kpi b { display: block; font-size: 17px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-kpi b.gold { color: var(--gold-2); }
.ai-kpi small { font-size: 11px; color: var(--text-3); }
.ai-block { margin-bottom: 14px; }
.ai-block-title { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); font-weight: 600; margin-bottom: 8px; }
.ai-bar { display: grid; grid-template-columns: minmax(110px, 190px) 1fr auto auto; gap: 10px; align-items: center; padding: 5px 0; font-size: 12.5px; }
.ai-bar-l { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-bar-t { height: 6px; background: rgba(255,255,255,.06); border-radius: 6px; overflow: hidden; }
.ai-bar-t i { display: block; height: 100%; width: var(--w); background: linear-gradient(90deg, #A9843F, var(--gold)); border-radius: 6px; animation: grow 1s var(--ease) both; }
.ai-bar b { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.ai-bar em { font-style: normal; font-size: 11px; color: var(--text-3); min-width: 34px; text-align: right; }
.ai-table td, .ai-table th { padding: 8px 10px; }
.ai-table td small { font-size: 11px; }
.ai-recs { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.ai-rec { display: flex; gap: 10px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); }
.ai-rec.gold { border-color: var(--gold-line); background: rgba(214,173,96,.05); }
.ai-rec.warn { border-color: rgba(233,182,92,.3); background: var(--warning-dim); }
.ai-rec-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--elev-2); color: var(--gold); }
.ai-rec-ic svg { width: 15px; height: 15px; }
.ai-rec b { font-size: 12.5px; font-weight: 600; display: block; }
.ai-rec p { font-size: 12px; color: var(--text-2); margin-top: 2px; line-height: 1.45; }
.ai-follow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.ai-follow .chip { height: 30px; font-size: 12px; }
.ai-follow .chip svg { width: 13px; height: 13px; }
.ai-typing { display: flex; align-items: center; gap: 5px; color: var(--text-2); font-size: 12.5px; }
.ai-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); animation: aiDot 1.1s infinite ease-in-out; }
.ai-typing i:nth-child(2) { animation-delay: .15s; }
.ai-typing i:nth-child(3) { animation-delay: .3s; }
.ai-typing span { margin-left: 8px; }
@keyframes aiDot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.ai-reveal { animation: aiReveal .55s var(--ease) both; }
@keyframes aiReveal { from { opacity: 0; transform: translateY(8px); } }
.ai-input { display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); }
.ai-input .input { height: 46px; font-size: 14px; }
.ai-input .btn { height: 46px; }
.ai-disclaimer { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 11px; color: var(--text-3); padding: 0 16px 12px; text-align: center; }
.ai-disclaimer svg { width: 13px; height: 13px; }
.ai-empty { margin: auto; text-align: center; max-width: 640px; padding: 20px 0; }
.ai-empty-mark { display: inline-block; margin-bottom: 14px; }
.ai-empty-mark svg { width: 56px; height: 56px; }
.ai-empty h3 { font-family: var(--serif); font-size: 30px; }
.ai-empty p { color: var(--text-2); margin: 6px auto 20px; max-width: 460px; }
.ai-starters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; text-align: left; }
.ai-starter { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text-2); cursor: pointer; font-size: 13px; transition: all .2s; }
.ai-starter:hover { border-color: var(--gold-line); color: var(--text); }
.ai-starter svg { color: var(--gold); width: 16px; height: 16px; }
.ai-side-q { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 0; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--text-2); cursor: pointer; font-size: 12.5px; text-align: left; }
.ai-side-q:last-child { border-bottom: 0; }
.ai-side-q:hover { color: var(--text); }
.ai-side-q span { flex: 1; }
.ai-side-q svg:first-child { color: var(--gold); width: 15px; height: 15px; }

/* ---------- Financial intelligence ---------- */
.gauge { position: relative; height: 170px; }
.gauge-center { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; pointer-events: none; }
.gauge-center b { display: block; font-size: 44px; font-weight: 600; letter-spacing: -.03em; font-family: var(--serif); color: var(--gold-2); line-height: 1; }
.gauge-center small { font-size: 11px; color: var(--text-3); letter-spacing: .14em; text-transform: uppercase; }
.intel-cards { gap: 14px; }
.intel-card { display: flex; flex-direction: column; gap: 4px; }
.intel-card .kpi-value { font-size: 22px; }
.intel-text { font-size: 12px; color: var(--text-2); line-height: 1.45; }
.intel-tone { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.intel-card.good .intel-tone { background: var(--success); box-shadow: 0 0 0 4px var(--success-dim); }
.intel-card.warn .intel-tone { background: var(--warning); box-shadow: 0 0 0 4px var(--warning-dim); }
.intel-card.bad .intel-tone { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-dim); }

/* ---------- Tax ---------- */
.tax-banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; border: 1px solid rgba(233,182,92,.3); background: var(--warning-dim); color: var(--text-2); font-size: 12.5px; }
.tax-banner svg { color: var(--warning); margin-top: 1px; }
.tax-banner b { color: var(--text); }
.list-item.tax-done b { color: var(--text-3); text-decoration: line-through; }

/* ---------- Approvals ---------- */
.apr-grid { align-items: stretch; }
.apr-card { display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.apr-card:hover { border-color: var(--gold-line); transform: translateY(-2px); }
.apr-card.pending { background: linear-gradient(180deg, rgba(214,173,96,.05), rgba(214,173,96,0) 45%), var(--card); }
.apr-card.critical.pending { border-color: var(--gold-line); box-shadow: var(--shadow), 0 0 0 1px rgba(214,173,96,.08); }
.apr-type { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.apr-type svg { width: 15px; height: 15px; }
.apr-title { font-family: var(--serif); font-size: 22px; margin-top: 6px; }
.apr-item { color: var(--text-2); font-size: 12.5px; min-height: 36px; }
.apr-amount { font-size: 28px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin: 6px 0; }
.apr-card.pending .apr-amount { color: var(--gold-2); }
.apr-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.apr-meta > span:first-child { display: flex; align-items: center; gap: 10px; min-width: 0; }
.apr-meta b { display: block; font-size: 12.5px; font-weight: 500; }
.apr-meta small { font-size: 11px; color: var(--text-3); }
.apr-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: auto; padding-top: 12px; flex-wrap: wrap; }
.apr-hero { align-items: center; }
.apr-hero-img { width: 150px; height: 96px; object-fit: cover; border-radius: 12px; flex: none; }
.apr-impact { padding: 12px 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.apr-impact span { font-size: 11.5px; color: var(--text-2); display: block; }
.apr-impact b { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.apr-impact.neg b { color: var(--danger); }
.apr-remarks { display: flex; flex-direction: column; gap: 12px; }
.apr-remark { display: flex; gap: 10px; }
.apr-remark p { font-size: 13px; color: var(--text-2); margin-top: 2px; }

/* ---------- Documents ---------- */
.doc-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; align-items: start; }
.doc-side { position: sticky; top: 0; }
.doc-cat { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 10px; border: 0; background: none; color: var(--text-2); cursor: pointer; font-size: 13px; text-align: left; }
.doc-cat:hover { background: rgba(255,255,255,.03); color: var(--text); }
.doc-cat.active { background: var(--gold-dim); color: var(--gold-2); }
.doc-cat span { flex: 1; }
.doc-cat em { font-style: normal; font-size: 11px; color: var(--text-3); }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.doc-card { display: flex; flex-direction: column; gap: 4px; padding: 14px; }
.doc-thumb { position: relative; height: 110px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-2); border: 1px solid var(--line); margin-bottom: 8px; overflow: hidden; color: var(--text-2); }
.doc-thumb svg { width: 34px; height: 34px; }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-thumb.t-pdf { color: #E58C8C; }
.doc-thumb.t-xlsx, .doc-thumb.t-csv { color: #7DB8A6; }
.doc-thumb.t-docx { color: #8FA7C9; }
.doc-thumb.t-jpg, .doc-thumb.t-png { color: var(--gold); }
.doc-ext { position: absolute; right: 8px; bottom: 8px; font-size: 9.5px; letter-spacing: .1em; font-weight: 700; padding: 2px 6px; border-radius: 5px; background: rgba(0,0,0,.5); color: var(--text-2); }
.doc-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-foot { margin-top: 8px; }
.doc-preview { display: grid; place-items: center; background: var(--bg-2); border-radius: 12px; padding: 12px; }
.doc-preview img { max-width: 100%; max-height: 65vh; border-radius: 8px; }
.doc-frame { width: 100%; height: 65vh; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.doc-paper { max-width: 620px; margin: 0 auto; padding: 28px; border-radius: 12px; background: linear-gradient(180deg, #1C232E, #161C25); border: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 16px; }
.doc-paper .brand-mark { width: 30px; height: 30px; }
.doc-paper h2 { font-family: var(--serif); font-size: 26px; padding-bottom: 12px; border-bottom: 1px solid var(--gold-line); }
.doc-lines { display: flex; flex-direction: column; gap: 8px; }
.doc-lines i { display: block; height: 7px; border-radius: 4px; background: rgba(255,255,255,.06); width: 100%; }

/* ---------- Audit timeline ---------- */
.timeline { position: relative; padding-left: 4px; }
.tl-day { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); font-weight: 600; margin: 18px 0 10px 50px; }
.tl-day:first-child { margin-top: 4px; }
.tl-item { position: relative; display: flex; gap: 14px; padding-bottom: 16px; }
.tl-item::before { content: ''; position: absolute; left: 17px; top: 38px; bottom: 0; width: 1px; background: var(--line-2); }
.tl-dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--elev); border: 1px solid var(--line-2); color: var(--gold); z-index: 1; }
.tl-dot svg { width: 15px; height: 15px; }
.tl-item.fail .tl-dot { color: var(--danger); background: var(--danger-dim); border-color: rgba(241,109,117,.3); }
.tl-body { flex: 1; min-width: 0; padding: 10px 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.tl-body b { font-size: 13px; font-weight: 600; }
.tl-body p { font-size: 12.5px; color: var(--text-2); margin: 2px 0 8px; }
.tl-meta { gap: 8px; }
.tl-meta small { font-size: 11.5px; color: var(--text-2); }
.avatar.xs { width: 22px; height: 22px; font-size: 9px; }

/* ---------- Users & roles ---------- */
.role-pick { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.role-opt { text-align: left; padding: 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); cursor: pointer; transition: all .2s; }
.role-opt:hover { border-color: rgba(255,255,255,.2); }
.role-opt.active { border-color: var(--gold-line); background: var(--gold-dim); }
.role-opt b { display: block; font-size: 13.5px; }
.role-opt.active b { color: var(--gold-2); }
.role-opt small { display: block; font-size: 11.5px; color: var(--text-2); margin-top: 4px; line-height: 1.4; }
.perm { width: 24px; height: 24px; border-radius: 7px; display: inline-grid; place-items: center; }
.perm svg { width: 14px; height: 14px; }
.perm.yes { background: var(--success-dim); color: var(--success); }
.perm.no { background: rgba(255,255,255,.04); color: var(--text-3); }
.perm-table tr.perm-current td { background: rgba(214,173,96,.05); }

/* ---------- Settings ---------- */
.settings-grid { align-items: start; }
.settings-grid .card-head h3 { display: flex; align-items: center; gap: 8px; }
.settings-grid .card-head h3 svg { color: var(--gold); width: 17px; height: 17px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.set-row:last-of-type { border-bottom: 0; }
.set-row b { display: block; font-size: 13px; font-weight: 500; }
.set-row small { display: block; font-size: 11.5px; color: var(--text-3); }
.seg-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.seg-opt { padding: 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; transition: all .2s; }
.seg-opt input { display: none; }
.seg-opt b { display: block; font-size: 13px; }
.seg-opt small { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.seg-opt.active { border-color: var(--gold-line); background: var(--gold-dim); }
.seg-opt.active b { color: var(--gold-2); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px 0 8px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text-2); cursor: pointer; font-size: 12.5px; }
.swatch span { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(255,255,255,.15); }
.swatch.active { border-color: var(--gold-line); color: var(--text); background: var(--gold-dim); }

/* Themes & accents (applied to body) */
body.theme-onyx { --bg: #030304; --bg-2: #0A0B0D; --card: #0F1114; --elev: #15181C; --elev-2: #1B1F25; }
body.theme-navy { --bg: #070B14; --bg-2: #0C1220; --card: #121A2B; --elev: #182236; --elev-2: #1F2B42; }
body.accent-champagne { --gold: #E6CFA0; --gold-2: #F6E8C8; --gold-dim: rgba(230,207,160,.14); --gold-line: rgba(230,207,160,.38); }
body.accent-platinum { --gold: #C9CED6; --gold-2: #EEF1F5; --gold-dim: rgba(201,206,214,.12); --gold-line: rgba(201,206,214,.35); }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .rep-layout, .doc-layout, .ai-layout { grid-template-columns: 1fr; }
  .rep-list { position: static; flex-direction: row; overflow-x: auto; }
  .rep-item { min-width: 220px; }
  .doc-side { position: static; }
  .ai-side { display: none; }
  .role-pick { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .rep-filter-row, .rep-kpis { grid-template-columns: 1fr 1fr; }
  .rep-filter-row .field:last-child { grid-column: 1 / -1; }
  .ai-chat { height: calc(100vh - 210px); min-height: 460px; }
  .ai-starters { grid-template-columns: 1fr; }
  .ai-bubble { max-width: 100%; }
  .ai-msg.user .ai-bubble { max-width: 85%; }
  .ai-msg .ai-av { display: none; }
  .ai-bar { grid-template-columns: 1fr auto; }
  .ai-bar-t { grid-column: 1 / -1; grid-row: 2; }
  .ai-bar em { display: none; }
  .role-pick, .seg-opts { grid-template-columns: 1fr; }
  .apr-hero { flex-direction: column; align-items: flex-start; }
  .apr-hero-img { width: 100%; height: 150px; }
  .doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tl-day { margin-left: 0; }
}

/* Labelled theme/accent swatches — override the round colour-dot swatches from money.css */
.swatches .swatch { width: auto; height: 38px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); box-shadow: none; transform: none; }
.swatches .swatch:hover { transform: none; border-color: var(--gold-line); }
.swatches .swatch.active { border-color: var(--gold-line); background: var(--gold-dim); }
.swatches:has(.swatch) { height: auto; }
