/* =====================================================================
   SES Manager 共通スタイル
   コーポレートカラー（mediamagic.co.jp より）
     ネイビー #27247B（主） / ライムグリーン #ABCD03（アクセント）
     ピンク #EB6EA5 / イエロー #FFEA00 / ブルー #1263A7 / レッド #D90000
   ===================================================================== */

:root {
  /* ブランドカラー */
  --navy: #27247B;
  --navy-dark: #1A1857;
  --navy-mid: #3A369E;
  --navy-light: #4A47A0;
  --navy-pale: #EEEFF9;
  --lime: #ABCD03;
  --lime-dark: #8AA602;
  --lime-pale: #F2F8D5;
  --pink: #EB6EA5;
  --yellow: #FFEA00;
  --blue: #1263A7;
  --sky: #3E94DC;
  --red: #D90000;
  --red-pale: #FDECEC;
  --orange: #F08300;

  /* ベース */
  --ink: #161616;
  --ink-sub: #555A6B;
  --ink-mute: #8A8FA3;
  --line: #D8DAE6;
  --line-strong: #B9BDD0;
  --bg: #F2F3F9;
  --panel: #FFFFFF;
  --shadow: 0 2px 10px rgba(39, 36, 123, .10);
  --shadow-lg: 0 12px 40px rgba(26, 24, 87, .28);
  --radius: 10px;
  --sidebar-w: 232px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "Yu Gothic UI", "Yu Gothic", "Meiryo", "Hiragino Kaku Gothic ProN", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--blue); }

/* ------------------------------ レイアウト ------------------------------ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #fff;
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.sidebar__brand {
  padding: 18px 18px 14px;
  border-bottom: 3px solid var(--lime);
}
.sidebar__brand strong { font-size: 18px; letter-spacing: .04em; display: block; }
.sidebar__brand span { font-size: 11px; color: #C9CAE8; letter-spacing: .16em; }

.sidebar__nav { flex: 1; overflow-y: auto; padding: 10px 0 20px; }
.sidebar__nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  color: #DCDDEF;
  text-decoration: none;
  border-left: 4px solid transparent;
  font-size: 13.5px;
}
.sidebar__nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar__nav a.is-active {
  background: rgba(171, 205, 3, .16);
  border-left-color: var(--lime);
  color: #fff;
  font-weight: 700;
}
.sidebar__nav .nav-icon { width: 20px; text-align: center; font-size: 15px; }
.sidebar__group {
  padding: 14px 18px 6px;
  font-size: 10.5px;
  letter-spacing: .18em;
  color: #9A9CCB;
}

.sidebar__footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.15);
  font-size: 12px;
  color: #C9CAE8;
}
.sidebar__footer .user-name { color: #fff; font-weight: 700; display: block; }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: var(--panel);
  border-bottom: 2px solid var(--navy);
  padding: 12px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar h1 { font-size: 19px; margin: 0; color: var(--navy); letter-spacing: .02em; }
.topbar .spacer { flex: 1; }
.topbar__sub { font-size: 12px; color: var(--ink-sub); }

.content { padding: 20px 22px 60px; }

/* ------------------------------ パネル ------------------------------ */
.panel {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}
.panel__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, var(--navy-pale), #fff);
}
.panel__head h2 {
  margin: 0;
  font-size: 15px;
  color: var(--navy);
  border-left: 5px solid var(--lime);
  padding-left: 10px;
}
.panel__head .spacer { flex: 1; }
.panel__body { padding: 16px; }
.panel__body--flush { padding: 0; }

/* ------------------------------ ボタン ------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: #fff;
  color: var(--navy);
  border-color: var(--line-strong);
  font-family: inherit;
  white-space: nowrap;
}
.btn:hover { filter: brightness(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn--accent { background: var(--lime); color: #1A1A00; border-color: var(--lime-dark); }
.btn--danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn--ghost { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn--sm { padding: 4px 10px; font-size: 12px; border-width: 1px; }
.btn--block { width: 100%; }

/* ------------------------------ フォーム ------------------------------ */
.field { margin-bottom: 12px; }
.field > label,
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}
.field-label .req {
  color: #fff;
  background: var(--red);
  font-size: 10px;
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 6px;
}
input[type="text"], input[type="number"], input[type="date"], input[type="month"],
input[type="email"], input[type="password"], input[type="search"], input[type="url"],
select, textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(39, 36, 123, .12);
}
textarea { min-height: 84px; resize: vertical; }
select:disabled, input:disabled { background: #F2F2F6; color: var(--ink-mute); }

.grid { display: grid; gap: 12px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.filters .field { margin: 0; min-width: 150px; }
.filters .field--wide { min-width: 240px; flex: 1; }

.hint { font-size: 11.5px; color: var(--ink-sub); margin-top: 4px; }
.error-text { color: var(--red); font-size: 11.5px; margin-top: 3px; font-weight: 700; }

/* ------------------------------ テーブル ------------------------------ */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}
table.data th {
  background: var(--navy);
  color: #fff;
  text-align: left;
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 700;
  border-right: 1px solid rgba(255,255,255,.14);
  position: sticky;
  top: 0;
}
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { background: var(--navy-mid); }
table.data th .sort-mark { color: var(--lime); margin-left: 4px; font-size: 11px; }
table.data td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid #EDEEF5;
}
table.data tbody tr:nth-child(even) { background: #FAFAFD; }
table.data tbody tr:hover { background: var(--lime-pale); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.center { text-align: center; }
table.data .empty { text-align: center; color: var(--ink-mute); padding: 28px; }
table.data .link {
  color: var(--navy);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--lime);
  text-underline-offset: 3px;
}
table.data .subtext { display: block; font-size: 11px; color: var(--ink-sub); }

.inline-select {
  padding: 3px 6px;
  font-size: 12px;
  border-radius: 5px;
  border: 1.5px solid var(--line-strong);
  font-weight: 700;
}

/* ------------------------------ バッジ ------------------------------ */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  background: var(--ink-mute);
  white-space: nowrap;
}
.badge--primary { background: var(--navy); }
.badge--success { background: #4C9A00; }
.badge--info    { background: var(--blue); }
.badge--warn    { background: var(--orange); }
.badge--danger  { background: var(--red); }
.badge--muted   { background: #8A8FA3; }
.badge--accent  { background: var(--lime); color: #1A1A00; }
.badge--outline { background: #fff; color: var(--navy); border: 1.5px solid var(--navy); }

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  margin: 1px 3px 1px 0;
  background: var(--navy-pale);
  color: var(--navy);
  border: 1px solid #C9CBE7;
}
.tag--must { background: var(--navy); color: #fff; border-color: var(--navy); }
.tag--want { background: var(--lime-pale); color: #4D5E00; border-color: var(--lime); }
.tag--free { background: #fff; color: var(--pink); border-color: var(--pink); }

/* 評価グレード（S〜D） */
.grade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 3px 8px;
  border-radius: 5px;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  letter-spacing: .04em;
}
.grade-s  { background: var(--navy); box-shadow: inset 0 -3px 0 var(--lime); }
.grade-ap { background: #2F6FBF; }
.grade-a  { background: var(--sky); }
.grade-am { background: #7FA800; }
.grade-bp { background: var(--lime); color: #1A1A00; }
.grade-b  { background: var(--yellow); color: #4A3B00; }
.grade-bm { background: var(--orange); }
.grade-c  { background: #8A8FA3; }
.grade-d  { background: var(--red); }

/* ------------------------------ タブ ------------------------------ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 3px solid var(--navy);
  margin-bottom: 0;
}
.tabs button {
  border: 2px solid transparent;
  border-bottom: none;
  background: #E7E8F2;
  color: var(--navy);
  font-weight: 700;
  font-size: 13.5px;
  padding: 9px 20px;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-family: inherit;
}
.tabs button.is-active { background: var(--navy); color: #fff; }
.tabs button .count {
  display: inline-block;
  margin-left: 7px;
  background: rgba(255,255,255,.22);
  border-radius: 999px;
  padding: 0 7px;
  font-size: 11px;
}
.tabs button:not(.is-active) .count { background: var(--navy); color: #fff; }

/* ------------------------------ 統計カード ------------------------------ */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: #fff;
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  border-left: 6px solid var(--navy);
}
.stat--lime { border-left-color: var(--lime); }
.stat--pink { border-left-color: var(--pink); }
.stat--blue { border-left-color: var(--blue); }
.stat--red  { border-left-color: var(--red); }
.stat .label { font-size: 12px; color: var(--ink-sub); font-weight: 700; }
.stat .value { font-size: 25px; font-weight: 800; color: var(--navy); line-height: 1.25; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 13px; font-weight: 700; margin-left: 2px; }
.stat .sub { font-size: 11.5px; color: var(--ink-mute); }

/* ------------------------------ モーダル ------------------------------ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 60, .55);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px;
  overflow-y: auto;
  z-index: 100;
}
.modal-backdrop.is-open { display: flex; }
.modal {
  background: #fff;
  width: min(980px, 100%);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal--wide { width: min(1180px, 100%); }
.modal--narrow { width: min(560px, 100%); }
.modal__head {
  background: var(--navy);
  color: #fff;
  padding: 13px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 4px solid var(--lime);
}
.modal__head h3 { margin: 0; font-size: 16px; }
.modal__head .spacer { flex: 1; }
.modal__head .close {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,.5);
  color: #fff;
  width: 28px; height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.modal__body { padding: 18px; max-height: calc(100vh - 220px); overflow-y: auto; }
.modal__foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: #FAFAFD;
}

.section-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--navy);
  margin: 18px 0 10px;
  padding: 5px 0 5px 10px;
  border-left: 5px solid var(--lime);
  background: linear-gradient(90deg, var(--navy-pale), transparent);
}
.section-title:first-child { margin-top: 0; }

/* 明細・定義リスト */
dl.detail { display: grid; grid-template-columns: 130px 1fr; gap: 0; margin: 0; font-size: 13px; }
dl.detail dt {
  background: var(--navy-pale);
  color: var(--navy);
  font-weight: 700;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
}
dl.detail dd { margin: 0; padding: 7px 10px; border-bottom: 1px solid var(--line); }

/* タイムライン（営業記録・フォロー面談・承認履歴） */
.timeline { list-style: none; margin: 0; padding: 0 0 0 6px; }
.timeline li {
  position: relative;
  padding: 0 0 14px 20px;
  border-left: 3px solid var(--navy-pale);
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -8px; top: 3px;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--lime);
  border: 3px solid var(--navy);
}
.timeline .when { font-size: 12px; font-weight: 700; color: var(--navy); }
.timeline .what { font-size: 13px; }
.timeline .who { font-size: 11.5px; color: var(--ink-sub); }

/* トースト */
.toast-area {
  position: fixed;
  right: 18px; bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}
.toast {
  background: var(--navy);
  color: #fff;
  padding: 11px 16px;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 700;
  border-left: 6px solid var(--lime);
  max-width: 420px;
}
.toast--error { background: var(--red); border-left-color: #7A0000; }
.toast--warn { background: var(--orange); border-left-color: #8A4B00; }

/* ローディング・空状態 */
.loading { padding: 40px; text-align: center; color: var(--ink-sub); font-weight: 700; }
.empty-state { padding: 40px; text-align: center; color: var(--ink-mute); }

/* 金額表示 */
.money { font-variant-numeric: tabular-nums; font-weight: 700; }
.money--in { color: var(--blue); }
.money--out { color: var(--navy); }
.money--profit { color: #3F7E00; }
.money--loss { color: var(--red); }

.rate-bar {
  display: inline-block;
  height: 7px;
  border-radius: 4px;
  background: var(--lime);
  vertical-align: middle;
  margin-left: 6px;
}

/* ログイン画面 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 55%, #131240 100%);
  padding: 24px;
}
.login-card {
  background: #fff;
  width: min(420px, 100%);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.login-card__head {
  padding: 26px 26px 18px;
  border-bottom: 5px solid var(--lime);
}
.login-card__head strong { font-size: 24px; color: var(--navy); display: block; letter-spacing: .02em; }
.login-card__head span { font-size: 12px; color: var(--ink-sub); letter-spacing: .12em; }
.login-card__body { padding: 22px 26px 26px; }
.login-demo {
  margin-top: 16px;
  background: var(--navy-pale);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 11.5px;
  color: var(--navy);
  line-height: 1.8;
}

/* 承認フロー */
.flow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.flow__step {
  border: 2px solid var(--line-strong);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  background: #fff;
  min-width: 120px;
}
.flow__step.is-approved { border-color: #4C9A00; background: #F1F8E6; }
.flow__step.is-pending { border-color: var(--orange); background: #FFF6E9; }
.flow__step.is-rejected { border-color: var(--red); background: var(--red-pale); }
.flow__step strong { display: block; color: var(--navy); }
.flow__arrow { color: var(--navy); font-weight: 800; }

/* AI取り込み結果 */
.ai-box {
  border: 2px dashed var(--lime);
  border-radius: 10px;
  padding: 14px;
  background: var(--lime-pale);
}
.ai-field-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 14px; font-size: 12.5px; }
.ai-field-list div { display: flex; gap: 8px; }
.ai-field-list .k { color: var(--navy); font-weight: 700; min-width: 100px; }
.conf {
  font-size: 10.5px;
  padding: 0 5px;
  border-radius: 3px;
  background: #fff;
  border: 1px solid var(--lime-dark);
  color: #5D7200;
  font-weight: 700;
}
.conf--low { border-color: var(--orange); color: var(--orange); }

.split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1200px) { .split { grid-template-columns: 1fr; } }

.legend { display: flex; flex-wrap: wrap; gap: 8px; }
.legend div { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-sub); }

.checklist { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checklist label { display: flex; align-items: center; gap: 5px; font-size: 12.5px; }
.checklist input { width: auto; }

.items-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.items-table th {
  background: var(--navy-pale);
  color: var(--navy);
  padding: 7px;
  font-size: 12px;
  border: 1px solid var(--line);
}
.items-table td { border: 1px solid var(--line); padding: 4px; }
.items-table input { padding: 5px 7px; font-size: 12.5px; }

/* ------------------------------ ツールチップ ------------------------------ */
/* 吹き出しは body 直下に描画するため、パネルや表の overflow に切られない */
[data-tip] { cursor: help; }
button[data-tip], a[data-tip], th[data-tip] { cursor: pointer; }
.tooltip-bubble {
  position: fixed;
  z-index: 500;
  max-width: 300px;
  background: var(--navy-dark);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  border-left: 4px solid var(--lime);
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.65;
  white-space: pre-line;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transition: opacity .12s ease;
  pointer-events: none;
}
.tooltip-bubble.is-visible { opacity: 1; visibility: visible; }

/* ラベル横のヘルプアイコン */
.help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  margin-left: 5px;
  cursor: help;
  vertical-align: middle;
}
table.data th .help { background: var(--lime); color: #1A1A00; }

/* ---------------- ファイルのドロップゾーン（CSV・スキルシート・案件票） ---------------- */
.drop-zone {
  border: 3px dashed var(--navy-light);
  border-radius: 12px;
  background: var(--navy-pale);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.drop-zone:hover { background: #E4E6F6; }
.drop-zone.is-over {
  border-color: var(--lime-dark);
  background: var(--lime-pale);
}
.drop-zone__icon {
  font-size: 30px;
  color: var(--navy);
  font-weight: 700;
  line-height: 1;
  margin-bottom: 8px;
}
.drop-zone__file { margin-top: 10px; font-size: 12.5px; color: var(--navy); }

/* ファイルを選択したあとの状態 */
.drop-zone.is-selected {
  border-style: solid;
  border-color: var(--lime-dark);
  background: var(--lime-pale);
}
.drop-zone.is-selected .drop-zone__icon { color: var(--lime-dark); }
.drop-zone.is-selected .drop-zone__file { font-weight: 700; }

/* モーダル内で使うときは余白を詰める */
.field .drop-zone { padding: 18px 14px; }
.field .drop-zone__icon { font-size: 24px; margin-bottom: 4px; }

/* ------------------------------ 横断検索（ヘッダー） ------------------------------ */
.global-search { position: relative; width: min(360px, 34vw); }
.global-search input {
  width: 100%;
  padding: 7px 12px;
  border: 2px solid var(--navy-pale);
  border-radius: 999px;
  background: #F7F8FC;
  font-size: 13px;
}
.global-search input:focus {
  background: #fff;
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(171, 205, 3, .22);
}
.global-search__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(520px, 90vw);
  max-height: 70vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  border-top: 4px solid var(--lime);
  z-index: 60;
}
.global-search__group { border-bottom: 1px solid var(--line); padding: 6px 0; }
.global-search__group:last-child { border-bottom: 0; }
.global-search__label {
  display: flex;
  justify-content: space-between;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--navy);
  background: var(--navy-pale);
  letter-spacing: .08em;
}
.global-search__item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 14px;
  text-decoration: none;
  color: var(--ink);
  border-left: 4px solid transparent;
}
.global-search__item:hover { background: var(--lime-pale); border-left-color: var(--lime); }
.global-search__item strong { display: block; font-size: 13px; }
.global-search__badge {
  flex: 0 0 auto;
  background: var(--navy);
  color: #fff;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  margin-top: 2px;
  min-width: 56px;
  text-align: center;
}
.global-search__sub { font-size: 11.5px; color: var(--ink-sub); }
.global-search__empty { padding: 18px; text-align: center; color: var(--ink-mute); font-size: 13px; }

/* ハンバーガー（狭い画面のみ表示） */
.nav-toggle {
  display: none;
  background: var(--navy);
  color: #fff;
  border: 0;
  border-radius: 6px;
  width: 36px;
  height: 34px;
  font-size: 17px;
  cursor: pointer;
}
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 60, .45);
  z-index: 35;
}
.nav-overlay.is-visible { display: block; }

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

/* ------------------------------ レスポンシブ ------------------------------ */
@media (max-width: 1200px) {
  .global-search { width: min(300px, 30vw); }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 6px 0 24px rgba(0,0,0,.25);
  }
  .sidebar.is-open { transform: translateX(0); }
  .main { margin-left: 0; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }

  .topbar { flex-wrap: wrap; gap: 8px 10px; padding: 10px 14px; }
  .topbar h1 { font-size: 17px; }
  .topbar__sub { display: none; }
  .global-search { order: 3; width: 100%; }
  .page-actions { order: 4; width: 100%; justify-content: flex-start; }

  .content { padding: 14px 14px 60px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .split { grid-template-columns: 1fr; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .filters .field, .filters .field--wide { min-width: 100%; }
  .filters .btn { flex: 1; }

  .modal__body { max-height: calc(100vh - 180px); }
  .modal, .modal--wide, .modal--narrow { width: 100%; }
  .modal-backdrop { padding: 12px 8px; }

  dl.detail { grid-template-columns: 100px 1fr; }
  .tabs { overflow-x: auto; }
  .tabs button { padding: 8px 14px; font-size: 12.5px; white-space: nowrap; }
}

@media (max-width: 600px) {
  body { font-size: 13px; }
  .stats { grid-template-columns: 1fr; }
  .stat .value { font-size: 21px; }
  table.data { font-size: 12px; }
  table.data th, table.data td { padding: 7px 8px; }
  .panel__head { flex-wrap: wrap; }
  .btn { padding: 6px 11px; font-size: 12.5px; }
  .login-card__head strong { font-size: 21px; }
  /* 狭い画面ではツールチップが画面外に出るため非表示にする */
  [data-tip]::after, [data-tip]::before { display: none; }
}

/* 印刷時は画面要素を隠す */
@media print {
  .sidebar, .topbar, .nav-overlay, .toast-area { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; }
}

/* =====================================================================
   UI調整（入力欄の高さ統一 / 横スクロールの明示 / ダッシュボードの整列）
   ===================================================================== */

/* ---- 入力欄とプルダウンの高さを揃える ---- */
input[type="text"], input[type="number"], input[type="date"], input[type="month"],
input[type="email"], input[type="password"], input[type="search"], input[type="url"],
input[type="file"], select {
  height: 36px;
  padding: 0 10px;
  line-height: 34px;
  vertical-align: middle;
}
select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--navy) 50%),
                    linear-gradient(135deg, var(--navy) 50%, transparent 50%);
  background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
input[type="file"] { padding: 4px 8px; line-height: 26px; }
textarea { padding: 8px 10px; line-height: 1.6; }
.filters .btn { height: 36px; }
.inline-select { height: 30px; line-height: 28px; padding: 0 22px 0 8px; background-position: calc(100% - 12px) 13px, calc(100% - 8px) 13px; }
.items-table input, .items-table select { height: 32px; line-height: 30px; font-size: 12.5px; }

/* ---- 横スクロールできることを分かるようにする ---- */
.table-wrap {
  position: relative;
  overflow-x: auto;
  scrollbar-color: var(--navy-light) var(--navy-pale);
  scrollbar-width: thin;
}
.table-wrap::-webkit-scrollbar { height: 12px; }
.table-wrap::-webkit-scrollbar-track { background: var(--navy-pale); border-radius: 6px; }
.table-wrap::-webkit-scrollbar-thumb {
  background: var(--navy-light);
  border-radius: 6px;
  border: 3px solid var(--navy-pale);
}
.table-wrap::-webkit-scrollbar-thumb:hover { background: var(--navy); }

/* スクロール可能な側にグラデーションの影を出す */
.table-scroll {
  position: relative;
}
.table-scroll::after,
.table-scroll::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 12px;
  width: 26px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease;
  z-index: 3;
}
.table-scroll::after {
  right: 0;
  background: linear-gradient(to left, rgba(39,36,123,.20), rgba(39,36,123,0));
}
.table-scroll::before {
  left: 0;
  background: linear-gradient(to right, rgba(39,36,123,.20), rgba(39,36,123,0));
}
.table-scroll.can-scroll-right::after { opacity: 1; }
.table-scroll.can-scroll-left::before { opacity: 1; }

/* 「横にスクロールできます」のヒント */
.scroll-hint {
  display: none;
  align-items: center;
  gap: 6px;
  margin: 8px 16px 0;
  padding: 5px 12px;
  background: var(--lime-pale);
  border-left: 4px solid var(--lime);
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 700;
  color: #4D5E00;
  width: fit-content;
}
.scroll-hint.is-visible { display: inline-flex; }
.scroll-hint .arrow { animation: scroll-nudge 1.4s ease-in-out infinite; }
@keyframes scroll-nudge {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(4px); }
}

/* ---- ダッシュボードの整列 ---- */
.stats { align-items: stretch; }
.stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 92px;
}
.stat .label {
  min-height: 19px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat .value { margin: 2px 0; white-space: nowrap; }
.stat .sub { min-height: 17px; }

.split { align-items: stretch; }
.split > .panel { display: flex; flex-direction: column; margin-bottom: 0; }
.split > .panel > .panel__body,
.split > .panel > div:last-child { flex: 1; }
.split { margin-bottom: 18px; }

/* ダッシュボードのタイムラインを詰めすぎない */
.panel__body .timeline li { padding-bottom: 12px; }
.panel__body .section-title:first-child { margin-top: 0; }

/* 参照ビュー（詳細モーダル） */
.detail-view dl.detail { margin-bottom: 4px; }
.detail-view .raw-text {
  background: #FAFAFD;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.8;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
}
.detail-view .timeline { margin-top: 4px; }

/* ヘッダーはツールチップの計算に影響するため位置指定のみ残す */
.topbar, .panel__head { position: relative; }


/* =====================================================================
   ダッシュボード（バランス調整）
   ===================================================================== */
.stats--dashboard {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.stats--dashboard .stat {
  min-height: 104px;
  border-left-width: 6px;
}
.stats--dashboard .stat .label {
  font-size: 11.5px;
  letter-spacing: .01em;
  min-height: 18px;
}
.stats--dashboard .stat .value {
  font-size: 23px;
  letter-spacing: -.01em;
  margin-top: 4px;
}
.stats--dashboard .stat .sub { margin-top: 3px; min-height: 16px; }

/* 月次サマリの比率バー */
.month-chart { display: flex; flex-direction: column; gap: 10px; }
.month-chart__row {
  display: grid;
  grid-template-columns: 96px 1fr 132px;
  align-items: center;
  gap: 12px;
}
.month-chart__label { font-size: 12.5px; font-weight: 700; color: var(--navy); }
.month-chart__bars { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.month-chart__bar {
  height: 20px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  min-width: 90px;
  transition: width .3s ease;
}
.month-chart__bar span { font-size: 11px; font-weight: 700; white-space: nowrap; }
.month-chart__bar--in  { background: var(--navy); }
.month-chart__bar--in span { color: #fff; }
.month-chart__bar--out { background: var(--pink); }
.month-chart__bar--out span { color: #fff; }
.month-chart__profit { text-align: right; }
.month-chart__profit .money { font-size: 14px; }
.month-chart__profit .subtext { display: block; font-size: 10.5px; color: var(--ink-mute); }

/* アラートカード（3枚を同じ高さで並べる） */
.dashboard-alerts { margin-bottom: 18px; align-items: stretch; }
.dashboard-alerts .alert-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}
.dashboard-alerts .alert-card .panel__body { flex: 1; min-height: 150px; }
.dashboard-alerts .timeline li { padding-bottom: 10px; }
.dashboard-alerts .timeline li:last-child { padding-bottom: 0; }
.dashboard-alerts .what { font-size: 12.5px; }
.dashboard-alerts .who { font-size: 11px; }

/* 直近の営業記録はカード並びにする */
.activity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.activity-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--lime);
  border-radius: 8px;
  padding: 10px 12px;
  background: #FAFAFD;
}
.activity-card .when { font-size: 11.5px; font-weight: 700; color: var(--navy); }
.activity-card .what { font-size: 13px; margin: 2px 0; }
.activity-card .who { font-size: 11px; color: var(--ink-sub); }

@media (max-width: 1200px) {
  .stats--dashboard { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-alerts { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .stats--dashboard { grid-template-columns: 1fr; }
  .month-chart__row { grid-template-columns: 74px 1fr; }
  .month-chart__profit { grid-column: 2; text-align: left; }
}


/* ==================== 追加機能（稼働時間・提案・入金・設定・ガイド） ==================== */

/* 表の中で直接入力する欄 */
.input-inline {
  width: 100%;
  min-width: 90px;
  padding: 5px 8px;
  font-size: 13px;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
  background: #fff;
}
.input-inline:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(39,36,123,.12); }
table.data td .input-inline { text-align: right; }
table.data td input[data-note].input-inline { text-align: left; }

/* 画面内の補足文 */
.note-text {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--ink-sub);
  background: #F6F7FB;
  border-left: 3px solid var(--lime);
  padding: 8px 10px;
  border-radius: 0 6px 6px 0;
}

/* チェックボックス付きラベル */
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--navy); }

/* パイプライン（提案履歴）のカンバン表示 */
.pipeline {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.pipeline__col {
  background: #F6F7FB;
  border: 1px solid var(--line);
  border-top: 3px solid var(--navy);
  border-radius: 8px;
  padding: 8px;
  min-height: 90px;
}
.pipeline__col.is-won { border-top-color: var(--lime); }
.pipeline__col.is-lost { border-top-color: var(--red); }
.pipeline__head { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; }
.pipeline__head strong { font-size: 12.5px; color: var(--navy); }
.pipeline__head span { font-size: 16px; font-weight: 800; margin-left: auto; }
.pipeline__card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 12px;
}
.pipeline__card:hover { border-color: var(--navy); box-shadow: 0 2px 6px rgba(39,36,123,.12); }
.pipeline__card strong { display: block; font-size: 12.5px; }
.pipeline__card span { display: block; color: var(--ink-sub); font-size: 11px; }
.pipeline__empty { font-size: 11.5px; color: var(--ink-mute); text-align: center; padding: 10px 0; }

/* 重複検知の警告 */
.dup-warning {
  border: 1.5px solid var(--pink);
  background: #FDF2F7;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 12.5px;
}
.dup-warning strong { color: #A03A68; }
.dup-warning ul { margin: 6px 0 0; padding-left: 18px; }
.dup-warning li { margin-bottom: 3px; }
.dup-level { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; color: #fff; margin-left: 6px; }
.dup-level--high { background: var(--red); }
.dup-level--medium { background: var(--blue); }

/* 設定画面 */
.setting-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.event-list { display: grid; gap: 8px; margin-top: 4px; }
.event-list label {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px;
  font-size: 12.5px; background: #fff; cursor: pointer;
}
.event-list label:hover { border-color: var(--navy); }
.event-list input { width: 16px; height: 16px; accent-color: var(--navy); }

/* 使い方ガイド */
.guide-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.guide-nav a {
  font-size: 12.5px; font-weight: 700; color: var(--navy);
  border: 1.5px solid var(--line-strong); border-radius: 999px; padding: 5px 12px;
  text-decoration: none; background: #fff;
}
.guide-nav a:hover { border-color: var(--navy); background: var(--lime-pale); }
.guide-section { scroll-margin-top: 70px; }
.guide-section h3 {
  font-size: 15px; margin: 0 0 4px; color: var(--navy);
  padding-left: 9px; border-left: 4px solid var(--lime);
}
.guide-section .lead { font-size: 12.5px; color: var(--ink-sub); margin: 0 0 10px; }
.guide-steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.guide-steps li {
  position: relative; padding: 0 0 10px 30px; font-size: 13px; line-height: 1.7;
  border-left: 2px solid var(--line); margin-left: 10px;
}
.guide-steps li:last-child { border-left-color: transparent; padding-bottom: 0; }
.guide-steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: -11px; top: 0;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--navy); color: #fff;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.guide-tip {
  font-size: 12px; background: var(--lime-pale); border-radius: 6px;
  padding: 8px 10px; margin-top: 8px; color: #3B4A00;
}
.guide-faq dt { font-weight: 700; font-size: 13px; margin-top: 10px; color: var(--navy); }
.guide-faq dd { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-sub); line-height: 1.7; }

@media (max-width: 1100px) {
  .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* AI連携の稼働状況カード */
.ai-status {
  border: 1px solid var(--line);
  border-left: 4px solid var(--lime-dark);
  border-radius: 8px;
  padding: 10px 14px;
  background: #FBFCFE;
}
.ai-status.is-warn { border-left-color: var(--red); background: var(--red-pale); }
.ai-status__label { font-size: 11px; color: var(--ink-sub); margin-right: 8px; }
.ai-status strong { font-size: 14px; color: var(--navy); }
.ai-status .hint { margin-top: 4px; }
.ai-status code {
  background: #EDEFF7; border-radius: 4px; padding: 1px 6px; font-size: 11.5px;
}
