/* ToolNest — design tokens */
@font-face { font-family: "TN Display"; src: url("../js/fonts/poppins-r.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "TN Display"; src: url("../js/fonts/poppins-b.ttf") format("truetype"); font-weight: 600 800; font-display: swap; }
:root {
  --bg: #f3f5fb; --surface: #ffffff; --surface-2: #eaeef8; --line: #dfe4f0; --line-strong: #c3cbe0;
  --ink: #0f1729; --ink-2: #444e68; --ink-3: #6b7792;
  --accent: #4338ca; --accent-ink: #ffffff; --accent-soft: #e4e2fb; --accent-2: #f59e0b;
  --grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #0ea5e9 100%);
  --danger: #c0392b; --ok: #1f8a4c; --warn: #b7791f;
  --radius: 16px; --radius-sm: 10px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 12px 28px -14px rgba(40,50,110,.28);
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Malayalam", sans-serif;
  --font-display: "TN Display", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b1020; --surface: #121a30; --surface-2: #19233f; --line: #243052; --line-strong: #34426b;
  --ink: #e8ecf8; --ink-2: #b6bfd8; --ink-3: #8794b5;
  --accent: #8b8cff; --accent-ink: #0b1020; --accent-soft: #1e2550; --accent-2: #fbbf24;
  --danger: #ff7b6b; --ok: #4fd18a; --warn: #f0b24a;
  --shadow: 0 1px 0 rgba(255,255,255,.03), 0 12px 28px -14px rgba(0,0,0,.7);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020; --surface: #121a30; --surface-2: #19233f; --line: #243052; --line-strong: #34426b;
    --ink: #e8ecf8; --ink-2: #b6bfd8; --ink-3: #8794b5;
    --accent: #8b8cff; --accent-ink: #0b1020; --accent-soft: #1e2550; --accent-2: #fbbf24;
    --danger: #ff7b6b; --ok: #4fd18a; --warn: #f0b24a;
    --shadow: 0 1px 0 rgba(255,255,255,.03), 0 12px 28px -14px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font-ui); -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: -.01em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── layout ── */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.topbar { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 10px; height: 56px; }
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 17px; }
.spacer { flex: 1; }
.icon-btn { min-width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; font-size: 17px; padding: 0 10px; text-decoration: none; color: var(--ink); }
.icon-btn:hover { border-color: var(--line-strong); }
main { padding: 18px 0 70px; min-height: 70vh; }
footer { border-top: 1px solid var(--line); padding: 22px 0 40px; color: var(--ink-3); font-size: 14px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: space-between; }

/* ── home ── */
.hero { padding: 26px 0 8px; }
.hero h1 { font-size: clamp(30px, 6.4vw, 52px); max-width: 15ch; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero p { color: var(--ink-2); max-width: 56ch; margin: 12px 0 0; font-size: 17px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 11px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.badge.neutral { background: var(--surface-2); color: var(--ink-2); }
.badge.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.searchbox { position: relative; margin: 20px 0 14px; }
.searchbox input { width: 100%; height: 54px; border-radius: 16px; border: 1.5px solid var(--line-strong); background: var(--surface); padding: 0 16px 0 48px; font-size: 17px; outline: none; box-shadow: var(--shadow); }
.searchbox input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.searchbox .mag { position: absolute; left: 16px; top: 14px; font-size: 20px; opacity: .6; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; margin: 0 -16px; padding-inline: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 8px 14px; border-radius: 99px; cursor: pointer; font-size: 14.5px; white-space: nowrap; text-decoration: none; }
.chip[aria-current="true"], .chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.section-h { display: flex; align-items: baseline; justify-content: space-between; margin: 30px 0 12px; gap: 12px; }
.section-h h2 { font-size: 24px; }
.section-h span { color: var(--ink-3); font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.tcard { display: flex; gap: 13px; align-items: flex-start; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); transition: transform .12s, border-color .12s, box-shadow .12s; min-height: 82px; position: relative; }
.tcard:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); }
.tcard:focus-visible, .chip:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
.ticon { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: var(--tint, var(--accent-soft)); }
.tcard h3 { font-family: var(--font-ui); font-size: 16px; font-weight: 650; letter-spacing: 0; }
.tcard p { margin: 3px 0 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.35; }
.tag-new { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; background: var(--accent-2); color: #231600; padding: 1px 6px; border-radius: 5px; margin-left: 6px; vertical-align: 2px; }
.fav { position: absolute; right: 8px; top: 6px; font-size: 16px; opacity: .85; }
.empty { padding: 40px 10px; text-align: center; color: var(--ink-3); }
.feature { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 22px; }
.feature .tcard { min-height: 110px; }
.feature .tcard.big { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), var(--surface)); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }

/* ── tool page ── */
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-3); margin-bottom: 10px; flex-wrap: wrap; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.thead { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.thead .ticon { width: 52px; height: 52px; font-size: 26px; }
.thead h1 { font-size: clamp(24px, 5vw, 36px); }
.thead p { margin: 6px 0 0; color: var(--ink-2); }
.privacy { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel + .panel { margin-top: 14px; }
.panel h3 { font-family: var(--font-ui); font-size: 15px; font-weight: 700; margin-bottom: 10px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }
.cols { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .cols.two { grid-template-columns: 1fr 1fr; } .cols.three { grid-template-columns: repeat(3, 1fr); } }
.cols > .panel + .panel { margin-top: 0; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field > label, .lbl { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.hint { font-size: 12.5px; color: var(--ink-3); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.row > .field { flex: 1 1 130px; }
input[type=text], input[type=number], input[type=date], input[type=time], input[type=search], input[type=password], input[type=url], input[type=email], input[type=datetime-local], select, textarea {
  width: 100%; min-height: 44px; border: 1.5px solid var(--line-strong); background: var(--bg); border-radius: var(--radius-sm); padding: 9px 12px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
textarea { min-height: 130px; resize: vertical; line-height: 1.45; }
textarea.mono, input.mono, .mono { font-family: var(--font-mono); font-size: 14px; }
input[type=color] { width: 54px; height: 44px; padding: 3px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg); }
input[type=range] { width: 100%; accent-color: var(--accent); min-height: 32px; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 18px; height: 18px; }
.check { display: flex; align-items: center; gap: 9px; min-height: 36px; font-size: 15px; cursor: pointer; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 11px; border: 1.5px solid var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 650; cursor: pointer; text-decoration: none; transition: filter .12s, transform .06s; }
.btn:hover { filter: brightness(1.07); } .btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.ghost { background: transparent; color: var(--accent); border-color: transparent; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 9px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; filter: none; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.out { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; white-space: pre-wrap; word-break: break-word; font-family: var(--font-mono); font-size: 14px; position: relative; min-height: 46px; }
.out.prose { font-family: var(--font-ui); font-size: 15.5px; line-height: 1.6; }
.out .copy { position: absolute; right: 8px; top: 8px; }
.stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 6px; }
.stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 11px 13px; }
.stat b { display: block; font-size: 20px; font-family: var(--font-display); word-break: break-word; }
.stat span { font-size: 12.5px; color: var(--ink-3); }
.stat.big { grid-column: 1 / -1; background: var(--accent-soft); } .stat.big b { font-size: 30px; color: var(--accent); }
table.t { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.t th, table.t td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
table.t th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); position: sticky; top: 0; background: var(--surface); }
.scroll-x { overflow-x: auto; } .scroll-y { max-height: 360px; overflow-y: auto; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { border: 1.5px solid var(--line); background: var(--surface); padding: 7px 14px; border-radius: 10px; cursor: pointer; font-size: 14.5px; }
.tab[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.note { font-size: 14px; color: var(--ink-2); background: var(--surface-2); border-left: 4px solid var(--accent-2); padding: 10px 13px; border-radius: 8px; margin: 10px 0; }
.note.ok { border-left-color: var(--ok); } .note.bad { border-left-color: var(--danger); }
.drop { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 28px 16px; text-align: center; cursor: pointer; background: var(--surface); transition: border-color .12s, background .12s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop b { display: block; font-size: 17px; margin-bottom: 4px; } .drop span { color: var(--ink-3); font-size: 14px; }
.filelist { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.filelist li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface-2); border-radius: 10px; font-size: 14.5px; }
.filelist li .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filelist li .sz { color: var(--ink-3); font-size: 12.5px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; margin-top: 12px; }
.thumb { position: relative; border: 2px solid var(--line); border-radius: 10px; background: var(--surface-2); padding: 6px; text-align: center; font-size: 12.5px; user-select: none; }
.thumb canvas, .thumb img { max-width: 100%; height: auto; display: block; margin: 0 auto 4px; background: #fff; border-radius: 4px; }
.thumb.sel { border-color: var(--accent); background: var(--accent-soft); }
.thumb.del { opacity: .35; }
.thumb .tb { display: flex; gap: 4px; justify-content: center; margin-top: 4px; }
.thumb .tb button { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 7px; min-width: 30px; height: 30px; cursor: pointer; font-size: 14px; }
.progress { height: 8px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin: 10px 0; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 12px; font-size: 14.5px; opacity: 0; transition: all .2s; z-index: 200; pointer-events: none; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.kbd { font-family: var(--font-mono); font-size: 12px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--surface); }
.swatch { width: 100%; height: 90px; border-radius: 12px; border: 1px solid var(--line); }
.meter { height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; } .meter > i { display: block; height: 100%; transition: width .2s, background .2s; }
.diff-add { background: color-mix(in srgb, var(--ok) 22%, transparent); } .diff-del { background: color-mix(in srgb, var(--danger) 22%, transparent); }
.diffline { display: block; padding: 1px 8px; white-space: pre-wrap; font-family: var(--font-mono); font-size: 13.5px; }
.res-bands { display: flex; align-items: center; justify-content: center; margin: 16px auto; width: min(380px, 100%); }
.resistor { display: flex; align-items: center; width: 100%; } .resistor .lead { height: 4px; flex: 0 0 34px; background: #9aa0a6; }
.resistor .body { flex: 1; height: 54px; border-radius: 26px; background: #d9c8a0; display: flex; align-items: stretch; justify-content: space-evenly; padding: 0 22px; overflow: hidden; border: 1px solid rgba(0,0,0,.25); }
.resistor .band { width: 13px; } .resistor .band.gap { width: 16px; background: transparent !important; }
.gate-grid { display: grid; gap: 6px; }
.led { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: #444; border: 1px solid rgba(0,0,0,.3); vertical-align: -2px; } .led.on { background: #3ddc84; box-shadow: 0 0 10px #3ddc84; }
.mdprev { line-height: 1.65; } .mdprev h1, .mdprev h2, .mdprev h3 { margin: 16px 0 8px; } .mdprev pre { background: var(--surface-2); padding: 10px; border-radius: 8px; overflow: auto; } .mdprev code { font-family: var(--font-mono); font-size: .92em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; } .mdprev pre code { background: none; padding: 0; } .mdprev blockquote { border-left: 4px solid var(--line-strong); margin: 8px 0; padding: 2px 12px; color: var(--ink-2); } .mdprev table { border-collapse: collapse; } .mdprev th, .mdprev td { border: 1px solid var(--line); padding: 5px 9px; }
.chat { display: flex; flex-direction: column; gap: 10px; max-height: 58vh; overflow-y: auto; padding: 4px 2px 8px; }
.msg { padding: 10px 13px; border-radius: 14px; max-width: 92%; white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.quizq { margin: 14px 0; } .quizq .opt { display: block; width: 100%; text-align: left; margin: 6px 0; padding: 10px 12px; border: 1.5px solid var(--line-strong); background: var(--surface); border-radius: 10px; cursor: pointer; }
.quizq .opt.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, transparent); } .quizq .opt.wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
dialog { border: 1px solid var(--line-strong); border-radius: 16px; background: var(--surface); color: var(--ink); max-width: min(520px, 94vw); width: 100%; padding: 20px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); }
dialog::backdrop { background: rgba(0,0,0,.45); }
@media (max-width: 520px) { .hero { padding-top: 14px; } .tcard { padding: 12px; } .panel { padding: 13px; } }
@media print { .topbar, footer, .btns, .noprint { display: none !important; } body { background: #fff; color: #000; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ── PDF editor (full-bleed workspace) ── */
body.editor-mode main { padding: 0; } body.editor-mode footer { display: none; }
.ped { display: flex; flex-direction: column; height: calc(100dvh - 57px); background: var(--surface-2); }
.ped-bar { display: flex; gap: 6px; align-items: center; padding: 8px 10px; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; flex: none; }
.ped-bar .sep { width: 1px; align-self: stretch; background: var(--line); margin: 3px 4px; flex: none; }
.tbtn { flex: none; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-width: 54px; height: 52px; border-radius: 11px; border: 1.5px solid transparent; background: transparent; cursor: pointer; font-size: 11.5px; padding: 0 6px; color: var(--ink-2); }
.tbtn .i { font-size: 19px; line-height: 1; color: var(--ink); } .tbtn:hover { background: var(--surface-2); }
.tbtn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); } .tbtn[aria-pressed="true"] .i { color: var(--accent); }
.tbtn[disabled] { opacity: .35; cursor: default; }
.ped-opts { display: flex; gap: 8px; align-items: center; padding: 7px 10px; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; min-height: 52px; font-size: 14px; scrollbar-width: thin; }
.ped-opts > * { flex: none; } .ped-opts select, .ped-opts input[type=number] { min-height: 36px; padding: 4px 8px; width: auto; } .ped-opts input[type=number] { width: 70px; }
.ped-opts .lbl { white-space: nowrap; }
.ped-main { flex: 1; display: flex; min-height: 0; }
.ped-side { width: 150px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; padding: 8px; flex: none; display: none; }
@media (min-width: 900px) { .ped-side.on { display: block; } }
.ped-side .pt { margin-bottom: 8px; text-align: center; font-size: 12px; cursor: pointer; border: 2px solid transparent; border-radius: 8px; padding: 4px; } .ped-side .pt.cur { border-color: var(--accent); } .ped-side .pt canvas { width: 100%; height: auto; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.ped-scroll { flex: 1; overflow: auto; padding: 14px 8px 80px; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y pinch-zoom; }
.ped-scroll.drawing { touch-action: none; }
.ped-page { position: relative; margin: 0 auto 16px; background: #fff; box-shadow: 0 2px 14px rgba(0,0,0,.28); transform-origin: top left; }
.ped-page canvas.pdfc { display: block; width: 100%; height: 100%; position: absolute; left: 0; top: 0; }
.ped-layer { position: absolute; inset: 0; overflow: hidden; }
.ped-pgnum { position: absolute; left: 50%; bottom: -3px; transform: translate(-50%, 100%); font-size: 11px; color: var(--ink-3); }
.tb-box { position: absolute; cursor: pointer; border-radius: 2px; }
.ped-mode-edit .tb-box:hover, .ped-mode-edit .tb-box.hl { outline: 2px solid color-mix(in srgb, #2b7cff 80%, transparent); background: rgba(43,124,255,.10); }
.ped-mode-edit.showall .tb-box { outline: 1px dashed rgba(43,124,255,.55); }
.obj { position: absolute; user-select: none; touch-action: none; }
.obj.sel { outline: 2px solid #2b7cff; outline-offset: 1px; }
.obj .rh { position: absolute; right: -9px; bottom: -9px; width: 18px; height: 18px; background: #2b7cff; border: 2px solid #fff; border-radius: 50%; cursor: nwse-resize; touch-action: none; display: none; }
.obj.sel .rh { display: block; }
.obj .del { position: absolute; right: -11px; top: -11px; width: 22px; height: 22px; background: #d9382b; color: #fff; border: 2px solid #fff; border-radius: 50%; cursor: pointer; font-size: 12px; line-height: 16px; text-align: center; display: none; padding: 0; }
.obj.sel .del { display: block; }
.obj.txt { white-space: pre; line-height: 1.15; cursor: move; padding: 0; }
.obj.txt .ln { position: absolute; white-space: pre; left: 0; line-height: 1; }
.ped-editor { position: absolute; z-index: 30; background: #fff; color: #000; border: 2px solid #2b7cff; border-radius: 4px; padding: 0; margin: 0; outline: none; resize: none; overflow: hidden; box-shadow: 0 6px 24px rgba(0,0,0,.3); }
.ped-status { padding: 5px 12px; font-size: 12.5px; color: var(--ink-3); background: var(--surface); border-top: 1px solid var(--line); flex: none; display: flex; gap: 14px; flex-wrap: wrap; }
.ped-empty { max-width: 560px; margin: 8vh auto; padding: 0 16px; }
.siggrid { display: grid; gap: 10px; }
.sigpad { width: 100%; height: 180px; background: #fff; border: 2px dashed var(--line-strong); border-radius: 12px; touch-action: none; }

/* PDF editor: page panel as overlay on phones */
@media (max-width: 899px) { .ped-side.on { display: block; position: absolute; z-index: 40; left: 0; top: 0; bottom: 0; width: 150px; box-shadow: 4px 0 18px rgba(0,0,0,.25); } }
.ped-side .pt > div:first-child canvas { max-width: 100%; }
.tb-box.all { outline: 1px dashed rgba(43,124,255,.55); }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.searchbox input[type=search] { padding: 0 16px 0 48px; }

/* PDF editor: always-visible download */
.ped-fab { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 70; display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font: 700 16px/1 inherit; box-shadow: 0 10px 28px rgba(11,122,102,.45), 0 2px 6px rgba(0,0,0,.25); cursor: pointer; }
.ped-fab[hidden] { display: none; }
.ped-fab:disabled { opacity: .6; }
.ped-fab:active { transform: translateY(1px); }
.ped-dl { min-height: 38px; padding: 0 16px; font-weight: 700; flex: none; }
.ped-opts .fontsel { min-width: 150px; max-width: 220px; }


/* ══ v2 design: AI-first home ══ */
h1, h2, h3 { font-weight: 700; }
.topbar { background: color-mix(in srgb, var(--surface) 86%, transparent); }
.brand-mark { background: var(--grad); color: #fff; box-shadow: 0 4px 12px -4px rgba(79,70,229,.7); }
.hero2 { position: relative; margin: 6px 0 4px; padding: 34px 22px 26px; border-radius: 24px; background: var(--grad); color: #fff; overflow: hidden; isolation: isolate; }
.hero2::before { content: ""; position: absolute; inset: -40% -10% auto auto; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.28), transparent 65%); z-index: -1; }
.hero2::after { content: ""; position: absolute; left: -80px; bottom: -120px; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, rgba(14,165,233,.5), transparent 65%); z-index: -1; }
.eyebrow { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 700; letter-spacing: .02em; padding: 5px 12px; border-radius: 99px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); }
.hero2 h1 { font-size: clamp(30px, 6.6vw, 54px); margin: 14px 0 0; max-width: 17ch; line-height: 1.08; color: #fff; }
.hero2 p { margin: 12px 0 0; max-width: 58ch; font-size: 17px; color: rgba(255,255,255,.92); }
.askbox { display: flex; gap: 8px; margin-top: 22px; background: #fff; border-radius: 18px; padding: 7px; box-shadow: 0 16px 40px -16px rgba(10,10,60,.6); max-width: 760px; }
.askbox input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 17px; padding: 0 12px; color: #0f1729; height: 48px; }
.askbox input::placeholder { color: #7a849c; }
.askbox button { flex: none; height: 48px; padding: 0 22px; border: 0; border-radius: 13px; background: var(--grad); color: #fff; font-weight: 700; font-size: 16px; cursor: pointer; }
.asksugg { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.asksugg a { color: #fff; text-decoration: none; font-size: 13.5px; padding: 6px 12px; border-radius: 99px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28); }
.asksugg a:hover { background: rgba(255,255,255,.28); }
.hero2 .badges { margin-top: 16px; }
.hero2 .badge { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.25); }
.pdfspot { display: grid; grid-template-columns: 1fr; gap: 18px; align-items: center; margin-top: 26px; padding: 22px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
@media (min-width: 760px) { .pdfspot { grid-template-columns: 1.2fr 1fr; padding: 28px; } }
.pdfspot h2 { font-size: clamp(22px, 4vw, 30px); }
.pdfspot p { color: var(--ink-2); margin: 8px 0 14px; max-width: 54ch; }
.pdfspot ul { margin: 0 0 16px; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 14.5px; color: var(--ink-2); }
.pdfspot li::before { content: "✓"; color: var(--ok); font-weight: 800; margin-right: 8px; }
.cta { display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 22px; border-radius: 13px; background: var(--accent); color: var(--accent-ink); font-weight: 700; text-decoration: none; }
.cta:hover { filter: brightness(1.08); }
.mock { border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); padding: 14px; display: grid; gap: 10px; }
.mock .bar { display: flex; gap: 6px; }
.mock .bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.mock .pg { background: #fff; color: #222; border-radius: 8px; padding: 14px 16px; font: 13px/1.5 Georgia, serif; box-shadow: 0 6px 18px -10px rgba(0,0,0,.35); }
.mock .pg b { display: block; font: 700 15px/1.3 var(--font-display); color: #1e1b4b; margin-bottom: 4px; }
.mock .pg s { color: #b42318; }
.mock .pg ins { background: #dcfce7; color: #166534; text-decoration: none; border-radius: 3px; padding: 0 2px; }
.mock .pill { justify-self: start; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 3px 10px; border-radius: 99px; }
.aigrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.tcard.ai { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 9%, var(--surface)), var(--surface) 70%); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.tcard.ai .ticon { background: var(--grad); color: #fff; box-shadow: 0 6px 16px -8px rgba(79,70,229,.8); }
.tcard.ai.first { grid-column: 1 / -1; }
@media (min-width: 700px) { .tcard.ai.first { grid-column: span 2; } }
.tcard { border-radius: var(--radius); }
.chip[aria-current="true"], .chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.section-h h2 { font-size: 22px; }
.searchbox input[type=search] { border-radius: 16px; }
.btn.primary, button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ped-fab { background: var(--grad); box-shadow: 0 10px 28px rgba(79,70,229,.5), 0 2px 6px rgba(0,0,0,.25); }
@media (max-width: 520px) { .hero2 { padding: 24px 16px 20px; border-radius: 20px; } .askbox { flex-direction: column; } .askbox button { width: 100%; } }

.dots { display: inline-flex; gap: 5px; padding: 4px 2px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); animation: dot 1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }
.aimsg p { margin: 0 0 8px; } .aimsg p:last-child { margin: 0; } .aimsg ul, .aimsg ol { margin: 4px 0 8px; padding-left: 22px; }
.aimsg code { font-family: var(--font-mono); font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; } .aimsg pre code { background: none; padding: 0; }


/* ── ToolNest refined minimal interface ── */
:root {
  --bg: #f5f6f4; --surface: #ffffff; --surface-2: #eef1ee;
  --line: #e1e6e1; --line-strong: #cbd4cd;
  --ink: #17231e; --ink-2: #53635b; --ink-3: #78867e;
  --accent: #16785e; --accent-ink: #ffffff; --accent-soft: #e2f1eb; --accent-2: #d7eee5;
  --danger: #b83d38; --ok: #18794e; --warn: #95651a;
  --radius: 13px; --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20,35,27,.035), 0 8px 24px -18px rgba(20,35,27,.22);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #101714; --surface: #17211c; --surface-2: #202c25;
  --line: #2a3930; --line-strong: #3b4d42;
  --ink: #edf4ef; --ink-2: #b5c4ba; --ink-3: #84958a;
  --accent: #63c39c; --accent-ink: #0d1b14; --accent-soft: #1c3a2d; --accent-2: #294c3c;
  --danger: #ff8a7f; --ok: #67d5a0; --warn: #e6bd70;
  --shadow: 0 1px 2px rgba(0,0,0,.2), 0 10px 26px -18px rgba(0,0,0,.7);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101714; --surface: #17211c; --surface-2: #202c25;
    --line: #2a3930; --line-strong: #3b4d42;
    --ink: #edf4ef; --ink-2: #b5c4ba; --ink-3: #84958a;
    --accent: #63c39c; --accent-ink: #0d1b14; --accent-soft: #1c3a2d; --accent-2: #294c3c;
    --danger: #ff8a7f; --ok: #67d5a0; --warn: #e6bd70;
    --shadow: 0 1px 2px rgba(0,0,0,.2), 0 10px 26px -18px rgba(0,0,0,.7);
  }
}
body { letter-spacing: -.008em; }
.wrap { max-width: 1200px; }
.topbar { background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(16px); }
.topbar .wrap { height: 64px; }
.brand { font-size: 19px; letter-spacing: -.035em; }
.brand-mark { border-radius: 10px; background: var(--ink); color: var(--bg); }
main { padding-top: 26px; }
.hero { padding: 44px 0 18px; }
.hero h1 { max-width: 17ch; font-size: clamp(34px, 6vw, 58px); letter-spacing: -.055em; line-height: 1.04; font-weight: 720; }
.hero h1 em { color: var(--accent); font-style: normal; }
.hero p { max-width: 58ch; font-size: 16px; line-height: 1.7; color: var(--ink-2); }
.badges { gap: 7px; }
.badge { border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 650; }
.searchbox { max-width: 820px; margin-top: 24px; }
.searchbox input { height: 58px; border-radius: 12px; background: var(--surface); border-color: var(--line); box-shadow: 0 2px 8px rgba(20,35,27,.035); }
.chips { gap: 7px; }
.chip { border-radius: 8px; padding: 7px 12px; font-size: 13px; }
.chip[aria-current="true"], .chip.on { background: var(--ink); color: var(--bg); }
.section-h { margin-top: 34px; }
.section-h h2 { font-size: 21px; letter-spacing: -.035em; }
.grid { gap: 13px; }
.tcard { gap: 12px; padding: 15px; border-radius: 12px; min-height: 88px; box-shadow: none; transition: border-color .15s, background .15s; }
.tcard:hover { transform: none; border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); background: color-mix(in srgb, var(--accent-soft) 22%, var(--surface)); box-shadow: none; }
.ticon { width: 39px; height: 39px; border-radius: 10px; font-size: 19px; }
.tcard h3 { font-size: 14px; font-weight: 680; letter-spacing: -.01em; }
.tcard p { font-size: 12.5px; line-height: 1.5; color: var(--ink-3); }
.feature .tcard.big { background: var(--surface); border-color: var(--line); }
.panel { border-radius: 13px; box-shadow: var(--shadow); padding: 18px; }
.panel h3 { letter-spacing: .035em; font-size: 12px; }
input[type=text], input[type=number], input[type=date], input[type=time], input[type=search], input[type=password], input[type=url], input[type=email], input[type=datetime-local], select, textarea { background: var(--surface); border-color: var(--line); border-radius: 9px; }
.btn { border-radius: 9px; font-weight: 650; box-shadow: none; }
.btn.secondary { border-color: var(--line); }
.thead h1 { letter-spacing: -.04em; }
footer { margin-top: 20px; }
.tcard:focus-visible, .chip:focus-visible, button:focus-visible, a:focus-visible { outline-color: var(--accent); }
/* The PDF inline editor must retain the sampled page colour and the original text colour. */
textarea.ped-editor { background: var(--ped-bg, #fff) !important; color: var(--ped-ink, #111) !important; border: 2px solid #16785e !important; padding: 2px 4px !important; opacity: 1 !important; -webkit-text-fill-color: var(--ped-ink, #111) !important; box-shadow: 0 4px 18px rgba(0,0,0,.22) !important; }
@media (max-width: 600px) { .hero { padding-top: 28px; } .hero h1 { font-size: clamp(32px, 10vw, 44px); } .panel { padding: 14px; } .topbar .wrap { height: 58px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }

/* Home workspace hero: calm, high-contrast, minimal instead of a saturated gradient banner. */
.hero2 { margin: 8px 0 8px; padding: clamp(26px, 5vw, 48px); border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.hero2::before, .hero2::after { display: none; }
.hero2 .eyebrow { padding: 5px 10px; border-radius: 6px; background: var(--accent-soft); border: 1px solid var(--line); color: var(--accent); font-size: 11px; letter-spacing: .055em; text-transform: uppercase; }
.hero2 h1 { max-width: 16ch; margin-top: 17px; color: var(--ink); font-size: clamp(34px, 6.2vw, 60px); line-height: 1.02; letter-spacing: -.055em; }
.hero2 p { max-width: 60ch; color: var(--ink-2); font-size: 15.5px; line-height: 1.7; }
.hero2 .badges .badge { background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.asksugg a { color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px; font-size: 12.5px; }
.asksugg a:hover { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.askbox { max-width: 760px; margin-top: 20px; }
.askbox input { border-radius: 10px; background: var(--bg); border-color: var(--line-strong); box-shadow: none; }
.askbox button { border-radius: 9px; }
.pdfspot { border-radius: 14px; box-shadow: none; }
.pdfspot .eyebrow { background: var(--accent-soft) !important; color: var(--accent) !important; }
.aigrid .tcard.ai { background: var(--surface); border-color: var(--line); }
.aigrid .tcard.ai .ticon { background: var(--accent-soft); color: var(--accent); box-shadow: none; }

.skip-link { position: fixed; z-index: 1000; left: 12px; top: 12px; transform: translateY(-160%); padding: 10px 14px; border-radius: 8px; background: var(--ink); color: var(--bg); text-decoration: none; } .skip-link:focus { transform: translateY(0); }

/* ask box follows the theme (fixes a white card with a dark input in dark mode) */
.askbox { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.askbox input { color: var(--ink); background: var(--bg); }
.askbox input::placeholder { color: var(--ink-3); }
