:root {
    color-scheme: light dark;
    --bg: #f5f5f2;
    --surface: #ffffff;
    --surface-2: #f0efe9;
    --text: #1c1c1a;
    --muted: #6a6a64;
    --line: #e0dfd9;
    --axis: #c3c2b7;
    --accent: #2e6b4c;
    --accent-text: #ffffff;
    --warn-bg: #fdf1dc;
    --warn-text: #74470a;
    --code-bg: #f0efe9;
    --danger: #b3261e;
    --shadow: 0 1px 2px rgb(28 28 26 / 6%);
    /* Status: a dot beside a label, never colour alone. */
    --good: #0ca30c;
    --warning: #fab219;
    /* Work going on, and action items (tasks.css). */
    --progress: #2563eb;
    --action: #7c3aed;
    --radius: 16px;
    --card-radius: 12px;
    font: 16px/1.5 system-ui, -apple-system, 'Segoe UI', sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #141413;
        --surface: #22221f;
        --surface-2: #2c2c28;
        --text: #ebeae4;
        --muted: #a2a199;
        --line: #33322e;
        --axis: #4a4944;
        --accent: #73c095;
        --accent-text: #0c1d14;
        --warn-bg: #382810;
        --warn-text: #f8d49a;
        --code-bg: #2c2c28;
        --danger: #d9473d;
        --shadow: none;
        --progress: #6ea8fe;
        --action: #b197fc;
    }
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    background: var(--bg);
    color: var(--text);
}

button,
input,
textarea {
    font: inherit;
    color: inherit;
}

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 999px;
    padding: 10px 18px;
    background: var(--accent);
    color: var(--accent-text);
    font-weight: 600;
    cursor: pointer;
}

button.quiet {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--line);
}

button.danger {
    background: var(--danger);
    color: #ffffff;
}

button.small {
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 500;
}

button:disabled {
    opacity: 0.5;
    cursor: default;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.icon {
    flex: none;
    width: 16px;
    height: 16px;
}

button .icon {
    width: 18px;
    height: 18px;
}

button.small .icon {
    width: 14px;
    height: 14px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* The header: NowPaw, the connection, the dock that shows and hides windows, and sign-out. */
.bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 8px 16px;
    padding-top: max(8px, env(safe-area-inset-top));
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.logo {
    width: 34px;
    height: 34px;
}

.bar h1 {
    margin: 0;
    font-size: 1.1rem;
}

.bar > button {
    padding: 6px 14px;
    font-size: 0.875rem;
}

.status {
    flex: 1;
    min-width: 0;
    margin: 0;
    color: var(--muted);
    font-size: 0.875rem;
}

.dock {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

.dock-button {
    position: relative;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 0.8125rem;
    font-weight: 500;
}

.dock-button .icon {
    width: 16px;
    height: 16px;
}

.dock-button:hover {
    border-color: var(--line);
}

.dock-button[aria-pressed='true'] {
    background: var(--surface-2);
    color: var(--text);
}

/* Narrower, the dock's buttons are icons (their names are still their labels), so the header stays one row: with
   nine windows' names, Undo, Reset and the usage pill it needs about 1,360 px. */
@media (max-width: 1380px) {
    .dock-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}

main {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.signin {
    display: grid;
    flex: 1;
    place-items: center;
    padding: 16px;
}

.card {
    display: grid;
    gap: 10px;
    width: 100%;
    max-width: 380px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.card h2,
.card p {
    margin: 0;
}

.card input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg);
}

.signin-face {
    justify-self: center;
}

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

.error {
    color: var(--warn-text);
}

/*
 * The windows: layout.js tiles the board with them, placing each absolutely in pixels from its layout tree and the
 * board's size, with the board's `gap` (which it reads) between neighbours. A window minimized, or stepped aside for
 * one maximized or focused, is out of view but still rendered, at the size it had: the camera's video keeps giving
 * frames, and the dashboard's frame keeps running.
 */
.board {
    position: relative;
    flex: 1;
    gap: 12px;
    min-height: 0;
    padding: 12px 16px 16px;
    overflow: hidden;
}

.widget {
    position: absolute;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--card-radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    transition:
        left 180ms ease,
        top 180ms ease,
        width 180ms ease,
        height 180ms ease;
}

/* Placed at once: on a resize of the board, and while a gap or a corner is dragged. */
.board.instant .widget,
.board.live .widget {
    transition: none;
}

.widget[data-state='minimized'],
.widget[data-state='aside'] {
    position: fixed;
    top: 0;
    left: 0;
    z-index: -1;
    visibility: hidden;
    pointer-events: none;
    transition: none;
}

/* Coming back onto the board. */
.widget.entering {
    animation: widget-in 200ms ease-out;
}

@keyframes widget-in {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
}

.widget-head {
    display: flex;
    flex: none;
    align-items: center;
    gap: 2px;
    height: 40px;
    padding: 0 6px 0 4px;
    border-bottom: 1px solid var(--line);
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.widget-title {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin: 0 0 0 2px;
    overflow: hidden;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.widget-title .icon {
    color: var(--muted);
}

.widget-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* The move handle, and minimize, maximize (or restore) and close. */
.widget-button {
    flex: none;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
}

.widget-button .icon {
    width: 16px;
    height: 16px;
}

.widget-button:hover {
    background: var(--surface-2);
    color: var(--text);
}

.widget-grip {
    cursor: grab;
}

.widget-close:hover {
    background: color-mix(in srgb, var(--danger) 14%, transparent);
    color: var(--danger);
}

/* A window's own buttons (addAction) come before minimize, a little apart from it. */
.widget-action + .widget-minimize {
    margin-left: 6px;
}

.widget-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 12px;
}

/* The resize corner: two short diagonal strokes. */
.widget-resize {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, transparent 52%, var(--muted) 52% 58%, transparent 58% 70%, var(--muted) 70% 76%, transparent 76%);
    cursor: nwse-resize;
    opacity: 0.45;
    touch-action: none;
}

.widget:hover .widget-resize,
.widget.resizing .widget-resize {
    opacity: 1;
}

/* The window being dragged by its title bar, in its place until it is let go. */
.widget.moving {
    border-style: dashed;
    border-color: var(--accent);
    box-shadow: none;
}

.widget.moving > * {
    opacity: 0.35;
}

/* While a window, a gap or a corner is dragged. Frames would take the pointer's events. */
body[data-drag] {
    user-select: none;
}

body[data-drag] iframe {
    pointer-events: none;
}

body[data-drag='move'],
body[data-drag='move'] * {
    cursor: grabbing !important;
}

body[data-drag='col'],
body[data-drag='col'] * {
    cursor: col-resize !important;
}

body[data-drag='row'],
body[data-drag='row'] * {
    cursor: row-resize !important;
}

body[data-drag='corner'],
body[data-drag='corner'] * {
    cursor: nwse-resize !important;
}

/*
 * Moving and pointing: the gaps that resize, where a dragged window would go, minimized windows in the dock, and the
 * ring and note that draw the eye to a window (highlight).
 */

/* The gap between two windows is a handle; a line shows in it on hover. */
.board-gutter {
    position: absolute;
    z-index: 2;
    touch-action: none;
}

.board-gutter[data-dir='row'] {
    cursor: col-resize;
}

.board-gutter[data-dir='column'] {
    cursor: row-resize;
}

.board-gutter::after {
    position: absolute;
    inset: 0;
    margin: auto;
    border-radius: 2px;
    background: var(--accent);
    opacity: 0;
    transition: opacity 120ms ease;
    content: '';
}

.board-gutter[data-dir='row']::after {
    width: 2px;
}

.board-gutter[data-dir='column']::after {
    height: 2px;
}

.board-gutter:hover::after,
.board-gutter.active::after {
    opacity: 1;
}

/* What follows the pointer while a window is dragged, and where it would go. */
.widget-ghost {
    position: fixed;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: var(--surface);
    box-shadow: 0 8px 24px rgb(0 0 0 / 18%);
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
}

.widget-ghost .icon {
    color: var(--accent);
}

.drop-preview {
    position: absolute;
    z-index: 3;
    display: grid;
    place-items: center;
    border: 2px solid var(--accent);
    border-radius: var(--card-radius);
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    pointer-events: none;
    transition:
        left 120ms ease,
        top 120ms ease,
        width 120ms ease,
        height 120ms ease;
}

.drop-label {
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-text);
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}

/* A window minimized, or stepped aside for one maximized or focused: still working, with a dot under its button. */
.dock-button.minimized {
    color: var(--text);
}

.dock-button.minimized::after {
    position: absolute;
    bottom: 1px;
    left: 50%;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    transform: translateX(-50%);
    content: '';
}

/* highlight: a ring that pulses a few times around the window, and a note pointing at what to look at. */
.widget.attention {
    z-index: 1;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
    animation: attention 850ms ease-out 3;
}

.widget.entering.attention {
    animation:
        widget-in 200ms ease-out,
        attention 850ms ease-out 3;
}

/* A part of the page outside the windows, such as a dock button, ringed the same way. */
.pointed {
    box-shadow: 0 0 0 2px var(--accent);
    animation: attention 850ms ease-out 3;
}

@keyframes attention {
    from {
        box-shadow:
            0 0 0 2px var(--accent),
            0 0 0 2px color-mix(in srgb, var(--accent) 60%, transparent);
    }
    to {
        box-shadow:
            0 0 0 2px var(--accent),
            0 0 0 12px color-mix(in srgb, var(--accent) 0%, transparent);
    }
}

.callout {
    position: fixed;
    z-index: 40;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: min(300px, calc(100vw - 16px));
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--accent);
    color: var(--accent-text);
    box-shadow: 0 10px 28px rgb(0 0 0 / 22%);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    animation: callout-in 180ms ease-out;
}

.callout .icon {
    margin-top: 1px;
}

.callout-text {
    margin: 0;
    overflow-wrap: anywhere;
}

.callout::before {
    position: absolute;
    left: var(--arrow-x, 50%);
    width: 12px;
    height: 12px;
    margin-left: -6px;
    border-radius: 2px;
    background: inherit;
    transform: rotate(45deg);
    content: '';
}

.callout[data-place='below']::before {
    top: -5px;
}

.callout[data-place='above']::before {
    bottom: -5px;
}

@keyframes callout-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .widget,
    .drop-preview {
        transition: none;
    }

    .widget.entering,
    .widget.attention,
    .widget.entering.attention,
    .pointed,
    .callout {
        animation: none;
    }
}

/* Chat */
.chat-body {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.log {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 760px;
    margin: 0 auto;
    padding: 0;
    list-style: none;
}

#live:not(:empty) {
    margin-top: 10px;
}

.message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: var(--radius);
    overflow-wrap: anywhere;
}

.message .text {
    margin: 0;
    white-space: pre-wrap;
}

/* Answers are rendered Markdown (markdown.js). */
.message .text.md {
    white-space: normal;
}

.md > * {
    margin: 0;
}

.md > * + * {
    margin-top: 0.6em;
}

.md .heading {
    font-weight: 600;
}

.md ul,
.md ol {
    padding-left: 1.4em;
    list-style: disc;
}

.md ol {
    list-style: decimal;
}

.md li + li {
    margin-top: 0.2em;
}

.md code {
    font: 0.875em/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
    padding: 0.1em 0.3em;
    border-radius: 4px;
    background: var(--code-bg);
}

.md pre {
    overflow-x: auto;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--code-bg);
    font: 0.875em/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
    white-space: pre;
}

.md pre code {
    padding: 0;
    background: none;
    font: inherit;
}

.md blockquote {
    padding-left: 10px;
    border-left: 3px solid var(--line);
    color: var(--muted);
}

.md hr {
    border: 0;
    border-top: 1px solid var(--line);
}

.md a {
    color: inherit;
    text-decoration: underline;
}

.message.user {
    align-self: flex-end;
    background: var(--accent);
    color: var(--accent-text);
    border-bottom-right-radius: 4px;
}

.message.assistant {
    align-self: flex-start;
    background: var(--surface);
    border: 1px solid var(--line);
    border-bottom-left-radius: 4px;
}

.message.pending {
    opacity: 0.6;
}

.label {
    display: block;
    font-size: 0.75rem;
    opacity: 0.75;
}

.note {
    align-self: center;
    max-width: 85%;
    padding: 6px 12px;
    border-radius: 10px;
    background: var(--warn-bg);
    color: var(--warn-text);
    font-size: 0.875rem;
}

.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    align-self: center;
    margin: 24px 0;
    color: var(--muted);
    text-align: center;
}

.empty img {
    margin-bottom: 8px;
}

.empty strong {
    color: var(--text);
    font-size: 1.05rem;
}

.dots {
    display: inline-flex;
    gap: 4px;
    padding: 6px 0;
}

/* What NowPaw is doing while a tool runs, beside the dots. */
.message.working {
    display: flex;
    align-items: center;
    gap: 10px;
}

.activity {
    color: var(--muted);
    font-size: 0.875rem;
}

.dots i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted);
    animation: pulse 1.2s infinite ease-in-out;
}

.dots i:nth-child(2) {
    animation-delay: 0.2s;
}

.dots i:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse {
    0%,
    80%,
    100% {
        opacity: 0.25;
    }
    40% {
        opacity: 1;
    }
}

.composer {
    display: flex;
    flex: none;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
}

.composer textarea {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    max-height: 200px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--bg);
    resize: none;
}

.composer button {
    min-height: 44px;
}

.message.ask {
    align-self: flex-end;
    max-width: 85%;
    padding: 0 6px;
    color: var(--muted);
    font-size: 0.8125rem;
}

/* Voice: NowPaw's face shows what it is doing, then the newest line said. Centred while it fits; when the window is
   too short, it starts at the top and scrolls, rather than losing the face above the top edge. */
.voice-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: safe center;
    gap: 8px;
    text-align: center;
}

.voice-body p {
    margin: 0;
}

.voice-body button {
    padding: 8px 16px;
}

.voice-idle,
.voicebar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-width: 0;
}

.face {
    position: relative;
    display: grid;
    flex: none;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--surface-2);
    place-items: center;
}

.face::after {
    position: absolute;
    inset: -4px;
    border: 3px solid transparent;
    border-radius: 50%;
    content: '';
}

.face[data-state='listening']::after {
    border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.face[data-state='hearing']::after {
    border-color: var(--accent);
    animation: ring 1.1s ease-out infinite;
}

.face[data-state='connecting']::after,
.face[data-state='thinking']::after {
    border-color: var(--line);
    border-top-color: var(--accent);
    animation: spin 0.9s linear infinite;
}

.face[data-state='speaking']::after {
    border-color: var(--accent);
}

.face[data-state='speaking'] img {
    animation: bob 0.8s ease-in-out infinite;
}

@keyframes ring {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(1.16);
        opacity: 0;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes bob {
    50% {
        transform: translateY(-4px);
    }
}

.voice-state {
    font-weight: 600;
}

.voice-line {
    max-width: 100%;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.875rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Camera */
.camera-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 8px;
}

.camera-view {
    position: relative;
    display: grid;
    flex: 1;
    width: 100%;
    min-height: 96px;
    overflow: hidden;
    border-radius: 8px;
    background: #141413;
    place-items: center;
}

.preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.camera-hint {
    max-width: 30ch;
    margin: 0;
    padding: 12px;
    color: #c9c8c2;
    font-size: 0.8125rem;
    text-align: center;
}

/* Dashboard: NowPaw's live widgets and the code it ran, one at a time, with the console of a widget under it. */
.canvas-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.canvas-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
}

.canvas-title {
    flex: 1;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: 0.9375rem;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.canvas-making,
.canvas-count {
    color: var(--muted);
    font-size: 0.8125rem;
    white-space: nowrap;
}

.canvas-bar button.small {
    padding: 4px 6px;
}

/* The stage takes the window's remaining height; a widget fills it. */
.canvas-stage {
    position: relative;
    flex: 1;
    min-height: 140px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--card-radius);
    background: var(--surface);
}

.canvas-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.canvas-code {
    position: absolute;
    inset: 0;
    overflow: auto;
    padding: 10px 12px;
}

.canvas-label {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.canvas-pre {
    margin: 0 0 12px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--code-bg);
    font: 0.8125rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.canvas-pre.failed,
.canvas-status.failed {
    color: var(--danger);
}

.canvas-status {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 0.8125rem;
}

.canvas-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: safe center;
    gap: 8px;
    padding: 16px;
    overflow: auto;
    text-align: center;
}

.canvas-empty p {
    max-width: 44ch;
    margin: 0;
    color: var(--muted);
    font-size: 0.875rem;
}

.canvas-examples {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 4px;
}

.canvas-console {
    font-size: 0.8125rem;
}

.canvas-console summary {
    color: var(--muted);
    cursor: pointer;
}

.canvas-console ol {
    max-height: 7.5em;
    margin: 4px 0 0;
    padding: 6px 10px;
    overflow: auto;
    border-radius: 8px;
    background: var(--code-bg);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    list-style: none;
}

.canvas-console li {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.canvas-console li.error {
    color: var(--danger);
}

.canvas-console li.warn {
    color: var(--warn-text);
}

/* In the chat: a widget or a script, which opens it on the dashboard. */
.message.work {
    padding: 0;
}

.message.work button {
    max-width: 100%;
}

.work-failed {
    color: var(--muted);
    font-size: 0.8125rem;
}

/* Tools and apps: rows with a status. */
.list {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
}

.list-row {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    border-bottom: 1px solid var(--line);
}

.list-row:last-child {
    border-bottom: 0;
}

.list-row > .icon {
    color: var(--muted);
}

.list-text {
    display: grid;
    min-width: 0;
}

.list-name {
    overflow: hidden;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.list-detail {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.75rem;
    line-height: 1.35;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--axis);
}

.chip.good .dot {
    background: var(--good);
}

.chip.warning .dot {
    background: var(--warning);
}

/* A row's own small button (panels.js), such as Connect Google, and a chip beside one. */
.row-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.row-button {
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.75rem;
    white-space: nowrap;
    cursor: pointer;
}

.row-button:hover:not(:disabled) {
    background: var(--surface-2);
}

.row-button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.recent {
    display: grid;
    gap: 4px;
    margin: 8px 0 0;
    padding: 0 0 0 28px;
    color: var(--muted);
    font-size: 0.8125rem;
    list-style: none;
}

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

@media (prefers-reduced-motion: reduce) {
    .dots i {
        animation: none;
        opacity: 0.6;
    }

    .face::after,
    .face img {
        animation: none !important;
    }
}

/*
 * A phone: the windows shown stack in one column in reading order (layout.js sets their `order`), the chat as tall as
 * the screen and the rest as tall as their content. A window maximized is shown alone, as tall as the screen.
 */
@media (max-width: 760px) {
    .bar {
        padding-right: 12px;
        padding-left: 12px;
    }

    .dock {
        order: 1;
        width: 100%;
        justify-content: space-between;
    }

    .board {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 8px;
        overflow-y: auto;
    }

    .widget {
        position: relative;
        flex: none;
        transition: none;
    }

    .widget[data-widget='chat'],
    .board[data-mode] .widget[data-state='open'] {
        height: var(--board-height, 70vh);
    }

    .board[data-mode] .widget[data-state='open'] .canvas-stage {
        flex: 1;
        height: auto;
    }

    .board-gutter {
        display: none;
    }

    .camera-view {
        flex: none;
        aspect-ratio: 4 / 3;
    }

    .canvas-stage {
        flex: none;
        height: 60vh;
    }

    .widget-resize {
        display: none;
    }

    /* Send as its icon alone (its name stays its label), so the message box has room for "Message NowPaw". */
    #send .button-label {
        display: none;
    }
}

/*
 * The chat's extras (app.js): what goes with the next message (pictures, files, the shared screen), New chat's
 * question, Compact's summary, pictures and files in messages, the chat window's title-bar actions, and the question
 * a tool asks before it does something outward-facing.
 */

/* Frames of the shared screen are drawn from this video, which must be rendered to play, but not seen. */
.offscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 2px;
    height: 2px;
    opacity: 0;
    pointer-events: none;
}

.composer {
    flex-wrap: wrap;
}

.composer .icon-only {
    flex: none;
    width: 44px;
    padding: 0;
    justify-content: center;
}

.composer .icon-only[aria-pressed='true'] {
    border-color: var(--accent);
    color: var(--accent);
}

.attachments {
    display: flex;
    flex-basis: 100%;
    flex-wrap: wrap;
    gap: 6px;
}

.attachments[hidden] {
    display: none;
}

.attachment {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 240px;
    min-height: 36px;
    padding: 3px 4px 3px 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg);
    font-size: 0.8125rem;
}

.attachment img {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    object-fit: cover;
}

.attachment .icon {
    flex: none;
    width: 16px;
    height: 16px;
}

.attachment-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.composer .attachment-remove {
    flex: none;
    min-height: 0;
    padding: 2px 6px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 0.8125rem;
}

.attachment-remove .icon {
    width: 14px;
    height: 14px;
}

.attachment.screen-chip {
    border-color: var(--accent);
}

.widget.dropping {
    outline: 2px dashed var(--accent);
    outline-offset: -6px;
}

.confirm-bar {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--line);
    background: var(--warn-bg);
    color: var(--warn-text);
}

.confirm-bar[hidden] {
    display: none;
}

.confirm-bar p {
    flex: 1;
    min-width: 12em;
    margin: 0;
    font-size: 0.875rem;
}

.thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.thumb img {
    display: block;
    max-width: 180px;
    max-height: 130px;
    border-radius: 8px;
    object-fit: cover;
}

.file-block {
    margin-top: 6px;
}

.file-block summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.file-block summary .icon {
    width: 16px;
    height: 16px;
}

.file-block pre {
    max-height: 240px;
    margin: 6px 0 0;
    overflow: auto;
    font-size: 0.8125rem;
    white-space: pre-wrap;
}

.message.summary {
    align-self: stretch;
    max-width: none;
    padding: 8px 12px;
    border: 1px dashed var(--line);
    border-radius: var(--card-radius);
    color: var(--muted);
}

.message.summary summary {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.875rem;
}

.message.summary summary .icon {
    width: 16px;
    height: 16px;
}

.message.summary .text {
    margin-top: 8px;
    color: var(--text);
}

.widget-action {
    flex: none;
    width: 28px;
    height: 28px;
    min-height: 0;
    padding: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
}

.widget-action:hover {
    background: var(--bg);
    color: var(--text);
}

.ask-dialog {
    max-width: min(440px, calc(100vw - 32px));
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 12px 40px rgb(0 0 0 / 25%);
}

.ask-dialog::backdrop {
    background: rgb(0 0 0 / 45%);
}

.ask-dialog h2 {
    margin: 0 0 8px;
    font-size: 1.0625rem;
}

.ask-dialog p {
    margin: 0;
    white-space: pre-wrap;
}

/* The question, then what would go out, quoted (app.js, askPerson); the blank line between them doesn't show. */
.ask-question {
    font-weight: 500;
}

.ask-quote {
    max-height: 9.5em;
    margin: 10px 0 0;
    padding: 8px 12px;
    overflow: auto;
    border-left: 3px solid var(--line);
    border-radius: 0 8px 8px 0;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.875rem;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.ask-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}

/* The usage pill in the bar, and its dialog (usage.js). */
.usage-pill {
    flex: none;
    padding: 4px 10px;
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
}

.usage-dialog {
    max-width: min(560px, calc(100vw - 32px));
}

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

.usage-tile {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--card-radius);
    background: var(--surface-2);
}

.usage-dialog .usage-tile p {
    margin: 0;
    white-space: normal;
}

.usage-label,
.usage-detail {
    color: var(--muted);
    font-size: 0.8125rem;
}

.usage-value {
    font-size: 1.5rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.usage-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
}

.usage-table caption {
    margin-bottom: 4px;
    color: var(--muted);
    text-align: left;
}

.usage-table th,
.usage-table td {
    padding: 4px 6px;
    border-bottom: 1px solid var(--line);
    text-align: right;
}

.usage-table th:first-child {
    overflow-wrap: anywhere;
    text-align: left;
}

.usage-table thead th {
    color: var(--muted);
    font-weight: 500;
}

.usage-dialog .usage-note {
    margin-top: 12px;
    font-size: 0.8125rem;
    white-space: normal;
}

