/* ─── task_schedule_chat_app / style.css ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', sans-serif; background: #f4f6f9; color: #333; min-height: 100vh; display: flex; flex-direction: column; }

/* ─── ヘッダー ──────────────────────────────────────────────────────────────── */
.app-header {
  position: sticky; top: 0; z-index: 100;
  background: #232f3e; color: #fff;
  height: 54px; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3); flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-logo { font-size: 0.85rem; color: #ff9900; font-weight: 700; text-decoration: none; letter-spacing: 0.5px; }
.header-sep { color: #4a5568; font-size: 0.9rem; }
.header-title { font-size: 0.95rem; font-weight: 600; color: #e2e8f0; }
.header-right { display: flex; align-items: center; gap: 8px; }
.header-user { font-size: 0.8rem; color: #aab7c4; }

/* ─── サイドバー ＋ コンテンツ ─────────────────────────────────────────────── */
.layout { display: flex; flex: 1; min-height: 0; }
.sidebar {
  width: 200px; flex-shrink: 0;
  background: #2d3748; color: #e2e8f0;
  padding: 16px 0;
  overflow-y: auto;
}
.sidebar-nav { list-style: none; }
.sidebar-nav li a, .sidebar-nav li button {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; color: #e2e8f0;
  font-size: 0.88rem; text-decoration: none;
  border: none; background: none; width: 100%; cursor: pointer;
  transition: background 0.15s;
}
.sidebar-nav li a:hover, .sidebar-nav li button:hover { background: #3d4a5c; }
.sidebar-nav li a.active, .sidebar-nav li button.active { background: #ff9900; color: #fff; font-weight: 600; }
.sidebar-nav .nav-icon { font-size: 1rem; width: 20px; text-align: center; }
.sidebar-section {
  font-size: 0.7rem; color: #718096; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 14px 20px 4px;
}

.main-content { flex: 1; overflow-y: auto; padding: 24px; }

/* ─── トースト ──────────────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9000;
  background: #232f3e; color: #fff; padding: 12px 20px;
  border-radius: 8px; font-size: 0.88rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.success { border-left: 4px solid #48bb78; }
#toast.error   { border-left: 4px solid #e53e3e; }

/* ─── ビュー共通 ────────────────────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ─── ページヘッダー ────────────────────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-header h1 { font-size: 1.3rem; font-weight: 700; color: #232f3e; }
.page-header .actions { display: flex; gap: 8px; }

/* ─── ボタン ────────────────────────────────────────────────────────────────── */
.btn { padding: 8px 16px; border-radius: 6px; font-size: 0.88rem; font-weight: 600; cursor: pointer; border: none; transition: background 0.15s, opacity 0.15s; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary   { background: #ff9900; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #e68a00; }
.btn-secondary { background: #edf2f7; color: #4a5568; border: 1px solid #e2e8f0; }
.btn-secondary:hover:not(:disabled) { background: #e2e8f0; }
.btn-danger    { background: #e53e3e; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #c53030; }
.btn-sm        { padding: 5px 12px; font-size: 0.8rem; }
.btn-icon      { padding: 6px 8px; }

/* ─── フィルターバー ────────────────────────────────────────────────────────── */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; background: #fff; padding: 12px 16px; border-radius: 8px; border: 1px solid #e2e8f0; }
.filter-item { display: flex; flex-direction: column; gap: 4px; }
.filter-item label { font-size: 0.72rem; font-weight: 600; color: #718096; }
.filter-item input, .filter-item select { padding: 5px 10px; border: 1px solid #e2e8f0; border-radius: 5px; font-size: 0.85rem; color: #333; min-width: 120px; }
.filter-item input:focus, .filter-item select:focus { outline: none; border-color: #ff9900; }

/* ─── テーブル ──────────────────────────────────────────────────────────────── */
.table-wrap { background: #fff; border-radius: 10px; border: 1px solid #e2e8f0; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
thead { background: #f7f8fa; }
th { padding: 10px 14px; text-align: left; font-weight: 600; color: #4a5568; font-size: 0.8rem; white-space: nowrap; border-bottom: 2px solid #e2e8f0; }
td { padding: 10px 14px; border-bottom: 1px solid #f0f2f5; color: #333; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }
tr.overdue td { background: #fff5f5; }
tr.due-soon td { background: #fffdf0; }
.row-link { cursor: pointer; }
.row-link:hover td { background: #f0f8ff; }
.empty-row td { text-align: center; color: #aaa; padding: 32px; }

/* ─── バッジ ────────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.badge-gray     { background: #edf2f7; color: #4a5568; }
.badge-blue     { background: #ebf8ff; color: #2b6cb0; }
.badge-yellow   { background: #fffff0; color: #975a16; border: 1px solid #ecc94b; }
.badge-orange   { background: #fffaf0; color: #c05621; border: 1px solid #f6ad55; }
.badge-green    { background: #f0fff4; color: #276749; }
.badge-red      { background: #fff5f5; color: #c53030; }
.badge-purple   { background: #faf5ff; color: #6b46c1; }
/* ステータス */
.status-未着手   { background: #edf2f7; color: #4a5568; }
.status-進行中   { background: #ebf8ff; color: #2b6cb0; }
.status-確認待ち { background: #fffff0; color: #975a16; }
.status-完了     { background: #f0fff4; color: #276749; }
.status-保留     { background: #faf5ff; color: #6b46c1; }
/* 優先度 */
.priority-高 { background: #fff5f5; color: #c53030; }
.priority-中 { background: #fffaf0; color: #c05621; }
.priority-低 { background: #edf2f7; color: #4a5568; }

/* ─── カード ────────────────────────────────────────────────────────────────── */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card {
  background: #fff; border-radius: 10px; border: 1px solid #e2e8f0;
  padding: 18px 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); border-color: #ff9900; }
.card-title { font-size: 1rem; font-weight: 700; color: #232f3e; margin-bottom: 8px; }
.card-meta  { font-size: 0.78rem; color: #718096; display: flex; gap: 12px; flex-wrap: wrap; }
.card-footer-btns { margin-top: 14px; display: flex; gap: 8px; }

/* ─── ダッシュボード ─────────────────────────────────────────────────────────── */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.dash-section { background: #fff; border-radius: 10px; border: 1px solid #e2e8f0; padding: 18px 20px; }
.dash-section h2 { font-size: 0.95rem; font-weight: 700; color: #232f3e; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.dash-task-item { padding: 10px 0; border-bottom: 1px solid #f0f2f5; cursor: pointer; }
.dash-task-item:last-child { border-bottom: none; }
.dash-task-item:hover { background: #fafbfc; }
.dash-task-title { font-size: 0.88rem; font-weight: 600; color: #2d3748; }
.dash-task-meta  { font-size: 0.76rem; color: #718096; margin-top: 3px; display: flex; gap: 10px; }
.overdue-label  { color: #c53030; font-weight: 700; }
.due-soon-label { color: #c05621; font-weight: 700; }

/* ─── タスク詳細 ────────────────────────────────────────────────────────────── */
.detail-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; }
@media (max-width: 900px) { .detail-layout { grid-template-columns: 1fr; } }
.detail-main { display: flex; flex-direction: column; gap: 16px; }
.detail-side { display: flex; flex-direction: column; gap: 16px; }
.detail-card { background: #fff; border-radius: 10px; border: 1px solid #e2e8f0; padding: 18px 20px; }
.detail-card h2 { font-size: 0.9rem; font-weight: 700; color: #718096; margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.detail-title { font-size: 1.3rem; font-weight: 700; color: #232f3e; margin-bottom: 10px; line-height: 1.4; }
.detail-desc { font-size: 0.9rem; color: #4a5568; line-height: 1.7; white-space: pre-wrap; }
.detail-fields { display: flex; flex-direction: column; gap: 10px; }
.detail-field { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.87rem; }
.detail-field-label { color: #718096; font-weight: 600; min-width: 80px; }
.detail-field-value { color: #2d3748; text-align: right; flex: 1; }
.subtask-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.subtask-item { display: flex; align-items: center; gap: 8px; font-size: 0.87rem; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.subtask-item:hover { background: #f4f6f9; }

/* ─── コメント ──────────────────────────────────────────────────────────────── */
.comment-list { display: flex; flex-direction: column; gap: 12px; }
.comment-item { background: #f7f8fa; border-radius: 8px; padding: 12px 14px; }
.comment-header { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.comment-avatar { width: 28px; height: 28px; border-radius: 50%; background: #232f3e; color: #ff9900; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; flex-shrink: 0; }
.comment-author { font-size: 0.82rem; font-weight: 700; color: #2d3748; }
.comment-time   { font-size: 0.75rem; color: #a0aec0; margin-left: auto; }
.comment-body   { font-size: 0.87rem; color: #4a5568; line-height: 1.6; white-space: pre-wrap; }
.comment-input-area { margin-top: 14px; display: flex; gap: 8px; }
.comment-input-area textarea { flex: 1; border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 12px; font-size: 0.88rem; font-family: inherit; resize: vertical; min-height: 60px; }
.comment-input-area textarea:focus { outline: none; border-color: #ff9900; }

/* ─── フォーム ──────────────────────────────────────────────────────────────── */
.form-card { background: #fff; border-radius: 10px; border: 1px solid #e2e8f0; padding: 24px; max-width: 760px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .col-span-2 { grid-column: 1 / -1; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field label { font-size: 0.8rem; font-weight: 600; color: #4a5568; }
.form-field input, .form-field select, .form-field textarea {
  padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 6px;
  font-size: 0.88rem; color: #333; font-family: inherit;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { outline: none; border-color: #ff9900; box-shadow: 0 0 0 2px rgba(255,153,0,0.15); }
.form-field textarea { resize: vertical; min-height: 80px; }
.required-star { color: #e53e3e; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
.form-hint { font-size: 0.75rem; color: #a0aec0; }

/* ─── カレンダー ────────────────────────────────────────────────────────────── */
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-title { font-size: 1.1rem; font-weight: 700; color: #232f3e; }
.cal-nav   { display: flex; gap: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: #e2e8f0; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
.cal-dow { background: #f7f8fa; text-align: center; padding: 8px 4px; font-size: 0.78rem; font-weight: 700; color: #4a5568; }
.cal-cell { background: #fff; min-height: 96px; padding: 6px; font-size: 0.8rem; }
.cal-cell.other-month { background: #f9fafb; }
.cal-cell.today { background: #fff8ee; }
.cal-date { font-weight: 700; color: #232f3e; margin-bottom: 4px; }
.cal-cell.other-month .cal-date { color: #c0c6d2; }
.cal-cell.today .cal-date { color: #ff9900; }
.cal-event { display: block; font-size: 0.72rem; padding: 2px 5px; border-radius: 3px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal-event.ev-overdue  { background: #fed7d7; color: #c53030; }
.cal-event.ev-due-soon { background: #fefcbf; color: #744210; }
.cal-event.ev-normal   { background: #e9f0fb; color: #2b6cb0; }
.cal-event.ev-complete { background: #f0fff4; color: #276749; }

/* ─── チャット ──────────────────────────────────────────────────────────────── */
.chat-layout { display: grid; grid-template-columns: 240px 1fr; gap: 0; height: calc(100vh - 54px - 48px); min-height: 400px; }
.chat-room-list { border-right: 1px solid #e2e8f0; overflow-y: auto; background: #fff; }
.chat-room-item { padding: 12px 16px; cursor: pointer; border-bottom: 1px solid #f0f2f5; transition: background 0.12s; }
.chat-room-item:hover { background: #f4f6f9; }
.chat-room-item.active { background: #fff8ee; border-left: 3px solid #ff9900; }
.chat-room-name { font-size: 0.88rem; font-weight: 600; color: #2d3748; }
.chat-room-last { font-size: 0.75rem; color: #a0aec0; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-main { display: flex; flex-direction: column; background: #f9fafb; }
.chat-head { padding: 12px 18px; border-bottom: 1px solid #e2e8f0; background: #fff; display: flex; align-items: center; justify-content: space-between; }
.chat-head-name { font-size: 1rem; font-weight: 700; color: #232f3e; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.chat-msg { display: flex; gap: 10px; max-width: 75%; }
.chat-msg.mine { flex-direction: row-reverse; align-self: flex-end; }
.chat-msg-avatar { width: 32px; height: 32px; border-radius: 50%; background: #232f3e; color: #ff9900; display: flex; align-items: center; justify-content: center; font-size: 0.78rem; font-weight: 700; flex-shrink: 0; }
.chat-msg-bubble { padding: 9px 13px; border-radius: 12px; font-size: 0.87rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.chat-msg:not(.mine) .chat-msg-bubble { background: #fff; border: 1px solid #e2e8f0; color: #333; border-radius: 2px 12px 12px 12px; }
.chat-msg.mine .chat-msg-bubble { background: #ff9900; color: #fff; border-radius: 12px 2px 12px 12px; }
.chat-msg-meta { font-size: 0.72rem; color: #a0aec0; margin-top: 4px; }
.chat-msg.mine .chat-msg-meta { text-align: right; }
.chat-msg-name { font-size: 0.78rem; color: #718096; margin-bottom: 2px; }
.chat-task-badge { font-size: 0.72rem; background: #ebf8ff; color: #2b6cb0; padding: 2px 7px; border-radius: 4px; display: inline-block; margin-top: 4px; cursor: pointer; }
.chat-input-area { padding: 12px 16px; background: #fff; border-top: 1px solid #e2e8f0; display: flex; gap: 8px; align-items: flex-end; }
.chat-input-area textarea { flex: 1; border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 12px; font-size: 0.88rem; font-family: inherit; resize: none; min-height: 40px; max-height: 120px; }
.chat-input-area textarea:focus { outline: none; border-color: #ff9900; }
.chat-placeholder { display: flex; align-items: center; justify-content: center; height: 100%; color: #a0aec0; font-size: 0.95rem; }
.mention { color: #2b6cb0; font-weight: 700; }

/* ─── CSV ───────────────────────────────────────────────────────────────────── */
.csv-card { background: #fff; border-radius: 10px; border: 1px solid #e2e8f0; padding: 24px; max-width: 600px; }
.csv-section { margin-bottom: 24px; }
.csv-section h2 { font-size: 0.95rem; font-weight: 700; color: #232f3e; margin-bottom: 12px; }

/* ─── モーダル ──────────────────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 500; display: flex; align-items: center; justify-content: center; }
.modal-backdrop.hidden { display: none; }
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 480px; max-width: 95vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal h2 { font-size: 1rem; font-weight: 700; color: #232f3e; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

/* ─── その他 ────────────────────────────────────────────────────────────────── */
.count-badge { display: inline-flex; align-items: center; background: #edf2f7; color: #4a5568; border-radius: 12px; padding: 2px 10px; font-size: 0.8rem; font-weight: 700; margin-left: 10px; }
a { color: #ff9900; text-decoration: none; }
a:hover { text-decoration: underline; }
.text-muted { color: #a0aec0; font-size: 0.85rem; }
.text-overdue { color: #c53030; font-weight: 700; }
.text-due-soon { color: #c05621; font-weight: 700; }
.loading { text-align: center; padding: 40px; color: #a0aec0; }
.tag { display: inline-flex; align-items: center; padding: 2px 8px; background: #edf2f7; color: #4a5568; border-radius: 12px; font-size: 0.72rem; font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.back-btn { display: inline-flex; align-items: center; gap: 6px; color: #718096; font-size: 0.85rem; margin-bottom: 16px; cursor: pointer; }
.back-btn:hover { color: #ff9900; }
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item { font-size: 0.8rem; color: #718096; padding: 6px 0; border-bottom: 1px solid #f0f2f5; }
.history-item:last-child { border-bottom: none; }
