:root {
    --bg: #f3f6fb;
    --card: #ffffff;
    --text: #0f1f3a;
    --muted: #667085;
    --primary: #111827;
    --primary-hover: #22304a;
    --border: #cfd7e5;
    --shadow: 0 20px 45px rgba(15, 31, 58, 0.10);
    --success: #0f8a5f;
    --danger: #c0392b;
    --warning-bg: #fff8e6;
    --warning-text: #8a5a00;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.site-wrap {
    width: min(980px, calc(100% - 32px));
    margin: 0 auto;
    padding: 26px 0 70px;
}

.main-title {
    font-size: clamp(30px, 4vw, 36px);
    line-height: 1.15;
    margin: 0 0 28px;
    font-weight: 800;
    color: #0c1c38;
    letter-spacing: -0.6px;
}

.selection-card {
  
    background: var(--card);
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 20px;
}

.card-title {
    margin: 0 0 20px;
    font-size: 26px;
    color: #101828;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-group.hidden {
    display: none !important;
}

label {
    font-size: 14px;
    font-weight: 700;
    color: #101828;
}

select,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea,
input[type="file"] {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: #000;
    font-size: 15px;
    padding: 10px 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea {
    min-height: 94px;
    resize: vertical;
}

select:focus,
input:focus,
textarea:focus {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.12);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.btn {
    border: 0;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    padding: 12px 17px;
    font-weight: 800;
    cursor: pointer;
    line-height: 1;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f1f5f9;
    color: #0f172a;
    border: 1px solid #dbe3ef;
}

.btn-secondary:hover {
    background: #e6edf7;
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: #9f2e23;
}

.btn-small {
    padding: 9px 12px;
    font-size: 13px;
    min-height: 34px;
}

.message {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-weight: 700;
}

.message.success {
    color: var(--success);
    background: #e9fff6;
    border: 1px solid #bcebd9;
}

.message.error {
    color: var(--danger);
    background: #fff0ee;
    border: 1px solid #f2c4bd;
}

.message.warning {
    color: var(--warning-text);
    background: var(--warning-bg);
    border: 1px solid #f5dc9e;
}

.help-text {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

/* Modal */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(7, 14, 30, 0.70);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop.show {
    display: flex;
}

.modal-card {
    width: min(1080px, 100%);
    max-height: 92vh;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.36);
    display: flex;
    flex-direction: column;
}

.modal-head {
    padding: 16px 18px;
    background: #101827;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-head h3 {
    margin: 0;
    font-size: 20px;
}

.modal-close {
    border: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.modal-body {
    padding: 16px 18px 18px;
    overflow: auto;
}

.result-details {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.detail-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
}

.detail-box span {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 5px;
}

.detail-box strong {
    font-size: 15px;
    color: #0f172a;
}

.pdf-frame-wrap {
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    overflow: hidden;
    background: #f8fafc;
}

.pdf-frame {
    display: block;
    width: 100%;
    height: 68vh;
    border: 0;
}

.loader {
    display: none;
    font-weight: 800;
    color: #1d4ed8;
}

.loader.show {
    display: inline-block;
}

/* Admin */
.admin-body {
    background: #eef2f7;
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 68px;
    background: #0d1729;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 28px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.16);
}

.admin-topbar strong {
    display: block;
    font-size: 20px;
}

.admin-topbar span {
    display: block;
    color: #b9c3d4;
    font-size: 13px;
    margin-top: 2px;
}

.admin-topbar nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-topbar nav a {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    padding: 9px 12px;
    border-radius: 9px;
    background: rgba(255,255,255,0.08);
}

.admin-topbar nav a:hover {
    background: rgba(255,255,255,0.16);
}

.admin-main {
    width: min(1180px, calc(100% - 32px));
    margin: 24px auto 50px;
}

.admin-footer {
    color: #667085;
    text-align: center;
    padding: 20px;
}

.admin-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 18px;
}

.admin-card h1,
.admin-card h2 {
    margin: 0 0 18px;
    color: #101828;
}

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

.stat-card {
    background: linear-gradient(135deg, #111827, #22304a);
    color: #fff;
    border-radius: 16px;
    padding: 18px;
}

.stat-card span {
    display: block;
    color: #cbd5e1;
    font-size: 13px;
    margin-bottom: 8px;
}

.stat-card strong {
    font-size: 30px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1080px;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
    font-size: 14px;
}

.table th {
    background: #f8fafc;
    color: #334155;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.table tr:last-child td {
    border-bottom: 0;
}

.badge {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 12px;
}

.badge.active {
    background: #e9fff6;
    color: #0f8a5f;
}

.badge.inactive {
    background: #fff0ee;
    color: #c0392b;
}

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

.full-width {
    grid-column: 1 / -1;
}

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: min(440px, 100%);
}

@media (max-width: 768px) {
    .site-wrap {
        width: min(100% - 22px, 980px);
        padding-top: 20px;
    }

    .selection-card {
        border-radius: 16px;
        padding: 18px;
    }

    .form-grid,
    .admin-form-grid,
    .result-details,
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .card-title {
        font-size: 22px;
    }

    .main-title {
        margin-bottom: 22px;
    }

    .admin-topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        padding: 14px 16px;
    }

    .admin-main {
        width: min(100% - 22px, 1180px);
    }

    .pdf-frame {
        height: 63vh;
    }

    .modal-card {
        max-height: 94vh;
    }
}

.dynamic-notice {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #fff8e6;
    color: #8a5a00;
    border: 1px solid #ffe1a6;
    font-size: 14px;
    font-weight: 700;
}
.dynamic-notice.hidden {
    display: none !important;
}
