* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', sans-serif;
    background: #f4f7fb;
    color: #111827;
}

a {
    text-decoration: none;
}

.app-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    width: 100%;
    height: 76px;
    padding: 0 32px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    font-size: 24px;
}

.brand-text {
    font-size: 20px;
    font-weight: 800;
    color: #111827;
}

.topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
}

.pdf-toolbar-top {
    display: flex;
    align-items: center;
    gap: 16px;
}

.pdf-toolbar-top span {
    font-size: 16px;
    font-weight: 800;
    color: #111827;
}

.secondary-btn {
    border: none;
    background: #eef2ff;
    color: #4338ca;
    font-weight: 800;
    padding: 11px 18px;
    border-radius: 16px;
    cursor: pointer;
}

#openSignatureBtn {
    background: linear-gradient(135deg, #14532d, #166534);
    color: #ffffff;
    padding: 12px 20px;
}

#openSignatureBtn:hover {
    background: linear-gradient(135deg, #064e3b, #14532d);
}

.main-content {
    flex: 1;
    height: calc(100vh - 76px);
    overflow: hidden;
    padding: 24px;
}

.sign-workspace {
    width: 100%;
    height: 100%;
}

.upload-center {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-card {
    width: 100%;
    max-width: 620px;
    background: #ffffff;
    border-radius: 28px;
    padding: 48px 42px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef2ff;
    color: #4338ca;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 24px;
}

.sign-title {
    font-size: 42px;
    line-height: 1.12;
    font-weight: 800;
    color: #111827;
    margin-bottom: 16px;
}

.sign-description {
    font-size: 17px;
    line-height: 1.5;
    color: #6b7280;
    margin-bottom: 30px;
}

.upload-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 24px;
    padding: 40px 24px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.upload-dropzone:hover {
    border-color: #7c3aed;
    background: #f5f3ff;
}

.upload-icon {
    font-size: 48px;
}

.upload-title {
    font-size: 20px;
    font-weight: 800;
    color: #111827;
}

.upload-text {
    font-size: 15px;
    color: #6b7280;
}

.hidden-file-input {
    display: none;
}

.viewer-panel {
    width: 100%;
    height: 100%;
    background: #eef2f7;
    border-radius: 24px;
    overflow: hidden;
}

.pdf-viewer {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 24px;
    background: #eef2f7;
}

.pdf-page-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.pdf-page {
    width: auto;
    max-width: 100%;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .topbar {
        height: auto;
        min-height: 76px;
        padding: 16px 18px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .topbar-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .pdf-toolbar-top {
        width: 100%;
        justify-content: space-between;
    }

    .main-content {
        height: calc(100vh - 118px);
        padding: 14px;
    }

    .upload-card {
        padding: 36px 24px;
        border-radius: 24px;
    }

    .sign-title {
        font-size: 32px;
    }

    .pdf-viewer {
        padding: 12px;
    }
}

.signature-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(8px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.signature-card {
    width: 100%;
    max-width: 720px;
    background: #ffffff;
    border-radius: 28px;
    padding: 24px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}

.signature-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.signature-header h2 {
    font-size: 28px;
    font-weight: 800;
    color: #111827;
}

.signature-header p {
    margin-top: 6px;
    color: #6b7280;
    font-size: 15px;
}

.icon-btn {
    border: none;
    background: #f1f5f9;
    color: #111827;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 800;
}

.signature-pad-wrap {
    width: 100%;
    height: 280px;
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 22px;
    overflow: hidden;
}

#signatureCanvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    cursor: crosshair;
}

.signature-actions {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.primary-action-btn {
    border: none;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #ffffff;
    font-weight: 800;
    padding: 12px 20px;
    border-radius: 16px;
    cursor: pointer;
}

@media (max-width: 768px) {
    .signature-card {
        padding: 18px;
        border-radius: 24px;
    }

    .signature-pad-wrap {
        height: 240px;
    }

    .signature-actions {
        flex-direction: column;
    }

    .signature-actions button {
        width: 100%;
    }
}

.placed-signature {
    position: absolute;
    width: 240px;
    max-width: 45%;
    height: auto;
    z-index: 10;
    cursor: move;
    user-select: none;
    pointer-events: auto;
}

.placed-signature-box {
    position: absolute;
    z-index: 20;
    cursor: move;
    user-select: none;
    touch-action: none;
}

.placed-signature {
    display: block;
    width: 240px;
    max-width: none;
    height: auto;
    pointer-events: none;
}

.signature-controls {
    position: absolute;
    top: -42px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 6px;
    align-items: center;
    justify-content: center;
    z-index: 25;
}

.placed-signature-box:hover .signature-controls,
.placed-signature-box.active-signature .signature-controls {
    display: flex;
}

.signature-control {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 999px;
    background: #ffffff;
    color: #111827;
    font-size: 18px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.22);
}

.signature-delete {
    background: #fee2e2;
    color: #991b1b;
}

.placed-signature-box {
    position: absolute !important;
    z-index: 50 !important;
    cursor: move;
    user-select: none;
    touch-action: none;
    border: 1px dashed transparent;
    padding: 4px;
}

.placed-signature-box:hover,
.placed-signature-box.active-signature {
    border-color: #2563eb;
}

.placed-signature-box .placed-signature {
    position: static !important;
    display: block !important;
    width: 240px;
    max-width: none !important;
    height: auto !important;
    pointer-events: none;
}

.signature-controls {
    position: absolute;
    top: -44px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 8px;
    z-index: 999;
}

.placed-signature-box:hover .signature-controls,
.placed-signature-box.active-signature .signature-controls {
    display: flex !important;
}

.signature-control {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 999px;
    background: #ffffff;
    color: #111827;
    font-size: 20px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.25);
}

.signature-delete {
    background: #fee2e2 !important;
    color: #991b1b !important;
}

.placed-signature-box {
    position: absolute !important;
    z-index: 50 !important;
    cursor: move;
    user-select: none;
    touch-action: none;
    border: 1px dashed transparent;
    padding: 4px;
}

.placed-signature-box:hover,
.placed-signature-box.active-signature {
    border-color: #2563eb;
}

.placed-signature-box .placed-signature {
    position: static !important;
    display: block !important;
    width: 240px;
    max-width: none !important;
    height: auto !important;
    pointer-events: none;
}

.signature-delete,
.signature-rotate {
    position: absolute;
    display: none;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 999px;
    font-size: 18px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.25);
    z-index: 80;
    align-items: center;
    justify-content: center;
}

.signature-delete {
    top: -18px;
    right: -18px;
    background: #fee2e2 !important;
    color: #991b1b !important;
}

.signature-rotate {
    top: -18px;
    left: -18px;
    background: #ffffff;
    color: #111827;
}

.signature-resize-handle {
    position: absolute;
    right: -8px;
    bottom: -8px;
    display: none;
    width: 18px;
    height: 18px;
    border-radius: 6px;
    background: #2563eb;
    border: 2px solid #ffffff;
    cursor: nwse-resize;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.25);
    z-index: 80;
}

.placed-signature-box:hover .signature-delete,
.placed-signature-box:hover .signature-resize-handle,
.placed-signature-box:hover .signature-rotate,
.placed-signature-box.active-signature .signature-delete,
.placed-signature-box.active-signature .signature-resize-handle,
.placed-signature-box.active-signature .signature-rotate {
    display: flex;
}

.signature-controls,
.signature-smaller,
.signature-bigger {
    display: none !important;
}

.success-page {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.success-card {
    width: 100%;
    max-width: 760px;
    background: #ffffff;
    border-radius: 28px;
    padding: 42px;
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

.success-icon {
    font-size: 34px;
    margin-bottom: 18px;
}

.success-card h1 {
    font-size: 38px;
    line-height: 1.12;
    font-weight: 900;
    color: #111827;
    margin-bottom: 12px;
}

.success-card p {
    font-size: 17px;
    color: #4b5563;
    line-height: 1.5;
    margin-bottom: 14px;
}

.success-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef2ff;
    color: #3730a3;
    font-weight: 900;
    padding: 12px 18px;
    border-radius: 16px;
    margin: 10px 0 22px;
}

.success-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.success-actions a,
.success-actions button {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.success-code-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0 22px;
    flex-wrap: wrap;
}

.copy-code-btn {
    border: none;
    background: #eef2ff;
    color: #4338ca;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    cursor: pointer;
    font-size: 20px;
    font-weight: 700;
}

.copy-code-btn:hover {
    background: #e0e7ff;
}

@media (max-width: 640px) {
    .success-page {
        padding: 8px 16px 24px;
        align-items: flex-start;
    }

    .success-card {
        margin-top: 0;
        padding: 26px 22px;
        border-radius: 28px;
        max-width: 100%;
    }

    .success-icon {
        font-size: 30px;
        margin-bottom: 14px;
    }

    .success-card h1 {
        font-size: 28px;
        line-height: 1.12;
        margin-bottom: 12px;
    }

    .success-card p {
        font-size: 16px;
        line-height: 1.42;
        margin-bottom: 16px;
    }

    .success-code-wrap {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 52px;
        gap: 10px;
        margin: 16px 0 24px;
    }

    .success-code {
        width: 100%;
        margin: 0;
        min-height: 52px;
        font-size: 16px;
    }

    .copy-code-btn {
        width: 52px;
        height: 52px;
        border-radius: 16px;
    }

    .success-actions {
        width: 100%;
        gap: 10px;
    }

    .success-actions a,
    .success-actions button {
        width: 100%;
        min-height: 52px;
        border-radius: 18px;
        font-size: 16px;
    }
}

/* =========================================================
   ADMIN PANEL
========================================================= */

.admin-page {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px;
}

.admin-header {
    margin-bottom: 28px;
}

.admin-header h1 {
    font-size: 42px;
    line-height: 1.1;
    font-weight: 900;
    color: #111827;
    margin-bottom: 10px;
}

.admin-header p {
    font-size: 17px;
    color: #6b7280;
    line-height: 1.5;
}

.admin-upload-card {
    width: 100%;
    background: #ffffff;
    border-radius: 28px;
    padding: 28px;
    margin-bottom: 28px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.admin-upload-card h2 {
    font-size: 24px;
    font-weight: 900;
    color: #111827;
    margin-bottom: 6px;
}

.admin-upload-card p {
    color: #6b7280;
    font-size: 15px;
}

.admin-upload-card input[type="file"] {
    flex: 1;
    min-width: 260px;
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 18px;
    padding: 14px;
    font-size: 15px;
}

.admin-upload-card button {
    border: none;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #ffffff;
    font-weight: 800;
    padding: 16px 24px;
    border-radius: 18px;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.admin-upload-card button:hover {
    transform: translateY(-1px);
}

.admin-table-card {
    width: 100%;
    background: #ffffff;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table thead {
    background: #f8fafc;
}

.admin-table th {
    text-align: left;
    padding: 18px 20px;
    font-size: 14px;
    font-weight: 800;
    color: #475569;
    border-bottom: 1px solid #e5e7eb;
}

.admin-table td {
    padding: 18px 20px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 15px;
    color: #111827;
    vertical-align: middle;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table a {
    color: #4338ca;
    font-weight: 700;
}

.admin-table a:hover {
    text-decoration: underline;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-signed {
    background: #dcfce7;
    color: #166534;
}

.admin-empty {
    width: 100%;
    background: #ffffff;
    border-radius: 28px;
    padding: 70px 24px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.admin-empty-icon {
    font-size: 58px;
    margin-bottom: 18px;
}

.admin-empty h2 {
    font-size: 30px;
    font-weight: 900;
    color: #111827;
    margin-bottom: 10px;
}

.admin-empty p {
    font-size: 16px;
    color: #6b7280;
}

@media (max-width: 980px) {

    .admin-header h1 {
        font-size: 34px;
    }

    .admin-upload-card {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-upload-card button {
        width: 100%;
    }

    .admin-table-card {
        overflow-x: auto;
    }

    .admin-table {
        min-width: 980px;
    }
}

@media (max-width: 640px) {

    .admin-page {
        padding: 4px;
    }

    .admin-header {
        margin-bottom: 22px;
    }

    .admin-header h1 {
        font-size: 28px;
    }

    .admin-header p {
        font-size: 15px;
    }

    .admin-upload-card {
        padding: 22px;
        border-radius: 24px;
    }

    .admin-upload-card h2 {
        font-size: 22px;
    }

    .admin-empty {
        padding: 50px 22px;
        border-radius: 24px;
    }

    .admin-empty h2 {
        font-size: 24px;
    }
}

/* ADMIN FORM FIX */

.admin-upload-card {
    display: grid !important;
    grid-template-columns: 360px 1fr auto;
    align-items: center;
    gap: 28px;
}

.admin-form-header {
    min-width: 280px;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
    width: 100%;
}

.admin-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.admin-field label {
    font-size: 14px;
    font-weight: 800;
    color: #374151;
}

.admin-field input,
.admin-field textarea {
    width: 100%;
    border: 1px solid #dbe3ef;
    background: #f8fafc;
    border-radius: 16px;
    padding: 13px 14px;
    font-family: inherit;
    font-size: 15px;
    color: #111827;
    outline: none;
}

.admin-field input:focus,
.admin-field textarea:focus {
    border-color: #7c3aed;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.10);
}

.admin-field textarea {
    resize: vertical;
    min-height: 92px;
}

.admin-submit-btn {
    min-width: 220px;
    height: 54px;
}

.document-title-cell {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.document-title-cell span {
    color: #6b7280;
    font-size: 14px;
    line-height: 1.35;
}

@media (max-width: 1100px) {
    .admin-upload-card {
        grid-template-columns: 1fr !important;
    }

    .admin-form-grid {
        grid-template-columns: 1fr;
    }

    .admin-submit-btn {
        width: 100%;
    }
}

/* ADMIN SCROLL FIX */

body:has(.admin-page) {
    overflow-y: auto;
}

body:has(.admin-page) .app-container {
    min-height: 100vh;
    height: auto;
}

body:has(.admin-page) .main-content {
    height: auto;
    min-height: calc(100vh - 76px);
    overflow: visible;
}

/* VERIFY PAGE */

.verify-page {
    width: 100%;
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.verify-card {
    width: 100%;
    max-width: 780px;
    background: #ffffff;
    border-radius: 28px;
    padding: 42px;
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

.verify-icon {
    font-size: 34px;
    margin-bottom: 18px;
}

.verify-card h1 {
    font-size: 38px;
    line-height: 1.12;
    font-weight: 900;
    color: #111827;
    margin-bottom: 12px;
}

.verify-description {
    font-size: 17px;
    color: #4b5563;
    line-height: 1.5;
    margin-bottom: 26px;
}

.verify-info {
    display: grid;
    gap: 14px;
    margin-bottom: 26px;
}

.verify-row {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 16px;
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 14px;
    align-items: start;
}

.verify-row span {
    color: #64748b;
    font-weight: 700;
}

.verify-row strong {
    color: #111827;
    font-weight: 900;
    word-break: break-word;
}

.verify-success {
    color: #15803d !important;
}

.verify-pending {
    color: #92400e !important;
}

.hash-value {
    font-size: 13px;
    line-height: 1.5;
    font-family: monospace;
}

.verify-download-btn {
    width: 100%;
    min-height: 52px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #ffffff;
    font-weight: 900;
}

@media (max-width: 640px) {
    .verify-page {
        padding: 12px;
        align-items: flex-start;
    }

    .verify-card {
        padding: 26px 20px;
        border-radius: 24px;
    }

    .verify-card h1 {
        font-size: 30px;
    }

    .verify-description {
        font-size: 15px;
    }

    .verify-row {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 14px;
    }

    .hash-value {
        font-size: 12px;
    }
}

/* VERIFY PAGE FIX */

body:has(.verify-page) {
    overflow-y: auto;
}

body:has(.verify-page) .app-container {
    min-height: 100vh;
    height: auto;
}

body:has(.verify-page) .main-content {
    height: auto;
    overflow: visible;
    min-height: calc(100vh - 76px);
}

.verify-page {
    padding: 20px;
    align-items: flex-start;
}

.verify-card {
    margin-top: 24px;
    padding: 32px;
}

.verify-icon {
    margin-bottom: 10px;
}

.verify-card h1 {
    margin-bottom: 10px;
}

.verify-description {
    margin-bottom: 18px;
}

.verify-info {
    gap: 10px;
    margin-bottom: 20px;
}

.verify-row {
    min-height: 58px;
    padding: 12px 16px;
    border-radius: 16px;
    align-items: center;
}

.verify-row span {
    font-size: 14px;
}

.verify-row strong {
    font-size: 15px;
}

.hash-value {
    font-size: 12px;
    line-height: 1.35;
}

.verify-download-btn {
    min-height: 48px;
    font-size: 15px;
}

@media (max-width: 640px) {

    .verify-page {
        padding: 10px;
    }

    .verify-card {
        margin-top: 8px;
        padding: 22px 16px;
    }

    .verify-card h1 {
        font-size: 28px;
    }

    .verify-row {
        padding: 12px;
        gap: 4px;
    }

    .verify-row strong {
        font-size: 14px;
    }
}

/* =========================================================
   LOGIN ADMIN
========================================================= */

body:has(.login-page) {
    overflow-y: auto;
}

body:has(.login-page) .app-container {
    min-height: 100vh;
    height: auto;
}

body:has(.login-page) .main-content {
    height: auto;
    overflow: visible;
    min-height: calc(100vh - 76px);
}

.login-page {
    width: 100%;
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 520px;
    background: #ffffff;
    border-radius: 32px;
    padding: 42px;
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

.login-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef2ff;
    color: #4338ca;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 22px;
}

.login-card h1 {
    font-size: 40px;
    line-height: 1.1;
    font-weight: 900;
    color: #111827;
    margin-bottom: 14px;
}

.login-description {
    font-size: 16px;
    line-height: 1.5;
    color: #6b7280;
    margin-bottom: 28px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-field label {
    font-size: 14px;
    font-weight: 800;
    color: #374151;
}

.login-field input {
    width: 100%;
    border: 1px solid #dbe3ef;
    background: #f8fafc;
    border-radius: 18px;
    padding: 15px 16px;
    font-family: inherit;
    font-size: 15px;
    color: #111827;
    outline: none;
}

.login-field input:focus {
    border-color: #7c3aed;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.10);
}

.login-submit-btn {
    width: 100%;
    min-height: 56px;
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #ffffff;
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    margin-top: 4px;
    transition: transform 0.15s ease;
}

.login-submit-btn:hover {
    transform: translateY(-1px);
}

.login-error {
    background: #fee2e2;
    color: #991b1b;
    border-radius: 18px;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 22px;
}

.admin-logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 16px;
    background: #f1f5f9;
    color: #111827;
    font-size: 14px;
    font-weight: 800;
    transition: all 0.2s ease;
}

.admin-logout-btn:hover {
    background: #e2e8f0;
}

@media (max-width: 640px) {

    .login-page {
        padding: 12px;
        align-items: flex-start;
    }

    .login-card {
        padding: 28px 22px;
        border-radius: 28px;
    }

    .login-card h1 {
        font-size: 32px;
    }

    .login-description {
        font-size: 15px;
    }
}

/* =========================================================
   REQUEST DETAILS
========================================================= */

body:has(.request-details-page) {
    overflow-y: auto;
}

body:has(.request-details-page) .app-container {
    min-height: 100vh;
    height: auto;
}

body:has(.request-details-page) .main-content {
    height: auto;
    overflow: visible;
    min-height: calc(100vh - 76px);
}

.request-details-page {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px;
}

.request-details-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.request-details-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef2ff;
    color: #4338ca;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 18px;
}

.request-details-header h1 {
    font-size: 42px;
    line-height: 1.08;
    font-weight: 900;
    color: #111827;
    margin-bottom: 12px;
}

.request-details-header p {
    font-size: 17px;
    color: #6b7280;
    line-height: 1.5;
}

.request-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    margin-bottom: 22px;
}

.request-card {
    width: 100%;
    background: #ffffff;
    border-radius: 28px;
    padding: 28px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.request-card h2 {
    font-size: 24px;
    font-weight: 900;
    color: #111827;
    margin-bottom: 22px;
}

.request-info-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.request-info-row {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 16px;
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 14px;
    align-items: start;
}

.request-info-row span {
    color: #64748b;
    font-size: 14px;
    font-weight: 700;
}

.request-info-row strong {
    color: #111827;
    font-size: 15px;
    font-weight: 900;
    word-break: break-word;
}

.hash-block {
    font-size: 12px !important;
    line-height: 1.45;
    font-family: monospace;
}

.request-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.request-action-btn {
    min-height: 52px;
    padding: 0 22px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #ffffff;
    font-size: 15px;
    font-weight: 900;
}

.secondary-request-btn {
    background: #eef2ff;
    color: #4338ca;
}

.secondary-request-btn:hover {
    background: #e0e7ff;
}

@media (max-width: 980px) {

    .request-details-grid {
        grid-template-columns: 1fr;
    }

    .request-details-header h1 {
        font-size: 34px;
    }
}

@media (max-width: 640px) {

    .request-details-page {
        padding: 4px;
    }

    .request-details-header {
        margin-bottom: 22px;
    }

    .request-details-header h1 {
        font-size: 28px;
    }

    .request-details-header p {
        font-size: 15px;
    }

    .request-card {
        padding: 22px;
        border-radius: 24px;
    }

    .request-card h2 {
        font-size: 22px;
    }

    .request-info-row {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 14px;
    }

    .request-actions {
        flex-direction: column;
    }

    .request-action-btn {
        width: 100%;
    }
}

/* =========================================================
   LANDING PAGE
========================================================= */

body:has(.landing-hero) {
    overflow-y: auto;
}

body:has(.landing-hero) .app-container {
    min-height: 100vh;
    height: auto;
}

body:has(.landing-hero) .main-content {
    height: auto;
    overflow: visible;
    min-height: calc(100vh - 76px);
}

.landing-hero {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 90px 24px 70px;
    text-align: center;
}

.landing-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef2ff;
    color: #4338ca;
    padding: 12px 20px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 26px;
}

.landing-title {
    font-size: 64px;
    line-height: 1.02;
    font-weight: 900;
    color: #111827;
    letter-spacing: -2px;
    margin-bottom: 24px;
}

.landing-description {
    max-width: 860px;
    margin: 0 auto 36px;
    font-size: 20px;
    line-height: 1.7;
    color: #6b7280;
}

.landing-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.landing-primary-btn {
    min-height: 56px;
    padding: 0 28px;
    border-radius: 18px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 900;
    transition: transform 0.18s ease;
}

.landing-primary-btn:hover {
    transform: translateY(-2px);
}

.landing-secondary-btn {
    min-height: 56px;
    padding: 0 28px;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #111827;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
}

.landing-features {
    width: 100%;
    max-width: 1250px;
    margin: 0 auto;
    padding: 0 24px 70px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
}

.feature-card {
    background: #ffffff;
    border-radius: 28px;
    padding: 34px 28px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.feature-icon {
    font-size: 34px;
    margin-bottom: 18px;
}

.feature-card h3 {
    font-size: 24px;
    line-height: 1.15;
    font-weight: 900;
    color: #111827;
    margin-bottom: 14px;
}

.feature-card p {
    font-size: 16px;
    line-height: 1.6;
    color: #6b7280;
}

.landing-bottom-cta {
    width: calc(100% - 48px);
    max-width: 1200px;
    margin: 0 auto 60px;
    background: linear-gradient(135deg, #111827, #1f2937);
    border-radius: 36px;
    padding: 70px 40px;
    text-align: center;
}

.landing-bottom-cta h2 {
    font-size: 48px;
    line-height: 1.08;
    font-weight: 900;
    color: #ffffff;
    margin-bottom: 20px;
}

.landing-bottom-cta p {
    max-width: 760px;
    margin: 0 auto 34px;
    font-size: 18px;
    line-height: 1.7;
    color: rgba(255,255,255,0.75);
}

.landing-bottom-cta .landing-primary-btn {
    background: #ffffff;
    color: #111827;
}

@media (max-width: 1100px) {

    .landing-title {
        font-size: 52px;
    }

    .landing-features {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {

    .landing-hero {
        padding: 50px 18px 40px;
    }

    .landing-title {
        font-size: 38px;
        letter-spacing: -1px;
    }

    .landing-description {
        font-size: 17px;
        line-height: 1.6;
    }

    .landing-actions {
        flex-direction: column;
    }

    .landing-primary-btn,
    .landing-secondary-btn {
        width: 100%;
    }

    .landing-features {
        grid-template-columns: 1fr;
        padding: 0 18px 40px;
    }

    .feature-card {
        border-radius: 24px;
        padding: 28px 22px;
    }

    .landing-bottom-cta {
        width: calc(100% - 24px);
        padding: 42px 22px;
        border-radius: 28px;
    }

    .landing-bottom-cta h2 {
        font-size: 34px;
    }

    .landing-bottom-cta p {
        font-size: 16px;
    }
}

/* =========================================================
   LANDING PREMIUM V2
========================================================= */

.landing-admin-link {
    min-height: 44px;
    padding: 0 18px;
    border-radius: 14px;
    background: #111827;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
}

.landing-premium-hero {
    position: relative;
    overflow: hidden;
    max-width: 1280px;
    padding-top: 70px;
}

.landing-glow {
    position: absolute;
    width: 700px;
    height: 700px;
    background: radial-gradient(
        circle,
        rgba(124, 58, 237, 0.16) 0%,
        rgba(79, 70, 229, 0.10) 30%,
        transparent 70%
    );
    top: -280px;
    right: -120px;
    pointer-events: none;
}

.landing-hero-grid {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 50px;
    align-items: center;
}

.landing-hero-copy {
    text-align: left;
}

.landing-hero-copy .landing-actions {
    justify-content: flex-start;
}

.landing-mockup {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mockup-window {
    width: 100%;
    max-width: 480px;
    background: #ffffff;
    border-radius: 30px;
    padding: 20px;
    box-shadow:
        0 30px 80px rgba(15, 23, 42, 0.12),
        0 10px 30px rgba(15, 23, 42, 0.08);
}

.mockup-dots {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
}

.mockup-dots span {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: #d1d5db;
}

.mockup-document {
    position: relative;
    background: #f8fafc;
    border-radius: 22px;
    padding: 28px;
    min-height: 430px;
    overflow: hidden;
}

.mockup-line {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: #dbe3ef;
    margin-bottom: 16px;
}

.mockup-line.wide {
    width: 82%;
}

.mockup-line.short {
    width: 48%;
}

.mockup-signature {
    position: absolute;
    left: 40px;
    bottom: 90px;
    background: #ffffff;
    border-radius: 18px;
    padding: 14px 18px;
    font-weight: 900;
    color: #1d4ed8;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
    transform: rotate(-4deg);
}

.mockup-qr {
    position: absolute;
    right: 32px;
    bottom: 38px;
    width: 72px;
    height: 72px;
    border-radius: 14px;
    background:
        linear-gradient(90deg, #111827 50%, transparent 50%),
        linear-gradient(#111827 50%, transparent 50%);
    background-size: 12px 12px;
    background-color: #ffffff;
    border: 6px solid #ffffff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 900;
    color: #111827;
}

.mockup-code {
    position: absolute;
    right: 30px;
    bottom: 122px;
    font-size: 13px;
    font-weight: 900;
    color: #374151;
}

.feature-card {
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.feature-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.10);
}

.landing-how {
    width: 100%;
    max-width: 1250px;
    margin: 0 auto;
    padding: 10px 24px 70px;
}

.landing-section-header {
    text-align: center;
    margin-bottom: 40px;
}

.landing-section-header span {
    display: inline-block;
    color: #4338ca;
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 12px;
}

.landing-section-header h2 {
    font-size: 52px;
    line-height: 1.05;
    font-weight: 900;
    color: #111827;
    margin-bottom: 16px;
}

.landing-section-header p {
    max-width: 720px;
    margin: 0 auto;
    font-size: 18px;
    line-height: 1.7;
    color: #6b7280;
}

.how-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}

.how-card {
    background: #ffffff;
    border-radius: 28px;
    padding: 34px 28px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.how-card strong {
    display: inline-flex;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: #eef2ff;
    color: #4338ca;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 18px;
}

.how-card h3 {
    font-size: 24px;
    font-weight: 900;
    margin-bottom: 12px;
}

.how-card p {
    color: #6b7280;
    line-height: 1.6;
}

.landing-verify-preview {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px 70px;
}

.verify-preview-card {
    background: #ffffff;
    border-radius: 36px;
    padding: 44px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

.verify-preview-icon {
    font-size: 36px;
    margin-bottom: 16px;
}

.verify-preview-card h2 {
    font-size: 42px;
    line-height: 1.08;
    font-weight: 900;
    margin-bottom: 12px;
}

.verify-preview-card p {
    color: #6b7280;
    margin-bottom: 28px;
    font-size: 17px;
}

.verify-preview-row {
    background: #f8fafc;
    border-radius: 18px;
    padding: 16px 18px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.verify-preview-row span {
    color: #64748b;
    font-weight: 700;
}

.verify-preview-row strong {
    color: #111827;
    font-weight: 900;
}

.landing-footer {
    width: 100%;
    padding: 0 24px 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.landing-footer strong {
    font-size: 18px;
    color: #111827;
}

.landing-footer span {
    color: #6b7280;
    font-size: 14px;
}

.landing-whatsapp-sticky {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 999;
    min-height: 54px;
    padding: 0 22px;
    border-radius: 999px;
    background: #22c55e;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    box-shadow: 0 14px 30px rgba(34, 197, 94, 0.30);
}

@media (max-width: 1100px) {

    .landing-hero-grid {
        grid-template-columns: 1fr;
    }

    .landing-hero-copy {
        text-align: center;
    }

    .landing-hero-copy .landing-actions {
        justify-content: center;
    }

    .how-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {

    .landing-premium-hero {
        padding-top: 30px;
    }

    .landing-section-header h2,
    .verify-preview-card h2 {
        font-size: 34px;
    }

    .mockup-window {
        max-width: 100%;
    }

    .verify-preview-card {
        padding: 28px 22px;
        border-radius: 28px;
    }

    .verify-preview-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .landing-whatsapp-sticky {
        left: 14px;
        right: 14px;
        bottom: 14px;
    }
}

/* =========================================================
   PHOTO SIGNATURE MODE
========================================================= */

.signature-mode-switch {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}

.signature-mode-switch button {
    flex: 1;
}

.active-sign-mode {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #ffffff;
}

.signature-photo-wrap {
    width: 100%;
}

.signature-photo-dropzone {
    min-height: 220px;
    justify-content: center;
}

.signature-photo-preview {
    margin-top: 18px;
    width: 100%;
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 22px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.signature-photo-preview img {
    max-width: 100%;
    max-height: 220px;
    object-fit: contain;
    display: block;
}

@media (max-width: 768px) {

    .signature-mode-switch {
        flex-direction: column;
    }

    .signature-photo-dropzone {
        min-height: 180px;
    }

    .signature-photo-preview img {
        max-height: 180px;
    }
}

/* =========================================================
   PHOTO SIGNATURE MODE
========================================================= */

.signature-mode-switch {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}

.signature-mode-switch button {
    flex: 1;
}

.active-sign-mode {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #ffffff;
}

.signature-photo-wrap {
    width: 100%;
}

.signature-photo-dropzone {
    min-height: 220px;
    justify-content: center;
}

.signature-photo-preview {
    margin-top: 18px;
    width: 100%;
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 22px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.signature-photo-preview img {
    max-width: 100%;
    max-height: 220px;
    object-fit: contain;
    display: block;
}

/* =========================================================
   SIGNATURE CROP MODAL
========================================================= */

.signature-crop-card {
    max-width: 900px;
}

.signature-crop-wrap {
    width: 100%;
}

.signature-crop-stage {
    position: relative;
    width: 100%;
    min-height: 420px;
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#signatureCropImage {
    max-width: 100%;
    max-height: 72vh;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    display: block;
}

.signature-crop-box {
    position: absolute;
    width: 260px;
    height: 120px;
    border: 2px solid #4f46e5;
    border-radius: 18px;
    background: rgba(79, 70, 229, 0.08);
    backdrop-filter: blur(1px);
    cursor: move;
    touch-action: none;
    box-shadow:
        0 0 0 9999px rgba(15, 23, 42, 0.45),
        0 10px 30px rgba(15, 23, 42, 0.18);
}

.signature-crop-handle {
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #ffffff;
    border: 3px solid #4f46e5;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
}

.crop-handle-tl {
    top: -10px;
    left: -10px;
    cursor: nwse-resize;
}

.crop-handle-tr {
    top: -10px;
    right: -10px;
    cursor: nesw-resize;
}

.crop-handle-bl {
    bottom: -10px;
    left: -10px;
    cursor: nesw-resize;
}

.crop-handle-br {
    bottom: -10px;
    right: -10px;
    cursor: nwse-resize;
}

.signature-crop-help {
    margin-top: 16px;
    text-align: center;
    font-size: 14px;
    line-height: 1.5;
    color: #6b7280;
}

@media (max-width: 768px) {

    .signature-mode-switch {
        flex-direction: column;
    }

    .signature-photo-dropzone {
        min-height: 180px;
    }

    .signature-photo-preview img {
        max-height: 180px;
    }

    .signature-crop-card {
        padding: 18px;
        border-radius: 24px;
    }

    .signature-crop-stage {
        min-height: 320px;
        border-radius: 20px;
    }

    .signature-crop-box {
        width: 200px;
        height: 100px;
    }

    .signature-crop-help {
        font-size: 13px;
    }
}