/* =========================================================
   SHAREBUY — Money modules (transactions, accounts, income,
   expenses, bills & invoices)
   ========================================================= */

/* ---------- Shared helpers ---------- */
.nowrap { white-space: nowrap; }
.ic.tiny, svg.tiny { width: 12px; height: 12px; vertical-align: -2px; }
.clickable-row { cursor: pointer; border-radius: 10px; transition: background .15s; }
.clickable-row:hover { background: rgba(255, 255, 255, 0.025); }
.list-item.clickable-row { padding-left: 6px; padding-right: 6px; }
.table th[data-dir="asc"]::after { content: ' ↑'; }
.table th[data-dir="desc"]::after { content: ' ↓'; }
.sub-head { display: flex; align-items: center; gap: 8px; padding: 14px 20px 6px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-2); font-weight: 600; }
.sub-head svg { width: 14px; height: 14px; color: var(--gold); }

.alert { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--elev); }
.alert > svg { width: 20px; height: 20px; flex: none; }
.alert > div { flex: 1; display: flex; flex-direction: column; font-size: 13px; }
.alert > div span { color: var(--text-2); font-size: 12.5px; }
.alert-danger { border-color: rgba(241, 109, 117, 0.3); background: linear-gradient(90deg, rgba(241, 109, 117, 0.09), rgba(241, 109, 117, 0.02)); }
.alert-danger > svg { color: var(--danger); }

/* ---------- Transactions ---------- */
.tx-filters { padding: 18px 20px 16px; border-bottom: 1px solid var(--line); }
.tx-search { width: min(340px, 100%); }
.field-inline { display: inline-flex; align-items: center; gap: 8px; }
.field-inline span { font-size: 12px; color: var(--text-3); }
.field-inline .input { min-width: 0 !important; width: 150px !important; }
.type-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.type-seg button {
  height: 44px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text-2);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 500; transition: all .2s;
}
.type-seg button svg { width: 16px; height: 16px; }
.type-seg button:hover { color: var(--text); }
.type-seg button.active { border-color: var(--gold-line); background: var(--gold-dim); color: var(--gold-2); }
.note-box { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); color: var(--text-2); font-size: 13px; }
.note-box svg { color: var(--gold); width: 16px; height: 16px; margin-top: 2px; }
.receipt-box { padding: 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.receipt-box img { display: block; max-width: 100%; max-height: 320px; margin-top: 10px; border-radius: 8px; border: 1px solid var(--line); }

/* ---------- Bank cards ---------- */
.acct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.bank-card {
  --c: #D6AD60;
  position: relative; min-height: 196px; padding: 20px 20px 18px; border-radius: 18px; cursor: pointer; overflow: hidden;
  display: flex; flex-direction: column; gap: 10px; isolation: isolate;
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--c) 26%, transparent), transparent 60%),
    linear-gradient(150deg, #1B222D 0%, #12161D 70%);
  border: 1px solid color-mix(in srgb, var(--c) 28%, rgba(255, 255, 255, 0.06));
  box-shadow: var(--shadow);
  transition: transform .4s var(--ease), border-color .3s, box-shadow .4s var(--ease);
}
.bank-card::before {
  content: ''; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background: repeating-linear-gradient(115deg, transparent 0 22px, rgba(255, 255, 255, 0.018) 22px 23px);
}
.bank-card::after {
  content: ''; position: absolute; right: -60px; bottom: -80px; width: 220px; height: 220px; border-radius: 50%; z-index: -1;
  border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
}
.bank-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--c) 55%, transparent); box-shadow: 0 30px 50px -30px color-mix(in srgb, var(--c) 45%, transparent); }
.bank-card:focus-visible { outline: 2px solid var(--gold-line); }
.bc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.bc-top small { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); display: block; }
.bc-top b { font-weight: 600; font-size: 15px; display: block; margin-top: 2px; }
.bc-type { font-size: 10.5px; padding: 3px 9px; border-radius: 20px; color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); white-space: nowrap; }
.bc-chip { width: 38px; height: 28px; border-radius: 6px; display: grid; place-items: center; color: #1a1408;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 70%, #fff 30%), var(--c)); opacity: .9; }
.bc-chip svg { width: 15px; height: 15px; }
.bc-bal { margin-top: auto; }
.bc-bal small { font-size: 11px; color: var(--text-3); display: block; }
.bc-bal b { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; display: block; }
.bc-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); letter-spacing: .12em; }
.bc-actions { position: absolute; right: 14px; bottom: 44px; display: flex; gap: 6px; opacity: 0; transform: translateY(4px); transition: all .25s var(--ease); }
.bank-card:hover .bc-actions, .bank-card:focus-within .bc-actions { opacity: 1; transform: none; }
.bc-actions .icon-btn { background: rgba(8, 10, 14, 0.7); backdrop-filter: blur(6px); }
.bank-card.big { cursor: default; min-height: 210px; }
.bank-card.big:hover { transform: none; }
.bank-card.big .bc-bal b { font-size: 28px; }
.bank-card.big .bc-bal small.num { font-size: 12px; color: var(--gold); margin-top: 2px; }
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .bank-card { background: linear-gradient(150deg, #1B222D, #12161D); border-color: var(--line-2); }
  .bc-chip { background: var(--c); }
  .bc-type { color: var(--gold); border-color: var(--gold-line); }
}

.swatches { display: flex; gap: 8px; flex-wrap: wrap; height: 40px; align-items: center; }
.swatches button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; background: var(--c); cursor: pointer; box-shadow: 0 0 0 1px rgba(255,255,255,.1) inset; transition: transform .2s; }
.swatches button:hover { transform: scale(1.1); }
.swatches button.active { border-color: var(--text); }

.quick-amts { display: flex; gap: 6px; margin-top: 6px; }
.quick-amts .chip { height: 26px; font-size: 11.5px; padding: 0 10px; }
.trf-flow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.trf-flow > svg { color: var(--gold); }
.trf-flow small { display: block; font-size: 11px; color: var(--text-3); }
.trf-flow b { font-size: 13px; font-variant-numeric: tabular-nums; }
.trf-flow.bad { border-color: rgba(241, 109, 117, 0.35); }
.trf-preview p { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.trf-preview p svg { width: 14px; height: 14px; }

/* ---------- Expenses ---------- */
.limits { display: flex; flex-direction: column; gap: 16px; }
.limit-row { display: flex; flex-direction: column; gap: 7px; }
.limit-row > .row span { font-size: 13px; }
.limit-row b { font-size: 12.5px; }
.limit-row small { font-size: 11px; }

/* ---------- Invoice editor ---------- */
.inv-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.li-head, .li-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px 170px 150px 32px; gap: 10px; align-items: center; }
.li-head { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); font-weight: 600; padding: 0 2px 8px; border-bottom: 1px solid var(--line); }
.li-row { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.li-amt { text-align: right; font-weight: 600; font-size: 13px; }
.inv-bottom { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.inv-bottom .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.inv-sum { padding: 16px 18px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); }
.inv-total { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; padding-top: 12px; margin-top: 6px; border-top: 1px solid var(--gold-line); }
.inv-total span { color: var(--text-2); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.inv-total b { font-size: 22px; font-weight: 600; color: var(--gold-2); font-variant-numeric: tabular-nums; }
.inv-total small { width: 100%; text-align: right; color: var(--text-3); font-size: 11.5px; }

/* ---------- Invoice document (paper) ---------- */
.invoice-doc {
  background: #FBFAF6; color: #17181C; border-radius: 14px; padding: 32px 34px; font-size: 13px;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.9); position: relative; overflow: hidden;
}
.invoice-doc::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: linear-gradient(90deg, #9C7430, #D6AD60, #F2D89C); }
.invoice-doc .muted, .invoice-doc p { color: #6A6E78; }
.id-head { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 20px; border-bottom: 1px solid #E5E1D6; }
.id-head p { font-size: 12px; margin-top: 8px; line-height: 1.6; }
.id-head h2 { font-family: var(--serif); font-size: 30px; font-weight: 600; color: #17181C; }
.id-head .r b { display: block; letter-spacing: .04em; }
.id-brand { display: flex; align-items: center; gap: 10px; }
.id-brand b { letter-spacing: .3em; font-size: 14px; display: block; }
.id-brand small { color: #8A6A2C; font-size: 11px; letter-spacing: .06em; }
.id-parties { display: flex; justify-content: space-between; gap: 24px; padding: 18px 0; }
.id-parties small { display: block; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: #8A8E98; margin-bottom: 4px; }
.id-parties b { font-size: 15px; }
.id-parties p { font-size: 12px; line-height: 1.6; margin-top: 4px; }
.id-table { width: 100%; border-collapse: collapse; }
.id-table th { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #8A8E98; text-align: left; padding: 10px 8px; border-bottom: 1px solid #17181C; }
.id-table td { padding: 12px 8px; border-bottom: 1px solid #ECE8DE; }
.id-table .r { text-align: right; }
.id-totals { margin-left: auto; width: min(320px, 100%); margin-top: 14px; }
.id-totals > div { display: flex; justify-content: space-between; padding: 7px 8px; font-variant-numeric: tabular-nums; }
.id-totals span { color: #6A6E78; }
.id-totals .grand { margin-top: 6px; padding: 12px; border-radius: 10px; background: #17181C; color: #F2D89C; }
.id-totals .grand span { color: #D8D4C8; letter-spacing: .1em; text-transform: uppercase; font-size: 11px; align-self: center; }
.id-totals .grand b { font-size: 18px; }
.id-note { margin-top: 26px; font-size: 10.5px; color: #A0A3AB !important; text-align: center; letter-spacing: .06em; }
.invoice-doc .badge-success { background: #E2F5EC; color: #1E8F62; }
.invoice-doc .badge-warning { background: #FBF0DA; color: #A87318; }
.invoice-doc .badge-danger { background: #FCE6E7; color: #C43F48; }
.invoice-doc .badge-muted { background: #EEECE6; color: #6A6E78; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .inv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inv-bottom { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .acct-grid { grid-template-columns: 1fr; }
  .bc-actions { opacity: 1; transform: none; position: static; justify-content: flex-end; }
  .inv-grid, .inv-bottom .form-grid { grid-template-columns: 1fr; }
  .li-head { display: none; }
  .li-row { grid-template-columns: 1fr 70px 32px; grid-template-areas: 'd d d' 'q p x' 'a a a'; }
  .li-row [data-k=desc] { grid-area: d; }
  .li-row [data-k=qty] { grid-area: q; }
  .li-row .money-input { grid-area: p; grid-column: 2 / 3; }
  .li-row { grid-template-columns: 70px 1fr 32px; grid-template-areas: 'd d d' 'q p x' 'a a a'; }
  .li-row .money-input { grid-area: p; }
  .li-row [data-rm] { grid-area: x; }
  .li-row .li-amt { grid-area: a; }
  .invoice-doc { padding: 22px 18px; }
  .id-head, .id-parties { flex-direction: column; }
  .id-head .r, .id-parties .r { text-align: left; }
  .field-inline .input { width: 100% !important; }
  .field-inline { flex: 1; }
  .type-seg button { font-size: 12px; }
  .trf-flow { flex-direction: column; align-items: flex-start; }
}
