* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  background: #f4f6f8; color: #2c3440; font-size: 14px; line-height: 1.6;
}
code { background: #eef1f4; padding: 1px 6px; border-radius: 4px; font-size: 13px; }

/* レイアウト */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: #1f2a37; color: #d5dbe3;
  display: flex; flex-direction: column; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh; align-self: flex-start;
  overflow-y: auto; overscroll-behavior: contain;
}
.brand {
  padding: 20px 16px; font-size: 18px; font-weight: 700; color: #fff;
  border-bottom: 1px solid #2e3b4b; line-height: 1.3;
}
.brand small { font-size: 10px; font-weight: 400; color: #8b98a9; letter-spacing: 1px; }
.store-indicator {
  padding: 8px 16px; background: #17212d; color: #7fd6a2; font-size: 12px; font-weight: 700;
  border-bottom: 1px solid #2e3b4b;
}
.sidebar-store-select {
  padding: 10px 12px; background: #17212d; border-bottom: 1px solid #2e3b4b;
}
.sidebar-store-select label {
  display: block; font-size: 10px; color: #8b98a9; letter-spacing: 1px; margin-bottom: 4px; font-weight: 700;
}
.sidebar-store-select select {
  width: 100%; margin: 0; padding: 7px 8px; font-size: 13px; font-weight: 600;
  background: #2e3b4b; color: #fff; border: 1px solid #3d4c5e; border-radius: 6px;
}
.sidebar nav { flex: 1; padding: 6px 0 12px; }
.nav-group-label {
  padding: 14px 16px 4px; font-size: 10px; font-weight: 700;
  color: #5d6b7d; letter-spacing: 1.5px;
}
.nav-item {
  display: block; padding: 11px 16px; color: #d5dbe3; text-decoration: none; font-size: 13px;
}
.nav-item:hover { background: #2e3b4b; color: #fff; }
.nav-item.disabled { color: #5d6b7d; cursor: default; }
.nav-item.disabled em { font-size: 10px; font-style: normal; background: #2e3b4b; padding: 1px 6px; border-radius: 8px; margin-left: 4px; }
.sidebar-footer { padding: 14px 16px; border-top: 1px solid #2e3b4b; }
.user-info { margin-bottom: 8px; font-size: 13px; color: #fff; }
.user-info small { color: #8b98a9; }

.content { flex: 1; padding: 28px 32px; max-width: 1100px; }
.page-title { font-size: 20px; margin-bottom: 20px; }

/* カード */
.card {
  background: #fff; border-radius: 10px; padding: 20px 24px; margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(20, 30, 40, .08);
}
.card-narrow { max-width: 560px; }
.card-medium { max-width: 780px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-header h2 { font-size: 15px; }

/* 統計カード */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 10px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(20, 30, 40, .08); }
.stat-value { font-size: 26px; font-weight: 700; color: #06c755; }
.stat-label { font-size: 12px; color: #6b7684; margin-top: 2px; }

/* テーブル */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #edf0f3; }
th { font-size: 12px; color: #6b7684; font-weight: 600; background: #fafbfc; white-space: nowrap; }
tr:hover td { background: #f8fafb; }
td.empty { text-align: center; color: #9aa4b0; padding: 28px; }
td.actions { white-space: nowrap; }
.muted { color: #9aa4b0; }

/* バッジ */
.badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-active { background: #e3f7eb; color: #0f9d58; }
.badge-preparing { background: #fff4e0; color: #c77700; }
.badge-closed, .badge-retired { background: #eceff2; color: #6b7684; }
.badge-suspended { background: #fff4e0; color: #c77700; }
.badge-banned { background: #fde8e8; color: #d93025; }

/* フォーム */
label { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 600; }
input, select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 9px 12px;
  border: 1px solid #d4dae1; border-radius: 6px; font-size: 14px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #06c755; }
input:disabled { background: #f2f4f6; color: #8b98a9; }
label small { font-weight: 400; color: #9aa4b0; }
.required { color: #d93025; font-size: 11px; margin-left: 4px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

/* ボタン */
.btn {
  display: inline-block; padding: 9px 18px; border-radius: 6px; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; font-family: inherit;
  white-space: nowrap;
}
.btn-primary { background: #06c755; color: #fff; }
.btn-primary:hover { background: #05b34c; }
.btn-ghost { background: #eef1f4; color: #2c3440; }
.btn-ghost:hover { background: #e2e7ec; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* アラート */
.alert { padding: 11px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 13px; }
.alert-error { background: #fde8e8; color: #b3261e; }
.alert-success { background: #e3f7eb; color: #0f7a44; }

/* 詳細リスト */
.detail-list { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; }
.detail-list dt { color: #6b7684; font-size: 13px; }

/* テーブル内 */
.truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* 横スクロール可能なテーブル枠(はみ出し防止) */
.table-scroll { width: 100%; overflow-x: auto; }

/* ヘッダー固定・本文スクロールのテーブル枠 */
.table-sticky { max-height: 60vh; overflow-y: auto; overflow-x: auto; border: 1px solid #edf0f3; border-radius: 8px; }
.table-sticky table { border-collapse: separate; border-spacing: 0; }
.table-sticky thead th {
  position: sticky; top: 0; z-index: 2;
  background: #f4f6f8; box-shadow: inset 0 -1px 0 #dfe4e9;
}
.table-sticky tbody td { border-bottom: 1px solid #edf0f3; }

/* 監査ログ: 詳細列は折り返し、テーブルは固定レイアウトで枠内に収める */
.audit-table { table-layout: fixed; width: 100%; min-width: 720px; }
.audit-table th, .audit-table td { word-break: break-word; }
.audit-table .audit-detail {
  font-size: 12px; color: #4a5563; font-family: ui-monospace, monospace;
  white-space: pre-wrap; word-break: break-all;
}
.audit-table col.c-detail { width: 30%; }
.avatar { width: 24px; height: 24px; border-radius: 50%; vertical-align: middle; margin-right: 6px; }

/* 注記・装飾エディタ */
.soft-note { font-weight: 400; font-size: 11px; color: #c77700; margin-left: 6px; }
.rte-toolbar {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  padding: 8px; background: #f4f6f8; border: 1px solid #d4dae1; border-bottom: none;
  border-radius: 6px 6px 0 0; margin-top: 5px;
}
.rte-toolbar select, .rte-toolbar input[type=color] { margin-top: 0; width: auto; padding: 4px 6px; }
.rte-toolbar input[type=color] { width: 36px; height: 30px; padding: 2px; }
.rte-area {
  min-height: 160px; border: 1px solid #d4dae1; border-radius: 0 0 6px 6px;
  padding: 10px 12px; background: #fff; font-size: 14px; line-height: 1.8;
  white-space: pre-wrap; overflow-y: auto; max-height: 420px;
}
.rte-area:focus { outline: none; border-color: #06c755; }
.rte-area.readonly { background: #f8fafb; border-radius: 6px; margin-top: 5px; }
.rte-area a { color: #1565c0; }

/* 店舗画面のバナー管理 */
.banner-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.banner-row .banner-thumb { max-width: 140px; }

/* お知らせ一覧(お客様向け) */
.promo-banners { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.promo-banner { width: 100%; border-radius: 10px; display: block; }
.news-section-title { font-size: 15px; margin: 18px 0 10px; }
.ann-body { line-height: 1.9; }
.ann-body.plain { white-space: pre-wrap; }
.news-banner { width: calc(100% + 52px); margin: -30px -26px 16px; border-radius: 14px 14px 0 0; display: block; }
.news-welcome { color: #6b7684; margin: -6px 0 16px; white-space: pre-wrap; line-height: 1.8; }
.banner-thumb { max-width: 260px; border-radius: 8px; display: block; margin-bottom: 6px; }
.news-list { display: flex; flex-direction: column; gap: 10px; }
.news-item {
  display: block; padding: 12px 14px; border: 1px solid #e4e9ee; border-radius: 10px;
  text-decoration: none; color: #2c3440; background: #fff;
}
.news-item:active { background: #f4f6f8; }
.news-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.news-date { font-size: 12px; }
.news-title { font-weight: 600; line-height: 1.5; }

/* 本番リリースまでの送信ロック */
.release-lock { position: relative; }
.release-lock-cover {
  position: absolute; inset: -6px; z-index: 10; border-radius: 8px;
  background: rgba(244, 246, 248, .72); backdrop-filter: blur(1.5px);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #6b7684; cursor: not-allowed;
}

/* 棒グラフ */
.chart { display: flex; align-items: flex-end; gap: 2px; height: 130px; padding-top: 6px; }
.chart .bar { flex: 1; background: #06c755; border-radius: 2px 2px 0 0; min-height: 2px; }
.chart.chart-blue .bar { background: #2196F3; }
.chart .bar:hover { opacity: .7; }
.chart-labels { display: flex; justify-content: space-between; font-size: 11px; color: #9aa4b0; margin-top: 4px; }

/* 検索バー・タグ選択 */
.filter-bar { display: flex; gap: 8px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
.bulk-bar { background: #f8fafb; border: 1px solid #e4e9ee; border-radius: 8px; padding: 8px 12px; }
.tag-checks { display: flex; gap: 10px; flex-wrap: wrap; margin: -6px 0 14px; }
.tag-check { display: flex; align-items: center; gap: 4px; margin: 0; font-weight: 400; cursor: pointer; }
.tag-check input { width: auto; margin: 0; display: inline; }

/* ダッシュボードのタブ・表示範囲 */
.dash-controls { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.tab-nav { display: flex; gap: 6px; }
.tab-item {
  padding: 9px 16px; border-radius: 8px; text-decoration: none; font-size: 13px; font-weight: 600;
  color: #6b7684; background: #eef1f4;
}
.tab-item.active { background: #06c755; color: #fff; }
.tab-item:hover:not(.active) { background: #e2e7ec; }

/* 店舗切替(管理者用) */
.store-switcher {
  background: #fff; border-radius: 10px; padding: 12px 16px; margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(20, 30, 40, .08); max-width: 340px;
}

/* ガイド */
.guide-box {
  background: #f0f7ff; border: 1px solid #cfe3f7; border-radius: 8px;
  padding: 12px 14px; margin: 12px 0; font-size: 13px; line-height: 1.8;
}
.guide-table td { vertical-align: top; font-size: 13px; }
.guide-table code { word-break: break-all; }

/* お客様向け公開ページ(スマホ前提) */
.public-body {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: #f4f6f8; padding: 16px;
}
.public-card {
  background: #fff; border-radius: 14px; padding: 30px 26px; width: 100%; max-width: 420px;
  box-shadow: 0 4px 16px rgba(20, 30, 40, .1);
}
.public-card h1 { font-size: 19px; }
.public-card.center { text-align: center; }
.public-sub { color: #6b7684; margin: 8px 0 18px; }
.done-mark {
  width: 64px; height: 64px; border-radius: 50%; background: #06c755; color: #fff;
  font-size: 36px; line-height: 64px; text-align: center; margin: 0 auto 14px;
}

/* お知らせページ・画像 */
.announcement { max-width: 480px; }
.ann-meta { margin-bottom: 8px; }
.ann-title { font-size: 20px; margin-bottom: 14px; }
.ann-image { width: 100%; border-radius: 10px; margin-bottom: 12px; }
/* 画像の長押し保存・ドラッグ保存・右クリック保存を抑制(完全防止ではない/casual保存の抑止) */
.ann-image, .promo-banner, .news-banner, .landing-logo {
  -webkit-touch-callout: none; /* iOS長押しメニュー無効 */
  -webkit-user-select: none; -moz-user-select: none; user-select: none;
  -webkit-user-drag: none; user-drag: none;
}
.image-list { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.image-item img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; display: block; }
.image-item.image-editable { position: relative; }
.image-x {
  position: absolute; top: -8px; right: -8px; z-index: 3;
  width: 26px; height: 26px; border-radius: 50%; border: none; cursor: pointer;
  background: #d93025; color: #fff; font-size: 14px; line-height: 1; font-weight: 700;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.image-x:hover { background: #b3261e; }
.image-removing-label {
  position: absolute; inset: 0; z-index: 2; display: none;
  align-items: center; justify-content: center; border-radius: 8px;
  background: rgba(217, 48, 37, .78); color: #fff; font-size: 12px; font-weight: 700;
}
.image-item.removing .image-removing-label { display: flex; }
.image-item.removing img { opacity: .35; }
.image-item.removing .remove-flag ~ input[type=url] { opacity: .4; }
.image-key-badge {
  position: absolute; top: 4px; left: 4px; z-index: 3;
  background: rgba(31, 42, 55, .85); color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 6px;
}
.insert-key-btn { margin-top: 4px; }
.image-remove { font-size: 12px; font-weight: 400; margin: 4px 0 0; }
.rte-sep { width: 1px; height: 22px; background: #d4dae1; display: inline-block; margin: 0 3px; }
.rte-imgkey { background: #eaf6ef; }
.slot-num {
  align-self: center; background: #1f2a37; color: #fff; font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 6px; white-space: nowrap;
}
.image-add-slot { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; align-items: center; }
.image-add-slot input[type=file] { flex: 1; min-width: 180px; margin-top: 0; }
.image-add-slot input[type=url] { flex: 1.4; min-width: 180px; margin-top: 0; font-size: 12px; padding: 7px 10px; }
.copy-btn { margin-left: 6px; }

/* 誘引ページ(公開) */
.landing-card { max-width: 380px; padding: 40px 30px; }
.landing-logo { max-width: 200px; max-height: 200px; margin: 0 auto 20px; display: block; border-radius: 12px; }
.landing-title { font-size: 20px; margin-bottom: 24px; }
.landing-line-btn {
  display: block; width: 100%; background: var(--theme, #06c755); color: #fff; text-decoration: none;
  padding: 16px; border-radius: 12px; font-size: 17px; font-weight: 700; border: none; cursor: pointer;
  box-shadow: 0 3px 10px rgba(6, 199, 85, .3);
}
.landing-line-btn:active { opacity: .85; }
.landing-line-icon {
  background: rgba(255, 255, 255, .25); padding: 2px 8px; border-radius: 6px; font-size: 13px; margin-right: 6px;
}
.landing-note { color: #6b7684; font-size: 13px; margin-top: 16px; line-height: 1.7; }

/* モーダル(プレビュー等) */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000; background: rgba(20, 30, 40, .55);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box { background: #fff; border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .3); display: flex; flex-direction: column; overflow: hidden; }
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid #edf0f3; font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.modal-phone { width: 400px; max-width: 100%; height: 85vh; }
.modal-phone iframe { flex: 1; width: 100%; border: none; background: #f4f6f8; }

/* ログイン画面 */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #1f2a37; }
.login-card { background: #fff; border-radius: 12px; padding: 36px 40px; width: 380px; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); }
.login-card h1 { font-size: 20px; text-align: center; }
.login-sub { text-align: center; color: #9aa4b0; font-size: 11px; letter-spacing: 2px; margin: 4px 0 24px; }

/* ===== モバイル対応(スマホで撮影→即配信の運用向け。PC表示は不変) ===== */
.mobile-topbar { display: none; }
.sidebar-overlay { display: none; }

@media (max-width: 768px) {
  /* トップバー(ハンバーガー) */
  .mobile-topbar {
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 30;
    background: #1f2a37; color: #fff; padding: 10px 14px;
  }
  .menu-toggle {
    width: auto; margin: 0; padding: 2px 8px; background: none; border: none;
    color: #fff; font-size: 22px; line-height: 1; cursor: pointer;
  }
  .mobile-brand { font-weight: 700; font-size: 15px; }

  /* レイアウト: サイドバーをスライドインのドロワーに */
  .layout { display: block; min-height: auto; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 78%; max-width: 300px; z-index: 40;
    transform: translateX(-100%); transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 30px rgba(0, 0, 0, .5); }
  .sidebar-overlay.show {
    display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 35;
  }

  /* 本文: 全幅・余白圧縮 */
  .content { padding: 16px 14px; max-width: 100%; }
  .page-title { font-size: 17px; margin-bottom: 14px; }
  .card { padding: 16px 14px; }
  .card-narrow, .card-medium { max-width: 100%; }

  /* フォーム: 横並びを縦積みに */
  .detail-list { grid-template-columns: 1fr; gap: 2px 0; }
  .detail-list dt { margin-top: 10px; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1 1 auto; text-align: center; }
  .rte-toolbar { flex-wrap: wrap; }
  .image-add-slot { flex-wrap: wrap; }
  .image-add-slot input[type=file], .image-add-slot input[type=url] { flex: 1 1 100%; }

  /* テーブル: 横スクロールではみ出し防止 */
  .content table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }

  /* プレビューのスマホ枠は画面いっぱいに */
  .modal-phone { width: 100%; height: 90vh; }
}
