/* ── Agent Portal Styles ───────────────────────────────────────────────────── */

:root {
    --ap-primary:     #1d4ed8;
    --ap-primary-h:   #1e40af;
    --ap-danger:      #dc2626;
    --ap-success:     #16a34a;
    --ap-warning:     #d97706;
    --ap-text:        #111827;
    --ap-text-muted:  #6b7280;
    --ap-border:      #e5e7eb;
    --ap-bg:          #f9fafb;
    --ap-surface:     #ffffff;
    --ap-radius:      10px;
    --ap-shadow:      0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
    --ap-shadow-md:   0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

.ap-wrap { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; color: var(--ap-text); }

/* ── Login ─────────────────────────────────────────────────────────────────── */
.ap-wrap--login {
    display: flex; justify-content: center; align-items: flex-start;
    padding: 48px 16px; min-height: 60vh;
}
.ap-login-card {
    background: var(--ap-surface); border: 1px solid var(--ap-border);
    border-radius: 16px; box-shadow: var(--ap-shadow-md);
    width: 100%; max-width: 420px; padding: 40px 36px;
}
.ap-login-brand { text-align: center; margin-bottom: 28px; }
.ap-login-title { font-size: 1.6rem; font-weight: 700; margin: 12px 0 4px; }
.ap-login-subtitle { color: var(--ap-text-muted); font-size: .9rem; margin: 0; }

.ap-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.ap-field label { font-size: .85rem; font-weight: 600; color: var(--ap-text); }
.ap-field input[type="text"],
.ap-field input[type="password"] {
    padding: 10px 14px; border: 1px solid var(--ap-border); border-radius: var(--ap-radius);
    font-size: .95rem; width: 100%; box-sizing: border-box; transition: border-color .15s;
}
.ap-field input:focus { outline: none; border-color: var(--ap-primary); box-shadow: 0 0 0 3px rgba(29,78,216,.15); }
.ap-field--check { flex-direction: row; align-items: center; }
.ap-field--check label { font-weight: 400; font-size: .85rem; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.ap-field-pass { position: relative; }
.ap-field-pass input { width: 100%; box-sizing: border-box; padding-right: 44px; }
.ap-toggle-pass {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; color: var(--ap-text-muted); padding: 4px;
}
.ap-toggle-pass svg { width: 18px; height: 18px; }

.ap-login-footer { text-align: center; margin-top: 16px; font-size: .85rem; }
.ap-login-footer a { color: var(--ap-primary); text-decoration: none; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.ap-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: var(--ap-radius); font-size: .9rem;
    font-weight: 600; cursor: pointer; border: 1px solid transparent;
    transition: background .15s, transform .1s, box-shadow .15s; text-decoration: none;
}
.ap-btn:active { transform: scale(.98); }
.ap-btn svg { width: 16px; height: 16px; }
.ap-btn--primary { background: var(--ap-primary); color: #fff; width: 100%; justify-content: center; }
.ap-btn--primary:hover { background: var(--ap-primary-h); box-shadow: var(--ap-shadow); }
.ap-btn--ghost { background: transparent; border-color: var(--ap-border); color: var(--ap-text); }
.ap-btn--ghost:hover { background: var(--ap-bg); }
.ap-btn--icon { background: none; border: none; color: var(--ap-text-muted); padding: 6px; border-radius: 6px; }
.ap-btn--icon:hover { background: #fee2e2; color: var(--ap-danger); }
.ap-btn--icon svg { width: 18px; height: 18px; }
.ap-btn:disabled { opacity: .55; pointer-events: none; }

/* ── Spinner ────────────────────────────────────────────────────────────────── */
.ap-spinner {
    width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff; border-radius: 50%; animation: ap-spin .7s linear infinite;
}
@keyframes ap-spin { to { transform: rotate(360deg); } }

/* ── Notices ────────────────────────────────────────────────────────────────── */
.ap-notice {
    padding: 12px 16px; border-radius: var(--ap-radius); font-size: .9rem;
    border: 1px solid transparent; margin-bottom: 16px;
}
.ap-notice--success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.ap-notice--error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.ap-notice--info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

/* ── Dashboard ──────────────────────────────────────────────────────────────── */
.ap-wrap--dashboard { max-width: 860px; margin: 0 auto; padding: 24px 16px 64px; }
.ap-dashboard-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; background: var(--ap-surface); border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius); box-shadow: var(--ap-shadow); margin-bottom: 24px;
}
.ap-dashboard-header__info { display: flex; align-items: center; gap: 16px; }
.ap-avatar {
    width: 48px; height: 48px; border-radius: 50%; background: var(--ap-primary);
    color: #fff; font-weight: 700; font-size: 1.1rem;
    display: flex; align-items: center; justify-content: center;
}
.ap-dashboard-title { margin: 0; font-size: 1.1rem; font-weight: 700; }
.ap-dashboard-email  { margin: 2px 0 0; font-size: .85rem; color: var(--ap-text-muted); }

/* ── Upload trigger bar ─────────────────────────────────────────────────────── */
.ap-upload-trigger-bar {
    display: flex; justify-content: flex-end; margin-bottom: 20px;
}
.ap-btn--upload-trigger {
    background: var(--ap-primary); color: #fff;
    padding: 12px 24px; font-size: .95rem; border-radius: var(--ap-radius);
    box-shadow: 0 2px 8px rgba(29,78,216,.25);
    transition: background .15s, transform .1s, box-shadow .15s;
}
.ap-btn--upload-trigger:hover {
    background: var(--ap-primary-h); box-shadow: 0 4px 14px rgba(29,78,216,.35); transform: translateY(-1px);
}
.ap-btn--upload-trigger svg { width: 18px; height: 18px; }

/* ── Docs section ───────────────────────────────────────────────────────────── */
.ap-docs-section {
    background: var(--ap-surface); border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius); box-shadow: var(--ap-shadow);
    padding: 24px; margin-bottom: 24px;
}
.ap-section-title {
    margin: 0 0 16px; font-size: 1rem; font-weight: 700;
    display: flex; align-items: center; gap: 8px;
}

/* ── Lightbox overlay ───────────────────────────────────────────────────────── */
.ap-lightbox {
    position: fixed; inset: 0; z-index: 999999;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    /* Isolate stacking context from theme interference */
    isolation: isolate;
}
.ap-lightbox__backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: ap-fade-in .2s ease;
    cursor: pointer;
}
@keyframes ap-fade-in { from { opacity: 0; } to { opacity: 1; } }

.ap-lightbox__panel {
    position: relative; z-index: 2;
    background: var(--ap-surface);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25), 0 8px 24px rgba(0,0,0,.12);
    width: 100%; max-width: 580px;
    max-height: 90vh; overflow-y: auto;
    animation: ap-slide-up .25s cubic-bezier(.34,1.56,.64,1);
    display: flex; flex-direction: column;
}
@keyframes ap-slide-up {
    from { opacity: 0; transform: translateY(24px) scale(.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ── Lightbox header ────────────────────────────────────────────────────────── */
.ap-lightbox__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px 0;
}
.ap-lightbox__title-group {
    display: flex; align-items: center; gap: 10px;
}
.ap-lightbox__title-group svg { width: 20px; height: 20px; color: var(--ap-primary); }
.ap-lightbox__title-group h3 { margin: 0; font-size: 1.1rem; font-weight: 700; }
.ap-lightbox__close {
    width: 34px; height: 34px; border-radius: 50%; border: none;
    background: var(--ap-bg); cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: var(--ap-text-muted); transition: background .15s, color .15s;
}
.ap-lightbox__close:hover { background: #fee2e2; color: var(--ap-danger); }
.ap-lightbox__close svg { width: 16px; height: 16px; }

/* ── Drop zone (inside lightbox) ────────────────────────────────────────────── */
.ap-drop-zone {
    margin: 20px 24px 0;
    border: 2px dashed var(--ap-border);
    border-radius: 12px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: border-color .2s, background .2s;
    min-height: 220px;
    display: flex; align-items: center; justify-content: center;
}
.ap-drop-zone:focus { outline: none; border-color: var(--ap-primary); }
.ap-drop-zone:hover { border-color: var(--ap-primary); background: #f5f8ff; }
.ap-drop-zone__inner {
    text-align: center; padding: 36px 24px;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    pointer-events: none;
}
.ap-drop-zone__icon svg {
    width: 64px; height: 64px; color: var(--ap-primary); opacity: .6; margin-bottom: 4px;
}
.ap-drop-zone__heading { font-size: 1.05rem; font-weight: 600; margin: 0; color: var(--ap-text); }
.ap-drop-zone__sub { font-size: .85rem; color: var(--ap-text-muted); margin: 0; }
.ap-browse-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--ap-primary); color: #fff;
    padding: 9px 18px; border-radius: 8px;
    font-size: .875rem; font-weight: 600; pointer-events: auto; cursor: pointer;
    transition: background .15s;
}
.ap-browse-btn:hover { background: var(--ap-primary-h); }
.ap-browse-btn svg { width: 15px; height: 15px; }
.ap-drop-zone__hint { font-size: .78rem; color: var(--ap-text-muted); margin: 4px 0 0; }

/* Drag-over overlay */
.ap-drop-zone__overlay {
    position: absolute; inset: 0;
    background: rgba(29,78,216,.08);
    border: 2px dashed var(--ap-primary);
    border-radius: 12px;
    display: none;
    flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; color: var(--ap-primary); font-weight: 700; font-size: 1rem;
}
.ap-drop-zone__overlay svg { width: 40px; height: 40px; }
.ap-drop-zone--over .ap-drop-zone__overlay { display: flex; }
.ap-drop-zone--over .ap-drop-zone__inner { opacity: .2; }

/* ── Upload queue ───────────────────────────────────────────────────────────── */
.ap-upload-queue { margin: 16px 24px 0; }
.ap-queue-header {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;
}
.ap-queue-header__label { font-size: .85rem; font-weight: 600; color: var(--ap-text-muted); }
.ap-queue-clear {
    font-size: .78rem; font-weight: 600; color: var(--ap-danger);
    background: none; border: none; cursor: pointer; padding: 0; text-decoration: underline;
}
.ap-queue-list {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 6px;
    max-height: 220px; overflow-y: auto;
}
.ap-queue-item {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px;
    background: var(--ap-bg); border: 1px solid var(--ap-border);
    border-radius: 8px; font-size: .875rem;
    animation: ap-fade-in .15s ease;
}
.ap-queue-item__icon {
    width: 32px; height: 32px; border-radius: 6px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: .6rem; font-weight: 700; background: #e0e7ff; color: #3730a3;
}
.ap-queue-item__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.ap-queue-item__size { color: var(--ap-text-muted); font-size: .78rem; flex-shrink: 0; }
.ap-queue-item__status { font-size: .78rem; font-weight: 700; flex-shrink: 0; }
.ap-queue-item--ok        .ap-queue-item__status { color: var(--ap-success); }
.ap-queue-item--err       .ap-queue-item__status { color: var(--ap-danger); }
.ap-queue-item--uploading .ap-queue-item__status { color: var(--ap-primary); }
.ap-queue-item--ok { border-color: #bbf7d0; background: #f0fdf4; }
.ap-queue-item--err { border-color: #fecaca; background: #fef2f2; }

/* ── Lightbox footer ────────────────────────────────────────────────────────── */
.ap-lightbox__footer {
    padding: 20px 24px 24px;
}
.ap-lightbox__actions {
    display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px;
}
.ap-lightbox__actions .ap-btn--primary { width: auto; }
.ap-lightbox__actions .ap-btn--ghost { color: var(--ap-text-muted); }

/* spinner inside primary btn */
.ap-btn .ap-spinner {
    width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff; border-radius: 50%; animation: ap-spin .7s linear infinite; display: none;
}
.ap-btn--loading .ap-spinner { display: inline-block; }
.ap-btn--loading .ap-btn-label { display: none; }

/* ── Document list ──────────────────────────────────────────────────────────── */
.ap-doc-count {
    background: var(--ap-primary); color: #fff; font-size: .72rem;
    border-radius: 20px; padding: 2px 8px; font-weight: 700;
}
.ap-doc-list { display: flex; flex-direction: column; gap: 8px; }
.ap-doc-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    border: 1px solid var(--ap-border); border-radius: 8px; background: var(--ap-bg);
    transition: box-shadow .15s;
}
.ap-doc-item:hover { box-shadow: var(--ap-shadow); }
.ap-doc-icon {
    width: 44px; height: 44px; border-radius: 8px; display: flex; align-items: center;
    justify-content: center; font-size: .65rem; font-weight: 700; letter-spacing: .04em;
    flex-shrink: 0; background: #e0e7ff; color: #3730a3;
}
.ap-doc-icon--pdf  { background: #fee2e2; color: #991b1b; }
.ap-doc-icon--doc,
.ap-doc-icon--docx { background: #dbeafe; color: #1e40af; }
.ap-doc-icon--xls,
.ap-doc-icon--xlsx { background: #dcfce7; color: #166534; }
.ap-doc-icon--jpg,
.ap-doc-icon--jpeg,
.ap-doc-icon--png  { background: #fce7f3; color: #9d174d; }
.ap-doc-icon--csv,
.ap-doc-icon--txt  { background: #fef3c7; color: #92400e; }
.ap-doc-info { flex: 1; min-width: 0; }
.ap-doc-name { margin: 0; font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-doc-meta { margin: 3px 0 0; font-size: .8rem; color: var(--ap-text-muted); }

/* ── Empty state ────────────────────────────────────────────────────────────── */
.ap-empty-state { text-align: center; padding: 40px 16px; color: var(--ap-text-muted); }
.ap-empty-state svg { width: 56px; height: 56px; margin-bottom: 12px; opacity: .4; }
.ap-empty-state p { margin: 0; font-size: .95rem; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 580px) {
    .ap-dashboard-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .ap-login-card { padding: 28px 20px; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   Notary Journal
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Section wrapper ─────────────────────────────────────────────────────── */
.ap-journal-section {
    background: var(--ap-surface);
    border: 1px solid var(--ap-border);
    border-radius: var(--ap-radius);
    box-shadow: var(--ap-shadow);
    overflow: hidden;
    margin-bottom: 24px;
}

/* ── Section header bar ──────────────────────────────────────────────────── */
.ap-journal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--ap-border);
    background: #fafbff;
}
.ap-journal-header__title {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ap-journal-header__title svg {
    width: 20px;
    height: 20px;
    color: var(--ap-primary);
    flex-shrink: 0;
}
.ap-journal-header__title h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--ap-text);
}
.ap-journal-count {
    background: var(--ap-primary);
    color: #fff;
    font-size: .72rem;
    border-radius: 20px;
    padding: 2px 8px;
    font-weight: 700;
}

/* New Entry button */
.ap-btn--journal-new {
    background: #eef2ff;
    color: var(--ap-primary);
    border: 1px solid #c7d2fe;
    padding: 8px 16px;
    font-size: .85rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.ap-btn--journal-new:hover {
    background: #e0e7ff;
    border-color: #a5b4fc;
}
.ap-btn--journal-new svg { width: 14px; height: 14px; }

/* ── Entry form ──────────────────────────────────────────────────────────── */
.ap-journal-form-wrap {
    border-bottom: 1px solid var(--ap-border);
    background: #f8faff;
    animation: ap-fade-in .2s ease;
}
.ap-journal-form-inner {
    padding: 24px;
}
.ap-journal-form-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .95rem;
    font-weight: 700;
    margin: 0 0 20px;
    color: var(--ap-primary);
}
.ap-journal-form-title svg { width: 16px; height: 16px; }

/* Form grid */
.ap-jf-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
@media (max-width: 640px) {
    .ap-jf-grid { grid-template-columns: 1fr; }
}
.ap-jf-field { display: flex; flex-direction: column; gap: 6px; }
.ap-jf-field--full { grid-column: 1 / -1; }

.ap-jf-field label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--ap-text);
    display: flex;
    align-items: center;
    gap: 5px;
}
.ap-jf-field label svg { width: 13px; height: 13px; color: var(--ap-text-muted); }
.ap-req { color: var(--ap-danger); font-weight: 700; }

.ap-jf-field input[type="text"],
.ap-jf-field input[type="date"],
.ap-jf-field textarea {
    padding: 9px 13px;
    border: 1px solid var(--ap-border);
    border-radius: 8px;
    font-size: .9rem;
    font-family: inherit;
    background: #fff;
    color: var(--ap-text);
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
    box-sizing: border-box;
}
.ap-jf-field input:focus,
.ap-jf-field textarea:focus,
.ap-jf-field select:focus {
    outline: none;
    border-color: var(--ap-primary);
    box-shadow: 0 0 0 3px rgba(29,78,216,.12);
}
.ap-jf-field textarea { resize: vertical; min-height: 80px; }

/* Select wrapper */
.ap-jf-select-wrap {
    position: relative;
}
.ap-jf-select-wrap select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    padding: 9px 36px 9px 13px;
    border: 1px solid var(--ap-border);
    border-radius: 8px;
    font-size: .9rem;
    font-family: inherit;
    background: #fff;
    color: var(--ap-text);
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
}
.ap-select-caret {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    pointer-events: none;
    color: var(--ap-text-muted);
}

/* Form actions */
.ap-journal-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 4px;
}
.ap-btn--save {
    width: auto;
    padding: 10px 22px;
}

/* ── Journal table ───────────────────────────────────────────────────────── */
.ap-journal-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.ap-journal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
    color: var(--ap-text);
}
.ap-journal-table thead {
    background: #f3f4f6;
    border-bottom: 2px solid var(--ap-border);
}
.ap-journal-table th {
    padding: 11px 14px;
    text-align: left;
    font-size: .75rem;
    font-weight: 700;
    color: var(--ap-text-muted);
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
}
.ap-journal-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--ap-border);
    vertical-align: top;
    line-height: 1.45;
}
.ap-journal-table tbody tr:last-child td { border-bottom: none; }
.ap-journal-table tbody tr:hover td { background: #fafbff; }
.ap-journal-table tr.ap-row-new td { animation: ap-row-highlight .9s ease; }
@keyframes ap-row-highlight {
    0%   { background: #e0e7ff; }
    100% { background: transparent; }
}

/* Column sizing */
.ap-jcol-date    { white-space: nowrap; }
.ap-jcol-signer  { min-width: 130px; }
.ap-jcol-location { min-width: 160px; }
.ap-jcol-act     { white-space: nowrap; }
.ap-jcol-id      { min-width: 130px; }
.ap-jcol-details { min-width: 180px; max-width: 260px; }
.ap-col-action   { width: 44px; }
.ap-jcol-action  { text-align: center; }

/* Date badge */
.ap-journal-date-badge {
    display: inline-block;
    background: #eef2ff;
    color: var(--ap-primary);
    border: 1px solid #c7d2fe;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
}

/* Tags */
.ap-journal-tag {
    display: inline-block;
    background: #f3f4f6;
    color: var(--ap-text);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: .78rem;
    font-weight: 600;
    border: 1px solid var(--ap-border);
}
.ap-journal-tag--id {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}

/* Empty state */
.ap-journal-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--ap-text-muted);
}
.ap-journal-empty svg {
    width: 52px;
    height: 52px;
    margin-bottom: 12px;
    opacity: .3;
}
.ap-journal-empty p { margin: 0; font-size: .95rem; }

/* ══════════════════════════════════════════════════════════════════════════════
   Signature Pad
   ══════════════════════════════════════════════════════════════════════════ */

.ap-sig-section {
    margin: 4px 0 20px;
    padding: 20px;
    background: #fff;
    border: 1px solid var(--ap-border);
    border-radius: 10px;
}

.ap-sig-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: .85rem;
    font-weight: 700;
    color: var(--ap-text);
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.ap-sig-label svg { width: 15px; height: 15px; color: var(--ap-primary); flex-shrink: 0; }
.ap-sig-hint {
    font-weight: 400;
    color: var(--ap-text-muted);
    font-size: .78rem;
    margin-left: 4px;
}

/* Pad wrapper */
.ap-sig-pad-wrap {
    position: relative;
    border: 2px dashed var(--ap-border);
    border-radius: 8px;
    background: #fafafa;
    overflow: hidden;
    cursor: crosshair;
    touch-action: none; /* prevent scroll while signing on mobile */
    transition: border-color .2s;
}
.ap-sig-pad-wrap:hover,
.ap-sig-pad-wrap.ap-sig-active {
    border-color: var(--ap-primary);
    background: #fff;
}
.ap-sig-pad-wrap.ap-sig-has-sig {
    border-style: solid;
    border-color: #a5b4fc;
    background: #fff;
}

/* Canvas fills the wrapper */
.ap-sig-canvas {
    display: block;
    width: 100%;
    height: 160px;
    cursor: crosshair;
}
@media (max-width: 480px) {
    .ap-sig-canvas { height: 140px; }
}

/* Placeholder overlay — hidden once drawing starts */
.ap-sig-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #c7d2fe;
    pointer-events: none;
    transition: opacity .2s;
}
.ap-sig-placeholder svg { width: 32px; height: 32px; }
.ap-sig-placeholder span { font-size: .85rem; font-weight: 500; letter-spacing: .02em; }
.ap-sig-placeholder.ap-sig-hidden { opacity: 0; }

/* Baseline rule */
.ap-sig-pad-wrap::after {
    content: '';
    position: absolute;
    left: 40px;
    right: 40px;
    bottom: 36px;
    height: 1px;
    background: #e5e7eb;
    pointer-events: none;
}

/* Clear button */
.ap-sig-actions {
    position: absolute;
    top: 8px;
    right: 8px;
}
.ap-sig-clear-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-size: .75rem;
    font-weight: 600;
    color: var(--ap-text-muted);
    background: rgba(255,255,255,.9);
    border: 1px solid var(--ap-border);
    border-radius: 6px;
    cursor: pointer;
    transition: color .15s, border-color .15s, background .15s;
}
.ap-sig-clear-btn:hover {
    color: var(--ap-danger);
    border-color: #fca5a5;
    background: #fff;
}
.ap-sig-clear-btn svg { width: 12px; height: 12px; }

/* Signature thumbnail in table */
.ap-jcol-sig { min-width: 120px; }
.ap-sig-thumb {
    max-width: 110px;
    max-height: 52px;
    border: 1px solid var(--ap-border);
    border-radius: 5px;
    background: #fff;
    display: block;
    object-fit: contain;
}
.ap-sig-missing {
    font-size: .75rem;
    color: #d1d5db;
    font-style: italic;
}
