
      :root {
        --primary: #16305c;
        --primary-light: #1e3f78;
        --secondary: #0f766e;
        --secondary-light: #14b8a6;
        --accent: #b45309;
        --accent-light: #f59e0b;
        --violet: #7c3aed;
        --violet-light: #a78bfa;
        --rose: #e11d48;
        --bg: #eef1f5;
        --card: #ffffff;
        --text: #1c2530;
        --text-muted: #64748b;
        --border: #d6dce4;
        --danger: #b91c1c;
        --success: #0d9488;
        --radius: 10px;
      }

      [data-theme="dark"] {
        --bg: #0c1420;
        --card: #141d2b;
        --text: #e5eaf1;
        --text-muted: #93a1b5;
        --border: #263143;
        --primary-light: #2a4d85;
      }

      * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
      }

      body {
        font-family: 'Nirmala UI', 'Noto Sans Devanagari', 'Segoe UI', system-ui, sans-serif;
        background:
          radial-gradient(circle at 15% 0%, rgba(22, 48, 92, 0.06), transparent 40%),
          radial-gradient(circle at 100% 20%, rgba(180, 83, 9, 0.05), transparent 35%),
          var(--bg);
        color: var(--text);
        min-height: 100vh;
        padding: 22px;
        line-height: 1.5;
        transition: background .2s, color .2s;
      }

      .container {
        max-width: 1320px;
        margin: 0 auto;
      }

      /* ---------- Letterhead header ---------- */
      header.letterhead {
        display: flex;
        align-items: center;
        gap: 20px;
        padding: 22px 28px;
        background: linear-gradient(120deg, var(--primary) 0%, var(--primary-light) 45%, var(--violet) 85%, var(--secondary) 130%);
        color: #fff;
        border-radius: 14px;
        margin-bottom: 22px;
        box-shadow: 0 10px 25px -8px rgba(22, 48, 92, 0.45);
        position: relative;
        overflow: hidden;
      }

      header.letterhead::after {
        content: "";
        position: absolute;
        inset: 0;
        background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 14px);
        pointer-events: none;
      }

      .seal {
        flex-shrink: 0;
        width: 58px;
        height: 58px;
        border-radius: 50%;
        background: radial-gradient(circle at 35% 30%, var(--accent-light), var(--accent) 70%);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 26px;
        border: 3px solid rgba(255, 255, 255, 0.85);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28), 0 0 0 4px rgba(124, 58, 237, 0.25), inset 0 0 0 3px rgba(180, 83, 9, 0.35);
        position: relative;
        z-index: 1;
        overflow: hidden;
      }

      .seal img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 50%;
      }

      header .titles {
        position: relative;
        z-index: 1;
        flex: 1;
        text-align: center;
      }

      header h1 {
        font-size: 22px;
        letter-spacing: 0.2px;
        margin-bottom: 3px;
      }

      header p {
        font-size: 13px;
        opacity: 0.9;
      }

      .header-right {
        margin-inline-start: auto;
        text-align: right;
        font-size: 12px;
        opacity: 0.92;
        position: relative;
        z-index: 1;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 6px;
      }

      .header-actions {
        display: flex;
        align-items: center;
        gap: 8px;
      }

      .header-icon-btn {
        width: 30px;
        height: 30px;
        border-radius: 50%;
        border: 1px solid rgba(255, 255, 255, 0.35);
        background: rgba(255, 255, 255, 0.14);
        color: #fff;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        transition: background .15s;
      }

      .header-icon-btn:hover {
        background: rgba(255, 255, 255, 0.28);
      }

      .page-credit {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        font-size: 13px;
        color: var(--text-muted);
        padding: 22px 0 10px;
        letter-spacing: 0.2px;
      }

      .credit-badge {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        padding: 6px 16px;
        border-radius: 999px;
        background: linear-gradient(90deg, #ef4444, #f59e0b, #22c55e, #0ea5e9, #8b5cf6, #ec4899, #ef4444);
        background-size: 400% auto;
        animation: credit-shine 8s linear infinite;
        box-shadow: 0 2px 14px -2px rgba(139, 92, 246, 0.35);
      }

      [data-theme="dark"] .credit-badge {
        box-shadow: 0 2px 18px -2px rgba(139, 92, 246, 0.5);
      }

      .credit-badge .spark {
        font-size: 13px;
        filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.6));
      }

      .credit-name {
        font-weight: 800;
        color: #fff;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
        letter-spacing: 0.3px;
      }

      @keyframes credit-shine {
        0% {
          background-position: 0% center;
        }

        100% {
          background-position: 400% center;
        }
      }

      /* ---------- Layout ---------- */
      .main-layout {
        display: grid;
        grid-template-columns: 300px 1fr;
        gap: 22px;
        align-items: start;
      }

      @media (max-width: 880px) {
        .main-layout {
          grid-template-columns: 1fr;
        }
      }

      .sidebar {
        background: var(--card);
        padding: 20px;
        border-radius: var(--radius);
        box-shadow: 0 2px 10px -4px rgba(15, 23, 42, 0.08);
        border: 1px solid var(--border);
        position: sticky;
        top: 22px;
        max-height: calc(100vh - 44px);
        overflow-y: auto;
      }

      @media (max-width: 880px) {
        .sidebar {
          position: static;
          max-height: none;
        }
      }

      .section-title {
        font-size: 13px;
        font-weight: 700;
        color: var(--primary);
        text-transform: uppercase;
        letter-spacing: 0.4px;
        margin-bottom: 10px;
        padding-bottom: 8px;
        border-bottom: 3px solid transparent;
        border-image: linear-gradient(90deg, var(--secondary-light), var(--violet-light), var(--accent-light)) 1;
        margin-top: 18px;
      }

      [data-theme="dark"] .section-title {
        color: #cbd9f5;
      }

      .section-title:first-child {
        margin-top: 0;
      }

      .radio-group {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-bottom: 4px;
      }

      .radio-btn {
        display: flex;
        align-items: center;
        padding: 10px 12px;
        background: #f4f6f9;
        border: 1px solid var(--border);
        border-inline-start: 3px solid transparent;
        border-radius: 8px;
        cursor: pointer;
        font-size: 14px;
        transition: background .15s, border-color .15s;
      }

      [data-theme="dark"] .radio-btn {
        background: #101927;
      }

      .radio-btn:hover {
        background: #e9edf3;
        border-inline-start-color: var(--secondary-light);
      }

      [data-theme="dark"] .radio-btn:hover {
        background: #1a2536;
      }

      .radio-btn input {
        margin-inline-end: 10px;
        accent-color: var(--secondary);
      }

      .radio-btn.active {
        background: linear-gradient(120deg, var(--secondary), var(--secondary-light));
        color: #fff;
        border-color: var(--secondary);
        border-inline-start-color: var(--accent-light);
        font-weight: 600;
        box-shadow: 0 3px 10px -4px rgba(15, 118, 110, 0.5);
      }

      .radio-btn .fy-status {
        margin-inline-start: auto;
        font-size: 10px;
        padding: 2px 7px;
        border-radius: 999px;
        background: rgba(0, 0, 0, 0.08);
      }

      .radio-btn.active .fy-status {
        background: rgba(255, 255, 255, 0.25);
      }

      /* ---------- Dynamic fiscal-year rows (editable / removable) ---------- */
      .year-row {
        display: flex;
        align-items: center;
        gap: 6px;
        margin-bottom: 8px;
      }

      .radio-btn-inline {
        flex: 1;
        display: flex;
        align-items: center;
        padding: 10px 12px;
        background: #f4f6f9;
        border: 1px solid var(--border);
        border-radius: 8px;
        cursor: pointer;
        font-size: 14px;
        min-width: 0;
        transition: background .15s, border-color .15s;
      }

      [data-theme="dark"] .radio-btn-inline {
        background: #101927;
      }

      .radio-btn-inline:hover {
        background: #e9edf3;
      }

      [data-theme="dark"] .radio-btn-inline:hover {
        background: #1a2536;
      }

      .radio-btn-inline input {
        margin-inline-end: 10px;
        accent-color: var(--secondary);
        flex-shrink: 0;
      }

      .radio-btn-inline .year-label-text {
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .radio-btn-inline.active {
        background: linear-gradient(120deg, var(--secondary), var(--secondary-light));
        color: #fff;
        border-color: var(--secondary);
        font-weight: 600;
        box-shadow: 0 3px 10px -4px rgba(15, 118, 110, 0.5);
      }

      .radio-btn-inline .fy-status {
        margin-inline-start: 6px;
        font-size: 10px;
        padding: 2px 7px;
        border-radius: 999px;
        background: rgba(0, 0, 0, 0.08);
        flex-shrink: 0;
      }

      .radio-btn-inline.active .fy-status {
        background: rgba(255, 255, 255, 0.25);
      }

      .year-actions {
        display: flex;
        gap: 4px;
        flex-shrink: 0;
      }

      .icon-btn {
        width: 28px;
        height: 28px;
        border: 1px solid var(--border);
        background: var(--card);
        color: var(--text);
        border-radius: 6px;
        cursor: pointer;
        font-size: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background .15s;
      }

      .icon-btn:hover {
        background: #f4f6f9;
      }

      [data-theme="dark"] .icon-btn:hover {
        background: #1a2536;
      }

      .icon-btn:disabled {
        opacity: 0.35;
        cursor: not-allowed;
      }

      .icon-btn-danger:hover {
        background: #fee2e2;
        border-color: #fca5a5;
      }

      .utility-box {
        margin-top: 20px;
        padding: 14px;
        background: #fff8ec;
        border: 1px solid #fbe4bb;
        border-radius: 8px;
      }

      [data-theme="dark"] .utility-box {
        background: #241c0e;
        border-color: #4a3813;
      }

      .utility-box.blue-box {
        background: #eef4ff;
        border-color: #c7d9fb;
      }

      [data-theme="dark"] .utility-box.blue-box {
        background: #10192b;
        border-color: #22365c;
      }

      .utility-box .label {
        font-size: 13px;
        font-weight: 700;
        margin-bottom: 6px;
        color: #92400e;
        display: flex;
        align-items: center;
        gap: 6px;
      }

      .utility-box.blue-box .label {
        color: var(--primary-light);
      }

      [data-theme="dark"] .utility-box .label {
        color: #f0b656;
      }

      [data-theme="dark"] .utility-box.blue-box .label {
        color: #8db4f0;
      }

      .utility-box .hint {
        font-size: 9px;
        color: var(--text-muted);
        margin-bottom: 10px;
        line-height: 1.5;
      }

      .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        width: 100%;
        padding: 10px 12px;
        background: linear-gradient(135deg, var(--primary), var(--primary-light));
        color: #fff;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        font-weight: 600;
        font-size: 13.5px;
        margin-top: 8px;
        box-shadow: 0 3px 10px -3px rgba(22, 48, 92, 0.45);
        transition: filter .15s, transform .1s, box-shadow .15s;
        font-family: inherit;
      }

      .btn:hover {
        filter: brightness(1.1);
        box-shadow: 0 5px 14px -3px rgba(22, 48, 92, 0.55);
      }

      .btn:active {
        transform: scale(0.98);
      }

      .btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        box-shadow: none;
      }

      .btn-warning {
        background: linear-gradient(135deg, var(--accent), var(--accent-light));
        box-shadow: 0 3px 10px -3px rgba(180, 83, 9, 0.45);
      }

      .btn-success {
        background: linear-gradient(135deg, var(--success), var(--secondary-light));
        box-shadow: 0 3px 10px -3px rgba(13, 148, 136, 0.45);
      }

      .btn-secondary {
        background: linear-gradient(135deg, #475569, #64748b);
        box-shadow: 0 3px 10px -3px rgba(71, 85, 105, 0.4);
      }

      .btn-outline {
        background: var(--card);
        color: var(--primary);
        border: 1px solid var(--border);
        box-shadow: none;
      }

      [data-theme="dark"] .btn-outline {
        color: #cbd9f5;
      }

      .btn-outline:hover {
        background: #f4f6f9;
        box-shadow: none;
      }

      [data-theme="dark"] .btn-outline:hover {
        background: #1a2536;
      }

      .btn-danger-outline {
        background: var(--card);
        color: var(--danger);
        border: 1px solid #fca5a5;
        box-shadow: none;
      }

      .btn-row {
        display: flex;
        gap: 8px;
      }

      .btn-row .btn {
        margin-top: 0;
      }

      /* ---------- Editor ---------- */
      .editor-container {
        background: var(--card);
        border-radius: var(--radius);
        box-shadow: 0 2px 10px -4px rgba(15, 23, 42, 0.08);
        border: 1px solid var(--border);
        display: flex;
        flex-direction: column;
        overflow: hidden;
      }

      .editor-header {
        background: #f4f6f9;
        padding: 14px 20px;
        border-bottom: 1px solid var(--border);
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 10px;
      }

      [data-theme="dark"] .editor-header {
        background: #101927;
      }

      .current-status {
        font-weight: 700;
        color: var(--primary);
        font-size: 14.5px;
      }

      [data-theme="dark"] .current-status {
        color: #cbd9f5;
      }

      .current-status .fy-tag {
        font-size: 11px;
        font-weight: 700;
        margin-inline-start: 8px;
        padding: 3px 10px;
        border-radius: 999px;
        background: linear-gradient(120deg, var(--violet), var(--rose));
        color: #fff;
      }

      .helper-text {
        font-size: 9px;
        color: var(--text-muted);
        line-height: 1.5;
      }

      .toolbar {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 4px;
        padding: 8px 16px;
        background: var(--card);
        border-bottom: 1px solid var(--border);
      }

      .tb-btn {
        border: 1px solid transparent;
        background: transparent;
        width: 32px;
        height: 32px;
        border-radius: 6px;
        cursor: pointer;
        font-size: 14px;
        color: var(--text);
        display: flex;
        align-items: center;
        justify-content: center;
        font-family: inherit;
      }

      .tb-btn:hover {
        background: #eef1f5;
        border-color: var(--border);
      }

      [data-theme="dark"] .tb-btn:hover {
        background: #1a2536;
      }

      .tb-sep {
        width: 1px;
        align-self: stretch;
        background: var(--border);
        margin: 4px 6px;
      }

      .tb-select {
        height: 32px;
        border: 1px solid var(--border);
        border-radius: 6px;
        font-size: 12px;
        background: var(--card);
        color: var(--text);
        padding: 0 4px;
        font-family: inherit;
        cursor: pointer;
      }

      .tb-color-btn {
        position: relative;
        width: 32px;
        height: 32px;
        border: 1px solid transparent;
        border-radius: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 13px;
        cursor: pointer;
      }

      .tb-color-btn:hover {
        background: #eef1f5;
        border-color: var(--border);
      }

      [data-theme="dark"] .tb-color-btn:hover {
        background: #1a2536;
      }

      .tb-color-btn input[type=color] {
        position: absolute;
        inset: 0;
        opacity: 0;
        cursor: pointer;
        width: 100%;
        height: 100%;
        border: none;
        padding: 0;
      }

      .word-page {
        background: #fff;
        color: #1c2530;
        margin: 26px auto;
        width: 92%;
        min-height: 480px;
        box-shadow: 0 0 0 1px #e2e8f0, 0 8px 20px -6px rgba(15, 23, 42, 0.12);
        border-radius: 4px;
        padding: 46px 54px;
        outline: none;
        overflow-y: auto;
        font-size: 15.5px;
        line-height: 1.75;
      }

      .word-page:focus {
        box-shadow: 0 0 0 2px var(--secondary), 0 8px 20px -6px rgba(15, 23, 42, 0.12);
      }

      .word-page h2 {
        color: var(--primary);
        font-size: 19px;
        margin-bottom: 6px;
      }

      .word-page hr {
        border: none;
        border-top: 2px solid var(--secondary);
        margin: 12px 0 16px;
        opacity: 0.4;
      }

      .word-page p {
        margin-bottom: 8px;
      }

      .word-page table {
        border-collapse: collapse;
        width: 100%;
        margin-top: 10px;
        font-size: 14px;
      }

      .word-page table th,
      .word-page table td {
        border: 1px solid #cbd5e1;
        padding: 8px 10px;
        text-align: left;
      }

      .word-page table th {
        background: #f1f5f9;
        color: var(--primary);
      }

      .word-page .docx-p {
        margin-bottom: 6px;
        min-height: 1.2em;
        overflow-wrap: break-word;
        word-break: break-word;
      }

      .word-page .docx-table {
        border-collapse: collapse;
        width: 100%;
        margin: 6px 0;
        table-layout: fixed;
      }

      .word-page .docx-table td {
        border: var(--docx-cell-border, 1px solid #94a3b8);
        padding: 6px 8px;
        vertical-align: top;
        overflow-wrap: break-word;
        word-break: break-word;
      }

      .word-page .docx-run {
        outline: none;
      }

      .word-page .docx-run:focus {
        background: rgba(15, 118, 110, 0.08);
        border-radius: 2px;
      }

      .notes-box {
        padding: 12px 20px;
        background: #fffdf6;
        border-top: 1px dashed var(--border);
      }

      [data-theme="dark"] .notes-box {
        background: #171307;
      }

      .notes-box label {
        font-size: 12px;
        font-weight: 700;
        color: #92400e;
        display: flex;
        align-items: center;
        gap: 6px;
        margin-bottom: 6px;
      }

      [data-theme="dark"] .notes-box label {
        color: #f0b656;
      }

      .notes-box textarea {
        width: 100%;
        min-height: 48px;
        resize: vertical;
        padding: 8px 10px;
        border: 1px solid var(--border);
        border-radius: 6px;
        font-family: inherit;
        font-size: 13px;
        background: var(--card);
        color: var(--text);
      }

      .editor-footer {
        padding: 14px 20px;
        background: #f4f6f9;
        border-top: 1px solid var(--border);
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
      }

      [data-theme="dark"] .editor-footer {
        background: #101927;
      }

      .editor-footer .btn {
        width: auto;
        padding: 10px 26px;
        margin-top: 0;
      }

      .footer-left {
        display: flex;
        flex-direction: column;
        gap: 2px;
      }

      .save-hint {
        font-size: 12px;
        color: var(--text-muted);
      }

      .word-count-hint {
        font-size: 11.5px;
        color: var(--text-muted);
      }

      /* ---------- Toast ---------- */
      .toast {
        position: fixed;
        top: 20px;
        right: 20px;
        background: var(--success);
        color: #fff;
        padding: 12px 22px;
        border-radius: 8px;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
        display: flex;
        align-items: center;
        gap: 8px;
        transform: translateX(120%);
        transition: transform .3s ease;
        z-index: 1000;
        font-size: 13.5px;
        font-weight: 600;
      }

      .toast.show {
        transform: translateX(0);
      }

      .toast.error {
        background: var(--danger);
      }

      /* ---------- Modal system ---------- */
      .modal-overlay {
        position: fixed;
        inset: 0;
        background: rgba(10, 15, 25, 0.55);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 2000;
        padding: 20px;
        opacity: 0;
        pointer-events: none;
        transition: opacity .15s ease;
      }

      .modal-overlay.show {
        opacity: 1;
        pointer-events: auto;
      }

      .modal-box {
        background: var(--card);
        color: var(--text);
        border-radius: 12px;
        padding: 22px 24px;
        width: 100%;
        max-width: 420px;
        box-shadow: 0 24px 60px -14px rgba(0, 0, 0, 0.4);
        transform: translateY(8px);
        transition: transform .15s ease;
      }

      .modal-overlay.show .modal-box {
        transform: translateY(0);
      }

      .modal-box.search-box,
      .modal-box.history-box {
        max-width: 580px;
        text-align: left;
      }

      .modal-title {
        font-weight: 700;
        font-size: 15.5px;
        color: var(--primary);
        margin-bottom: 8px;
        display: flex;
        align-items: center;
        gap: 8px;
      }

      [data-theme="dark"] .modal-title {
        color: #cbd9f5;
      }

      .modal-message {
        font-size: 13.5px;
        color: var(--text-muted);
        margin-bottom: 14px;
        line-height: 1.55;
        white-space: pre-line;
      }

      .modal-input {
        width: 100%;
        padding: 10px 12px;
        border: 1px solid var(--border);
        border-radius: 8px;
        font-size: 14px;
        margin-bottom: 16px;
        font-family: inherit;
        background: var(--card);
        color: var(--text);
      }

      .modal-actions {
        display: flex;
        justify-content: flex-end;
        gap: 8px;
      }

      .modal-actions .btn {
        width: auto;
        margin-top: 0;
        padding: 9px 18px;
      }

      .search-results,
      .history-list {
        max-height: 340px;
        overflow-y: auto;
        margin-bottom: 14px;
        display: flex;
        flex-direction: column;
        gap: 6px;
      }

      .search-result-item,
      .history-item {
        padding: 10px 12px;
        border: 1px solid var(--border);
        border-radius: 8px;
        cursor: pointer;
        font-size: 13px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
      }

      .search-result-item:hover {
        background: #f4f6f9;
      }

      [data-theme="dark"] .search-result-item:hover {
        background: #1a2536;
      }

      .search-result-item .sr-body {
        min-width: 0;
      }

      .search-result-item .sr-title,
      .history-item .hi-title {
        font-weight: 700;
        color: var(--primary);
        font-size: 12.5px;
        margin-bottom: 3px;
      }

      [data-theme="dark"] .search-result-item .sr-title,
      [data-theme="dark"] .history-item .hi-title {
        color: #cbd9f5;
      }

      .search-result-item .sr-snippet {
        color: var(--text-muted);
        font-size: 12px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .search-empty,
      .history-empty {
        text-align: center;
        color: var(--text-muted);
        font-size: 13px;
        padding: 26px 0;
      }

      .history-item .hi-date {
        font-size: 11.5px;
        color: var(--text-muted);
      }

      .history-item .hi-restore-btn {
        width: auto;
        margin: 0;
        padding: 6px 12px;
        font-size: 12px;
        flex-shrink: 0;
      }

      .hi-compare-check {
        flex-shrink: 0;
        width: 17px;
        height: 17px;
        cursor: pointer;
        accent-color: var(--secondary);
      }

      /* ---------- Dashboard modal ---------- */
      .modal-box.dashboard-box {
        max-width: 760px;
        text-align: left;
        max-height: 88vh;
        display: flex;
        flex-direction: column;
      }

      .dashboard-scroll {
        overflow-y: auto;
        flex: 1;
        padding-right: 2px;
        margin-bottom: 14px;
      }

      .deadline-box {
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 12px 14px;
        margin-bottom: 16px;
        background: #f4f6f9;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px;
      }

      [data-theme="dark"] .deadline-box {
        background: #1a2536;
      }

      .deadline-box input[type="date"] {
        padding: 7px 10px;
        border: 1px solid var(--border);
        border-radius: 6px;
        font-family: inherit;
        background: var(--card);
        color: var(--text);
        font-size: 13px;
      }

      .deadline-status {
        font-size: 12.5px;
        font-weight: 700;
        padding: 4px 10px;
        border-radius: 999px;
      }

      .deadline-status.ok {
        background: rgba(13, 148, 136, 0.15);
        color: var(--success);
      }

      .deadline-status.soon {
        background: rgba(245, 158, 11, 0.2);
        color: var(--accent);
      }

      .deadline-status.over {
        background: rgba(185, 28, 28, 0.15);
        color: var(--danger);
      }

      .deadline-status.none {
        background: rgba(100, 116, 139, 0.15);
        color: var(--text-muted);
      }

      .dash-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 12.5px;
      }

      .dash-table th,
      .dash-table td {
        border: 1px solid var(--border);
        padding: 8px 10px;
        text-align: center;
        vertical-align: middle;
      }

      .dash-table th {
        background: #f4f6f9;
        color: var(--primary);
        font-weight: 700;
      }

      [data-theme="dark"] .dash-table th {
        background: #1a2536;
        color: #cbd9f5;
      }

      .dash-table td.dash-year-col {
        text-align: left;
        font-weight: 600;
      }

      .dash-cell {
        display: flex;
        flex-direction: column;
        gap: 5px;
        align-items: center;
      }

      .dash-status-yes {
        color: var(--success);
        font-weight: 800;
      }

      .dash-status-no {
        color: var(--text-muted);
      }

      .dash-goto-btn {
        width: auto;
        padding: 4px 10px;
        font-size: 11.5px;
        margin: 0;
      }

      /* ---------- History diff (तुलना) modal ---------- */
      .modal-box.diff-box {
        max-width: 760px;
        text-align: left;
        max-height: 88vh;
        display: flex;
        flex-direction: column;
      }

      .diff-body {
        flex: 1;
        overflow-y: auto;
        padding: 14px;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: var(--card);
        line-height: 2;
        font-size: 13.5px;
        margin-bottom: 14px;
        white-space: pre-wrap;
      }

      .diff-body ins {
        background: rgba(13, 148, 136, 0.18);
        color: var(--success);
        text-decoration: none;
        padding: 0 1px;
        border-radius: 2px;
      }

      .diff-body del {
        background: rgba(185, 28, 28, 0.14);
        color: var(--danger);
        padding: 0 1px;
        border-radius: 2px;
      }

      .diff-empty {
        text-align: center;
        color: var(--text-muted);
        padding: 20px 0;
      }

      /* ---------- तालिका जोड (auto-total) row ---------- */
      tr.jsd-total-row td {
        font-weight: 700;
        background: rgba(15, 118, 110, 0.08);
      }

      .file-info-card {
        margin-top: 8px;
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 10px 12px;
        background: #f4f6f9;
        display: flex;
        flex-direction: column;
        gap: 5px;
      }

      [data-theme="dark"] .file-info-card {
        background: #1a2536;
      }

      .file-info-card .fi-row {
        display: flex;
        align-items: baseline;
        gap: 6px;
        font-size: 12.5px;
      }

      .file-info-card .fi-row .fi-label {
        color: var(--text-muted);
        flex-shrink: 0;
        min-width: 86px;
      }

      .file-info-card .fi-row .fi-value {
        font-weight: 600;
        word-break: break-all;
      }

      .file-info-card .fi-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 4px;
      }

      .file-info-card .fi-actions .btn {
        width: auto;
        flex: 1 1 30%;
        min-width: 90px;
        margin: 0;
        padding: 7px 8px;
        font-size: 12px;
      }

      .file-info-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
      }

      .file-info-empty {
        font-size: 13px;
        color: var(--text-muted);
        margin-top: 8px;
      }

      /* ---------- Envelope (खाम) print modal ---------- */
      .modal-box.envelope-box {
        max-width: 780px;
        text-align: left;
        max-height: 88vh;
        display: flex;
        flex-direction: column;
        padding-bottom: 0;
      }

      .modal-box.preview-box {
        max-width: 760px;
        text-align: left;
        max-height: 88vh;
        display: flex;
        flex-direction: column;
      }

      .preview-body {
        flex: 1;
        overflow: auto;
        margin-bottom: 14px;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: #f4f6f9;
        min-height: 200px;
        max-height: 65vh;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px;
      }

      [data-theme="dark"] .preview-body {
        background: #1a2536;
      }

      .preview-body img {
        max-width: 100%;
        max-height: 62vh;
        display: block;
        border-radius: 4px;
      }

      .preview-body iframe {
        width: 100%;
        height: 62vh;
        border: none;
        background: #fff;
        border-radius: 4px;
      }

      .preview-body .preview-doc-content {
        width: 100%;
        height: 62vh;
        overflow-y: auto;
        background: #fff;
        color: #1c2530;
        padding: 20px;
        border-radius: 4px;
        font-size: 14px;
        line-height: 1.6;
        text-align: left;
      }

      .preview-body .preview-unsupported {
        padding: 30px;
        text-align: center;
        color: var(--text-muted);
        font-size: 13.5px;
      }

      .envelope-scroll-area {
        overflow-y: auto;
        padding-right: 4px;
        margin-inline: -2px;
        padding-inline: 2px;
      }

      .envelope-subtitle {
        font-size: 12.5px;
        color: var(--text-muted);
        margin-bottom: 14px;
        margin-top: -6px;
        flex-shrink: 0;
      }

      .envelope-upload-box {
        margin-bottom: 16px;
        padding: 12px 14px;
        flex-shrink: 0;
      }

      .envelope-upload-box input[type="file"] {
        display: none;
      }

      .envelope-size-row {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 14px;
        flex-wrap: wrap;
        flex-shrink: 0;
      }

      .envelope-size-row .helper-text {
        margin: 0;
      }

      .envelope-size-tabs {
        display: inline-flex;
        border: 1px solid var(--border);
        border-radius: 8px;
        overflow: hidden;
      }

      .envelope-size-tabs button {
        border: none;
        background: var(--card);
        color: var(--text);
        padding: 7px 14px;
        font-size: 12.5px;
        cursor: pointer;
        font-family: inherit;
        font-weight: 600;
        opacity: 0.65;
      }

      .envelope-size-tabs button+button {
        border-inline-start: 1px solid var(--border);
      }

      .envelope-size-tabs button.active {
        background: linear-gradient(120deg, var(--secondary), #0b8f85);
        color: #fff;
        opacity: 1;
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
      }

      .envelope-stage {
        background: #dfe3e9;
        border-radius: 10px;
        padding: 22px;
        overflow-y: auto;
        overflow-x: hidden;
        margin-bottom: 14px;
        max-height: 46vh;
      }

      [data-theme="dark"] .envelope-stage {
        background: #060a12;
      }

      .envelope-surface {
        width: 100%;
        margin: 0 auto;
        box-sizing: border-box;
        min-height: 260px;
        background: #fffdf8;
        color: #1c2530;
        box-shadow: 0 0 0 1px #d8ccb0, 0 8px 20px -6px rgba(15, 23, 42, 0.12);
        border-radius: 4px;
        padding: 30px 34px;
        position: relative;
        font-size: 15px;
        line-height: 1.75;
        outline: none;
        overflow-wrap: break-word;
      }

      .envelope-surface.size-a4 {
        max-width: 900px;
        padding: 40px 46px;
      }

      .envelope-surface.size-dl {
        max-width: 640px;
      }

      .envelope-surface:focus {
        box-shadow: 0 0 0 2px var(--secondary), 0 8px 20px -6px rgba(15, 23, 42, 0.12);
      }

      /* अपलोड गरिएको मूल .docx खामको ढाँचा (तालिका/फन्ट/स्पेसिङ) जस्ताको त्यस्तै देखियोस् भनेर */
      .envelope-surface .docx-p {
        margin-bottom: 6px;
        min-height: 1.2em;
        overflow-wrap: break-word;
        word-break: break-word;
      }

      .envelope-surface .docx-table {
        border-collapse: collapse;
        width: 100%;
        margin: 6px 0;
        table-layout: fixed;
      }

      .envelope-surface .docx-table td {
        border: var(--docx-cell-border, 1px solid #94a3b8);
        padding: 6px 8px;
        vertical-align: top;
        overflow-wrap: break-word;
        word-break: break-word;
      }

      .envelope-surface .docx-run {
        outline: none;
        font-size: 10pt !important;
      }

      .envelope-surface .docx-p,
      .envelope-surface .docx-p * {
        font-size: 10pt !important;
      }

      .envelope-surface .docx-run:focus {
        background: rgba(15, 118, 110, 0.08);
        border-radius: 2px;
      }

      .envelope-surface .env-sender {
        font-size: 12.5px;
        margin-bottom: 46px;
        max-width: 58%;
        color: #3a3226;
      }

      .envelope-surface .env-sender b {
        color: var(--primary);
        display: block;
        font-size: 13.5px;
        margin-bottom: 2px;
      }

      .envelope-surface .env-stamp {
        position: absolute;
        top: 26px;
        right: 30px;
        width: 78px;
        height: 62px;
        border: 2px dashed #b8ac8a;
        border-radius: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 9.5px;
        color: #9c8f6e;
        text-align: center;
        padding: 4px;
      }

      .envelope-surface .env-recipient-wrap {
        display: flex;
        justify-content: flex-end;
      }

      .envelope-surface .env-recipient {
        max-width: 60%;
        font-size: 15px;
      }

      .envelope-surface .env-recipient b {
        display: block;
        margin-bottom: 4px;
        color: var(--primary);
        font-size: 15.5px;
      }

      .envelope-actions-row {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding: 14px 24px 20px;
        margin: 0 -24px;
        border-top: 1px solid var(--border);
        flex-shrink: 0;
        background: var(--card);
      }

      .envelope-actions-row .btn {
        width: auto;
        margin-top: 0;
        padding: 10px 16px;
      }

      .envelope-actions-row .btn-danger-outline {
        margin-inline-start: auto;
      }

      .envelope-print-only {
        display: none;
      }

      @media print {

        body.printing-envelope .container,
        body.printing-envelope .toast {
          display: none !important;
        }

        body.printing-envelope .envelope-print-only {
          display: block !important;
          width: 100%;
        }

        body.printing-envelope .envelope-print-only .envelope-surface {
          box-shadow: none !important;
          width: 100% !important;
          max-width: 100% !important;
          min-height: 0 !important;
        }
      }

      @media (max-width: 620px) {
        body {
          padding: 10px;
        }

        .container {
          max-width: 100%;
        }

        header.letterhead {
          flex-direction: row;
          align-items: center;
          padding: 14px 12px;
          gap: 10px;
        }

        .seal {
          width: 46px;
          height: 46px;
          font-size: 20px;
        }

        header .titles {
          flex: 1;
          text-align: center;
          min-width: 0;
        }

        header h1 {
          font-size: 15px;
          line-height: 1.3;
        }

        header p {
          font-size: 10.5px;
        }

        .header-right {
          align-items: flex-end;
          width: auto;
          flex-shrink: 0;
        }

        .header-actions {
          gap: 6px;
        }

        .header-icon-btn {
          width: 26px;
          height: 26px;
          font-size: 12px;
        }

        .main-layout {
          gap: 14px;
        }

        .sidebar {
          padding: 14px;
        }

        .section-title {
          font-size: 12px;
        }

        .radio-btn {
          padding: 9px 10px;
          font-size: 13px;
        }

        .editor-header {
          padding: 12px 14px;
        }

        .current-status {
          font-size: 13px;
        }

        .toolbar {
          padding: 6px 10px;
          gap: 2px;
        }

        .tb-btn,
        .tb-color-btn {
          width: 30px;
          height: 30px;
        }

        .word-page {
          padding: 20px 14px;
          width: 100%;
          font-size: 14.5px;
        }

        .word-page table {
          font-size: 12.5px;
        }

        .editor-footer {
          flex-direction: column;
          align-items: stretch;
          padding: 14px;
        }

        .editor-footer .btn-row {
          flex-direction: column;
        }

        .editor-footer .btn {
          width: 100%;
          font-size: 13px;
        }

        .modal-box {
          padding: 18px 16px;
        }

        .toast {
          left: 12px;
          right: 12px;
          width: auto;
        }

        .page-credit {
          font-size: 11px;
          padding: 14px 0 4px;
        }

        .credit-badge {
          padding: 5px 12px;
          gap: 5px;
        }
      }

      @media print {
        body {
          background: #fff;
          padding: 0;
        }

        .sidebar,
        .editor-header,
        .toolbar,
        .editor-footer,
        header.letterhead,
        .toast,
        .notes-box,
        .modal-overlay,
        .page-credit {
          display: none !important;
        }

        .main-layout {
          display: block;
        }

        .word-page {
          box-shadow: none;
          margin: 0;
          width: 100%;
          padding: 0;
        }
      }

    