:root {
    --bg: #f6f7f9;
    --card: #ffffff;
    --text: #18202a;
    --muted: #667085;
    --border: #d7dce3;
    --primary: #27364a;
    --primary-light: #eef2f7;
    --danger: #8a1f1f;
    --success: #1f6b3b;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.45;
}

a { color: #1b4f8f; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    background: var(--primary);
    color: white;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}
.topbar .sub { display: block; font-size: 13px; opacity: .8; margin-top: 2px; }
.topbar a { color: white; margin-left: 16px; font-weight: 600; }

.container { max-width: 1100px; margin: 28px auto; padding: 0 18px; }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px; }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
}

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.stat { background: var(--primary-light); border-radius: 10px; padding: 16px; }
.stat strong { display: block; font-size: 28px; margin-bottom: 4px; }

label { display: block; font-weight: 700; margin: 13px 0 5px; }
input, select, textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    background: white;
}
textarea { min-height: 120px; }

button, .button {
    display: inline-block;
    background: var(--primary);
    color: white;
    border: 0;
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 14px;
}
button.secondary, .button.secondary { background: #586579; }
button.danger, .button.danger { background: var(--danger); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }

.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 700;
    background: var(--primary-light);
    color: var(--primary);
}

.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 18px; background: #fff; border: 1px solid var(--border); }
.alert.success { border-color: #b7e1c3; color: var(--success); }
.alert.error { border-color: #e4b5b5; color: var(--danger); }

.login-box { max-width: 460px; margin: 60px auto; }
.help { color: var(--muted); font-size: 14px; margin-top: 6px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.status-pending { background: #fff7d6; color: #7a5b00; }
.status-verified { background: #e4f6e9; color: #1f6b3b; }
.status-rejected { background: #f8e1e1; color: #8a1f1f; }
.logo-preview img { max-width: 220px; max-height: 120px; border: 1px solid var(--border); border-radius: 8px; padding: 8px; background: white; }

.print-body { background: #dfe3e8; }
.print-actions { max-width: 900px; margin: 20px auto; display: flex; gap: 10px; justify-content: flex-end; }
.certificate {
    max-width: 900px;
    margin: 20px auto 60px;
    background: white;
    padding: 48px;
    border: 1px solid #c8ced8;
    box-shadow: 0 8px 20px rgba(0,0,0,.08);
}
.certificate-header { display: flex; gap: 22px; align-items: center; }
.certificate-header h1 { margin: 0 0 8px; font-size: 28px; }
.certificate-header p { margin: 2px 0; color: var(--muted); }
.certificate-logo { width: 120px; min-width: 120px; height: 120px; display:flex; align-items:center; justify-content:center; }
.certificate-logo img { max-width: 120px; max-height: 120px; }
.logo-placeholder { border: 3px solid var(--primary); color: var(--primary); width: 105px; height: 105px; border-radius: 50%; display:flex; align-items:center; justify-content:center; font-weight: 800; letter-spacing: .08em; }
.certificate h2 { text-align:center; text-transform: uppercase; letter-spacing: .08em; margin-top: 28px; }
.certificate-statement { font-size: 18px; line-height: 1.65; }
.certificate-summary { margin: 22px 0; }
.certificate-table th, .certificate-table td { font-size: 13px; }
.signature-block { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; margin-top: 60px; }
.signature-line { border-bottom: 1px solid #111; height: 30px; margin-bottom: 8px; }
.certificate-footer { margin-top: 40px; color: var(--muted); font-size: 12px; text-align: center; }

@media print {
    body { background: white; }
    .no-print, .topbar, .footer { display: none !important; }
    .certificate { box-shadow: none; border: none; margin: 0; max-width: none; padding: 22px; }
    a { color: black; text-decoration: none; }
}

/* v2.4 clean hour verification layout */
.certificate-clean {
    max-width: 850px;
    padding: 44px 54px;
    overflow: hidden;
}
.certificate-header-clean {
    display: grid;
    grid-template-columns: minmax(90px, 230px) 1fr;
    gap: 22px;
    align-items: center;
    min-height: 74px;
    margin-bottom: 18px;
}
.certificate-logo-clean {
    width: 100%;
    max-width: 230px;
    height: 74px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
}
.certificate-logo-clean img {
    display: block;
    max-width: 100%;
    max-height: 72px;
    object-fit: contain;
}
.certificate-logo-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 3px solid #27364a;
    color: #27364a;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: .05em;
}
.certificate-org-clean h1 {
    margin: 0 0 4px;
    font-size: 24px;
    line-height: 1.15;
}
.certificate-org-clean p {
    margin: 1px 0;
    color: #667085;
    font-size: 12px;
    line-height: 1.25;
}
.certificate-rule {
    border-top: 2px solid #1f2937;
    margin: 16px 0 24px;
}
.certificate-title-block h2 {
    text-align: left;
    text-transform: uppercase;
    letter-spacing: .035em;
    font-size: 27px;
    line-height: 1.15;
    margin: 0 0 16px;
}
.certificate-title-block p {
    font-size: 16px;
    line-height: 1.55;
    margin: 0 0 22px;
}
.certificate-summary-clean {
    border: 1.5px solid #1f2937;
    padding: 16px 20px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin: 24px 0;
}
.certificate-summary-clean span {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #667085;
    margin-bottom: 5px;
}
.certificate-summary-clean strong {
    display: block;
    font-size: 14px;
    line-height: 1.25;
}
.verified-detail-clean {
    margin-top: 8px;
}
.verified-detail-clean h3 {
    font-size: 20px;
    margin: 0 0 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #1f2937;
}
.verified-entry-clean {
    border-bottom: 1px solid #d7dce3;
    padding: 10px 0 12px;
    page-break-inside: avoid;
}
.verified-entry-main {
    display: flex;
    gap: 13px;
    flex-wrap: wrap;
    font-size: 13px;
    line-height: 1.35;
}
.verified-entry-sub {
    margin-top: 4px;
    font-size: 12px;
    color: #475467;
    font-weight: 700;
}
.verified-entry-clean p {
    margin: 5px 0 0;
    font-size: 13px;
    line-height: 1.4;
}
.signature-block-clean {
    margin-top: 64px;
    page-break-inside: avoid;
}
.certificate-footer {
    margin-top: 36px;
}

@media (max-width: 720px) {
    .certificate-clean { padding: 28px 24px; }
    .certificate-header-clean { grid-template-columns: 1fr; }
    .certificate-summary-clean { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media print {
    .certificate-clean {
        width: 100%;
        max-width: none;
        padding: 36px 42px;
        overflow: visible;
    }
    .certificate-header-clean {
        grid-template-columns: minmax(90px, 200px) 1fr;
        gap: 18px;
        margin-bottom: 14px;
    }
    .certificate-logo-clean {
        max-width: 200px;
        height: 60px;
    }
    .certificate-logo-clean img {
        max-height: 58px;
    }
    .certificate-title-block h2 {
        font-size: 24px;
    }
    .certificate-title-block p {
        font-size: 14px;
    }
    .certificate-summary-clean {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        padding: 12px 14px;
        gap: 12px;
    }
}


/* v2.5 HR cleanup */
.template-box {
    width: 100%;
    min-height: 220px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    white-space: pre-wrap;
}
.notice-box {
    background: #fffdf8;
    border: 1px solid var(--border);
    border-left: 5px solid var(--primary);
    border-radius: 10px;
    padding: 14px;
    margin: 14px 0;
}
.notice-box.gold { border-left-color: #d7a536; }
.notice-box.teal { border-left-color: #2f9c9a; }
.status-active { background: #e4f6e9; color: #1f6b3b; }
.status-inactive { background: #f8e1e1; color: #8a1f1f; }
.status-pending-person { background: #fff7d6; color: #7a5b00; }
.inline-form {
    display: inline;
}
.compact-form {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
}
.compact-form label {
    margin-top: 0;
}
.email-template-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 10px;
}
