/* 愛知溶業 案件共有システム スタイルシート */

:root {
  --primary: #7b1a2e;
  --primary-dark: #5a0f1f;
  --primary-light: #a83250;
  --secondary: #64748b;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --urgent: #dc2626;
  --express: #d97706;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --header-height: 48px;
  --bottom-nav-height: 52px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

#app {
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ===== ローディング画面 ===== */
#loading-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, #3d0b17 0%, #7b1a2e 45%, #5a0f1f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  color: white;
}

.loading-content {
  text-align: center;
}

.loading-logo {
  /* 旧アイコンスタイル（互換用） */
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.9;
}

.loading-content h1 {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.10em;
  margin-bottom: 4px;
}

.loading-content p {
  font-size: 14px;
  opacity: 0.8;
  margin-bottom: 32px;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== ログイン画面 ===== */
#login-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, #3d0b17 0%, #7b1a2e 45%, #5a0f1f 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  gap: 0;
}

/* ログイン画面上部（ロゴエリア） */
.login-logo-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

.login-logo-area img {
  width: 100px;
  height: 100px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
}

.login-logo-area h1 {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #fff;
  margin-top: 10px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.login-logo-area p {
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  margin-top: 2px;
  letter-spacing: 0.05em;
}

.login-card {
  background: #fff;
  border-radius: 18px;
  padding: 28px 24px 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
  border-top: 4px solid #7b1a2e;
}

.login-header {
  text-align: center;
  margin-bottom: 22px;
}

.login-header .logo {
  font-size: 40px;
  color: var(--primary);
  margin-bottom: 10px;
}

.login-header h1 {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.06em;
  margin-bottom: 3px;
}

.login-header p {
  font-size: 12px;
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group label .required {
  color: var(--danger);
  margin-left: 4px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  transition: border-color 0.2s;
  outline: none;
  background: #f8fafc;
}

.form-control:focus {
  border-color: var(--primary);
  background: white;
}

.form-control.is-invalid {
  border-color: var(--danger);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-secondary {
  background: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.btn-outline {
  background: transparent;
  border: 2px solid currentColor;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 16px;
  min-height: 52px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  min-height: 32px;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ===== メインレイアウト ===== */
#main-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ===== ヘッダー ===== */
.app-header {
  height: var(--header-height);
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: white;
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(90,15,31,0.35);
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}

.header-back-btn {
  background: none;
  border: none;
  color: white;
  font-size: 17px;
  padding: 6px;
  cursor: pointer;
  margin: -6px;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.header-title {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-icon-btn {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  padding: 8px;
  cursor: pointer;
  position: relative;
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  border-radius: 50%;
}

.header-icon-btn:active {
  background: rgba(255,255,255,0.2);
}

.badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ===== コンテンツエリア ===== */
.content-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--bottom-nav-height);
  min-height: 0;
}

.content-area.no-bottom-nav {
  padding-bottom: 16px;
}

/* 詳細ページ用：flexコンテナとして機能させる（overflow:hiddenでflexboxが正しく動く） */
.content-area.flex-page {
  overflow: hidden;
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
}

/* ===== ボトムナビ ===== */
.bottom-nav {
  height: var(--bottom-nav-height);
  background: white;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-shrink: 0;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom);
  position: relative;
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
  border-radius: var(--radius-sm);
  transition: color 0.2s;
  position: relative;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item i {
  font-size: 17px;
}

.nav-item span {
  font-size: 9px;
  font-weight: 600;
}

/* ===== タブ ===== */
.tabs {
  display: flex;
  background: white;
  border-bottom: 2px solid var(--border);
  padding: 0 16px;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  background: none;
  border: none;
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ===== カード ===== */
.project-card {
  background: white;
  border-radius: var(--radius);
  margin: 8px 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.2s;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative; /* 特急バッジ位置決め用 */
}

.project-card:active {
  box-shadow: var(--shadow-md);
}

/* 特急バッジ（カード右上・大きく目立つ） */
/* 旧express-badge-card（削除・新デザインに移行） */
/* .express-badge-card は廃止。写真左上の.express-badge-photoを使用 */

/* 特急バッジ: 写真サムネ左上（写真ラッパー内・絶対配置） */
.express-badge-photo {
  position: absolute;
  top: 0;
  left: 0;
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm) 0 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
  box-shadow: 1px 1px 4px rgba(0,0,0,0.22);
  pointer-events: none;
}

/* 特急スタンプ: カード右端に大きく縦書き表示 */
.express-stamp {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 4px;
  padding: 10px 5px;
  border-radius: 6px 0 0 6px;
  z-index: 10;
  pointer-events: none;
  line-height: 1;
  text-align: center;
  box-shadow: -3px 0 10px rgba(185,28,28,0.5), inset 0 1px 0 rgba(255,255,255,0.2);
  writing-mode: vertical-rl;
  text-orientation: upright;
  /* 縦書き「特急」が見えるよう最小高さ確保 */
  min-height: 52px;
}

/* 特急カード — 赤背景＋左枠・右パディング確保 */
.project-card.project-card-express {
  background: linear-gradient(135deg, #fff5f5 0%, #fee2e2 100%);
  border-left: 4px solid #dc2626;
  /* スタンプが右端に被らないよう右側にスペース確保 */
  padding-right: 28px;
}
.project-card.project-card-express .project-customer,
.project-card.project-card-express .project-mold {
  color: #1f2937;
}

/* 溶接のみカード（濃いグレー背景で一目でわかる） */
.project-card.project-card-weld {
  background: #d0d0d0;
  border-left: 4px solid #9ca3af;
}
.project-card.project-card-weld .project-customer {
  color: #1f2937;
}
.project-card.project-card-weld .project-mold {
  color: #374151;
}

.project-card-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 8px;
}

.project-photo {
  width: 66px;
  height: 66px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
}

.project-photo-placeholder {
  width: 66px;
  height: 66px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 22px;
  flex-shrink: 0;
}

.project-info {
  flex: 1;
  min-width: 0;
}

.project-customer {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-mold {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-items: center;
}

.meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 10px;
  font-weight: 600;
}

.meta-tag.time {
  background: #eff6ff;
  color: var(--primary);
}

.meta-tag.delivery {
  background: #fef3c7;
  color: #92400e;
}

.meta-tag.core {
  background: #f0fdf4;
  color: var(--success);
}

.meta-tag.category {
  background: #f3e8ff;
  color: #7c3aed;
}

.meta-tag.urgent {
  background: #fee2e2;
  color: var(--danger);
}

.meta-tag.express {
  background: #fef3c7;
  color: var(--warning);
}

.meta-tag.attach {
  background: #e0f2fe;
  color: #0369a1;
}
.meta-tag.unread-comment {
  background: #fce7f3;
  color: #be185d;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

/* サムネ写真ラッパー（ステータスバッジ・炎バッジ用） */
.project-photo-wrap {
  position: relative;
  flex-shrink: 0;
  width: 66px;
  overflow: visible; /* 炎バッジのはみ出しを許可 */
}

/* サムネ下ステータスバー */
.thumb-status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 4px;
  min-height: 18px;
}

.thumb-status-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  white-space: nowrap;
  line-height: 1.3;
}
.thumb-status-badge.scheduled { background: #fef3c7; color: #92400e; }
.thumb-status-badge.arrived   { background: #d1fae5; color: #065f46; }
.thumb-status-badge.completed { background: #f1f5f9; color: #64748b; }

.thumb-weld-icon {
  display: none; /* weld-fire-badgeに統一、重複非表示 */
}

/* 溶接炎バッジ（カード左下角・project-card直下に配置）
   親は .project-card（position:relative）
   overflow:hiddenのためphoto-wrap内には配置不可 */
.weld-fire-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: #ff4500;
  color: white;
  font-size: 13px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.55);
  z-index: 20;
  pointer-events: none;
  border: 2px solid #fff;
}

/* 未読コメバッジ（カード左上に配置）*/
.unread-comment-badge-card {
  position: absolute;
  top: 0;
  left: 0;
  background: linear-gradient(135deg, #be185d 0%, #9d174d 100%);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px 2px 6px;
  border-radius: 0 0 8px 0;
  z-index: 15;
  pointer-events: none;
  letter-spacing: 0.02em;
  box-shadow: 1px 1px 4px rgba(190,24,93,0.4);
  line-height: 1.6;
}

/* 未読コメがあるカード — 左上バッジで視覚化、border競合回避のためoutlineで補足 */
.project-card.project-card-unread-comment {
  outline: 2px solid rgba(190, 24, 93, 0.35);
  outline-offset: -2px;
}

/* 入荷済みにするボタン用フッター（コンパクト） */
.project-card-footer-compact {
  padding: 6px 12px 8px;
  border-top: 1px solid var(--border);
}

.btn-block-sm {
  width: 100%;
  justify-content: center;
}

/* 案件一覧ページの件数バー */
.plist-count-bar {
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.project-card-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ===== 案件詳細 ===== */
.detail-section {
  background: white;
  border-radius: var(--radius);
  margin: 8px 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 15px;
  gap: 8px;
}

.section-header i {
  color: var(--primary);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.detail-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.detail-item:nth-child(odd) {
  border-right: 1px solid var(--border);
}

.detail-item.full-width {
  grid-column: 1 / -1;
}

.detail-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-value {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

.detail-value.large {
  font-size: 16px;
  font-weight: 700;
}

/* ===== 写真グリッド ===== */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 2px;
}

.photo-thumb {
  aspect-ratio: 1;
  object-fit: cover;
  cursor: pointer;
  width: 100%;
  background: var(--bg);
  transition: opacity 0.2s;
}

.photo-thumb:active {
  opacity: 0.8;
}

.photo-item {
  position: relative;
}

.photo-delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;     /* 右上のまま（追加ボタンは左上に移動済み） */
  background: rgba(220,38,38,0.92);
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* ===== 写真モーダル ===== */
.photo-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.photo-modal img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
}

.photo-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  font-size: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-modal-caption {
  color: white;
  padding: 12px 20px;
  text-align: center;
  font-size: 13px;
}

/* ===== コメント ===== */
.comment-list {
  padding: 8px 0;
}

.comment-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}

.user-info {
  flex: 1;
}

.user-name {
  font-size: 13px;
  font-weight: 700;
}

.user-dept {
  font-size: 11px;
  color: var(--text-muted);
}

.comment-time {
  font-size: 11px;
  color: var(--text-muted);
}

.comment-content {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 8px;
  word-break: break-word;
}

.mention-tag {
  display: inline-block;
  background: #eff6ff;
  color: var(--primary);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
}

.comment-actions {
  display: flex;
  gap: 12px;
}

.comment-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 0;
  font-weight: 600;
}

.comment-action-btn:hover {
  color: var(--primary);
}

.reply-thread {
  margin-left: 40px;
  border-left: 2px solid var(--border);
  padding-left: 12px;
  margin-top: 8px;
}

.reply-item {
  margin-bottom: 12px;
}

/* ===== コメント入力 ===== */
/* 案件詳細スクロール領域 */
.detail-scroll-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  padding-bottom: 8px;
}

/* コメント入力固定バー（詳細画面下部） */
.detail-comment-bar {
  display: block;
  flex-shrink: 0;
  background: white;
  border-top: 1px solid var(--border);
  padding: 8px 12px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 10;
  /* content-area.flex-page（flex-column）の直下に置くことで下部に固定される */
}

/* スマホ: ボトムナビ（58px）の上に固定表示 */
@media (max-width: 899px) {
  .detail-comment-bar {
    position: fixed !important;
    bottom: calc(58px + env(safe-area-inset-bottom, 0px)) !important;
    left: 0;
    right: 0;
    z-index: 200 !important;
    padding-bottom: 8px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.10);
  }
  /* コメントバーの高さ分だけdetail-scroll-areaに余白を確保 */
  .detail-scroll-area {
    padding-bottom: 160px !important;
  }
}

/* 旧sticky方式（削除・互換用に残す） */
.comment-input-area {
  background: white;
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  /* position: sticky; bottom: 0; は廃止 */
  display: none; /* 新バーに移行したので非表示 */
}

.reply-indicator {
  background: #eff6ff;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mention-selector {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  margin-bottom: 8px;
  max-height: 120px;
  overflow-y: auto;
}

.comment-input-row {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}

/* インラインツールバー（メンション・カメラボタン） */
.comment-toolbar-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  align-self: flex-end;
  padding-bottom: 2px;
}

.comment-tool-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.comment-tool-btn:hover,
.comment-tool-btn:active {
  background: var(--primary-light, #fce7f3);
  color: var(--primary);
  border-color: var(--primary);
}

.comment-input-row textarea {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  resize: none;
  max-height: 120px;
  min-height: 44px;
  outline: none;
  font-family: inherit;
  line-height: 1.5;
}

.comment-input-row textarea:focus {
  border-color: var(--primary);
}

.comment-send-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

/* 旧comment-toolbar（下段バー方式）→ インライン方式に移行したため非表示 */
.comment-toolbar {
  display: none;
}

.comment-toolbar button {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 4px;
}

.comment-toolbar button:hover {
  background: var(--bg);
  color: var(--primary);
}

/* ===== 添付資料 ===== */
.attachment-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.attachment-item:active {
  background: var(--bg);
}

.attachment-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.attachment-icon.pdf { background: #fee2e2; color: var(--danger); }
.attachment-icon.excel { background: #d1fae5; color: var(--success); }
.attachment-icon.word { background: #dbeafe; color: var(--primary); }
.attachment-icon.image { background: #fce7f3; color: #be185d; }
.attachment-icon.other { background: var(--bg); color: var(--text-muted); }

.attachment-info {
  flex: 1;
  min-width: 0;
}

.attachment-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* 添付ファイル ラッパー（プレビュー付き） */
.attachment-item-wrap {
  border-bottom: 1px solid var(--border);
}
.attachment-item-wrap .attachment-item {
  border-bottom: none;
}

/* ===== 添付資料 プレビュー共通（50%幅・全体表示） ===== */
.attachment-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 12px 12px;
  background: #f8fafc;
  border-top: 1px solid var(--border);
}

/* PC: 30%幅・全体表示 */
.attachment-preview-media {
  width: 30%;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  cursor: pointer;
}

.attachment-preview-pdf-frame {
  width: 30%;
  /* A4縦尺比（1:√2）で全体が収まる高さ */
  aspect-ratio: 1 / 1.41;
  border: 1px solid var(--border);
  background: #fff;
  pointer-events: none;
  display: block;
}

.attachment-preview-pdf-btns {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* スマホ: 資料プレビューを30%幅に（表示サイズ・縦比は維持） */
@media (max-width: 899px) {
  .attachment-preview-media,
  .attachment-preview-pdf-frame {
    width: 30%;
  }
}



/* ===== モーダル ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.center {
  align-items: center;
  padding: 20px;
}

.modal {
  background: white;
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal.center-modal {
  border-radius: 16px;
  max-width: 480px;
  max-height: 85vh;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: white;
  z-index: 10;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
}

.modal-body {
  padding: 16px 20px;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ===== 検索 ===== */
.search-bar {
  padding: 10px 12px;
  background: white;
  border-bottom: 1px solid var(--border);
}

.search-input-wrap {
  position: relative;
}

.search-input-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 2px solid var(--border);
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  background: var(--bg);
}

.search-input:focus {
  border-color: var(--primary);
  background: white;
}

/* ===== 通知 ===== */
.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}

.notification-item:active {
  background: var(--bg);
}

.notification-item.unread {
  background: #eff6ff;
}

.notif-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.notif-icon.new_project { background: #dbeafe; color: var(--primary); }
.notif-icon.arrived { background: #d1fae5; color: var(--success); }
.notif-icon.comment { background: #fce7f3; color: #be185d; }
.notif-icon.reply { background: #e0e7ff; color: #4338ca; }
.notif-icon.mention { background: #fef3c7; color: var(--warning); }
.notif-icon.photo_added { background: #fce7f3; color: #be185d; }
.notif-icon.attachment_added { background: #d1fae5; color: var(--success); }

.notif-content {
  flex: 1;
  min-width: 0;
}

.notif-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 3px;
}

.notif-body {
  font-size: 12px;
  color: var(--text-muted);
  white-space: pre-wrap;
}

.notif-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  margin-top: 6px;
}

/* ===== 管理画面 ===== */
.admin-section {
  background: white;
  border-radius: var(--radius);
  margin: 8px 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.admin-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.admin-item:last-child {
  border-bottom: none;
}

.admin-item:active {
  background: var(--bg);
}

.admin-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.admin-item-info {
  flex: 1;
}

.admin-item-title {
  font-size: 14px;
  font-weight: 600;
}

.admin-item-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== ロールカード（権限管理）===== */
.role-card {
  background: white;
  border-radius: var(--radius);
  margin: 8px 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.role-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.role-card-header:active { background: #f8fafc; }
.role-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #ede9fe;
  color: #7c3aed;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.role-card-users {
  padding: 12px 14px;
}
.role-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ede9fe;
  color: #5b21b6;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 20px;
  cursor: pointer;
}
.role-user-chip:active { background: #ddd6fe; }

.perm-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
}
.perm-badge.on  { background: #dcfce7; color: #15803d; }
.perm-badge.off { background: #f1f5f9; color: #94a3b8; text-decoration: line-through; }

/* ===== 権限管理カード ===== */
.perm-card {
  background: white;
  border-radius: var(--radius);
  margin: 8px 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.perm-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.perm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.perm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  cursor: pointer;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  transition: background 0.15s;
  user-select: none;
}
.perm-item:nth-child(2n) { border-right: none; }
.perm-item:nth-last-child(-n+2) { border-bottom: none; }
.perm-item input[type="checkbox"] { display: none; }
.perm-item i { font-size: 16px; flex-shrink: 0; }
.perm-item.on {
  background: #f0fdf4;
  color: #15803d;
  font-weight: 600;
}
.perm-item.on i { color: #16a34a; }

/* ===== ユーザーカード ===== */
.user-card {
  background: white;
  border-radius: var(--radius);
  margin: 6px 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.user-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}

.user-card-info {
  flex: 1;
}

.user-card-name {
  font-size: 15px;
  font-weight: 700;
}

.user-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===== ロールバッジ ===== */
.role-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.role-badge.admin { background: #fee2e2; color: var(--danger); }
.role-badge.sales { background: #dbeafe; color: var(--primary); }
.role-badge.general { background: var(--bg); color: var(--text-muted); }

/* ===== ステータスバッジ ===== */
.status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

.status-badge.scheduled { background: #fef3c7; color: #92400e; }
.status-badge.arrived { background: #d1fae5; color: var(--success); }
.status-badge.completed { background: var(--bg); color: var(--text-muted); }

/* ===== フォームモーダル ===== */
.subcategory-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 2px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.checkbox-pill input {
  display: none;
}

.checkbox-pill.checked {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
}

/* ===== ファイルアップロード ===== */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-area:hover, .upload-area.drag-over {
  border-color: var(--primary);
  background: #eff6ff;
}

.upload-area i {
  font-size: 32px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.upload-area p {
  font-size: 13px;
  color: var(--text-muted);
}

/* ===== 今日の引取り件数バナー ===== */
.pickup-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.pickup-count {
  font-size: 36px;
  font-weight: 900;
  line-height: 1;
}

.pickup-label {
  font-size: 13px;
  opacity: 0.9;
}

/* ===== 空状態 ===== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.empty-state p {
  font-size: 13px;
  line-height: 1.6;
}

/* ===== トースト通知 ===== */
.toast-container {
  position: fixed;
  top: calc(var(--header-height) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 400px;
}

.toast {
  background: #1e293b;
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  animation: slideDown 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  pointer-events: all;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

@keyframes slideDown {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ===== FAB ===== */
.fab {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 16px);
  right: 16px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(30,64,175,0.4);
  z-index: 200;
  transition: transform 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.fab:active {
  transform: scale(0.92);
}

/* ===== スイッチ ===== */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.switch input { display: none; }

.switch-slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 26px;
  cursor: pointer;
  transition: background 0.2s;
}

.switch-slider:before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.switch input:checked + .switch-slider {
  background: var(--primary);
}

.switch input:checked + .switch-slider:before {
  transform: translateX(22px);
}

/* ===== セクション見出し ===== */
.section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 16px 16px 6px;
}

/* ===== スクロール可能コンテナ ===== */
.scrollable-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  /* デフォルト: ボトムナビ分の余白（ボトムナビが表示されるページ用） */
  padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
}
/* ボトムナビなし・入力バーありのページは余白不要 */
.scrollable-content.no-extra-pb {
  padding-bottom: 8px;
}

/* ===== プログレス ===== */
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s;
}

/* ===== 検索フィルター ===== */
.filter-chips {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  background: white;
  border-bottom: 1px solid var(--border);
}

.filter-chips::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border: 2px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: white;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.filter-chip.active {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
}

/* ===== タブレット対応（768px〜899px）: 幅制限は解除（サイドバーと共存） ===== */
@media (min-width: 768px) and (max-width: 899px) {
  #main-app {
    max-width: 100%;
    margin: 0;
    box-shadow: none;
    height: 100vh;
  }

  .login-card {
    max-width: 440px;
    margin: 0 auto;
  }
}

/* ===== PC（900px以上）: max-width制限を完全解除 ===== */
@media (min-width: 900px) {
  #main-app {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    box-shadow: none !important;
  }
}

/* ===== アニメーション（高速化のため無効化） ===== */
.page-enter {
  /* animation: pageIn 0.12s ease; */
}

@keyframes pageIn {
  from { opacity: 0.8; }
  to { opacity: 1; }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ===== 小区分ピル ===== */
.subcategory-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding-top: 4px;
}

.subcategory-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #e0e7ff;
  color: #4338ca;
  font-weight: 600;
}

/* ===== 写真スライダー ===== */
.photo-slider-wrap {
  position: relative;
  /* 幅は親コンテナの100%だが、overflow-x:hiddenの影響で%が正しく計算されない場合がある */
  /* JS側で getBoundingClientRect().width を使って px で明示的に幅を設定する */
  width: 100%;
  background: #e2e8f0;
  overflow: hidden;
  height: 160px;
  flex-shrink: 0;
  box-sizing: border-box;
  /* スクロールコンテナ内でもビューポート幅を超えないよう制限 */
  max-width: 100%;
  contain: layout style;
}

.photo-slider {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  height: 100%;
  /* width は JS側で各スライドのpx幅×枚数にしない（transformで移動するため幅固定不要） */
  width: 100%;
  transition: transform 0.25s ease;
  will-change: transform;
  /* transformの基点を左端に固定 */
  transform-origin: left center;
}

.photo-slide {
  /* JSが設定するまでのフォールバック */
  width: 100%;
  min-width: 100%;
  height: 100%;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
  /* JS で width/min-width を px で上書きする */
}

.photo-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
  background: #e2e8f0;
}

.slide-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 10px;
  font-size: 11px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
  pointer-events: none;
}

.slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.4);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  font-size: 13px;
  padding: 0;
}
.slider-btn-prev { left: 8px; }
.slider-btn-next { right: 8px; }

.slider-dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  z-index: 2;
}

.slider-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background 0.2s;
}
.slider-dot.active { background: #fff; }

.slider-count {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 11px;
  color: rgba(255,255,255,0.8);
  background: rgba(0,0,0,0.4);
  padding: 1px 6px;
  border-radius: 8px;
  z-index: 2;
}

.slider-add-btn {
  position: absolute;
  top: 8px;
  left: 8px;      /* 右上→左上に移動（削除ボタンと分離） */
  background: rgba(0,0,0,0.55);
  border: none;
  color: #fff;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 14px;
  cursor: pointer;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.photo-slider-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #94a3b8;
  gap: 6px;
  font-size: 13px;
}
.photo-slider-empty i { font-size: 28px; }
.photo-slider-empty .slider-add-btn {
  position: static;
  margin-top: 4px;
}

/* ===== ドラッグ&ドロップゾーン ===== */
.photo-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 18px 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: #fafbff;
  margin-bottom: 8px;
}
.photo-drop-zone.dragging {
  border-color: var(--primary);
  background: #eff6ff;
}

/* ===== ファイルプレビューアイテム ===== */
.photo-preview-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
}

.photo-preview-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: #e2e8f0;
}

.photo-preview-info {
  flex: 1;
  min-width: 0;
}

.photo-preview-caption {
  width: 100%;
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  box-sizing: border-box;
}
.photo-preview-caption:focus { border-color: var(--primary); }

.photo-preview-del {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}
.photo-preview-del:hover { color: #ef4444; }

/* ===== コンパクト詳細グリッド ===== */
.detail-main-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.detail-sub-title {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 1px;
  margin-bottom: 4px;
}

.detail-grid-compact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 0 12px 4px;
}

.dc-item {
  padding: 4px 6px;
  border-bottom: 1px solid #f1f5f9;
}

.dc-full {
  grid-column: 1 / -1;
}

.dc-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 1px;
}

.dc-value {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

/* ===== フォームレイアウト ===== */
.form-wrap {
  padding: 8px 10px;
}

.form-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  padding: 10px 12px 12px;
}

.form-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.form-row {
  display: flex;
  gap: 8px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* 既存の detail-section のパディング最適化 */
.detail-section {
  margin-bottom: 4px !important;
}

/* ===== ホームアカウントバー ===== */
.home-account-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  margin: 10px 12px 4px;
  padding: 10px 14px;
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.home-account-avatar {
  width: 38px;
  height: 38px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.home-account-info { flex: 1; min-width: 0; }
.home-account-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-account-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

/* ===== ホームセクションラベル ===== */
.home-section-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 10px 0;
}

/* ===== ホームタイルグリッド（2列共通） ===== */
.home-tiles-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 6px 12px 4px;
}

/* ===== 新規登録タイル色（少しコンパクト） ===== */
.tile-new-welding { background: linear-gradient(135deg, #ef4444, #b91c1c); color: #fff; min-height: 90px !important; }
.tile-new-other   { background: linear-gradient(135deg, #06b6d4, #0e7490); color: #fff; min-height: 90px !important; }

.home-tile {
  border-radius: 16px;
  padding: 18px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  min-height: 110px;
  user-select: none;
}
.home-tile:active { transform: scale(0.96); }
.home-tile.tile-active { box-shadow: 0 0 0 3px rgba(99,102,241,0.5); }

.tile-today    { background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; }
.tile-arrived  { background: linear-gradient(135deg, #10b981, #065f46); color: #fff; }
.tile-upcoming { background: linear-gradient(135deg, #f59e0b, #b45309); color: #fff; }
.tile-master   { background: linear-gradient(135deg, #8b5cf6, #5b21b6); color: #fff; }
.tile-search   { background: linear-gradient(135deg, #64748b, #334155); color: #fff; }

.tile-icon {
  font-size: 32px;
  margin-bottom: 6px;
  opacity: 0.95;
}

.tile-label {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.9;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}

.tile-count {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tile-badge-wrap {
  position: absolute;
  top: 8px;
  right: 8px;
}

.tile-badge {
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* タイルリストヘッダー */
.tile-list-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 10px 14px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tile-list-count {
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 4px;
}

/* ===== NEWバッジ ===== */
.new-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  letter-spacing: 0.05em;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  z-index: 2;
}

/* ===== ピンチズームビューアー ===== */
.pinch-viewer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.pinch-viewer-close {
  position: absolute;
  top: env(safe-area-inset-top, 12px);
  right: 16px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  margin-top: 8px;
}

.pinch-viewer-container {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.pinch-img {
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  transform-origin: center center;
  will-change: transform;
  transition: transform 0.05s linear;
  user-select: none;
  -webkit-user-drag: none;
}

.pinch-viewer-caption {
  position: absolute;
  bottom: env(safe-area-inset-bottom, 16px);
  left: 0; right: 0;
  text-align: center;
  color: rgba(255,255,255,0.8);
  font-size: 13px;
  padding: 8px 20px;
  pointer-events: none;
}

/* ビューアー内 カウンター */
.pinch-viewer-counter {
  position: absolute;
  top: env(safe-area-inset-top, 12px);
  left: 16px;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  z-index: 10;
  margin-top: 8px;
  pointer-events: none;
}

/* ビューアー内 左右ナビボタン */
.pinch-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.18);
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.pinch-nav-prev { left: 12px; }
.pinch-nav-next { right: 12px; }

/* ===== 顧客名オートコンプリート ===== */
.customer-suggest {
  position: absolute;
  left: 0; right: 0;
  top: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.13);
  z-index: 200;
  max-height: 220px;
  overflow-y: auto;
}
.customer-suggest-item {
  padding: 11px 14px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.customer-suggest-item:last-child { border-bottom: none; }
.customer-suggest-item:active,
.customer-suggest-item:hover { background: #eff6ff; color: var(--primary); }

/* ===== 顧客一覧 50音グループラベル ===== */
.customers-group-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 10px 16px 2px;
  letter-spacing: 0.05em;
}

/* ===== ホーム 3列コンパクトタイル ===== */
.home-tiles-grid {
  display: grid;
  gap: 10px;
  padding: 0;
}
.home-tiles-3col {
  grid-template-columns: repeat(3, 1fr);
}
.home-tile-sm {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 10px 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  min-height: 82px;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
.home-tile-sm:active { transform: scale(0.96); }
.home-tile-sm::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--primary);
  opacity: 0.6;
}
.tile-today::before  { background: var(--warning); }
.tile-arrived::before { background: var(--success); }
.tile-upcoming::before { background: var(--primary-light); }

.tile-icon-sm {
  font-size: 20px;
  margin-bottom: 3px;
  line-height: 1;
}
.tile-label-sm {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 2px;
  letter-spacing: 0.02em;
}
.tile-count-sm {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

/* コア数チップ */
.tile-cores-row {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  flex-wrap: wrap;
  justify-content: center;
}
.tile-core-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 6px;
  line-height: 1.3;
  white-space: nowrap;
}
.tile-core-chip.weld {
  background: #fff0ed;
  color: #c2410c;
}
.tile-core-chip.other {
  background: #f5f5f5;
  color: #374151;
}

/* ===== ホーム 大タイル（新規登録） ===== */
.home-tiles-2col {
  grid-template-columns: repeat(2, 1fr);
  margin-top: 10px;
}
.home-tile-lg {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 14px 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  min-height: 96px;
  text-decoration: none;
}
.home-tile-lg:active { transform: scale(0.97); box-shadow: var(--shadow-md); }
.tile-icon-lg { font-size: 28px; margin-bottom: 6px; }
.tile-label-lg {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}
.tile-register { background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%); }
.tile-register .tile-icon-lg,
.tile-register .tile-label-lg { color: #fff; }

/* ===== グローバルチャット ===== */
.global-chat-wrap {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow);
  overflow: hidden;
  flex: 1;
  min-height: 0;
}
.global-chat-header {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.global-chat-list {
  /* 6行分の固定高さ（行高約21px × 6 + バブルpadding等で約160px） */
  height: 160px;
  max-height: 160px;
  overflow-y: auto;
  padding: 10px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}
.global-chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 10px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: #f8fafc;
}
.global-chat-textarea {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 36px;
  max-height: 100px;
  transition: border-color 0.2s;
  background: #fff;
  line-height: 1.4;
}
.global-chat-textarea:focus { border-color: var(--primary-light); }
.global-chat-send-btn {
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 14px;
  transition: background 0.2s;
}
.global-chat-send-btn:active { background: var(--primary-dark); }

/* 吹き出しメッセージ */
.gchat-msg {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}
.gchat-mine {
  flex-direction: row-reverse;
}
.gchat-other {
  flex-direction: row;
}
.gchat-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  background: var(--primary);
}
.gchat-bubble-wrap {
  display: flex;
  flex-direction: column;
  max-width: 72%;
}
.gchat-mine .gchat-bubble-wrap {
  align-items: flex-end;
}
.gchat-name {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 2px;
  padding-left: 2px;
}
.gchat-dept {
  font-size: 10px;
  color: #94a3b8;
  margin-left: 3px;
}
.gchat-bubble {
  background: #f1f5f9;
  border-radius: 16px 16px 16px 4px;
  padding: 7px 11px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
  position: relative;
}
.gchat-bubble-mine {
  background: #dbeafe;
  border-radius: 16px 16px 4px 16px;
  color: #1e3a8a;
}
.gchat-text { display: block; }
.gchat-del-btn {
  position: absolute;
  top: 4px; right: 6px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 10px;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
}
.gchat-del-btn:hover { color: var(--danger); }
.gchat-time {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
  padding-left: 4px;
}
.gchat-time-right {
  padding-left: 0;
  padding-right: 4px;
  text-align: right;
}
.gchat-loading, .gchat-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 20px 0;
}

/* ===== ホームページ専用コンテナ（チャット+タイルの固定レイアウト） ===== */
.home-page-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 4px 0 0;
  gap: 0;
  /* ボトムナビ分の余白を最下部のみに設定 */
  padding-bottom: 0;
}

/* ===== ホーム全体レイアウト ===== */
.home-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px 12px;
  gap: 10px;
  overflow: hidden;
}
.home-tiles-section {
  flex-shrink: 0;
}
.home-chat-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ===== カラーピッカー ===== */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.color-picker-preview {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
}
.color-picker-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: #1e40af; }

/* ===== 経過日数バッジ（入荷予定日超過・未入荷のみ）
   project-info（position:relative）内の右上に配置 ===== */
.overdue-badge-card {
  position: absolute;
  top: 0;
  right: 0;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 0 0 0 6px;
  display: flex;
  align-items: center;
  gap: 3px;
  z-index: 2;
  box-shadow: -1px 1px 4px rgba(0,0,0,.15);
  white-space: nowrap;
  line-height: 1.4;
}
.overdue-badge-card i { font-size: 9px; }

/* ===== ホーム通知アクターアバター ===== */
.home-notif-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  width: 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.home-notif-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.home-notif-type-badge {
  font-size: 8px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: center;
  line-height: 1.2;
  max-width: 38px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== ホーム通知リスト ===== */
.home-notif-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.home-notif-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0;
}
.home-notif-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.home-notif-item:last-child { border-bottom: none; }
.home-notif-item:hover { background: var(--hover); }
.home-notif-item.unread { background: #eff6ff; }
.home-notif-icon {
  font-size: 20px;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}
.home-notif-body {
  flex: 1;
  min-width: 0;
}
.home-notif-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-notif-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-notif-time {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 1px;
}

/* ===== 金型名複数入力行 ===== */
.mold-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.mold-remove-btn {
  flex-shrink: 0;
  background: #fee2e2;
  color: #ef4444;
  border: none;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
}
.mold-remove-btn:hover { background: #fecaca; }

/* ===== コメント添付画像 ===== */
.comment-images {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 4px;
}
.comment-image-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: zoom-in;
  transition: opacity 0.15s;
}
.comment-image-thumb:hover { opacity: 0.85; }

/* ===== コメントツールバー ===== */
.comment-toolbar {
  display: flex;
  gap: 6px;
  padding: 4px 0 6px;
  flex-wrap: wrap;
}
.comment-toolbar button {
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s;
}
.comment-toolbar button:hover { background: #e2e8f0; }

/* ===== 新規登録ボタン行（小型） ===== */
.home-new-row {
  display: flex;
  gap: 5px;
  padding: 0 8px 3px;
}
.home-new-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 5px 4px;
  border: none;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
}
.home-new-btn:active { opacity: 0.8; }
.home-new-btn-weld       { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.home-new-btn-allprocess { background: linear-gradient(135deg, #16a34a, #166534); }
.home-new-btn-other      { background: linear-gradient(135deg, #06b6d4, #0e7490); }

/* ===== 入荷済みフィルタバー ===== */
.arrived-filter-bar {
  display: flex;
  gap: 6px;
  padding: 4px 12px 6px;
  flex-wrap: wrap;
}
.arrived-filter-btn {
  padding: 4px 12px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}
.arrived-filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
/* 営業課専用「自分の担当」フィルターボタン */
.arrived-filter-btn.self-sales-btn {
  border-color: #0ea5e9;
  color: #0ea5e9;
  background: #f0f9ff;
}
.arrived-filter-btn.self-sales-btn.active {
  background: #0ea5e9;
  color: #fff;
  border-color: #0ea5e9;
}

/* ===== 写真スライダー スマホ対応 ===== */
@media (max-width: 480px) {
  .photo-slider-wrap { height: 130px; }
}

/* ===== 通知グループ管理カード（admin）===== */
.notif-group-admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.notif-group-admin-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 12px;
  transition: box-shadow 0.15s;
}
.notif-group-admin-sort {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}
.notif-sort-btn {
  width: 28px;
  height: 26px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: all 0.15s;
}
.notif-sort-btn:not(:disabled):hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.notif-sort-btn:disabled {
  opacity: 0.3;
  cursor: default;
}
.notif-group-admin-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #fce7f3;
  color: #be185d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.notif-group-admin-info {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.notif-group-admin-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.notif-group-admin-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}
.notif-group-admin-members-preview {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}
.notif-group-edit-btn {
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  transition: all 0.15s;
}
.notif-group-edit-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ===== 通知グループ閲覧カード（全従業員）===== */
.notif-group-view-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.notif-group-view-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  cursor: pointer;
  transition: box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.notif-group-view-card:active {
  box-shadow: 0 0 0 2px rgba(190,24,93,0.2);
}
.notif-group-view-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #fce7f3;
  color: #be185d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.notif-group-view-info {
  flex: 1;
  min-width: 0;
}
.notif-group-view-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.notif-group-view-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.notif-group-members-preview {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
}

/* ===== 通知タイプ別背景（home-notif-item） ===== */
.home-notif-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 10px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  background: #fff;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}
.home-notif-item.unread { background: #fafbff; }
.home-notif-item:active { background: #f1f5f9; }

/* ===== ホームヘッダーユーザーバッジ ===== */
.header-user-badge:active { opacity: 0.8; }

/* ===== プロジェクトカード縮小 ===== */
.project-card {
  background: white;
  border-radius: 8px;
  margin: 0 8px 5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.project-card:active { transform: scale(0.985); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }

.project-photo-wrap {
  position: relative;
  width: 70px;
  height: 70px;
  flex-shrink: 0;
  background: #f1f5f9;
  overflow: hidden;
  border-radius: 6px 0 0 6px;
}
.project-photo { width: 100%; height: 100%; object-fit: cover; display: block; }
.project-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  font-size: 24px;
}
.project-info {
  flex: 1;
  padding: 4px 6px;
  min-width: 0;
  overflow: hidden;
}
.project-customer {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-mold {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin: 1px 0 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}
.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
.meta-tag {
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 600;
  white-space: nowrap;
}

/* ===== ボタン全体縮小 ===== */
.btn { padding: 8px 14px; font-size: 13px; }
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-lg { padding: 11px 20px; font-size: 14px; }

/* ===== 入荷済みにするボタン（旧フッター型・非推奨）===== */
.project-card-footer-compact {
  padding: 2px 8px 4px;
  border-top: 1px solid #f1f5f9;
}
.project-card-footer-compact .btn {
  width: 100%;
  padding: 3px 8px;
  font-size: 10px;
  border-radius: 4px;
}

/* ===== 入荷済みにするボタン（カード内右端インライン型）===== */
.arrive-inline-btn {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: #16a34a;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 6px;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  min-width: 36px;
  align-self: stretch;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
  line-height: 1;
}
.arrive-inline-btn:active { opacity: 0.75; }
.arrive-inline-btn i { font-size: 13px; }
.arrive-inline-btn span { font-size: 9px; white-space: nowrap; }

/* ===== ヘッダーロゴ ===== */
.header-logo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  filter: brightness(0) invert(1);
}

/* login-card の追加スタイルは上部 #login-screen セクションで定義済み */

/* ===== タイルのコア数チップ（大型化） ===== */
.tile-core-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 6px;
  line-height: 1.3;
  white-space: nowrap;
}
.tile-core-chip.weld { background: #fff0ed; color: #c2410c; }
.tile-core-chip.other { background: #f5f5f5; color: #374151; }

/* ===== 詳細コア数（大型・目立つ） ===== */
.dc-value-core {
  font-size: 22px;
  font-weight: 900;
  color: var(--primary);
  line-height: 1.2;
}
.dc-value-core .core-unit {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 2px;
}

/* ===== カードのコアタグ（大型化） ===== */
.meta-tag.core {
  background: #fef2f2;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  padding: 2px 7px;
  border: 1px solid rgba(123,26,46,0.2);
}

/* ===== ホームタイルカウント（大型化） ===== */
.tile-count-sm {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.1;
  margin: 1px 0;
}

/* ===== ローディング画面ロゴ ===== */
.loading-logo-img {
  width: 90px;
  height: 90px;
  object-fit: contain;
  margin: 0 auto 12px;
  display: block;
  filter: brightness(0) invert(1) opacity(0.9);
}

/* ===== プッシュ通知 個人設定トグルスイッチ ===== */
.push-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.push-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.push-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #d1d5db;
  border-radius: 24px;
  transition: background 0.2s;
}
.push-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.push-toggle input:checked + .push-toggle-slider {
  background: var(--primary);
}
.push-toggle input:checked + .push-toggle-slider::before {
  transform: translateX(20px);
}
.push-toggle input:disabled + .push-toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== ホーム コンパクトタイル（横3列・スリム版）===== */
.home-tiles-compact {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 2px 8px 4px;
}

/* 横1行インラインタイル */
.home-tile-inline {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 5px 8px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: transform 0.15s;
  position: relative;
  overflow: visible;
}
.home-tile-inline:active { transform: scale(0.97); }
.home-tile-inline::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.home-tile-inline.tile-today::before    { background: var(--warning); }
.home-tile-inline.tile-arrived::before  { background: var(--success); }
.home-tile-inline.tile-upcoming::before { background: var(--primary-light, var(--primary)); }
.home-tile-compact {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 4px 2px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s;
  min-height: 0;
  position: relative;
  overflow: visible;
  text-align: center;
}
.home-tile-compact:active { transform: scale(0.95); }
.home-tile-compact::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.home-tile-compact.tile-today::before  { background: var(--warning); }
.home-tile-compact.tile-arrived::before { background: var(--success); }
.home-tile-compact.tile-upcoming::before { background: var(--primary-light, var(--primary)); }

/* コンパクトタイル内のバッジ */
.tile-badge-compact {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  z-index: 1;
}

/* カスタムロール管理: 製造役職者チェックボックス */
.manufacturing-supervisor-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fef9c3;
  border: 1px solid #fde68a;
  border-radius: 8px;
  margin-top: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #a16207;
  font-weight: 600;
}

/* メンションフルスクリーン追加スタイル */
#mention-fullscreen-overlay .mention-fs-header-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px 8px;
}

/* ============================================================
   PC レイアウト（900px 以上）
   スマホ用スタイルを一切変更せず、PC専用スタイルを上書き追加
   ============================================================ */
@media (min-width: 900px) {

  /* ---- 全体変数オーバーライド ---- */
  :root {
    --header-height: 56px;
    --sidebar-width: 260px;
  }

  html, body {
    font-size: 15px;
    overflow: hidden;
  }

  /* ---- メインアプリ構造: サイドバー + コンテンツ ---- */
  #main-app {
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
  }

  /* ---- サイドバーナビ（PC専用） ---- */
  .bottom-nav {
    display: none !important; /* スマホ用ボトムナビを非表示 */
  }

  .pc-sidebar {
    display: flex !important;
  }

  /* ---- コンテンツエリア ---- */
  #page-container {
    flex: 1;
    min-width: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 0 !important;
  }

  #page-container.flex-page {
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  /* ---- ヘッダー ---- */
  .app-header {
    height: var(--header-height);
    padding: 0 24px;
    font-size: 17px;
  }

  .header-title {
    font-size: 17px;
  }

  /* ---- 新規登録ボタン: PC用に大きく ---- */
  .home-new-btn {
    padding: 14px 18px !important;
    font-size: 14px !important;
    border-radius: 10px !important;
    min-height: 52px !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    width: 100%;
  }
  .home-new-btn i {
    font-size: 18px !important;
    width: 22px;
    text-align: center;
  }

  /* ---- タイル: PC用に大きく ---- */
  .home-tile-inline {
    padding: 16px 18px !important;
    gap: 14px !important;
    border-radius: 12px !important;
  }
  .home-tile-inline i {
    font-size: 22px !important;
  }
  .home-tile-inline div[style*="font-size:9px"] {
    font-size: 12px !important;
  }
  .home-tile-inline div[style*="font-size:13px"] {
    font-size: 20px !important;
  }

  /* ---- 通知カード (ホーム) ---- */
  .home-notif-item {
    padding: 12px 14px !important;
    gap: 12px !important;
  }
  .home-notif-body {
    font-size: 13px !important;
  }
  .home-notif-time {
    font-size: 12px !important;
  }

  /* ---- 案件カード: PCでは2列グリッド ---- */
  .pc-card-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    padding: 0;
  }

  .pc-card-grid .project-card {
    margin: 6px 10px !important;
  }

  .project-card {
    transition: box-shadow 0.2s, transform 0.15s;
  }

  .project-card:hover {
    box-shadow: var(--shadow-lg) !important;
    transform: translateY(-2px);
  }

  /* カード写真を大きく */
  .project-photo,
  .project-photo-placeholder,
  .project-photo-wrap {
    width: 80px !important;
    height: 80px !important;
  }

  .project-customer {
    font-size: 13px !important;
  }

  .project-mold {
    font-size: 13px !important;
  }

  .meta-tag {
    font-size: 11px !important;
    padding: 2px 7px !important;
  }

  /* ---- plist-count-bar ---- */
  .plist-count-bar {
    font-size: 13px !important;
    padding: 10px 20px !important;
  }

  /* ---- タブ ---- */
  .tabs {
    padding: 0 24px !important;
  }

  .tab-btn {
    font-size: 15px !important;
    padding: 16px 24px !important;
  }

  /* ---- 検索ページ ---- */
  .search-page-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 24px;
  }

  /* ---- 案件詳細 ---- */
  .detail-scroll-area {
    max-width: 800px !important;
    margin: 0 auto !important;
    width: 100%;
  }

  /* 写真スライダーを大きく */
  .photo-slider {
    max-height: 420px !important;
  }

  .photo-slide img {
    max-height: 420px !important;
  }

  /* 詳細情報セクション */
  .project-detail-section {
    padding: 16px 24px !important;
  }

  .detail-field-label {
    font-size: 12px !important;
  }

  .detail-field-value {
    font-size: 15px !important;
  }

  /* コメント入力バー */
  .detail-comment-bar {
    max-width: 800px !important;
    margin: 0 auto !important;
    width: 100%;
  }

  /* コメント */
  .comment-item {
    padding: 12px 20px !important;
  }

  .comment-avatar {
    width: 36px !important;
    height: 36px !important;
    font-size: 14px !important;
  }

  .comment-body {
    font-size: 14px !important;
  }

  .comment-meta {
    font-size: 12px !important;
  }

  /* ---- フォーム ---- */
  .form-page-wrap {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px 24px;
  }

  .form-control {
    font-size: 15px !important;
    padding: 14px 16px !important;
  }

  /* ---- 通知一覧ページ ---- */
  .notif-page-wrap {
    max-width: 800px;
    margin: 0 auto;
  }

  /* ---- メニューページ ---- */
  .menu-page-wrap {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px 24px;
  }

  /* ---- タイルリストページ（ホームタイルクリック後） ---- */
  .tile-list-header {
    font-size: 17px !important;
    padding: 16px 20px !important;
  }

  /* ---- モーダル ---- */
  .modal-wrap {
    padding: 40px !important;
  }

  .modal-content {
    max-width: 560px !important;
    border-radius: 16px !important;
  }

  /* ---- 管理ページ ---- */
  .admin-page-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 24px;
  }

  /* ---- ログイン画面 ---- */
  .login-card {
    max-width: 440px !important;
  }

  /* ---- トースト ---- */
  .toast-container {
    bottom: 24px !important;
    right: 24px !important;
    left: auto !important;
  }

  /* ---- scrollable-content: ボトムナビなし、最大幅制限 ---- */
  .scrollable-content {
    padding-bottom: 24px !important;
  }

  /* 通知・検索・メニュー・管理ページを中央寄せ・最大幅制限 */
  #notif-list,
  #search-results,
  #plist-content,
  #form-content,
  #users-list,
  #roles-list,
  #depts-list,
  #groups-list,
  #notif-groups-view-list,
  #cats-list,
  #customers-content {
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }

  /* 通知リストのカード */
  #notif-list .notif-item {
    padding: 14px 20px !important;
    font-size: 14px !important;
  }

  /* 検索結果もグリッド対応 */
  #search-results .pc-card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  /* ---- ホーム件数タイルバッジを少し大きく ---- */
  .tile-badge-compact {
    min-width: 20px !important;
    height: 20px !important;
    font-size: 11px !important;
  }
}

/* ============================================================
   PC サイドバー共通スタイル（常時定義、表示はJS/PC制御）
   ============================================================ */
.pc-sidebar {
  display: none; /* スマホでは非表示 */
  width: var(--sidebar-width, 220px);
  min-width: var(--sidebar-width, 220px);
  height: 100vh;
  background: linear-gradient(180deg, #3d0b17 0%, #7b1a2e 60%, #5a0f1f 100%);
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 2px 0 16px rgba(0,0,0,0.25);
  z-index: 200;
  overflow: hidden;
}

.pc-sidebar-logo {
  padding: 20px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  gap: 10px;
}

.pc-sidebar-logo img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: brightness(1.1);
}

.pc-sidebar-logo-text {
  display: flex;
  flex-direction: column;
}

.pc-sidebar-logo-text strong {
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.2;
}

.pc-sidebar-logo-text span {
  color: rgba(255,255,255,0.55);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.pc-sidebar-user {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.pc-sidebar-user:hover {
  background: rgba(255,255,255,0.07);
}

.pc-sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.pc-sidebar-user-name {
  color: rgba(255,255,255,0.9);
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pc-sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
  scrollbar-width: none;
}

.pc-sidebar-nav::-webkit-scrollbar { display: none; }

.pc-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  cursor: pointer;
  color: rgba(255,255,255,0.70);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.18s;
  position: relative;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  margin-bottom: 2px;
}

.pc-nav-item:hover {
  background: rgba(255,255,255,0.10);
  color: #fff;
}

.pc-nav-item.active {
  background: rgba(255,255,255,0.18);
  color: #fff;
}

.pc-nav-item i {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.pc-nav-item .pc-nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.pc-sidebar-section {
  padding: 6px 12px 4px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  margin-top: 8px;
}

.pc-sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,0.10);
}

/* ============================================================
   サイドバー内 新規登録ボタン（.pc-nav-new）
   ============================================================ */

/* 共通ベース: pc-nav-item を上書き */
.pc-nav-new {
  margin-bottom: 6px !important;
  padding: 10px 12px !important;
  border-radius: 10px !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  color: #fff !important;
  position: relative;
  overflow: hidden;
}

.pc-nav-new:hover {
  opacity: 0.90;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
}

.pc-nav-new i {
  font-size: 14px !important;
  width: 20px !important;
  flex-shrink: 0;
}

/* 溶接のみ */
.pc-nav-new-weld {
  background: linear-gradient(135deg, #7b1a2e 0%, #c0395a 100%) !important;
}

/* 全工程 */
.pc-nav-new-all {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%) !important;
}

/* その他 */
.pc-nav-new-other {
  background: linear-gradient(135deg, #374151 0%, #6b7280 100%) !important;
}

/* ============================================================
   サイドバー内 案件状況タイルボタン（.pc-nav-tile）
   ============================================================ */
.pc-nav-tile {
  padding: 9px 12px !important;
  border-radius: 10px !important;
  margin-bottom: 4px !important;
  background: rgba(255,255,255,0.07) !important;
  border: 1px solid rgba(255,255,255,0.10) !important;
  position: relative;
  overflow: visible;
  align-items: center;
  gap: 10px !important;
}

.pc-nav-tile:hover {
  background: rgba(255,255,255,0.14) !important;
  border-color: rgba(255,255,255,0.20) !important;
}

.pc-nav-tile-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  position: relative;
}

.pc-nav-tile-today .pc-nav-tile-icon  { background: rgba(217,119,6,0.25); color: #fbbf24; }
.pc-nav-tile-arrived .pc-nav-tile-icon { background: rgba(22,163,74,0.25); color: #4ade80; }
.pc-nav-tile-upcoming .pc-nav-tile-icon { background: rgba(123,26,46,0.35); color: #fca5a5; }

.pc-nav-tile-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.pc-nav-tile-label {
  font-size: 10px;
  color: rgba(255,255,255,0.55);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-nav-tile-count {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

/* ============================================================
   PC ホーム 通知エリア
   ============================================================ */
@media (min-width: 900px) {
  .pc-home-notif-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px 28px 20px 24px;
    gap: 12px;
  }

  .pc-home-notif-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0 2px;
    flex-shrink: 0;
  }

  .pc-home-notif-label i {
    color: var(--primary);
    font-size: 12px;
  }

  .pc-home-notif-card {
    overflow-y: auto;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }

  .pc-home-notif-card::-webkit-scrollbar { width: 4px; }
  .pc-home-notif-card::-webkit-scrollbar-track { background: transparent; }
  .pc-home-notif-card::-webkit-scrollbar-thumb { background-color: var(--border); border-radius: 2px; }
}

/* ============================================================
   PC 案件詳細 2カラムレイアウト（@media 900px以上で有効）
   ============================================================ */
@media (min-width: 900px) {
  /* PC版: 添付プレビューはスマホと同じスタイルを継承（上書き不要） */
  .attachment-preview-pdf iframe {
    height: 400px;
    min-height: unset;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin: 0 12px;
    width: calc(100% - 24px);
  }
  .attachment-preview-pdf {
    padding: 0 0 12px;
  }
  .attachment-preview-pdf-overlay {
    padding: 8px 12px;
    border: none;
    border-top: 1px solid var(--border);
    background: transparent;
  }

  /* 案件詳細ページ全体のラッパー: ヘッダー下をflex横並び */
  .pc-detail-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    height: calc(100vh - var(--header-height));
  }

  /* 左カラム: 案件詳細・写真・添付ファイル */
  .pc-detail-left {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid var(--border);
    background: var(--bg);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }

  .pc-detail-left::-webkit-scrollbar {
    width: 6px;
  }

  .pc-detail-left::-webkit-scrollbar-track {
    background: transparent;
  }

  .pc-detail-left::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 3px;
  }

  /* 左カラム内コンテンツ: 適切な余白 */
  .pc-detail-left-inner {
    padding: 0 0 40px;
  }

  /* 右カラム: コメント一覧＋入力（左60:右40） */
  .pc-detail-right {
    flex: 0 0 40%;
    width: 40%;
    min-width: 300px;
    max-width: 560px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--card-bg);
  }

  /* 右カラムヘッダー */
  .pc-detail-right-header {
    padding: 14px 18px;
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    background: var(--card-bg);
  }

  .pc-detail-right-header i {
    color: var(--primary);
    font-size: 15px;
  }

  /* コメント件数バッジ */
  #pc-comment-count {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
  }

  /* コメント一覧: スクロール可能エリア */
  .pc-detail-comment-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    background: var(--bg);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }

  .pc-detail-comment-list::-webkit-scrollbar {
    width: 4px;
  }

  .pc-detail-comment-list::-webkit-scrollbar-track {
    background: transparent;
  }

  .pc-detail-comment-list::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 2px;
  }

  /* コメント入力エリア */
  .pc-detail-comment-input {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    background: var(--card-bg);
    padding: 0;
  }

  /* PC右カラム内のコメントバーはfixed解除 */
  .pc-detail-comment-input .detail-comment-bar,
  .pc-detail-comment-input .comment-bar {
    position: static !important;
    bottom: unset !important;
  }

  /* PC: ツールボタンを横並び・コンパクトに */
  .pc-detail-comment-input .comment-toolbar-inline {
    flex-direction: row;
    align-self: flex-end;
    padding-bottom: 2px;
  }
}


/* ============================================================
   サイドバー タイルボタン: 横並びレイアウト上書き
   ============================================================ */
.pc-nav-tile {
  flex-direction: row !important;
  align-items: center !important;
  gap: 10px !important;
}

.pc-nav-tile .pc-nav-tile-body {
  display: none !important; /* 旧ボディ非表示（label/countは直接子要素に） */
}

.pc-nav-tile .pc-nav-tile-label {
  flex: 1;
  font-size: 13px !important;
  color: rgba(255,255,255,0.85) !important;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-nav-tile .pc-nav-tile-count {
  font-size: 15px !important;
  font-weight: 800 !important;
  color: #fff !important;
  min-width: 28px;
  text-align: right;
  flex-shrink: 0;
}

/* ============================================================
   スマホ用: ドロワーサイドバー + ハンバーガーボタン
   （max-width: 899px のみ有効）
   ============================================================ */
@media (max-width: 899px) {

  /* ボトムナビは完全非表示 */
  .bottom-nav {
    display: none !important;
  }

  /* ハンバーガー固定ボタン */
  .sp-hamburger {
    display: flex !important;
    position: fixed;
    top: 10px;
    right: 12px;
    z-index: 1100;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.30);
    transition: background 0.18s;
  }

  .sp-hamburger:hover { background: var(--primary-dark); }

  .sp-hamburger-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #fff;
  }

  /* ドロワーオーバーレイ */
  .sp-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1200;
    backdrop-filter: blur(2px);
  }

  .sp-drawer-overlay.open {
    display: block;
  }

  /* ドロワー本体（左からスライドイン） */
  .sp-drawer {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    max-width: 85vw;
    background: linear-gradient(180deg, #3d0b17 0%, #7b1a2e 60%, #5a0f1f 100%);
    z-index: 1300;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 4px 0 24px rgba(0,0,0,0.35);
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sp-drawer.open {
    transform: translateX(0);
  }

  /* ドロワー内はpc-sidebarと同スタイルを継承 */
  .sp-drawer .pc-sidebar-logo,
  .sp-drawer .pc-sidebar-user,
  .sp-drawer .pc-sidebar-nav,
  .sp-drawer .pc-sidebar-footer,
  .sp-drawer .pc-sidebar-section,
  .sp-drawer .pc-nav-item,
  .sp-drawer .pc-nav-new,
  .sp-drawer .pc-nav-tile {
    /* pc-sidebar系CSSがすでに定義済みなのでそのまま適用 */
  }
}

/* PC時はドロワー・ハンバーガーを非表示 */
@media (min-width: 900px) {
  .sp-hamburger {
    display: none !important;
  }
  .sp-drawer {
    display: none !important;
  }
  .sp-drawer-overlay {
    display: none !important;
  }
}

/* ============================================================
   スマホ ホーム通知エリアラベル
   ============================================================ */
.sp-home-notif-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 2px;
  flex-shrink: 0;
}

.sp-home-notif-label i {
  color: var(--primary);
  font-size: 12px;
}

/* ============================================================
   コンテンツエリア: スマホでボトムナビ分のpadding不要に
   ============================================================ */
@media (max-width: 899px) {
  .content-area {
    padding-bottom: 0 !important;
  }

  .app-header {
    padding-right: 10px !important;
  }
}

/* ============================================================
   スマホ用常時表示サイドバー (.sp-sidebar) —— ask#3で廃止（非表示固定）
   ============================================================ */
.sp-sidebar,
.sp-sb-btn,
.sp-sb-logo,
.sp-sb-new,
.sp-sb-tile,
.sp-sb-count,
.sp-sb-badge,
.sp-sb-divider {
  display: none !important;
}

/* ============================================================
   スマホ用ヘッダーバナー（ロゴ＋ユーザー名）
   ============================================================ */
.sp-header-banner {
  display: none;
}

@media (max-width: 899px) {
  .sp-header-banner {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    /* 右端配置（appendChildで末尾に追加される） */
    margin-left: auto;
    padding-right: 4px;
  }
  .sp-header-user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
  }
  .sp-header-user-name {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.90);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90px;
  }
}

/* ============================================================
   通知カード右端アイコン（引取り＝トラック / 登録＝品目）
   ============================================================ */
.notif-right-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  margin-left: 4px;
}
.notif-right-truck    { background: rgba(22,163,74,0.15);   color: #16a34a; }
.notif-right-weld     { background: rgba(123,26,46,0.15);   color: #c0395a; }
.notif-right-all      { background: rgba(30,64,175,0.15);   color: #3b82f6; }
.notif-right-other    { background: rgba(100,116,139,0.15); color: #64748b; }
.notif-right-delivery { background: rgba(234,88,12,0.15);   color: #ea580c; } /* 納期変更 オレンジ */
.notif-right-mention  { background: rgba(190,24,93,0.15);   color: #be185d; } /* メンション ピンク */
.notif-right-attach   { background: rgba(124,58,237,0.15);  color: #7c3aed; } /* 資料添付 紫 */
.notif-right-comment  { background: rgba(161,98,7,0.15);    color: #a16207; } /* コメント 黄 */

/* 通知ページの notification-item にも対応 */
.notification-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================================
   旧ドロワー・ハンバーガー要素は念のため非表示に
   ============================================================ */
.sp-hamburger,
.sp-drawer,
.sp-drawer-overlay {
  display: none !important;
}

/* ============================================================
   スマホホーム画面新規登録ボタン（PCと同じグラデーションデザイン）
   ============================================================ */
.sp-home-new-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sp-home-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}
/* 新規登録: 3列横並びラッパー */
.sp-home-new-row {
  display: flex;
  gap: 8px;
}
.sp-home-new-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 6px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex: 1;
  text-align: center;
  transition: opacity 0.15s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  line-height: 1.2;
}
.sp-home-new-btn:active {
  opacity: 0.85;
  transform: scale(0.97);
}
.sp-home-new-btn i {
  font-size: 20px;
  flex-shrink: 0;
}
.sp-home-new-weld  { background: linear-gradient(135deg, #7b1a2e 0%, #c0395a 100%); }
.sp-home-new-all   { background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%); }
.sp-home-new-other { background: linear-gradient(135deg, #374151 0%, #6b7280 100%); }

/* ============================================================
   通知吹き出し内インジケータ（既読マーク・資料添付クリップ）
   ============================================================ */
.notif-bubble-extras {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
}
.notif-bubble-read {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(22,163,74,0.12);
  color: #16a34a;
  border-radius: 6px;
  padding: 2px 5px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
.notif-bubble-clip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(124,58,237,0.12);
  color: #7c3aed;
  border-radius: 6px;
  padding: 2px 5px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

/* ============================================================
   スマホ: sp-sidebar廃止後の #main-app レイアウト修正
   (横並び記述をリセット→縦並びに戻す)
   ============================================================ */
@media (max-width: 899px) {
  #main-app {
    flex-direction: column !important;
  }
  /* 通常ページ: スクロール可能、ボトムナビ分だけ余白確保 */
  #page-container {
    flex: 1;
    width: 100%;
    min-width: 0;
    height: calc(100vh - 58px);
    overflow-y: auto;
    overflow-x: hidden;
  }
  /* flex-page（ホーム・詳細）: flex-column で2段レイアウト */
  #page-container.flex-page {
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }
}

/* ============================================================
   スマホ用ボトムナビバー
   ============================================================ */
.sp-bottom-nav {
  display: none; /* PCでは非表示 */
}

@media (max-width: 899px) {
  .sp-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 58px;
    background: linear-gradient(180deg, #3d0b17 0%, #7b1a2e 100%);
    border-top: 1px solid rgba(255,255,255,0.10);
    z-index: 300;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.25);
    /* iOS Safari の安全領域対応 */
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .sp-bottom-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.55);
    font-size: 18px;
    cursor: pointer;
    padding: 6px 0 4px;
    transition: color 0.15s, background 0.15s;
    position: relative;
  }

  .sp-bottom-btn span:last-child {
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
  }

  .sp-bottom-btn:active,
  .sp-bottom-btn.active {
    color: #fff;
    background: rgba(255,255,255,0.12);
  }

  .sp-bottom-btn.active i {
    filter: drop-shadow(0 0 4px rgba(255,255,255,0.5));
  }
}

/* ===== 通知カード NEWバッジ ===== */
.notif-new-badge {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  letter-spacing: 0.06em;
  box-shadow: 0 1px 4px rgba(239,68,68,0.4);
  flex-shrink: 0;
  line-height: 1.4;
}

/* ===== メンションバナー ===== */
.mention-banner {
  background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);
  border: 1.5px solid #f9a8d4;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(190,24,93,0.12);
}

.mention-banner-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #be185d 0%, #db2777 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.mention-banner-header i {
  font-size: 14px;
  flex-shrink: 0;
}

.mention-banner-header span {
  flex: 1;
}

.mention-banner-close {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
  transition: background 0.15s;
}
.mention-banner-close:hover { background: rgba(255,255,255,0.35); }

.mention-banner-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(249,168,212,0.4);
  cursor: pointer;
  transition: background 0.15s;
}
.mention-banner-item:last-child { border-bottom: none; }
.mention-banner-item:active { background: rgba(249,168,212,0.3); }

.mention-banner-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mention-banner-text {
  flex: 1;
  font-size: 12px;
  color: #6b1d4a;
  line-height: 1.4;
  min-width: 0;
}

.mention-banner-name {
  font-weight: 700;
  color: #be185d;
}

.mention-banner-project {
  display: block;
  font-size: 11px;
  color: #9f1239;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mention-banner-arrow {
  color: #f472b6;
  font-size: 11px;
  flex-shrink: 0;
}

.mention-banner-extra {
  padding: 8px 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #be185d;
  cursor: pointer;
  background: rgba(249,168,212,0.2);
  transition: background 0.15s;
}
.mention-banner-extra:active { background: rgba(249,168,212,0.4); }
