@font-face {
    font-family: 'Sarabun';
    src: url('../fonts/Sarabun-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Sarabun';
    src: url('../fonts/Sarabun-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ============================================================
   ระบบเกษียนหนังสือราชการด้วยการประทับตรา
   Custom CSS - Animations & Effects
   ============================================================ */

/* ── Theme tokens: ฟ้า-ขาว (school colours) ─────── */
:root {
    color-scheme: light;
    --sky-50: #f0f9ff;
    --sky-100: #e0f2fe;
    --sky-200: #bae6fd;
    --sky-300: #7dd3fc;
    --sky-400: #38bdf8;
    --sky-500: #0ea5e9;
    --sky-600: #0284c7;
    --sky-700: #0369a1;
    --blue-600: #2563eb;
    --ink: #0f2942;
    --ink-soft: #475569;
    --ink-muted: #64748b;
    --line: #e2e8f0;
    --line-sky: rgba(14, 165, 233, 0.18);
    --card: #ffffff;
    --shadow-sm: 0 1px 2px rgba(15, 41, 66, 0.04), 0 2px 8px rgba(2, 132, 199, 0.06);
    --shadow-md: 0 4px 12px rgba(15, 41, 66, 0.06), 0 12px 32px rgba(2, 132, 199, 0.10);
}

/* ── Base ─────────────────────────────────────── */
* { font-family: 'Sarabun', sans-serif; }
body {
    background:
        radial-gradient(1200px 500px at 100% -10%, rgba(56, 189, 248, 0.18), transparent 60%),
        radial-gradient(900px 400px at -10% 110%, rgba(37, 99, 235, 0.10), transparent 60%),
        linear-gradient(180deg, #f5fbff 0%, #eef6fd 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--ink-soft);
}

/* ── Cards (class names kept from the old glass theme) ── */
.glass {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--line-sky);
    border-radius: 1.25rem;
    box-shadow: var(--shadow-md);
}
.glass-light {
    background: var(--sky-50);
    border: 1px solid var(--line-sky);
    border-radius: 0.75rem;
}
.glass-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.glass-card:hover {
    border-color: var(--sky-200);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ── Sidebar ──────────────────────────────────── */
.sidebar {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--line-sky);
    transition: width 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: var(--sky-200) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--sky-200); border-radius: 4px; }

.sidebar-link {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.7rem 1rem; border-radius: 0.75rem;
    color: var(--ink-soft);
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 0.95rem;
}
.sidebar-link:hover {
    background: var(--sky-50);
    color: var(--sky-700);
    transform: translateX(4px);
}
.sidebar-link.active {
    background: linear-gradient(135deg, var(--sky-500), var(--blue-600));
    color: #fff;
    font-weight: 700;
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.28);
}

/* ── Stamp Styles ─────────────────────────────── */
.stamp-card {
    position: relative;
    cursor: pointer;
    padding: 1.5rem;
    border-radius: 1rem;
    border: 2px solid transparent;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}
.stamp-card::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.5), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.stamp-card:hover::before { opacity: 1; }
.stamp-card:hover {
    transform: scale(1.04);
    box-shadow: var(--shadow-md);
}
.stamp-card.selected {
    border-color: currentColor;
    transform: scale(1.06);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.18), var(--shadow-md);
}

/* ── Receipt Stamp (ตรารับหนังสือ) ────────────── */
.receipt-stamp {
    border: 3px solid #1a47b8;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    color: #1a47b8;
    font-weight: 600;
    position: relative;
    background: rgba(26, 71, 184, 0.05);
    transform: rotate(-2deg);
}
.receipt-stamp::after {
    content: '';
    position: absolute; inset: 3px;
    border: 1px solid rgba(26, 71, 184, 0.4);
    border-radius: 2px;
}

/* ── Stamp Animation ──────────────────────────── */
@keyframes stampPress {
    0% { transform: scale(3) rotate(-15deg); opacity: 0; }
    50% { transform: scale(0.9) rotate(2deg); opacity: 0.9; }
    70% { transform: scale(1.1) rotate(-1deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
@keyframes stampInk {
    0% { transform: scale(0); opacity: 0.6; }
    50% { transform: scale(1.5); opacity: 0.3; }
    100% { transform: scale(2); opacity: 0; }
}
@keyframes stampShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px) rotate(-1deg); }
    75% { transform: translateX(3px) rotate(1deg); }
}
.stamp-animate {
    animation: stampPress 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
}
.stamp-ink-effect {
    position: absolute;
    width: 100px; height: 100px;
    border-radius: 50%;
    animation: stampInk 0.8s ease-out forwards;
    pointer-events: none;
}
.stamp-shake {
    animation: stampShake 0.3s ease-in-out;
}

/* ── Endorsement Stamp Display ────────────────── */
.endorsement-stamp {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    border: 2px solid;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    position: relative;
    background: #fff;
}
.endorsement-stamp::before {
    content: '';
    position: absolute; inset: 2px;
    border: 1px solid;
    border-radius: 9999px;
    opacity: 0.3;
}

/* ── Timeline ─────────────────────────────────── */
.timeline-item {
    position: relative;
    padding-left: 2.5rem;
    padding-bottom: 2rem;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: 0.82rem;
    top: 2rem;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--sky-300), transparent);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
    position: absolute;
    left: 0;
    top: 0.25rem;
    width: 1.75rem; height: 1.75rem;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem;
    border: 2px solid;
    background: #fff;
    box-shadow: 0 0 0 4px var(--sky-50);
    z-index: 1;
}

/* ── Stats Cards ──────────────────────────────── */
.stat-card {
    position: relative;
    overflow: hidden;
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}
.stat-card::before {
    content: '';
    position: absolute;
    top: -50%; right: -50%;
    width: 100%; height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.35), transparent 70%);
    transform: rotate(45deg);
    pointer-events: none;
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}
.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    color: var(--ink);
}

/* ── Form Inputs ──────────────────────────────── */
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 0.75rem;
    color: var(--ink);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    outline: none;
}
.form-input:hover { border-color: var(--sky-300); }
.form-input:focus {
    border-color: var(--sky-500);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.15);
    background: #fff;
}
.form-input::placeholder { color: #94a3b8; }
select.form-input option { background: #fff; color: var(--ink); }
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: 0.5rem;
}

/* ── Buttons ──────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    outline: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
    background: linear-gradient(135deg, var(--sky-500), var(--blue-600));
    color: white;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.30);
}
.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.40);
    transform: translateY(-1px);
}
.btn-success {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.28);
}
.btn-success:hover { box-shadow: 0 6px 20px rgba(16, 185, 129, 0.38); transform: translateY(-1px); }
.btn-danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: white;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25);
}
.btn-danger:hover { box-shadow: 0 6px 20px rgba(220, 38, 38, 0.35); transform: translateY(-1px); }
.btn-outline {
    background: #fff;
    border: 1px solid #cbd5e1;
    color: var(--ink-soft);
}
.btn-outline:hover { background: var(--sky-50); border-color: var(--sky-300); color: var(--sky-700); }

/* ── Toast Notifications ──────────────────────── */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.toast {
    min-width: 320px;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: toastSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; align-items: center; gap: 0.75rem;
    color: #fff;
    font-weight: 500;
    box-shadow: 0 8px 28px rgba(15, 41, 66, 0.18);
}
.toast-success { background: rgba(5, 150, 105, 0.95); }
.toast-error { background: rgba(220, 38, 38, 0.95); }
.toast-info { background: rgba(2, 132, 199, 0.95); }
.toast-warning { background: rgba(217, 119, 6, 0.95); }
@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes toastSlideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ── Overlay ──────────────────────────────────── */
.overlay {
    position: fixed; inset: 0;
    background: rgba(15, 41, 66, 0.35);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: all 0.3s ease;
}
.overlay.active { opacity: 1; pointer-events: auto; }

.modal {
    background: #fff;
    border: 1px solid var(--line-sky);
    border-radius: 1.5rem;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    transform: scale(0.9); opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 24px 80px rgba(15, 41, 66, 0.25);
    color: var(--ink-soft);
}
.overlay.active .modal { transform: scale(1); opacity: 1; }

/* ── Table ────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.data-table thead th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sky-700);
    border-bottom: 1px solid var(--sky-100);
    background: var(--sky-50);
}
.data-table thead th:first-child { border-radius: 0.75rem 0 0 0; }
.data-table thead th:last-child { border-radius: 0 0.75rem 0 0; }
.data-table tbody tr {
    transition: all 0.15s ease;
}
.data-table tbody tr:hover {
    background: rgba(14, 165, 233, 0.05);
}
.data-table tbody td {
    padding: 0.875rem 1rem;
    font-size: 0.9rem;
    color: var(--ink-soft);
    border-bottom: 1px solid #f1f5f9;
}

/* ── Badge ────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    gap: 0.25rem;
}

/* ── Loading Spinner ──────────────────────────── */
@keyframes spin {
    to { transform: rotate(360deg); }
}
.spinner {
    width: 1.5rem; height: 1.5rem;
    border: 2px solid var(--sky-100);
    border-top-color: var(--sky-500);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ── Gradient Text ────────────────────────────── */
.gradient-text {
    background: linear-gradient(135deg, var(--sky-500), var(--blue-600));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Scrollbar ────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--sky-200); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--sky-300); }

/* ── Responsive ───────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); position: fixed; z-index: 40; width: 280px !important; box-shadow: var(--shadow-md); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0 !important; }
    .stat-number { font-size: 1.75rem; }
}

/* ── Pulse glow ───────────────────────────────── */
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 5px rgba(14, 165, 233, 0.3); }
    50% { box-shadow: 0 0 20px rgba(14, 165, 233, 0.55); }
}
.pulse-glow { animation: pulseGlow 2s ease-in-out infinite; }

/* ── Float animation ──────────────────────────── */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}
.float-animation { animation: float 3s ease-in-out infinite; }

/* ── Login page background ────────────────────── */
.login-bg {
    position: fixed; inset: 0;
    background: linear-gradient(160deg, #e0f2fe 0%, #f8fbff 45%, #dbeafe 100%);
    overflow: hidden;
}
.login-bg::before {
    content: '';
    position: absolute;
    width: 480px; height: 480px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.35), transparent 70%);
    top: 10%; left: 5%;
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}
.login-bg::after {
    content: '';
    position: absolute;
    width: 360px; height: 360px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.22), transparent 70%);
    bottom: 10%; right: 5%;
    border-radius: 50%;
    animation: float 8s ease-in-out infinite reverse;
}

/* ── File upload area ─────────────────────────── */
.upload-area {
    border: 2px dashed var(--sky-200);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    background: var(--sky-50);
    transition: all 0.3s ease;
    cursor: pointer;
}
.upload-area:hover, .upload-area.dragover {
    border-color: var(--sky-500);
    background: var(--sky-100);
}

/* ── Document Paper Preview ───────────────────── */
.paper-container {
    display: flex;
    justify-content: center;
    justify-content: safe center;
    overflow-x: auto;
    padding: 2rem 0;
}
.paper {
    width: 210mm;
    flex-shrink: 0;
    min-height: 297mm;
    background: #fff;
    color: #1a1a1a;
    padding: 20mm 25mm 25mm 30mm;
    position: relative;
    box-shadow: 0 4px 30px rgba(15,41,66,0.15);
    font-family: 'Sarabun', 'TH SarabunPSK', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    overflow: hidden;
}

/* ── Stamp Common: สีน้ำเงิน กรอบสี่เหลี่ยม ──── */
/* ตราประทับทั้ง 3 รูปแบบ: น้ำเงิน (#1a47b8) กรอบสี่เหลี่ยม */

/* ── Stamp 1: ตรารับหนังสือ (Receipt - มุมบนขวา) ── */
.stamp-receipt-box {
    position: absolute;
    top: 18mm;
    right: 20mm;
    width: 52mm;
    border: 3px solid #1a47b8;
    border-radius: 3px;
    padding: 6px 10px;
    text-align: center;
    color: #1a47b8;
    font-weight: 700;
    transform: rotate(-1.5deg);
    background: rgba(255,255,255,0.55);
    z-index: 5;
    font-size: 13px;
    box-shadow: 0 0 0 1.5px #fff, 0 0 0 3px rgba(26,71,184,0.08);
}
.stamp-receipt-box::before {
    content: '';
    position: absolute; inset: 2px;
    border: 1.5px solid rgba(26,71,184,0.35);
    border-radius: 2px;
    pointer-events: none;
}
.stamp-receipt-box .stamp-title {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.5px;
    border-bottom: 1.5px solid rgba(26,71,184,0.3);
    padding-bottom: 3px;
    margin-bottom: 4px;
}
.stamp-receipt-box .stamp-school {
    font-size: 12.5px;
    font-weight: 800;
    margin-bottom: 4px;
    padding-bottom: 3px;
    border-bottom: 1.5px solid rgba(26,71,184,0.3);
}
.stamp-receipt-box .stamp-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    line-height: 1.5;
}
.stamp-receipt-box .stamp-row .label {
    font-weight: 600;
    opacity: 0.7;
}
.stamp-receipt-box .stamp-row .value {
    font-weight: 800;
}
.stamp-receipt-box::after {
    content: '';
    position: absolute; inset: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
    pointer-events: none;
    mix-blend-mode: multiply;
    border-radius: 2px;
}

/* ── Stamp 2: เสนอเพื่อพิจารณา (Proposal - ล่างซ้าย) ── */
.stamp-proposal-box {
    position: absolute;
    bottom: 85mm;
    left: 25mm;
    width: 75mm;
    border: none;
    border-radius: 3px;
    padding: 10px 12px;
    color: #1a47b8;
    font-size: 12.5px;
    transform: rotate(0.5deg);
    background: rgba(255,255,255,0.55);
    z-index: 5;
    line-height: 1.55;
}
.stamp-proposal-box .stamp-title {
    font-size: 13.5px;
    font-weight: 800;
    text-align: center;
    border-bottom: 1.5px solid rgba(26,71,184,0.25);
    padding-bottom: 4px;
    margin-bottom: 6px;
    letter-spacing: 1px;
}
.stamp-proposal-box .stamp-to {
    font-weight: 700;
    margin-bottom: 4px;
    font-size: 12.5px;
}
.stamp-proposal-box .stamp-section {
    margin-bottom: 3px;
    font-size: 11.5px;
    line-height: 1.4;
    word-break: break-word;
}
.stamp-proposal-box .stamp-section .sec-label {
    font-weight: 700;
    font-size: 11px;
    opacity: 0.7;
}
.stamp-proposal-box .stamp-sign {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(26,71,184,0.2);
    font-size: 11.5px;
    text-align: center;
}
.stamp-proposal-box .stamp-sign .sign-name {
    font-weight: 700;
}
.stamp-proposal-box::after {
    content: '';
    position: absolute; inset: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    mix-blend-mode: multiply;
}

.stamp-resolution-box {
    position: absolute;
    bottom: 85mm;
    right: 20mm;
    width: 70mm;
    border: none;
    border-radius: 3px;
    padding: 10px 12px;
    text-align: center;
    color: #1a47b8;
    font-weight: 700;
    transform: rotate(-2deg);
    background: rgba(255,255,255,0.55);
    z-index: 5;
}
.stamp-resolution-box .res-body {
    text-align: left;
    font-size: 12.5px;
    line-height: 1.5;
    margin-bottom: 12px;
}
.stamp-resolution-box .res-sign {
    font-size: 12.5px;
    font-weight: 700;
    text-align: center;
}
.stamp-resolution-box .res-sign .sign-name {
    margin-bottom: 2px;
}
.stamp-resolution-box::after {
    content: '';
    position: absolute; inset: 0;
    border-radius: 2px;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    mix-blend-mode: multiply;
}

.stamp-ack-box {
    position: absolute;
    width: 45mm;
    border: none;
    border-radius: 3px;
    padding: 5px 8px;
    color: #1a47b8;
    font-weight: 700;
    transform: rotate(-1deg);
    background: rgba(255,255,255,0.55);
    z-index: 5;
}
.stamp-ack-box .ack-body {
    text-align: left;
    font-size: 12px;
    line-height: 1.25;
    margin-bottom: 1px;
}
.stamp-ack-box .ack-sign {
    min-height: 26px;
    font-weight: 700;
    text-align: center;
}
.stamp-ack-box .sign-name {
    margin-bottom: 2px;
}

/* ── Paper document text ─────────────────────── */
.paper-header { text-align: center; margin-bottom: 18px; }
.paper-header .garuda { width: 60px; margin: 0 auto 4px; opacity: 0.85; }
.paper-header .agency { font-size: 14px; font-weight: 600; }
.paper-header .address { font-size: 13px; color: #444; }
.paper-meta { font-size: 14px; margin-bottom: 10px; }
.paper-body { font-size: 15px; text-indent: 2.5em; margin-bottom: 8px; }
.paper-sign { text-align: center; margin-top: 30px; font-size: 14px; }

/* ── Print styles ─────────────────────────────── */
@media print {
    .sidebar, nav, .no-print, #toast-notification { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }
    .main-content > div { padding: 0 !important; margin: 0 !important; }
    body { background: white !important; color: black !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .paper-container { padding: 0 !important; justify-content: flex-start; overflow: visible !important; }
    .paper { box-shadow: none !important; margin: 0; width: 100%; min-height: auto; }
    .stamp-receipt-box, .stamp-proposal-box, .stamp-resolution-box {
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
}

/* ── Stat card colour accent (set --accent inline) ── */
.stat-card[style*="--accent"]::after {
    content: '';
    position: absolute; left: 0; right: 0; top: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 40%, #fff));
}

/* ── Dark theme components ───────────────────── */
html[data-theme="dark"] {
    color-scheme: dark;
    --ink: #e6f0fa;
    --ink-soft: #b4c3d4;
    --ink-muted: #8b9bb0;
    --line: rgba(148, 163, 184, 0.14);
    --line-sky: rgba(56, 189, 248, 0.18);
    --card: #12263c;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25), 0 2px 10px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.3), 0 14px 40px rgba(2, 132, 199, 0.12);
}
html[data-theme="dark"] body {
    background:
        radial-gradient(1200px 500px at 100% -10%, rgba(14, 165, 233, 0.16), transparent 60%),
        radial-gradient(900px 400px at -10% 110%, rgba(37, 99, 235, 0.12), transparent 60%),
        linear-gradient(180deg, #0a1828 0%, #0b1a2c 100%);
    background-attachment: fixed;
}
html[data-theme="dark"] .glass { background: rgba(18, 38, 60, 0.92); }
html[data-theme="dark"] .glass-light { background: rgba(56, 189, 248, 0.07); }
html[data-theme="dark"] .glass-card:hover { border-color: rgba(56, 189, 248, 0.35); }
html[data-theme="dark"] .topnav {
    background: rgba(11, 26, 44, 0.85) !important;
    border-bottom-color: rgba(56, 189, 248, 0.14) !important;
    box-shadow: 0 1px 12px rgba(0, 0, 0, 0.3) !important;
}
html[data-theme="dark"] .sidebar { background: rgba(11, 26, 44, 0.96); }
html[data-theme="dark"] .sidebar-link:hover { background: rgba(56, 189, 248, 0.10); color: #7dd3fc; }
html[data-theme="dark"] .sidebar-link.active { color: #fff; }
html[data-theme="dark"] .form-input {
    background: rgba(8, 20, 34, 0.7);
    border-color: rgba(148, 163, 184, 0.22);
}
html[data-theme="dark"] .form-input:hover { border-color: rgba(56, 189, 248, 0.45); }
html[data-theme="dark"] .form-input:focus { background: rgba(8, 20, 34, 0.9); border-color: #38bdf8; }
html[data-theme="dark"] .form-input::placeholder { color: #5f7189; }
html[data-theme="dark"] select.form-input option { background: #12263c; color: #e6f0fa; }
html[data-theme="dark"] .btn-outline { background: transparent; border-color: rgba(148, 163, 184, 0.28); color: #b4c3d4; }
html[data-theme="dark"] .btn-outline:hover { background: rgba(56, 189, 248, 0.10); border-color: rgba(56, 189, 248, 0.45); color: #7dd3fc; }
html[data-theme="dark"] .overlay { background: rgba(0, 0, 0, 0.55); }
html[data-theme="dark"] .modal { background: #12263c; }
html[data-theme="dark"] .data-table thead th { background: rgba(56, 189, 248, 0.07); color: #7dd3fc; border-bottom-color: rgba(56, 189, 248, 0.15); }
html[data-theme="dark"] .data-table tbody td { border-bottom-color: rgba(148, 163, 184, 0.08); }
html[data-theme="dark"] .data-table tbody tr:hover { background: rgba(56, 189, 248, 0.06); }
html[data-theme="dark"] .timeline-dot { background: #12263c; box-shadow: 0 0 0 4px #0b1a2c; }
html[data-theme="dark"] .endorsement-stamp { background: rgba(255, 255, 255, 0.04); }
html[data-theme="dark"] .upload-area { background: rgba(56, 189, 248, 0.05); border-color: rgba(56, 189, 248, 0.25); }
html[data-theme="dark"] .upload-area:hover, html[data-theme="dark"] .upload-area.dragover { background: rgba(56, 189, 248, 0.12); border-color: #38bdf8; }
html[data-theme="dark"] .spinner { border-color: rgba(56, 189, 248, 0.15); border-top-color: #38bdf8; }
html[data-theme="dark"] .login-bg { background: linear-gradient(160deg, #0a1828 0%, #0e2238 50%, #0a1828 100%); }
html[data-theme="dark"] .login-bg::before { background: radial-gradient(circle, rgba(14, 165, 233, 0.22), transparent 70%); }
html[data-theme="dark"] .login-bg::after { background: radial-gradient(circle, rgba(37, 99, 235, 0.18), transparent 70%); }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(56, 189, 248, 0.25); }
html[data-theme="dark"] .paper { box-shadow: 0 4px 40px rgba(0, 0, 0, 0.5); }
/* Stamp miniatures drawn on cards keep their paper look */
html[data-theme="dark"] .receipt-stamp { background: #fff; }

/* ── Theme toggle button ─────────────────────── */
.theme-toggle {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.25rem; height: 2.25rem;
    border-radius: 0.6rem;
    color: var(--ink-soft);
    transition: background 0.2s ease, color 0.2s ease;
}
.theme-toggle:hover { background: var(--sky-100); color: var(--sky-700); }
html[data-theme="dark"] .theme-toggle:hover { background: rgba(56, 189, 248, 0.12); color: #7dd3fc; }
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.theme-toggle-floating {
    position: fixed; top: 1rem; right: 1rem; z-index: 20;
    background: var(--card);
    border: 1px solid var(--line-sky);
    box-shadow: var(--shadow-sm);
}

/* ── Dark theme: Tailwind colour utilities ───── */
html[data-theme="dark"] .text-slate-800:not(.paper *) { color: #e6f0fa; }
html[data-theme="dark"] .text-slate-700:not(.paper *) { color: #cbd8e6; }
html[data-theme="dark"] .text-slate-600:not(.paper *) { color: #a7b6c8; }
html[data-theme="dark"] .text-slate-500:not(.paper *) { color: #8b9bb0; }
html[data-theme="dark"] .text-slate-400:not(.paper *) { color: #66788f; }
html[data-theme="dark"] .hover\:text-slate-800:hover:not(.paper *) { color: #ffffff; }
html[data-theme="dark"] .bg-white:not(.paper *) { background-color: #142a42; }
html[data-theme="dark"] .bg-slate-50:not(.paper *) { background-color: rgba(255,255,255,0.03); }
html[data-theme="dark"] .bg-slate-100:not(.paper *) { background-color: rgba(255,255,255,0.07); }
html[data-theme="dark"] .border-slate-200:not(.paper *),
html[data-theme="dark"] .border-sky-100:not(.paper *) { border-color: rgba(148,163,184,0.16); }
html[data-theme="dark"] .border-slate-300:not(.paper *) { border-color: rgba(148,163,184,0.26); }
html[data-theme="dark"] .divide-slate-100:not(.paper *) > :not([hidden]) ~ :not([hidden]) { border-color: rgba(148,163,184,0.12); }
html[data-theme="dark"] .text-sky-600:not(.paper *),
html[data-theme="dark"] .text-sky-700:not(.paper *),
html[data-theme="dark"] .text-sky-800:not(.paper *) { color: rgb(125,211,252); }
html[data-theme="dark"] .hover\:text-sky-700:hover:not(.paper *),
html[data-theme="dark"] .hover\:text-sky-800:hover:not(.paper *),
html[data-theme="dark"] .group:hover .group-hover\:text-sky-700:not(.paper *) { color: rgb(125,211,252); filter: brightness(1.15); }
html[data-theme="dark"] .bg-sky-50:not(.paper *),
html[data-theme="dark"] .hover\:bg-sky-50:hover:not(.paper *) { background-color: rgba(14,165,233,0.10); }
html[data-theme="dark"] .bg-sky-100:not(.paper *),
html[data-theme="dark"] .hover\:bg-sky-100:hover:not(.paper *) { background-color: rgba(14,165,233,0.18); }
html[data-theme="dark"] .border-sky-200:not(.paper *),
html[data-theme="dark"] .border-sky-300:not(.paper *) { border-color: rgba(56,189,248,0.35); }
html[data-theme="dark"] .text-blue-600:not(.paper *),
html[data-theme="dark"] .text-blue-700:not(.paper *),
html[data-theme="dark"] .text-blue-800:not(.paper *) { color: rgb(147,197,253); }
html[data-theme="dark"] .hover\:text-blue-700:hover:not(.paper *),
html[data-theme="dark"] .hover\:text-blue-800:hover:not(.paper *),
html[data-theme="dark"] .group:hover .group-hover\:text-blue-700:not(.paper *) { color: rgb(147,197,253); filter: brightness(1.15); }
html[data-theme="dark"] .bg-blue-50:not(.paper *),
html[data-theme="dark"] .hover\:bg-blue-50:hover:not(.paper *) { background-color: rgba(59,130,246,0.10); }
html[data-theme="dark"] .bg-blue-100:not(.paper *),
html[data-theme="dark"] .hover\:bg-blue-100:hover:not(.paper *) { background-color: rgba(59,130,246,0.18); }
html[data-theme="dark"] .border-blue-200:not(.paper *),
html[data-theme="dark"] .border-blue-300:not(.paper *) { border-color: rgba(96,165,250,0.35); }
html[data-theme="dark"] .text-violet-600:not(.paper *),
html[data-theme="dark"] .text-violet-700:not(.paper *),
html[data-theme="dark"] .text-violet-800:not(.paper *) { color: rgb(196,181,253); }
html[data-theme="dark"] .hover\:text-violet-700:hover:not(.paper *),
html[data-theme="dark"] .hover\:text-violet-800:hover:not(.paper *),
html[data-theme="dark"] .group:hover .group-hover\:text-violet-700:not(.paper *) { color: rgb(196,181,253); filter: brightness(1.15); }
html[data-theme="dark"] .bg-violet-50:not(.paper *),
html[data-theme="dark"] .hover\:bg-violet-50:hover:not(.paper *) { background-color: rgba(139,92,246,0.10); }
html[data-theme="dark"] .bg-violet-100:not(.paper *),
html[data-theme="dark"] .hover\:bg-violet-100:hover:not(.paper *) { background-color: rgba(139,92,246,0.18); }
html[data-theme="dark"] .border-violet-200:not(.paper *),
html[data-theme="dark"] .border-violet-300:not(.paper *) { border-color: rgba(167,139,250,0.35); }
html[data-theme="dark"] .text-purple-600:not(.paper *),
html[data-theme="dark"] .text-purple-700:not(.paper *),
html[data-theme="dark"] .text-purple-800:not(.paper *) { color: rgb(216,180,254); }
html[data-theme="dark"] .hover\:text-purple-700:hover:not(.paper *),
html[data-theme="dark"] .hover\:text-purple-800:hover:not(.paper *),
html[data-theme="dark"] .group:hover .group-hover\:text-purple-700:not(.paper *) { color: rgb(216,180,254); filter: brightness(1.15); }
html[data-theme="dark"] .bg-purple-50:not(.paper *),
html[data-theme="dark"] .hover\:bg-purple-50:hover:not(.paper *) { background-color: rgba(168,85,247,0.10); }
html[data-theme="dark"] .bg-purple-100:not(.paper *),
html[data-theme="dark"] .hover\:bg-purple-100:hover:not(.paper *) { background-color: rgba(168,85,247,0.18); }
html[data-theme="dark"] .border-purple-200:not(.paper *),
html[data-theme="dark"] .border-purple-300:not(.paper *) { border-color: rgba(192,132,252,0.35); }
html[data-theme="dark"] .text-red-600:not(.paper *),
html[data-theme="dark"] .text-red-700:not(.paper *),
html[data-theme="dark"] .text-red-800:not(.paper *) { color: rgb(252,165,165); }
html[data-theme="dark"] .hover\:text-red-700:hover:not(.paper *),
html[data-theme="dark"] .hover\:text-red-800:hover:not(.paper *),
html[data-theme="dark"] .group:hover .group-hover\:text-red-700:not(.paper *) { color: rgb(252,165,165); filter: brightness(1.15); }
html[data-theme="dark"] .bg-red-50:not(.paper *),
html[data-theme="dark"] .hover\:bg-red-50:hover:not(.paper *) { background-color: rgba(239,68,68,0.10); }
html[data-theme="dark"] .bg-red-100:not(.paper *),
html[data-theme="dark"] .hover\:bg-red-100:hover:not(.paper *) { background-color: rgba(239,68,68,0.18); }
html[data-theme="dark"] .border-red-200:not(.paper *),
html[data-theme="dark"] .border-red-300:not(.paper *) { border-color: rgba(248,113,113,0.35); }
html[data-theme="dark"] .text-emerald-600:not(.paper *),
html[data-theme="dark"] .text-emerald-700:not(.paper *),
html[data-theme="dark"] .text-emerald-800:not(.paper *) { color: rgb(110,231,183); }
html[data-theme="dark"] .hover\:text-emerald-700:hover:not(.paper *),
html[data-theme="dark"] .hover\:text-emerald-800:hover:not(.paper *),
html[data-theme="dark"] .group:hover .group-hover\:text-emerald-700:not(.paper *) { color: rgb(110,231,183); filter: brightness(1.15); }
html[data-theme="dark"] .bg-emerald-50:not(.paper *),
html[data-theme="dark"] .hover\:bg-emerald-50:hover:not(.paper *) { background-color: rgba(16,185,129,0.10); }
html[data-theme="dark"] .bg-emerald-100:not(.paper *),
html[data-theme="dark"] .hover\:bg-emerald-100:hover:not(.paper *) { background-color: rgba(16,185,129,0.18); }
html[data-theme="dark"] .border-emerald-200:not(.paper *),
html[data-theme="dark"] .border-emerald-300:not(.paper *) { border-color: rgba(52,211,153,0.35); }
html[data-theme="dark"] .text-green-600:not(.paper *),
html[data-theme="dark"] .text-green-700:not(.paper *),
html[data-theme="dark"] .text-green-800:not(.paper *) { color: rgb(134,239,172); }
html[data-theme="dark"] .hover\:text-green-700:hover:not(.paper *),
html[data-theme="dark"] .hover\:text-green-800:hover:not(.paper *),
html[data-theme="dark"] .group:hover .group-hover\:text-green-700:not(.paper *) { color: rgb(134,239,172); filter: brightness(1.15); }
html[data-theme="dark"] .bg-green-50:not(.paper *),
html[data-theme="dark"] .hover\:bg-green-50:hover:not(.paper *) { background-color: rgba(34,197,94,0.10); }
html[data-theme="dark"] .bg-green-100:not(.paper *),
html[data-theme="dark"] .hover\:bg-green-100:hover:not(.paper *) { background-color: rgba(34,197,94,0.18); }
html[data-theme="dark"] .border-green-200:not(.paper *),
html[data-theme="dark"] .border-green-300:not(.paper *) { border-color: rgba(74,222,128,0.35); }
html[data-theme="dark"] .text-amber-600:not(.paper *),
html[data-theme="dark"] .text-amber-700:not(.paper *),
html[data-theme="dark"] .text-amber-800:not(.paper *) { color: rgb(252,211,77); }
html[data-theme="dark"] .hover\:text-amber-700:hover:not(.paper *),
html[data-theme="dark"] .hover\:text-amber-800:hover:not(.paper *),
html[data-theme="dark"] .group:hover .group-hover\:text-amber-700:not(.paper *) { color: rgb(252,211,77); filter: brightness(1.15); }
html[data-theme="dark"] .bg-amber-50:not(.paper *),
html[data-theme="dark"] .hover\:bg-amber-50:hover:not(.paper *) { background-color: rgba(245,158,11,0.10); }
html[data-theme="dark"] .bg-amber-100:not(.paper *),
html[data-theme="dark"] .hover\:bg-amber-100:hover:not(.paper *) { background-color: rgba(245,158,11,0.18); }
html[data-theme="dark"] .border-amber-200:not(.paper *),
html[data-theme="dark"] .border-amber-300:not(.paper *) { border-color: rgba(251,191,36,0.35); }
html[data-theme="dark"] .text-orange-600:not(.paper *),
html[data-theme="dark"] .text-orange-700:not(.paper *),
html[data-theme="dark"] .text-orange-800:not(.paper *) { color: rgb(253,186,116); }
html[data-theme="dark"] .hover\:text-orange-700:hover:not(.paper *),
html[data-theme="dark"] .hover\:text-orange-800:hover:not(.paper *),
html[data-theme="dark"] .group:hover .group-hover\:text-orange-700:not(.paper *) { color: rgb(253,186,116); filter: brightness(1.15); }
html[data-theme="dark"] .bg-orange-50:not(.paper *),
html[data-theme="dark"] .hover\:bg-orange-50:hover:not(.paper *) { background-color: rgba(249,115,22,0.10); }
html[data-theme="dark"] .bg-orange-100:not(.paper *),
html[data-theme="dark"] .hover\:bg-orange-100:hover:not(.paper *) { background-color: rgba(249,115,22,0.18); }
html[data-theme="dark"] .border-orange-200:not(.paper *),
html[data-theme="dark"] .border-orange-300:not(.paper *) { border-color: rgba(251,146,60,0.35); }
html[data-theme="dark"] .text-pink-600:not(.paper *),
html[data-theme="dark"] .text-pink-700:not(.paper *),
html[data-theme="dark"] .text-pink-800:not(.paper *) { color: rgb(249,168,212); }
html[data-theme="dark"] .hover\:text-pink-700:hover:not(.paper *),
html[data-theme="dark"] .hover\:text-pink-800:hover:not(.paper *),
html[data-theme="dark"] .group:hover .group-hover\:text-pink-700:not(.paper *) { color: rgb(249,168,212); filter: brightness(1.15); }
html[data-theme="dark"] .bg-pink-50:not(.paper *),
html[data-theme="dark"] .hover\:bg-pink-50:hover:not(.paper *) { background-color: rgba(236,72,153,0.10); }
html[data-theme="dark"] .bg-pink-100:not(.paper *),
html[data-theme="dark"] .hover\:bg-pink-100:hover:not(.paper *) { background-color: rgba(236,72,153,0.18); }
html[data-theme="dark"] .border-pink-200:not(.paper *),
html[data-theme="dark"] .border-pink-300:not(.paper *) { border-color: rgba(244,114,182,0.35); }
html[data-theme="dark"] .text-slate-600:not(.paper *),
html[data-theme="dark"] .text-slate-700:not(.paper *),
html[data-theme="dark"] .text-slate-800:not(.paper *) { color: rgb(203,213,225); }
html[data-theme="dark"] .hover\:text-slate-700:hover:not(.paper *),
html[data-theme="dark"] .hover\:text-slate-800:hover:not(.paper *),
html[data-theme="dark"] .group:hover .group-hover\:text-slate-700:not(.paper *) { color: rgb(203,213,225); filter: brightness(1.15); }
html[data-theme="dark"] .bg-slate-50:not(.paper *),
html[data-theme="dark"] .hover\:bg-slate-50:hover:not(.paper *) { background-color: rgba(100,116,139,0.10); }
html[data-theme="dark"] .bg-slate-100:not(.paper *),
html[data-theme="dark"] .hover\:bg-slate-100:hover:not(.paper *) { background-color: rgba(100,116,139,0.18); }
html[data-theme="dark"] .border-slate-200:not(.paper *),
html[data-theme="dark"] .border-slate-300:not(.paper *) { border-color: rgba(148,163,184,0.35); }
html[data-theme="dark"] .text-sky-700\/80:not(.paper *) { color: rgba(125,211,252,0.8); }

/* No colour animation while the theme is being switched */
.theme-switching *, .theme-switching *::before, .theme-switching *::after { transition: none !important; }
/* Pastel stamp choices sit a little softer on the dark background */
html[data-theme="dark"] .stamp-card { filter: brightness(0.93); }
