@import url('https://fonts.googleapis.com/css2?family=Arial:wght@400;700&display=swap');

        body {
            background-color: #333;
            font-family: 'Arial', sans-serif;
            margin: 0;
            padding: 20px;
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        /* Controls */
        .controls {
            background: #222;
            color: white;
            padding: 15px;
            border-radius: 6px;
            margin-bottom: 20px;
            display: flex;
            gap: 15px;
            align-items: flex-end;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
            font-family: sans-serif;
            z-index: 1000;
            flex-wrap: wrap;
            border: 1px solid #444;
        }

        .input-group {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .input-group label {
            font-size: 11px;
            text-transform: uppercase;
            font-weight: bold;
            color: #aaa;
        }

        input {
            padding: 8px;
            border-radius: 3px;
            border: 1px solid #555;
            font-size: 14px;
            background: #444;
            color: white;
            width: 160px;
        }

        button {
            background: #0078d4;
            color: white;
            border: none;
            padding: 9px 18px;
            font-size: 14px;
            font-weight: bold;
            border-radius: 3px;
            cursor: pointer;
            transition: background 0.2s;
        }

        button:hover {
            background: #005a9e;
        }

        .scan-btn {
            background: #e67e22;
        }

        .scan-btn:hover {
            background: #d35400;
        }

        .rand-btn {
            background: #27ae60;
        }

        .rand-btn:hover {
            background: #219150;
        }

        /* The Paper */
        .page-container {
            position: relative;
            background-color: white;
            width: 8.5in;
            height: 11in;
            box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
            overflow: hidden;
            border: 1px solid #dcdcdc;
            transition: transform 0.3s;
        }

        .page-content {
            padding: 0.5in;
            height: 100%;
            box-sizing: border-box;
            color: #000;
        }

        /* Scan Mode FX */
        .scan-overlay {
            display: none;
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            mix-blend-mode: multiply;
            background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.08'/%3E%3C/svg%3E");
            z-index: 100;
        }

        .scan-mode .page-container {
            filter: contrast(1.2) brightness(0.97) blur(0.4px);
            transform: rotate(-0.3deg);
        }

        .scan-mode .scan-overlay {
            display: block;
        }

        .scan-mode .page-content {
            color: #1a1a1a;
        }

        /* Layout */
        .row {
            display: flex;
            width: 100%;
            gap: 20px;
            margin-bottom: 12px;
        }

        .col {
            flex: 1;
        }

        /* Header Design */
        .header {
            display: flex;
            justify-content: space-between;
            align-items: flex-end;
            margin-bottom: 25px;
            border-bottom: 2px solid #000;
            padding-bottom: 10px;
        }

        .logo-section {
            display: flex;
            flex-direction: column;
            border: none;
            padding: 0;
            margin: 0;
        }

        .logo-section img {
            height: 65px;
            object-fit: contain;
            object-position: left bottom;
            margin-bottom: 2px;
            /* Clip the baked-in border from the image file */
            clip-path: inset(2px);
            transform: scale(1.02);
            /* Slight scale to compensate for clip */
        }

        .org-name {
            font-size: 11px;
            font-weight: bold;
            color: #333;
            margin-top: 5px;
            padding-left: 2px;
        }

        .doc-meta {
            text-align: right;
        }

        .doc-title {
            font-size: 22px;
            font-weight: bold;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .doc-subtitle {
            font-size: 10px;
            text-transform: uppercase;
            color: #666;
            margin-top: 2px;
        }

        /* Tables & Grids */
        .panel {
            border: 1px solid #888;
            margin-bottom: 12px;
        }

        .panel-header {
            background-color: #eee;
            padding: 4px 8px;
            font-weight: bold;
            border-bottom: 1px solid #888;
            font-size: 10px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .panel-body {
            padding: 6px 8px;
        }

        .info-grid {
            display: grid;
            grid-template-columns: auto 1fr;
            gap: 3px 15px;
            font-size: 10px;
        }

        .label {
            font-weight: bold;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            font-size: 9px;
        }

        th {
            background-color: #f4f4f4;
            border-bottom: 1px solid #000;
            text-align: left;
            padding: 3px 6px;
            font-weight: bold;
        }

        td {
            border-bottom: 1px solid #ddd;
            padding: 3px 6px;
        }

        .num {
            text-align: right;
            font-family: 'Courier New', monospace;
            font-weight: 600;
        }

        .total-row td {
            border-top: 1px solid #000;
            background-color: #f9f9f9;
            font-weight: bold;
        }

        /* Footer */
        .footer {
            position: absolute;
            bottom: 0.4in;
            left: 0.5in;
            right: 0.5in;
            border-top: 1px solid #ccc;
            padding-top: 5px;
            display: flex;
            justify-content: space-between;
            font-size: 7px;
            color: #666;
            font-family: 'Courier New', monospace;
        }

        @media print {
            body {
                background: white;
                padding: 0;
            }

            .controls {
                display: none;
            }

            .page-container {
                box-shadow: none;
                width: 100%;
                height: 100%;
                margin: 0;
                transform: none !important;
                border: none;
            }
        }

        .signature-box {
            position: absolute;
            bottom: 200px;
            right: 570px;
            text-align: center;
            width: 250px;
        }

        .signature-box img {
            height: 100px;
        }

        .letter-content {
            font-family: 'Times New Roman', serif;
            font-size: 12pt;
            line-height: 1.6;
            color: #000;
            padding: 40px;
        }

        .letter-header {
            text-align: center;
            margin-bottom: 20px;
        }