:root {
  color-scheme: light;
  --app-bg: #f7f8fb;
  --sidebar-bg: #edf4fa;
  --sidebar-active: #dde7ef;
  --surface: #ffffff;
  --surface-soft: #f5f6f8;
  --surface-hover: #eef1f4;
  --border: #e3e6ea;
  --border-strong: #d2d8df;
  --text: #16181d;
  --muted: #69727e;
  --subtle: #8c96a3;
  --green: #16a365;
  --blue: #2775d1;
  --yellow: #b7791f;
  --red: #cf3e3e;
  --right-bg: #101319;
  --right-panel: #171b23;
  --right-panel-2: #1e242e;
  --right-border: #313844;
  --right-text: #f3f5f7;
  --right-muted: #a1aab8;
  --shadow: 0 12px 34px rgba(16, 24, 40, .08);
  --sans: "Inter", "Noto Sans JP", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius-sm: 8px; --radius-md: 10px; --radius-lg: 14px; --radius-xl: 18px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.05);
  --shadow-md: 0 8px 24px rgba(16,24,40,.10);
  --ring: 0 0 0 3px rgba(39,117,209,.25);
  --tr: .15s ease;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background: var(--app-bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
}

button, input, textarea, select { font: inherit; }
button { border: 0; cursor: pointer; }

/* ============ login ============ */
.login-body { display: grid; place-items: center; height: 100vh; background: var(--app-bg); overflow: hidden; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 34px; width: 360px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.login-card h1 { margin: 0; font-size: 22px; }
.login-card .sub { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.login-card input { background: var(--surface-soft); border: 1px solid var(--border); color: var(--text);
  border-radius: 9px; padding: 11px 12px; font-size: 15px; }
.login-card input:focus { outline: 0; border-color: var(--blue); }
.login-card button { background: #171a20; color: #fff; border-radius: 10px; padding: 12px; font-size: 15px; font-weight: 700; }
.login-card button:hover { filter: brightness(1.15); }
.login-card .error { background: rgba(207,62,62,.1); color: var(--red); border: 1px solid var(--red);
  border-radius: 9px; padding: 9px 11px; font-size: 13px; }

/* ============ app shell ============ */
.app {
  display: grid;
  grid-template-columns: 296px minmax(520px, 1fr) minmax(440px, 31vw);
  width: 100vw; height: 100vh; min-height: 700px;
  background: var(--app-bg);
}

/* ---- left rail ---- */
.left-rail { display: flex; flex-direction: column;
  min-width: 0; height: 100vh; background: var(--sidebar-bg); border-right: 1px solid #dce6ef; }
.left-rail > * { flex: 0 0 auto; }
.left-rail .project-list { flex: 1 1 auto; }
.window-tools { display: flex; align-items: center; gap: 16px; height: 40px; padding: 0 14px; color: #7b8794; font-size: 14px; font-weight: 700; }
.proj-head { display: flex; align-items: center; justify-content: space-between; }
.mini-add { width: 22px; height: 22px; border-radius: 7px; background: #dbe6ef; color: #4d5966; font-size: 14px; line-height: 1; }
.mini-add:hover { background: #cbd9e6; }
.pg-new { width: 20px; height: 20px; border-radius: 6px; background: transparent; color: #8c98a6; font-size: 13px; }
.pg-new:hover { background: #d8e3ed; color: #2c3540; }
.project-title { justify-content: space-between; cursor: pointer; }
.pt-name { display: inline-flex; align-items: center; gap: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.caret { display: inline-block; font-size: 10px; color: #8c98a6; transition: transform .1s; }
.project-group.collapsed .caret { transform: rotate(-90deg); }
.project-group.collapsed .pg-list { display: none; }
.pt-count { color: #94a0ad; font-size: 11px; }
.new-chat { display: flex; align-items: center; justify-content: space-between; height: 42px; margin: 5px 8px 6px;
  padding: 0 11px; border-radius: 10px; background: #e5edf4; color: #2c3540; font-weight: 650; }
.new-chat:hover { background: #dbe6ef; }
.shortcut { min-width: 47px; padding: 2px 7px; border-radius: 999px; background: #d1dbe5; color: #4d5966; font-size: 11px; text-align: center; }
.nav-stack { display: grid; gap: 2px; padding: 6px 8px 12px; }
.nav-row { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 9px; border-radius: 9px;
  background: transparent; color: #3f4b59; text-align: left; }
.nav-row:hover { background: #e3ecf4; }
.nav-row .glyph { width: 18px; color: #657281; text-align: center; }
.side-label { margin: 4px 14px 8px; color: #94a0ad; font-size: 13px; }
.project-list { min-height: 0; overflow: auto; padding: 0 6px 16px; }
.project-group { margin-bottom: 14px; }
.project-title { display: flex; align-items: center; gap: 7px; height: 30px; padding: 0 8px; color: #29333f; font-weight: 650; }
.conversation { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; width: 100%;
  min-height: 32px; padding: 0 10px 0 22px; border-radius: 10px; background: transparent; color: #2e3844; text-align: left; }
.conversation.active { background: var(--sidebar-active); }
.conversation:hover { background: #e4edf5; }
.conversation span:first-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.age { color: #778493; font-size: 12px; padding-left: 8px; }
.side-footer { display: flex; align-items: center; justify-content: space-between; height: 46px; padding: 0 14px;
  border-top: 1px solid #dfe8f0; color: #34404d; }
.side-footer a { color: #34404d; text-decoration: none; }
.side-footer a:hover { color: var(--blue); }

/* ---- center ---- */
.center { display: grid; grid-template-rows: 44px minmax(0,1fr) auto; min-width: 0; height: 100vh;
  background: var(--surface); border-right: 1px solid var(--border); }
.chat-header { display: flex; align-items: center; justify-content: space-between; min-width: 0; padding: 0 16px;
  border-bottom: 1px solid var(--border); background: rgba(255,255,255,.94); }
.thread-title { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 700; }
.thread-title span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.header-actions { display: flex; align-items: center; gap: 8px; color: #7d8794; }
.ghost-button, .tiny-icon { display: inline-grid; place-items: center; min-width: 32px; height: 32px;
  border: 1px solid transparent; border-radius: 9px; background: transparent; color: inherit; }
.ghost-button:hover, .tiny-icon:hover { border-color: var(--border); background: var(--surface-soft); }

.conversation-pane { min-height: 0; overflow: auto; padding: 0 0 28px; background: var(--surface); }
.hero-spacer { height: 40px; }
.message-row { max-width: 736px; margin: 0 auto 22px; padding: 0 22px; }
.user-bubble { width: fit-content; max-width: min(560px, 80%); margin-left: auto; padding: 13px 16px;
  border-radius: 16px; background: #f0f1f3; color: #252a31; white-space: pre-wrap; word-break: break-word;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.02); }
.elapsed { display: flex; align-items: center; gap: 8px; margin: 22px 0 14px; color: #747f8c; font-size: 13px; }
.elapsed::after { content: ""; height: 1px; flex: 1 1 auto; background: var(--border); }
.assistant-text { color: #22272e; }
.assistant-text p { margin: 0 0 14px; white-space: pre-wrap; word-break: break-word; }
.assistant-text a { color: #0a74dc; text-decoration: none; font-weight: 650; }
.assistant-text.streaming::after { content: "▋"; color: #9aa4b2; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.empty-hint { max-width: 520px; margin: 8vh auto 0; padding: 0 22px; text-align: center; color: var(--subtle); }
.empty-hint h2 { color: var(--text); font-size: 20px; margin: 0 0 8px; }

.composer-wrap { padding: 0 22px 18px; background: linear-gradient(to top, #fff 84%, rgba(255,255,255,0)); }
.composer { max-width: 736px; min-height: 88px; margin: 0 auto; border: 1px solid var(--border); border-radius: 18px;
  background: #fff; box-shadow: 0 10px 30px rgba(15,23,42,.07); }
.composer textarea { display: block; width: 100%; height: 48px; resize: none; padding: 14px 14px 4px; border: 0;
  outline: 0; background: transparent; color: var(--text); font-size: 14px; font-family: inherit; }
.composer textarea::placeholder { color: #8c96a3; }
.composer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 12px 10px; }
.composer-left, .composer-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.agent-select { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 9px;
  border-radius: 999px; color: #2070c8; font-weight: 650; }
.model-select { min-width: 120px; height: 30px; border: 0; background: transparent; color: #5d6672; text-align: right; }
.send { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #171a20; color: #fff; font-size: 18px; }
.send:disabled { opacity: .45; cursor: not-allowed; }

/* ---- right workbench ---- */
.right-workbench { display: grid; grid-template-rows: 36px 44px minmax(0,1fr); min-width: 0; height: 100vh;
  background: var(--right-bg); color: var(--right-text); }
.right-window-bar { display: flex; align-items: center; justify-content: space-between; padding: 0 10px;
  background: #f7f8fa; border-bottom: 1px solid #e3e6ea; color: #8b95a2; }
.tabs { display: flex; align-items: center; gap: 8px; min-width: 0; }
.browser-tab { display: inline-flex; align-items: center; gap: 8px; min-width: 132px; max-width: 200px; height: 28px;
  padding: 0 12px; border-radius: 999px; background: #eef1f4; color: #303946; font-size: 13px; }
.browser-tab.inactive { background: transparent; color: #6b7480; }
.browser-tab span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.address-bar { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 10px;
  padding: 0 12px; border-bottom: 1px solid #252b35; background: #f8f9fb; color: #747f8c; font-size: 13px; }
.address { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #18202a; text-align: center; font-size: 12px; }
.agent-preview { min-height: 0; overflow: auto; padding: 18px 12px 24px; background: #11141a; }
.preview-title { margin: 0 0 2px; font-size: 18px; line-height: 1.2; color: #fff; }
.preview-sub { margin: 0 0 18px; color: var(--right-muted); font-size: 12px; }
.agent-mode { display: flex; gap: 6px; padding: 4px; border: 1px solid var(--right-border); border-radius: 8px;
  background: #151922; flex-wrap: wrap; }
.agent-mode button { height: 32px; padding: 0 10px; border-radius: 6px; background: transparent; color: #a8b1bf;
  font-size: 12px; font-weight: 700; }
.agent-mode button.active { background: #2a3140; color: #fff; box-shadow: inset 0 0 0 1px #3b4557; }
.preview-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 12px 0; color: var(--right-muted); font-size: 13px; }
.dark-select { height: 34px; padding: 0 36px 0 12px; border: 1px solid var(--right-border); border-radius: 8px; background: #171b23; color: #fff; }
.dark-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 10px;
  border: 1px solid rgba(22,163,101,.35); border-radius: 999px; color: #70d19f; font-size: 12px; font-weight: 700; }
.dark-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.dark-pill.idle { color: #8c96a3; border-color: rgba(140,150,163,.35); }
.dark-pill.warn { color: #f2d18d; border-color: rgba(183,121,31,.45); }
.approval { display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; align-items: center; gap: 10px;
  min-height: 48px; margin: 12px 0 18px; padding: 8px 10px; border: 1px solid rgba(183,121,31,.65); border-radius: 8px;
  background: rgba(183,121,31,.16); color: #f2d18d; font-size: 13px; font-weight: 700; }
.dark-button { height: 30px; padding: 0 12px; border: 1px solid #435061; border-radius: 7px; background: #1d2430; color: #e8edf3; font-weight: 700; }
.dark-button.ok { border-color: rgba(22,163,101,.65); color: #8de0b0; }
.dark-button.bad { border-color: rgba(207,62,62,.65); color: #ffaaa5; }
.preview-message { display: grid; grid-template-columns: 28px minmax(0,1fr); gap: 10px; margin-bottom: 18px; }
.dark-avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: #263040;
  color: #cfd7e2; font-size: 12px; font-weight: 800; }
.dark-avatar.ai { background: #17483e; color: #9ff0cf; }
.dark-avatar.router { background: #2b2546; color: #c9bff5; }
.preview-head { display: flex; align-items: center; gap: 8px; min-height: 28px; color: var(--right-muted); font-size: 12px; flex-wrap: wrap; }
.preview-head strong { color: #fff; font-size: 13px; }
.preview-message p { margin: 0; color: #e8ecf2; white-space: pre-wrap; word-break: break-word; }
.code-panel { overflow: hidden; margin-top: 10px; border: 1px solid var(--right-border); border-radius: 8px; background: #12161d; }
.code-head { display: flex; align-items: center; justify-content: space-between; min-height: 34px; padding: 0 11px;
  border-bottom: 1px solid var(--right-border); color: #cdd5df; font-size: 12px; font-weight: 700; }
.code-head span:last-child { color: var(--right-muted); font-weight: 500; }
pre { margin: 0; padding: 13px; overflow: auto; color: #dce4ee; font-family: var(--mono); font-size: 12px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.tool-line { color: #a1aab8; font-family: var(--mono); font-size: 12px; margin: 4px 0; }
.dark-artifact { display: grid; grid-template-columns: 18px minmax(0,1fr); gap: 10px; align-items: center; min-height: 44px;
  margin-top: 8px; padding: 0 12px; border: 1px solid var(--right-border); border-radius: 8px; background: #181d26; color: #edf2f7; }
.dark-artifact span:last-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.right-composer { position: sticky; bottom: 0; margin: 20px 0 0; padding-top: 12px;
  background: linear-gradient(to top, #11141a 80%, rgba(17,20,26,0)); }
.right-input { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; min-height: 84px; padding: 10px;
  border: 1px solid var(--right-border); border-radius: 8px; background: #12161d; }
.right-input textarea { min-width: 0; resize: none; border: 0; outline: 0; background: transparent; color: #fff; font-family: inherit; }
.right-input textarea::placeholder { color: #758092; }
.right-send { align-self: end; height: 38px; padding: 0 14px; border-radius: 8px; background: #62d5c0; color: #07251f; font-weight: 800; }
.right-send:disabled { opacity: .45; cursor: not-allowed; }
.hidden { display: none !important; }

/* scrollbars */
.project-list::-webkit-scrollbar, .conversation-pane::-webkit-scrollbar, .agent-preview::-webkit-scrollbar { width: 9px; }
.conversation-pane::-webkit-scrollbar-thumb { background: #e0e3e8; border-radius: 8px; }
.agent-preview::-webkit-scrollbar-thumb { background: #2a313d; border-radius: 8px; }

/* ===== toggle / search / menus / viewer (v3) ===== */
.app { position: relative; }
.app.right-collapsed { grid-template-columns: 296px minmax(520px,1fr); }
.app.right-collapsed .right-workbench { display: none; }

.search-box { padding: 0 8px 6px; }
.search-box input { width: 100%; height: 34px; border: 1px solid var(--border-strong); border-radius: 9px; background: #fff; padding: 0 10px; }
.search-box input:focus { outline: 0; border-color: var(--blue); }
.settings-btn { background: transparent; color: #34404d; }
.settings-btn:hover { color: var(--blue); }
.who { font-size: 12px; color: #6a7682; }
.who a { color: #6a7682; }

.menu-anchor { position: relative; }
.popmenu { position: absolute; bottom: 42px; left: 0; z-index: 40; min-width: 220px; background: #fff;
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: grid; gap: 2px; }
.popmenu button { display: block; width: 100%; text-align: left; padding: 9px 11px; border-radius: 8px; background: transparent; color: #2e3844; }
.popmenu button:hover { background: var(--surface-soft); }
.popmenu button.sel { background: var(--surface-soft); color: var(--blue); font-weight: 650; }

.attach-chips { max-width: 736px; margin: 0 auto 8px; display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: #fff; font-size: 12px; color: #34404d; }
.chip button { background: transparent; color: #9aa4b2; font-size: 14px; line-height: 1; }
.send i { font-style: normal; font-size: 15px; }
.mobile-only { display: none; }

.file-viewer { grid-row: 3; min-height: 0; overflow: auto; background: #0f1218; display: flex; flex-direction: column; }
.fv-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--right-border);
  position: sticky; top: 0; background: #0f1218; }
.fv-name { flex: 1; color: #fff; font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dark-close { color: #aab3c0; }
#fv-body { color: #dce4ee; padding: 14px; }
.scrim { position: absolute; inset: 0; background: rgba(8,11,16,.5); z-index: 30; }
.drop-overlay { position: absolute; inset: 0; z-index: 60; background: rgba(39,117,209,.10);
  border: 2px dashed var(--blue); display: flex; align-items: center; justify-content: center; }
.drop-inner { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 18px 28px;
  font-weight: 650; color: var(--blue); box-shadow: var(--shadow); pointer-events: none; }

/* ===== markdown rendering (assistant) v6 ===== */
.assistant-text.md { white-space: normal; }
.assistant-text.md > :first-child { margin-top: 0; }
.assistant-text.md h1, .assistant-text.md h2, .assistant-text.md h3 { margin: 18px 0 8px; line-height: 1.3; }
.assistant-text.md h1 { font-size: 20px; } .assistant-text.md h2 { font-size: 17px; } .assistant-text.md h3 { font-size: 15px; }
.assistant-text.md p { margin: 0 0 12px; }
.assistant-text.md ul, .assistant-text.md ol { margin: 0 0 12px; padding-left: 22px; }
.assistant-text.md li { margin: 3px 0; }
.assistant-text.md code { background: #f0f1f3; border-radius: 5px; padding: 1px 5px; font-family: var(--mono); font-size: 12.5px; }
.assistant-text.md pre { background: #f5f6f8; border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin: 0 0 12px; overflow: auto; }
.assistant-text.md pre code { background: transparent; padding: 0; }
.assistant-text.md blockquote { margin: 0 0 12px; padding: 2px 14px; border-left: 3px solid var(--border-strong); color: var(--muted); }
.assistant-text.md table { border-collapse: collapse; margin: 0 0 12px; font-size: 13px; }
.assistant-text.md th, .assistant-text.md td { border: 1px solid var(--border); padding: 5px 9px; }
.assistant-text.md a { color: #0a74dc; text-decoration: none; font-weight: 650; }
.assistant-text.md hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }

/* ===== skills cards ===== */
.skills-grid { max-width: 760px; margin: 0 auto; padding: 8px 22px 28px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.skill-card { border: 1px solid var(--border); border-radius: 10px; background: #fff; padding: 12px 14px; cursor: pointer; }
.skill-card:hover { border-color: var(--blue); background: var(--surface-soft); }
.skill-card strong { display: block; font-size: 13px; margin-bottom: 4px; }
.skill-card span { display: block; color: var(--muted); font-size: 12px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.skills-head { max-width: 760px; margin: 0 auto; padding: 18px 22px 0; }
.dark-artifact { cursor: pointer; }
.dark-artifact:hover { border-color: #3b4557; }
.path-link { color: #7fc4ff; cursor: pointer; text-decoration: underline; word-break: break-all; }

@media (max-width: 1320px) { .app { grid-template-columns: 260px minmax(480px,1fr) 400px; }
  .app.right-collapsed { grid-template-columns: 260px minmax(480px,1fr); } }
@media (max-width: 1080px) {
  body { overflow: auto; }
  .app { grid-template-columns: 248px minmax(0,1fr); height: auto; min-height: 100vh; }
  .right-workbench { display: none; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0,1fr); }
  .left-rail { display: none; }
  .center { min-height: 100vh; }
  .message-row { padding: 0 14px; }
  .user-bubble { max-width: 92%; }
}

/* ===== mobile overlays (v3) ===== */
@media (max-width: 1080px) {
  body { overflow: hidden; }
  .app, .app.right-collapsed { grid-template-columns: 248px minmax(0,1fr); height: 100vh; }
  .right-workbench { display: none; }
  .app.right-open .right-workbench {
    display: grid; position: absolute; top: 0; right: 0; height: 100vh; width: min(460px, 94vw); z-index: 35;
    box-shadow: -8px 0 30px rgba(0,0,0,.35);
  }
}
@media (max-width: 760px) {
  .app, .app.right-collapsed { grid-template-columns: minmax(0,1fr); }
  .mobile-only { display: inline-grid; }
  .left-rail { display: none; }
  .app.left-open .left-rail {
    display: grid; position: absolute; top: 0; left: 0; height: 100vh; width: min(300px, 88vw); z-index: 35;
    box-shadow: 8px 0 30px rgba(0,0,0,.25);
  }
  .app.right-open .right-workbench { width: 100vw; }
  .composer, .attach-chips, .message-row { max-width: 100%; }
}

/* ===== polish pass (v10) — keep Codex look, refine quality ===== */
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; letter-spacing: -0.006em; }
.nav-row, .conversation, .new-chat, .pill-button, .ghost-button, .tiny-icon, .send, .agent-mode button,
.dark-button, .right-send, .skill-card, .popmenu button, .mini-add, .pg-new, .file-card, .chip, .settings-btn {
  transition: background var(--tr), border-color var(--tr), color var(--tr), box-shadow var(--tr), transform var(--tr);
}
/* クリック時の枠線は出さない */
input:focus-visible, select:focus-visible { outline: none; box-shadow: var(--ring); }
button:focus, a:focus, button:focus-visible, a:focus-visible,
textarea:focus, textarea:focus-visible { outline: none; box-shadow: none; }
.composer:focus-within { border-color: var(--border); }
.pill-button:active, .send:active, .dark-button:active, .right-send:active, .new-chat:active { transform: translateY(.5px) scale(.99); }
.send { box-shadow: var(--shadow-sm); }
.send:hover { filter: brightness(1.18); }
/* アクティブな会話は灰色背景のみ（青線なし） */
.conversation.active { background: #e4e6e9; box-shadow: none; }
.file-card { box-shadow: var(--shadow-sm); }
.file-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.popmenu { box-shadow: var(--shadow-md); }
.skill-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.window-tools span, .preview-title, .login-card h1 { letter-spacing: -0.012em; }
.agent-mode button:hover { color: #fff; }
.new-chat:hover { box-shadow: var(--shadow-sm); }
.login-card input:focus, .search-box input:focus { outline: none; box-shadow: var(--ring); }

/* ===== mobile viewport height fix (v12) ===== */
@supports (height: 100dvh) {
  .app, .left-rail, .center, .right-workbench, .login-body { height: 100dvh; }
  .app.left-open .left-rail, .app.right-open .right-workbench { height: 100dvh; }
}
@media (max-width: 760px) {
  .composer-wrap { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .conversation-pane { padding-bottom: 16px; }
}

/* ===== footer buttons + usage view (v12) ===== */
.footer-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.settings-btn { background: transparent; color: #34404d; font-size: 13px; white-space: nowrap; padding: 4px 2px; }
.settings-btn:hover { color: var(--blue); }
.side-footer .who { font-size: 12px; color: #6a7682; white-space: nowrap; }
.usage-wrap { max-width: 760px; margin: 0 auto; padding: 22px; }
.usage-wrap h2 { margin: 0 0 6px; font-size: 20px; }
.usage-wrap h3 { margin: 18px 0 8px; font-size: 13px; color: var(--muted); }
.usage-note { color: var(--muted); font-size: 13px; margin: 0 0 8px; line-height: 1.6; }
.usage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.usage-card { background: var(--surface-soft); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.usage-card span { color: var(--muted); font-size: 12px; }
.usage-card strong { font-size: 20px; font-weight: 600; }

/* ===== chat/project rename & delete (v14) ===== */
.conversation { display: flex; align-items: center; gap: 6px; }
.conv-title { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.age { white-space: nowrap; flex: 0 0 auto; }
.conv-actions { display: none; align-items: center; gap: 1px; flex: 0 0 auto; }
.conversation:hover .conv-actions { display: flex; }
.conversation:hover .age { display: none; }
.conv-rename, .conv-del { width: 22px; height: 22px; border-radius: 6px; background: transparent; color: #8c98a6; font-size: 12px; line-height: 1; }
.conv-rename:hover { background: #d8e3ed; color: #2c3540; }
.conv-del:hover { background: #f1d4d4; color: var(--red); }
.pg-tools { display: inline-flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.pg-rename { width: 20px; height: 20px; border-radius: 6px; background: transparent; color: #8c98a6; font-size: 12px; line-height: 1; }
.pg-rename:hover { background: #d8e3ed; color: #2c3540; }
