:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #2563eb;
  --primary-2: #4f46e5;
  --primary-soft: #eff6ff;
  --success: #0f766e;
  --danger: #b42318;
  --danger-soft: #fff1f2;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.09);
  --radius: 22px;
  --radius-sm: 14px;
  --shell: 1160px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input { font: inherit; }
a { color: inherit; }
img { max-width: 100%; }

.shell { width: min(calc(100% - 32px), var(--shell)); margin-inline: auto; }
.skip-link {
  position: fixed; left: 12px; top: 12px; z-index: 9999; transform: translateY(-160%);
  background: #111827; color: #fff; padding: 10px 14px; border-radius: 10px; text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.9);
  border-bottom: 1px solid rgba(226,232,240,.85); backdrop-filter: blur(14px);
}
.nav-wrap { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; min-width: 150px; text-decoration: none; }
.brand img { display: block; width: auto; max-height: 46px; object-fit: contain; }
.brand-fallback { font-weight: 900; font-size: 1.65rem; letter-spacing: -0.05em; }
.brand-fallback span { color: var(--primary); }
.top-nav { display: flex; align-items: center; gap: 24px; }
.top-nav a { font-size: .94rem; color: #334155; text-decoration: none; font-weight: 650; }
.top-nav a:hover, .top-nav a:focus-visible { color: var(--primary); }

.hero { position: relative; overflow: hidden; padding: 72px 0 54px; background: radial-gradient(circle at 80% 10%, #dbeafe 0, rgba(219,234,254,0) 30%), linear-gradient(180deg, #fff 0%, #f8fbff 100%); border-bottom: 1px solid var(--line); }
.hero::after { content: ""; position: absolute; width: 320px; height: 320px; border-radius: 50%; right: -140px; bottom: -220px; background: rgba(79,70,229,.08); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 48px; align-items: center; }
.hero h1 { margin: 10px 0 18px; font-size: clamp(2.25rem, 6vw, 4.6rem); line-height: .98; letter-spacing: -.055em; max-width: 820px; }
.hero-copy > p { margin: 0; max-width: 760px; color: #475569; font-size: clamp(1rem, 2vw, 1.18rem); }
.eyebrow { display: inline-block; color: var(--primary); font-weight: 800; font-size: .76rem; text-transform: uppercase; letter-spacing: .13em; }
.hero-chips { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 9px; }
.hero-chips span { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; color: #334155; font-size: .86rem; font-weight: 650; box-shadow: 0 4px 18px rgba(15,23,42,.04); }
.quote-card { position: relative; min-height: 230px; padding: 30px; border: 1px solid #dbeafe; border-radius: 28px; background: rgba(255,255,255,.9); box-shadow: var(--shadow); overflow: hidden; }
.quote-mark { position: absolute; right: 24px; top: 0; color: #dbeafe; font: 800 7rem/1 Georgia, serif; }
.quote-label { margin: 0 0 20px; color: var(--primary); font-size: .76rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; }
.quote-card blockquote { position: relative; z-index: 1; margin: 0; font: 650 clamp(1.15rem, 2.5vw, 1.5rem)/1.45 Georgia, "Times New Roman", serif; color: #1e293b; }

.ad-zone { margin-top: 28px; text-align: center; color: #94a3b8; font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; }
.ad-placeholder { display: grid; place-items: center; min-height: 96px; margin-top: 6px; border: 1px dashed #d8dee8; border-radius: 14px; background: rgba(255,255,255,.65); color: #c0c8d4; }
.ad-zone-bottom { margin-top: 42px; }

.calculator-section { padding-top: 46px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 26px; margin-bottom: 20px; }
.section-heading h2 { margin: 5px 0 0; font-size: clamp(1.55rem, 3vw, 2.25rem); line-height: 1.1; letter-spacing: -.035em; }
.section-heading > p { margin: 0; max-width: 520px; color: var(--muted); font-size: .95rem; }
.calculator-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.calculator-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #fff, #fbfdff); }
.toolbar-title { margin: 0; font-weight: 850; letter-spacing: -.02em; }
.toolbar-subtitle { margin: 3px 0 0; color: var(--muted); font-size: .8rem; }
.private-badge { display: inline-flex; align-items: center; min-height: 34px; padding: 6px 10px; border: 1px solid #c7f9ef; border-radius: 999px; background: #f0fdfa; color: var(--success); font-size: .76rem; font-weight: 750; }
.table-head { display: grid; grid-template-columns: 1.15fr .75fr .9fr 1fr; gap: 12px; padding: 12px 22px; background: #f8fafc; border-bottom: 1px solid var(--line); color: #64748b; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.table-head span:last-child { text-align: right; }
.denomination-list { display: grid; }
.denom-row { display: grid; grid-template-columns: 1.15fr .75fr .9fr 1fr; gap: 12px; align-items: center; min-height: 72px; padding: 10px 22px; border-bottom: 1px solid var(--line); transition: background .18s ease; }
.denom-row:hover { background: #fbfdff; }
.denom-meta { min-width: 0; }
.denom-name { display: flex; align-items: center; gap: 9px; font-weight: 820; font-variant-numeric: tabular-nums; }
.kind-badge { display: inline-flex; align-items: center; padding: 3px 7px; border-radius: 999px; font-size: .65rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.kind-note { background: #eef2ff; color: #4338ca; }
.kind-coin { background: #fff7ed; color: #c2410c; }
.denom-help { margin-top: 2px; color: #94a3b8; font-size: .73rem; }
.qty-input { width: 100%; min-height: 46px; border: 1px solid #cbd5e1; border-radius: 12px; padding: 9px 11px; background: #fff; color: var(--text); font-weight: 750; font-variant-numeric: tabular-nums; outline: none; transition: border .15s ease, box-shadow .15s ease; }
.qty-input:focus { border-color: #60a5fa; box-shadow: 0 0 0 4px rgba(59,130,246,.12); }
.qty-input.qty-invalid { border-color: #fb7185; box-shadow: 0 0 0 4px rgba(244,63,94,.10); }
.bundle-cell { color: #475569; font-size: .86rem; }
.bundle-cell strong { color: #0f172a; font-variant-numeric: tabular-nums; }
.subtotal { text-align: right; font-size: 1rem; font-weight: 850; font-variant-numeric: tabular-nums; }
.summary-panel { display: grid; grid-template-columns: 1.15fr .85fr; gap: 20px; padding: 24px 22px; background: linear-gradient(135deg, #eff6ff, #f5f3ff); }
.summary-main { display: grid; align-content: center; }
.summary-main > span { color: #475569; font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.summary-main strong { margin-top: 4px; font-size: clamp(2rem, 5vw, 3.3rem); line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.summary-main p { margin: 10px 0 0; color: #475569; font-size: .9rem; }
.summary-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.summary-stats div { min-height: 82px; padding: 13px; border: 1px solid rgba(255,255,255,.88); border-radius: 15px; background: rgba(255,255,255,.75); }
.summary-stats span { display: block; color: #64748b; font-size: .73rem; font-weight: 700; }
.summary-stats strong { display: block; margin-top: 6px; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.action-bar { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; padding: 18px 22px 22px; background: #fff; }
.btn { min-height: 48px; border: 1px solid #cbd5e1; border-radius: 13px; background: #fff; color: #334155; font-weight: 800; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, border .15s ease; }
.btn:hover { transform: translateY(-1px); border-color: #94a3b8; box-shadow: 0 8px 22px rgba(15,23,42,.07); }
.btn:active { transform: translateY(0); }
.btn:focus-visible, .text-btn:focus-visible, summary:focus-visible { outline: 3px solid rgba(37,99,235,.25); outline-offset: 2px; }
.btn-primary { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.btn-danger { color: var(--danger); border-color: #fecdd3; background: var(--danger-soft); }

.history-card { margin-top: 22px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.history-head h2 { margin: 4px 0 0; font-size: 1.35rem; }
.text-btn { min-height: 42px; border: 0; background: transparent; color: var(--primary); font-weight: 800; cursor: pointer; }
.history-list { display: grid; gap: 10px; }
.history-item { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; text-align: left; cursor: pointer; transition: border .15s ease, background .15s ease; }
.history-item:hover { border-color: #93c5fd; background: #f8fbff; }
.history-item strong { font-variant-numeric: tabular-nums; }
.history-item small { color: var(--muted); }
.history-restore { color: var(--primary); font-size: .78rem; font-weight: 800; }
.empty-state { margin: 0; padding: 18px; border-radius: 14px; background: #f8fafc; color: #64748b; text-align: center; }

.info-section, .content-section, .faq-section { padding-top: 58px; }
.steps-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.steps-grid article, .content-card { border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 10px 28px rgba(15,23,42,.045); }
.steps-grid article { padding: 20px; }
.steps-grid article > span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); font-weight: 900; }
.steps-grid h3 { margin: 16px 0 7px; font-size: 1.02rem; }
.steps-grid p { margin: 0; color: var(--muted); font-size: .9rem; }
.content-card { padding: 26px; }
.content-card h2 { margin: 0 0 10px; }
.content-card p { color: #475569; }
.content-card p:last-child { margin-bottom: 0; }
.faq-list { display: grid; gap: 10px; }
details { border: 1px solid var(--line); border-radius: 15px; background: #fff; overflow: hidden; }
summary { min-height: 54px; display: flex; align-items: center; cursor: pointer; padding: 14px 18px; font-weight: 800; }
details p { margin: -2px 18px 18px; color: var(--muted); }

.site-footer { margin-top: 64px; padding: 36px 0 24px; background: #0f172a; color: #cbd5e1; }
.footer-grid { display: grid; grid-template-columns: 1.2fr 1fr auto; gap: 36px; align-items: start; }
.footer-brand { color: #fff; font-size: 1.35rem; font-weight: 900; text-decoration: none; }
.footer-grid p { max-width: 480px; margin: 8px 0 0; color: #94a3b8; font-size: .9rem; }
.footer-links { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px 22px; }
.footer-links a { color: #cbd5e1; text-decoration: none; font-size: .88rem; }
.footer-links a:hover { color: #fff; }
.visitor-card { min-width: 128px; padding: 12px 14px; border: 1px solid #334155; border-radius: 14px; background: #111c30; }
.visitor-card span { display: block; color: #94a3b8; font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; }
.visitor-card strong { display: block; margin-top: 4px; color: #fff; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.copyright { margin-top: 28px; padding-top: 18px; border-top: 1px solid #253247; color: #64748b; font-size: .78rem; }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 60; transform: translate(-50%, 140%); opacity: 0; max-width: min(90vw, 440px); padding: 11px 16px; border-radius: 12px; background: #0f172a; color: #fff; box-shadow: 0 18px 40px rgba(15,23,42,.25); font-size: .88rem; font-weight: 700; transition: .22s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.noscript { position: fixed; inset: auto 12px 12px; z-index: 100; padding: 12px; border-radius: 10px; background: #7f1d1d; color: #fff; text-align: center; }

@media (max-width: 900px) {
  .top-nav a:not(:first-child) { display: none; }
  .hero { padding-top: 52px; }
  .hero-grid { grid-template-columns: 1fr; gap: 26px; }
  .quote-card { min-height: auto; }
  .section-heading { align-items: start; flex-direction: column; gap: 8px; }
  .steps-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .visitor-card { grid-column: 1 / -1; width: fit-content; }
}

@media (max-width: 680px) {
  .shell { width: min(calc(100% - 20px), var(--shell)); }
  .nav-wrap { min-height: 66px; }
  .brand img { max-height: 40px; max-width: 150px; }
  .hero { padding: 38px 0 38px; }
  .hero h1 { font-size: clamp(2.15rem, 12vw, 3.4rem); }
  .quote-card { padding: 22px; border-radius: 20px; }
  .ad-placeholder { min-height: 86px; }
  .calculator-section { padding-top: 34px; }
  .calculator-card, .history-card { border-radius: 18px; }
  .calculator-toolbar { align-items: start; flex-direction: column; padding: 16px; }
  .table-head { display: none; }
  .denom-row { grid-template-columns: 1fr 112px; grid-template-areas: "meta subtotal" "input bundle"; min-height: 106px; padding: 12px 14px; gap: 9px 12px; }
  .denom-meta { grid-area: meta; }
  .qty-input { grid-area: input; min-height: 48px; }
  .bundle-cell { grid-area: bundle; text-align: right; align-self: center; }
  .subtotal { grid-area: subtotal; align-self: start; padding-top: 2px; font-size: 1.03rem; }
  .summary-panel { grid-template-columns: 1fr; padding: 18px 14px; }
  .summary-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .action-bar { grid-template-columns: repeat(2, minmax(0,1fr)); padding: 14px; }
  .btn { min-height: 50px; }
  .history-card { padding: 16px; }
  .history-head { align-items: flex-start; }
  .history-item { grid-template-columns: 1fr auto; }
  .history-item small { grid-column: 1 / -1; }
  .steps-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 22px; }
  .visitor-card { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

@media print {
  @page { margin: 12mm; }
  body { background: #fff; }
  .site-header, .hero, .ad-zone, .section-heading, .history-card, .info-section, .content-section, .faq-section, .site-footer, .action-bar, .toast { display: none !important; }
  .calculator-section { width: 100%; padding: 0; margin: 0; }
  .calculator-card { box-shadow: none; border: 1px solid #bbb; border-radius: 0; }
  .denom-row, .table-head { break-inside: avoid; }
  .qty-input { border: 0; padding: 0; min-height: auto; background: transparent; }
  .summary-panel { background: #fff; border-top: 2px solid #111; }
  .private-badge { display: none; }
}

/* Cash Counter top-first layout */
.tool-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-top: 26px;
  padding-bottom: 16px;
}
.tool-intro h1 {
  margin: 5px 0 8px;
  font-size: clamp(2rem, 5vw, 3.35rem);
  line-height: 1;
  letter-spacing: -.05em;
}
.tool-intro p { margin: 0; max-width: 760px; color: #475569; }
.tool-intro-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.tool-intro-badges span { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: #475569; font-size: .76rem; font-weight: 750; white-space: nowrap; }
.compact-heading { margin-bottom: 14px; }
.after-calculator { padding-top: 26px; }
.quote-card-wide { min-height: 0; padding: 24px 28px; }
.quote-card-wide blockquote { max-width: 920px; }

/* Touch-friendly quantity stepper */
.qty-control {
  display: grid;
  grid-template-columns: 46px minmax(64px, 1fr) 46px;
  align-items: stretch;
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 13px;
  overflow: hidden;
  background: #fff;
  transition: border .15s ease, box-shadow .15s ease;
}
.qty-control:focus-within { border-color: #60a5fa; box-shadow: 0 0 0 4px rgba(59,130,246,.12); }
.qty-input {
  min-width: 0;
  min-height: 46px;
  border: 0;
  border-left: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
  border-radius: 0;
  padding: 7px 6px;
  text-align: center;
  box-shadow: none !important;
  -moz-appearance: textfield;
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-step {
  display: grid;
  place-items: center;
  min-width: 46px;
  min-height: 46px;
  border: 0;
  background: #f8fafc;
  color: #1e293b;
  font-size: 1.35rem;
  font-weight: 850;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.qty-step:hover { background: #eff6ff; color: var(--primary); }
.qty-step:active { background: #dbeafe; transform: scale(.96); }
.qty-step:focus-visible { position: relative; z-index: 2; outline: 3px solid rgba(37,99,235,.24); outline-offset: -3px; }

@media (min-width: 681px) {
  .table-head, .denom-row { grid-template-columns: 1.1fr 1fr .9fr 1fr; }
}

@media (max-width: 900px) {
  .tool-intro { align-items: flex-start; flex-direction: column; gap: 14px; }
  .tool-intro-badges { justify-content: flex-start; }
}

@media (max-width: 680px) {
  .nav-wrap { min-height: 60px; }
  .brand img { max-height: 46px; max-width: 120px; }
  .tool-intro { padding-top: 16px; padding-bottom: 10px; gap: 10px; }
  .tool-intro h1 { font-size: clamp(2rem, 11vw, 2.7rem); margin-bottom: 6px; }
  .tool-intro p { font-size: .91rem; line-height: 1.45; }
  .tool-intro-badges { gap: 6px; }
  .tool-intro-badges span { padding: 5px 8px; font-size: .69rem; }
  .calculator-section { padding-top: 8px; }
  .compact-heading { margin-bottom: 10px; }
  .compact-heading h2 { font-size: 1.35rem; }
  .compact-heading > p { font-size: .82rem; }
  .denom-row { grid-template-columns: minmax(0,1fr) 126px; grid-template-areas: "meta subtotal" "qty bundle"; min-height: 108px; padding: 11px 12px; gap: 8px 10px; }
  .qty-control { grid-area: qty; grid-template-columns: 42px minmax(48px, 1fr) 42px; }
  .qty-step { min-width: 42px; min-height: 48px; }
  .qty-input { min-height: 48px; padding-inline: 3px; }
  .bundle-cell { grid-area: bundle; font-size: .78rem; }
  .denom-help { display: none; }
  .denom-name { gap: 6px; font-size: .94rem; }
  .kind-badge { padding: 2px 5px; font-size: .58rem; }
  .after-calculator { padding-top: 18px; }
  .quote-card-wide { padding: 18px; }
  .quote-card blockquote { font-size: 1.05rem; }
  .ad-zone { margin-top: 18px; }
}

@media print {
  .tool-intro, .after-calculator { display: none !important; }
  .qty-control { border: 0; display: block; }
  .qty-step { display: none !important; }
  .qty-input { border: 0; text-align: left; padding: 0; }
}


/* Desktop left/right AdSense rails. They stay outside the tool UI and are hidden
   when there is not enough side space, keeping mobile/tablet use uncluttered. */
.side-ad {
  position: fixed;
  top: 96px;
  z-index: 18;
  width: 160px;
  text-align: center;
  color: #94a3b8;
  font-size: .64rem;
  text-transform: uppercase;
  letter-spacing: .11em;
  pointer-events: auto;
}
.side-ad-left { left: max(10px, calc((100vw - var(--shell)) / 2 - 180px)); }
.side-ad-right { right: max(10px, calc((100vw - var(--shell)) / 2 - 180px)); }
.side-ad-label { display: block; margin-bottom: 6px; }
.side-ad-slot {
  display: grid;
  place-items: center;
  width: 160px;
  min-height: 600px;
  overflow: hidden;
  border: 1px dashed #d8dee8;
  border-radius: 16px;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(10px);
}
.side-ad-slot ins.adsbygoogle { width: 100%; min-height: 600px; }
.side-ad-placeholder { color: #c0c8d4; }

/* Reserve side rails only where a 160px ad can sit without touching the 1160px tool. */
@media (max-width: 1519px) {
  .side-ad { display: none; }
}

@media print {
  .side-ad { display: none !important; }
}
