body {
    background: #f3f2ef;
    font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
    color: #1f2937;
}

.navbar-custom {
    background: #ffffff;
    backdrop-filter: blur(18px);
    border-bottom: 1px solid #e0e0e0;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.home-topbar {
    max-width: 1128px;
}

.navbar-brand-custom {
    color: #b71c1c !important;
    font-weight: 800;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #b71c1c, #8d1515);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(183, 28, 28, 0.18);
}

.brand-text {
    letter-spacing: -0.02em;
}

.nav-link-custom {
    color: #666666 !important;
    font-size: 0.95rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    min-height: 52px;
    padding: 4px 10px !important;
    border-radius: 0;
    transition: color 0.2s ease, transform 0.2s ease;
    position: relative;
}

.nav-link-custom i {
    font-size: 1.05rem;
    margin-bottom: 3px;
}

.nav-link-custom span {
    font-size: 0.75rem;
    font-weight: 500;
}

.nav-link-custom:hover {
    color: #b71c1c !important;
}

.nav-link-custom:hover::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: -1px;
    height: 2px;
    background: #b71c1c;
}

.btn-add-cert {
    background: linear-gradient(135deg, #b71c1c, #8d1515);
    color: #ffffff;
    font-weight: bold;
    border-radius: 999px;
    padding: 10px 18px;
    border: 0;
    box-shadow: 0 12px 20px rgba(183, 28, 28, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-add-cert:hover {
    background: linear-gradient(135deg, #a81818, #7a1212);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 16px 24px rgba(183, 28, 28, 0.24);
}

.main-content {
    margin-top: 92px;
}

.card-linked {
    background: #ffffff;
    border: 1px solid #e0dfdc;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    margin-bottom: 16px;
    overflow: hidden;
}

.card-achievement-linked {
    border-left: 0;
    position: relative;
}

.card-achievement-linked::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: linear-gradient(180deg, #b71c1c, #ef5350);
    border-radius: 12px 0 0 12px;
}

.home-feed-shell {
    max-width: 1128px;
    width: 100%;
}

.feed-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ffffff;
    box-shadow: 0 0 5px rgba(0,0,0,0.1);
}

.avatar-stack {
    position: relative;
    overflow: hidden;
    border-radius: 50%;
    flex: 0 0 auto;
}

.avatar-stack-image,
.avatar-stack-fallback {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
}

.avatar-stack-image {
    display: block;
    object-fit: cover;
    z-index: 2;
}

.avatar-stack-fallback {
    z-index: 1;
    font-weight: 800;
}

.messages-wrap {
    max-width: 880px;
    margin: 0 auto 1rem;
}

.alert {
    border: 0;
    border-radius: 18px;
}

.certificate-preview-frame {
    position: relative;
    width: 100%;
    min-height: 460px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background:
        radial-gradient(circle at top left, rgba(183, 28, 28, 0.08), transparent 32%),
        linear-gradient(145deg, #fffdfb, #f7f9fc);
    overflow: hidden;
}

.certificate-preview-frame canvas,
.certificate-preview-frame img {
    width: auto;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
    background-color: #fff;
    object-fit: contain;
}

.certificate-preview-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #7a7f87;
    font-size: 0.92rem;
}

.certificate-preview-fallback {
    text-align: center;
    color: #6b7280;
    max-width: 320px;
}

.stats-pill,
.stats-card {
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    border: 1px solid rgba(229, 231, 235, 0.9);
    border-radius: 18px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 92px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.stats-pill strong,
.stats-card strong {
    font-size: 1.45rem;
    color: #111827;
}

.stats-pill span,
.stats-card span {
    font-size: 0.8rem;
    color: #6b7280;
}

.hero-panel {
    background:
        radial-gradient(circle at 10% 15%, rgba(255, 255, 255, 0.18), transparent 24%),
        radial-gradient(circle at top right, rgba(255, 196, 0, 0.20), transparent 30%),
        linear-gradient(135deg, #671111 0%, #b71c1c 44%, #f59e0b 130%);
    color: #fff;
    border-radius: 30px;
    padding: 36px;
    box-shadow: 0 24px 48px rgba(122, 18, 18, 0.22);
}

.hero-kicker {
    display: inline-block;
    margin-bottom: 12px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.14);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.hero-title {
    font-size: clamp(2.3rem, 4vw, 3.4rem);
    font-weight: 800;
    margin-bottom: 12px;
    line-height: 1.05;
}

.hero-text {
    font-size: 1.08rem;
    max-width: 720px;
    margin: 0;
    color: rgba(255,255,255,0.9);
    line-height: 1.7;
}

.feature-grid {
    display: grid;
    gap: 18px;
}

.feature-item {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 16px;
    align-items: start;
    padding: 14px 0;
    border-bottom: 1px solid rgba(229, 231, 235, 0.7);
}

.feature-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.feature-item i {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(183, 28, 28, 0.12), rgba(245, 158, 11, 0.12));
}

.achievement-lead {
    white-space: pre-line;
    font-size: 1.08rem;
    line-height: 1.8;
    color: #374151;
}

.related-achievement-link {
    border: 1px solid #edf0f3;
    border-radius: 18px;
    padding: 16px 18px;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.related-achievement-link:hover {
    background-color: #fafafa;
    border-color: #e5d2d2;
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.06);
}

.surface-muted {
    background: linear-gradient(180deg, rgba(255,255,255,0.85), rgba(249, 250, 251, 0.95));
    border: 1px solid rgba(229, 231, 235, 0.92);
    border-radius: 18px;
}

.section-title {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #111827;
}

.section-subtitle {
    color: #6b7280;
    font-size: 0.88rem;
}

.soft-panel {
    border-radius: 12px;
    padding: 0;
    background: #fff;
    border: 1px solid #e0dfdc;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.filter-toolbar .form-control,
.filter-toolbar .form-select,
.search-shell .form-control {
    border-radius: 8px;
    border-color: #e4e7ec;
    min-height: 44px;
}

.filter-toolbar .btn,
.search-shell .btn {
    min-height: 42px;
    border-radius: 999px;
}

.achievement-card {
    padding: 0 !important;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.achievement-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.achievement-meta {
    font-size: 0.82rem;
    color: #6b7280;
}

.achievement-title-link {
    color: #0f172a;
    text-decoration: none;
    line-height: 1.25;
}

.achievement-title-link:hover {
    color: #8d1515;
}

.achievement-owner-avatar-shell {
    width: 52px;
    height: 52px;
    min-width: 52px;
    flex: 0 0 52px;
    position: relative;
    overflow: hidden;
    border-radius: 50%;
}

.achievement-owner-avatar-img,
.achievement-owner-avatar-fallback {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.10);
}

.achievement-owner-avatar-img {
    object-fit: cover;
    display: block;
    position: relative;
    z-index: 2;
}

.achievement-owner-avatar-fallback {
    font-size: 1.1rem;
    position: absolute;
    inset: 0;
    z-index: 1;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.achievement-author-link {
    display: inline-block;
    max-width: 100%;
}

.achievement-author-name {
    font-size: 1rem;
    line-height: 1.2;
    color: #111827;
    word-break: break-word;
}

.achievement-title {
    font-size: 1.35rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.teacher-card {
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.teacher-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.08);
    border-color: rgba(183, 28, 28, 0.18);
}

.teacher-directory-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
}

.achievement-detail-shell {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,255,255,0.9)),
        radial-gradient(circle at top right, rgba(183, 28, 28, 0.08), transparent 28%);
}

.badge-soft-danger {
    background: #ffebee;
    color: #b71c1c;
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 700;
}

.about-section-card {
    padding: 28px !important;
}

.tech-list p:last-child {
    margin-bottom: 0;
}

.profile-side-card .card-body,
.side-info-card .card-body,
.filter-side-card .card-body {
    padding: 16px;
}

.profile-side-cover {
    height: 64px;
    background: linear-gradient(135deg, #7f1d1d, #b71c1c 58%, #f59e0b 140%);
}

.profile-side-avatar-wrap {
    margin-top: -36px;
}

.profile-side-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

.side-divider {
    height: 1px;
    background: #ebebeb;
    margin: 12px -16px;
}

.side-link-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-decoration: none;
    color: #1f2937;
    font-size: 0.92rem;
    padding: 9px 0;
    border-bottom: 1px solid #f1f1f1;
}

.side-link-row:last-child {
    border-bottom: 0;
}

.side-link-row strong {
    color: #b71c1c;
    font-size: 0.82rem;
    white-space: nowrap;
}

.composer-card .card-body {
    padding: 12px 16px;
}

.feed-search-row {
    display: grid;
    grid-template-columns: 18px 1fr auto;
    align-items: center;
    gap: 12px;
    background: #eef3f8;
    border-radius: 999px;
    padding: 8px 8px 8px 14px;
}

.feed-search-row .form-control {
    background: transparent;
    min-height: 42px;
}

.feed-header-row {
    padding: 0 4px;
}

.feed-card {
    border-radius: 14px;
    width: 100%;
}

.feed-description {
    line-height: 1.7;
    font-size: 1rem;
}

.feed-preview-shell {
    border-radius: 0;
    overflow: hidden;
    min-height: 420px;
    border-top: 1px solid #ececec;
    border-bottom: 1px solid #ececec;
    border-left: 0;
    border-right: 0;
    width: 100%;
    background: #f8fafc;
}

.feed-post-header {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 16px 18px 14px 26px;
}

.feed-post-body {
    padding: 16px 18px 18px 26px;
}

.feed-open-link {
    margin-left: auto;
    color: #7a7f87;
    text-decoration: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.feed-open-link:hover {
    background: #f3f4f6;
    color: #b71c1c;
}

.feed-file-link {
    color: #b71c1c;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
}

.feed-file-link:hover {
    color: #8d1515;
}

.filter-side-card,
.side-info-card,
.profile-side-card,
.composer-card {
    position: sticky;
    top: 104px;
}

.side-info-card {
    top: 400px;
}

.filter-side-card {
    top: 104px;
}

@media (max-width: 991px) {
    .main-content {
        margin-top: 92px;
    }

    .nav-link-custom {
        min-width: unset;
        min-height: unset;
        align-items: flex-start;
        border-radius: 12px;
    }

    .hero-panel {
        padding: 28px;
        border-radius: 24px;
    }

    .profile-side-card,
    .side-info-card,
    .filter-side-card,
    .composer-card {
        position: static;
    }

    .teacher-directory-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 576px) {
    .main-content {
        margin-top: 88px;
    }

    .hero-panel {
        padding: 24px 20px;
    }

    .achievement-card {
        padding: 18px !important;
    }

    .achievement-title {
        font-size: 1.45rem;
    }

    .certificate-preview-frame {
        min-height: 300px;
        padding: 8px;
    }

    .feed-preview-shell {
        min-height: 280px;
    }
}

.site-nav-actions {
    flex-wrap: wrap;
}

.nav-auth-btn {
    min-width: 120px;
}

.page-shell {
    margin: 0 auto 40px;
}

.page-shell-sm {
    max-width: 720px;
}

.page-shell-md {
    max-width: 860px;
}

.page-shell-lg {
    max-width: 1080px;
}

.page-shell-xl {
    max-width: 1180px;
}

.auth-shell {
    max-width: 980px;
    margin: 0 auto 44px;
}

.auth-card {
    display: grid;
    grid-template-columns: minmax(300px, 0.9fr) minmax(380px, 1.1fr);
    background: #fff;
    border: 1px solid #e0dfdc;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.auth-showcase {
    padding: 36px 34px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 247, 247, 0.92)),
        linear-gradient(135deg, rgba(183, 28, 28, 0.12), rgba(245, 158, 11, 0.08));
    color: #1f2937;
    border-right: 1px solid #f0dede;
}

.auth-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid rgba(183, 28, 28, 0.16);
    color: #b71c1c;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.auth-title {
    margin: 20px 0 12px;
    font-size: clamp(1.9rem, 3vw, 2.55rem);
    line-height: 1.12;
    letter-spacing: 0;
    font-weight: 800;
    color: #111827;
}

.auth-text {
    margin: 0 0 26px;
    max-width: 480px;
    color: #526070;
    line-height: 1.65;
    font-size: 1rem;
}

.auth-feature-list {
    display: grid;
    gap: 14px;
}

.auth-feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid rgba(229, 231, 235, 0.92);
    color: #374151;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.auth-feature-item i {
    width: 34px;
    height: 34px;
    min-width: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #ffebee;
    color: #b71c1c;
}

.auth-form-panel {
    padding: 38px 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #ffffff;
}

.auth-form-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.auth-icon {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffebee;
    color: #b71c1c;
    font-size: 1.2rem;
}

.auth-form-title {
    margin: 0 0 4px;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0;
}

.auth-form-subtitle {
    margin: 0;
    color: #6b7280;
    font-size: 0.92rem;
}

.auth-form {
    display: grid;
    gap: 14px;
}

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

.auth-field .form-control {
    min-height: 46px;
    border-radius: 10px;
    border-color: #d9dee6;
    padding: 11px 13px;
    background: #fbfcfe;
}

.auth-field .form-label {
    margin-bottom: 6px;
    color: #374151;
    font-size: 0.9rem;
}

.auth-field .form-control:focus,
.profile-edit-form .form-control:focus,
.form-surface .form-control:focus {
    border-color: #b71c1c;
    box-shadow: 0 0 0 0.18rem rgba(183, 28, 28, 0.12);
}

.auth-field ul.errorlist,
.profile-form-group ul.errorlist,
.form-surface ul.errorlist {
    list-style: none;
    padding: 0;
    margin: 0 0 6px;
    color: #b71c1c;
    font-size: 0.85rem;
    font-weight: 600;
}

.auth-submit-btn {
    width: 100%;
    min-height: 50px;
    border-radius: 12px;
    font-weight: 800;
    box-shadow: 0 10px 18px rgba(183, 28, 28, 0.16);
}

.auth-footer {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #eceff3;
    color: #6b7280;
    font-size: 0.92rem;
    text-align: center;
}

.auth-footer a {
    color: #b71c1c;
    font-weight: 700;
    text-decoration: none;
}

.profile-hero-card,
.profile-form-card,
.profile-achievements-shell,
.about-brief-card,
.form-surface,
.danger-surface {
    border-radius: 24px;
}

.profile-cover {
    height: 132px;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.18), transparent 34%),
        linear-gradient(135deg, #7f1d1d 0%, #b71c1c 58%, #f59e0b 165%);
}

.teacher-cover {
    background:
        linear-gradient(135deg, rgba(255,255,255,0.16), transparent 32%),
        linear-gradient(135deg, #691313 0%, #b71c1c 54%, #ef9a9a 150%);
}

.profile-hero-body {
    padding: 0 28px 28px;
}

.profile-avatar-shell {
    width: 132px;
    height: 132px;
    border-radius: 50%;
    margin-top: -66px;
    border: 6px solid #fff;
    background: #fff;
    box-shadow: 0 18px 28px rgba(15, 23, 42, 0.10);
    overflow: hidden;
    position: relative;
}

.profile-avatar-image,
.profile-avatar-fallback {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: absolute;
    inset: 0;
}

.profile-avatar-image {
    object-fit: cover;
    display: block;
}

.profile-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 2.8rem;
    font-weight: 800;
}

.profile-status-pill {
    display: inline-flex;
    margin-top: 16px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #ffebee;
    color: #b71c1c;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.profile-identity-block {
    margin-top: 18px;
}

.profile-name {
    margin: 0 0 8px;
    font-size: clamp(1.9rem, 4vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.04;
}

.profile-role {
    margin: 0 0 6px;
    font-size: 1.04rem;
    color: #374151;
}

.profile-username {
    color: #6b7280;
    font-size: 0.96rem;
}

.profile-email {
    display: inline-block;
    margin-top: 8px;
    color: #b71c1c;
    font-weight: 700;
    text-decoration: none;
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 22px;
}

.profile-about-panel {
    margin-top: 22px;
    padding: 20px;
    border: 1px solid #eceff3;
    border-radius: 18px;
    background: linear-gradient(180deg, #fbfbfc, #f7fafc);
}

.profile-about-text {
    margin: 0;
    white-space: pre-line;
    line-height: 1.75;
    color: #374151;
}

.profile-form-card,
.profile-achievements-shell {
    padding: 26px;
}

.profile-panel-head {
    margin-bottom: 20px;
}

.profile-panel-head-inline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.profile-kicker {
    margin-bottom: 10px;
}

.profile-kicker-light {
    background: #fff1f2;
    color: #b71c1c;
}

.profile-edit-form {
    display: grid;
    gap: 18px;
}

.profile-form-group .form-control {
    border-radius: 14px;
    min-height: 48px;
}

.profile-form-group textarea.form-control {
    min-height: 140px;
}

.avatar-color-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.avatar-color-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid #d9dee6;
    border-radius: 14px;
    background: #fbfcfe;
    color: #374151;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.avatar-color-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.avatar-color-swatch {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.16);
}

.avatar-color-option:has(input:checked) {
    border-color: #b71c1c;
    background: #fff7f7;
    box-shadow: 0 0 0 0.16rem rgba(183, 28, 28, 0.09);
}

.profile-save-btn {
    width: 100%;
    min-height: 48px;
    font-weight: 800;
}

.profile-achievement-list {
    display: grid;
    gap: 18px;
}

.profile-achievement-item {
    border: 1px solid #eceff3;
    border-radius: 20px;
    padding: 22px;
    background: linear-gradient(180deg, #fff, #fcfcfd);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.profile-achievement-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.profile-achievement-title {
    margin: 0;
    font-size: 1.3rem;
    line-height: 1.18;
    letter-spacing: -0.02em;
}

.profile-menu-btn {
    white-space: nowrap;
}

.profile-achievement-description {
    margin: 16px 0 18px;
    color: #4b5563;
    line-height: 1.75;
}

.profile-achievement-preview,
.teacher-achievement-preview,
.detail-preview-shell {
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid #e6ebf0;
    background: #f8fafc;
}

.profile-achievement-preview .certificate-preview-frame,
.teacher-achievement-preview .certificate-preview-frame,
.detail-preview-shell .certificate-preview-frame {
    min-height: 320px;
}

.profile-achievement-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #eceff3;
}

.profile-empty-state {
    text-align: center;
    padding: 40px 16px 16px;
}

.teacher-card-avatar {
    width: 64px;
    height: 64px;
    min-width: 64px;
    border-radius: 50%;
    object-fit: cover;
}

.teacher-card-avatar-fallback {
    font-size: 1.5rem;
    font-weight: 800;
}

.teacher-card-content {
    min-width: 0;
}

.teacher-card-title {
    margin: 0 0 6px;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.teacher-card-meta {
    font-size: 0.78rem;
}

.teacher-card-meta i {
    font-size: 0.45rem;
}

.directory-search-panel {
    padding: 18px;
}

.detail-owner-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.detail-owner-avatar {
    width: 58px;
    height: 58px;
    min-width: 58px;
    border-radius: 50%;
    object-fit: cover;
}

.detail-owner-avatar-fallback {
    font-size: 1.3rem;
    font-weight: 800;
}

.detail-badge {
    width: fit-content;
}

.about-hero-panel {
    border-radius: 30px;
}

.about-stats-grid,
.about-brief-grid,
.about-recent-grid {
    display: grid;
    gap: 16px;
}

.about-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 28px;
}

.about-brief-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 24px;
}

.about-brief-card {
    padding: 24px;
}

.about-brief-label {
    display: inline-flex;
    margin-bottom: 12px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #fff1f2;
    color: #b71c1c;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.about-flow-list,
.about-stack-list {
    display: grid;
    gap: 14px;
}

.about-flow-item,
.about-stack-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(229, 231, 235, 0.7);
}

.about-flow-item:last-child,
.about-stack-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.about-flow-step {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffebee;
    color: #b71c1c;
    font-weight: 800;
}

.about-stack-item span {
    color: #6b7280;
}

.about-stack-item strong {
    text-align: right;
}

.about-value-list {
    margin: 0;
    padding-left: 20px;
    color: #374151;
    display: grid;
    gap: 12px;
}

.about-recent-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.about-recent-card {
    border: 1px solid #eceff3;
    border-radius: 20px;
    padding: 18px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.about-recent-card:hover {
    transform: translateY(-2px);
    border-color: rgba(183, 28, 28, 0.16);
    box-shadow: 0 16px 28px rgba(15, 23, 42, 0.06);
}

.about-recent-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.about-recent-title {
    margin: 0 0 10px;
    font-size: 1.08rem;
    font-weight: 800;
    line-height: 1.22;
}

.about-recent-text {
    margin: 0 0 14px;
    color: #6b7280;
    font-size: 0.92rem;
    line-height: 1.65;
}

.about-recent-owner {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #374151;
    font-size: 0.9rem;
    font-weight: 600;
}

.about-recent-avatar {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    object-fit: cover;
}

.about-recent-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
}

.form-surface {
    background: #fff;
    border: 1px solid #e0dfdc;
    overflow: hidden;
}

.form-surface-header {
    padding: 28px 28px 20px;
    border-bottom: 1px solid #eceff3;
    background:
        radial-gradient(circle at top right, rgba(183, 28, 28, 0.08), transparent 28%),
        linear-gradient(180deg, #fff, #fcfcfd);
}

.form-surface-body {
    padding: 28px;
}

.form-surface .form-control {
    min-height: 48px;
    border-radius: 14px;
}

.form-surface textarea.form-control {
    min-height: 160px;
}

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

.danger-surface {
    background: linear-gradient(180deg, #fff, #fcfcfd);
    border: 1px solid #f2d4d6;
    padding: 34px 28px;
    text-align: center;
}

.danger-surface-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    border-radius: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffebee;
    color: #b71c1c;
    font-size: 1.9rem;
}

.danger-surface-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 26px;
}

@media (max-width: 1199px) {
    .profile-stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 991px) {
    .site-nav-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch !important;
        padding: 14px 0 4px;
    }

    .nav-link-custom {
        flex-direction: row;
        justify-content: flex-start;
        gap: 10px;
        border-radius: 12px;
        padding: 10px 12px !important;
    }

    .nav-link-custom i {
        margin-bottom: 0;
    }

    .btn-add-cert,
    .nav-auth-btn {
        width: 100%;
        justify-content: center;
    }

    .auth-card,
    .about-brief-grid,
    .about-recent-grid {
        grid-template-columns: 1fr;
    }

    .about-stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .profile-panel-head-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .profile-add-btn {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 767px) {
    .main-content {
        padding-left: 12px;
        padding-right: 12px;
    }

    .auth-showcase,
    .auth-form-panel,
    .profile-form-card,
    .profile-achievements-shell,
    .form-surface-header,
    .form-surface-body {
        padding: 22px 20px;
    }

    .profile-hero-body {
        padding: 0 20px 22px;
    }

    .profile-stats-grid,
    .about-stats-grid {
        grid-template-columns: 1fr;
    }

    .auth-grid,
    .profile-achievement-actions,
    .form-actions-row,
    .avatar-color-grid {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    .profile-achievement-top,
    .teacher-directory-header,
    .detail-owner-row,
    .about-recent-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-achievement-actions .btn,
    .form-actions-row .btn,
    .danger-surface-actions .btn {
        width: 100%;
    }

    .directory-search-panel {
        padding: 16px;
    }
}

@media (max-width: 576px) {
    .auth-shell,
    .page-shell {
        margin-bottom: 28px;
    }

    .auth-card,
    .profile-hero-card,
    .profile-form-card,
    .profile-achievements-shell,
    .form-surface,
    .danger-surface,
    .about-brief-card {
        border-radius: 20px;
    }

    .profile-avatar-shell {
        width: 112px;
        height: 112px;
        margin-top: -56px;
    }

    .profile-name,
    .hero-title,
    .auth-title {
        line-height: 1.1;
    }

    .about-flow-item,
    .about-stack-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-achievement-preview .certificate-preview-frame,
    .teacher-achievement-preview .certificate-preview-frame,
    .detail-preview-shell .certificate-preview-frame {
        min-height: 240px;
    }
}

/* Visual refresh: calmer academic UI with a single reusable surface language. */
:root {
    --surface: #ffffff;
    --surface-soft: #f7f9fb;
    --surface-tint: #eef6f5;
    --ink: #17212f;
    --muted: #617084;
    --line: #dfe6ee;
    --line-strong: #cbd7e3;
    --brand: #0f766e;
    --brand-dark: #115e59;
    --accent: #b45309;
    --danger: #b42318;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 12px 30px rgba(27, 39, 55, 0.08);
    --radius: 8px;
}

html {
    background: #f5f7fa;
}

body {
    background:
        linear-gradient(180deg, #f7fafc 0%, #eef3f7 45%, #f6f7f4 100%);
    color: var(--ink);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1.55;
}

.navbar-custom {
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid rgba(203, 213, 225, 0.86);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}

.home-topbar,
.home-feed-shell {
    max-width: 1180px;
}

.navbar-brand-custom {
    color: var(--ink) !important;
    font-size: 1rem;
    gap: 12px;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--brand), #164e63);
    box-shadow: none;
}

.brand-text {
    letter-spacing: 0;
}

.nav-link-custom {
    color: var(--muted) !important;
    min-width: 92px;
    min-height: 48px;
    border-radius: var(--radius);
    transition: background-color 0.16s ease, color 0.16s ease;
}

.nav-link-custom i {
    color: #718096;
}

.nav-link-custom:hover,
.nav-link-custom:hover i {
    color: var(--brand) !important;
}

.nav-link-custom:hover {
    background: #eef6f5;
}

.nav-link-custom:hover::after {
    display: none;
}

.main-content {
    margin-top: 96px;
}

.card-linked,
.soft-panel,
.form-surface,
.auth-card,
.danger-surface,
.profile-hero-card,
.profile-form-card,
.profile-achievements-shell,
.about-brief-card,
.about-section-card,
.about-recent-card,
.profile-achievement-item,
.related-achievement-link,
.stats-card,
.stats-pill {
    border-radius: var(--radius) !important;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow-sm) !important;
}

.card-linked:hover,
.teacher-card:hover,
.about-recent-card:hover,
.related-achievement-link:hover,
.achievement-card:hover {
    border-color: var(--line-strong);
    box-shadow: var(--shadow-md) !important;
    transform: translateY(-2px);
}

.section-title {
    color: var(--ink);
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0;
}

.section-subtitle,
.text-muted,
.achievement-meta,
.profile-username {
    color: var(--muted) !important;
}

.btn,
.rounded-pill,
.form-control,
.form-select,
.dropdown-menu,
.alert {
    border-radius: var(--radius) !important;
}

.btn {
    font-weight: 700;
}

.btn-danger,
.btn-add-cert,
.auth-submit-btn {
    background: var(--brand) !important;
    border-color: var(--brand) !important;
    color: #fff !important;
    box-shadow: none !important;
}

.btn-danger:hover,
.btn-add-cert:hover,
.auth-submit-btn:hover {
    background: var(--brand-dark) !important;
    border-color: var(--brand-dark) !important;
    color: #fff !important;
}

.btn-outline-danger {
    color: var(--brand) !important;
    border-color: rgba(15, 118, 110, 0.34) !important;
}

.btn-outline-danger:hover {
    background: var(--brand) !important;
    border-color: var(--brand) !important;
    color: #fff !important;
}

.btn-light {
    background: #f3f6f8;
    border-color: var(--line);
    color: #263445;
}

.text-danger,
.feed-file-link,
.achievement-title-link:hover,
.side-link-row strong,
.auth-footer a,
.profile-email {
    color: var(--brand) !important;
}

.border-danger-subtle {
    border-color: rgba(15, 118, 110, 0.24) !important;
}

.bg-white.text-danger,
.badge-soft-danger,
.profile-status-pill,
.profile-kicker-light,
.about-brief-label,
.auth-badge,
.auth-icon,
.auth-feature-item i,
.about-flow-step,
.danger-surface-icon {
    background: #e9f6f4 !important;
    color: var(--brand) !important;
}

.form-control,
.form-select {
    border-color: #cfd9e5;
    background-color: #fbfdff;
    min-height: 44px;
}

.form-control:focus,
.form-select:focus,
.auth-field .form-control:focus,
.profile-edit-form .form-control:focus,
.form-surface .form-control:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 0.18rem rgba(15, 118, 110, 0.14);
}

.hero-panel {
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.94), rgba(22, 78, 99, 0.94)),
        linear-gradient(180deg, #ffffff, #ffffff);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.hero-kicker {
    letter-spacing: 0.03em;
}

.hero-title,
.auth-title,
.profile-name {
    letter-spacing: 0;
}

.profile-cover,
.profile-side-cover,
.teacher-cover {
    background: linear-gradient(135deg, var(--brand), #164e63 72%, var(--accent));
}

.profile-avatar-shell,
.profile-side-avatar,
.feed-avatar,
.teacher-card-avatar,
.detail-owner-avatar,
.about-recent-avatar,
.achievement-owner-avatar-shell,
.achievement-owner-avatar-img,
.achievement-owner-avatar-fallback {
    box-shadow: none;
}

.stats-pill,
.stats-card {
    background: linear-gradient(180deg, #ffffff, #f6faf9);
    padding: 14px 16px;
}

.stats-pill strong,
.stats-card strong {
    color: var(--brand-dark);
}

.feed-search-row {
    background: #eef4f7;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 8px 10px 8px 14px;
}

.composer-card .card-body,
.profile-side-card .card-body,
.side-info-card .card-body,
.filter-side-card .card-body {
    padding: 18px;
}

.side-link-row {
    color: #263445;
    border-color: #edf1f5;
}

.feed-card {
    border-radius: var(--radius);
}

.feed-post-header {
    padding: 18px 20px 14px;
}

.feed-post-body {
    padding: 18px 20px 20px;
}

.feed-open-link {
    border-radius: var(--radius);
}

.feed-open-link:hover {
    background: var(--surface-tint);
    color: var(--brand);
}

.feed-preview-shell,
.profile-achievement-preview,
.teacher-achievement-preview,
.detail-preview-shell {
    background: #f3f7fa;
    border-color: var(--line);
}

.certificate-preview-frame {
    min-height: 420px;
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.07), transparent 34%),
        linear-gradient(180deg, #fbfdff, #eef3f7);
}

.certificate-preview-frame canvas,
.certificate-preview-frame img {
    border-radius: var(--radius);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.11);
}

.achievement-title {
    font-size: 1.24rem;
}

.achievement-title-link {
    color: #17212f;
}

.teacher-directory-header {
    padding: 2px 2px 0;
}

.teacher-card .card-body {
    padding: 18px;
}

.teacher-card-avatar {
    border: 3px solid #fff;
    outline: 1px solid var(--line);
}

.directory-search-panel,
.form-surface-header,
.auth-showcase,
.profile-about-panel {
    background: linear-gradient(180deg, #ffffff, #f7fafb);
}

.auth-card {
    grid-template-columns: minmax(300px, 0.86fr) minmax(380px, 1.14fr);
}

.auth-showcase {
    border-right: 1px solid var(--line);
}

.auth-feature-item {
    border-radius: var(--radius);
}

.profile-form-card,
.profile-achievements-shell {
    padding: 24px;
}

.profile-achievement-item {
    background: #fff;
}

.profile-menu-btn {
    border-radius: var(--radius) !important;
}

.avatar-color-option {
    border-radius: var(--radius);
}

.avatar-color-option:has(input:checked) {
    border-color: var(--brand);
    background: #eef8f7;
    box-shadow: 0 0 0 0.16rem rgba(15, 118, 110, 0.11);
}

.about-stats-grid .stats-card {
    background: rgba(255, 255, 255, 0.94);
}

.about-stats-grid .stats-card span {
    color: #425466;
}

.about-brief-card,
.about-section-card {
    padding: 24px !important;
}

.about-stack-item strong {
    color: var(--ink);
}

.pagination .page-link {
    color: var(--brand);
    border-color: var(--line);
}

.pagination .page-link:hover {
    background: var(--surface-tint);
    color: var(--brand-dark);
}

.dropdown-menu {
    border-color: var(--line);
    box-shadow: var(--shadow-md);
}

.dropdown-item:active {
    background: var(--brand);
}

@media (max-width: 991px) {
    .navbar-custom {
        position: sticky;
    }

    .main-content {
        margin-top: 28px;
    }

    .nav-link-custom {
        min-width: 0;
    }
}

@media (max-width: 767px) {
    .main-content {
        padding-left: 14px;
        padding-right: 14px;
    }

    .certificate-preview-frame {
        min-height: 300px;
    }

    .feed-post-header,
    .feed-post-body {
        padding-left: 16px;
        padding-right: 16px;
    }
}

@media (max-width: 576px) {
    .brand-text {
        max-width: 190px;
        white-space: normal;
        line-height: 1.1;
    }

    .feed-search-row {
        grid-template-columns: 18px 1fr;
    }

    .feed-search-row .btn {
        grid-column: 1 / -1;
        width: 100%;
    }

    .profile-stats-grid,
    .about-stats-grid {
        gap: 10px;
    }
}

/* Diploma polish: compact, presentable first screen without hiding the feed. */
.btn-add-cert {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.home-summary-band {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(330px, 0.58fr);
    gap: 22px;
    align-items: stretch;
    padding: 28px;
    border: 1px solid rgba(203, 213, 225, 0.88);
    border-radius: var(--radius);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(242, 248, 249, 0.96)),
        linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(180, 83, 9, 0.08));
    box-shadow: var(--shadow-sm);
}

.home-summary-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.home-summary-label {
    width: fit-content;
    margin-bottom: 12px;
    padding: 7px 12px;
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-radius: var(--radius);
    background: #e9f6f4;
    color: var(--brand);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.home-summary-copy h1 {
    max-width: 680px;
    margin: 0 0 12px;
    color: var(--ink);
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1.04;
    font-weight: 850;
}

.home-summary-copy p {
    max-width: 720px;
    margin: 0;
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.7;
}

.home-summary-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.home-stat-card {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 152px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.9);
}

.home-stat-card strong {
    color: var(--brand-dark);
    font-size: clamp(1.7rem, 3vw, 2.35rem);
    line-height: 1;
}

.home-stat-card span {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
}

.achievement-issuer-pill,
.detail-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.achievement-issuer-pill {
    width: fit-content;
    padding: 7px 10px;
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-radius: var(--radius);
    background: #eef8f7;
    color: var(--brand-dark);
    font-size: 0.84rem;
    font-weight: 750;
}

.achievement-issuer-pill i {
    color: var(--brand);
}

.detail-meta-row {
    gap: 10px;
}

.detail-meta-row span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f7fafb;
    color: #334155;
    font-size: 0.92rem;
    font-weight: 700;
}

.detail-meta-row i {
    color: var(--brand);
}

.achievement-detail-shell h1 {
    color: var(--ink);
    font-size: clamp(1.8rem, 4vw, 2.65rem);
    line-height: 1.08;
}

.form-surface .form-text,
.auth-field .form-text {
    color: #75849a;
}

.empty-state,
.profile-empty-state {
    background:
        linear-gradient(180deg, #ffffff, #f8fbfc);
    border-radius: var(--radius);
}

@media (max-width: 991px) {
    .home-summary-band {
        grid-template-columns: 1fr;
    }

    .home-summary-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .home-summary-band {
        padding: 22px 18px;
    }

    .home-summary-stats {
        grid-template-columns: 1fr;
    }

    .home-stat-card {
        min-height: 96px;
    }
}

/* Mobile hardening pass for real phones. */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

img,
canvas,
video {
    max-width: 100%;
}

@media (max-width: 991px) {
    .navbar-custom {
        position: sticky;
        top: 0;
    }

    .navbar-custom .container {
        max-width: 100%;
    }

    .navbar-brand-custom {
        min-width: 0;
    }

    .site-nav-actions {
        gap: 8px !important;
    }

    .filter-side-card,
    .side-info-card,
    .profile-side-card,
    .composer-card {
        position: static;
    }

    .home-feed-shell,
    .page-shell,
    .auth-shell {
        max-width: 100%;
    }

    .home-summary-band {
        margin-top: 4px;
    }

    .profile-hero-card,
    .profile-form-card,
    .profile-achievements-shell,
    .form-surface,
    .auth-card,
    .about-section-card,
    .about-brief-card,
    .danger-surface {
        width: 100%;
    }
}

@media (max-width: 767px) {
    body {
        font-size: 0.96rem;
    }

    .container,
    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }

    .main-content {
        margin-top: 18px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .brand-mark {
        width: 34px;
        height: 34px;
        min-width: 34px;
    }

    .brand-text {
        max-width: 170px;
        font-size: 0.95rem;
        line-height: 1.12;
    }

    .navbar-toggler {
        padding: 6px 8px;
        border-color: var(--line);
    }

    .nav-link-custom {
        width: 100%;
        min-height: 44px;
    }

    .nav-auth-btn,
    .btn-add-cert {
        min-height: 42px;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .home-summary-band {
        gap: 16px;
        padding: 20px 16px;
    }

    .home-summary-copy h1 {
        font-size: 1.75rem;
        line-height: 1.12;
    }

    .home-summary-copy p {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .home-summary-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .home-stat-card {
        min-height: 88px;
        padding: 12px;
    }

    .home-stat-card strong {
        font-size: 1.45rem;
    }

    .home-stat-card span {
        font-size: 0.74rem;
        line-height: 1.15;
    }

    .feed-search-row {
        grid-template-columns: 18px 1fr;
        border-radius: var(--radius);
    }

    .feed-search-row .btn {
        grid-column: 1 / -1;
        width: 100%;
    }

    .feed-card {
        margin-left: 0;
        margin-right: 0;
    }

    .feed-post-header {
        display: grid !important;
        grid-template-columns: 52px minmax(0, 1fr) 34px;
        gap: 12px !important;
        padding: 14px 14px 12px !important;
    }

    .achievement-author-name,
    .achievement-title,
    .profile-achievement-title,
    .teacher-card-title,
    .about-recent-title {
        overflow-wrap: anywhere;
    }

    .achievement-title {
        font-size: 1.12rem;
    }

    .feed-post-body {
        padding: 14px;
    }

    .feed-description,
    .achievement-lead,
    .profile-achievement-description {
        font-size: 0.94rem;
        line-height: 1.62;
    }

    .feed-preview-shell,
    .certificate-preview-frame {
        min-height: 240px;
    }

    .certificate-preview-frame {
        padding: 8px;
    }

    .profile-cover {
        height: 104px;
    }

    .profile-avatar-shell {
        width: 104px;
        height: 104px;
        margin-top: -52px;
        border-width: 5px;
    }

    .profile-avatar-fallback {
        font-size: 2.15rem;
    }

    .profile-name {
        font-size: 1.7rem;
        overflow-wrap: anywhere;
    }

    .profile-status-pill,
    .hero-kicker,
    .about-brief-label,
    .auth-badge {
        max-width: 100%;
        white-space: normal;
    }

    .profile-stats-grid,
    .about-stats-grid,
    .about-brief-grid,
    .about-recent-grid {
        grid-template-columns: 1fr;
    }

    .profile-achievement-item,
    .profile-form-card,
    .profile-achievements-shell,
    .about-section-card,
    .about-brief-card,
    .form-surface-header,
    .form-surface-body {
        padding: 18px !important;
    }

    .profile-achievement-top {
        gap: 12px;
    }

    .profile-menu-btn {
        width: 100%;
    }

    .teacher-card .card-body {
        align-items: flex-start !important;
    }

    .teacher-card-avatar {
        width: 56px;
        height: 56px;
        min-width: 56px;
    }

    .teacher-directory-header .stats-pill {
        width: 100%;
    }

    .detail-owner-row {
        align-items: flex-start;
    }

    .detail-owner-avatar {
        width: 52px;
        height: 52px;
        min-width: 52px;
    }

    .achievement-detail-shell {
        padding: 18px !important;
    }

    .achievement-detail-shell h1 {
        font-size: 1.65rem;
    }

    .detail-meta-row span,
    .achievement-issuer-pill {
        width: 100%;
    }

    .auth-card {
        display: block;
    }

    .auth-showcase,
    .auth-form-panel {
        padding: 20px 18px;
    }

    .auth-title {
        font-size: 1.65rem;
    }

    .auth-feature-item {
        align-items: flex-start;
    }

    .form-actions-row .btn,
    .danger-surface-actions .btn,
    .achievement-detail-shell .btn {
        width: 100%;
    }
}

@media (max-width: 420px) {
    .main-content {
        padding-left: 8px;
        padding-right: 8px;
    }

    .brand-text {
        max-width: 142px;
        font-size: 0.9rem;
    }

    .home-summary-stats {
        grid-template-columns: 1fr;
    }

    .home-stat-card {
        min-height: 72px;
    }

    .feed-post-header {
        grid-template-columns: 48px minmax(0, 1fr);
    }

    .feed-open-link {
        grid-column: 2;
        justify-self: start;
        width: auto;
        height: auto;
        padding: 4px 0;
    }

    .achievement-owner-avatar-shell,
    .achievement-owner-avatar-img,
    .achievement-owner-avatar-fallback {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
    }

    .certificate-preview-frame,
    .feed-preview-shell {
        min-height: 210px;
    }
}
