/* css/pages/cashflow.css */

.cashflow-page {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding-bottom: 2rem;
}

/* ── Hero ──────────────────────────────────────────────────────────────── */
.cashflow-hero {
  background: linear-gradient(135deg, var(--surface-elevated) 0%, rgba(46,122,130,0.08) 100%);
  border: 1px solid rgba(46,122,130,0.18);
  border-radius: var(--radius-lg);
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  margin: 0.5rem 1.25rem 0;
}

/* ── Månadsnavigator ─────────────────────────────────────────────────── */
.cashflow-month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.cashflow-month-nav__btn {
  background: none;
  border: 1px solid rgba(46,122,130,0.2);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 0.9rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}

.cashflow-month-nav__btn:hover:not(:disabled) {
  border-color: rgba(46,122,130,0.5);
  color: var(--primary-light);
}

.cashflow-month-nav__btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.cashflow-month-nav__btn svg {
  display: block;
  pointer-events: none;
}

.cashflow-month-nav__label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: 0.03em;
  flex: 1;
  text-align: center;
}

.cashflow-hero__label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  margin: 0 0 0.35rem;
}

.cashflow-hero__amount {
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 400;
  line-height: 1;
  margin: 0 0 0.25rem;
  color: var(--text-1);
}

.cashflow-hero__amount.is-positive { color: #10B981; }
.cashflow-hero__amount.is-negative { color: #EF4444; }

.cashflow-hero__period {
  font-size: 0.8rem;
  color: var(--text-2);
  margin: 0;
}

/* Sparkvots-bar */
.cashflow-hero__rate-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.cashflow-hero__bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  position: relative;
}

.cashflow-hero__fill {
  height: 100%;
  border-radius: 3px;
  background: var(--primary);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 100%;
}

.cashflow-hero__fill.is-good    { background: #10B981; }
.cashflow-hero__fill.is-ok      { background: var(--accent); }
.cashflow-hero__fill.is-low     { background: #EF4444; }

/* Benchmark-linje vid 20% */
.cashflow-hero__benchmark {
  position: absolute;
  left: 20%;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: rgba(0,0,0,0.18);
  border-radius: 1px;
}

.cashflow-hero__rate-label {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-2);
}
.cashflow-hero__rate-label.is-good { color: #10B981; }
.cashflow-hero__rate-label.is-ok   { color: var(--accent); }
.cashflow-hero__rate-label.is-low  { color: #EF4444; }

.cashflow-hero__meta {
  display: flex;
  gap: 1.5rem;
}

.cashflow-hero__meta span {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.cashflow-hero__meta .meta-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-2);
}

.cashflow-hero__meta .meta-val {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-1);
}

/* ── Sections ──────────────────────────────────────────────────────────── */
.cashflow-section {
  padding: 0 1.25rem;
}

.cashflow-section__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.875rem;
}

.cashflow-section__title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.875rem;
}

.cashflow-section__title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
  margin: 0;
}

.cashflow-section__total {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-1);
}

.cashflow-section__subtitle {
  font-size: 0.75rem;
  color: var(--text-2);
  font-weight: 400;
}

.cashflow-section--pulse .pulse-container {
  background: transparent;
  padding: 0;
}

/* ── Category grid ─────────────────────────────────────────────────────── */
.cashflow-cats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.cashflow-cat-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--cat-color, var(--primary-light));
  border-radius: 10px;
  padding: 0.875rem 0.875rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  overflow: hidden;
}

.cashflow-cat-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.cashflow-cat-card.is-anomaly {
  border-left-color: var(--warning);
}

.cashflow-cat-card__top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.cashflow-cat-card__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cashflow-cat-card__name {
  font-size: 0.75rem;
  color: var(--text-2);
  flex: 1;
}

.cashflow-cat-card__pct {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-2);
  margin-left: auto;
}

.cashflow-cat-card__amount {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-1);
}

.cashflow-cat-card__chip {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent);
  align-self: flex-start;
}

.cashflow-cat-card__chip.is-positive {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
}

.cashflow-cat-fill-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.25rem;
}

.cashflow-cat-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--cat-color, var(--primary-light));
  width: 0%;
  transition: width 0.65s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── AI Insight cards ──────────────────────────────────────────────────── */
.cashflow-insights {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.cashflow-insight-card {
  background: rgba(46,122,130,0.06);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary-light);
  border-radius: 10px;
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cashflow-insight-card.severity-warning  {
  background: rgba(245,158,11,0.08);
  border-left-color: var(--accent);
}
.cashflow-insight-card.severity-urgent,
.cashflow-insight-card.severity-negative {
  background: rgba(239,68,68,0.08);
  border-left-color: var(--loss);
}
.cashflow-insight-card.severity-positive {
  background: rgba(16,185,129,0.08);
  border-left-color: var(--gain);
}

.cashflow-insight-card__title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-1);
  margin: 0;
}

.cashflow-insight-card__body {
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.55;
  margin: 0;
}

.cashflow-insight-card__body strong {
  color: var(--text-1);
}

.cashflow-insight-card__cta {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary-light);
  background: rgba(46,122,130,0.12);
  border: 1px solid rgba(46,122,130,0.25);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.15s;
}

.cashflow-insight-card__cta:hover {
  background: rgba(46,122,130,0.2);
}

/* Skeleton */
.cashflow-skeleton {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.cashflow-skeleton__card {
  background: var(--surface-elevated);
  border-radius: 10px;
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cashflow-skeleton__line {
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  animation: shimmer 1.5s ease-in-out infinite;
}

.cashflow-skeleton__line.w-60 { width: 60%; }
.cashflow-skeleton__line.w-80 { width: 80%; }
.cashflow-skeleton__line.w-40 { width: 40%; }

@keyframes shimmer {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.8; }
}

/* ── Subscriptions ─────────────────────────────────────────────────────── */
.cashflow-subs {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s-3) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow: var(--shadow-sm);
}

.cashflow-subs__callout {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--s-2);
  font-size: var(--text-xs);
  color: var(--text-2);
  flex-wrap: wrap;
}

.cashflow-subs__callout-sep {
  color: var(--border);
}

.cashflow-subs__callout-yearly {
  font-weight: 600;
  color: var(--text-1);
}

.cashflow-sub-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  gap: 0.75rem;
}

.cashflow-sub-item:last-child { border-bottom: none; }

.cashflow-sub-item__dot { display: none; }

.cashflow-sub-item__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(99,102,241,0.15);
  color: var(--cat-prenumerationer);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cashflow-sub-item__avatar.is-forgotten {
  background: rgba(245,158,11,0.15);
  color: var(--warning);
}

.cashflow-sub-item__name {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-1);
}

.cashflow-sub-item__monthly {
  font-size: 0.8rem;
  color: var(--text-2);
}

.cashflow-sub-item__yearly {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-1);
}

.cashflow-subs__forgotten-header {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--warning);
  padding: var(--s-3) var(--s-4) var(--s-2);
  margin-top: var(--s-2);
  margin-left: calc(-1 * var(--s-4));
  margin-right: calc(-1 * var(--s-4));
  border-top: 1px solid rgba(245,158,11,0.15);
  background: rgba(245,158,11,0.05);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
