/* No framework, no CDN: the CSP allows nothing from elsewhere. */

/* --- tokens -------------------------------------------------------------- */

:root {
    color-scheme: light;

    --bg: #f7f8fa;
    --surface: #ffffff;
    --surface-2: #fafbfc;
    --surface-hover: #f4f6f9;
    --sunken: #fcfcfd;

    --line: #e4e7ec;
    --line-strong: #d0d5dd;

    --fg: #171a1f;
    --fg-soft: #3d434d;
    --muted: #6a717c;

    --accent: #3b6fa8;
    --accent-dim: #5b87ba;
    --accent-fg: #ffffff;

    --ok: #2f7d5c;
    --ok-soft: rgba(47, 125, 92, 0.08);
    --warn: #9a6b17;
    --bad: #c0505f;
    --bad-soft: rgba(192, 80, 95, 0.08);
    --danger: #a53d4c;

    --console-bg: #14171c;
    --console-fg: #d3d8e0;

    --radius: 8px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-float: 0 16px 40px -20px rgba(16, 24, 40, 0.28);

    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* --- page ---------------------------------------------------------------- */

body {
    font-family: var(--sans);
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
    text-underline-offset: 0.2em;
}
a:hover { text-decoration-color: currentColor; }

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

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* --- topbar -------------------------------------------------------------- */

#topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 1.4em;
    padding: 0.75em 1.5em;
    background: #1b2733;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    color: #fff;
}
#topbar a {
    color: #c3ccd5;
    text-decoration: none;
    font-size: 0.86em;
}
#topbar a:hover { color: #fff; }
#topbar .brand {
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    font-weight: 700;
    font-size: 1em;
    color: #fff;
}
#topbar .brand::before { content: "\1F477\1F3FD"; }
#topbar .spacer { flex: 1; }
#topbar { flex-wrap: wrap; row-gap: 0.5em; }
#topbar .server { display: flex; flex-wrap: wrap; gap: 0.4em 1.1em; font-size: 0.78em; color: #c3ccd5; font-variant-numeric: tabular-nums; }
#topbar .stat { display: inline-flex; align-items: center; gap: 0.45em; white-space: nowrap; }
#topbar .stat .k { color: #8796a6; text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.9em; }
#topbar .meter { width: 34px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.15); overflow: hidden; }
#topbar .meter > span { display: block; height: 100%; background: #c3ccd5; }
#topbar .loads { display: inline-flex; gap: 0.75em; }
#topbar .stat.high { color: #ffb4a8; }
#topbar .stat.high .meter > span { background: #ff8a78; }
#topbar .counts {
    font-family: var(--mono);
    font-size: 0.78em;
    color: #c3ccd5;
    white-space: nowrap;
}

main { padding: 2em 1.5em 4em; max-width: 78rem; margin: 0 auto; }

/* --- headings ------------------------------------------------------------ */

h1, h2, h3 { letter-spacing: -0.01em; }

h2 {
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin: 2.2em 0 0.8em;
}
h2:first-child { margin-top: 0; }

/* --- page head: primary action left, overflow menu right ----------------- */

.page-head {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin-bottom: 1.4em;
}
.page-head .spacer { flex: 1; }
.page-head button { margin: 0; }

.menu { position: relative; }

button.menu-button {
    width: 2.2em;
    height: 2.2em;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}
button.menu-button::before {
    content: "";
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
}
button.menu-button[aria-expanded="true"] { color: var(--fg); background: var(--surface-hover); }

.menu-list {
    position: absolute;
    right: 0;
    top: calc(100% + 0.4em);
    z-index: 20;
    min-width: 14rem;
    padding: 0.3em;
    background: var(--surface);
    border: thin solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-float);
}
.menu-list[hidden] { display: none; }
.menu-list button {
    display: block;
    width: 100%;
    margin: 0;
    text-align: left;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    padding: 0.5em 0.7em;
    font-size: 0.86em;
    color: var(--fg-soft);
}
.menu-list button:hover:not(:disabled) {
    background: var(--surface-hover);
    color: var(--fg);
    border-color: transparent;
}

/* --- dialogs ------------------------------------------------------------- */
 
dialog.modal {
    width: min(38rem, calc(100vw - 2rem));
    padding: 0;
    border: thin solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--fg);
    box-shadow: var(--shadow-float);
}
dialog.modal::backdrop {
    background: rgba(8, 10, 13, 0.6);
    backdrop-filter: blur(2px);
}
dialog.modal .modal-head {
    display: flex;
    align-items: center;
    gap: 1em;
    padding: 1.1em 1.4em;
    border-bottom: thin solid var(--line);
}
dialog.modal .modal-head h2 {
    margin: 0;
    font-size: 0.95em;
    letter-spacing: -0.01em;
    text-transform: none;
    color: var(--fg);
}
dialog.modal .modal-head .spacer { flex: 1; }
dialog.modal .modal-body { padding: 1.4em; }
dialog.modal .modal-body > :first-child { margin-top: 0; }
dialog.modal .modal-foot {
    display: flex;
    align-items: center;
    gap: 0.5em;
    padding: 1em 1.4em;
    border-top: thin solid var(--line);
    background: var(--surface-2);
}
dialog.modal .modal-foot .spacer { flex: 1; }
dialog.modal .modal-foot button { margin: 0; }

button.close {
    width: 1.9em;
    height: 1.9em;
    padding: 0;
    position: relative;
    color: var(--muted);
    flex: 0 0 auto;
}
button.close::before, button.close::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0.8em;
    height: 1px;
    background: currentColor;
}
button.close::before { transform: translate(-50%, -50%) rotate(45deg); }
button.close::after { transform: translate(-50%, -50%) rotate(-45deg); }

/* --- status -------------------------------------------------------------- */

.dot {
    display: inline-block;
    width: 0.5em;
    height: 0.5em;
    border-radius: 50%;
    margin-right: 0.55em;
    vertical-align: middle;
    background: var(--muted);
}
.st-running .dot { background: var(--ok); }
.st-stopped .dot { background: var(--muted); }
.st-error .dot { background: var(--bad); }
.st-starting .dot { background: var(--warn); }

.status {
    white-space: nowrap;
    font-size: 0.85em;
    color: var(--fg-soft);
}
.st-running { color: var(--ok); }
.st-error { color: var(--bad); }
.st-starting { color: var(--warn); }

/* --- surfaces ------------------------------------------------------------ */

.panel-box {
    background: var(--surface);
    border: thin solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel-box { padding: 1.3em 1.4em; }

.name {
    font-weight: 600;
    text-decoration: none;
    color: var(--fg);
}
.name:hover { color: var(--accent); }

.muted { color: var(--muted); font-size: 0.85em; }
code, pre { font-family: var(--mono); }
code {
    font-size: 0.9em;
    padding: 0.1em 0.35em;
    border-radius: 3px;
    background: var(--surface-2);
    border: thin solid var(--line);
    color: var(--fg-soft);
}

/* --- agent cards --------------------------------------------------------- */
 
.agent-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1em;
}
@media (max-width: 1080px) { .agent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .agent-grid { grid-template-columns: 1fr; } }
.agent-grid[hidden] { display: none; }

.agent-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: thin solid var(--line);
    border-radius: var(--radius);
    padding: 1.1em 1.2em;
    box-shadow: var(--shadow);
    transition: border-color 0.12s;
}
.agent-card:hover { border-color: var(--line-strong); }

.card-head {
    display: flex;
    align-items: baseline;
    gap: 0.9em;
}
.card-head .name {
    flex: 1;
    min-width: 0;
    font-size: 1.05em;
    overflow-wrap: anywhere;
}
.card-head .status { flex: 0 0 auto; }

.card-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.15em 0.9em;
    margin: 0.9em 0 0;
    font-size: 0.8em;
}
.card-meta dt { color: var(--muted); }
.card-meta dd { margin: 0; color: var(--fg-soft); overflow-wrap: anywhere; }
.card-meta dd.refused { color: var(--bad); }

/* --- controls ------------------------------------------------------------ */

button {
    font: inherit;
    font-size: 0.85em;
    padding: 0.45em 0.9em;
    margin-left: 0.3em;
    border: thin solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--fg-soft);
    cursor: pointer;
    transition: color 0.12s, border-color 0.12s, background 0.12s;
}
button:hover:not(:disabled) {
    color: var(--fg);
    border-color: var(--muted);
    background: var(--surface-hover);
}
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.danger:hover:not(:disabled) { color: var(--bad); border-color: var(--bad); }
button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-fg);
    font-weight: 600;
}
button.primary:hover:not(:disabled) {
    background: color-mix(in srgb, var(--accent) 88%, white);
    border-color: color-mix(in srgb, var(--accent) 88%, white);
    color: var(--accent-fg);
}

input, select, textarea {
    font: inherit;
    font-size: 0.92em;
    padding: 0.55em 0.7em;
    border: thin solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--sunken);
    color: var(--fg);
    width: 100%;
    transition: border-color 0.12s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.75; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-dim);
}
select {
    cursor: pointer;
    appearance: none;
    padding-right: 2.2em;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236b727d' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8em center;
}
textarea { font-family: var(--mono); font-size: 0.85em; line-height: 1.6; }

label {
    display: block;
    font-size: 0.8em;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 0.35em;
}
.field { margin-bottom: 1.1em; }
.field:last-child { margin-bottom: 0; }
.row { margin-bottom: 1.1em; }
.row:last-child { margin-bottom: 0; }
.row > .field { margin-bottom: 0; }

/* --- banners ------------------------------------------------------------- */

.banner {
    padding: 0.75em 1em;
    border-radius: var(--radius-sm);
    margin-bottom: 1em;
    font-size: 0.88em;
    border: thin solid var(--line);
    background: var(--surface-2);
    color: var(--fg-soft);
}
.banner.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); color: var(--bad); }
.banner.info { background: var(--surface-2); border-color: var(--line); color: var(--fg-soft); }
.banner.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 28%, transparent); color: var(--ok); }
.banner code { word-break: break-all; background: transparent; border-color: currentColor; opacity: 0.85; }

/* --- layout helpers ------------------------------------------------------ */

.row { display: flex; gap: 1.1em; align-items: flex-end; }
.row > * { flex: 1; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.3em; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }

.empty {
    color: var(--muted);
    padding: 3.5em 2em;
    text-align: center;
    font-size: 0.9em;
    border: thin solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.hint {
    font-size: 0.85em;
    color: var(--muted);
    margin: 0.5em 0 0;
    line-height: 1.6;
}

.toolbar {
    display: flex;
    gap: 0.5em;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0.9em;
}
.toolbar .grow { flex: 1; font-size: 0.9em; }
.toolbar label {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.45em;
    white-space: nowrap;
}
.toolbar select, .toolbar input { width: auto; }
.toolbar input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; }

.actions-grid { display: flex; flex-wrap: wrap; gap: 0.45em; margin-bottom: 1em; }
.actions-grid button { margin: 0; }

.facts {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.35em 1.2em;
    font-size: 0.86em;
    margin-top: 0.7em;
}
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.row-tight { display: flex; gap: 0.45em; align-items: stretch; }
.row-tight input { flex: 1; font-family: var(--mono); font-size: 0.85em; }
.row-tight button { margin: 0; white-space: nowrap; }
.facts dd.row-tight { align-items: center; }
.facts dd .value { flex: 1; overflow-wrap: anywhere; }
.facts dd button { padding: 0.2em 0.6em; font-size: 0.8em; }

.oauth-step { margin-bottom: 1.1em; }
.step-label { display: block; font-weight: 600; font-size: 0.88em; margin-bottom: 0.4em; color: var(--fg); }

/* --- sign in ------------------------------------------------------------- */

form.signin {
    max-width: 22rem;
    margin: 6em auto;
    background: var(--surface);
    border: thin solid var(--line);
    border-radius: var(--radius);
    padding: 2em;
    box-shadow: var(--shadow);
}
form.signin h2 {
    margin: 0 0 1.4em;
    font-size: 0.95em;
    text-transform: none;
    letter-spacing: -0.01em;
    color: var(--fg);
}
form.signin button { width: 100%; margin: 0.8em 0 0; padding: 0.65em; font-size: 0.9em; }

/* --- confirm-in-place ---------------------------------------------------- */
 
button.armed {
    background: var(--bad-soft);
    border-color: var(--bad);
    color: var(--bad);
    font-weight: 600;
}
button.armed:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

/* --- tabs ---------------------------------------------------------------- */

.tabs {
    display: flex;
    gap: 0.1em;
    border-bottom: thin solid var(--line);
    margin: 1.8em 0 1.4em;
    flex-wrap: wrap;
}
.tabs button {
    margin: 0;
    border: none;
    border-bottom: 1px solid transparent;
    border-radius: 0;
    background: none;
    padding: 0.7em 0.95em;
    font-size: 0.88em;
    color: var(--muted);
}
.tabs button:hover { color: var(--fg); background: none; }
.tabs button[aria-selected="true"] {
    color: var(--fg);
    border-bottom-color: var(--accent);
    font-weight: 600;
}
.tabpanel[hidden] { display: none; }

/* --- console surfaces ---------------------------------------------------- */

pre.console {
    background: var(--console-bg);
    color: var(--console-fg);
    border: thin solid var(--line);
    padding: 1em 1.1em;
    border-radius: var(--radius-sm);
    overflow: auto;
    max-height: 70vh;
    font-size: 0.8em;
    line-height: 1.65;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    tab-size: 2;
}

pre.console.full {
    max-height: none;
    overflow: visible;
}
pre.console:empty::before { content: "-"; opacity: 0.4; }

/* --- logs ---------------------------------------------------------------- */

.logview {
    background: var(--console-bg);
    border: thin solid var(--line);
    border-radius: var(--radius-sm);
    padding: 0.9em 0.2em 0.9em 0;
    height: 70vh;
    overflow: auto;
    font-family: var(--mono);
    font-size: 0.78em;
    line-height: 1.7;
}
.logview .line {
    display: grid;
    grid-template-columns: 5.5em 4.6em 1fr;
    gap: 0.8em;
    padding: 0.05em 1.1em;
    white-space: pre-wrap;
    word-break: break-word;
}
.logview .line:hover { background: rgba(255, 255, 255, 0.03); }
.logview .ts { color: #5a626d; text-align: right; }
.logview .lvl { font-weight: 600; }
.logview .msg { color: var(--console-fg); }
.lvl-info { color: var(--accent); }
.lvl-warning { color: var(--warn); }
.lvl-error { color: var(--bad); }
.logview .line.is-error { box-shadow: inset 2px 0 0 var(--bad); }
.logview .line.is-warning { box-shadow: inset 2px 0 0 var(--warn); }

/* --- sessions: list on the left, transcript on the right ----------------- */

.session-split {
    display: grid;
    grid-template-columns: 22rem 1fr;
    gap: 1.1em;
    align-items: start;
}
@media (max-width: 900px) { .session-split { grid-template-columns: 1fr; } }

.session-list {
    max-height: 70vh;
    overflow-y: auto;
    border: thin solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}
.session-item {
    border-bottom: thin solid var(--line);
    font-size: 0.88em;
}
.session-item:last-child { border-bottom: none; }
.session-item:hover { background: var(--surface-hover); }
.session-item[aria-current="true"] {
    background: var(--surface-hover);
    box-shadow: inset 2px 0 0 var(--accent);
}

.session-open {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    border-radius: 0;
    margin: 0;
    padding: 0.75em 0.9em 0.4em;
    background: none;
    cursor: pointer;
    font-size: inherit;
    color: inherit;
}
.session-open:hover { border-color: transparent; color: inherit; background: none; }
.session-open .title { font-weight: 600; display: block; color: var(--fg); }
.session-open .sid {
    display: block;
    font-family: var(--mono);
    font-size: 0.8em;
    color: var(--muted);
    word-break: break-all;
    margin-top: 0.2em;
}
.session-open .count { color: var(--muted); font-size: 0.8em; }

.session-actions {
    display: flex;
    gap: 0.35em;
    padding: 0 0.9em 0.7em;
}
.session-actions button { margin: 0; font-size: 0.78em; padding: 0.3em 0.6em; }

.transcript {
    max-height: 70vh;
    overflow-y: auto;
    border: thin solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 1.1em 1.2em;
}

/* --- messages and chat --------------------------------------------------- */

.msg {
    border-left: 2px solid var(--line-strong);
    padding: 0.5em 0 0.5em 0.9em;
    margin-bottom: 0.9em;
}
.msg .who {
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 0.3em;
}
.msg .body {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.9em;
    line-height: 1.6;
    color: var(--fg-soft);
}
.msg-user { border-left-color: var(--accent); }
.msg-assistant { border-left-color: var(--ok); }
.msg-assistant .body { color: var(--fg); }
.msg-tool { border-left-color: var(--warn); }
.msg-tool .body {
    font-family: var(--mono);
    font-size: 0.78em;
    color: var(--muted);
    max-height: 14em;
    overflow: auto;
}

.chat-log {
    max-height: 60vh;
    overflow-y: auto;
    border: thin solid var(--line);
    border-radius: var(--radius-sm);
    padding: 1em;
    background: var(--surface-2);
}
.chat-log:empty::before {
    content: "Nothing yet.";
    color: var(--muted);
    font-size: 0.9em;
}
.thinking { color: var(--muted); font-style: italic; font-size: 0.9em; }

/* --- agent header -------------------------------------------------------- */

.agent-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.4em 2em;
    align-items: start;
}
.agent-header .identity { grid-column: 1; }
.agent-header .state { grid-column: 2; text-align: right; }

.agent-header h1 {
    margin: 0;
    font-size: 1.6em;
    line-height: 1.1;
    letter-spacing: -0.02em;
    font-weight: 600;
}
.agent-header h2 {
    margin: 0;
    font-size: 1em;
    font-weight: 600;
    white-space: nowrap;
    text-transform: none;
    letter-spacing: 0;
    color: inherit;
}

.agent-header .notice { grid-column: 1 / -1; margin-top: 1em; }
.agent-header .notice .banner { margin-bottom: 0; }
.agent-header .controls {
    grid-column: 1 / -1;
    margin-top: 1.2em;
    padding-top: 1em;
    border-top: thin solid var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 0.4em;
}
.agent-header .controls button { margin: 0; }
.agent-header .controls .spacer { flex: 1; }

.agent-header .status { font-size: 0.9em; }

@media (max-width: 640px) {
    main { padding: 1.4em 1em 3em; }
    .agent-header { grid-template-columns: 1fr; }
    .agent-header .state { grid-column: 1; text-align: left; }
    #topbar { padding: 0.75em 1em; gap: 0.9em; }
    .row { flex-direction: column; align-items: stretch; gap: 0; }
}

/* --- scrollbars ---------------------------------------------------------- */

* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 999px;
    border: 3px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

/* --- checks -------------------------------------------------------------- */

.checks { display: flex; flex-wrap: wrap; gap: 0.35em 1em; margin: 0.6em 0; }
.check { font-size: 0.85em; color: var(--fg-soft); white-space: nowrap; cursor: default; }
.check-ok .dot { background: var(--ok); }
.check-bad .dot { background: var(--bad); }
.check-bad { color: var(--bad); }
.check-none .dot { background: var(--line-strong); }

.check-detail { margin-bottom: 0.8em; }
.check-detail:last-child { margin-bottom: 0; }
.check-detail pre.console { margin: 0.3em 0 0; max-height: 10em; }

.card-desc { margin: 0.2em 0 0; font-size: 0.9em; }
.logview.events { height: auto; max-height: 24em; }
.logview.events .line { grid-template-columns: 9em 4.6em 1fr; }
.check-detail p { margin: 0.2em 0 0 1.2em; font-size: 0.85em; color: var(--fg-soft); }
.row-tight.grow, .row-tight .grow { flex: 1; }
.field .hint { margin-top: 0.3em; }
dialog.modal pre.console { min-height: 8em; max-height: 22em; }
.agent-header .notice:empty { display: none; }

/* --- shell --------------------------------------------------------------- */

dialog.modal.shell-modal { width: min(1100px, 94vw); }
dialog.modal.shell-modal .modal-head .muted { font-size: 0.85em; margin-left: 0.8em; }
.shell-term { height: 70vh; background: var(--console-bg); padding: 0.6em; }

.usage-pick { display: inline-flex; gap: 0.3em; align-items: stretch; }
.usage-pick select { width: auto; font-size: 0.85em; }

.check-label { display: flex; align-items: center; gap: 0.5em; font-weight: 500; }
.check-label input { width: auto; margin: 0; }

.odoo-detail p { margin: 0.6em 0 0; }
.odoo-detail pre.console { margin: 0.6em 0 0; max-height: 12em; }

/* --- tool calls and thinking in a conversation ---------------------------- */

.tool-call {
    margin: 0 0 0.6em 0.9em;
    border-left: 2px solid var(--line-strong);
    padding-left: 0.7em;
    font-size: 0.82em;
}
.tool-call.is-ok { border-left-color: var(--ok); }
.tool-call.is-failed { border-left-color: var(--bad); }
.tool-call summary {
    cursor: pointer;
    display: flex;
    gap: 0.8em;
    align-items: baseline;
    color: var(--fg-soft);
    list-style: none;
}
.tool-call summary::-webkit-details-marker { display: none; }
.tool-call summary::before { content: "▸"; color: var(--muted); }
.tool-call[open] summary::before { content: "▾"; }
.tool-call.is-running .tool-name::after { content: " …"; color: var(--muted); }
.tool-name { font-family: var(--mono); white-space: nowrap; }
.tool-args {
    font-family: var(--mono);
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.tool-label {
    margin: 0.6em 0 0.2em;
    font-size: 0.85em;
    color: var(--muted);
}
.tool-io {
    margin: 0;
    padding: 0.6em 0.8em;
    background: var(--surface);
    border: thin solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 0.95em;
    max-height: 18em;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.thinking-block { margin: 0 0 0.6em 0.9em; font-size: 0.82em; color: var(--muted); }
.thinking-block summary { cursor: pointer; font-style: italic; }
.thinking-block .body { white-space: pre-wrap; padding: 0.4em 0 0 0.9em; }

.session-item.is-active .title::before {
    content: "";
    display: inline-block;
    width: 0.45em;
    height: 0.45em;
    border-radius: 50%;
    background: var(--ok);
    margin-right: 0.45em;
    vertical-align: middle;
}
