/* k428 - スタンドアロン スタイルシート */

/* ============================================================
   CSS Variables (inunote ベースの配色)
   ============================================================ */
:root {
  --bg: #F4F6F9;
  --card-bg: #FBFCFE;
  --primary: #282a36;
  --primary-hover: #3a3d4e;
  --secondary: #4A5568;
  --heading: #3D4F5F;
  --text: #3A4550;
  --text-light: #8896A4;
  --border: #D8DEE6;
  --border-light: #E2E8F0;
  --white: #ffffff;

  --primary-alpha-10: rgba(40, 42, 54, 0.10);
  --primary-alpha-15: rgba(40, 42, 54, 0.15);
  --primary-alpha-20: rgba(40, 42, 54, 0.20);
  --black-alpha-10: rgba(0, 0, 0, 0.10);
  --black-alpha-50: rgba(0, 0, 0, 0.50);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 50%;
}

/* ============================================================
   リセット & ベース
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-size: 17px;
  font-family: 'Zen Maru Gothic', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

#app {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0;
  overflow: hidden;
}

/* ============================================================
   認証画面
   ============================================================ */
.auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 1000;
}

.auth-container {
  text-align: center;
  padding: 48px 40px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 24px rgba(74, 85, 104, 0.08);
  max-width: 380px;
  width: 90%;
}

.auth-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-logo-img {
  width: 56px;
  height: 56px;
  color: #6b7b8d;
}

.auth-container h1 {
  font-size: 1.5rem;
  color: var(--heading);
  margin-bottom: 8px;
}

.auth-container p {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 24px;
}

.google-signin-button {
  display: flex;
  justify-content: center;
}

.auth-error {
  margin-top: 16px;
  padding: 10px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  color: #dc2626;
  font-size: 0.85rem;
}

/* ============================================================
   ナビゲーションバー
   ============================================================ */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--primary);
  color: var(--white);
  flex-shrink: 0;
  height: 48px;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-kamon-btn {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: opacity 0.2s;
}

.navbar-kamon-btn:hover {
  opacity: 0.7;
}

.navbar-icon-img {
  width: 24px;
  height: 24px;
  animation: spin 20s linear infinite;
}


/* ナビバー タブ */
.navbar-tabs {
  display: flex;
  gap: 2px;
  margin-left: 16px;
}

.navbar-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  transition: all 0.2s;
}

.navbar-tab:hover {
  background: rgba(255,255,255,0.25);
}

.navbar-tab.active {
  background: rgba(255,255,255,0.3);
  color: white;
}

.navbar-tab .material-symbols-outlined {
  font-size: 16px;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ヘッダー使用率インジケーター */
.header-usage {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-right: 6px;
  padding-right: 12px;
  border-right: 1px solid rgba(255,255,255,0.2);
}

.header-usage:empty {
  display: none;
}

.aws-cost {
  flex-direction: column;
  gap: 1px;
  margin-right: 6px;
  padding-right: 12px;
  border-right: 1px solid rgba(255,255,255,0.2);
}

.aws-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.aws-label {
  font-size: 0.5rem;
  font-weight: 500;
  opacity: 0.6;
  min-width: 22px;
  letter-spacing: 0.3px;
}

.aws-val {
  font-size: 0.55rem;
  font-weight: 600;
  color: #e8c97a;
  font-family: 'Consolas', 'Monaco', monospace;
  min-width: 44px;
  text-align: right;
}

.header-usage .sys-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-usage .sys-label {
  font-size: 0.55rem;
  font-weight: 500;
  opacity: 0.7;
  letter-spacing: 0.5px;
  min-width: 26px;
}

.header-usage .sys-bar {
  width: 40px;
  height: 3px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  overflow: hidden;
}

.header-usage .sys-fill {
  height: 100%;
  border-radius: 2px;
  background: rgba(255,255,255,0.8);
  transition: width 0.6s ease, background 0.6s ease;
}

.header-usage .sys-fill.warn {
  background: #f9e2af;
}

.header-usage .sys-fill.danger {
  background: #f38ba8;
}

.header-usage .sys-error-text {
  font-size: 0.55rem;
  opacity: 0.7;
  color: #f9e2af;
}

.header-usage .sys-value {
  font-size: 0.55rem;
  min-width: 22px;
  text-align: right;
  opacity: 0.8;
  font-family: 'Consolas', 'Monaco', monospace;
}

/* システム統計インジケーター */
.system-stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-right: 6px;
  padding-right: 12px;
  border-right: 1px solid rgba(255,255,255,0.2);
}

.sys-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sys-label {
  font-size: 0.55rem;
  font-weight: 500;
  opacity: 0.7;
  letter-spacing: 0.5px;
  min-width: 26px;
}

.sys-bar {
  width: 40px;
  height: 3px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  overflow: hidden;
}

.sys-fill {
  height: 100%;
  border-radius: 2px;
  background: rgba(255,255,255,0.8);
  transition: width 0.6s ease, background 0.6s ease;
  width: 0%;
}

.sys-fill.warn {
  background: #f9e2af;
}

.sys-fill.danger {
  background: #f38ba8;
}

.sys-value {
  font-size: 0.55rem;
  min-width: 22px;
  text-align: right;
  opacity: 0.8;
  font-family: 'Consolas', 'Monaco', monospace;
}

/* バッテリーインジケーター */
.navbar-battery {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-right: 6px;
  padding-right: 12px;
  border-right: 1px solid rgba(255,255,255,0.2);
}

.navbar-battery-icon {
  font-size: 1.1rem;
  opacity: 0.9;
}

.navbar-battery-value {
  font-size: 0.65rem;
  opacity: 0.85;
  font-family: 'Consolas', 'Monaco', monospace;
  min-width: 24px;
}

.navbar-battery.low .navbar-battery-icon,
.navbar-battery.low .navbar-battery-value {
  color: #f9e2af;
}

.navbar-battery.critical .navbar-battery-icon,
.navbar-battery.critical .navbar-battery-value {
  color: #f38ba8;
}

.navbar-moon {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: 6px;
  padding-right: 10px;
  border-right: 1px solid rgba(255,255,255,0.2);
}

.navbar-moon-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.navbar-moon-name {
  font-size: 0.6rem;
  opacity: 0.8;
  white-space: nowrap;
}

.navbar-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: 2px solid rgba(255,255,255,0.4);
  object-fit: cover;
}

.navbar-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
  min-width: 58px;
}

.navbar-clock-time {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--white);
  font-family: 'Segoe UI', 'Segoe', sans-serif;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}

.navbar-clock-date {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.75);
  font-family: 'Segoe UI', 'Segoe', sans-serif;
  letter-spacing: 0.02em;
}

/* ============================================================
   プロフィールモーダル
   ============================================================ */
.profile-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--black-alpha-50);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-modal {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 28px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 300px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.profile-modal-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--primary);
  object-fit: cover;
  margin-bottom: 4px;
}

.profile-modal-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--heading);
}

.profile-modal-email {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 8px;
}

.profile-modal-logout {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 24px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  transition: background 0.2s;
}

.profile-modal-logout:hover {
  background: var(--primary-hover);
}

.profile-modal-logout .material-symbols-outlined {
  font-size: 18px;
}

/* ============================================================
   ナビゲーションドロワー（モバイル専用）
   ============================================================ */
.nav-drawer,
.session-list,
.chat-messages,
.gcal-grid,
.gmail-list,
.gmail-detail,
.gmail-detail-body,
.files-list,
.xterm-viewport {
  touch-action: pan-y;
}

.nav-drawer {
  position: fixed;
  left: -290px;
  top: 0;
  width: 280px;
  height: 100vh;
  height: 100dvh;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: left 0.25s ease;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.15);
  overflow-y: auto;
}

.nav-drawer.open {
  left: 0;
}

.nav-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--black-alpha-50);
  z-index: 199;
}

.nav-drawer-overlay.active {
  display: block;
}

.nav-drawer-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--primary);
  flex-shrink: 0;
}

.nav-drawer-kamon {
  width: 24px;
  height: 24px;
  animation: spin 20s linear infinite;
}

.nav-drawer-title {
  font-size: 1rem;
  font-weight: 600;
  color: white;
  letter-spacing: 0.05em;
  flex: 1;
}

.nav-drawer-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.nav-drawer-close:hover {
  color: white;
  background: rgba(255, 255, 255, 0.15);
}

.nav-drawer-close .material-symbols-outlined {
  font-size: 20px;
}

.nav-drawer-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.nav-drawer-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid var(--primary);
  object-fit: cover;
  margin-bottom: 8px;
}

.nav-drawer-user-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--heading);
  text-align: center;
}

.nav-drawer-user-email {
  font-size: 0.78rem;
  color: var(--text-light);
  text-align: center;
  margin-top: 2px;
}

.nav-drawer-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  gap: 2px;
}

.nav-drawer-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  background: none;
  border: none;
  border-radius: 0;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  width: 100%;
}

.nav-drawer-tab:hover {
  background: var(--primary-alpha-10);
}

.nav-drawer-tab.active {
  background: var(--primary-alpha-15);
  color: var(--primary);
  font-weight: 600;
}

.nav-drawer-tab .material-symbols-outlined {
  font-size: 22px;
  flex-shrink: 0;
}

.nav-drawer-tab.active .material-symbols-outlined {
  color: var(--primary);
}

.nav-drawer-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.nav-drawer-reload {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-light);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
  margin-bottom: 8px;
}

.nav-drawer-reload:hover {
  background: var(--primary-alpha-10);
  color: var(--text);
}

.nav-drawer-reload .material-symbols-outlined {
  font-size: 18px;
}

.nav-drawer-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-light);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.nav-drawer-logout:hover {
  background: var(--primary-alpha-10);
  color: var(--text);
}

.nav-drawer-logout .material-symbols-outlined {
  font-size: 18px;
}

/* ============================================================
   チャットレイアウト
   ============================================================ */
.aichat-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

/* ============================================================
   サイドバー（セッション一覧）
   ============================================================ */
.aichat-sidebar {
  width: 260px;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--card-bg);
  overflow: hidden;
}

.sidebar-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-title {
  font-size: 0.85rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-title .material-symbols-outlined {
  font-size: 16px;
}

.btn-new-session {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  transition: background 0.2s;
}

.btn-new-session:hover {
  background: var(--primary-hover);
}

.btn-new-session .material-symbols-outlined {
  font-size: 18px;
}

/* プロバイダー選択 */
.provider-tabs {
  display: flex;
  gap: 4px;
}

.provider-tab {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-light);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  text-align: center;
  transition: all 0.2s;
}

.provider-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* セッションリスト */
.session-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.session-item {
  display: flex;
  align-items: center;
  padding: 9px 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  position: relative;
  gap: 8px;
  min-width: 0;
}

.session-item:hover {
  background: var(--primary-alpha-10);
}

.session-item.active {
  background: var(--primary-alpha-15);
  border-left-color: var(--primary);
}

.session-item-icon {
  font-size: 14px;
  color: var(--text-light);
  flex-shrink: 0;
}

.session-item-body {
  flex: 1;
  min-width: 0;
}

.session-item-title {
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-item-meta {
  font-size: 0.72rem;
  color: var(--text-light);
  margin-top: 1px;
}

.session-item-delete {
  opacity: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  padding: 2px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.session-item:hover .session-item-delete {
  opacity: 1;
}

.session-item-delete:hover {
  color: #c0392b;
  background: rgba(192, 57, 43, 0.1);
}

.session-item-delete .material-symbols-outlined {
  font-size: 16px;
}

.session-item-streaming {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  animation: pulse 1.5s ease-in-out infinite;
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ============================================================
   メインパネル（チャットエリア）
   ============================================================ */
.aichat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* アプリタイトルバー */
.aichat-titlebar {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.aichat-titlebar-icon {
  width: 30px;
  height: 30px;
  background: var(--primary-alpha-15);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.aichat-titlebar-icon .material-symbols-outlined {
  font-size: 18px;
  color: var(--primary);
}

.aichat-titlebar-text h2 {
  font-size: 0.95rem;
  color: var(--heading);
}

.aichat-titlebar-text span {
  font-size: 0.75rem;
  color: var(--text-light);
}

.aichat-titlebar-provider {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-light);
}

.provider-badge {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  background: var(--primary-alpha-15);
  color: var(--secondary);
}

/* チャットメッセージエリア */
.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  gap: 12px;
  padding: 40px;
}

.chat-empty .material-symbols-outlined {
  font-size: 48px;
  opacity: 0.4;
}

.chat-empty p {
  font-size: 0.9rem;
  text-align: center;
}

/* メッセージバブル */
.message {
  display: flex;
  gap: 10px;
  max-width: 90%;
}

.message.user-message {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message.assistant-message {
  align-self: flex-start;
}

.message-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--primary-alpha-20);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.message-avatar .material-symbols-outlined {
  font-size: 16px;
  color: var(--secondary);
}

.user-message .message-avatar {
  background: var(--primary);
}

.user-message .message-avatar .material-symbols-outlined {
  color: white;
}

.message-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.message-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  line-height: 1.65;
  word-break: break-word;
}

.user-message .message-bubble {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: var(--radius-sm);
}

.assistant-message .message-bubble {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: var(--radius-sm);
}

/* マークダウンスタイル（アシスタントメッセージ内） */
.assistant-message .message-bubble h1,
.assistant-message .message-bubble h2,
.assistant-message .message-bubble h3 {
  margin: 0.8em 0 0.4em;
  color: var(--heading);
}

.assistant-message .message-bubble p {
  margin: 0.4em 0;
}

.assistant-message .message-bubble p:first-child {
  margin-top: 0;
}

.assistant-message .message-bubble p:last-child {
  margin-bottom: 0;
}

.assistant-message .message-bubble code {
  background: var(--primary-alpha-10);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 0.85em;
  font-family: 'Consolas', 'Monaco', monospace;
}

.assistant-message .message-bubble pre {
  background: #1e1e2e;
  border-radius: var(--radius-md);
  padding: 12px;
  overflow-x: auto;
  margin: 0.6em 0;
}

.assistant-message .message-bubble pre code {
  background: none;
  border: none;
  padding: 0;
  color: #cdd6f4;
  font-size: 0.85em;
}

.assistant-message .message-bubble ul,
.assistant-message .message-bubble ol {
  padding-left: 1.4em;
  margin: 0.4em 0;
}

.assistant-message .message-bubble li {
  margin: 0.2em 0;
}

.assistant-message .message-bubble blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 10px;
  margin: 0.6em 0;
  color: var(--text-light);
}

.assistant-message .message-bubble hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.8em 0;
}

.assistant-message .message-bubble table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.85em;
  margin: 0.6em 0;
}

.assistant-message .message-bubble th,
.assistant-message .message-bubble td {
  border: 1px solid var(--border);
  padding: 5px 8px;
}

.assistant-message .message-bubble th {
  background: var(--primary-alpha-10);
}

/* ツール使用インジケーター */
.tool-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  color: var(--text-light);
  margin: 2px 0;
}

.tool-indicator .material-symbols-outlined {
  font-size: 14px;
}

/* ストリーミング中のカーソル */
.streaming-cursor::after {
  content: '\25CC';
  animation: blink 1s step-end infinite;
  color: var(--primary);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* チャット入力エリア */
.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
  flex-shrink: 0;
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px 10px;
  transition: border-color 0.2s;
}

.chat-input-wrapper:focus-within {
  border-color: var(--primary);
}

.chat-input {
  flex: 1;
  border: none;
  background: none;
  resize: none;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  line-height: 1.5;
  max-height: 200px;
  overflow-y: auto;
  -webkit-user-select: text;
  user-select: text;
}

.chat-input::placeholder {
  color: var(--text-light);
}

.chat-send-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}

.chat-send-btn:hover:not(:disabled) {
  background: var(--primary-hover);
}

.chat-send-btn:disabled {
  background: var(--border);
  cursor: not-allowed;
}

.chat-send-btn .material-symbols-outlined {
  font-size: 18px;
}

/* 送信中のストップボタン */
.chat-stop-btn {
  background: #e74c3c;
  color: white;
  border: none;
  border-radius: var(--radius-md);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}

.chat-stop-btn:hover {
  background: #c0392b;
}

.chat-stop-btn .material-symbols-outlined {
  font-size: 18px;
}

/* セッション未選択時の空状態 */
.no-session-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  gap: 16px;
  padding: 40px;
}

.no-session-placeholder .material-symbols-outlined {
  font-size: 56px;
  opacity: 0.3;
}

.no-session-placeholder h3 {
  font-size: 1rem;
  color: var(--text-light);
}

/* ============================================================
   ローディング状態
   ============================================================ */
.thinking-indicator {
  display: flex;
  gap: 5px;
  padding: 10px 14px;
  align-items: center;
}

.thinking-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  animation: thinking 1.2s ease-in-out infinite;
}

.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinking {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ============================================================
   モバイル対応
   ============================================================ */
@media (max-width: 768px) {
  /* iOS Safari でキーボード表示時に body がスクロールしないよう固定
     position: fixed はタップイベントを阻害するため使わない */
  html, body {
    overflow: hidden;
    overscroll-behavior: none;
  }

  /* スクロールバーを非表示（webkit） */
  ::-webkit-scrollbar {
    display: none;
  }

  /* スクロールバーを非表示（Firefox） */
  * {
    scrollbar-width: none;
  }
  .aichat-sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    height: 100vh;
    z-index: 100;
    transition: left 0.25s ease;
    box-shadow: 2px 0 8px var(--black-alpha-10);
  }

  .aichat-sidebar.open {
    left: 0;
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--black-alpha-50);
    z-index: 99;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .system-stats {
    display: none;
  }

  .header-usage {
    display: none;
  }

  /* モバイルではナビバータブを非表示（ドロワーに移動） */
  .navbar-tabs {
    display: none;
  }
}

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}

.mobile-menu-btn .material-symbols-outlined {
  font-size: 22px;
}

/* ============================================================
   使用率ゲージパネル
   ============================================================ */
.usage-panel {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.usage-panel:empty {
  display: none;
}

.usage-section-title {
  font-size: 0.72rem;
  color: var(--text-light);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.usage-section-title .material-symbols-outlined {
  font-size: 13px;
}

.usage-gauge {
  margin-bottom: 6px;
}

.usage-gauge:last-child {
  margin-bottom: 0;
}

.usage-gauge-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3px;
}

.usage-gauge-label {
  font-size: 0.72rem;
  color: var(--text-light);
}

.usage-gauge-value {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text);
}

.usage-gauge-bar {
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.usage-gauge-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
  background: var(--primary);
}

.usage-gauge-fill.warn {
  background: #e67e22;
}

.usage-gauge-fill.danger {
  background: #e74c3c;
}

.usage-gauge-reset {
  font-size: 0.65rem;
  color: var(--text-light);
  margin-top: 2px;
}

.usage-section + .usage-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.usage-stat {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-light);
  margin-bottom: 2px;
}

.usage-stat-value {
  color: var(--text);
  font-weight: 500;
}

/* ============================================================
   ターミナルビュー
   ============================================================ */
.terminal-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.terminal-container {
  flex: 1;
  display: flex;
  min-height: 0;
}

.terminal-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.terminal-pane + .terminal-pane {
  border-left: 1px solid var(--border);
}

.terminal-pane-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #181825;
  color: #bac2de;
  font-size: 0.72rem;
  font-family: 'Consolas', 'Monaco', monospace;
  flex-shrink: 0;
  border-bottom: 1px solid #313244;
  border-top: 2px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.terminal-pane.active .terminal-pane-header {
  background: #221e14;
  color: #f9e2af;
  border-top-color: #f9e2af;
  border-bottom-color: #3d3520;
}

.terminal-status {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.terminal-status.connected {
  background: #a6e3a1;
}

.terminal-status.disconnected {
  background: #f38ba8;
}

.term-scrollback-btn {
  margin-left: auto;
  padding: 1px 7px;
  background: #313244;
  border: 1px solid #45475a;
  border-radius: 3px;
  color: #bac2de;
  font-size: 0.68rem;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.4;
}

.term-scrollback-btn:hover {
  background: #45475a;
  border-color: #89b4fa;
  color: #cdd6f4;
}

.terminal-pane-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #1e1e2e;
}

.terminal-pane-body .xterm {
  height: 100%;
  padding: 4px;
}

/* xterm カスタムスクロールバー */
.xterm-viewport::-webkit-scrollbar {
  width: 10px;
}

.xterm-viewport::-webkit-scrollbar-track {
  background: transparent;
}

.xterm-viewport::-webkit-scrollbar-thumb {
  background: #585b70;
  border-radius: 4px;
  min-height: 40px;
}

.xterm-viewport::-webkit-scrollbar-thumb:hover {
  background: #89b4fa;
}

/* Firefox */
.xterm-viewport {
  scrollbar-width: thin;
  scrollbar-color: #585b70 transparent;
}

/* ターミナル モバイル対応 */
@media (max-width: 768px) {
  /* xterm のスクロールバーも非表示（タッチスクロールで代替） */
  .xterm-viewport::-webkit-scrollbar {
    display: none;
  }
  .xterm-viewport {
    scrollbar-width: none;
  }

  .terminal-container {
    flex-direction: row;
  }

  .terminal-pane + .terminal-pane {
    border-left: 1px solid var(--border);
    border-top: none;
  }

  /* モバイルではペインヘッダーを非表示（モバイルタブバーに統合） */
  .terminal-pane-header {
    display: none;
  }

  /* 非アクティブなペインを非表示（JSで制御） */
  .terminal-pane.mobile-hidden {
    display: none;
  }

  .navbar-tabs {
    margin-left: 8px;
    gap: 1px;
  }

  .navbar-tab {
    padding: 4px 8px;
    font-size: 0.72rem;
  }

  .navbar-tab .material-symbols-outlined {
    font-size: 14px;
  }
}

/* ============================================================
   モバイル専用ターミナルタブバー
   ============================================================ */
.mobile-terminal-tabs {
  display: none;
}

@media (max-width: 768px) {
  .mobile-terminal-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
    background: #181825;
    border-bottom: 1px solid #313244;
    flex-shrink: 0;
  }

  .mobile-pane-dots {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .mobile-pane-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #45475a;
    transition: background 0.2s, transform 0.2s;
  }

  .mobile-pane-dot.active {
    background: #cdd6f4;
    transform: scale(1.3);
  }
}

/* ============================================================
   モバイル専用ショートカットキーバー
   ============================================================ */
.mobile-shortcut-bar {
  display: none;
}

@media (max-width: 768px) {
  .mobile-shortcut-bar {
    display: flex;
    align-items: stretch;
    background: #181825;
    border-top: 1px solid #313244;
    flex-shrink: 0;
    height: 49px;
  }

  .shortcut-key {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-right: 1px solid #313244;
    color: #cdd6f4;
    font-size: 0.82rem;
    font-family: 'Consolas', 'Monaco', monospace;
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }

  .shortcut-key:first-child,
  .shortcut-key:last-child {
    flex: 1.1;
  }

  .shortcut-key:last-child {
    border-right: none;
  }

  .shortcut-key:active {
    background: #313244;
  }

  .shortcut-key.com-key {
    color: #89b4fa;
  }

  .shortcut-key.com-key:active {
    background: #1e2030;
  }
}

/* コマンドピッカーモーダル */
.com-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 600;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.com-modal {
  background: #1e1e2e;
  border: 1px solid #313244;
  border-radius: 14px 14px 0 0;
  padding: 20px 16px 32px;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.com-modal-title {
  font-size: 0.85rem;
  color: #6c7086;
  text-align: center;
  margin-bottom: 4px;
  font-family: 'Consolas', 'Monaco', monospace;
}

.com-modal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.com-modal-item {
  width: 100%;
  padding: 14px 16px;
  background: #313244;
  border: 1px solid #45475a;
  border-radius: 8px;
  color: #cdd6f4;
  font-size: 0.95rem;
  font-family: 'Consolas', 'Monaco', monospace;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.com-modal-item:active {
  background: #45475a;
}

.com-modal-cancel {
  width: 100%;
  padding: 14px;
  background: transparent;
  border: 1px solid #45475a;
  border-radius: 8px;
  color: #6c7086;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  margin-top: 4px;
  -webkit-tap-highlight-color: transparent;
}

.com-modal-cancel:active {
  background: #313244;
}

/* ============================================================
   メモ帳ビュー
   ============================================================ */
.memo-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

.memo-sidebar {
  width: 260px;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--card-bg);
  overflow: hidden;
}

.memo-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.memo-editor-area {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.memo-editor {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  padding: 16px;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  overflow-y: auto;
  -webkit-user-select: text;
  user-select: text;
}

.memo-editor::placeholder {
  color: var(--text-light);
}

.memo-save-status {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-light);
  min-width: 40px;
  text-align: right;
}

/* ロックボタン */
.memo-lock-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  color: var(--text-light);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
  margin-left: 8px;
}

.memo-lock-btn:hover {
  background: var(--hover-bg);
  color: var(--text-color);
}

.memo-lock-btn.locked {
  border-color: #e8934a;
  color: #e8934a;
  background: rgba(232, 147, 74, 0.08);
}

.memo-lock-btn.locked:hover {
  background: rgba(232, 147, 74, 0.18);
}

.memo-lock-btn .material-symbols-outlined {
  font-size: 18px;
}

/* サイドバーのロックアイコン */
.memo-list-lock {
  font-size: 16px;
  color: #e8934a;
  flex-shrink: 0;
  padding: 4px;
  opacity: 0.85;
}

/* メモ帳 モバイル対応 */
@media (max-width: 768px) {
  .memo-sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    height: 100vh;
    z-index: 100;
    transition: left 0.25s ease;
    box-shadow: 2px 0 8px var(--black-alpha-10);
  }

  .memo-sidebar.open {
    left: 0;
  }
}

/* ============================================================
   Google ビュー（カレンダー＆メール）
   ============================================================ */
.google-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

.google-no-account {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-light);
  padding: 40px;
}

.google-no-account .material-symbols-outlined {
  font-size: 56px;
  opacity: 0.3;
}

.google-no-account h3 {
  color: var(--text-light);
  font-size: 1rem;
}

.google-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* アカウントバー */
.google-account-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}

.google-account-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.google-account-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  white-space: nowrap;
  transition: all 0.2s;
}

.google-account-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.google-account-tab .material-symbols-outlined {
  font-size: 18px;
}

.google-account-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.google-account-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.google-account-remove {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
  opacity: 0;
  transition: opacity 0.15s;
  display: flex;
  align-items: center;
}

.google-account-tab:hover .google-account-remove {
  opacity: 0.7;
}

.google-account-remove .material-symbols-outlined {
  font-size: 14px;
}

.google-add-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  cursor: pointer;
  color: var(--text-light);
  display: flex;
  align-items: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.google-add-btn:hover {
  background: var(--primary-alpha-10);
  border-color: var(--primary);
  color: var(--primary);
}

.google-add-btn .material-symbols-outlined {
  font-size: 18px;
}

/* 左右分割 */
.google-split {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.google-calendar-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.google-gmail-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.google-pane-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--heading);
  flex-shrink: 0;
}

.google-pane-header .material-symbols-outlined {
  font-size: 18px;
  color: var(--primary);
}

/* カレンダーナビゲーション */
.gcal-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.gcal-nav-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.75rem;
  font-family: inherit;
  display: flex;
  align-items: center;
  transition: all 0.15s;
}

.gcal-nav-btn:hover {
  background: var(--primary-alpha-10);
  border-color: var(--primary);
}

.gcal-nav-btn .material-symbols-outlined {
  font-size: 16px;
}

.gcal-month-label {
  font-size: 0.85rem;
  font-weight: 500;
  min-width: 90px;
  text-align: center;
}

/* カレンダーグリッド */
.gcal-grid {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 4px;
}

.gcal-header-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}

.gcal-header-cell {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-light);
  padding: 4px 0;
  font-weight: 500;
}

.gcal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.gcal-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  flex: 1;
}

.gcal-cell {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  padding: 2px 4px;
  min-height: 60px;
  overflow: hidden;
}

.gcal-cell.gcal-empty {
  background: transparent;
  border-color: transparent;
}

.gcal-cell.gcal-today {
  border-color: var(--primary);
  background: rgba(107, 123, 141, 0.05);
}

.gcal-day-num {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}

.gcal-today .gcal-day-num {
  color: var(--primary);
  font-weight: 700;
}

.gcal-event {
  font-size: 0.65rem;
  padding: 1px 4px;
  margin-bottom: 1px;
  border-left: 3px solid var(--primary);
  border-radius: 2px;
  background: var(--primary-alpha-10);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}

.gcal-more {
  font-size: 0.6rem;
  color: var(--text-light);
  padding: 0 4px;
}

/* Gmail 部分 */
.gmail-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.gmail-unread-badge {
  background: #e74c3c;
  color: white;
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.gmail-search-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.gmail-search-bar .material-symbols-outlined {
  font-size: 18px;
  color: var(--text-light);
}

.gmail-search-bar input {
  flex: 1;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text);
  outline: none;
}

.gmail-search-bar input::placeholder {
  color: var(--text-light);
}

.gmail-list {
  flex: 1;
  overflow-y: auto;
}

.gmail-loading {
  padding: 20px;
  text-align: center;
  color: var(--text-light);
  font-size: 0.85rem;
}

.gmail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.15s;
}

.gmail-item:hover {
  background: var(--primary-alpha-10);
}

.gmail-item.gmail-unread {
  background: rgba(66, 133, 244, 0.05);
}

.gmail-item.gmail-unread .gmail-item-from,
.gmail-item.gmail-unread .gmail-item-subject {
  font-weight: 600;
}

.gmail-item-from {
  font-size: 0.82rem;
  color: var(--text);
  min-width: 120px;
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.gmail-item-content {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.82rem;
}

.gmail-item-subject {
  color: var(--text);
}

.gmail-item-snippet {
  color: var(--text-light);
}

.gmail-item-date {
  font-size: 0.72rem;
  color: var(--text-light);
  white-space: nowrap;
  flex-shrink: 0;
}

.gmail-load-more {
  display: block;
  width: 100%;
  padding: 10px;
  background: none;
  border: none;
  border-top: 1px solid var(--border-light);
  color: var(--primary);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
}

.gmail-load-more:hover {
  background: var(--primary-alpha-10);
}

/* メール詳細 */
.gmail-detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.gmail-detail-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.gmail-back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.8rem;
  font-family: inherit;
}

.gmail-back-btn:hover {
  background: var(--primary-alpha-10);
}

.gmail-back-btn .material-symbols-outlined {
  font-size: 16px;
}

.gmail-detail-subject {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--heading);
  padding: 12px 16px 4px;
}

.gmail-detail-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 16px;
  font-size: 0.82rem;
}

.gmail-detail-from {
  font-weight: 500;
  color: var(--text);
}

.gmail-detail-date {
  color: var(--text-light);
}

.gmail-detail-to {
  padding: 2px 16px 8px;
  font-size: 0.75rem;
  color: var(--text-light);
  border-bottom: 1px solid var(--border-light);
}

.gmail-detail-body {
  padding: 16px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
  overflow-y: auto;
  flex: 1;
}

.gmail-detail-body img {
  max-width: 100%;
  height: auto;
}

.gmail-detail-body a {
  color: var(--primary);
}

/* メール作成モーダル */
.gmail-compose-overlay {
  position: fixed;
  inset: 0;
  background: var(--black-alpha-50);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gmail-compose-modal {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.gmail-compose-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  color: var(--heading);
}

.gmail-compose-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  padding: 4px;
  display: flex;
}

.gmail-compose-close:hover {
  color: var(--text);
}

.gmail-compose-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gmail-compose-field {
  border: none;
  border-bottom: 1px solid var(--border-light);
  padding: 10px 16px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  outline: none;
  background: none;
}

.gmail-compose-field::placeholder {
  color: var(--text-light);
}

.gmail-compose-textarea {
  flex: 1;
  border: none;
  padding: 12px 16px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  outline: none;
  resize: none;
  min-height: 200px;
  background: none;
}

.gmail-compose-textarea::placeholder {
  color: var(--text-light);
}

.gmail-compose-footer {
  display: flex;
  justify-content: flex-end;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}

/* Google ビュー モバイル対応 */
@media (max-width: 768px) {
  .google-split {
    flex-direction: column;
  }

  .google-calendar-pane {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 40vh;
  }

  .gmail-item-from {
    min-width: 80px;
    max-width: 100px;
  }
}

/* ============================================================
   ブラウザビュー
   ============================================================ */

.browser-view {
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: var(--surface);
  overflow: hidden;
}

/* ツールバー */
.browser-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.browser-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.browser-nav-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.browser-nav-btn .material-symbols-outlined {
  font-size: 20px;
}

/* URLバー */
.browser-url-bar {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 4px 2px 10px;
  gap: 4px;
  transition: border-color 0.15s;
}

.browser-url-bar:focus-within {
  border-color: var(--accent);
}

.browser-lock-icon {
  font-size: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.browser-url-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  min-width: 0;
}

.browser-url-input::placeholder {
  color: var(--text-muted);
}

.browser-go-btn {
  padding: 4px;
}

/* 接続状態ドット */
.browser-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s;
}

.browser-status-dot.connected {
  background: #a6e3a1;
}

.browser-status-dot.disconnected {
  background: var(--text-muted);
}

/* ブックマークバー */
.browser-bookmarks-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
  min-height: 28px;
}

.browser-bookmarks-bar:empty {
  display: none;
}

.browser-bookmark-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  max-width: 160px;
  transition: background 0.15s;
}

.browser-bookmark-item:hover {
  background: var(--surface-hover);
}

.browser-bookmark-item .material-symbols-outlined {
  font-size: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.browser-bookmark-item span.bookmark-title {
  overflow: hidden;
  text-overflow: ellipsis;
}

.browser-bookmark-delete {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.browser-bookmark-item:hover .browser-bookmark-delete {
  display: flex;
}

.browser-bookmark-delete .material-symbols-outlined {
  font-size: 14px;
}

.browser-bookmark-delete:hover .material-symbols-outlined {
  color: var(--error, #f38ba8);
}

/* ブックマーク済み状態 */
#browser-btn-bookmark.bookmarked .material-symbols-outlined {
  color: #f9e2af;
}

/* Canvasコンテナ */
.browser-canvas-container {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #fff;
}

.browser-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: default;
  outline: none;
}

/* 切断中オーバーレイ */
.browser-disconnected-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--text-muted);
  gap: 12px;
  pointer-events: none;
}

.browser-disconnected-overlay .material-symbols-outlined {
  font-size: 48px;
  opacity: 0.4;
}

.browser-disconnected-overlay p {
  font-size: 14px;
  opacity: 0.6;
  margin: 0;
}

/* 接続時はオーバーレイ非表示（JS側で制御） */
.browser-view.connected .browser-disconnected-overlay {
  display: none;
}

@media (max-width: 768px) {
  .browser-toolbar {
    padding: 4px 6px;
    gap: 2px;
  }

  .browser-nav-btn {
    padding: 5px;
  }
}

/* ============================================================
   ファイルビュー
   ============================================================ */
.files-view {
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: var(--bg);
  overflow: hidden;
}

/* ツールバー */
.files-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.files-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.files-nav-btn:hover:not(:disabled) {
  background: var(--primary-alpha-10);
}
.files-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.files-nav-btn .material-symbols-outlined {
  font-size: 18px;
}

.files-breadcrumb-wrap {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.files-breadcrumb {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
}

.files-crumb {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  color: var(--secondary);
  cursor: pointer;
  transition: background 0.15s;
  font-weight: 500;
}
.files-crumb:hover {
  background: var(--primary-alpha-10);
  color: var(--heading);
}
.files-crumb .material-symbols-outlined {
  font-size: 14px;
}
.files-crumb-sep {
  color: var(--text-light);
  font-size: 12px;
}

.files-search-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
}
.files-search-icon {
  font-size: 16px;
  color: var(--text-light);
}
.files-search-input {
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--text);
  width: 140px;
  outline: none;
}
.files-search-input::placeholder {
  color: var(--text-light);
}

/* メインエリア（左リスト + 右コンテンツ） */
.files-main {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* 左ペイン（ファイル一覧） */
.files-list-pane {
  width: 300px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card-bg);
}

.files-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0;
}

.files-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.12s;
  border-radius: 0;
  min-width: 0;
}
.files-item:hover {
  background: var(--primary-alpha-10);
}
.files-item.active {
  background: var(--primary-alpha-15);
}
.files-item-icon {
  font-size: 18px;
  flex-shrink: 0;
  color: var(--secondary);
}
.files-item-dir .files-item-icon {
  color: #c9a227;
}
.files-item-binary {
  opacity: 0.5;
  cursor: default;
}
.files-item-name {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.files-item-dir .files-item-name {
  font-weight: 500;
}
.files-item-meta {
  font-size: 11px;
  color: var(--text-light);
  flex-shrink: 0;
  white-space: nowrap;
}

.files-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  color: var(--text-light);
}
.files-spin {
  animation: files-spin 1s linear infinite;
}
@keyframes files-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.files-empty,
.files-error {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 16px 12px;
  font-size: 13px;
  color: var(--text-light);
}

/* 右ペイン（ファイル内容） */
.files-content-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.files-content {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.files-content-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-light);
  gap: 10px;
}
.files-content-placeholder .material-symbols-outlined {
  font-size: 48px;
  opacity: 0.3;
}
.files-content-placeholder p {
  font-size: 14px;
  opacity: 0.6;
}

.files-content-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
  flex-shrink: 0;
}
.files-content-header .material-symbols-outlined {
  font-size: 18px;
  color: var(--secondary);
  flex-shrink: 0;
}
.files-content-filename {
  font-size: 14px;
  font-weight: 600;
  color: var(--heading);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.files-content-meta {
  font-size: 12px;
  color: var(--text-light);
  white-space: nowrap;
}
.files-copy-wrap {
  position: relative;
  flex-shrink: 0;
}

.files-content-copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.files-content-copy-btn:hover {
  background: var(--primary-alpha-10);
  color: var(--text);
}
.files-content-copy-btn .material-symbols-outlined {
  font-size: 16px;
}

.files-copy-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  flex-direction: column;
  min-width: 160px;
  z-index: 100;
  overflow: hidden;
}

.files-copy-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.12s;
  font-family: inherit;
}
.files-copy-menu-item:hover {
  background: var(--primary-alpha-10);
}
.files-copy-menu-item .material-symbols-outlined {
  font-size: 16px;
  color: var(--secondary);
}

.files-content-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 24px 16px;
  color: var(--text-light);
  font-size: 14px;
}
.files-content-error .material-symbols-outlined {
  font-size: 20px;
  color: #c0392b;
}

.files-pre {
  margin: 0;
  padding: 16px;
  font-family: 'Menlo', 'Monaco', 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre;
  overflow-x: auto;
  tab-size: 2;
}

/* モバイル対応 */
@media (max-width: 768px) {
  .files-main {
    flex-direction: column;
    overflow: hidden;
  }
  .files-list-pane {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    height: 40vh;
    min-height: 0;
    flex-shrink: 0;
    display: block;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
  }
  .files-list {
    height: auto;
    overflow: visible;
  }
  .files-content-pane {
    flex: 1;
    min-height: 40vh;
    display: block;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
  }
  .files-content {
    height: auto;
    overflow: visible;
  }
  .files-search-input {
    width: 80px;
  }
  .files-content-meta {
    display: none;
  }
}
