/* PDFNest Tools - works with any theme; uses theme variables when present. */
:root {
	--cht-ink: var(--ch-ink, #14172b);
	--cht-muted: var(--ch-muted, #5b6178);
	--cht-line: var(--ch-line, #dde1ee);
	--cht-paper: var(--ch-paper, #f6f7fb);
	--cht-surface: var(--ch-surface, #ffffff);
	--cht-accent: var(--ch-accent, #3b5bff);
	--cht-soft: var(--ch-soft, #eef1ff);
	--cht-okbg: var(--ch-okbg, #ecfaf4);
	--cht-bad: #c4281c;
}
.cht-wrap, .cht-grid { color: var(--cht-ink); }

/* icon: source square + target badge */
.cht-ico { position: relative; display: inline-block; flex: none; width: 40px; height: 34px; }
.cht-ico b {
	position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 9px; background: var(--c);
	color: #fff; display: grid; place-items: center; font: 800 15px/1 var(--ch-font, system-ui, sans-serif);
}
.cht-ico i {
	position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; border-radius: 6px; background: var(--c);
	color: #fff; font: 800 9.5px/16px var(--ch-font, system-ui, sans-serif); text-align: center; font-style: normal;
	box-shadow: 0 0 0 2.5px var(--cht-surface);
}

/* chip cloud (centered pills, like a tool directory) */
.cht-cloud { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 14px; }
.cht-chip {
	display: inline-flex; align-items: center; gap: 12px; padding: 9px 22px 9px 10px;
	background: var(--cht-surface); border: 1px solid transparent; border-radius: 999px;
	color: var(--cht-ink); text-decoration: none; font-weight: 500; font-size: 16px;
	box-shadow: 0 1px 2px rgba(20, 23, 43, .06), 0 4px 14px rgba(20, 23, 43, .05);
	transition: transform .15s, box-shadow .15s, border-color .15s;
}
.cht-chip:hover { transform: translateY(-2px); border-color: var(--cht-accent); box-shadow: 0 8px 22px rgba(59, 91, 255, .18); }
.cht-chip:focus-visible { outline: 3px solid var(--cht-accent); outline-offset: 2px; }
.cht-chip.is-current { border-color: var(--cht-accent); background: var(--cht-soft); }
.cht-chip[hidden] { display: none; }
.cht-none { color: var(--cht-muted); text-align: center; }

.cht-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 22px; }
.cht-tabs button {
	font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; padding: 8px 16px; border-radius: 999px;
	border: 1px solid var(--cht-line); background: transparent; color: var(--cht-muted);
}
.cht-tabs button:hover { color: var(--cht-ink); border-color: var(--cht-accent); }
.cht-tabs button.is-on { background: var(--cht-accent); border-color: var(--cht-accent); color: #fff; }
.cht-tabs button:focus-visible { outline: 3px solid var(--cht-accent); outline-offset: 2px; }

.cht-recent { margin: 0 0 30px; padding: 18px 20px 22px; border: 1px dashed var(--cht-line); border-radius: 18px; }
.cht-recent[hidden] { display: none; }
.cht-recent-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.cht-recent h2 { margin: 0; font-size: 1rem; color: var(--cht-muted); font-weight: 650; }
.cht-link { background: none; border: 0; color: var(--cht-muted); cursor: pointer; font: inherit; font-size: .9rem; text-decoration: underline; }
.cht-link:hover { color: var(--cht-ink); }

.cht-more { margin-top: 44px; }
.cht-more h2 { text-align: center; font-size: 1.25rem; margin: 0 0 18px; }

.cht-faq { margin-top: 36px; max-width: 70ch; }
.cht-faq h2 { font-size: 1.3rem; margin: 0 0 12px; }
.cht-faq details { border: 1px solid var(--cht-line); border-radius: 12px; background: var(--cht-surface); margin-bottom: 10px; }
.cht-faq summary { cursor: pointer; padding: 14px 18px; font-weight: 650; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.cht-faq summary::-webkit-details-marker { display: none; }
.cht-faq summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--cht-muted); }
.cht-faq details[open] summary::after { content: "\2212"; }
.cht-faq details p { margin: 0; padding: 0 18px 16px; line-height: 1.65; color: var(--cht-muted); }

/* tool box */
.cht-box {
	background: var(--cht-surface); border: 1px solid var(--cht-line); border-radius: 16px;
	padding: 24px; display: grid; gap: 16px;
}
.cht-loading { color: var(--cht-muted); margin: 0; }
.cht-drop {
	display: grid; gap: 4px; justify-items: center; text-align: center; cursor: pointer;
	padding: 36px 16px; border: 2px dashed var(--cht-line); border-radius: 14px; background: var(--cht-paper);
	transition: border-color .15s, background .15s;
}
.cht-drop strong { font-size: 1.1rem; }
.cht-drop span { color: var(--cht-muted); font-size: .95rem; }
.cht-drop:hover, .cht-drop.is-over, .cht-drop:focus-within { border-color: var(--cht-accent); background: var(--cht-soft); }
.cht-files { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cht-files:empty { display: none; }
.cht-files li {
	display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 14px;
	border: 1px solid var(--cht-line); border-radius: 10px; background: var(--cht-surface);
}
.cht-fn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.cht-fs { color: var(--cht-muted); font-size: .85rem; }
.cht-act { display: flex; gap: 4px; }
.cht-act button {
	width: 32px; height: 32px; border: 1px solid var(--cht-line); background: var(--cht-surface);
	border-radius: 8px; cursor: pointer; color: var(--cht-ink); font-size: 12px;
}
.cht-act button:hover:not(:disabled) { border-color: var(--cht-accent); }
.cht-act button:disabled { opacity: .35; cursor: default; }

.cht-field { display: grid; gap: 6px; font-weight: 600; }
.cht-box textarea, .cht-box select, .cht-box input[type="text"] {
	width: 100%; font: inherit; font-weight: 400; color: var(--cht-ink); background: var(--cht-surface);
	border: 1px solid var(--cht-line); border-radius: 10px; padding: 10px 12px; box-sizing: border-box;
}
.cht-box textarea { resize: vertical; min-height: 120px; }
.cht-box input[type="color"] { width: 48px; height: 36px; padding: 2px; border: 1px solid var(--cht-line); border-radius: 8px; background: var(--cht-surface); }
.cht-opts { display: flex; flex-wrap: wrap; gap: 14px 20px; }
.cht-opts label { display: grid; gap: 4px; font-weight: 600; font-size: .9rem; }
.cht-opts select { width: auto; min-width: 150px; }
.cht-hint { margin: 0; color: var(--cht-muted); font-size: .92rem; }

/* buttons */
.cht-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
	font: inherit; font-weight: 650; padding: 12px 22px; border-radius: 10px; text-decoration: none;
	border: 1px solid var(--cht-line); background: var(--cht-surface); color: var(--cht-ink);
}
.cht-btn:hover { border-color: var(--cht-accent); }
.cht-btn:focus-visible { outline: 3px solid var(--cht-accent); outline-offset: 2px; }
.cht-btn-main { background: var(--cht-accent); border-color: var(--cht-accent); color: #fff; justify-self: start; }
.cht-btn-main:hover { filter: brightness(.92); border-color: var(--cht-accent); }
.cht-btn-main:disabled { opacity: .6; cursor: progress; }
.cht-btn-sm { padding: 7px 14px; font-size: .9rem; }
.cht-dl { background: #0e9f6e; border-color: #0e9f6e; color: #fff; margin: 4px 8px 4px 0; }
.cht-dl:hover { border-color: #0e9f6e; filter: brightness(.92); }

.cht-status { margin: 0; min-height: 1.4em; color: var(--cht-muted); }
.cht-status.cht-err { color: var(--cht-bad); font-weight: 600; }
.cht-result { display: block; }
.cht-result:empty { display: none; }
.cht-preview { display: block; max-width: 100%; height: auto; margin-top: 12px; border: 1px solid var(--cht-line); border-radius: 10px; }
.cht-qr { max-width: 280px; }
.cht-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin: 12px 0; }
.cht-thumb { margin: 0; }
.cht-thumb img { width: 100%; height: auto; border: 1px solid var(--cht-line); border-radius: 8px; display: block; }
.cht-thumb figcaption { font-size: .85rem; margin-top: 6px; }
.cht-textout { display: grid; gap: 10px; margin-top: 10px; }
.cht-row { display: flex; flex-wrap: wrap; gap: 8px; }
.cht-scanres { display: grid; gap: 10px; margin-top: 10px; }
.cht-scanrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--cht-line); border-radius: 10px; }
.cht-scanrow code { word-break: break-all; background: var(--cht-paper); padding: 4px 8px; border-radius: 6px; }

/* about / related */
.cht-ad { margin: 24px 0; text-align: center; overflow: hidden; }
.cht-about { margin-top: 36px; max-width: 70ch; }
.cht-about h2 { font-size: 1.3rem; margin: 0 0 8px; }
.cht-about h3, .cht-related h3 { font-size: 1.05rem; margin: 20px 0 8px; }
.cht-about p, .cht-about li { line-height: 1.65; }
.cht-privacy { padding: 12px 14px; border-left: 4px solid #0e9f6e; background: var(--cht-okbg); border-radius: 0 8px 8px 0; }
.cht-related { margin-top: 28px; }

@media (max-width: 600px) {
	.cht-box { padding: 16px; }
	.cht-btn-main { justify-self: stretch; }
	.cht-opts select { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .cht-chip, .cht-drop { transition: none; } }

/* phones: smaller chips so two fit per row */
@media (max-width: 600px) {
	.cht-cloud { gap: 10px 8px; }
	.cht-chip { padding: 6px 12px 6px 7px; font-size: 14px; gap: 8px; }
	.cht-ico { width: 36px; height: 31px; }
	.cht-ico b { width: 27px; height: 27px; border-radius: 8px; font-size: 13px; }
	.cht-ico b svg { width: 15px; height: 15px; }
	.cht-ico i { width: 15px; height: 15px; line-height: 15px; font-size: 9px; }
}

/* compress image */
.cht-opts input[type="number"] { width: 150px; font: inherit; padding: 10px 12px; border: 1px solid var(--cht-line); border-radius: 10px; background: var(--cht-surface); color: var(--cht-ink); }
.cht-cmp { display: grid; gap: 12px; margin-top: 8px; }
.cht-cmp-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--cht-line); border-radius: 12px; }
.cht-cmp-row img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--cht-line); }
.cht-cmp-row > div { flex: 1; min-width: 180px; display: grid; gap: 2px; }
.cht-cmp-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cht-cmp-row span { color: var(--cht-muted); font-size: .92rem; }
.cht-cmp-row em { color: var(--cht-bad); font-style: normal; font-size: .9rem; }
.cht-sizes { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 18px 0 0; }
.cht-sizes span { color: var(--cht-muted); font-weight: 600; font-size: .92rem; }
.cht-sizes a { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--cht-line); background: var(--cht-surface); color: var(--cht-ink); text-decoration: none; font-weight: 600; font-size: .92rem; }
.cht-sizes a:hover, .cht-sizes a.is-on { border-color: var(--cht-accent); background: var(--cht-soft); }
