/*
 * नमुना ८ converter — "ग्रामपंचायत नोंदवही" रूप.
 * उबदार कागद + निळी शाई + हळदीचा शिक्का. जुन्या Chrome (Windows 7) साठी रंग hex मध्येच.
 */

:root {
    --paper: #f7f1e3;
    --paper-deep: #efe5cf;
    --sheet: #fffdf7;
    --rule: #e3d6b8;
    --rule-soft: #eee4cc;
    --margin-red: #d9796a;

    --ink: #1f2a52;
    --ink-soft: #46507a;
    --ink-faint: #7d84a3;
    --ink-wash: #e8eaf4;

    --turmeric: #e3a21a;
    --turmeric-deep: #b57a06;
    --turmeric-wash: #fbefd2;

    --wax: #b8322a;
    --wax-wash: #fbe3df;
    --blank-cell: #ffc7ce;

    --leaf: #2f7a4a;
    --leaf-wash: #e2f1e6;

    --radius: 14px;
    --radius-sm: 9px;
    --shadow-sheet: 0 1px 0 #e9dcbd, 0 10px 30px -14px rgba(60, 42, 8, .28), 0 2px 6px -2px rgba(60, 42, 8, .12);
    --font-body: 'Mukta', 'Nirmala UI', 'Mangal', sans-serif;
    --font-display: 'Martel', 'Nirmala UI', 'Mangal', serif;
    --ease-out: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }

/* display:flex/grid दिलेल्या घटकांवरही hidden चालावे */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 16.5px;
    line-height: 1.55;
    color: var(--ink);
    background-color: var(--paper);
    /* कागदाचा पोत — अगदी फिकट रेषा */
    background-image:
        radial-gradient(1200px 500px at 85% -10%, rgba(227, 162, 26, .13), transparent 60%),
        repeating-linear-gradient(0deg, transparent 0 31px, rgba(160, 130, 70, .07) 31px 32px);
    min-height: 100vh;
}

code {
    font-family: Consolas, 'Cascadia Mono', monospace;
    font-size: .86em;
    background: var(--ink-wash);
    color: var(--ink);
    padding: .08em .38em;
    border-radius: 5px;
    word-break: break-all;
}

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

:focus-visible {
    outline: 3px solid var(--turmeric);
    outline-offset: 2px;
}

/* ------------------------------------------------------------
   Masthead — शाईचा पट्टा + नमुना ८ चा शिक्का
   ------------------------------------------------------------ */
.masthead {
    background:
        linear-gradient(115deg, rgba(255, 255, 255, .06) 0 40%, transparent 40%),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 22px),
        var(--ink);
    color: #f5efe0;
    border-bottom: 4px solid var(--turmeric);
}

.masthead-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 26px clamp(16px, 4vw, 40px) 28px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 22px;
    align-items: center;
}

.seal {
    width: 86px; height: 86px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 35% 30%, #f6c453 0, var(--turmeric) 45%, var(--turmeric-deep) 100%);
    box-shadow:
        inset 0 0 0 4px rgba(255, 255, 255, .18),
        inset 0 0 0 7px rgba(120, 70, 0, .35),
        0 0 0 4px rgba(227, 162, 26, .18),
        0 10px 28px -6px rgba(227, 162, 26, .55);
    transform: rotate(-8deg);
    animation: seal-in .9s var(--ease-out) both;
}

.seal span {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 46px;
    line-height: 1;
    color: #2a1a00;
    text-shadow: 0 1px 0 rgba(255, 230, 160, .7);
    transform: translateY(4px);
}

.eyebrow {
    margin: 0 0 2px;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: .04em;
    color: #f2c766;
}

.masthead h1 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(26px, 3.4vw, 38px);
    line-height: 1.25;
    letter-spacing: -.005em;
}

.lede {
    margin: 4px 0 0;
    max-width: 60ch;
    color: #cfd3e6;
    font-size: 15.5px;
}

.masthead-text > * { animation: rise .7s var(--ease-out) both; }
.masthead-text > :nth-child(2) { animation-delay: .08s; }
.masthead-text > :nth-child(3) { animation-delay: .16s; }

.offline-pill {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
    color: #e9ecf7;
    background: rgba(255, 255, 255, .08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
    white-space: nowrap;
    animation: rise .7s .24s var(--ease-out) both;
}

.offline-pill .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #7ddc99;
    box-shadow: 0 0 0 3px rgba(125, 220, 153, .22), 0 0 10px rgba(125, 220, 153, .8);
}

/* ------------------------------------------------------------
   Workbench — डावीकडे नोंद, उजवीकडे प्रक्रिया
   ------------------------------------------------------------ */
.workbench {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px clamp(16px, 4vw, 40px) 8px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 26px;
    align-items: start;
}

.sheet {
    background: var(--sheet);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sheet);
    animation: rise .7s var(--ease-out) both;
}

/* नोंदवहीचा लाल समास */
.form-sheet {
    position: relative;
    padding: 8px 28px 8px 58px;
    animation-delay: .12s;
}

.form-sheet::before {
    content: "";
    position: absolute;
    top: 0; bottom: 0; left: 38px;
    width: 0;
    border-left: 2px solid var(--margin-red);
    opacity: .55;
}

.block {
    padding: 20px 0 22px;
    border-bottom: 1px dashed var(--rule);
}

.block:last-child { border-bottom: 0; }

.block h2 {
    position: relative;
    margin: 0 0 14px;
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--ink);
}

.num {
    position: absolute;
    left: -47px;
    top: -1px;
    width: 30px; height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 800;
    color: var(--turmeric-deep);
    background: var(--turmeric-wash);
    box-shadow: inset 0 0 0 1.5px var(--turmeric);
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 16px;
}

.field label {
    display: block;
    margin-bottom: 5px;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--ink-soft);
}

.field input {
    width: 100%;
    height: 46px;
    padding: 0 13px;
    font: inherit;
    font-size: 16.5px;
    color: var(--ink);
    background: #fff;
    border: 1.5px solid var(--rule);
    border-radius: var(--radius-sm);
    transition: border-color .2s, box-shadow .2s;
}

.field input:hover { border-color: #d3c193; }

.field input:focus {
    outline: none;
    border-color: var(--ink-soft);
    box-shadow: 0 0 0 4px rgba(70, 80, 122, .14);
}

.field input::placeholder { color: #a9aec6; }

.field input.invalid {
    border-color: var(--wax);
    box-shadow: 0 0 0 4px rgba(184, 50, 42, .12);
}

/* ---------- Drop zone ---------- */
.dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 26px 18px 24px;
    text-align: center;
    cursor: pointer;
    border-radius: var(--radius);
    border: 2px dashed #d6c59a;
    background:
        repeating-linear-gradient(0deg, transparent 0 27px, var(--rule-soft) 27px 28px),
        #fffcf3;
    transition: border-color .25s, background-color .25s, transform .25s var(--ease-out), box-shadow .25s;
}

.dropzone:hover {
    border-color: var(--turmeric);
    box-shadow: 0 0 0 5px rgba(227, 162, 26, .12);
}

.dropzone.dragging {
    border-color: var(--turmeric-deep);
    border-style: solid;
    background-color: var(--turmeric-wash);
    transform: scale(1.012);
    box-shadow: 0 0 0 7px rgba(227, 162, 26, .2), 0 12px 30px -12px rgba(181, 122, 6, .5);
}

.dropzone:focus-within { box-shadow: 0 0 0 4px rgba(70, 80, 122, .2); }

.drop-icon {
    width: 46px; height: 46px;
    color: var(--ink-soft);
    margin-bottom: 4px;
    transition: transform .3s var(--ease-out), color .3s;
}

.dropzone:hover .drop-icon,
.dropzone.dragging .drop-icon {
    transform: translateY(-4px) rotate(-4deg);
    color: var(--turmeric-deep);
}

.drop-title { font-size: 17.5px; font-weight: 700; }
.drop-sub { font-size: 14px; color: var(--ink-faint); }

.file-chip {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--leaf-wash);
    box-shadow: inset 0 0 0 1.5px rgba(47, 122, 74, .35);
    animation: rise .35s var(--ease-out) both;
}

.file-chip .xl {
    flex: none;
    width: 34px; height: 34px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    background: var(--leaf);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
}

.file-chip .fname {
    min-width: 0;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-chip .fsize { margin-left: auto; flex: none; color: var(--ink-soft); font-size: 14px; }

/* ---------- Switch ---------- */
.switch-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    cursor: pointer;
}

.switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.switch {
    flex: none;
    position: relative;
    width: 48px; height: 28px;
    margin-top: 2px;
    border-radius: 999px;
    background: #d9cfb6;
    box-shadow: inset 0 1px 3px rgba(60, 42, 8, .25);
    transition: background-color .25s;
}

.switch::after {
    content: "";
    position: absolute;
    top: 3px; left: 3px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .25);
    transition: transform .3s var(--ease-out);
}

.switch-input:checked + .switch { background: var(--ink); }
.switch-input:checked + .switch::after { transform: translateX(20px); }
.switch-input:focus-visible + .switch { outline: 3px solid var(--turmeric); outline-offset: 2px; }

.switch-text { display: flex; flex-direction: column; }
.switch-text strong { font-weight: 600; }

.hint { margin: 2px 0 0; font-size: 14px; color: var(--ink-faint); }

.explain { margin: 10px 0 0 62px; font-size: 14.5px; color: var(--ink-soft); }
.explain summary {
    cursor: pointer;
    width: max-content;
    font-weight: 600;
    color: var(--turmeric-deep);
}
.explain p { margin: 8px 0 0; }

/* ---------- Folder ---------- */
.folder-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-bottom: 6px;
}

.folder-name { font-weight: 600; word-break: break-all; }
.folder-name.chosen { color: var(--leaf); }

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
button { font: inherit; }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 16px;
    font-weight: 600;
    color: var(--ink);
    background: #fff;
    border: 1.5px solid var(--rule);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color .2s, transform .15s, box-shadow .2s;
}

.btn-ghost svg { width: 20px; height: 20px; }
.btn-ghost:hover { border-color: var(--ink-soft); box-shadow: 0 4px 12px -6px rgba(31, 42, 82, .4); }
.btn-ghost:active { transform: translateY(1px); }

.btn-link {
    padding: 4px 6px;
    background: none;
    border: 0;
    color: var(--wax);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.btn-primary {
    position: relative;
    width: 100%;
    min-height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 22px;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: #fffaf0;
    background: linear-gradient(180deg, #2c3a6e 0%, var(--ink) 100%);
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .18),
        inset 0 -3px 0 rgba(0, 0, 0, .22),
        0 10px 22px -10px rgba(31, 42, 82, .7);
    transition: transform .15s var(--ease-out), box-shadow .25s, filter .2s;
}

/* चकाकी — hover वर पुढे सरकते */
.btn-primary::before {
    content: "";
    position: absolute;
    top: 0; bottom: 0; left: -60%;
    width: 45%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .22), transparent);
    transform: skewX(-18deg);
    transition: left .6s var(--ease-out);
}

.btn-primary:hover::before { left: 120%; }
.btn-primary:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), inset 0 -3px 0 rgba(0, 0, 0, .22), 0 14px 28px -10px rgba(31, 42, 82, .8), 0 0 0 4px rgba(227, 162, 26, .25); }
.btn-primary:active { transform: translateY(2px); }
.btn-primary:disabled { cursor: progress; filter: saturate(.6) brightness(1.1); }
.btn-primary:disabled::before { display: none; }

.spinner {
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, .3);
    border-top-color: var(--turmeric);
    animation: spin .8s linear infinite;
}

.spinner[hidden] { display: none; }

/* ------------------------------------------------------------
   Process panel
   ------------------------------------------------------------ */
.process-sheet {
    position: sticky;
    top: 20px;
    padding: 20px 22px 22px;
    animation-delay: .2s;
}

.process-title {
    margin: 0 0 10px;
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
}

.ledger-canvas {
    display: block;
    width: 100%;
    height: 118px;
    border-radius: 10px;
    background: #fffaf0;
    box-shadow: inset 0 0 0 1px var(--rule);
}

.steps {
    list-style: none;
    margin: 16px 0 14px;
    padding: 0;
    counter-reset: step;
}

.steps li {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    color: var(--ink-faint);
    font-weight: 600;
    transition: color .3s;
}

/* टप्प्यांना जोडणारी रेषा */
.steps li + li::before {
    content: "";
    position: absolute;
    left: 10px;
    top: -9px;
    height: 16px;
    border-left: 2px dotted var(--rule);
}

.tick {
    flex: none;
    position: relative;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: inset 0 0 0 2px var(--rule);
    transition: background-color .3s, box-shadow .3s;
}

.steps li[data-state="active"] { color: var(--ink); }
.steps li[data-state="active"] .tick {
    box-shadow: inset 0 0 0 2px var(--turmeric), 0 0 0 5px rgba(227, 162, 26, .18);
    animation: pulse 1.2s ease-in-out infinite;
}
.steps li[data-state="active"] .tick::after {
    content: "";
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: var(--turmeric);
}

.steps li[data-state="done"] { color: var(--leaf); }
.steps li[data-state="done"] .tick { background: var(--leaf); box-shadow: none; }
.steps li[data-state="done"] .tick::after {
    content: "";
    position: absolute;
    left: 7px; top: 4px;
    width: 6px; height: 11px;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

.steps li[data-state="error"] { color: var(--wax); }
.steps li[data-state="error"] .tick { background: var(--wax); box-shadow: none; }
.steps li[data-state="error"] .tick::after {
    content: "!";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
    font-size: 14px;
}

.dest {
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--paper);
    box-shadow: inset 0 0 0 1px var(--rule-soft);
}

.dest-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-faint);
}

.dest code { background: none; padding: 0; font-size: 14px; }

.progress-text {
    margin: 10px 0 0;
    font-size: 14.5px;
    color: var(--ink-soft);
    text-align: center;
}

/* ------------------------------------------------------------
   Notices
   ------------------------------------------------------------ */
.notice {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    animation: rise .35s var(--ease-out) both;
}

.notice-error { background: var(--wax-wash); color: #7d1d17; box-shadow: inset 0 0 0 1.5px rgba(184, 50, 42, .35); }
.notice-warn { background: var(--turmeric-wash); color: #6b4700; box-shadow: inset 0 0 0 1.5px rgba(227, 162, 26, .45); }

/* ------------------------------------------------------------
   Results
   ------------------------------------------------------------ */
.results {
    max-width: 1280px;
    margin: 0 auto;
    padding: 18px clamp(16px, 4vw, 40px) 10px;
}

.result-sheet {
    padding: 24px 28px 26px;
    animation: rise .6s var(--ease-out) both;
}

.result-top {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 24px;
    align-items: center;
}

/* "पूर्ण" शिक्का */
.stamp {
    width: 104px; height: 104px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--leaf);
    border: 3px double var(--leaf);
    box-shadow: inset 0 0 0 5px var(--sheet), inset 0 0 0 6.5px rgba(47, 122, 74, .55);
    font-family: var(--font-display);
    font-weight: 800;
    line-height: 1;
    transform: rotate(-10deg);
    animation: stamp .55s var(--ease-out) both;
}

.stamp b { display: block; font-size: 24px; line-height: 1.5; }
.stamp small {
    display: block;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1.5px solid rgba(47, 122, 74, .5);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: .05em;
}

.result-top h2 {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 800;
}

/* आकडे — नोंदवहीतल्या ओळीसारखे, ठिपक्यांच्या रेषेसह */
.tally { margin: 0; padding: 0; list-style: none; max-width: 560px; }

.tally li {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 3px 0;
}

.tally .lbl { color: var(--ink-soft); }
.tally .lead { flex: 1; border-bottom: 2px dotted var(--rule); transform: translateY(-4px); }
.tally .val {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 20px;
    font-variant-numeric: tabular-nums;
}
.tally .val.red { color: var(--wax); }
.tally .val.amber { color: var(--turmeric-deep); }
.tally .val.green { color: var(--leaf); }

.swatch {
    display: inline-block;
    width: 14px; height: 14px;
    margin-right: 6px;
    vertical-align: -1px;
    border-radius: 3px;
    background: var(--blank-cell);
    box-shadow: inset 0 0 0 1px rgba(184, 50, 42, .4);
}

.result-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; min-width: 240px; }

.btn-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 54px;
    padding: 0 22px;
    border-radius: 12px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 17px;
    color: #fff;
    text-decoration: none;
    background: linear-gradient(180deg, #3b8f5a 0%, var(--leaf) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 -3px 0 rgba(0, 0, 0, .2), 0 10px 22px -10px rgba(47, 122, 74, .8);
    transition: transform .15s var(--ease-out), box-shadow .25s;
}

.btn-download svg { width: 22px; height: 22px; }
.btn-download:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 -3px 0 rgba(0, 0, 0, .2), 0 14px 28px -10px rgba(47, 122, 74, .9), 0 0 0 4px rgba(47, 122, 74, .2); }
.btn-download:active { transform: translateY(2px); }

.saved {
    margin: 18px 0 0;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--paper);
    font-size: 14.5px;
}

.saved div + div { margin-top: 4px; }
.saved span { color: var(--ink-faint); font-weight: 600; margin-right: 6px; }

.attention {
    margin-top: 18px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    background: var(--wax-wash);
    color: #6e1a14;
    box-shadow: inset 0 0 0 1.5px rgba(184, 50, 42, .3);
}

.attention h3 { margin: 0 0 4px; font-family: var(--font-display); font-size: 18px; }
.attention p { margin: 0; }

/* ---------- Tabs ---------- */
.tabs {
    margin-top: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: 2px solid var(--rule);
}

.tab {
    position: relative;
    padding: 10px 16px 11px;
    background: none;
    border: 0;
    font-weight: 600;
    color: var(--ink-faint);
    cursor: pointer;
    border-radius: 9px 9px 0 0;
    transition: color .2s, background-color .2s;
}

.tab:hover { color: var(--ink); background: var(--paper); }

.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"]::after {
    content: "";
    position: absolute;
    left: 10px; right: 10px; bottom: -2px;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--turmeric);
}

.tab .count {
    display: inline-block;
    min-width: 24px;
    margin-left: 6px;
    padding: 0 7px;
    border-radius: 999px;
    font-size: 13px;
    line-height: 22px;
    text-align: center;
    background: var(--ink-wash);
    color: var(--ink-soft);
}

.tab .count.red { background: var(--wax-wash); color: var(--wax); }

.tab-panel { padding-top: 16px; animation: rise .3s var(--ease-out) both; }

.panel-note { margin: 0 0 12px; color: var(--ink-soft); font-size: 15px; }

.search {
    width: 100%;
    max-width: 380px;
    height: 42px;
    margin-bottom: 12px;
    padding: 0 13px;
    font: inherit;
    border: 1.5px solid var(--rule);
    border-radius: var(--radius-sm);
    background: #fff;
}

.search:focus { outline: none; border-color: var(--ink-soft); box-shadow: 0 0 0 4px rgba(70, 80, 122, .14); }

.table-wrap {
    max-height: 560px;
    overflow: auto;
    border-radius: var(--radius-sm);
    box-shadow: inset 0 0 0 1px var(--rule);
}

table.ledger {
    width: 100%;
    min-width: 760px;           /* लहान screen वर columns दबू नयेत — आतल्या आत आडवे scroll */
    border-collapse: collapse;
    font-size: 14.5px;
}

.ledger th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 9px 12px;
    text-align: left;
    font-weight: 700;
    color: var(--ink);
    background: var(--paper-deep);
    border-bottom: 2px solid var(--rule);
    white-space: nowrap;
}

.ledger td {
    padding: 8px 12px;
    vertical-align: top;
    border-bottom: 1px solid var(--rule-soft);
    white-space: pre-line;
}

.ledger tbody tr:nth-child(even) td { background: #fffaf0; }
.ledger tbody tr:hover td { background: var(--ink-wash); }
.ledger tr.needs td { background: #fff4d6; }
.ledger tr.needs:nth-child(even) td { background: #fdefc8; }
.ledger td.mono { font-family: Consolas, monospace; font-size: 13.5px; color: var(--ink-soft); }

.empty-state { padding: 26px; text-align: center; color: var(--ink-faint); }

.warn-list { margin: 0; padding: 0; list-style: none; }
.warn-list li {
    padding: 10px 14px 10px 40px;
    position: relative;
    border-bottom: 1px dashed var(--rule);
}
.warn-list li::before {
    content: "!";
    position: absolute;
    left: 8px; top: 11px;
    width: 22px; height: 22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-weight: 800;
    font-size: 13px;
    color: #6b4700;
    background: var(--turmeric-wash);
    box-shadow: inset 0 0 0 1.5px var(--turmeric);
}

/* ---------- Mapping ---------- */
.map-sheet {
    margin-bottom: 12px;
    border-radius: var(--radius-sm);
    box-shadow: inset 0 0 0 1px var(--rule);
    background: #fff;
}

.map-sheet > summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 700;
}

.map-body { padding: 0 16px 16px; }

.tag {
    display: inline-block;
    padding: 1px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    background: var(--ink-wash);
    color: var(--ink-soft);
}

.tag.skip { background: #ececec; color: #555; }
.tag.ok { background: var(--leaf-wash); color: var(--leaf); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { padding: 2px 10px; border-radius: 7px; font-size: 13.5px; }
.chip-empty { background: var(--wax); color: #fff; }
.chip-missing { background: var(--wax-wash); color: var(--wax); box-shadow: inset 0 0 0 1px rgba(184, 50, 42, .4); }
.chip-unmapped { background: var(--paper); color: var(--ink-soft); box-shadow: inset 0 0 0 1px var(--rule); }

.map-group { margin-top: 14px; }
.map-group > strong { font-size: 14.5px; }
.map-group > strong.red { color: var(--wax); }

.foot {
    max-width: 1280px;
    margin: 0 auto;
    padding: 18px clamp(16px, 4vw, 40px) 30px;
    font-size: 13.5px;
    color: var(--ink-faint);
    text-align: center;
}

/* ------------------------------------------------------------
   Motion
   ------------------------------------------------------------ */
@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

@keyframes seal-in {
    from { opacity: 0; transform: rotate(-40deg) scale(.6); }
    to { opacity: 1; transform: rotate(-8deg) scale(1); }
}

@keyframes stamp {
    0% { opacity: 0; transform: rotate(-22deg) scale(1.7); }
    60% { opacity: 1; transform: rotate(-9deg) scale(.96); }
    100% { opacity: 1; transform: rotate(-10deg) scale(1); }
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes pulse {
    0%, 100% { box-shadow: inset 0 0 0 2px var(--turmeric), 0 0 0 4px rgba(227, 162, 26, .18); }
    50% { box-shadow: inset 0 0 0 2px var(--turmeric), 0 0 0 8px rgba(227, 162, 26, .06); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */
@media (max-width: 1000px) {
    .workbench { grid-template-columns: minmax(0, 1fr); }
    .process-sheet { position: static; }
    .result-top { grid-template-columns: auto minmax(0, 1fr); }
    .result-actions { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
    .result-actions .btn-download { flex: 1; }
}

@media (max-width: 720px) {
    body { font-size: 16px; }
    .masthead-inner { grid-template-columns: auto 1fr; gap: 14px; }
    .seal { width: 62px; height: 62px; }
    .seal span { font-size: 34px; }
    .offline-pill { grid-column: 1 / -1; justify-self: start; white-space: normal; }
    .field-grid { grid-template-columns: minmax(0, 1fr); }
    .form-sheet { padding: 4px 16px 4px 46px; }
    .form-sheet::before { left: 30px; }
    .num { left: -40px; width: 28px; height: 28px; }
    .explain { margin-left: 0; }
    .result-sheet { padding: 18px 16px; }
    .result-top { grid-template-columns: minmax(0, 1fr); }
    .stamp { width: 84px; height: 84px; }
    .stamp b { font-size: 20px; }
    .tab { padding: 9px 11px; }
}
