/* p.css — styles for p-app.js (budget, the chain, gold, …), on the Material 3 colour roles so light and dark both follow. */

/* four tabs: Home, Budget, Assets, Liabilities */
body:not(.rail) .nav .in {
  grid-template-columns: repeat(4, 1fr);
}

/* Home: Available now */
.balbar.p-avail {
  background: var(--primary-container);
  color: var(--on-primary-container);
}
.balbar.p-avail b {
  font-size: 1.35rem;
}
.balbar.p-avail + .balbar {
  margin-top: 8px;
}

/* a section title with its total and a small + on the right, in the title's own size */
.sec.p-sec {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 28px;
}
.p-sec-r {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.p-sec-r b {
  color: var(--on-surface);
  font-size: 0.95rem;
  white-space: nowrap;
}
.p-plus {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary-container);
  color: var(--on-primary-container);
  flex: none;
  position: relative;
}
/* a bigger target than it looks (48px), for fingers */
.p-plus::after {
  content: "";
  position: absolute;
  inset: -10px;
}
.p-plus .ic {
  width: 18px;
  height: 18px;
}

/* sub-groups inside one list (Gold: Touchable, Untouchable) */
.p-sub {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--on-surface-variant);
  padding: 14px 16px 6px;
}
.p-sub + .p-sub,
.tx + .p-sub,
.p-none + .p-sub {
  border-top: 1px solid var(--outline-variant);
}
.p-none {
  padding: 4px 16px 14px;
  font-size: 0.85rem;
  color: var(--on-surface-variant);
}

/* the chain: totals in bold, steps in italics; a line under Net worth and above Available now */
.card.p-chain {
  padding: 8px 16px;
}
.p-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 7px 0;
  font-size: 0.92rem;
  color: var(--on-surface-variant);
  text-align: left;
  background: none;
}
.p-line b {
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--on-surface);
}
.p-line.step span {
  font-style: italic;
}
button.p-line {
  cursor: pointer;
  border-radius: 6px;
}
button.p-line:hover span,
button.p-line:focus-visible span {
  color: var(--on-surface);
}
.p-line.tot {
  font-size: 1rem;
  font-weight: 700;
  color: var(--on-surface);
}
.p-line.tot b {
  font-weight: 700;
}
.p-line.net {
  border-bottom: 1px solid var(--outline-variant);
  padding-bottom: 10px;
  margin-bottom: 3px;
}
.p-line.end {
  border-top: 1px solid var(--outline-variant);
  margin-top: 3px;
  padding-top: 10px;
}
.p-line.end b {
  font-size: 1.15rem;
  color: var(--primary);
}
.p-line.note {
  padding-top: 0;
  font-size: 0.82rem;
}
.p-line.note b {
  font-weight: 400;
  color: var(--on-surface-variant);
}

/* "You owe" and an overspent budget: a deep red card */
.sumcard.owe {
  background: var(--spent-container);
  color: var(--on-spent-container);
}

/* the main currency, tappable, on the Net worth card */
.p-curchip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-highest);
  color: var(--on-surface);
  font-weight: 600;
  font-size: 0.85rem;
}
.p-warn {
  color: var(--spent) !important;
}
.tx .a.p-debt {
  color: var(--spent);
}

/* Budget */
.p-month {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -4px 0 12px;
  font-weight: 600;
  font-size: 1.05rem;
}
.p-month .icon[disabled] {
  opacity: 0.35;
}
.sumcard .bar.p-bar {
  margin: 10px 0 8px;
}
.bar.p-bar {
  position: relative;
  display: flex;
  overflow: visible;
  height: 6px;
  margin: 8px 0 2px;
}
.bar.p-bar span {
  border-radius: 0;
  flex: none;
}
.bar.p-bar span:first-child {
  border-radius: 4px 0 0 4px;
}
.bar.p-bar .co {
  opacity: 0.4;
}
.bar.p-bar.ok span {
  background: var(--got);
}
.bar.p-bar.ahead span,
.bar.p-bar.tight span {
  background: #e0a100;
}
.bar.p-bar.over span,
.sumcard .bar.p-bar.over span {
  background: var(--spent);
}
.bar.p-bar i {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 12px;
  border-radius: 1px;
  background: var(--on-surface);
  opacity: 0.55;
}
.p-brow.over .s,
.p-brow.tight .s {
  color: var(--spent);
}
.p-brow.ahead .s {
  color: #b07d00;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .p-brow.ahead .s {
    color: #f2c14e;
  }
}
:root[data-theme="dark"] .p-brow.ahead .s {
  color: #f2c14e;
}
.p-brow .mid {
  min-width: 0;
  flex: 1;
}

/* Home: the period's entries, a quiet link under Available now */
.p-entries {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px auto 0;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--on-surface-variant);
}
.p-entries .ic {
  width: 18px;
  height: 18px;
}
/* every budget bar as wide as its row */
.p-brow .mid .bar.p-bar {
  width: 100%;
}
.p-brow .a {
  min-width: 6.5rem;
}

/* the welcome page's logo */
.welcome .logo {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  margin: 8px auto 4px;
  display: block;
}

/* ---------- a computer screen (body.desk, 1200px+): a side bar with names, and room ---------- */
body.desk.hasnav {
  padding-left: 248px;
}
body.desk .nav {
  width: 248px;
  border-right: 1px solid var(--outline-variant);
}
body.desk main {
  max-width: 1240px;
}
.p-side {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px 14px;
  gap: 6px;
}
.p-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 14px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--on-surface);
}
.p-brand img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}
.p-side .btn {
  width: 100%;
  justify-content: center;
}
.p-side-new {
  height: 52px;
}
.p-side-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 14px;
}
.p-side-row .btn {
  height: 44px;
  font-size: 0.85rem;
  padding: 0 8px;
}
.p-side-tabs {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.p-side-tabs.end {
  margin-top: auto;
}
body.desk .nav .p-side-tab {
  height: 48px;
  flex-direction: row;
  justify-content: flex-start;
  gap: 14px;
  padding: 0 16px;
  border-radius: 24px;
  font-size: 0.95rem;
  font-weight: 500;
  width: 100%;
}
body.desk .nav .p-side-tab .ic {
  flex: none;
}
body.desk .nav .p-side-tab[aria-current="page"] {
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  font-weight: 700;
}
.p-side kbd,
.setrow kbd {
  margin-left: auto;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-highest);
  color: var(--on-surface-variant);
}
.p-side-new kbd {
  background: rgba(255, 255, 255, 0.22);
  color: inherit;
}
/* the History and Settings buttons in the top bar are in the side bar already */
body.desk .appbar .icon[data-act="go"] {
  display: none;
}
/* a mouse: rows and chips answer to the pointer */
@media (hover: hover) and (pointer: fine) {
  .tx[data-act]:hover,
  .chip:hover,
  .p-side-tab:hover,
  .balbar:hover {
    box-shadow: inset 0 0 0 999px rgba(127, 127, 127, 0.08);
    cursor: pointer;
  }
}
/* the side bar's buttons are buttons, not bottom-bar tabs */
body.desk .nav .p-side .btn {
  flex-direction: row;
  gap: 8px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--primary);
  color: var(--on-primary);
}
body.desk .nav .p-side .btn.tonal {
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  font-size: 0.85rem;
}
body.desk .nav .p-side .btn .ic {
  width: 20px;
  height: 20px;
  flex: none;
}

/* sign in / create an account */
.p-auth {
  max-width: 420px;
  margin: 0 auto;
  text-align: left;
}
.p-auth h2,
.p-auth > p {
  text-align: center;
}
.p-auth .field {
  margin-top: 12px;
}
.p-auth .btn {
  margin-top: 14px;
}
.p-auth-links {
  justify-content: center;
  flex-wrap: wrap;
}
.p-auth-links .btn {
  width: auto;
  margin-top: 4px;
}
/* how saving to your account is going */
.p-sync {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--on-surface-variant);
}
.p-sync.saved::before {
  content: "● ";
  color: var(--got);
}
.p-sync.offline,
.p-sync.demo {
  color: #b07d00;
}
.p-sync.error {
  color: var(--spent);
}
.p-side > .p-sync {
  padding: 0 10px 12px;
  margin-top: -8px;
}
