/* ==========================================================================
   FreeDocuTools.com - Production Stylesheet
   1. Tokens & reset            5. Tool workspace & panels
   2. Layout & ad containers    6. Tool-specific components
   3. Header & navigation       7. FAQ, footer, overlay, toast
   4. Home view & tool grid     8. Responsive breakpoints
   ========================================================================== */

/* ==========================================================================
   1. DESIGN TOKENS & RESET
   ========================================================================== */
:root {
  --brand:        #e11d48;
  --brand-dark:   #be123c;
  --brand-soft:   rgba(225, 29, 72, .10);
  --accent:       #2563eb;
  --green:        #059669;
  --violet:       #7c3aed;
  --amber:        #d97706;

  --bg:           #f6f7fb;
  --bg-alt:       #eef1f7;
  --surface:      #ffffff;
  --surface-2:    #f9fafb;
  --border:       #e2e8f0;
  --border-str:   #cbd5e1;

  --text:         #0f172a;
  --text-soft:    #475569;
  --text-mute:    #64748b;

  --radius-sm:    8px;
  --radius:       14px;
  --radius-lg:    20px;

  --shadow-sm:    0 1px 2px rgba(15, 23, 42, .06);
  --shadow:       0 4px 16px rgba(15, 23, 42, .08);
  --shadow-lg:    0 18px 48px rgba(15, 23, 42, .14);

  --header-h:     68px;
  --maxw:         1280px;
  --gap:          20px;

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

html[data-theme="dark"] {
  --brand:        #fb7185;
  --brand-dark:   #f43f5e;
  --brand-soft:   rgba(251, 113, 133, .14);
  --accent:       #60a5fa;
  --green:        #34d399;
  --violet:       #a78bfa;
  --amber:        #fbbf24;

  --bg:           #0b1120;
  --bg-alt:       #0f172a;
  --surface:      #111a2e;
  --surface-2:    #16203a;
  --border:       #1f2b47;
  --border-str:   #2b3a5c;

  --text:         #e8edf7;
  --text-soft:    #b3c0d6;
  --text-mute:    #8496b3;

  --shadow-sm:    0 1px 2px rgba(0, 0, 0, .4);
  --shadow:       0 4px 18px rgba(0, 0, 0, .45);
  --shadow-lg:    0 20px 50px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; font-weight: 700; letter-spacing: -.02em; }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; list-style: none; }
img, svg, canvas, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

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

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--brand); color: #fff; padding: 12px 18px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ==========================================================================
   2. LAYOUT + ZERO-CLS AD CONTAINERS
   ========================================================================== */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 32px;
  align-items: start;
  padding-top: 26px;
  padding-bottom: 50px;
}

.content { min-width: 0; }

.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* --- Ad slots: heights are hard-reserved so nothing shifts on fill (0 CLS) - */
.ad-wrap { width: 100%; }
.ad-wrap--top { padding: 14px 0 0; }

.ad-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px dashed var(--border-str);
  border-radius: var(--radius-sm);
  contain: strict;
}

.ad-slot__label {
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-mute);
  opacity: .7;
}

/* 970x90 leaderboard -> 728x90 -> 320x100 (height locked per breakpoint) */
.ad-slot--leaderboard { width: 970px; max-width: 100%; height: 90px; min-height: 90px; }
/* 300x250 medium rectangle */
.ad-slot--rect { width: 300px; max-width: 100%; height: 250px; min-height: 250px; }
/* 336x280 in-content large rectangle */
.ad-slot--inline { width: 336px; max-width: 100%; height: 280px; min-height: 280px; margin: 34px auto; }

/* ==========================================================================
   3. HEADER & NAVIGATION
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 90;
  height: var(--header-h);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

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

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -.03em; flex-shrink: 0; }
.brand__mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff;
  box-shadow: 0 6px 16px var(--brand-soft);
}
.brand__text span { color: var(--brand); }
.brand--footer { font-size: 18px; margin-bottom: 12px; }

.main-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.main-nav__link {
  padding: 8px 14px; border-radius: 999px; font-size: 14.5px; font-weight: 600;
  color: var(--text-soft); transition: background .15s, color .15s;
}
.main-nav__link:hover, .main-nav__link.is-active { background: var(--brand-soft); color: var(--brand); }

.header-actions { display: flex; align-items: center; gap: 8px; margin-left: 8px; }

.lang-switch { position: relative; display: flex; align-items: center; }
.lang-switch__icon { position: absolute; left: 10px; display: grid; place-items: center; color: var(--text-mute); pointer-events: none; }
.lang-switch select {
  appearance: none; -webkit-appearance: none;
  padding: 9px 30px 9px 32px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); font-size: 13.5px; font-weight: 600; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-mute) 50%), linear-gradient(135deg, var(--text-mute) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.lang-switch select:hover { border-color: var(--border-str); }

.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text-soft); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }

.icon-moon { display: none; }
html[data-theme="dark"] .icon-sun { display: none; }
html[data-theme="dark"] .icon-moon { display: block; }

.menu-btn { display: none; }

/* ==========================================================================
   4. HOME VIEW - HERO, CATEGORIES, TOOL GRID
   ========================================================================== */
.hero { text-align: center; padding: 30px 0 26px; }

.hero__badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 14px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
  font-size: 12.5px; font-weight: 700; letter-spacing: .01em;
  margin-bottom: 18px;
}

.hero__title {
  font-size: clamp(30px, 5vw, 47px);
  letter-spacing: -.035em;
  max-width: 18ch;
  margin: 0 auto .18em;
  background: linear-gradient(120deg, var(--text) 30%, var(--brand));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

.hero__sub { max-width: 62ch; margin: 0 auto 26px; color: var(--text-soft); font-size: 17px; }

.hero__search {
  position: relative; display: flex; align-items: center;
  max-width: 560px; margin: 0 auto 22px;
}
.hero__search svg { position: absolute; left: 18px; color: var(--text-mute); }
.hero__search input {
  width: 100%; padding: 15px 18px 15px 48px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow-sm);
  font-size: 15.5px; transition: border-color .15s, box-shadow .15s;
}
.hero__search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }

.hero__stats { display: flex; justify-content: center; gap: 40px; flex-wrap: wrap; }
.hero__stats li { display: flex; flex-direction: column; align-items: center; }
.hero__stats strong { font-size: 26px; font-weight: 800; color: var(--brand); letter-spacing: -.03em; }
.hero__stats span { font-size: 12.5px; color: var(--text-mute); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }

.cat-tabs {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  margin: 26px 0 6px;
}
.cat-tab {
  padding: 9px 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 14px; font-weight: 600; color: var(--text-soft);
  transition: all .15s;
}
.cat-tab:hover { border-color: var(--brand); color: var(--brand); }
.cat-tab.is-active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 18px var(--brand-soft); }

.section-title {
  font-size: clamp(21px, 2.6vw, 27px);
  margin: 36px 0 18px;
  letter-spacing: -.03em;
}

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 16px; }

.tool-card {
  display: flex; gap: 14px; text-align: left; cursor: pointer;
  padding: 18px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm);
  transition: transform .18s cubic-bezier(.2,.8,.3,1), box-shadow .18s, border-color .18s;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand); }
.tool-card[hidden] { display: none; }

.tool-card__icon {
  flex: 0 0 44px; width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; color: #fff;
}
.ic-red    { background: linear-gradient(135deg, #f43f5e, #be123c); }
.ic-green  { background: linear-gradient(135deg, #10b981, #047857); }
.ic-violet { background: linear-gradient(135deg, #a78bfa, #6d28d9); }
.ic-blue   { background: linear-gradient(135deg, #60a5fa, #1d4ed8); }

.tool-card__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tool-card__title { font-weight: 700; font-size: 15.5px; letter-spacing: -.015em; }
.tool-card__desc { font-size: 13.5px; color: var(--text-mute); line-height: 1.5; }

.grid-empty { text-align: center; color: var(--text-mute); padding: 30px 0; }

/* --- Feature / trust band --- */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.feature {
  padding: 20px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.feature__icon {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  background: var(--brand-soft); color: var(--brand); margin-bottom: 12px;
}
.feature h3 { font-size: 16px; margin-bottom: 6px; }
.feature p { font-size: 13.8px; color: var(--text-mute); margin: 0; }

/* ==========================================================================
   5. TOOL WORKSPACE
   ========================================================================== */
.view[hidden] { display: none; }

.back-btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  margin: 4px 0 18px; padding: 8px 14px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  font-size: 14px; font-weight: 600; color: var(--text-soft); transition: all .15s;
}
.back-btn:hover { border-color: var(--brand); color: var(--brand); }

.tool-head { margin-bottom: 22px; }
.tool-head__title { font-size: clamp(24px, 3.4vw, 33px); margin-bottom: .25em; }
.tool-head__desc { color: var(--text-soft); max-width: 74ch; margin: 0; }

.tool-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 26px; box-shadow: var(--shadow-sm);
}
.tool-panel[hidden] { display: none; }

.sub-title { font-size: 17px; margin: 28px 0 14px; padding-top: 22px; border-top: 1px solid var(--border); }

/* --- Dropzone (iLovePDF-style) --- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; cursor: pointer;
  min-height: 230px; padding: 34px 22px;
  border: 2px dashed var(--border-str); border-radius: var(--radius);
  background: var(--surface-2);
  transition: border-color .16s, background .16s, transform .16s;
}
.dropzone:hover { border-color: var(--brand); background: var(--brand-soft); }
.dropzone.is-drag { border-color: var(--brand); background: var(--brand-soft); transform: scale(1.006); }
.dropzone__icon { color: var(--brand); margin-bottom: 6px; }
.dropzone strong { font-size: 17.5px; }
.dropzone span { font-size: 13.5px; color: var(--text-mute); }

/* --- Form fields --- */
.opt-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 16px; margin-top: 22px;
}
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field--full { grid-column: 1 / -1; }
.field--action { justify-content: flex-end; flex-direction: row; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.field--check { justify-content: center; }

.field > label { font-size: 13.5px; font-weight: 600; color: var(--text-soft); }
.field output { color: var(--brand); font-variant-numeric: tabular-nums; }

.field input[type="text"], .field input[type="url"], .field input[type="number"],
.field input[type="search"], .field select, .field textarea,
.pw-output input, textarea {
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-size: 14.5px; transition: border-color .15s, box-shadow .15s;
}
.field textarea, textarea { font-family: inherit; resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.field input[type="color"] { width: 100%; height: 42px; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 999px; background: var(--border-str);
  cursor: pointer; margin: 8px 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--brand); border: 3px solid var(--surface);
  box-shadow: 0 2px 8px rgba(0,0,0,.25); cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--brand); border: 3px solid var(--surface); cursor: pointer;
}

.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-soft); }
.check input { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }

.range-legend { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-mute); }

.hint { font-size: 13px; color: var(--text-mute); margin: 10px 0 0; }

/* --- Buttons --- */
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 26px; border-radius: 999px; cursor: pointer;
  border: 1px solid transparent; font-size: 15px; font-weight: 700;
  transition: transform .14s, box-shadow .14s, background .14s, color .14s;
}
.btn--primary { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; box-shadow: 0 8px 22px var(--brand-soft); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 12px 28px var(--brand-soft); }
.btn--ghost { background: var(--surface); border-color: var(--border-str); color: var(--text-soft); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn--sm { padding: 9px 16px; font-size: 13.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* --- Segmented control --- */
.seg-control {
  display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
}
.seg {
  padding: 9px 18px; border: none; border-radius: 999px; cursor: pointer;
  background: transparent; font-size: 14px; font-weight: 600; color: var(--text-soft);
  transition: background .15s, color .15s;
}
.seg:hover { color: var(--brand); }
.seg.is-active { background: var(--brand); color: #fff; }

/* --- Chips --- */
.chip-row { display: flex; flex-wrap: wrap; gap: 9px; margin: 18px 0; }
.chip {
  padding: 9px 15px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 13.5px; font-weight: 600; color: var(--text-soft); transition: all .15s;
}
.chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ==========================================================================
   6. TOOL-SPECIFIC COMPONENTS
   ========================================================================== */

/* --- Image thumbnails (JPG to PDF) --- */
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; margin-top: 22px; }
.thumb-grid:empty { display: none; }

.thumb {
  position: relative; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); overflow: hidden; cursor: grab;
}
.thumb.is-dragging { opacity: .4; }
.thumb canvas, .thumb img { width: 100%; height: 120px; object-fit: contain; background: var(--bg-alt); }
.thumb__name { display: block; padding: 7px 9px; font-size: 11.5px; color: var(--text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb__del {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px;
  display: grid; place-items: center; cursor: pointer;
  border: none; border-radius: 50%; background: rgba(15,23,42,.72); color: #fff; font-size: 15px; line-height: 1;
}
.thumb__del:hover { background: var(--brand); }
.thumb__idx {
  position: absolute; top: 6px; left: 6px; min-width: 22px; height: 22px; padding: 0 6px;
  display: grid; place-items: center; border-radius: 999px;
  background: var(--brand); color: #fff; font-size: 11.5px; font-weight: 700;
}

/* --- File chip / sortable list --- */
.file-chip {
  display: flex; align-items: center; gap: 12px; margin-top: 20px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
  font-size: 14px;
}
.file-chip b { font-weight: 700; }
.file-chip span { color: var(--text-mute); font-size: 13px; }

.sort-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.sort-list:empty { display: none; }
.sort-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 15px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); cursor: grab;
}
.sort-item.is-dragging { opacity: .4; border-style: dashed; }
.sort-item__grip { color: var(--text-mute); flex-shrink: 0; }
.sort-item__name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sort-item__meta { font-size: 12.5px; color: var(--text-mute); flex-shrink: 0; }
.sort-item__btns { display: flex; gap: 4px; flex-shrink: 0; }
.mini-btn {
  width: 30px; height: 30px; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--border); border-radius: 7px; background: var(--surface);
  color: var(--text-mute); font-size: 13px; line-height: 1;
}
.mini-btn:hover { border-color: var(--brand); color: var(--brand); }

/* --- Result box --- */
.result-box {
  margin-top: 22px; padding: 18px 20px;
  border: 1px solid var(--green); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--green) 10%, transparent);
  font-size: 14.5px;
}
.result-box b { color: var(--green); }

/* --- Rendered PDF pages --- */
.page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-top: 22px; }
.page-grid:empty { display: none; }
.page-item { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.page-item canvas { width: 100%; height: auto; background: #fff; }
.page-item__bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 11px; font-size: 12.5px; color: var(--text-mute); }

/* --- Calculators --- */
.calc-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 28px; align-items: start; }
.calc-inputs .opt-row { margin-top: 0; }

.calc-output {
  padding: 22px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2);
}

.donut-wrap { position: relative; max-width: 240px; margin: 0 auto 20px; }
.donut { width: 100%; height: auto; transform: rotate(-90deg); }
.donut__ring { fill: none; stroke: var(--border); stroke-width: 4.2; }
.donut__seg { fill: none; stroke-width: 4.2; stroke-linecap: butt; transition: stroke-dasharray .5s cubic-bezier(.2,.8,.3,1); }
.seg-net    { stroke: #10b981; }
.seg-tax    { stroke: #f43f5e; }
.seg-social { stroke: #f59e0b; }
.seg-other  { stroke: #6366f1; }

.donut__center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 0 26px;
}
.donut__label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--text-mute); font-weight: 700; }
.donut__center strong { font-size: clamp(20px, 3.4vw, 27px); font-weight: 800; letter-spacing: -.03em; color: var(--green); }
.donut__sub { font-size: 12px; color: var(--text-mute); }

.breakdown { display: flex; flex-direction: column; gap: 2px; margin-bottom: 18px; }
.breakdown li { display: flex; align-items: center; gap: 10px; padding: 9px 2px; font-size: 14px; border-bottom: 1px solid var(--border); }
.breakdown li:last-child { border-bottom: none; }
.breakdown li b { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; }
.breakdown li.is-total { font-weight: 700; color: var(--green); font-size: 15px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot--net { background: #10b981; } .dot--tax { background: #f43f5e; }
.dot--social { background: #f59e0b; } .dot--other { background: #6366f1; }
.dot--netsolid { background: var(--green); }

.mini-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mini-table th, .mini-table td { padding: 9px 8px; text-align: right; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.mini-table th:first-child, .mini-table td:first-child { text-align: left; }
.mini-table th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-mute); }

.stat-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 24px; }
.stat-row--grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); }
.stat {
  flex: 1 1 160px; padding: 16px 18px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.stat span { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-mute); font-weight: 700; }
.stat strong { font-size: clamp(19px, 2.6vw, 25px); font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat--accent { border-color: var(--brand); background: var(--brand-soft); }
.stat--accent strong { color: var(--brand); }
.stat--wide { flex-basis: 100%; }

/* --- Canvas stage (background remover) --- */
.canvas-stage {
  margin-top: 22px; padding: 16px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface-2); overflow: auto;
  display: flex; justify-content: center;
}
.canvas-stage canvas { max-width: 100%; height: auto; cursor: crosshair; border-radius: var(--radius-sm); }
.checker {
  background-image:
    linear-gradient(45deg, #cbd5e1 25%, transparent 25%),
    linear-gradient(-45deg, #cbd5e1 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #cbd5e1 75%),
    linear-gradient(-45deg, transparent 75%, #cbd5e1 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

/* --- Image compare --- */
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; margin-top: 22px; }
.compare__side { margin: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.compare__side img { width: 100%; height: 230px; object-fit: contain; background: var(--bg-alt); }
.compare__side figcaption { padding: 10px 12px; font-size: 13px; color: var(--text-mute); }
.saving { color: var(--green); font-weight: 700; }

/* --- QR --- */
.qr-stage { display: flex; justify-content: center; margin-top: 26px; }
.qr-host {
  display: grid; place-items: center; padding: 18px; min-height: 220px; min-width: 220px;
  border: 1px solid var(--border); border-radius: var(--radius); background: #fff;
}
.qr-host canvas, .qr-host img { max-width: min(100%, 340px); height: auto; }

/* --- Password --- */
.pw-output { display: flex; gap: 8px; align-items: center; }
.pw-output input {
  flex: 1; font-family: var(--mono); font-size: 17px; letter-spacing: .02em;
  padding: 15px 16px; border: 1px solid var(--border-str); border-radius: var(--radius-sm);
  background: var(--surface-2); overflow-wrap: anywhere;
}

.meter { margin-top: 16px; }
.meter__bar { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.meter__bar span { display: block; height: 100%; width: 0; border-radius: 999px; transition: width .3s, background .3s; background: var(--brand); }
.meter__meta { display: flex; justify-content: space-between; margin-top: 7px; font-size: 12.5px; font-weight: 700; color: var(--text-mute); }

.hash-out {
  margin-top: 14px; padding: 15px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); font-family: var(--mono); font-size: 13.5px;
  overflow-wrap: anywhere; color: var(--text-soft); min-height: 52px;
}

/* ==========================================================================
   7. FAQ, SIDEBAR CARDS, FOOTER, OVERLAY, TOAST
   ========================================================================== */
.faq { margin-top: 46px; }

.accordion { display: flex; flex-direction: column; gap: 10px; }
.acc-item { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.acc-item h3 { margin: 0; }
.acc-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; padding: 18px 20px; cursor: pointer;
  border: none; background: transparent; text-align: left;
  font-size: 15.5px; font-weight: 700; color: var(--text); letter-spacing: -.01em;
}
.acc-btn:hover { color: var(--brand); }
.acc-icon { position: relative; flex: 0 0 18px; width: 18px; height: 18px; }
.acc-icon::before, .acc-icon::after {
  content: ""; position: absolute; top: 50%; left: 0; width: 18px; height: 2px;
  border-radius: 2px; background: var(--brand); transition: transform .22s;
}
.acc-icon::after { transform: rotate(90deg); }
.acc-btn[aria-expanded="true"] .acc-icon::after { transform: rotate(0deg); }
.acc-panel { padding: 0 20px 20px; color: var(--text-soft); font-size: 14.5px; }
.acc-panel p { margin: 0; }

.side-card { padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.side-card__title { font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-mute); margin-bottom: 12px; }
.side-list { display: flex; flex-direction: column; }
.side-list a {
  display: block; padding: 9px 0; font-size: 14px; font-weight: 600; color: var(--text-soft);
  border-bottom: 1px solid var(--border); transition: color .15s, padding-left .15s;
}
.side-list li:last-child a { border-bottom: none; }
.side-list a:hover { color: var(--brand); padding-left: 5px; }
.side-card--note p { font-size: 13.5px; color: var(--text-mute); margin: 0; }

.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 46px 0 26px; margin-top: 20px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 30px; }
.footer-about { font-size: 13.8px; color: var(--text-mute); max-width: 42ch; }
.footer-title { font-size: 13px; text-transform: uppercase; letter-spacing: .09em; color: var(--text-mute); margin-bottom: 14px; }
.footer-col ul { display: flex; flex-direction: column; gap: 9px; }
.footer-col a { font-size: 14px; color: var(--text-soft); font-weight: 500; transition: color .15s; }
.footer-col a:hover { color: var(--brand); }
.footer-bottom {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-mute);
}
.footer-bottom p { margin: 0; }

/* Agency credit - external link, opens in a new tab */
.footer-credit { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.footer-credit__sep { opacity: .4; }
.footer-credit__by { display: inline-flex; align-items: center; gap: 5px; }
.footer-credit a {
  color: #3b82f6;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color .15s, text-decoration-thickness .15s;
}
.footer-credit a:hover, .footer-credit a:focus-visible {
  color: #2563eb;
  text-decoration-thickness: 2px;
}
/* Lighter blue in dark mode so the link keeps AA contrast on the dark surface */
html[data-theme="dark"] .footer-credit a { color: #60a5fa; }
html[data-theme="dark"] .footer-credit a:hover,
html[data-theme="dark"] .footer-credit a:focus-visible { color: #93c5fd; }

.overlay {
  position: fixed; inset: 0; z-index: 150;
  display: grid; place-items: center;
  background: rgba(2, 6, 23, .62); backdrop-filter: blur(3px);
}
.overlay[hidden] { display: none; }
.overlay__box {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 32px 42px; border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-lg); text-align: center;
}
.overlay__box p { margin: 0; font-weight: 600; }
.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 4px solid var(--border); border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 160;
  transform: translate(-50%, 130%);
  padding: 13px 22px; border-radius: 999px;
  background: var(--text); color: var(--bg);
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg);
  transition: transform .3s cubic-bezier(.2,.8,.3,1);
  max-width: calc(100vw - 32px); text-align: center;
}
.toast.is-visible { transform: translate(-50%, 0); }
.toast.is-error { background: var(--brand-dark); color: #fff; }

/* ==========================================================================
   8. RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .sidebar .side-card { flex: 1 1 280px; }
  .ad-slot--leaderboard { width: 728px; height: 90px; min-height: 90px; }
}

@media (max-width: 900px) {
  .calc-grid { grid-template-columns: minmax(0, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 780px) {
  :root { --header-h: 62px; }

  .menu-btn { display: grid; }
  .main-nav {
    position: fixed; inset: var(--header-h) 0 auto; z-index: 89;
    flex-direction: column; align-items: stretch; gap: 0; margin: 0;
    padding: 8px 20px 16px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow); transform: translateY(-140%);
    transition: transform .25s cubic-bezier(.2,.8,.3,1);
  }
  .main-nav.is-open { transform: translateY(0); }
  .main-nav__link { padding: 13px 12px; border-radius: var(--radius-sm); }

  .tool-panel { padding: 18px; border-radius: var(--radius); }
  .tool-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .dropzone { min-height: 190px; }
  .hero { padding: 20px 0 14px; }
  .hero__stats { gap: 26px; }
  .btn { flex: 1 1 auto; }

  /* Mobile leaderboard slot: 320x100 reserved */
  .ad-slot--leaderboard { width: 320px; height: 100px; min-height: 100px; }
  .ad-slot--inline { width: 300px; height: 250px; min-height: 250px; }
}

@media (max-width: 560px) {
  .container { padding: 0 14px; }
  .brand__text { font-size: 17px; }
  .lang-switch select { padding: 8px 26px 8px 28px; font-size: 12.5px; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-bottom { flex-direction: column; }
  .seg-control { width: 100%; }
  .seg { flex: 1 1 auto; text-align: center; }
  .stat-row { flex-direction: column; }
  .compare__side img { height: 180px; }
}

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

@media print {
  .site-header, .sidebar, .ad-wrap, .ad-slot, .site-footer, .actions, .back-btn, .toast, .overlay { display: none !important; }
  body { background: #fff; }
  .tool-panel { border: none; box-shadow: none; padding: 0; }
}
