/* المحفظة والتدفقات النقدية — inspired by cashflow/ & wallt/ mockups */
.cw-year-lbl { font-size: 11px; font-weight: 700; color: var(--text-m); }

.cw-app { display: flex; flex-direction: column; gap: 16px; }
.cw-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.cw-tab {
  padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--border);
  background: #fff; font-size: 12px; font-weight: 700; cursor: pointer; transition: var(--tr);
}
.cw-tab.active { background: var(--odoo-purple); color: #fff; border-color: var(--odoo-purple); }
.cw-tab:hover:not(.active) { background: var(--odoo-purple-l); color: var(--odoo-purple); }

.cw-panel { display: none; }
.cw-panel.active { display: block; }

.cw-filter-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 10px 12px; background: var(--surface2, #f8fafc);
  border: 1px solid var(--border); border-radius: var(--r-lg);
}
.cw-month-strip { display: flex; gap: 4px; flex-wrap: wrap; }
.cw-month-btn {
  padding: 5px 10px; font-size: 10px; font-weight: 700; border: 1px solid var(--border);
  border-radius: 20px; background: #fff; cursor: pointer; transition: var(--tr);
}
.cw-month-btn.active { background: linear-gradient(135deg, #714B67, #017E84); color: #fff; border-color: transparent; }
.cw-month-btn:hover:not(.active) { background: var(--odoo-purple-l); }

/* ── Dashboard grid (wallt mockup) ── */
.cw-dash-grid {
  display: grid; grid-template-columns: 1.15fr 0.9fr 0.95fr; gap: 16px; align-items: start;
}
@media (max-width: 1200px) { .cw-dash-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 800px) { .cw-dash-grid { grid-template-columns: 1fr; } }
.cw-col-mid, .cw-col-right { display: flex; flex-direction: column; gap: 16px; }

.cw-widget {
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--sh-sm, 0 2px 8px rgba(0,0,0,.04)); overflow: hidden;
}
.cw-widget-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface2, #fafafa);
}
.cw-widget-title { font-size: 13px; font-weight: 800; color: var(--text); }
.cw-widget-body { padding: 14px 16px; }
.cw-widget-body-scroll { max-height: 320px; overflow-y: auto; }
.cw-accounts-widget { margin-top: 16px; }

.cw-balance-tabs, .cw-period-tabs { display: flex; gap: 4px; }
.cw-btab, .cw-ptab {
  padding: 4px 10px; font-size: 10px; font-weight: 700; border-radius: 999px;
  border: 1px solid var(--border); background: #fff; cursor: pointer; transition: var(--tr);
}
.cw-btab.active, .cw-ptab.active { background: #111; color: #fff; border-color: #111; }
.cw-btab:hover:not(.active), .cw-ptab:hover:not(.active) { background: var(--odoo-purple-l); }

/* ── Balance hero card ── */
.cw-balance-widget .cw-widget-body { padding: 0; }
.cw-balance-card {
  border-radius: 0 0 var(--r-lg) var(--r-lg); padding: 20px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #714B67 0%, #017E84 55%, #6366f1 100%);
  min-height: 280px; box-shadow: inset 0 1px 0 rgba(255,255,255,.15);
}
.cw-glass-deco {
  position: absolute; width: 140px; height: 140px; top: -20px; left: -20px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.35), rgba(255,255,255,.05) 60%, transparent 70%);
  filter: blur(1px); pointer-events: none;
}
.cw-balance-card::after {
  content: ''; position: absolute; width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255,255,255,.06); bottom: -60px; right: -40px; pointer-events: none;
}
.cw-balance-label { font-size: 11px; opacity: .85; font-weight: 700; letter-spacing: .5px; position: relative; }
.cw-balance-total { font-size: 32px; font-weight: 900; font-family: var(--mono); margin: 8px 0 4px; position: relative; }
.cw-balance-sub { font-size: 11px; opacity: .9; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; position: relative; }
.cw-balance-sub span,
.cw-balance-sub .cw-split-pill { background: rgba(255,255,255,.15); padding: 4px 10px; border-radius: 20px; font-weight: 700; }

.cw-mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; position: relative; }
.cw-mini-stat {
  background: rgba(255,255,255,.12); border-radius: var(--r); padding: 10px 12px; backdrop-filter: blur(4px);
}
.cw-mini-stat .lbl { font-size: 9px; opacity: .85; }
.cw-mini-stat .val { font-size: 14px; font-weight: 800; font-family: var(--mono); margin-top: 2px; }

.cw-chart-wrap { margin-top: 16px; position: relative; }
.cw-chart-legend { display: flex; gap: 14px; font-size: 9px; opacity: .9; margin-bottom: 8px; position: relative; }
.cw-chart-legend span { display: flex; align-items: center; gap: 4px; }
.cw-leg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.cw-leg-in { background: linear-gradient(180deg, #22c55e, #15803d); }
.cw-leg-out { background: linear-gradient(180deg, #f87171, #dc2626); }
.cw-leg-profit { background: #f59e0b; border-radius: 50%; width: 8px; height: 8px; }
.cw-chart-area { position: relative; height: 120px; }
.cw-chart-bars {
  display: flex; align-items: flex-end; gap: 8px; height: 100%; padding-top: 8px; position: relative; z-index: 1;
}
.cw-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.cw-bar-in { width: 100%; max-width: 28px; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, #22c55e, #15803d); min-height: 4px; }
.cw-bar-out { width: 100%; max-width: 28px; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, #f87171, #dc2626); min-height: 4px; margin-top: 2px; }
.cw-bar-lbl { font-size: 8px; color: rgba(255,255,255,.75); font-weight: 700; }
.cw-profit-line {
  position: absolute; inset: 8px 0 18px 0; width: 100%; height: calc(100% - 26px);
  pointer-events: none; z-index: 2;
}
.cw-profit-line polyline { fill: none; stroke: #fbbf24; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.cw-profit-line circle { fill: #fbbf24; stroke: #fff; stroke-width: 1.5; }

/* ── Budget progress (wallt) ── */
.cw-budget-row { margin-bottom: 12px; }
.cw-budget-row:last-child { margin-bottom: 0; }
.cw-budget-meta { display: flex; justify-content: space-between; font-size: 11px; font-weight: 700; margin-bottom: 6px; }
.cw-budget-meta .muted { color: var(--text-m); font-weight: 600; }
.cw-progress-track {
  height: 10px; border-radius: 999px; background: #eef2f0; overflow: hidden;
}
.cw-progress-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #714B67, #ec4899, #6366f1);
  transition: width .4s ease;
}
.cw-budget-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.cw-budget-stat {
  padding: 10px 12px; border-radius: var(--r); background: var(--surface2, #f8fafc);
  border: 1px solid var(--border);
}
.cw-budget-stat .lbl { font-size: 10px; color: var(--text-m); font-weight: 700; }
.cw-budget-stat .val { font-size: 16px; font-weight: 900; font-family: var(--mono); margin-top: 4px; color: var(--odoo-purple); }

/* ── Donut charts ── */
.cw-donut-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: center; }
.cw-donut {
  width: 120px; height: 120px; border-radius: 50%; position: relative; flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(113,75,103,.15);
}
.cw-donut-hole {
  position: absolute; inset: 22px; border-radius: 50%; background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.cw-donut-val { font-size: 14px; font-weight: 900; font-family: var(--mono); color: var(--odoo-purple); line-height: 1.1; }
.cw-donut-lbl { font-size: 9px; color: var(--text-m); font-weight: 700; margin-top: 2px; }
.cw-donut-legend { flex: 1; min-width: 120px; display: flex; flex-direction: column; gap: 6px; }
.cw-donut-leg-item { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; }
.cw-donut-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.cw-donut-leg-amt { margin-right: auto; font-family: var(--mono); font-size: 10px; color: var(--text-m); }

/* ── Stacked account cards (wallt visa stack) ── */
.cw-stacked-cards {
  display: flex; flex-direction: column; gap: 18px;
  height: auto; min-height: 180px; margin-bottom: 8px;
}
.cw-currency-block { display: flex; flex-direction: column; gap: 8px; }
.cw-currency-label {
  font-size: 11px; font-weight: 800; color: var(--text-m);
  display: flex; align-items: center; gap: 6px;
}
.cw-currency-stack { position: relative; height: 180px; }
.cw-stack-card {
  position: absolute; right: 0; left: 0; border-radius: 16px; padding: 16px 18px; color: #fff;
  cursor: pointer; transition: transform .2s, box-shadow .2s; box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
.cw-stack-card:hover { transform: translateY(-4px) scale(1.01); z-index: 10 !important; }
.cw-currency-stack .cw-stack-card:nth-child(1) { top: 0; z-index: 3; }
.cw-currency-stack .cw-stack-card:nth-child(2) { top: 28px; z-index: 2; transform: scale(.96); opacity: .92; }
.cw-currency-stack .cw-stack-card:nth-child(3) { top: 52px; z-index: 1; transform: scale(.92); opacity: .85; }
.cw-stack-card:hover { transform: translateY(-4px) scale(1.02) !important; opacity: 1 !important; }
.cw-stack-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.cw-stack-brand { font-size: 10px; font-weight: 900; letter-spacing: 1px; opacity: .9; }
.cw-stack-chip { width: 34px; height: 26px; border-radius: 5px; background: rgba(255,255,255,.28); }
.cw-stack-balance { font-size: 20px; font-weight: 900; font-family: var(--mono); }
.cw-stack-balance small { font-size: 10px; opacity: .85; margin-left: 4px; }
.cw-stack-foot { display: flex; justify-content: space-between; margin-top: 12px; font-size: 10px; opacity: .88; font-weight: 700; }
.cw-stack-empty {
  text-align: center; padding: 40px 16px; color: var(--text-m); font-size: 12px;
  border: 2px dashed var(--border); border-radius: var(--r-lg);
}
.cw-stack-empty-sm { padding: 24px 12px; font-size: 11px; min-height: 80px; }

/* ── Quick actions ── */
.cw-quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cw-qact {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px;
  border: 1px solid var(--border); border-radius: var(--r-lg); background: #fff; cursor: pointer;
  transition: var(--tr); font-size: 10px; font-weight: 700; color: var(--text);
}
.cw-qact:hover { border-color: var(--odoo-purple); background: var(--odoo-purple-l); color: var(--odoo-purple); transform: translateY(-1px); }
.cw-qact-icon { font-size: 20px; line-height: 1; }

/* ── Account groups & cards ── */
.cw-account-group { margin-bottom: 18px; }
.cw-account-group:last-of-type { margin-bottom: 8px; }
.cw-group-header {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 14px; margin-bottom: 10px; border-radius: var(--r);
  background: linear-gradient(135deg, var(--odoo-purple-l), #f0fdfa);
  border: 1px solid var(--border); border-right: 4px solid var(--odoo-purple);
}
.cw-group-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cw-group-icon { font-size: 22px; line-height: 1; flex-shrink: 0; }
.cw-group-name { font-size: 13px; font-weight: 800; color: var(--text); }
.cw-group-code { font-size: 10px; color: var(--text-m); font-weight: 700; margin-top: 2px; }
.cw-group-total {
  font-family: var(--mono); font-weight: 900; font-size: 17px; color: var(--odoo-purple);
  white-space: nowrap; flex-shrink: 0;
}
.cw-group-total small { font-size: 10px; font-weight: 700; opacity: .75; margin-left: 4px; }
.cw-cur-sep { opacity: .5; font-weight: 400; margin: 0 2px; }
.cw-group-accounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.cw-group-empty {
  font-size: 11px; color: var(--text-m); text-align: center; padding: 14px; grid-column: 1 / -1;
  border: 1px dashed var(--border); border-radius: var(--r); background: #fafafa;
}

.cw-accounts-stack { display: flex; flex-direction: column; gap: 12px; }
.cw-account-card {
  border-radius: 16px; padding: 16px 18px; color: #fff; position: relative; overflow: hidden;
  cursor: pointer; transition: transform .15s, box-shadow .15s; box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.cw-account-card:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(0,0,0,.18); }
.cw-account-card.cash { background: linear-gradient(135deg, #714B67, #9b59b6); }
.cw-account-card.bank { background: linear-gradient(135deg, #017E84, #6366f1); }
.cw-account-card.bank-alt { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.cw-account-card.bank-usd { background: linear-gradient(135deg, #198754, #017E84); }
.cw-account-card.custody { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.cw-ac-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.cw-ac-type { font-size: 10px; font-weight: 800; letter-spacing: 1px; opacity: .9; }
.cw-ac-currency {
  font-size: 10px; font-weight: 900; padding: 2px 8px; border-radius: 999px;
  background: rgba(255,255,255,.22); letter-spacing: .5px;
}
.cw-ac-chip { width: 32px; height: 24px; border-radius: 4px; background: rgba(255,255,255,.25); }
.cw-ac-code { font-family: var(--mono); font-size: 11px; opacity: .85; margin-bottom: 4px; }
.cw-ac-name { font-size: 13px; font-weight: 800; margin-bottom: 12px; }
.cw-ac-balance { font-size: 22px; font-weight: 900; font-family: var(--mono); }
.cw-ac-balance small { font-size: 11px; font-weight: 600; opacity: .85; margin-right: 4px; }
.cw-ac-meta {
  font-size: 9px; opacity: .88; margin-top: 10px; padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,.2); font-weight: 600;
}
.cw-ac-link { cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.cw-ac-link:hover { opacity: .85; }
.cw-add-account {
  border: 2px dashed var(--border); border-radius: var(--r-lg); padding: 14px;
  text-align: center; font-size: 12px; font-weight: 700; color: var(--text-m);
  cursor: pointer; transition: var(--tr);
}
.cw-add-account:hover { border-color: var(--odoo-purple); color: var(--odoo-purple); background: var(--odoo-purple-l); }

/* ── Transactions ── */
.cw-txn-list { display: flex; flex-direction: column; gap: 0; }
.cw-txn-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border);
}
.cw-txn-item:last-child { border-bottom: none; }
.cw-txn-click { cursor: pointer; border-radius: var(--r); padding-right: 6px; padding-left: 6px; }
.cw-txn-click:hover { background: var(--odoo-purple-l); }
.cw-txn-icon {
  width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.cw-txn-icon.in { background: #dcfce7; }
.cw-txn-icon.out { background: #fee2e2; }
.cw-txn-body { flex: 1; min-width: 0; }
.cw-txn-title { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-txn-meta { font-size: 10px; color: var(--text-m); margin-top: 2px; }
.cw-txn-amt { font-size: 13px; font-weight: 800; font-family: var(--mono); white-space: nowrap; }
.cw-txn-amt.in { color: #15803d; }
.cw-txn-amt.out { color: #dc2626; }

/* ── Cashflow tab (cashflow mockup) ── */
.cw-cf-kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 900px) { .cw-cf-kpi-row { grid-template-columns: repeat(2, 1fr); } }
.cw-cf-kpi {
  padding: 14px 16px; border-radius: var(--r-lg); background: #fff; border: 1px solid var(--border);
  border-top: 3px solid var(--odoo-purple); box-shadow: var(--sh-sm, 0 2px 8px rgba(0,0,0,.04));
}
.cw-cf-kpi.green { border-top-color: #198754; }
.cw-cf-kpi.blue { border-top-color: var(--odoo-blue); }
.cw-cf-kpi.orange { border-top-color: #f59e0b; }
.cw-cf-kpi.purple { border-top-color: var(--odoo-purple); }
.cw-cf-kpi .lbl { font-size: 10px; color: var(--text-m); font-weight: 700; }
.cw-cf-kpi .val { font-size: 18px; font-weight: 900; font-family: var(--mono); margin-top: 4px; }

.cw-cf-charts-grid {
  display: grid; grid-template-columns: 1.4fr 0.8fr 0.8fr; gap: 16px; margin-bottom: 16px;
}
@media (max-width: 1100px) { .cw-cf-charts-grid { grid-template-columns: 1fr; } }

.cw-cf-bar-chart {
  display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 12px; position: relative;
}
.cw-cf-bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.cw-cf-bar-pair { display: flex; gap: 3px; align-items: flex-end; height: 100%; }
.cw-cf-bar { width: 14px; border-radius: 5px 5px 0 0; min-height: 4px; }
.cw-cf-bar.in { background: linear-gradient(180deg, #6366f1, #017E84); }
.cw-cf-bar.out { background: linear-gradient(180deg, #f472b6, #ec4899); }
.cw-cf-bar-lbl { font-size: 9px; color: var(--text-m); font-weight: 700; }
.cw-cf-bar-legend { display: flex; gap: 16px; margin-top: 12px; font-size: 10px; font-weight: 700; }
.cw-cf-bar-legend span { display: flex; align-items: center; gap: 6px; }
.cw-cf-bar-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.cw-cf-mini-card {
  border-radius: 16px; padding: 20px; color: #fff; min-height: 140px;
  background: linear-gradient(135deg, #017E84, #6366f1); position: relative; overflow: hidden;
  box-shadow: 0 12px 32px rgba(1,126,132,.25);
}
.cw-cf-mini-card::after {
  content: ''; position: absolute; width: 100px; height: 100px; border-radius: 50%;
  background: rgba(255,255,255,.1); top: -20px; left: -20px;
}
.cw-cf-mini-card .chip { width: 36px; height: 28px; border-radius: 5px; background: rgba(255,255,255,.25); margin-bottom: 20px; }
.cw-cf-mini-card .lbl { font-size: 10px; opacity: .85; font-weight: 700; }
.cw-cf-mini-card .val { font-size: 24px; font-weight: 900; font-family: var(--mono); margin-top: 6px; }

.cw-cf-main-grid { display: grid; grid-template-columns: 1.5fr 0.7fr; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .cw-cf-main-grid { grid-template-columns: 1fr; } }

.cw-cf-section { margin-bottom: 16px; }
.cw-cf-hdr {
  font-size: 12px; font-weight: 800; color: var(--odoo-purple); padding: 8px 12px;
  background: var(--odoo-purple-l); border-radius: var(--r); margin-bottom: 8px;
}
.cw-cf-row {
  display: flex; justify-content: space-between; align-items: center; padding: 8px 12px;
  border-bottom: 1px dotted var(--border); font-size: 12px;
}
.cw-cf-row.sub { padding-right: 28px; color: var(--text-m); }
.cw-cf-row.grand {
  font-weight: 900; font-size: 14px; background: linear-gradient(135deg, #e8f5f6, #f0fdf4);
  border: 2px solid var(--odoo-teal); border-radius: var(--r); padding: 12px; margin-top: 12px;
}
.cw-cf-amt { font-family: var(--mono); font-weight: 700; }
.cw-cf-amt.neg { color: #dc2626; }
.cw-cf-amt.pos { color: #15803d; }

.cw-cf-sidebar-item {
  display: flex; justify-content: space-between; align-items: center; padding: 12px 0;
  border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 700;
}
.cw-cf-sidebar-item:last-child { border-bottom: none; }
.cw-cf-sidebar-item .lbl { color: var(--text-m); font-size: 11px; }
.cw-cf-sidebar-item .val { font-family: var(--mono); font-weight: 900; color: var(--odoo-purple); }
.cw-cf-sidebar-item.grand {
  margin-top: 8px; padding: 14px; border-radius: var(--r); border: none;
  background: linear-gradient(135deg, var(--odoo-purple-l), #f0fdfa);
}
.cw-cf-sidebar-item.grand .val { font-size: 16px; }

/* ── Dark mode ── */
body.dark-mode .cw-widget { background: #1a2a24; border-color: #2a3d36; }
body.dark-mode .cw-widget-head { background: #152018; border-color: #2a3d36; }
body.dark-mode .cw-tab, body.dark-mode .cw-month-btn, body.dark-mode .cw-btab, body.dark-mode .cw-ptab,
body.dark-mode .cw-qact { background: #1a2a24; border-color: #2a3d36; color: #e8f5f0; }
body.dark-mode .cw-donut-hole { background: #1a2a24; }
body.dark-mode .cw-cf-kpi { background: #1a2a24; border-color: #2a3d36; }
body.dark-mode .cw-budget-stat { background: #152018; border-color: #2a3d36; }
body.dark-mode .cw-filter-bar { background: #152018; border-color: #2a3d36; }
