/* ==========================================================================
   EWD Labs shared styles. Mobile first: base styles are for phones,
   then min-width media queries add tablet (48em) and desktop (64em) layout.
   ========================================================================== */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + var(--s4)); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img, svg { display: block; max-width: 100%; }
a { color: var(--brand-ink); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.12; margin: 0; letter-spacing: -0.015em; }
h1 { font-size: var(--text-3xl); font-weight: 750; letter-spacing: -0.03em; }
h2 { font-size: var(--text-2xl); font-weight: 700; }
h3 { font-size: var(--text-lg); font-weight: 650; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[x-cloak] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.icon { width: 1.25rem; height: 1.25rem; flex: none; stroke-width: 2; }
.visually-hidden {
  position: absolute !important; 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: var(--s4); top: -100px; z-index: 100;
  background: var(--brand); color: var(--on-brand); padding: var(--s2) var(--s4);
  border-radius: var(--radius-sm); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: var(--s2); }

.wrap { width: 100%; max-width: var(--page-max); margin-inline: auto; padding-inline: var(--s4); }
@media (min-width: 48em) { .wrap { padding-inline: var(--s6); } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s5);
  border: 0; border-radius: var(--radius); cursor: pointer;
  font-weight: 600; text-decoration: none; white-space: nowrap;
  background: var(--brand); color: var(--on-brand);
  transition: transform 80ms ease;
}
.btn:active { transform: translateY(1px); }
.btn-quiet { background: var(--surface); color: var(--ink); border: var(--border); }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: var(--radius); background: transparent; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--surface); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg); border-bottom: var(--border);
}
.site-header .wrap { display: flex; align-items: center; gap: var(--s2); height: var(--header-h); }
.brand {
  display: inline-flex; align-items: center; gap: var(--s2);
  color: var(--ink); text-decoration: none; margin-right: auto;
  font-family: var(--font-display); font-weight: 750; font-size: 1.25rem; letter-spacing: -0.03em;
}
.brand-mark {
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 26px; height: 26px;
}
.brand-mark span { border-radius: 3px; }
.brand-mark span:nth-child(1) { background: var(--brand); }
.brand-mark span:nth-child(2) { background: var(--finance); }
.brand-mark span:nth-child(3) { background: var(--text); }
.brand-mark span:nth-child(4) { background: var(--seo-web); }

.header-nav { display: none; }
.header-nav a {
  color: var(--muted); text-decoration: none; font-weight: 550; font-size: var(--text-sm);
  padding: var(--s2) var(--s3); border-radius: var(--radius-sm);
}
.header-nav a:hover, .header-nav a[aria-current="page"] { color: var(--ink); background: var(--surface); }

.search-trigger {
  display: none; align-items: center; gap: var(--s2);
  height: 40px; padding: 0 var(--s3); min-width: 15rem;
  border: var(--border); border-radius: var(--radius); background: var(--surface);
  color: var(--muted); cursor: pointer; font-size: var(--text-sm);
}
.search-trigger kbd, .search-box kbd {
  margin-left: auto; font-family: var(--font-body); font-size: var(--text-xs);
  border: var(--border); border-radius: 5px; padding: 0 6px; background: var(--bg); color: var(--muted);
}
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

@media (min-width: 64em) {
  .header-nav { display: flex; gap: var(--s1); margin-right: var(--s4); }
  .search-trigger { display: inline-flex; }
  .search-icon-btn, .menu-btn { display: none; }
}

/* ---------- Mobile drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgb(14 16 32 / 0.5); z-index: 60; }
.drawer {
  position: fixed; inset: 0 0 0 auto; width: min(22rem, 88vw); z-index: 61;
  background: var(--bg); border-left: var(--border); overflow-y: auto;
  padding: var(--s4); display: flex; flex-direction: column; gap: var(--s4);
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-title { font-family: var(--font-display); font-weight: 700; font-size: var(--text-lg); }
.drawer nav { display: grid; gap: var(--s1); }
.drawer nav a {
  display: flex; align-items: center; gap: var(--s3); padding: var(--s3);
  border-radius: var(--radius); color: var(--ink); text-decoration: none; font-weight: 550;
}
.drawer nav a:hover { background: var(--surface); }

/* ---------- Search palette ---------- */
.search-dialog {
  position: fixed; inset: 0; z-index: 70; display: grid; align-items: start; justify-items: center;
  padding: var(--s4); padding-top: min(12vh, 6rem); background: rgb(14 16 32 / 0.55);
}
.search-panel {
  width: min(40rem, 100%); background: var(--raised); border: var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.search-box { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s4); border-bottom: var(--border); }
.search-box input {
  flex: 1; min-width: 0; height: 56px; border: 0; background: transparent; outline: none; font-size: var(--text-lg);
}
.search-results { list-style: none; margin: 0; padding: var(--s2); max-height: min(60vh, 26rem); overflow-y: auto; }
.search-results a {
  display: flex; align-items: center; gap: var(--s3); padding: var(--s3);
  border-radius: var(--radius); color: var(--ink); text-decoration: none;
}
.search-results a[aria-selected="true"] { background: var(--brand-soft); }
.search-results .r-name { font-weight: 600; }
.search-results .r-cat { font-size: var(--text-xs); color: var(--muted); }
.search-empty { padding: var(--s5) var(--s4); color: var(--muted); }

/* ---------- Category colour helpers ---------- */
.cat-finance   { --c: var(--finance);   --c-ink: var(--finance-ink);   --c-soft: var(--finance-soft); }
.cat-developer { --c: var(--developer); --c-ink: var(--developer-ink); --c-soft: var(--developer-soft); }
.cat-text      { --c: var(--text);      --c-ink: var(--text-ink);      --c-soft: var(--text-soft); }
.cat-seo-web   { --c: var(--seo-web);   --c-ink: var(--seo-web-ink);   --c-soft: var(--seo-web-soft); }
.cat-image     { --c: var(--image);     --c-ink: var(--image-ink);     --c-soft: var(--image-soft); }
.cat-everyday  { --c: var(--everyday);  --c-ink: var(--everyday-ink);  --c-soft: var(--everyday-soft); }

.chip {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: var(--radius); background: var(--c); color: var(--on-category);
}
.chip .icon { width: 1.25rem; height: 1.25rem; }
.chip-sm { width: 32px; height: 32px; border-radius: 8px; }
.chip-sm .icon { width: 1.05rem; height: 1.05rem; }

/* ---------- Home ---------- */
.hero { padding-block: var(--s6) var(--s5); }
.hero h1 { max-width: 14ch; }
.hero .lead { margin-top: var(--s3); font-size: var(--text-lg); color: var(--muted); max-width: 46ch; }
.hero-search {
  margin-top: var(--s5); display: flex; align-items: center; gap: var(--s3);
  width: 100%; max-width: 40rem; height: 56px; padding: 0 var(--s4);
  border: 2px solid var(--ink); border-radius: var(--radius-lg); background: var(--bg);
  color: var(--muted); font-size: var(--text-lg); cursor: text; text-align: left;
}
.hero-search:hover { border-color: var(--brand); }
@media (min-width: 48em) { .hero { padding-block: var(--s8) var(--s6); } }

/* The signature element: flat, full-colour category blocks. */
.cat-blocks {
  display: grid; gap: var(--s2);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  list-style: none; padding: 0; margin: 0 0 var(--s7);
}
.cat-blocks li { display: flex; }
.cat-block {
  flex: 1; min-width: 0; container-type: inline-size;
  display: flex; flex-direction: column; justify-content: space-between; gap: var(--s5);
  min-height: 7.5rem; padding: var(--s4);
  border-radius: var(--radius-lg); background: var(--c); color: var(--on-category);
  text-decoration: none;
}
.cat-block .icon { width: 1.75rem; height: 1.75rem; }
.cat-block-name {
  font-family: var(--font-display); font-weight: 700; line-height: 1.1; letter-spacing: -0.02em;
  /* Names never wrap: the size follows the tile's width, up to the normal heading size. */
  white-space: nowrap; font-size: min(var(--text-xl), 17cqi);
}
.cat-block-count { font-weight: 600; font-size: var(--text-sm); }
.cat-block:hover { outline: 3px solid var(--ink); outline-offset: 2px; }
@media (max-width: 47.99em) { .cat-blocks li:last-child:nth-child(odd) { grid-column: span 2; } .cat-block { min-height: 6.5rem; } }
@media (min-width: 48em) { .cat-blocks { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 64em) {
  .cat-blocks { grid-template-columns: repeat(var(--cat-count, 5), minmax(0, 1fr)); }
  .cat-block { min-height: 10rem; padding: var(--s5); }
}

.section { margin-bottom: var(--s7); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s4); }
.section-head a { font-weight: 600; font-size: var(--text-sm); text-decoration: none; }

/* Tool lists: quiet rows, colour only in the chip. */
.tool-list {
  list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 48em) { .tool-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 64em) { .tool-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tool-link {
  display: flex; align-items: flex-start; gap: var(--s3); height: 100%;
  padding: var(--s4); border: var(--border); border-radius: var(--radius-lg);
  color: var(--ink); text-decoration: none; background: var(--raised);
}
.tool-link:hover { border-color: var(--c); }
.tool-link-name { display: block; font-weight: 650; line-height: 1.3; }
.tool-link-sum { display: block; margin-top: 2px; font-size: var(--text-sm); color: var(--muted); }

.cat-section { margin-bottom: var(--s6); }
.cat-section-title { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s4); }
.cat-section-title h3 { font-size: var(--text-xl); }
.cat-section-title a { color: inherit; text-decoration: none; }

/* ---------- Page header (category, tool, 404) ---------- */
.crumbs { padding-top: var(--s4); font-size: var(--text-sm); color: var(--muted); }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); }
.crumbs li + li::before { content: "/"; margin-right: var(--s2); color: var(--line-strong); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.page-head { padding-block: var(--s4) var(--s5); display: flex; gap: var(--s4); align-items: flex-start; }
.page-head .chip { width: 48px; height: 48px; margin-top: 4px; }
.page-head .chip .icon { width: 1.5rem; height: 1.5rem; }
.page-head .lead { margin-top: var(--s2); color: var(--muted); font-size: var(--text-lg); max-width: 60ch; }
@media (min-width: 48em) { .page-head { padding-block: var(--s5) var(--s6); } .page-head .chip { width: 56px; height: 56px; } }

/* ---------- Tool page layout ---------- */
.tool-layout { display: grid; gap: var(--s6); grid-template-columns: minmax(0, 1fr); padding-bottom: var(--s7); }
@media (min-width: 64em) { .tool-layout { grid-template-columns: minmax(0, 1fr) 18rem; gap: var(--s7); } }
.tool-main { display: grid; gap: var(--s6); align-content: start; min-width: 0; }

.tool-card {
  background: var(--raised); border: var(--border); border-radius: var(--radius-lg);
  padding: var(--s5); min-width: 0;
}
@media (min-width: 48em) { .tool-card { padding: var(--s6); } }
.tool-card-soon { display: grid; gap: var(--s3); justify-items: start; background: var(--surface); }
.tool-card-soon .icon { width: 2rem; height: 2rem; color: var(--c-ink); }

.badge {
  display: inline-flex; align-items: center; gap: var(--s2); font-size: var(--text-sm); font-weight: 550;
  color: var(--success);
}
.badge .icon { width: 1rem; height: 1rem; }

.help { max-width: var(--content-max); display: grid; gap: var(--s4); }
.help h2 { font-size: var(--text-xl); margin-top: var(--s4); }
.help p, .help li { color: var(--ink); }

.rail h2 { font-size: var(--text-lg); margin-bottom: var(--s3); }
.rail .tool-list { grid-template-columns: minmax(0, 1fr); }
.rail .tool-link { padding: var(--s3); border-radius: var(--radius); }
.rail .tool-link-sum { display: none; }
@media (min-width: 64em) { .rail-inner { position: sticky; top: calc(var(--header-h) + var(--s5)); } }

/* ---------- The single ad slot ---------- */
.ad-slot { width: 100%; max-width: 728px; }
.ad-label { font-size: var(--text-xs); color: var(--muted); margin-bottom: var(--s1); }
/* min-height reserves space so nothing jumps; never a fixed height. */
.ad-box { min-height: 280px; }
.ad-placeholder {
  display: grid; place-items: center; min-height: 280px; border: 1px dashed var(--line-strong);
  border-radius: var(--radius); background: var(--surface); color: var(--muted); font-size: var(--text-sm);
}

/* ---------- 404 ---------- */
.nf { padding-block: var(--s7); display: grid; gap: var(--s4); justify-items: start; }
.nf .btn-row { justify-self: stretch; }
.nf .lead { color: var(--muted); font-size: var(--text-lg); max-width: 50ch; }

/* ---------- Footer ---------- */
.site-footer { border-top: var(--border); background: var(--surface); padding-block: var(--s6); font-size: var(--text-sm); color: var(--muted); }
.footer-grid { display: grid; gap: var(--s5); }
@media (min-width: 48em) { .footer-grid { grid-template-columns: 2fr 3fr; } }
.footer-cats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2) var(--s4); }
@media (min-width: 48em) { .footer-cats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.footer-cats a { color: var(--ink); text-decoration: none; font-weight: 550; }
.footer-cats a:hover { text-decoration: underline; }
.footer-note { margin-top: var(--s2); max-width: 40ch; }
.footer-bottom { margin-top: var(--s5); padding-top: var(--s4); border-top: var(--border); }
.footer-bottom a { color: var(--muted); }

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

.search-results .chip { width: 12px; height: 12px; border-radius: 3px; }

/* ==========================================================================
   Tool components (shared by every tool)
   ========================================================================== */
.btn-sm { min-height: 40px; padding: 0 var(--s4); font-size: var(--text-sm); }
.btn-sm .icon { width: 1.05rem; height: 1.05rem; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }
/* Button rows (one rule for the whole site):
   - always right-aligned, with the main action last in the markup so it sits on the right;
   - on phones every row is filled edge to edge, by one button or by several sharing the width. */
.btn-row, .page-actions { display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: flex-end; align-items: center; }
.page-actions { margin-top: var(--s4); }
@media (max-width: 39.99em) {
  .btn-row > .btn, .page-actions > .btn, .input-action > .btn { flex: 1 1 auto; justify-content: center; }
}
/* A text box with its button: the button sits on the right, and drops to a full-width row on phones. */
.input-action { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: flex-end; }
.input-action > .field, .input-action > .input { flex: 1 1 14rem; min-width: 0; }
.fav-btn.is-on { color: var(--seo-web-ink); border-color: var(--seo-web); background: var(--seo-web-soft); }
.fav-btn.is-on .icon { fill: currentColor; }

.form-grid { display: grid; gap: var(--s5); }
@media (min-width: 48em) { .form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.field { display: grid; gap: var(--s2); align-content: start; min-width: 0; }
.field > label, .field-label { font-weight: 600; font-size: var(--text-sm); }
.field-hint { font-size: var(--text-xs); color: var(--muted); }
.field-error { font-size: var(--text-sm); color: var(--danger); font-weight: 550; }

.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: var(--s3) var(--s4);
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--bg);
  font-size: var(--text-base);
}
.textarea { min-height: 12rem; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input-group { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--bg); overflow: hidden; }
.input-group:focus-within { outline: 3px solid var(--focus); border-color: var(--focus); }
.input-group .addon { display: grid; place-items: center; padding: 0 var(--s3); background: var(--surface); color: var(--muted); font-weight: 600; border-right: var(--border); }
.input-group .addon-end { border-right: 0; border-left: var(--border); }
.input-group .input { border: 0; border-radius: 0; outline: none; }
.input-group[aria-invalid="true"] { border-color: var(--danger); }

/* Segmented control: a row of options that look like one switch. */
.segmented { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: var(--radius); background: var(--surface); border: var(--border); }
.segmented label { flex: 1 1 auto; position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 40px; padding: 0 var(--s3); border-radius: 7px;
  font-weight: 600; font-size: var(--text-sm); color: var(--muted); white-space: nowrap;
}
.segmented input:checked + span { background: var(--c, var(--brand)); color: var(--on-category); }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 1px; }
.segmented-sm { margin-top: var(--s2); }
.segmented-sm span { min-height: 36px; font-size: var(--text-xs); }

.check { display: flex; align-items: center; gap: var(--s3); min-height: 44px; cursor: pointer; font-weight: 550; }
.check input { width: 20px; height: 20px; accent-color: var(--c, var(--brand)); margin: 0; }
.range { width: 100%; accent-color: var(--c, var(--brand)); height: 28px; }

/* Results */
.results { margin-top: var(--s6); padding-top: var(--s5); border-top: var(--border); display: grid; gap: var(--s5); }
.results > * { min-width: 0; }
.result-hero { display: grid; gap: var(--s1); }
.result-hero-label { font-size: var(--text-sm); font-weight: 600; color: var(--muted); }
.result-hero-value {
  font-family: var(--font-display); font-weight: 750; letter-spacing: -0.03em; line-height: 1.05;
  font-size: clamp(2rem, 1.5rem + 2.5vw, 3rem); color: var(--c-ink, var(--ink));
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.stats { display: grid; gap: var(--s2); grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
@media (min-width: 48em) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stat { padding: var(--s3) var(--s4); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.stat dt { font-size: var(--text-xs); color: var(--muted); font-weight: 600; }
.stat dd { margin: 2px 0 0; font-weight: 700; font-size: var(--text-lg); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.result-note { font-size: var(--text-sm); color: var(--muted); }
.output {
  display: flex; align-items: center; gap: var(--s3); padding: var(--s4);
  border-radius: var(--radius); background: var(--surface); border: var(--border);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: var(--text-xl);
  overflow-wrap: anywhere; word-break: break-all; min-height: 64px;
}
.toast { font-size: var(--text-sm); font-weight: 600; color: var(--success); display: inline-flex; align-items: center; gap: var(--s2); }
.toast .icon { width: 1rem; height: 1rem; }

.meter { height: 8px; border-radius: 99px; background: var(--surface); border: var(--border); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 99px; background: var(--meter, var(--brand)); }

/* Tables (schedules, comparisons). The wrapper scrolls sideways on small phones. */
.table-wrap { overflow-x: auto; border: var(--border); border-radius: var(--radius); }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: var(--s2) var(--s3); text-align: right; border-bottom: var(--border); white-space: nowrap; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table thead th { background: var(--surface); font-weight: 650; color: var(--muted); font-size: var(--text-xs); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .row-strong td { font-weight: 700; }
details.more { border: var(--border); border-radius: var(--radius); }
details.more > summary { cursor: pointer; padding: var(--s3) var(--s4); font-weight: 600; display: flex; align-items: center; gap: var(--s2); }
details.more > summary .icon { width: 1.05rem; height: 1.05rem; }
details.more[open] > summary { border-bottom: var(--border); }
details.more > .more-body { padding: var(--s3); }

@media (min-width: 48em) { .form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.span-all { grid-column: 1 / -1; }

/* Side-by-side options, e.g. new vs old tax regime. The better one gets a solid colour edge. */
.compare { display: grid; gap: var(--s3); }
@media (min-width: 40em) { .compare { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.compare-card { padding: var(--s4); border: var(--border); border-radius: var(--radius); display: grid; gap: var(--s2); align-content: start; }
.compare-card.is-best { border: 2px solid var(--c, var(--brand)); background: var(--c-soft, var(--surface)); }
.compare-card h3 { margin: 0; font-size: var(--text-base); display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.compare-value { font-family: var(--font-display); font-size: var(--text-2xl, 1.6rem); font-weight: 750; font-variant-numeric: tabular-nums; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; font-size: var(--text-xs); font-weight: 700; background: var(--c, var(--brand)); color: var(--on-category); }
.pill .icon { width: 0.9rem; height: 0.9rem; }

/* Code and long text output */
.code-out {
  margin: 0; padding: var(--s4); border-radius: var(--radius); background: var(--surface); border: var(--border);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: var(--text-sm); line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 28rem; overflow: auto;
}
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.text-out { padding: var(--s4); border-radius: var(--radius); background: var(--surface); border: var(--border); font-size: var(--text-lg); line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; min-height: 64px; }
.counter { font-size: var(--text-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.counter.is-over { color: var(--danger); font-weight: 650; }

/* Rows of small option chips, e.g. presets */
.chip-row { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip-btn { min-height: 36px; padding: 0 var(--s3); border-radius: 99px; border: var(--border); background: var(--bg); font-size: var(--text-sm); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--ink); }
.chip-btn .icon { width: 0.95rem; height: 0.95rem; }
.chip-btn:hover { border-color: var(--c, var(--brand)); }
.chip-btn[aria-pressed="true"] { background: var(--c, var(--brand)); border-color: var(--c, var(--brand)); color: var(--on-category); }

/* Lists of items that can be added and removed (price compare). */
.item-list { display: grid; gap: var(--s3); }
.item { display: grid; gap: var(--s3); padding: var(--s4); border: var(--border); border-radius: var(--radius); }
.item.is-best { border: 2px solid var(--c, var(--brand)); background: var(--c-soft, var(--surface)); }
.item-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); font-weight: 650; }
.item-fields { display: grid; gap: var(--s3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 47.99em) { .item-fields > :first-child { grid-column: 1 / -1; } }
@media (min-width: 48em) { .item-fields { grid-template-columns: 2fr 2fr 1.4fr; } }

/* Rich text editor */
.editor-bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border: 1px solid var(--line-strong); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; background: var(--surface); position: sticky; top: 64px; z-index: 2; }
.editor-bar .icon-btn { width: 40px; height: 40px; }
.editor-bar .sep { width: 1px; background: var(--line); margin: 4px 2px; }
.editor {
  min-height: 22rem; padding: var(--s4) var(--s5); border: 1px solid var(--line-strong); border-radius: 0 0 var(--radius) var(--radius);
  background: var(--bg); font-size: var(--text-lg); line-height: 1.7; overflow-wrap: anywhere;
}
.editor:focus { outline: 3px solid var(--focus); outline-offset: 0; }
.editor:empty::before { content: attr(data-placeholder); color: var(--muted); }
.editor h2 { font-size: 1.5rem; margin: 1.2em 0 0.4em; }
.editor h3 { font-size: 1.2rem; margin: 1em 0 0.3em; }
.editor blockquote { margin: 1em 0; padding-left: var(--s4); border-left: 4px solid var(--c, var(--brand)); color: var(--muted); }
.editor a { color: var(--brand-ink); }

/* Thumbnails grid */
.thumbs { display: grid; gap: var(--s4); }
@media (min-width: 40em) { .thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.thumb { display: grid; gap: var(--s2); padding: var(--s3); border: var(--border); border-radius: var(--radius); align-content: start; }
.thumb img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: var(--surface); }
.thumb-meta { display: flex; justify-content: space-between; gap: var(--s2); font-size: var(--text-sm); }
.thumb-meta strong { font-weight: 650; }

/* Status block, e.g. domain days left */
.status-card { padding: var(--s4); border-radius: var(--radius); border: 2px solid var(--status, var(--line)); display: grid; gap: var(--s2); }
.notice { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--radius); background: var(--surface); border: var(--border); font-size: var(--text-sm); }
.notice .icon { flex: none; width: 1.15rem; height: 1.15rem; margin-top: 2px; }
.notice.is-error { border-color: var(--danger); color: var(--danger); }

/* Feedback */
.feedback { padding-top: var(--s4); border-top: var(--border); }
.feedback-form { display: grid; gap: var(--s3); max-width: 40rem; }
.feedback-form label { font-weight: 600; }
.feedback-form textarea { width: 100%; padding: var(--s3); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--bg); }

.help ul, .help ol { margin: 0; padding-left: 1.25rem; display: grid; gap: var(--s2); }
.help code { font-size: 0.92em; background: var(--surface); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }
.help .formula { padding: var(--s3) var(--s4); border-left: 4px solid var(--c, var(--brand)); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }

/* Print: only the tool and its results. */
@media print {
  .site-header, .site-footer, .rail, .ad-slot, .page-actions, .feedback, .badge, .btn-row, .skip-link, .crumbs, .search-dialog, .drawer { display: none !important; }
  body { background: #fff; color: #000; }
  .tool-card { border: 0; padding: 0; }
  .tool-layout { display: block; }
}

/* Percentage calculator: questions written as sentences with inline boxes. */
.pc-q { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; }
.pc-in { width: 4.5rem; min-height: 44px; padding: var(--s2) var(--s3); text-align: right; font-variant-numeric: tabular-nums; }
.pc-a { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; min-height: 2.6rem; }
.pc-a .btn-row { margin-left: auto; }
@media (max-width: 39.99em) { .pc-a .btn-row { flex: 1 1 100%; } }
@media (min-width: 30em) { .pc-in { width: 7rem; } }
.editor-bar .icon-btn[aria-pressed="true"] { background: var(--c, var(--brand)); color: var(--on-category); }
.link-bar { padding: var(--s2); border: 1px solid var(--line-strong); border-bottom: 0; background: var(--surface); align-items: center; }
.link-bar .input { min-height: 40px; }
.btn.is-danger { color: var(--danger); border-color: var(--danger); }
.kv-table, .kv-table tbody { display: block; }
.kv-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: var(--s2); padding: var(--s2) var(--s3); border-bottom: var(--border); }
.kv-table tr:last-child { border-bottom: 0; }
.kv-table th, .kv-table td { padding: 0; border: 0; white-space: normal; text-align: left; }
.kv-table th { grid-column: 1 / -1; font-weight: 600; color: var(--muted); font-size: var(--text-xs); }
.kv-table td.mono { overflow-wrap: anywhere; font-size: var(--text-sm); }
.kv-table .btn-sm { min-height: 34px; padding: 0 var(--s3); }
.input[type="date"], .input[type="datetime-local"], .input[type="time"] { min-width: 0; max-width: 100%; }
.compare-card h3 .icon { width: 1.1rem; height: 1.1rem; }
.pd-groups { display: grid; gap: var(--s4); }
@media (min-width: 64em) { .pd-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pd-group-title { font-size: var(--text-base); margin: 0 0 var(--s2); }
.pd-table td, .pd-table th { white-space: normal; text-align: left; vertical-align: middle; }
.pd-table td.mono { overflow-wrap: anywhere; }
.pd-table .chip-btn { min-height: 32px; }
.cron-fields { display: grid; gap: var(--s3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cron-fields .field:last-child { grid-column: 1 / -1; }
@media (min-width: 40em) { .cron-fields { grid-template-columns: repeat(5, minmax(0, 1fr)); } .cron-fields .field:last-child { grid-column: auto; } }
.cron-runs { margin: var(--s2) 0 0; padding-left: 1.4rem; display: grid; gap: 4px; font-variant-numeric: tabular-nums; }
/* Search result and share card previews */
.serp { display: grid; gap: 4px; font-family: Arial, sans-serif; overflow-wrap: anywhere; }
.serp-site { display: flex; gap: var(--s2); align-items: center; font-size: 13px; }
.serp-site > span:last-child { display: grid; }
.serp-fav { width: 26px; height: 26px; border-radius: 50%; background: var(--surface); border: var(--border); flex: none; }
.serp-name { color: var(--ink); }
.serp-url { color: var(--muted); font-size: 12px; }
.serp-title { color: #1a0dab; font-size: 19px; line-height: 1.3; }
[data-theme="dark"] .serp-title { color: #99c3ff; }
.serp-desc { color: var(--muted); font-size: 14px; line-height: 1.55; }
.share-card { border: var(--border); border-radius: var(--radius); overflow: hidden; }
.share-img { aspect-ratio: 1.91 / 1; background: var(--surface); }
.share-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.share-body { display: grid; gap: 2px; padding: var(--s3); font-size: var(--text-sm); overflow-wrap: anywhere; }
.share-host { color: var(--muted); font-size: var(--text-xs); text-transform: lowercase; }
.dc-form .btn { min-height: 48px; }
.status-card.is-ok { --status: var(--success); }
.status-card.is-soon { --status: var(--text); }
.status-card.is-urgent, .status-card.is-expired { --status: var(--danger); }
.status-card.is-urgent .result-hero-value, .status-card.is-expired .result-hero-value { color: var(--danger); }
.status-card.is-ok .result-hero-value { color: var(--success); }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

/* Space for the first two packs, so the page doesn't jump when the form appears. */
.wp-items { min-height: 567px; }
@media (min-width: 48em) { .wp-items { min-height: 382px; } }

/* Two-part bar, e.g. principal vs interest. Flat colours, with a legend for screen readers and colour-blind visitors. */
.split { display: grid; gap: var(--s2); }
.split-bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--surface); border: var(--border); }
.split-bar > span { display: block; height: 100%; min-width: 2px; }
.split-bar > .part-a, .split-key .part-a::before { background: var(--c, var(--brand)); }
.split-bar > .part-b, .split-key .part-b::before { background: var(--ink); opacity: .78; }
.split-key { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); font-size: var(--text-sm); color: var(--muted); margin: 0; padding: 0; list-style: none; }
.split-key li { display: inline-flex; align-items: center; gap: var(--s2); }
.split-key li::before { content: ""; width: 12px; height: 12px; border-radius: 3px; }
.split-key strong { color: var(--ink); font-variant-numeric: tabular-nums; }

/* GST invoice generator */
.inv-form { display: grid; gap: var(--s4); }
.inv-box { border: var(--border); border-radius: var(--radius); padding: var(--s4); margin: 0; min-width: 0; }
.inv-box > legend { font-weight: 700; padding: 0 var(--s2); }
.inv-box > .btn-row { margin-top: var(--s3); }
.inv-items { display: grid; gap: var(--s3); min-height: 330px; }
@media (min-width: 48em) { .inv-items { min-height: 200px; } }
.inv-item { border-radius: var(--radius); background: var(--surface); padding: var(--s3); display: grid; gap: var(--s2); }
.inv-item-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); min-height: 36px; }
.inv-item-grid { display: grid; gap: var(--s2) var(--s3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.inv-item-grid .inv-name { grid-column: 1 / -1; }
@media (min-width: 48em) {
  .inv-item-grid { grid-template-columns: 3fr 1.2fr 0.8fr 0.8fr 1.2fr 1fr 1fr; }
  .inv-item-grid .inv-name { grid-column: auto; }
  .inv-line-total { grid-column: 1 / -1; }
}
.inv-line-total { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: var(--s2); align-items: baseline; font-variant-numeric: tabular-nums; }
.inv-line-total span { color: var(--muted); font-size: var(--text-sm); }
.invoice-paper { border: var(--border); border-radius: var(--radius); padding: var(--s5); background: var(--bg); display: grid; gap: var(--s4); font-size: var(--text-sm); }
.ip-head { display: grid; gap: var(--s1); border-bottom: 2px solid var(--c, var(--brand)); padding-bottom: var(--s3); }
.ip-title { margin: 0; font-size: var(--text-xl); }
.ip-meta { margin: 0; display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); }
.ip-parties { display: grid; gap: var(--s4); }
@media (min-width: 40em) { .ip-parties { grid-template-columns: 1fr 1fr; } }
.ip-parties h3 { margin: 0 0 var(--s1); font-size: var(--text-xs); color: var(--muted); }
.ip-parties p { margin: 0 0 var(--s1); }
.ip-pre { white-space: pre-line; }
.ip-bottom { display: grid; gap: var(--s4); align-items: start; }
@media (min-width: 48em) { .ip-bottom { grid-template-columns: 1.3fr 1fr; } }
.ip-totals { margin: 0; display: grid; gap: var(--s1); }
.ip-totals > div { display: flex; justify-content: space-between; gap: var(--s3); font-variant-numeric: tabular-nums; }
.ip-totals dt { color: var(--muted); }
.ip-totals dd { margin: 0; font-weight: 600; }
.ip-grand { border-top: var(--border); padding-top: var(--s2); font-size: var(--text-base); }
.ip-grand dt, .ip-grand dd { color: var(--ink); font-weight: 750; }
.ip-words { margin: 0; font-weight: 600; text-transform: capitalize; }
.ip-foot { display: grid; gap: var(--s3); }
@media (min-width: 40em) { .ip-foot { grid-template-columns: repeat(3, 1fr); } }
.ip-sign { text-align: right; grid-column: -2 / -1; }
@media print {
  body.print-invoice .tool-layout > :not(.tool-main), body.print-invoice .tool-main > :not(.tool-card),
  body.print-invoice .inv-form, body.print-invoice .result-hero, body.print-invoice .stats, body.print-invoice .result-note,
  body.print-invoice .page-head, body.print-invoice .help, body.print-invoice .toast { display: none !important; }
  body.print-invoice .results { border: 0; margin: 0; padding: 0; }
  body.print-invoice .invoice-paper { border: 0; padding: 0; color: #000; }
  body.print-invoice .table-wrap { overflow: visible; border: 0; }
  .ip-bottom { grid-template-columns: 1.3fr 1fr; }
  .ip-parties { grid-template-columns: 1fr 1fr; }
}
.ip-items th:nth-child(2), .ip-items td:nth-child(2) { text-align: left; white-space: normal; min-width: 10rem; }

/* One-line status under developer tools: valid, invalid or waiting. */
.status-line { margin: 0; min-height: 1.6em; font-weight: 600; font-size: var(--text-sm); color: var(--muted); }
.status-line > span { display: inline-flex; gap: var(--s2); align-items: flex-start; }
.status-line .icon { width: 1.1rem; height: 1.1rem; flex: none; margin-top: 2px; }
.status-line .is-good { color: var(--success); }
.status-line .is-bad { color: var(--danger); }
.kv-left th { text-align: left; font-weight: 650; width: 32%; white-space: normal; }
.kv-left td { text-align: left; white-space: normal; overflow-wrap: anywhere; }
.kv-left .icon-btn { vertical-align: middle; }
.jwt-parts { display: grid; gap: var(--s4); }
@media (min-width: 64em) { .jwt-parts { grid-template-columns: 1fr 1.4fr; } .jwt-parts .table-wrap { grid-column: 1 / -1; } }

.muted { color: var(--muted); font-weight: 500; }
.rx-out { font-size: var(--text-sm); min-height: 6rem; max-height: 24rem; overflow: auto; }
.rx-hit { background: var(--c-soft, var(--surface)); box-shadow: inset 0 -2px 0 var(--c, var(--brand)); border-radius: 3px; }
.rx-pattern .addon { font-family: ui-monospace, Consolas, monospace; }
.hash-table th { width: 6.5rem; }
.hash-table td:last-child { width: 44px; text-align: right; }
.hash { font-size: var(--text-xs); word-break: break-all; }
.notice.has-action { flex-wrap: wrap; align-items: center; }
.notice.has-action > span { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }

/* Image tools: drop zone and previews. */
.drop {
  display: grid; place-items: center; gap: var(--s2); text-align: center; min-height: 11rem; padding: var(--s5);
  border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer;
}
.drop:hover, .drop.is-over { border-color: var(--c, var(--brand)); background: var(--c-soft, var(--surface)); }
.drop:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.drop .icon { width: 2rem; height: 2rem; color: var(--c-ink, var(--brand)); }
.drop strong { font-size: var(--text-lg); }
.drop small { color: var(--muted); }
.img-preview { display: grid; gap: var(--s2); justify-items: center; padding: var(--s3); border: var(--border); border-radius: var(--radius); background: var(--surface); }
.img-preview img { max-width: 100%; max-height: 22rem; height: auto; width: auto; display: block; }
.img-list { display: grid; gap: var(--s2); }
.img-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: var(--s2); border: var(--border); border-radius: var(--radius); }
.img-row img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; background: var(--surface); }
.img-row .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.img-row .meta { font-size: var(--text-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.img-row .saved { color: var(--success); font-weight: 650; }
.img-row .grew { color: var(--danger); font-weight: 650; }
.img-actions { display: flex; gap: var(--s1); }

/* Case converter: one row per case, label, result, actions. */
.case-list { display: grid; gap: var(--s2); }
.case-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s1) var(--s3); align-items: center; padding: var(--s2) var(--s3); border: var(--border); border-radius: var(--radius); }
.case-name { font-size: var(--text-xs); font-weight: 650; color: var(--muted); grid-column: 1; }
.case-out { grid-column: 1; overflow-wrap: anywhere; white-space: pre-wrap; min-height: 1.5em; font-variant-ligatures: none; }
.case-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: var(--s1); }
@media (min-width: 48em) { .case-row { grid-template-columns: 11rem minmax(0, 1fr) auto; } .case-name, .case-out { grid-column: auto; } .case-actions { grid-column: 3; grid-row: 1; } }
.lorem-out { font-size: var(--text-base); height: 24rem; overflow: auto; }
.qr-kinds span .icon { width: 1rem; height: 1rem; }
.qr-fields { margin-top: var(--s4); min-height: 5.5rem; }
.qr-color { min-height: 44px; padding: 4px; }
.qr-box { display: grid; place-items: center; min-height: 272px; padding: var(--s4); border: var(--border); border-radius: var(--radius); background: var(--surface); text-align: center; }
.qr-box img { width: 240px; height: 240px; image-rendering: pixelated; background: #fff; }
.age-hero { font-size: clamp(1.6rem, 1.2rem + 2vw, 2.4rem); }
.uc-row { display: grid; gap: var(--s3); margin-top: var(--s4); grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; }
.uc-row > .field:first-child { grid-column: 1 / -1; }
.uc-swap { margin-bottom: 4px; }
@media (min-width: 48em) { .uc-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto minmax(0, 1.2fr); } .uc-row > .field:first-child { grid-column: auto; } }
.vat-rates { min-height: 50px; }
.input-group .addon-btn { border: 0; border-right: var(--border); min-width: 44px; cursor: pointer; color: var(--ink); }
.input-group .addon-btn.addon-end { border-right: 0; border-left: var(--border); }
.input-group .addon-btn:hover { background: var(--c-soft, var(--brand-soft)); }
.input-group .addon-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.input-group .addon-btn .icon { width: 1.1rem; height: 1.1rem; }
.seg-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 40em) { .seg-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
/* ---------- Footer links and plain pages ---------- */
.footer-links { margin-top: var(--s5); display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); align-items: center; }
.footer-links a, .link-btn { color: var(--ink); font-weight: 550; text-decoration: none; min-height: 32px; display: inline-flex; align-items: center; }
.footer-links a:hover, .link-btn:hover { text-decoration: underline; }
.link-btn { gap: var(--s2); background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-weight: 550; }
.link-btn .icon { width: 1rem; height: 1rem; }
.link-btn[hidden] { display: none; }
.static-page { padding-bottom: var(--s7, 4rem); }
.contact-card { margin-bottom: var(--s3); }
.contact-card .btn-row { margin-top: var(--s5); }
