/* Workspace component layer */
:root
{
    --sidebar-w: 264px;
    --taskbar-w: 320px;
    --topbar-h: 56px;
    --ui_measure: 780px;
    --ui_gutter: max(28px, calc((100% - var(--ui_measure)) / 2));
    --ui_border: color-mix(in srgb, var(--text) 11%, transparent);
    --ui_hover: color-mix(in srgb, var(--text) 5%, transparent);
    --ui_selected: color-mix(in srgb, var(--text) 8%, transparent);
}

:root[data-theme="light"], :root[data-theme="system"]
{
    --ground: #f5f5f3;
    --surface: #fdfdfc;
    --surface-raised: #ffffff;
    --surface-sunken: #f2f2ef;
    --bubble-mine: #efefec;
    --code-bg: #f5f5f2;
    --text: #30312e;
    --text-strong: #20221f;
    --muted: #70726c;
    --faint: #777973;
}

:root[data-theme="dark"]
{
    --ground: #1b1c1b;
    --surface: #222321;
    --surface-raised: #292a27;
    --surface-sunken: #1e1f1d;
    --bubble-mine: #30312e;
    --code-bg: #1b1c1a;
    --text: #dedfd9;
    --text-strong: #f2f3ed;
    --muted: #a3a59d;
    --faint: #979990;
}

@media (prefers-color-scheme: dark)
{
    :root[data-theme="system"]
    {
        --ground: #1b1c1b;
        --surface: #222321;
        --surface-raised: #292a27;
        --surface-sunken: #1e1f1d;
        --bubble-mine: #30312e;
        --code-bg: #1b1c1a;
        --text: #dedfd9;
        --text-strong: #f2f3ed;
        --muted: #a3a59d;
        --faint: #979990;
    }
}

.sidebar
{
    border-right: 1px solid var(--ui_border);
}

.sidebar-top
{
    padding: 0 15px;
    gap: 10px;
    height: 62px;
}

.sidebar_brand
{
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 17px;
    font-weight: 650;
    letter-spacing: -.6px;
    color: var(--text-strong);
}

.brand_dot
{
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    flex: none;
}

#sidebarSearchBtn
{
    display: none;
}

.side-nav
{
    gap: 3px;
    padding: 0 12px 16px;
}

.side-nav .nav-row
{
    justify-content: flex-start;
    min-height: 36px;
    height: auto;
    padding: 8px 11px;
    border: 0;
    border-radius: 8px;
    box-shadow: none;
    font-size: 13px;
    font-weight: 450;
    transform: none;
    color: var(--text);
    background: transparent;
}

.side-nav .nav-row::after
{
    display: none;
}

.side-nav .nav-row:hover, .side-nav .nav-row.is-active
{
    background: var(--ui_selected);
}

.side-nav .nav-row.primary
{
    order: -1;
    font-weight: 550;
    color: var(--text-strong);
}

.side-nav .workspace_search
{
    color: var(--muted);
    margin-bottom: 10px;
}

.workspace_search kbd
{
    margin-left: auto;
    font-family: inherit;
    font-size: 10px;
    white-space: nowrap;
    color: var(--faint);
}

.sidebar-panel
{
    padding: 0 12px;
}

.side-section
{
    padding: 8px 9px 8px;
}

.side-section .ws-switch
{
    max-width: 205px;
    font-size: 12px;
    color: var(--muted);
}

.side-section .ws-name
{
    font-weight: 550;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-group
{
    font-size: 11px;
    padding: 12px 11px 5px;
    color: var(--faint);
}

.project_group
{
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 650;
    color: var(--muted);
}

.list-item.conv .sub
{
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.list-item.conv .sub > span:last-child
{
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task_state
{
    flex: none;
    font-size: 10px;
    font-weight: 600;
}

.task_state_needs_input
{
    color: var(--accent);
}

.task_state_running
{
    color: #3b8d6e;
}

.task_state_queued
{
    color: var(--muted);
}

.task_state_incomplete
{
    color: var(--accent);
}

.list-item.conv
{
    min-height: 36px;
    height: auto;
    padding: 9px 11px;
    border-radius: 7px;
}

.list-item.conv::before
{
    width: 5px;
    height: 5px;
    border-width: 1px;
    opacity: .5;
}

.list-item.conv.is-active::before
{
    opacity: 1;
}

.list-item.conv .name
{
    font-size: 13px;
    line-height: 1.4;
}

.list-item.conv.is-active
{
    background: var(--ui_selected);
}

.sidebar-foot
{
    margin: 8px 10px 4px;
    padding: 10px 0;
    border-top: 1px solid var(--ui_border);
}

.user-row
{
    min-height: 38px;
    gap: 10px;
    padding: 6px 9px;
    text-align: left;
}

.user-avatar
{
    width: 27px;
    height: 27px;
}

.user-menu, .ws-menu
{
    padding: 7px;
    border-radius: 12px;
    border: 1px solid var(--ui_border);
}

.view-head
{
    height: 56px;
    min-height: 56px;
    padding: 0 28px;
    border-bottom: 1px solid var(--ui_border);
    gap: 12px;
}

.view-title
{
    overflow: hidden;
    gap: 10px;
}

.view-title h1
{
    font-size: 13px;
    font-weight: 550;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ws-pill
{
    font-size: 11px;
    color: var(--muted);
    background: var(--ui_hover);
    border: 0;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#conversation_workdir
{
    max-width: 180px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.run_status
{
    flex: none;
    font-size: 11px;
    color: var(--muted);
}

.run_status_needs_input
{
    color: var(--accent);
}

.run_status_running
{
    color: #3b8d6e;
}

.run_status_incomplete
{
    color: var(--accent);
}

.incomplete_notice
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    margin: 20px 0;
    border: 1px solid var(--ui_border);
    border-left: 3px solid var(--accent);
    border-radius: 9px;
    background: var(--surface-raised);
    font-size: 12px;
}

.incomplete_notice strong
{
    font-weight: 550;
}

#conversationMeta, .title-icon
{
    display: none;
}

.thread
{
    padding: 36px var(--ui_gutter) 28px;
    gap: 24px;
    scroll-padding-bottom: 24px;
}

.msg, .msg-body
{
    min-width: 0;
}

.msg .msg-content, .msg.assistant .msg-content
{
    font-size: 15px;
    line-height: 1.85;
    letter-spacing: .005em;
    overflow-wrap: anywhere;
}

.msg.user.mine
{
    justify-content: flex-end;
}

.msg.user.mine .msg-body
{
    flex: 0 1 auto;
    width: fit-content;
    max-width: 88%;
}

.msg.user.mine .msg-content
{
    padding: 12px 18px;
    border-radius: 16px 16px 5px 16px;
    background: var(--bubble-mine);
    font-size: 14px;
}

.md h1, .md h2, .md h3
{
    font-weight: 620;
    font-size: 1.14em;
    margin: 1.2em 0 .55em;
    line-height: 1.5;
}

.md pre, .code-block
{
    border: 1px solid var(--ui_border);
    border-radius: 10px;
    font-size: 12.5px;
    line-height: 1.7;
}

.code-block pre
{
    border: 0;
    padding: 18px 42px 18px 18px;
}

.tool-card, .reasoning
{
    background: var(--ui_hover);
    border: 1px solid var(--ui_border);
    border-radius: 9px;
    font-size: 12px;
}

.composer
{
    padding: 12px var(--ui_gutter) 20px;
    background: var(--surface);
    border: 0;
}

.composer-box
{
    min-height: 80px;
    border: 1px solid color-mix(in srgb, var(--text) 18%, transparent);
    border-radius: 17px;
    background: var(--surface-raised);
    box-shadow: 0 3px 12px rgba(0, 0, 0, .025);
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.composer-box:focus-within
{
    border-color: color-mix(in srgb, var(--text) 36%, transparent);
    box-shadow: 0 0 0 3px var(--ui_hover);
}

.composer-input
{
    padding: 17px 18px;
    min-height: 78px;
    max-height: 240px;
    font-size: 14px;
    line-height: 1.7;
    border: 0;
    background: transparent;
}

.composer-input::placeholder
{
    color: var(--faint);
}

.send-key
{
    width: 32px;
    height: 32px;
    margin: 12px;
    border-radius: 50%;
    background: var(--text-strong);
    color: var(--surface);
}

.send-key:hover
{
    background: var(--text);
    color: var(--surface);
}

.send-key:disabled
{
    opacity: .35;
}

.composer-controls
{
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 3px 0;
    min-height: 38px;
    flex-wrap: wrap;
}

.composer-controls .ghost-select.pill
{
    max-width: 200px;
    min-height: 28px;
    font-size: 12px;
    color: var(--muted);
    padding-left: 8px;
    border: 0;
}

.composer-controls .agent_select
{
    max-width: 120px;
}

/* A focused ghost-select should read as a snug, rounded highlight that hugs
   the pill - not the global square focus outline, which detaches from a small
   control and looks like a clunky bordered box. */
.ghost-select:focus-visible,
.ghost-select:focus
{
    outline: none;
    background-color: var(--ui_hover);
    box-shadow: 0 0 0 2px var(--focus-ring);
}

.composer_hint
{
    font-size: 10px;
    color: var(--faint);
    white-space: nowrap;
}

#chatView .composer_hint
{
    display: none;
}

.composer_options
{
    position: relative;
}

.composer_options > summary
{
    list-style: none;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--muted);
}

.composer_options > summary::after
{
    content: '⌄';
    margin-left: 6px;
}

.composer_options > summary::-webkit-details-marker, .agent_picker > summary::-webkit-details-marker
{
    display: none;
}

.composer_options[open] > summary, .composer_options > summary:hover
{
    background: var(--ui_selected);
    color: var(--text);
}

.options_panel
{
    position: absolute;
    z-index: 45;
    bottom: calc(100% + 12px);
    right: 0;
    width: 260px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    border: 1px solid var(--ui_border);
    border-radius: 12px;
    background: var(--surface-raised);
    box-shadow: var(--shadow-pop);
}

.option_field
{
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 12px;
    color: var(--muted);
}

.option_field .ghost-select.pill
{
    max-width: 100%;
    width: 100%;
    background-color: var(--ui_hover);
    border-radius: 6px;
    color: var(--text);
}

#newView .new-body
{
    /* Fill the view so the auto margins on .new-inner have room to work;
       without flex:1 the body shrank to its content and the hero stuck to
       the top instead of sitting in the middle of the page. */
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 0;
    overflow: auto;
    padding: 24px 28px 40px;
}

.new-inner
{
    width: min(100%, 680px);
    flex: 0 0 auto;
    margin-block: auto;
}

.workspace_eyebrow
{
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: .1em;
    margin-bottom: 20px;
}

/* Compact header: a calm title and one quiet line, no eyebrow above it.
   The message box, not the copy, is the thing the eye should land on. */
.new-inner > h1
{
    text-align: center;
    font-size: clamp(20px, 2vw, 24px);
    font-weight: 560;
    letter-spacing: -.02em;
    margin-bottom: 6px;
    color: var(--text-strong);
}

.new-inner > .muted
{
    text-align: center;
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 14px;
}

/* Context ring: a small circle at the right of the composer controls, under
   the send key. It fills with how much of the model's context window the
   current draft would take, and turns to the accent only when nearly full. */
.ctx_ring
{
    width: 18px;
    height: 18px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ctx_ring svg
{
    width: 18px;
    height: 18px;
    transform: rotate(-90deg);
    overflow: visible;
}

.ctx_ring circle
{
    fill: none;
    stroke-width: 2.4;
}

.ctx_ring_track
{
    stroke: var(--ui_border);
}

.ctx_ring_fill
{
    stroke: var(--muted);
    stroke-linecap: round;
    stroke-dasharray: 56.549;
    stroke-dashoffset: 56.549;
    transition: stroke-dashoffset .2s ease, stroke .2s ease;
}

.ctx_ring.is-danger .ctx_ring_fill
{
    stroke: var(--accent);
}

/* A short note under the composer, e.g. the automatic-mode caveat. */
.new_approval_note
{
    margin: 8px 2px 0;
    font-size: 11px;
    line-height: 1.5;
    color: var(--muted);
    text-align: center;
}

/* Everything below the composer is secondary: one quiet block, set off
   from the primary compose area by a single hairline. */
.new-context
{
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--ui_border);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Continue-a-conversation: a short list of recent threads under the composer,
   so picking up where you left off is one click from the new-task screen. */
.new-recents
{
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--ui_border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.new-recents-head
{
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
}

.new-recents-list
{
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.new-recent
{
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    padding: 8px 10px;
    text-align: left;
    border: 1px solid transparent;
    border-radius: 8px;
    background: none;
    cursor: pointer;
    color: var(--text);
}

.new-recent:hover
{
    background: var(--ui_hover);
    border-color: var(--ui_border);
}

.new-recent-name
{
    font-size: 13px;
    font-weight: 550;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.new-recent-meta
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 11.5px;
    color: var(--muted);
}

.new-recent-bits
{
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.new-recent-when
{
    flex: none;
    color: var(--faint);
}

/* The working folder sits between the heading and the composer: pick where the
   work happens, then say what to do. Centred to match the heading and box. */
.task_context
{
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 0 12px;
    padding: 0;
    border: 0;
    background: none;
}

/* Working folder: a first-class pill (same vocabulary as the model/approval
   controls), not a bare form field. Clicking opens a small combobox popover. */
.folder_picker
{
    position: relative;
}

.folder_pill
{
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 8px 7px 9px;
    border-radius: 8px;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
    max-width: 100%;
}

.folder_pill::-webkit-details-marker
{
    display: none;
}
.folder_pill:hover,
.folder_picker[open] .folder_pill
{
    background: var(--ui_hover);
    color: var(--text);
}

.folder_glyph
{
    width: 15px;
    height: 15px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linejoin: round;
}

.folder_name
{
    font-weight: 550;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder_name.is-empty
{
    font-weight: 500;
    color: var(--muted);
}

.folder_server
{
    width: 14px;
    height: 14px;
    flex: none;
    fill: none;
    stroke: var(--faint);
    stroke-width: 1.3;
}

.folder_caret
{
    width: 14px;
    height: 14px;
    flex: none;
    fill: none;
    stroke: var(--faint);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .15s ease;
}

.folder_picker[open] .folder_caret
{
    transform: rotate(180deg);
}

/* A remote machine gets a small chip on the pill so a conversation that runs
   off the CoAgent server never reads as local. Local shows no chip. */
.folder_machine_chip
{
    flex: none;
    max-width: 40%;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* The machine row sits above the folder search inside the popover. */
.folder_machine
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
}

.folder_machine .ghost-select.pill
{
    background-color: var(--ui_hover);
    border-radius: 6px;
    color: var(--text);
    max-width: 62%;
}

.folder_panel
{
    position: absolute;
    z-index: 45;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    width: min(340px, 86vw);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid var(--ui_border);
    border-radius: 12px;
    background: var(--surface-raised);
    box-shadow: var(--shadow-pop);
}

.folder_search
{
    width: 100%;
    height: 32px;
    padding: 0 10px;
    font-size: 12.5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--text);
    border: 1px solid var(--hairline-strong);
    border-radius: 8px;
    background: var(--surface);
}

.folder_search:focus
{
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--focus-ring);
}

.folder_recents
{
    display: flex;
    flex-direction: column;
    gap: 1px;
    max-height: 210px;
    overflow-y: auto;
}

.folder_recent
{
    appearance: none;
    border: 0;
    background: none;
    text-align: left;
    font: inherit;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 7px;
    cursor: pointer;
}

.folder_recent:hover,
.folder_recent.is-active
{
    background: var(--ui_hover);
}

.folder_recent .fr_glyph
{
    width: 14px;
    height: 14px;
    flex: none;
    fill: none;
    stroke: var(--faint);
    stroke-width: 1.4;
    stroke-linejoin: round;
}

.folder_recent .fr_name
{
    flex: 1;
    min-width: 0;
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder_recent .fr_check
{
    flex: none;
    color: var(--accent);
    font-size: 12px;
}

.folder_recent.fr_create .fr_name
{
    color: var(--muted);
}
.folder_recent.fr_create .fr_plus
{
    color: var(--faint);
    flex: none;
}

.folder_empty
{
    padding: 8px;
    font-size: 11.5px;
    color: var(--faint);
    text-align: center;
}

.folder_note
{
    margin: 0;
    padding: 6px 8px 2px;
    border-top: 1px solid var(--ui_border);
    font-size: 11px;
    line-height: 1.5;
    color: var(--muted);
}

#newView .composer
{
    padding: 0;
    overflow: visible;
}

#newView .composer-box
{
    min-height: 92px;
    border-radius: 16px;
}

#newView .composer-input
{
    min-height: 90px;
}

#newView .options_panel
{
    bottom: auto;
    top: calc(100% + 8px);
    left: 0;
    right: auto;
}

.agent_picker
{
    margin: 0;
    border-top: 0;
}

.agent_picker > summary
{
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 2px;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
}

.agent_picker strong
{
    color: var(--text);
    font-weight: 550;
}

.picker_change
{
    margin-left: auto;
    font-size: 11px;
}

.picker_change::after
{
    content: '⌄';
    margin-left: 7px;
}

.agent_picker[open] .picker_change::after
{
    content: '⌃';
}

.agent-grid
{
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 8px 0 4px;
}

.agent-card, .agent-card:hover, .agent-card:active
{
    padding: 13px;
    border: 1px solid var(--ui_border);
    background: var(--surface);
    box-shadow: none;
    transform: none;
    animation: none;
    border-radius: 10px;
    gap: 7px;
}

.agent-card:hover
{
    background: var(--ui_hover);
}

.agent-card.is-active
{
    border-color: var(--text);
    background: var(--ui_hover);
    box-shadow: none;
}

.agent-dot
{
    background: var(--muted);
    width: 6px;
    height: 6px;
    box-shadow: none;
}

.agent-card.is-active .agent-dot
{
    background: var(--accent);
}

.agent-tag
{
    display: none;
}

.agent-name
{
    font-size: 12px;
}

.agent-desc
{
    font-size: 11.5px;
    line-height: 1.6;
    color: var(--muted);
}

.agent-meta
{
    color: var(--faint);
    font-size: 10px;
}

.empty-card
{
    width: min(100%, 600px);
    max-width: 600px;
}

.empty-card .brand-mark
{
    display: none;
}

.empty-card h1
{
    font-size: clamp(26px, 3vw, 34px);
    font-weight: 550;
    letter-spacing: -.035em;
    margin-bottom: 16px;
}

.empty-card .quick-grid
{
    margin-top: 26px;
    gap: 12px;
}

.quick-card
{
    min-width: 145px;
    border: 1px solid var(--ui_border);
    border-radius: 12px;
    box-shadow: none;
    background: var(--surface-raised);
    padding: 20px 16px;
}

.quick-icon
{
    color: var(--muted);
    background: var(--ui_hover);
    border-radius: 9px;
}

#emptyQuickHint
{
    margin-top: 20px;
}

.taskbar
{
    background: var(--ground);
    border-left: 1px solid var(--ui_border);
}

.taskbar-head
{
    height: 56px;
    padding: 0 16px;
    border-bottom: 1px solid var(--ui_border);
    margin-bottom: 14px;
}

.taskbar-head h2
{
    font-size: 13px;
}

.task-card
{
    background: var(--surface);
    border: 1px solid var(--ui_border);
    border-radius: 10px;
    padding: 14px;
    gap: 8px;
}

.palette
{
    border: 1px solid var(--ui_border);
    border-radius: 16px;
    box-shadow: var(--shadow-pop);
}

.icon-btn, .code-copy, summary, .nav-row, .list-item.conv
{
    cursor: pointer;
}

button:focus-visible, summary:focus-visible, .list-item:focus-visible
{
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.sidebar_restore, .sidebar_scrim
{
    display: none;
}

body.sidebar-collapsed .sidebar_restore
{
    display: inline-flex;
    position: absolute;
    top: 13px;
    left: 14px;
    z-index: 20;
}

body.sidebar-collapsed .view-head
{
    padding-left: 58px;
}

@media (max-width: 1180px)
{
    .taskbar
    {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(360px, 90vw);
        box-shadow: -8px 0 30px rgba(0, 0, 0, .12);
    }
}

@media (max-width: 900px)
{
    .sidebar, body.sidebar-collapsed .sidebar
    {
        position: fixed;
        width: min(300px, 84vw);
        min-width: 0;
        inset: 0 auto 0 0;
        z-index: 60;
        overflow: visible;
        transform: translateX(-105%);
        background: var(--ground);
    }

    .sidebar.is-open, body.sidebar-collapsed .sidebar.is-open
    {
        transform: translateX(0);
    }

    .sidebar_restore
    {
        display: inline-flex;
        position: absolute;
        top: 13px;
        left: 14px;
        z-index: 20;
    }

    body:has(.sidebar.is-open) .sidebar_scrim
    {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 55;
        border: 0;
        background: rgba(0, 0, 0, .35);
    }

    .view-head
    {
        padding-left: 58px;
        padding-right: 16px;
    }

    .thread, .composer
    {
        --ui_gutter: 24px;
    }

    #newView .new-body
    {
        padding-top: 48px;
    }
}

@media (max-width: 600px)
{
    :root
    {
        --ui_gutter: 16px;
    }

    .thread, .composer
    {
        --ui_gutter: 16px;
    }

    .thread
    {
        padding-top: 24px;
    }

    #newView .new-body
    {
        padding: 88px 20px 28px;
    }

    .new-inner > h1
    {
        font-size: 21px;
    }

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

    .composer_hint, .ws-pill
    {
        display: none;
    }

    .composer-controls
    {
        gap: 3px;
    }

    .composer-controls .ghost-select.pill
    {
        max-width: 150px;
    }

    .composer-controls .agent_select
    {
        max-width: 90px;
    }

    .composer_options .options_panel
    {
        position: fixed;
        top: auto !important;
        left: 16px !important;
        right: 16px !important;
        bottom: 125px;
        width: auto;
    }

    .quick-card
    {
        min-width: 0;
        padding: 16px 10px;
    }

    .empty-card .quick-grid
    {
        grid-template-columns: 1fr;
    }

    .view-actions .btn
    {
        padding: 4px 6px;
        font-size: 11px;
    }

    .composer
    {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}

@media (prefers-reduced-motion: reduce)
{
    *, *::before, *::after
    {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Interaction affordances */
#newConversationBtn
{
    justify-content: flex-start;
    gap: 10px;
    border: 0;
    background: transparent;
    box-shadow: none;
}

#newConversationBtn:hover
{
    background: var(--ui_selected);
}

.quick-card:hover
{
    transform: none;
    box-shadow: none;
    border-color: color-mix(in srgb, var(--text) 28%, transparent);
}

.composer-box:has(textarea:placeholder-shown) .send-key
{
    background: var(--ui_selected);
    color: var(--faint);
}

#taskbarToggle
{
    position: relative;
}

#taskbarToggle.has_activity::after
{
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
}

/* Navigation visibility */
body.sidebar-collapsed .sidebar
{
    visibility: hidden;
}

#chatView .view-head
{
    padding-left: 28px;
}

body.sidebar-collapsed #main .view-head
{
    padding-left: 58px;
}

@media (max-width: 900px)
{
    .sidebar
    {
        visibility: hidden;
    }

    .sidebar.is-open, body.sidebar-collapsed .sidebar.is-open
    {
        visibility: visible;
    }

    #main .view-head, #chatView .view-head
    {
        padding-left: 58px;
    }
}

@media (max-width: 600px)
{
    .composer-input
    {
        font-size: 16px;
    }
}

/* Compact mobile companion */
@media (max-width: 600px)
{
    body[data-view="new"] .cam-root, body[data-view="empty"] .cam-root
    {
        top: auto !important;
        left: auto !important;
        right: 12px !important;
        bottom: 20px !important;
        width: 96px !important;
    }
}

/* Thinking effort slider */
.effort_field
{
    gap: 12px;
}

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

.effort_heading output
{
    color: var(--text-strong);
    font-weight: 550;
    font-size: 12px;
}

.effort_range
{
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 24px;
    padding: 0;
    margin: 0;
    cursor: ew-resize;
    background: transparent;
    --effort_progress: 50%;
}

.effort_range::-webkit-slider-runnable-track
{
    height: 5px;
    border-radius: 99px;
    background: linear-gradient(to right, var(--text-strong) var(--effort_progress), var(--ui_selected) var(--effort_progress));
}

.effort_range::-moz-range-track
{
    height: 5px;
    border-radius: 99px;
    background: var(--ui_selected);
}

.effort_range::-moz-range-progress
{
    height: 5px;
    border-radius: 99px;
    background: var(--text-strong);
}

.effort_range::-webkit-slider-thumb
{
    appearance: none;
    -webkit-appearance: none;
    margin-top: -6px;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    border: 2px solid var(--surface-raised);
    background: var(--text-strong);
    box-shadow: 0 0 0 1px var(--ui_border);
}

.effort_range::-moz-range-thumb
{
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--surface-raised);
    background: var(--text-strong);
    box-shadow: 0 0 0 1px var(--ui_border);
}

.effort_range:focus-visible
{
    outline: 2px solid var(--accent);
    outline-offset: 4px;
    border-radius: 4px;
}

.effort_ticks
{
    display: flex;
    justify-content: space-between;
    gap: 3px;
    color: var(--faint);
    font-size: 10px;
}

/* Browser verification dialog */
.passkey_bridge_dialog
{
    max-width: 440px;
    padding: 28px;
    border: 1px solid var(--ui_border);
    border-radius: 18px;
    color: var(--text);
    background: var(--surface);
}
.passkey_bridge_dialog::backdrop
{
    background: #0006;
}
.passkey_bridge_dialog a, .passkey_bridge_dialog button
{
    display: inline-block;
    margin: 12px 12px 0 0;
    padding: 10px 14px;
}

.archived-toggle
{
    position: relative;
    display: flex;
    gap: 8px;
    min-height: 34px;
    margin: 6px 8px 12px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--muted);
    background: transparent;
    transition: background .15s, border-color .15s;
}
.archived-toggle:hover,
.archived-toggle:has(input:checked)
{
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}
.archived-toggle input
{
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}
.archived-toggle:has(input:focus-visible)
{
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.archive_icon
{
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
}
.archive_switch_track
{
    margin-left: auto;
    width: 26px;
    height: 16px;
    border-radius: 10px;
    background: var(--border);
    padding: 3px;
    box-sizing: border-box;
}
.archive_switch_track::after
{
    content: '';
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--muted);
    transition: transform .15s;
}
.archived-toggle input:checked ~ .archive_switch_track
{
    background: var(--accent);
}
.archived-toggle input:checked ~ .archive_switch_track::after
{
    background: white;
    transform: translateX(10px);
}
.local_file_list
{
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 100px;
    overflow: auto;
}
.local_file_item
{
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    background: var(--surface);
    font: inherit;
    max-width: 100%;
    overflow-wrap: anywhere;
    cursor: pointer;
}
.local_file_preview
{
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 40vh;
    min-height: 100px;
    overflow: auto;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    font-size: 12px;
    line-height: 1.6;
}

.composer,
.composer-box
{
    min-width: 0;
    max-width: 100%;
}
.composer-input
{
    box-sizing: border-box;
    flex: 1 1 0%;
    width: 0;
    min-width: 0;
    max-width: 100%;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-x: none;
}

/* ==========================================================================
   Usage view: token statistics across the workspace. Stat tiles for the
   headline numbers, sorted single-hue bars for the distribution. One neutral
   hue keeps the accent reserved; values are labelled directly.
   ========================================================================== */

.usage-body
{
    flex: 1;
    overflow-y: auto;
    padding: 24px max(20px, calc(50% - 380px)) 56px;
}

.usage-subtitle
{
    margin: 0 0 20px;
    font-size: 13px;
}

.usage-tiles
{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 8px;
}

.usage-tile
{
    border: 1px solid var(--ui_border);
    border-radius: 12px;
    padding: 14px 16px;
    background: var(--surface-raised);
}

.usage-tile-value
{
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -.02em;
    color: var(--text-strong);
    font-variant-numeric: tabular-nums;
}

.usage-tile-label
{
    margin-top: 3px;
    font-size: 12px;
    color: var(--muted);
}

.usage-section
{
    margin-top: 28px;
}

.usage-section-title
{
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.usage-bars
{
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.usage-bar-head
{
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.usage-bar-name
{
    font-size: 13px;
    color: var(--text);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.usage-bar-value
{
    flex: none;
    font-size: 12.5px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.usage-bar-meta
{
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--faint);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.usage-bar-track
{
    margin-top: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--ui_border);
    overflow: hidden;
}

.usage-bar-fill
{
    display: block;
    height: 100%;
    border-radius: 4px;
    background: color-mix(in srgb, var(--text) 32%, transparent);
    transition: width .3s ease;
}

.usage-empty, .usage-loading
{
    padding: 40px 0;
    text-align: center;
    font-size: 14px;
}
.usage-note
{
    margin-top: 16px;
    font-size: 12px;
}
