/* =====================================================================
   Autonomous tasks: a live mission board. A scanning beam while it works,
   a plan that lights up step by step, a tool log where each tool moves its own way.
   ===================================================================== */
:root { --spring: cubic-bezier(.34, 1.56, .64, 1); --out: cubic-bezier(.16, 1, .3, 1); --tk: #3ee6a8; }

/* Task toggle in the composer */
.task-toggle { flex-shrink: 0; height: 38px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--border-2, rgba(255,255,255,.1)); background: rgba(255,255,255,.03); color: var(--muted); display: inline-flex; align-items: center; gap: 6px; font: 600 12.5px Inter, system-ui, sans-serif; cursor: pointer; transition: background .25s, color .25s, border-color .25s, transform .3s var(--spring); }
.task-toggle .i { width: 16px; height: 16px; }
.task-toggle:hover { color: var(--text); border-color: rgba(62,230,168,.45); }
.task-toggle:hover .i { transform: rotate(45deg); }
.task-toggle[aria-pressed="true"] { background: var(--tk); border-color: var(--tk); color: var(--on-accent, #03140d); box-shadow: 0 8px 22px -10px rgba(62,230,168,.8); }
.task-toggle[aria-pressed="true"] .i { animation: targetLock .6s var(--spring); }
@keyframes targetLock { from { transform: scale(.5) rotate(-120deg); } }
.composer.task-on { border-color: rgba(62,230,168,.55) !important; box-shadow: 0 0 0 4px rgba(62,230,168,.08), 0 18px 50px -20px rgba(62,230,168,.35) !important; }
.composer.task-on::before { opacity: 1 !important; }
@media (max-width: 560px) { .task-toggle span { display: none; } .task-toggle { padding: 0 10px; } }

/* The goal bubble */
.bubble .tg { display: flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; opacity: .75; margin-bottom: 4px; }
.bubble .tg .i { width: 12px; height: 12px; }

/* Live mission board */
.tboard { position: relative; overflow: hidden; border: 1px solid rgba(62,230,168,.22); border-radius: 16px; padding: 14px 14px 12px; margin: 4px 0 12px; background: linear-gradient(180deg, rgba(62,230,168,.07), rgba(255,255,255,.015)); animation: boardOpen .6s var(--out) both; }
@keyframes boardOpen { from { opacity: 0; clip-path: inset(0 0 100% 0 round 16px); } to { opacity: 1; clip-path: inset(0 0 0 0 round 16px); } }
.tb-top { display: flex; align-items: center; gap: 10px; font-size: 12.5px; flex-wrap: wrap; }
.tb-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgba(62,230,168,.14); color: var(--tk); font-weight: 700; font-size: 11.5px; letter-spacing: .02em; }
.tb-badge .i { width: 13px; height: 13px; }
.tboard:not(.done) .tb-badge .i { animation: spin 3s linear infinite; }
.tb-status { color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.tb-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tk); animation: livePulse 1.2s ease-in-out infinite; }
.tboard.done .tb-status::before { animation: none; }
@keyframes livePulse { 50% { opacity: .3; transform: scale(.7); } }
.tb-scan { height: 2px; border-radius: 2px; margin: 12px 0; background: rgba(255,255,255,.06); overflow: hidden; }
.tb-scan i { display: block; height: 100%; width: 35%; background: linear-gradient(90deg, transparent, var(--tk), transparent); animation: scanBeam 1.4s ease-in-out infinite; }
.tboard.done .tb-scan i { animation: none; width: 100%; background: var(--tk); }
@keyframes scanBeam { from { transform: translateX(-110%); } to { transform: translateX(310%); } }

/* Plan that lights up */
.tb-plan { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 7px; }
.tb-plan li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--muted); animation: planIn .5s var(--out) both; transition: color .3s; }
.tb-plan li:nth-child(2) { animation-delay: .07s; } .tb-plan li:nth-child(3) { animation-delay: .14s; } .tb-plan li:nth-child(4) { animation-delay: .21s; } .tb-plan li:nth-child(5) { animation-delay: .28s; } .tb-plan li:nth-child(6) { animation-delay: .35s; }
@keyframes planIn { from { opacity: 0; transform: translate3d(-14px, 0, 0); } }
.tb-plan li::before { content: ""; width: 15px; height: 15px; border-radius: 50%; flex-shrink: 0; border: 1.5px solid rgba(255,255,255,.25); transition: background-color .3s, border-color .3s, box-shadow .3s; }
.tb-plan li.now { color: var(--text); }
.tb-plan li.now::before { border-color: var(--tk); animation: nowRing 1.2s ease-in-out infinite; }
@keyframes nowRing { 50% { box-shadow: 0 0 0 5px rgba(62,230,168,.18); } }
.tb-plan li.done { color: var(--text); }
.tb-plan li.done::before { border-color: var(--tk); background: var(--tk) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2303140d' stroke-width='3.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 10px no-repeat; animation: checkPop .45s var(--spring); }
.tb-plan li.ghost { height: 12px; border-radius: 6px; width: 70%; background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.1), rgba(255,255,255,.04)); background-size: 200% 100%; animation: ghost 1.2s linear infinite; }
.tb-plan li.ghost:nth-child(2) { width: 55%; } .tb-plan li.ghost:nth-child(3) { width: 62%; }
.tb-plan li.ghost::before { display: none; }
@keyframes ghost { to { background-position: -200% 0; } }

/* Tool log: every tool has its own colour and its own motion while running */
.tb-log { list-style: none; margin: 0; padding: 10px 0 0; border-top: 1px dashed rgba(255,255,255,.09); display: grid; gap: 9px; }
.tb-log:empty { display: none; }
.tl { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: start; font-size: 13px; animation: logIn .45s var(--out) both; }
@keyframes logIn { from { opacity: 0; transform: translate3d(0, 10px, 0) scale(.97); } }
.tl .ti { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; }
.tl .ti .i { width: 16px; height: 16px; }
.tl.web_search .ti { background: rgba(76,195,212,.15); color: #4cc3d4; }
.tl.read_page .ti { background: rgba(161,145,242,.16); color: #a191f2; }
.tl.calculate .ti { background: rgba(242,180,90,.16); color: #f2b45a; }
.tl.write .ti { background: rgba(62,230,168,.16); color: var(--tk); }
.tl.run.web_search .ti .i { animation: sweep 1s ease-in-out infinite; }
.tl.run.read_page .ti .i { animation: globeTurn 1.6s linear infinite; }
.tl.run.calculate .ti .i { animation: tick .5s ease-in-out infinite; }
.tl.run.write .ti .i { animation: scribble .7s ease-in-out infinite; }
@keyframes sweep { 0%, 100% { transform: translate(-2px, 1px) rotate(-8deg); } 50% { transform: translate(2px, -1px) rotate(8deg); } }
@keyframes globeTurn { to { transform: rotateY(360deg); } }
@keyframes tick { 50% { transform: scale(1.18); } }
@keyframes scribble { 0%, 100% { transform: translate(-1px, 1px) rotate(-6deg); } 50% { transform: translate(2px, -1px) rotate(6deg); } }
.tl.done .ti { animation: checkPop .4s var(--spring); }
.tl b { font-weight: 600; color: var(--text); }
.tl .td { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl small { display: block; color: var(--dim); font-size: 12px; margin-top: 1px; }
.tl.fail small { color: #f87171; }
.tl .chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.tl .chips span { font-size: 11px; padding: 2px 8px; border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); animation: chipIn .4s var(--spring) both; }
.tl .chips span:nth-child(2) { animation-delay: .05s; } .tl .chips span:nth-child(3) { animation-delay: .1s; } .tl .chips span:nth-child(4) { animation-delay: .15s; } .tl .chips span:nth-child(5) { animation-delay: .2s; }
@keyframes chipIn { from { opacity: 0; transform: scale(.6); } }

/* The finished report slides up and unblurs */
.msg.bot .md.report-in { animation: reportIn .8s var(--out) both; }
@keyframes reportIn { from { opacity: 0; transform: translate3d(0, 16px, 0); filter: blur(4px); } }
@media (max-width: 820px), (pointer: coarse) { @keyframes reportIn { from { opacity: 0; transform: translate3d(0, 16px, 0); } } }

/* Finished task summary on the message */
.task-sum .steps-head { gap: 10px; flex-wrap: wrap; }
.task-sum .steps-list li.plan-li { color: var(--text); }
.task-sum .steps-list li.log-li { color: var(--muted); font-size: 12.5px; }

/* Tables in reports */
.md .tbl { overflow-x: auto; margin: 12px 0; border: 1px solid rgba(255,255,255,.09); border-radius: 12px; -webkit-overflow-scrolling: touch; }
.md table { border-collapse: collapse; width: 100%; min-width: 440px; font-size: 13px; }
.md th { text-align: left; font-weight: 600; color: var(--text); background: rgba(62,230,168,.08); white-space: nowrap; }
.md th, .md td { padding: 9px 11px; border-bottom: 1px solid rgba(255,255,255,.06); vertical-align: top; }
.md tbody tr:last-child td { border-bottom: 0; }
.md tbody tr { transition: background .2s; }
.md tbody tr:hover { background: rgba(62,230,168,.05); }

/* Task idea on the welcome screen */
.task-idea { margin: 14px auto 0; display: flex; align-items: center; gap: 12px; width: 100%; max-width: 640px; padding: 12px 14px; border-radius: 14px; border: 1px dashed rgba(62,230,168,.45); background: rgba(62,230,168,.05); color: var(--text); text-align: left; cursor: pointer; font: inherit; animation: riseIn .7s var(--out) .55s both; transition: transform .3s var(--spring), border-color .3s, background .3s; }
.task-idea:hover { transform: translateY(-2px); border-style: solid; background: rgba(62,230,168,.09); }
.task-idea .ico-t { width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center; background: var(--tk); color: var(--on-accent, #03140d); }
.task-idea:hover .ico-t .i { animation: targetLock .6s var(--spring); }
.task-idea span b { display: block; font-size: 13.5px; }
.task-idea span small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.task-idea > .i { margin-left: auto; color: var(--tk); flex-shrink: 0; transition: transform .3s var(--spring); }
.task-idea:hover > .i { transform: translateX(4px); }

@media (prefers-reduced-motion: reduce) { .tboard *, .tboard, .task-idea, .tl { animation: none !important; } }

/* Header buttons never wrap their label */
.bar .icon-btn, .icon-btn { white-space: nowrap; }

/* =====================================================================
   Mode menu + Deep research
   ===================================================================== */
:root { --dp: #a191f2; }
.task-toggle .cv { width: 12px !important; height: 12px !important; opacity: .7; margin-left: -2px; transition: transform .3s var(--spring); }
.task-toggle[aria-expanded="true"] .cv { transform: rotate(180deg); }
.task-toggle[data-mode="deep"] { background: var(--dp); border-color: var(--dp); color: #120d2b; box-shadow: 0 8px 22px -10px rgba(161,145,242,.8); }
.composer.deep-on { border-color: rgba(161,145,242,.6) !important; box-shadow: 0 0 0 4px rgba(161,145,242,.1), 0 18px 50px -20px rgba(161,145,242,.4) !important; }
.composer.deep-on::before { background: linear-gradient(120deg, rgba(161,145,242,.95), rgba(62,230,168,.5), rgba(161,145,242,.95)) !important; background-size: 200% 200% !important; }

/* Menu fans up from the button, each option on its own beat */
.mode-menu { position: absolute; left: 8px; bottom: calc(100% + 10px); z-index: 30; width: min(340px, calc(100vw - 32px)); padding: 6px; border-radius: 16px; background: rgba(10, 13, 19, .96); border: 1px solid rgba(255,255,255,.1); box-shadow: 0 24px 60px -20px rgba(0,0,0,.8); transform-origin: 20% 100%; animation: menuFan .35s var(--spring) both; }
@supports (backdrop-filter: blur(1px)) { @media (min-width: 821px) and (pointer: fine) { .mode-menu { background: rgba(10, 13, 19, .82); backdrop-filter: blur(20px) saturate(150%); } } }
@keyframes menuFan { from { opacity: 0; transform: translateY(10px) scale(.92) rotate(-2deg); } }
.mode-menu button { display: flex; gap: 12px; align-items: center; width: 100%; padding: 10px; border-radius: 11px; border: 0; background: transparent; color: var(--text); text-align: left; font: inherit; cursor: pointer; animation: optIn .4s var(--out) both; transition: background .2s; }
.mode-menu button:nth-child(2) { animation-delay: .05s; } .mode-menu button:nth-child(3) { animation-delay: .1s; }
@keyframes optIn { from { opacity: 0; transform: translate3d(0, 8px, 0); } }
.mode-menu button:hover { background: rgba(255,255,255,.05); }
.mode-menu button.sel { background: rgba(62,230,168,.1); }
.mode-menu button.mm-deep.sel { background: rgba(161,145,242,.13); }
.mode-menu .mi { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; transition: transform .35s var(--spring); }
.mode-menu .mm-chat .mi { background: rgba(147,182,220,.15); color: #93b6dc; }
.mode-menu .mm-task .mi { background: rgba(62,230,168,.15); color: var(--tk); }
.mode-menu .mm-deep .mi { background: rgba(161,145,242,.18); color: var(--dp); }
.mode-menu .mm-chat:hover .mi { transform: translateY(-2px); }
.mode-menu .mm-task:hover .mi { transform: rotate(90deg); }
.mode-menu .mm-deep:hover .mi { transform: scale(1.12) translateY(-2px); }
.mode-menu b { display: block; font-size: 13.5px; }
.mode-menu small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }

/* Deep research board: violet aurora drifting behind, a double sonar beam, a source counter */
.tboard.deep { border-color: rgba(161,145,242,.3); background: linear-gradient(120deg, rgba(161,145,242,.1), rgba(62,230,168,.05) 45%, rgba(161,145,242,.08)); background-size: 220% 220%; animation: boardOpen .6s var(--out) both, deepDrift 9s ease-in-out infinite alternate; }
.tboard.deep.done { animation: none; }
@keyframes deepDrift { to { background-position: 100% 100%; } }
.tboard.deep .tb-badge { background: rgba(161,145,242,.18); color: var(--dp); }
.tboard.deep .tb-status::before { background: var(--dp); }
.tboard.deep .tb-scan { position: relative; height: 3px; }
.tboard.deep .tb-scan i { position: absolute; top: 0; left: 0; background: linear-gradient(90deg, transparent, var(--dp), transparent); animation-duration: 1.8s; }
.tboard.deep .tb-scan i + i { background: linear-gradient(90deg, transparent, var(--tk), transparent); animation-delay: -.9s; }
.tboard.deep.done .tb-scan i { position: static; background: linear-gradient(90deg, var(--dp), var(--tk)); }
.tboard.deep.done .tb-scan i + i { display: none; }
.tboard.deep .tb-plan li.now::before { border-color: var(--dp); animation-name: nowRingDeep; }
@keyframes nowRingDeep { 50% { box-shadow: 0 0 0 5px rgba(161,145,242,.22); } }
.tboard.deep .tb-plan li.done::before { border-color: var(--dp); background-color: var(--dp); }
.tb-count { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 600; }
.tb-count:empty { display: none; }
.tb-count.bump { animation: countBump .5s var(--spring); }
@keyframes countBump { 40% { transform: scale(1.18); color: var(--text); } }
/* While writing, the tool log folds away so the report takes the stage */
.tboard.writing .tb-log { max-height: 0; padding-top: 0; border-top-color: transparent; opacity: 0; overflow: hidden; transition: max-height .6s var(--out), opacity .3s, padding .4s; }
.tboard .tb-log { max-height: 4000px; }
.tboard.writing .tb-plan { margin-bottom: 0; }

/* Contents for deep reports */
.task-sum.deep .tb-badge { background: rgba(161,145,242,.18); color: var(--dp); }
.toc { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 2px 0 12px; }
.toc-l { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--dp); margin-right: 2px; }
.toc-l .i { width: 13px; height: 13px; }
.toc button { font: 500 12px Inter, system-ui, sans-serif; padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(161,145,242,.28); background: rgba(161,145,242,.07); color: var(--text); cursor: pointer; transition: transform .25s var(--spring), background .2s; animation: chipIn .4s var(--spring) both; }
.toc button:hover { transform: translateY(-2px); background: rgba(161,145,242,.16); }
.md .h { scroll-margin-top: 16px; }

/* Two idea cards */
.task-ideas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 640px; margin: 14px auto 0; }
.task-ideas .task-idea { margin: 0; max-width: none; }
.task-ideas .task-idea:nth-child(2) { animation-delay: .65s; }
.task-idea.deep { border-color: rgba(161,145,242,.45); background: rgba(161,145,242,.06); }
.task-idea.deep:hover { background: rgba(161,145,242,.11); }
.task-idea.deep .ico-t { background: var(--dp); color: #120d2b; }
.task-idea.deep > .i { color: var(--dp); }
.task-idea.deep:hover .ico-t .i { animation: layerLift .6s var(--spring); }
@keyframes layerLift { 40% { transform: translateY(-3px) scale(1.1); } }
@media (max-width: 700px) { .task-ideas { grid-template-columns: 1fr; } }
