* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Tahoma, Arial, sans-serif;
    direction: ltr;
    background:
        radial-gradient(circle at top, rgba(174, 138, 79, 0.22), transparent 36%),
        linear-gradient(135deg, #f8f3e9 0%, #f2efe8 45%, #e8edf3 100%);
    color: #1f2937;
}

:root {
    --certificate-print-width: 297mm;
    --certificate-print-height: 210mm;
    --certificate-name-top: 86mm;
    --certificate-name-side-padding: 28mm;
    --certificate-name-font-size: 30px;
    --certificate-name-color: #000000;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

.container {
    width: min(1100px, calc(100% - 32px));
    margin: 0 auto;
}

.hero-card,
.message-card,
.panel,
.stat-card {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(128, 98, 43, 0.18);
    border-radius: 24px;
    box-shadow: 0 24px 70px rgba(71, 85, 105, 0.12);
    backdrop-filter: blur(12px);
}

.landing-page .container,
.dashboard-page .container {
    padding: 48px 0 64px;
}

.hero-card,
.message-card {
    padding: 32px;
}

.brand-logo {
    display: block;
    width: min(420px, 100%);
    margin: 0 auto 24px;
}

.dashboard-logo {
    margin: 0 0 16px;
    width: min(320px, 100%);
}

.hero-card {
    max-width: 760px;
    margin: 48px auto 0;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 14px;
    color: #8a6b33;
    font-size: 14px;
    font-weight: 700;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 16px;
    font-size: clamp(30px, 5vw, 48px);
    line-height: 1.15;
}

.lead,
.certificate-body,
.certificate-intro {
    color: #4b5563;
    line-height: 1.8;
}

.issue-form {
    display: grid;
    gap: 14px;
    margin-top: 28px;
}

.issue-form label {
    font-weight: 700;
    color: #374151;
}

.issue-form input {
    width: 100%;
    padding: 15px 16px;
    border: 1px solid #d5d9e0;
    border-radius: 14px;
    background: #fff;
}

button,
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
    padding: 0 22px;
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button {
    background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
    color: #fff;
    box-shadow: 0 18px 36px rgba(15, 118, 110, 0.2);
}

.secondary-button {
    background: #fff;
    color: #1f2937;
    border: 1px solid #d7dde5;
}

button:hover,
.secondary-button:hover {
    transform: translateY(-1px);
}

.quick-links {
    margin-top: 18px;
}

.quick-links a {
    color: #115e59;
    font-weight: 700;
}

.dashboard-header,
.certificate-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    padding: 24px;
}

.stat-card span {
    display: block;
    margin-bottom: 12px;
    color: #6b7280;
}

.stat-card strong {
    font-size: 34px;
    color: #111827;
}

.panel {
    padding: 24px;
    margin-bottom: 24px;
}

.panel-heading h2 {
    margin-bottom: 18px;
    font-size: 22px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

th {
    color: #6b7280;
    font-size: 14px;
}

.empty-state {
    text-align: center;
    color: #6b7280;
}

.certificate-page {
    background: #eef1f6;
}

.certificate-shell {
    padding: 0;
}

.certificate-template {
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.certificate-frame {
    position: relative;
    overflow: hidden;
    aspect-ratio: 297 / 210;
    min-height: 760px;
    padding: 0;
    border: 0;
    border-radius: 0;
    text-align: center;
}

.certificate-logo {
    display: block;
    width: min(460px, 100%);
    margin: 0 auto 30px;
}

.certificate-background-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 0;
    pointer-events: none;
}

.certificate-name {
    position: absolute;
    top: var(--certificate-name-top);
    left: 50%;
    width: calc(100% - (var(--certificate-name-side-padding) * 2));
    transform: translateX(-50%);
    z-index: 2;
    color: var(--certificate-name-color);
    font-size: var(--certificate-name-font-size);
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    background: transparent;
    white-space: normal;
}

@media (max-width: 768px) {
    .hero-card,
    .message-card,
    .panel,
    .certificate-template {
        border-radius: 18px;
    }

    .certificate-toolbar,
    .dashboard-header {
        flex-direction: column;
        align-items: stretch;
    }

    .certificate-frame {
        min-height: auto;
    }

    .certificate-name {
        top: 46%;
        width: calc(100% - 48px);
        font-size: 18px;
    }
}

@media print {
    @page {
        size: landscape;
        margin: 0;
    }

    html,
    body {
        width: 100%;
        height: auto;
        margin: 0;
        padding: 0;
        background: #fff;
        overflow: hidden;
    }

    .no-print {
        display: none !important;
    }

    .certificate-shell {
        width: 100%;
        height: auto;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden;
        page-break-after: avoid;
        break-after: avoid-page;
    }

    .certificate-template {
        width: 100%;
        height: auto;
        min-width: 0;
        max-width: none;
        min-height: 0;
        max-height: none;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
        overflow: hidden;
        page-break-after: avoid;
        break-after: avoid-page;
    }

    .certificate-frame {
        position: relative;
        width: 100%;
        height: auto;
        min-width: 0;
        max-width: none;
        min-height: 0;
        max-height: none;
        aspect-ratio: 297 / 210;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        overflow: hidden;
        page-break-inside: avoid;
        break-inside: avoid-page;
    }

    .certificate-background-layer {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        display: block;
    }

    .certificate-name {
        position: absolute;
        top: var(--certificate-name-top);
        left: 50%;
        width: calc(100% - (var(--certificate-name-side-padding) * 2));
        transform: translateX(-50%);
        z-index: 2;
        color: var(--certificate-name-color);
        font-size: var(--certificate-name-font-size);
        font-weight: 700;
        line-height: 1.25;
        text-align: center;
        background: transparent;
        white-space: normal;
    }
}
