/* Boop guides and free tools (/guides, /boop/tools).
   Loaded after styles.css; reuses its tokens and adds a warm corgi accent. */

:root {
  --boop: #c2410c;
  --boop-strong: #9a3412;
  --boop-soft: rgba(234, 88, 12, 0.10);
  --boop-glow: rgba(251, 146, 60, 0.18);
  --needs: #2563eb;
  --wants: #db2777;
  --save: #15803d;
  --warn-bg: rgba(234, 179, 8, 0.14);
  --warn-border: rgba(202, 138, 4, 0.45);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --boop: #fdba74;
    --boop-strong: #fed7aa;
    --boop-soft: rgba(251, 146, 60, 0.14);
    --boop-glow: rgba(251, 146, 60, 0.12);
    --needs: #60a5fa;
    --wants: #f472b6;
    --save: #4ade80;
    --warn-bg: rgba(234, 179, 8, 0.12);
    --warn-border: rgba(250, 204, 21, 0.4);
  }
}
:root[data-theme="dark"] {
  --boop: #fdba74;
  --boop-strong: #fed7aa;
  --boop-soft: rgba(251, 146, 60, 0.14);
  --boop-glow: rgba(251, 146, 60, 0.12);
  --needs: #60a5fa;
  --wants: #f472b6;
  --save: #4ade80;
  --warn-bg: rgba(234, 179, 8, 0.12);
  --warn-border: rgba(250, 204, 21, 0.4);
}

.bg-page {
  max-width: 820px; margin: 0 auto;
  padding: 40px 24px 72px;
}
.bg-page--wide { max-width: 980px; }
.bg-hero { margin-bottom: 28px; }
.bg-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono-font); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--boop);
  margin-bottom: 10px;
}
.bg-kicker img { width: 22px; height: 22px; }
.bg-page h1 {
  font-family: var(--display-font);
  font-size: clamp(28px, 2.2vw + 18px, 40px); font-weight: 700;
  letter-spacing: -0.03em; line-height: 1.12; margin-bottom: 14px;
}
.bg-lead {
  font-size: 16.5px; color: var(--text-secondary); line-height: 1.65;
  max-width: 680px;
}
.bg-meta {
  margin-top: 14px; font-size: 13px; color: var(--text-muted);
  display: flex; flex-wrap: wrap; gap: 6px 14px;
}
.bg-meta a { font-weight: 500; }

/* ----- Header nav for these pages ----- */
.bg-nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.bg-nav a {
  padding: 6px 10px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 13px; font-weight: 500;
}
.bg-nav a:hover, .bg-nav a[aria-current="page"] { color: var(--text); background: var(--bg-subtle); opacity: 1; }
.header-inner .logo { margin-right: 0; }

/* ----- Tool panels ----- */
.tool {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
  padding: 22px; margin: 8px 0 28px;
}
.tool + .tool { margin-top: 0; }
.tool h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 4px; }
.tool-sub { font-size: 13.5px; color: var(--text-muted); margin-bottom: 16px; }
.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.tool-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--full { grid-column: 1 / -1; }
.field label, .field .label, fieldset legend {
  font-size: 13px; font-weight: 600; color: var(--text);
}
.field small, .hint { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

.tool input[type="text"], .tool input[type="number"], .tool input[type="date"],
.tool select, .tool textarea {
  width: 100%; min-width: 0;
  font: inherit; font-size: 16px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 10px 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.tool textarea { font-family: var(--mono-font); font-size: 13px; resize: vertical; }
.tool input:focus-visible, .tool select:focus-visible, .tool textarea:focus-visible {
  outline: none; border-color: var(--boop); box-shadow: 0 0 0 3px var(--boop-soft);
}
.money-input { position: relative; }
.tool .money-input input { padding-left: 52px; }
.bg-page [hidden] { display: none !important; }
.money-input .cur-tag {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  font-family: var(--mono-font); pointer-events: none;
}

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label {
  padding: 8px 12px; border-radius: 999px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  background: var(--bg); border: 1px solid var(--border-strong);
  transition: all var(--transition);
}
.seg input:checked + label { background: var(--btn-primary-bg); color: var(--btn-primary-fg); border-color: var(--btn-primary-bg); }
.seg input:focus-visible + label { box-shadow: 0 0 0 3px var(--boop-soft); border-color: var(--boop); }

.tool .btn { font-size: 14px; padding: 10px 16px; border-radius: 10px; }
.btn--boop { background: var(--boop); color: #fff; }
:root[data-theme="dark"] .btn--boop { color: #1c0d02; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn--boop { color: #1c0d02; } }
.btn--boop:hover { background: var(--boop-strong); opacity: 1; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.link-btn {
  background: none; border: 0; padding: 4px 0; font: inherit; font-size: 13.5px;
  font-weight: 600; color: var(--accent); cursor: pointer;
}
.icon-btn {
  width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--bg); color: var(--text-muted); cursor: pointer; font-size: 18px; line-height: 1;
}
.icon-btn:hover { color: var(--text); border-color: var(--text-muted); }

/* Bill / item rows */
.rows { display: grid; gap: 8px; margin-top: 4px; }
.row {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.9fr) 40px;
  gap: 8px; align-items: center;
}
.row--2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 40px; }
.row-head { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.row-head span:last-child { visibility: hidden; }

/* Results */
.results { margin-top: 20px; display: grid; gap: 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat {
  border-radius: var(--radius); padding: 14px; border: 1px solid var(--border);
  background: var(--bg-elevated); min-width: 0;
}
.stat-label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.stat-label::before { content: ''; width: 9px; height: 9px; border-radius: 3px; background: var(--dot, var(--text-muted)); flex-shrink: 0; }
.stat-value { font-size: clamp(18px, 1.2vw + 14px, 24px); font-weight: 700; letter-spacing: -0.02em; margin-top: 2px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.stat--needs { --dot: var(--needs); }
.stat--wants { --dot: var(--wants); }
.stat--save { --dot: var(--save); }

.bar {
  display: flex; height: 14px; border-radius: 999px; overflow: hidden;
  background: var(--bg-subtle); border: 1px solid var(--border);
}
.bar span { display: block; height: 100%; transition: width 0.3s ease; }
.bar .b-needs { background: var(--needs); }
.bar .b-bills { background: var(--needs); opacity: 0.55; }
.bar .b-wants { background: var(--wants); }
.bar .b-save { background: var(--save); }

.notice {
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--warn-bg); border: 1px solid var(--warn-border);
  font-size: 13.5px; line-height: 1.55; color: var(--text);
}
.notice--ok { background: var(--green-soft); border-color: rgba(22, 163, 74, 0.35); }

.plan-table, .prose table {
  width: 100%; border-collapse: collapse; font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.plan-table th, .plan-table td, .prose th, .prose td {
  text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.plan-table th, .prose th { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.plan-table td.num, .plan-table th.num, .prose td.num, .prose th.num { text-align: right; white-space: nowrap; }
.plan-table tfoot td { font-weight: 700; border-bottom: 0; }
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.cutoffs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cutoff {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px;
  background: var(--bg-elevated); min-width: 0;
}
.cutoff h3 { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.cutoff dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; font-size: 14px; }
.cutoff dt { color: var(--text-secondary); }
.cutoff dd { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.cutoff dt.sub, .cutoff dd.sub { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.cutoff dt.sub { padding-left: 12px; }
.cutoff .total { border-top: 1px solid var(--border); padding-top: 6px; }

/* Embed / share */
.share-box { display: grid; gap: 8px; }
.share-box textarea { min-height: 96px; }
.copied { font-size: 12.5px; color: var(--green); font-weight: 600; min-height: 1.2em; }

/* ----- Article prose ----- */
.prose { font-size: 16px; line-height: 1.72; color: var(--text-secondary); }
.prose > * + * { margin-top: 14px; }
.prose h2 {
  font-size: clamp(21px, 0.8vw + 17px, 25px); font-weight: 700; color: var(--text);
  letter-spacing: -0.02em; line-height: 1.25; margin-top: 40px;
}
.prose h3 { font-size: 17px; font-weight: 700; color: var(--text); margin-top: 26px; }
.prose strong { color: var(--text); font-weight: 600; }
.prose a { font-weight: 500; text-decoration: underline; text-decoration-color: var(--accent-soft); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose ul, .prose ol { padding-left: 22px; display: grid; gap: 6px; }
.prose li::marker { color: var(--text-muted); }
.prose table { margin-top: 16px; }
.prose td, .prose th { color: var(--text-secondary); }
.prose td strong { color: var(--text); }
.prose caption { caption-side: bottom; text-align: left; font-size: 12.5px; color: var(--text-muted); padding-top: 8px; }
.callout {
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--boop-soft); border: 1px solid var(--border);
  border-left: 3px solid var(--boop); font-size: 15px;
}
.callout p + p { margin-top: 8px; }
.formula {
  font-family: var(--mono-font); font-size: 14px; color: var(--text);
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px; overflow-wrap: anywhere;
}
.toc {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px;
  background: var(--bg-card); font-size: 14.5px;
}
.toc strong { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.toc ol { padding-left: 20px; display: grid; gap: 4px; }
.sources { font-size: 13.5px; }
.sources li { overflow-wrap: anywhere; }
.disclaimer { font-size: 13px; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 16px; margin-top: 32px; }
.lang-switch {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600;
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border-strong);
  color: var(--text); background: var(--bg-card);
}

/* Editable budget table (articles) */
.budget-table input {
  width: 100%; min-width: 0; font: inherit; font-size: 15px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 6px 8px; text-align: right;
}
.budget-table input.name { text-align: left; }
.budget-table td { padding: 6px 6px; }
.budget-table td:first-child { width: 58%; }

/* ----- Soft Boop CTA ----- */
.cta-box {
  margin-top: 44px; padding: 24px; border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background:
    radial-gradient(ellipse 70% 90% at 100% 0%, var(--boop-glow), transparent 70%),
    var(--bg-card);
  display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 18px; align-items: start;
}
.cta-box img.cta-icon { width: 72px; height: 72px; border-radius: 17px; border: 1px solid var(--border); box-shadow: var(--shadow-photo); }
.cta-box h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.015em; color: var(--text); margin: 0 0 6px; }
.cta-box p { font-size: 14.5px; color: var(--text-secondary); line-height: 1.6; margin: 0; }
.cta-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; align-items: center; }
.cta-links .store-badge svg { border: none; }
.btn-play {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px;
  border-radius: 8px; background: #000; color: #fff; font-size: 14px; font-weight: 600;
  border: 1px solid var(--badge-border);
}
.btn-play:hover { opacity: 0.9; color: #fff; }
.btn-play svg { width: 18px; height: 18px; }

/* ----- Hubs ----- */
.hub-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 8px; }
.hub-card {
  display: flex; flex-direction: column; gap: 6px; padding: 18px;
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: var(--bg-card); box-shadow: var(--shadow-card); color: var(--text);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.hub-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow-card-hover); opacity: 1; }
.hub-card .tag { font-family: var(--mono-font); font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--boop); }
.hub-card h3 { font-size: 16.5px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; }
.hub-card p { font-size: 14px; color: var(--text-secondary); line-height: 1.55; }
.hub-card .also { font-size: 13px; color: var(--text-muted); margin-top: auto; padding-top: 4px; }
.hub-section { margin-top: 36px; }
.hub-section > h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
.hub-section > p { font-size: 14.5px; color: var(--text-muted); margin-bottom: 12px; }

/* ----- Ipon printable sheet ----- */
.sheet-wrap { margin-top: 18px; }
.sheet {
  background: #fff; color: #1f1a17; border-radius: 14px; border: 1px solid var(--border);
  padding: 22px; box-shadow: var(--shadow-card);
  --sheet-accent: #c2410c; --sheet-soft: #fff1e6; --sheet-line: #f3c9a8;
}
.sheet[data-theme-pick="cat"] { --sheet-accent: #6d28d9; --sheet-soft: #f3edff; --sheet-line: #d4c4f7; }
.sheet[data-theme-pick="plain"] { --sheet-accent: #27272a; --sheet-soft: #f4f4f5; --sheet-line: #d4d4d8; }
.sheet-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.sheet-head img { width: 64px; height: 64px; flex-shrink: 0; }
.sheet-title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; color: var(--sheet-accent); overflow-wrap: anywhere; }
.sheet-sub { font-size: 13.5px; color: #57534e; margin-top: 2px; }
.sheet-grid {
  display: grid; grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr)); gap: 6px;
}
.sheet-cell {
  border: 1.5px solid var(--sheet-line); border-radius: 9px; background: var(--sheet-soft);
  min-height: 46px; padding: 4px 2px; text-align: center;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  font-variant-numeric: tabular-nums; cursor: pointer; user-select: none;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.sheet-cell .wk { font-size: 9.5px; font-weight: 600; color: #78716c; line-height: 1.1; }
.sheet-cell .amt { font-size: 13px; font-weight: 700; color: #292524; line-height: 1.2; overflow-wrap: anywhere; }
.sheet-cell.done { background: var(--sheet-accent); border-color: var(--sheet-accent); }
.sheet-cell.done .amt, .sheet-cell.done .wk { color: #fff; }
.sheet-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; font-size: 12.5px; color: #57534e; }
.sheet-foot strong { color: #1c1917; }

/* ----- Utang slip ----- */
.slip-preview { margin-top: 18px; display: flex; justify-content: center; }
.slip-preview canvas { width: 100%; max-width: 380px; height: auto; border-radius: 16px; box-shadow: var(--shadow-card-hover); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatches label {
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--border-strong); background: var(--sw);
  display: grid; place-items: center;
}
.swatches input:checked + label { border-color: var(--text); box-shadow: 0 0 0 3px var(--boop-soft); }
.swatches input:focus-visible + label { outline: 2px solid var(--boop); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 680px) {
  .bg-page { padding: 28px 16px 56px; }
  .tool { padding: 16px; border-radius: var(--radius); }
  .tool-grid, .tool-grid--3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
  .cutoffs { grid-template-columns: 1fr; }
  .hub-grid { grid-template-columns: 1fr; }
  .cta-box { grid-template-columns: 1fr; padding: 20px; }
  .cta-box img.cta-icon { width: 56px; height: 56px; border-radius: 13px; }
  .row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px; }
  .row .bill-name { grid-column: 1 / -1; }
  .row-head { display: none; }
  .row { padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
  .sheet { padding: 14px; }
  .sheet-grid { grid-template-columns: repeat(var(--cols-sm, 4), minmax(0, 1fr)); }
  .sheet-title { font-size: 20px; }
  .bg-nav a { padding: 6px 8px; }
  .header .container { padding: 0 16px; }
  .budget-table thead { display: none; }
  .budget-table tr {
    display: grid; grid-template-columns: minmax(0, 1fr) 128px; gap: 6px 10px;
    padding: 10px 0; border-bottom: 1px solid var(--border); align-items: center;
  }
  .budget-table td { border: 0; padding: 0; }
  .budget-table td:first-child { grid-column: 1 / -1; width: auto; }
  .budget-table td.bt-row-pct, .budget-table td.bt-pct { text-align: left; color: var(--text-muted); }
  .budget-table tfoot tr { border-bottom: 0; }
}

@media print {
  @page { margin: 10mm; }
  body { background: #fff !important; }
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; left: 0; top: 0; width: 100%; }
  .sheet { box-shadow: none; border: 0; padding: 0; }
  .sheet-grid { grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr)) !important; }
  .header, .footer { display: none; }
}
