/* ============================================================
   案件管理システム - メインスタイルシート
   ============================================================ */

/* リセット・ベース */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  background: #f4f5f7;
  color: #333;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: #1a56a0; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   ヘッダー
   ============================================================ */
.site-header {
  background: #1e3a5f;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  height: 52px;
  gap: 24px;
}
.header-logo a {
  color: #fff;
  font-size: 1.15rem;
  font-weight: bold;
  text-decoration: none;
  white-space: nowrap;
}
.header-nav { flex: 1; }
.header-nav ul { list-style: none; display: flex; gap: 4px; }
.header-nav a {
  color: #c8d8f0;
  padding: 6px 14px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.95rem;
  transition: background .15s;
}
.header-nav a:hover,
.header-nav a.active {
  background: rgba(255,255,255,.15);
  color: #fff;
}
.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: #c8d8f0;
  white-space: nowrap;
}
.header-user a {
  color: #c8d8f0;
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 3px;
  font-size: 0.85rem;
}
.header-user a:hover { background: rgba(255,255,255,.1); text-decoration: none; }

/* ============================================================
   メインコンテンツ
   ============================================================ */
.site-main {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
}

/* ページヘッダー */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #dde2ea;
}
.page-header h1 {
  font-size: 1.35rem;
  color: #1e3a5f;
  font-weight: bold;
}
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.content-body { }

/* ============================================================
   フッター
   ============================================================ */
.site-footer {
  background: #1e3a5f;
  color: #8aa4c8;
  font-size: 0.8rem;
  padding: 12px 20px;
  text-align: center;
  margin-top: auto;
}

/* ============================================================
   ボタン
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  text-decoration: none;
  transition: opacity .15s, background .15s;
  white-space: nowrap;
}
.btn:hover { opacity: .85; text-decoration: none; }
.btn-primary   { background: #1a56a0; color: #fff; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-success   { background: #28a745; color: #fff; }
.btn-danger    { background: #dc3545; color: #fff; }
.btn-warning   { background: #ffc107; color: #333; }
.btn-outline   { background: #fff; color: #1a56a0; border: 1px solid #1a56a0; }
.btn-sm        { padding: 3px 10px; font-size: 0.82rem; }

/* ============================================================
   フォーム
   ============================================================ */
.form-card {
  background: #fff;
  border: 1px solid #dde2ea;
  border-radius: 6px;
  padding: 24px;
  max-width: 860px;
}
.form-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eef0f3;
}
.form-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.form-section-title {
  font-size: 0.95rem;
  font-weight: bold;
  color: #1e3a5f;
  margin-bottom: 14px;
  padding-left: 8px;
  border-left: 3px solid #1a56a0;
}
.form-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  align-items: start;
  gap: 8px 16px;
  margin-bottom: 14px;
}
.form-row:last-child { margin-bottom: 0; }
.form-label {
  padding-top: 7px;
  font-size: 0.9rem;
  color: #555;
  font-weight: 500;
}
.required { color: #dc3545; margin-left: 3px; font-size: 0.8rem; }
.form-control {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #c8cfd8;
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
  color: #333;
  background: #fff;
  transition: border-color .15s;
}
.form-control:focus {
  outline: none;
  border-color: #1a56a0;
  box-shadow: 0 0 0 2px rgba(26,86,160,.15);
}
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }
.form-control-half { max-width: 280px; }
.form-control-date { max-width: 160px; }
.form-hint { font-size: 0.8rem; color: #888; margin-top: 3px; }
.form-actions {
  display: flex;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid #eef0f3;
  margin-top: 20px;
}
.input-error { border-color: #dc3545 !important; }
.error-msg { color: #dc3545; font-size: 0.82rem; margin-top: 3px; }

/* ============================================================
   テーブル
   ============================================================ */
.table-wrap {
  background: #fff;
  border: 1px solid #dde2ea;
  border-radius: 6px;
  overflow: hidden;
}
.table-wrap + .table-wrap { margin-top: 16px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
thead th {
  background: #e8edf4;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: #2c4a7a;
  border-bottom: 2px solid #c8d2e0;
  white-space: nowrap;
}
tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid #eef0f3;
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f7f9fc; }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.col-num  { width: 60px; text-align: right; }
.col-date { width: 100px; }
.col-status { width: 90px; }
.col-priority { width: 70px; }
.col-actions { width: 140px; }

/* ============================================================
   カード
   ============================================================ */
.card {
  background: #fff;
  border: 1px solid #dde2ea;
  border-radius: 6px;
  margin-bottom: 20px;
}
.card-header {
  padding: 12px 16px;
  background: #e8edf4;
  border-bottom: 1px solid #dde2ea;
  border-radius: 6px 6px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title {
  font-size: 1rem;
  font-weight: bold;
  color: #1e3a5f;
}
.card-body { padding: 16px; }

/* 詳細表示テーブル */
.detail-table { width: 100%; border-collapse: collapse; }
.detail-table th {
  width: 160px;
  padding: 9px 12px;
  background: #f0f3f8;
  font-weight: 500;
  color: #555;
  border: 1px solid #dde2ea;
  vertical-align: top;
  white-space: nowrap;
}
.detail-table td {
  padding: 9px 12px;
  border: 1px solid #dde2ea;
  vertical-align: top;
  line-height: 1.7;
}
.text-pre { white-space: pre-wrap; word-break: break-word; }

/* ============================================================
   ステータス・優先度バッジ
   ============================================================ */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
.status-new          { background: #e3f0ff; color: #1a56a0; }
.status-in-progress  { background: #fff3cd; color: #856404; }
.status-pending      { background: #f0e6ff; color: #6f42c1; }
.status-completed    { background: #d4edda; color: #155724; }
.status-closed       { background: #e2e3e5; color: #495057; }
.priority-high   { background: #fde8e8; color: #c0392b; }
.priority-medium { background: #fef9e7; color: #7d6608; }
.priority-low    { background: #e8f8f0; color: #1e7a44; }

/* やり取り種別バッジ */
.type-email   { background: #e3f0ff; color: #1a56a0; }
.type-phone   { background: #e8f8f0; color: #1e7a44; }
.type-meeting { background: #fff3cd; color: #856404; }
.type-memo    { background: #f0f3f8; color: #555; }

/* ============================================================
   アラート・フラッシュメッセージ
   ============================================================ */
.alert {
  padding: 10px 16px;
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  border-left: 4px solid;
}
.alert-success { background: #d4edda; color: #155724; border-color: #28a745; }
.alert-danger  { background: #f8d7da; color: #721c24; border-color: #dc3545; }
.alert-warning { background: #fff3cd; color: #856404; border-color: #ffc107; }
.alert-info    { background: #d1ecf1; color: #0c5460; border-color: #17a2b8; }

/* ============================================================
   フィルター・検索バー
   ============================================================ */
.filter-bar {
  background: #fff;
  border: 1px solid #dde2ea;
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.filter-item { display: flex; flex-direction: column; gap: 4px; }
.filter-item label { font-size: 0.82rem; color: #666; font-weight: 500; }
.filter-item .form-control { min-width: 140px; }
.filter-item-search .form-control { min-width: 220px; }

/* ============================================================
   ページネーション
   ============================================================ */
.pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 16px;
}
.pagination a, .pagination span {
  display: inline-block;
  padding: 5px 11px;
  border: 1px solid #c8cfd8;
  border-radius: 3px;
  font-size: 0.88rem;
  color: #1a56a0;
  background: #fff;
  text-decoration: none;
}
.pagination a:hover { background: #e8edf4; }
.pagination .current { background: #1a56a0; color: #fff; border-color: #1a56a0; }
.pagination .disabled { color: #aaa; cursor: default; }

/* ============================================================
   ファイルアイコン
   ============================================================ */
.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #dde2ea;
  border-radius: 4px;
  margin-bottom: 8px;
  background: #fff;
}
.file-item:last-child { margin-bottom: 0; }
.file-icon {
  width: 28px;
  height: 28px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: bold;
  color: #fff;
  flex-shrink: 0;
}
.icon-pdf   .file-icon, .file-icon.icon-pdf   { background: #dc3545; }
.icon-word  .file-icon, .file-icon.icon-word  { background: #1a56a0; }
.icon-excel .file-icon, .file-icon.icon-excel { background: #28a745; }
.icon-ppt   .file-icon, .file-icon.icon-ppt   { background: #fd7e14; }
.icon-file  .file-icon, .file-icon.icon-file  { background: #6c757d; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 0.9rem; color: #1a56a0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 0.78rem; color: #888; margin-top: 1px; }
.file-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ============================================================
   やり取り履歴
   ============================================================ */
.comm-list { list-style: none; }
.comm-item {
  background: #fff;
  border: 1px solid #dde2ea;
  border-radius: 6px;
  margin-bottom: 12px;
  overflow: hidden;
}
.comm-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #f7f9fc;
  border-bottom: 1px solid #dde2ea;
}
.comm-type { }
.comm-subject { font-weight: 600; font-size: 0.95rem; flex: 1; }
.comm-date { font-size: 0.82rem; color: #888; white-space: nowrap; }
.comm-user { font-size: 0.82rem; color: #666; white-space: nowrap; }
.comm-body {
  padding: 12px 14px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.7;
}
.comm-attachments { padding: 8px 14px 12px; border-top: 1px solid #eef0f3; }
.comm-attachments-title { font-size: 0.82rem; color: #666; margin-bottom: 6px; }
.comm-from-to {
  font-size: 0.88rem;
  color: #444;
  flex: 1;
}
.from-to-label {
  font-size: 0.78rem;
  color: #888;
  font-weight: 600;
}
.comm-footer {
  padding: 6px 14px;
  border-top: 1px solid #eef0f3;
  text-align: right;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

/* ============================================================
   ログインページ
   ============================================================ */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1e3a5f;
}
.login-box {
  background: #fff;
  border-radius: 8px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
}
.login-title {
  text-align: center;
  font-size: 1.3rem;
  font-weight: bold;
  color: #1e3a5f;
  margin-bottom: 6px;
}
.login-subtitle {
  text-align: center;
  color: #888;
  font-size: 0.88rem;
  margin-bottom: 28px;
}
.login-box .form-row {
  grid-template-columns: 1fr;
  margin-bottom: 16px;
}
.login-box .form-label { padding-top: 0; margin-bottom: 4px; }

/* ============================================================
   統計サマリー
   ============================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: #fff;
  border: 1px solid #dde2ea;
  border-radius: 6px;
  padding: 14px 16px;
  text-align: center;
}
.stat-label { font-size: 0.82rem; color: #888; margin-bottom: 4px; }
.stat-value { font-size: 1.6rem; font-weight: bold; color: #1e3a5f; }

/* ============================================================
   ユーティリティ
   ============================================================ */
.text-muted  { color: #888; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.no-data { padding: 32px; text-align: center; color: #aaa; font-size: 0.95rem; }

/* スクロールテーブル */
.table-scroll { overflow-x: auto; }

/* ============================================================
   フローティングナビゲーションボタン
   ============================================================ */
.float-nav {
  position: fixed;
  right: 20px;
  bottom: 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 300;
}
.float-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  text-decoration: none;
  box-shadow: 0 3px 8px rgba(0,0,0,.25);
  transition: transform .15s, box-shadow .15s;
  gap: 2px;
}
.float-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(0,0,0,.3);
  text-decoration: none;
}
.float-btn-add    { background: #28a745; color: #fff; }
.float-btn-latest { background: #1a56a0; color: #fff; }
.float-btn-icon   { font-size: 1.3rem; line-height: 1; }
.float-btn-label  { font-size: 0.65rem; font-weight: bold; letter-spacing: .03em; }

/* 2カラムレイアウト */
.two-col {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}
.two-col-main {}
.two-col-side {}

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .form-label { padding-top: 0; }
}
