/* ============================
   デザイントークン（モノトーン基調）
   ============================ */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #1f2937;
  --text-sub: #6b7280;
  --text-mute: #9ca3af;
  --accent: #2563eb;
  --accent-soft: #eff3fb;
  --accent-line: #1f2937;
  --hover: #f3f4f6;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04);
}

* {
  box-sizing: border-box;
}

html,
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN",
    "Yu Gothic", "Meiryo", "Noto Sans JP", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
}

/* ============================
   レイアウト：サイドバー + メイン
   ============================ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 40;
  transition: transform 0.2s ease;
}

.sidebar-brand {
  min-height: 60px;
  display: flex;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  gap: 8px;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.sidebar-brand-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}

.sidebar-brand-sub {
  font-weight: 400;
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--text-sub);
  border-radius: var(--radius);
  font-size: 14px;
  text-decoration: none;
  margin-bottom: 2px;
  position: relative;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: var(--hover);
  color: var(--text);
}

.nav-item .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
}

.nav-item.active {
  background: var(--hover);
  color: var(--text);
  font-weight: 600;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--accent-line);
  border-radius: 2px;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px 8px;
}

/* メイン */
.main {
  flex: 1;
  margin-left: 232px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
}

.content {
  flex: 1;
  padding: 24px;
  max-width: 1200px;
  width: 100%;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 20px;
}

/* ============================
   コンポーネント：カード
   ============================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 20px;
}

/* ============================
   コンポーネント：ボタン
   ============================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--text);
  color: #fff;
}
.btn-primary:hover {
  background: #000;
}

.btn-default {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-default:hover {
  background: var(--hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-sub);
}
.btn-ghost:hover {
  background: var(--hover);
  color: var(--text);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: #fecaca;
}
.btn-danger:hover {
  background: var(--danger-soft);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

.btn-icon {
  padding: 6px 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-sub);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn-icon:hover {
  color: var(--text);
  background: var(--hover);
}

/* ============================
   コンポーネント：フォーム
   ============================ */
.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 6px;
}
.label .req {
  color: var(--danger);
  margin-left: 4px;
}

.input,
.textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s;
}
.input:focus,
.textarea:focus {
  outline: none;
  border-color: var(--text);
}
.textarea {
  resize: vertical;
}

.radio-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.radio-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
}

/* ============================
   バッジ
   ============================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  background: var(--hover);
  color: var(--text);
}
.badge-strong {
  background: var(--text);
  color: #fff;
}
.badge-soft {
  background: #f3f4f6;
  color: var(--text-sub);
}

/* ============================
   ホーム：機能タイル
   ============================ */
.tile-grid {
  display: grid;
  /* 画面幅に応じて自動で列数が変わる：
     - auto-fit：入りきらない空きトラックは潰す → 右側に余白が残らない
     - minmax(240px, 1fr)：1枚あたり最小 240px。
       最も長いタイトル「システムの使い方」(8文字, font-size 17px ≒ 136px)
       + アイコン52px + 左右padding44px = 約232px に安全マージンを足した値。
       これにより、どんな画面幅でもタイトルが改行・省略されない。 */
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 22px 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* min-width: 0 でグリッドアイテムが minmax を尊重して縮めるのを許可 */
  min-width: 0;
}
.tile:hover {
  border-color: var(--text-sub);
}
.tile-head {
  display: flex;
  align-items: center;
  gap: 12px;
  /* 子の .tile-title が overflow:hidden で省略できるよう min-width:0 を許可 */
  min-width: 0;
}
.tile-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--hover);
  border-radius: var(--radius);
  font-size: 18px;
  color: var(--text);
}
.tile-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  /* タイトルは1行固定（改行禁止・省略禁止）。
     タイル最小幅(minmax 240px)が常にタイトル全長を上回るよう確保している */
  white-space: nowrap;
}
.tile-desc {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.6;
}

/* ============================
   テーブル風リスト
   ============================ */
.list {
  width: 100%;
  border-collapse: collapse;
}
.list th,
.list td {
  text-align: left;
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.list th {
  font-weight: 600;
  color: var(--text-sub);
  background: #fafbfc;
  font-size: 12px;
}
.list tr:last-child td {
  border-bottom: none;
}

/* 企業カード（一覧）：1行ずつ表示 */
.company-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 業務手順書（受注・納品）の2列レイアウト */
.proc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 720px) {
  .proc-grid {
    grid-template-columns: 1fr;
  }
}

/* 検索ボックス */
.search-box {
  position: relative;
  flex: 1;
  max-width: 360px;
}
.search-box input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s;
}
.search-box input:focus {
  outline: none;
  border-color: var(--text);
}
.search-box i.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-mute);
  font-size: 13px;
  pointer-events: none;
}
.search-box .clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-mute);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: none;
}
.search-box .clear-btn:hover {
  color: var(--text);
  background: var(--hover);
}
.search-box.has-value .clear-btn {
  display: inline-flex;
}

@media (max-width: 560px) {
  .search-box {
    max-width: 100%;
  }
}
.company-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s;
}
.company-card:hover {
  border-color: var(--text-sub);
}
.company-card .name {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}
.company-card .note {
  font-size: 12px;
  color: var(--text-sub);
  word-break: break-word;
}

/* 汎用マニュアル一覧（番号付き＋ドラッグ&ドロップ） */
.manual-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.manual-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.manual-row:hover {
  border-color: var(--text-sub);
}
.manual-row.dragging {
  opacity: 0.5;
  border-color: var(--accent);
}
.manual-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  background: #f7f8fa;
  border-right: 1px solid var(--border);
  color: var(--text-mute);
  cursor: grab;
  user-select: none;
}
.manual-handle:active {
  cursor: grabbing;
}
.manual-no {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-sub);
  border-right: 1px solid var(--border);
  background: #fafbfc;
}
.manual-link {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
}
.manual-link .name {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}
.manual-link .note {
  font-size: 12px;
  color: var(--text-sub);
  word-break: break-word;
}

/* 早見表 */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.quick-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: #fafbfc;
}
.quick-item .quick-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 8px;
}

/* 早見表：あり/なし表示 */
.qr-yes {
  color: var(--danger);
  font-weight: 700;
}
.qr-no {
  color: var(--text-sub);
}

/* 早見表：フェーズタグ（受注/納品） */
.phase-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.4;
  white-space: nowrap;
}
.phase-tag.phase-order {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}
.phase-tag.phase-delivery {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
/* 早見表テーブル：フェーズ列の縦中央寄せ */
.quick-table thead th {
  font-size: 12px;
  color: var(--text-sub);
  font-weight: 600;
  text-align: left;
  padding: 8px 12px;
  background: #f7f8fa;
  border-bottom: 1px solid var(--border);
}
.quick-table td:first-child {
  text-align: center;
  vertical-align: middle;
}
/* 編集モードの quick-label 内フェーズタグ */
.quick-label .phase-tag {
  margin-right: 6px;
}

/* 工程カード */
.step-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface);
  display: flex;
  gap: 12px;
}
.step-card.dragging {
  opacity: 0.4;
}
.step-card.drag-over {
  border-color: var(--text);
  background: var(--hover);
}
.step-handle {
  color: var(--text-mute);
  cursor: grab;
  padding-top: 4px;
}
/* データアップロード（添付）の並び替え */
.attachment-item.dragging {
  opacity: 0.4;
}
.attachment-item.drag-over {
  border-color: var(--text);
  background: var(--hover);
}
.att-handle {
  color: var(--text-mute);
  padding-top: 2px;
  flex-shrink: 0;
}
.attachments-list.att-reorder-mode .attachment-item {
  transition: background 0.1s ease;
}
/* アップロード進捗バー */
.upload-progress {
  margin-top: 12px;
}
.upload-progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 6px;
}
.upload-progress-info i {
  margin-right: 4px;
}
.upload-progress-track {
  width: 100%;
  height: 8px;
  background: var(--border, #e5e7eb);
  border-radius: 999px;
  overflow: hidden;
}
.upload-progress-bar {
  height: 100%;
  background: var(--primary, #2563eb);
  border-radius: 999px;
  transition: width 0.15s ease;
}
.upload-progress-bar.indeterminate {
  width: 100% !important;
  background: linear-gradient(90deg,
    var(--border, #e5e7eb) 25%,
    var(--primary, #2563eb) 50%,
    var(--border, #e5e7eb) 75%);
  background-size: 200% 100%;
  animation: upload-indeterminate 1.2s linear infinite;
}
@keyframes upload-indeterminate {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.step-no {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}

/* プレビュー */
.preview-area {
  min-height: 180px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: #fafbfc;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.preview-area.drag-active {
  border-color: var(--text);
  background: var(--hover);
}
.preview-frame {
  width: 100%;
  height: min(75vh, 720px);
  min-height: 480px;
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.lock-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-sub);
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: help;
}
.lock-status i {
  color: #64748b;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.preview-filename {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-sub);
  min-width: 0;
  flex: 1;
}
.preview-filename span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-image {
  max-width: 100%;
  max-height: 480px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: block;
  margin: 0 auto;
}

/* 工程カード内のサムネイル（小さめ表示） */
.step-thumb {
  width: 100%;
  max-width: 220px;
  height: 140px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: zoom-in;
  display: block;
  transition: transform 0.15s, border-color 0.15s;
}
.step-thumb:hover {
  border-color: var(--text-sub);
  transform: scale(1.02);
}

/* 画像拡大ライトボックス */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  cursor: zoom-out;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}
.preview-empty {
  text-align: center;
  color: var(--text-mute);
  padding: 36px 16px;
  font-size: 13px;
}
.preview-empty i {
  font-size: 28px;
  display: block;
  margin-bottom: 8px;
  color: var(--text-mute);
}

/* モーダル */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
  overflow-y: auto;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  padding: 20px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
}
.modal-lg {
  max-width: 640px;
}
.modal-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

/* トースト */
.toast {
  position: fixed;
  top: 76px;
  right: 20px;
  background: var(--text);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  z-index: 70;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
}

/* セパレータ */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* パンくず */
.breadcrumb {
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 12px;
}
.breadcrumb a {
  color: var(--text-sub);
  text-decoration: none;
}
.breadcrumb a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* 空状態 */
.empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-sub);
  font-size: 13px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: #fafbfc;
}

/* スタックレイアウト */
.stack-16 > * + * { margin-top: 16px; }
.stack-12 > * + * { margin-top: 12px; }
.stack-8 > * + * { margin-top: 8px; }

.row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================
   レスポンシブ（SP対応）
   ============================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 35;
}

@media (max-width: 880px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.2);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open {
    display: block;
  }
  .main {
    margin-left: 0;
  }
  .menu-toggle {
    display: inline-flex;
  }
  .content {
    padding: 16px;
  }
  .tile-grid {
    grid-template-columns: 1fr;
  }
  .quick-grid {
    grid-template-columns: 1fr;
  }
  .company-grid {
    grid-template-columns: 1fr;
  }
  .row-between {
    align-items: flex-start;
  }
  .preview-frame {
    height: min(70vh, 560px);
    min-height: 360px;
  }
  .step-cols {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 560px) {
  .page-title {
    font-size: 18px;
  }
  .card-body {
    padding: 16px;
  }
  .card-header {
    padding: 14px 16px;
  }
  .list th,
  .list td {
    padding: 10px 12px;
    font-size: 12px;
  }
  .topbar {
    padding: 0 12px;
  }
  .modal {
    padding: 16px;
  }
}

/* スクロールバー（控えめ） */
.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ============================
   注文書発行（一覧・編集・印刷）
   ============================ */

/* 一覧テーブル */
.po-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.po-table th,
.po-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.po-table th {
  background: #f8fafc;
  font-weight: 600;
  color: var(--text-sub);
  font-size: 12px;
  border-bottom: 1px solid var(--border-strong);
}
.po-table td.num,
.po-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.po-table td.actions,
.po-table th.actions {
  width: 1%;
  white-space: nowrap;
}
.po-table td.actions .btn {
  margin-left: 4px;
}
.po-table tr:hover td {
  background: var(--hover);
}
.po-link {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.po-link:hover {
  text-decoration: underline;
}

/* バッジ */
.po-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.po-badge-draft {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}
.po-badge-issued {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #6ee7b7;
}
.po-badge-cancelled {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

/* 編集フォーム */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-sub);
}
.field-wide {
  grid-column: 1 / -1;
}
.field input[type="text"],
.field input[type="date"],
.field input[type="number"],
.field input[type="email"],
.field select,
.field textarea {
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--text);
}

/* 明細テーブル（編集） */
.po-edit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.po-edit-table th,
.po-edit-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.po-edit-table th {
  background: #f8fafc;
  font-weight: 600;
  color: var(--text-sub);
  font-size: 12px;
  text-align: left;
}
.po-edit-table th.num,
.po-edit-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.po-edit-table input[type="text"],
.po-edit-table input[type="number"] {
  width: 100%;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: inherit;
}
.po-edit-table input.num {
  text-align: right;
}
.po-edit-table .amount-cell {
  font-weight: 600;
}
.btn-icon-sm {
  padding: 4px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--danger);
}
.btn-icon-sm:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

/* 合計表示 */
.po-totals {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  border-top: 1px solid var(--border);
}
.po-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  min-width: 280px;
  font-size: 13px;
}
.po-total-row span:last-child {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.po-total-grand {
  font-size: 16px;
  font-weight: 700;
  border-top: 2px solid var(--text);
  padding-top: 8px;
  margin-top: 4px;
}

/* レスポンシブ */
@media (max-width: 720px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .po-table {
    font-size: 12px;
  }
  .po-table td.actions .btn {
    padding: 4px 6px;
  }
  .po-edit-table {
    font-size: 12px;
  }
}

/* ============================
   注文書 印刷プレビュー（A4）
   ============================ */
.po-print-root {
  background: #f1f5f9;
  min-height: 100vh;
  padding: 24px 0;
}
.po-print-toolbar {
  max-width: 297mm;
  margin: 0 auto 16px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px;
}
.po-print-page {
  width: 297mm;
  min-height: 210mm;
  margin: 0 auto;
  background: #fff;
  padding: 12mm 14mm;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "MS Mincho", serif;
  color: #111;
  font-size: 10.5pt;
  box-sizing: border-box;
}
/* （旧バージョンの .po-print-title / -subject / -greeting / -issuer / -stamp /
   -meta(-row) / -supplier / -company / -items / -totals / -conditions / -spec
   は 雛形版 .po-tpl-* に置き換えたため削除済み。
   現行コードで使用しているのは .po-print-root / .po-print-toolbar / .po-print-page のみ。） */

/* 印刷時のみ */
@media print {
  body {
    background: #fff !important;
    margin: 0;
  }
  .no-print,
  .app-shell .sidebar,
  .app-shell .topbar {
    display: none !important;
  }
  .po-print-root {
    background: #fff;
    padding: 0;
  }
  .po-print-page {
    width: auto;
    min-height: auto;
    margin: 0;
    box-shadow: none;
    padding: 10mm 12mm;
  }
  @page {
    size: A4 landscape;
    margin: 0;
  }
}

/* empty state */
.empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-sub);
}

/* ============================
   注文書 印刷プレビュー（雛形版）
   ============================ */

/* メタ情報行（編集画面の自動採番表示） */
.po-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  font-size: 13px;
}
.po-meta-lbl {
  color: var(--text-sub);
  margin-right: 8px;
  font-size: 12px;
}
.po-meta-val {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* 雛形ベースのプリント */
.po-tpl {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  font-size: 10.5pt;
  color: #111;
  position: relative;
}

.po-tpl-doc-id {
  text-align: right;
  color: #1d4ed8;
  font-size: 11pt;
  margin-bottom: 6px;
}

.po-tpl-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.po-tpl-left {
  font-size: 10.5pt;
  line-height: 1.7;
}
.po-tpl-supplier-row {
  margin-top: 4px;
}
.po-tpl-supplier-name {
  font-size: 14pt;
  font-weight: 700;
  margin-right: 16px;
}
.po-tpl-onchu {
  font-size: 12pt;
  font-weight: 600;
}
.po-tpl-tel-row {
  margin-top: 4px;
  font-size: 10.5pt;
}

.po-tpl-center {
  text-align: center;
  align-self: center;
  padding: 0 16px;
}
.po-tpl-title {
  font-size: 28pt;
  font-weight: 700;
  letter-spacing: 0.3em;
  border-bottom: 2px solid #111;
  padding-bottom: 4px;
}

.po-tpl-right {
  text-align: right;
  font-size: 10pt;
  line-height: 1.7;
}
.po-tpl-meta {
  display: inline-block;
  text-align: left;
  margin-bottom: 8px;
  background: #f0f0f0;
  border: 1px solid #999;
  padding: 4px 10px;
  font-size: 10pt;
}
.po-tpl-meta .lbl {
  display: inline-block;
  width: 80px;
  color: #555;
}
.po-tpl-meta .val {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.po-tpl-issuer {
  text-align: left;
  display: inline-block;
}
.po-tpl-issuer-name {
  font-size: 11pt;
  font-weight: 700;
  position: relative;
  display: inline-block;
}
.po-tpl-stamp {
  display: inline-block;
  width: 28px;
  height: 28px;
  margin-left: 8px;
  border: 1.5px solid #c33;
  color: #c33;
  border-radius: 50%;
  font-size: 11pt;
  text-align: center;
  line-height: 26px;
  vertical-align: middle;
  font-weight: 700;
}

/* 注文内容テーブル */
.po-tpl-content {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5pt;
  margin-bottom: 12px;
}
.po-tpl-content th,
.po-tpl-content td {
  border: 1px solid #111;
  padding: 6px 10px;
}
.po-tpl-content th {
  background: #f5f5f5;
  text-align: center;
  width: 110px;
  font-weight: 600;
}
.po-tpl-content td {
  background: #fff;
}

/* 明細テーブル */
.po-tpl-items {
  width: 100%;
  border-collapse: collapse;
  font-size: 10pt;
  margin-bottom: 18px;
  table-layout: fixed;
}
.po-tpl-items th,
.po-tpl-items td {
  border: 1px solid #111;
  padding: 6px 8px;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.po-tpl-items th {
  background: #f5f5f5;
  text-align: center;
  font-weight: 600;
}
.po-tpl-items td.c {
  text-align: center;
}
.po-tpl-items td.r {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* 切取線 */
.po-tpl-cutline {
  border-top: 1px dashed #555;
  margin-top: 18px;
}

/* レスポンシブ：印刷プレビューもスマホで開けるように */
@media (max-width: 720px) {
  .po-tpl-header {
    grid-template-columns: 1fr;
  }
  .po-tpl-center {
    padding: 8px 0;
  }
  .po-tpl-right {
    text-align: left;
  }
}

/* ============== 注文書 明細テーブル（編集画面） ============== */
.po-items-wrap {
  overflow-x: auto;
}
.po-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 1100px;
}
.po-items-table th,
.po-items-table td {
  border: 1px solid var(--border);
  padding: 6px 6px;
  vertical-align: middle;
}
.po-items-table thead th {
  background: #f8fafc;
  color: var(--text-sub);
  font-weight: 600;
  text-align: left;
  font-size: 11px;
  white-space: nowrap;
}
.po-items-table th.r,
.po-items-table td.r { text-align: right; }
.po-items-table .po-item-idx {
  width: 36px;
  text-align: center;
  color: var(--text-mute);
  background: #fafbfc;
  font-weight: 600;
}
.po-items-table .po-item-ops {
  width: 44px;
  text-align: center;
}
.po-items-table input[type="text"],
.po-items-table input[type="number"],
.po-items-table select {
  width: 100%;
  border: 1px solid transparent;
  background: #fff;
  padding: 4px 6px;
  font-size: 12px;
  border-radius: 4px;
  box-sizing: border-box;
}
.po-items-table input:focus,
.po-items-table select:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.po-items-table .po-num { text-align: right; }
.po-items-table .po-unit { text-align: center; }
.po-items-table .po-item-amount {
  font-weight: 600;
  background: #fafbfc;
  white-space: nowrap;
}
.po-items-table tfoot td {
  background: #f8fafc;
}

/* ============== 発注先プレビュー ============== */
.supplier-preview {
  margin-top: 12px;
}
.supplier-preview-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.7;
}
.supplier-preview-name {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}
.supplier-preview-row {
  color: var(--text-sub);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.supplier-preview-empty {
  background: #fef9e7;
  border: 1px dashed #f5c648;
  color: #92670d;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12px;
}
.supplier-preview-empty i {
  margin-right: 6px;
}

/* ============== モーダル ============== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 9000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}
.modal-dialog {
  background: #fff;
  border-radius: 8px;
  width: 100%;
  max-width: 640px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  animation: modal-in 0.16s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-weight: 700;
  font-size: 15px;
}
.modal-title i { margin-right: 8px; color: var(--primary, #2563eb); }
.modal-close {
  background: transparent;
  border: none;
  font-size: 16px;
  color: var(--text-mute);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.modal-close:hover {
  background: #f1f5f9;
  color: var(--text);
}
.modal-body { padding: 16px 18px; }
.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: #fafbfc;
}

/* ============== 印刷時：明細テーブルのフォント微調整 ============== */
@media print {
  .po-tpl-items { font-size: 11px; }
}

/* ============== 注文書一覧：行クリック対応 ============== */
.po-table-clickable .po-row {
  cursor: pointer;
  transition: background-color 0.12s ease;
}
.po-table-clickable .po-row:hover td {
  background: #eff6ff;
}
.po-table-clickable .po-row:hover .po-link {
  color: var(--primary, #2563eb);
  text-decoration: underline;
}
.po-table-clickable .po-row .po-link {
  cursor: pointer;
}

/* ============================================================
   システムの使い方ページ：模式図（UIモック）用スタイル
   ※ B案：HTML/CSSで実画面を模した簡易図を作る。
     画像ファイルは使わず、システムUI変更時の追従性を担保。
   ============================================================ */

/* セクション間の余白を読みやすく */
.help-section .card-body { padding: 18px 20px; }
.help-section .card-title { font-size: 14px; }

/* リード文 */
.help-lead {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.8;
  margin-bottom: 12px;
}

/* 用語チップ */
.help-chip {
  display: inline-block;
  padding: 2px 8px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  margin: 0 2px;
  white-space: nowrap;
}
.help-chip.gray { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }
.help-chip.green { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.help-chip.amber { background: #fffbeb; color: #b45309; border-color: #fcd34d; }

/* 番号付きステップ（縦並び・左に丸番号） */
.help-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.help-steps > li {
  position: relative;
  padding-left: 36px;
  min-height: 26px;
  font-size: 13px;
  line-height: 1.7;
}
.help-steps > li::before {
  content: counter(help-step);
  counter-increment: help-step;
  position: absolute;
  left: 0;
  top: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--primary, #2563eb);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}
.help-steps { counter-reset: help-step; }

/* キー/操作などの装飾 */
.help-kbd {
  display: inline-block;
  padding: 1px 6px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-bottom-width: 2px;
  border-radius: 4px;
  font-size: 11px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", monospace;
  color: #334155;
  vertical-align: 1px;
  white-space: normal;
  word-break: break-word;
  max-width: 100%;
}

/* ==========================
   UIモック：共通の枠
   ========================== */
.ui-mock {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  margin: 12px 0;
  font-size: 12px;
}
.ui-mock-caption {
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 4px;
  text-align: center;
}

/* ハイライト付き要素（クリック箇所など） */
.ui-mock-hi {
  position: relative;
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
  border-radius: 4px;
  animation: ui-mock-pulse 2.4s ease-in-out infinite;
}
@keyframes ui-mock-pulse {
  0%, 100% { outline-color: rgba(251, 191, 36, 0.95); }
  50%      { outline-color: rgba(251, 191, 36, 0.35); }
}
.ui-mock-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  background: #f59e0b;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* ==========================
   UIモック：サイドバー＋メインの俯瞰図
   ========================== */
.ui-mock-shell {
  display: grid;
  grid-template-columns: 160px 1fr;
  min-height: 260px;
}
.ui-mock-sidebar {
  background: #f8fafc;
  border-right: 1px solid var(--border);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ui-mock-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 10px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}
.ui-mock-brand i { color: var(--primary, #2563eb); }
.ui-mock-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-sub);
}
.ui-mock-nav i { width: 14px; text-align: center; color: var(--text-mute); }
.ui-mock-nav.active {
  background: #e0e7ff;
  color: #1e40af;
  font-weight: 600;
}
.ui-mock-nav.active i { color: #1e40af; }
.ui-mock-main {
  padding: 14px 16px;
  background: #fff;
}
.ui-mock-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.ui-mock-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.ui-mock-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--primary, #2563eb);
  color: #fff;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  width: max-content;
  max-width: 100%;
  vertical-align: middle;
}
.ui-mock-btn.ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}
.ui-mock-btn.danger { background: #dc2626; }

/* ==========================
   UIモック：カード（早見表、手順書、注文書など）
   ========================== */
.ui-mock-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  margin-bottom: 8px;
}
.ui-mock-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.ui-mock-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
.ui-mock-card-body {
  font-size: 11px;
  color: var(--text-sub);
  line-height: 1.7;
}
.ui-mock-row {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px dashed #e2e8f0;
}
.ui-mock-row:last-child { border-bottom: none; }
.ui-mock-row-label { color: var(--text-mute); min-width: 90px; }
.ui-mock-row-value { color: var(--text); font-weight: 500; }

/* ==========================
   UIモック：明細テーブル（注文書用）
   ========================== */
.ui-mock-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.ui-mock-table th,
.ui-mock-table td {
  border: 1px solid var(--border);
  padding: 4px 6px;
  text-align: left;
}
.ui-mock-table th {
  background: #f1f5f9;
  font-weight: 600;
  color: var(--text-sub);
  font-size: 10px;
}
.ui-mock-table .r { text-align: right; }
.ui-mock-table .c { text-align: center; }

/* ==========================
   UIモック：工程ステップ
   ========================== */
.ui-mock-step {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 8px;
  align-items: start;
  padding: 8px;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 11px;
}
.ui-mock-step-handle {
  color: var(--text-mute);
  cursor: grab;
  padding-top: 2px;
}
.ui-mock-step-no {
  display: inline-block;
  background: #e0e7ff;
  color: #1e40af;
  border-radius: 4px;
  padding: 1px 6px;
  font-weight: 700;
  font-size: 10px;
  margin-right: 6px;
}
.ui-mock-step-body { color: var(--text); }

/* ==========================
   FAQ
   ========================== */
.help-faq {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.help-faq-item {
  border-left: 3px solid var(--primary, #2563eb);
  padding: 4px 0 4px 12px;
}
.help-faq-q {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 4px;
}
.help-faq-q::before {
  content: "Q.";
  color: var(--primary, #2563eb);
  margin-right: 6px;
  font-weight: 800;
}
.help-faq-a {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.7;
}
.help-faq-a::before {
  content: "A.";
  color: #16a34a;
  margin-right: 6px;
  font-weight: 800;
}

/* ==========================
   SP対応
   ========================== */
@media (max-width: 640px) {
  .ui-mock-shell { grid-template-columns: 110px 1fr; }
  .ui-mock-sidebar { padding: 8px 4px; }
  .ui-mock-nav { font-size: 10px; padding: 4px 6px; gap: 4px; }
  .ui-mock-brand { font-size: 10px; padding: 4px 6px 8px 6px; }
  .ui-mock-main { padding: 10px 12px; }
  .ui-mock-table { font-size: 10px; }
  .ui-mock-table th, .ui-mock-table td { padding: 3px 4px; }
  .help-section .card-body { padding: 14px 14px; }
}

/* ============================================================
 * 認証関連：ログイン画面・ユーザーメニュー・設定画面
 * ============================================================ */

/* ===== ログイン画面 ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f6f7f8 0%, #e9eef5 100%);
  padding: 24px;
}
.login-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  border: 1px solid #e5e9ef;
}
.login-brand {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px;
}
.login-brand i {
  font-size: 28px; color: #2563eb;
}
.login-brand-title { font-size: 18px; font-weight: 700; color: #0f172a; }
.login-brand-sub { font-size: 12px; color: #64748b; }
.login-title {
  font-size: 22px; font-weight: 700; color: #0f172a;
  margin-bottom: 10px;
}
.login-desc {
  font-size: 13px; color: #475569; line-height: 1.7;
  margin-bottom: 22px;
}
.login-desc code {
  background: #f1f5f9; padding: 1px 6px; border-radius: 4px;
  font-size: 12px; color: #0f172a;
}
.btn-google {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  color: #0f172a;
  font-size: 15px; font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s;
  cursor: pointer;
}
.btn-google:hover {
  background: #f8fafc;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
.login-foot {
  margin-top: 18px;
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
}

/* ===== トップバー：ユーザーメニュー ===== */
.user-menu {
  position: relative;
}
.user-menu-btn {
  position: relative;
}
.user-menu-badge {
  position: absolute;
  top: -4px; right: -6px;
  background: #f59e0b;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 1.2;
  letter-spacing: 0.02em;
}
.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 240px;
  background: #fff;
  border: 1px solid #e5e9ef;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  padding: 6px;
  display: none;
  z-index: 1000;
}
.user-menu.open .user-menu-dropdown {
  display: block;
}
.user-menu-info {
  padding: 10px 12px 12px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 6px;
}
.user-menu-name {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}
.user-menu-email {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
  word-break: break-all;
}
.user-menu-preview {
  margin-top: 6px;
  font-size: 11px;
  color: #b45309;
  background: #fef3c7;
  padding: 3px 6px;
  border-radius: 4px;
  display: inline-block;
}
.user-menu-admin {
  margin-top: 6px;
  font-size: 11px;
  color: #1d4ed8;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 13px;
  color: #0f172a;
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.1s;
}
.user-menu-item:hover {
  background: #f1f5f9;
}
.user-menu-item i {
  width: 16px;
  text-align: center;
  color: #64748b;
}
.user-menu-logout {
  color: #dc2626;
}
.user-menu-logout i {
  color: #dc2626;
}

/* ===== 設定画面：ユーザー管理テーブル ===== */
.settings-users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.settings-users-table thead th {
  background: #f8fafc;
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 12px;
  color: #475569;
}
.settings-users-table thead th.c { text-align: center; }
.settings-users-table tbody td {
  padding: 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.settings-users-table tbody td.c { text-align: center; }
.settings-users-table tbody tr:hover {
  background: #fafbfc;
}
.settings-users-table code {
  font-size: 12px;
  background: #f8fafc;
  padding: 2px 6px;
  border-radius: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}
.badge-admin { background: #dbeafe; color: #1d4ed8; }
.badge-user { background: #f1f5f9; color: #475569; }
.badge-active { background: #dcfce7; color: #15803d; }
.badge-inactive { background: #fee2e2; color: #b91c1c; }

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  margin: 0 2px;
}
.btn-danger {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.btn-danger:hover {
  background: #fecaca;
}

.settings-msg {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  display: inline-block;
}
.settings-msg-ok {
  background: #dcfce7;
  color: #15803d;
}
.settings-msg-error {
  background: #fee2e2;
  color: #b91c1c;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
}
.form-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.form-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.table-wrap {
  overflow-x: auto;
}

@media (max-width: 640px) {
  .settings-users-table thead { display: none; }
  .settings-users-table tbody td {
    display: block;
    border-bottom: none;
    padding: 4px 12px;
  }
  .settings-users-table tbody tr {
    display: block;
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 0;
  }
}

/* =========================================================
   QA（よくある質問と回答）
   ========================================================= */
.qa-add-card {
  margin-bottom: 16px;
}
.qa-field-label {
  display: block;
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 4px;
  font-weight: 600;
}
.qa-textarea {
  resize: vertical;
  min-height: 64px;
  line-height: 1.6;
}
.qa-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.qa-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.qa-list.qa-reorder-mode .qa-item {
  transition: background 0.1s ease, border-color 0.1s ease;
}
.qa-item.dragging {
  opacity: 0.4;
}
.qa-item.drag-over {
  border-color: var(--text);
  background: var(--hover);
}
.qa-handle {
  color: var(--text-mute);
  padding-top: 2px;
  flex-shrink: 0;
  cursor: grab;
}
.qa-handle:active {
  cursor: grabbing;
}
.qa-item-body {
  flex: 1;
  min-width: 0;
}
.qa-question {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-weight: 700;
  color: var(--text);
  line-height: 1.6;
  word-break: break-word;
}
.qa-qno {
  color: #dc2626;
  font-weight: 700;
  flex-shrink: 0;
  white-space: nowrap;
}
.qa-answer {
  margin-top: 8px;
  color: var(--text-sub);
  font-size: 14px;
  line-height: 1.7;
  white-space: normal;
  word-break: break-word;
}
.qa-answer-empty {
  color: var(--text-mute);
  font-style: italic;
}
.qa-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.qa-del-btn {
  color: #dc2626;
}
.qa-del-btn:hover {
  background: #fef2f2;
}
.qa-item-editing {
  border-color: var(--primary, #2563eb);
  background: #f8fafc;
}
.qa-empty {
  text-align: center;
  color: var(--text-mute);
  padding: 28px 12px;
}
