/* TradeDocsNow - one accent colour, system fonts, mobile first. */
:root {
  --accent: #0f766e;
  --accent-dark: #115e59;
  --accent-soft: #e6f4f2;
  --ink: #111827;
  --muted: #4b5563;
  --line: #e5e7eb;
  --bg: #f8fafb;
  --card: #fff;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.6 var(--font); color: var(--ink); background: var(--bg); }
img, svg { max-width: 100%; height: auto; }
a { color: var(--accent-dark); }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); letter-spacing: -.01em; }
h2 { font-size: 1.35rem; margin-top: 1.6em; }
h3 { font-size: 1.1rem; margin-top: 1.4em; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 0; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 1rem; }
.wrap-wide { max-width: 1440px; }
.prose { max-width: 760px; }

/* Header and footer */
.site-head { background: #fff; border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 60px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.logo svg { width: 30px; height: 30px; }
.nav { display: flex; gap: .25rem 1rem; flex-wrap: wrap; font-size: .95rem; padding: .25rem 0; }
.nav a { color: var(--muted); text-decoration: none; padding: .35rem 0; }
.nav a:hover, .nav a[aria-current] { color: var(--accent-dark); }
.site-foot { margin-top: 4rem; padding: 2rem 0 3rem; border-top: 1px solid var(--line); background: #fff; font-size: .92rem; color: var(--muted); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-bottom: 1rem; }
.site-foot a { color: var(--muted); }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .55rem 1.1rem;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: #cbd5e1; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn.small { min-height: 36px; padding: .3rem .8rem; font-size: .9rem; }

/* Page intro */
.crumbs { font-size: .88rem; color: var(--muted); margin: 1.25rem 0 .75rem; }
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.crumbs li + li::before { content: "›"; margin-right: .35rem; }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 760px; }

/* Tool layout */
.tool { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; margin-top: 1.25rem; align-items: start; }
.preview-col { min-width: 0; }
@media (min-width: 980px) {
  .tool { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .preview-col { position: sticky; top: 1rem; }
}
/* Ad rail only exists on wide screens, so it never pushes content around. */
.ad-rail { display: none; }
@media (min-width: 1380px) {
  .tool { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 300px; }
  .ad-rail { display: block; position: sticky; top: 1rem; }
}

/* Reserved ad space (empty for now). Fixed min-heights stop layout shift when ads are added. */
.ad-slot { min-height: 280px; margin: 1.25rem 0; }
.ad-rail.ad-slot { min-height: 600px; margin: 0; }

/* Form */
.doc-form fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 1rem 1rem .5rem; margin: 0 0 1rem; min-width: 0; }
.doc-form legend { font-weight: 700; padding: 0 .35rem; }
.f { display: block; margin-bottom: .85rem; }
.f > span { display: block; font-size: .9rem; font-weight: 600; margin-bottom: .25rem; }
.f small, .hint { display: block; font-size: .84rem; color: var(--muted); margin-top: .25rem; }
input, select, textarea { width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: #fff; border: 1px solid #cbd5e1; border-radius: 7px; padding: .55rem .65rem; min-height: 44px; }
textarea { min-height: 76px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); outline-offset: 0; }
.row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 .85rem; }
@media (min-width: 560px) { .row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.check { display: flex; align-items: flex-start; gap: .55rem; margin-bottom: .85rem; font-size: .95rem; }
.check input { width: 20px; height: 20px; min-height: 0; margin-top: .2rem; flex: none; accent-color: var(--accent); }
.saved-note { background: var(--accent-soft); border-radius: 7px; padding: .5rem .75rem; font-size: .9rem; margin-bottom: .85rem; }
.inline-actions { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin-bottom: .85rem; font-size: .9rem; }

/* Line items */
.item { display: grid; grid-template-columns: 1fr 1fr auto; gap: .5rem; padding: .75rem 0; border-bottom: 1px dashed var(--line); align-items: end; }
.item label span { display: block; font-size: .8rem; color: var(--muted); margin-bottom: .15rem; }
.item-desc { grid-column: 1 / -1; }
.item-total { grid-column: 1 / -1; font-weight: 600; font-variant-numeric: tabular-nums; }
.item-remove { grid-column: 3; grid-row: 2; width: 44px; height: 44px; border: 1px solid var(--line); background: #fff; border-radius: 7px; font-size: 1.3rem; cursor: pointer; color: var(--muted); }
.item-remove:hover { color: #b91c1c; border-color: #fca5a5; }
@media (min-width: 560px) {
  .item { grid-template-columns: minmax(0, 1fr) 70px 100px 90px 44px; }
  .item-desc { grid-column: auto; }
  .item-total { grid-column: auto; text-align: right; padding-bottom: .6rem; }
  .item-remove { grid-column: auto; grid-row: auto; }
}
.items-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .85rem 0; flex-wrap: wrap; }
.form-total { font-weight: 700; font-size: 1.05rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .25rem 0 1rem; }
.chips-label { font-size: .85rem; color: var(--muted); margin: 0 0 .3rem; }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: .4rem .75rem; font: inherit; font-size: .85rem; cursor: pointer; min-height: 36px; color: var(--ink); }
.chip:hover { border-color: var(--accent); color: var(--accent-dark); }

.actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 25%); padding: 1rem 0 .75rem; display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; z-index: 2; }
.actions .btn { flex: 1 1 auto; }
@media (min-width: 980px) { .actions { position: static; background: none; } .actions .btn { flex: 0 0 auto; } }
.status { font-size: .9rem; color: var(--muted); min-height: 1.4em; margin: 0; }

/* Preview */
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; }
.preview-head h2 { margin: 0; font-size: 1.1rem; }
.paper { background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 24px rgba(15, 23, 42, .07); min-height: 520px; overflow: hidden; }
.pv { padding: 7% 7% 8%; font-size: 12.5px; line-height: 1.45; color: var(--ink); }
.pv table { border-collapse: collapse; width: 100%; }
.pv th { text-align: left; font-weight: 600; }
.pv .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pv-ph { color: #6b7280; font-style: italic; }
.pv-head { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: 1em; border-bottom: 1px solid var(--line); margin-bottom: 1.2em; }
.pv-bizname { font-size: 1.45em; font-weight: 700; color: var(--accent); line-height: 1.2; }
.pv-small { color: var(--muted); font-size: .9em; margin-top: .3em; }
.pv-meta { text-align: right; flex: none; }
.pv-title { font-size: 1.75em; font-weight: 800; letter-spacing: .02em; }
.pv-paid { color: var(--accent); font-size: .55em; vertical-align: middle; border: 2px solid var(--accent); border-radius: 4px; padding: 0 .3em; }
.pv-meta table { width: auto; margin-left: auto; margin-top: .3em; }
.pv-meta th { color: var(--muted); font-weight: 400; padding: 1px .75em 1px 0; text-align: right; }
.pv-meta td { font-weight: 600; text-align: right; }
.pv-parties { display: flex; gap: 1.5rem; justify-content: space-between; margin-bottom: 1.4em; }
.pv-label { font-size: .78em; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .2em; }
.pv-items th { background: #f3f4f6; color: var(--muted); font-size: .8em; text-transform: uppercase; letter-spacing: .04em; padding: .55em .5em; }
.pv-items td { padding: .55em .5em; border-bottom: 1px solid var(--line); vertical-align: top; }
.pv-totals { width: 55% !important; margin: 1em 0 1.4em auto; }
.pv-totals th { color: var(--muted); font-weight: 400; padding: .3em .5em; }
.pv-totals td { text-align: right; padding: .3em .5em; font-variant-numeric: tabular-nums; }
.pv-grand th, .pv-grand td { background: var(--accent); color: #fff; font-weight: 700; font-size: 1.1em; }
.pv-due { font-weight: 700; font-size: 1.05em; }
.pv-sec { margin-bottom: 1em; }
.pv-sec p { margin: 0; }
.pv-sign { display: flex; gap: 2rem; margin-top: 2em; }
.pv-sign span { flex: 1; border-top: 1px solid #9ca3af; padding-top: .2em; color: var(--muted); font-size: .9em; }
.pv-sign span:last-child { flex: .6; }
.pv-foot { margin-top: 2em; color: var(--muted); font-size: .85em; }
.pv-letter p { margin: 0 0 .9em; }
.pv-from { text-align: right; margin-bottom: 1.5em; }
.pv-from strong { color: var(--accent); font-size: 1.2em; }
.pv-from div { color: var(--muted); white-space: pre-line; }
.pv-to { margin-bottom: 1.2em; }
.pv-summary { background: #f3f4f6; margin: .4em 0 1.2em; }
.pv-summary th { color: var(--muted); font-weight: 400; padding: .35em .9em; width: 42%; }
.pv-summary td { font-weight: 700; padding: .35em .9em; }
.pv-signname { font-weight: 700; margin-top: 1.6em !important; }

/* Content */
.content { margin-top: 2.5rem; }
.content ul, .content ol { padding-left: 1.3rem; }
.content li { margin-bottom: .35rem; }
.faq details { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: .75rem 1rem; margin-bottom: .6rem; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq details p { margin: .6rem 0 0; }
.notice { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: .75rem 1rem; font-size: .93rem; }
.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem; padding: 0; list-style: none; }
.related a { display: block; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .7rem .9rem; text-decoration: none; font-weight: 600; }
.related a:hover { border-color: var(--accent); }

/* Home */
.hero { padding: 2.5rem 0 1rem; }
.hero p { font-size: 1.12rem; color: var(--muted); max-width: 680px; }
.hero .btns { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.25rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; margin-top: 1rem; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.card h3 { margin-top: 0; }
.card ul { list-style: none; padding: 0; margin: 0; }
.card li { padding: .25rem 0; }
.points { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; padding: 0; list-style: none; }
.points li { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.points strong { display: block; margin-bottom: .2rem; }

/* Cookie banner */
.consent { position: fixed; left: 1rem; right: 1rem; bottom: 1rem; max-width: 560px; margin: 0 auto; background: #fff; border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(15, 23, 42, .18); border-radius: 12px; padding: 1rem; z-index: 50; font-size: .95rem; }
.consent p { margin: 0 0 .75rem; }
.consent-btns { display: flex; gap: .5rem; justify-content: flex-end; }

@media print {
  .site-head, .site-foot, .doc-form, .ad-slot, .content, .crumbs, .preview-head, h1, .lead, .consent { display: none !important; }
  .tool { display: block; }
  .paper { border: 0; box-shadow: none; }
}
