/* ═══════════════════════════════════════════
   POKIT — components.css
   Buttons · Forms · Cards · Stats · Lists
   ═══════════════════════════════════════════ */

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.card-title { font-size: 14px; font-weight: 700; }
.card-subtitle { font-size: 12px; color: var(--text-muted); }

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-emoji { font-size: 20px; margin-bottom: 4px; }
.stat-value { font-size: 18px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Forms ── */
.form-group { margin-bottom: 12px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-muted);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  font-size: 14px;
  background: var(--bg2);
  color: var(--text);
  font-family: var(--font);
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
  outline: none;
}
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: var(--font);
  transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-gold { background: linear-gradient(135deg, var(--accent), #E8C84B); color: #2D1F2D; }
.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: white; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 12px; }

/* ── Progress Bar ── */
.progress-bar {
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0;
}
.progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 0.5s ease;
}

/* ── List Items ── */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--card-border);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.list-item:active { transform: scale(0.98); }
.list-item-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: var(--bg);
  flex-shrink: 0;
}
.list-item-icon img {
  width: 100%; height: 100%;
  border-radius: 12px;
  object-fit: cover;
}
.list-item-info { flex: 1; min-width: 0; }
.list-item-name { font-size: 14px; font-weight: 600; }
.list-item-sub { font-size: 12px; color: var(--text-muted); }
.list-item-amount { font-size: 14px; font-weight: 700; text-align: right; }
.list-item-actions { display: flex; gap: 4px; }

/* ── Chips / Badges ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 10px;
  background: var(--bg);
}
.chip-primary { background: var(--primary); color: white; }
.chip-danger { background: #FEE2E2; color: var(--danger); }
.chip-success { background: #DCFCE7; color: var(--success); }
.chip-warning { background: #FEF3C7; color: #B45309; }

/* ── Due Items ── */
.due-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--card-border);
}
.due-item:last-child { border-bottom: none; }
.due-icon { font-size: 18px; width: 28px; text-align: center; }
.due-info { flex: 1; }
.due-name { font-size: 13px; font-weight: 600; }
.due-detail { font-size: 11px; color: var(--text-muted); }
.due-countdown { font-size: 12px; font-weight: 700; }
.due-urgent { color: var(--danger); }

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}
.empty-state .emoji { font-size: 48px; margin-bottom: 8px; }
.empty-state p { font-size: 13px; }

/* ── Toggle Switch ── */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--card-border);
  border-radius: 24px;
  transition: 0.3s;
}
.toggle-slider:before {
  content: '';
  position: absolute;
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }

/* ── Sync Badge ── */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg);
}
.sync-dot { width: 6px; height: 6px; border-radius: 50%; }
.sync-dot.synced { background: var(--success); }
.sync-dot.syncing { background: var(--warning); }
.sync-dot.error { background: var(--danger); }

/* ── Net Worth Bar ── */
.networth-bar {
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  margin: 8px 0;
}
.networth-assets { background: var(--success); height: 100%; }
.networth-debts { background: var(--danger); height: 100%; }

/* ── Accounts Dashboard ── */
.acct-dash-header {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  margin-bottom: 16px;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
}
.acct-dash-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.acct-dash-amount {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin: 6px 0 4px;
  transition: all 0.2s;
}
.acct-dash-toggle {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  vertical-align: middle;
}
.acct-dash-breakdown {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.acct-dash-breakdown strong { font-weight: 700; }

/* ── Account Filter Tabs ── */
.acct-filter-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 0 12px;
  margin-bottom: 4px;
}
.acct-filter-tabs::-webkit-scrollbar { display: none; }
.acct-filter-tab {
  flex-shrink: 0;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--card-border);
  background: var(--card);
  color: var(--text-muted);
  transition: all 0.2s;
  font-family: var(--font);
}
.acct-filter-tab.active {
  background: var(--text);
  color: var(--card);
  border-color: var(--text);
}

/* ── Account Cards Grid ── */
.acct-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.acct-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.15s;
}
.acct-card:active { transform: scale(0.97); }
.acct-card-logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--bg);
  margin-bottom: 12px;
  flex-shrink: 0;
}
.acct-card-logo img { width: 100%; height: 100%; object-fit: cover; }
.acct-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acct-card-balance {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.5px;
}
.acct-card-balance.masked { letter-spacing: 3px; font-size: 18px; }
.acct-card-type {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 6px;
  text-transform: capitalize;
}

/* ── Split Rows ── */
.split-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--card-border);
}
.split-row:last-child { border-bottom: none; }
.split-name { font-size: 13px; font-weight: 600; display: block; }
.split-input {
  width: 90px;
  text-align: right;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  background: var(--bg2);
  color: var(--text);
  flex-shrink: 0;
  margin-top: 2px;
}
.split-acct-select, .split-jar-select { cursor: pointer; }
.split-priority {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 8px;
  background: var(--danger);
  color: white;
  font-weight: 700;
}

/* ── Priority Reorderer ── */
.priority-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  margin-bottom: 4px;
  cursor: grab;
  touch-action: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.priority-item:active { cursor: grabbing; border-color: var(--primary); background: var(--bg2); }
.priority-item.dragging { opacity: 0.5; transform: scale(0.98); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.priority-item .pri-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.priority-item .pri-label { flex: 1; font-size: 13px; font-weight: 500; }
.priority-item .pri-arrows { display: flex; flex-direction: column; gap: 2px; }
.priority-item .pri-arrows button {
  background: none;
  border: 1px solid var(--card-border);
  cursor: pointer;
  font-size: 18px;
  padding: 4px 10px;
  color: var(--text-muted);
  line-height: 1;
  border-radius: 6px;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.priority-item .pri-arrows button:hover { color: var(--primary); background: var(--bg2); }
.priority-item .pri-arrows button:disabled { opacity: 0.2; cursor: default; }

/* ── Receivable Badges ── */
.receivable-badge { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: 10px; font-weight: 700; }
.receivable-badge.pending { background: #FFF3CD; color: #856404; }
.receivable-badge.overdue { background: #F8D7DA; color: #721C24; }
.receivable-badge.partial { background: #D1ECF1; color: #0C5460; }
.receivable-badge.paid { background: #D4EDDA; color: #155724; }
.tip-green { background: #D4EDDA; color: #155724; border-radius: 10px; padding: 12px; font-size: 12px; line-height: 1.6; }

/* ── Receipt Thumb ── */
.receipt-thumb {
  width: 48px; height: 48px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--card-border);
  cursor: pointer;
}

/* ── Account Logo ── */
.account-logo {
  width: 40px; height: 40px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--bg);
}

/* ── Focus Card ── */
.focus-card {
  border-radius: 14px;
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}
.focus-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background: repeating-linear-gradient(45deg, transparent, transparent 10px, currentColor 10px, currentColor 11px);
  pointer-events: none;
}
.focus-icon { font-size: 28px; line-height: 1; }
.focus-title { font-size: 13px; font-weight: 700; line-height: 1.3; }
.focus-sub { font-size: 11px; opacity: 0.75; line-height: 1.4; margin-top: 2px; }

/* ── AI Split Chat ── */
.split-chat { display: flex; gap: 6px; margin-top: 10px; }
.split-chat input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 20px;
  border: 1px solid var(--card-border);
  font-size: 12px;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}
.split-chat button {
  padding: 8px 14px;
  border-radius: 20px;
  background: var(--accent);
  color: white;
  border: none;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  white-space: nowrap;
}

/* ── Support Section ── */
.support-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--card-border);
  margin-bottom: 8px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
}
.support-icon {
  font-size: 20px;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.support-label { font-size: 14px; font-weight: 600; }
.support-desc { font-size: 11px; color: var(--text-muted); }

/* ── Settings Accordion ── */
.settings-section {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}
.settings-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  user-select: none;
}
.settings-section-header:active { background: var(--bg2); }
.section-arrow {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.2s;
  margin-left: auto;
}
.settings-section.open .section-arrow { transform: rotate(90deg); }
.section-count {
  font-size: 11px;
  font-weight: 600;
  background: var(--primary);
  color: white;
  border-radius: 10px;
  padding: 1px 7px;
  margin-left: 8px;
  min-width: 20px;
  text-align: center;
}
.settings-section-body { padding: 0 16px 16px; }

/* ── Settings Hints ── */
.settings-hint { margin-bottom: 10px; cursor: pointer; }
.hint-toggle { font-size: 12px; color: var(--primary); font-weight: 600; }
.hint-body {
  display: none;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  background: var(--bg);
  border-radius: 8px;
  padding: 10px;
}
.settings-hint.expanded .hint-body { display: block; }
.settings-hint.expanded .hint-toggle::after { content: ' ▾'; }
.hint-toggle::after { content: ' ▸'; }

/* ── Help Guide Buttons ── */
.guide-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  margin-bottom: 4px;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text);
  transition: background 0.15s;
}
.guide-btn:hover, .guide-btn:active { background: var(--bg2); }
.guide-detail {
  display: none;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  background: var(--bg2);
  border-radius: 0 0 10px 10px;
  margin-top: -5px;
  margin-bottom: 4px;
}
.guide-detail.open { display: block; }
