/* ============================================================
   デザイントークン（2026-09-06、インディゴ×ホワイト基調のUI刷新に伴い値を更新。
   参照デザイン: ia-redesign-mockup.html）。
   変数名・参照箇所は変更せず、値のみを新パレットへ差し替えている。
   ============================================================ */
:root {
  --sidebar-bg: #FAFAFA;
  --sidebar-bg-deep: rgba(0,0,0,.055);
  --sidebar-active: #EEECFB;
  --sidebar-active-line: #EEECFB;
  --sidebar-text: #1A1A2E;
  --sidebar-text-muted: #62626F;
  --sidebar-label-muted: #9797A3;

  --page-bg: #FFFFFF;
  --surface: #ffffff;
  --surface-subtle: #F5F5F8;

  --text-primary: #1A1A2E;
  --text-secondary: #62626F;
  --text-muted: #9797A3;

  --border: #E7E7EE;
  --border-strong: #D5D5E0;

  --primary: #5B4FE5;
  --primary-dark: #4A3FD6;
  --primary-light: #EEECFB;
  --primary-hover: #4A3FD6;
  --link: #5B4FE5;

  --danger: #EB5967;
  --danger-bg: #fdecee;
  --danger-border: #f6cdd1;

  --warning: #B0691B;
  --warning-bg: #FBF0E2;
  --warning-border: #E9C48F;

  --success: #4b9847;
  --success-bg: #edf7eb;
  --success-border: #c9e2c5;

  --info: #6E9FC1;
  --info-bg: #eaf1f6;
  --info-border: #cddfe9;

  --neutral-badge: #F5F5F8;
  --neutral-text: #62626F;

  --purple: #8b74b0;
  --purple-bg: #f3effa;
  --purple-border: #d9cbec;

  --radius-card: 8px;
  --radius-control: 6px;
  --radius-badge: 6px;
  --radius-sidebar: 8px;

  --focus-ring: #5B4FE5;

  --space-section: 20px;
  --space-card: 16px;

  --content-max-width: 1600px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  /* 2026-09-08、ユーザー指定「文字と数字のフォントをOpenAI Sansにして」への対応。
     OpenAI Sansは正規配布が確認できなかったため、似た雰囲気でGoogle Fontsから
     正規配布されているInterで代用(ユーザー確認済み)。Interは欧文・数字のみの
     書体でCJKグリフを持たないため、日本語は引き続き既存のHiragino/Meiryo/Yu Gothicへ
     自然にフォールバックする(1つのfont-family指定でグリフ単位のフォールバックが働く)。 */
  font-family: "Inter", "Hiragino Kaku Gothic ProN", "Meiryo", "Yu Gothic", sans-serif;
  background: var(--page-bg);
  color: var(--text-primary);
  font-size: 14px;
}
.icon { flex-shrink: 0; }

.layout { display: flex; min-height: 100vh; }

/* ============ サイドバー ============ */
.sidebar {
  width: 248px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text-muted);
  padding: 16px 0;
  flex-shrink: 0;
  transition: width .15s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sidebar-top { display: flex; align-items: flex-start; justify-content: space-between; padding: 0 12px 0 18px; }
.sidebar-toggle {
  background: none; border: 1px solid var(--border); color: var(--sidebar-text); border-radius: var(--radius-sidebar);
  width: 24px; height: 24px; cursor: pointer; font-size: 12px; flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--sidebar-bg-deep); }
.sidebar .brand { padding: 4px 0 14px; }
.brand-logo { display: block; width: 100%; max-width: 188px; height: auto; }
.sidebar-nav { flex: 1; }
.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  margin: 1px 8px;
  border-radius: var(--radius-sidebar);
  color: var(--sidebar-text-muted);
  text-decoration: none;
  white-space: nowrap;
  font-size: 13px;
  position: relative;
}
.sidebar a .icon { color: inherit; }
.sidebar a .nav-badge {
  margin-left: auto;
  background: var(--danger); color: #fff; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; line-height: 1.5;
  padding: 1px 6px; min-width: 16px; text-align: center; flex-shrink: 0;
}
.sidebar-collapsed .sidebar a { position: relative; }
.sidebar-collapsed .sidebar a .nav-badge {
  position: absolute; top: 4px; right: 6px; margin-left: 0;
  padding: 1px 5px; font-size: 9px;
}
.sidebar a:hover { background: var(--sidebar-bg-deep); color: var(--sidebar-text); }
.sidebar a.active {
  background: var(--sidebar-active);
  color: var(--primary);
  font-weight: 700;
}
.sidebar .user {
  padding: 12px 18px 4px; font-size: 12px; color: var(--sidebar-text-muted);
  border-top: 1px solid var(--border); margin-top: 8px; white-space: nowrap;
}

/* サイドバーのアコーディオングループ(事務管理／営業管理／テレアポ／クライアント管理／
   システム管理)。2026-09-06、開閉式に変更(参照デザイン: ia-redesign-mockup.html)。
   開閉状態はJS(base.html末尾)がlocalStorageで管理し、現在地を含むグループ(.has-active)は
   常に開いた状態で描画する。 */
.nav-group { margin: 0 8px 2px; }
.nav-group-head {
  display: flex; align-items: center; justify-content: space-between; gap: 9px;
  padding: 8px 10px; border-radius: var(--radius-sidebar); cursor: pointer;
  color: var(--sidebar-text-muted); font-size: 13px; font-weight: 500;
}
.nav-group-head:hover { background: var(--sidebar-bg-deep); color: var(--sidebar-text); }
.nav-group-head .left { display: flex; align-items: center; gap: 10px; }
.nav-group-head .chevron { display: inline-flex; opacity: .6; transition: transform .15s ease; }
.nav-group.open > .nav-group-head { color: var(--sidebar-text); font-weight: 600; }
.nav-group.open > .nav-group-head .chevron { transform: rotate(90deg); }
.nav-sub { max-height: 0; overflow: hidden; transition: max-height .18s ease; }
.nav-group.open .nav-sub { max-height: 600px; }
/* 2026-09-06、ユーザー報告「文字が見切れてる」で発覚。インデント分(34px)の余白が
   ラベルの幅を圧迫し、長い項目名(「営業進捗ダッシュボード」等)が右端で切れていた。
   折り返しを許可し、インデントも少し詰める。 */
.nav-sub a.nav-item, .nav-sub a {
  padding-left: 30px; padding-top: 7px; padding-bottom: 7px;
  white-space: normal; line-height: 1.3; align-items: flex-start;
  /* 2026-09-07、ユーザー指摘「改行が変な風になる」(「ュ」等の小さい仮名で行が始まって
     しまう)への対応。禁則処理を効かせて、行頭に来てはいけない文字の直前で折り返す。
     word-break: keep-allも試したが、.sidebarがoverflow:hiddenのため、長いラベルが
     全く折り返せず右端で見切れる(2026-09-06に直したのと同じ不具合)が再発したため
     使わない。ただし「コミット目標実績」→「コミット目標実」/「績」のような、意味の
     区切りとは無関係な位置での折り返し自体は禁則処理の対象外(直せない)ため、
     それは別途ラベルの見直しで対応する。 */
  line-break: strict;
}
.nav-sub a .icon { margin-top: 1px; }

.sidebar .user-row { display: flex; align-items: center; gap: 9px; padding: 6px 0; color: var(--sidebar-text); font-size: 13px; }
.sidebar .user-links { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.sidebar .user-links a { padding: 6px 0; margin: 0; border-radius: 0; font-size: 12px; color: var(--sidebar-text-muted); }
.sidebar .user-links a:hover { background: none; color: var(--sidebar-text); }

.sidebar-collapsed .sidebar { width: 56px; }
.sidebar-collapsed .sidebar .brand,
.sidebar-collapsed .sidebar a span.label,
.sidebar-collapsed .sidebar .user,
.sidebar-collapsed .sidebar .nav-group-head { display: none; }
.sidebar-collapsed .sidebar a { justify-content: center; padding: 11px 0; margin: 2px 8px; }
.sidebar-collapsed .sidebar-top { padding: 0; justify-content: center; padding-top: 4px; }
/* 折りたたみ時はアコーディオンの概念を無くし、以前と同じ「アイコンのみのフラット一覧」に戻す
   (折りたたみ幅ではグループ見出しを表示する余地が無いため、2026-09-06追加)。 */
.sidebar-collapsed .sidebar .nav-sub { max-height: none; overflow: visible; }
.sidebar-collapsed .sidebar .nav-sub a { padding-left: 0; }

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--primary); color: #fff;
  padding: 10px 16px; z-index: 100; border-radius: 0 0 6px 0;
}
.skip-link:focus { left: 0; }

.main { flex: 1; padding: 18px 28px 28px; min-width: 0; }
.main > .page-inner { max-width: var(--content-max-width); margin: 0 auto; }

.mobile-topbar {
  display: none; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
h1 { font-size: 26px; font-weight: 700; margin: 0 0 4px; color: var(--text-primary); }
h2 { font-size: 18px; font-weight: 700; margin: var(--space-section) 0 10px; color: var(--text-primary); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 2px 8px rgba(30, 55, 65, .06);
  padding: var(--space-card);
  margin-bottom: 16px;
}

table { border-collapse: collapse; width: 100%; background: var(--surface); }
th, td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}
th { background: var(--surface-subtle); color: var(--text-secondary); }
tr:nth-child(even) td { background: var(--surface-subtle); }

.badge { display: inline-block; padding: 2px 8px; border-radius: var(--radius-badge); font-size: 12px; }
.badge-ok { background: var(--success-bg); color: var(--success); }
.badge-warn { background: var(--warning-bg); color: var(--warning); }
.badge-bad { background: var(--danger-bg); color: var(--danger); }
.badge-new { background: var(--primary-light); color: var(--primary); font-weight: 600; }

/* ============ ボタン階層 ============ */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  padding: 9px 16px;
  border-radius: var(--radius-control);
  cursor: pointer;
  font-size: 13.5px;
  font-family: inherit;
  text-decoration: none;
  line-height: 1.3;
}
.btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn:disabled { background: var(--border-strong); border-color: var(--border-strong); cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--primary-dark); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--page-bg); border-color: var(--text-muted); }
.btn-small { padding: 5px 11px; font-size: 12px; border-radius: var(--radius-control); }
.btn-muted { background: var(--neutral-badge); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-muted:hover { background: #e3e7ea; }
.btn-text {
  background: none; border: none; color: var(--text-secondary); padding: 4px 2px;
  font-size: 13px; font-family: inherit; cursor: pointer; text-decoration: underline;
}

/* テレアポ対応履歴の選択肢(2026-08-29追加。電話→切電後の対応履歴を固定6分類から
   選ばせる運用のためのラジオボタン風ピル)。 */
.disposition-choice {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-secondary); font-size: 13px; cursor: pointer;
}
.disposition-choice:has(input:checked) {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
/* 2026-10-02、ユーザー指摘「会議と書いてあるところ、文字と背景色のバランスが悪くて
   読めない」への対応。#scheduleEventForm label { color: var(--text-secondary); }
   (IDセレクタ)の方がここより詳細度が高く、選択中の文字色(白)を上書きしてしまい、
   濃い紫地に濃い文字で読めなくなっていた。!importantで確実に白を優先させる。 */
.disposition-choice:has(input:checked) { color: #fff !important; }
.disposition-choice input[type="radio"] { accent-color: #fff; }
.btn-text:hover { color: var(--text-primary); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #c02f3e; border-color: #c02f3e; }
.btn-link {
  background: none; border: none; padding: 0; font-family: inherit; font-size: 13px;
  color: var(--link); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 2px;
}
.btn-link:hover { text-decoration: underline; }
.inline-form { display: inline-block; margin: 2px 4px 2px 0; }

input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], input[type=url], input[type=email], input[type=tel], textarea, select {
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  font-size: 13.5px;
  width: 100%;
  max-width: 420px;
  min-height: 38px;
  box-sizing: border-box;
  background: var(--surface);
  color: var(--text-primary);
}
input[type=date] { max-width: 168px; }
input[type=time] { max-width: 130px; }
label { display: block; margin: 12px 0 4px; font-weight: bold; font-size: 13px; }

.flash { padding: 10px 14px; border-radius: var(--radius-control); margin-bottom: 16px; font-size: 13px; }
.flash-error { background: var(--danger-bg); color: var(--danger); }
.flash-success { background: var(--success-bg); color: var(--success); }

.login-wrap { display: flex; align-items: center; justify-content: center; height: 100vh; background: var(--sidebar-bg); }
.login-box { background: var(--surface); padding: 36px; border-radius: var(--radius-card); width: 320px; }
.login-box h1 { text-align: center; font-size: 20px; }
.brand-logo-vertical { display: block; width: 176px; height: auto; margin: 0 auto 14px; }

/* ============ ALPHA BASEブランドローディング表示(2026-09-07追加)
   app/templates/_alphabase_loader.htmlのマクロ・app/static/alphabase-loader.jsと
   セットで使う。中央のレイヤーロゴ(alpha-base-symbol.svg)は回転させず、外周の
   円弧＋ドットのリングだけを時計回りに回す。CSSのtransformアニメーションのみで
   完結させ(JSによる連続描画は無し)、prefers-reduced-motionにも対応する。 ============ */
.ab-loader-wrap.ab-loader-mode-inline { display: inline-flex; }
.ab-loader-wrap.ab-loader-mode-overlay {
  position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.72);
}
.ab-loader-wrap.ab-loader-mode-fullscreen {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.92);
}
/* overlay/fullscreenのdisplay:flexは、hidden属性のブラウザ既定スタイル(display:none)より
   詳細度が高く、そのままだとhidden属性を付けても表示されたままになってしまう
   (実機確認で発覚した重大な不具合。2026-09-07修正)。hidden指定を必ず勝たせる。 */
.ab-loader-wrap[hidden] { display: none !important; }
.ab-loader { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ab-loader-visual { position: relative; width: var(--ab-size); height: var(--ab-size); }
.ab-loader-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(
    #F36C21 0deg 100deg, transparent 100deg 120deg,
    #596170 120deg 220deg, transparent 220deg 240deg,
    #17223B 240deg 340deg, transparent 340deg 360deg
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--ab-stroke)), #000 calc(100% - var(--ab-stroke)));
  mask: radial-gradient(farthest-side, transparent calc(100% - var(--ab-stroke)), #000 calc(100% - var(--ab-stroke)));
  animation: ab-loader-spin 1.4s linear infinite;
  will-change: transform;
}
/* 円弧の切れ目に小さなドットを置き、「円弧＋ドット」の連なりに見せる
   (次の色を先取りするように、直後の弧の色を付けている)。 */
.ab-loader-dot { position: absolute; top: 50%; left: 50%; border-radius: 50%; }
.ab-loader-dot-1 { background: #596170; transform: rotate(110deg) translateY(calc(-1 * var(--ab-radius))); }
.ab-loader-dot-2 { background: #17223B; transform: rotate(230deg) translateY(calc(-1 * var(--ab-radius))); }
.ab-loader-dot-3 { background: #F36C21; transform: rotate(350deg) translateY(calc(-1 * var(--ab-radius))); }
.ab-loader-symbol {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  animation: ab-loader-pulse 2.6s ease-in-out infinite;
}
.ab-loader-text { font-size: 13px; color: var(--text-secondary); text-align: center; max-width: 220px; }
.ab-loader-sm { --ab-size: 28px; --ab-symbol: 16px; --ab-stroke: 2.5px; --ab-radius: 11px; --ab-dot: 3px; }
.ab-loader-md { --ab-size: 56px; --ab-symbol: 32px; --ab-stroke: 3.5px; --ab-radius: 23px; --ab-dot: 4px; }
.ab-loader-lg { --ab-size: 108px; --ab-symbol: 60px; --ab-stroke: 5px; --ab-radius: 45px; --ab-dot: 6px; }
.ab-loader-sm .ab-loader-text, .ab-loader-md .ab-loader-text { font-size: 11.5px; }
.ab-loader-ring { width: var(--ab-size); height: var(--ab-size); }
.ab-loader-symbol { width: var(--ab-symbol); height: auto; }
.ab-loader-dot { width: var(--ab-dot); height: var(--ab-dot); margin: calc(var(--ab-dot) / -2) 0 0 calc(var(--ab-dot) / -2); }
@keyframes ab-loader-spin { to { transform: rotate(360deg); } }
@keyframes ab-loader-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.045); }
}
@media (prefers-reduced-motion: reduce) {
  .ab-loader-ring, .ab-loader-symbol { animation: none; }
}

/* ============ パンくずリスト ============ */
.breadcrumb { font-size: 12.5px; color: var(--text-secondary); margin: 0 0 10px; display: flex; flex-wrap: wrap; align-items: center; }
.breadcrumb a { color: var(--text-secondary); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); text-decoration: underline; }
.breadcrumb .breadcrumb-sep { margin: 0 6px; color: var(--text-muted); }
.breadcrumb .breadcrumb-current { color: var(--text-primary); font-weight: 600; }

/* ============ ヘッダー ============ */
.result-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.result-meta { font-size: 13px; color: var(--text-secondary); margin: 0; display: flex; flex-wrap: wrap; gap: 3px 16px; }
.data-freshness { display: inline-flex; align-items: center; gap: 4px; }
.data-freshness svg { width: 12px; height: 12px; flex-shrink: 0; }
.result-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============ コンパクト警告バナー ============ */
.alert-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--danger);
  border-radius: var(--radius-control); padding: 10px 16px; margin-bottom: 12px; font-size: 13.5px;
}
.alert-banner .icon { color: var(--danger); }
.alert-banner-text { color: var(--text-primary); }
.alert-banner details { display: inline; }
.alert-banner summary { display: inline; cursor: pointer; color: var(--link); list-style: none; }
.alert-banner summary::-webkit-details-marker { display: none; }
.alert-banner summary:hover { text-decoration: underline; }
.alert-details-body { flex-basis: 100%; margin-top: 10px; }
.note-text { font-size: 12px; color: var(--text-secondary); }
.hint-text { font-size: 12px; color: var(--text-secondary); margin: 0 0 12px; }

.mini-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.mini-table th, .mini-table td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.mini-table th { background: var(--page-bg); }

/* ============ 氏名寄せ確認: 顧客ごとの比較表 ============ */
.dedup-group { border: 1px solid var(--border); border-radius: var(--radius-card); margin: 16px 0; overflow: hidden; }
.dedup-group-head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  padding: 12px 16px; background: var(--surface-subtle); border-bottom: 1px solid var(--border);
}
.dedup-group-head .btn, .dedup-group-head .btn-text { margin-left: 6px; }
.dedup-compare-table { font-size: 12.5px; }
.dedup-compare-table th { white-space: nowrap; }
.dedup-compare-table td { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.dedup-merged-row td { background: var(--info-bg); color: var(--info); font-weight: 600; }

/* ============ KPIカード ============ */
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 10px; }
/* 3件/4件ぶんのKPI行(テレアポの実績カード等)向けの列数指定。以前はテンプレート側で
   style="grid-template-columns: repeat(4, 1fr);"のようにインラインで固定していたが、
   インラインstyleは.kpi-gridのレスポンシブなmedia query(下記)より詳細度が高く効いて
   しまい、スマホ幅でも常に3列/4列のまま→カードがはみ出て見切れる不具合になっていた
   (2026-09-07、ユーザー指摘「架電するページのカードが見切れている」)。クラスとして
   定義し、同じ幅ごとの折り返し規則をここでも明示することで直す。 */
.kpi-grid.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-grid.kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1023px) {
  .kpi-grid.kpi-grid-3, .kpi-grid.kpi-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 767px) {
  .kpi-grid.kpi-grid-3, .kpi-grid.kpi-grid-4 { grid-template-columns: 1fr; }
}
.kpi-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  box-shadow: 0 2px 8px rgba(30, 55, 65, .06);
  padding: 12px 14px; display: flex; align-items: center; gap: 11px;
}
.kpi-box .kpi-icon {
  width: 28px; height: 28px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 7px; background: var(--primary-light);
  color: var(--kpi-color, var(--primary-dark));
}
.kpi-box .kpi-icon svg { width: 17px; height: 17px; }
.kpi-box .kpi-body { min-width: 0; }
.kpi-box .label { font-size: 12px; color: var(--text-secondary); font-weight: 600; white-space: nowrap; position: relative; }
.kpi-box .value { font-size: 20px; font-weight: 700; color: var(--kpi-color, var(--text-primary)); margin-top: 1px; line-height: 1.2; }
.kpi-box .value a { color: inherit; text-decoration: none; }
.kpi-box .value a:hover { text-decoration: underline; }
.kpi-box-total { --kpi-color: var(--primary); }
.kpi-box-matched { --kpi-color: var(--success); }
.kpi-box-outstanding { --kpi-color: var(--danger); }
.kpi-box-name { --kpi-color: var(--warning); }
.kpi-box-profile { --kpi-color: var(--warning); }
.kpi-box-navy { --kpi-color: var(--primary); }
.kpi-box-blue { --kpi-color: var(--info); }
.kpi-box-orange { --kpi-color: var(--warning); }
.kpi-box-green { --kpi-color: var(--success); }
.kpi-box-purple { --kpi-color: var(--purple); }

/* ============ 案件パイプライン（担当者別） ============ */
.pipeline-stage-chip {
  display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px; white-space: nowrap; text-decoration: none;
}
.pipeline-stage-chip.stage-将来新規 { background: var(--info-bg); color: var(--info); }
.pipeline-stage-chip.stage-提案 { background: var(--warning-bg); color: var(--warning); }
.pipeline-stage-chip.stage-契約予定 { background: var(--success-bg); color: var(--success); }
.pipeline-stage-chip.stage-商談継続中 { background: var(--purple-bg); color: var(--purple); }
.pipeline-stage-chip.stage-保全 { background: var(--neutral-badge); color: var(--neutral-text); }
.pipeline-stage-chip.stage-未分類 { background: var(--surface-subtle); color: var(--text-muted); border: 1px dashed var(--border-strong); }
a.pipeline-stage-chip:hover { filter: brightness(0.92); }
.pipeline-week-cell { display: flex; flex-wrap: wrap; gap: 4px; }
.pipeline-week-cell .cell-empty { color: var(--text-muted); }

.pipeline-table { border-collapse: separate; border-spacing: 0; }
.pipeline-table th, .pipeline-table td { white-space: nowrap; }
.pipeline-table th { position: relative; }
.pipeline-table th.col-staff, .pipeline-table td.col-staff,
.pipeline-table th.col-total, .pipeline-table td.col-total {
  position: sticky; background: var(--surface); z-index: 1;
}
.pipeline-table thead th.col-staff, .pipeline-table thead th.col-total { z-index: 2; background: var(--surface-subtle); }
.pipeline-table th.col-staff, .pipeline-table td.col-staff { left: 0; min-width: 120px; border-right: 1px solid var(--border); }
.pipeline-table th.col-total, .pipeline-table td.col-total { left: 120px; min-width: 70px; border-right: 1px solid var(--border); text-align: center; }
.pipeline-table td.col-week { min-width: 150px; vertical-align: top; }
.pipeline-table th.col-week-current, .pipeline-table td.col-week-current { background: var(--info-bg); }
.pipeline-table thead th.col-week-current { background: var(--info-border); }

.pipeline-kpi-extra { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; color: var(--text-secondary); }
.pipeline-checkpoints { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 14px; }
.pipeline-checkpoint {
  flex: 1 1 200px; padding: 12px 16px; border-radius: var(--radius-card); border: 1px solid var(--border);
  background: var(--surface-subtle);
}
.pipeline-checkpoint .label { font-size: 12.5px; color: var(--text-secondary); font-weight: 600; position: relative; }
.pipeline-checkpoint .value { font-size: 24px; font-weight: 700; margin-top: 3px; }
.pipeline-checkpoint .value a { color: inherit; text-decoration: none; }
.pipeline-checkpoint .value a:hover { text-decoration: underline; }
.pipeline-checkpoint-danger { background: var(--danger-bg); border-color: var(--danger-border); }
.pipeline-checkpoint-danger .value { color: var(--danger); }

/* 2カラムの並列カード配置(月次推移の再アポ率/契約率など)。2026-08-23追加。
   grid-template-columns:1fr の子要素は既定でmin-width:autoのため、中の.histのような
   横に長いflexコンテンツがあると、トラック(ひいてはページ全体)が押し広げられて
   横スクロールが発生する。min-width:0で明示的に縮小を許可し、はみ出しは
   .hist側のoverflow-x:autoに閉じ込める(2026-08-23、ユーザー報告により修正)。 */
.rank-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.rank-grid > * { min-width: 0; }
@media (max-width: 780px) {
  .rank-grid { grid-template-columns: 1fr; }
}

/* 早期フォロー対象の区分バッジ。2026-08-23追加。 */
.urgency-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.urgency-badge.urgency-watch { background: var(--warning-bg); color: var(--warning); }
.urgency-badge.urgency-urgent { background: var(--danger-bg); color: var(--danger); }

/* 月次推移(再アポ率・契約率)のミニ棒グラフ。2026-08-23追加。 */
.hist { display: flex; align-items: flex-end; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.hist-col { flex: 1 1 0; min-width: 40px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.hist-bar-wrap { flex: 1; display: flex; align-items: flex-end; width: 100%; justify-content: center; }
.hist-bar { width: 60%; min-width: 8px; background: var(--primary); border-radius: 3px 3px 0 0; }
.hist-bar.peak { background: var(--primary-dark); }
.hist-val { font-size: 10.5px; font-weight: 700; color: var(--text-secondary); margin-bottom: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hist-label { font-size: 10px; color: var(--text-muted); margin-top: 6px; white-space: nowrap; }

/* 案件パイプライン専用の説明ポップオーバー。position:fixedにし、JS側(_pipeline_body.html)が
   ボタンの実座標から画面内に収まるtop/leftを計算して指定する(祖先のoverflow設定や
   カードの右端に関係なく表示できるようにするため)。 */
.pipeline-help-popover {
  display: none; position: fixed; z-index: 60; max-width: 380px; background: var(--text-primary);
  color: #fff; font-size: 12px; line-height: 1.6; padding: 12px 14px; border-radius: var(--radius-control);
  box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.pipeline-help-popover.open { display: block; }


.clear-banner {
  padding: 12px 16px;
  border-radius: var(--radius-control);
  margin-bottom: var(--space-section);
  font-size: 13px;
  font-weight: bold;
}
.clear-banner-warn { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }
.clear-banner-ok { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }

/* ============ 検索・一覧カード（タブ＋検索行＋テーブルを1つにまとめる） ============ */
.list-card { padding: 0; overflow: visible; position: relative; }

.tab-bar { display: flex; align-items: center; gap: 4px; padding: 0 18px; border-bottom: 1px solid var(--border); overflow-x: auto; background: var(--surface); border-radius: var(--radius-card) var(--radius-card) 0 0; }
.tab-btn {
  display: inline-flex; align-items: center; text-decoration: none;
  background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-secondary);
  font-family: inherit; font-size: 13px; font-weight: 600; padding: 11px 12px; cursor: pointer; white-space: nowrap;
  height: 40px; box-sizing: border-box;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--text-primary); border-bottom-color: var(--primary); }
.tab-count { font-weight: 700; }
.tab-btn[data-tab="outstanding"] .tab-count { color: var(--danger); }
.tab-btn[data-tab="prior_month"] .tab-count { color: var(--text-secondary); }
.tab-btn[data-tab="fixed_pending"] .tab-count { color: var(--text-secondary); }
.tab-btn[data-tab="done"] .tab-count { color: var(--text-secondary); }
.tab-btn.active .tab-count { color: inherit; }
.tab-btn.active[data-tab="outstanding"] .tab-count { color: var(--danger); }

.search-row { display: flex; align-items: center; gap: 10px; padding: 10px 20px; flex-wrap: wrap; position: relative; }
.search-input-wrap { position: relative; flex: 1 1 320px; min-width: 200px; }
.search-input-wrap .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-input-wrap input[type=search] { max-width: none; padding: 8px 10px 8px 38px; }
.search-input-wrap input[type=search]::-webkit-search-cancel-button { cursor: pointer; }
.filter-toggle-btn {
  display: inline-flex; align-items: center; gap: 7px; background: var(--surface); color: var(--primary-dark);
  border: 1px solid var(--border-strong); border-radius: var(--radius-control); padding: 8px 14px; font-size: 13.5px;
  font-family: inherit; cursor: pointer; flex-shrink: 0; position: relative;
}
.filter-toggle-btn:hover { background: var(--page-bg); }
.filter-toggle-btn.active { border-color: var(--primary-dark); }
.filter-toggle-btn .badge-count {
  background: var(--danger); color: #fff; border-radius: 999px; font-size: 10.5px; font-weight: 700;
  padding: 1px 6px; margin-left: 2px;
}
.search-row-count { margin-left: auto; font-size: 13px; color: var(--text-secondary); white-space: nowrap; }

/* ============ 絞り込みポップオーバー（一覧を押し下げない） ============ */
.filter-popover {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 20px;
  width: 540px;
  max-width: calc(100vw - 40px);
  max-height: 70vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 12px 32px rgba(23,43,61,.16);
  z-index: 45;
  flex-direction: column;
}
.filter-popover.open { display: flex; }
.filter-popover-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.filter-popover-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.filter-popover-field label, .filter-popover-field-label { margin: 0 0 5px; font-size: 12px; color: var(--text-secondary); font-weight: 600; display: block; }
.filter-popover-field input, .filter-popover-field select { max-width: none; padding: 8px; font-size: 13.5px; }
.filter-popover-checks { display: flex; flex-direction: column; gap: 9px; padding-top: 4px; border-top: 1px solid var(--border); }
.filter-popover-checks label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: normal; color: var(--text-primary); margin: 0; }
.filter-popover-checks input[type=checkbox] { margin: 0; }
.filter-popover-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 20px; border-top: 1px solid var(--border); flex-shrink: 0;
}
.filter-popover-footer .right { display: flex; gap: 8px; }
.filter-popover-scrim { display: none; position: fixed; inset: 0; z-index: 44; background: transparent; }
.filter-popover-scrim.open { display: block; }

.checkbox-label { font-size: 13px; color: var(--text-primary); display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; margin-top: 4px; }
.checkbox-label label { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-weight: normal; }
.checkbox-label input[type=checkbox] { margin: 0; }

.filter-chips { padding: 0 20px 10px; font-size: 12px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; max-height: 32px; overflow: hidden; }
.filter-chips-label { color: var(--text-secondary); font-weight: bold; }
.filter-chip {
  background: var(--info-bg); color: var(--info); border: 1px solid var(--info-border); border-radius: 999px;
  padding: 3px 10px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.filter-chip:hover { background: #dfeaf1; }
#filterClear { color: var(--text-secondary); font-size: 12px; margin-left: 4px; background: none; border: none; cursor: pointer; font-family: inherit; }

.help-text-inline { font-size: 12px; color: var(--link); }

/* 問題内容ヘッダーのヘルプアイコン（AI判定の説明を常時のパラグラフではなく、見出し内のアイコンに収める） */
.th-help { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%; background: var(--neutral-badge); color: var(--text-secondary); font-size: 10px; font-weight: bold; cursor: pointer; border: none; margin-left: 4px; vertical-align: middle; }
.th-help:hover { background: var(--border-strong); }

/* ============ 案件一覧テーブル ============ */
.table-scroll { width: 100%; overflow-x: auto; }
.issue-table { border-collapse: collapse; width: 100%; background: var(--surface); }
.issue-table th, .issue-table td {
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  text-align: left;
  font-size: 14px;
  vertical-align: middle;
  word-break: keep-all;
  overflow-wrap: break-word;
}
.issue-table th { background: var(--surface-subtle); color: var(--text-secondary); font-size: 12px; font-weight: 600; padding-top: 12px; padding-bottom: 12px; }
.issue-table td { padding-top: 16px; padding-bottom: 16px; line-height: 1.55; }
.issue-table tr:last-child td { border-bottom: none; }
.issue-table tr.issue-row { cursor: pointer; }
.issue-table tr.issue-row:hover td { background: var(--page-bg); }
.issue-table tr.issue-row:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
/* 交互行はごく薄いトーンにとどめ、境界線(--border)の存在感を主にする */
.issue-table tr:nth-child(even) td { background: #fbfcfd; }

.case-cell { max-width: 320px; }
.case-name { font-weight: 700; font-size: 14.5px; line-height: 1.4; color: var(--text-primary); overflow-wrap: break-word; }
a.case-name { display: block; text-decoration: none; }
a.case-name:hover { color: var(--primary); text-decoration: underline; }
.case-name .case-alt { font-weight: normal; color: var(--text-secondary); font-size: 13px; }
.case-identifiers { font-size: 12.5px; color: var(--text-secondary); margin-top: 5px; overflow-wrap: break-word; }
.case-progress { font-size: 12.5px; color: var(--text-secondary); margin-top: 5px; line-height: 1.6; }
.case-progress strong { color: var(--text-primary); font-weight: 700; }
.case-no { color: var(--text-secondary); font-weight: normal; font-size: 12px; }

.state-badge, .ai-badge, .dict-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.state-critical { background: var(--danger-bg); color: var(--danger); }
.state-warn { background: var(--warning-bg); color: var(--warning); }
.state-done { background: var(--success-bg); color: var(--success); }
.state-none { background: var(--neutral-badge); color: var(--text-secondary); }

/* 問題内容: 色ドット＋テキスト */
.problem-list { display: flex; flex-direction: column; gap: 9px; max-width: 320px; }
.problem-line { font-size: 13.5px; color: var(--text-primary); line-height: 1.6; display: flex; align-items: flex-start; gap: 7px; }
.problem-line .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; margin-top: 7px; }
.problem-line .dot-danger { background: var(--danger); }
.problem-line .dot-warning { background: var(--warning); }
.problem-line .dot-neutral { background: var(--text-muted); }
.problem-more-btn {
  align-self: flex-start; background: none; border: none; color: var(--link); font-size: 12px;
  font-family: inherit; cursor: pointer; padding: 0; margin-top: 8px;
}
.problem-more-btn:hover { text-decoration: underline; }

.candidate-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.candidate-row:last-of-type { border-bottom: none; }

.detail-cell { width: 76px; text-align: right; }
.btn-detail-link {
  background: none; border: none; color: var(--link); font-family: inherit; font-size: 13px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 1px; padding: 4px;
}
.btn-detail-link:hover { text-decoration: underline; }

/* ============ バッジ（状態色。限定した範囲のみに使用） ============ */
.priority-badge, .change-badge, .status-badge, .progress-badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.priority-high { background: var(--danger-bg); color: var(--danger); }
.priority-mid { background: var(--warning-bg); color: var(--warning); }
.priority-low { background: var(--neutral-badge); color: var(--text-secondary); }

.change-new { background: var(--danger-bg); color: var(--danger); }
.change-recurring { background: var(--danger-bg); color: var(--danger); }
.change-still_open { background: var(--warning-bg); color: var(--warning); }
.change-continuing { background: var(--neutral-badge); color: var(--text-secondary); }
.change-cleared { background: var(--success-bg); color: var(--success); }
.change-prior_month { background: var(--info-bg); color: var(--info); }
.change-over30 { background: var(--warning-bg); color: var(--warning); }

.status-not_started { background: var(--danger-bg); color: var(--danger); }
.status-investigating { background: var(--warning-bg); color: var(--warning); }
.status-fix_requested { background: var(--warning-bg); color: var(--warning); }
.status-fixed_pending { background: var(--success-bg); color: var(--success); }
.status-resolved { background: var(--success-bg); color: var(--success); }
.status-not_needed { background: var(--neutral-badge); color: var(--text-secondary); }
.status-ai_only { background: var(--info-bg); color: var(--info); }

/* ============ 詳細スライドパネル（固定ヘッダー／フッター、中央だけスクロール） ============ */
.detail-overlay {
  position: fixed; inset: 0; background: rgba(23,43,61,0.24);
  opacity: 0; pointer-events: none; transition: opacity .2s ease; z-index: 40;
}
.detail-overlay.open { opacity: 1; pointer-events: auto; }
.detail-panel {
  position: fixed; top: 0; right: 0; height: 100%; width: 620px; max-width: 94vw;
  background: var(--surface); box-shadow: -6px 0 20px rgba(23,43,61,0.14);
  transform: translateX(100%); transition: transform .25s ease; z-index: 41;
  display: flex; flex-direction: column;
}
.detail-panel.open { transform: translateX(0); }
/* 説明書きのⓘアイコン(2026-10-06、長い注意書きをクリック/フォーカス時だけ表示する) */
.info-tip {
  display: inline-flex; align-items: center; justify-content: center; position: relative;
  width: 16px; height: 16px; margin-left: 4px; border-radius: 50%; border: 1px solid var(--text-secondary);
  color: var(--text-secondary); font-size: 11px; font-weight: 700; font-style: normal; line-height: 1;
  cursor: help; vertical-align: middle;
}
.info-tip::after {
  content: attr(data-tip); position: absolute; left: -6px; top: 22px; z-index: 50;
  width: 280px; max-width: 80vw; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-control);
  background: var(--surface); color: var(--text-primary); box-shadow: 0 4px 12px rgba(23,43,61,0.14);
  font-size: 12px; font-weight: 400; line-height: 1.6; text-align: left; white-space: normal;
  opacity: 0; visibility: hidden; transition: opacity .15s;
}
.info-tip:hover::after, .info-tip:focus::after { opacity: 1; visibility: visible; }

/* 予定パネルの拡大表示(2026-10-06、画面中央に大きく表示する。閉じると通常位置に戻る) */
.detail-panel.is-expanded {
  top: 50% !important; left: 50% !important; right: auto !important; bottom: auto !important;
  height: auto !important; max-height: 92vh !important; width: min(760px, 94vw) !important;
  transform: translate(-50%, -50%) !important; border-radius: 12px;
}
.detail-panel.is-expanded .detail-panel-body { min-height: 0; }
.detail-panel-header {
  padding: 18px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
}
.detail-panel-header-main { min-width: 0; }
.detail-panel-header .dp-name { font-size: 17px; font-weight: 700; color: var(--text-primary); overflow-wrap: break-word; }
.detail-panel-header .dp-meta { font-size: 12px; color: var(--text-secondary); margin-top: 4px; line-height: 1.6; }
.detail-close {
  background: none; border: 1px solid var(--border); border-radius: var(--radius-control); width: 32px; height: 32px;
  cursor: pointer; color: var(--text-secondary); line-height: 1; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.detail-close:hover { background: var(--page-bg); color: var(--text-primary); }
.detail-panel-body { padding: 22px 24px; overflow-y: auto; flex: 1; font-size: 13px; }
.detail-panel-footer {
  padding: 14px 24px; border-top: 1px solid var(--border); flex-shrink: 0;
  display: flex; justify-content: flex-end; gap: 10px;
}

.detail-section { margin-bottom: var(--space-section); }
.detail-section h4 {
  font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em;
  margin: 0 0 10px; border-bottom: 1px solid var(--border); padding-bottom: 6px;
}
.detail-row { display: flex; padding: 6px 0; align-items: flex-start; }
.detail-row .k { width: 120px; flex-shrink: 0; color: var(--text-secondary); }
.detail-row .v { flex: 1; }

/* 案件入手先の不一致比較（どれとどれが不一致かを一目で見せる） */
.source-compare { display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; }
.source-compare-item {
  flex: 1 1 200px; background: var(--page-bg); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 10px 14px;
}
.source-compare-label { font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; }
.source-compare-value { font-size: 14px; font-weight: 600; word-break: break-all; }
.source-compare-vs { align-self: center; font-size: 16px; font-weight: 700; color: var(--danger); padding: 0 2px; }

/* 問題サマリー（詳細パネル最上部） */
.problem-summary {
  background: var(--page-bg); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px 18px; margin-bottom: var(--space-section);
}
.problem-summary-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.problem-summary-row:last-child { margin-bottom: 0; }
.problem-summary-label { font-size: 11px; color: var(--text-secondary); width: 90px; flex-shrink: 0; }

/* 判定内容セクション（折りたたみ） */
.judgement-section { border: 1px solid var(--border); border-radius: var(--radius-card); margin-bottom: 12px; overflow: hidden; }
.judgement-section summary {
  padding: 12px 16px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-primary);
  display: flex; align-items: center; justify-content: space-between; list-style: none;
}
.judgement-section summary::-webkit-details-marker { display: none; }
.judgement-section summary .jt { display: flex; align-items: center; gap: 8px; }
.judgement-section summary::after { content: "▾"; color: var(--text-secondary); font-size: 11px; }
.judgement-section[open] summary::after { content: "▴"; }
.judgement-section summary:hover { background: var(--page-bg); }
.judgement-body { padding: 4px 16px 16px; border-top: 1px solid var(--border); }
.judgement-not-evaluated { color: var(--text-secondary); font-weight: 600; font-size: 12px; }

/* AIコメント：長い場合は折りたたみ、クリックで展開 */
.ai-comment { position: relative; line-height: 1.7; }
.ai-comment.clamped {
  max-height: 4.9em;
  overflow: hidden;
}
.ai-comment.clamped::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 22px;
  background: linear-gradient(rgba(255,255,255,0), var(--surface) 85%);
}
.comment-toggle-btn {
  display: none;
  margin: 4px 0 0;
  background: none;
  border: none;
  color: var(--link);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
}
.comment-toggle-btn:hover { text-decoration: underline; }

/* ヘルプアイコン（AI判定の説明文などを常時表示せず展開領域に） */
.help-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
  border-radius: 50%; background: var(--neutral-badge); color: var(--text-secondary);
  font-size: 11px; font-weight: bold; cursor: pointer; border: none; vertical-align: middle;
}
.help-icon:hover { background: var(--border-strong); }
/* position:fixedにし、JS側(result.js)がボタンの実座標から画面内に収まるtop/leftを
   計算して指定する(2026-08-29修正。以前はposition:absoluteだったため、横スクロールする
   .table-scroll内では祖先のoverflow-x:autoにより吹き出しがクリップされ、クリックしても
   説明が表示されないことがあった。.pipeline-help-popoverと同じ考え方に揃えた)。 */
.help-popover {
  display: none; position: fixed; z-index: 60; max-width: 380px; background: var(--text-primary);
  color: #fff; font-size: 12px; line-height: 1.6; padding: 12px 14px; border-radius: var(--radius-control);
  box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.help-popover.open { display: block; }

/* 対応履歴タイムライン */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { position: relative; padding: 0 0 18px 22px; border-left: 2px solid var(--border); }
.timeline-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline-item::before {
  content: ""; position: absolute; left: -6px; top: 2px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary); border: 2px solid var(--surface);
}
.timeline-item.timeline-system::before { background: var(--text-muted); }
.timeline-date { font-size: 11px; color: var(--text-secondary); }
.timeline-body { font-size: 13px; color: var(--text-primary); margin-top: 2px; }
.timeline-source { font-size: 11px; color: var(--text-muted); margin-left: 6px; }
.timeline-comment { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* ============ 対応状況の変更（1操作→必要な入力→保存 の流れ） ============ */
.status-control { background: var(--page-bg); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px 18px; }
.status-control-current { font-size: 13px; margin-bottom: 10px; }
.status-change-toggle { margin-top: 4px; }
.status-change-form { display: none; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.status-change-form.open { display: block; }
.status-change-form select { max-width: 260px; }
.status-extra-fields { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.status-extra-fields label { margin: 0; font-size: 12px; }
.not-needed-note { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.status-history { margin-top: 12px; font-size: 12px; color: var(--text-secondary); }
.status-history summary { cursor: pointer; }

/* ============ 今週のレポート：AIによる文章解釈 ============ */
.weekly-narrative {
  margin-top: 14px; padding: 14px 16px; background: var(--primary-light);
  border: 1px solid var(--primary-border, var(--border)); border-radius: var(--radius-card);
  font-size: 14px; line-height: 1.8;
}

/* ============ 今週のレポート：週次目標の進捗バー ============ */
.target-progress-track { height: 8px; border-radius: 4px; background: var(--surface-subtle); border: 1px solid var(--border); margin-top: 4px; overflow: hidden; }
.target-progress-fill { height: 100%; background: var(--primary); border-radius: 4px; }
.target-progress-fill.is-over { background: var(--success); }

/* ============ 営業ファネル ============ */
.funnel-row { display: flex; align-items: stretch; flex-wrap: wrap; gap: 4px; }
.funnel-step {
  background: var(--surface-subtle); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 12px 16px; min-width: 120px; flex: 1 1 120px; text-align: center;
  transition: background .12s ease, box-shadow .12s ease;
}
.funnel-step-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.funnel-step-value { font-size: 22px; font-weight: 700; color: var(--text-primary); margin-top: 3px; font-variant-numeric: tabular-nums; }
a.funnel-step-value { display: block; text-decoration: none; border-radius: 6px; margin: -2px; padding: 2px; }
a.funnel-step-value:hover { color: var(--primary-dark); background: var(--primary-light); }
.funnel-step:has(a.funnel-step-value:hover) { box-shadow: 0 2px 8px rgba(30, 55, 65, .1); }
.funnel-step-sub { font-size: 11px; color: var(--text-secondary); font-weight: 400; }
.funnel-step-mint { background: var(--primary-light); border-color: var(--primary-border, var(--border)); }
.funnel-step-blue { background: var(--info-bg); border-color: var(--info-border); }
.funnel-step-orange { background: var(--warning-bg); border-color: var(--warning-border); }
.funnel-step-green { background: var(--success-bg); border-color: var(--success-border); }
.funnel-arrow {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-muted); flex: 0 0 auto; padding: 0 3px; min-width: 46px;
}
.funnel-arrow span { font-size: 11.5px; font-weight: 700; color: var(--primary-dark); white-space: nowrap; }
@media (max-width: 780px) {
  /* 2026-09-13、ユーザー報告「見た目がスマホだとちょっと変。歪」への対応。
     以前は.funnel-arrow全体(アイコン+%テキスト)を90度回転させ、テキストだけ逆回転で
     戻していたため、回転の軸ずれで矢印とテキストの位置関係が不自然になっていた。
     アイコンだけを回転させ、テキストは回転させない(横並びのまま)方針に変更。 */
  .funnel-row { flex-direction: column; }
  .funnel-arrow { flex-direction: row; justify-content: center; gap: 6px; min-width: 0; min-height: 28px; padding: 2px 0; }
  .funnel-arrow .icon { transform: rotate(90deg); }
}

/* マーケット別新規流入の推移グラフ(2026-09-13、ユーザー指定「マーケット別新規流入は
   推移グラフに」)。SVGはJS側(dashboard.html)で描画し、ここでは外枠・凡例の見た目のみ。 */
.chart-wrap { overflow-x: auto; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; }
.chart-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-secondary); text-decoration: none; }
.chart-legend-item:hover { color: var(--primary-dark); text-decoration: underline; }
.chart-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }

/* ============ レスポンシブ ============ */
@media (min-width: 1921px) {
  .main { padding-left: 48px; padding-right: 48px; }
}

/* KPIカードの列数は幅ごとに独立して切り替える：1440px以上=5列／1024〜1439px=3列（3+2）／
   768〜1023px=2列／767px以下=1列（後続のブロックで上書き、ソース順で優先させる）。 */
@media (max-width: 1439px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1280px) {
  .sidebar { width: 210px; }
  .filter-popover { width: 480px; }
}

@media (max-width: 1024px) {
  .main { padding: 16px 20px; }
  .kpi-box { padding: 11px 13px; gap: 9px; }
  .kpi-box .kpi-icon { width: 26px; height: 26px; }
  .kpi-box .kpi-icon svg { width: 24px; height: 24px; }
  .kpi-box .value { font-size: 19px; }
  .filter-popover { width: 92vw; left: 4vw; }
  .detail-panel { width: 68vw; }
}

@media (max-width: 1023px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) and (min-width: 781px) {
  /* 重要列を優先し、担当列は詳細パネルで確認する運用とする（カード表示に切り替わる780px以下では対象外） */
  .issue-table th:nth-child(2), .issue-table td:nth-child(2) { display: none; }
  .issue-table th, .issue-table td { padding-left: 14px; padding-right: 14px; }
}

/* ============ レスポンシブ：狭い画面ではサイドバーをドロワー化・テーブルをカード表示に ============ */
@media (max-width: 780px) {
  .main { padding: 14px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .result-header { flex-direction: column; }
  .detail-panel { width: 100vw; }
  .tab-bar { padding: 0 14px; }
  .search-row { padding: 10px 14px; }
  .search-row-count { margin-left: 0; flex-basis: 100%; }
  .filter-popover { left: 4vw; width: 92vw; }
  .filter-popover-row { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; width: 260px;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: 4px 0 16px rgba(0,0,0,.2);
    /* 2026-09-18、ユーザー報告「メニューが固定して動かない」で発覚。ベースの.sidebar
       ルール(overflow: hidden、幅の折りたたみアニメーション用)をそのまま引き継ぐと、
       スマホ幅ではposition: fixedで高さが画面いっぱいに固定されるため、ナビ項目が
       増えて中身が画面の高さを超えると、下の方の項目(ログアウト等)に一切届かなく
       なってしまう。ここだけ縦スクロールを許可する(横方向は折りたたみアニメーションの
       見た目を保つためoverflow-x: hiddenのまま)。 */
    overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  }
  .sidebar-open .sidebar { transform: translateX(0); }
  .mobile-topbar { display: flex; }
  .sidebar-scrim {
    display: none; position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 49;
  }
  .sidebar-open .sidebar-scrim { display: block; }

  .issue-table, .issue-table tbody, .issue-table tr, .issue-table td { display: block; width: 100%; }
  .issue-table thead { position: absolute; left: -9999px; top: -9999px; }
  .issue-table .issue-row {
    border-bottom: 1px solid var(--border); padding: 14px 4px; background: var(--surface);
  }
  .issue-table .issue-row td {
    border: none; padding: 6px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  }
  .issue-table .issue-row td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    font-size: 12px; color: var(--text-secondary); font-weight: 600; flex-shrink: 0; width: 42%;
  }
  .issue-table .issue-row td.case-cell { display: block; }
  .issue-table .issue-row td.case-cell[data-label]::before { content: none; }
  .issue-table .issue-row td.detail-cell {
    justify-content: flex-end; margin-top: 4px; padding-top: 6px;
  }
  .detail-cell { width: auto; }

  /* .issue-tableの狭幅カード表示(display:block化)は担当者×週の一覧性が命の
     このテーブルには不向きなため、通常のtable表示＋横スクロールを維持する
     (「横スクロールまたはカード表示」のいずれかでよいとの指定に基づく選択、2026-08-22)。 */
  .pipeline-table, .pipeline-table tbody, .pipeline-table tr, .pipeline-table td, .pipeline-table th {
    display: revert; width: revert;
  }
  .pipeline-table thead { position: static; left: auto; top: auto; }
  .pipeline-table td { padding: 10px 12px; }
  .pipeline-table th.col-staff, .pipeline-table td.col-staff { min-width: 96px; }
  .pipeline-table th.col-total, .pipeline-table td.col-total { left: 96px; min-width: 56px; }
}

.mobile-topbar-toggle {
  background: none; border: 1px solid var(--border-strong); border-radius: var(--radius-control);
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-primary);
}
.mobile-topbar-logo { height: 28px; width: auto; display: block; }

@media (max-width: 767px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

/* ============ マイページ「使い方ガイド」ツアー（2026-09-05追加。app/static/usage_tour.js
   参照。.tour-overlayは透明なクリックキャッチャー(クリックでスキップ)、暗転自体は
   .tour-spotlightのbox-shadow(スプレッド9999px)で対象要素の周囲だけを覆う「穴あき」
   手法で表現している） ============ */
.tour-overlay { position: fixed; inset: 0; z-index: 100; background: transparent; cursor: pointer; }
.tour-spotlight {
  position: fixed; z-index: 101; pointer-events: none; border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(15,23,42,.6);
  transition: top .25s ease, left .25s ease, width .25s ease, height .25s ease;
}
.tour-tooltip {
  position: fixed; z-index: 102; width: 320px; max-width: calc(100vw - 28px);
  background: var(--surface); border-radius: var(--radius-card);
  box-shadow: 0 12px 32px rgba(23,43,61,.28);
  padding: 16px 18px;
}
.tour-tooltip-progress { font-size: 11.5px; color: var(--text-muted); font-weight: 600; margin-bottom: 6px; }
.tour-tooltip-title { font-size: 14.5px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.tour-tooltip-text { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 14px; }
.tour-tooltip-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tour-tooltip-actions-right { display: flex; gap: 8px; }

/* ============ マイページ「今年の目標を提出する」フォーム（2026-09-05、縦一列で
   長すぎたレイアウトを圧縮。始期日は単独行のまま、6項目は3カラム×2行に） ============ */
.target-form { margin-top: 4px; }
.target-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 16px;
  margin: 0 0 10px;
}
.target-field label {
  display: block; font-size: 12px; color: var(--text-secondary); font-weight: 600;
  margin: 0 0 4px;
}
.target-field-input { display: flex; align-items: center; gap: 6px; }
.target-field-input input[type=number] { width: 100%; max-width: none; min-width: 0; }
.target-field-unit { font-size: 12px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
@media (max-width: 600px) {
  .target-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   マイページ（管理者向け）UI改修（2026-09-05、参照デザイン: mypage-mockup.html）。
   ============================================================ */

/* 要対応バナー（報告者の返信待ちが1件以上ある場合にページ最上部へ表示） */
.page-date-note { white-space: nowrap; align-self: flex-end; }

.mypage-alert-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--warning-bg); border: 1px solid var(--warning-border);
  border-radius: var(--radius-card); padding: 14px 18px; margin-bottom: var(--space-section);
}
.mypage-alert-bar .mypage-alert-icon {
  width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--warning-border);
  display: flex; align-items: center; justify-content: center; color: var(--warning);
}
.mypage-alert-bar .mypage-alert-text { flex: 1; min-width: 200px; }
.mypage-alert-bar .mypage-alert-text strong { color: var(--warning); font-weight: 700; }
.mypage-alert-bar .mypage-alert-text div { color: var(--text-secondary); font-size: 12.5px; margin-top: 2px; }
.mypage-alert-bar .btn { background: var(--warning); border-color: var(--warning); white-space: nowrap; }
.mypage-alert-bar .btn:hover { background: #96590F; border-color: #96590F; }

/* KPIヒーローカード（手数料実績合計・入金予定合計・承認待ち・返信待ちを横並びで大きく表示） */
.kpi-hero-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: var(--space-section); }
.kpi-hero-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 6px;
}
.kpi-hero-card .label { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.kpi-hero-card .value { font-size: 28px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.kpi-hero-card .value small { font-size: 14px; font-weight: 600; color: var(--text-muted); margin-left: 2px; }
.kpi-hero-card .delta { font-size: 12px; color: var(--text-muted); }
.kpi-hero-card.is-warn .value { color: var(--warning); }
.kpi-hero-card.is-warn { border-color: var(--warning-border); }
.kpi-hero-card.is-ok .value { color: var(--primary); }
@media (max-width: 980px) { .kpi-hero-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .kpi-hero-row { grid-template-columns: 1fr; } }

/* マイページ2カラムレイアウト（左:KPI、右:会社からの連絡・スケジュール・アクセス） */
.mypage-cols { display: grid; grid-template-columns: 1.1fr .9fr; gap: 16px; }
@media (max-width: 980px) { .mypage-cols { grid-template-columns: 1fr; } }

/* ファネル段階別到達件数の簡易棒グラフ（KPI仲介全体） */
.funnel-barchart-bars { display: flex; gap: 0; align-items: flex-end; height: 120px; border-bottom: 1px solid var(--border); padding-top: 10px; }
.funnel-barchart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.funnel-barchart-bar { width: 60%; background: var(--primary); border-radius: 5px 5px 0 0; opacity: .9; min-height: 2px; }
.funnel-barchart-col:first-child .funnel-barchart-bar { opacity: 1; }
.funnel-barchart-value { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.funnel-barchart-labels { display: flex; margin-top: 8px; }
.funnel-barchart-labels div { flex: 1; text-align: center; font-size: 11.5px; color: var(--text-secondary); }

/* ============ スケジュール管理（週間カレンダー、2026-09-06追加。ユーザー指定
   「Googleカレンダーのような感じにしてほしい」を受けて、時刻軸に沿って予定を
   絶対配置するタイムグリッド表示に変更。top/height(px)はapp/main.pyのschedule_view()
   がHH:MM文字列から計算し、テンプレート・CSS側では位置計算をしない） ============ */
.gcal-wrap {
  position: relative; /* ドラッグ移動時のローディングオーバーレイの基準にする(2026-09-07追加) */
  border: 1px solid var(--border); border-radius: var(--radius-card);
  overflow: hidden; overflow-x: auto;
}
.gcal-header-row, .gcal-body-row { display: flex; min-width: 640px; }
.gcal-time-col-head { width: 52px; flex-shrink: 0; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); }
.gcal-day-head {
  flex: 1; min-width: 84px; padding: 6px 4px; text-align: center;
  border-bottom: 1px solid var(--border); border-right: 1px solid var(--border);
  background: var(--surface); position: sticky; top: 0;
}
.gcal-day-head:last-child { border-right: none; }
.gcal-day-head .dow { font-size: 11.5px; color: var(--text-secondary); }
.gcal-day-head .num {
  font-size: 15px; font-weight: 700; color: var(--text-primary);
  width: 28px; height: 28px; line-height: 28px; border-radius: 50%; margin: 2px auto 0;
}
.gcal-day-head.is-today .num { background: var(--primary); color: #fff; }
.gcal-day-head.is-saturday .dow, .gcal-day-head.is-saturday .num { color: var(--info); }
.gcal-day-head.is-holiday .dow, .gcal-day-head.is-holiday .num { color: var(--danger); }
.gcal-day-head.is-today.is-saturday .num, .gcal-day-head.is-today.is-holiday .num { color: #fff; } /* 今日はプライマリ丸背景を優先 */
.gcal-scroll { height: 600px; overflow-y: auto; } /* JSがviewportの残り高さに合わせて上書きする(2026-09-07追加) */
.gcal-time-col { width: 52px; flex-shrink: 0; position: relative; border-right: 1px solid var(--border); }
.gcal-hour-label {
  position: absolute; right: 6px; transform: translateY(-7px);
  font-size: 10.5px; color: var(--text-muted); white-space: nowrap;
}
/* PCでは素通りの入れ物(残り幅いっぱいのflexコンテナ)。スマホでは横スライドの
   トラックになる(下のmax-width:700pxブロック参照、2026-09-07追加)。 */
.gcal-day-track { display: flex; flex: 1; min-width: 0; }
.gcal-day-col { flex: 1; min-width: 84px; position: relative; border-right: 1px solid var(--border); }
.gcal-day-col:last-child { border-right: none; }
.gcal-day-col.is-saturday { background: rgba(110,159,193,0.05); }
.gcal-day-col.is-holiday { background: rgba(235,89,103,0.05); }
.gcal-day-col.drag-over { background: var(--primary-light); }
.gcal-hour-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); }
.gcal-now-line { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid var(--danger); z-index: 3; }
.gcal-event {
  /* 2026-10-09、left/widthは重なった予定を横に並べるためtop/heightと一緒に常にインライン
     styleで指定する(app/main.py _assign_event_lanes())。ここでは指定漏れ時の保険のみ持つ。 */
  position: absolute; left: 2px; right: 2px; overflow: hidden;
  background: var(--primary-light); border-left: 3px solid var(--primary); border-radius: 4px;
  padding: 1px 5px; font-size: 11px; line-height: 1.35; cursor: grab; z-index: 2;
}
.gcal-event:hover { box-shadow: 0 1px 4px rgba(0,0,0,0.16); z-index: 4; }
.gcal-event.dragging { opacity: 0.45; cursor: grabbing; }
/* 区分ごとの色分け(ユーザー指摘:タスカルで赤字＝顧客面談、という前提を踏襲) */
.gcal-event.cat-customer_meeting { background: var(--danger-bg); border-left-color: var(--danger); }
.gcal-event.cat-customer_meeting .gcal-event-time { color: var(--danger); }
.gcal-event.cat-task { background: var(--success-bg); border-left-color: var(--success); }
.gcal-event.cat-task .gcal-event-time { color: var(--success); }
.gcal-event.cat-private { background: var(--surface-subtle); border-left-color: var(--text-muted); }
.gcal-event.cat-private .gcal-event-time { color: var(--text-secondary); }
.gcal-event.not-owner { cursor: pointer; opacity: .92; }
/* 他のスタッフの予定を閲覧するモードで、詳細を見せない「予定あり」ブロック
   (2026-09-27追加)。区分の色分けは維持しつつ、クリックできない見た目にする。 */
.gcal-event.is-masked, .gcal-task-chip.is-masked {
  cursor: default; opacity: .6; filter: grayscale(35%);
}
.gcal-event.is-masked:hover { box-shadow: none; }
/* クライアント予約フォームからの仮予定(FP未承認、2026-09-21追加) */
.gcal-event.tentative { border-left-style: dashed; background-image: repeating-linear-gradient(135deg, rgba(0,0,0,0.04) 0 6px, transparent 6px 12px); }
.gcal-event-guest-badge { color: var(--text-muted); font-size: 10px; margin-left: 3px; }
.gcal-event.is-live { box-shadow: 0 0 0 2px var(--success); animation: gcal-live-pulse 1.6s ease-in-out infinite; }
@keyframes gcal-live-pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--success); }
  50% { box-shadow: 0 0 0 4px var(--success-border); }
}
.gcal-event-time { font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }
.gcal-event-loc { color: var(--text-secondary); font-weight: 600; }
.gcal-event-title { color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcal-event-cat-icon { display: inline-flex; vertical-align: -2px; margin-right: 2px; opacity: .7; }
.gcal-event-link { margin-left: 3px; font-weight: 600; }
.gcal-event-actions { position: absolute; top: 0; right: 0; display: flex; gap: 0; }
.gcal-event-join {
  background: none; border: none; color: var(--success); cursor: pointer;
  font-size: 11px; line-height: 1; padding: 2px 3px; display: inline-flex;
}
.gcal-event-join:hover { color: #2f6f2c; }
.gcal-event-delete-form { margin: 0; }
.gcal-event-delete {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 12px; line-height: 1; padding: 2px 4px;
}
.gcal-event-delete:hover { color: var(--danger); }

/* タスク専用の行(2026-09-14追加)。ユーザー指摘「スケジュールに入ってしまっていて
   他人が予約できなくなるのもよくないし、ユーザーがしっかり忘れないように」への対応。
   時間軸の枠には入れず、Googleカレンダーの終日イベント行のように、ヘッダーのすぐ下
   ＝カレンダー上部にチップとして表示することで、他人の予約の空き枠を塞がず、かつ
   目立たせる。 */
.gcal-tasks-row { display: flex; min-width: 640px; border-bottom: 1px solid var(--border); }
.gcal-tasks-label {
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; color: var(--text-muted); writing-mode: vertical-rl;
}
.gcal-tasks-daycol {
  flex: 1; min-width: 84px; border-right: 1px solid var(--border);
  padding: 4px; display: flex; flex-direction: column; gap: 3px;
}
.gcal-tasks-daycol:last-child { border-right: none; }
.gcal-task-chip {
  background: var(--success-bg); border-left: 3px solid var(--success); border-radius: 4px;
  padding: 2px 5px; font-size: 11px; line-height: 1.35; cursor: pointer;
}
.gcal-task-chip:hover { box-shadow: 0 1px 4px rgba(0,0,0,0.16); }
.gcal-task-chip.is-completed { opacity: .55; text-decoration: line-through; }

/* 区分の凡例 */
.gcal-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; font-size: 12px; color: var(--text-secondary); }
.gcal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.gcal-legend .dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.gcal-legend .dot.cat-customer_meeting { background: var(--danger); }
.gcal-legend .dot.cat-meeting { background: var(--primary); }
.gcal-legend .dot.cat-task { background: var(--success); }
.gcal-legend .dot.cat-private { background: var(--text-muted); }

/* 月表示カレンダー(2026-09-18追加、ユーザー指定「月刊カレンダー、週刊カレンダーも
   見れるようにしたい」への対応)。週表示(.gcal-*)とは別の、6週固定のグリッド。 */
.gcal-month-grid { border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; }
.gcal-month-head-row { display: flex; background: var(--surface-subtle); }
.gcal-month-head-cell {
  flex: 1; text-align: center; padding: 6px 0; font-size: 12px; color: var(--text-secondary);
  border-right: 1px solid var(--border);
}
.gcal-month-head-cell:last-child { border-right: none; }
.gcal-month-row { display: flex; border-top: 1px solid var(--border); }
.gcal-month-row:first-child { border-top: none; }
.gcal-month-cell {
  flex: 1; min-height: 96px; min-width: 0; padding: 4px; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit;
}
.gcal-month-cell:last-child { border-right: none; }
.gcal-month-cell:hover { background: var(--surface-subtle); }
.gcal-month-cell.is-saturday { background: rgba(110,159,193,0.05); }
.gcal-month-cell.is-holiday { background: rgba(235,89,103,0.05); }
.gcal-month-cell.is-out-of-month { opacity: .4; }
.gcal-month-cell-date {
  font-size: 12.5px; font-weight: 600; color: var(--text-primary); width: 22px; height: 22px;
  line-height: 22px; text-align: center; border-radius: 50%;
}
.gcal-month-cell.is-today .gcal-month-cell-date { background: var(--primary); color: #fff; }
.gcal-month-cell-events { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.gcal-month-chip {
  font-size: 10.5px; line-height: 1.3; padding: 1px 4px; border-radius: 3px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  background: var(--primary-light); border-left: 2px solid var(--primary); color: var(--text-primary);
}
.gcal-month-chip.cat-customer_meeting { background: var(--danger-bg); border-left-color: var(--danger); }
.gcal-month-chip.cat-task { background: var(--success-bg); border-left-color: var(--success); }
.gcal-month-chip.cat-private { background: var(--surface-subtle); border-left-color: var(--text-muted); }
.gcal-month-chip-more { font-size: 10px; color: var(--text-muted); padding-left: 4px; }

@media (max-width: 700px) {
  /* スマホでは1件ずつのチップは入り切らないため、色付きドットの件数表示だけにする
     (タップすればその日の週表示へ飛べるので、詳細はそちらで見る想定)。 */
  .gcal-month-cell { min-height: 58px; padding: 3px; gap: 1px; }
  .gcal-month-cell-date { font-size: 11px; width: 18px; height: 18px; line-height: 18px; }
  .gcal-month-cell-events { flex-direction: row; flex-wrap: wrap; gap: 3px; margin-top: 2px; }
  .gcal-month-chip {
    width: 6px; height: 6px; padding: 0; border-radius: 50%; border-left: none; font-size: 0; overflow: hidden;
  }
  .gcal-month-chip-more { display: none; }
}

/* スマホでの1日表示切替(2026-09-07追加、ユーザー指摘「カレンダーがスマホで見づらい」
   →Googleカレンダーのスマホアプリのような1日単位の表示を、と参考にした)。
   同日中に、ユーザーがGoogleカレンダー実機の挙動(週の日付が横並びの帯で、タップで
   その日に切り替わり、左右スワイプで1週間ずれる)を示してくれたため、単純な前後矢印
   から曜日circleの帯(週ストリップ)に作り直した。PC幅では帯自体を隠し、従来通り
   週7列をそのまま表示する。 */
.gcal-week-strip { display: none; }
.gcal-active-date-label { display: none; }
@media (max-width: 700px) {
  .gcal-week-strip { display: flex; gap: 2px; margin-bottom: 4px; touch-action: pan-y; }
  #scheduleEventForm .suggest-box { max-height: 150px; }
  .gcal-week-strip-day {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: none; border: none; padding: 4px 0 6px; cursor: pointer; border-radius: var(--radius-control); min-width: 0;
  }
  .gcal-week-strip-day .dow { font-size: 10.5px; color: var(--text-secondary); }
  .gcal-week-strip-day.is-saturday .dow, .gcal-week-strip-day.is-saturday .num { color: var(--info); }
  .gcal-week-strip-day.is-holiday .dow, .gcal-week-strip-day.is-holiday .num { color: var(--danger); }
  .gcal-week-strip-day.is-active.is-saturday .num, .gcal-week-strip-day.is-active.is-holiday .num { color: #fff; }
  .gcal-week-strip-day .num {
    font-size: 14px; font-weight: 700; color: var(--text-primary);
    width: 26px; height: 26px; line-height: 26px; border-radius: 50%;
  }
  /* マークは常に1つ(タップして選択中の日)だけにする(2026-09-07、ユーザー指摘
     「マークされた日付は一つでいい。タップされているところだけにして」)。以前は
     「今日」にも常時マルを付けていたため、選択中の日と2つ同時に強調されていた。 */
  .gcal-week-strip-day.is-active .num { background: var(--primary); color: #fff; }
  .gcal-active-date-label { display: block; font-size: 13px; font-weight: 700; color: var(--text-primary); margin: 2px 0 8px; }
  .gcal-body-row { min-width: 0; }
  .gcal-wrap { overflow-x: hidden; }
  .gcal-scroll { overflow-x: hidden; }
  /* 週ストリップ＋日付ラベルで既に同じ情報を示しているため、曜日ヘッダー行自体は
     スマホでは省いてその分カレンダーの表示領域を広げる(2026-09-07追加)。 */
  .gcal-header-row { display: none; }
  /* 「カレンダーを左右にスクロールしたら、日付がスロットマシンのようにスライドする
     ように」(2026-09-07追加)。7日ぶんを横に並べたまま(700%幅)にしておき、
     JS側でtransform: translateXするだけで、表示中の1日だけがビューポートに収まる
     (はみ出た左右の日はgcal-scrollのoverflow-x:hiddenで隠れる)。以前のdisplay:none
     切り替え方式(即座に切り替わるだけ)から、実際に横滑りするアニメーションに変更。 */
  .gcal-day-track { width: 700%; flex: none; transition: transform .22s ease; } /* flex:1のflex-basis:0%がwidthを無視してしまうためflex:noneで解除 */
  .gcal-day-col { width: calc(100% / 7); flex: none; }
  .gcal-tasks-daycol { width: calc(100% / 7); flex: none; }
  .gcal-time-col-head, .gcal-time-col { width: 44px; }
  .gcal-tasks-label { width: 44px; flex-shrink: 0; }
  .gcal-hour-label { font-size: 10px; right: 4px; }
  .gcal-page-card { padding: 10px 10px 4px; }
}

/* 表示メンバー切替(2026-09-06追加) */
.schedule-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.schedule-toolbar select { min-width: 160px; }
.schedule-toolbar-spacer { flex: 1 1 auto; }
.schedule-readonly-note {
  margin-bottom: 12px; padding: 8px 12px; border-radius: var(--radius-control);
  background: var(--page-bg); color: var(--text-secondary); font-size: 12.5px;
}

/* 予定検索(顧客検索・住所検索で共通、2026-09-06追加) */
.suggest-wrap { position: relative; }
.suggest-box {
  position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 20;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-control);
  box-shadow: 0 4px 14px rgba(0,0,0,0.12); max-height: 220px; overflow-y: auto;
}
.suggest-item { padding: 8px 12px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--border); }
.suggest-item:last-child { border-bottom: none; }
.suggest-item:hover, .suggest-item.active { background: var(--primary-light); }
.suggest-item .sub { color: var(--text-secondary); font-size: 11.5px; margin-top: 1px; }
.schedule-picked-chip {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 5px 10px;
  border-radius: 999px; background: var(--primary-light); color: var(--primary-dark); font-size: 12.5px;
}
.schedule-picked-chip button { background: none; border: none; color: inherit; cursor: pointer; font-size: 12px; padding: 0; }
#scheduleLocationMap { height: 140px; border-radius: var(--radius-control); margin-top: 8px; overflow: hidden; display: none; }
.schedule-guest-list { display: flex; gap: 6px; flex-wrap: wrap; max-height: 120px; overflow-y: auto; padding: 4px 0; }

/* 空き時間検索ページ(2026-09-06追加) */
.find-time-day { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 10px 12px; margin-bottom: 8px; }
.find-time-day-head { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.find-time-slot {
  display: inline-block; margin: 3px 6px 3px 0; padding: 4px 10px; border-radius: 999px;
  background: var(--success-bg); color: var(--success); font-size: 12.5px; font-variant-numeric: tabular-nums;
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
}
/* 2026-10-01追加。ユーザー指摘「空いているスケジュールをクリックしたら予定をいれられる
   ように」への対応でspan→aに変更したため、クリックできると分かるようホバー時に強調する。 */
.find-time-slot:hover { border-color: var(--success); filter: brightness(0.96); }
.find-time-empty { color: var(--text-muted); font-size: 12.5px; }
.find-time-staff-choices { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 16px; }

/* 予定の詳細/編集パネル(既存の.detail-panelパターンを再利用、app/templates/telecall.html等と同じ) */
#scheduleEventForm label { display: block; margin: 12px 0 4px; font-size: 12.5px; color: var(--text-secondary); }
#scheduleEditFieldsBox > label:first-child { margin-top: 0; }
.schedule-join-box {
  margin: 10px 0 4px; padding: 10px 12px; border-radius: var(--radius-control);
  background: var(--page-bg); display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.schedule-join-box.is-live { background: var(--success-bg); border: 1px solid var(--success-border); }
/* 2026-10-01追加。ユーザー指摘「URLないのは、入室できないようにして」への対応。
   会議URL未登録の時は押せるボタンに見えないよう、色を落として禁止カーソルにする。 */
#scheduleJoinLink.is-disabled {
  background: var(--page-bg); color: var(--text-secondary); border: 1px solid var(--border-color);
  cursor: not-allowed; pointer-events: none;
}
/* 2026-09-27追加。予定パネル上部の操作バー(面談開始・報告を書く・編集する)。
   ユーザー指摘「編集の行為と報告が1画面にあるとややこしい」への対応で、既存予定を
   開いた時だけここに集約する(新規登録時は隠す)。 */
.schedule-action-bar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.schedule-action-bar .schedule-join-box { margin: 0; }
.schedule-action-summary { font-size: 13px; font-weight: 700; color: var(--text-primary); }
/* 2026-09-27追加。複数スタッフの週間予定を選んで重ねて表示するドロップダウン。 */
.schedule-staff-view-picker { position: relative; }
.schedule-staff-view-dropdown {
  left: 0; right: auto; width: max-content; min-width: 200px; max-width: 260px;
  max-height: 260px; overflow-y: auto; padding: 8px 10px;
}
.schedule-staff-view-dropdown .disposition-choice { display: block; margin: 4px 0; }
/* 複数人表示中の予定ブロックに、誰の予定かのラベルを出す(2026-09-27追加)。 */
.gcal-event-staff-label { display: block; font-size: 10px; color: var(--text-muted); }

/* ============ マイページ「各機能へのアクセス」タイルグリッド
   (2026-09-06追加、参照デザイン: ia-redesign-mockup.html) ============ */
/* .sectionに下マージンが無く、直後の.card(会社からの連絡等)とすき間なくくっついて
   見えていた(2026-09-07、ユーザー指摘「架電すると会社からの連絡の間に隙間がない」)。
   .cardと同じ余白をとる。 */
.section { margin-bottom: var(--space-card); }
.section-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.section-head h2 { margin: 0; }
.tile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 20px; cursor: pointer; text-decoration: none; color: inherit;
  display: flex; gap: 14px; align-items: flex-start;
}
.tile:hover { border-color: var(--primary); box-shadow: 0 2px 10px rgba(91,79,229,.10); }
.tile .icon-box {
  width: 38px; height: 38px; border-radius: 9px; background: var(--primary-light);
  display: flex; align-items: center; justify-content: center; color: var(--primary);
  flex-shrink: 0;
}
.tile.attn .icon-box { background: var(--warning-bg); color: var(--warning); }
.tile .t-title { font-size: 14.5px; font-weight: 700; margin-bottom: 3px; color: var(--text-primary); }
.tile .t-desc { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.tile .t-badge {
  display: inline-block; margin-top: 6px; font-size: 11px; font-weight: 700;
  background: var(--warning-bg); color: var(--warning); padding: 2px 8px; border-radius: 20px;
}
@media (max-width: 1000px) { .tile-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .tile-grid { grid-template-columns: 1fr; } }

/* ============ ホーム画面への追加を促すバナー(2026-09-07追加、PWA化の一環) ============ */
.pwa-install-banner {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  box-shadow: 0 6px 20px rgba(0,0,0,0.16);
  padding: 10px 12px;
}
.pwa-install-banner-row { display: flex; align-items: center; gap: 10px; }
.pwa-install-banner-icon { border-radius: 8px; display: block; flex-shrink: 0; }
.pwa-install-banner-text { flex: 1; min-width: 0; }
.pwa-install-banner-title { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.pwa-install-banner-desc { font-size: 11.5px; color: var(--text-secondary); margin-top: 1px; line-height: 1.4; }
.pwa-install-banner-close {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 4px; line-height: 1; flex-shrink: 0; display: flex;
}
@media (min-width: 700px) { .pwa-install-banner { max-width: 380px; left: auto; } }

/* iOSの「ホーム画面に追加」手順(実際のiOSのアイコンに似せた図解、2026-09-07追加) */
.pwa-ios-steps { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 9px; }
.pwa-ios-step { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-primary); line-height: 1.4; }
.pwa-ios-step-num {
  width: 18px; height: 18px; border-radius: 50%; background: var(--primary); color: #fff;
  font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.pwa-ios-step-icon { flex-shrink: 0; color: var(--primary); }
.timeline-item.is-highlighted .timeline-body, .timeline-item.is-highlighted .timeline-date { background: var(--primary-light); border-radius: var(--radius-control); }
.progress-row:hover, .progress-row:focus { background: var(--primary-light); }

/* 2026-10-05、ユーザー指摘で発覚。.btn等のdisplay指定がhidden属性を上書きし、会議の予定でも
   「報告を書く」「入室する」が表示され、押しても反応しなかった。hiddenは必ず非表示にする。 */
[hidden] { display: none !important; }
