:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --text: #111827;
  --text-2: #4b5563;
  --muted: #5b6473;
  --border: #e5e7eb;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --success: #047857;
  --success-bg: #ecfdf5;
  --error: #b91c1c;
  --error-bg: #fef2f2;
  --info-bg: #eff6ff;
  --info: #1d4ed8;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, .08);
  --radius: 14px;
  --radius-sm: 9px;

  --c-pdf: #b91c1c;   --c-pdf-bg: #fef2f2;
  --c-image: #0e7490; --c-image-bg: #ecfeff;
  --c-ai: #7c3aed;    --c-ai-bg: #f5f3ff;
  --c-text: #b45309;  --c-text-bg: #fffbeb;
  --c-dev: #047857;   --c-dev-bg: #ecfdf5;
  --c-finance: #2563eb; --c-finance-bg: #eff6ff;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-2: #1f2630;
    --text: #e6edf3;
    --text-2: #b1bac4;
    --muted: #8b949e;
    --border: #2d333b;
    --primary: #818cf8;
    --primary-hover: #a5b4fc;
    --primary-soft: #1e1b4b;
    --success: #34d399;
    --success-bg: #052e22;
    --error: #f87171;
    --error-bg: #3b0d0d;
    --info-bg: #0c1f3f;
    --info: #93c5fd;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, .4);

    --c-pdf: #f87171;   --c-pdf-bg: #3b1212;
    --c-image: #22d3ee; --c-image-bg: #0b2f36;
    --c-ai: #a78bfa;    --c-ai-bg: #2a1a4a;
    --c-text: #fbbf24;  --c-text-bg: #3a2a08;
    --c-dev: #34d399;   --c-dev-bg: #072e22;
    --c-finance: #60a5fa; --c-finance-bg: #0f2547;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); letter-spacing: -.02em; }
h2 { font-size: 1.35rem; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }

.container { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; }
.lead { font-size: 1.1rem; color: var(--text-2); }
.page { padding-top: 24px; padding-bottom: 48px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; font-size: 1.15rem; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff;
}
.site-nav { margin-left: auto; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; align-items: center; }
.nav-item { position: relative; }
.nav-link {
  display: inline-flex; align-items: center; gap: 4px; padding: 8px 10px; border-radius: 8px; border: 0; background: none;
  font: inherit; font-weight: 550; font-size: .95rem; color: var(--text-2); cursor: pointer; text-decoration: none;
}
.nav-link:hover, .nav-item.open > .nav-link { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.active { color: var(--primary); }
.chev { transition: transform .15s; }
.nav-item.open .chev { transform: rotate(180deg); }
.nav-menu {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; min-width: 240px; padding: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.nav-menu::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; } /* hover bridge */
.nav-item.open > .nav-menu { display: block; }
.nav-menu-list { list-style: none; margin: 0; padding: 0; }
.nav-menu-wide { width: 480px; }
.nav-menu-wide .nav-menu-list { columns: 2; column-gap: 8px; }
.nav-menu-list li { break-inside: avoid; }
.nav-menu-list a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); font-size: .93rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-menu-list a:hover, .nav-menu-list a:focus-visible { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.nav-menu-list a.current { color: var(--primary); font-weight: 650; }
.nav-menu-all { display: block; margin-top: 6px; padding: 9px 10px 4px; border-top: 1px solid var(--border); font-size: .88rem; font-weight: 650; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 0; color: var(--text); padding: 8px; cursor: pointer; border-radius: 8px; }

@media (max-width: 1020px) {
  .nav-toggle { display: block; }
  .site-nav {
    display: none; position: absolute; top: 64px; left: 0; right: 0; max-height: calc(100vh - 64px); overflow-y: auto;
    padding: 8px 16px 20px; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg);
  }
  .site-nav.open { display: block; }
  .nav-list { flex-direction: column; align-items: stretch; gap: 0; }
  .nav-item { border-bottom: 1px solid var(--border); }
  .nav-link { width: 100%; justify-content: space-between; padding: 14px 6px; font-size: 1rem; border-radius: 0; }
  .nav-link:hover, .nav-item.open > .nav-link { background: none; }
  .nav-menu { position: static; box-shadow: none; border: 0; padding: 0 0 10px 8px; min-width: 0; width: auto; }
  .nav-menu::before { display: none; }
  .nav-menu-wide { width: auto; }
  .nav-menu-wide .nav-menu-list { columns: 1; }
  .nav-menu-list a { padding: 10px; white-space: normal; }
  .nav-menu-all { border-top: 0; padding-top: 6px; }
}

/* ---------- Hero & search ---------- */
.hero { padding: 56px 0 36px; text-align: center; }
.hero h1 { max-width: 760px; margin: 0 auto .4em; }
.hero-sub { color: var(--text-2); font-size: 1.15rem; max-width: 640px; margin: 0 auto 28px; }
.search {
  display: flex; align-items: center; gap: 10px; max-width: 560px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 0 20px; box-shadow: var(--shadow-lg); color: var(--muted);
}
.search:focus-within { border-color: var(--primary); }
.search input[type=search] { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; padding: 15px 0; min-width: 0; }

/* ---------- Tool cards ---------- */
.tool-section { margin: 36px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.section-head h2 { margin: 0; }
.see-all { font-weight: 600; font-size: .95rem; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tool-card {
  display: flex; gap: 14px; align-items: flex-start; padding: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s, border-color .15s;
}
.tool-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.tool-card-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tool-card-title { font-weight: 650; }
.tool-card-desc { color: var(--muted); font-size: .9rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.badge {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 11px;
  font-size: .72rem; font-weight: 800; letter-spacing: .04em;
}
.badge-lg { width: 60px; height: 60px; font-size: .9rem; border-radius: 15px; }
.badge-pdf { color: var(--c-pdf); background: var(--c-pdf-bg); }
.badge-image { color: var(--c-image); background: var(--c-image-bg); }
.badge-ai { color: var(--c-ai); background: var(--c-ai-bg); }
.badge-text { color: var(--c-text); background: var(--c-text-bg); }
.badge-dev { color: var(--c-dev); background: var(--c-dev-bg); }
.badge-finance { color: var(--c-finance); background: var(--c-finance-bg); }
.badge { font-size: .68rem; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 56px 0; }
.feature { padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.feature h3 { font-size: 1.05rem; }
.feature p { color: var(--text-2); margin: 0; font-size: .95rem; }

/* ---------- Tool page ---------- */
.breadcrumb { font-size: .9rem; color: var(--muted); margin-bottom: 18px; }
.breadcrumb span { margin: 0 6px; }
.breadcrumb a { text-decoration: underline; text-underline-offset: 3px; }
.tool-header { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 22px; }
.tool-header h1 { margin-bottom: .2em; }
.tool-header .lead { margin: 0; }

.tool-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: clamp(16px, 3vw, 28px); box-shadow: var(--shadow-lg);
}

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 40px 16px; text-align: center; cursor: pointer;
  border: 2px dashed var(--border); border-radius: var(--radius); background: var(--surface-2);
  color: var(--primary); transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
.dropzone-title {
  display: inline-block; margin-top: 6px; padding: 11px 26px; border-radius: 999px;
  background: var(--primary); color: #fff; font-weight: 650;
}
@media (prefers-color-scheme: dark) { .dropzone-title { color: #0d1117; } }
.dropzone-hint { color: var(--muted); font-size: .9rem; }

.file-list, .result-list { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 8px; }
.file-list:empty, .result-list:empty { display: none; }
.file-list li, .result-list li {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
}
.file-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.file-size { font-size: .85rem; flex: none; }
.file-actions { display: flex; gap: 4px; flex: none; }
.result-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); cursor: pointer; font-size: 1rem;
}
.icon-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.icon-btn:disabled { opacity: .35; cursor: default; }

.options { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: flex-end; margin-top: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 200px; font-weight: 550; font-size: .92rem; }
.field > span { color: var(--text-2); }
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-size: .92rem; color: var(--text-2); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .95rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

input:not([type]), input[type=text], input[type=number], input[type=search], input[type=email], input[type=tel], input[type=url], input[type=date], select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; width: 100%;
}
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 35%, transparent); border-color: var(--primary); }
input[type=range] { width: 100%; accent-color: var(--primary); }
input[type=color] { width: 100%; height: 44px; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.inline-field select { width: auto; padding: 7px 10px; }

.radio-group { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; width: 100%; }
.radio-group legend { font-weight: 600; margin-bottom: 8px; font-size: .92rem; color: var(--text-2); }
.radio-group label {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
}
.radio-group label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.radio-group input { accent-color: var(--primary); }

.actions, .button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; }
.row-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; padding: 11px 20px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-primary, .btn-primary:hover:not(:disabled) { color: #0d1117; } }
.btn-sm { padding: 6px 12px; font-size: .88rem; border-radius: 8px; }

.status { margin-top: 16px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: .95rem; }
.status-info { background: var(--info-bg); color: var(--info); }
.status-success { background: var(--success-bg); color: var(--success); }
.status-error { background: var(--error-bg); color: var(--error); }
.notice { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--c-text-bg); color: var(--text); margin-bottom: 16px; }

.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 16px; }
.progress-bar { height: 100%; width: 0; background: var(--primary); transition: width .2s; }

.output-box { margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.output-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.output-text { padding: 14px; white-space: pre-wrap; word-wrap: break-word; }
textarea.output-text { border: 0; border-radius: 0; display: block; }

.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-top: 18px; }
.result-card { margin: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.result-card img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: contain; background: #fff; }
.result-card figcaption { padding: 8px; text-align: center; }
.preview { margin-top: 18px; text-align: center; }
.preview img { max-height: 360px; border-radius: var(--radius-sm); border: 1px solid var(--border); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 16px; }
.stat { padding: 14px; border-radius: var(--radius-sm); background: var(--surface-2); display: flex; flex-direction: column; }
.stat-value { font-size: 1.5rem; font-weight: 750; }
.stat-label { color: var(--muted); font-size: .85rem; }

.qr-layout { display: grid; grid-template-columns: 1fr 280px; gap: 24px; }
.qr-preview { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.qr-preview canvas { width: 100%; height: auto; aspect-ratio: 1; border-radius: var(--radius-sm); border: 1px solid var(--border); }
@media (max-width: 700px) { .qr-layout { grid-template-columns: 1fr; } }

.password-out { display: flex; gap: 10px; }
.password-out input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.15rem; padding: 14px; }
.strength { height: 6px; border-radius: 99px; background: var(--surface-2); margin-top: 14px; overflow: hidden; }
.strength-bar { height: 100%; width: 0; transition: width .2s; background: var(--error); }
.strength-bar[data-level=fair] { background: #f59e0b; }
.strength-bar[data-level=good] { background: #10b981; }
.strength-bar[data-level=great] { background: #059669; }
.strength + p { margin-top: 6px; }

/* ---------- Content below the tool ---------- */
.content-grid { display: grid; grid-template-columns: 1fr 320px; gap: 36px; margin-top: 40px; }
@media (max-width: 900px) { .content-grid { grid-template-columns: 1fr; } }
.prose h2 { margin-top: 1.6em; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--text-2); }
.prose ul { padding-left: 1.3em; }
.steps { padding-left: 1.3em; }
.steps li { margin-bottom: 6px; }
.faq details { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 16px; margin-bottom: 10px; background: var(--surface); }
.faq summary { cursor: pointer; padding: 14px 0; font-weight: 600; }
.faq details p { margin-bottom: 14px; }
.aside-title { font-size: 1.1rem; }
.related { display: flex; flex-direction: column; gap: 10px; }

.ad-slot { margin: 28px 0; text-align: center; }
.ad-label { display: block; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
/* Reserve space so the page doesn't jump when an ad loads */
.ad-top, .ad-bottom { min-height: 120px; }
.ad-inArticle { min-height: 250px; }
.ad-sidebar { min-height: 270px; margin: 0 0 24px; }
@media (max-width: 900px) { .ad-sidebar { margin-top: 0; } }
.ad-placeholder { display: grid; place-items: center; min-height: inherit; height: 100%; border: 2px dashed var(--border); border-radius: var(--radius-sm); color: var(--muted); font-weight: 600; background: repeating-linear-gradient(45deg, transparent 0 10px, var(--surface-2) 10px 20px); }
.ad-top .ad-placeholder, .ad-bottom .ad-placeholder { min-height: 100px; }
.ad-inArticle .ad-placeholder { min-height: 230px; }
.ad-sidebar .ad-placeholder { min-height: 250px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: 40px; padding-top: 40px; }
.footer-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px 24px; }
.footer-grid > :first-child { grid-column: 1 / -1; max-width: 560px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
.footer-logo { margin-bottom: 10px; }
.footer-grid p { font-size: .9rem; }
.footer-heading { font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.footer-links { list-style: none; padding: 0; margin: 0; font-size: .92rem; }
.footer-links li { margin-bottom: 6px; }
.footer-links a { color: var(--text-2); }
.footer-bottom { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; padding-top: 24px; padding-bottom: 28px; margin-top: 28px; border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; }
.footer-legal { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-legal a { color: var(--muted); }

/* ---------- Background remover ---------- */
.bg-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .bg-compare { grid-template-columns: 1fr; } }
.bg-compare figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.bg-compare img, .bg-compare canvas { display: block; width: 100%; height: auto; max-height: 420px; object-fit: contain; }
.bg-compare img, .bg-compare [data-preview-wrap] { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background-color: var(--surface-2); }
.checker {
  background-color: #fff !important;
  background-image: linear-gradient(45deg, #e5e7eb 25%, transparent 25%), linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e5e7eb 75%), linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer; padding: 0;
  border: 2px solid var(--border); box-shadow: inset 0 0 0 2px var(--surface);
}
.swatch.active { border-color: var(--primary); box-shadow: inset 0 0 0 2px var(--surface), 0 0 0 2px color-mix(in srgb, var(--primary) 35%, transparent); }
.swatch-none { background: conic-gradient(#e5e7eb 25%, #fff 0 50%, #e5e7eb 0 75%, #fff 0) 0 0 / 12px 12px; }
.swatch-custom { position: relative; overflow: hidden; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.swatch-custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

/* ---------- Bulk background remover ---------- */
.bulk-summary { margin-top: 18px; }
.bulk-summary .progress { margin-top: 8px; }
.bulk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 18px; }
.bulk-grid:empty { display: none; }
.bulk-card { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.bulk-card[data-status=working] { border-color: var(--primary); }
.bulk-card[data-status=error] { border-color: var(--error); }
.bulk-thumb { aspect-ratio: 1; background-color: var(--surface-2); display: grid; place-items: center; }
.bulk-thumb img { width: 100%; height: 100%; object-fit: contain; }
.bulk-card[data-status=working] .bulk-thumb img { opacity: .5; }
.bulk-meta { display: flex; flex-direction: column; padding: 8px 10px 0; min-width: 0; }
.bulk-meta .file-name { font-size: .9rem; }
.bulk-status { color: var(--muted); }
.bulk-card[data-status=done] .bulk-status { color: var(--success); }
.bulk-card[data-status=error] .bulk-status { color: var(--error); }
.bulk-card[data-status=working] .bulk-status { color: var(--primary); }
.bulk-actions { display: flex; gap: 6px; justify-content: space-between; align-items: center; padding: 8px 10px 10px; margin-top: auto; }
.bulk-actions .icon-btn { margin-left: auto; }

/* ---------- Background changer / product photo editor ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; margin-top: 4px; }
@media (max-width: 800px) { .editor { grid-template-columns: 1fr; } }
.editor-preview { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background-color: var(--surface-2); display: grid; place-items: center; align-self: start; }
.editor-preview canvas { display: block; max-width: 100%; max-height: 520px; width: auto; height: auto; }
.editor-controls .options { margin-top: 16px; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 10px; margin-bottom: 14px; }
.tab { flex: 1; font: inherit; font-weight: 600; font-size: .92rem; padding: 8px 6px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); cursor: pointer; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tab-panel { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; min-height: 44px; }
.tab-panel .field { flex-basis: 100%; }
[data-transparent].active { border-color: var(--primary); color: var(--primary); }

/* ---------- Chart color tokens (validated categorical palette) ---------- */
:root {
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4;
  --chart-grid: #e7e6e2; --chart-axis: #6b7280;
}
@media (prefers-color-scheme: dark) {
  :root {
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181;
    --chart-grid: #2d333b; --chart-axis: #8b949e;
  }
}

/* ---------- Shared bits for new tools ---------- */
.tabs-wrap { flex-wrap: wrap; }
.tabs-wrap .tab { flex: 1 1 auto; }
.tabs-sm { margin: 0; }
.tabs-sm .tab { padding: 6px 14px; }
.table-wrap { overflow-x: auto; margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.table-scroll { max-height: 420px; overflow-y: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table thead th { position: sticky; top: 0; background: var(--surface-2); font-weight: 650; color: var(--text-2); }
.data-table tbody tr:last-child td { border-bottom: 0; }

/* Fancy text */
.fancy-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.fancy-item {
  display: grid; grid-template-columns: 130px 1fr auto; gap: 12px; align-items: center; text-align: left;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text); font: inherit; cursor: pointer;
}
.fancy-item:hover { border-color: var(--primary); }
.fancy-label { color: var(--muted); font-size: .85rem; }
.fancy-value { font-size: 1.15rem; overflow-wrap: anywhere; min-width: 0; }
.fancy-copy { color: var(--primary); font-weight: 600; font-size: .88rem; }
@media (max-width: 560px) { .fancy-item { grid-template-columns: 1fr auto; } .fancy-label { grid-column: 1 / -1; } }

/* Unit converter */
.converter { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: end; margin-top: 18px; }
.converter .field input { font-size: 1.2rem; font-weight: 600; }
.swap-btn { width: 44px; height: 44px; font-size: 1.2rem; margin-bottom: 26px; }
@media (max-width: 640px) { .converter { grid-template-columns: 1fr; } .swap-btn { margin: 0 auto; transform: rotate(90deg); } }
.formula { margin: 12px 0 0; }

/* Loan calculators */
.calc-layout { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 28px; }
@media (max-width: 860px) { .calc-layout { grid-template-columns: 1fr; } }
.calc-inputs { display: flex; flex-direction: column; gap: 16px; }
.calc-inputs .field { flex: none; }
.slider-field { display: grid; grid-template-columns: 1fr 130px; gap: 6px 10px; align-items: center; }
.slider-field label { font-weight: 550; font-size: .92rem; color: var(--text-2); }
.slider-field input[type=range] { grid-column: 1 / -1; }
.more-costs { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 14px; }
.more-costs summary { cursor: pointer; padding: 12px 0; font-weight: 600; }
.more-costs .field { margin-bottom: 12px; }
.hero-number { display: flex; flex-direction: column; }
.hero-number strong { font-size: clamp(2rem, 5vw, 2.8rem); letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.loan-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 16px 0; }
.loan-summary div { padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.loan-summary dt { color: var(--muted); font-size: .82rem; }
.loan-summary dd { margin: 2px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.split { display: flex; gap: 2px; height: 14px; }
.split-seg { min-width: 3px; height: 100%; }
.split-seg:first-child { border-radius: 4px 0 0 4px; }
.split-seg:last-child { border-radius: 0 4px 4px 0; }
.split-seg:only-child { border-radius: 4px; }
.legend { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: .9rem; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend-swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.legend-label { color: var(--text-2); }
.legend-value { font-weight: 650; font-variant-numeric: tabular-nums; }
.chart-block, .schedule { margin-top: 28px; }
.chart-title { font-size: 1rem; margin: 0 0 8px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis { fill: var(--chart-axis); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .area { fill: var(--series-1); opacity: .14; }
.chart .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; }
.chart .crosshair { stroke: var(--chart-axis); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: crosshair; touch-action: pan-y; }
.chart-tooltip {
  position: fixed; z-index: 50; pointer-events: none; padding: 8px 10px; border-radius: 8px; font-size: .85rem; line-height: 1.45;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-variant-numeric: tabular-nums;
}

/* Color tools */
.palette { display: flex; gap: 2px; height: 300px; border-radius: var(--radius); overflow: hidden; margin-top: 16px; }
.palette-swatch { flex: 1; position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; }
.palette-copy { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 18px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; }
.palette-hex { font-weight: 750; font-size: 1.05rem; letter-spacing: .03em; }
.palette-rgb { font-size: .8rem; opacity: .8; }
.palette-lock { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: rgba(255,255,255,.22); color: inherit; border: 0; border-radius: 8px; width: 38px; height: 38px; cursor: pointer; display: grid; place-items: center; opacity: .55; }
.palette-lock[aria-pressed=true] { opacity: 1; background: rgba(255,255,255,.4); }
.palette-swatch:hover .palette-lock { opacity: 1; }
@media (max-width: 640px) {
  .palette { flex-direction: column; height: auto; }
  .palette-swatch { flex-direction: row; justify-content: space-between; align-items: center; min-height: 64px; padding: 0 10px; }
  .palette-copy { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 18px 4px; }
  .palette-lock { position: static; transform: none; }
}
.row-gap { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-right: auto; }
.kbd { font-size: .72rem; padding: 2px 6px; border-radius: 5px; background: rgba(255,255,255,.22); margin-left: 4px; }
.image-palette { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 4px; }
.palette-source { max-height: 260px; width: auto; max-width: 100%; border-radius: var(--radius-sm); justify-self: center; }

.picker-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
@media (max-width: 800px) { .picker-layout { grid-template-columns: 1fr; } }
.picker-main { display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: end; }
.picker-main input[type=color] { height: 110px; border-radius: var(--radius); }
.picker-image { margin-top: 18px; }
.canvas-wrap { position: relative; line-height: 0; }
.canvas-wrap canvas { width: 100%; height: auto; border-radius: var(--radius-sm); cursor: crosshair; touch-action: none; }
.loupe { position: absolute; width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35), var(--shadow-lg); transform: translate(-50%, -130%); pointer-events: none; }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; cursor: pointer; text-decoration: underline; }
.color-preview { height: 120px; border-radius: var(--radius); display: grid; place-items: center; font-weight: 750; font-size: 1.4rem; letter-spacing: .03em; border: 1px solid var(--border); }
.codes { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 22px; }
.code-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.code-row:hover { border-color: var(--primary); }
.code-key { color: var(--muted); font-size: .82rem; font-weight: 650; }
.code-row code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92rem; overflow-wrap: anywhere; }
.code-copy { color: var(--primary); font-weight: 600; font-size: .85rem; }
.shades { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; margin-bottom: 22px; border-radius: var(--radius-sm); overflow: hidden; }
.shade { height: 44px; border: 0; cursor: pointer; padding: 0; }
.contrast { display: flex; flex-direction: column; gap: 8px; }
.contrast-row { display: flex; justify-content: space-between; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* OCR */
.ocr-result { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 18px; margin-top: 18px; align-items: start; }
@media (max-width: 760px) { .ocr-result { grid-template-columns: 1fr; } }
.ocr-result img { width: 100%; max-height: 420px; object-fit: contain; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); }
.ocr-result .output-box { margin-top: 0; }

/* Document builders (invoice, resume) */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; align-items: start; }
@media (max-width: 980px) { .doc-layout { grid-template-columns: 1fr; } }
.doc-form fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0 0 16px; display: flex; flex-direction: column; gap: 12px; }
.doc-form legend { font-weight: 700; padding: 0 6px; }
.doc-form .field { flex: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .grid-2 { grid-template-columns: 1fr; } }
.doc-side { position: sticky; top: 80px; }
@media (max-width: 980px) { .doc-side { position: static; } }
.doc-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.paper-wrap { background: var(--surface-2); border-radius: var(--radius); padding: 14px; margin-top: 12px; overflow: auto; max-height: 80vh; container-type: inline-size; }
.paper { background: #fff; color: #111827; box-shadow: var(--shadow-lg); border-radius: 4px; padding: 32px; font-size: 12px; line-height: 1.5; min-height: 500px; }
.logo-row { display: flex; align-items: center; gap: 12px; }
.logo-drop { display: grid; place-items: center; width: 160px; height: 64px; border: 2px dashed var(--border); border-radius: var(--radius-sm); cursor: pointer; color: var(--primary); font-weight: 600; font-size: .9rem; overflow: hidden; }
.logo-drop:hover { border-color: var(--primary); }
.logo-drop img { max-width: 100%; max-height: 100%; object-fit: contain; }
.items { display: flex; flex-direction: column; gap: 8px; }
.item-head, .item-row { display: grid; grid-template-columns: 1fr 70px 110px 32px; gap: 8px; align-items: center; }
.item-head { font-size: .8rem; color: var(--muted); font-weight: 600; }
.item-row input { padding: 8px 10px; }

.invoice-paper { --accent: #4f46e5; }
.inv-top { display: flex; justify-content: space-between; gap: 20px; }
.inv-logo { max-width: 150px; max-height: 60px; display: block; margin-bottom: 10px; }
.inv-from { color: #4b5563; }
.inv-from strong, .inv-bill strong { color: #111827; font-size: 13px; }
.inv-meta { text-align: right; }
.inv-meta h2 { color: var(--accent); font-size: 26px; margin: 0 0 8px; letter-spacing: .02em; }
.inv-meta div { display: flex; justify-content: flex-end; gap: 12px; }
.inv-meta span { color: #6b7280; }
.inv-label { display: block; font-size: 10px; font-weight: 700; letter-spacing: .06em; color: #6b7280; text-transform: uppercase; margin-bottom: 2px; }
.inv-bill { margin: 22px 0; color: #4b5563; }
.inv-table { width: 100%; border-collapse: collapse; }
.inv-table th { background: var(--accent); color: #fff; font-size: 10px; letter-spacing: .05em; text-transform: uppercase; padding: 7px 10px; text-align: right; }
.inv-table td { padding: 8px 10px; border-bottom: 1px solid #e5e7eb; text-align: right; font-variant-numeric: tabular-nums; }
.inv-table th:first-child, .inv-table td:first-child { text-align: left; }
.inv-totals { margin: 14px 0 0 auto; width: 260px; }
.inv-totals div { display: flex; justify-content: space-between; padding: 4px 10px; }
.inv-totals span { color: #6b7280; }
.inv-total { background: var(--accent); color: #fff; margin-top: 4px; padding: 8px 10px !important; font-size: 13px; }
.inv-total span { color: #fff !important; }
.inv-due b { color: var(--accent); }
.inv-notes { margin-top: 18px; color: #374151; }

/* Resume builder */
.entries { display: flex; flex-direction: column; gap: 12px; }
.entry { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: var(--surface-2); }
.entry-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
.entry-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.span-2 { grid-column: 1 / -1; }
.resume-paper { --accent: #2563eb; padding: 36px 40px; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 11.5px; line-height: 1.45; min-height: calc((100cqw - 28px) * 1.414); }
.resume-paper .r-fullname { font-size: 26px; font-weight: 700; line-height: 1.2; margin: 0; letter-spacing: -.01em; color: #111827; }
.resume-paper .r-title { margin: 2px 0 0; font-size: 14px; color: var(--accent); font-weight: 600; }
.resume-paper .r-contact { margin: 8px 0 0; color: #4b5563; font-size: 11px; }
.resume-paper .sep { margin: 0 6px; color: #9ca3af; }
.resume-paper section { margin-top: 16px; }
.resume-paper h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin: 0 0 6px; padding-bottom: 4px; border-bottom: 1.5px solid var(--accent); }
.resume-paper p { margin: 0; color: #1f2937; }
.resume-paper ul { margin: 4px 0 0; padding-left: 16px; color: #1f2937; }
.resume-paper li { margin-bottom: 2px; }
.r-entry { margin-bottom: 10px; break-inside: avoid; }
.r-row { display: flex; justify-content: space-between; gap: 10px; color: #111827; }
.r-date { color: #4b5563; white-space: nowrap; font-size: 11px; }
.r-sub { color: #4b5563; font-style: italic; }
.r-skills { display: flex; flex-wrap: wrap; gap: 5px; }
.r-skills span { padding: 2px 8px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 12%, #fff); color: #1f2937; }
.resume-modern .r-head-text { border-left: 5px solid var(--accent); padding-left: 14px; }
.resume-classic { font-family: Georgia, "Times New Roman", serif; }
.resume-classic .r-header { flex-direction: column; text-align: center; gap: 10px; }
.resume-classic .r-fullname { font-size: 28px; font-weight: 400; letter-spacing: .04em; }
.resume-classic h3 { color: #111827; border-bottom-color: #111827; text-align: left; }
.resume-classic .r-title { color: #374151; }
.resume-classic .r-skills span { background: none; padding: 0; }
.resume-classic .r-skills span:not(:last-child)::after { content: ","; }
.resume-minimal h3 { border-bottom: 0; color: #111827; padding-bottom: 0; }
.resume-minimal .r-title { color: #4b5563; font-weight: 400; }
.resume-minimal .r-skills span { background: #f3f4f6; }

/* Resume: photo, samples, creative & executive templates */
.photo-row { display: flex; gap: 14px; align-items: center; }
.photo-drop { flex: none; display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; border: 2px dashed var(--border); cursor: pointer; color: var(--primary); font-weight: 600; font-size: .85rem; overflow: hidden; }
.photo-drop:hover { border-color: var(--primary); }
.photo-drop img { width: 100%; height: 100%; object-fit: cover; }
.photo-controls { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.sample-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.sample-card { display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.sample-card:hover { border-color: var(--primary); }
.sample-card.active { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent); }
.sample-thumb { display: flex; flex-direction: column; gap: 4px; padding: 8px; height: 54px; border-radius: 6px; background: #fff; border: 1px solid #e5e7eb; }
.sample-thumb i { display: block; height: 6px; border-radius: 3px; background: #e5e7eb; }
.sample-thumb i:first-child { width: 60%; height: 8px; background: var(--accent); }
.sample-thumb i:nth-child(2) { width: 85%; }
.sample-thumb i:nth-child(3) { width: 70%; }
.sample-name { font-weight: 650; font-size: .88rem; line-height: 1.25; }
.sample-meta { font-size: .76rem; color: var(--muted); }

.resume-paper .r-header { display: flex; align-items: center; gap: 18px; }
.r-head-text { min-width: 0; flex: 1; }
.r-photo { width: 92px; height: 92px; object-fit: cover; flex: none; border-radius: 50%; }
.r-photo-rounded { border-radius: 14px; }
.r-photo-square { border-radius: 0; }

.resume-executive { padding: 0; }
.resume-executive .r-header { flex-direction: row-reverse; justify-content: space-between; background: var(--accent); padding: 28px 40px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.resume-executive .r-header .r-fullname, .resume-executive .r-header .r-title, .resume-executive .r-header .r-contact { color: #fff; }
.resume-executive .r-header .r-title { opacity: .9; font-weight: 500; }
.resume-executive .r-header .r-contact { opacity: .88; }
.resume-executive .r-header .sep { color: rgba(255,255,255,.6); }
.resume-executive .r-photo { border: 3px solid rgba(255,255,255,.85); }
.resume-executive .r-body { padding: 4px 40px 32px; }
.resume-executive h3 { border-bottom-width: 1px; border-bottom-color: #e5e7eb; }

.resume-creative { padding: 0; display: grid; grid-template-columns: 33% 1fr; }
.resume-creative .r-side { background: color-mix(in srgb, var(--accent) 10%, #fff); padding: 30px 20px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.resume-creative .r-side .r-photo { display: block; width: 120px; height: 120px; margin: 0 auto 6px; border: 4px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.resume-creative .r-side section:first-of-type { margin-top: 10px; }
.resume-creative .r-side h3 { border-bottom-color: color-mix(in srgb, var(--accent) 40%, #fff); }
.resume-creative .r-contact-list { list-style: none; padding: 0; margin: 0; overflow-wrap: anywhere; font-size: 11px; }
.resume-creative .r-contact-list li { margin-bottom: 4px; }
.resume-creative .r-skills span { background: #fff; }
.resume-creative .r-main { padding: 30px 28px; min-width: 0; }
.resume-creative .r-header { display: block; margin-bottom: 4px; }
.resume-creative .r-fullname { font-size: 28px; color: var(--accent); }
.resume-creative .r-title { color: #374151; }

/* Printing the resume: show only the cloned resume */
#print-root { display: none; }
@media print {
  @page { size: A4; margin: 12mm 14mm; }
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing { background: #fff; }
  body.printing #print-root { display: block; }
  body.printing #print-root .paper { box-shadow: none; border-radius: 0; padding: 0; min-height: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.printing #print-root .resume-creative { min-height: 272mm; }
}

/* Screenshot to code */
.radio-row { flex-direction: row; flex-wrap: wrap; }
.radio-row label { flex: 1 1 160px; }
.s2c-result { margin-top: 18px; }
.code-out {
  margin: 12px 0 0; padding: 16px; max-height: 520px; overflow: auto; border-radius: var(--radius-sm);
  background: #0d1117; color: #e6edf3; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.s2c-preview { width: 100%; height: 600px; margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }

/* Contract generator */
.legal-note { margin-bottom: 16px; }
.contract-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 20px; }
.contract-card { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; text-align: left; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.contract-card span { font-size: .82rem; color: var(--muted); line-height: 1.35; }
.contract-card:hover { border-color: var(--primary); }
.contract-card.active { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent); }
.contract-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .contract-fields { grid-template-columns: 1fr; } }
.contract-fields .field { flex: none; }
mark.ph { background: #fef08a; color: #713f12; padding: 0 3px; border-radius: 3px; }
.contract-paper { font-family: Georgia, "Times New Roman", serif; font-size: 12.5px; line-height: 1.6; padding: 40px 44px; }
.contract-paper .c-title { text-align: center; font-size: 20px; margin: 0 0 18px; color: #111827; }
.contract-paper .c-h { font-size: 13.5px; margin: 16px 0 6px; color: #111827; }
.contract-paper p { margin: 0 0 8px; color: #1f2937; }
.contract-paper .c-li { padding-left: 18px; position: relative; }
.contract-paper .c-li::before { content: "•"; position: absolute; left: 4px; }
.c-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 28px; break-inside: avoid; }
.c-sign-box { display: flex; flex-direction: column; gap: 10px; color: #1f2937; }
.c-line { border-top: 1px solid #111827; padding-top: 4px; margin-top: 26px; font-size: 11px; color: #4b5563; }
@media print { body.printing mark.ph { background: none; color: inherit; } }

/* Plagiarism checker */
.plag-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 16px; }
@media (max-width: 800px) { .plag-grid { grid-template-columns: 1fr; } }
.plag-col, .plag-source { display: flex; flex-direction: column; gap: 6px; }
.plag-source + .plag-source { margin-top: 14px; }
.plag-result { margin-top: 22px; }
.plag-score { display: flex; gap: 22px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.score-ring { --p: 0; width: 120px; height: 120px; border-radius: 50%; display: grid; place-content: center; text-align: center; flex: none;
  background: radial-gradient(closest-side, var(--surface) 78%, transparent 79% 100%), conic-gradient(var(--ring) calc(var(--p) * 1%), var(--surface-2) 0); --ring: var(--success); }
.score-ring[data-level=medium] { --ring: #d97706; }
.score-ring[data-level=high] { --ring: var(--error); }
.score-ring strong { font-size: 1.7rem; line-height: 1; }
.score-ring span { font-size: .8rem; color: var(--muted); }
.plag-score p { margin: 0 0 8px; }
.plag-highlight { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); white-space: pre-wrap; line-height: 1.7; max-height: 420px; overflow: auto; }
.plag-highlight mark { background: #fecaca; color: #7f1d1d; border-radius: 2px; padding: 0 1px; }
.plag-matches, .web-checks { padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.plag-matches q, .web-checks q { color: var(--text-2); }
.web-checks li { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.web-checks li.is-found { border-color: var(--error); }
.web-checks .found { color: var(--error); }
.web-checks .not-found { color: var(--success); font-weight: 600; }

/* Resize image to KB */
.kb-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; align-items: start; }
@media (max-width: 760px) { .kb-layout { grid-template-columns: 1fr; } }
.kb-preview img { display: block; max-width: 100%; max-height: 360px; margin: 0 auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }

/* Passport photo */
.tips { margin: 14px 0 0; padding-left: 20px; color: var(--text-2); font-size: .92rem; }
.pp-layout { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 28px; align-items: start; margin-top: 8px; }
@media (max-width: 760px) { .pp-layout { grid-template-columns: 1fr; } }
.pp-preview canvas { display: block; width: 100%; max-width: 300px; height: auto; margin: 0 auto; border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.pp-layout .field { flex: none; }

.hex-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.hex-chip { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border); flex: none; }
.hex-row input { width: 120px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-transform: uppercase; padding: 6px 10px; }
.hex-row input.invalid { border-color: var(--error); outline-color: var(--error); }

/* Image resizer (visual) */
.rs-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 860px) { .rs-layout { grid-template-columns: 1fr; } }
.rs-compare { position: relative; height: 380px; border-radius: var(--radius); background-color: var(--surface-2);
  background-image: linear-gradient(45deg, rgba(0,0,0,.04) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.04) 75%), linear-gradient(45deg, rgba(0,0,0,.04) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.04) 75%);
  background-size: 20px 20px; background-position: 0 0, 10px 10px; overflow: hidden; }
@media (max-width: 560px) { .rs-compare { height: 280px; } }
.rs-orig { position: absolute; border: 2px dashed var(--muted); border-radius: 2px; pointer-events: none; z-index: 2; }
.rs-tag { position: absolute; top: -1px; left: -1px; transform: translateY(-100%); font-size: .72rem; font-weight: 700; color: var(--muted); background: var(--surface-2); padding: 1px 6px; border-radius: 4px 4px 0 0; white-space: nowrap; }
.rs-new { position: absolute; z-index: 1; box-shadow: 0 2px 12px rgba(0,0,0,.18); }
.rs-dims { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; justify-content: center; margin-top: 12px; font-variant-numeric: tabular-nums; }
.rs-dims strong { font-size: 1.15rem; }
.rs-change { font-weight: 700; font-size: .9rem; }
.rs-change.down { color: var(--success); }
.rs-change.up { color: #d97706; }
.rs-controls { display: flex; flex-direction: column; gap: 14px; }
.rs-controls .field { flex: none; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { font: inherit; font-size: .88rem; font-weight: 600; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
@media (prefers-color-scheme: dark) { .chip.active { color: #0d1117; } }
.chip-row input[type=color] { width: 40px; height: 34px; padding: 2px; }
.rs-wh { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: end; }
.rs-lock { width: 40px; height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.rs-lock[aria-pressed=true] { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.rs-estimate { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: .92rem; font-variant-numeric: tabular-nums; }

/* Language switcher */
.lang-switch { position: relative; margin-left: 6px; flex: none; }
.lang-btn { display: inline-flex; align-items: center; gap: 5px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer; }
.lang-btn:hover, .lang-switch.open .lang-btn { color: var(--primary); border-color: var(--primary); }
.lang-menu { display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; list-style: none; margin: 0; padding: 6px; min-width: 190px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.lang-switch.open .lang-menu { display: block; }
.lang-menu a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--text); font-size: .93rem; }
.lang-menu a:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.lang-menu a.current { color: var(--primary); font-weight: 700; }
.footer-langs { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding-top: 24px; margin-top: 28px; border-top: 1px solid var(--border); font-size: .9rem; }
.footer-langs a { color: var(--text-2); }
.footer-langs a[aria-current] { color: var(--primary); font-weight: 700; }
.footer-langs + .footer-bottom { margin-top: 16px; }
@media (max-width: 1020px) {
  .lang-switch { margin-left: auto; }
  .nav-toggle { margin-left: 4px; }
}

/* Contact form */
.contact-form { display: grid; gap: 14px; margin: 24px 0 32px; padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface, transparent); }
.contact-form .field input, .contact-form .field textarea { width: 100%; }
.contact-form .btn { justify-self: start; }
.contact-form p { margin: 0; }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
