/* ============================================================
   publisher_listings.css — 掲載者ダッシュボード 掲載一覧ページ専用スタイル
   ============================================================ */

/* ----------------------------------------------------------
   未保存変更 アクションバー
   ---------------------------------------------------------- */
.pub-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 10px;
}

.pub-action-bar-count {
  font-size: 14px;
  font-weight: 700;
  color: #92400e;
}

.pub-action-bar-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ----------------------------------------------------------
   掲載を追加・CSVダウンロード ツールバー
   ---------------------------------------------------------- */
.pub-listing-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* ----------------------------------------------------------
   一覧表示・カード表示 切り替え（別ページへのセグメント状ナビ）
   選択中は「掲載を追加」ボタン（.btn.primary）と同じ var(--cta) 系の濃紺にする
   ---------------------------------------------------------- */
.pub-view-tabs {
  display: flex;
  gap: 6px;
  width: fit-content;
  margin-top: 10px;
}
.pub-view-tab {
  padding: 7px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  color: var(--cta);
  background: #fff;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.pub-view-tab:hover {
  border-color: var(--cta);
  background: rgba(3, 105, 161, 0.06);
}
.pub-view-tab:focus-visible {
  outline: 2px solid var(--cta);
  outline-offset: 2px;
}
.pub-view-tab.is-active {
  background: var(--cta);
  border-color: var(--cta);
  color: #fff;
}
.pub-view-tab.is-active:hover {
  background: var(--cta-hover);
  border-color: var(--cta-hover);
}

/* スマホ側の補助表示（PC向け一覧管理機能のため、カード表示への導線を控えめに案内する）。
   PCでは非表示、スマホでは pub-view-tabs-pc の代わりにこちらを表示する。 */
.pub-view-mobile-note {
  display: none;
}
.pub-view-mobile-text {
  font-size: 13px;
  color: var(--muted);
}
.pub-view-mobile-link {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--cta);
  text-decoration: underline;
}

@media (max-width: 767px) {
  .pub-view-tabs-pc {
    display: none;
  }
  .pub-view-mobile-note {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
  }
  .pub-view-tabs {
    width: 100%;
  }
  .pub-view-tab {
    flex: 1;
    text-align: center;
  }
}

/* ----------------------------------------------------------
   フィルターバー
   ---------------------------------------------------------- */
.pub-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}

.pub-filter-select {
  min-width: 0;
  width: 180px;
  max-width: 200px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.pub-filter-select:focus {
  border-color: rgba(20, 184, 166, 0.55);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.14);
}

.pub-filter-input {
  min-width: 180px;
  max-width: 280px;
  min-height: 40px;
  font-size: 14px;
}

/* ----------------------------------------------------------
   PC 表形式
   ---------------------------------------------------------- */
.pub-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.pub-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
  min-width: 1100px;
}

.pub-table th,
.pub-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.pub-table th {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 1;
}

.pub-table tr:last-child td {
  border-bottom: none;
}

.pub-table tbody tr:hover {
  background: rgba(20, 184, 166, 0.04);
}

/* 掲載ID: monospace 短縮表示 */
.pub-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
  cursor: default;
}

/* タイトル・住所セルは適度に折り返す */
.pub-col-title {
  max-width: 200px;
  white-space: normal;
  word-break: break-all;
}
.pub-col-addr {
  min-width: 260px;
  max-width: 320px;
  direction: rtl;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* PR欄は省略 */
.pub-col-pr {
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 未保存変更行のハイライト */
.pub-table tbody tr.pub-row-dirty {
  background: #fffbeb !important;
}

/* インライン編集 — 共通 */
.pub-inline-input,
.pub-inline-num,
.pub-inline-select,
.pub-inline-textarea {
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 7px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.pub-inline-input:focus,
.pub-inline-num:focus,
.pub-inline-select:focus,
.pub-inline-textarea:focus {
  border-color: rgba(20, 184, 166, 0.55);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
}

.pub-inline-input     { min-width: 80px; }
.pub-inline-num       { min-width: 60px; }
.pub-inline-select    { min-width: 80px; }
.pub-inline-textarea  { min-width: 100px; max-width: 160px; min-height: 50px; resize: vertical; display: block; }

.pub-col-title-input  { width: 160px; }

/* 公開・空き状況 select */
.pub-status-select    { width: 120px; }

/* 敷金・礼金・その他初期費用 — セル内レイアウト */
.pub-fee-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

/* 問い合わせ方法チェックボックス群 */
.pub-contact-checks {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}
.pub-contact-checks label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
}

/* モバイルカードの未保存表示 */
.pub-card-dirty {
  border: 2px solid #fcd34d !important;
}

/* 操作列のボタン */
.pub-edit-btn {
  font-size: 12px;
  min-height: 32px;
  padding: 5px 10px;
  white-space: nowrap;
}

/* 空状態メッセージ */
.pub-table-empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 16px;
  font-size: 14px;
  margin: 0;
}

/* ----------------------------------------------------------
   モバイル カード形式
   PC ではデフォルト非表示、モバイルで表示
   ---------------------------------------------------------- */
.pub-cards {
  display: none;
}

@media (max-width: 767px) {
  /* PC テーブルを隠す */
  .pub-table-wrap {
    display: none !important;
  }

  /* フィルターは両方に表示 */
  .pub-filter-select {
    width: 100%;
    max-width: none;
  }
  .pub-filter-input {
    max-width: none;
    width: 100%;
  }

  /* モバイルカードを表示 */
  .pub-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
}

/* ----------------------------------------------------------
   ご意見箱 固定ボタン
   ---------------------------------------------------------- */
.pub-feedback-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  cursor: pointer;
  border: 1px solid rgba(37, 99, 235, 0.35);
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 14px;
  min-height: 44px;
  box-shadow: 0 4px 16px rgba(2, 6, 23, 0.14);
  backdrop-filter: blur(8px);
  transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.pub-feedback-btn:hover {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 6px 20px rgba(2, 6, 23, 0.18);
}

@media (max-width: 767px) {
  .pub-feedback-btn {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    right: 14px;
    font-size: 13px;
    padding: 9px 14px;
  }
}

/* ----------------------------------------------------------
   ご意見箱 モーダル
   pub-confirm-dialog と同パターン（base.css の <dialog> 実装に準拠）
   ---------------------------------------------------------- */
.pub-feedback-modal {
  border: none;
  padding: 0;
  border-radius: 16px;
  width: min(520px, calc(100vw - 28px));
  max-height: min(86dvh, 640px);
  background: var(--card, #fff);
  color: var(--text, #0f172a);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.24);
  overflow: hidden;
}

.pub-feedback-modal[open] {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

.pub-feedback-modal::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.pub-feedback-modal-inner {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.pub-feedback-modal-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.pub-feedback-modal-body {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pub-feedback-modal-footer {
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ----------------------------------------------------------
   Excelアップロード
   ---------------------------------------------------------- */
.pub-upload-box {
  margin-bottom: 14px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pub-upload-box-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pub-upload-dropzone {
  border: 2px dashed var(--line);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  background: #fafbfd;
  transition: background 0.15s, border-color 0.15s;
}
.pub-upload-dropzone.is-dragging {
  background: #eef4ff;
  border-color: var(--primary, #3b82f6);
}
.pub-upload-dropzone-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}
.pub-upload-dropzone-text span:first-child {
  font-weight: 700;
  color: var(--fg);
}

.pub-upload-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pub-upload-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}
.pub-upload-label:hover {
  border-color: rgba(20, 184, 166, 0.55);
  background: rgba(20, 184, 166, 0.04);
}

.pub-upload-filename {
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
}
.pub-upload-filename.has-file {
  color: var(--text);
  font-weight: 700;
}

.pub-upload-error {
  margin: 0;
  font-size: 13px;
  color: var(--danger);
}

.pub-upload-result {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.6;
}

.pub-upload-result ul {
  margin: 6px 0;
  padding-left: 1.4em;
}

.pub-upload-result p {
  margin: 6px 0 0;
  color: var(--muted);
}

.pub-upload-result-warn {
  color: var(--danger) !important;
  font-weight: 700;
}

.pub-upload-preview-overview {
  margin-bottom: 10px;
}

.pub-upload-preview-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.pub-upload-preview-section h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.pub-upload-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 10px;
}

.pub-upload-metrics span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.pub-preview-table-wrap {
  margin-top: 8px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.pub-preview-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 12px;
}

.pub-preview-table th,
.pub-preview-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.pub-preview-table th,
.pub-preview-table td {
  border-right: 1px solid var(--line);
}

.pub-preview-table th:last-child,
.pub-preview-table td:last-child {
  border-right: none;
}

.pub-existing-preview-table-wrap {
  max-height: min(68vh, 720px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.pub-existing-preview-table {
  table-layout: fixed;
  min-width: 980px;
}

.pub-existing-preview-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  box-shadow: 0 1px 0 var(--line);
}

.pub-existing-preview-table td,
.pub-existing-preview-table th {
  white-space: normal;
  word-break: break-word;
}

.pub-existing-col-row { width: 48px; }
.pub-existing-col-listing { width: 96px; }
.pub-existing-col-field { width: 96px; }
.pub-existing-col-current { width: 30%; }
.pub-existing-col-excel { width: 30%; }
.pub-existing-col-action { width: 190px; }

.pub-existing-preview-table td:nth-child(4),
.pub-existing-preview-table td:nth-child(5) {
  min-width: 0;
}

.pub-commit-deferred-note {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}


.pub-preview-table th {
  background: #f1f5f9;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.pub-preview-table tr:last-child td {
  border-bottom: none;
}

.pub-preview-row-error td {
  background: #fff5f5;
}
.pub-row-error-list {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--danger, #dc2626);
}

.pub-preview-warnings {
  border-color: rgba(239, 68, 68, 0.28);
}

.pub-preview-error-cell {
  color: var(--danger);
  font-weight: 700;
}

.pub-preview-warning-cell {
  color: #b45309;
  font-weight: 700;
}

.pub-preview-ok-cell {
  color: var(--ok, #16a34a);
  font-weight: 700;
}

.pub-upload-muted {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 767px) {
  .pub-preview-table {
    min-width: 760px;
  }
}

.pub-preview-summary {
  margin: 8px 0 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.pub-preview-summary.is-ok {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.06);
}

.pub-preview-summary.is-warn {
  border-color: rgba(245, 158, 11, 0.38);
  background: rgba(245, 158, 11, 0.08);
}

.pub-preview-summary.is-error {
  border-color: rgba(239, 68, 68, 0.38);
  background: rgba(239, 68, 68, 0.07);
}

.pub-preview-summary-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
}

.pub-preview-summary-head strong {
  font-size: 14px;
}

.pub-preview-summary-head span {
  color: var(--muted);
  font-size: 12px;
}

.pub-preview-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.pub-preview-summary-grid div,
.pub-summary-card {
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.pub-summary-card {
  cursor: pointer;
  text-align: left;
  font: inherit;
  display: block;
  width: 100%;
  transition: background 0.12s, border-color 0.12s;
}

.pub-summary-card:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(148, 163, 184, 0.55);
}

.pub-preview-summary-grid b {
  display: block;
  font-size: 18px;
  line-height: 1.1;
}

.pub-preview-summary-grid span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 767px) {
  .pub-preview-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


.pub-preview-sheet-validation {
  border-color: rgba(217, 119, 6, 0.28);
  background: rgba(255, 251, 235, 0.72);
}

.pub-preview-sheet-validation .pub-preview-table td:nth-child(4),
.pub-preview-sheet-validation .pub-preview-table td:nth-child(5) {
  white-space: normal;
  min-width: 180px;
}

.pub-preview-actions {
  margin: 14px 0 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pub-preview-actions-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  flex: 1 1 260px;
}

.pub-preview-actions-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 767px) {
  .pub-preview-actions {
    align-items: stretch;
  }
  .pub-preview-actions-buttons {
    justify-content: stretch;
  }
  .pub-preview-actions-buttons .btn {
    flex: 1 1 100%;
  }
}

.pub-upload-job-id {
  color: var(--muted);
  font-size: 11px;
  margin: 8px 0 0;
  word-break: break-all;
}

/* Excelアップロード履歴 */
.pub-import-history-section {
  margin: 14px 0 0;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.pub-import-history-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.pub-history-table-wrap {
  overflow-x: auto;
}
.pub-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 640px;
}
.pub-history-table th {
  text-align: left;
  padding: 5px 8px;
  background: var(--input-bg, #f1f5f9);
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}
.pub-history-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}
.pub-history-table tbody tr:last-child td {
  border-bottom: none;
}
.pub-history-id {
  font-family: monospace;
  font-size: 10px;
  color: var(--muted);
  word-break: break-all;
  white-space: normal;
  max-width: 180px;
}
.pub-history-cell-error {
  color: var(--danger, #dc2626);
  font-weight: 700;
}

/* 履歴詳細モーダル */
.pub-detail-modal {
  border: none;
  border-radius: 12px;
  padding: 0;
  width: min(820px, 96vw);
  /* A-8: iOS Safariはアドレスバーの表示/非表示で vh が変動し、
     固定 90vh だと下端の要素が一時的に画面外へ隠れることがあるため dvh を優先する
     （dvh未対応ブラウザ向けに vh を先に書いてフォールバックにする）。 */
  max-height: 90vh;
  max-height: 90dvh;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.pub-detail-modal::backdrop {
  background: rgba(0,0,0,.45);
}
.pub-detail-modal-inner {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  max-height: 90dvh;
}
.pub-detail-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.pub-detail-modal-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* A-8: flex:1 + min-height:0 がないと、この要素はコンテンツの実サイズまで伸びてしまい
     overflow-y:auto が働かず、はみ出し分がdialogのoverflow:hiddenで見えないまま切れる
     （スマホでボタンが画面外に隠れる不具合の直接原因）。本文だけをスクロール領域にする。 */
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px 20px 20px;
}
/* A-8: モーダル下部の主操作ボタン領域。本文スクロール領域の外（flexの兄弟要素）に置くことで、
   本文がどれだけ長くてもボタンは常にモーダル下部に固定表示される。 */
.pub-detail-modal-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: #fff;
}

/* 詳細ジョブ情報 */
.pub-detail-job-info {
  margin-bottom: 16px;
}
.pub-detail-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 13px;
  margin: 0;
}
.pub-detail-dl dt {
  color: var(--muted);
  white-space: nowrap;
  font-weight: 700;
}
.pub-detail-dl dd {
  margin: 0;
  word-break: break-all;
}

/* 行カード */
.pub-detail-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.pub-detail-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  background: #fff;
}
.pub-detail-row-update  { border-left: 3px solid #3b82f6; }
.pub-detail-row-warn    { border-left: 3px solid #f59e0b; }
.pub-detail-row-error   { border-left: 3px solid var(--danger, #dc2626); background: #fff5f5; }
.pub-detail-row-new     { border-left: 3px solid #10b981; }

.pub-detail-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.pub-detail-row-type {
  font-weight: 700;
  font-size: 12px;
}
.pub-detail-row-meta {
  color: var(--muted);
  font-size: 11px;
}
.pub-detail-row-lid {
  color: var(--muted);
  font-size: 11px;
}
.pub-detail-row-lid code {
  font-family: monospace;
}

/* diff 表示 */
.pub-detail-diff-list {
  margin: 4px 0 6px;
  padding-left: 16px;
  font-size: 13px;
  line-height: 1.7;
}
.pub-detail-diff-simple {
  margin: 4px 0 6px;
  font-size: 13px;
}

/* エラー・警告 */
.pub-detail-errors {
  margin: 4px 0 2px;
  color: var(--danger, #dc2626);
  font-size: 12px;
}
.pub-detail-errors strong {
  display: block;
  margin-bottom: 2px;
}
.pub-detail-errors ul,
.pub-detail-warnings ul {
  margin: 0;
  padding-left: 16px;
}
.pub-detail-warnings {
  margin: 4px 0 2px;
  color: #b45309;
  font-size: 12px;
}
.pub-detail-warnings strong {
  display: block;
  margin-bottom: 2px;
}

/* raw_json 折りたたみ */
.pub-detail-raw {
  margin-top: 6px;
  font-size: 12px;
}
.pub-detail-raw summary {
  cursor: pointer;
  color: var(--muted);
  user-select: none;
}
.pub-detail-raw-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  margin: 6px 0 0;
  padding: 8px;
  background: #f8fafc;
  border-radius: 6px;
  font-size: 11px;
}
.pub-detail-raw-dl dt {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}
.pub-detail-raw-dl dd {
  margin: 0;
  word-break: break-all;
}

/* 反映前チェックモーダル */
.pub-precheck-modal {
  border: none;
  border-radius: 12px;
  padding: 0;
  width: min(560px, 96vw);
  /* A-8: dvhフォールバック（.pub-detail-modal と同じ理由）。 */
  max-height: 80vh;
  max-height: 80dvh;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.pub-precheck-modal::backdrop {
  background: rgba(0,0,0,.45);
}
/* A-8: .pub-detail-modal-inner の既定max-height（90vh/90dvh）は .pub-detail-modal 用の値で、
   .pub-precheck-modal 自体のmax-height（80vh/80dvh）より大きい。値が食い違うと、内側のflex
   レイアウトはinner側の90dvh基準で計算されてしまい、footerがdialogのoverflow:hiddenで
   下端を切られて見えなくなる（実機検証で確認済み）。precheckモーダルでは自身の値に揃える。 */
.pub-precheck-modal .pub-detail-modal-inner {
  max-height: 80vh;
  max-height: 80dvh;
}
.pub-precheck-result {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
}
.pub-precheck-result.is-blocked {
  background: #fff5f5;
  border: 1px solid #fca5a5;
  color: var(--danger, #dc2626);
}
.pub-precheck-result.is-ok {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #166534;
}
.pub-precheck-result.is-committed {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1e40af;
}
.pub-precheck-result.is-partial {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
}
.pub-precheck-result.is-failed {
  background: #fff5f5;
  border: 1px solid #fca5a5;
  color: var(--danger, #dc2626);
}
.pub-commit-partial-note {
  margin: 0 0 10px;
  padding: 8px 10px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  font-size: 13px;
  color: #92400e;
  line-height: 1.6;
}

/* 反映予定内容モーダル */
.pub-commit-plans {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pub-commit-plan-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #f8fafc;
}
.pub-commit-plan-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 14px;
}
.pub-commit-execute {
  margin-top: 16px;
  padding: 14px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
}
.pub-commit-execute-note {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}
.pub-commit-bool-note {
  font-size: 11px;
  color: var(--muted);
  margin-left: 4px;
}
.pub-commit-scope-note {
  margin: 0 0 14px;
  padding: 10px 12px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  font-size: 13px;
  color: #92400e;
  line-height: 1.6;
}
.pub-contact-change-notice {
  margin: 12px 0 0;
  padding: 10px 12px;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-radius: 6px;
  font-size: 13px;
  color: #1e40af;
  line-height: 1.6;
}
.pub-contact-current {
  margin: 8px 0;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.pub-contact-norm-compare {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.pub-contact-norm-raw {
  color: var(--muted);
  text-decoration: line-through;
  font-size: 12px;
}
.pub-contact-norm-arrow {
  color: var(--muted);
  font-size: 12px;
}
.pub-contact-norm-val {
  font-weight: 700;
}
.pub-contact-norm-tag {
  font-size: 11px;
  padding: 1px 5px;
  background: #dbeafe;
  color: #1d4ed8;
  border-radius: 4px;
}
.pub-contact-warnings {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: #92400e;
}
.pub-contact-commit-section {
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pub-contact-commit-blocked {
  margin: 0;
  font-size: 13px;
  color: #b45309;
}
.pub-contact-commit-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
  cursor: pointer;
}
.pub-contact-commit-check input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.pub-contact-commit-check input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* ---- 公開・空き状況変更候補 ---- */
.pub-avail-change-notice {
  margin: 12px 0 0;
  padding: 10px 12px;
  background: #fefce8;
  border: 1px solid #fde047;
  border-radius: 6px;
  font-size: 13px;
  color: #854d0e;
  line-height: 1.6;
}
.pub-avail-summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 14px;
}
.pub-avail-summary-card {
  padding: 8px 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  min-width: 90px;
  text-align: center;
}
.pub-avail-summary-card.is-invalid {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}
.pub-avail-candidate-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
}
.pub-avail-candidate-item.is-invalid {
  border-color: #fcd34d;
  background: #fefce8;
}
.pub-avail-meaning {
  margin-top: 6px;
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
}
.pub-avail-meaning.is-public {
  color: #15803d;
  font-weight: 600;
}
.pub-avail-meaning.is-private {
  color: var(--muted);
}
.pub-avail-warning {
  margin-top: 6px;
  font-size: 12px;
  color: #92400e;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ---- 行修正フォームモーダル ---- */
.pub-row-edit-btn {
  font-size: 11px;
  padding: 3px 8px;
  white-space: nowrap;
}
.pub-row-edit-notice {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  padding: 10px 12px;
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.6;
  color: #92400e;
}
.pub-row-edit-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 0 16px;
}
.pub-row-edit-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pub-row-edit-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--label, #374151);
}
.pub-row-edit-field input,
.pub-row-edit-field select,
.pub-row-edit-field textarea {
  padding: 6px 10px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 6px;
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
}
.pub-row-edit-hint {
  font-size: 11px;
  color: var(--muted, #6b7280);
}
.pub-row-edit-actions {
  border-top: 1px solid var(--border, #e5e7eb);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---- 再チェック結果 ---- */
.pub-recheck-result {
  margin: 10px 0 8px;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.6;
}
.pub-recheck-result.is-ok {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #14532d;
}
.pub-recheck-result.is-ng {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #7f1d1d;
}

/* ---- 再チェック済みバッジ ---- */
.pub-recheck-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}
.pub-recheck-badge-ok {
  background: #dcfce7;
  color: #14532d;
}
.pub-recheck-badge-ng {
  background: #fef3c7;
  color: #78350f;
}


/* ---- 履歴詳細: 専用commit履歴（問い合わせ先・公開/空き状況） ---- */
.pub-aux-commit-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.pub-aux-commit-card {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
}
.pub-aux-commit-card strong {
  display: block;
  margin-bottom: 4px;
}
.pub-aux-commit-card p {
  margin: 0 0 8px;
}
.pub-aux-commit-card.is-ok {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #166534;
}
.pub-aux-commit-card.is-failed {
  background: #fff5f5;
  border: 1px solid #fca5a5;
  color: var(--danger, #dc2626);
}
.pub-aux-commit-note {
  margin: 8px 0 0 !important;
  font-size: 12px;
  font-weight: 700;
}

/* ---- 新規下書き作成通知・モーダル ---- */
.pub-new-draft-notice {
  margin-top: 16px;
  padding: 14px 16px;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-radius: 8px;
}
.pub-new-draft-notice p {
  margin: 4px 0 10px;
  font-size: 13px;
  color: var(--muted, #6b7280);
}
.pub-new-draft-candidate-list {
  margin: 12px 0;
  padding: 0;
  list-style: none;
}
.pub-new-draft-candidate-list li {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line, #e5e7eb);
  font-size: 13px;
}
.pub-new-draft-candidate-list li:last-child {
  border-bottom: none;
}
.pub-new-draft-candidate-list .row-meta {
  color: var(--muted, #6b7280);
  font-size: 12px;
  margin-left: 6px;
}
.pub-new-draft-caution {
  margin: 12px 0;
  padding: 10px 12px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.6;
}
.pub-new-draft-caution ul {
  margin: 4px 0 0;
  padding-left: 18px;
}
.pub-new-draft-confirm-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 14px 0;
  font-size: 13px;
  line-height: 1.5;
  cursor: pointer;
}
.pub-new-draft-confirm-check input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 2px;
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.pub-new-draft-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
}
.pub-new-draft-result {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
}
.pub-new-draft-result.is-ok {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #166534;
}
.pub-new-draft-result.is-error {
  background: #fff5f5;
  border: 1px solid #fca5a5;
  color: var(--danger, #dc2626);
}
.pub-new-draft-result a {
  color: inherit;
  text-decoration: underline;
}
.pub-new-draft-skipped {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted, #6b7280);
}

/* ----------------------------------------------------------
   変更確認モーダル（bulk-update）
   ---------------------------------------------------------- */
.pub-bulk-confirm-modal {
  border: none;
  padding: 0;
  border-radius: 16px;
  width: min(560px, calc(100vw - 28px));
  max-height: min(88dvh, 680px);
  background: var(--card, #fff);
  color: var(--text, #0f172a);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.24);
  overflow: hidden;
}

.pub-bulk-confirm-modal[open] {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

.pub-bulk-confirm-modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.pub-bulk-confirm-inner {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.pub-bulk-confirm-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.pub-bulk-confirm-body {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
  padding: 16px 20px;
}

.pub-bulk-confirm-footer {
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* 変更一覧アイテム */
.pub-bulk-confirm-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* 変更確認アイテム（変更前→変更後） */
.pub-confirm-item {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) minmax(80px, 1fr) 2fr;
  gap: 6px;
  align-items: start;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font-size: 13px;
  background: #f8fafc;
}

.pub-confirm-listing {
  font-weight: 700;
  word-break: break-word;
}

.pub-confirm-field {
  color: var(--muted);
  font-size: 12px;
}

.pub-confirm-change {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.pub-confirm-before {
  color: var(--muted);
  text-decoration: line-through;
  font-size: 12px;
  word-break: break-all;
}

.pub-confirm-arrow {
  color: var(--muted);
  font-size: 12px;
  flex-shrink: 0;
}

.pub-confirm-after {
  font-weight: 700;
  word-break: break-all;
  color: var(--text);
}

/* 確認モーダル 注意書き */
.pub-bulk-confirm-notes {
  margin: 0 0 12px;
  padding: 8px 12px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.6;
  color: #92400e;
}
.pub-bulk-confirm-notes p {
  margin: 0;
}
.pub-bulk-confirm-notes p + p {
  margin-top: 3px;
}

/* 確認モーダル エラー表示 */
.pub-bulk-confirm-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  font-size: 13px;
  color: var(--danger, #dc2626);
  line-height: 1.6;
}

/* ----------------------------------------------------------
   スマホカード コンパクト表示
   優先度の高い情報（タイトル・住所・状態・賃料）のみ常時表示し、
   種別・初期費用合計・問い合わせ方法・最終更新は「かんたん編集」側に寄せる。
   ---------------------------------------------------------- */
@media (max-width: 767px) {
  .pub-cards .card.pad.pub-card-compact {
    padding: 10px 12px;
  }
}

.pub-card-edit-secondary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.pub-card-edit-secondary-label {
  color: var(--muted);
  margin-right: 4px;
}

/* ----------------------------------------------------------
   スマホカード かんたん編集セクション
   ---------------------------------------------------------- */
.pub-card-edit-section {
  margin-top: 12px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pub-card-edit-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pub-card-edit-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

/* かんたん編集トグルボタン */
.pub-card-edit-toggle {
  font-size: 13px;
  min-height: 36px;
  padding: 5px 12px;
}

/* ----------------------------------------------------------
   一括操作バー
   ---------------------------------------------------------- */
.pub-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-radius: 10px;
}

.pub-bulk-bar-count {
  font-size: 14px;
  font-weight: 700;
  color: #1e40af;
}

.pub-bulk-bar-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* 危険操作ボタン */
.btn.danger {
  border-color: #fca5a5;
  color: #dc2626;
  background: #fef2f2;
}
.btn.danger:hover {
  border-color: #f87171;
  background: #fee2e2;
}

/* ----------------------------------------------------------
   固定横スクロールバー（position: fixed）
   ---------------------------------------------------------- */
#table-scrollbar-outer {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 12px;
  height: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

#table-scrollbar-inner {
  height: 1px;
}

@media (max-width: 767px) {
  #table-scrollbar-outer {
    display: none !important;
  }
}
