/* Phase 1 — Dashboard health, income, bills, goals, dark toggle */

.yk-theme-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1000;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-card);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    transform var(--transition),
    background var(--transition);
}
.yk-theme-toggle:hover {
  transform: scale(1.06);
}

/* Score ring */
.score-hero {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 12px 0;
  display: flex;
  gap: 16px;
  align-items: center;
}
.score-ring {
  --p: 0;
  --c: var(--primary);
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: conic-gradient(
    var(--c) calc(var(--p) * 1%),
    var(--border-light) 0
  );
  display: grid;
  place-items: center;
  flex-shrink: 0;
  position: relative;
}
.score-ring::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--surface-card);
}
.score-ring > span {
  position: relative;
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
}
.score-ring > span small {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
}
.score-meta .grade {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}
.score-meta .sub-line {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* KPI grid */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 8px 0 4px;
}
.kpi {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.kpi .label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kpi .value {
  font-size: 18px;
  font-weight: 800;
  margin-top: 4px;
  color: var(--text);
}
.kpi.pos .value {
  color: var(--success);
}
.kpi.neg .value {
  color: var(--danger);
}
.kpi.warn .value {
  color: var(--warning);
}

/* Subscore bars */
.subscore {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
}
.subscore .name {
  flex: 0 0 110px;
  font-size: 13px;
  color: var(--text-secondary);
}
.subscore .bar {
  flex: 1;
  height: 8px;
  background: var(--border-light);
  border-radius: 999px;
  overflow: hidden;
}
.subscore .bar > i {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}
.subscore .val {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  width: 34px;
  text-align: right;
}

/* Bills list */
.bill-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.bill-row:last-child {
  border-bottom: 0;
}
.bill-row .due-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--border-light);
  color: var(--text-secondary);
}
.bill-row.overdue .due-chip {
  background: var(--danger-light);
  color: var(--danger);
}
.bill-row.soon .due-chip {
  background: var(--warning-light);
  color: var(--warning);
}
.bill-row.ok .due-chip {
  background: var(--success-light);
  color: var(--success);
}
.bill-row .info {
  flex: 1;
}
.bill-row .info .name {
  font-weight: 600;
  color: var(--text);
}
.bill-row .info .meta {
  font-size: 12px;
  color: var(--text-secondary);
}
.bill-row .amt {
  font-weight: 700;
  color: var(--text);
}

/* Goal card */
.goal-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin: 10px 0;
}
.goal-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.goal-head .title {
  font-weight: 700;
  color: var(--text);
}
.goal-head .pct {
  font-weight: 800;
  color: var(--primary);
}
.goal-progress {
  height: 10px;
  border-radius: 999px;
  background: var(--border-light);
  overflow: hidden;
  margin: 8px 0 6px;
}
.goal-progress > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 999px;
}
.goal-meta {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.form-grid .full {
  grid-column: 1/-1;
}
.form-grid label {
  font-size: 12px;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 4px;
}
.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

/* Utility */
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 14px 0 6px;
}
.section-title h3 {
  margin: 0;
}
.pill-link {
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px; /* space between the two buttons */
  margin-left: auto; /* push to the right */
}
.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border, #e5e7eb);
  background: var(--card, #fff);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition:
    background 0.15s ease,
    transform 0.15s ease;
}
.icon-btn:hover {
  background: var(--muted, #f3f4f6);
}
.icon-btn:active {
  transform: scale(0.96);
}

/* show correct icon per state */
#money-toggle .icon-eye-off,
body.amounts-hidden #money-toggle .icon-eye {
  display: none;
}
body.amounts-hidden #money-toggle .icon-eye-off {
  display: inline;
}

#theme-toggle .icon-moon,
html.dark #theme-toggle .icon-sun {
  display: none;
}
html.dark #theme-toggle .icon-moon {
  display: inline;
}
.money-toggle {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition:
    background 0.15s ease,
    transform 0.1s ease;
}
.money-toggle:hover {
  background: var(--surface-2, rgba(0, 0, 0, 0.05));
}
.money-toggle:active {
  transform: scale(0.94);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* The mask itself */
.money-mask {
  transition: filter 0.15s ease;
}
body.money-hidden .money-mask {
  filter: blur(8px);
  user-select: none;
  cursor: pointer;
}
/* Fallback for browsers without blur — replace with dots */
@supports not (filter: blur(1px)) {
  body.money-hidden .money-mask {
    color: transparent;
    position: relative;
  }
  body.money-hidden .money-mask::after {
    content: "••••••";
    position: absolute;
    inset: 0;
    color: var(--text);
    letter-spacing: 2px;
  }
}
