/* Aadhaar Cutter, design v2 "cutting mat"
   Idea: a craft-shop cutting table. Cream paper, warm black ink, a green self-healing mat for the sheet,
   saffron for the main action, chunky outlines with hard offset shadows, dashed cut lines.
   (The earlier violet design is kept in css/style-v1-purple.css and is not linked.) */
:root {
  --ink: #1F1B16;
  --ink-2: #5A5144;
  --page: #FFF4DD;
  --paper: #FFFFFF;
  --card: #FFFDF8;
  --soft: #FFF9EC;
  --line: #E6D6B4;
  --line-2: #F0E4C8;
  --sun: #FFB020;
  --sun-d: #F59E0B;
  --stamp: #C2410C;
  --stamp-d: #9A3412;
  --stamp-tint: #FFE9C2;
  --mat: #2F7A5C;
  --mat-d: #276549;
  --err: #B3261E;
  --ok: #1D7A4B;
  --radius: 14px;
  --shadow: 4px 4px 0 var(--ink);
  --shadow-s: 2px 2px 0 var(--ink);
  --font: "Figtree", "Segoe UI", system-ui, -apple-system, "Noto Sans", Roboto, Arial, sans-serif;
  --font-h: "Bricolage Grotesque", "Figtree", "Segoe UI", system-ui, -apple-system, "Noto Sans", Roboto, Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font-family: var(--font); font-size: 1rem; line-height: 1.55;
  background-image: radial-gradient(rgba(31,27,22,.09) 1px, transparent 1.4px); background-size: 22px 22px;
}
img, svg, canvas { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.12; letter-spacing: -0.02em; font-family: var(--font-h); }
p { margin: 0; }
a { color: var(--stamp); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a:hover { color: var(--stamp-d); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 12px; }
.muted { color: var(--ink-2); }
.small { font-size: 0.875rem; }

/* header: a strip with pill links */
.top { max-width: 2000px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-mark { flex: none; filter: drop-shadow(2px 2px 0 var(--ink)); }
.brand-name { white-space: nowrap; font-family: var(--font-h); font-weight: 800; font-size: 1.4rem; letter-spacing: -0.03em; }
.top-nav { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.top-nav a { white-space: nowrap; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .9375rem; padding: 6px 14px; border: 2px solid transparent; border-radius: 999px; }
.top-nav a:hover { border-color: var(--ink); background: var(--paper); }
.top-nav a[aria-current="page"] { border-color: var(--ink); background: var(--sun); box-shadow: var(--shadow-s); }

/* intro: a coupon with a dashed cut line and scissors */
.intro {
  position: relative; width: calc(100% - 48px); max-width: 1952px; margin: 10px auto 24px; padding: 22px 28px 20px;
  background: var(--stamp-tint); border: 2.5px dashed var(--ink); border-radius: 18px;
}
.intro::before {
  content: ""; position: absolute; left: 26px; top: -15px; width: 38px; height: 28px; background: var(--page) center / 26px 22px no-repeat;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 22' fill='none' stroke='%231F1B16' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='5' cy='5' r='3.2'/%3E%3Ccircle cx='5' cy='17' r='3.2'/%3E%3Cpath d='M7.6 6.8 24 17M7.6 15.2 24 5'/%3E%3C/svg%3E");
}
.intro h1 { font-size: clamp(1.7rem, 1.1rem + 1.8vw, 2.5rem); font-weight: 800; max-width: 32ch; letter-spacing: -0.035em; }
.intro p { margin-top: 10px; max-width: 78ch; color: var(--ink); font-size: 1.0625rem; }

/* workbench */
.bench {
  max-width: 2000px; margin: 0 auto; padding: 0 24px 56px;
  --lw: 360px; --rw: 340px;
  display: grid; grid-template-columns: var(--lw) minmax(0, 1fr) var(--rw); gap: 26px; align-items: start;
}
.controls { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.panel { background: var(--card); border: 2.5px solid var(--ink); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.panel h2 { font-size: 1.25rem; font-weight: 800; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.status:empty { display: none; }
.status { margin-top: 10px; font-size: 0.9375rem; color: var(--ink-2); }
.status.is-err { color: var(--err); }

/* buttons */
.btn {
  font: inherit; font-weight: 700; font-size: 0.9375rem; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  background: var(--paper); color: var(--ink); border: 2px solid var(--ink); box-shadow: var(--shadow-s);
  transition: transform .1s, box-shadow .1s, background .12s;
}
.btn:hover:not(:disabled) { background: var(--stamp-tint); transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.btn-primary { background: var(--sun); color: var(--ink); }
.btn-primary:hover:not(:disabled) { background: var(--sun-d); }
.btn-lg { min-height: 50px; padding: 0 24px; font-size: 1rem; box-shadow: var(--shadow); }
.btn-sm { min-height: 36px; padding: 0 13px; font-size: 0.875rem; }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; padding: 0;
  background: transparent; border: 2px solid transparent; border-radius: 10px; color: var(--ink); cursor: pointer; font: inherit; font-size: 1.25rem; line-height: 1;
}
.icon-btn:hover:not(:disabled) { background: var(--sun); border-color: var(--ink); color: var(--ink); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* card list */
.cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.card-item { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 12px; padding: 10px; border: 2px solid var(--line); border-radius: 12px; background: var(--soft); }
.thumb {
  position: relative; width: 104px; aspect-ratio: 1.586; background: #fff; border: 2px solid var(--ink);
  display: grid; place-items: center; overflow: hidden; border-radius: 7px;
}
.thumb canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb.loading::after { content: ""; width: 18px; height: 18px; border: 3px solid var(--line); border-top-color: var(--stamp); border-radius: 50%; animation: spin .8s linear infinite; }
.card-meta { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.card-meta input[type=text] {
  font: inherit; font-weight: 700; width: 100%; min-height: 34px; padding: 4px 8px; color: var(--ink);
  border: 2px solid transparent; border-radius: 8px; background: transparent;
}
.card-meta input[type=text]:hover { border-color: var(--line); background: #fff; }
.card-meta input[type=text]:focus { border-color: var(--ink); background: #fff; outline: none; box-shadow: 0 0 0 3px var(--sun); }
.card-tools { display: flex; flex-wrap: wrap; gap: 2px; margin-left: -4px; }
.card-note { font-size: 0.8125rem; color: var(--err); padding: 0 8px; }

/* page setup */
.field { border: 0; padding: 0; margin: 18px 0 0; min-width: 0; }
.field legend { font-weight: 700; font-size: 0.9375rem; padding: 0; margin-bottom: 8px; }
.field-note { font-size: 0.875rem; color: var(--ink-2); margin-top: 7px; }
.seg { display: flex; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; background: var(--paper); }
.seg label { flex: 1 1 0; display: block; position: relative; }
.seg label + label { border-left: 2px solid var(--ink); }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: grid; place-items: center; min-height: 40px; padding: 4px 8px; text-align: center; font-size: 0.875rem; font-weight: 700; line-height: 1.15; }
.seg input:checked + span { background: var(--sun); color: var(--ink); }
.seg input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: -5px; }
.seg label:hover input:not(:checked) + span { background: var(--stamp-tint); }
.pair { display: flex; gap: 18px; flex-wrap: wrap; }
.inline { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9375rem; font-weight: 600; margin-top: 8px; }
.pair .inline { margin-top: 0; }
input[type=number] {
  font: inherit; font-weight: 600; width: 78px; min-height: 38px; padding: 4px 8px; border: 2px solid var(--ink); border-radius: 10px; color: var(--ink); background: #fff;
}
input[type=number]:focus { outline: none; box-shadow: 0 0 0 3px var(--sun); }
.check { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 0.9375rem; font-weight: 500; cursor: pointer; }
.check input { width: 19px; height: 19px; accent-color: var(--stamp); margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions .btn-lg { flex: 1 1 100%; }
.actions .btn:not(.btn-lg) { flex: 1 1 0; }

/* sheet: paper on a green cutting mat */
.sheet-col { min-width: 0; }
.desk {
  border-radius: 20px; padding: 40px 24px 22px; display: flex; flex-direction: column; align-items: center; gap: 14px;
  background-color: var(--mat);
  background-image:
    linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.14) 1px, transparent 1px);
  background-size: 20px 20px, 20px 20px, 100px 100px, 100px 100px;
  border: 2.5px solid var(--ink); box-shadow: var(--shadow);
}
.pager { display: flex; align-items: center; gap: 10px; background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; padding: 2px 8px; font-weight: 700; font-size: 0.9375rem; }
.paper-wrap { position: relative; width: var(--paper-w, 560px); max-width: 100%; }
.paper-wrap::before {
  content: ""; position: absolute; inset: -20px; pointer-events: none; z-index: 1;
  background:
    linear-gradient(#fff, #fff) 0 13px / 15px 2px no-repeat,
    linear-gradient(#fff, #fff) 13px 0 / 2px 15px no-repeat,
    linear-gradient(#fff, #fff) 100% 13px / 15px 2px no-repeat,
    linear-gradient(#fff, #fff) calc(100% - 13px) 0 / 2px 15px no-repeat,
    linear-gradient(#fff, #fff) 0 calc(100% - 13px) / 15px 2px no-repeat,
    linear-gradient(#fff, #fff) 13px 100% / 2px 15px no-repeat,
    linear-gradient(#fff, #fff) 100% calc(100% - 13px) / 15px 2px no-repeat,
    linear-gradient(#fff, #fff) calc(100% - 13px) 100% / 2px 15px no-repeat;
}
#sheet { display: block; width: 100%; height: auto; aspect-ratio: 210 / 297; background: #fff; box-shadow: 0 0 0 2px var(--ink), 6px 8px 0 rgba(0,0,0,.35); }
.drop-hint {
  position: absolute; left: 8%; right: 8%; top: 41%; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--stamp-tint); padding: 20px 16px; border: 2.5px dashed var(--ink); border-radius: 16px;
}
.drop-title { font-family: var(--font-h); font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.drop-sub { color: var(--ink); font-size: 0.9375rem; }
.drop-hint .btn { margin-top: 6px; }
.drop-priv { font-size: 0.8125rem; color: var(--ink-2); }
.paper-wrap.is-over #sheet { outline: 4px dashed var(--sun); outline-offset: 6px; }
.busy {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(255,249,236,.88); font-weight: 700; text-align: center; padding: 20px; z-index: 2;
}
.spinner { width: 32px; height: 32px; border: 4px solid var(--line); border-top-color: var(--stamp); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.caption { font-size: 0.875rem; font-weight: 500; color: var(--ink); background: var(--soft); border: 2px solid var(--ink); padding: 3px 14px; border-radius: 999px; }

/* info sections */
.info { max-width: 900px; margin: 0 auto; padding: 40px 24px; border-top: 2.5px dashed var(--ink); }
.info h2 { display: inline-block; font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.1rem); font-weight: 800; margin-bottom: 22px; background: linear-gradient(transparent 62%, var(--sun) 62% 92%, transparent 92%); padding: 0 4px; margin-left: -4px; }
.spec { width: 100%; border-collapse: collapse; background: var(--card); border: 2.5px solid var(--ink); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.spec th, .spec td { text-align: left; vertical-align: top; padding: 14px 16px; border-bottom: 1.5px solid var(--line); }
.spec tbody tr:last-child th, .spec tbody tr:last-child td { border-bottom: 0; }
.spec thead th { font-size: 0.8125rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); font-weight: 800; background: var(--sun); border-bottom: 2.5px solid var(--ink); }
.spec tbody th { width: 34%; font-weight: 800; }
.spec td { color: var(--ink-2); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: s; }
.steps li { counter-increment: s; padding: 18px 18px 20px; background: var(--card); border: 2.5px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow); }
.steps li:nth-child(2) { background: var(--stamp-tint); }
.steps li::before { content: counter(s); display: inline-grid; place-items: center; width: 34px; height: 34px; margin-bottom: 12px; background: var(--sun); border: 2px solid var(--ink); color: var(--ink); font-family: var(--font-h); font-weight: 800; font-size: 1.05rem; border-radius: 50%; }
.steps h3 { font-size: 1.125rem; font-weight: 800; margin-bottom: 6px; }
.steps p { color: var(--ink-2); font-size: 0.9375rem; }
details { background: var(--card); border: 2px solid var(--ink); border-radius: 12px; margin-bottom: 10px; padding: 0 16px; }
details[open] { box-shadow: var(--shadow-s); background: var(--paper); }
summary { cursor: pointer; padding: 15px 30px 15px 0; font-weight: 700; list-style: none; position: relative; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; display: grid; place-items: center; background: var(--sun); border: 2px solid var(--ink); border-radius: 50%; font-size: 1.1rem; font-weight: 800; line-height: 1; }
details[open] summary::after { content: "\2212"; }
details p { padding: 0 0 16px; color: var(--ink-2); max-width: 66ch; }
.foot { max-width: 900px; margin: 0 auto; padding: 28px 24px 44px; border-top: 2.5px dashed var(--ink); color: var(--ink-2); font-size: 0.9375rem; display: flex; flex-direction: column; gap: 12px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px; }
.foot nav a { color: var(--ink); font-weight: 600; text-decoration: none; padding: 4px 12px; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); }
.foot nav a:hover { background: var(--sun); }
.copy { font-size: 0.875rem; }

/* prose pages */
.prose { max-width: 70ch; margin: 0 auto; padding: 24px 24px 60px; }
.prose h1 { font-size: clamp(1.8rem, 1.2rem + 2.2vw, 2.6rem); font-weight: 800; margin-bottom: 16px; }
.prose h2 { font-size: 1.35rem; margin: 30px 0 8px; font-weight: 800; }
.prose p, .prose li { color: var(--ink-2); }
.prose p { margin: 0 0 12px; }
.prose ul { padding-left: 20px; margin: 0 0 12px; }

/* dialogs */
.dlg { border: 2.5px solid var(--ink); border-radius: 18px; padding: 22px; width: min(440px, calc(100vw - 28px)); color: var(--ink); background: var(--card); box-shadow: 7px 7px 0 var(--ink); }
.dlg::backdrop { background: rgba(31,27,22,.6); }
.dlg h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 6px; }
.dlg .stack { display: flex; flex-direction: column; gap: 6px; font-weight: 700; margin: 14px 0 8px; }
.dlg input[type=password] { font: inherit; min-height: 44px; padding: 6px 12px; border: 2px solid var(--ink); border-radius: 10px; letter-spacing: .08em; }
.dlg input[type=password]:focus { outline: none; box-shadow: 0 0 0 3px var(--sun); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.err { color: var(--err); font-weight: 700; font-size: 0.9375rem; margin-bottom: 8px; }
.dlg-wide { width: min(960px, calc(100vw - 24px)); max-height: calc(100dvh - 16px); overflow: auto; }
.dlg-wide .dlg-actions { position: sticky; bottom: -22px; background: var(--card); padding: 12px 0 2px; margin-top: 12px; border-top: 2px dashed var(--line); }
.ed-head { margin-bottom: 12px; }
.ed-body { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; align-items: start; }
.ed-main { justify-self: center; min-width: 0; max-width: 100%; display: flex; flex-direction: column; gap: 8px; }
.ed-stage { position: relative; align-self: center; line-height: 0; background: #222; user-select: none; -webkit-user-select: none; }
.ed-scroll { position: absolute; inset: 0; padding: 22px; box-sizing: border-box; overflow: auto; touch-action: pan-x pan-y; scrollbar-width: thin; overscroll-behavior: contain; }
.ed-inner { position: relative; line-height: 0; }
.ed-zoom { grid-template-columns: 48px 1fr 44px; }
.ed-stage canvas { display: block; }
#edSvg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#edShade { fill: rgba(31,27,22,.5); }
#edCurve { fill: none; stroke: #fff; stroke-width: 2; vector-effect: non-scaling-stroke; }
#edPoly { fill: none; stroke: #fff; stroke-width: 2; vector-effect: non-scaling-stroke; }
.handle {
  position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border: 0; background: transparent; padding: 0; cursor: grab; touch-action: none;
}
.handle::before { content: ""; position: absolute; left: 11px; top: 11px; width: 22px; height: 22px; border-radius: 50%; background: var(--sun); border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--ink), 0 1px 4px rgba(0,0,0,.5); }
.handle:active { cursor: grabbing; }
/* while dragging: see-through ring with a tiny centre dot, so the card corner underneath stays visible */
.handle.is-drag, .handle.is-drag:active { cursor: none; }
.handle.is-drag::before { background: transparent; border: 0; box-shadow: none; }
.handle.is-drag::after { content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--sun); box-shadow: 0 0 0 1px #fff; }
.handle:focus-visible { outline: none; }
.handle:focus-visible::before { outline: 3px solid #fff; outline-offset: 2px; background: var(--sun-d); }
.ed-side { display: flex; flex-direction: column; gap: 10px; }
#edPreview { width: 100%; height: auto; border: 2px solid var(--ink); border-radius: 8px; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 14px 14px; }
.ed-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.label-line { font-weight: 700; }

/* toasts, drag veil */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; width: min(520px, calc(100vw - 24px)); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 0.9375rem; font-weight: 500; border: 2px solid #fff; box-shadow: 4px 4px 0 rgba(0,0,0,.35); pointer-events: auto; }
.toast.is-err { background: var(--err); }
.drag-veil { position: fixed; inset: 0; z-index: 50; background: rgba(255,176,32,.22); border: 5px dashed var(--ink); display: grid; place-items: center; pointer-events: none; }
.drag-veil p { background: var(--sun); color: var(--ink); border: 2.5px solid var(--ink); box-shadow: var(--shadow); font-family: var(--font-h); font-weight: 800; font-size: 1.5rem; padding: 12px 28px; border-radius: 999px; }

/* responsive */
@media (max-width: 960px) {
  .bench { grid-template-columns: 1fr; gap: 24px; padding-bottom: 100px; }
  .sheet-col { position: static; order: -1; }
  .desk { padding: 32px 14px 18px; }
  .steps { grid-template-columns: 1fr; }
  .ed-body { grid-template-columns: 1fr; }
  .actions {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: var(--page); border-top: 2.5px solid var(--ink); flex-wrap: nowrap; gap: 8px;
  }
  .actions .btn-lg { flex: 2 1 0; min-height: 46px; padding: 0 12px; font-size: 0.9375rem; box-shadow: var(--shadow-s); }
  .actions .btn:not(.btn-lg) { flex: 1 1 0; min-height: 46px; padding: 0 6px; font-size: 0.875rem; white-space: nowrap; }
  .actions #dlPng { flex-grow: 1.5; }
  #edPreview { max-width: 280px; }
  .toasts { bottom: 88px; }
}
@media (max-width: 560px) {
  .top { padding: 10px 16px; flex-wrap: wrap; row-gap: 4px; }
  .top-nav { gap: 2px; }
  .top-nav a { padding: 5px 10px; font-size: 0.875rem; }
  .top-nav a:first-child { display: none; }
  .intro { width: calc(100% - 32px); padding: 22px 18px 18px; }
  .bench, .info, .foot { padding-left: 16px; padding-right: 16px; }
  .spec thead { display: none; }
  .spec tr, .spec th, .spec td { display: block; width: 100% !important; }
  .spec tbody th { padding: 14px 16px 2px; border: 0; }
  .spec td { padding: 0 16px 14px; }
  .drop-hint { left: 4%; right: 4%; top: 36%; padding: 12px 10px; }
  .drop-title { font-size: 1.2rem; }
  .card-item { grid-template-columns: 88px minmax(0, 1fr); }
  .thumb { width: 88px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .spinner, .thumb.loading::after { animation-duration: 2.4s; }
  .btn { transition: none; }
}

/* ---------- sliders, brightness, border ---------- */
.legend-sub { font-weight: 400; color: var(--ink-2); font-size: 0.875rem; }
.legend-sub::before { content: "\2014\00a0"; }
.field-note.flush { margin: 0 0 6px; }
.field-note strong { color: var(--ink); }
.slider { display: grid; grid-template-columns: 64px 1fr 56px; align-items: center; gap: 10px; min-height: 36px; font-size: 0.9375rem; font-weight: 600; }
.slider output { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 0.875rem; font-weight: 600; }
.slider-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; margin: 0; cursor: pointer; accent-color: var(--stamp); }
input[type=range]::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: var(--line); border: 1.5px solid var(--ink); }
input[type=range]::-moz-range-track { height: 5px; border-radius: 4px; background: var(--line); border: 1.5px solid var(--ink); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--sun); border: 2.5px solid var(--ink); box-shadow: 1px 1px 0 var(--ink); margin-top: -8px; }
input[type=range]::-moz-range-thumb { width: 17px; height: 17px; border-radius: 50%; background: var(--sun); border: 2.5px solid var(--ink); box-shadow: 1px 1px 0 var(--ink); }
input[type=range]:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 6px; }
input[type=range]:disabled { opacity: .4; cursor: not-allowed; }
input[type=color] { width: 44px; height: 34px; padding: 2px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; cursor: pointer; }
input[type=color]:disabled { opacity: .4; cursor: not-allowed; }
.slider.is-off { opacity: .55; }
.legend-check { width: 100%; }
.legend-check .check { padding: 0; font-weight: 700; }
.bright-list { display: block; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.btn-sm { min-height: 38px; padding: 6px 14px; font-size: 0.875rem; }

.guide-opts { margin-top: 10px; padding: 10px 14px 12px; border: 2px dashed var(--line); border-radius: 12px; background: var(--soft); }
.guide-opts[hidden] { display: none; }
.guide-opts .check { padding: 2px 0; }

/* ---------- zoom ---------- */
.desk { position: relative; overflow: hidden; }
.paper-wrap { transform-origin: 0 0; }
.paper-wrap.is-zoomed { cursor: grab; touch-action: none; }
.paper-wrap.is-panning { cursor: grabbing; }
.pager, .caption { position: relative; z-index: 5; }
.zoombar {
  position: absolute; top: 10px; right: 10px; z-index: 6; display: flex; align-items: center; gap: 2px;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; padding: 2px 4px; box-shadow: var(--shadow-s);
}
.zoombar .icon-btn { width: 32px; height: 32px; font-size: 1.25rem; line-height: 1; font-weight: 700; border-radius: 50%; }
.zoom-val { font: inherit; font-size: 0.8125rem; font-weight: 800; min-width: 52px; height: 32px; border: 0; background: transparent; color: var(--ink); cursor: pointer; border-radius: 999px; font-variant-numeric: tabular-nums; }
.zoom-val:hover { background: var(--sun); }
.zoom-hint { font-size: 0.75rem; color: var(--ink-2); padding: 0 8px 0 6px; white-space: nowrap; }
.zoom-hint[hidden] { display: none; }
@media (max-width: 560px) { .zoom-hint { display: none; } }

/* ---------- two sidebars, each can collapse ---------- */
.bench.l-off { --lw: 48px; }
.bench.r-off { --rw: 48px; }
.side { position: sticky; top: 12px; max-height: calc(100vh - 24px); display: flex; flex-direction: column; min-width: 0; }
.side-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; min-height: 34px; }
.side-right .side-head { justify-content: space-between; }
.side-title { font-family: var(--font-h); font-size: 0.875rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); white-space: nowrap; }
.side-toggle {
  flex: none; width: 34px; height: 34px; display: grid; place-items: center; padding: 0; cursor: pointer;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 50%; color: var(--ink); box-shadow: var(--shadow-s);
}
.side-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.side-toggle:hover { background: var(--sun); }
.side-toggle:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.side-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; padding: 0 7px 7px 0; scrollbar-width: thin; }
.side-right .side-body { padding: 0 0 7px 0; margin-right: 7px; }
.side.is-collapsed .side-body { display: none; }
.side.is-collapsed .side-toggle svg { transform: scaleX(-1); }
@media (min-width: 961px) {
  .side.is-collapsed .side-head { flex-direction: column; align-items: center; justify-content: flex-start; gap: 14px; }
  .side.is-collapsed .side-title { writing-mode: vertical-rl; }
  .side.is-collapsed .side-toggle { order: -1; }
  .side-right.is-collapsed .side-head { flex-direction: column; }
  .sheet-col .actions {
    position: static; margin-bottom: 16px; flex-wrap: nowrap; gap: 10px;
    background: var(--card); border: 2.5px solid var(--ink); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow);
  }
  .sheet-col .actions .btn-lg { flex: 2 1 0; min-height: 46px; font-size: 0.9375rem; padding: 0 14px; box-shadow: var(--shadow-s); }
  .sheet-col .actions .btn:not(.btn-lg) { flex: 1 1 0; min-height: 46px; }
}
@media (max-width: 960px) {
  .side { position: static; max-height: none; }
  .side-body { overflow: visible; }
  .side-right .side-body { margin-right: 0; padding-right: 7px; }
  .side-left { order: 1; } .side-right { order: 2; }
  .side.is-collapsed .side-head { flex-direction: row; }
  .side-right .side-head { justify-content: space-between; }
}

/* ---------- batch brightness rows ---------- */
.bright-list .slider { grid-template-columns: minmax(70px, 118px) 1fr 44px; gap: 8px; }
.bright-list .slider.master { font-weight: 800; padding-bottom: 8px; margin-bottom: 6px; border-bottom: 2px dashed var(--line); }
.bright-list .slider:hover, .bright-list .slider:focus-within { background: var(--stamp-tint); border-radius: 8px; }
.card-item:hover { border-color: var(--ink); }

/* ---------- buttons over the hovered card on the sheet ---------- */
.sheet-tools {
  position: absolute; z-index: 8; display: flex; gap: 2px; padding: 4px; border-radius: 999px;
  background: var(--ink); border: 2px solid #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .35); animation: tools-in .12s ease-out;
}
.sheet-tools[hidden] { display: none; }
@keyframes tools-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.sheet-tools .icon-btn { width: 30px; height: 30px; border: 0; border-radius: 50%; color: #fff; background: transparent; }
.sheet-tools .icon-btn svg { width: 18px; height: 18px; stroke-width: 2; }
.sheet-tools .icon-btn:hover:not(:disabled) { background: var(--sun); color: var(--ink); border: 0; }
.sheet-tools .icon-btn:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.sheet-tools .icon-btn:disabled { opacity: .35; }
.sheet-tools .icon-btn[data-act=del]:hover:not(:disabled) { background: rgba(220, 38, 38, .95); color: #fff; }
@media (hover: none) { .sheet-tools .icon-btn { width: 38px; height: 38px; } }
@media (prefers-reduced-motion: reduce) { .sheet-tools { animation: none; } }

/* ---------- magnifier in the corner editor ---------- */
.ed-stage .ed-loupe {
  position: absolute; z-index: 6; border-radius: 50%; border: 3px solid #fff; background: #222; pointer-events: none;
  box-shadow: 0 0 0 2px var(--ink), 0 2px 12px rgba(0, 0, 0, .5); box-sizing: border-box;
}
.ed-stage .ed-loupe[hidden] { display: none; }

.panel-head-sub { margin-bottom: 4px; }
.panel-head .btn-sm { flex: none; }

/* ---------- remove-all button next to Download / Print ---------- */
.actions .btn.btn-reset:not(.btn-lg), .sheet-col .actions .btn.btn-reset:not(.btn-lg) { flex: 0 0 auto; min-width: 116px; padding-left: 14px; padding-right: 14px; }
.actions .btn-reset:hover:not(:disabled) { border-color: var(--err); color: var(--err); background: #fff; }
.actions .btn-reset.is-armed, .actions .btn-reset.is-armed:hover:not(:disabled) { background: var(--err); border-color: var(--ink); color: #fff; }

/* ---------- corner editor: full screen ---------- */
.ed-titlebar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ed-titlebar h2 { margin-bottom: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ed-titlebar .btn { flex: none; }
.ed-head .muted { margin-top: 6px; }
.dlg-wide.is-full { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; box-shadow: none; padding: 14px; background: var(--page); }
/* wide screens: picture area on the left filling the height; preview, controls and Cancel / Apply stacked in a column on the right */
@media (min-width: 961px) {
  .dlg-wide.is-full { overflow: hidden; }
  .dlg-wide.is-full[open] {
    display: grid; grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "main head" "main side" "main actions"; column-gap: 16px;
  }
  .dlg-wide.is-full .ed-body { display: contents; }
  .dlg-wide.is-full .ed-head { grid-area: head; margin-bottom: 10px; }
  .dlg-wide.is-full .ed-main {
    grid-area: main; min-height: 0; justify-self: stretch; align-self: stretch; padding: 10px; gap: 8px; overflow: hidden;
    background: #1e1b17; border: 2.5px solid var(--ink); border-radius: 16px; justify-content: space-between;
  }
  .dlg-wide.is-full .ed-stage { margin: auto; }
  .dlg-wide.is-full .ed-zoom { flex: none; background: var(--paper); border-radius: 999px; padding: 0 16px; }
  .dlg-wide.is-full .ed-side { grid-area: side; min-height: 0; overflow: auto; }
  .dlg-wide.is-full .dlg-actions { grid-area: actions; position: static; margin-top: 10px; padding: 12px 0 0; justify-content: flex-end; background: transparent; }
}
@media (max-width: 960px) {
  .dlg-wide.is-full { overflow: auto; }
  .dlg-wide.is-full .dlg-actions { position: sticky; bottom: -14px; background: var(--page); }
}

/* ---------- fine-tune pad (shown when a corner handle is selected) ---------- */
.handle.is-sel:not(.is-drag)::before { box-shadow: 0 0 0 1.5px var(--ink), 0 0 0 6px rgba(255, 176, 32, .55), 0 1px 4px rgba(0,0,0,.5); }
.ed-pad { margin-top: 4px; padding: 8px 12px 10px; border: 2px solid var(--ink); border-radius: 14px; background: var(--paper); box-shadow: var(--shadow-s); }
.ed-pad[hidden] { display: none; }
.dpad { display: grid; grid-template-columns: repeat(3, 46px); grid-template-rows: repeat(3, 46px); gap: 2px; justify-content: center; margin: 6px 0 8px; }
.dp { display: grid; place-items: center; padding: 0; border: 0; border-radius: 12px; background: transparent; cursor: pointer; touch-action: none; -webkit-tap-highlight-color: transparent; }
.dp svg { width: 30px; height: 30px; fill: var(--sun); stroke: var(--ink); stroke-width: 2.2; stroke-linejoin: round; filter: drop-shadow(1.5px 2px 0 rgba(31,27,22,.4)); transition: transform .08s; }
.dp:hover svg { fill: var(--sun-d); }
.dp:active svg, .dp.is-down svg { transform: scale(.88); }
.dp:focus-visible { outline: 3px solid var(--ink); }
.dp-up { grid-column: 2; grid-row: 1; } .dp-left { grid-column: 1; grid-row: 2; } .dp-right { grid-column: 3; grid-row: 2; } .dp-down { grid-column: 2; grid-row: 3; }
.dp-ok { grid-column: 2; grid-row: 2; border: 2.5px solid var(--ink); border-radius: 50%; background: var(--sun); color: var(--ink); font: inherit; font-weight: 800; font-size: 1rem; cursor: pointer; box-shadow: var(--shadow-s); }
.dp-ok:hover { background: var(--sun-d); }
.dp-ok:active { transform: translate(1px, 1px); box-shadow: none; }
.dp-ok:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
@media (min-width: 961px) {
  .dlg-wide.is-full #edPreview { width: 100%; height: 17vh; min-height: 90px; object-fit: contain; object-position: center; background: #f1f3f7; }
  .dlg-wide.is-full #edHint { font-size: .78rem; line-height: 1.4; }
  .dlg-wide.is-full .ed-side { gap: 8px; }
}

/* quality chips under the heading */
.quality-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.quality-chips li { padding: 5px 13px; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); color: var(--ink); font-size: .875rem; font-weight: 700; }
.quality-chips li::before { content: "\2713"; margin-right: 6px; color: var(--ok); font-weight: 800; }
.quality-chips .chip-hd { background: var(--ink); border-color: var(--ink); color: var(--sun); font-weight: 800; letter-spacing: .08em; }
.quality-chips .chip-hd::before { content: none; }

/* ---------- password remover page ---------- */
.pwr { max-width: 860px; margin: 0 auto; padding: 0 0 40px; }
.pwr .intro { margin-top: 14px; }
.pwr-card { margin: 0 24px; padding: 22px; background: var(--card); border: 2.5px solid var(--ink); border-radius: 18px; box-shadow: 6px 6px 0 var(--ink); display: flex; flex-direction: column; gap: 20px; }
.pwr-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 32px 16px; border: 2.5px dashed var(--ink); border-radius: 16px; background: var(--stamp-tint); color: var(--ink-2); text-align: center; cursor: pointer; transition: background .15s; }
.pwr-drop:hover, .pwr-drop.is-over { background: var(--sun); color: var(--ink); }
.pwr-drop[hidden] { display: none; }
.pwr-drop svg { color: var(--ink); }
.pwr-drop strong { color: var(--ink); font-family: var(--font-h); font-size: 1.2rem; }
.pwr-file { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 2px solid var(--ink); border-radius: 12px; background: var(--soft); }
.pwr-file[hidden] { display: none; }
.pwr-file svg { flex: none; color: var(--stamp); }
.pwr-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.pwr-file-size { flex: none; }
.pwr-label { display: block; font-weight: 800; margin-bottom: 6px; }
.pwr-pw { display: flex; gap: 8px; }
.pwr-pw input, .pwr-help input { font: inherit; min-height: 44px; padding: 6px 14px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; color: var(--ink); width: 100%; }
.pwr-pw input { flex: 1; min-width: 0; letter-spacing: .06em; }
.pwr-pw .btn { min-height: 44px; }
.pwr-pw input:focus, .pwr-help input:focus { outline: none; box-shadow: 0 0 0 3px var(--sun); }
.pwr-help { margin-top: 12px; }
.pwr-help summary { cursor: pointer; font-weight: 700; color: var(--stamp-d); }
.pwr-help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 12px 0 8px; }
.pwr-help-box { padding: 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--soft); display: flex; flex-direction: column; gap: 8px; }
.pwr-help-box h3 { font-size: 1.05rem; margin: 0; }
.pwr-help-box p { margin: 0; font-size: .9375rem; color: var(--ink-2); }
.pwr-help-box label { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: .875rem; }
.pwr-help-box input { min-height: 40px; }
.pwr-calc { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--ink) !important; }
.pwr-calc b { font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.pwr-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.pwr-actions .status { min-height: 1.4em; }
.pwr-done { padding: 16px; border: 2px solid var(--ok); border-radius: 12px; background: #eef8f2; }
.pwr-done[hidden] { display: none; }
.pwr-done p { margin: 0 0 12px; font-weight: 600; }
.pwr-done-row { display: flex; flex-wrap: wrap; gap: 10px; }
.pwr-done-row a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.pwr-prose { padding: 8px 24px 0; margin-top: 18px; }
@media (max-width: 640px) {
  .pwr-card { margin: 0 14px; padding: 16px; }
  .pwr-help-grid { grid-template-columns: 1fr; }
  .pwr-prose { padding: 8px 14px 0; }
}

/* drag cards on the sheet */
.paper-wrap.over-card { cursor: grab; }
.paper-wrap.is-moving, .paper-wrap.is-moving * { cursor: grabbing !important; }

/* square handles that bend an edge */
.handle.is-bend::before { left: 14px; top: 14px; width: 16px; height: 16px; border-radius: 4px; background: #fff; border: 3px solid var(--sun); box-shadow: 0 0 0 1.5px var(--ink); }
.handle.is-bend.is-drag::before { background: transparent; border: 0; box-shadow: none; }
