/**
 * AI Assistent 3.0 – stylesheet (3v1)
 * SOP-GUI efter Nyt design 3v. PC-bredde som 2.x. Mindre dropdown på mobil.
 */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    -webkit-text-size-adjust: 100%;
    touch-action: pan-y pinch-zoom;
}

body.app-body {
    margin: 0;
    padding: 0;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    background: #0a1238;
    color: #0f172a;
    font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
    touch-action: pan-y pinch-zoom;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.hidden {
    display: none !important;
}

.app-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 0 0 1px rgba(15, 26, 78, 0.08);
}

.brand-bar {
    height: 4px;
    flex: 0 0 4px;
    background: linear-gradient(90deg, #2563eb, #38bdf8, #e8eef9);
}

.sop-header {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 3.5rem 1fr 3.5rem;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid #e2e8f0;
    background: #fafbff;
    z-index: 3;
}

.header-logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 2.5rem;
    text-decoration: none;
}

.header-logo-img {
    display: block;
    height: 2.25rem;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.header-title-block {
    min-width: 0;
    text-align: center;
}

.header-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #0f172a;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-title--clickable {
    cursor: pointer;
    color: #1e3a8a;
}

.header-subtitle {
    margin: 0.12rem 0 0;
    font-size: 0.68rem;
    font-weight: 500;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stage {
    position: relative;
    flex: 1 1 0;
    min-height: 0;
    background: #f8fafc;
}

.sop-stage {
    height: 100%;
    overflow-x: hidden;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y pinch-zoom;
    background: #f8fafc;
}

.sop-page {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.sop-hero {
    display: block;
    width: 100%;
    max-height: none; object-fit: contain;
    background: #e2e8f0;
    cursor: zoom-in;
}

.sop-body {
    padding: 1rem 1rem 5.5rem;
    font-size: 0.95rem;
    line-height: 1.55;
    color: #0f172a;
}

.sop-body h1,
.sop-body h2,
.sop-body h3 {
    margin: 0.35em 0 0.4em;
    line-height: 1.25;
    color: #0f172a;
}

.sop-body h1 { font-size: 1.25rem; font-weight: 600; }
.sop-body h2 { font-size: 1.15rem; font-weight: 600; }
.sop-body h3 { font-size: 1.02rem; font-weight: 600; }
.sop-body p { margin: 0.4em 0; }
.sop-body ul,
.sop-body ol {
    margin: 0.6em 0;
    padding-left: 1.3rem;
}
.sop-body li { margin: 0.25em 0; }
.sop-body strong { font-weight: 700; }

.sop-empty {
    padding: 1.25rem 1rem;
    color: #64748b;
}

.message--error {
    margin: 1rem;
    padding: 0.75rem 0.9rem;
    border-radius: 0.75rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    font-size: 0.9rem;
}

.lesson-catalog {
    margin: 1rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    padding: 1rem 1.1rem 1.15rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.lesson-catalog__heading {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
}

.lesson-catalog__hint {
    margin: 0 0 0.85rem;
    font-size: 0.85rem;
    color: #64748b;
}

.lesson-catalog__empty {
    margin: 0;
    color: #64748b;
}

.lesson-catalog__list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.lesson-catalog__link {
    display: block;
    padding: 0.75rem 0.85rem;
    border-radius: 0.6rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #1e3a8a;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
}

.lesson-catalog__link:hover,
.lesson-catalog__link:focus {
    background: #eff6ff;
    border-color: #93c5fd;
    outline: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ask-ai {
    position: absolute;
    right: 0.75rem;
    bottom: 0.85rem;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    height: 3rem;
    padding: 0 1rem;
    border: none;
    border-radius: 999px;
    background: #2563eb;
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
    ring: 2px solid #ffffff;
    outline: 2px solid #ffffff;
    cursor: pointer;
}

.ask-ai svg {
    width: 1.2rem;
    height: 1.2rem;
}

.ask-ai:active {
    transform: scale(0.97);
}

.sop-nav {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem max(0.65rem, env(safe-area-inset-bottom));
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
    z-index: 4;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    height: 2.75rem;
    min-width: 3.6rem;
    padding: 0 0.45rem;
    border-radius: 0.5rem;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

.nav-btn svg {
    width: 1.2rem;
    height: 1.2rem;
}

.nav-btn--back {
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #0f172a;
}

.nav-btn--back:hover:not(:disabled) {
    background: #f8fafc;
}

.nav-btn--next {
    border: none;
    background: #16a34a;
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(22, 163, 74, 0.3);
}

.nav-btn--next:hover:not(:disabled) {
    background: #15803d;
}

.nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.step-select-wrap {
    position: relative;
    display: block;
    min-width: 0;
}

.step-select {
    display: block;
    width: 100%;
    height: 2.75rem;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #f8fafc;
    padding: 0 1.6rem 0 0.45rem;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    color: #0f172a;
    outline: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.step-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.step-select-chevron {
    position: absolute;
    top: 50%;
    right: 0.45rem;
    width: 1rem;
    height: 1rem;
    transform: translateY(-50%);
    color: #64748b;
    pointer-events: none;
}

/* AI overlay */
.ai-sheet {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.ai-sheet-backdrop {
    position: absolute;
    inset: 0;
    border: none;
    padding: 0;
    background: rgba(15, 26, 78, 0.45);
    cursor: pointer;
}

.ai-sheet-panel {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    max-height: 86%;
    background: #ffffff;
    border-radius: 1rem 1rem 0 0;
    box-shadow: 0 -12px 40px rgba(15, 26, 78, 0.18);
    padding-bottom: env(safe-area-inset-bottom);
}

.ai-sheet-head {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem 0.7rem;
    border-bottom: 1px solid #e2e8f0;
}

.ai-sheet-head-text {
    min-width: 0;
    flex: 1;
}

.ai-sheet-kicker {
    margin: 0;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #2563eb;
}

.ai-sheet-title {
    margin: 0.15rem 0 0;
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-sheet-close {
    flex: 0 0 auto;
    width: 2.75rem;
    height: 2.75rem;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 1.7rem;
    line-height: 1;
    border-radius: 0.5rem;
    cursor: pointer;
}

.ai-sheet-close:hover {
    background: #f8fafc;
    color: #0f172a;
}

.ai-sheet-log {
    min-height: 7rem;
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.ai-bubble {
    max-width: 92%;
    padding: 0.65rem 0.85rem;
    border-radius: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.45;
}

.ai-bubble--bot {
    align-self: flex-start;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 0.3rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.ai-bubble--user {
    align-self: flex-end;
    background: #e8eef9;
    border-bottom-right-radius: 0.3rem;
}

.ai-bubble--error {
    align-self: stretch;
    max-width: 100%;
    background: #fef2f2;
    color: #b91c1c;
}

.ai-sheet-chips {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.6rem 1rem;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
}

.ai-chip {
    flex: 0 0 auto;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #1e3a8a;
    border-radius: 999px;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
}

.ai-chip:hover {
    border-color: #2563eb;
    background: #e8eef9;
}

.ai-sheet-form {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem 0.75rem;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
}

.ai-sheet-input {
    flex: 1;
    min-width: 0;
    height: 3rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #f8fafc;
    padding: 0 0.9rem;
    font-size: 16px;
    font-family: inherit;
    color: #0f172a;
    outline: none;
}

.ai-sheet-input:focus {
    border-color: #2563eb;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.ai-sheet-send {
    width: 3rem;
    height: 3rem;
    flex: 0 0 3rem;
    border: none;
    border-radius: 0.5rem;
    background: #16a34a;
    color: #ffffff;
    cursor: pointer;
}

.ai-sheet-send svg {
    width: 1.25rem;
    height: 1.25rem;
}

.ai-sheet-send:hover:not(:disabled) {
    background: #15803d;
}

.ai-sheet-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Lightbox + debug-modal (uændret funktion) */
.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.92);
    touch-action: none;
    overflow: hidden;
}

.image-lightbox.hidden { display: none !important; }

.image-lightbox img {
    max-width: 96%;
    max-height: 86%;
    object-fit: contain;
    transform-origin: center center;
    user-select: none;
    -webkit-user-drag: none;
    touch-action: none;
}

.image-lightbox-close {
    position: absolute;
    top: max(0.5rem, env(safe-area-inset-top, 0px));
    right: 0.6rem;
    z-index: 2;
    border: none;
    background: rgba(15, 23, 42, 0.55);
    color: #ffffff;
    font-size: 2rem;
    line-height: 1;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    cursor: pointer;
}

.image-lightbox-hint {
    position: absolute;
    left: 0.75rem;
    right: 0.75rem;
    bottom: max(0.6rem, env(safe-area-inset-bottom, 0px));
    margin: 0;
    text-align: center;
    color: #cbd5e1;
    font-size: 0.8rem;
    pointer-events: none;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.55);
}

.modal-panel {
    background: #ffffff;
    border-radius: 0.75rem;
    width: 100%;
    max-width: 32rem;
    max-height: min(80dvh, 36rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.modal-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
}

.modal-body {
    margin: 0;
    padding: 1rem;
    overflow: auto;
    font-size: 0.8rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    color: #334155;
    font-family: ui-monospace, Menlo, monospace;
}

@media (min-width: 640px) {
    .app-shell {
        max-width: 48rem;
        box-shadow:
            0 0 0 1px rgba(15, 26, 78, 0.08),
            0 10px 40px rgba(10, 18, 56, 0.35);
    }

    .step-select {
        height: 3rem;
        font-size: 0.8rem;
        padding: 0 1.8rem 0 0.65rem;
    }

    .nav-btn {
        height: 3rem;
        min-width: 4.4rem;
        padding: 0 0.7rem;
        font-size: 0.88rem;
    }

    .sop-hero {
        max-height: none;
        object-fit: contain;
        background: #f1f5f9;
    }
}

@media (min-width: 1024px) {
    .app-shell {
        max-width: 64rem;
    }
}


/* ---- Burger + slide-in menus ---- */
.burger-btn {
    justify-self: end;
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: #0f172a;
    cursor: pointer;
    padding: 0;
}

.burger-btn:hover,
.burger-btn:focus-visible {
    background: #e8eefc;
    outline: none;
}

.burger-btn-bar {
    display: block;
    width: 1.15rem;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
}

.app-menu {
    position: fixed;
    inset: 0;
    z-index: 80;
    pointer-events: none;
}

.app-menu.is-open {
    pointer-events: auto;
}

.app-menu-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    padding: 0;
    margin: 0;
    background: rgba(15, 23, 42, 0.28);
    opacity: 0;
    transition: opacity 0.22s ease;
    cursor: pointer;
}

.app-menu.is-open .app-menu-backdrop {
    opacity: 1;
}

.menu-drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    box-shadow: -8px 0 28px rgba(15, 23, 42, 0.18);
    border-radius: 1.1rem 0 0 1.1rem;
    transform: translateX(105%);
    transition: transform 0.28s ease;
    overflow: hidden;
}

.menu-drawer--main {
    width: 90%;
    z-index: 2;
}

.menu-drawer--sub {
    width: 80%;
    z-index: 3;
}

.menu-drawer.is-open {
    transform: translateX(0);
}

.menu-drawer-head {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 2.5rem 1fr 2.5rem;
    align-items: center;
    gap: 0.35rem;
    padding: 0.85rem 0.9rem;
    border-bottom: 1px solid #e2e8f0;
}

.menu-drawer--main .menu-drawer-head,
.menu-drawer--sub .menu-drawer-head {
    grid-template-columns: 1fr 2.5rem;
}

.menu-drawer-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    text-align: center;
}

.menu-drawer--main .menu-drawer-title,
.menu-drawer--sub .menu-drawer-title {
    text-align: left;
    padding-left: 0.25rem;
}

.menu-drawer-close,
.menu-drawer-back {
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: #334155;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.menu-drawer-close:hover,
.menu-drawer-back:hover,
.menu-drawer-close:focus-visible,
.menu-drawer-back:focus-visible {
    background: #e8eefc;
    outline: none;
}

.menu-drawer-close {
    justify-self: end;
}

.menu-nav {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
    overflow-y: auto;
}

.menu-nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: 0;
    border-bottom: 1px solid #f1f5f9;
    background: transparent;
    text-align: left;
    padding: 1rem 1.15rem;
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    cursor: pointer;
}

.menu-nav-item:hover,
.menu-nav-item:focus-visible {
    background: #f8fafc;
    outline: none;
}

.menu-nav-item--selected {
    background: #eef4ff;
    color: #1e3a8a;
}

.menu-nav-item--current {
    background: #f8fafc;
}

.menu-nav-heading {
    padding: 0.85rem 1.15rem 0.25rem;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    cursor: default;
    user-select: none;
}

.menu-nav-item--indent {
    padding-left: 2rem;
    font-weight: 500;
}


.menu-nav-check {
    color: #1d4ed8;
    font-weight: 700;
}

.menu-hint {
    margin: 0.75rem 1.15rem 0;
    font-size: 0.8rem;
    color: #64748b;
}

.menu-login-form {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 1.1rem 1.15rem 1.5rem;
}

.menu-field-label {
    margin-top: 0.55rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #0f172a;
}

.menu-field-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 0.65rem;
    padding: 0.7rem 0.85rem;
    font-size: 1rem;
    background: #fff;
}

.menu-field-input:focus {
    outline: 2px solid #93c5fd;
    border-color: #60a5fa;
}

body.app-menu-open {
    overflow: hidden;
}



/* ---- Empty welcome frontpage ---- */
.welcome-page {
    box-sizing: border-box;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.75rem;
    padding: 2rem 1.5rem 3rem;
}

.welcome-page__logo {
    display: block;
    width: min(72vw, 28rem);
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.welcome-page__text {
    margin: 0;
    max-width: 34rem;
    text-align: center;
    font-size: 1.05rem;
    line-height: 1.55;
    font-weight: 500;
    color: #334155;
}



/* ---- Frontpage Spørg AI (90% from bottom) ---- */
.ai-sheet--home .ai-sheet-panel {
    height: 90%;
    max-height: 90%;
    border-radius: 1.1rem 1.1rem 0 0;
    transform: translateY(100%);
    transition: transform 0.28s ease;
}

.ai-sheet--home.is-open .ai-sheet-panel {
    transform: translateY(0);
}

.ai-sheet--home .ai-sheet-chips {
    display: none !important;
}

.ai-sheet--home .ai-sheet-title {
    white-space: pre-line;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.35;
}



.ai-sheet-title-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.ai-sheet-provider-logo {
    flex: 0 0 auto;
    width: 2.35rem;
    height: 2.35rem;
    object-fit: contain;
}

.ai-sheet-provider-logo.hidden {
    display: none;
}

.ai-sheet--home .ai-sheet-kicker {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: normal;
    text-transform: none;
    color: #2563eb;
}

.ai-sheet--home .ai-sheet-title {
    white-space: pre-line;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.35;
    font-size: 0.95rem;
}


.menu-login-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0.65rem;
    margin-top: 1.1rem;
}

.menu-login-btn {
    border: 0;
    border-radius: 0.65rem;
    padding: 0.7rem 1.15rem;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
}

.menu-login-btn--primary {
    color: #ffffff;
    background: #2563eb;
}

.menu-login-btn--primary:hover,
.menu-login-btn--primary:focus-visible {
    background: #1d4ed8;
    outline: none;
}

.menu-login-btn--create {
    color: #ffffff;
    background: #16a34a;
}

.menu-login-btn--create:hover,
.menu-login-btn--create:focus-visible {
    background: #15803d;
    outline: none;
}


/* ---- Thinking bubble (spinner + Tænker + seconds) ---- */
.ai-bubble--thinking {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 92%;
}

.ai-thinking-spinner {
    width: 1.25rem;
    height: 1.25rem;
    color: #3b82f6;
    flex: 0 0 auto;
    animation: spin 0.9s linear infinite;
}

.ai-thinking-label {
    font-weight: 600;
    color: #334155;
}

.ai-thinking-secs {
    font-variant-numeric: tabular-nums;
    color: #64748b;
    font-weight: 500;
    min-width: 1.6rem;
}


.ai-msg {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-width: 100%;
}

.ai-msg--user {
    align-items: flex-end;
}

.ai-msg--bot,
.ai-msg--error {
    align-items: flex-start;
}

.ai-msg .ai-bubble {
    max-width: 92%;
}

.ai-think-meta {
    margin: 0 0 0 0.15rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: #94a3b8;
}


.ai-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.55rem 0.85rem;
    margin: 0 0 0 0.15rem;
}

.ai-think-meta {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 500;
    color: #94a3b8;
}

.ai-price-link {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    color: #2563eb;
    text-decoration: underline;
    text-underline-offset: 0.12em;
    cursor: pointer;
}

.ai-price-link:hover,
.ai-price-link:focus-visible {
    color: #1d4ed8;
    outline: none;
}

.ai-price-detail {
    margin: 0.35rem 0 0.15rem;
    padding: 0.75rem 0.85rem;
    border-radius: 0.65rem;
    background: #dbeafe;
    color: #1e3a8a;
    font-size: 0.82rem;
    line-height: 1.45;
    max-width: 92%;
}

.ai-price-detail.hidden {
    display: none;
}

.ai-price-detail p {
    margin: 0 0 0.45rem;
}

.ai-price-detail p:last-child {
    margin-bottom: 0;
}

.ai-price-list {
    margin: 0.35rem 0 0.5rem;
    padding-left: 1.1rem;
}

.ai-price-list li {
    margin: 0.2rem 0;
}

.ai-price-muted {
    color: #3b82f6;
    font-weight: 500;
}


.ai-save-chat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    margin: 0 0 0.65rem;
    padding: 0.55rem 1rem;
    border: 2px solid #1d4ed8;
    border-radius: 0.65rem;
    background: #2563eb;
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 700;
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
    cursor: pointer;
}

.ai-save-chat:hover,
.ai-save-chat:focus-visible {
    background: #1d4ed8;
    outline: none;
}

.ai-save-chat:disabled {
    opacity: 0.7;
    cursor: wait;
}

.ai-pdf-export-host {
    position: fixed;
    left: -10000px;
    top: 0;
    width: 800px;
    pointer-events: none;
    opacity: 1;
    z-index: -1;
}

.ai-pdf-export {
    background: #f8fafc;
    color: #0f172a;
    padding: 1rem 1.1rem 1.5rem;
    font-family: inherit;
}

.ai-pdf-export-head h1 {
    margin: 0;
    font-size: 1.25rem;
    color: #2563eb;
}

.ai-pdf-export-sub {
    margin: 0.35rem 0 0;
    white-space: pre-line;
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
}

.ai-pdf-export-when {
    margin: 0.35rem 0 0.85rem;
    font-size: 0.75rem;
    color: #64748b;
}

.ai-pdf-export-log {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: #f8fafc;
    padding: 0;
    min-height: 0;
    overflow: visible;
}
