@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;900&display=swap');

* {
    box-sizing: border-box
}

body {
    margin: 0;
    font-family: Cairo, Arial, sans-serif;
    background: #f3f6fb;
    color: #17233c
}

.app {
    display: flex;
    min-height: 100vh
}

.sidebar {
    width: 280px;
    background: #0b1f63;
    color: #fff;
    padding: 24px;
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0
}

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

.brand img {
    width: 58px;
    height: 58px;
    object-fit: contain;
    background: #fff;
    border-radius: 14px;
    padding: 4px
}

.brand strong {
    display: block;
    font-size: 26px
}

.brand span {
    font-size: 13px;
    opacity: .9
}

.sidebar nav a {
    display: block;
    color: #fff;
    text-decoration: none;
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 8px;
    font-weight: 700
}

.sidebar nav a:hover {
    background: #d60000
}

.main {
    margin-right: 280px;
    width: calc(100% - 280px);
    padding: 26px
}

.topbar {
    background: #fff;
    border-radius: 20px;
    padding: 20px 24px;
    box-shadow: 0 10px 30px #09246b12;
    margin-bottom: 24px
}

.topbar h1 {
    margin: 0;
    font-size: 26px
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px
}

.stat,
.panel {
    background: #fff;
    border-radius: 22px;
    padding: 22px;
    box-shadow: 0 10px 30px #09246b12
}

.stat b {
    display: block;
    font-size: 38px;
    color: #0b1f63
}

.btn {
    display: inline-block;
    border: 0;
    background: #0b1f63;
    color: #fff;
    text-decoration: none;
    padding: 11px 18px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer
}

.btn.red {
    background: #d60000
}

.btn.gray {
    background: #59647a
}

.btn.light {
    background: #eef2ff;
    color: #0b1f63
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 18px
}

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

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid #d8deea;
    border-radius: 14px;
    padding: 12px 14px;
    font-family: inherit;
    background: #fff
}

.field.full {
    grid-column: 1/-1
}

.alert {
    padding: 14px 18px;
    border-radius: 14px;
    margin-bottom: 18px
}

.alert.error {
    background: #fff1f1;
    color: #a90000;
    border: 1px solid #ffcaca
}

.alert.ok {
    background: #effff2;
    color: #09651d;
    border: 1px solid #b7efc2
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 10px 30px #09246b12
}

th,
td {
    padding: 13px;
    border-bottom: 1px solid #eef2f7;
    text-align: right
}

th {
    background: #0b1f63;
    color: white
}

.thumb {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover
}

.preview-wrap {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    direction: ltr
}

.id-card {
    width: 354px;
    height: 600px;
    position: relative;
    overflow: hidden;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 10px 30px #09246b30;
    font-family: Cairo, Arial, sans-serif;
    direction: ltr
}

.id-card .bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0
}

.id-card .content {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    padding: 0 28px;
    text-align: center
}

.front .photo {
    position: absolute;
    top: 140px;
    left: 50%;
    transform: translateX(-50%);
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    background: #e7ecf5
}

.front .name {
    position: absolute;
    top: 340px;
    left: 25px;
    right: 25px;
    font-size: 18px;
    line-height: 1.15;
    font-weight: 900;
    color: #050505;
    text-transform: uppercase
}

.front .job {
    position: absolute;
    top: 370px;
    left: 40px;
    right: 40px;
    background: #d60000;
    color: #fff;
    border-radius: 18px;
    padding: 5px 5px;
    font-size: 18px;
    font-weight: 800;
}

.front .meta {
    position: absolute;
    top: 420px;
    left: 54px;
    right: 54px;
    text-align: left;
    font-weight: 900;
    font-size: 18px;
    color: #090909;
    line-height: 1.0
}

.front .qr {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 95px;
    height: 95px
}

.front .site {
    position: absolute;
    bottom: 8px;
    left: 0;
    right: 0;
    font-weight: 900;
    font-size: 17px;
    color: #000
}

.back .dates {
    position: absolute;
    top: 358px;
    left: 0;
    right: 0;
    text-align: center;
    font-weight: 900;
    font-size: 20px;
    color: #050505;
    letter-spacing: 1px
}

.print-page {
    background: #e9edf5;
    padding: 20px
}

.print-actions {
    margin-bottom: 16px
}

.cards-print {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-start;
    direction: ltr
}

@media print {
    body {
        background: #fff
    }

    .print-actions,
    .sidebar,
    .topbar {
        display: none !important
    }

    .main {
        margin: 0;
        width: 100%;
        padding: 0
    }

    .panel {
        box-shadow: none;
        padding: 0
    }

    .cards-print {
        gap: 0
    }

    .id-card {
        box-shadow: none;
        border-radius: 0;
        page-break-inside: avoid;
        margin: 0
    }

    .id-card+.id-card {
        margin-left: 8mm
    }
}

@media(max-width:800px) {
    .sidebar {
        position: static;
        width: 100%
    }

    .app {
        display: block
    }

    .main {
        margin: 0;
        width: 100%
    }

    .form-grid {
        grid-template-columns: 1fr
    }
}