/* ========================================================
   Hudbohry Metodika – Custom styles (Bootstrap 5 base)
   ======================================================== */

@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,opsz,wght@0,6..12,300..900;1,6..12,300..900&display=swap');

:root {
    /* ── Project palette (matches /index.html) ── */
    --bg-body:       #faf4ec;
    --bg-card:       #ffffff;
    --accent:        #c69a6b;
    --accent-soft:   #f3dfc5;
    --accent-strong: #a26f3a;
    --text-main:     #2f2a26;
    --text-muted:    #6d625a;
    --border-soft:   #e4d7c7;
    --shadow-soft:   0 10px 25px rgba(0, 0, 0, 0.05);
    --radius-lg:     18px;
    --radius-xl:     26px;
    --max-width:     1120px;
    --header-height: 60px;

    /* ── Bootstrap theme variable overrides ── */
    /* Replaces Bootstrap's blue/green/teal with the warm palette */
    --bs-primary:           #a26f3a;
    --bs-primary-rgb:       162, 111, 58;
    --bs-success:           #6b8b4e;
    --bs-success-rgb:       107, 139, 78;
    --bs-info:              #c69a6b;
    --bs-info-rgb:          198, 154, 107;
    --bs-link-color:        #a26f3a;
    --bs-link-color-rgb:    162, 111, 58;
    --bs-link-hover-color:  #c69a6b;
}

/* ── Checkout: payment-method selector + PayPal buttons ── */
.hm-pay-methods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.hm-pay-method {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.9rem 1rem;
    border: 2px solid var(--border-soft);
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-main);
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.hm-pay-method i {
    font-size: 1.15rem;
}
.hm-pay-method:hover {
    border-color: var(--accent);
}
.hm-pay-method.active {
    border-color: var(--accent-strong);
    background: var(--accent-soft);
    color: var(--accent-strong);
}
#paypal-button-container {
    max-width: 320px;
    margin: 0 auto;
}

/* ── Global ───────────────────────────────────────────── */
body {
    font-family: 'Nunito Sans', system-ui, -apple-system, sans-serif;
    background: radial-gradient(circle at top left, #fbeadd, #faf4ec 50%, #fdfcf9) fixed;
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

a {
    color: var(--accent-strong);
}
a:hover {
    color: var(--accent);
}

/* ── Navbar ───────────────────────────────────────────── */
.hm-navbar {
    background-color: rgba(250, 244, 236, 0.9) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(228, 215, 199, 0.8);
    box-shadow: var(--shadow-soft);
    padding-top: .4rem;
    padding-bottom: .4rem;
}

/* Brand: logo + stacked text */
.hm-brand {
    display: flex !important;
    align-items: center;
    gap: .65rem;
    text-decoration: none;
}

.hm-brand-logo {
    height: 52px;
    width: 52px;
    object-fit: contain;
    border-radius: 50%;
    flex-shrink: 0;
}

.hm-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.hm-brand-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--accent-strong);
    letter-spacing: .03em;
}

.hm-brand-subtitle {
    font-size: .75rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: .12em;
    text-transform: uppercase;
}

.hm-navbar .nav-link {
    color: var(--text-main) !important;
    font-weight: 500;
    transition: color .2s;
}
.hm-navbar .nav-link:hover,
.hm-navbar .nav-link.active {
    color: var(--accent-strong) !important;
}

.hm-navbar .navbar-toggler {
    border-color: var(--border-soft);
    color: var(--text-main);
}
.hm-navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%232f2a26' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.hm-navbar .btn-nav-register {
    background: var(--accent);
    color: #fff !important;
    font-weight: 600;
    border: none;
    border-radius: 999px !important;
    box-shadow: 0 6px 13px rgba(162, 111, 58, 0.25);
}
.hm-navbar .btn-nav-register:hover {
    background: var(--accent-strong);
    color: #fff !important;
}

/* Dropdown */
.hm-navbar .dropdown-menu {
    border-color: var(--border-soft);
    box-shadow: var(--shadow-soft);
    border-radius: var(--radius-lg);
}
.hm-navbar .dropdown-item:hover,
.hm-navbar .dropdown-item:focus {
    background-color: var(--accent-soft);
    color: var(--accent-strong);
}

/* ── Page wrapper ─────────────────────────────────────── */
.hm-page {
    padding-top: 2rem;
    padding-bottom: 3rem;
}

/* ── Auth cards (login, register, etc.) ───────────────── */
.hm-auth-wrap {
    min-height: calc(100vh - var(--header-height));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.hm-auth-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft), 0 1px 3px rgba(0,0,0,.04);
    border: 1px solid var(--border-soft);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 480px;
}

.hm-auth-card .hm-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.hm-auth-card .hm-logo span {
    display: block;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent-strong);
    line-height: 1.1;
}

.hm-auth-intro {
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    font-size: .9rem;
    line-height: 1.55;
}

.hm-auth-intro p {
    margin: 0;
}

.hm-auth-intro p + p {
    margin-top: .5rem;
}

.hm-auth-intro strong {
    color: var(--accent-strong);
}

.hm-auth-intro-link {
    display: inline-block;
    margin-top: .5rem;
    font-size: .85rem;
    font-weight: 600;
    color: var(--accent-strong);
    text-decoration: none;
}

.hm-auth-intro-link:hover {
    text-decoration: underline;
}

/* ── About page ─────────────────────────────────────────── */
.hm-about-card {
    max-width: 720px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft), 0 1px 3px rgba(0,0,0,.04);
    border: 1px solid var(--border-soft);
    padding: 2.5rem 2rem;
}

.hm-about-heading {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent-strong);
    margin-bottom: 2rem;
}

.hm-about-section {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.hm-about-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 1.25rem;
}

.hm-about-section h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 .35rem;
    color: var(--text-main);
}

.hm-about-section p {
    margin: 0;
    font-size: .92rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.hm-about-section p + p {
    margin-top: .35rem;
}

.hm-about-list {
    margin: .5rem 0 0;
    padding-left: 0;
    list-style: none;
}

.hm-about-list li {
    position: relative;
    padding-left: 1.25rem;
    font-size: .92rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.hm-about-list li::before {
    content: "\F287";
    font-family: "bootstrap-icons";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-size: .7rem;
    top: .15rem;
}

.hm-about-cta {
    background: var(--accent-soft);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 1rem;
}

.hm-about-cta p {
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: .75rem;
    font-size: 1rem;
}

.hm-about-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: .75rem;
}

.hm-auth-card h1 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--text-main);
}

/* ── Form elements ────────────────────────────────────── */
.form-label {
    font-weight: 600;
    font-size: .875rem;
    color: var(--text-main);
}

.form-control,
.form-select {
    border-color: var(--border-soft);
    border-radius: 10px;
    background-color: #fffdf9;
    color: var(--text-main);
}
.form-control:focus,
.form-select:focus {
    border-color: var(--accent);
    background-color: #fff;
    box-shadow: 0 0 0 .2rem rgba(198, 154, 107, .25);
}

/* ── Buttons (matching /index.html exactly) ──────────── */
.btn-primary {
    /* Override Bootstrap's CSS variable system */
    --bs-btn-color:              #fff;
    --bs-btn-bg:                 #a26f3a;
    --bs-btn-border-color:       transparent;
    --bs-btn-hover-color:        #fff;
    --bs-btn-hover-bg:           #a26f3a;
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color:       #fff;
    --bs-btn-active-bg:          #8a5e30;
    --bs-btn-focus-shadow-rgb:   162, 111, 58;
    --bs-btn-disabled-bg:        #c69a6b;
    --bs-btn-disabled-border-color: transparent;

    background: linear-gradient(135deg, #c69a6b, #a26f3a);
    border: none;
    color: #fff;
    border-radius: 999px;
    font-weight: 600;
    box-shadow: 0 10px 22px rgba(162, 111, 58, 0.32);
    transition: transform 0.08s ease-out, box-shadow 0.08s ease-out;
}
.btn-primary:hover,
.btn-primary:active,
.btn-primary:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(162, 111, 58, 0.42);
    background: linear-gradient(135deg, #c69a6b, #a26f3a);
    border: none;
    color: #fff;
}
.btn-primary:focus {
    box-shadow: 0 0 0 .2rem rgba(162, 111, 58, .35);
}

/* Ghost button (matching /index.html .btn-ghost) */
.btn-outline-primary {
    --bs-btn-color:              var(--text-main);
    --bs-btn-border-color:       var(--border-soft);
    --bs-btn-hover-color:        var(--text-main);
    --bs-btn-hover-bg:           #ffffff;
    --bs-btn-hover-border-color: var(--border-soft);
    --bs-btn-active-color:       var(--text-main);

    background: rgba(255, 255, 255, 0.85);
    color: var(--text-main);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    font-weight: 600;
}
.btn-outline-primary:hover {
    background: #ffffff;
    color: var(--text-main);
    border-color: rgba(194, 154, 107, 0.4);
}

.btn-outline-warning {
    border-radius: 999px;
    font-weight: 600;
}

/* Video button in documents list */
.document-item .btn-outline-warning {
    background: linear-gradient(135deg, #1d4ed8, #1d4ed8);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 10px 22px rgba(29, 78, 216, 0.32);
}
.document-item .btn-outline-warning:hover,
.document-item .btn-outline-warning:focus {
    background: linear-gradient(135deg, #1e40af, #1e40af);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 12px 26px rgba(29, 78, 216, 0.42);
}


/* ── Subscription badge in navbar ─────────────────────── */
.hm-sub-badge {
    font-size: .7rem;
    font-weight: 600;
    padding: .2em .55em;
    border-radius: 30px;
    vertical-align: middle;
    margin-left: .35rem;
}

/* ── Documents page ───────────────────────────────────── */
.hm-page-header {
    background: linear-gradient(135deg, var(--accent-strong) 0%, var(--accent) 100%);
    color: #fff;
    padding: 2rem 0 1.5rem;
    margin-bottom: 0rem;
}

.hm-page-header h1 {
    font-size: 1.9rem;
    font-weight: 700;
    margin-bottom: .25rem;
}

.hm-page-header p {
    opacity: .9;
    margin: 0;
    font-size: .95rem;
}

.hm-page-header a {
    color: rgba(255, 255, 255, .85);
}
.hm-page-header a:hover {
    color: #fff;
}

/* Theme section */
.theme-section {
    margin-bottom: 2.5rem;
}

.theme-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-strong);
    padding-bottom: .6rem;
    border-bottom: 3px solid var(--accent-soft);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* Top (pinned) theme */
.theme-top .theme-title {
    color: #a26f3a;
    border-bottom-color: var(--accent);
}
.theme-top .document-item {
    background: var(--accent-soft);
    border-color: var(--accent);
}
.theme-top .document-item:hover {
    box-shadow: 0 12px 30px rgba(162, 111, 58, .15);
}

/* Document item */
.document-item {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: .75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-soft);
    transition: box-shadow .2s, transform .15s;
}
.document-item:hover {
    box-shadow: 0 12px 30px rgba(0, 0, 0, .09);
    transform: translateY(-1px);
}

.document-item.locked {
    opacity: .7;
    background: #fdf8f3;
}

.doc-info {
    flex: 1;
    min-width: 0;
}

.doc-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: .2rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-desc {
    font-size: .875rem;
    color: var(--text-muted);
    margin-bottom: .4rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.doc-badges {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.doc-actions {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    align-items: flex-end;
    flex-shrink: 0;
}

.doc-locked-msg {
    font-size: .8rem;
    color: var(--text-muted);
    text-align: right;
    max-width: 140px;
    line-height: 1.3;
}

/* Profile & card pages */
.card {
    border-radius: var(--radius-lg) !important;
}
.card-header {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    background-color: var(--accent-soft) !important;
    color: var(--accent-strong);
}

/* ── Video modal ──────────────────────────────────────── */
#videoModal .modal-content {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: none;
}
#videoModal .modal-header {
    background-color: var(--accent-strong);
    color: #fff;
    border: none;
}
#videoModal .modal-header .btn-close {
    filter: invert(1) grayscale(1) brightness(2);
}
#videoModal .modal-body {
    background: #000;
    padding: 0;
}
#videoModal .modal-dialog {
    margin-left: auto;
    margin-right: auto;
}
@media (max-width: 576px) {
    #videoModal .modal-dialog {
        margin: .5rem auto;
        max-width: calc(100% - 1rem);
    }
}

/* ── Footer ───────────────────────────────────────────── */
.hm-footer {
    background-color: var(--accent-strong);
    color: rgba(255, 255, 255, .75);
    padding: 1.25rem 0;
    font-size: .875rem;
    margin-top: auto;
}
.hm-footer a {
    color: rgba(255, 255, 255, .85);
    text-decoration: none;
}
.hm-footer a:hover {
    color: #fff;
}

/* ── Bootstrap colour overrides ──────────────────────── */
/* Primary */
.text-primary   { color: var(--accent-strong) !important; }
.bg-primary     { background-color: var(--accent) !important; }
.border-primary { border-color: var(--accent) !important; }

/* Muted */
.text-muted     { color: var(--text-muted) !important; }

/* Success → warm olive (keeps positive meaning, removes Bootstrap green) */
.text-success   { color: #5f8a45 !important; }
.bg-success     { background-color: var(--accent-strong) !important; }
.alert-success  {
    color: #3d5428;
    background-color: #eef3e8;
    border-color: #ccd9bb;
}
.alert-success .btn-close { filter: none; }

/* Info → accent warm brown */
.text-info      { color: var(--accent-strong) !important; }
.bg-info        {
    background-color: var(--accent-soft) !important;
    color: var(--accent-strong) !important;
}

/* ── OTP login code input ─────────────────────────────── */
.hm-otp-input {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: .5rem;
    border-radius: 12px;
    border-color: var(--accent);
}
.hm-otp-input:focus {
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 .2rem rgba(162, 111, 58, .25);
}

/* ── Standalone purchase badges & items ───────────────── */
.hm-badge-standalone {
    background-color: #7c5cbf;
    color: #fff;
}

.hm-badge-standalone-free {
    background-color: #3a8a5e;
    color: #fff;
}

.hm-badge-purchased {
    background-color: var(--bs-success);
    color: #fff;
}

.hm-badge-discount {
    background-color: #d4433b;
    color: #fff;
}

/* ── Discount ribbon on pricing cards ────────────────── */
.hm-discount-ribbon {
    background: #d4433b;
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: var(--bs-card-border-radius, .375rem) var(--bs-card-border-radius, .375rem) 0 0;
    text-align: center;
}

/* ── Discount note (name shown under pricing cards) ──── */
.hm-discount-note {
    font-size: .8rem;
    color: #d4433b;
    font-weight: 600;
}

/* ── Info bars at top of documents page ──────────────── */
.hm-info-bar {
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 1.3rem;
}
.hm-info-bar-info {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border: 1px solid var(--border-soft);
}
.hm-info-bar-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}
.hm-info-bar-warning {
    background: #fff8e1;
    color: #f57f17;
    border: 1px solid #ffecb3;
}
.hm-info-bar-danger {
    background: #fce4ec;
    color: #c62828;
    border: 1px solid #f8bbd0;
}

.document-item.standalone {
    border-color: #c4b3e8;
    background: #faf8ff;
}

.document-item.standalone.locked {
    background: #f5f2fc;
}

.hm-standalone-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #7c5cbf;
    display: block;
    line-height: 1.2;
}

/* ── Subscription page ────────────────────────────────── */
.hm-sub-icon-lg {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.hm-plan-card {
    background: var(--bg-card);
    border: 2px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    height: 100%;
    transition: border-color .2s, box-shadow .2s;
    cursor: default;
}

.hm-plan-card-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    height: 100%;
}

.hm-plan-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
}

.hm-plan-card.hm-plan-active {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(198, 154, 107, .25);
    background: #fffbf6;
}

.hm-plan-card.hm-plan-pending {
    border-color: var(--bs-info);
    box-shadow: 0 0 0 3px rgba(198, 154, 107, .15);
}

.hm-plan-icon {
    font-size: 2.2rem;
    margin-bottom: .5rem;
    line-height: 1;
}

.hm-plan-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: .5rem;
}

.hm-plan-features {
    flex: 1;
    width: 100%;
}

.btn-plan-select {
    margin-top: auto;
}

/* ── Responsive tweaks ────────────────────────────────── */
@media (max-width: 575px) {
    .hm-auth-card {
        padding: 1.75rem 1.25rem;
    }

    .document-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .doc-actions {
        align-items: flex-start;
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
    }

    .doc-title {
        white-space: normal;
    }

}

/* ── Support widget ──────────────────────────────── */
.hm-support-widget {
    position: fixed;
    bottom: 1.25rem;
    left: 1.25rem;
    z-index: 10000;
}

.hm-support-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #1d4ed8;
    color: #fff;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(29, 78, 216, 0.4);
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
}
.hm-support-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(29, 78, 216, 0.5);
}

.hm-support-panel {
    position: absolute;
    bottom: 70px;
    left: 0;
    width: 340px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-soft);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .15);
    overflow: hidden;
    animation: supportSlideUp .2s ease-out;
}

@keyframes supportSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.hm-support-header {
    background: #1d4ed8;
    color: #fff;
    padding: .85rem 1rem;
    font-weight: 700;
    font-size: .95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hm-support-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    opacity: .8;
}
.hm-support-close:hover {
    opacity: 1;
}

.hm-support-body {
    padding: 1rem;
}

.hm-support-send {
    background: #1d4ed8;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
}
.hm-support-send:hover {
    background: #1e40af;
    color: #fff;
}

.hm-support-success {
    text-align: center;
    padding: 1.5rem 1rem;
}
.hm-support-success i {
    font-size: 2.5rem;
    color: #1d4ed8;
    display: block;
    margin-bottom: .75rem;
}

@media (max-width: 420px) {
    .hm-support-panel {
        width: calc(100vw - 2rem);
        left: -0.25rem;
    }
}

/* ── AI Chat widget (admin) ── */
.hm-aichat-widget {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 9998;
}

.hm-aichat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #7c3aed;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4);
    transition: transform .15s, box-shadow .15s;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: .5px;
}

.hm-aichat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.5);
}

.hm-aichat-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 380px;
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.hm-aichat-header {
    background: #7c3aed;
    color: #fff;
    padding: .85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
}

.hm-aichat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    opacity: .8;
    line-height: 1;
}

.hm-aichat-close:hover {
    opacity: 1;
}

.hm-aichat-messages {
    overflow-y: auto;
    padding: 1rem;
    height: 350px;
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.hm-aichat-msg {
    max-width: 85%;
    padding: .5rem .85rem;
    border-radius: 12px;
    font-size: .875rem;
    line-height: 1.45;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.hm-aichat-msg.user {
    align-self: flex-end;
    background: #7c3aed;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.hm-aichat-msg.assistant {
    align-self: flex-start;
    background: #f3f0ff;
    color: var(--text-main);
    border-bottom-left-radius: 4px;
}

.hm-aichat-msg.assistant p:last-child { margin-bottom: 0; }
.hm-aichat-msg.assistant ul,
.hm-aichat-msg.assistant ol { margin-bottom: .25rem; padding-left: 1.25rem; }
.hm-aichat-msg.assistant h1,
.hm-aichat-msg.assistant h2,
.hm-aichat-msg.assistant h3 { font-size: .95rem; font-weight: 700; margin: .4rem 0 .2rem; }
.hm-aichat-msg.assistant code { font-size: .8rem; background: rgba(0,0,0,.06); padding: .1rem .3rem; border-radius: 4px; }
.hm-aichat-msg.assistant a { color: #7c3aed; text-decoration: underline; }

.hm-aichat-thinking {
    display: flex;
    gap: 4px;
    padding: .5rem 1rem;
    align-items: center;
}

.hm-aichat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #7c3aed;
    animation: aiDotPulse .8s ease-in-out infinite;
}

.hm-aichat-dot:nth-child(2) { animation-delay: .15s; }
.hm-aichat-dot:nth-child(3) { animation-delay: .3s; }

@keyframes aiDotPulse {
    0%, 80%, 100% { opacity: .3; transform: scale(.8); }
    40% { opacity: 1; transform: scale(1); }
}

.hm-aichat-form {
    display: flex;
    gap: .5rem;
    padding: .75rem;
    border-top: 1px solid var(--border-soft);
    align-items: flex-end;
}

.hm-aichat-form textarea {
    flex: 1;
    border-radius: 10px;
    resize: none;
}

.hm-aichat-send {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #7c3aed;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s;
}

.hm-aichat-send:hover {
    background: #6d28d9;
}

.hm-aichat-send:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.hm-aichat-tokens {
    font-size: .75rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    padding: .35rem 1rem 0;
    border-top: 1px solid var(--border-soft);
}

.hm-aichat-tokens.exhausted {
    color: #dc3545;
    font-weight: 600;
}

.hm-aichat-limit-notice {
    background: #f3f0ff;
    border: 1px solid #d8ccf5;
    border-radius: 12px;
    padding: .75rem 1rem;
    text-align: center;
    font-size: .85rem;
    color: var(--text-main);
}

.hm-aichat-limit-notice p {
    margin: 0 0 .5rem;
}

.hm-aichat-purchase-btn {
    display: inline-block;
    background: #7c3aed;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: .4rem 1.2rem;
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s;
}

.hm-aichat-purchase-btn:hover {
    background: #6d28d9;
    color: #fff;
}

.hm-aichat-support-btn {
    display: inline-block;
    background: #1d4ed8;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: .4rem 1rem;
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s;
    margin-top: .4rem;
}

.hm-aichat-support-btn:hover {
    background: #1e40af;
    color: #fff;
}

.hm-aichat-error {
    font-size: .8rem;
    color: #dc3545;
    padding: 0 1rem .5rem;
}

/* Prevent iOS auto-zoom on textarea focus (requires font-size >= 16px) */
.hm-aichat-form textarea {
    font-size: 16px;
}

@media (max-width: 420px) {
    .hm-aichat-panel {
        width: calc(100vw - 2rem);
        right: -0.25rem;
    }
}

/* ── Document detail – desktop buy button above the article ── */
.doc-detail-top-buy {
    display: none;
}

@media (min-width: 769px) {
    .doc-detail-top-buy {
        display: block;
    }
}

/* ── Document detail – sticky mobile action bar ── */
.doc-detail-sticky-bar {
    display: none;
}

@media (max-width: 768px) {
    .doc-detail-sticky-bar {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-card);
        border-top: 1px solid var(--border-soft);
        box-shadow: 0 -4px 12px rgba(0, 0, 0, .08);
        padding: .75rem 1rem;
        z-index: 1050;
    }
}

/* ── Intro page ──────────────────────────────────────── */
.intro-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .6rem;
}
@media (min-width: 420px) {
    .intro-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
.intro-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    font-size: .78rem;
    color: var(--text-main);
    transition: transform .15s, box-shadow .15s;
    gap: .3rem;
    padding: .6rem;
    text-align: center;
}
.intro-box i {
    font-size: 1.2rem;
}
.intro-box:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-soft);
    color: var(--text-main);
    text-decoration: none;
}
.intro-box-new {
    background: #e8f5e9;
    border: 2px solid #a5d6a7;
}
.intro-box-new:hover {
    border-color: #66bb6a;
}
.intro-box-top {
    background: #e3f2fd;
    border: 2px solid #90caf9;
}
.intro-box-top:hover {
    border-color: #42a5f5;
}
.intro-box-regular {
    background: #faf0e4;
    border: 2px solid #dcc8a8;
}
.intro-box-regular:hover {
    border-color: var(--accent);
}
.intro-box-workshop {
    background: #f3e5f5;
    border: 2px solid #ce93d8;
}
.intro-box-workshop:hover {
    border-color: #ab47bc;
}
@media (min-width: 576px) {
    .intro-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 1.2rem;
    }
    .intro-box {
        font-size: 1.05rem;
        gap: .5rem;
        padding: 1.2rem;
        border-radius: var(--radius-lg);
    }
    .intro-box i { font-size: 1.8rem; }
}

/* ── Document pricing ────────────────────────────────── */
.pricing-option input:checked + .card {
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 2px var(--accent-strong);
}
.pricing-option .card {
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
.pricing-option .card:hover {
    border-color: var(--accent);
}

/* ── Surveys / questionnaires ─────────────────────────────────────────── */
.hm-survey {
    max-width: 720px;
}
.hm-survey-card {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}
.hm-survey-html {
    color: var(--text-main);
    line-height: 1.6;
}
.hm-survey-html :last-child {
    margin-bottom: 0;
}
.hm-survey-check {
    font-size: 3.5rem;
    line-height: 1;
    color: var(--bs-success);
}
.hm-survey-label {
    display: block;
    font-weight: 600;
    color: var(--text-main);
}
.hm-survey-num {
    color: var(--accent-strong);
    font-weight: 700;
    margin-right: .25rem;
}
.hm-survey-q .form-check {
    padding: .15rem 0 .15rem 1.9em;
}
.hm-survey-q .form-check-input:checked {
    background-color: var(--accent-strong);
    border-color: var(--accent-strong);
}
.hm-survey-status {
    font-size: .85rem;
    color: var(--text-muted);
    transition: opacity .2s;
}
.hm-survey-status.saving { color: var(--text-muted); }
.hm-survey-status.saved  { color: var(--bs-success); }
.hm-survey-status.err    { color: var(--bs-danger); }

/* Admin survey editor – monospace HTML fields */
.hm-survey-admin .hm-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .82rem;
}
.hm-question-card {
    border: 1px solid var(--border-soft);
}

/* ── Campaign email HTML preview ──────────────────────────────────────── */
.hm-email-preview {
    width: 100%;
    height: 600px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    background: #ffffff;
}
