/* MADO AI GENERATION HISTORY PAGE CSS SSOT 2026-08-20
 * Provider only: public/css/ai-generation-history-page.css
 * Markup source: includes/portal/ai-generation-history-page.php
 * Visual direction follows 利用履歴, but no chat-log CSS selectors are reused or duplicated.
 * 2026-08-21: 日付選択後の一覧移動は利用履歴と同じsmooth scroll。カードは生成本文＋必要なQ&A ID/参照URLだけに簡素化。
 * 2026-08-20: AI生成履歴の可読性を優先して既存文字を原則+2px。参照・生成情報見出しだけ+1px、
 * evidence label/valueは大きくした分だけweightを1段階落とす。
 * 2026-08-21: カレンダー日付は14pxへ調整し、日付セル全体のselected色は廃止。選択状態はAI返信案/AIブラッシュのsource chipだけで示す。
 * 2026-08-21: リード文を15pxへ調整。todayは利用履歴のsource-split表示と同じ淡い内枠に寄せる。
 * 2026-08-24: desktop calendarの固定min-widthを撤去してpanel幅へ自然に収め、狭幅時だけ横scrollへ戻す。
 * カレンダー本体は利用履歴の通常表示と同じ80px/78pxセル基準へ統一し、検索カード文字は各1px縮小する。
 * 2026-08-24: 種別filterは生成履歴一覧専用としてlist header直下へ移動。内部保存先表示は撤去し、表示件数はlist headerへ統合。
 * カレンダー見出しは19px/700。検索見出し「生成履歴を探す」は17px/600へ調整し、
 * 利用履歴「シナリオ到達・解決状況」と同じ見出し密度にする。
 * 生成履歴cardはheader/bodyの縦paddingを縮小。本文未記録行だけ内枠を外してさらに圧縮する。
 * 2026-08-24: 一覧は20件/pageのまま、初期1行preview→本文クリックで開閉する。右端の全文/閉じるボタンは廃止。
 * 2026-08-24 16:30: 承認モックへ寄せ、開閉矢印をheader左端へ移動。headerは#f6fbfe前後の一続きの淡い面とし、
 * 生成種別/日時/チケット/担当者/対象チケットの区切りは18pxの短いseparatorだけにする。セル全面の縦罫線・濃い水色セルは使わない。
 * 折りたたみ時は1行preview、展開時はpreview帯を隠して生成本文全体を直下表示する。theme button色の混入を避けるためtoggleはbutton要素にしない。
 * AI水色はページ内の共通変数を使い、Q&A footerは薄緑（#eef9ed / #a7d9a3 / #3aae39）で区別する。現行数値は17:28契約を正本とする。
 * 参照URLは利用履歴と同じ薄水色へ寄せ、Q&A/URLとも内側cardは作らずfooter帯として1行配置する。
 * 2026-08-24 16:48: 上段見出しのweightを各100下げ、一覧見出し「生成履歴」は検索見出しと同じ17pxへ統一する。
 * 一覧filterはpill/chipを廃止し、短い縦区切り線で連なるsegmented text navigationへ変更する。AI返信案=淡い水色、AIブラッシュ=淡い緑。
 * filterの選択stateは既存selectedTypeだけを使い、DB/REST/URL stateは増やさない。画面末尾にはpaginationが隠れないよう下余白を確保する。
 * 2026-08-24 17:05: 16:48版を正本に継続し、旧pill/tabへ戻さない。今回の変更は色とカレンダー件数寸法だけ。
 * 2026-08-24 18:22: AI系の水色は参照Q&A IDリンク/POP設定で使うMADO共通brand accentを正本とする。
 * 基本面=--mado-brand-accent-soft(#e6fbf9)、枠=--mado-brand-accent-border(#b9eeea)、文字=--mado-brand-accent-text(#129f9e)。
 * カレンダー・参照URLは基本面をそのまま使い、生成履歴header帯だけ同系色を白へ寄せた#f3fdfcを使う。別系統の青は増やさない。
 * AIブラッシュは既存緑paletteを維持し、履歴headerも緑背景へ切り替える。件数chip文字は600へ統一する。
 * 一覧headerのAI返信案/AIブラッシュはchipを廃止して帯へなじませ、header面・対象チケットリンク・reply_draft選択面はAI生成履歴の共通水色変数へ揃える。
 * AI生成履歴のカレンダー件数は利用履歴通常表示と同寸法へ揃え、利用履歴側の数字だけ1px拡大した13pxを正本とする。
 * ページ冒頭lead撤去後の未使用selectorは残さない。
 */

body.mado-portal-account-page .mado-portal-shell--action-ai-generation-history .mado-portal-shell__content-frame.is-standard,
.mado-portal-shell--action-ai-generation-history .mado-portal-shell__content-frame.is-standard {
    box-sizing: border-box;
    width: 100%;
    max-width: calc(1140px + var(--mado-portal-page-gutter-x, clamp(18px, 2.4vw, 32px)) * 2);
    margin-inline: auto;
    padding-inline: var(--mado-portal-page-gutter-x, clamp(18px, 2.4vw, 32px));
}

.mado-ai-gen-history-page {
    width: 100%;
    max-width: 1140px;
    min-width: 0;
    margin-inline: auto;
    padding-bottom: clamp(84px, 9vh, 120px);
    box-sizing: border-box;
    --mado-ai-gen-blue-border: var(--mado-brand-accent-border, #b9eeea);
    --mado-ai-gen-blue-background: var(--mado-brand-accent-soft, #e6fbf9);
    --mado-ai-gen-blue-text: var(--mado-brand-accent-text, #129f9e);
    --mado-ai-gen-blue-hover-border: var(--mado-brand-accent, #06bfb5);
    --mado-ai-gen-blue-hover-background: #d8f7f4;
    --mado-ai-gen-blue-selected-background: #d8f7f4;
    --mado-ai-gen-blue-selected-text: var(--mado-brand-accent-text, #129f9e);
    --mado-ai-gen-blue-header-background: #f3fdfc;
    --mado-ai-gen-green-border: #a7d9a3;
    --mado-ai-gen-green-background: #eef9ed;
    --mado-ai-gen-green-text: #3aae39;
    color: #0f172a;
}

.mado-ai-gen-history-page__heading { margin: 0 0 12px; }
.mado-ai-gen-history-tabs {
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 0;
    margin: 0;
    padding: 0 22px;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
}
.mado-ai-gen-history-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    padding: 8px 16px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #334155;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: none;
}
.mado-ai-gen-history-tab + .mado-ai-gen-history-tab {
    margin-left: 2px;
    padding-left: 18px;
}
.mado-ai-gen-history-tab + .mado-ai-gen-history-tab::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 1px;
    height: 18px;
    transform: translateY(-50%);
    background: #cbdde6;
}
.mado-ai-gen-history-tab[data-history-type="reply_draft"] {
    color: var(--mado-ai-gen-blue-text);
}
.mado-ai-gen-history-tab[data-history-type="reply_polish"] {
    color: #2f8f2f;
}
.mado-ai-gen-history-tab__icon {
    display: block;
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    fill: currentColor;
}
.mado-ai-gen-history-tab__label {
    display: inline-block;
    line-height: 1.2;
}
.mado-ai-gen-history-tab:hover,
.mado-ai-gen-history-tab:focus-visible {
    background: #f8fbfd;
    color: #0f172a;
    outline: none;
}
.mado-ai-gen-history-tab[data-history-type="reply_draft"]:hover,
.mado-ai-gen-history-tab[data-history-type="reply_draft"]:focus-visible {
    background: var(--mado-ai-gen-blue-background);
    color: var(--mado-ai-gen-blue-text);
}
.mado-ai-gen-history-tab[data-history-type="reply_polish"]:hover,
.mado-ai-gen-history-tab[data-history-type="reply_polish"]:focus-visible {
    background: var(--mado-ai-gen-green-background);
    color: var(--mado-ai-gen-green-text);
}
.mado-ai-gen-history-tab.is-active {
    background: #f8fbfd;
    color: #0f172a;
    box-shadow: inset 0 -2px 0 #64748b;
}
.mado-ai-gen-history-tab.is-active[data-history-type="reply_draft"] {
    background: var(--mado-ai-gen-blue-background);
    color: var(--mado-ai-gen-blue-text);
    box-shadow: inset 0 -2px 0 var(--mado-ai-gen-blue-border);
}
.mado-ai-gen-history-tab.is-active[data-history-type="reply_polish"] {
    background: var(--mado-ai-gen-green-background);
    color: var(--mado-ai-gen-green-text);
    box-shadow: inset 0 -2px 0 var(--mado-ai-gen-green-border);
}

.mado-ai-gen-history-panel,
.mado-ai-gen-history-search-card,
.mado-ai-gen-history-list-panel {
    background: #fff;
    border: 1px solid #dbe4ee;
    border-radius: 16px;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.05);
}

.mado-ai-gen-history-top-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
    gap: 18px;
    align-items: start;
    margin-bottom: 18px;
}
.mado-ai-gen-history-panel { padding: 16px; }
.mado-ai-gen-history-panel__header { margin-bottom: 12px; }
.mado-ai-gen-history-panel__title,
.mado-ai-gen-history-search-card h2,
.mado-ai-gen-history-list-panel__header h2 {
    margin: 0;
    line-height: 1.35;
    color: #0f172a;
}

.mado-ai-gen-history-panel__title {
    font-size: 19px;
    font-weight: 600;
}

.mado-ai-gen-history-search-card h2 {
    font-size: 17px;
    font-weight: 500;
}

.mado-ai-gen-history-list-panel__header h2 {
    font-size: 17px;
    font-weight: 700;
}

.mado-ai-gen-history-calendar__toolbar {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    align-items: center;
    gap: 14px;
    margin-bottom: 9px;
    text-align: center;
}
.mado-ai-gen-history-calendar__toolbar strong {
    color: #0f172a;
    font-size: 19px;
    font-weight: 500;
}
.mado-ai-gen-history-calendar__nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0 auto;
    padding: 0;
    border: 1.5px solid #075985;
    border-radius: 50%;
    background: #f0fbff;
    color: #075985;
    text-decoration: none;
    font-size: 22px;
    line-height: 1;
    box-shadow: none;
    transition: transform 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}
.mado-ai-gen-history-calendar__nav:hover,
.mado-ai-gen-history-calendar__nav:focus-visible {
    background: #dff3fb;
    color: #00688f;
    outline: none;
}
.mado-ai-gen-history-calendar__nav:active { transform: scale(0.95); }
.mado-ai-gen-history-calendar-wrap {
    width: 100%;
    min-width: 0;
    overflow-x: visible;
}
.mado-ai-gen-history-calendar {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    border-collapse: collapse;
}
.mado-ai-gen-history-calendar th {
    padding: 8px 6px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    text-align: center;
    color: #475569;
    font-size: 14px;
    font-weight: 700;
}
.mado-ai-gen-history-calendar th.is-sun { color: #dc2626; }
.mado-ai-gen-history-calendar th.is-sat { color: #2563eb; }
.mado-ai-gen-history-calendar__cell,
.mado-ai-gen-history-calendar td.is-blank {
    height: 80px;
    padding: 3px;
    border: 1px solid #e2e8f0;
    vertical-align: top;
    background: #ffffff;
}
.mado-ai-gen-history-calendar td.is-blank { background: #ffffff; }
.mado-ai-gen-history-calendar__day {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 5px;
    width: 100%;
    min-height: 78px;
    box-sizing: border-box;
    padding: 6px 7px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: #ffffff;
    color: #0f172a;
    text-align: center;
    transition: border-color 0.16s ease, background-color 0.16s ease;
}
.mado-ai-gen-history-calendar__day.has-logs {
    background: var(--mado-ai-gen-blue-background);
}
.mado-ai-gen-history-calendar__day.is-empty {
    color: #94a3b8;
}
.mado-ai-gen-history-calendar__day.is-today {
    border-color: transparent;
    background: var(--mado-ai-gen-blue-background);
    box-shadow: inset 0 0 0 1px var(--mado-ai-gen-blue-border);
}
.mado-ai-gen-history-calendar__day.is-future { background: #f8fafc; }
.mado-ai-gen-history-calendar__day.is-future .mado-ai-gen-history-calendar__number,
.mado-ai-gen-history-calendar__day.is-future .mado-ai-gen-history-calendar__source-count {
    color: #94a3b8;
    opacity: 0.4;
}
.mado-ai-gen-history-calendar__number {
    align-self: center;
    color: #64748b;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}
.mado-ai-gen-history-calendar__source-counts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    width: 100%;
}
.mado-ai-gen-history-calendar__source-count {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    min-height: 26px;
    box-sizing: border-box;
    padding: 4px 6px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--mado-ai-gen-blue-background);
    color: var(--mado-ai-gen-blue-text);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}
.mado-ai-gen-history-calendar__source-count.is-draft {
    background: var(--mado-ai-gen-blue-background);
    color: var(--mado-ai-gen-blue-text);
}
.mado-ai-gen-history-calendar__source-count.is-polish {
    background: #f1fbf1;
    color: #3aae39;
}
.mado-ai-gen-history-calendar__source-count:hover,
.mado-ai-gen-history-calendar__source-count:focus-visible {
    border-color: var(--mado-ai-gen-blue-hover-border);
    background: var(--mado-ai-gen-blue-hover-background);
    outline: none;
}
.mado-ai-gen-history-calendar__source-count.is-polish:hover,
.mado-ai-gen-history-calendar__source-count.is-polish:focus-visible {
    border-color: #a7d9a3;
    background: #eef9ed;
}
.mado-ai-gen-history-calendar__source-count:active { transform: translateY(1px); }
.mado-ai-gen-history-calendar__source-count.is-draft.is-selected {
    border-color: var(--mado-ai-gen-blue-border);
    background: var(--mado-ai-gen-blue-selected-background);
    color: var(--mado-ai-gen-blue-selected-text);
    box-shadow: inset 0 0 0 1px rgba(6, 191, 181, 0.10);
}
.mado-ai-gen-history-calendar__source-count.is-polish.is-selected {
    border-color: #3aae39;
    background: #e6f7e5;
    color: #2f8f2f;
    box-shadow: inset 0 0 0 1px rgba(58, 174, 57, 0.12);
}
.mado-ai-gen-history-calendar__day.is-future .mado-ai-gen-history-calendar__source-count:hover,
.mado-ai-gen-history-calendar__day.is-future .mado-ai-gen-history-calendar__source-count:focus-visible {
    border-color: #cbd5e1;
    background: #f1f5f9;
}
.mado-ai-gen-history-calendar__source-icon {
    display: block;
    flex: 0 0 auto;
    width: 12px;
    height: 12px;
    color: currentColor;
}
.mado-ai-gen-history-calendar__source-count-value {
    color: currentColor;
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
}
.mado-ai-gen-history-calendar__selection {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    color: #64748b;
    font-size: 14px;
}
.mado-ai-gen-history-calendar__selection a { color: #0369a1; font-weight: 700; }

.mado-ai-gen-history-summary__scope {
    margin: 0 0 16px;
    color: #64748b;
    font-size: 14px;
}
.mado-ai-gen-history-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.mado-ai-gen-history-summary-grid article {
    padding: 14px;
    border: 1px solid #dbe4ee;
    border-radius: 13px;
    background: #f8fafc;
}
.mado-ai-gen-history-summary-grid article.is-wide { grid-column: 1 / -1; }
.mado-ai-gen-history-summary-grid span {
    display: block;
    margin-bottom: 4px;
    color: #334155;
    font-size: 14px;
    font-weight: 700;
}
.mado-ai-gen-history-summary-grid strong { font-size: 22px; }
.mado-ai-gen-history-summary__note {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e2e8f0;
}
.mado-ai-gen-history-summary__note strong { font-size: 15px; }
.mado-ai-gen-history-summary__note p {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 14px;
    line-height: 1.7;
}

.mado-ai-gen-history-search-card {
    padding: 22px 24px;
    margin-bottom: 18px;
}
.mado-ai-gen-history-search-card p {
    margin: 7px 0 0;
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
}
.mado-ai-gen-history-search-form { margin-top: 16px; }
.mado-ai-gen-history-search-form label {
    display: block;
    margin-bottom: 7px;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}
.mado-ai-gen-history-search-form__controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
}
.mado-ai-gen-history-search-form input[type="search"] {
    width: 100%;
    min-height: 42px;
    box-sizing: border-box;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: #0f172a;
    font-size: 14px;
}
.mado-ai-gen-history-search-form input[type="search"]::placeholder {
    font-size: 14px;
}
.mado-ai-gen-history-search-form button,
.mado-ai-gen-history-search-form__controls > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    box-sizing: border-box;
    padding: 8px 15px;
    border: 1px solid #111827;
    border-radius: 999px;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}
.mado-ai-gen-history-search-form button { background: #111827; color: #fff; }
.mado-ai-gen-history-search-form__controls > a { background: #fff; color: #111827; }

.mado-ai-gen-history-list-panel {
    padding: 0;
    overflow: hidden;
    scroll-margin-top: 24px;
}
.mado-ai-gen-history-list-panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px 14px;
}
.mado-ai-gen-history-list-panel__header p {
    margin: 5px 0 0;
    color: #64748b;
    font-size: 14px;
}
.mado-ai-gen-history-list-panel__visible-count {
    display: inline-flex;
    align-items: baseline;
    gap: 7px;
    flex: 0 0 auto;
    color: #64748b;
    font-size: 12px;
    line-height: 1.3;
}
.mado-ai-gen-history-list-panel__visible-count strong {
    color: #0f172a;
    font-size: 14px;
    font-weight: 700;
}
.mado-ai-gen-history-records { padding: 16px; }
.mado-ai-gen-history-record {
    border: 1px solid #dbe4ee;
    border-radius: 12px;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.035);
}
.mado-ai-gen-history-record + .mado-ai-gen-history-record { margin-top: 24px; }
.mado-ai-gen-history-record__header {
    display: flex;
    align-items: center;
    min-height: 54px;
    gap: 0;
    padding: 0 20px;
    border-bottom: 1px solid #dbe4ee;
    background: var(--mado-ai-gen-blue-header-background);
}
.mado-ai-gen-history-record.is-polish .mado-ai-gen-history-record__header {
    background: var(--mado-ai-gen-green-background);
}
.mado-ai-gen-history-record.is-polish .mado-ai-gen-history-record__disclosure,
.mado-ai-gen-history-record.is-polish .mado-ai-gen-history-record__ticket-link {
    color: var(--mado-ai-gen-green-text);
}
.mado-ai-gen-history-record.is-polish .mado-ai-gen-history-record__disclosure:hover,
.mado-ai-gen-history-record.is-polish .mado-ai-gen-history-record__disclosure:focus-visible {
    background: rgba(167, 217, 163, 0.22);
}
.mado-ai-gen-history-record__disclosure {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 24px;
    width: 24px;
    height: 36px;
    margin-right: 10px;
    color: #075985;
    cursor: pointer;
    border-radius: 8px;
    outline: none;
}
.mado-ai-gen-history-record__disclosure:hover,
.mado-ai-gen-history-record__disclosure:focus-visible {
    background: rgba(138, 216, 225, 0.20);
}
.mado-ai-gen-history-record__disclosure:focus-visible {
    box-shadow: inset 0 0 0 2px rgba(11, 104, 112, 0.12);
}
.mado-ai-gen-history-record__disclosure-icon {
    display: block;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    transform-origin: 50% 50%;
    transition: transform 0.16s ease;
}
.mado-ai-gen-history-record.is-expanded .mado-ai-gen-history-record__disclosure-icon {
    transform: rotate(225deg);
}
.mado-ai-gen-history-record__identity {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    min-width: 0;
    color: #334155;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
}
.mado-ai-gen-history-record__identity > * {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    box-sizing: border-box;
    white-space: nowrap;
}
.mado-ai-gen-history-record__identity > * + * {
    margin-left: 18px;
    padding-left: 18px;
}
.mado-ai-gen-history-record__identity > * + *::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 1px;
    height: 18px;
    transform: translateY(-50%);
    background: #b8c6d2;
}
.mado-ai-gen-history-record__badge {
    min-height: 28px;
    padding: 4px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--mado-ai-gen-blue-text);
    font-size: 13px;
    font-weight: 500;
}
.mado-ai-gen-history-record.is-polish .mado-ai-gen-history-record__badge {
    border: 0;
    background: transparent;
    color: var(--mado-ai-gen-green-text);
}
.mado-ai-gen-history-record__date,
.mado-ai-gen-history-record__ticket,
.mado-ai-gen-history-record__actor {
    color: #334155;
    font-size: 13px;
    font-weight: 500;
}
.mado-ai-gen-history-record__header-actions {
    position: relative;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    margin-left: 18px;
    padding-left: 18px;
}
.mado-ai-gen-history-record__header-actions::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 1px;
    height: 18px;
    transform: translateY(-50%);
    background: #b8c6d2;
}
.mado-ai-gen-history-record__ticket-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 4px 0;
    background: transparent;
    color: var(--mado-ai-gen-blue-text);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    text-decoration: none;
}
.mado-ai-gen-history-record__ticket-link::after {
    content: "↗";
    font-size: 13px;
    line-height: 1;
}
.mado-ai-gen-history-record__ticket-link:hover,
.mado-ai-gen-history-record__ticket-link:focus-visible {
    background: transparent;
    color: var(--mado-ai-gen-blue-text);
    text-decoration: underline;
    outline: none;
}
.mado-ai-gen-history-record__preview {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 14px 24px 15px 58px;
    border: 0;
    background: #ffffff;
    color: #1e293b;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.6;
    text-align: left;
    cursor: pointer;
    outline: none;
}
.mado-ai-gen-history-record__preview:hover {
    background: #fbfdfe;
}
.mado-ai-gen-history-record__preview:focus-visible {
    box-shadow: inset 0 0 0 2px rgba(11, 104, 112, 0.10);
}
.mado-ai-gen-history-record__preview-text {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mado-ai-gen-history-record.is-expanded .mado-ai-gen-history-record__preview {
    display: none;
}
.mado-ai-gen-history-record__body {
    display: none;
    padding: 20px 24px 14px;
    background: #ffffff;
}
.mado-ai-gen-history-record.is-expanded .mado-ai-gen-history-record__body {
    display: block;
}
.mado-ai-gen-history-record__body-toggle {
    display: block;
    cursor: pointer;
    outline: none;
    border-radius: 6px;
}
.mado-ai-gen-history-record__body-toggle:hover {
    background: #fbfdfe;
}
.mado-ai-gen-history-record__body-toggle:focus-visible {
    box-shadow: 0 0 0 2px rgba(11, 104, 112, 0.10);
}
.mado-ai-gen-history-record__text-block + .mado-ai-gen-history-record__text-block { margin-top: 12px; }
.mado-ai-gen-history-record__text {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #1e293b;
    font-size: 14px;
    line-height: 1.75;
    overflow-wrap: anywhere;
}
.mado-ai-gen-history-record__text-block.is-result.is-empty .mado-ai-gen-history-record__text {
    color: #64748b;
    font-style: italic;
}
.mado-ai-gen-history-record.is-empty-record .mado-ai-gen-history-record__body {
    padding-top: 8px;
    padding-bottom: 8px;
}
.mado-ai-gen-history-references {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    margin: 14px -14px -12px;
    border-top: 1px solid #d7e1e9;
}
.mado-ai-gen-history-reference {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: 38px;
    padding: 8px 14px;
    border: 0;
    border-radius: 0;
    box-sizing: border-box;
}
.mado-ai-gen-history-reference + .mado-ai-gen-history-reference {
    border-top: 1px solid rgba(148, 163, 184, 0.22);
}
.mado-ai-gen-history-reference--qa {
    background: var(--mado-ai-gen-green-background);
}
.mado-ai-gen-history-reference--url {
    background: var(--mado-ai-gen-blue-background);
}
.mado-ai-gen-history-reference__label {
    flex: 0 0 auto;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.mado-ai-gen-history-reference--qa .mado-ai-gen-history-reference__label,
.mado-ai-gen-history-reference--qa .mado-ai-gen-history-reference__values a,
.mado-ai-gen-history-reference--qa .mado-ai-gen-history-reference__values strong {
    color: #2f7f31;
}
.mado-ai-gen-history-reference--url .mado-ai-gen-history-reference__label,
.mado-ai-gen-history-reference--url .mado-ai-gen-history-reference__values a,
.mado-ai-gen-history-reference--url .mado-ai-gen-history-reference__values strong {
    color: var(--mado-ai-gen-blue-text);
}
.mado-ai-gen-history-reference__values {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 9px;
    min-width: 0;
}
.mado-ai-gen-history-reference__values a,
.mado-ai-gen-history-reference__values strong {
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
.mado-ai-gen-history-reference__qa {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}
.mado-ai-gen-history-reference__qa-id {
    flex: 0 0 auto;
    white-space: nowrap;
}
.mado-ai-gen-history-reference__qa-title {
    min-width: 0;
}
.mado-ai-gen-history-reference__values a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.mado-ai-gen-history-empty {
    margin: 16px;
    padding: 22px;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    text-align: center;
}
.mado-ai-gen-history-empty strong { display: block; margin-bottom: 6px; }
.mado-ai-gen-history-empty p { margin: 0; color: #64748b; font-size: 14px; line-height: 1.7; }
.mado-ai-gen-history-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    padding: 0 16px 18px;
}
.mado-ai-gen-history-pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding-inline: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    background: #fff;
    color: #334155;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
}
.mado-ai-gen-history-pagination a.is-active { background: #0f172a; border-color: #0f172a; color: #fff; }

@media (max-width: 900px) {
    .mado-ai-gen-history-top-grid { grid-template-columns: 1fr; }
}

@media (max-width: 782px) {
    body.mado-portal-account-page .mado-portal-shell--action-ai-generation-history .mado-portal-shell__content-frame.is-standard,
    .mado-portal-shell--action-ai-generation-history .mado-portal-shell__content-frame.is-standard {
        padding-inline: var(--mado-portal-page-gutter-x-mobile, 16px);
    }
    .mado-ai-gen-history-page {
        padding-bottom: 72px;
    }
}

@media (max-width: 640px) {
    .mado-ai-gen-history-calendar__number { font-size: 13px; }
    .mado-ai-gen-history-panel,
    .mado-ai-gen-history-search-card { padding: 16px; }
    .mado-ai-gen-history-search-form__controls { grid-template-columns: 1fr 1fr; }
    .mado-ai-gen-history-search-form__controls input[type="search"] { grid-column: 1 / -1; }
    .mado-ai-gen-history-record__header { flex-wrap: wrap; padding: 6px 12px; }
    .mado-ai-gen-history-record__disclosure { margin-right: 6px; }
    .mado-ai-gen-history-record__identity { flex: 1 1 calc(100% - 40px); flex-wrap: wrap; row-gap: 2px; }
    .mado-ai-gen-history-record__identity > * { min-height: 34px; }
    .mado-ai-gen-history-record__identity > * + * { margin-left: 10px; padding-left: 10px; }
    .mado-ai-gen-history-record__header-actions { width: 100%; margin-left: 40px; padding-left: 0; }
    .mado-ai-gen-history-record__header-actions::before { content: none; }
    .mado-ai-gen-history-record__ticket-link { min-height: 34px; justify-content: flex-start; }
    .mado-ai-gen-history-record__preview { padding: 12px 14px 13px 52px; }
    .mado-ai-gen-history-record__body { padding: 14px 14px 10px; }
    .mado-ai-gen-history-record.is-empty-record .mado-ai-gen-history-record__body { padding-block: 8px; }
    .mado-ai-gen-history-references { margin: 14px -12px -10px; }
    .mado-ai-gen-history-reference { align-items: flex-start; padding-inline: 12px; }
}


@media (max-width: 760px) {
    .mado-ai-gen-history-calendar-wrap {
        overflow-x: auto;
    }
    .mado-ai-gen-history-calendar {
        min-width: 570px;
    }
    .mado-ai-gen-history-calendar__cell,
    .mado-ai-gen-history-calendar td.is-blank { height: 72px; }
    .mado-ai-gen-history-calendar__day {
        min-height: 70px;
        gap: 4px;
        padding: 5px 4px;
    }
    .mado-ai-gen-history-calendar__source-count {
        gap: 4px;
        min-height: 23px;
        padding: 3px 4px;
        font-size: 12px;
    }
    .mado-ai-gen-history-calendar__source-icon {
        width: 11px;
        height: 11px;
    }
    .mado-ai-gen-history-calendar__source-count-value { font-size: 13px; }
}

/* Q&A reference compact title / 2026-08-21
 * Keep the canonical question title out of history storage; render the one-time resolved title
 * inside the existing Q&A column and clip naturally before the URL column.
 */
.mado-ai-gen-history-reference__values .mado-ai-gen-history-reference__qa {
    display: flex;
    align-items: baseline;
    gap: 7px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}
.mado-ai-gen-history-reference__qa-id {
    flex: 0 0 auto;
}
.mado-ai-gen-history-reference__qa-title {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    color: inherit;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}
