/* Round X, X.2 (11-Nov-2026): the website assistant's widget; light and dark from the visitor's own setting (the layout
   has no dark mode of its own, so the widget carries its tokens).
   Round 3 item 4 (David, 14-Nov-2026): "a round button on the right edge, halfway down the screen ... Fixed while the
   page scrolls. Open panel: full screen height on the right. Desktop width about 400 px, with the page beside it still
   usable. On phones it opens full screen with a clear X. Contrasting colours: TRAC blue as the base, with a warm amber
   or orange accent for the chat head, the send button and 'Open my booking form'. Every text and background pair passes
   WCAG AA." Every pair is measured in real Chrome, light and dark, at 1280 and 390 px, by test_assistant_layout_14nov
   (the head, the title bar, the close, Send, a reply, "Open my booking form", the box): all at 4.5:1 or more. */
.tga {
    --tga-bg: #ffffff; --tga-fg: #1f2937; --tga-muted: #4b5563; --tga-line: #d1d5db;
    --tga-me: #e8f0fe; --tga-bot: #f3f4f6; --tga-card: #f8fafc;
    --tga-base: #2c5f7c; --tga-base-fg: #ffffff;           /* TRAC blue: the head of the panel, buttons */
    --tga-accent: #f59e0b; --tga-accent-fg: #1f2937;       /* amber: the chat head, Send, Open my booking form */
    --tga-ring: #b45309;
    position: fixed; right: 0; top: 50%; transform: translateY(-50%); z-index: 1090; font-family: inherit; font-size: 15px;
}
@media (prefers-color-scheme: dark) {
    .tga {
        --tga-bg: #1f2430; --tga-fg: #e5e7eb; --tga-muted: #c3c8d0; --tga-line: #374151;
        --tga-me: #1e3a5f; --tga-bot: #2b3241; --tga-card: #262c3a;
        --tga-base: #1e3a5f; --tga-base-fg: #ffffff; --tga-accent: #fbbf24; --tga-accent-fg: #111827; --tga-ring: #fbbf24;
    }
}
/* The chat head: round, amber, on the right edge halfway down. */
.tga-bubble {
    display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; margin-right: 10px;
    border: 2px solid var(--tga-base); border-radius: 50%; padding: 0;
    background: var(--tga-accent); color: var(--tga-accent-fg); box-shadow: 0 4px 14px rgba(0,0,0,.25); cursor: pointer;
    font-size: 1.45rem;
}
.tga-bubble-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tga-bubble:focus-visible, .tga-close:focus-visible, .tga-btn:focus-visible, .tga-send:focus-visible,
.tga-input:focus-visible, .tga-field:focus-visible, .tga-mic:focus-visible, .tga-speak:focus-visible {
    outline: 3px solid var(--tga-ring); outline-offset: 2px; }
.tga-open { top: 0; bottom: 0; transform: none; }
.tga-open .tga-bubble { display: none; }
/* The open panel: the whole screen's height on the right, 400 px wide; the page beside it stays usable (no backdrop). */
.tga-panel {
    width: 400px; max-width: 100vw; height: 100vh; height: 100dvh;
    display: flex; flex-direction: column; background: var(--tga-bg); color: var(--tga-fg);
    border-left: 1px solid var(--tga-line); box-shadow: -8px 0 30px rgba(0,0,0,.22); overflow: hidden;
}
.tga-panel[hidden] { display: none; }
.tga-head { display: flex; align-items: center; gap: .4rem; padding: .6rem .8rem; background: var(--tga-base);
            color: var(--tga-base-fg); }
.tga-title { font-size: 1rem; margin: 0; font-weight: 700; color: var(--tga-base-fg); flex: 1; }
/* 12-Nov-2026, his wording: a small "AI" label beside the title, always visible. */
.tga-ai { display: inline-block; margin-left: .35rem; padding: 0 .35rem; border: 1px solid currentColor; border-radius: 4px;
          font-size: .7rem; font-weight: 700; line-height: 1.4; vertical-align: middle; white-space: nowrap; }
.tga-close { border: 0; background: transparent; color: var(--tga-base-fg); font-size: 1.8rem; line-height: 1; cursor: pointer;
             width: 44px; height: 44px; padding: 0; }
.tga-speak { border: 1px solid var(--tga-base-fg); background: transparent; color: var(--tga-base-fg); border-radius: 8px;
             width: 38px; height: 34px; cursor: pointer; opacity: .85; }
.tga-speak[aria-pressed="true"] { background: var(--tga-accent); color: var(--tga-accent-fg); border-color: var(--tga-accent); opacity: 1; }
.tga-log { flex: 1; overflow-y: auto; padding: .8rem; display: flex; flex-direction: column; gap: .5rem; }
.tga-msg { padding: .5rem .7rem; border-radius: 12px; max-width: 88%; white-space: pre-wrap; overflow-wrap: anywhere;
           line-height: 1.35; }
.tga-me { align-self: flex-end; background: var(--tga-me); }
.tga-bot { align-self: flex-start; background: var(--tga-bot); white-space: normal; }
/* Round 4 item 7: the reply's own lists and bold (built from text nodes in assistant_widget.js) */
.tga-bot .tga-list { margin: .3rem 0 .3rem 1.1rem; padding: 0; }
.tga-bot .tga-list li { margin: .1rem 0; }
.tga-bot strong { font-weight: 700; }
.tga-wait { color: var(--tga-muted); font-style: italic; }
.tga-card { border: 1px solid var(--tga-line); background: var(--tga-card); border-radius: 10px; padding: .6rem .7rem; }
.tga-card-title { font-weight: 700; margin-bottom: .3rem; }
.tga-card-leg { display: grid; grid-template-columns: 1fr auto; gap: 0 .5rem; padding: .3rem 0;
                border-top: 1px dashed var(--tga-line); }
.tga-card-leg:first-of-type { border-top: 0; }
.tga-card-route { font-weight: 600; overflow-wrap: anywhere; }
.tga-card-when { grid-column: 1; color: var(--tga-muted); font-size: .9em; }
.tga-card-price { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-weight: 700; }
.tga-card-total { display: flex; justify-content: space-between; border-top: 1px solid var(--tga-line); margin-top: .3rem;
                  padding-top: .3rem; }
.tga-card-login { margin-top: 6px; font-weight: 600; color: var(--tga-fg); font-size: 0.85rem; }
.tga-card-note { color: var(--tga-muted); font-size: .85em; margin-top: .3rem; }
.tga-contact, .tga-auth { display: flex; flex-direction: column; gap: .4rem; }
.tga-field, .tga-input { width: 100%; border: 1px solid var(--tga-line); border-radius: 8px; padding: .45rem .55rem;
                         background: var(--tga-bg); color: var(--tga-fg); font: inherit; }
.tga-btn { display: inline-block; text-align: center; border: 0; border-radius: 8px; padding: .5rem .8rem; cursor: pointer;
           background: var(--tga-base); color: var(--tga-base-fg); text-decoration: none; font-weight: 600; }
.tga-btn:hover { filter: brightness(1.08); color: var(--tga-base-fg); }
/* "Open my booking form": the amber accent. */
.tga-review, .tga-review:hover { background: var(--tga-accent); color: var(--tga-accent-fg); }
.tga-small { padding: .3rem .6rem; font-size: .88em; }
.tga-offer { display: flex; flex-wrap: wrap; gap: .35rem; }
.tga-google { background: var(--tga-bg); color: var(--tga-fg); border: 1px solid var(--tga-line); }
.tga-google:hover { color: var(--tga-fg); }
.tga-trap { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.tga-wa { background: #25d366; color: #0b1020; }
.tga-wa:hover { color: #0b1020; }
/* 13-Nov-2026 (David's first staging test): "Call David now" first and unmistakable for urgent travel (item 7). */
.tga-call { background: #b91c1c; color: #fff; font-weight: 700; font-size: 1.05em; }
.tga-call:hover { color: #fff; }
.tga-card-fits, .tga-card-smaller { grid-column: 1; color: var(--tga-muted); font-size: .85em; }
.tga-card-smaller { color: var(--tga-fg); font-weight: 600; }
.tga-pass-clash { border: 1px solid #b91c1c; border-radius: 8px; padding: .5rem; margin: .4rem 0; }
.tga-pass-clash p { margin: 0 0 .4rem; }
.tga-pick { margin: 0 .3rem .3rem 0; }
.tga-pick[aria-pressed="true"] { outline: 2px solid var(--tga-accent); }
.tga-form { display: flex; gap: .4rem; padding: .6rem; border-top: 1px solid var(--tga-line); }
.tga-input { resize: none; min-height: 40px; max-height: 120px; }
.tga-send { border: 0; border-radius: 8px; padding: 0 .9rem; background: var(--tga-accent); color: var(--tga-accent-fg);
            font-weight: 700; cursor: pointer; }
.tga-mic { width: 40px; border: 1px solid var(--tga-line); border-radius: 8px; background: var(--tga-bg); color: var(--tga-fg);
           cursor: pointer; }
.tga-mic[hidden], .tga-speak[hidden] { display: none; }
.tga-listening .tga-mic { background: #b91c1c; color: #fff; border-color: #b91c1c; }
.tga-attach { display: inline-flex; align-items: center; justify-content: center; width: 40px; cursor: pointer;
              border: 1px solid var(--tga-line); border-radius: 8px; }
.tga-attach:focus-within { outline: 3px solid var(--tga-ring); outline-offset: 2px; }
.tga-pass-row { display: grid; grid-template-columns: 7.5rem 1fr; align-items: center; gap: .4rem; margin: .2rem 0; font-size: .9em; }
.tga-card-trip { font-weight: 700; margin-top: .4rem; padding-top: .3rem; border-top: 1px solid var(--tga-line); }
.tga-card-trip:first-of-type { border-top: 0; }
/* Phones: full screen, a clear close. */
@media (max-width: 480px) {
    .tga-bubble { width: 52px; height: 52px; margin-right: 6px; }
    .tga-open { left: 0; right: 0; top: 0; bottom: 0; }
    .tga-panel { width: 100vw; border-left: 0; box-shadow: none; }
    .tga-close { font-size: 2.1rem; }
}
/* His 7 (11-Nov-2026): never over a booking-form button. While the booking pop-up is open (book.js sets body.jn-pop-open)
   the head steps aside entirely; it comes back when the pop-up closes. Round 3 item 4: the same while the booking page's
   Members Login panel is open on the right (its closed tab sits lower on the same edge, clear of the head). */
body.jn-pop-open .tga:not(.tga-open) { display: none; }
body:has(.members-edge-tab.is-open) .tga:not(.tga-open) { display: none; }
