:root {
    --primary-color: #1a3a6a;
    --accent-color: #c5b358;
    --bg-color: #f8f6f2;
    --text-dark: #1f2937;
    --text-light: #4b5563;
}

body {
    font-family: "Lato", sans-serif;
}

.app-body {
    background:
        radial-gradient(circle at 0% 0%, rgba(26, 58, 106, 0.12), transparent 34%),
        radial-gradient(circle at 100% 0%, rgba(197, 179, 88, 0.15), transparent 32%),
        linear-gradient(180deg, #f3f5f9 0%, #e7ebf3 100%);
}

.app-topbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.app-eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #6b7280;
    font-size: 0.72rem;
    font-weight: 700;
}

.app-title {
    margin: 0.25rem 0 0 0;
    font-family: "Merriweather", serif;
    color: var(--primary-color);
    font-size: clamp(1.6rem, 2.3vw, 2.4rem);
    line-height: 1.15;
}

.app-subtitle {
    margin: 0.5rem 0 0 0;
    color: #4b5563;
    font-size: 0.95rem;
}

.app-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.18s ease;
}

.nav-chip:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.nav-chip-active {
    border-color: #1a3a6a;
    color: #1a3a6a;
    background: #e7efff;
}

.nav-chip-danger {
    border-color: #fecaca;
    color: #991b1b;
    background: #fff1f2;
}

.panel {
    background: #ffffff;
    border-radius: 0.85rem;
    box-shadow: 0 16px 35px rgba(15, 23, 42, 0.12);
}

.panel-soft {
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.workspace-context-panel {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 255, 0.94));
}

.workspace-context-summary {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid #dbe4f1;
    border-radius: 0.75rem;
    padding: 0.6rem 0.75rem;
}

.workspace-context-summary strong {
    color: #1a3a6a;
}

.workspace-context-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.95rem;
    align-items: stretch;
}

.workspace-card {
    border: 1px solid #dbe4f1;
    border-radius: 0.85rem;
    padding: 0.85rem;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 100%;
}

.workspace-card .field-input {
    margin-top: 0.25rem;
}

.workspace-card .btn-secondary,
.workspace-card .btn-outline,
.workspace-card .btn-primary {
    margin-top: auto;
    min-width: 9rem;
}

.workspace-card p.text-sm {
    line-height: 1.45;
}

.workspace-card-danger {
    border-color: #fecaca;
    background: linear-gradient(180deg, #fffaf9 0%, #fff4f4 100%);
}

.workspace-card-danger .field-label {
    color: #7f1d1d;
}

@media (max-width: 1200px) {
    .workspace-context-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }

    .workspace-card .btn-secondary,
    .workspace-card .btn-outline,
    .workspace-card .btn-primary {
        width: 100%;
    }
}

.field-label {
    display: block;
    font-size: 0.83rem;
    font-weight: 700;
    color: #475569;
}

.field-input {
    margin-top: 0.35rem;
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 0.6rem;
    padding: 0.55rem 0.75rem;
    font-size: 0.92rem;
    color: #1f2937;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.field-input:focus {
    outline: none;
    border-color: #1a3a6a;
    box-shadow: 0 0 0 3px rgba(26, 58, 106, 0.15);
}

.file-input {
    margin-top: 0.35rem;
    width: 100%;
    font-size: 0.86rem;
    color: #475569;
}

.section-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #334155;
}

.check-line {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.84rem;
    color: #475569;
}

.btn-primary,
.btn-secondary,
.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.65rem;
    padding: 0.62rem 0.95rem;
    font-size: 0.9rem;
    font-weight: 700;
    transition: all 0.18s ease;
    border: 1px solid transparent;
}

.btn-primary {
    color: #ffffff;
    background: linear-gradient(90deg, #1a3a6a 0%, #274a80 100%);
}

.btn-primary:hover {
    filter: brightness(1.03);
}

.btn-secondary {
    color: #1f2937;
    background: #e5e7eb;
    border-color: #cbd5e1;
}

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

.btn-outline {
    color: #334155;
    background: #ffffff;
    border-color: #cbd5e1;
}

.btn-outline:hover {
    background: #f8fafc;
}

.flash-ok {
    color: #065f46;
    background: #d1fae5;
    border: 1px solid #6ee7b7;
    border-radius: 0.6rem;
    padding: 0.75rem;
}

.flash-error {
    color: #7f1d1d;
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 0.6rem;
    padding: 0.75rem;
}

.thumb {
    max-height: 70px;
    border: 1px solid #d1d5db;
    border-radius: 0.45rem;
    background: #ffffff;
    padding: 0.25rem;
}

.status {
    min-height: 1.25rem;
    font-size: 0.95rem;
}

.badge-ok,
.badge-fail {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.2rem 0.55rem;
}

.badge-ok {
    color: #065f46;
    background: #d1fae5;
}

.badge-fail {
    color: #991b1b;
    background: #fee2e2;
}

.student-row-copy {
    transition: background-color 0.16s ease;
}

.student-row-copy:hover {
    background: #f8fafc;
}

.menu-dropdown {
    position: relative;
    display: inline-block;
    text-align: left;
}

.menu-dropdown summary {
    list-style: none;
}

.menu-dropdown summary::-webkit-details-marker {
    display: none;
}

.menu-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    font-weight: 800;
    cursor: pointer;
    user-select: none;
}

.menu-trigger:hover {
    background: #f1f5f9;
}

.menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.25rem);
    min-width: 13rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 0.65rem;
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.18);
    padding: 0.35rem;
    z-index: 30;
}

.menu-item {
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    border-radius: 0.5rem;
    padding: 0.48rem 0.6rem;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
}

.menu-item-neutral {
    color: #1f2937;
}

.menu-item-neutral:hover {
    background: #f1f5f9;
}

.menu-item-danger {
    color: #991b1b;
}

.menu-item-danger:hover {
    background: #fee2e2;
}

.auth-shell {
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.2);
}

.auth-hero {
    background:
        radial-gradient(circle at 30% 20%, rgba(197, 179, 88, 0.2), transparent 60%),
        linear-gradient(160deg, #1a3a6a 0%, #243b64 100%);
    color: #e2e8f0;
}

.auth-kicker {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    font-weight: 800;
    margin: 0;
    color: #cbd5e1;
}

.auth-title {
    font-family: "Merriweather", serif;
    margin: 0.55rem 0 0 0;
    font-size: 2rem;
    line-height: 1.15;
}

.auth-copy {
    margin-top: 1rem;
    line-height: 1.55;
    color: #dbe4f3;
    font-size: 0.95rem;
}

.auth-note {
    margin-top: 1.2rem;
    font-size: 0.82rem;
    color: #bfdbfe;
}

.preview-wrap {
    width: 100%;
}

.student-dashboard-preview {
    padding: 0.2rem 0 1rem;
}

.student-dashboard-preview #certificatePreview {
    transform: translateY(-6px);
}

.admin-dashboard-preview {
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 0.9rem;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.94), rgba(241, 245, 249, 0.86));
    padding: 1rem;
}

.admin-dashboard-preview #certificatePreview {
    margin: 0 auto;
    max-width: 100%;
}

.admin-dashboard-preview #certificatePreview .certificate-content {
    padding: 1.45rem 1.65rem;
}

.admin-dashboard-preview #certificatePreview .certificate-main {
    margin-top: 0.55rem;
    margin-bottom: 0.95rem;
}

.admin-dashboard-preview #certificatePreview .logo-anchor {
    width: 4.4rem;
    height: 4.4rem;
    margin-bottom: 0.4rem;
}

.admin-dashboard-preview #certificatePreview .logo-anchor .logo-shell {
    width: 166.67%;
    height: 166.67%;
}

.admin-dashboard-preview #certificatePreview .heading {
    font-size: clamp(1.9rem, 2.5vw, 2.55rem) !important;
    letter-spacing: 0.14em;
}

.admin-dashboard-preview #certificatePreview .separator {
    margin-top: 0.55rem;
}

.admin-dashboard-preview #certificatePreview .recipient-name {
    font-size: clamp(2.8rem, 4.8vw, 4.25rem) !important;
    min-height: 0;
    line-height: 1.08;
    margin-top: 0.65rem;
    margin-bottom: 0.7rem;
}

.admin-dashboard-preview #certificatePreview .course-name {
    font-size: clamp(1.8rem, 2.7vw, 2.65rem) !important;
    min-height: 0;
}

.admin-dashboard-preview #certificatePreview .signature-slot {
    min-height: 2.75rem;
    height: 2.75rem;
}

.admin-dashboard-preview #certificatePreview .signature-image {
    max-height: 5.9rem;
    max-width: 18rem;
    bottom: -1.1rem;
}

.admin-dashboard-preview #certificatePreview .certificate-signatories {
    gap: 1.3rem;
}

.admin-dashboard-preview #certificatePreview .certificate-footer p {
    line-height: 1.2;
}

.admin-dashboard-preview #certificatePreview .certificate-number-badge {
    top: 0.65rem;
    font-size: 0.58rem;
}

.admin-dashboard-preview #certificatePreview .certificate-qr-badge {
    top: 2.1rem;
    width: 2.7rem;
    height: 2.7rem;
}

.admin-dashboard-preview #certificatePreview .certificate-qr-label {
    font-size: 0.31rem;
}

.admin-dashboard-preview #certificatePreview .certificate-qr-right .certificate-qr-label {
    left: -0.54rem;
}

.admin-dashboard-preview #certificatePreview .certificate-qr-left .certificate-qr-label {
    left: calc(100% + 0.54rem);
}

.secure-lock {
    position: relative;
}

.secure-lock .secure-lock-content {
    transition: filter 0.2s ease;
}

.secure-lock.is-locked .secure-lock-content {
    filter: blur(22px) brightness(0.45) saturate(0.25);
    pointer-events: none;
    user-select: none;
}

.secure-lock.is-locked::after {
    content: "Locked: enter valid Student ID + Secret Code";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    background: rgba(255, 255, 255, 0.9);
    color: #1a3a6a;
    border: 1px solid #93a6c8;
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    pointer-events: none;
}

/* Certificate styles (intentionally unchanged visually). */
.certificate-container {
    font-family: "Lato", sans-serif;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    width: 100%;
    aspect-ratio: 1.414 / 1;
    position: relative;
    overflow: hidden;
    background-color: var(--bg-color);
    display: flex;
    padding: 1rem;
}

.certificate-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-48 0c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zM32 63c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-48 0c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48-50c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-24 0c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7z' fill='%231a3a6a' fill-opacity='0.04' fill-rule='evenodd'/%3E%3C/svg%3E");
    opacity: 0.8;
    z-index: 1;
}

.certificate-content {
    padding: 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1;
    position: relative;
    z-index: 2;
}

.recipient-name {
    font-family: "Merriweather", serif;
    font-weight: 900;
    color: var(--primary-color);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    min-height: 80px;
}

.course-name {
    font-family: "Merriweather", serif;
    font-weight: 700;
    color: var(--text-dark);
    min-height: 40px;
}

.heading {
    font-family: "Merriweather", serif;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--primary-color);
    line-height: 1.2;
    margin: 0;
}

.signature {
    font-family: "Merriweather", serif;
    font-weight: 700;
    min-height: 28px;
}

.certificate-header {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.separator {
    width: 150px;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--accent-color), transparent);
    margin: 0.8rem auto 0 auto;
}

.logo-anchor {
    position: relative;
    width: 6rem;
    height: 6rem;
    margin-bottom: 0.9rem;
}

.logo-shell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 166.67%;
    height: 166.67%;
    position: absolute;
    top: 46%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.logo-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.certificate-number-badge {
    position: absolute;
    top: 1rem;
    z-index: 6;
    font-size: 0.68rem;
    font-weight: 800;
    color: #1a3a6a;
    letter-spacing: 0.07em;
    line-height: 1.15;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
}

.certificate-number-left {
    left: 1rem;
    text-align: left;
}

.certificate-number-right {
    right: 1rem;
    text-align: right;
}

#certCertificateNumber {
    font-weight: 900;
    letter-spacing: 0.08em;
    color: #1a3a6a;
}

.certificate-qr-badge {
    position: absolute;
    top: 2.55rem;
    width: 3.35rem;
    height: 3.35rem;
    z-index: 6;
    pointer-events: none;
}

.certificate-qr-left {
    left: 1rem;
}

.certificate-qr-right {
    right: 1rem;
}

.certificate-qr-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.certificate-qr-label {
    position: absolute;
    top: 0;
    height: 100%;
    width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.39rem;
    font-weight: 700;
    color: #1a3a6a;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1;
    opacity: 0.9;
    pointer-events: none;
}

.certificate-qr-label-text {
    display: block;
    white-space: nowrap;
    transform: rotate(-90deg);
    transform-origin: center center;
}

.certificate-qr-right .certificate-qr-label {
    left: -0.7rem;
}

.certificate-qr-left .certificate-qr-label {
    left: calc(100% + 0.7rem);
}

.signature-slot {
    min-height: 56px;
    height: 56px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    position: relative;
    overflow: visible;
}

.signature-image {
    max-height: 112px;
    max-width: 440px;
    width: auto;
    object-fit: contain;
    position: absolute;
    left: 50%;
    bottom: -24px;
    transform: translateX(-50%);
    z-index: 2;
    pointer-events: none;
}

.signature-slot .signature {
    position: relative;
    z-index: 2;
}

.certificate-signatories {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.1rem;
}

.signature-party {
    flex: 1 1 0;
    min-width: 0;
}

.certificate-footer {
    position: relative;
}

.institution-seal-overlay {
    position: absolute;
    left: 50%;
    bottom: -1.25rem;
    transform: translateX(-50%);
    width: 19%;
    max-width: 200px;
    min-width: 125px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4;
    pointer-events: none;
}

.institution-seal-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.template-classic {
}

.template-modern {
    background: #f5f8ff;
}

.template-modern::before {
    background-image:
        linear-gradient(120deg, rgba(26, 58, 106, 0.12) 0%, transparent 55%),
        linear-gradient(0deg, rgba(15, 23, 42, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 23, 42, 0.05) 1px, transparent 1px);
    background-size: auto, 26px 26px, 26px 26px;
    opacity: 1;
}

.template-modern .certificate-content {
    padding: 2.2rem 2.5rem;
}

.template-modern .certificate-header {
    align-items: flex-start;
    text-align: left;
}

.template-modern .separator {
    margin: 0.8rem 0 0;
    width: 200px;
    background: linear-gradient(to right, rgba(26, 58, 106, 0.9), rgba(26, 58, 106, 0.15));
}

.template-modern .certificate-main {
    align-items: flex-start;
    text-align: left;
}

.template-modern .recipient-name {
    text-align: left;
}

.template-modern .course-name {
    text-align: left;
}

.template-modern .certificate-signatories {
    justify-content: space-between;
}

.template-modern .signature-party {
    text-align: left;
}

.template-modern .signature-slot {
    justify-content: flex-start;
}

.template-modern .signature-image {
    left: 0;
    transform: none;
}

.template-sunrise {
    background: #fff8ef;
}

.template-sunrise::before {
    background-image:
        radial-gradient(circle at 15% 18%, rgba(251, 146, 60, 0.2), transparent 26%),
        radial-gradient(circle at 85% 22%, rgba(59, 130, 246, 0.18), transparent 22%),
        radial-gradient(circle at 65% 78%, rgba(245, 158, 11, 0.16), transparent 20%);
    opacity: 1;
}

.template-sunrise .certificate-content {
    border: 4px double rgba(194, 65, 12, 0.35);
    border-radius: 14px;
    padding: 1.8rem 2.2rem;
    background: rgba(255, 255, 255, 0.72);
}

.template-sunrise .heading {
    color: #9a3412;
    letter-spacing: 0.14em;
}

.template-sunrise .separator {
    background: linear-gradient(to right, transparent, #f97316, transparent);
}

.template-sunrise .recipient-name {
    color: #9a3412;
}

.template-sunrise .course-name {
    color: #7c2d12;
}

.template-sunrise .certificate-main p {
    color: #7c2d12;
}

.template-sunrise #certCompletionDate,
.template-sunrise #certInstitutionName {
    color: #9a3412;
}

.template-sunrise .signature,
.template-sunrise #certInstructorName,
.template-sunrise #certDeanName {
    color: #7c2d12;
}

@media (max-width: 700px) {
    .template-modern .certificate-header,
    .template-modern .certificate-main,
    .template-modern .signature-party {
        text-align: center;
        align-items: center;
    }

    .template-modern .separator {
        margin: 0.8rem auto 0;
    }

    .template-modern .signature-slot {
        justify-content: center;
    }

    .template-modern .signature-image {
        left: 50%;
        transform: translateX(-50%);
    }

    .certificate-signatories {
        flex-direction: column;
        align-items: center;
        gap: 0.7rem;
    }

    .institution-seal-overlay {
        width: 24%;
        min-width: 105px;
        max-width: 150px;
        bottom: -0.2rem;
    }

    .certificate-number-badge {
        top: 0.7rem;
        font-size: 0.56rem;
        padding: 0.2rem 0.45rem;
    }

    .certificate-number-left {
        left: 0.45rem;
    }

    .certificate-number-right {
        right: 0.45rem;
    }

    .certificate-qr-badge {
        top: 1.9rem;
        width: 2.45rem;
        height: 2.45rem;
    }

    .certificate-qr-left {
        left: 0.45rem;
    }

    .certificate-qr-right {
        right: 0.45rem;
    }

    .certificate-qr-label {
        font-size: 0.32rem;
    }

    .certificate-qr-right .certificate-qr-label {
        left: -0.54rem;
    }

    .certificate-qr-left .certificate-qr-label {
        left: calc(100% + 0.54rem);
    }
}
