/* JMSS アプリポータル 共通スタイル（配色は scripts/jmss_palette.py 準拠: gold #998059 / navy #2D4056）
   テーマ: ライト既定。ダークは [data-theme=dark]（手動）と prefers-color-scheme（システム追従）の両対応。 */

:root {
  --gold: #998059;
  --navy: #2D4056;
  --gray: #6b6b6b;          /* 旧 #808080 は白背景でコントラスト比不足（WCAG AA）のため濃く */
  --dark: #333333;
  --bg: #f7f5f2;
  --card: #ffffff;
  --line: #e3ded6;
  --line-soft: #f0ece5;
  --surface: #faf9f6;
  --gold-tint: #f5efe6;
  --danger: #CC0000;
  --ok: #3d8b60;
  --warn: #c77b28;
  --shadow: 0 1px 3px rgba(45, 64, 86, .08);
  --shadow-hover: 0 6px 16px rgba(45, 64, 86, .18);
  --header-bg: var(--navy);
  --header-fg: #ffffff;
}

[data-theme="dark"] {
  --gold: #b49772;
  --navy: #9db4cc;
  --gray: #a3a9b0;
  --dark: #d8d5cf;
  --bg: #1c2129;
  --card: #262d37;
  --line: #3a4350;
  --line-soft: #303947;
  --surface: #2b333e;
  --gold-tint: #34394a;
  --danger: #ff8a80;
  --ok: #7ac79a;
  --warn: #e0a55f;
  --shadow: 0 1px 3px rgba(0, 0, 0, .35);
  --shadow-hover: 0 6px 16px rgba(0, 0, 0, .5);
  --header-bg: #161b22;
  --header-fg: #e6e3dd;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --gold: #b49772;
    --navy: #9db4cc;
    --gray: #a3a9b0;
    --dark: #d8d5cf;
    --bg: #1c2129;
    --card: #262d37;
    --line: #3a4350;
    --line-soft: #303947;
    --surface: #2b333e;
    --gold-tint: #34394a;
    --danger: #ff8a80;
    --ok: #7ac79a;
    --warn: #e0a55f;
    --shadow: 0 1px 3px rgba(0, 0, 0, .35);
    --shadow-hover: 0 6px 16px rgba(0, 0, 0, .5);
    --header-bg: #161b22;
    --header-fg: #e6e3dd;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }  /* display指定を持つ要素（.app-card等）でも hidden 属性を必ず効かせる */
html { color-scheme: light dark; }
body {
  font-family: "Meiryo", "Hiragino Kaku Gothic ProN", sans-serif;
  background: var(--bg);
  color: var(--dark);
}
main { max-width: 1080px; margin: 0 auto; padding: 32px 20px; }
footer { text-align: center; color: var(--gray); font-size: 11px; padding: 24px; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--navy); color: #fff; padding: 8px 16px; border-radius: 0 0 8px 0;
  font-size: 12px; text-decoration: none;
}
.skip-link:focus { left: 0; }

/* ── ヘッダー ─────────────────────────────── */
.site-header {
  background: var(--header-bg); color: var(--header-fg);
  padding: 12px 28px; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.site-header .brand { font-size: 16px; font-weight: bold; letter-spacing: .05em; }
.site-header .brand span { color: #c8ab7d; }
.site-header .brand .season { font-weight: normal; margin-left: 6px; }
.header-actions { display: flex; align-items: center; gap: 10px; font-size: 12px; color: #cfd6de; flex-wrap: wrap; }
.header-actions .hlink { color: #98C1D9; text-decoration: none; position: relative; }
.header-actions .hlink:hover { text-decoration: underline; }
.hbtn {
  background: rgba(255, 255, 255, .12); color: var(--header-fg);
  border: 1px solid rgba(255, 255, 255, .25); border-radius: 6px;
  min-width: 30px; height: 26px; padding: 0 7px; font-size: 13px; cursor: pointer;
  font-family: inherit;
}
.hbtn:hover { background: rgba(255, 255, 255, .22); }
.staff-badge, .fb-status-badge {
  display: inline-block; background: var(--danger); color: #fff; border-radius: 9px;
  font-size: 10px; padding: 0 5px; margin-left: 4px; vertical-align: 1px; line-height: 15px;
}
.fb-status-badge { background: var(--gold); }
@media (max-width: 640px) { .header-actions .user-mail { display: none; } }

/* ── MVVセクション（経営理念・行動指針の常設バンド。文言は _mvv.html） ── */
.mvv {
  background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--gold);
  border-radius: 10px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.mvv-band { display: flex; align-items: center; gap: 14px; padding: 8px 16px; flex-wrap: wrap; }
.mvv-label {
  flex: 0 0 auto; font-size: 9px; font-weight: bold; letter-spacing: .12em;
  color: #fff; background: var(--gold); border-radius: 4px; padding: 3px 7px;
}
[data-theme="dark"] .mvv-label { color: #1c2129; }
.mvv-phi { flex: 1 1 260px; min-width: 220px; font-size: 12.5px; color: var(--dark); line-height: 1.55; font-weight: bold; }
.mvv-phi small {
  display: block; font-size: 9px; color: var(--gray); font-weight: normal; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;  /* 今日の指針の定義を1行で */
}
.mvv-gp { display: flex; gap: 2px; align-items: flex-end; }
.mvv-gp-item {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 7px; border-radius: 8px; cursor: default; min-width: 56px;
}
.mvv-gp-item:hover, .mvv-gp-item:focus-within { background: var(--gold-tint); }
.mvv-gi { line-height: 1; display: block; }
.mvv-gi svg {
  width: 22px; height: 22px; display: block;
  stroke: var(--gold); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
/* 今日の指針（portal.js が日付から1つに .today を付与） */
.mvv-gp-item.today { background: var(--gold-tint); box-shadow: inset 0 0 0 1.5px var(--gold); }
.mvv-gp-item.today::before {
  content: "今日"; position: absolute; top: -7px; right: -3px; z-index: 2;
  background: var(--gold); color: #fff; font-size: 8px; font-weight: bold;
  padding: 1px 6px; border-radius: 7px; letter-spacing: .05em;
}
[data-theme="dark"] .mvv-gp-item.today::before { color: #1c2129; }
.mvv-gp-nm { font-size: 10px; color: var(--dark); white-space: nowrap; }
.mvv-gp-en { font-size: 8px; color: var(--gray); white-space: nowrap; letter-spacing: .02em; }
.mvv-gp-dig { border: 1px dashed var(--gold); background: var(--gold-tint); }
.mvv-gp-dig .mvv-gp-nm { font-weight: bold; }
.mvv-gp-sep { width: 1px; align-self: stretch; background: var(--line); margin: 4px 6px; }
.mvv-tip {
  display: none; position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  width: min(250px, 72vw); background: #223448; color: #fff; font-size: 11px; line-height: 1.7;
  padding: 9px 12px; border-radius: 8px; z-index: 40; box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
  font-weight: normal;
}
.mvv-tip b { color: #c8ab7d; display: block; margin-bottom: 3px; }
.mvv-gp-item:hover .mvv-tip, .mvv-gp-item:focus-within .mvv-tip { display: block; }
.mvv-gp .mvv-gp-item:first-child .mvv-tip { left: 0; transform: none; }
.mvv-gp .mvv-gp-item:last-child .mvv-tip { left: auto; right: 0; transform: none; }
.mvv-more {
  flex: 0 0 auto; font-size: 11px; color: var(--gray); background: none;
  border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px; cursor: pointer; font-family: inherit;
}
.mvv-more:hover { color: var(--navy); border-color: var(--gold); }
.mvv-detail { display: none; border-top: 1px solid var(--line-soft); padding: 14px 18px 16px; }
.mvv.open .mvv-detail { display: block; }
.mvv-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.mvv-col h4 { font-size: 11px; letter-spacing: .1em; color: var(--gold); margin-bottom: 7px; }
.mvv-vitem { font-size: 12px; color: var(--dark); line-height: 1.6; margin-bottom: 5px; display: flex; gap: 6px; }
.mvv-vitem .n { color: var(--gold); font-weight: bold; flex: 0 0 auto; }
.mvv-formula { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.mvv-chip { background: var(--gold-tint); border: 1px solid var(--line); border-radius: 12px; padding: 3px 10px; color: var(--dark); font-weight: bold; }
.mvv-formula .op { color: var(--gray); }
.mvv-formula .res { background: var(--navy); color: #fff; border-radius: 12px; padding: 3px 12px; font-weight: bold; }
[data-theme="dark"] .mvv-formula .res { color: #1c2129; }
.mvv-conf { font-size: 10px; color: var(--gray); margin-top: 4px; line-height: 1.7; }
[data-density="compact"] .mvv-phi small { display: none; }
[data-density="compact"] .mvv-band { padding: 6px 14px; }
@media (max-width: 700px) { .mvv-gp { flex-wrap: wrap; } }

/* ── 通知バナー・ヒーロー ─────────────────── */
.denied-banner {
  background: #fdf0ef; border: 1px solid #EF6F6C; color: #CC0000;
  border-radius: 8px; padding: 12px 16px; margin-bottom: 20px; font-size: 13px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
[data-theme="dark"] .denied-banner { background: #3a2626; }
.denied-banner .request-link { margin-left: auto; }

.hero { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.hero .greeting { font-size: 18px; color: var(--navy); font-weight: bold; }
.hero .greeting small { display: block; font-size: 11px; color: var(--gray); font-weight: normal; margin-top: 3px; }
.search-wrap { margin-left: auto; position: relative; flex: 0 1 340px; min-width: 220px; }
.search-wrap input {
  width: 100%; padding: 9px 34px 9px 34px; border: 1px solid var(--line); border-radius: 20px;
  font-family: inherit; font-size: 13px; background: var(--card); color: var(--dark);
}
.search-wrap input:focus { border-color: var(--gold); }
.search-wrap .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gray); font-size: 13px; pointer-events: none; }
.search-wrap .search-key {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--gray); border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 5px; background: var(--surface); pointer-events: none;
}
.search-empty { color: var(--gray); font-size: 13px; padding: 18px 4px; }

/* ── マイ・アシスト×お知らせの横並び行（top.html .top-duo） ── */
.top-duo {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 14px; margin-bottom: 18px; align-items: start;
}
.top-duo:not(:has(.my-assist, .news-box)) { display: none; }  /* 両方空なら行ごと消す */
.top-duo .my-assist, .top-duo .news-box { margin-bottom: 0; }

/* ── お知らせ（更新履歴ティッカー・実現した要望） ── */
.news-box {
  background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--gold);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 22px; font-size: 12px;
}
.news-box .news-row { display: flex; gap: 8px; padding: 2px 0; color: var(--gray); line-height: 1.6; min-width: 0; }
.news-box .news-date { flex: 0 0 auto; color: var(--gray); }
.news-box .news-app { flex: 0 0 auto; color: var(--navy); font-weight: bold; max-width: 11em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.news-box .news-head { font-weight: bold; color: var(--navy); margin-bottom: 3px; font-size: 12px; }
.news-box + .news-box { margin-top: -12px; }
.news-box .news-title { color: var(--dark); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── セクション共通 ───────────────────────── */
.page-title {
  font-size: 18px; color: var(--navy); border-bottom: 3px solid var(--gold);
  padding-bottom: 10px; margin-bottom: 24px;
}
.apps-section { margin-bottom: 30px; }
.apps-section > .sec-head, details.cat > summary .sec-head {
  font-size: 14px; font-weight: bold; color: var(--gold); letter-spacing: .03em;
  padding-left: 10px; border-left: 4px solid var(--gold);
}
.sec-count { font-size: 11px; color: var(--gray); font-weight: normal; margin-left: 6px; }
.apps-section > .sec-head { margin-bottom: 14px; }

details.cat { scroll-margin-top: 56px; }  /* sticky カテゴリナビの下に潜らないように */
details.cat > summary {
  list-style: none; cursor: pointer; user-select: none; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
details.cat > summary::-webkit-details-marker { display: none; }
details.cat > summary .cat-caret { font-size: 10px; color: var(--gold); transition: transform .15s; }
details.cat[open] > summary .cat-caret { transform: rotate(90deg); }

/* ── カードグリッド ───────────────────────── */
.app-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px;
}
.app-grid--row { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
@media (max-width: 480px) { .app-grid { grid-template-columns: 1fr; } }

.app-card {
  position: relative; display: block; background: var(--card);
  border: 1px solid var(--line); border-left: 5px solid var(--gold); border-radius: 10px;
  padding: 18px 20px; box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .2s, border-color .2s;
  overflow: hidden;
  animation: card-in .35s ease-out both;
  animation-delay: calc(var(--i, 0) * 30ms);
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.app-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); border-left-color: var(--navy); }
.app-card:hover .icon-tile { transform: scale(1.12); }
.app-card.continue-card { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-tint), var(--shadow); }
.app-card.drag-over { outline: 2px dashed var(--gold); outline-offset: 2px; }
.app-card.dragging { opacity: .5; }

.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; padding-right: 30px; }
.icon-tile {
  flex: 0 0 auto; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; border-radius: 9px; transition: transform .2s;
  background: linear-gradient(135deg, var(--gold-tint), var(--surface));
  border: 1px solid var(--line-soft);
}
[data-cat="common"] .icon-tile { background: linear-gradient(135deg, #f0e7d8, #faf6ee); }
[data-cat="consulting"] .icon-tile { background: linear-gradient(135deg, #dfe6ee, #f2f6fa); }
[data-cat="leader"] .icon-tile { background: linear-gradient(135deg, #e8e2d4, #f7f3ea); }
[data-cat="management"] .icon-tile { background: linear-gradient(135deg, #e2e8e3, #f2f7f3); }
[data-theme="dark"] .icon-tile,
[data-theme="dark"] [data-cat] .icon-tile { background: linear-gradient(135deg, #333a49, #2b3240); border-color: #3a4350; }

.card-name { font-size: 15px; font-weight: bold; color: var(--navy); line-height: 1.4; }
.card-title-link { color: inherit; text-decoration: none; }
.card-title-link::after { content: ""; position: absolute; inset: 0; }  /* カード全面をクリック領域に */
.card-desc {
  font-size: 12px; color: var(--gray); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-note {
  font-size: 11px; color: #8a6d3b; line-height: 1.6; margin-top: 8px;
  background: var(--gold-tint); border: 1px solid var(--line-soft); border-radius: 6px; padding: 5px 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
[data-theme="dark"] .card-note { color: #cbb387; }

.card-badge {
  position: absolute; top: 10px; right: 34px; font-size: 9px; font-weight: bold; letter-spacing: .05em;
  border-radius: 8px; padding: 2px 7px; z-index: 2;
}
.badge-new { background: var(--gold); color: #fff; }
.badge-updated { background: var(--navy); color: #fff; }
[data-theme="dark"] .badge-new { color: #1c2129; }
[data-theme="dark"] .badge-updated { color: #1c2129; }

.status-dot {
  position: absolute; left: 10px; top: 10px; width: 8px; height: 8px; border-radius: 50%; z-index: 2;
}
.status-dot[data-status="ok"] { background: var(--ok); }
.status-dot[data-status="down"] { background: var(--warn); width: auto; height: auto; border-radius: 8px;
  font-size: 9px; color: #fff; padding: 1px 6px; font-weight: bold;
  top: auto; bottom: 8px; }  /* ピル型はタイトル・アイコンと重ならない左下へ */

.fav-btn {
  position: absolute; top: 6px; right: 6px; z-index: 3;
  background: none; border: none; cursor: pointer; font-size: 15px; line-height: 1;
  color: var(--line); padding: 4px; border-radius: 6px; font-family: inherit;
  transition: transform .15s, color .15s;
}
.fav-btn:hover { transform: scale(1.25); color: var(--gold); }
.fav-btn[aria-pressed="true"] { color: var(--gold); }

.info-btn {
  position: absolute; bottom: 6px; right: 6px; z-index: 3;
  background: none; border: none; cursor: pointer; font-size: 12px; color: var(--gray);
  padding: 4px 6px; border-radius: 6px; font-family: inherit; opacity: 0;
  transition: opacity .15s;
}
.app-card:hover .info-btn, .app-card:focus-within .info-btn { opacity: 1; }
.info-btn:hover { color: var(--navy); background: var(--surface); }

/* クリックリップル */
.ripple {
  position: absolute; border-radius: 50%; transform: scale(0); z-index: 1;
  background: rgba(153, 128, 89, .25); animation: ripple .5s ease-out forwards; pointer-events: none;
}
@keyframes ripple { to { transform: scale(3); opacity: 0; } }

/* コンパクト表示（表示密度） */
[data-density="compact"] .app-card { padding: 10px 14px; }
[data-density="compact"] .card-desc, [data-density="compact"] .card-note { display: none; }
[data-density="compact"] .card-head { margin-bottom: 0; }
[data-density="compact"] .icon-tile { width: 28px; height: 28px; font-size: 15px; }
[data-density="compact"] .card-name { font-size: 13px; }
[data-density="compact"] .app-grid { gap: 10px; }
[data-density="compact"] main { padding-top: 20px; }

/* ── カテゴリナビ（sticky） ────────────────── */
.catnav {
  position: sticky; top: 0; z-index: 20; background: var(--bg);
  display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 0 10px; margin-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.catnav a {
  font-size: 12px; color: var(--gray); text-decoration: none; padding: 5px 12px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--card);
}
.catnav a:hover { color: var(--navy); border-color: var(--gold); }

/* ── 利用統計ミニウィジェット ─────────────── */
.stats-widget {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 18px; margin-bottom: 22px; font-size: 12px;
}
.stats-widget .stats-head { font-weight: bold; color: var(--navy); margin-bottom: 8px; }
.stats-row { display: flex; align-items: center; gap: 10px; padding: 3px 0; }
.stats-row .stats-rank { flex: 0 0 auto; font-size: 13px; }
.stats-row .stats-name { flex: 0 0 180px; color: var(--dark); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-row .stats-bar-wrap { flex: 1; background: var(--line-soft); border-radius: 6px; height: 12px; overflow: hidden; }
/* .stats-bar は span のため display:block 必須（インラインのままだと width が無視され描画されない） */
.stats-row .stats-bar {
  display: block; height: 100%; border-radius: 6px;
  background-color: var(--gold);
  background-image: linear-gradient(90deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .32));
  transform-origin: left;
  animation: stats-grow .7s cubic-bezier(.22, .9, .35, 1.15) backwards;
}
.stats-row.rank-2 .stats-bar { background-color: var(--navy); animation-delay: .15s; }
.stats-row.rank-3 .stats-bar { background-color: var(--warn); animation-delay: .3s; }
.stats-row:hover .stats-bar { filter: brightness(1.1); }
.stats-row .stats-count { flex: 0 0 3.5em; text-align: right; color: var(--dark); font-size: 11px; font-family: Arial, "Meiryo", sans-serif; font-weight: bold; }
@keyframes stats-grow { from { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .stats-row .stats-bar { animation: none; } }
.stats-widget .stats-staff { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-soft); color: var(--gray); }
/* 沈黙型の機能（アクセスログ）が止まったことを気づける導線。平時は出ない */
.stats-staff .stats-warn { display: block; margin-top: 4px; color: var(--danger); }
.stats-staff .stats-warn a { color: inherit; }
.stats-active-toggle {
  background: none; border: none; padding: 0; font: inherit; color: inherit;
  cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px;
}
.stats-active-toggle:hover:not([disabled]) { color: var(--navy); }
.stats-active-toggle[disabled] { cursor: default; text-decoration: none; }
.stats-active-toggle .au-caret { display: inline-block; margin-left: 3px; transition: transform .15s; }
.stats-active-toggle.open .au-caret { transform: rotate(180deg); }
.stats-active-detail {
  margin-top: 6px; padding: 8px 12px; background: var(--surface);
  border: 1px solid var(--line-soft); border-radius: 8px;
}
.au-row { display: flex; gap: 10px; padding: 3px 0; align-items: baseline; flex-wrap: wrap; }
.au-name { flex: 0 0 130px; font-weight: bold; color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-apps { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.au-app { background: var(--gold-tint); border: 1px solid var(--line-soft); border-radius: 10px; padding: 2px 8px; color: var(--dark); white-space: nowrap; }
.au-time { color: var(--gray); margin-left: 5px; font-family: Arial, sans-serif; font-size: 10px; }
@media (max-width: 480px) { .stats-row .stats-name { flex-basis: 110px; } }

/* ── フッターユーティリティ（利用申請・非表示アプリ） ── */
.portal-util { margin: 26px 0; font-size: 12px; color: var(--gray); display: flex; flex-direction: column; gap: 8px; }
.portal-util .request-link { align-self: flex-start; }
.request-link {
  font-size: 12px; color: var(--navy); background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 5px 14px; cursor: pointer; font-family: inherit; text-decoration: none;
}
.request-link:hover { border-color: var(--gold); color: var(--gold); }
.hidden-apps summary { cursor: pointer; color: var(--gray); font-size: 12px; user-select: none; }
.hidden-apps ul { list-style: none; margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.hidden-apps li { display: flex; align-items: center; gap: 10px; }
.restore-btn {
  font-size: 11px; color: var(--navy); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 2px 10px; cursor: pointer; font-family: inherit;
}
.restore-btn:hover { border-color: var(--gold); }

/* ── ダイアログ共通 ───────────────────────── */
dialog {
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--dark);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25); padding: 0; max-width: min(560px, 92vw);
  margin: auto;
}
dialog::backdrop { background: rgba(20, 26, 34, .45); }
.dialog-body { padding: 22px 24px; font-size: 13px; line-height: 1.7; }
.dialog-body h3 { font-size: 15px; color: var(--navy); margin-bottom: 10px; }
.dialog-close {
  position: absolute; top: 10px; right: 12px; background: none; border: none; cursor: pointer;
  font-size: 16px; color: var(--gray); font-family: inherit; padding: 4px;
}
.dialog-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; align-items: center; }
.btn-primary {
  background: var(--gold); color: #fff; border: none; border-radius: 6px; padding: 8px 20px;
  font-size: 13px; font-weight: bold; cursor: pointer; font-family: inherit; text-decoration: none; display: inline-block;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-quiet {
  background: none; border: 1px solid var(--line); color: var(--gray); border-radius: 6px;
  padding: 7px 14px; font-size: 12px; cursor: pointer; font-family: inherit; text-decoration: none; display: inline-block;
}
.btn-quiet:hover { border-color: var(--gold); color: var(--navy); }
.detail-desc { color: var(--gray); margin-bottom: 8px; }
.detail-note { font-size: 12px; color: #8a6d3b; background: var(--gold-tint); border-radius: 6px; padding: 6px 10px; margin-bottom: 8px; }
[data-theme="dark"] .detail-note { color: #cbb387; }
.detail-log { margin-top: 12px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.detail-log .log-head { font-size: 12px; font-weight: bold; color: var(--navy); margin-bottom: 6px; }
.detail-log ul { list-style: none; font-size: 12px; color: var(--gray); display: flex; flex-direction: column; gap: 4px; }
.detail-log .log-date { color: var(--gold); margin-right: 8px; }
.audience-box { margin-top: 12px; font-size: 12px; color: var(--gray); border-top: 1px solid var(--line-soft); padding-top: 10px; }

/* 利用申請ダイアログ */
#request-dialog { max-width: min(480px, 92vw); }
.req-lead { font-size: 12px; color: var(--gray); margin-bottom: 10px; }
.req-list {
  display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto;
  margin-bottom: 12px; border: 1px solid var(--line-soft); border-radius: 8px; padding: 6px;
}
.req-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
  cursor: pointer; font-size: 13px; color: var(--dark);
}
.req-item:hover { background: var(--gold-tint); }
.req-item:has(input:checked) { background: var(--gold-tint); outline: 1px solid var(--gold); }
.req-item input { accent-color: var(--gold); }
.req-icon { font-size: 16px; }
.req-name { line-height: 1.4; }
.req-name small { display: block; font-size: 11px; color: var(--gray); }
#req-reason {
  width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 6px;
  font-family: inherit; font-size: 13px; background: var(--card); color: var(--dark); resize: vertical;
}
.req-empty { font-size: 13px; color: var(--gray); margin-bottom: 8px; }

/* ショートカットヘルプ */
.help-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.help-table td { padding: 5px 8px; border-bottom: 1px solid var(--line-soft); color: var(--gray); }
.help-table td:first-child { width: 110px; }
kbd {
  display: inline-block; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px;
  background: var(--surface); padding: 1px 7px; font-size: 11px; font-family: inherit; color: var(--dark);
}

/* コマンドパレット（Ctrl+K） */
.cmdk { width: min(520px, 92vw); }
.cmdk input {
  width: 100%; border: none; border-bottom: 1px solid var(--line); background: transparent;
  padding: 16px 20px; font-size: 15px; font-family: inherit; color: var(--dark); outline: none;
}
.cmdk ul { list-style: none; max-height: 320px; overflow-y: auto; padding: 8px; }
.cmdk li { border-radius: 8px; }
.cmdk li a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; text-decoration: none;
  color: var(--dark); font-size: 13px; border-radius: 8px;
}
.cmdk li.active a, .cmdk li a:hover { background: var(--gold-tint); color: var(--navy); }
.cmdk .cmdk-cat { margin-left: auto; font-size: 10px; color: var(--gray); }
.cmdk .cmdk-empty { padding: 14px; font-size: 12px; color: var(--gray); }

/* ── フィードバックフォーム（_feedback.html） ── */
.fb-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 14px; }
.fb-tab {
  flex: 1; min-width: 130px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--gray); font-family: inherit; font-size: 13px; font-weight: bold;
  cursor: pointer; text-align: center;
}
.fb-tab[aria-selected="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
[data-theme="dark"] .fb-tab[aria-selected="true"] { color: #1c2129; }
.fb-row { display: grid; grid-template-columns: 130px 1fr; gap: 8px; align-items: start; margin-bottom: 9px; }
.fb-row > label { font-size: 12px; color: var(--dark); padding-top: 8px; }
.fb-req { color: var(--danger); font-weight: bold; }
.fb-row input[type=text], .fb-row input[type=datetime-local], .fb-row select, .fb-row textarea {
  width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 6px;
  font-family: inherit; font-size: 13px; background: var(--card); color: var(--dark);
}
.fb-row textarea { resize: vertical; }
.fb-inline { display: flex; gap: 8px; flex-wrap: wrap; }
.fb-inline > * { flex: 1; min-width: 150px; }
.fb-drop {
  border: 2px dashed var(--line); border-radius: 8px; background: var(--surface); padding: 14px;
  text-align: center; font-size: 12px; color: var(--gray); cursor: pointer;
}
.fb-drop.over { border-color: var(--gold); background: var(--gold-tint); }
.fb-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.fb-thumb {
  position: relative; border: 1px solid var(--line); border-radius: 6px; padding: 4px;
  background: var(--card); font-size: 11px; color: var(--gray); max-width: 130px;
}
.fb-thumb img { display: block; max-width: 120px; max-height: 80px; border-radius: 4px; }
.fb-thumb button {
  position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; line-height: 1;
  border: 1px solid var(--line); border-radius: 50%; background: var(--card); color: var(--danger);
  cursor: pointer; font-size: 12px;
}
.fb-hint { font-size: 11px; color: var(--gray); line-height: 1.6; margin-top: 3px; }
.fb-mine { width: 100%; border-collapse: collapse; font-size: 12px; }
.fb-mine th { text-align: left; color: var(--gray); font-weight: normal; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.fb-mine td { padding: 5px 6px; border-bottom: 1px solid var(--line-soft); color: var(--dark); }
.fb-badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; white-space: nowrap; }
.fb-badge[data-status=new] { background: var(--line-soft); color: var(--gray); }
.fb-badge[data-status=in_progress] { background: #EAE4DA; color: #7a6444; font-weight: bold; }
.fb-badge[data-status=done] { background: #e4eaf0; color: #2D4056; }
.fb-badge[data-status=wontfix] { background: var(--line-soft); color: var(--gray); }
[data-theme="dark"] .fb-badge[data-status=in_progress] { background: #4a4032; color: #dcc194; }
[data-theme="dark"] .fb-badge[data-status=done] { background: #2c3b4d; color: #9db4cc; }
@media (max-width: 640px) { .fb-row { grid-template-columns: 1fr; } .fb-row > label { padding-top: 0; } }
.fb-accordion {
  margin: 30px 0; background: var(--card); border: 1px solid var(--line);
  border-left: 5px solid var(--navy); border-radius: 10px;
}
.fb-accordion > summary { list-style: none; cursor: pointer; user-select: none; display: flex; align-items: center; gap: 10px; padding: 18px 24px; }
.fb-accordion > summary::-webkit-details-marker { display: none; }
.fb-accordion > summary h2 { margin: 0; font-size: 14px; font-weight: bold; color: var(--navy); }
.fb-caret { font-size: 11px; color: var(--gold); transition: transform .15s; flex: 0 0 auto; }
.fb-accordion[open] .fb-caret { transform: rotate(90deg); }
.fb-acc-hint { margin-left: auto; font-size: 11px; color: var(--gray); font-weight: normal; white-space: nowrap; }
.fb-acc-hint::after { content: "▸ クリックで開く"; }
.fb-accordion[open] .fb-acc-hint::after { content: "クリックで閉じる"; }
.fb-acc-body { padding: 2px 24px 22px; }
.fb-lead { font-size: 12px; color: var(--gray); margin-bottom: 8px; line-height: 1.7; }
.fb-lead b { color: var(--dark); }
.fb-tips summary { font-size: 12px; color: var(--gold); cursor: pointer; font-weight: bold; }
.fb-tips-body { font-size: 12px; color: var(--gray); line-height: 1.8; padding: 8px 4px 0; }
.fb-submit-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.fb-msg { font-size: 12px; line-height: 1.6; }
.fb-msg.ok { color: var(--navy); }
.fb-msg.err { color: var(--danger); }
.fb-mine-wrap { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.fb-mine-head { font-size: 12px; font-weight: bold; color: var(--navy); margin-bottom: 6px; }

/* 送信成功の紙吹雪（reduced-motion では出さない） */
.confetti-piece {
  position: fixed; top: -12px; width: 8px; height: 12px; z-index: 999; pointer-events: none;
  animation: confetti-fall 1.6s ease-in forwards;
}
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(105vh) rotate(540deg); opacity: .6; }
}

/* 空状態 */
.empty-state { color: var(--gray); font-size: 14px; line-height: 1.9; }

/* ── マイ・アシスト（本人専用ウィジェット。_my_assist.html） ── */
.my-assist {
  background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--gold);
  border-radius: 10px; padding: 10px 14px 12px; margin-bottom: 22px; box-shadow: var(--shadow);
}
.assist-head { font-size: 13px; font-weight: bold; color: var(--navy); margin-bottom: 6px; }
.assist-note { font-size: 10px; color: var(--gray); font-weight: normal; margin-left: 8px; }
/* auto-fit: 全幅なら2カラム・.top-duo で半幅に入ったときは自動で縦積みになる */
.assist-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; }
.assist-col {
  border: 1px solid var(--line-soft); border-radius: 8px; padding: 6px 10px 8px;
  background: var(--surface); min-width: 0;
}
.assist-col-head { font-size: 11.5px; font-weight: bold; color: var(--gray); margin-bottom: 6px; }
.assist-move, .assist-upd {
  display: flex; gap: 7px; align-items: flex-start; padding: 4px 2px;
  font-size: 12px; color: var(--dark); line-height: 1.6;
}
.assist-upd { display: block; }
.assist-dot {
  flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger); margin-top: 7px;
}
.assist-move.seen .assist-dot { background: transparent; }
.assist-move-body { min-width: 0; }
.assist-applink { color: var(--navy); font-weight: bold; text-decoration: underline dotted; text-underline-offset: 3px; }
.assist-applink:hover { color: var(--gold); }
.assist-move-note { color: var(--gray); font-size: 11px; }
.assist-date { color: var(--gray); font-size: 10px; margin-left: 5px; font-family: Arial, sans-serif; }
.assist-app { color: var(--gold); font-weight: bold; }
.assist-upd-title { color: var(--dark); }
[data-density="compact"] .my-assist { padding: 8px 14px 10px; }

/* ── クイックアクション（カードhover時のアプリ内直リンク。_app_card.html） ── */
.qa-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; position: relative; z-index: 3; }
.qa-chip {
  font-size: 11px; color: var(--navy); background: var(--gold-tint);
  border: 1px solid var(--line-soft); border-radius: 12px; padding: 2px 10px;
  text-decoration: none; opacity: 0; transition: opacity .15s, background .15s, color .15s;
}
.app-card:hover .qa-chip, .app-card:focus-within .qa-chip { opacity: 1; }
.qa-chip:hover { background: var(--gold); color: #fff; }
[data-theme="dark"] .qa-chip:hover { color: #1c2129; }
/* コンパクト表示（既定）は説明文が無くhoverのきっかけも薄いため、チップは常時表示にする */
[data-density="compact"] .qa-chip { opacity: 1; }
@media (hover: none) { .qa-chip { opacity: 1; } }  /* タッチ端末はhoverが無いため常時表示 */

/* ── オンボーディングツアー（初回訪問のみ。portal.js） ── */
.tour-pop {
  position: absolute; z-index: 60; max-width: 320px; background: var(--navy); color: #fff;
  border-radius: 10px; padding: 12px 16px; font-size: 12.5px; line-height: 1.7;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3); animation: pop-in .25s ease-out;
}
[data-theme="dark"] .tour-pop { background: #223448; color: #e6e3dd; }
.tour-pop::before {
  content: ""; position: absolute; top: -8px; left: 26px;
  border: 8px solid transparent; border-bottom-color: var(--navy); border-top: none;
}
[data-theme="dark"] .tour-pop::before { border-bottom-color: #223448; }
.tour-pop .tour-step { color: #c8ab7d; font-weight: bold; font-size: 10.5px; display: block; margin-bottom: 3px; }
.tour-pop .tour-btns { display: flex; gap: 8px; margin-top: 9px; }
.tour-pop .tour-next {
  background: var(--gold); color: #fff; border: none; border-radius: 6px;
  padding: 4px 14px; font-size: 12px; font-weight: bold; cursor: pointer; font-family: inherit;
}
[data-theme="dark"] .tour-pop .tour-next { color: #1c2129; }
.tour-pop .tour-skip {
  background: transparent; color: #cfd6de; border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 6px; padding: 4px 12px; font-size: 11.5px; cursor: pointer; font-family: inherit;
}
.tour-target { position: relative; z-index: 55; outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }
@keyframes pop-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── トースト（要望実現のお祝い・利用マイルストーン。portal.js） ── */
.portal-toast-area {
  position: fixed; right: 18px; bottom: 18px; z-index: 90;
  display: flex; flex-direction: column; gap: 10px; max-width: min(340px, 86vw);
}
.portal-toast {
  background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--gold);
  border-radius: 10px; padding: 12px 16px; font-size: 12.5px; color: var(--dark); line-height: 1.7;
  box-shadow: var(--shadow-hover); animation: pop-in .3s ease-out;
}
.portal-toast b { color: var(--gold); }

/* ── ヘッダーの画面切替タブ（マイページ｜アプリ一覧。対象者にのみ描画される） ── */
.site-tabs { display: flex; gap: 4px; }
.site-tabs a {
  color: var(--header-fg); text-decoration: none; font-size: 12.5px;
  padding: 4px 12px; border-radius: 99px; border: 1px solid transparent;
  opacity: .82;
}
.site-tabs a:hover { opacity: 1; border-color: rgba(255, 255, 255, .35); }
.site-tabs a[aria-current="page"] {
  opacity: 1; font-weight: bold;
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .3);
  box-shadow: inset 0 -2px 0 var(--gold);
}
@media (max-width: 700px) {
  .site-tabs { order: 3; width: 100%; justify-content: center; }
}

/* ── reduced-motion: 全アニメーション・トランジションを無効化 ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .app-card { animation: none; }
  .confetti-piece { display: none; }
}
