/* =====================================================================
   HappyPDF design system: calm surfaces, one accent colour, big type.
   ===================================================================== */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --fill: rgba(118, 118, 128, .12);
  --fill-2: rgba(118, 118, 128, .2);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --border: rgba(0, 0, 0, .1);
  --hairline: rgba(0, 0, 0, .08);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --primary: var(--accent);
  --ok: #34c759;
  --ok-text: #248a3d;
  --danger: #ff3b30;
  --glass: rgba(245, 245, 247, .78);
  --glass-2: rgba(255, 255, 255, .96);
  --radius: 18px;
  --radius-lg: 28px;
  --nav-h: 52px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 2px 8px rgba(0, 0, 0, .04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .04);
  --ease: cubic-bezier(.25, .1, .25, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --fill: rgba(118, 118, 128, .24);
  --fill-2: rgba(118, 118, 128, .36);
  --text: #f5f5f7;
  --muted: #98989d;
  --border: rgba(255, 255, 255, .14);
  --hairline: rgba(255, 255, 255, .1);
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --ok: #30d158;
  --ok-text: #30d158;
  --danger: #ff453a;
  --glass: rgba(22, 22, 23, .78);
  --glass-2: rgba(36, 36, 38, .96);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 8px rgba(0, 0, 0, .3);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  font: 17px/1.47 var(--font); letter-spacing: -.012em;
  background: var(--bg); color: var(--text);
  min-height: 100vh; display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
body.no-scroll { overflow: hidden; }
main { flex: 1; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2, h3, h4 { line-height: 1.1; margin: 0 0 .5em; letter-spacing: -.022em; font-weight: 700; }
p { margin: 0 0 1em; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 22px; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; border-radius: 6px; }
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 300; background: var(--surface); padding: 8px 14px; border-radius: 10px; }
.skip:focus-visible { left: 8px; }
svg { flex: none; }

/* ---------- App icons (category coloured squircles) ---------- */
.app-icon {
  display: inline-grid; place-items: center; flex: none;
  width: 48px; height: 48px; border-radius: 12px; color: #fff;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c, var(--accent)) 72%, #fff) 0%, var(--c, var(--accent)) 55%, color-mix(in srgb, var(--c, var(--accent)) 85%, #000) 100%);
  box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .1), 0 1px 2px rgba(0, 0, 0, .08);
}
.app-icon svg { stroke-width: 2; }
.app-icon.sm { width: 28px; height: 28px; border-radius: 7.5px; }
.app-icon.xl { width: 88px; height: 88px; border-radius: 22px; box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .1), 0 8px 24px color-mix(in srgb, var(--c, var(--accent)) 30%, transparent); }
.mini-icon { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: #fff; background: var(--c); flex: none; }
.mini-icon svg { stroke-width: 2.2; }

/* ---------- Navigation (frosted glass) ---------- */
.nav {
  position: sticky; top: 0; z-index: 100; height: var(--nav-h);
  background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
body.is-scrolled .nav { border-bottom-color: var(--hairline); }
.nav-inner { display: flex; align-items: center; gap: 28px; height: 100%; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.12rem; letter-spacing: -.02em; color: var(--text); }
.brand img { border-radius: 7px; }
.nav-links { display: flex; gap: 2px; flex: 1; }
.nav-links a { color: var(--text); opacity: .8; font-size: .82rem; padding: 6px 11px; border-radius: 99px; transition: opacity .15s, background .15s; }
.nav-links a:hover { opacity: 1; background: var(--fill); }
.nav-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.nav-search {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px 0 12px; min-width: 210px;
  border: none; border-radius: 10px; background: var(--fill); color: var(--muted); font: inherit; font-size: .82rem; cursor: pointer; transition: background .15s;
}
.nav-search:hover { background: var(--fill-2); }
.nav-search span { flex: 1; text-align: left; }
.nav-search kbd { font: 600 .7rem var(--font); background: var(--surface); border-radius: 5px; padding: 2px 6px; color: var(--muted); box-shadow: 0 0 0 .5px var(--border); }
.megamenu { position: static; }
.megamenu summary {
  list-style: none; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px;
  border-radius: 10px; font-size: .82rem; font-weight: 500; cursor: pointer; color: var(--text); transition: background .15s;
}
.megamenu summary::-webkit-details-marker { display: none; }
.megamenu summary:hover, .megamenu[open] summary { background: var(--fill); }
.megamenu-panel {
  position: fixed; left: 0; right: 0; top: var(--nav-h); max-height: calc(100vh - var(--nav-h)); overflow: auto;
  background: var(--glass-2); -webkit-backdrop-filter: saturate(180%) blur(30px); backdrop-filter: saturate(180%) blur(30px);
  border-bottom: 1px solid var(--hairline); box-shadow: 0 30px 60px rgba(0, 0, 0, .12);
  padding: 30px 0 38px; animation: drop .28s var(--ease);
}
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } }
.megamenu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 26px 32px; }
.megamenu-col h4 { font-size: .75rem; font-weight: 600; color: var(--muted); margin: 0 0 10px; letter-spacing: 0; }
.megamenu-col a { display: flex; align-items: center; gap: 10px; color: var(--text); padding: 5px 0; font-size: .9rem; font-weight: 500; }
.megamenu-col a:hover { color: var(--accent); }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: none; border-radius: 10px; background: none; color: var(--text); cursor: pointer; transition: background .15s; }
.icon-btn:hover { background: var(--fill); }
.i-sun { display: none; }
[data-theme="dark"] .i-sun { display: inline-grid; }
[data-theme="dark"] .i-moon { display: none; }

/* ---------- Spotlight search ---------- */
.spotlight { position: fixed; inset: 0; z-index: 400; background: rgba(0, 0, 0, .22); display: flex; justify-content: center; align-items: flex-start; padding: 13vh 16px 16px; animation: fade .18s; }
@keyframes fade { from { opacity: 0; } }
.spotlight-box {
  width: min(660px, 100%); max-height: 72vh; display: flex; flex-direction: column; overflow: hidden;
  background: var(--glass-2); -webkit-backdrop-filter: saturate(180%) blur(40px); backdrop-filter: saturate(180%) blur(40px);
  border-radius: 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, .3), 0 0 0 .5px var(--border); animation: pop .22s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: scale(.97); } }
.spotlight-field { display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--hairline); color: var(--muted); }
.spotlight-field input { flex: 1; height: 62px; border: none; outline: none; background: none; color: var(--text); font: 400 1.35rem var(--font); letter-spacing: -.02em; }
.spotlight-field input::-webkit-search-cancel-button { display: none; }
.spotlight-list { overflow: auto; padding: 8px; }
.spotlight-list a { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 11px; color: var(--text); }
.spotlight-list a span:last-child { display: flex; flex-direction: column; min-width: 0; }
.spotlight-list strong { font-weight: 600; font-size: .95rem; }
.spotlight-list small { color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spotlight-list a.is-active { background: var(--accent); color: #fff; }
.spotlight-list a.is-active small { color: rgba(255, 255, 255, .8); }
.spotlight-empty { color: var(--muted); text-align: center; padding: 24px; margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px; border-radius: 980px; border: none;
  background: var(--fill); color: var(--text); font: inherit; font-size: .94rem; font-weight: 500; letter-spacing: -.01em; cursor: pointer;
  transition: background .15s, transform .1s var(--ease), box-shadow .15s; white-space: nowrap;
}
.btn:hover { background: var(--fill-2); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-xl { padding: 14px 30px; font-size: 1.06rem; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: .84rem; }
.btn-link, .link { display: inline-flex; align-items: center; gap: 6px; border: none; background: none; color: var(--accent); font: inherit; font-size: .95rem; cursor: pointer; padding: 6px 4px; }
.btn-link:hover, .link:hover { text-decoration: underline; }

/* ---------- Home ---------- */
.hero { text-align: center; padding: 72px 0 28px; }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; font-size: .85rem; font-weight: 600; color: var(--ok-text); background: color-mix(in srgb, var(--ok) 12%, transparent); padding: 6px 14px; border-radius: 99px; margin-bottom: 22px; }
.hero h1 { font-size: clamp(2.5rem, 6.4vw, 4.6rem); line-height: 1.04; letter-spacing: -.04em; margin-bottom: 18px; }
.grad { background: linear-gradient(95deg, #0a84ff 0%, #8e5cf7 50%, #ff375f 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: clamp(1.08rem, 2vw, 1.3rem); line-height: 1.45; color: var(--muted); max-width: 640px; margin: 0 auto 30px; letter-spacing: -.016em; }
.hero-search {
  display: flex; align-items: center; gap: 12px; max-width: 600px; margin: 0 auto 22px; padding: 0 20px; height: 58px;
  background: var(--surface); border-radius: 16px; color: var(--muted); box-shadow: var(--shadow-lg); transition: box-shadow .2s;
}
.hero-search:focus-within { box-shadow: var(--shadow-lg), 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.hero-search input { flex: 1; min-width: 0; border: none; outline: none; background: none; color: var(--text); font: inherit; font-size: 1.05rem; height: 100%; }
.seg-pills { display: inline-flex; gap: 4px; padding: 4px; background: var(--fill); border-radius: 99px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg-pills::-webkit-scrollbar { display: none; }
.seg-pills button { border: none; background: none; color: var(--text); font: inherit; font-size: .85rem; font-weight: 500; padding: 7px 15px; border-radius: 99px; cursor: pointer; white-space: nowrap; transition: background .2s, box-shadow .2s; }
.seg-pills button:hover { background: var(--fill); }
.seg-pills button.is-active { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }

.tools { padding-bottom: 40px; }
.tool-section { padding-top: 34px; }
.tool-section h2 { font-size: 1.5rem; margin-bottom: 16px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 14px; }
.tool-card {
  display: flex; align-items: center; gap: 15px; padding: 16px 18px; min-height: 84px;
  background: var(--surface); border-radius: var(--radius); color: var(--text);
  box-shadow: var(--shadow); transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.tool-card:hover { transform: translateY(-2px) scale(1.01); box-shadow: var(--shadow-lg); }
.tool-card:active { transform: scale(.99); }
.tool-card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tool-card strong { font-size: 1rem; font-weight: 600; letter-spacing: -.015em; }
.tool-card small { color: var(--muted); font-size: .83rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.no-results { text-align: center; color: var(--muted); padding: 48px 0; }

.bento { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; padding-top: 56px; padding-bottom: 24px; }
.bento-card { background: var(--surface); border-radius: var(--radius-lg); padding: 34px; box-shadow: var(--shadow); }
.bento-main { grid-row: span 2; display: flex; flex-direction: column; justify-content: flex-end; min-height: 340px;
  background: radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, #30b955 16%, transparent), transparent 60%), var(--surface); }
.bento-card h2 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); letter-spacing: -.035em; margin: 18px 0 10px; }
.bento-card h3 { font-size: 1.5rem; margin: 16px 0 6px; }
.bento-card p { color: var(--muted); margin: 0; font-size: 1.02rem; }
.bento-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }

/* ---------- Tool page ---------- */
.stage { text-align: center; padding: 34px 22px 72px; max-width: 880px; margin: 0 auto; }
.crumb { display: inline-flex; align-items: center; gap: 5px; font-size: .85rem; color: var(--muted); margin-bottom: 26px; }
.crumb:hover { color: var(--accent); }
.stage-upload .app-icon.xl { display: grid; margin: 0 auto 22px; }
.stage-upload h1 { font-size: clamp(2.2rem, 5.4vw, 3.6rem); letter-spacing: -.04em; margin-bottom: 12px; }
.stage-upload .lead { margin-bottom: 34px; }
.dropzone {
  margin: 0 auto; max-width: 660px; padding: 44px 24px 40px; border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow); outline: 2px dashed transparent; outline-offset: -12px;
  display: flex; flex-direction: column; align-items: center; gap: 12px; transition: outline-color .2s, background .2s, transform .2s var(--ease);
}
.dropzone.is-over, body.is-dragging .dropzone { outline-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); transform: scale(1.01); }
.drop-art { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); margin-bottom: 6px; }
.dropzone .muted { font-size: .9rem; margin: 0; }
.privacy-note { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .85rem; margin-top: 20px; }
.privacy-note svg { color: var(--ok-text); }
.soon-note { background: var(--surface); padding: 14px 18px; border-radius: 14px; display: inline-block; }

.stage-work { max-width: none; padding: 0; text-align: left; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 360px; min-height: calc(100vh - var(--nav-h)); }
.work-main { padding: 24px 28px; overflow: auto; }
.work-side {
  background: var(--surface); border-left: 1px solid var(--hairline); padding: 22px 22px 20px;
  display: flex; flex-direction: column; gap: 18px; position: sticky; top: var(--nav-h); height: calc(100vh - var(--nav-h)); overflow: auto;
}
.side-head { display: flex; align-items: center; gap: 10px; padding-bottom: 16px; border-bottom: 1px solid var(--hairline); }
.side-head h2 { font-size: 1.25rem; margin: 0; }
.work-side #process-btn { margin-top: auto; position: sticky; bottom: 0; box-shadow: 0 -12px 16px var(--surface); }
.work-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; align-items: center; }
.work-toolbar .spacer { flex: 1; }
.work-toolbar > .muted { font-size: .85rem; }
.side-msg { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); border-radius: 12px; padding: 11px 13px; font-size: .88rem; }

.file-grid { display: flex; flex-wrap: wrap; gap: 18px; align-content: flex-start; }
.card {
  width: 168px; background: var(--surface); border-radius: 16px; padding: 10px; box-shadow: var(--shadow);
  position: relative; text-align: center; cursor: grab; user-select: none; transition: box-shadow .2s, transform .2s var(--ease);
}
.card:hover { box-shadow: var(--shadow-lg); }
.card .thumb { height: 188px; display: grid; place-items: center; background: var(--surface-2); border-radius: 10px; overflow: hidden; }
.card .thumb canvas, .card .thumb img { max-width: 100%; max-height: 100%; box-shadow: 0 1px 4px rgba(0, 0, 0, .16); background: #fff; transition: transform .25s var(--ease); }
.card .name { font-size: .8rem; font-weight: 500; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta { font-size: .72rem; color: var(--muted); }
.card .card-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; z-index: 2; }
.card:hover .card-actions, .card:focus-within .card-actions { opacity: 1; }
.card .card-actions button { width: 28px; height: 28px; border-radius: 50%; border: none; background: rgba(0, 0, 0, .62); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #fff; cursor: pointer; font-size: .85rem; display: grid; place-items: center; }
.card .card-actions button:hover { background: rgba(0, 0, 0, .8); }
.card .num { position: absolute; left: 14px; top: 14px; background: var(--glass-2); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-radius: 99px; font-size: .7rem; font-weight: 600; padding: 2px 8px; z-index: 1; box-shadow: 0 0 0 .5px var(--border); }
.card.is-selected { box-shadow: 0 0 0 3px var(--accent), var(--shadow-lg); }
.card.is-selected::after { content: "✓"; position: absolute; bottom: 46px; right: 16px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; box-shadow: 0 0 0 2px var(--surface); }
.card.is-marked-remove .thumb { opacity: .35; }
.card.is-marked-remove.is-selected { box-shadow: 0 0 0 3px var(--danger), var(--shadow-lg); }
.card.is-marked-remove.is-selected::after { content: "✕"; background: var(--danger); }
.card.is-blank .thumb { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 8px, var(--surface) 8px, var(--surface) 16px); }
.card.sortable-ghost { opacity: .35; }
.card.sortable-chosen { transform: scale(1.03); }
.add-card { width: 168px; min-height: 250px; border: 2px dashed var(--border); border-radius: 16px; background: none; color: var(--muted); font: inherit; font-size: .9rem; font-weight: 500; cursor: pointer; display: grid; place-items: center; transition: border-color .15s, color .15s, background .15s; }
.add-card:hover { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 4%, transparent); }
.add-card span { font-size: 2.2rem; font-weight: 300; display: block; line-height: 1; }

/* ---------- Options (inspector) ---------- */
.options { display: flex; flex-direction: column; gap: 18px; }
.opt label.opt-label { display: block; font-weight: 600; font-size: .8rem; color: var(--muted); margin-bottom: 7px; letter-spacing: -.005em; }
.opt .hint { font-size: .78rem; color: var(--muted); margin-top: 5px; }
.opt input[type=text], .opt input[type=password], .opt input[type=number], .opt select, .opt textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: none; background: var(--fill); color: var(--text); font: inherit; font-size: .94rem; transition: box-shadow .15s, background .15s;
}
.opt select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background: var(--fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; }
.opt input:focus, .opt select:focus, .opt textarea:focus { outline: none; background-color: var(--surface); box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.opt input[type=range] { width: 100%; accent-color: var(--accent); }
.opt input[type=color] { width: 44px; height: 34px; border: none; border-radius: 9px; padding: 3px; background: var(--fill); cursor: pointer; }
.opt .check { display: flex; gap: 10px; align-items: center; font-size: .92rem; cursor: pointer; }
.opt .check input { accent-color: var(--accent); width: 18px; height: 18px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--fill); border-radius: 10px; padding: 2px; gap: 2px; }
.seg.vertical { grid-auto-flow: row; }
.seg button { border: none; background: none; color: var(--text); padding: 7px 8px; border-radius: 8px; font: inherit; font-size: .84rem; font-weight: 500; cursor: pointer; transition: background .2s, box-shadow .2s; }
.seg.vertical button { text-align: left; padding: 9px 12px; }
.seg button:hover:not(.is-active) { background: var(--fill); }
.seg button.is-active { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); font-weight: 600; }
[data-theme="dark"] .seg button.is-active { background: #636366; }
.seg button small { display: block; font-weight: 400; color: var(--muted); font-size: .75rem; margin-top: 1px; }
.pos-grid { display: grid; grid-template-columns: repeat(3, 40px); gap: 5px; }
.pos-grid button { height: 32px; border: none; background: var(--fill); border-radius: 8px; cursor: pointer; transition: background .15s; }
.pos-grid button:hover { background: var(--fill-2); }
.pos-grid button.is-active { background: var(--accent); }
.opt-note { font-size: .84rem; color: var(--muted); background: var(--surface-2); padding: 11px 13px; border-radius: 12px; line-height: 1.45; }
.range-row { display: flex; gap: 10px; align-items: center; }
.range-row output { min-width: 44px; text-align: right; font-weight: 600; font-size: .85rem; font-variant-numeric: tabular-nums; }

.url-form { display: flex; gap: 8px; width: 100%; max-width: 520px; margin-top: 10px; }
.url-form input { flex: 1; min-width: 0; padding: 11px 16px; border-radius: 99px; border: none; background: var(--fill); color: var(--text); font: inherit; }
.url-form input:focus { outline: none; box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.card .thumb .ext { font-weight: 700; font-size: 1.2rem; color: #fff; background: var(--c, var(--accent)); border-radius: 10px; padding: 14px 12px; }

/* ---------- Busy / done ---------- */
.stage-busy, .stage-done { min-height: calc(100vh - var(--nav-h) - 80px); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.busy-ring { margin-bottom: 18px; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 3.5px solid var(--fill); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.stage-busy h2 { font-size: 1.6rem; }
.progress { width: min(380px, 80vw); height: 6px; margin: 14px auto; background: var(--fill); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .25s var(--ease); }
#busy-text { font-size: .9rem; font-variant-numeric: tabular-nums; }
.done-check { width: 76px; height: 76px; margin-bottom: 20px; }
.done-check svg { width: 100%; height: 100%; }
.done-check circle { fill: var(--ok); stroke: none; transform-origin: center; animation: popin .45s var(--ease) both; }
.done-check path { fill: none; stroke: #fff; stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .4s .3s var(--ease) forwards; }
@keyframes popin { from { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.06); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.stage-done h1 { font-size: clamp(2rem, 4.6vw, 3rem); letter-spacing: -.035em; margin-bottom: 10px; }
.stage-done .lead { margin-bottom: 28px; font-size: 1.05rem; }
.done-actions { margin-top: 14px; }
.continue { margin-top: 56px; width: 100%; }
.continue h3 { font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 14px; letter-spacing: 0; }
.continue-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.continue-list a { display: inline-flex; gap: 9px; align-items: center; background: var(--surface); padding: 6px 15px 6px 6px; border-radius: 99px; color: var(--text); font-size: .88rem; font-weight: 500; box-shadow: var(--shadow); transition: box-shadow .2s, transform .2s var(--ease); }
.continue-list a .app-icon.sm { border-radius: 50%; }
.continue-list a:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 500; max-width: min(520px, 90vw);
  background: rgba(29, 29, 31, .88); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); color: #fff;
  padding: 12px 20px; border-radius: 16px; box-shadow: var(--shadow-lg); font-size: .92rem; animation: toast .3s var(--ease);
}
@keyframes toast { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------- Content pages ---------- */
.prose { max-width: 720px; padding-top: 56px; padding-bottom: 72px; }
.prose h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); letter-spacing: -.04em; }
.prose h2 { font-size: 1.5rem; margin-top: 1.8em; }
.prose p, .prose li { color: color-mix(in srgb, var(--text) 85%, var(--muted)); }
.prose li { margin-bottom: .5em; }

/* ---------- How-to / FAQ (tool pages, home) ---------- */
body[data-view="work"] .seo-content, body[data-view="busy"] .seo-content { display: none; }
.seo-content { max-width: 760px; margin: 24px auto 80px; padding: 0 22px; }
.seo-content h2 { font-size: 1.6rem; letter-spacing: -.03em; margin: 2.2em 0 .7em; }
.home-faq h2 { text-align: center; font-size: clamp(1.8rem, 3.6vw, 2.5rem); margin-top: 1.4em; }
.answer { font-size: 1.05rem; line-height: 1.55; background: var(--surface); border-radius: var(--radius); padding: 20px 24px; margin: 0; box-shadow: var(--shadow); }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 30px 1fr; column-gap: 14px; padding: 16px 20px; }
.steps li + li { border-top: 1px solid var(--hairline); }
.steps li::before { content: counter(s); grid-row: span 2; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: .85rem; }
.steps li strong { font-weight: 600; }
.steps li span { color: var(--muted); font-size: .95rem; }
.faq { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.faq details + details { border-top: 1px solid var(--hairline); }
.faq summary { cursor: pointer; padding: 17px 22px; font-weight: 500; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; transition: background .15s; }
.faq summary:hover { background: color-mix(in srgb, var(--fill) 50%, transparent); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; flex: none; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-3px); transition: transform .25s var(--ease); }
.faq details[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.faq details p { margin: 0; padding: 0 22px 18px; color: var(--muted); line-height: 1.55; }
.seo-content .continue-list { justify-content: flex-start; }
.prose .answer { margin-bottom: 1.2em; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--hairline); padding: 36px 0 28px; font-size: .78rem; color: var(--muted); }
.footer-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding-bottom: 22px; border-bottom: 1px solid var(--hairline); }
.footer-top p { margin: 0; }
.footer .brand { font-size: .98rem; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 24px; padding: 24px 0; }
.footer-grid h4 { font-size: .78rem; font-weight: 600; color: var(--text); margin: 0 0 8px; letter-spacing: 0; }
.footer-grid a { display: block; color: var(--muted); line-height: 2; }
.footer-grid a:hover { color: var(--text); text-decoration: underline; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-top: 18px; border-top: 1px solid var(--hairline); }

/* ---------- Small screens ---------- */
@media (max-width: 960px) {
  .nav-links { display: none; }
  .nav-search { min-width: 0; }
}
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .work-main { padding: 18px 16px; }
  .work-side { position: static; height: auto; border-left: none; border-top: 1px solid var(--hairline); padding-bottom: 0; }
  .work-side #process-btn { bottom: 12px; margin-bottom: 12px; box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 35%, transparent); }
  .card, .add-card { width: calc(50% - 9px); }
  .card .card-actions { opacity: 1; }
  .bento { grid-template-columns: 1fr; }
  .bento-main { grid-row: auto; min-height: 0; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .nav-inner { gap: 10px; }
  .nav-search span, .nav-search kbd, .megamenu summary span { display: none; }
  .nav-search { padding: 0; width: 34px; justify-content: center; background: none; color: var(--text); }
  .megamenu summary { padding: 0; width: 34px; justify-content: center; }
  .hero { padding: 44px 0 18px; }

  .hero-search { height: 52px; }
  .seg-pills { display: flex; border-radius: 14px; }
  .tool-grid { grid-template-columns: 1fr; gap: 10px; }
  .tool-card { min-height: 0; padding: 14px 16px; }
  .bento-card { padding: 26px; }
  .stage { padding-top: 22px; }
  .stage-upload .app-icon.xl { width: 72px; height: 72px; border-radius: 18px; }
  .dropzone { padding: 32px 18px; }
  .megamenu-grid { grid-template-columns: 1fr 1fr; gap: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Page editor (Edit PDF, Forms, Sign, Redact) ---------- */
.workspace.is-editor .work-main { overflow: visible; padding-top: 0; min-width: 0; }
.workspace.is-editor .work-toolbar { position: sticky; top: var(--nav-h); z-index: 20; background: var(--bg); padding: 12px 0; margin: 0 0 8px; border-bottom: 1px solid var(--border); }
.file-grid.is-custom { display: block; }
.ed-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ed-tool { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; }
.ed-tool:hover { border-color: var(--accent); }
.ed-tool.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.ed-tool:disabled { opacity: .45; cursor: default; }
.ed-tool svg { width: 17px; height: 17px; }
.ed-sep { width: 1px; height: 26px; background: var(--border); margin: 0 4px; }
.pe-root { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 8px 0 40px; }
.pe-page { position: relative; background: #fff; box-shadow: var(--shadow); border-radius: 2px; flex: none; user-select: none; -webkit-user-select: none; }
.pe-canvas, .pe-canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.pe-layer { position: absolute; inset: 0; touch-action: none; cursor: crosshair; overflow: hidden; }
.pe-root[data-tool="select"] .pe-layer { cursor: default; }
.pe-root[data-tool="text"] .pe-layer { cursor: text; }
.pe-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.pe-svg g { pointer-events: visiblePainted; cursor: move; }
.pe-root:not([data-tool="select"]) .pe-svg g { cursor: inherit; }
.pe-text { position: absolute; white-space: pre; cursor: move; min-width: 4px; outline: none; padding: 0; margin: 0; }
.pe-text.is-editing { cursor: text; outline: 1.5px dashed var(--accent); outline-offset: 2px; user-select: text; -webkit-user-select: text; min-width: 1em; }
.pe-sel { position: absolute; border: 1.5px solid var(--accent); border-radius: 3px; pointer-events: none; }
.pe-handle { position: absolute; right: -7px; bottom: -7px; width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); pointer-events: all; cursor: nwse-resize; }
.pe-ftag { position: absolute; color: #0071e3; font: 600 11px/1 system-ui, sans-serif; pointer-events: none; white-space: nowrap; }
.pe-extra { position: absolute; inset: 0; pointer-events: none; }
.pe-extra > * { pointer-events: auto; }
.pe-num { position: absolute; left: 50%; bottom: -19px; transform: translateX(-50%); font-size: .75rem; color: var(--muted); }
/* Side panel controls */
.ed-panel { display: flex; flex-direction: column; gap: 14px; }
.ed-group { display: flex; flex-direction: column; gap: 6px; }
.ed-group > label, .ed-label { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.ed-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ed-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.ed-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; padding: 0; }
.ed-swatch.is-active { outline: 2px solid var(--accent); outline-offset: 2px; }
.ed-swatch.none { background: linear-gradient(135deg, #fff 45%, #ef4444 45%, #ef4444 55%, #fff 55%); }
.ed-panel select, .ed-panel input[type=number], .ed-panel input[type=text] { padding: 7px 9px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.ed-panel input[type=range] { flex: 1; }
.ed-toggle { min-width: 36px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.ed-toggle.is-active { background: var(--accent); color: #fff; border-color: transparent; }
.ed-hint { font-size: .85rem; color: var(--muted); margin: 0; }
/* Form inputs placed over pages */
.ff { color-scheme: light; position: absolute; box-sizing: border-box; margin: 0; border: 1px solid rgba(0,113,227,.55); background: rgba(219,234,254,.55); color: #111; font-family: Helvetica, Arial, sans-serif; padding: 0 3px; border-radius: 2px; }
.ff:focus { outline: 2px solid var(--accent); background: rgba(255,255,255,.95); }
textarea.ff { resize: none; padding: 2px 3px; line-height: 1.15; }
input.ff[type=checkbox], input.ff[type=radio] { accent-color: #0071e3; background: none; border: none; padding: 0; cursor: pointer; }
.ff[readonly], .ff:disabled { background: rgba(229,231,235,.6); }


/* ---------- Sign PDF ---------- */
.sg-side { display: flex; flex-direction: column; gap: 12px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.sg-card { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 64px; padding: 8px; border-radius: 10px; border: 1.5px dashed var(--border); background: #fff; color: #4b5563; cursor: pointer; font: inherit; font-weight: 600; }
.sg-card:hover { border-color: var(--accent); }
.sg-card img { max-width: 100%; max-height: 70px; }
.sg-card svg { width: 22px; height: 22px; }
.sg-back { position: fixed; inset: 0; background: rgba(15, 18, 32, .55); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.sg-modal { width: min(640px, 100%); max-height: 92vh; overflow: auto; background: var(--surface); color: var(--text); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.sg-head { display: flex; align-items: center; justify-content: space-between; }
.sg-head h3 { margin: 0; }
.sg-x { border: none; background: none; color: var(--muted); font-size: 1.2rem; cursor: pointer; }
.sg-pane { position: relative; display: flex; flex-direction: column; gap: 10px; }
.sg-canvas { width: 100%; height: 220px; background: #fff; border: 1px solid var(--border); border-radius: 12px; touch-action: none; cursor: crosshair; }
.sg-line { position: absolute; left: 24px; right: 24px; top: 160px; border-top: 1.5px solid #cbd5e1; pointer-events: none; }
.sg-line span { position: absolute; left: 0; top: 6px; font-size: .8rem; color: #94a3b8; }
.sg-line.is-used span { display: none; }
.sg-clear { position: absolute; right: 10px; top: 10px; }
.sg-name { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 1.05rem; }
.sg-fonts { display: grid; gap: 8px; }
.sg-font { background: #fff; border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 16px; text-align: left; cursor: pointer; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-font.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.sg-drop { display: flex; flex-direction: column; gap: 4px; align-items: center; padding: 26px; border: 1.5px dashed var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; }
.sg-preview { display: flex; justify-content: center; background: repeating-conic-gradient(#f1f5f9 0 25%, #fff 0 50%) 0 0 / 16px 16px; border-radius: 10px; min-height: 20px; }
.sg-preview canvas { max-width: 100%; max-height: 160px; }
.sg-ink { display: flex; align-items: center; gap: 8px; }
.sg-foot { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Redact PDF ---------- */
.rd-pats { display: flex; flex-wrap: wrap; gap: 6px; }
.rd-count { font-weight: 600; }

/* ---------- Compare PDF ---------- */
.cmp-grid { display: grid; gap: 18px 24px; justify-content: center; padding: 8px 0 40px; }
.cmp-head { position: sticky; top: calc(var(--nav-h) + 54px); z-index: 2; font-weight: 700; font-size: .9rem; padding: 6px 10px; border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 4px solid; }
.cmp-head.del { border-color: #dc2626; } .cmp-head.ins { border-color: #16a34a; }
.cmp-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cmp-page { position: relative; background: #fff; box-shadow: var(--shadow); border-radius: 2px; overflow: hidden; }
.cmp-page canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.cmp-marks { position: absolute; inset: 0; z-index: 1; }
.cmp-mark { position: absolute; mix-blend-mode: multiply; border-radius: 2px; }
.cmp-mark.del { background: rgba(239, 68, 68, .38); box-shadow: 0 0 0 1px rgba(220, 38, 38, .6); }
.cmp-mark.ins { background: rgba(34, 197, 94, .38); box-shadow: 0 0 0 1px rgba(22, 163, 74, .6); }
.cmp-mark.flash { animation: cmpflash 1.4s ease 2; }
@keyframes cmpflash { 50% { box-shadow: 0 0 0 4px #f59e0b; } }
.cmp-num { font-size: .75rem; color: var(--muted); }
.cmp-missing { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 1 / 1.41; border: 1.5px dashed var(--border); border-radius: 4px; color: var(--muted); }
.cmp-overlay { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0 40px; }
.cmp-legend { display: inline-flex; gap: 12px; font-size: .85rem; font-weight: 600; }
.cmp-legend span::before, .cmp-sum span::before { content: ''; display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.cmp-legend .del::before { background: #ef4444; } .cmp-legend .ins::before { background: #22c55e; }
.cmp-sum { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.cmp-sum strong { font-size: 1.1rem; }
.cmp-sum .del { color: #dc2626; } .cmp-sum .ins { color: #16a34a; }
.cmp-sum span.muted::before { display: none; }
.cmp-list { list-style: none; margin: 0 0 14px; padding: 0; max-height: 46vh; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.cmp-list li { padding: 8px 10px; border-radius: 10px; background: var(--surface-2); cursor: pointer; font-size: .86rem; display: flex; flex-direction: column; gap: 2px; border: 1.5px solid transparent; }
.cmp-list li:hover, .cmp-list li.is-active { border-color: var(--accent); }
.cmp-list .pg { font-size: .72rem; color: var(--muted); font-weight: 700; }
.cmp-list del { color: #b91c1c; background: rgba(239, 68, 68, .12); text-decoration: line-through; border-radius: 4px; padding: 0 3px; }
.cmp-list ins { color: #15803d; background: rgba(34, 197, 94, .14); text-decoration: none; border-radius: 4px; padding: 0 3px; }
.cmp-need, .cmp-wait { text-align: center; padding: 60px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* ---------- Result extras (AI summary) ---------- */
.done-extra { width: min(760px, 100%); margin: 8px auto 18px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.summary-box { width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px; box-shadow: var(--shadow); line-height: 1.6; }
.summary-box h3 { font-size: 1.15rem; margin: 0 0 6px; }
.summary-box h4 { font-size: 1rem; margin: 16px 0 6px; }
.summary-box ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.summary-box p { margin: 0 0 6px; color: var(--muted); }
.pe-segs { position: absolute; inset: 0; pointer-events: none; display: none; }
.pe-root[data-tool="edittext"] .pe-segs { display: block; }
.pe-root[data-tool="edittext"] .pe-layer { cursor: text; }
.pe-seg { position: absolute; border: 1px dashed rgba(0, 113, 227, .55); background: rgba(0, 113, 227, .06); border-radius: 2px; }

/* ---------- Editor refinements (toolbar, inspector, dialogs) ---------- */
.workspace.is-editor .work-toolbar { background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom-color: var(--hairline); margin-left: -28px; margin-right: -28px; padding-left: 28px; padding-right: 28px; }
.ed-tools { gap: 4px; background: var(--surface); padding: 4px; border-radius: 12px; box-shadow: var(--shadow); }
.ed-tool { border: none; background: none; border-radius: 9px; padding: 7px 11px; font-weight: 500; font-size: .85rem; transition: background .15s; }
.ed-tool:hover { background: var(--fill); }
.ed-tool.is-active, .ed-tool.is-active:hover { background: var(--accent); color: #fff; }
.ed-sep { height: 22px; background: var(--hairline); }
.ed-group > label, .ed-label { font-size: .8rem; font-weight: 600; text-transform: none; letter-spacing: -.005em; }
.ed-panel select, .ed-panel input[type=number], .ed-panel input[type=text] { border: none; background: var(--fill); border-radius: 9px; }
.ed-toggle { border: none; background: var(--fill); border-radius: 8px; font-weight: 600; }
.ed-toggle.is-active { background: var(--accent); }
.ed-swatch { border: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); width: 28px; height: 28px; }
.ed-swatch.is-active { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.pe-page { box-shadow: 0 2px 10px rgba(0, 0, 0, .1), 0 0 0 .5px rgba(0, 0, 0, .06); }
.sg-card { border-radius: 14px; border-width: 1.5px; }
.sg-back { background: rgba(0, 0, 0, .35); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .18s; }
.sg-modal { border-radius: 22px; padding: 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); animation: pop .22s var(--ease); }
.sg-name { border: none; background: var(--fill); }
.sg-x { width: 30px; height: 30px; border-radius: 50%; background: var(--fill); font-size: 1rem; }
.cmp-head { border-radius: 10px; }
.cmp-list li { border-radius: 12px; }
.summary-box { border: none; border-radius: var(--radius); padding: 22px 26px; }
.hero h1 .grad { display: block; }
/* A blurred parent breaks the menu panel's own background, so drop the nav blur while the menu is open. */
.nav:has(.megamenu[open]) { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface); }
.megamenu-panel { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface); }

/* ---------- Ads ---------- */
.ad { display: flex; flex-direction: column; align-items: center; margin: 28px auto; width: 100%; max-width: 100%; overflow: hidden; }
.ad::before { content: "Advertisement"; font-size: .68rem; letter-spacing: .02em; color: var(--muted); opacity: .8; margin-bottom: 6px; }
.ad:not(.is-filled)::before { visibility: hidden; }
.ad-leader { min-height: 76px; }
.ad-rect { min-height: 272px; }
.ad-native { min-height: 120px; }
.ad-native iframe { background: #fff; border-radius: 14px; }
.ad-home { margin: 38px auto 6px; }
.ad-under-upload { margin-top: 40px; }
.ad-side { margin: 0 auto; flex: none; }
.ad-busy, .ad-done { margin-top: 36px; }
.ad-wide { margin-top: 48px; }
.ad-test { display: grid; place-items: center; background: repeating-linear-gradient(45deg, var(--fill), var(--fill) 10px, transparent 10px, transparent 20px); border: 1px dashed var(--border); border-radius: 8px; color: var(--muted); font-size: .8rem; font-weight: 600; }
.ad-rail { position: fixed; top: calc(var(--nav-h) + 24px); width: 160px; z-index: 5; display: none; }
.ad-rail .ad { margin: 0; }
.ad-rail-left { left: max(12px, calc((100vw - 1120px) / 2 - 184px)); }
.ad-rail-right { right: max(12px, calc((100vw - 1120px) / 2 - 184px)); }
@media (min-width: 1500px) { .ad-rail { display: block; } }
body[data-view="work"] .ad-rail { display: none; }
@media (max-width: 900px) { .work-side .ad-side { margin-bottom: 8px; } }
