#visual-guide {
    position: fixed;
    z-index: 55;
    right: 22px;
    bottom: 22px;
    width: min(322px, calc(100vw - 36px));
    pointer-events: none;
}

#visual-guide[data-open] {
    background: #fff;
    color: var(--black);
    border: 1px solid #b6cf9c;
    border-radius: 18px;
    box-shadow: 0 14px 42px #17230e26;
    overflow: hidden;
    pointer-events: auto;
}

/* This temporary veil leaves the page's own styles and the focus area intact. */
#tour-spotlight {
    position: fixed;
    z-index: 100;
    pointer-events: none;
    border: 2px solid #78a844;
    border-radius: 14px;
    box-shadow: 0 0 0 200vmax rgb(239 243 234 / 82%), 0 0 0 5px rgb(168 230 61 / 30%);
}

#tour-spotlight[hidden] { display: none; }

#visual-guide[data-tour][data-open] {
    z-index: 101;
    background: #172018;
    color: #f4f8ef;
    border: 1px solid #526746;
    border-radius: 20px;
    box-shadow: 0 18px 55px #111b1538;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
}

#visual-guide[data-tour] .guide-top {
    background: #223023;
    color: #d8ebc3;
    padding: 10px 15px;
}

#visual-guide[data-tour] .guide-copy { padding: 18px 20px 0; }
#visual-guide[data-tour] .guide-copy h2 { color: #f4f8ef; font-size: 19px; line-height: 1.3; margin-bottom: 10px; }
#visual-guide[data-tour] .guide-copy p { color: #c8d5bf; line-height: 1.65; font-size: 14px; }
#visual-guide[data-tour] .guide-controls { padding: 14px 20px 20px; }
#visual-guide[data-tour] .guide-tour-status { color: #a9bf99; }
#visual-guide[data-tour] .guide-mark { color: #a8e63d; }
#visual-guide[data-tour] .guide-close,
#visual-guide[data-tour] .guide-pause { color: #d2e5c2; }
#visual-guide[data-tour] .guide-close:hover { background: #35472b; }
#visual-guide[data-tour] .btn.white { background: transparent; border-color: #627455; color: #e4efd9; }
#visual-guide[data-tour] button:disabled { opacity: 0.4; cursor: default; }
#visual-guide[data-tour] button:focus-visible { outline-color: #c0f572; }
.guide-tour-target { scroll-margin-top: 100px; }

body:has(#visual-guide[data-tour]) #main { padding-bottom: 420px; }

#visual-guide[data-urgent-alert] .guide-top {
    background: #ffe9e4;
    color: #852a21;
}

#visual-guide[data-urgent-alert] .guide-mark,
#visual-guide[data-urgent-alert] .guide-close {
    color: inherit;
}

@media (prefers-reduced-motion: no-preference) {
    .daily-task[data-advanced] {
        animation: reminder-advance 260ms ease-out both;
    }
}

@keyframes reminder-advance {
    from {
        background: #ddf4c3;
        transform: translateY(4px);
    }
    to {
        background: #f5fbeb;
        transform: translateY(0);
    }
}

.guide-top,
.guide-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.guide-top {
    background: #e5f5cf;
    padding: 7px 12px 7px 15px;
    font-size: 13px;
    font-weight: 750;
}

.guide-mark {
    color: #386018;
    margin-right: 3px;
    font-size: 17px;
}

.guide-close,
.guide-pause,
.guide-launch {
    cursor: pointer;
    font: inherit;
}

.guide-close {
    min-width: 40px;
    min-height: 40px;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: #355127;
    font-size: 22px;
    line-height: 1;
}

.guide-close:hover {
    background: #d7edbb;
}

.guide-copy {
    padding: 13px 15px 0;
}

.guide-copy h2 {
    font-size: 16px;
    letter-spacing: 0;
    margin: 0 0 5px;
    overflow-wrap: anywhere;
}

.guide-copy p {
    margin: 0;
    color: #485142;
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.guide-controls {
    padding: 11px 15px 13px;
    flex-wrap: wrap;
}
.guide-tour-status {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #5d6854;
    font-size: 12px;
}
.guide-tour-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    width: 100%;
}

.guide-pause {
    padding: 10px 4px;
    border: 0;
    color: #485142;
    background: transparent;
    font-size: 12px;
    text-decoration: underline;
}

.guide-launch {
    float: right;
    pointer-events: auto;
    padding: 9px 13px;
    border-radius: 999px;
    border: 1px solid #b6cf9c;
    background: #e5f5cf;
    color: #24361a;
    font-size: 13px;
    font-weight: 700;
}

.guide-target {
    outline: 3px solid #4f791f;
    outline-offset: 4px;
    box-shadow: 0 0 0 9px #a8e63d55;
    scroll-margin-block: 16px;
}

.daily-checklist h2 {
    margin: 0;
    font-size: clamp(18px, 3vw, 23px);
}

.daily-header,
.daily-header-controls {
    flex-wrap: wrap;
    gap: 7px 10px;
}

.daily-header-controls {
    display: flex;
    align-items: center;
}

.daily-toggle {
    padding: 6px 9px;
    border: 1px solid #bbd5a8;
    border-radius: 7px;
    background: #f5fbeb;
    color: #2d4a1c;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.daily-toggle::after {
    content: "";
    display: inline-block;
    margin-left: 7px;
    width: 5px;
    height: 5px;
    border-right: 1.5px solid;
    border-bottom: 1.5px solid;
    transform: translateY(-2px) rotate(45deg);
}

.daily-toggle[aria-expanded="true"]::after {
    transform: translateY(1px) rotate(225deg);
}

.daily-checklist:has(.daily-toggle[aria-expanded="false"]) {
    padding-block: 13px;
}

.daily-compact:not([hidden]) {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px 7px;
    margin-top: 5px;
    font-size: 12px;
    color: #485142;
}

.reminder-section {
    margin-bottom: 24px;
}

.reminder-badge {
    display: inline-block;
    width: fit-content;
    border-radius: 999px;
    padding: 3px 8px;
    background: #edf2e8;
    color: #34452f;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.45;
}

.reminder-badge[data-tone="urgent"] {
    background: #ffe9e4;
    color: #852a21;
}

.reminder-badge[data-tone="soon"] {
    background: #fff1d7;
    color: #6b4203;
}

.reminder-badge[data-tone="price"] {
    background: #dff1d1;
    color: #2b5118;
}

.daily-task-title {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 3px 10px;
}

.daily-task[data-next-task] {
    background: #f5fbeb;
    box-shadow: -3px 0 #547c32;
    padding-inline: 9px;
    border-radius: 6px;
}

.daily-next-label {
    display: block;
    color: #2d4a1c;
    font-size: 11px;
    font-weight: 750;
    margin-bottom: 4px;
}

.agent-coverage {
    border-top: 1px solid #bbd5a8;
    margin-top: 8px;
    padding-top: 10px;
}

.agent-coverage summary {
    cursor: pointer;
    color: #2d4a1c;
    font-size: 13px;
    font-weight: 700;
    width: fit-content;
}

.agent-coverage ul {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
    gap: 12px;
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

.agent-coverage a,
.agent-coverage small {
    display: block;
}

.agent-coverage a {
    width: fit-content;
    font-size: 13px;
    font-weight: 700;
    text-decoration: underline;
}

.agent-coverage small {
    margin-top: 3px;
    color: #485142;
    font-size: 12px;
}

.daily-progress {
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.daily-tasks {
    margin: 13px 0 0;
    padding: 0;
    list-style: none;
}

.daily-task {
    display: grid;
    grid-template-columns: 23px 1fr;
    gap: 9px;
    padding: 11px 0;
    border-top: 1px solid #bbd5a8;
}

.daily-task input {
    width: 17px;
    min-height: 17px;
    height: 17px;
    margin: 2px 0 0;
    accent-color: #436a22;
    cursor: pointer;
}

.daily-task h3 {
    font-size: 14px;
}

.daily-task p {
    margin: 3px 0;
    font-size: 12px;
}

.daily-link {
    display: inline-block;
    padding: 2px 3px;
    border-radius: 4px;
    color: #2d4a1c;
    font-size: 12px;
    font-weight: 700;
    text-decoration: underline;
}

.daily-done h3 {
    text-decoration: line-through;
}

.daily-empty {
    margin: 13px 0 0;
}

#visual-guide button:focus-visible,
.guide-target:focus-visible {
    outline: 3px solid #24361a;
    outline-offset: 3px;
}

body:has(#visual-guide[data-open]) #main {
    padding-bottom: 220px;
}

@media (max-width: 700px) {
    #visual-guide {
        right: 12px;
        bottom: calc(88px + env(safe-area-inset-bottom));
        width: min(322px, calc(100vw - 24px));
    }

    body:has(#visual-guide[data-open]) #main {
        padding-bottom: 285px;
    }
    body:has(#visual-guide[data-tour]) #main {
        padding-bottom: 420px;
    }
}

@media (max-height: 500px) {
    #visual-guide[data-open] {
        max-height: 48dvh;
        overflow: auto;
    }
}

/* The assistant stays reachable as a message bubble when minimized. */
#visual-guide[data-minimized] { width: 56px; }
#visual-guide[data-minimized] .guide-launch { width: 56px; height: 56px; padding: 0; display: grid; place-items: center; border-radius: 50%; background: #243b1b; color: #d5f6ae; border: 1px solid #96be68; box-shadow: 0 6px 20px #17230e26; }
#visual-guide[data-minimized] .guide-launch:hover { background: #36552a; }
@media (prefers-reduced-motion: no-preference) {
  .guide-target:not(.guide-tour-target) { animation: tara-recommendation-glow 3s ease-in-out 2; }
  .daily-task[data-next-task] .daily-link,
  .daily-compact:not([hidden]) .daily-link { animation: tara-recommendation-glow 3s ease-in-out 2; }
}
@keyframes tara-recommendation-glow {
  0%, 100% { box-shadow: 0 0 0 3px #a8e63d25; }
  50% { box-shadow: 0 0 0 7px #a8e63d55; background-color: #e9f7d8; }
}

/* Movable assistant: only the heading, bubble and resize grip capture drags. */
#visual-guide[data-open] { max-height: calc(100dvh - 24px); overflow: auto; min-width: min(240px, calc(100vw - 24px)); }
.tara-drag-handle, .guide-launch, .tara-resize { touch-action: none; }
.tara-drag-handle { cursor: grab; user-select: none; flex: 1; }
.tara-drag-handle:active { cursor: grabbing; }
#visual-guide .guide-top { position: sticky; top: 0; z-index: 2; }
.tara-widget-chat { padding: 0 14px 10px; }
.tara-inline-thread { max-height: 230px; overflow: auto; overflow-wrap: anywhere; }
.tara-inline-thread:empty { display: none; }
#visual-guide .tara-inline-thread .message { max-width: 100%; margin: 8px 0; padding: 12px; font-size: 12px; border-radius: 10px; }
#visual-guide .tara-inline-thread .answer-copy { font-size: 12px; line-height: 1.65; }
#visual-guide .tara-inline-thread .answer-proof { padding: 10px; }
#visual-guide .tara-inline-thread .answer-proof h3 { font-size: 13px; }
.tara-widget-chat label { display: block; font-size: 12px; font-weight: 650; margin: 10px 0 8px; }
.tara-composer { display: flex; gap: 6px; }
.tara-composer input { min-width: 0; width: 100%; font: inherit; font-size: 13px; padding: 10px; border: 1px solid #bdcbb1; border-radius: 8px; background: #fff; color: #162010; }
.tara-composer button { flex-shrink: 0; padding: 10px; border: 0; border-radius: 8px; background: #a8e63d; color: #172018; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.tara-composer button:disabled { opacity: .55; cursor: wait; }
.tara-widget-chat form > p, .tara-wait { font-size: 10px; color: #627057; margin: 8px 0 0; line-height: 1.5; }
.tara-widget-chat form > p a { text-decoration: underline; }
.tara-resize { display: block; margin: 0 2px 2px auto; border: 0; background: transparent; color: #66795a; width: 28px; height: 25px; cursor: nwse-resize; }
#visual-guide[data-tour] .tara-widget-chat form > p { color: #becfae; }
#visual-guide[data-tour] .tara-inline-thread { color: #172018; }

#visual-guide .guide-top { cursor: grab; touch-action: none; user-select: none; }
#visual-guide .guide-top:active { cursor: grabbing; }

.tara-open-ask { display: block; width: fit-content; margin: 6px 0 10px auto; font-size: 12px; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }

/* Compact by default; cursor resizing can still enlarge the assistant. */
#visual-guide:not([data-tour]) .guide-top { padding: 5px 10px 5px 12px; font-size: 12px; }
#visual-guide:not([data-tour]) .guide-copy { padding: 10px 12px 0; }
#visual-guide:not([data-tour]) .guide-copy h2 { font-size: 15px; }
#visual-guide:not([data-tour]) .guide-copy p { font-size: 12px; }
#visual-guide:not([data-tour]) .guide-controls { padding: 8px 12px; }
.tara-widget-chat { padding-inline: 12px; }
.tara-inline-thread { max-height: 190px; }
.tara-open-ask { margin-block: 3px 7px; font-size: 11px; }

#visual-guide .tara-resize { position: absolute; right: 0; bottom: 0; margin: 0; width: 24px; height: 24px; padding: 0; font-size: 15px; z-index: 3; }
#visual-guide .tara-resize-nw { left: 0; right: auto; top: 0; bottom: auto; cursor: nwse-resize; }
#visual-guide .tara-resize-ne { right: 0; top: 0; bottom: auto; cursor: nesw-resize; }
#visual-guide .tara-resize-sw { left: 0; right: auto; bottom: 0; cursor: nesw-resize; }
#visual-guide[data-shrink-to-icon] { outline: 3px solid #7ba544; opacity: .75; }
.tara-widget-chat { padding-bottom: 18px; }

/* One compact composer, one live priority. Expanded conversations remain in place. */
#visual-guide[data-composer][data-open] { border: 1px solid #dce3d6; border-radius: 22px; background: #fff; box-shadow: 0 8px 28px #17230e16; }
#visual-guide[data-composer] .guide-top { background: transparent; color: #34402d; padding: 4px 28px; border-bottom: 1px solid #f1f3ee; }
#visual-guide[data-composer] .guide-close { min-height: 30px; height: 30px; min-width: 30px; font-size: 19px; }
#visual-guide[data-composer] .guide-mark { font-size: 14px; }
#visual-guide .tara-widget-chat { padding: 4px 14px 12px; }
.tara-widget-chat .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; }
#visual-guide .tara-widget-chat textarea { width: 100%; min-height: 56px; height: 64px; max-height: none; resize: none; padding: 10px 0 4px; border: 0; border-radius: 0; box-shadow: none; background: transparent; font: inherit; font-size: 14px; line-height: 1.5; color: #172018; }
#visual-guide .tara-widget-chat textarea:focus-visible { outline: 0; }
#visual-guide .tara-widget-chat form:focus-within { outline: 2px solid #a8c57f; outline-offset: 4px; border-radius: 8px; }
.tara-composer-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tara-composer-footer > span { font-size: 10px; color: #5c6854; }
.tara-composer-footer > div { display: flex; align-items: center; gap: 10px; }
.tara-composer-footer .tara-open-ask { margin: 0; font-size: 10px; }
.tara-composer-footer button { border: 0; border-radius: 50%; width: 32px; height: 32px; color: #172018; background: #a8e63d; font-size: 20px; cursor: pointer; }
.tara-composer-footer button:disabled { opacity: .45; cursor: wait; }
#visual-guide .tara-ai-choice { font-size: 9px; margin: 6px 0 0; color: #5c6854; }
.tara-notification { font-size: 11px; margin: 2px 0; }
.tara-notification > p { font-size: 10px; color: #7a8372; margin: 4px 0; }
.tara-notification summary { display: flex; align-items: center; gap: 7px; padding: 7px 0; cursor: pointer; list-style: none; }
.tara-notification summary::-webkit-details-marker { display: none; }
.tara-priority-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #35422d; }
.tara-priority-tone { font-size: 9px; font-weight: 700; border-radius: 5px; padding: 3px 5px; background: #edf3e6; color: #45652c; flex-shrink: 0; }
.tara-priority-tone[data-tone="urgent"] { background: #fff0eb; color: #a43b2a; }
.tara-priority-tone[data-tone="soon"] { background: #fff4df; color: #8a5c18; }
.tara-notification details > p { font-size: 11px; color: #65715b; line-height: 1.5; margin: 3px 0 7px; }
.tara-notification details > a { font-size: 11px; text-decoration: underline; }
.guide-launch { position: relative; }
.tara-priority-count:not([hidden]) { position: absolute; top: -2px; right: -2px; display: grid; place-items: center; min-width: 18px; height: 18px; background: #b34b37; border: 2px solid white; border-radius: 50%; color: #fff; font-size: 10px; }
#visual-guide[data-tour] textarea { color: #f4f8ef; }
#visual-guide[data-tour] .tara-priority-title { color: #d7e4cc; }

.tara-notification summary::after { content: "⌄"; margin-left: auto; color: #7a8372; flex-shrink: 0; }

/* Conversational motion and bubbles, using ContextIQ's own palette. */
#visual-guide .tara-inline-thread .message.user { width: fit-content; max-width: 90%; margin-left: auto; background: #243b1b; color: #f2f8e9; border: 0; border-radius: 15px 15px 4px 15px; }
#visual-guide .tara-inline-thread .message.assistant { background: transparent; border: 0; box-shadow: none; padding-inline: 2px; }
#visual-guide .tara-inline-thread .answer-byline { color: #54753b; font-size: 11px; }
#visual-guide .tara-inline-thread .answer-byline > span:last-child { display: none; }
#visual-guide .tara-inline-thread .answer-details { background: #f4f7ef; border: 1px solid #dce5d2; border-radius: 10px; }
#visual-guide .tara-inline-thread .answer-source-link { font-size: 11px; }
#visual-guide .tara-widget-chat textarea { transition: height 140ms ease; }
.tara-typing { display: inline-flex; align-items: center; gap: 4px; height: 23px; padding: 3px; }
.tara-typing i { display: block; width: 5px; height: 5px; border-radius: 50%; background: #6f914f; }
@media (prefers-reduced-motion: no-preference) {
  .tara-turn { animation: tara-message-in 180ms ease-out both; }
  .tara-typing i { animation: tara-thinking 1.2s ease-in-out infinite; }
  .tara-typing i:nth-child(2) { animation-delay: 150ms; }
  .tara-typing i:nth-child(3) { animation-delay: 300ms; }
  #visual-guide[data-minimized] .guide-launch { animation: tara-message-in 140ms ease-out; }
}
@keyframes tara-message-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes tara-thinking { 0%,70%,100% { transform: translateY(0); opacity: .45; } 35% { transform: translateY(-3px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #visual-guide .tara-widget-chat textarea { transition: none; } }

/* Apple-green urgency keeps the priority explicit without changing the composer. */
#visual-guide .tara-notification details[data-priority-tone="urgent"] { background: linear-gradient(125deg, #dbf5ae, #eff9dc); border: 1px solid #bedc87; border-left: 3px solid #8bc433; border-radius: 12px; padding: 2px 9px 7px; box-shadow: 0 2px 8px #81b4360d; }
#visual-guide .tara-notification details[data-priority-tone="urgent"] .tara-priority-title { color: #294019; font-weight: 600; }
#visual-guide .tara-notification details[data-priority-tone="urgent"] > p { color: #4a6234; }
#visual-guide .tara-priority-tone[data-tone="urgent"] { background: #b5e46c; color: #26420f; }
#visual-guide .tara-priority-count:not([hidden]) { background: #a8df4d; color: #243b12; box-shadow: 0 0 0 2px #dff1c2; font-weight: 750; }
