/* PDF Forms - fill and save a PDF form: its own fields, or a flat form laid
   out with input boxes over the page images (Story 3530). */

/* Pinned chrome: the shell is exactly the viewport (100dvh, with 100vh for old
   browsers) and only .pf-scroll scrolls, so the icon band never slides off. */
.pf-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}
.pf-shell > .pf-header { flex: 0 0 auto; }
.pf-scroll {
    flex: 1 1 auto;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 120px;
}

.pf-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px 4px;
}
.pf-header h1 {
    margin: 0;
    font: 600 18pt 'Segoe UI', system-ui, sans-serif;
    color: #1F2329;
}

.pf-sub {
    color: #5A6377;
    font: 400 11pt 'Segoe UI', system-ui, sans-serif;
    margin: 0 0 14px;
    padding: 0 16px;
    line-height: 1.45;
}

/* Content sections carry the side gutters so the band/header stay full width. */
.pf-list-view,
.pf-form-view,
.pf-flat-view {
    padding: 0 16px;
}

/* ---- List of fillable PDFs ------------------------------------------------ */

.pf-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #FFFFFF;
    border: 1px solid #E2E5EA;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 8px;
    cursor: pointer;
}
.pf-row:hover { border-color: #B9C2CF; background: #FAFBFC; }
.pf-row-name { font: 600 11.5pt 'Segoe UI', system-ui, sans-serif; color: #1F2329; word-break: break-word; }
.pf-row-meta { font: 400 9.5pt 'Segoe UI', system-ui, sans-serif; color: #8A93A2; margin-top: 2px; }
.pf-row-go   { color: #0A66C2; font-size: 16pt; flex: 0 0 auto; }

.pf-empty {
    text-align: center;
    color: #8A93A2;
    font-style: italic;
    padding: 40px 16px;
}

/* ---- Form view ------------------------------------------------------------ */

.pf-form-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}
.pf-file {
    font: 600 12pt 'Segoe UI', system-ui, sans-serif;
    color: #1F2329;
    word-break: break-word;
}

.pf-field { margin: 0 0 16px; }
.pf-field label {
    display: block;
    font: 600 10.5pt 'Segoe UI', system-ui, sans-serif;
    color: #3C4043;
    margin-bottom: 5px;
}
.pf-field input[type="text"],
.pf-field textarea,
.pf-field select {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #C7CDD6;
    border-radius: 6px;
    padding: 9px 11px;
    font: 400 11.5pt 'Segoe UI', system-ui, sans-serif;
    color: #1F2329;
    background: #FFFFFF;
}
.pf-field textarea { min-height: 84px; resize: vertical; }
.pf-field input[type="text"]:focus,
.pf-field textarea:focus,
.pf-field select:focus {
    outline: none;
    border-color: #0A66C2;
    box-shadow: 0 0 0 2px rgba(10, 102, 194, 0.15);
}

/* checkbox / radio rows */
.pf-check { display: flex; align-items: center; gap: 9px; }
.pf-check input { width: 18px; height: 18px; flex: 0 0 auto; }
.pf-check label { margin: 0; }
.pf-radio-opt { display: flex; align-items: center; gap: 9px; margin: 4px 0; }
.pf-radio-opt input { width: 18px; height: 18px; }
.pf-radio-opt label { margin: 0; font-weight: 400; }

.pf-readonly-note { font: italic 400 9.5pt 'Segoe UI', system-ui, sans-serif; color: #8A93A2; margin-left: 6px; }

.pf-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}
.pf-actions button { flex: 1 1 auto; min-width: 140px; }

/* ---- Toast ---------------------------------------------------------------- */

.pf-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    background: #1F2329;
    color: #FFFFFF;
    padding: 10px 18px;
    border-radius: 8px;
    font: 500 11pt 'Segoe UI', system-ui, sans-serif;
    z-index: 9999;
}

/* ---- Drop zone -------------------------------------------------------------- */

.pf-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border: 2px dashed #B9C2CF;
    border-radius: 10px;
    background: #FAFBFC;
    padding: 26px 16px;
    margin: 6px 0 18px;
    text-align: center;
    cursor: pointer;
}
.pf-drop.pf-drop-over { border-color: #0A66C2; background: #EEF5FC; }
.pf-drop-title { font: 600 12.5pt 'Segoe UI', system-ui, sans-serif; color: #1F2329; }
.pf-drop-sub   { font: 400 10pt 'Segoe UI', system-ui, sans-serif; color: #5A6377; }

.pf-h2 {
    font: 600 11pt 'Segoe UI', system-ui, sans-serif;
    color: #5A6377;
    margin: 14px 0 8px;
}
.pf-row-filled { color: #1E7B34; font-weight: 600; }

/* ---- Flat form ---------------------------------------------------------------- */

.pf-flat-bar { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; }
.pf-flat-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.pf-remember { font: 400 10.5pt 'Segoe UI', system-ui, sans-serif; color: #3C4043; display: flex; align-items: center; gap: 6px; }
.pf-status { font: 400 10pt 'Segoe UI', system-ui, sans-serif; color: #5A6377; margin: 4px 0 10px; min-height: 1em; }
.pf-adding .pf-page { cursor: crosshair; outline: 2px solid #0A66C2; }

.pf-pages { display: flex; flex-direction: column; gap: 14px; }
.pf-page {
    position: relative;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    background: #FFFFFF;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
    --s: 1;                          /* CSS px per PDF point, set by the script */
}
.pf-page img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }

.pf-box {
    position: absolute;
    box-sizing: border-box;
    background: rgba(10, 102, 194, 0.08);
    border: 1px solid rgba(10, 102, 194, 0.55);
    border-radius: 2px;
}
.pf-box.pf-box-sel { border-color: #E07B00; box-shadow: 0 0 0 2px rgba(224, 123, 0, 0.35); }
.pf-box.pf-box-keyed { background: rgba(30, 123, 52, 0.08); }
.pf-box input {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    border: 0;
    padding: 0 0 0 2px;
    margin: 0;
    background: transparent;
    color: #0B2F66;
    font-family: Helvetica, Arial, sans-serif;
    font-size: calc(var(--s) * 9px);
    line-height: 1;
}
.pf-box input:focus { outline: none; background: rgba(255, 255, 255, 0.85); }
.pf-box-check {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    font: 700 calc(var(--s) * 10px) Helvetica, Arial, sans-serif;
    color: #0B2F66;
}
.pf-grip {
    position: absolute;
    left: -14px;
    top: 50%;
    width: 14px;
    height: 22px;
    margin-top: -11px;
    background: #E07B00;
    border-radius: 4px 0 0 4px;
    touch-action: none;
    cursor: move;
    display: none;
}
.pf-size {
    position: absolute;
    right: -7px;
    bottom: -7px;
    width: 14px;
    height: 14px;
    background: #E07B00;
    border-radius: 50%;
    touch-action: none;
    cursor: nwse-resize;
    display: none;
}
.pf-box-sel .pf-grip, .pf-box-sel .pf-size { display: block; }

/* ---- Selected box sheet ------------------------------------------------------- */

.pf-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #FFFFFF;
    border-top: 1px solid #D5DAE1;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.12);
    padding: 10px 16px 14px;
    z-index: 900;
}
.pf-sheet-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.pf-sheet-row:last-child { margin-bottom: 0; }
.pf-sheet-row input[type="text"] {
    flex: 1 1 auto;
    min-width: 0;
    border: 1px solid #C7CDD6;
    border-radius: 6px;
    padding: 8px 10px;
    font: 400 11pt 'Segoe UI', system-ui, sans-serif;
}
.pf-sheet-row select, .pf-sheet-row .picasso-select { flex: 1 1 auto; min-width: 0; }
