/* ==========================================================================
   OBLIVET — card colors, swatches, privacy mode, and settings additions
   ========================================================================== */

/* Swatches */
.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.swatch {
  position: relative;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--sw, transparent);
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.swatch:hover {
  transform: scale(1.1);
}

.swatch[aria-checked="true"] {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--white);
}

.swatch--none {
  background: repeating-linear-gradient(135deg, #2a2a2a 0 4px, #0c0c0c 4px 8px);
}

.swatch--custom {
  display: inline-flex;
  overflow: hidden;
  background: conic-gradient(#f43f5e, #f59e0b, #84cc16, #06b6d4, #8b5cf6, #f43f5e);
}

.swatch--custom[aria-checked="true"] {
  overflow: visible;
  background: var(--sw);
}

.swatch--custom input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.settings-field + .settings-field {
  margin-top: 20px;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-btn[aria-pressed="true"] {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
}

/* Wallet cards tinted with the real card's color */
.wallet-card.has-color,
.wallet-mini.has-color {
  --text: #fff;
  --white: #fff;
  --text-soft: rgba(255, 255, 255, 0.9);
  --muted: rgba(255, 255, 255, 0.74);
  --muted-dim: rgba(255, 255, 255, 0.62);
  --line: rgba(255, 255, 255, 0.24);
  --line-soft: rgba(255, 255, 255, 0.16);
  --line-strong: rgba(255, 255, 255, 0.36);
  --hi: rgba(255, 255, 255, 0.2);
  --track: rgba(255, 255, 255, 0.24);
  --fill: #fff;
  --tool-bg: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.2);
  background:
    radial-gradient(120% 100% at 100% 0%, var(--hi), transparent 60%),
    linear-gradient(145deg, var(--wc), var(--wc-2));
}

.wallet-card.has-color.is-light,
.wallet-mini.has-color.is-light {
  --text: #12110d;
  --white: #12110d;
  --text-soft: rgba(0, 0, 0, 0.84);
  --muted: rgba(0, 0, 0, 0.68);
  --muted-dim: rgba(0, 0, 0, 0.58);
  --line: rgba(0, 0, 0, 0.22);
  --line-soft: rgba(0, 0, 0, 0.14);
  --line-strong: rgba(0, 0, 0, 0.34);
  --hi: rgba(255, 255, 255, 0.35);
  --track: rgba(0, 0, 0, 0.2);
  --fill: #12110d;
  --tool-bg: rgba(0, 0, 0, 0.1);
  border-color: rgba(0, 0, 0, 0.18);
}

.wallet-mini.has-color:hover {
  border-color: var(--line-strong);
  filter: brightness(1.07);
}

.wallet-card.has-color .progress,
.wallet-mini.has-color .wallet-mini-bar {
  background: var(--track);
}

.wallet-card.has-color .progress > span,
.wallet-mini.has-color .wallet-mini-bar > span {
  background: var(--fill);
}

.wallet-card.has-color .wallet-mark,
.wallet-mini.has-color .wallet-mini-mark {
  border-color: var(--line);
  background: var(--tool-bg);
  color: var(--text);
}

.wallet-card.has-color .wallet-tool:hover {
  background: var(--tool-bg);
  color: var(--text);
}

/* A custom card background also reaches the cards that had a fixed gradient */
[data-custom-cards] .stat-card,
[data-custom-cards] .portfolio-hero {
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(255, 255, 255, 0.06), transparent 55%),
    linear-gradient(180deg, var(--panel-top), var(--panel));
}

/* Privacy mode: money is blurred everywhere until toggled back */
.is-private :is(
  .stat-value, .stat-foot-main, .portfolio-value, .portfolio-change, .portfolio-figures dd,
  .wallet-balance, .wallet-mini-value, .wallet-flow, .wallet-credit-meta strong,
  .wallet-group-total strong, .budget-remaining, .budget-figures dd, .budget-money,
  .budget-health-value, .budget-foot strong, .tx-amount, .recent-amount, .legend-value,
  .mini-stat > p, .mini-stat-foot, .bar-summary strong, .chart-foot strong, .donut-hole strong,
  .category-row-value, .panel-footline strong, .note p strong
) {
  filter: blur(9px);
  user-select: none;
}

.is-private #cashflowWrap,
.is-private .bar-chart {
  filter: blur(7px);
  pointer-events: none;
}


/* Extras: AMOLED theme and accessible settings toggles */
body.amoled-mode { --bg: #000; --bg-elevated: #050505; --surface: #050505; }
body.amoled-mode .ambient { opacity: .18; }
body.amoled-mode .site-header { background: rgba(0,0,0,.94); }
body.amoled-mode .card, body.amoled-mode .modal, body.amoled-mode .auth-card { background-color: #050505; border-color: #202020; }
.feature-toggle { display:flex; align-items:flex-start; gap:12px; padding:12px 0; cursor:pointer; }
.feature-toggle input { width:18px; height:18px; margin-top:3px; accent-color:var(--white); flex:0 0 auto; }
.feature-toggle span { display:grid; gap:4px; }
.feature-toggle small { color:var(--muted); line-height:1.45; }
@media print {
  body * { visibility:hidden !important; }
  #oblivet-print-report, #oblivet-print-report * { visibility:visible !important; }
  #oblivet-print-report { display:block !important; position:absolute; inset:0; width:100%; padding:24px; background:#fff; color:#111; font:12px Arial,sans-serif; }
}


/* Settings refresh: spacious, grouped, and easier to scan on mobile */
#settingsModal .modal { width: min(100%, 720px); max-height: min(90dvh, 900px); padding: clamp(18px, 3vw, 30px); }
#settingsModal .modal-head { margin-bottom: 12px; }
#settingsModal .modal-desc { margin-bottom: 18px; }
#settingsModal .settings-field { padding: 16px; margin: 0 0 12px; border: 1px solid var(--line-soft); border-radius: 15px; background: rgba(255,255,255,.018); min-width: 0; }
#settingsModal .settings-field legend { padding: 0 7px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
#settingsModal .language-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
#settingsModal .settings-actions:not(.settings-actions--stack) { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
#settingsModal .settings-actions .btn { min-width: 0; white-space: normal; line-height: 1.35; }
#settingsModal .field-hint { line-height: 1.5; }
#settingsModal .modal-foot { position: sticky; bottom: -1px; padding-top: 14px; margin-top: 8px; background: linear-gradient(180deg, transparent, #090909 24%); }
.bio-lock-overlay { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; padding: 22px; background: #050505; color: #f7f7f7; }
body.biometric-locked > *:not(#biometricLockOverlay) { visibility: hidden !important; }
body.biometric-locked > #biometricLockOverlay { visibility: visible !important; }
.bio-lock-card { width: min(100%,390px); padding: 30px 24px; text-align: center; border: 1px solid rgba(255,255,255,.14); border-radius: 22px; background: #101010; box-shadow: 0 25px 90px rgba(0,0,0,.5); }
.bio-lock-mark { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 18px; background: rgba(255,255,255,.08); font-size: 28px; }
.bio-lock-card h2 { margin: 8px 0 10px; }
.bio-lock-card p { color: #aaa; line-height: 1.55; }
.bio-lock-card .btn { width: 100%; margin-top: 10px; }
.bio-lock-card .bio-lock-footnote { margin-top: 18px; font-size: 11px; }
@media (max-width: 520px) {
  #settingsModal.modal-layer { padding: 8px; align-items: stretch; }
  #settingsModal .modal { width: 100%; max-height: 100%; border-radius: 18px; padding: 17px 14px; }
  #settingsModal .settings-field { padding: 12px; }
  #settingsModal .language-options, #settingsModal .settings-actions:not(.settings-actions--stack) { grid-template-columns: 1fr; }
}
