:root {
    --navy: #111d68;
    --navy2: #25348d;
    --blue: #2f62ff;
    --green: #12b76a;
    --text: #101936;
    --muted: #6b7280;
    --border: #dfe5f3;
    --soft: #f6f8ff;
    --danger: #dc3545;
    --shadow: 0 10px 30px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: #f7f9fd;
    color: var(--text);
    font-size: 14px;
}

.top-header {
    height: 76px;
    background: linear-gradient(90deg, var(--navy), var(--navy2));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 70px;
    box-shadow: 0 3px 12px rgba(0,0,0,.12);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255,255,255,.14);
    display: grid;
    place-items: center;
    font-size: 18px;
    font-weight: 800;
}

.brand h1 {
    margin: 0;
    font-size: 26px;
    line-height: 1;
    color: #fff;
}

.brand h1 span { color: #19e8a5; }

.brand small {
    display: block;
    margin-top: 5px;
    font-size: 11px;
    letter-spacing: 2px;
    color: #fff;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 24px;
}

.user-name {
    font-weight: 700;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    opacity: .85;
    margin-top: 3px;
}

.logout-link {
    color: #fff;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,.35);
    padding: 8px 14px;
    border-radius: 6px;
    font-weight: 700;
}

.page {
    max-width: 1280px;
    margin: 0 auto;
    padding: 22px 24px 50px;
}

.notice {
    background: #d9fff2;
    border: 1px solid #97efd4;
    color: #006b54;
    border-radius: 5px;
    padding: 17px 22px;
    display: flex;
    gap: 14px;
    line-height: 1.6;
    font-size: 14px;
    margin-bottom: 14px;
}

.notice-icon {
    width: 22px;
    height: 22px;
    border: 2px solid #08a978;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 800;
    flex: 0 0 auto;
}

.main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.28fr) minmax(390px, .92fr);
    gap: 18px;
    margin-top: 14px;
    align-items: start;
}

.card {
    background: #fff;
    border: 1px solid #edf0f7;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.card-body {
    padding: 22px;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 22px;
}

.title-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--blue);
    color: var(--blue);
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 800;
    flex: 0 0 auto;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px 26px;
}

.field label {
    display: block;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 7px;
}

.required { color: #ff3158; }

input[type=text], input[type=password], select, input[type=file] {
    width: 100%;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 0 12px;
    outline: none;
    background: #fff;
    color: var(--text);
    font-family: "Segoe UI", Arial, sans-serif;
}

input[type=file] {
    padding-top: 8px;
}

input:focus, select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(47,98,255,.1);
}

.passport-row {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(200px, .8fr);
    gap: 26px;
    margin-top: 16px;
    align-items: end;
}

.passport-preview {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--muted);
    font-size: 13px;
}

.mini-photo, .photo-box {
    border: 1px solid var(--border);
    border-radius: 5px;
    background: linear-gradient(#f4f5f7, #e5e7eb);
    display: grid;
    place-items: center;
    color: #888;
    overflow: hidden;
}

.mini-photo {
    width: 52px;
    height: 52px;
}

.photo-box {
    width: 96px;
    height: 96px;
    margin-bottom: 18px;
}

.photo-box img, .mini-photo img, .verify-photo img, .table-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.form-actions {
    margin-top: 28px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn {
    height: 42px;
    border: 0;
    border-radius: 5px;
    padding: 0 22px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    text-decoration: none;
    font-family: "Segoe UI", Arial, sans-serif;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue), #3b45f0);
    color: #fff;
    box-shadow: 0 8px 18px rgba(47,98,255,.23);
}

.btn-outline {
    border: 1px solid var(--blue);
    background: #fff;
    color: var(--blue);
}

.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-light { background: #fff; border: 1px solid var(--border); color: var(--text); }

.qr-card {
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 16px;
    display: grid;
    grid-template-columns: 130px minmax(160px, 1fr);
    align-items: center;
    gap: 25px;
    min-height: 230px;
}

.qr-holder {
    width: 165px;
    height: 165px;
    margin-left: auto;
    display: grid;
    place-items: center;
}

.qr-holder canvas,
.qr-holder img {
    width: 160px !important;
    height: 160px !important;
}

.qr-placeholder {
    width: 160px;
    height: 160px;
    border: 8px solid #2f62ff;
    background: #f1f4ff;
    position: relative;
}

.qr-placeholder:before,
.qr-placeholder:after {
    content: "";
    position: absolute;
    width: 42px;
    height: 42px;
    border: 8px solid #2f62ff;
    background: #f1f4ff;
}

.qr-placeholder:before { left: 18px; top: 18px; }
.qr-placeholder:after { right: 18px; top: 18px; }

.staff-meta { margin-top: 8px; line-height: 1.7; }
.staff-meta strong { display: block; }
.staff-meta span { display: block; color: var(--muted); font-size: 13px; }

.hint {
    margin-top: 8px;
    border: 1px solid var(--border);
    background: var(--soft);
    color: var(--blue);
    border-radius: 5px;
    padding: 11px 14px;
    font-size: 13px;
}

.preview-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.table-card { margin-top: 14px; }

.table-header {
    padding: 14px 22px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.table-actions { display: flex; gap: 12px; }

.gridview {
    width: calc(100% - 40px);
    margin: 0 20px 20px;
    border-collapse: collapse;
    border: 1px solid var(--border);
    font-size: 13px;
}

.gridview th, .gridview td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #eef2f7;
    vertical-align: middle;
}

.gridview th {
    background: #f8faff;
    font-size: 12px;
}

.table-photo {
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 5px;
    display: grid;
    place-items: center;
    background: #eef0f4;
    overflow: hidden;
}

.small-btn {
    height: 34px;
    padding: 0 14px;
    font-size: 12px;
    margin-right: 6px;
}

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 22px;
    background: radial-gradient(circle at top left, #eaf0ff, transparent 35%), #f7f9fd;
}

.login-card {
    width: 420px;
    max-width: 100%;
    background: #fff;
    box-shadow: var(--shadow);
    border-radius: 14px;
    border: 1px solid #edf0f7;
    padding: 30px;
}

.login-card h1 { margin: 0 0 5px; }
.login-card p { margin: 0 0 20px; color: var(--muted); }

.error {
    color: #dc3545;
    font-size: 13px;
    margin-top: 10px;
    display: block;
}

.success {
    color: #008057;
    font-size: 13px;
    margin-top: 10px;
    display: block;
}

.verify-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 22px;
    background: linear-gradient(180deg, #f7f9fd, #fff);
}

.verify-card {
    width: 480px;
    max-width: 70%;
    background: #fff;
    box-shadow: var(--shadow);
    border-radius: 16px;
    border: 1px solid #edf0f7;
    overflow: hidden;
}

.verify-head {
    background: linear-gradient(90deg, var(--navy), var(--navy2));
    color: #fff;
    padding: 22px;
    text-align: center;
}

.verify-body {
    padding: 25px;
    text-align: center;
}

.verify-photo {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border: 4px solid #eef3ff;
    margin: 0 auto 15px;
    overflow: hidden;
    background: #eef0f4;
    display: grid;
    place-items: center;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 18px;
    text-align: left;
}

.detail-table td {
    padding: 10px;
    border-bottom: 1px solid #eef2f7;
}

.detail-table td:first-child {
    color: var(--muted);
    width: 38%;
}

.print-labels {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    padding: 20px;
}

.qr-label {
    border: 1px dashed #222;
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr 92px;
    align-items: center;
    min-height: 112px;
    page-break-inside: avoid;
    background: #fff;
}

.qr-label strong {
    display: block;
    font-size: 14px;
}

.qr-label small {
    display: block;
    color: #555;
    margin-top: 4px;
}

.label-qr {
    width: 90px;
    height: 90px;
    display: grid;
    place-items: center;
}

.label-qr canvas,
.label-qr img {
    width: 88px !important;
    height: 88px !important;
}

.print-toolbar {
    padding: 14px 20px;
    display: flex;
    gap: 10px;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

@media print {
    .top-header, .print-toolbar {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .print-labels {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media(max-width: 980px) {
    .top-header {
        padding: 0 18px;
    }

    .main-grid,
    .form-grid,
    .passport-row,
    .qr-card {
        grid-template-columns: 1fr;
    }

    .qr-holder {
        margin: 0;
    }

    .table-header {
        flex-direction: column;
        align-items: stretch;
    }

    .table-actions {
        flex-direction: column;
    }

    .gridview {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
