*{box-sizing:border-box}
body{margin:0;background:#f4f6f8;color:#202124;font-family:Arial,Helvetica,sans-serif}
.topbar{background:#111827;color:#fff;padding:15px 22px;display:flex;justify-content:space-between;align-items:center;gap:15px}
.topbar strong{font-size:20px}.topbar-sub{font-size:13px;color:#cbd5e1;margin-left:10px}
.container{width:min(1100px,94%);margin:25px auto}
.container.narrow{max-width:600px}
.hero{display:flex;justify-content:space-between;align-items:center;gap:20px;margin-bottom:20px}
.hero h1{margin:0 0 7px;font-size:28px}.hero p{margin:0;color:#64748b}
.stats{display:flex;gap:12px}.stats div{background:#fff;border:1px solid #e5e7eb;padding:12px 18px;border-radius:10px;text-align:center}
.stats b{display:block;font-size:22px}.stats span{font-size:12px;color:#64748b}
.panel{background:#fff;border:1px solid #e5e7eb;border-radius:12px;padding:22px;margin-bottom:20px;box-shadow:0 2px 10px rgba(0,0,0,.03)}
.grid{display:grid;grid-template-columns:1fr 1fr;gap:25px}
label{display:block;font-size:14px;font-weight:700;margin:0 0 7px}
input,textarea{width:100%;border:1px solid #cbd5e1;border-radius:8px;padding:10px 11px;margin:0 0 16px;font:inherit;background:#fff}
input:focus,textarea:focus{outline:none;border-color:#64748b;box-shadow:0 0 0 3px rgba(100,116,139,.12)}
small{display:block;color:#64748b;margin-top:-10px;margin-bottom:16px}
.btn{display:inline-block;border:0;border-radius:8px;padding:10px 14px;text-decoration:none;cursor:pointer;font-weight:700;background:#e5e7eb;color:#111827}
.btn.primary{background:#111827;color:#fff}.btn.light{background:#fff;color:#111827}.btn.small{padding:6px 9px;font-size:12px}.btn.full{width:100%;margin-top:5px}
.alert{padding:12px 14px;border-radius:8px;margin-bottom:15px;font-size:14px}
.alert.success{background:#e7f7ed;color:#176b35}.alert.error{background:#fde8e8;color:#9b1c1c}
.panel-head{display:flex;justify-content:space-between;align-items:center;gap:15px}.panel h2{margin-top:0}
.search{max-width:300px;margin:0}
.table-wrap{overflow:auto}
table{width:100%;border-collapse:collapse;font-size:14px}
th,td{padding:10px;border-bottom:1px solid #e5e7eb;text-align:left;vertical-align:middle}
th{background:#f8fafc}
.login-body{min-height:100vh;display:grid;place-items:center;background:#f4f6f8}
.login-card{width:min(420px,92%);background:#fff;border:1px solid #e5e7eb;border-radius:14px;padding:30px;box-shadow:0 10px 40px rgba(0,0,0,.08);text-align:left}
.login-logo{text-align:center}.login-logo img{width:80px;height:80px;object-fit:contain}.login-card h1{text-align:center;margin:8px 0 4px}.muted{text-align:center;color:#64748b;margin:0 0 22px}
@media(max-width:760px){.grid{grid-template-columns:1fr}.hero{align-items:flex-start;flex-direction:column}.panel-head{align-items:flex-start;flex-direction:column}.search{max-width:none}.topbar{padding:13px 15px}}

.muted-left{color:#64748b;font-size:14px;margin-top:-8px}
.actions{display:flex;flex-wrap:wrap;gap:5px;min-width:300px}
.btn.danger{background:#b42318;color:#fff}
.btn.secondary{background:#e8eef7;color:#1f3b5b}
.current-card{display:block;max-width:360px;width:100%;height:auto;border:1px solid #ddd;border-radius:8px}

.table-help{margin:-6px 0 0;color:#64748b;font-size:13px}
.actions{white-space:nowrap}
.inline-form{display:inline}
.btn.edit{background:#eef2ff;color:#3730a3}
.btn.danger{background:#fee2e2;color:#991b1b}
.no-results{padding:18px;text-align:center;color:#64748b}
.preview-box{width:180px;height:180px;border:1px solid #e5e7eb;border-radius:10px;background:#f8fafc;display:flex;align-items:center;justify-content:center;overflow:hidden}
.preview-box img{width:100%;height:100%;object-fit:cover}
.photo-note{font-size:13px;color:#64748b;margin-top:8px}
.edit-layout{display:grid;grid-template-columns:200px 1fr;gap:25px;align-items:start}
.edit-grid{gap:20px}
@media(max-width:760px){.edit-layout{grid-template-columns:1fr}}


/* Photo fitting tool */
.photo-fitter{width:255px;height:255px;margin:10px auto 8px;position:relative;display:flex;align-items:center;justify-content:center;background:#f3f4f6;border:1px solid #d1d5db;border-radius:12px;overflow:hidden;touch-action:none;cursor:grab;user-select:none}
.photo-fitter.dragging{cursor:grabbing}
.photo-circle{width:211px;height:211px;border-radius:50%;position:relative;overflow:hidden;background:#e5e7eb;border:3px solid #111;box-shadow:inset 0 0 0 3px #c58a42;display:flex;align-items:center;justify-content:center}
.photo-circle:after{content:'Upload photo';position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:#6b7280;font-size:13px;pointer-events:none;z-index:0}
.photo-preview{position:absolute;left:50%;top:50%;max-width:none;display:block;z-index:1;pointer-events:none;transform-origin:center center;will-change:transform;width:auto;height:auto}
.photo-preview[src=""]{display:none}
.photo-controls{display:flex;align-items:center;justify-content:center;gap:8px;margin:8px auto 15px;max-width:255px}
.zoom-range{flex:1;min-width:100px;margin:0!important;padding:0!important}
.photo-controls .btn{margin:0;min-width:34px;padding:7px 9px}
.photo-note{font-size:13px;color:#64748b;text-align:center}
@media(max-width:760px){.photo-fitter{margin-left:0;margin-right:0}.photo-controls{margin-left:0;margin-right:0}}


/* Final edit-page alignment */
.edit-layout{
    display:grid;
    grid-template-columns:300px minmax(0,1fr);
    gap:36px;
    align-items:start;
}
.edit-photo-column{
    min-width:0;
    text-align:center;
}
.edit-photo-column label,
.edit-photo-column small{
    text-align:left;
}
.edit-fields{
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr);
    column-gap:26px;
    row-gap:0;
    min-width:0;
}
.edit-fields > div{min-width:0}
.edit-fields input,
.edit-fields textarea{width:100%}
.edit-fields label{margin-top:0}
.edit-fields textarea{min-height:126px;resize:vertical}
.edit-layout + *{}
.pagination{
    display:flex;
    align-items:center;
    justify-content:center;
    flex-wrap:wrap;
    gap:6px;
    margin-top:18px;
}
.page-btn{
    border:1px solid #cbd5e1;
    background:#fff;
    color:#1f2937;
    border-radius:7px;
    min-width:38px;
    padding:7px 10px;
    cursor:pointer;
    font-weight:600;
}
.page-btn:hover:not(:disabled){background:#f1f5f9}
.page-btn.active{background:#111827;color:#fff;border-color:#111827}
.page-btn:disabled{opacity:.45;cursor:not-allowed}
@media(max-width:900px){
    .edit-layout{grid-template-columns:270px minmax(0,1fr);gap:24px}
}
@media(max-width:760px){
    .edit-layout{grid-template-columns:1fr}
    .edit-fields{grid-template-columns:1fr}
    .edit-photo-column{text-align:left}
}


/* ===== FINAL HOME PAGE ALIGNMENT ===== */
.create-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:34px;
    align-items:start;
}
.create-column{
    min-width:0;
}
.create-field{
    display:grid;
    grid-template-columns:150px minmax(0,1fr);
    align-items:center;
    column-gap:16px;
    margin-bottom:14px;
}
.create-field label{
    margin:0;
    text-align:right;
    white-space:nowrap;
}
.create-field input,
.create-field textarea{
    margin:0;
    min-width:0;
}
.create-field textarea{
    resize:vertical;
}
.create-help{
    margin:-7px 0 15px 166px;
    font-size:12px;
    color:#64748b;
}

/* ===== FINAL EDIT PAGE ALIGNMENT ===== */
.edit-layout{
    display:grid;
    grid-template-columns:300px minmax(0,1fr);
    gap:40px;
    align-items:start;
}
.edit-photo-column{
    min-width:0;
    background:#f8fafc;
    border:1px solid #e5e7eb;
    border-radius:12px;
    padding:20px;
}
.edit-photo-column > label{
    display:block;
    margin-bottom:7px;
}
.edit-photo-column > input[type=file]{
    width:100%;
    margin-bottom:8px;
}
.edit-fields{
    min-width:0;
    padding-top:2px;
}
.edit-form-row{
    display:grid;
    grid-template-columns:145px minmax(0,1fr);
    align-items:center;
    column-gap:18px;
    margin-bottom:15px;
}
.edit-form-row label{
    margin:0;
    text-align:right;
    white-space:nowrap;
}
.edit-form-row label span{
    color:#b91c1c;
}
.edit-form-row input,
.edit-form-row textarea{
    width:100%;
    margin:0;
    min-width:0;
}
.edit-form-row textarea{
    resize:vertical;
}
.edit-address-row{
    align-items:start;
}
.edit-address-row label{
    padding-top:10px;
}

/* Pagination */
.pagination-bar{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:15px;
    margin-top:18px;
}
.page-info{
    font-size:13px;
    color:#64748b;
}
.pagination{
    display:flex;
    flex-wrap:wrap;
    gap:5px;
    justify-content:flex-end;
}
.page-btn{
    min-width:36px;
    height:34px;
    padding:0 10px;
    border:1px solid #cbd5e1;
    border-radius:7px;
    background:#fff;
    cursor:pointer;
    font-weight:600;
}
.page-btn.active{
    background:#111827;
    color:#fff;
    border-color:#111827;
}
.page-btn:disabled{
    opacity:.45;
    cursor:not-allowed;
}

@media(max-width:900px){
    .create-grid{
        grid-template-columns:1fr;
        gap:0;
    }
}
@media(max-width:760px){
    .edit-layout{
        grid-template-columns:1fr;
        gap:24px;
    }
    .edit-photo-column{
        max-width:420px;
        width:100%;
        margin:auto;
    }
    .edit-form-row,
    .create-field{
        grid-template-columns:1fr;
        gap:7px;
    }
    .edit-form-row label,
    .create-field label{
        text-align:left;
    }
    .create-help{
        margin:-7px 0 15px 0;
    }
    .pagination-bar{
        flex-direction:column;
        align-items:center;
    }
}


/* ==========================================================
   PROFESSIONAL CREATE-ID FORM
   Final override for the home/create page only
   ========================================================== */

.create-form-layout{
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr);
    gap:34px;
    align-items:start;
    max-width:100%;
}

.create-form-column{
    min-width:0;
}

.create-form-field{
    display:grid;
    grid-template-columns:140px minmax(0,1fr);
    align-items:center;
    column-gap:16px;
    min-height:48px;
    margin-bottom:12px;
}

.create-form-field label{
    margin:0;
    text-align:right;
    white-space:nowrap;
    font-size:14px;
    font-weight:700;
    color:#111827;
}

.create-form-field label span,
.photo-upload-header label span{
    color:#b42318;
}

.create-form-field input,
.create-form-field textarea{
    width:100%;
    min-width:0;
    margin:0;
    background:#fff;
}

.create-form-field textarea{
    min-height:112px;
    resize:vertical;
}

/* Make the date/input controls exactly the same height. */
.create-form-field input:not([type=file]){
    height:42px;
}

/* Photo area is a compact, intentional panel rather than a loose
   collection of controls. */
.photo-upload-section{
    margin-top:5px;
    padding:15px;
    border:1px solid #e2e8f0;
    border-radius:12px;
    background:#f8fafc;
}

.photo-upload-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    margin-bottom:8px;
}

.photo-upload-header label{
    margin:0;
    font-size:14px;
    font-weight:700;
    color:#111827;
}

.photo-hint{
    font-size:12px;
    color:#64748b;
}

.photo-upload-section > input[type=file]{
    display:block;
    width:100%;
    height:42px;
    margin:0 0 12px;
    padding:8px 10px;
    background:#fff;
    border:1px solid #cbd5e1;
    border-radius:8px;
    font-size:13px;
}

.photo-fitting-area{
    display:flex;
    flex-direction:column;
    align-items:center;
}

.photo-fitter{
    width:235px;
    height:235px;
    margin:0 auto 9px;
    position:relative;
    display:flex;
    align-items:center;
    justify-content:center;
    background:#eef2f7;
    border:1px solid #d5dce5;
    border-radius:12px;
    overflow:hidden;
    touch-action:none;
    cursor:grab;
    user-select:none;
}

.photo-fitter.dragging{
    cursor:grabbing;
}

.photo-circle{
    width:204px;
    height:204px;
    flex:0 0 204px;
    border-radius:50%;
    position:relative;
    overflow:hidden;
    background:#e5e7eb;
    border:3px solid #111827;
    box-shadow:inset 0 0 0 3px #c58a42;
    display:flex;
    align-items:center;
    justify-content:center;
}

.photo-circle:after{
    content:'Upload photo';
    position:absolute;
    inset:0;
    display:flex;
    align-items:center;
    justify-content:center;
    color:#64748b;
    font-size:13px;
    pointer-events:none;
    z-index:0;
}

.photo-preview{
    position:absolute;
    left:50%;
    top:50%;
    max-width:none;
    display:block;
    z-index:1;
    pointer-events:none;
    transform-origin:center center;
    will-change:transform;
    width:auto;
    height:auto;
}

.photo-preview[src=""]{
    display:none;
}

.photo-controls{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:7px;
    width:100%;
    max-width:300px;
    margin:0;
}

.photo-controls .btn{
    min-width:34px;
    height:34px;
    margin:0;
    padding:5px 9px;
}

.zoom-range{
    flex:1;
    min-width:90px;
    max-width:145px;
    margin:0 !important;
    padding:0 !important;
}

.photo-instruction{
    margin:10px 2px 0;
    text-align:center;
    color:#64748b;
    font-size:12px;
    line-height:1.45;
}

/* Keep the Generate button visually connected to the form. */
.create-form-layout + .btn.primary{
    margin-top:22px;
    min-width:145px;
    height:42px;
}

/* Desktop: both columns start at exactly the same vertical point. */
@media(min-width:761px){
    .create-form-layout > .create-form-column{
        padding-top:0;
    }
}

/* Tablet/mobile: stack cleanly instead of squeezing labels. */
@media(max-width:900px){
    .create-form-layout{
        grid-template-columns:1fr;
        gap:6px;
    }

    .photo-upload-section{
        margin-top:8px;
    }
}

@media(max-width:600px){
    .create-form-field{
        grid-template-columns:1fr;
        gap:7px;
        min-height:0;
        margin-bottom:14px;
    }

    .create-form-field label{
        text-align:left;
    }

    .photo-upload-header{
        align-items:flex-start;
        flex-direction:column;
        gap:3px;
    }

    .photo-fitter{
        width:225px;
        height:225px;
    }

    .photo-circle{
        width:196px;
        height:196px;
        flex-basis:196px;
    }
}


/* ==========================================================
   CREATE ID CARD - PROFESSIONAL TWO-PANEL LAYOUT
   ========================================================== */

.professional-create-layout{
    display:grid;
    grid-template-columns:minmax(0, 1fr) 390px;
    gap:32px;
    align-items:stretch;
}

.details-panel{
    padding:8px 8px 4px 4px;
}

.section-title{
    display:flex;
    align-items:baseline;
    justify-content:space-between;
    gap:15px;
    padding-bottom:16px;
    margin-bottom:22px;
    border-bottom:1px solid #e5e7eb;
}

.section-title h2,
.photo-panel-header h2{
    margin:0;
    font-size:18px;
    color:#111827;
}

.section-title span,
.photo-panel-header span{
    color:#64748b;
    font-size:12px;
}

.detail-row{
    display:grid;
    grid-template-columns:145px minmax(0,1fr);
    align-items:center;
    column-gap:20px;
    margin-bottom:16px;
}

.detail-row label{
    margin:0;
    text-align:right;
    white-space:nowrap;
    font-size:14px;
    font-weight:700;
    color:#111827;
}

.detail-row label b{
    color:#b91c1c;
}

.detail-row input,
.detail-row textarea{
    width:100%;
    margin:0;
    min-width:0;
}

.detail-row textarea{
    resize:vertical;
    min-height:100px;
}

.detail-row-address{
    align-items:start;
}

.detail-row-address label{
    padding-top:11px;
}

.photo-panel{
    border:1px solid #dbe2ea;
    border-radius:14px;
    background:#f8fafc;
    padding:22px;
    min-height:100%;
    display:flex;
    flex-direction:column;
}

.photo-panel-header{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:12px;
    margin-bottom:18px;
}

.photo-panel-header h2{
    margin-bottom:4px;
}

.required-badge{
    background:#eef2ff;
    color:#374151 !important;
    border:1px solid #dbe3f0;
    border-radius:20px;
    padding:4px 9px;
    font-size:11px !important;
    font-weight:700;
    white-space:nowrap;
}

.file-label{
    display:block;
    margin-bottom:7px;
    font-size:13px;
    font-weight:700;
    color:#374151;
}

.photo-panel input[type=file]{
    width:100%;
    margin:0;
    padding:10px;
    background:#fff;
    border:1px solid #cbd5e1;
    border-radius:8px;
}

.file-help{
    color:#64748b;
    font-size:11px;
    margin-top:7px;
}

.photo-workspace{
    flex:1;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    padding:18px 0 4px;
}

.photo-fitter{
    width:250px;
    height:250px;
    display:flex;
    align-items:center;
    justify-content:center;
    margin:0 auto 15px;
    background:#eef2f7;
    border:1px solid #d8e0ea;
    border-radius:12px;
}

.photo-circle{
    width:220px;
    height:220px;
    border-radius:50%;
    overflow:hidden;
    position:relative;
    background:#e5e7eb;
    border:4px solid #111827;
    box-shadow:0 0 0 2px #d59a43;
    cursor:grab;
}

.photo-circle:active{
    cursor:grabbing;
}

.photo-preview{
    position:absolute;
    max-width:none;
    user-select:none;
    -webkit-user-drag:none;
    transform-origin:center center;
}

.photo-placeholder{
    position:absolute;
    inset:0;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:6px;
    color:#64748b;
    font-size:13px;
    pointer-events:none;
}

.placeholder-icon{
    width:34px;
    height:34px;
    display:flex;
    align-items:center;
    justify-content:center;
    border:1px solid #cbd5e1;
    border-radius:50%;
    background:#fff;
    font-size:20px;
    line-height:1;
}

.photo-controls{
    width:280px;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    margin:0 auto;
}

.zoom-range{
    flex:1;
    min-width:80px;
    margin:0 !important;
    padding:0 !important;
}

.photo-controls .btn.small{
    min-width:34px;
    height:34px;
    padding:0 9px;
}

.photo-instruction{
    max-width:330px;
    margin:16px auto 0;
    text-align:center;
    color:#64748b;
    font-size:12px;
    line-height:1.5;
}

.create-actions{
    margin-top:24px;
    padding-top:20px;
    border-top:1px solid #e5e7eb;
    display:flex;
    justify-content:flex-start;
}

.generate-btn{
    min-width:170px;
    padding:12px 20px;
}

/* The photo fitter should never get squeezed into the detail column. */
.professional-create-layout .photo-panel input,
.professional-create-layout .photo-panel textarea{
    box-sizing:border-box;
}

@media(max-width:900px){
    .professional-create-layout{
        grid-template-columns:1fr;
        gap:24px;
    }

    .photo-panel{
        min-height:0;
    }

    .photo-workspace{
        padding-bottom:8px;
    }
}

@media(max-width:600px){
    .detail-row{
        grid-template-columns:1fr;
        gap:7px;
    }

    .detail-row label{
        text-align:left;
    }

    .detail-row-address label{
        padding-top:0;
    }

    .photo-panel{
        padding:18px;
    }

    .photo-fitter{
        width:230px;
        height:230px;
    }

    .photo-circle{
        width:205px;
        height:205px;
    }

    .photo-controls{
        width:100%;
        max-width:280px;
    }
}

/* Photo fitter: reliable drag/touch behavior */
.photo-fitter,
.photo-circle {
    touch-action: none;
}
.photo-preview {
    position: absolute !important;
    max-width: none !important;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}
