/*
 * Octopus Intelligence (OI) wherever it shows: the switch-on window (Apps), the dashboard
 * teaser, the sidebar item, and the Octopus page. Tokens only (mauzo-tokens.css).
 * Magenta is OI's colour (the AI, BRAND.md); red is for "needs you" and "running";
 * green for results that came good.
 */

/* ---------------------------------------------------------------- switch-on window */
.oi-on .modal-header { align-items: flex-start; border-bottom: 0; padding-bottom: 6px; }
.oi-on-kicker { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ai-text); margin-bottom: 4px; }
.oi-on .modal-title { font-family: var(--font-display); font-weight: 500; letter-spacing: -.02em; font-size: 22px; }
.oi-on-steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0; padding: 4px 24px 14px; border-bottom: 1px solid var(--border); }
.oi-on-steps li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); padding-top: 10px; border-top: 3px solid var(--border); }
.oi-on-steps li span { display: inline-flex; width: 20px; height: 20px; border-radius: 50%; align-items: center; justify-content: center; background: var(--surface-3); font-size: 11px; font-weight: 700; color: var(--ink); flex: none; }
.oi-on-steps li.is-on { color: var(--ink-strong); font-weight: 600; border-top-color: var(--ink-strong); }
.oi-on-steps li.is-on span { background: var(--ink-strong); color: var(--surface); }
.oi-on-steps li.is-done { border-top-color: var(--success-fill, var(--success)); }
.oi-on-steps li.is-done span { background: var(--success-soft); color: var(--success); }
.oi-on .modal-body { padding: 20px 24px; min-height: 380px; }
.oi-on-lead { color: var(--ink); margin-bottom: 14px; }
.oi-on-note { font-size: 12.5px; color: var(--muted); margin: 12px 0 0; }
.oi-on-sources { display: grid; gap: 8px; }
.oi-on-source { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer; }
.oi-on-source:has(input:checked) { border-color: var(--ink-strong); box-shadow: inset 0 0 0 1px var(--ink-strong); }
.oi-on-source input { margin: 0; flex: none; }
.oi-on-source-b { flex: 1; min-width: 0; }
.oi-on-source-b b { display: block; color: var(--ink-strong); }
.oi-on-source-b small, .oi-on-field small, .oi-on-locked small, .oi-on-mode small { display: block; color: var(--muted); font-size: 12.5px; }
.oi-on-count { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink); white-space: nowrap; }
.oi-on-field { margin-bottom: 18px; }
.oi-on-label { font-weight: 600; color: var(--ink-strong); margin-bottom: 8px; }
.oi-on-seg { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.oi-on-seg label { position: relative; }
.oi-on-seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.oi-on-seg span { display: inline-block; padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-pill); font-size: 13.5px; color: var(--ink); font-variant-numeric: tabular-nums; }
.oi-on-seg input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); font-weight: 600; }
.oi-on-seg input:focus-visible + span { box-shadow: 0 0 0 3px var(--focus-ring); }
.oi-on-time { width: 7.5rem; }
.oi-on-locked { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--surface-2); }
.oi-on-pill, .oi-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--ink-strong); white-space: nowrap; }
.oi-on-modes { display: grid; gap: 10px; }
.oi-on-mode { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); cursor: pointer; }
.oi-on-mode:has(input:checked) { border-color: var(--ink-strong); box-shadow: inset 0 0 0 1px var(--ink-strong); }
.oi-on-mode input { margin-top: 4px; accent-color: var(--ink-strong); }
.oi-on-mode b { display: block; color: var(--ink-strong); margin-bottom: 2px; }
.oi-on-rec { font-style: normal; font-size: 11px; font-weight: 600; color: var(--success); background: var(--success-soft); padding: 1px 8px; border-radius: var(--radius-pill); margin-left: 6px; }
.oi-on-progress { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.oi-on-progress li { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--muted); transition: color var(--motion-fast, 120ms); }
.oi-on-progress li small { margin-left: auto; font-family: var(--font-mono); }
.oi-on-progress li.is-skip { opacity: .45; }
.oi-on-tick { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); flex: none; position: relative; }
.oi-on-progress li:not(.is-read):not(.is-skip):first-of-type .oi-on-tick, .oi-on-progress li.is-read + li:not(.is-read):not(.is-skip) .oi-on-tick { border-top-color: var(--ai); animation: oi-spin .8s linear infinite; }
.oi-on-progress li.is-read { color: var(--ink-strong); }
.oi-on-progress li.is-read .oi-on-tick { border-color: var(--success-fill, var(--success)); background: var(--success-fill, var(--success)); animation: none; }
.oi-on-progress li.is-read .oi-on-tick::after { content: ""; position: absolute; left: 4px; top: 1px; width: 5px; height: 9px; border: solid var(--on-brand); border-width: 0 2px 2px 0; transform: rotate(45deg); }
@keyframes oi-spin { to { transform: rotate(360deg); } }
@media (max-width: 575.98px) {
    .oi-on-steps { grid-template-columns: repeat(4, 1fr); padding-inline: 16px; }
    .oi-on-steps li { font-size: 0; gap: 0; justify-content: center; }
    .oi-on-steps li span { font-size: 11px; }
    .oi-on .modal-body { padding: 16px; }
}

/* ---------------------------------------------------------------- the OI mark */
.oi-mark { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 9px; background: var(--ai-soft); color: var(--ai-text); flex: none; }
.oi-mark svg { width: 17px; height: 17px; }

/* ---------------------------------------------------------------- dashboard teaser (OI off) */
.oi-teaser { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 18px; margin-bottom: 16px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); }
.oi-teaser-b { flex: 1 1 320px; min-width: 0; }
.oi-teaser-t { color: var(--ink-strong); font-weight: 600; }
.oi-teaser-t b { font-weight: 700; }
.oi-teaser-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.oi-teaser-chips span { padding: 3px 10px; border-radius: var(--radius-pill); background: var(--surface-3); color: var(--muted); font-size: 12.5px; }

/* ---------------------------------------------------------------- sidebar item */
.mz-sidebar .mz-oi-item { margin-top: 4px; }
.mz-sidebar .mz-oi-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--brand-strong); color: var(--on-brand); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.mz-sidebar .mz-oi-live { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-left: 8px; box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 60%, transparent); animation: oi-pulse 1.6s ease-out infinite; flex: none; }
.mz-sidebar .mz-oi-count + .mz-oi-live { margin-left: 6px; }
@keyframes oi-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 55%, transparent); } 80%, 100% { box-shadow: 0 0 0 7px transparent; } }
@media (prefers-reduced-motion: reduce) { .mz-sidebar .mz-oi-live, .oi-on-tick { animation: none !important; } }
@media (min-width: 992px) {
    [data-sidebar="folded"] .mz-sidebar .mz-oi-count, [data-sidebar="hover"] .mz-sidebar:not(:hover) .mz-oi-count { position: absolute; top: 4px; right: 8px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
    [data-sidebar="folded"] .mz-sidebar .mz-oi-live, [data-sidebar="hover"] .mz-sidebar:not(:hover) .mz-oi-live { position: absolute; bottom: 8px; right: 12px; }
    [data-sidebar="folded"] .mz-sidebar .mz-oi-item .nav-link, [data-sidebar="hover"] .mz-sidebar:not(:hover) .mz-oi-item .nav-link { position: relative; }
}

/* ---------------------------------------------------------------- the Octopus page */
.oi-page { max-width: 1320px; }
.oi-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.oi-head-t { display: flex; gap: 14px; align-items: flex-start; min-width: 0; }
.oi-mark-lg { width: 44px; height: 44px; border-radius: 13px; }
.oi-mark-lg svg { width: 26px; height: 26px; }
.oi-kicker { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ai-text); }
.oi-head .page-title { margin: 2px 0 2px; font-size: 28px; }
.oi-sub { margin: 0; color: var(--muted); max-width: 60ch; }
.oi-head-a { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* segmented switch (mode, agents) */
.oi-seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: var(--radius-pill); }
.oi-seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: var(--radius-pill); font-size: 13.5px; font-weight: 600; color: var(--ink); white-space: nowrap; transition: background var(--motion-fast, 120ms), color var(--motion-fast, 120ms); }
.oi-seg button[aria-checked="true"] { background: var(--surface); color: var(--ink-strong); box-shadow: 0 1px 2px rgba(11, 11, 18, .12); }
.oi-seg button:disabled { opacity: .6; cursor: default; }
.oi-seg button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }
.oi-seg-sm button { padding: 5px 10px; font-size: 12.5px; }

/* the four stages */
.oi-bar { display: inline-flex; gap: 3px; vertical-align: middle; }
.oi-bar i { width: 14px; height: 4px; border-radius: 2px; background: var(--border-strong); }
.oi-bar i.is-done { background: var(--ink-strong); }
.oi-bar i.is-now { background: var(--ai); }
.oi-bar i.is-live { background: var(--brand); animation: oi-blink 1.4s ease-in-out infinite; }
@keyframes oi-blink { 50% { opacity: .45; } }

.oi-loop { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.oi-loop-i { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; min-width: 0; }
.oi-loop-i.is-live { border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); }
.oi-loop-n { font-family: var(--font-display); font-weight: 500; font-size: 26px; letter-spacing: -.02em; color: var(--ink-strong); margin-top: 8px; font-variant-numeric: tabular-nums; }
.oi-loop-l { color: var(--muted); font-size: 13px; }

.oi-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.oi-main, .oi-side { display: grid; gap: 16px; min-width: 0; }
.oi-card .card-header { display: flex; align-items: center; gap: 10px; }
.oi-card .card-header .card-title { margin: 0; font-size: 16px; }
.oi-empty { display: grid; gap: 4px; color: var(--muted); }
.oi-empty b { color: var(--ink-strong); }

.oi-sec-h { display: flex; align-items: center; gap: 8px; margin: 2px 0 10px; }
.oi-sec-h h2 { margin: 0; font-size: 16px; font-weight: 700; }
.oi-sec-n { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.oi-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.oi-insight { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.oi-insight-t { margin: 4px 0 0; font-size: 15px; font-weight: 700; color: var(--ink-strong); line-height: 1.3; }
.oi-insight-s { margin: 0; color: var(--ink); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.oi-insight-f { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding-top: 6px; }

.oi-row-k { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.oi-list { list-style: none; margin: 0; padding: 0; }
.oi-row { display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 14px 20px; border-top: 1px solid var(--border); }
.oi-row:first-child { border-top: 0; }
.oi-row-b { min-width: 0; }
.oi-row-t { font-weight: 700; color: var(--ink-strong); margin: 3px 0 2px; }
.oi-row-s { font-size: 13px; color: var(--muted); }
.oi-row-a { display: flex; gap: 8px; flex: none; }

.oi-pill.is-red { background: var(--brand-strong); color: var(--on-brand); }
.oi-pill.is-live { background: var(--brand-soft); color: var(--brand-text); }
.oi-pill.is-good { background: var(--success-soft); color: var(--success); }
.oi-pill.is-auto { background: var(--info-soft); color: var(--info); }
.oi-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); animation: oi-blink 1.4s ease-in-out infinite; }

.oi-runs { display: grid; }
.oi-run { padding: 16px 20px; border-top: 1px solid var(--border); display: grid; gap: 10px; }
.oi-run:first-child { border-top: 0; }
.oi-run-h { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.oi-progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.oi-progress span { display: block; height: 100%; background: var(--brand); border-radius: 3px; transition: width .8s var(--ease-brand, ease); }
.oi-run-m { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); }
.oi-link { border: 0; background: none; padding: 0; color: var(--ink-strong); font-weight: 600; font-size: 13.5px; text-align: left; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); justify-self: start; }
.oi-link:hover { text-decoration-color: currentColor; }
.oi-link-t { text-decoration: none; }
.oi-table td { vertical-align: top; }

.oi-agents { list-style: none; margin: 0; padding: 0; }
.oi-agent { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--border); }
.oi-agent:first-child { border-top: 0; }
.oi-agent-b b { display: block; color: var(--ink-strong); }
.oi-agent-b small, .oi-agent-n { color: var(--muted); font-size: 12px; line-height: 1.35; }
.oi-agent-n { grid-column: 1 / -1; }
.oi-note { padding: 10px 20px 14px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--border); }

.oi-limits { display: grid; gap: 12px; }
.oi-limits > label, .oi-limits-row label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; color: var(--ink-strong); }
.oi-limits small { font-weight: 400; color: var(--muted); font-size: 12px; }
.oi-limits-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.oi-activity-f { width: auto; margin-left: auto; }
.oi-activity { list-style: none; margin: 0; padding: 4px 0; max-height: 420px; overflow-y: auto; }
.oi-activity li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; padding: 8px 20px; font-size: 13px; }
.oi-act-who { font-weight: 700; color: var(--ink-strong); }
.oi-act-t { color: var(--ink); }
.oi-activity time { grid-column: 2; color: var(--muted); font-size: 12px; }

.oi-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1200; padding: 10px 16px; border-radius: var(--radius-md); background: var(--primary); color: var(--primary-ink); font-size: 14px; box-shadow: var(--shadow-pop); max-width: calc(100vw - 32px); }
.oi-toast.is-bad { background: var(--danger); color: var(--on-brand); }

/* the plan drawer */
.oi-scrim { position: fixed; inset: 0; z-index: 1090; background: var(--overlay, rgba(11, 11, 18, .4)); opacity: 0; transition: opacity .2s; }
.oi-scrim.is-on { opacity: 1; }
.oi-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 1095; width: min(520px, 100vw); display: flex; flex-direction: column; background: var(--surface); box-shadow: var(--shadow-pop); transform: translateX(104%); transition: transform var(--motion-rise, 320ms) var(--ease-brand, ease); }
.oi-drawer.is-on { transform: none; }
.oi-d-h { display: flex; justify-content: space-between; gap: 12px; padding: 18px 22px 14px; border-bottom: 1px solid var(--border); }
.oi-d-h h2 { margin: 6px 0 0; font-size: 19px; font-weight: 700; line-height: 1.3; }
.oi-d-state { font-family: var(--font-sans); text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--ink); }
.oi-d-b { flex: 1; overflow-y: auto; padding: 18px 22px; display: grid; gap: 18px; align-content: start; }
.oi-d-loading { color: var(--muted); }
.oi-d-s h3 { font-size: 13px; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 500; margin: 0 0 8px; }
.oi-d-s p { margin: 0; color: var(--ink); }
.oi-d-ev { margin: 8px 0 0; padding-left: 18px; color: var(--ink); font-size: 13.5px; }
.oi-d-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.oi-d-tiles > div { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 12px; }
.oi-d-tiles small { display: block; color: var(--muted); font-size: 12px; }
.oi-d-tiles b { font-family: var(--font-display); font-weight: 500; font-size: 18px; letter-spacing: -.01em; white-space: nowrap; }
.oi-d-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.oi-d-steps li { display: flex; gap: 12px; }
.oi-d-n { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-3); color: var(--ink-strong); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.oi-d-steps li.is-done .oi-d-n { background: var(--success-fill, var(--success)); color: var(--on-brand); }
.oi-d-steps li.is-now .oi-d-n { background: var(--brand); color: var(--on-brand); }
.oi-d-steps li.is-off { opacity: .55; }
.oi-d-step { flex: 1; min-width: 0; }
.oi-d-step-h { display: flex; justify-content: space-between; gap: 8px; }
.oi-d-step-h b { color: var(--ink-strong); }
.oi-d-cost { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink); white-space: nowrap; }
.oi-d-step-m { font-size: 12.5px; color: var(--muted); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.oi-d-step-r { font-size: 12.5px; color: var(--ink); margin-top: 4px; }
.oi-d-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.oi-d-checks li { padding: 10px 12px 10px 36px; border-radius: var(--radius-md); background: var(--surface-2); font-size: 13.5px; position: relative; }
.oi-d-checks li::before { content: "✓"; position: absolute; left: 13px; top: 10px; font-weight: 700; color: var(--success); }
.oi-d-checks li.is-bad::before { content: "!"; color: var(--danger); }
.oi-d-checks li.is-lock::before { content: "🔒"; font-size: 12px; }
.oi-d-checks b { color: var(--ink-strong); margin-right: 4px; }
.oi-d-err { padding: 10px 12px; border-radius: var(--radius-md); background: var(--danger-soft); color: var(--danger); font-size: 13.5px; }
.oi-d-f { display: flex; gap: 8px; padding: 14px 22px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }

@media (max-width: 1199.98px) { .oi-grid { grid-template-columns: minmax(0, 1fr); } .oi-side { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); } }
@media (max-width: 767.98px) {
    .oi-loop { grid-template-columns: 1fr 1fr; }
    .oi-head-a { width: 100%; }
    .oi-row { flex-direction: column; align-items: stretch; padding: 14px 16px; }
    .oi-row-a .btn { flex: 1; }
    .oi-side { grid-template-columns: minmax(0, 1fr); }
    .oi-d-tiles b { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { .oi-bar i.is-live, .oi-dot { animation: none; } .oi-drawer, .oi-scrim { transition: none; } }

.oi-d-info { padding: 12px 14px; border-radius: var(--radius-md); background: var(--ai-soft); color: var(--ink-strong); font-size: 13.5px; }

/* OI's hints on other pages (phase 2): one quiet line, never a second banner style. */
.oi-hint { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 16px; border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: var(--radius-md, 10px); background: var(--surface); }
.oi-hint-k { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink-strong); white-space: nowrap; }
.oi-hint-k .oi-mark { width: 18px; height: 18px; }
.oi-hint-l { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; list-style: none; min-width: 0; }
.oi-hint-l a { color: var(--ink); text-decoration: none; }
.oi-hint-l a:hover, .oi-hint-l a:focus-visible { color: var(--brand); text-decoration: underline; }
.oi-hint-v { color: var(--muted); font-size: 12.5px; }
.oi-late-pill { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: var(--radius-pill); background: var(--warning-soft, var(--surface-3)); color: var(--warning); font-size: 12px; font-weight: 600; white-space: nowrap; }
@media (max-width: 575.98px) { .oi-hint { flex-direction: column; align-items: flex-start; } }

/* ---------------------------------------------------------------- Octopus page: plans + analytics */
.oi-head-chip { display: inline-grid; gap: 1px; padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--ink-strong); text-decoration: none; line-height: 1.2; }
.oi-head-chip:hover { border-color: var(--border-strong); color: var(--ink-strong); text-decoration: none; }
.oi-head-chip small { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.oi-head-chip b { font-size: 13.5px; white-space: nowrap; }
.oi-head-chip b span { font-weight: 500; color: var(--muted); }
.oi-head-a .btn .icon { width: 16px; height: 16px; margin-right: 6px; }

.oi-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 18px; }
.oi-kpi { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.oi-kpi > small { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.oi-kpi > b { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.15rem, .6rem + 1vw, 1.65rem); letter-spacing: -.02em; color: var(--ink-strong); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.oi-kpi > span { font-size: 12.5px; color: var(--muted); }
.oi-kpi-of { font-family: var(--font-sans); font-size: 13px; color: var(--muted); letter-spacing: 0; }
.oi-kpi-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.oi-kpi.is-dark { background: var(--obsidian); border-color: var(--obsidian); }
.oi-kpi.is-dark > small, .oi-kpi.is-dark > span { color: color-mix(in srgb, var(--on-dark) 70%, transparent); }
.oi-kpi.is-dark > b, .oi-kpi.is-dark > span b { color: var(--on-dark); }
.oi-spark { width: 100%; height: 30px; }
.oi-spark polyline { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.oi-meter { display: block; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin: 4px 0 2px; }
.oi-meter i { display: block; height: 100%; background: var(--ink-strong); border-radius: 3px; }
.oi-meter.is-full i { background: var(--warning); }

.oi-segs { display: flex; gap: 3px; }
.oi-segs i { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); }
.oi-segs i.is-done { background: var(--ink-strong); }
.oi-segs i.is-now { background: var(--brand); animation: oi-blink 1.4s ease-in-out infinite; }

.oi-sec-h { flex-wrap: wrap; }
.oi-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.oi-chip { border: 1px solid var(--border); background: var(--surface); color: var(--ink); border-radius: var(--radius-pill); padding: 4px 11px; font-size: 12.5px; font-weight: 600; }
.oi-chip[aria-pressed="true"] { background: var(--ink-strong); border-color: var(--ink-strong); color: var(--surface); }
.oi-chip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }
.oi-cards-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.oi-cards-2 .oi-filter-empty { grid-column: 1 / -1; }
.oi-insight[hidden] { display: none; }

.oi-vs-cell { min-width: 160px; }
.oi-vs { display: flex; align-items: center; gap: 8px; height: 14px; }
.oi-vs + .oi-vs { margin-top: 4px; }
.oi-vs i { display: block; height: 6px; border-radius: 3px; background: var(--border-strong); }
.oi-vs i.is-got { background: var(--brand); }
.oi-vs em { font-style: normal; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.oi-vs-key { display: flex; gap: 16px; padding: 10px 20px 14px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); }
.oi-vs-key i { display: inline-block; width: 10px; height: 6px; border-radius: 3px; background: var(--border-strong); margin-right: 6px; vertical-align: middle; }
.oi-vs-key i.is-got { background: var(--brand); }

.oi-hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.oi-hbars li { display: grid; grid-template-columns: 82px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13px; }
.oi-hbar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.oi-hbar i { display: block; height: 100%; background: var(--ink-strong); border-radius: 4px; }
.oi-hbars b { font-variant-numeric: tabular-nums; color: var(--ink-strong); font-size: 12.5px; white-space: nowrap; }
.oi-pill.is-off { background: var(--surface-3); color: var(--muted); }
.oi-agent { align-items: center; }

/* ---------------------------------------------------------------- Settings › Octopus */
.oi-settings { max-width: 880px; padding-bottom: 90px; }
.oi-set { display: grid; gap: 16px; }
.oi-set .card { scroll-margin-top: 80px; }
.oi-set-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.oi-set-mode { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer; }
.oi-set-mode:has(input:checked) { border-color: var(--ink-strong); box-shadow: inset 0 0 0 1px var(--ink-strong); }
.oi-set-mode input { margin-top: 3px; accent-color: var(--brand); }
.oi-set-mode span { display: grid; gap: 2px; }
.oi-set-mode small { color: var(--muted); font-size: 12.5px; }
.oi-seg-o { position: relative; margin: 0; }
.oi-seg-o input { position: absolute; opacity: 0; pointer-events: none; }
.oi-seg-o span { display: inline-block; padding: 5px 10px; border-radius: var(--radius-pill); font-size: 12.5px; font-weight: 600; color: var(--ink); cursor: pointer; white-space: nowrap; }
.oi-seg-o input:checked + span { background: var(--surface); color: var(--ink-strong); box-shadow: 0 1px 2px color-mix(in srgb, var(--ink-strong) 14%, transparent); }
.oi-seg-o input:focus-visible + span { box-shadow: 0 0 0 3px var(--focus-ring); }
.oi-seg-o.is-locked span { opacity: .5; cursor: default; }
.oi-set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.oi-set-grid label, .oi-set-pair label { display: grid; gap: 4px; font-weight: 600; font-size: 13.5px; color: var(--ink-strong); margin: 0; }
.oi-set-grid small, .oi-set-pair small { font-weight: 400; color: var(--muted); font-size: 12px; }
.oi-set-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; align-content: start; }
.oi-set-pair small { grid-column: 1 / -1; }
.oi-set-grid .oi-on-locked { grid-column: 1 / -1; }
.oi-set-notify { list-style: none; margin: 0 0 10px; padding: 0; }
.oi-set-notify li { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px solid var(--border); }
.oi-set-notify li:first-child { border-top: 0; }
.oi-set-notify li > div { display: grid; gap: 1px; min-width: 0; }
.oi-set-notify small { color: var(--muted); font-size: 12.5px; }
.oi-set-notify select { width: auto; flex: none; }
.oi-unsaved { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 1030; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 18px; background: var(--obsidian); color: var(--on-dark); border-radius: var(--radius-pill); box-shadow: var(--shadow-pop); }
.oi-unsaved span { font-size: 13.5px; white-space: nowrap; }
.oi-unsaved .btn-ghost-secondary { color: var(--on-dark); }
.oi-unsaved[hidden] { display: none; }

@media (max-width: 1199.98px) { .oi-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767.98px) {
    .oi-cards-2, .oi-set-modes, .oi-set-grid { grid-template-columns: minmax(0, 1fr); }
    .oi-chips { margin-left: 0 !important; width: 100%; }
    .oi-set-agents .oi-agent { grid-template-columns: minmax(0, 1fr); }
    .oi-set-notify li { flex-direction: column; align-items: stretch; }
    .oi-unsaved { left: 12px; right: 12px; transform: none; bottom: calc(12px + env(safe-area-inset-bottom)); }
}
@media (max-width: 479.98px) { .oi-kpis { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .oi-segs i.is-now { animation: none; } }

/* ---------------------------------------------------------------- Octopus's records in other modules (Records.php) */
.oi-from { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin: 0 0 16px; border: 1px solid color-mix(in srgb, var(--ai-text) 30%, var(--border)); border-radius: var(--radius-lg); background: var(--ai-soft); }
.oi-from .oi-mark { width: 30px; height: 30px; flex: none; }
.oi-from-t { display: grid; gap: 1px; min-width: 0; }
.oi-from-t b { color: var(--ink-strong); font-size: 13.5px; }
.oi-from-t small { color: var(--muted); font-size: 12.5px; }
.oi-from-a { margin-left: auto; flex: none; font-weight: 600; font-size: 13px; color: var(--ink-strong); text-decoration: underline; text-underline-offset: 3px; }
.card .oi-from, .col-lg-4 .oi-from { margin-bottom: 12px; }
.oi-badge { background: var(--ai-soft); color: var(--ai-text); }
@media (max-width: 575.98px) { .oi-from { flex-wrap: wrap; } .oi-from-a { margin-left: 42px; } }
