/* ==========================================================================
   ThaiHao Adaptive Seller & Creator Portal PWA Stylesheet
   GFW-Safe, Zero External CDNs, Safe-Area Insets, 44-48px Touch Floor
   Wave 3: every color, radius and duration reads from the tokens in
   thaihao_gfw_safe_tokens.css.
   ========================================================================== */

html {
    scrollbar-color: var(--o-thaihao-crimson) transparent;
    scrollbar-width: thin;
}

.o_thaihao_pwa_body {
    padding-bottom: calc(88px + var(--o-thaihao-safe-bottom));
    caret-color: var(--o-thaihao-crimson);
    font-variant-numeric: tabular-nums;
}

.o_thaihao_pwa_body a {
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.thaihao-num,
.o_thaihao_num {
    font-variant-numeric: tabular-nums;
}

/* Currency codes sit beside the number at a smaller size so the figure leads. */
.o_thaihao_unit {
    margin-right: 0.15em;
    font-size: 0.58em;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--o-thaihao-muted);
}

.o_thaihao_num_neg {
    color: var(--th-risk-fg);
}

.o_thaihao_sr_only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Prevent iOS Safari auto-zoom and guarantee 44px minimum touch height */
.o_thaihao_pwa_body input,
.o_thaihao_pwa_body select,
.o_thaihao_pwa_body textarea {
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--th-border-input);
    border-radius: 10px;
    background-color: var(--th-surface-card);
    color: var(--o-thaihao-ink);
    font-family: var(--o-thaihao-font-sans);
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color var(--th-dur-quick) var(--th-ease-out),
                box-shadow var(--th-dur-quick) var(--th-ease-out);
}

.o_thaihao_pwa_body :is(input, select, textarea):focus {
    border-color: var(--o-thaihao-crimson);
    box-shadow: 0 0 0 3px rgba(172, 0, 34, 0.16);
    outline: none;
}

.o_thaihao_pwa_body :is(input, select, textarea):user-invalid,
.o_thaihao_pwa_body :is(input, select, textarea)[aria-invalid="true"] {
    border-color: var(--th-risk-fg);
}

.o_thaihao_pwa_body :is(input, select, textarea):disabled {
    background-color: var(--th-surface-sunken);
    color: var(--o-thaihao-muted);
    cursor: not-allowed;
}

/* Topbar identity, language switcher, and Web Push trigger */
.o_thaihao_topbar_brand {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.o_thaihao_topbar_brand > strong {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: var(--th-tracking-tight);
}

.o_thaihao_topbar_brand .o_thaihao_pwa_partner_badge {
    max-width: 100%;
    margin-left: 0;
    overflow: hidden;
    color: var(--th-on-brand-muted);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.o_thaihao_topbar_actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: var(--th-s2);
}

/* Language switch reads as one segmented control. Visible height is 34px;
   the ::before layer extends the hit area to 44px. */
.o_thaihao_lang_switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border-radius: var(--th-r-md);
    background-color: rgba(0, 0, 0, 0.24);
}

.o_thaihao_lang_link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 34px;
    padding: 0 9px;
    border-radius: 9px;
    color: var(--th-on-brand-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: background-color var(--th-dur-quick) var(--th-ease-out),
                color var(--th-dur-quick) var(--th-ease-out);
}

.o_thaihao_lang_link::before {
    position: absolute;
    inset: -5px -1px;
    content: "";
}

@media (hover: hover) {
    .o_thaihao_lang_link:not(.is-active):hover {
        background-color: rgba(255, 255, 255, 0.1);
        color: #FFFFFF;
    }
}

.o_thaihao_lang_link:active {
    background-color: rgba(255, 255, 255, 0.16);
}

.o_thaihao_lang_link.is-active {
    background-color: #FFFFFF;
    color: var(--th-surface-brand);
    box-shadow: var(--th-e1);
}

.o_thaihao_push_btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 40px;
    min-height: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: var(--th-r-md);
    background-color: rgba(0, 0, 0, 0.24);
    color: #FFFFFF;
    font-family: var(--o-thaihao-font-sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--th-dur-quick) var(--th-ease-out);
}

.o_thaihao_push_btn::before {
    position: absolute;
    inset: -2px;
    content: "";
}

@media (hover: hover) {
    .o_thaihao_push_btn:hover {
        background-color: rgba(0, 0, 0, 0.34);
    }
}

.o_thaihao_push_btn:active {
    background-color: rgba(0, 0, 0, 0.4);
}

.o_thaihao_push_btn.is-subscribed {
    background-color: rgba(255, 255, 255, 0.16);
}

/* On phones the push control is the bell alone; the label stays readable to
   screen readers and still receives the "enabled" text from JS. */
@media (max-width: 599px) {
    .o_thaihao_push_btn {
        width: 40px;
        padding: 0;
    }

    .o_thaihao_push_label {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}

/* Bottom Navigation with Authored Inline 24x24 SVG Stroke Icons */
.o_thaihao_pwa_tab {
    gap: 3px;
}

.o_thaihao_tab_icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.o_thaihao_pwa_tab_active .o_thaihao_tab_icon {
    stroke-width: 2.1;
}

/* Headings and Section Spacing (more space above heading than below) */
.o_thaihao_section_header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--th-s2);
    margin: 28px 0 12px;
}

.o_thaihao_section_header:first-child {
    margin-top: 0;
}

.o_thaihao_section_title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: var(--th-lh-heading);
    letter-spacing: var(--th-tracking-tight);
    color: var(--o-thaihao-ink);
    text-wrap: balance;
}

.o_thaihao_section_hint {
    max-width: 68ch;
    margin: 4px 0 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--o-thaihao-muted);
}

/* The page title is plain type on the canvas, not another card. */
.o_thaihao_lead_banner {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--th-s3);
    margin: 4px 0 20px;
}

.o_thaihao_lead_title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    line-height: var(--th-lh-heading);
    letter-spacing: var(--th-tracking-tight);
    text-wrap: balance;
}

.o_thaihao_lead_sub {
    max-width: 68ch;
    margin: 4px 0 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--o-thaihao-muted);
}

/* 5-Stage Cross-Border TH -> CN Pipeline. A flow grid gets chevrons between
   stages; --plain is for metric groups that are not a sequence. */
.o_thaihao_pipeline_grid {
    --th-pipe-gap: 12px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--th-pipe-gap);
    margin-bottom: 20px;
}

.o_thaihao_pipeline_step {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
    min-height: 88px;
    padding: 14px 16px;
    border: 1px solid var(--th-border-subtle);
    border-radius: var(--th-r-md);
    background-color: var(--th-surface-card);
}

.o_thaihao_pipeline_grid:not(.o_thaihao_pipeline_grid--plain) > .o_thaihao_pipeline_step:not(:last-child)::after {
    position: absolute;
    top: 50%;
    right: calc(var(--th-pipe-gap) / -2 - 4.5px);
    z-index: 1;
    width: 7px;
    height: 7px;
    margin-top: -4px;
    border-top: 2px solid var(--th-border-strong);
    border-right: 2px solid var(--th-border-strong);
    transform: rotate(45deg);
    content: "";
}

.o_thaihao_pipeline_grid--plain > .o_thaihao_pipeline_step:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

.o_thaihao_step_label {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--o-thaihao-muted);
}

.o_thaihao_step_value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: var(--th-tracking-tight);
    color: var(--o-thaihao-ink);
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

/* On phones a flow is one swipeable row, so the chevrons keep their meaning. */
@media (max-width: 767px) {
    .o_thaihao_pipeline_grid:not(.o_thaihao_pipeline_grid--plain) {
        grid-auto-flow: column;
        grid-template-columns: none;
        grid-auto-columns: minmax(136px, 44%);
        margin-right: -2px;
        margin-left: -2px;
        padding: 2px 2px 4px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }

    .o_thaihao_pipeline_grid:not(.o_thaihao_pipeline_grid--plain)::-webkit-scrollbar {
        display: none;
    }

    .o_thaihao_pipeline_grid:not(.o_thaihao_pipeline_grid--plain) > .o_thaihao_pipeline_step {
        scroll-snap-align: start;
    }
}

/* Financial Summary Strip */
.o_thaihao_kpi_strip {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.o_thaihao_kpi_tile {
    padding: 16px 18px;
    border: 1px solid var(--th-border-subtle);
    border-radius: var(--th-r-lg);
    background-color: var(--th-surface-card);
}

.o_thaihao_kpi_label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--o-thaihao-muted);
}

.o_thaihao_kpi_amount {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: var(--th-tracking-tight);
    color: var(--o-thaihao-ink);
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.o_thaihao_kpi_amount_accent {
    color: var(--o-thaihao-crimson);
}

/* Structured Data Tables & Responsive Item Rows */
.o_thaihao_table_wrap {
    margin-bottom: 20px;
    overflow-x: auto;
    border: 1px solid var(--th-border-subtle);
    border-radius: var(--th-r-lg);
    background-color: var(--th-surface-card);
}

.o_thaihao_table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.o_thaihao_table th,
.o_thaihao_table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--th-border-subtle);
    vertical-align: middle;
}

.o_thaihao_table th {
    font-size: 12px;
    font-weight: 700;
    color: var(--o-thaihao-muted);
    background-color: var(--th-surface-sunken);
    white-space: nowrap;
}

.o_thaihao_table tr:last-child td {
    border-bottom: none;
}

.o_thaihao_table .o_thaihao_col_num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

@media (hover: hover) {
    .o_thaihao_table tbody tr:hover td {
        background-color: #FAFBFC;
    }
}

.o_thaihao_cell_sub {
    margin-top: 4px;
}

.o_thaihao_cell_stack {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* Phones: each row becomes a card; td[data-label] supplies the column name. */
@media (max-width: 639px) {
    .o_thaihao_table_wrap {
        overflow: visible;
        border: 0;
        border-radius: 0;
        background-color: transparent;
    }

    .o_thaihao_table,
    .o_thaihao_table tbody {
        display: block;
    }

    .o_thaihao_table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    .o_thaihao_table tr {
        display: block;
        margin-bottom: 10px;
        padding: 4px 16px;
        border: 1px solid var(--th-border-subtle);
        border-radius: var(--th-r-lg);
        background-color: var(--th-surface-card);
    }

    .o_thaihao_table td,
    .o_thaihao_table tr:last-child td {
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        gap: 4px 12px;
        padding: 9px 0;
        border-bottom: 1px solid var(--th-border-subtle);
        text-align: right;
    }

    .o_thaihao_table tr td:last-child {
        border-bottom: 0;
    }

    .o_thaihao_table td::before {
        margin-right: auto;
        color: var(--o-thaihao-muted);
        font-size: 12px;
        font-weight: 600;
        text-align: left;
        content: attr(data-label);
    }

    .o_thaihao_table tr td:first-child {
        display: block;
        padding: 12px 0 10px;
        font-size: 15px;
        text-align: left;
    }

    .o_thaihao_table td:first-child::before {
        content: none;
    }

    .o_thaihao_table .o_thaihao_col_num {
        white-space: normal;
    }

    @media (hover: hover) {
        .o_thaihao_table tbody tr:hover td {
            background-color: transparent;
        }
    }
}

/* Marketplace, Task & Touch Slot Grids */
.o_thaihao_grid_cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 20px;
}

.o_thaihao_pkg_card,
.o_thaihao_kol_card,
.o_thaihao_task_card,
.o_thaihao_slot_card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    padding: 18px;
    border: 1px solid var(--th-border-subtle);
    border-radius: var(--th-r-lg);
    background-color: var(--th-surface-card);
}

.o_thaihao_slot_card.is-blocked {
    border-color: var(--th-risk-bd);
    background-color: #FFF9FA;
}

.o_thaihao_slot_card.is-booked {
    border-color: rgba(197, 160, 89, 0.55);
    background-color: #FCFAF4;
}

.o_thaihao_card_top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.o_thaihao_card_top > div {
    min-width: 0;
}

.o_thaihao_card_title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    line-height: var(--th-lh-heading);
    color: var(--o-thaihao-ink);
    overflow-wrap: anywhere;
}

.o_thaihao_card_title + .o_thaihao_code_chip {
    margin-top: 6px;
}

.o_thaihao_meta_list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
    line-height: 1.5;
    color: var(--o-thaihao-muted);
}

.o_thaihao_meta_list strong {
    color: var(--o-thaihao-ink);
}

.o_thaihao_code_chip {
    display: inline-block;
    max-width: 100%;
    padding: 2px 8px;
    border: 1px solid var(--th-border-subtle);
    border-radius: var(--th-r-sm);
    background-color: var(--th-surface-sunken);
    font-family: var(--o-thaihao-font-mono);
    font-size: 13px;
    line-height: 1.5;
    color: var(--o-thaihao-ink);
    overflow-wrap: anywhere;
    vertical-align: middle;
}

/* Small Control Badges (pills strictly for small badges) */
.o_thaihao_badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--th-r-pill);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    background-color: #EEF0F5;
    color: var(--o-thaihao-ink);
}

.o_thaihao_badge_crimson {
    background-color: var(--th-risk-bg);
    color: var(--th-risk-fg);
}

.o_thaihao_badge_ready {
    background-color: var(--th-ok-bg);
    color: var(--th-ok-fg);
}

.o_thaihao_badge_warn {
    background-color: var(--th-warn-bg);
    color: var(--th-warn-fg);
}

.o_thaihao_badge_gold {
    background-color: var(--th-gold-bg);
    color: var(--th-gold-ink);
}

/* Ergonomic 44-48px Touch Buttons */
.o_thaihao_btn_row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.o_thaihao_btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 48px;
    min-height: 46px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: var(--th-r-md);
    font-family: var(--o-thaihao-font-sans);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--th-dur-quick) var(--th-ease-out),
                border-color var(--th-dur-quick) var(--th-ease-out),
                color var(--th-dur-quick) var(--th-ease-out),
                transform var(--th-dur-micro) var(--th-ease-out);
}

.o_thaihao_btn:active {
    transform: scale(0.98);
}

.o_thaihao_btn:disabled,
.o_thaihao_btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.o_thaihao_btn[aria-busy="true"] {
    cursor: progress;
}

.o_thaihao_btn[aria-busy="true"]::after {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: th-spin 700ms linear infinite;
    content: "";
}

@keyframes th-spin {
    to {
        transform: rotate(360deg);
    }
}

.o_thaihao_btn_primary {
    background-color: var(--o-thaihao-crimson);
    color: #FFFFFF;
}

@media (hover: hover) {
    .o_thaihao_btn_primary:hover {
        background-color: var(--o-thaihao-crimson-deep);
    }
}

.o_thaihao_btn_primary:active {
    background-color: var(--o-thaihao-crimson-deep);
}

.o_thaihao_btn_primary.is-copied {
    background-color: var(--th-ok-fg);
}

.o_thaihao_btn_secondary {
    border-color: var(--th-border-strong);
    background-color: var(--th-surface-card);
    color: var(--o-thaihao-ink);
}

@media (hover: hover) {
    .o_thaihao_btn_secondary:hover {
        border-color: var(--o-thaihao-muted);
    }
}

.o_thaihao_btn_secondary:active {
    background-color: var(--th-surface-sunken);
}

.o_thaihao_btn_secondary.is-copied {
    border-color: var(--th-ok-bd);
    background-color: var(--th-ok-bg);
    color: var(--th-ok-fg);
}

/* Copy buttons: the PID chip inverts on the crimson fill, and the icon swaps
   to a check while the "copied" label is showing. */
.o_thaihao_btn_primary .o_thaihao_code_chip {
    border-color: rgba(255, 255, 255, 0.35);
    background-color: rgba(255, 255, 255, 0.14);
    color: #FFFFFF;
}

.o_thaihao_btn .o_thaihao_icon_done {
    display: none;
}

.o_thaihao_btn.is-copied .o_thaihao_icon_idle {
    display: none;
}

.o_thaihao_btn.is-copied .o_thaihao_icon_done {
    display: inline-block;
}

.o_thaihao_slot_form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.o_thaihao_slot_input {
    flex: 1 1 180px;
}

/* Empty State: says what is missing and, where there is one, the next step */
.o_thaihao_empty_box {
    display: grid;
    justify-items: start;
    gap: 10px;
    padding: 22px 20px;
    border: 1px dashed var(--th-border-strong);
    border-radius: var(--th-r-lg);
    background-color: transparent;
    color: var(--o-thaihao-muted);
    font-size: 14px;
    line-height: 1.6;
}

.o_thaihao_empty_box p {
    max-width: 60ch;
    margin: 0;
}

.o_thaihao_empty_icon {
    width: 28px;
    height: 28px;
    color: var(--th-border-input);
}

/* Floating AI Marketing Advisor Coach Card (position: fixed across viewports, shadow elevation only, zero border) */
.o_thaihao_pwa_body.has-ai-coach {
    padding-bottom: calc(236px + env(safe-area-inset-bottom, 0px));
}

/* JS measures the coach and reserves exactly that much room under content. */
.o_thaihao_pwa_body.has-ai-coach.is-coach-measured {
    padding-bottom: var(--th-coach-space, calc(236px + env(safe-area-inset-bottom, 0px)));
}

.o_thaihao_ai_coach {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));
    z-index: 38;
    display: grid;
    grid-template-rows: auto 1fr;
    margin: 0;
    padding: 16px 18px;
    border-radius: var(--th-r-lg);
    background-color: var(--th-surface-inverse);
    color: #FFFFFF;
    box-shadow: var(--th-e3);
    view-transition-name: th-coach;
    transition: grid-template-rows var(--th-dur-fast) var(--th-ease-out);
}

.o_thaihao_ai_coach.is-collapsed {
    grid-template-rows: auto 0fr;
}

.o_thaihao_ai_coach.is-instant,
.o_thaihao_ai_coach.is-instant * {
    transition: none !important;
}

.o_thaihao_ai_coach :focus-visible {
    outline-color: #FFFFFF;
}

.o_thaihao_ai_coach_head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.o_thaihao_ai_coach_head > .o_thaihao_btn_row {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 6px;
}

.o_thaihao_ai_coach_title {
    margin: 0;
    padding-top: 2px;
    font-size: 15px;
    font-weight: 700;
    line-height: var(--th-lh-heading);
    color: #FFFFFF;
    text-wrap: pretty;
}

.o_thaihao_ai_urgency_pill {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 3px 10px;
    border-radius: var(--th-r-pill);
    background-color: var(--o-thaihao-crimson);
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.o_thaihao_ai_toggle_btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 1px solid rgba(242, 230, 233, 0.28);
    border-radius: var(--th-r-md);
    background-color: transparent;
    color: #F2E6E9;
    cursor: pointer;
    transition: background-color var(--th-dur-quick) var(--th-ease-out);
}

.o_thaihao_ai_toggle_btn svg {
    transition: transform var(--th-dur-fast) var(--th-ease-out);
}

.o_thaihao_ai_toggle_btn[aria-expanded="false"] svg {
    transform: rotate(180deg);
}

@media (hover: hover) {
    .o_thaihao_ai_toggle_btn:hover {
        background-color: rgba(255, 255, 255, 0.08);
    }
}

/* The body collapses through a 1fr -> 0fr grid row, so the height animates
   without measuring. Visibility flips after the row closes, which keeps the
   hidden actions out of the tab order. */
.o_thaihao_ai_coach_body {
    min-height: 0;
    margin: 0;
    overflow: hidden;
    opacity: 1;
    visibility: visible;
    transition: opacity var(--th-dur-fast) var(--th-ease-out),
                visibility 0s linear 0s;
}

.o_thaihao_ai_coach.is-collapsed .o_thaihao_ai_coach_body {
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--th-dur-quick) var(--th-ease-out),
                visibility 0s linear var(--th-dur-fast);
}

.o_thaihao_ai_summary {
    max-width: 70ch;
    margin: 10px 0 12px;
    font-size: 14px;
    line-height: var(--th-lh-body);
    color: #F2E6E9;
}

.o_thaihao_ai_meta {
    margin: 0 0 14px;
    font-size: 13px;
    color: #E9DEC8;
    font-variant-numeric: tabular-nums;
}

.o_thaihao_ai_coach .o_thaihao_btn_row form {
    margin: 0;
}

.o_thaihao_ai_snooze_btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 16px;
    border: 1px solid rgba(242, 230, 233, 0.35);
    border-radius: var(--th-r-md);
    background-color: transparent;
    color: #F2E6E9;
    font-family: var(--o-thaihao-font-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--th-dur-quick) var(--th-ease-out),
                transform var(--th-dur-micro) var(--th-ease-out);
}

@media (hover: hover) {
    .o_thaihao_ai_snooze_btn:hover {
        background-color: rgba(255, 255, 255, 0.08);
    }
}

.o_thaihao_ai_snooze_btn:active {
    transform: scale(0.98);
}

@media (min-width: 768px) {
    .o_thaihao_pipeline_grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .o_thaihao_pipeline_grid--plain {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .o_thaihao_pipeline_grid--plain > .o_thaihao_pipeline_step:last-child:nth-child(odd) {
        grid-column: auto;
    }

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

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

@media (min-width: 1024px) {
    .o_thaihao_pwa_body {
        padding-bottom: 32px;
    }

    .o_thaihao_pwa_body.has-ai-coach {
        padding-bottom: 180px;
    }

    .o_thaihao_ai_coach {
        left: auto;
        right: 24px;
        bottom: 24px;
        max-width: 380px;
    }

    .o_thaihao_pwa_tab {
        flex-direction: row;
        gap: 8px;
        padding: 6px 14px;
        font-size: 13px;
    }

    /* Desktop: the brand bar scrolls away and the tab row stays pinned. */
    .o_thaihao_has_tabs .o_thaihao_pwa_topbar {
        position: relative;
        animation: none;
    }

    .o_thaihao_has_tabs .o_thaihao_pwa_bottom_nav {
        position: sticky;
        top: 0;
        z-index: 45;
    }
}

@media (prefers-reduced-motion: reduce) {
    .o_thaihao_btn,
    .o_thaihao_ai_coach,
    .o_thaihao_ai_coach_body,
    .o_thaihao_ai_toggle_btn svg {
        transition: none;
    }

    .o_thaihao_btn[aria-busy="true"]::after {
        animation: none;
    }
}
