:root {
    --orange: #f76a0c;
    --orange-dark: #d95a06;
    --blue: #0460e7;
    --blue-dark: #0349b5;
    --light-blue: #c9e0f3;
    --bg: #f5f7fa;
    --surface: #ffffff;
    --text: #1a2332;
    --muted: #5b6b7f;
    --border: #e2e8f0;
    --green: #0f9d58;
    --red: #d93025;
    --amber: #b26a00;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.55;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* Top bar */
.topbar {
    background: linear-gradient(90deg, var(--orange) 0%, var(--orange-dark) 60%, var(--orange) 100%);
    box-shadow: var(--shadow);
    position: sticky; top: 0; z-index: 50;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; }
.brand-logo { height: 38px; width: auto; }
.nav { display: flex; gap: 20px; align-items: center; }
.nav a { color: #fff; font-weight: 600; font-size: 15px; }
.nav a:hover { text-decoration: underline; }

main.container { padding-top: 28px; padding-bottom: 48px; }

/* Hero */
.hero {
    background: linear-gradient(120deg, var(--blue-dark), var(--blue) 45%, var(--light-blue));
    color: #fff; border-radius: var(--radius); padding: 48px 40px; margin-bottom: 28px;
}
.hero h1 { margin: 0 0 10px; font-size: 34px; }
.hero .lead { font-size: 18px; max-width: 640px; margin: 0 0 22px; opacity: .95; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; margin: 20px 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 10px; color: var(--blue-dark); }

/* Buttons */
.btn {
    display: inline-block; border: none; cursor: pointer; font-weight: 600; font-size: 15px;
    padding: 10px 18px; border-radius: 8px; text-decoration: none; transition: background .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); }
.btn-outline { background: transparent; color: var(--blue); border: 1px solid var(--blue); }
.btn-outline:hover { background: var(--light-blue); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-approve { background: var(--green); color: #fff; }
.btn-approve:hover { background: #0c7d45; }
.btn-reject { background: var(--red); color: #fff; }
.btn-reject:hover { background: #b02118; }

/* Page head */
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 26px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }

/* Forms */
.form fieldset { border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 20px; padding: 16px 20px; background: var(--surface); }
.form legend { font-weight: 700; color: var(--blue-dark); padding: 0 6px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-full { grid-column: 1 / -1; }
.field label { font-weight: 600; font-size: 14px; }
input, textarea, select {
    padding: 9px 11px; border: 1px solid var(--border); border-radius: 7px; font-size: 15px;
    font-family: inherit; background: #fff; color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--light-blue); border-color: var(--blue); }
.mobile-row { display: flex; gap: 8px; }
.cc-input { width: 110px; }
.checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.radio-row { display: flex; gap: 16px; }
.narrow { max-width: 420px; }
.inline { display: inline; }
hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; margin: 0 0 18px; border: 1px solid; }
.alert-success { background: #e7f6ec; border-color: #b6e4c6; color: #0a5c31; }
.alert-error { background: #fdecea; border-color: #f5c6c0; color: #8a1f16; }
.alert-info { background: #e8f1fc; border-color: #c9e0f3; color: #0349b5; }
.alert ul { margin: 0; padding-left: 18px; }

/* Tables */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: #f0f4f9; color: var(--blue-dark); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
small { color: var(--muted); }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-pending { background: #fef3e2; color: var(--amber); }
.badge-approved { background: #e7f6ec; color: #0a5c31; }
.badge-rejected { background: #fdecea; color: #8a1f16; }

.muted { color: var(--muted); }

/* Certificate */
.certificate { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.cert-inner { padding: 48px; border: 3px double var(--orange); border-radius: var(--radius); margin: 6px; text-align: center; }
.cert-head img { height: 48px; }
.cert-title { font-size: 30px; margin: 22px 0 4px; color: var(--blue-dark); letter-spacing: 1px; }
.cert-sub { color: var(--muted); margin: 8px 0 4px; }
.cert-company { font-size: 30px; font-weight: 800; color: var(--orange-dark); margin: 10px 0; }
.cert-body { max-width: 620px; margin: 14px auto; color: var(--text); }
.cert-meta { display: flex; justify-content: center; gap: 40px; margin: 30px 0; flex-wrap: wrap; }
.cert-meta-item { display: flex; flex-direction: column; }
.cert-meta-item .label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.cert-meta-item .value { font-size: 20px; font-weight: 700; }
.cert-sign { margin-top: 44px; display: inline-block; text-align: center; }
.signature { height: 64px; }
.signature-text { font-family: "Segoe Script", "Brush Script MT", cursive; font-size: 34px; color: var(--blue-dark); }
.sign-line { width: 220px; border-top: 1px solid var(--text); margin: 6px auto 4px; }
.sign-name { font-weight: 700; }
.sign-title { color: var(--muted); font-size: 13px; }

/* Footer */
.footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: 40px; }
.footer-inner { display: flex; justify-content: space-between; padding: 20px; color: var(--muted); font-size: 14px; }

/* Responsive */
@media (max-width: 640px) {
    .grid { grid-template-columns: 1fr; }
    .hero { padding: 32px 22px; }
    .hero h1 { font-size: 26px; }
    .cert-inner { padding: 24px; }
}

/* Print: only show the certificate */
@media print {
    body { background: #fff; }
    .topbar, .footer, .page-head, .alert, .btn { display: none !important; }
    main.container { padding: 0; max-width: none; }
    .certificate { box-shadow: none; border: none; }
}
