@charset "UTF-8";

:root { 
  /* 価値住宅様のコーポレートカラー */
  --primary: #3BB8EB;
  --primary-hover: #28a0d4;
  --primary-light: rgba(59, 184, 235, 0.1);
  --accent: #3BB8EB; 
  --accent-grad: linear-gradient(135deg, #3BB8EB, #28a0d4); 
  
  --background: #f1f5f9;
  --surface: #ffffff;
  
  --text-main: #0f172a;
  --text-primary: #334155;
  --text-secondary: #64748b;
  
  --border: #e2e8f0;
  
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  
  /* 角丸のゆとり */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  /* 柔らかいシャドウ（光彩もコーポレートカラーに） */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --shadow-glow: 0 8px 20px -4px rgba(59, 184, 235, 0.4);
}

body { 
  font-family: 'Inter', 'Noto Sans JP', sans-serif; 
  background: var(--background); 
  color: var(--text-primary); 
  margin: 0; 
  padding-bottom: 100px; 
  -webkit-font-smoothing: antialiased; 
  letter-spacing: 0.02em;
}

.container { max-width: 600px; margin: 0 auto; padding: 1.2rem; }

/* =========================================
   共通ユーティリティ
========================================= */
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-1 { flex: 1; }
.flex-gap { display: flex; gap: 12px; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.max-w-full { max-width: 100% !important; }

.font-bold { font-weight: 700; }
.text-sm { font-size: 0.85rem; }
.text-md { font-size: 1.05rem; }
.text-xl { font-size: 1.5rem; }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-accent { color: var(--accent); }
.text-center { text-align: center; }
.text-truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.m-0 { margin: 0; }
.mt-4 { margin-top: 4px; }
.mt-5 { margin-top: 5px; }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mb-8 { margin-bottom: 8px; }
.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; }
.mr-4 { margin-right: 4px; }
.mr-8 { margin-right: 8px; }
.ml-4 { margin-left: 4px; }
.mx-15 { margin-left: 15px; margin-right: 15px; }
.p-0 { padding: 0; }
.p-8 { padding: 8px; }
.p-10 { padding: 10px; }
.p-15 { padding: 15px; }
.p-20 { padding: 20px; }
.pb-0 { padding-bottom: 0; }
.pb-nav { padding-bottom: 100px; }
.pt-15 { padding-top: 15px; }
.pt-20 { padding-top: 20px; }
.p-6-12 { padding: 6px 12px; }

.bg-light { background: var(--primary-light); }
.bg-surface { background: var(--surface); }
.border-none { border: none !important; }
.border-radius-none { border-radius: 0 !important; }
.border-dashed { border: 1px dashed var(--border); }
.border-success { border: 1px solid var(--success); }
.accent-border { border: 1px solid var(--accent); }
.box-shadow-none { box-shadow: none; }
.overflow-y-auto { overflow-y: auto; }
.touch-scroll { -webkit-overflow-scrolling: touch; }
.opacity-6 { opacity: 0.6; }
.opacity-8 { opacity: 0.8; }
.lh-large { line-height: 1.6; }

/* =========================================
   ヘッダー・カード
========================================= */
.global-header { 
  display: flex; justify-content: space-between; align-items: center; 
  padding: 12px 20px; 
  background: rgba(255,255,255,0.85); 
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.6); 
  z-index: 90;
}
.sticky-top { position: sticky; top: 0; }
.app-logo { font-weight: 700; font-size: 1.2rem; color: var(--text-main); display: flex; align-items: center; gap: 8px; letter-spacing: -0.02em; }
.app-logo .material-icons { color: var(--primary); }
.title-text { font-weight: 700; font-size: 1.1rem; color: var(--text-main); }
.user-badge { font-size: 0.8rem; font-weight: 700; background: var(--background); border: 1px solid var(--border); padding: 4px 12px; border-radius: var(--radius-full); }

.card { 
  background: var(--surface); 
  border-radius: var(--radius-lg); 
  padding: 20px; 
  box-shadow: var(--shadow-md); 
  margin-bottom: 20px; 
  border: 1px solid rgba(255,255,255,0.1); 
}
.card-title { font-weight: 700; margin-bottom: 15px; display: flex; align-items: center; gap: 8px; font-size: 1.1rem; color: var(--text-main); }
.flex-header { display: flex; justify-content: space-between; align-items: center; padding: 20px; }
.seamless-card { margin-top: -20px; border-top-left-radius: 0; border-top-right-radius: 0; box-shadow: var(--shadow-sm); }
.gradient-card { background: var(--accent-grad); box-shadow: var(--shadow-glow); border: none; }

/* =========================================
   ★修正：ボタン（コーポレートカラー統一）
========================================= */
.btn { 
  padding: 12px 24px; 
  border-radius: var(--radius-full); 
  border: none; 
  cursor: pointer; 
  font-weight: 600; 
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; 
  font-size: 0.95rem; 
  transition: all 0.2s ease; 
}
.btn:active { transform: scale(0.97); }

/* メインボタンを価値住宅ブルーに統一 */
.btn-primary { background: var(--accent-grad); color: white; box-shadow: var(--shadow-glow); }
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); }

.btn-accent { background: var(--accent-grad); color: white; box-shadow: var(--shadow-glow); }

/* 枠線ボタンも価値住宅ブルーに統一 */
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }

/* サブボタン（グレー背景） */
.btn-secondary { background: var(--background); color: var(--text-main); }
.btn-secondary:hover { background: var(--border); }

/* ゴーストボタン（ホバー時に価値住宅ブルーがフワッと出る） */
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--primary-light); color: var(--primary-hover); }

.btn-sm { padding: 6px 16px; font-size: 0.8rem; }
.btn-lg { padding: 16px 24px; font-size: 1rem; }

.icon-btn { background: none; border: none; cursor: pointer; padding: 8px; border-radius: 50%; color: var(--text-secondary); display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.icon-btn:hover { background: var(--primary-light); color: var(--primary); }

.icon-btn-text { background: none; border: none; font-weight: 600; color: var(--text-secondary); cursor: pointer; transition: 0.2s; display: flex; align-items: center; }
.icon-btn-text:hover { color: var(--primary); }

/* =========================================
   フォーム
========================================= */
.form-input, .form-textarea, .form-select { 
  width: 100%; 
  padding: 14px 16px; 
  border-radius: var(--radius-md); 
  border: 2px solid transparent; 
  background: var(--background); 
  font-size: 1rem; 
  box-sizing: border-box; 
  outline: none; 
  transition: all 0.2s ease; 
  font-family: inherit; 
  color: var(--text-main);
}
.form-input:focus, .form-textarea:focus, .form-select:focus { 
  border-color: var(--primary); 
  background: var(--surface); 
  box-shadow: var(--shadow-sm); 
}
.file-upload { 
  width: 100%; padding: 12px; border-radius: var(--radius-md); 
  background: var(--primary-light); box-sizing: border-box; 
  border: 1px dashed var(--primary); color: var(--primary); font-size: 0.9rem;
}
.accent-select { font-weight:bold; color:var(--primary); }
.section-label { font-size: 0.85rem; font-weight: 700; color: var(--text-secondary); display: block; margin-bottom: 8px; letter-spacing: 0.05em; }
.help-text { font-size: 0.75rem; color: var(--text-secondary); }

/* =========================================
   ナビゲーション・セグメント
========================================= */
.bottom-nav { 
  display: flex; justify-content: space-around; 
  position: fixed; bottom: 0; left: 0; width: 100%; z-index: 100; 
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom)) 10px; 
  background: rgba(255,255,255,0.85); 
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(226, 232, 240, 0.6); 
}
.nav-btn { 
  flex: 1; background: none; border: none; padding: 8px 0; 
  font-size: 0.7rem; font-weight: 600; color: var(--text-secondary); 
  cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; 
  border-radius: var(--radius-lg); transition: 0.2s;
}
.nav-btn:hover { background: rgba(0,0,0,0.02); }
.nav-btn.active { color: var(--primary); }
.nav-btn.active .material-icons { transform: scale(1.1); }

.segmented-control { display: flex; background: var(--background); padding: 4px; border-radius: var(--radius-md); }
.seg-btn { flex: 1; padding: 10px; font-weight: 600; font-size: 0.9rem; border: none; background: transparent; border-radius: 12px; color: var(--text-secondary); cursor: pointer; transition: 0.2s; }
.seg-btn.active { background: var(--surface); color: var(--text-main); box-shadow: var(--shadow-sm); }

.tab-content, .d-tab-content, .p-tab-content { display: none; animation: fadeUp 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.tab-content.active, .d-tab-content.active, .p-tab-content.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
   アシストカード（タスク）
========================================= */
.progress-card { display: flex; flex-direction: column; padding: 15px 20px; }
.progress-bar-bg { width: 100%; height: 8px; background: var(--background); border-radius: var(--radius-full); overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--accent-grad); width: 0%; transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1); }

.task-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}
.task-card.completed { transform: scale(0.95); opacity: 0; pointer-events: none; }
.bg-urgent { background: #fffcf8; border-color: #fef3c7; }

.task-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 8px 20px; }
.task-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 0.75rem; font-weight: 700; padding: 4px 10px; border-radius: var(--radius-full); letter-spacing: 0.05em; }
.task-badge .material-icons { font-size: 0.9rem; }
.badge-match { background: var(--primary-light); color: var(--primary-hover); } 
.badge-urgent { background: #fef3c7; color: #d97706; } 
.badge-tour { background: #f3e8ff; color: #9333ea; } 
.badge-normal { background: var(--background); color: var(--text-secondary); } 
.task-customer { font-size: 0.95rem; font-weight: 700; color: var(--text-main); }

.task-body { padding: 0 20px; }
.task-title { font-weight: 700; margin-bottom: 6px; font-size: 1.05rem; color: var(--text-main); }
.task-desc { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; }
.task-ai-note { font-size: 0.85rem; background: var(--background); padding: 12px; border-radius: var(--radius-md); color: var(--text-secondary); line-height: 1.5; margin: 12px 0; }

.task-footer { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px 20px 20px; gap: 12px; }
.task-sub-actions { display: flex; gap: 8px; flex-shrink: 0; }
.icon-btn-circle { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-secondary); transition: 0.2s; box-shadow: var(--shadow-sm); }
.icon-btn-circle:hover { background: var(--background); transform: translateY(-2px); color: var(--primary); border-color: var(--primary); }
.sub-reject:hover { color: var(--danger); border-color: var(--danger); background: #fef2f2; }
.sub-complete:hover { color: var(--success); border-color: var(--success); background: #f0fdf4; }

/* =========================================
   リスト・詳細ビュー
========================================= */
.list-item { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; cursor: pointer; transition: 0.2s; }
.list-item:not(:last-child) { border-bottom: 1px solid var(--background); }
.list-item:hover { background: var(--background); }

#detail-view { position: fixed; inset: 0; background: var(--background); z-index: 200; transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1); overflow-y: auto; }
#detail-view.open { transform: translateX(0); }

/* タグ（ピルデザイン） */
.tag-input-wrapper { display:flex; flex-wrap:wrap; gap:8px; padding: 8px; border: 2px solid transparent; border-radius: var(--radius-md); background: var(--surface); min-height:48px; align-items:center; transition: 0.2s; box-shadow: var(--shadow-sm); }
.tag-input-wrapper:focus-within { border-color: var(--primary); }
.tag-chip { padding: 6px 14px; border-radius: var(--radius-full); font-size: 0.85rem; cursor: pointer; user-select: none; font-weight: 600; display:inline-flex; align-items:center; transition: 0.2s; }
.tag-chip:hover { opacity: 0.8; }
.tag-chip.must { background: var(--primary); color: white; }
.tag-chip.ng { background: var(--border); color: var(--text-primary); }
.tag-input-field { border:none; outline:none; flex:1; min-width:120px; font-size:0.95rem; background:transparent; color: var(--text-main); }
.tag-master-list { display:flex; flex-wrap:wrap; gap:8px; }

/* タイムライン */
.pulse-container { display: flex; justify-content: space-around; font-size: 1.5rem; font-weight: 700; margin-top: 15px; }
.timeline-container { border-left: 2px solid var(--border); margin-left: 10px; padding-left: 20px; margin-top: 10px; }
.timeline-item { position: relative; padding-bottom: 24px; text-align: left; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: -27px; top: 4px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: var(--shadow-sm); }
.timeline-time { font-size: 0.8rem; font-weight: 700; color: var(--text-secondary); margin-bottom: 4px; }
.timeline-badge { color: var(--primary); font-size: 0.75rem; font-weight: 700; background: var(--primary-light); padding: 2px 6px; border-radius: 4px; }
.timeline-desc { font-weight: 600; font-size: 0.95rem; color: var(--text-main); line-height: 1.5; }

/* =========================================
   モーダル（グラスモーフィズム）
========================================= */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 10000; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; opacity: 1; transition: opacity 0.3s; }
.glass-panel { background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }

.login-box { background: var(--surface); padding: 40px 30px; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 320px; text-align: center; }
.login-icon-wrap { width: 80px; height: 80px; background: var(--primary-light); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 15px auto; color: var(--primary); }
.login-icon-wrap .material-icons { font-size: 2.5rem; }
.login-title { margin: 0 0 24px 0; font-family: 'M PLUS Rounded 1c'; color: var(--text-main); font-size: 1.5rem; }

.dialog-box { width:100%; max-width:340px; border-radius:var(--radius-lg); padding:24px; box-shadow:var(--shadow-lg); animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1); text-align:center; }
.dialog-box.large-dialog { max-width: 500px; max-height: 85vh; display: flex; flex-direction: column; padding: 0; text-align:left; background: var(--surface); }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

.slide-up-modal { justify-content: flex-end; padding: 0; }
.modal-content { width: 100%; max-width: 600px; max-height: 90vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; display: flex; flex-direction: column; animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1); box-shadow: var(--shadow-lg); }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

#custom-dialog-message { margin-bottom:24px; font-size:1rem; font-weight:500; line-height:1.6; color:var(--text-main); text-align: left; }

/* =========================================
   チャットUI
========================================= */
.chat-container { max-width:600px; width:100%; height:100%; background:var(--background); display:flex; flex-direction:column; box-shadow:var(--shadow-lg); margin: 0 auto; }
.chat-header { padding: 15px 20px; background: var(--surface); display:flex; justify-content:space-between; align-items:center; box-shadow: var(--shadow-sm); z-index: 10; }
.chat-messages { display:flex; flex-direction:column; padding: 20px; flex:1; overflow-y:auto; }
.chat-input-area { background: var(--surface); padding: 12px 20px calc(12px + env(safe-area-inset-bottom)) 20px; display:flex; gap:12px; box-shadow: 0 -4px 10px rgba(0,0,0,0.02); z-index: 10; }
.chat-text-input { flex:1; padding:14px 20px; border-radius:var(--radius-full); border:1px solid var(--border); font-size:1rem; outline:none; background:var(--background); color: var(--text-main); transition: 0.2s; }
.chat-text-input:focus { border-color: var(--primary); background: var(--surface); }
.mic-btn, .send-btn { border-radius:50%; width:48px; height:48px; padding:0; border: none; cursor: pointer; flex-shrink:0; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.mic-btn { background: var(--background); color: var(--text-main); }
.mic-btn:hover { background: var(--border); }
.send-btn { background: var(--accent-grad); color: white; box-shadow: var(--shadow-sm); }
.send-btn:hover { filter: brightness(1.05); transform: scale(0.95); }

.bubble { max-width: 80%; padding: 14px 18px; border-radius: 20px; font-size: 0.95rem; line-height: 1.6; margin-bottom: 16px; }
.bubble.ai { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 4px; box-shadow: var(--shadow-sm); color: var(--text-main); }
.bubble.user { align-self: flex-end; background: var(--primary); color: white; border-bottom-right-radius: 4px; margin-left: auto; box-shadow: var(--shadow-sm); }

/* レンジスライダーのモダン化 */
.range-slider { -webkit-appearance: none; height: 6px; background: var(--border); border-radius: var(--radius-full); outline: none; }
.range-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); cursor: pointer; box-shadow: var(--shadow-sm); }

/* ローダー */
#loader { position: fixed; inset: 0; background: rgba(255,255,255,0.8); display: none; align-items: center; justify-content: center; z-index: 100001; flex-direction: column; }
.spinner { 
  animation: rotate 1s linear infinite; 
  font-size: 3rem; 
  color: var(--primary); 
  margin-bottom: 10px; 
  display: inline-block; 
}
@keyframes rotate { 
  from { transform: rotate(0deg); } 
  to { transform: rotate(360deg); } 
}

/* 管理者用テーブル */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.admin-table th, .admin-table td { padding: 12px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.admin-table th { background: var(--background); font-weight: 700; color: var(--text-secondary); position: sticky; top: 0; z-index: 10; box-shadow: 0 1px 0 var(--border); white-space: nowrap; }
.admin-table tbody tr:hover { background: var(--primary-light); }
.table-wrapper { overflow-x: auto; max-height: 70vh; overflow-y: auto; border-bottom: 1px solid var(--border); margin: -20px -20px 0 -20px; }