:root {
    --qt-primary: #15a89e;
    --qt-primary-dark: #0f766e;
    --qt-bg: #f4f7fb;
    --qt-card: #ffffff;
    --qt-text: #172033;
    --qt-muted: #64748b;
    --qt-border: #e2e8f0;
    --qt-shadow: 0 18px 45px rgba(15, 23, 42, .08);
}

.qt-dynamic-page,
.qt-tutorial-shell {
    background: radial-gradient(circle at top right, rgba(21, 168, 158, .12), transparent 34%), var(--qt-bg);
    min-height: calc(100vh - 70px);
}

.qt-page-container {
    width: min(1240px, calc(100% - 32px));
    margin: 0 auto;
    padding: 30px 0 60px;
}

.qt-tutorial-shell {
    display: grid;
    grid-template-columns: 310px minmax(0, 1fr);
    gap: 28px;
    padding: 24px;
}

.qt-tutorial-content {
    min-width: 0;
    width: 100%;
}

.qt-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    color: var(--qt-muted);
    font-size: .92rem;
}

.qt-breadcrumb a {
    color: var(--qt-primary-dark);
    text-decoration: none;
    font-weight: 700;
}

.qt-breadcrumb strong {
    color: var(--qt-text);
}

.qt-tutorial-hero,
.qt-article-header {
    background: linear-gradient(135deg, #102a43, #0f766e);
    color: #fff;
    padding: 34px;
    border-radius: 28px;
    box-shadow: var(--qt-shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    position: relative;
    overflow: hidden;
}

.qt-tutorial-hero::after,
.qt-article-header::after {
    content: "";
    position: absolute;
    inset-inline-start: -50px;
    bottom: -70px;
    width: 220px;
    height: 220px;
    border-radius: 999px;
    background: rgba(255,255,255,.12);
}

.qt-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 999px;
    font-weight: 800;
    margin-bottom: 14px;
}

.qt-tutorial-hero h1,
.qt-article-header h1 {
    font-size: clamp(2rem, 4vw, 3.2rem);
    font-weight: 900;
    margin: 0 0 12px;
}

.qt-tutorial-hero p,
.qt-article-header p {
    font-size: 1.1rem;
    line-height: 1.9;
    opacity: .92;
    max-width: 760px;
    margin: 0;
}

.qt-hero-action,
.qt-article-actions a {
    position: relative;
    z-index: 1;
}

.qt-hero-action {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: 18px;
    background: #fff;
    color: var(--qt-primary-dark);
    font-weight: 900;
    text-decoration: none;
    box-shadow: 0 12px 30px rgba(0,0,0,.15);
}

.qt-search-box {
    margin-top: 22px;
    position: relative;
    z-index: 3;
}

.qt-search-input-wrap {
    background: #fff;
    padding: 10px 16px;
    border-radius: 22px;
    box-shadow: var(--qt-shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--qt-border);
}

.qt-search-input-wrap i {
    color: var(--qt-primary);
    font-size: 1.15rem;
}

.qt-search-input-wrap input {
    border: 0;
    box-shadow: none !important;
    font-weight: 700;
}

.qt-search-results {
    margin-top: 12px;
    background: #fff;
    border-radius: 22px;
    box-shadow: var(--qt-shadow);
    border: 1px solid var(--qt-border);
    overflow: hidden;
}

.qt-search-result-card {
    display: block;
    padding: 16px 20px;
    text-decoration: none;
    color: var(--qt-text);
    border-bottom: 1px solid var(--qt-border);
}

.qt-search-result-card:last-child { border-bottom: 0; }
.qt-search-result-card:hover { background: #f8fafc; }
.qt-search-result-card span,
.qt-article-card span { color: var(--qt-primary-dark); font-weight: 800; font-size: .86rem; }
.qt-search-result-card h3,
.qt-article-card h2 { font-size: 1.08rem; font-weight: 900; margin: 6px 0; }
.qt-search-result-card p,
.qt-article-card p { color: var(--qt-muted); margin: 0; line-height: 1.7; }

.qt-module-grid,
.qt-article-grid,
.qt-paths-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.qt-module-card,
.qt-article-card,
.qt-path-card {
    background: var(--qt-card);
    border: 1px solid var(--qt-border);
    border-radius: 24px;
    padding: 22px;
    box-shadow: 0 10px 30px rgba(15,23,42,.05);
    text-decoration: none;
    color: var(--qt-text);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.qt-module-card:hover,
.qt-article-card:hover {
    transform: translateY(-4px);
    border-color: rgba(21,168,158,.45);
    box-shadow: var(--qt-shadow);
}

.qt-module-card {
    display: flex;
    gap: 16px;
}

.qt-module-icon {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: rgba(21,168,158,.12);
    color: var(--qt-primary-dark);
    font-size: 1.4rem;
    flex: 0 0 auto;
}

.qt-module-card h2,
.qt-path-card h2 {
    font-size: 1.25rem;
    font-weight: 900;
    margin: 0 0 8px;
}

.qt-module-card p,
.qt-path-card p {
    color: var(--qt-muted);
    line-height: 1.75;
    margin: 0 0 10px;
}

.qt-module-card span {
    color: var(--qt-primary-dark);
    font-weight: 900;
}

.qt-article-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 190px;
}

.qt-article-card div:last-child {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--qt-primary-dark);
    font-weight: 900;
}

.qt-sidebar {
    background: rgba(255,255,255,.96);
    border: 1px solid var(--qt-border);
    border-radius: 26px;
    box-shadow: var(--qt-shadow);
    padding: 18px;
    height: calc(100vh - 120px);
    position: sticky;
    top: 88px;
    overflow: auto;
}

.qt-sidebar-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    font-weight: 900;
}

.qt-sidebar-head a {
    color: var(--qt-primary-dark);
    text-decoration: none;
    font-size: .9rem;
}

.qt-sidebar-search {
    margin-bottom: 14px;
}

.qt-sidebar-search .form-control {
    border-radius: 16px;
    font-weight: 700;
}

.qt-side-module {
    border: 1px solid #edf2f7;
    border-radius: 18px;
    margin-bottom: 10px;
    overflow: hidden;
}

.qt-side-module-title {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 12px;
    color: var(--qt-text);
    text-decoration: none;
    font-weight: 900;
    background: #fff;
}

.qt-side-module.open .qt-side-module-title {
    background: rgba(21,168,158,.08);
    color: var(--qt-primary-dark);
}

.qt-side-module-title small {
    background: #f1f5f9;
    color: var(--qt-muted);
    border-radius: 999px;
    padding: 2px 8px;
}

.qt-side-lessons {
    padding: 8px;
    background: #fbfdff;
}

.qt-side-link {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 8px;
    align-items: center;
    padding: 9px 10px;
    border-radius: 14px;
    color: var(--qt-text);
    text-decoration: none;
    font-size: .92rem;
}

.qt-side-link span {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #f1f5f9;
    color: var(--qt-muted);
    font-size: .78rem;
}

.qt-side-link.active,
.qt-side-link:hover {
    background: var(--qt-primary);
    color: #fff;
}

.qt-side-link.active span,
.qt-side-link:hover span {
    background: rgba(255,255,255,.22);
    color: #fff;
}

.qt-side-result {
    display: block;
    text-decoration: none;
    color: var(--qt-text);
    padding: 10px;
    border-radius: 14px;
}

.qt-side-result:hover { background: #f8fafc; }
.qt-side-result small { display: block; color: var(--qt-primary-dark); margin-top: 2px; }

.qt-article-header {
    display: block;
    margin-bottom: 24px;
}

.qt-article-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.qt-steps {
    display: grid;
    gap: 18px;
}

.qt-step-card {
    background: #fff;
    border: 1px solid var(--qt-border);
    border-radius: 26px;
    padding: 24px;
    box-shadow: 0 10px 26px rgba(15,23,42,.05);
}

.qt-step-header {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.qt-step-header span {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--qt-primary);
    color: #fff;
    font-weight: 900;
}

.qt-step-header h2 {
    font-size: 1.35rem;
    font-weight: 900;
    margin: 0;
}

.qt-step-card p {
    color: var(--qt-muted);
    line-height: 1.9;
    font-size: 1.02rem;
}

.qt-step-image-btn {
    display: block;
    border: 0;
    background: #f8fafc;
    padding: 10px;
    border-radius: 22px;
    width: 100%;
    cursor: zoom-in;
}

.qt-step-image-btn img {
    display: block;
    width: 100%;
    max-height: 720px;
    object-fit: contain;
    border-radius: 16px;
}

.qt-prev-next {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 22px 0;
}

.qt-prev-next-card {
    display: block;
    background: #fff;
    border: 1px solid var(--qt-border);
    border-radius: 20px;
    padding: 18px;
    text-decoration: none;
    color: var(--qt-text);
    box-shadow: 0 8px 20px rgba(15,23,42,.04);
}

.qt-prev-next-card:hover {
    border-color: rgba(21,168,158,.45);
}

.qt-prev-next-card span {
    display: block;
    color: var(--qt-muted);
    margin-bottom: 6px;
}

.qt-prev-next-card strong {
    color: var(--qt-primary-dark);
}

.qt-rating,
.qt-rating-note,
.qt-rating-thanks {
    background: #fff;
    border: 1px solid var(--qt-border);
    border-radius: 24px;
    padding: 22px;
    margin-top: 18px;
    box-shadow: 0 8px 20px rgba(15,23,42,.04);
}

.qt-rating {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.qt-rating h3 {
    font-weight: 900;
    margin: 0 0 6px;
}

.qt-rating p {
    margin: 0;
    color: var(--qt-muted);
}

.qt-rating-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.qt-paths-grid {
    margin-top: 22px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.qt-path-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.qt-path-head span {
    color: var(--qt-muted);
    font-weight: 700;
}

.qt-path-list {
    margin: 16px 0 0;
    padding-right: 22px;
}

.qt-path-list li {
    margin-bottom: 10px;
    color: var(--qt-primary-dark);
    font-weight: 900;
}

.qt-path-list a {
    color: var(--qt-text);
    text-decoration: none;
}

.qt-path-list a:hover {
    color: var(--qt-primary-dark);
}

.qt-video-box {
    background: #fff;
    border: 1px solid var(--qt-border);
    border-radius: 22px;
    padding: 20px;
    margin-bottom: 18px;
}

.qt-empty-state {
    color: var(--qt-muted);
    text-align: center;
}

@media (max-width: 1100px) {
    .qt-tutorial-shell {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .qt-sidebar {
        position: static;
        height: auto;
        max-height: 55vh;
    }

    .qt-module-grid,
    .qt-article-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .qt-page-container {
        width: min(100% - 20px, 1240px);
        padding-top: 18px;
    }

    .qt-tutorial-hero,
    .qt-article-header,
    .qt-rating {
        display: block;
        padding: 24px;
    }

    .qt-hero-action,
    .qt-article-actions {
        margin-top: 18px;
    }

    .qt-module-grid,
    .qt-article-grid,
    .qt-paths-grid,
    .qt-prev-next {
        grid-template-columns: 1fr;
    }

    .qt-module-card {
        display: block;
    }

    .qt-module-icon {
        margin-bottom: 12px;
    }

    .qt-step-card {
        padding: 18px;
        border-radius: 22px;
    }
}

/* ================= ADMIN DASHBOARD ================= */
.qt-hero-actions-stack,
.qt-admin-hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.qt-hero-action-secondary {
    background: rgba(255,255,255,.14);
    color: #fff;
    border: 1px solid rgba(255,255,255,.25);
}

.qt-admin-page {
    min-height: 100vh;
    background: radial-gradient(circle at top right, rgba(21, 168, 158, .14), transparent 34%), #f4f7fb;
    color: var(--qt-text);
}

.qt-admin-container {
    width: min(1380px, calc(100% - 28px));
    margin: 0 auto;
    padding: 28px 0 70px;
}

.qt-admin-hero {
    background: linear-gradient(135deg, #170b57, #0f766e);
    color: #fff;
    border-radius: 30px;
    padding: 32px;
    box-shadow: var(--qt-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    overflow: hidden;
    position: relative;
}

.qt-admin-hero::after {
    content: "";
    position: absolute;
    width: 260px;
    height: 260px;
    border-radius: 999px;
    background: rgba(255,255,255,.10);
    inset-inline-start: -90px;
    bottom: -110px;
}

.qt-admin-hero h1 {
    font-size: clamp(1.9rem, 4vw, 3.1rem);
    font-weight: 900;
    margin: 0 0 12px;
}

.qt-admin-hero p {
    max-width: 820px;
    line-height: 1.9;
    opacity: .92;
    margin: 0;
    font-size: 1.06rem;
}

.qt-admin-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0;
}

.qt-admin-stats div,
.qt-admin-card {
    background: #fff;
    border: 1px solid var(--qt-border);
    border-radius: 24px;
    box-shadow: 0 12px 34px rgba(15, 23, 42, .06);
}

.qt-admin-stats div {
    padding: 20px;
}

.qt-admin-stats strong {
    display: block;
    font-size: 2rem;
    font-weight: 900;
    color: var(--qt-primary-dark);
}

.qt-admin-stats span {
    color: var(--qt-muted);
    font-weight: 800;
}

.qt-admin-tabs {
    background: #fff;
    border: 1px solid var(--qt-border);
    padding: 8px;
    border-radius: 20px;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    box-shadow: 0 10px 28px rgba(15,23,42,.05);
}

.qt-admin-tabs button {
    border: 0;
    background: transparent;
    color: var(--qt-muted);
    padding: 11px 18px;
    border-radius: 15px;
    font-weight: 900;
}

.qt-admin-tabs button.active {
    background: var(--qt-primary);
    color: #fff;
}

.qt-admin-grid {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.qt-admin-card {
    padding: 20px;
}

.qt-admin-list-card {
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow: auto;
}

.qt-admin-card-head,
.qt-admin-step-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.qt-admin-card-head h2,
.qt-admin-card-head h3 {
    margin: 0;
    font-weight: 900;
    color: var(--qt-text);
}

.qt-admin-list {
    display: grid;
    gap: 10px;
}

.qt-admin-list-item {
    text-align: start;
    border: 1px solid var(--qt-border);
    background: #fff;
    border-radius: 18px;
    padding: 14px;
    display: grid;
    gap: 4px;
    color: var(--qt-text);
    transition: .2s ease;
}

.qt-admin-list-item:hover,
.qt-admin-list-item.active {
    border-color: rgba(21,168,158,.55);
    background: rgba(21,168,158,.07);
}

.qt-admin-list-item span {
    color: var(--qt-primary-dark);
    font-weight: 900;
    font-size: .82rem;
}

.qt-admin-list-item strong {
    font-weight: 900;
}

.qt-admin-list-item small {
    color: var(--qt-muted);
    direction: ltr;
    text-align: right;
}

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

.qt-form-full {
    grid-column: 1 / -1;
}

.qt-admin-page .form-label {
    font-weight: 900;
    color: var(--qt-text);
}

.qt-admin-page .form-control,
.qt-admin-page .form-select {
    border-radius: 14px;
    min-height: 46px;
    border-color: var(--qt-border);
}

.qt-admin-steps {
    display: grid;
    gap: 16px;
}

.qt-admin-step {
    border: 1px solid var(--qt-border);
    border-radius: 22px;
    padding: 16px;
    background: #f8fafc;
}

.qt-admin-step-head {
    margin-bottom: 12px;
}

.qt-admin-image-preview {
    margin-top: 12px;
    max-height: 220px;
    max-width: 100%;
    border-radius: 16px;
    border: 1px solid var(--qt-border);
    display: block;
    object-fit: contain;
    background: #fff;
}

.qt-admin-note {
    background: rgba(21,168,158,.08);
    border: 1px solid rgba(21,168,158,.22);
    color: #115e59;
    padding: 14px 16px;
    border-radius: 18px;
    font-weight: 800;
    line-height: 1.8;
}

.qt-json-box {
    direction: ltr;
    text-align: left;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: .9rem;
}

@media (max-width: 992px) {
    .qt-admin-hero,
    .qt-tutorial-hero,
    .qt-article-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .qt-admin-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .qt-admin-grid {
        grid-template-columns: 1fr;
    }

    .qt-admin-list-card {
        position: static;
        max-height: none;
    }
}

@media (max-width: 640px) {
    .qt-admin-stats,
    .qt-form-grid {
        grid-template-columns: 1fr;
    }

    .qt-admin-container {
        width: min(100% - 18px, 1380px);
    }

    .qt-admin-card,
    .qt-admin-hero {
        padding: 16px;
        border-radius: 20px;
    }
}

/* HTML lesson content */
.qt-html-content {
    background: #fff;
    border: 1px solid var(--qt-border);
    border-radius: 28px;
    box-shadow: var(--qt-shadow);
    padding: clamp(20px, 3vw, 36px);
    margin-top: 22px;
    line-height: 2;
    color: var(--qt-text);
    overflow-wrap: anywhere;
}

.qt-html-content h2,
.qt-html-content h3,
.qt-html-content h4 {
    color: #0f766e;
    font-weight: 900;
    margin: 1.2em 0 .5em;
}

.qt-html-content h2:first-child,
.qt-html-content h3:first-child {
    margin-top: 0;
}

.qt-html-content p,
.qt-html-content li {
    font-size: 1.02rem;
}

.qt-html-content img,
.qt-html-content video,
.qt-html-content iframe {
    max-width: 100%;
    border-radius: 18px;
    display: block;
    margin: 18px auto;
    box-shadow: 0 14px 32px rgba(15, 23, 42, .12);
}

.qt-html-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 18px 0;
    overflow: hidden;
    border-radius: 14px;
}

.qt-html-content th,
.qt-html-content td {
    border: 1px solid var(--qt-border);
    padding: 12px 14px;
    text-align: start;
}

.qt-html-content th {
    background: #ecfeff;
    color: #0f766e;
    font-weight: 900;
}

.qt-html-content blockquote,
.qt-html-content .lesson-tip {
    border-inline-start: 5px solid var(--qt-primary);
    background: #ecfeff;
    padding: 14px 18px;
    border-radius: 16px;
    margin: 18px 0;
}

.qt-html-content figure {
    margin: 22px 0;
}

.qt-html-content figcaption {
    color: var(--qt-muted);
    text-align: center;
    font-size: .92rem;
    margin-top: -8px;
}

.qt-html-mode-card {
    background: #f8fafc;
    border: 1px dashed var(--qt-border);
    border-radius: 18px;
    padding: 14px 16px;
}

.qt-html-editor {
    min-height: 420px;
    font-family: Consolas, Monaco, 'Courier New', monospace;
    font-size: .95rem;
    direction: ltr;
    text-align: left;
}

.qt-html-preview-wrap {
    margin-top: 18px;
}

.qt-html-preview-wrap summary {
    cursor: pointer;
    font-weight: 900;
    color: var(--qt-primary-dark);
    margin-bottom: 10px;
}

.qt-html-preview {
    margin-top: 10px;
    box-shadow: none;
}
