/* ============================================================
   Agentic OS Skin v3 — Matrix "Refined Cyberpunk"
   v3: 3-zone statusbar, 4-view stage switching, balance tweaks.
   Idempotent overlay; safe to re-apply on top of AionUi.
   ============================================================ */

/* ── Typography: Zen Maru Gothic (丸ゴシック) ── */
@import url('https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@300;400;500;700&family=M+PLUS+Rounded+1c:wght@300;400;500;700&display=swap');

:root {
  --ao-font-main: 'Zen Maru Gothic', 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', 'BIZ UDGothic', sans-serif;
  --ao-font-mono: 'SF Mono', 'Menlo', 'Consolas', 'Liberation Mono', monospace;
  --ao-fs-body: 14px;
  --ao-fs-aux: 12px;
  --ao-fs-heading: 16px;
  --ao-fs-section: 17px;
  --ao-lh: 1.55;
}


/* ---------- Root reset inside overlay ---------- */
#agentic-os-overlay,
#agentic-os-overlay *,
#agentic-os-overlay *::before,
#agentic-os-overlay *::after {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

#agentic-os-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  margin: 0;
  font-family: var(--ao-font-main);
  font-size: var(--ao-fs-body);
  line-height: var(--ao-lh);
  color: #E4F6E9;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(0, 80, 30, 0.18) 0%, rgba(0, 0, 0, 0) 55%),
    radial-gradient(ellipse at 100% 100%, rgba(0, 40, 18, 0.25) 0%, rgba(0, 0, 0, 0) 60%),
    linear-gradient(180deg, #02040a 0%, #000 100%);
  overflow: hidden;
  letter-spacing: 0.02em;
}

/* 極薄グリッド（背景） */
#agentic-os-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(34, 227, 107, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 227, 107, 0.045) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse at 50% 45%, #000 40%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 45%, #000 40%, transparent 85%);
  pointer-events: none;
  z-index: 0;
}

/* 走査線（うっすら） */
#agentic-os-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(34, 227, 107, 0.025) 0px,
    rgba(34, 227, 107, 0.025) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: screen;
}

/* 遠近グリッド"床"（下部）— T4: PC塗りつぶし帯バグ修正 */
.ao-floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: min(38vh, 280px);
  background:
    linear-gradient(180deg, transparent 0%, rgba(0, 40, 18, 0.20) 70%, rgba(0, 60, 25, 0.25) 100%),
    repeating-linear-gradient(
      90deg,
      rgba(34, 227, 107, 0.18) 0px,
      rgba(34, 227, 107, 0.18) 1px,
      transparent 1px,
      transparent 60px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(34, 227, 107, 0.14) 0px,
      rgba(34, 227, 107, 0.14) 1px,
      transparent 1px,
      transparent 40px
    );
  transform: perspective(520px) rotateX(58deg);
  transform-origin: 50% 100%;
  opacity: 0.28;
  pointer-events: none;
  z-index: 0;
  mask-image: linear-gradient(180deg, transparent 0%, #000 55%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 55%);
}
/* T4: ワイド画面では床を更に薄くして塗りつぶし帯を防止 */
@media (min-width: 1200px) {
  .ao-floor { opacity: 0.20; }
}
@media (min-width: 1600px) {
  .ao-floor { opacity: 0.13; height: min(38vh, 200px); }
}

/* T4: 統一戻るボタン */
.ao-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12px;
  color: #22E36B;
  background: rgba(0, 40, 20, 0.6);
  border: 1px solid rgba(34, 227, 107, 0.3);
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.06em;
  touch-action: manipulation;
  transition: background 0.15s, border-color 0.15s;
}
.ao-back-btn:hover {
  background: rgba(0, 60, 30, 0.8);
  border-color: rgba(34, 227, 107, 0.5);
}

/* NAV-T3: Unified nav controls (3-point set) */
.ao-nav-controls {
  display: inline-flex;
  gap: 8px;
  margin-right: 12px;
  align-items: center;
}
.ao-nav-controls .ao-back-btn {
  padding: 4px 10px;
  font-size: 12px;
}


/* ---------- Layout shell ---------- */
.ao-shell {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 220px 1fr;
  height: 100vh;
  width: 100vw;
}

/* ---------- Sidebar ---------- */
.ao-sidebar {
  border-right: 1px solid rgba(34, 227, 107, 0.18);
  background: linear-gradient(180deg, rgba(0, 12, 6, 0.85), rgba(0, 4, 2, 0.9));
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  backdrop-filter: blur(2px);
}

.ao-brand {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(34, 227, 107, 0.18);
}

.ao-brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: #22E36B;
  text-shadow: 0 0 8px rgba(34, 227, 107, 0.55), 0 0 2px rgba(34, 227, 107, 0.8);
  position: relative;
  display: inline-block;
}

/* 軽いグリッチ装飾 */
.ao-brand-title::before,
.ao-brand-title::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0.55;
  mix-blend-mode: screen;
  pointer-events: none;
}
.ao-brand-title::before {
  color: #00ff41;
  transform: translate(1px, 0);
  clip-path: polygon(0 0, 100% 0, 100% 40%, 0 40%);
  animation: ao-glitch-a 6s infinite steps(1);
}
.ao-brand-title::after {
  color: #0E9F49;
  transform: translate(-1px, 0);
  clip-path: polygon(0 60%, 100% 60%, 100% 100%, 0 100%);
  animation: ao-glitch-b 7s infinite steps(1);
}
@keyframes ao-glitch-a {
  0%, 92%, 100% { opacity: 0; }
  93%, 96% { opacity: 0.55; transform: translate(2px, -1px); }
}
@keyframes ao-glitch-b {
  0%, 88%, 100% { opacity: 0; }
  89%, 93% { opacity: 0.5; transform: translate(-2px, 1px); }
}

.ao-brand-sub {
  margin-top: 6px;
  font-size: 12px;
  letter-spacing: 0.3em;
  color: #0E9F49;
  text-transform: uppercase;
}

.ao-section-label {
  font-size: 12px;
  letter-spacing: 0.32em;
  color: #0E9F49;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ao-section-label::before {
  content: '';
  width: 8px;
  height: 1px;
  background: #0E9F49;
  box-shadow: 0 0 4px #00ff41;
}

.ao-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  margin-bottom: 2px;
  border-radius: 3px;
  color: #8fb39a;
  font-size: 12px;
  letter-spacing: 0.08em;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ao-nav-item:hover {
  background: rgba(34, 227, 107, 0.06);
  color: #c6f0cf;
  border-left-color: rgba(34, 227, 107, 0.5);
}
/* Active nav highlight for view switching */
.ao-nav-item.ao-nav-active {
  background: rgba(34, 227, 107, 0.1);
  color: #eaffee;
  border-left-color: #22E36B;
  text-shadow: 0 0 6px rgba(34, 227, 107, 0.25);
}
.ao-nav-item .ao-nav-glyph {
  color: #22E36B;
  text-shadow: 0 0 4px rgba(34, 227, 107, 0.6);
  font-size: 12px;
  width: 14px;
  text-align: center;
}

/* Agents list in sidebar */
.ao-agent-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 3px;
  margin-bottom: 2px;
  border-left: 2px solid transparent;
  cursor: default;
}
.ao-agent-row.ao-active {
  background: rgba(34, 227, 107, 0.08);
  border-left-color: #22E36B;
}
.ao-agent-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #2a3630;
}
.ao-agent-dot.ao-live {
  background: #22E36B;
  box-shadow: 0 0 6px #22E36B, 0 0 12px rgba(34, 227, 107, 0.5);
  animation: ao-pulse-dot 2.4s ease-in-out infinite;
}
@keyframes ao-pulse-dot {
  0%, 100% { box-shadow: 0 0 4px #22E36B, 0 0 8px rgba(34, 227, 107, 0.35); }
  50% { box-shadow: 0 0 8px #22E36B, 0 0 18px rgba(34, 227, 107, 0.75); }
}
.ao-agent-meta {
  flex: 1;
  min-width: 0;
}
.ao-agent-name {
  font-size: 12px;
  color: #d8f0dd;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ao-agent-row.ao-active .ao-agent-name {
  color: #eaffee;
  text-shadow: 0 0 6px rgba(34, 227, 107, 0.35);
}
.ao-agent-model {
  font-size: 12px;
  color: #5e8068;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Main area ---------- */
.ao-main {
  display: grid;
  grid-template-rows: 44px 1fr;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Status bar — 3-zone grid: left | center | right */
.ao-statusbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 0 22px;
  border-bottom: 1px solid rgba(34, 227, 107, 0.18);
  background: linear-gradient(180deg, rgba(0, 20, 10, 0.55), rgba(0, 0, 0, 0.2));
  font-size: 12px;
  letter-spacing: 0.28em;
  color: #8fb39a;
  text-transform: uppercase;
  gap: 16px;
  min-width: 0;
}
.ao-status-left {
  display: flex;
  gap: 18px;
  flex-shrink: 0;
}
.ao-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.ao-status-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22E36B;
  box-shadow: 0 0 6px #22E36B;
  animation: ao-pulse-dot 2s ease-in-out infinite;
}
/* Center zone: clock + date */
.ao-status-center {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 18px;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}
/* Right zone: close button */
.ao-status-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.ao-clock {
  font-size: 20px;
  color: #22E36B;
  letter-spacing: 0.18em;
  font-weight: 600;
  text-shadow: 0 0 10px rgba(34, 227, 107, 0.55);
}
.ao-clock::after {
  content: '▋';
  color: #22E36B;
  margin-left: 4px;
  animation: ao-blink 1.1s steps(2) infinite;
  text-shadow: 0 0 6px #22E36B;
}
@keyframes ao-blink {
  50% { opacity: 0; }
}
.ao-date {
  font-size: 12px;
  color: #6a8a72;
  letter-spacing: 0.22em;
}

/* Body */
.ao-body {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 280px;
  grid-template-rows: 1fr;
  gap: 14px;
  padding: 14px 18px 14px 18px;
  overflow: hidden;
}

/* Center stage: holds views */
.ao-stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* ========== VIEW SYSTEM ========== */
.ao-view {
  display: none;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.ao-view.ao-view-active {
  display: flex;
  opacity: 1;
}
/* Desktop scroll fix: content views scroll within the fixed shell.
   Canvas views (constellation/memory) and mobile (<=640px, own rules) untouched. */
@media (min-width: 641px) {
  .ao-view.ao-view-active:not(#ao-view-constellation):not(#ao-view-memory) {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
  }
}

/* View header label */
.ao-view-label {
  font-size: 12px;
  letter-spacing: 0.36em;
  color: #0E9F49;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.ao-view-label::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #22E36B;
  border-radius: 50%;
  box-shadow: 0 0 6px #22E36B;
}

/* ---- CONSTELLATION view (default) ---- */
.ao-hero {
  position: relative;
  border: 1px solid rgba(34, 227, 107, 0.22);
  border-radius: 6px;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(0, 60, 25, 0.22), rgba(0, 0, 0, 0.65) 70%),
    linear-gradient(180deg, #02060a, #000);
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(34, 227, 107, 0.04) inset,
    0 0 24px rgba(34, 227, 107, 0.08);
  min-height: 280px;
  flex: 1;
}
.ao-hero-label {
  position: absolute;
  top: 10px;
  left: 14px;
  font-size: 12px;
  letter-spacing: 0.36em;
  color: #0E9F49;
  text-transform: uppercase;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ao-hero-label::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #22E36B;
  border-radius: 50%;
  box-shadow: 0 0 6px #22E36B;
}
.ao-hero-sub {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 12px;
  letter-spacing: 0.22em;
  color: #4a7a58;
  text-transform: uppercase;
  z-index: 2;
}
/* Home constellation is the hero: keep it tall, then let the lower panels scroll. */
#ao-view-constellation {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}
.ao-hero {
  flex: 0 0 clamp(520px, 68vh, 760px);
  min-height: 520px;
}
#ao-constellation {
  display: block;
  width: 100%;
  height: 100%;
}
.ao-graph-mount { position: absolute; inset: 0; min-height: 0; background: #000; }
.ao-graph-full-wrap { position: relative; flex: 1 1 auto; min-height: 560px; border: 1px solid rgba(34,227,107,.22); border-radius: 6px; overflow: hidden; background: #000; }
.ao-graph-full-wrap .ao-graph-mount { position: absolute; }
.ao-graph-legend { position: absolute; z-index: 3; left: 14px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 5px; max-width: calc(100% - 28px); pointer-events: none; }
.ao-graph-chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border: 1px solid rgba(91,255,158,.25); border-radius: 999px; background: rgba(0,12,6,.82); color: #b8e8c8; font: 12px var(--ao-font-main); }
.ao-graph-chip i { width: 7px; height: 7px; border-radius: 50%; box-shadow: 0 0 7px currentColor; }
.ao-graph-detail { position: absolute; z-index: 4; right: 12px; bottom: 12px; width: min(320px, calc(100% - 24px)); padding: 12px; border: 1px solid rgba(91,255,158,.42); border-radius: 6px; background: rgba(0,12,7,.93); color: #cfeede; box-shadow: 0 0 20px rgba(34,227,107,.16); font-size: 12px; }
.ao-graph-detail-close { float: right; border: 0; background: transparent; color: #7dba91; font-size: 20px; cursor: pointer; line-height: 1; }
.ao-graph-detail-title { padding-right: 22px; color: #eaffee; font-size: 13px; font-weight: 600; line-height: 1.35; }
.ao-graph-detail-meta { margin-top: 6px; color: #5bff9e; font: 12px var(--ao-font-main); }
.ao-graph-detail-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.ao-graph-detail-tags span { padding: 4px 8px; border-radius: 3px; background: rgba(91,255,158,.12); color: #9edeb1; font-size: 12px; }
.ao-graph-detail-excerpt { margin-top: 9px; color: #91b89e; line-height: 1.5; max-height: 90px; overflow: auto; }

/* Panels row (top) and bottom row */
.ao-panels-top,
.ao-panels-bot {
  display: grid;
  gap: 12px;
  min-height: 0;
}
.ao-panels-top { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ao-panels-bot { grid-template-columns: 1.2fr 1.6fr; }

/* ---- AGENTS view ---- */
.ao-agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.ao-agent-card {
  border: 1px solid rgba(34, 227, 107, 0.18);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(0, 18, 8, 0.7), rgba(0, 6, 3, 0.8));
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ao-agent-card:hover {
  border-color: rgba(34, 227, 107, 0.35);
  box-shadow: 0 0 18px rgba(34, 227, 107, 0.12);
}
.ao-agent-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ao-agent-card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(34, 227, 107, 0.3);
  background: rgba(34, 227, 107, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #22E36B;
  text-shadow: 0 0 6px rgba(34, 227, 107, 0.5);
  flex-shrink: 0;
}
.ao-agent-card-info { flex: 1; min-width: 0; }
.ao-agent-card-name {
  font-size: 14px;
  font-weight: 600;
  color: #eaffee;
  letter-spacing: 0.06em;
}
.ao-agent-card-model {
  font-size: 12px;
  color: #5e8068;
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.ao-agent-card-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  letter-spacing: 0.1em;
}
.ao-agent-card-status .ao-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ao-agent-card-status .ao-dot.live {
  background: #22E36B;
  box-shadow: 0 0 6px #22E36B;
}
.ao-agent-card-status .ao-dot.idle {
  background: #c9a227;
  box-shadow: 0 0 4px rgba(201, 162, 39, 0.5);
}
.ao-agent-card-role {
  font-size: 12px;
  color: #7aa386;
  letter-spacing: 0.04em;
  line-height: 1.4;
  border-top: 1px solid rgba(34, 227, 107, 0.1);
  padding-top: 8px;
}

/* ---- MEMORY view ---- */
.ao-memory-container {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 16px;
  min-height: 0;
}
.ao-memory-graph {
  border: 1px solid rgba(34, 227, 107, 0.18);
  border-radius: 6px;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(0, 60, 25, 0.15), rgba(0, 0, 0, 0.6) 70%),
    linear-gradient(180deg, #02060a, #000);
  position: relative;
  overflow: hidden;
  min-height: 300px;
}
.ao-memory-graph-label {
  position: absolute;
  top: 12px;
  left: 14px;
  font-size: 12px;
  letter-spacing: 0.3em;
  color: #0E9F49;
  text-transform: uppercase;
  z-index: 2;
}
#ao-memory-canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.ao-memory-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---- KANBAN view (full-size) ---- */
.ao-kanban-full {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  min-height: 0;
}
.ao-kanban-col-full {
  border: 1px solid rgba(34, 227, 107, 0.16);
  border-radius: 6px;
  background: rgba(0, 18, 8, 0.4);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
}
.ao-kanban-col-full .ao-kanban-col-title {
  font-size: 12px;
  letter-spacing: 0.28em;
  color: #0E9F49;
  text-transform: uppercase;
  text-align: center;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(34, 227, 107, 0.18);
  margin-bottom: 4px;
}
.ao-kanban-card-full {
  font-size: 12px;
  color: #E4F6E9;
  padding: 10px 12px;
  border-left: 2px solid rgba(34, 227, 107, 0.45);
  background: rgba(34, 227, 107, 0.04);
  border-radius: 3px;
  line-height: 1.4;
  transition: background 0.15s;
}
.ao-kanban-card-full:hover {
  background: rgba(34, 227, 107, 0.08);
}
.ao-kanban-card-full.ao-done {
  opacity: 0.5;
  border-left-color: rgba(34, 227, 107, 0.2);
  text-decoration: line-through;
}
.ao-kanban-card-full .ao-kanban-card-meta {
  font-size: 12px;
  color: #5e8068;
  margin-top: 4px;
  letter-spacing: 0.06em;
}

/* Card (shared) */
.ao-card {
  border: 1px solid rgba(34, 227, 107, 0.16);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(0, 18, 8, 0.65), rgba(0, 6, 3, 0.75));
  padding: 12px 14px;
  box-shadow:
    0 0 0 1px rgba(34, 227, 107, 0.03) inset,
    0 0 14px rgba(34, 227, 107, 0.05);
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ao-card:hover {
  border-color: rgba(34, 227, 107, 0.32);
  box-shadow: 0 0 0 1px rgba(34, 227, 107, 0.05) inset, 0 0 18px rgba(34, 227, 107, 0.12);
}
.ao-card-title {
  font-size: 12px;
  letter-spacing: 0.34em;
  color: #0E9F49;
  text-transform: uppercase;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(34, 227, 107, 0.14);
  display: flex;
  align-items: center;
  gap: 8px;
}
.ao-card-title::before {
  content: '›';
  color: #22E36B;
  text-shadow: 0 0 4px #22E36B;
}

/* Skills / tags */
.ao-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ao-tag {
  padding: 3px 9px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #a6d8b2;
  background: rgba(34, 227, 107, 0.05);
  border: 1px solid rgba(34, 227, 107, 0.2);
  border-radius: 2px;
}
.ao-tag.hot {
  color: #eaffee;
  border-color: rgba(34, 227, 107, 0.55);
  box-shadow: 0 0 8px rgba(34, 227, 107, 0.25);
}

/* Metrics */
.ao-metric {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px dashed rgba(34, 227, 107, 0.1);
  font-variant-numeric: tabular-nums;
}
.ao-metric:last-of-type { border-bottom: none; }
.ao-metric-label {
  font-size: 12px;
  color: #7aa386;
  letter-spacing: 0.06em;
}
.ao-metric-value {
  font-size: 14px;
  color: #d8f5de;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-shadow: 0 0 6px rgba(34, 227, 107, 0.25);
}
.ao-metric-value.ao-hi {
  color: #22E36B;
  text-shadow: 0 0 8px rgba(34, 227, 107, 0.55);
}

/* Sparkline */
.ao-spark {
  display: block;
  width: 100%;
  height: 26px;
  margin-top: 6px;
}

/* Progress bar */
.ao-bar {
  height: 6px;
  background: rgba(34, 227, 107, 0.08);
  border: 1px solid rgba(34, 227, 107, 0.18);
  border-radius: 1px;
  overflow: hidden;
  margin-top: 6px;
}
.ao-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #0E9F49, #22E36B);
  box-shadow: 0 0 8px rgba(34, 227, 107, 0.55);
}

/* Cron list */
.ao-cron {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}
.ao-cron-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  border-left: 2px solid rgba(34, 227, 107, 0.2);
  background: rgba(34, 227, 107, 0.03);
}
.ao-cron-row .ao-cron-name { color: #E4F6E9; }
.ao-cron-row .ao-cron-next { color: #6a8a72; font-variant-numeric: tabular-nums; }

/* Kanban (compact, in constellation view) */
.ao-kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
  flex: 1;
}
.ao-kanban-col {
  border: 1px solid rgba(34, 227, 107, 0.14);
  border-radius: 4px;
  background: rgba(0, 20, 10, 0.4);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  overflow: hidden;
}
.ao-kanban-col-title {
  font-size: 12px;
  letter-spacing: 0.28em;
  color: #0E9F49;
  text-transform: uppercase;
  text-align: center;
  padding-bottom: 4px;
  border-bottom: 1px dashed rgba(34, 227, 107, 0.15);
}
.ao-kanban-card {
  font-size: 12px;
  color: #E4F6E9;
  padding: 5px 7px;
  border-left: 2px solid rgba(34, 227, 107, 0.45);
  background: rgba(34, 227, 107, 0.04);
  border-radius: 2px;
  line-height: 1.35;
}
.ao-kanban-card.ao-done {
  opacity: 0.55;
  border-left-color: rgba(34, 227, 107, 0.2);
  text-decoration: line-through;
}

/* Log */
.ao-log {
  font-size: 12px;
  line-height: 1.55;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(34, 227, 107, 0.12);
  border-radius: 3px;
  padding: 8px 10px;
  flex: 1;
  overflow: hidden;
  position: relative;
  font-variant-numeric: tabular-nums;
}
.ao-log::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 30px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.8));
  pointer-events: none;
}
.ao-log-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ao-log-line .ao-ts { color: #4a7a58; margin-right: 8px; }
.ao-log-line .ao-lvl { color: #0E9F49; margin-right: 8px; letter-spacing: 0.1em; }
.ao-log-line .ao-lvl.ok { color: #22E36B; text-shadow: 0 0 4px rgba(34, 227, 107, 0.4); }
.ao-log-line .ao-lvl.warn { color: #c9a227; }

/* Right column: COMMAND DECK */
.ao-deck {
  border: 1px solid rgba(34, 227, 107, 0.18);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(0, 18, 8, 0.6), rgba(0, 4, 2, 0.8));
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}
.ao-deck-title {
  font-size: 12px;
  letter-spacing: 0.36em;
  color: #0E9F49;
  text-transform: uppercase;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(34, 227, 107, 0.16);
  display: flex;
  justify-content: space-between;
}
.ao-deck-title::after {
  content: '▋';
  color: #22E36B;
  animation: ao-blink 1.1s steps(2) infinite;
  text-shadow: 0 0 4px #22E36B;
}
.ao-deck-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ao-btn {
  padding: 10px 8px;
  background: rgba(34, 227, 107, 0.04);
  border: 1px solid rgba(34, 227, 107, 0.28);
  border-radius: 3px;
  color: #c6f0cf;
  font-size: 12px;
  letter-spacing: 0.16em;
  font-family: inherit;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.ao-btn::before {
  content: '›';
  color: #22E36B;
  margin-right: 6px;
  text-shadow: 0 0 4px #22E36B;
}
.ao-btn:hover {
  background: rgba(34, 227, 107, 0.12);
  border-color: rgba(34, 227, 107, 0.6);
  color: #eaffee;
  box-shadow: 0 0 12px rgba(34, 227, 107, 0.35);
  text-shadow: 0 0 4px rgba(34, 227, 107, 0.6);
}
.ao-btn:active { transform: translateY(1px); }

.ao-deck-foot {
  font-size: 12px;
  color: #4a7a58;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-top: 1px dashed rgba(34, 227, 107, 0.14);
  padding-top: 8px;
  line-height: 1.6;
}

/* P6-03: Command button override — 日本語ボタンのために大文字変換を解除 */
.ao-cmd-btn {
  text-transform: none !important;
  letter-spacing: 0.04em;
  font-size: 12px;
  text-align: left;
  padding: 8px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ao-cmd-btn::before {
  content: '' !important;
  margin-right: 0 !important;
}

/* P6-03: Command result display area */
.ao-cmd-result {
  background: rgba(0, 12, 6, 0.5);
  border: 1px solid rgba(34, 227, 107, 0.14);
  border-radius: 4px;
  max-height: 200px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.5;
  min-height: 40px;
}
.ao-cmd-empty {
  opacity: 0.35;
  text-align: center;
  padding: 12px;
  font-size: 12px;
  letter-spacing: 0.1em;
}

/* Close / reopen */
.ao-close-btn {
  padding: 6px 14px;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: #c6f0cf;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(34, 227, 107, 0.3);
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  text-transform: uppercase;
  backdrop-filter: blur(4px);
  white-space: nowrap;
  transition: all 0.15s;
}
.ao-close-btn:hover {
  background: rgba(34, 227, 107, 0.1);
  color: #eaffee;
  border-color: rgba(34, 227, 107, 0.6);
  box-shadow: 0 0 10px rgba(34, 227, 107, 0.35);
}

#ao-reopen-btn {
  position: fixed;
  bottom: 22px;
  left: 22px;
  z-index: 999998;
  padding: 10px 16px;
  background: rgba(0, 8, 4, 0.92);
  border: 1px solid rgba(34, 227, 107, 0.4);
  border-radius: 3px;
  color: #c6f0cf;
  font-size: 12px;
  letter-spacing: 0.22em;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(34, 227, 107, 0.25);
  display: none;
}
#ao-reopen-btn::before {
  content: '◂ ';
  color: #22E36B;
  text-shadow: 0 0 4px #22E36B;
}
#ao-reopen-btn:hover {
  background: rgba(34, 227, 107, 0.12);
  color: #eaffee;
  box-shadow: 0 0 18px rgba(34, 227, 107, 0.5);
}

/* Responsive */
@media (max-width: 1100px) {
  .ao-shell { grid-template-columns: 200px 1fr; }
  .ao-body { grid-template-columns: 1fr; }
  .ao-deck { display: none; }
  .ao-panels-top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ao-memory-container { grid-template-columns: 1fr; }
  .ao-memory-stats { display: none; }
  .ao-status-left .ao-status-pill:nth-child(n+3) { display: none; }
}
@media (max-width: 820px) {
  .ao-shell { grid-template-columns: 1fr; }
  .ao-sidebar { display: none; }
  .ao-panels-top { grid-template-columns: 1fr; }
  .ao-panels-bot { grid-template-columns: 1fr; }
  .ao-clock { font-size: 16px; }
  .ao-status-pill:nth-child(n+3) { display: none; }
  .ao-agents-grid { grid-template-columns: 1fr; }
  .ao-kanban-full { grid-template-columns: 1fr; }
}

/* Utility */
.ao-hidden { display: none !important; }
.ao-mono { font-variant-numeric: tabular-nums; }

/* ============================================================
   Polish v5 — Form elements, Modal, Toast, Skills overlay,
   Memory grid, Conversations scroll, SOUL editor
   ============================================================ */

/* ---- Form elements: dark green theme ---- */
#agentic-os-overlay select,
#agentic-os-overlay input,
#agentic-os-overlay textarea {
  background: #04140a;
  color: #b8f0c8;
  border: 1px solid #0E9F49;
  border-radius: 3px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.04em;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
#agentic-os-overlay select:focus,
#agentic-os-overlay input:focus,
#agentic-os-overlay textarea:focus {
  border-color: #22E36B;
  box-shadow: 0 0 8px rgba(34, 227, 107, 0.35), 0 0 2px rgba(34, 227, 107, 0.6) inset;
}
#agentic-os-overlay select option {
  background: #04140a;
  color: #cfeede;
}
#agentic-os-overlay select option:hover,
#agentic-os-overlay select option:checked {
  background: #0a2a14;
  color: #eaffee;
}
#agentic-os-overlay textarea {
  resize: vertical;
  line-height: 1.5;
}
#agentic-os-overlay input::placeholder,
#agentic-os-overlay textarea::placeholder {
  color: #4a7a58;
}

/* ---- Modal ---- */
.ao-modal {
  position: fixed;
  inset: 0;
  z-index: 1000001;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.ao-modal.ao-modal-visible {
  opacity: 1;
  pointer-events: auto;
}
.ao-modal-box {
  background: linear-gradient(180deg, #041a0c, #020a06);
  border: 1px solid rgba(34, 227, 107, 0.3);
  border-radius: 6px;
  padding: 24px 28px;
  min-width: 340px;
  max-width: 520px;
  box-shadow: 0 0 40px rgba(34, 227, 107, 0.15), 0 0 0 1px rgba(34, 227, 107, 0.06) inset;
}
.ao-modal-title {
  font-size: 14px;
  font-weight: 600;
  color: #eaffee;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(34, 227, 107, 0.2);
}
.ao-modal-body {
  font-size: 12px;
  color: #E4F6E9;
  line-height: 1.6;
  margin-bottom: 20px;
}
.ao-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.ao-btn-cancel {
  border-color: rgba(255, 100, 100, 0.3) !important;
  color: #d4a0a0 !important;
}
.ao-btn-cancel:hover {
  border-color: rgba(255, 100, 100, 0.6) !important;
  background: rgba(255, 50, 50, 0.08) !important;
  box-shadow: 0 0 10px rgba(255, 50, 50, 0.2) !important;
}
.ao-btn-confirm {
  border-color: rgba(34, 227, 107, 0.5) !important;
  color: #eaffee !important;
  background: rgba(34, 227, 107, 0.08) !important;
}
.ao-btn-confirm:hover {
  background: rgba(34, 227, 107, 0.18) !important;
  box-shadow: 0 0 14px rgba(34, 227, 107, 0.4) !important;
}
.ao-btn-sm {
  padding: 6px 12px !important;
  font-size: 12px !important;
}

/* ---- Toast ---- */
.ao-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 1000002;
  padding: 10px 22px;
  background: linear-gradient(180deg, #041a0c, #020a06);
  border: 1px solid rgba(34, 227, 107, 0.35);
  border-radius: 4px;
  color: #c6f0cf;
  font-size: 12px;
  letter-spacing: 0.08em;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  box-shadow: 0 0 20px rgba(34, 227, 107, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  max-width: 480px;
  text-align: center;
}
.ao-toast.ao-toast-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.ao-toast.ao-toast-error {
  border-color: rgba(255, 80, 80, 0.4);
  color: #ffa0a0;
  box-shadow: 0 0 20px rgba(255, 50, 50, 0.2);
}

/* ---- SOUL excerpt clickable ---- */
.ao-soul-clickable {
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ao-soul-clickable:hover {
  border-color: rgba(34, 227, 107, 0.45) !important;
  box-shadow: 0 0 14px rgba(34, 227, 107, 0.15);
}

/* ---- SOUL editor ---- */
.ao-soul-editor {
  margin-top: 12px;
}
.ao-soul-editor textarea {
  width: 100%;
  min-height: 260px;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.6;
  background: #04140a;
  color: #b8f0c8;
  border: 1px solid #0E9F49;
  border-radius: 4px;
  padding: 12px;
}
.ao-soul-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: flex-end;
}

/* ---- Memory view: recent notes grid ---- */
.ao-memory-main-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
}
.ao-vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.ao-vault-card {
  border: 1px solid rgba(34, 227, 107, 0.16);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(0, 18, 8, 0.65), rgba(0, 6, 3, 0.75));
  padding: 12px 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ao-vault-card:hover {
  border-color: rgba(34, 227, 107, 0.35);
  box-shadow: 0 0 14px rgba(0, 255, 20, 0.1);
}
.ao-vault-card-title {
  font-size: 13px;
  color: #eaffee;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.3;
}
.ao-vault-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.ao-vault-card-tag {
  font-size: 12px;
  color: #22E36B;
  opacity: 0.7;
}
.ao-vault-card-date {
  font-size: 12px;
  color: #5e8068;
  letter-spacing: 0.06em;
  margin-top: auto;
}

/* ---- Memory mini graph ---- */
.ao-memory-mini-graph {
  width: 100%;
  height: 80px;
  border: 1px solid rgba(34, 227, 107, 0.12);
  border-radius: 4px;
  background: rgba(0, 10, 5, 0.4);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.ao-memory-mini-graph canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.ao-memory-mini-label {
  position: absolute;
  top: 4px;
  left: 8px;
  font-size: 12px;
  letter-spacing: 0.3em;
  color: #0E9F49;
  text-transform: uppercase;
  z-index: 2;
}

/* ---- Skills overlay / panel ---- */
.ao-skills-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.ao-skills-overlay.ao-skills-visible {
  opacity: 1;
  pointer-events: auto;
}
.ao-skills-panel {
  background: linear-gradient(180deg, #041a0c, #020a06);
  border: 1px solid rgba(34, 227, 107, 0.25);
  border-radius: 8px;
  width: 90vw;
  max-width: 860px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 60px rgba(34, 227, 107, 0.12);
}
.ao-skills-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(34, 227, 107, 0.18);
  display: flex;
  align-items: center;
  gap: 14px;
}
.ao-skills-header-title {
  font-size: 14px;
  letter-spacing: 0.3em;
  color: #0E9F49;
  text-transform: uppercase;
}
.ao-skills-search {
  flex: 1;
  max-width: 320px;
}
.ao-skills-close {
  margin-left: auto;
}
.ao-skills-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  align-content: start;
}
.ao-skill-card {
  border: 1px solid rgba(34, 227, 107, 0.16);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(0, 18, 8, 0.65), rgba(0, 6, 3, 0.75));
  padding: 14px 16px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  cursor: pointer;
}
.ao-skill-card:hover {
  border-color: rgba(34, 227, 107, 0.45);
  box-shadow: 0 0 18px rgba(0, 255, 20, 0.15);
}
.ao-skill-card.ao-skill-active {
  border-color: #22E36B;
  box-shadow: 0 0 20px rgba(34, 227, 107, 0.25), 0 0 0 1px rgba(34, 227, 107, 0.2) inset;
  transform: scale(1.02);
}
.ao-skill-card-name {
  font-size: 13px;
  font-weight: 600;
  color: #eaffee;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.ao-skill-card-desc {
  font-size: 12px;
  color: #7aa386;
  line-height: 1.4;
}

/* ---- Conversations scroll + messages ---- */
.ao-conv-scroll {
  flex: 1;
  overflow-y: auto;
  max-height: calc(100vh - 160px);
  padding: 4px 0;
}
.ao-conv-item {
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ao-conv-item:hover {
  border-color: rgba(34, 227, 107, 0.35);
  box-shadow: 0 0 12px rgba(0, 255, 20, 0.08);
}
.ao-conv-item.ao-conv-selected {
  border-color: #22E36B;
  box-shadow: 0 0 16px rgba(34, 227, 107, 0.15);
}
.ao-conv-messages {
  margin-top: 12px;
  border: 1px solid rgba(34, 227, 107, 0.16);
  border-radius: 6px;
  background: rgba(0, 8, 4, 0.6);
  padding: 12px;
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ao-conv-msg {
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.5;
  max-width: 85%;
  white-space: pre-wrap;
  word-break: break-word;
}
.ao-conv-msg-user {
  background: rgba(34, 227, 107, 0.08);
  border-left: 3px solid #22E36B;
  color: #cfeede;
  align-self: flex-end;
}
.ao-conv-msg-assistant {
  background: rgba(0, 100, 50, 0.08);
  border-left: 3px solid #0E9F49;
  color: #E4F6E9;
  align-self: flex-start;
}
.ao-conv-msg-system {
  background: rgba(100, 100, 0, 0.06);
  border-left: 3px solid #c9a227;
  color: #d4c89a;
  font-size: 12px;
  align-self: center;
  max-width: 100%;
}
.ao-conv-msg-tool {
  background: rgba(80, 80, 120, 0.06);
  border-left: 3px solid #6a6a9a;
  color: #9a9ab8;
  font-size: 12px;
  font-family: monospace;
  align-self: flex-start;
  max-width: 100%;
}

/* ============================================================
   v4-flash: Form readability — dark green theme for overlay forms
   Scope: #agentic-os-overlay only — safe global addition
   Added 2026-06-28
   ============================================================ */
#agentic-os-overlay select,
#agentic-os-overlay input,
#agentic-os-overlay textarea {
  background: #04140a;
  color: #b8f0c8;
  border: 1px solid #0E9F49;
  border-radius: 4px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#agentic-os-overlay select:focus,
#agentic-os-overlay input:focus,
#agentic-os-overlay textarea:focus {
  border-color: #22E36B;
  box-shadow: 0 0 8px rgba(34, 227, 107, 0.4), 0 0 16px rgba(34, 227, 107, 0.2);
}
#agentic-os-overlay option {
  background: #04140a;
  color: #cfeede;
}

/* ============================================================
   v4-flash: Mobile responsive — 390px portrait collapse fixes
   Scope: @media (max-width:640px) only — desktop (1440) untouched
   Added 2026-06-28
   ============================================================ */
@media (max-width: 640px) {
  /* 1. Vertical stack: sidebar on top, main below */
  .ao-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    width: 100%;
  }
  .ao-sidebar {
    width: 100%;
    max-height: 160px;
    overflow-y: auto;
    border-right: none;
    border-bottom: 1px solid rgba(34, 227, 107, 0.18);
    padding: 10px 12px;
  }
  .ao-main {
    width: 100%;
    height: auto;
    min-height: 0;
  }
  /* 2. Status bar — flex wrap to prevent overlap */
  .ao-statusbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    padding: 8px 12px;
    font-size: 12px;
  }
  .ao-status-left {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }
  .ao-status-center {
    gap: 6px;
    font-size: 12px;
  }
  .ao-clock {
    font-size: 13px;
  }
  .ao-clock::after {
    font-size: 12px;
  }
  .ao-status-pill span {
    display: none;
  }
  .ao-date {
    display: none;
  }
  .ao-status-right {
    margin-left: auto;
  }
  /* 3. Hero — smaller height, stack header */
  .ao-hero {
    min-height: 180px;
    flex: 0 0 180px;
  }
  .ao-hero-sub {
    display: none;
  }
  /* 4. Panels & deck — single column */
  .ao-panels-top {
    grid-template-columns: 1fr;
  }
  .ao-panels-bot {
    grid-template-columns: 1fr;
  }
  .ao-deck-grid {
    grid-template-columns: 1fr;
  }
  .ao-body {
    grid-template-columns: 1fr;
    padding: 8px 8px;
  }
  /* 5. Prevent horizontal overflow */
  .ao-shell,
  .ao-sidebar,
  .ao-main,
  .ao-body,
  .ao-stage,
  .ao-deck {
    max-width: 100%;
    overflow-x: hidden;
  }
}

/* === モバイル縦スクロール修正 (2026-06-28) — @media内のみ＝デスクトップ無変化 === */
@media (max-width: 640px) {
  #agentic-os-overlay { overflow-y: auto !important; -webkit-overflow-scrolling: touch; }
  .ao-shell { height: auto !important; min-height: 100vh; }
  .ao-main  { height: auto !important; overflow: visible !important; }
  .ao-stage { overflow: visible !important; }
}

/* ② モバイル: COST/HEALTH を Nimbus AI ショートカットボタンに差し替え (2026-06-29) */
.ao-nimbus-shortcut { display: none; }
@media (max-width: 640px) {
  #ao-cost-card { display: none !important; }
  .ao-nimbus-shortcut { display: block !important; }
}

/* ============================================================
   v4-flash: Mobile Agents Panel (2026-06-29)
   Smartphone-only agent cards + team placeholder hook
   Scope: @media (max-width: 640px) only
   ============================================================ */
#ao-mobile-agents { display: none; }

@media (max-width: 640px) {
  /* --- Layout fix: allow body to grow with mobile panel --- */
  .ao-body { overflow: visible !important; }

  /* --- Mobile panel container --- */
  #ao-mobile-agents {
    display: block;
    grid-column: 1 / -1;
    margin-bottom: 10px;
  }
  .ao-mobile-agents-container {
    border: 1px solid rgba(34, 227, 107, 0.18);
    border-radius: 6px;
    background: linear-gradient(180deg, rgba(0, 18, 8, 0.7), rgba(0, 6, 3, 0.8));
    overflow: hidden;
  }

  /* --- Header --- */
  .ao-mobile-agents-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(34, 227, 107, 0.14);
    font-size: 12px;
    letter-spacing: 0.32em;
    color: #0E9F49;
    text-transform: uppercase;
  }
  .ao-mobile-agents-header::before {
    content: '▸';
    color: #22E36B;
    text-shadow: 0 0 4px #22E36B;
    margin-right: 4px;
    font-size: 12px;
  }
  .ao-mobile-agents-count {
    margin-left: auto;
    font-size: 12px;
    color: #4a7a58;
    letter-spacing: 0.12em;
    white-space: nowrap;
  }

  /* --- Agent cards --- */
  .ao-mobile-agent-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-bottom: 1px solid rgba(34, 227, 107, 0.08);
    cursor: pointer;
    transition: background 0.12s;
    min-width: 0;
    -webkit-tap-highlight-color: rgba(34, 227, 107, 0.15);
  }
  .ao-mobile-agent-card:last-child { border-bottom: none; }
  .ao-mobile-agent-card:active {
    background: rgba(34, 227, 107, 0.08);
  }

  .ao-mobile-agent-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #2a3630;
  }
  .ao-mobile-agent-dot.ao-live {
    background: #22E36B;
    box-shadow: 0 0 6px #22E36B, 0 0 12px rgba(34, 227, 107, 0.5);
    animation: ao-pulse-dot 2.4s ease-in-out infinite;
  }

  .ao-mobile-agent-info {
    flex: 1;
    min-width: 0;
  }
  .ao-mobile-agent-name {
    font-size: 13px;
    color: #e0ffe0;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .ao-mobile-agent-model {
    font-size: 12px;
    color: #5e8068;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ao-mobile-agent-tags {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    align-items: center;
  }
  .ao-mobile-agent-tag {
    font-size: 12px;
    padding: 2px 6px;
    border: 1px solid rgba(34, 227, 107, 0.18);
    border-radius: 2px;
    color: #7aa386;
    background: rgba(34, 227, 107, 0.03);
    letter-spacing: 0.06em;
    white-space: nowrap;
  }
  .ao-mobile-agent-tag.ao-tag-running {
    color: #22E36B;
    border-color: rgba(34, 227, 107, 0.35);
    text-shadow: 0 0 4px rgba(34, 227, 107, 0.15);
    background: rgba(34, 227, 107, 0.06);
  }

  /* --- Footer: expand / remainder --- */
  .ao-mobile-agents-footer {
    padding: 8px 12px;
    border-top: 1px solid rgba(34, 227, 107, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 30px;
  }
  .ao-mobile-agents-more {
    font-size: 12px;
    color: #22E36B;
    cursor: pointer;
    letter-spacing: 0.08em;
    background: none;
    border: 1px solid rgba(34, 227, 107, 0.25);
    border-radius: 3px;
    font-family: inherit;
    padding: 4px 12px;
    text-transform: uppercase;
    transition: background 0.12s;
  }
  .ao-mobile-agents-more:active {
    background: rgba(34, 227, 107, 0.1);
  }
  .ao-mobile-agents-remaining {
    font-size: 12px;
    color: #4a7a58;
    letter-spacing: 0.06em;
    text-align: right;
  }

  /* --- Empty state --- */
  .ao-mobile-agents-empty {
    text-align: center;
    padding: 20px;
    font-size: 12px;
    color: #4a7a58;
    letter-spacing: 0.08em;
  }

  /* --- Team badges in mobile agent cards --- */
  .ao-mobile-team-placeholder { display: none; }
  .ao-mobile-team-placeholder.ao-team-visible {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 0 0 100%;
    padding: 2px 12px 6px 18px;
  }
  .ao-mobile-team-badge {
    font-size: 12px;
    padding: 1px 6px;
    border: 1px solid rgba(91, 255, 158, 0.2);
    border-radius: 8px;
    color: #00cc66;
    background: rgba(0, 32, 0, 0.35);
    white-space: nowrap;
    letter-spacing: 0.04em;
    line-height: 1.5;
  }
  .ao-mobile-team-role {
    opacity: 0.6;
    font-size: 12px;
  }
  .ao-mobile-team-extra {
    font-size: 12px;
    color: #4a7a58;
    padding: 1px 4px;
  }

  /* --- Modal fix: prevent off-screen overflow on small phones --- */
  .ao-modal-box {
    min-width: 0 !important;
    max-width: 92vw !important;
    padding: 18px 16px !important;
  }
  .ao-modal-body {
    max-height: 50vh;
    overflow-y: auto;
  }

  /* --- Agent detail: prevent selects/inputs from breaking layout --- */
  #ao-view-detail select,
  #ao-view-detail .ao-input {
    max-width: 100% !important;
    box-sizing: border-box !important;
    word-break: break-all;
    font-size: 12px !important;
  }
  #ao-detail-content [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Agent detail tags card mobile --- */
  .ao-detail-tags-row {
    flex-wrap: wrap;
  }
  .ao-detail-tags-label {
    min-width: 60px;
  }

  /* --- Horizontal scroll guard --- */
  .ao-shell,
  .ao-sidebar,
  .ao-main,
  .ao-body,
  .ao-stage,
  .ao-deck,
  .ao-mobile-agents-container {
    max-width: 100vw;
    overflow-x: hidden;
  }
  #ao-detail-content {
    max-width: 100vw;
    overflow-x: hidden;
    word-break: break-word;
  }
}

/* ---- Agent detail tags card (view-only) ---- */
.ao-detail-tags .ao-detail-tags-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ao-detail-tags-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
}
.ao-detail-tags-label {
  color: #4a7a58;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  min-width: 70px;
  flex-shrink: 0;
}
.ao-detail-tags-value {
  color: #cfeede;
  word-break: break-word;
  overflow-wrap: break-word;
}
.ao-detail-tags-none {
  opacity: 0.4;
  font-style: italic;
}

/* ---- Team card highlight for focused agent (v4-flash phase 3) ---- */
.ao-team-focused {
  border-color: rgba(34, 227, 107, 0.5) !important;
  box-shadow: 0 0 20px rgba(34, 227, 107, 0.2), 0 0 0 1px rgba(34, 227, 107, 0.15) inset !important;
}
.ao-team-focused-tag {
  display: inline-block;
  font-size: 12px;
  padding: 1px 6px;
  border: 1px solid rgba(34, 227, 107, 0.4);
  border-radius: 8px;
  color: #22E36B;
  background: rgba(0, 40, 0, 0.6);
  letter-spacing: 0.04em;
  margin-left: 8px;
  white-space: nowrap;
  line-height: 1.5;
}
/* ---- Tag Editor Modal (agent detail TAGS/ROLE) ---- */
.ao-tags-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 1000010;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.ao-tags-editor-box {
  background: linear-gradient(180deg, #041a0c, #020a06);
  border: 1px solid rgba(34, 227, 107, 0.3);
  border-radius: 6px;
  box-shadow: 0 0 40px rgba(34, 227, 107, 0.15), 0 0 0 1px rgba(34, 227, 107, 0.06) inset;
  width: 390px;
  max-width: 92vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.ao-tags-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(34, 227, 107, 0.15);
}
.ao-tags-editor-title {
  font-size: 13px;
  color: #eaffee;
  letter-spacing: 0.1em;
}
.ao-tags-editor-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
}
.ao-tags-editor-section {
  margin-bottom: 14px;
}
.ao-tags-editor-section:last-child {
  margin-bottom: 0;
}
.ao-tags-editor-label {
  font-size: 12px;
  color: #4a7a58;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.ao-tags-scroll-group {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.ao-tags-cbx-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #cfeede;
  cursor: pointer;
  padding: 3px 8px;
  border: 1px solid rgba(34, 227, 107, 0.12);
  border-radius: 3px;
  background: rgba(34, 227, 107, 0.03);
  transition: background 0.12s, border-color 0.12s;
}
.ao-tags-cbx-label:hover {
  background: rgba(34, 227, 107, 0.08);
  border-color: rgba(34, 227, 107, 0.3);
}
.ao-tags-cbx-label input[type="checkbox"] {
  accent-color: #22E36B;
  margin: 0;
  flex-shrink: 0;
}
.ao-tags-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px 16px;
  border-top: 1px solid rgba(34, 227, 107, 0.1);
}

/* ---- Mobile overrides for tag editor ---- */
@media (max-width: 640px) {
  .ao-tags-editor-box {
    width: 92vw;
    max-height: 90vh;
  }
  .ao-tags-editor-body {
    padding: 10px 14px;
  }
  .ao-tags-scroll-group {
    max-height: 140px;
  }
}

/* ---- Team Role Editor Modal ---- */
.ao-team-role-modal {
  position: fixed;
  inset: 0;
  z-index: 1000010;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.ao-team-role-box {
  background: linear-gradient(180deg, #041a0c, #020a06);
  border: 1px solid rgba(34, 227, 107, 0.3);
  border-radius: 6px;
  box-shadow: 0 0 40px rgba(34, 227, 107, 0.15), 0 0 0 1px rgba(34, 227, 107, 0.06) inset;
  width: 390px;
  max-width: 92vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.ao-team-role-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(34, 227, 107, 0.15);
}
.ao-team-role-title {
  font-size: 13px;
  color: #eaffee;
  letter-spacing: 0.1em;
}
.ao-team-role-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
}
.ao-team-role-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: rgba(34, 227, 107, 0.03);
  border: 1px solid rgba(34, 227, 107, 0.1);
  border-radius: 4px;
}
.ao-team-role-row:last-child {
  margin-bottom: 0;
}
.ao-team-role-row-name {
  font-size: 12px;
  color: #e0ffe0;
  font-weight: bold;
  letter-spacing: 0.04em;
}
.ao-team-role-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px 16px;
  border-top: 1px solid rgba(34, 227, 107, 0.1);
}

/* ao-input base (used on select/input elements) */
.ao-input {
  background: rgba(10, 14, 8, 0.9);
  color: #e0ffe0;
  border: 1px solid rgba(34, 227, 107, 0.2);
  border-radius: 3px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.04em;
  width: 100%;
  box-sizing: border-box;
}
.ao-input:focus {
  outline: none;
  border-color: rgba(34, 227, 107, 0.5);
  box-shadow: 0 0 8px rgba(34, 227, 107, 0.15);
}
.ao-input option {
  background: #041a0c;
  color: #e0ffe0;
}

/* ============================================================
   DESIGN REFLECTION v4 — Green Cockpit design system (ADDITIVE OVERRIDE)
   非破壊レイヤー：このブロックを丸ごと削除すれば元の見た目に戻る。
   Ref: _planning/mock-aionui-home-reflected.html （承認済みモック）
   反映: ①緑4階調＋状態色 ②本文コントラスト↑ ③mを JetBrains Mono へ
        ④コードレイン(#ao-rain) ⑤状態バッジ ⑥ボタン/カードのグロー
   ============================================================ */
#agentic-os-overlay {
  --grn: #22E36B; --grn-bright: #5BFF9E; --grn-phos: #00FF66; --grn-deep: #0E9F49;
  --txt: #E4F6E9; --txt-mid: #8FB79C; --txt-dim: #5A7A64;
  --amber: #F5B740; --red: #FF6B6B;
  --line: rgba(80, 255, 150, 0.10); --line-2: rgba(80, 255, 150, 0.18);
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', 'Menlo', 'Consolas', monospace;
  color: var(--txt);
}
#agentic-os-overlay,
#agentic-os-overlay * { font-family: var(--mono); }

/* Hero（粒子球パネル） */
#agentic-os-overlay .ao-hero {
  border-color: var(--line-2);
  box-shadow: 0 0 0 1px rgba(91, 255, 158, 0.06) inset, 0 0 26px -6px rgba(34, 227, 107, 0.5);
}
#agentic-os-overlay .ao-hero-label { color: var(--grn-bright); text-shadow: 0 0 10px rgba(34, 227, 107, 0.5); }

/* カード */
#agentic-os-overlay .ao-card {
  background: linear-gradient(180deg, #0D1710, #0A120C);
  border-color: var(--line);
  box-shadow: inset 0 1px 0 rgba(91, 255, 158, 0.04), 0 0 14px -6px rgba(34, 227, 107, 0.3);
}
#agentic-os-overlay .ao-card:hover {
  border-color: var(--line-2);
  box-shadow: inset 0 1px 0 rgba(91, 255, 158, 0.06), 0 0 20px -6px rgba(34, 227, 107, 0.5);
}
#agentic-os-overlay .ao-card-title { color: var(--txt-dim); }

/* ステータスバー pill */
#agentic-os-overlay .ao-status-pill { color: var(--txt-mid); border-color: var(--line); }

/* ブランド発光 */
#agentic-os-overlay .ao-brand-title { text-shadow: 0 0 10px rgba(34, 227, 107, 0.5), 0 0 2px rgba(0, 255, 102, 0.7); }

/* ボタン */
#agentic-os-overlay .ao-btn { border-color: var(--line-2); color: var(--txt); background: #0D1710; }
#agentic-os-overlay .ao-btn:hover { border-color: var(--grn); box-shadow: 0 0 14px -4px var(--grn); }
#agentic-os-overlay .ao-nimbus-shortcut .ao-btn,
#agentic-os-overlay #ao-nimbus-shortcut-btn {
  color: #04140A; border: none;
  background: linear-gradient(150deg, var(--grn-bright), var(--grn-deep));
  box-shadow: 0 6px 18px -4px var(--grn), 0 0 26px -6px rgba(34, 227, 107, 0.6);
}

/* 状態ドット / バッジ */
#agentic-os-overlay .ao-agent-dot.ao-live { background: var(--grn-phos); box-shadow: 0 0 8px var(--grn-phos); }
#agentic-os-overlay .ao-agent-row.ao-active { background: rgba(34, 227, 107, 0.08); box-shadow: inset 2px 0 0 var(--grn); }
#agentic-os-overlay .ao-dot.live { background: var(--grn-phos); box-shadow: 0 0 7px var(--grn-phos); }
#agentic-os-overlay .ao-dot.idle { background: var(--amber); }
#agentic-os-overlay .ao-mobile-agent-tag.ao-tag-running { color: var(--grn-bright); }

/* スキルタグ */
#agentic-os-overlay .ao-tag { color: var(--txt-mid); background: rgba(34, 227, 107, 0.06); border-color: var(--line-2); }
#agentic-os-overlay .ao-tag.hot {
  color: #04140A; border-color: transparent;
  background: linear-gradient(150deg, var(--grn-bright), var(--grn));
  box-shadow: 0 0 12px -3px var(--grn);
}

/* コードレイン（背景演出・追加） */
#ao-rain { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; opacity: 0.18; }
#ao-rain span {
  position: absolute; top: -30%; font: 600 14px/1.3 var(--mono); color: var(--grn-phos);
  white-space: pre; text-align: center; text-shadow: 0 0 6px rgba(0, 255, 102, 0.5);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 42%, #000 84%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 42%, #000 84%, transparent);
  animation: ao-fall linear infinite;
}
@keyframes ao-fall { to { transform: translateY(150vh); } }

/* ============================================================
   Phase 1-3: crystal graph + compact home operations drawer
   ============================================================ */
.ao-body {
  grid-template-columns: minmax(0, 1fr);
}
.ao-ops-shell {
  flex: 0 0 auto;
  min-width: 0;
  border: 1px solid rgba(91, 255, 158, 0.22);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(4, 20, 10, 0.96), rgba(0, 8, 4, 0.96));
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28), inset 0 1px rgba(255,255,255,0.025);
  overflow: hidden;
}
.ao-ops-status {
  min-height: 88px;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(150px, 1.25fr) repeat(3, minmax(115px, 1fr)) 28px;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: #CFEED8;
  background: radial-gradient(circle at 10% 20%, rgba(34,227,107,.12), transparent 38%), rgba(1,13,6,.94);
  border: 0;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.ao-ops-status:hover { background-color: rgba(7, 30, 14, .98); }
.ao-ops-status-main,
.ao-ops-metric { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.ao-ops-status-main b { color: #5BFF9E; font-size: 14px; letter-spacing: .14em; }
.ao-ops-status-main small,
.ao-ops-metric small { color: #63816C; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ao-ops-metric { padding-left: 12px; border-left: 1px solid rgba(91,255,158,.14); }
.ao-ops-metric b { color: #B9DDC3; font-size: 12px; }
.ao-badge-alert b { color: #ff6b35 !important; font-size: 13px !important; }
.ao-requests-wrap { display: flex; flex-direction: column; gap: 10px; max-height: 38vh; overflow-y: auto; }
.ao-req-section { display: flex; flex-direction: column; gap: 4px; }
.ao-req-section-title { font-size: 12px; font-weight: bold; padding: 6px 10px; border-radius: 3px; }
.ao-req-blocked { background: rgba(255, 107, 53, .12); color: #ff6b35; }
.ao-req-running { background: rgba(34, 227, 107, .08); color: #5BFF9E; }
.ao-req-done { background: rgba(91, 255, 158, .06); color: #88aa95; }
.ao-req-item { padding: 8px 12px; font-size: 12px; border-left: 2px solid; border-radius: 2px; background: rgba(0, 20, 10, .3); }
.ao-req-item-blocked { border-left-color: #ff6b35; }
.ao-req-item-running { border-left-color: #5BFF9E; }
.ao-req-item-done { border-left-color: #63816C; opacity: 0.7; }
.ao-req-item-title { color: #E5FCEF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ao-req-item-meta { font-size: 12px; color: #63816C; margin-top: 2px; }
.ao-req-item-reason { font-size: 12px; color: #ff6b35; margin-top: 2px; font-style: italic; }
.ao-req-approve-row { display: flex; gap: 4px; margin-top: 5px; align-items: center; }
.ao-req-approve-input {
  flex: 1;
  font-size: 12px;
  padding: 3px 6px;
  background: rgba(0, 20, 10, .5);
  border: 1px solid rgba(91, 255, 158, .2);
  border-radius: 2px;
  color: #E5FCEF;
  outline: none;
}
.ao-req-approve-input:focus { border-color: rgba(91, 255, 158, .5); }
.ao-req-approve-input::placeholder { color: #63816C; opacity: 0.6; }
.ao-req-approve-btn {
  font-size: 12px;
  padding: 3px 8px;
  background: rgba(91, 255, 158, .15);
  border: 1px solid rgba(91, 255, 158, .4);
  border-radius: 2px;
  color: #5BFF9E;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.ao-req-approve-btn:hover { background: rgba(91, 255, 158, .25); }
.ao-req-approve-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ao-ops-chevron { justify-self: end; color: #5BFF9E; font-size: 18px; transform: rotate(180deg); transition: transform .2s ease; }
.ao-ops-shell.ao-open .ao-ops-chevron { transform: rotate(0deg); }
.ao-ops-drawer {
  max-height: 46vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 14px 14px;
  border-top: 1px solid rgba(91,255,158,.13);
  scrollbar-color: rgba(91,255,158,.35) rgba(0,0,0,.25);
}
.ao-ops-drawer[hidden] { display: none !important; }
.ao-ops-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  padding: 10px 0 8px;
  background: rgba(1, 13, 6, .98);
}
.ao-ops-tab {
  min-height: 38px;
  border: 1px solid rgba(91,255,158,.17);
  border-radius: 5px;
  color: #73967D;
  background: rgba(4,25,11,.55);
  font: 13px/1.3 inherit;
  cursor: pointer;
}
.ao-ops-tab.ao-active { color: #E5FCEF; border-color: rgba(91,255,158,.48); background: rgba(34,227,107,.12); box-shadow: inset 0 -2px #22E36B; }
.ao-ops-panel { padding: 8px 2px 4px; min-width: 0; }
.ao-ops-panel[hidden] { display: none !important; }
.ao-ops-list { display: flex; flex-direction: column; gap: 10px; font-size: 12px; }
.ao-ops-subtitle { margin-top: 18px; }
.ao-ops-title-row { display: flex; align-items: center; gap: 8px; }
#ao-board-select-mini { margin-left: auto; max-width: 160px; background: rgba(0,32,0,.72); color: #5BFF9E; border: 1px solid rgba(91,255,158,.3); border-radius: 4px; font-size: 12px; padding: 6px 10px; }
.ao-ops-system-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 16px; }
.ao-ops-nimbus { width: 100%; margin-top: 12px; }
.ao-ops-panel .ao-log { max-height: 150px; overflow-y: auto; }
.ao-ops-panel .ao-deck-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.ao-graph-legend { pointer-events: auto; }
.ao-graph-chip {
  appearance: none;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.ao-graph-chip:hover { transform: translateY(-1px); border-color: rgba(91,255,158,.62); }
.ao-graph-chip.ao-active { color: #F2FFF6; border-color: #5BFF9E; background: rgba(20,78,39,.92); box-shadow: 0 0 12px rgba(91,255,158,.18); }
.ao-graph-chip small { margin-left: 2px; color: #6F9B7C; font-size: 12px; }
.ao-graph-detail-domain { display: flex; align-items: center; gap: 6px; margin-top: 7px; color: #CFFBE0; font-size: 12px; }
.ao-graph-detail-domain i { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.ao-graph-hover { max-width: 260px; padding: 4px 2px; color: #E8FFF0; font-family: monospace; }
.ao-graph-hover b, .ao-graph-hover span, .ao-graph-hover small { display: block; }
.ao-graph-hover span { margin-top: 4px; color: #83F3AD; font-size: 12px; }
.ao-graph-hover small { margin-top: 5px; color: #A3BEAB; line-height: 1.35; }

@media (max-width: 640px) {
  .ao-hero { height: 430px !important; min-height: 400px; margin-bottom: 10px; }
  .ao-ops-status {
    min-height: 84px;
    grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) 22px;
    gap: 6px;
    padding: 10px;
  }
  .ao-ops-status-main { grid-column: 1 / -1; grid-row: 1; }
  .ao-ops-metric:nth-of-type(2) { display: flex; grid-column: 1; grid-row: 2; }
  .ao-ops-metric:nth-of-type(3) { display: flex; grid-column: 2; grid-row: 2; }
  .ao-ops-metric:nth-of-type(4) { display: flex; grid-column: 3; grid-row: 2; }
  .ao-ops-metric:nth-of-type(n+5) { display: none; }
  .ao-ops-chevron { grid-column: 4; grid-row: 1; }
  .ao-ops-drawer { max-height: 50vh; overflow-y: auto; padding: 0 8px 10px; }
  .ao-ops-tabs { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .ao-ops-system-grid { grid-template-columns: 1fr; }
  .ao-ops-panel .ao-deck-grid { grid-template-columns: 1fr; }
  .ao-graph-legend { left: 8px; right: 8px; bottom: 8px; max-width: none; max-height: 74px; overflow-y: auto; }
  .ao-graph-chip { padding: 5px 7px; }
  .ao-graph-detail { right: 8px; bottom: 88px; width: calc(100% - 16px); max-height: 45%; overflow-y: auto; }
}

@media (min-width: 1024px) {
  .ao-graph-legend { gap: 8px; }
  .ao-graph-chip { padding: 7px 12px; gap: 7px; font-size: 12px; }
  .ao-graph-chip i { width: 9px; height: 9px; }
  .ao-graph-chip small { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .ao-ops-chevron, .ao-graph-chip { transition: none; }
}


/* ── Readability: readable line width + breathing room ── */
/* Cards and sections get more internal breathing room */
#agentic-os-overlay .ao-card {
  padding: 16px 20px;
  margin-bottom: 4px;
}
/* Home view: readable line width (全角40字≒80ch程度) */
#ao-view-home.ao-view-active > .ao-card,
#ao-view-home.ao-view-active > .ao-section-label,
#ao-view-home.ao-view-active > div {
  max-width: 80ch;
}
/* Ensure home view scrolls vertically */
@media (min-width: 641px) {
  #ao-view-home.ao-view-active {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 20px;
  }
}
/* Keep full-width for grid/dashboards that need it */
.ao-graph-full-wrap,
#ao-constellation-canvas,
#ao-memory-canvas {
  max-width: none;
}
