/*! site.css — design system + shared chrome for the Free Online Tools platform.
    Tokens first, then primitives, then layout. Tool-specific rules live in
    invoice.css so a second tool can reuse this file untouched. */

/* ============================== tokens ============================== */
:root {
  /* Ledger stationery palette: cool paper greys, one ink-green accent. */
  --desk:        #EDF1F4;
  --desk-deep:   #E2E8ED;
  --surface:     #FFFFFF;
  --surface-2:   #F7F9FB;
  --ink:         #141A21;
  --ink-2:       #3B4652;
  --muted:       #66727F;
  --line:        #DCE3EA;
  --line-strong: #C2CDD8;
  --brand:       #0B6B5B;
  --brand-ink:   #06503F;
  --brand-soft:  #E4F0ED;
  --danger:      #A3271C;
  --danger-soft: #FBEBE9;
  --warn:        #8A5B00;
  --warn-soft:   #FDF3E0;
  --ok:          #0B6B5B;

  --radius:    10px;
  --radius-sm: 7px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(20, 26, 33, .06);
  --shadow-md: 0 4px 16px rgba(20, 26, 33, .08);
  --shadow-lg: 0 18px 48px rgba(20, 26, 33, .14);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --wrap: 1240px;
  --gap: 20px;
  --header-h: 60px;
}

/* ============================== reset =============================== */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

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

body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; letter-spacing: -.02em; font-weight: 700; }
h1 { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.9rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + 1.1vw, 1.8rem); }
h3 { font-size: 1.1rem; }
p  { margin: 0 0 1em; }

a { color: var(--brand-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 3px;
}

.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;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm); transition: top .15s;
}
.skip-link:focus { top: 0; color: #fff; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 16px; }
@media (min-width: 768px) { .wrap { padding-inline: 24px; } }

/* ============================== header ============================== */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex; align-items: center; gap: 16px;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 700; letter-spacing: -.02em; color: var(--ink);
  text-decoration: none; font-size: 1.02rem; margin-right: auto;
}
.brand:hover { color: var(--ink); }

.brand-mark {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: .82rem; font-weight: 600;
}

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  color: var(--ink-2); text-decoration: none; font-size: .93rem;
  padding: 8px 11px; border-radius: var(--radius-sm); font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--brand-ink); background: var(--brand-soft); }

.nav-toggle {
  display: none; width: 40px; height: 40px; padding: 0;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--radius-sm); cursor: pointer;
  align-items: center; justify-content: center;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  content: ""; display: block; width: 17px; height: 1.5px;
  background: var(--ink); border-radius: 2px;
}
.nav-toggle span { position: relative; }
.nav-toggle span::before { position: absolute; top: -5px; }
.nav-toggle span::after  { position: absolute; top: 5px; }

@media (max-width: 767px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: 6px 12px 12px; box-shadow: var(--shadow-md);
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 12px 10px; font-size: 1rem; }
  .site-header { position: sticky; }
  .header-inner { position: relative; }
}

/* ============================= primitives =========================== */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px;
  background: var(--btn-bg); color: var(--btn-fg);
  border: 1px solid var(--btn-bd); border-radius: var(--radius-sm);
  font: inherit; font-size: .94rem; font-weight: 600; line-height: 1;
  text-decoration: none; cursor: pointer;
  transition: background .14s ease, border-color .14s ease, transform .14s ease;
}
.btn:hover { background: var(--surface-2); color: var(--btn-fg); }
.btn:active { transform: translateY(1px); }

.btn--primary { --btn-bg: var(--brand); --btn-fg: #fff; --btn-bd: var(--brand); }
.btn--primary:hover { --btn-bg: var(--brand-ink); color: #fff; }

.btn--dark { --btn-bg: var(--ink); --btn-fg: #fff; --btn-bd: var(--ink); }
.btn--dark:hover { --btn-bg: #000; color: #fff; }

.btn--ghost { --btn-bd: var(--line); }
.btn--danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: var(--danger); }
.btn--danger:hover { --btn-bg: #86200f; color: #fff; }
.btn--danger-text { color: var(--danger); }
.btn--danger-text:hover { background: var(--danger-soft); color: var(--danger); }

.btn--sm { min-height: 34px; padding: 0 11px; font-size: .85rem; }
.btn--lg { min-height: 50px; padding: 0 24px; font-size: 1rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.icon-btn {
  width: 32px; height: 32px; padding: 0; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 1rem; line-height: 1; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.icon-btn.is-danger:hover { background: var(--danger-soft); border-color: #f0cfca; color: var(--danger); }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.field-label {
  font-family: var(--font-mono); font-size: .68rem; font-weight: 500;
  letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
}

.input, .select, .textarea {
  width: 100%; max-width: 100%; min-height: 42px;
  padding: 9px 11px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font: inherit; font-size: .94rem;
  transition: border-color .14s ease, box-shadow .14s ease;
}
.input:hover, .select:hover, .textarea:hover { border-color: #a9b7c4; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11, 107, 91, .14);
}
.input::placeholder, .textarea::placeholder { color: #9aa6b2; }
.input.is-invalid { border-color: var(--danger); }
.input.is-invalid:focus { box-shadow: 0 0 0 3px rgba(163, 39, 28, .13); }

.input--num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }

.textarea { min-height: 84px; resize: vertical; line-height: 1.55; }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' stroke='%2366727F' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
  padding-right: 32px;
}

.input-affix { position: relative; display: flex; align-items: center; }
.input-affix-text {
  position: absolute; left: 10px; z-index: 1;
  font-family: var(--font-mono); font-size: .76rem; color: var(--muted);
  pointer-events: none;
}
.input-affix .input { padding-left: 42px; }

.field-error { margin: 0; font-size: .8rem; color: var(--danger); }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: .93rem; }
.switch input { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}

.eyebrow {
  display: inline-block; font-family: var(--font-mono); font-size: .68rem;
  letter-spacing: .11em; text-transform: uppercase; color: var(--brand-ink);
  margin-bottom: 10px;
}

.empty-note { margin: 0; color: var(--muted); font-size: .88rem; }
.empty-state { text-align: center; padding: 28px 16px; }
.empty-state-title { font-weight: 600; margin-bottom: 6px; }

/* ============================== modals ============================== */
.modal {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  padding: 16px;
  background: rgba(20, 26, 33, .45);
}
.modal[hidden] { display: none; }

.modal-panel {
  width: 100%; max-width: 640px; max-height: 86vh; overflow: auto;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.modal-panel--sm { max-width: 460px; }

.modal-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 18px 20px 12px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal-head p { margin: 4px 0 0; font-size: .88rem; color: var(--muted); }
.modal-close {
  margin-left: auto; width: 34px; height: 34px; flex: none;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--radius-sm); cursor: pointer; font-size: 1.1rem;
  line-height: 1; color: var(--muted);
}
.modal-close:hover { background: var(--surface-2); color: var(--ink); }
.modal-body { padding: 18px 20px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px 18px; flex-wrap: wrap;
}

/* ============================== toasts ============================== */
.toasts {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  z-index: 80; display: flex; flex-direction: column; gap: 8px;
  width: min(440px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--ink); color: #fff; font-size: .9rem;
  box-shadow: var(--shadow-md); animation: toast-in .2s ease;
}
.toast--ok   { background: var(--brand-ink); }
.toast--warn { background: #7a4a00; }
.toast.is-leaving { opacity: 0; transition: opacity .25s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 767px) {
  .toasts { bottom: 78px; }
}

/* ============================== ad slots ============================ */
/* An empty .ad-slot is removed from the DOM by site.js, so these styles only
   ever apply to a slot the administrator has actually filled. Nothing here is
   allowed near the invoice sheet, and print CSS hides all of it. */
.ad-slot { margin: 22px 0; text-align: center; }
.ad-slot-inner {
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; max-width: 100%;
}
.ad-slot-inner > * { max-width: 100%; }
.ad-label {
  display: block; margin-bottom: 6px;
  font-family: var(--font-mono); font-size: .62rem; letter-spacing: .12em;
  text-transform: uppercase; color: #9aa6b2;
}
@media (max-width: 1023px) { .ad-slot[data-ad-position="sidebar"] { display: none; } }

/* ============================ SEO content =========================== */
.prose { max-width: 72ch; }
.prose h2 { margin-top: 1.8em; }
.prose h3 { margin-top: 1.4em; font-size: 1.03rem; }
.prose ul, .prose ol { margin: 0 0 1em; padding-left: 1.2em; }
.prose li { margin-bottom: .4em; }
.prose strong { font-weight: 600; }

.content-section { padding: 40px 0; }
.content-section + .content-section { border-top: 1px solid var(--line); }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li {
  counter-increment: step; position: relative;
  padding-left: 44px; margin-bottom: 18px;
}
.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: 1px;
  font-family: var(--font-mono); font-size: .78rem; font-weight: 600;
  color: var(--brand-ink); background: var(--brand-soft);
  width: 30px; height: 26px; display: grid; place-items: center;
  border-radius: 5px;
}
.steps strong { display: block; }

.faq-item {
  border-bottom: 1px solid var(--line);
}
.faq-item summary {
  padding: 15px 34px 15px 0; cursor: pointer; position: relative;
  font-weight: 600; list-style: none; font-size: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; position: absolute; right: 6px; top: 50%;
  transform: translateY(-50%); font-family: var(--font-mono);
  font-size: 1.2rem; color: var(--muted); font-weight: 400;
}
.faq-item[open] summary::after { content: "\2212"; }
.faq-item summary:hover { color: var(--brand-ink); }
.faq-item .faq-answer { padding: 0 0 16px; color: var(--ink-2); max-width: 72ch; }
.faq-item .faq-answer p:last-child { margin-bottom: 0; }

/* ============================ tool cards ============================ */
.tool-grid-cards {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.tool-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink);
  transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}
a.tool-card:hover {
  border-color: var(--brand); box-shadow: var(--shadow-md);
  transform: translateY(-2px); color: var(--ink);
}
.tool-card-title { font-weight: 700; letter-spacing: -.01em; }
.tool-card-desc { font-size: .88rem; color: var(--muted); line-height: 1.5; }
.tool-card-tag {
  align-self: flex-start; margin-top: 4px;
  font-family: var(--font-mono); font-size: .64rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--brand-ink);
  background: var(--brand-soft); padding: 3px 7px; border-radius: 4px;
}
.tool-card--soon { opacity: .72; cursor: default; }
.tool-card--soon .tool-card-tag { color: var(--muted); background: var(--desk-deep); }

/* ============================ breadcrumbs =========================== */
.breadcrumbs {
  font-size: .82rem; color: var(--muted); padding: 12px 0 0;
}
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.breadcrumbs li::after { content: "/"; margin-left: 6px; color: var(--line-strong); }
.breadcrumbs li:last-child::after { content: ""; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--brand-ink); text-decoration: underline; }

/* ============================== footer ============================== */
.site-footer {
  margin-top: 48px; padding: 36px 0 28px;
  background: var(--surface); border-top: 1px solid var(--line);
}
.footer-grid {
  display: grid; gap: 26px;
  grid-template-columns: minmax(220px, 1.4fr) repeat(auto-fit, minmax(140px, 1fr));
}
.footer-tagline { color: var(--muted); font-size: .89rem; max-width: 34ch; margin: 8px 0 0; }
.footer-col h3 {
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 10px; font-weight: 500;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.footer-col a { color: var(--ink-2); text-decoration: none; font-size: .9rem; }
.footer-col a:hover { color: var(--brand-ink); text-decoration: underline; }
.footer-credit a { color: var(--brand-ink); font-weight: 600; text-decoration: none; }
.footer-credit a:hover { text-decoration: underline; }

.footer-bottom {
  margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between;
  font-size: .82rem; color: var(--muted);
}

/* =========================== simple pages ========================== */
.page-head { padding: 36px 0 8px; }
.page-body { padding-bottom: 24px; }
.page-body .prose { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; max-width: none; }
@media (min-width: 768px) { .page-body .prose { padding: 32px 36px; } }
.page-body .prose > :last-child { margin-bottom: 0; }


/* ============================== account ============================= */
.account-btn { flex: none; }
.account-btn[data-signed-in] {
  background: var(--brand-soft); border-color: var(--brand-soft); color: var(--brand-ink);
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (max-width: 767px) { .account-btn { margin-left: auto; margin-right: 8px; } }

.account-email { font-weight: 600; margin-bottom: 6px; word-break: break-all; }
.account-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.account-error {
  margin: 0 0 12px; padding: 9px 11px; border-radius: var(--radius-sm);
  background: var(--danger-soft); color: var(--danger); font-size: .87rem;
}
.account-switch { margin: 14px 0 0; font-size: .88rem; color: var(--muted); text-align: center; }
.link-btn {
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
  color: var(--brand-ink); font-weight: 600; text-decoration: underline;
}
#account-modal .field { margin-bottom: 12px; }
