:root {
  --cream-bg: #FBF3E7;
  --cream-card: #FFFAF0;
  --cream-deep: #F5E9D3;
  --terracotta: #C9663F;
  --terracotta-light: #E07A57;
  --terracotta-dark: #A04C2A;
  --text-dark: #3B2A1F;
  --text-mid: #6B5547;
  --text-light: #8B7568;
  --border: #E8D9C0;
  --shadow: 0 2px 12px rgba(180,120,80,0.08);
  --shadow-hover: 0 4px 20px rgba(180,120,80,0.16);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  background: var(--cream-bg);
  color: var(--text-dark);
  font-size: 14px;
  line-height: 1.7;
  display: flex;
  min-height: 100vh;
  padding-top: 56px;
}

/* ===== ヘッダー帯（Swipee / どこにげ 同型） ===== */
.mn-topband {
  position: fixed; top: 0; left: 0; right: 0; height: 56px; z-index: 300;
  display: flex; align-items: center; gap: 6px; padding: 0 18px;
  background: var(--cream-card); border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(70, 45, 25, 0.05);
}
.mn-topband-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex-shrink: 0; margin-right: auto; }
.mn-brand { display: flex; align-items: center; text-decoration: none; min-width: 0; line-height: 0; }
.mn-brand:hover { text-decoration: none; opacity: 0.92; }
.mn-brand-logo { height: 43px; width: auto; max-width: min(52vw, 320px); object-fit: contain; display: block; }
.mn-topnav { display: flex; align-items: center; gap: 2px; min-width: 0; overflow-x: auto; }
.mn-navlink {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 9px;
  font-size: 13px; font-weight: 700; color: var(--text-mid); text-decoration: none; white-space: nowrap;
  transition: background .14s, color .14s;
}
.mn-navlink:hover { background: var(--cream-deep); color: var(--terracotta-dark); text-decoration: none; }
.mn-navlink.active { background: var(--terracotta); color: #fff; }
.mn-nav-ico { display: inline-flex; width: 16px; height: 16px; color: var(--terracotta); flex-shrink: 0; }
.mn-nav-ico svg { width: 16px; height: 16px; }
.mn-navlink:hover .mn-nav-ico { color: var(--terracotta-dark); }
.mn-navlink.active .mn-nav-ico { color: #fff; }
.mn-topband-right { display: flex; align-items: center; flex-shrink: 0; }
/* アカウント帯(#mnTopbandRight)はJSがデスクトップ/モバイルで配置先を動的に移動する（sidebar-toggle.js の relocateAccount）。
   デスクトップ時 .mn-sidebar-head は閉じるボタンのみのため非表示。モバイル時のみ 900px以下ブロックで表示する。 */
.mn-sidebar-head { display: none; }
.mn-sidebar-close { display: none; }
.mn-burger {
  display: none; align-items: center; justify-content: center; width: 33px; height: 33px; padding: 0;
  border: 1px solid var(--border); border-radius: 10px; background: var(--cream-card); color: var(--text-mid);
  box-shadow: var(--shadow); cursor: pointer; flex-shrink: 0; margin-left: auto;
}
.mn-burger:hover { border-color: var(--terracotta); color: var(--terracotta-dark); background: var(--cream-deep); }
.mn-backdrop { display: none; }
.mn-sidebar-topnav { display: none; }

.sidebar {
  width: 240px; min-width: 240px;
  background: var(--cream-card);
  border-right: 1px solid var(--border);
  position: fixed; top: 56px; left: 0; height: calc(100vh - 56px);
  overflow-y: auto; padding: 16px 0; z-index: 310;
}
.nav-group-label { font-size: 10px; font-weight: 700; color: var(--text-light); letter-spacing: 0.08em; text-transform: uppercase; padding: 12px 20px 4px; }
.nav-item { display: flex; justify-content: space-between; align-items: center; padding: 9px 20px; font-size: 13px; color: var(--text-mid); cursor: pointer; transition: all 0.15s; border-left: 3px solid transparent; user-select: none; text-decoration: none; font-weight: 400; }
.nav-item:hover { background: var(--cream-deep); color: var(--text-dark); text-decoration: none; }
.nav-item.active { background: var(--terracotta); color: #fff; border-left: 3px solid var(--terracotta-dark); font-weight: 600; }
.nav-item.active .nav-count { background: rgba(255,255,255,0.25); color: #fff; }
.nav-count { background: var(--cream-deep); color: var(--text-light); font-size: 11px; font-weight: 700; border-radius: 999px; padding: 0 8px; min-width: 24px; text-align: center; }
.main { margin-left: 240px; flex: 1; padding: 40px 48px; max-width: 980px; }
.page-eyebrow { font-size: 11px; color: var(--text-light); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 6px; }
.page-header h1 { font-size: 26px; font-weight: 800; color: var(--terracotta-dark); margin-bottom: 6px; line-height: 1.4; }
.page-meta { font-size: 12px; color: var(--text-light); margin-bottom: 28px; }
.count-badge { display: inline-block; background: var(--terracotta); color: #fff; font-weight: 700; padding: 2px 12px; border-radius: 999px; font-size: 13px; margin-left: 8px; }
section { margin-bottom: 40px; scroll-margin-top: 80px; }
section h2 { font-size: 18px; font-weight: 700; color: var(--terracotta-dark); border-bottom: 2px solid var(--cream-deep); padding-bottom: 8px; margin-bottom: 16px; }
h3, h4, h5 { font-size: 14px; font-weight: 700; color: var(--text-dark); margin: 18px 0 8px; }
h4 { font-size: 13px; color: var(--terracotta-dark); }
h5 { font-size: 13px; color: var(--text-mid); font-weight: 600; }
.card { background: var(--cream-card); border-radius: 12px; padding: 22px 24px; box-shadow: var(--shadow); border: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
ul.styled-list { list-style: none; padding: 0; margin-bottom: 10px; }
ul.styled-list li { padding: 4px 0 4px 18px; position: relative; color: var(--text-dark); font-size: 14px; line-height: 1.7; }
ul.styled-list li::before { content: "\2022"; color: var(--terracotta); position: absolute; left: 0; font-weight: 700; }
ul.styled-list li.nested { margin-left: 18px; }
ul.styled-list li.nested::before { content: "\2013"; color: var(--terracotta-light); }
ul.action-list { list-style: none; padding: 0; margin-bottom: 10px; }
ul.action-list li { padding: 6px 0; display: flex; gap: 8px; align-items: baseline; font-size: 14px; border-bottom: 1px dashed var(--border); }
ul.action-list li:last-child { border-bottom: none; }
ul.action-list input[type="checkbox"] { accent-color: var(--terracotta); margin-top: 3px; flex-shrink: 0; }
.hook-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.hook-table th { background: var(--cream-deep); color: var(--text-mid); font-weight: 600; padding: 10px 14px; text-align: left; border-bottom: 2px solid var(--border); }
.hook-table td { padding: 9px 14px; border-bottom: 1px solid var(--border); color: var(--text-dark); vertical-align: top; }
.hook-table tr:last-child td { border-bottom: none; }
.hook-table tbody tr:hover td { background: var(--cream-deep); }
.hook-table td.num { color: var(--text-light); text-align: right; width: 52px; white-space: nowrap; }
.monthly-table tbody tr { cursor: pointer; }
.meta-table th { width: 90px; white-space: nowrap; background: transparent; border-bottom: 1px solid var(--border); color: var(--text-light); }
.meta-table tr:last-child th { border-bottom: none; }
.quote-block { border-left: 4px solid var(--terracotta-light); padding: 12px 18px; background: var(--cream-deep); border-radius: 0 8px 8px 0; color: var(--text-mid); margin: 12px 0; font-size: 13px; line-height: 1.8; }
p { margin-bottom: 10px; font-size: 14px; color: var(--text-dark); }
p.muted, .muted { color: var(--text-light); font-size: 13px; }
a { color: var(--terracotta-dark); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
code { background: var(--cream-deep); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; font-size: 0.88em; font-family: "SFMono-Regular", Menlo, Consolas, monospace; color: var(--terracotta-dark); }

/* badges */
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 999px; margin-right: 4px; white-space: nowrap; }
.badge-kanbu { background: #C9663F; color: #fff; }
.badge-chukan { background: #8B6F47; color: #fff; }
.badge-eigyo { background: #4E7A5A; color: #fff; }
.badge-funnel { background: #5B6C9E; color: #fff; }
.badge-kobetsu { background: #A8763E; color: #fff; }
.badge-loom { background: #5C6BC0; color: #fff; }
.badge-person { background: var(--cream-deep); color: var(--text-mid); border: 1px solid var(--border); }
.badge-shared { background: var(--cream-deep); color: var(--text-light); border: 1px dashed var(--border); }
.badge-inbox { background: var(--text-light); color: #fff; }
.badge-warn { background: #FDF0E5; color: #B4552D; border: 1px solid #EAC9A8; }

/* index list */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; }
#searchBox { flex: 1; max-width: 380px; padding: 9px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--cream-card); font-size: 13px; color: var(--text-dark); outline: none; }
#searchBox:focus { border-color: var(--terracotta-light); }
.clear-filter { border: 1px solid var(--border); background: var(--cream-card); color: var(--text-mid); font-size: 12px; padding: 8px 14px; border-radius: 8px; cursor: pointer; }
.clear-filter:hover { background: var(--cream-deep); }
.mt-row { display: block; background: var(--cream-card); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; margin-bottom: 12px; box-shadow: var(--shadow); transition: box-shadow 0.15s, transform 0.15s; color: var(--text-dark); font-weight: 400; }
.mt-row:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); text-decoration: none; }
.mt-row-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.mt-date { font-size: 12px; font-weight: 700; color: var(--text-light); font-variant-numeric: tabular-nums; }
.mt-title { font-size: 16px; font-weight: 700; color: var(--terracotta-dark); margin-bottom: 4px; }
.mt-snippet { font-size: 13px; color: var(--text-mid); margin-bottom: 6px; }
.mt-meta { font-size: 11px; color: var(--text-light); }
.mt-cell-title { font-weight: 600; color: var(--terracotta-dark); }
.empty-note { text-align: center; color: var(--text-light); padding: 40px 0; }

/* detail */
.breadcrumb { margin-bottom: 16px; font-size: 13px; }
.detail-actions { display: flex; align-items: center; gap: 14px; margin: 4px 0 28px; flex-wrap: wrap; }
.dl-menu { position: relative; display: inline-block; }
.dl-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--terracotta); color: #fff; font-size: 13px; font-weight: 700; padding: 9px 20px; border-radius: 8px; box-shadow: var(--shadow); border: none; cursor: pointer; font-family: inherit; line-height: 1.3; }
.dl-btn:hover, .dl-menu.is-open .dl-btn { background: var(--terracotta-dark); text-decoration: none; }
.dl-caret { font-size: 10px; opacity: 0.9; line-height: 1; }
.dl-menu-pop {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 40;
  min-width: 200px; padding: 6px; background: var(--cream-card); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-hover);
}
/* ホバーの隙間で閉じないよう透明ブリッジ */
.dl-menu-pop::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
.dl-menu:hover .dl-menu-pop, .dl-menu.is-open .dl-menu-pop { display: block; }
.dl-menu-item {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  color: var(--text-dark); font-size: 13px; font-weight: 700; font-family: inherit;
  padding: 10px 12px; border-radius: 8px; cursor: pointer; line-height: 1.3;
}
.dl-menu-item:hover { background: var(--cream-deep); color: var(--terracotta-dark); text-decoration: none; }
.dl-btn-deploy { background: var(--cream-card); color: var(--terracotta-dark); border: 1px solid var(--terracotta); box-shadow: none; }
.dl-btn-deploy:hover { background: var(--cream-deep); }
.dl-btn-deploy:disabled { opacity: 0.55; cursor: wait; }
.dl-note { font-size: 12px; color: var(--text-light); }
.transcript-note { margin-top: 8px; }

/* toast / Netlifyトークンモーダル（SL Code と同型・配色は minutes） */
.mn-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--terracotta-dark); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 600; z-index: 400; box-shadow: var(--shadow-hover);
  max-width: min(92vw, 520px); text-align: center; line-height: 1.45;
}
.mn-toast[hidden] { display: none; }
.mn-modal {
  position: fixed; inset: 0; background: rgba(59, 42, 31, 0.45); z-index: 410;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.mn-modal[hidden] { display: none; }
.mn-modal-box {
  background: var(--cream-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; max-width: 400px; width: 100%; display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow-hover);
}
.mn-modal-title { margin: 0; font-size: 14px; font-weight: 800; color: var(--terracotta-dark); }
.mn-modal-sub { margin: 0; font-size: 12px; color: var(--text-mid); line-height: 1.7; }
#netlifyTokenInput {
  width: 100%; min-height: 40px; padding: 8px 10px; font-size: 13px;
  font-family: Menlo, Consolas, monospace; border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-dark); background: #fff; box-sizing: border-box;
}
.mn-modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.mn-modal-btn {
  border: 1px solid var(--border); background: var(--cream-deep); color: var(--text-mid);
  font-size: 13px; font-weight: 700; font-family: inherit; padding: 8px 14px;
  border-radius: 8px; cursor: pointer;
}
.mn-modal-btn-ok { background: var(--terracotta); border-color: var(--terracotta); color: #fff; }
.mn-modal-btn-ok:hover { background: var(--terracotta-dark); }

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* account + bell（帯の右側にマウント・Swipee 同型） */
.mn-account { display: flex; align-items: center; gap: 6px; }
.mn-bell-wrap, .mn-user-wrap { position: relative; }
.mn-bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 33px; height: 33px; border: 1px solid var(--border); border-radius: 10px; background: var(--cream-card); color: var(--text-mid); cursor: pointer; transition: border-color .15s, color .15s, background .15s; box-shadow: var(--shadow); }
.mn-bell:hover { border-color: var(--terracotta); color: var(--terracotta-dark); background: var(--cream-deep); }
.mn-bell-badge { position: absolute; top: -4px; right: -4px; min-width: 14px; height: 14px; padding: 0 3px; border-radius: 999px; background: #C0392B; color: #fff; font-size: 9px; font-weight: 800; line-height: 14px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.mn-bell-badge[hidden] { display: none; }
.mn-user { display: inline-flex; align-items: center; gap: 8px; height: 33px; padding: 0 9px 0 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--cream-card); cursor: pointer; max-width: 260px; font-family: inherit; transition: border-color .15s, background .15s; box-shadow: var(--shadow); }
.mn-user:hover { border-color: var(--terracotta); background: var(--cream-deep); }
.mn-avatar { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 23px; height: 23px; border-radius: 50%; background: var(--text-light); color: #fff; font-size: 11px; font-weight: 800; line-height: 1; overflow: hidden; }
.mn-avatar.is-admin { background: var(--terracotta); }
.mn-avatar.has-photo { background: none; }
.mn-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mn-user-name { font-size: 12px; font-weight: 700; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.mn-user-caret { color: var(--text-light); flex: 0 0 auto; }
.mn-bell-pop, .mn-user-pop { position: absolute; top: calc(100% + 8px); right: 0; min-width: 220px; background: var(--cream-card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-hover); padding: 12px 14px; }
.mn-bell-pop { min-width: 320px; max-width: min(92vw, 380px); padding: 0; overflow: hidden; }
.mn-bell-pop[hidden], .mn-user-pop[hidden] { display: none; }
.mn-pop-email { font-size: 12px; font-weight: 700; color: var(--text-dark); word-break: break-all; }
.mn-pop-role { font-size: 11.5px; color: var(--text-mid); margin: 4px 0 10px; }
.mn-logout { display: inline-block; font-size: 12px; font-weight: 700; color: var(--terracotta-dark); }
.mn-notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 10px; border-bottom: 1px solid var(--border); }
.mn-notif-head-title { font-size: 11.5px; font-weight: 800; color: var(--text-mid); letter-spacing: .04em; }
.mn-notif-read-all { border: 0; background: none; padding: 0; font-family: inherit; font-size: 11px; font-weight: 700; color: var(--terracotta-dark); cursor: pointer; }
.mn-notif-read-all:hover { text-decoration: underline; }
.mn-notif-read-all[hidden] { display: none; }
.mn-notif-list { max-height: min(60vh, 420px); overflow: auto; padding: 8px 10px 10px; }
.mn-notif-empty { font-size: 12.5px; color: var(--text-light); padding: 16px 6px; text-align: center; }
.mn-notif-item { display: flex; gap: 10px; padding: 10px 8px; border-radius: 10px; text-decoration: none; color: inherit; transition: background .12s; font-weight: 400; }
.mn-notif-item:hover { background: var(--cream-deep); text-decoration: none; }
.mn-notif-dot { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: transparent; margin-top: 6px; }
.mn-notif-item.is-unread .mn-notif-dot { background: var(--terracotta); }
.mn-notif-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mn-notif-kind { display: inline-block; align-self: flex-start; font-size: 10px; font-weight: 800; letter-spacing: .02em; padding: 1px 7px; border-radius: 999px; }
.mn-notif-kind.is-new { color: #2F6B34; background: rgba(79, 138, 82, 0.14); }
.mn-notif-title { font-size: 12.5px; font-weight: 700; color: var(--text-dark); line-height: 1.45; }
.mn-notif-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--text-light); }

@media (max-width: 900px) {
  /* ヘッダーはロゴ＋ハンバーガーのみに。ナビ・通知・アカウントは全部サイドバー（オフキャンバスパネル）へ集約 */
  .mn-topnav { display: none; }
  .mn-burger { display: inline-flex; }
  .mn-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(59, 42, 31, 0.4);
    z-index: 340; opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .mn-backdrop.is-open { opacity: 1; pointer-events: auto; }
  .sidebar {
    position: fixed; top: 0; left: 0; width: 82vw; max-width: 320px; height: 100vh;
    border-right: 1px solid var(--border); overflow-y: auto; padding: 0 0 16px;
    transform: translateX(-100%); transition: transform .25s ease; z-index: 350;
  }
  .sidebar.is-open { transform: translateX(0); }
  .mn-sidebar-head {
    display: flex; align-items: center;
    position: static; height: auto; width: 100%; justify-content: space-between;
    padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--border); margin-bottom: 8px;
  }
  .mn-sidebar-close {
    display: inline-flex; align-items: center; justify-content: center; width: 33px; height: 33px;
    border: 1px solid var(--border); border-radius: 10px; background: var(--cream-card); color: var(--text-mid); cursor: pointer;
  }
  .mn-sidebar-close:hover { border-color: var(--terracotta); color: var(--terracotta-dark); }
  .mn-sidebar-topnav {
    display: flex; flex-direction: column; gap: 2px;
    padding: 0 8px 10px; margin: 0 8px 8px; border-bottom: 1px solid var(--border);
  }
  .mn-sidebar-topnav .mn-navlink { width: 100%; justify-content: flex-start; padding: 11px 12px; border-radius: 9px; border-left: none; }
  .mn-sidebar-topnav .mn-navlink.active { border-left: none; background: var(--terracotta); color: #fff; }
  .mn-sidebar-topnav .mn-navlink.active .mn-nav-ico { color: #fff; }
  /* ベル/ユーザーのポップアップはサイドバーパネル左寄りに移動したため、right基準だと画面外にはみ出す。left基準に切替 */
  .mn-bell-pop, .mn-user-pop { left: 0; right: auto; }
  .mn-bell-pop { max-width: min(84vw, 320px); }
}

@media (max-width: 768px) {
  body { padding-top: 56px; }
  .main { margin-left: 0; padding: 24px 20px; }
  .page-header h1 { font-size: 20px; }
  section h2 { font-size: 16px; }
  .card { padding: 16px 18px; }
  .hook-table { font-size: 12px; }
  .hook-table th, .hook-table td { padding: 7px 10px; }
}
@media (max-width: 600px) {
  .mn-topband { height: 50px; padding: 0 12px; }
  body { padding-top: 50px; }
  .mn-account { gap: 5px; }
  .mn-user { max-width: 150px; padding: 0 8px 0 5px; }
  .mn-user-name { max-width: 88px; font-size: 11px; }
  .mn-brand-logo { height: 37px; max-width: min(60vw, 240px); }
}
@media (max-width: 480px) {
  .main { padding: 16px 14px; }
  .page-header h1 { font-size: 18px; }
}

/* PDF保存用（印刷ダイアログ → 「PDFに保存」）。ナビ・DLボタン等は出さない。モバイル上書きより後ろに置く */
@media print {
  .mn-topband, .sidebar, .mn-backdrop, .mn-burger, .mn-topband-right,
  .detail-actions, .breadcrumb, .transcript-note, .mn-toast, .mn-modal { display: none !important; }
  body { background: #fff !important; padding-top: 0 !important; }
  .main { margin: 0 !important; padding: 12mm !important; max-width: none !important; }
  .card { box-shadow: none !important; break-inside: avoid; }
  .page-header h1 { color: #000 !important; }
  a { color: inherit !important; text-decoration: none !important; }
}
