/* ===========================================
   GANECCI Staff Manager - 共通スタイル
   =========================================== */

:root {
  /* デフォルト: ダーク (月モード) */
  --bg: #0d1018;
  --bg-2: #161a25;
  --bg-3: #1f2433;
  --line: #2a3045;
  --text: #ecf0f9;
  --text-2: #98a2bd;
  --text-3: #6c7596;
  --accent: #5b8cff;            /* GANECCI primary - ロイヤルブルー */
  --accent-2: #3d6ee0;
  --gold: #f0b73a;              /* GANECCI accent - ゴールド */
  --ok: #4ade80;
  --warn: #fbbf24;
  --ng: #f87171;
  --purple: #a78bfa;
  --pink: #f472b6;
  --teal: #2dd4bf;
  --shadow: 0 4px 28px rgba(0, 0, 0, .45);
  --radius: 10px;
}

/* ===== ☀️ ライトモード (太陽モード) — 2026-05-21 礒貝CEO指示 ===== */
body.theme-light {
  --bg: #f5f7fa;
  --bg-2: #ffffff;
  --bg-3: #eef1f8;
  --line: #d6dbe6;
  --text: #1a1f2e;
  --text-2: #4b5269;
  --text-3: #7e859b;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --gold: #c98a14;
  --ok: #15803d;
  --warn: #ca8a04;
  --ng: #dc2626;
  --purple: #7c3aed;
  --pink: #db2777;
  --teal: #0d9488;
  --shadow: 0 4px 18px rgba(15, 23, 42, .12);
}
body.theme-light img, body.theme-light .logo img { filter: none; }
body.theme-light .badge { filter: contrast(1.05); }
body.theme-light input, body.theme-light textarea, body.theme-light select {
  background: #ffffff !important; color: #1a1f2e !important; border-color: #c5cad6 !important;
}
body.theme-light .modal { background: #ffffff !important; color: #1a1f2e !important; }
body.theme-light .modal-bg { background: rgba(15, 23, 42, .35) !important; }
body.theme-light header { background: #ffffff !important; border-color: var(--line) !important; }
body.theme-light .user-pill { background: var(--bg-3) !important; color: var(--text) !important; }
body.theme-light pre, body.theme-light code { background: #f0f3f9 !important; color: #1a1f2e !important; }

/* ☀️🌙 テーマ切替トグルボタン */
.theme-toggle {
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  transition: all .15s;
}
.theme-toggle:hover { background: var(--accent); color: #fff; transform: scale(1.05); }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* 2026-05-28 礒貝CEO指示 [強化]: スマホ限定で横にグラグラ動かない & モーダルが下までスクロール可能 */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden !important;
    overscroll-behavior-x: none;
    width: 100%;
    max-width: 100vw;
    touch-action: pan-y;
  }
  /* 全要素が画面幅を超えないように (横ブレ抑制) */
  body * {
    max-width: 100vw;
  }
  /* タイムテーブル等の横スクロール「するべき」要素は例外 */
  .table-wrap, #rooms-timetable, #emp-rooms-timetable, #rooms-month-cal,
  .table-wrap *, #rooms-timetable *, #emp-rooms-timetable *, #rooms-month-cal * {
    max-width: none;
    touch-action: pan-x pan-y;
  }
  /* ===== モーダルを「画面全体スクロール可能」に確定 ===== */
  .modal-bg.show {
    display: block !important;
    place-items: unset !important;
    align-items: unset !important;
    justify-content: unset !important;
    padding: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y !important;
    /* iOS Safari の URL バーで隠れないよう、画面外余白を確保 */
    min-height: 100vh;
    min-height: 100dvh;
  }
  .modal {
    width: 100% !important;
    max-width: 100% !important;
    min-height: auto !important;
    max-height: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 16px !important;
    /* 下に大きな余白: 登録ボタンが iOS の Safari URL バー / ホームインジケーターに隠れないように */
    padding-bottom: calc(120px + env(safe-area-inset-bottom)) !important;
    overflow: visible !important;
    touch-action: pan-y !important;
    animation: none !important;
  }
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ====== ヘッダー ====== */
header.app-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15, 17, 23, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
header .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 15px; letter-spacing: .03em;
}
header .brand-logo {
  width: 28px; height: 28px; border-radius: 6px;
  background: linear-gradient(135deg, var(--accent) 0%, #2c4ba8 60%, var(--gold) 130%);
  display: grid; place-items: center; color: white; font-weight: 800; font-size: 13px;
  box-shadow: 0 0 0 1px rgba(240,183,58,.3), inset 0 1px 0 rgba(255,255,255,.15);
}
header nav { display: flex; gap: 6px; }
header nav a {
  padding: 6px 12px; border-radius: 6px; color: var(--text-2); font-size: 13px;
}
header nav a.active { background: var(--bg-3); color: var(--text); }
header nav a:hover { background: var(--bg-3); text-decoration: none; }
header .user-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; background: var(--bg-3); border-radius: 20px; font-size: 13px;
  /* 2026-06-11 修正: スマホ幅 (360〜414px) で「ログアウト」「氏名」が 2 行に割れる崩れを防ぐ。
     ピル内は 1 行で表示し、入りきらない場合はピル自体を横スクロール可能にする。 */
  white-space: nowrap; flex-shrink: 0; max-width: 100%;
}
header .user-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
header .user-pill .avatar { flex-shrink: 0; }
header .user-pill #logout-btn { white-space: nowrap; flex-shrink: 0; }

/* ====== レイアウト ====== */
.container { max-width: 1400px; margin: 0 auto; padding: 24px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ====== カード ====== */
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card h2, .card h3 {
  margin: 0 0 12px;
  font-size: 14px;
  letter-spacing: .04em;
  color: var(--text-2);
  text-transform: uppercase;
  font-weight: 600;
}
.card h2 { font-size: 15px; color: var(--text); text-transform: none; }

/* ====== KPI ====== */
.kpi {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.kpi .label { font-size: 11px; color: var(--text-3); letter-spacing: .08em; text-transform: uppercase; }
.kpi .value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.kpi .delta { font-size: 11px; color: var(--text-2); margin-top: 2px; }
/* クリッカブル KPI(詳細モーダル誘導)*/
.kpi.clickable { cursor: pointer; transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease; user-select: none; }
.kpi.clickable:hover { border-color: var(--accent); transform: translateY(-1px); background: linear-gradient(135deg, var(--bg-2), rgba(91,140,255,0.05)); }
.kpi.clickable:active { transform: translateY(0); }

/* 本日休暇中メンバーカード(視覚的区別 = 業務中 8 / 休暇 2 が一目で分かる)*/
.member-card.on-leave { opacity: 0.62; border-color: var(--gold) !important; background: linear-gradient(135deg, rgba(240,183,58,0.06), rgba(91,140,255,0.02)) !important; position: relative; }
.member-card.on-leave .leave-banner { background: linear-gradient(135deg, var(--gold), #f5cc4a); color: #1a1410; padding: 6px 12px; border-radius: 6px; font-size: 13px; font-weight: 700; margin-bottom: 10px; text-align: center; line-height: 1.4; box-shadow: 0 2px 8px rgba(240,183,58,0.25); }
.member-card.on-leave .workload-bar { filter: grayscale(0.4); }

/* ===== 🚀 グローバル FAB(全ページ共通フローティング) ===== */
#global-fab-root { position: fixed; right: 20px; bottom: 20px; z-index: 9000; }
.fab-button { width: 56px; height: 56px; border-radius: 50%; border: none; background: linear-gradient(135deg, #5b8cff, #f0b73a); color: #fff; font-size: 28px; font-weight: 700; cursor: pointer; box-shadow: 0 6px 20px rgba(91,140,255,0.45), 0 2px 6px rgba(0,0,0,0.3); display: grid; place-items: center; transition: transform 0.18s ease, box-shadow 0.18s ease; line-height: 1; }
.fab-button:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 10px 28px rgba(240,183,58,0.45), 0 4px 10px rgba(0,0,0,0.3); }
.fab-button.open { transform: rotate(45deg); background: linear-gradient(135deg, #f0b73a, #5b8cff); }
.fab-button .fab-icon-plus { display: block; transition: transform 0.18s ease; }
.fab-menu { position: absolute; bottom: 72px; right: 0; width: 320px; max-height: 70vh; overflow-y: auto; background: var(--bg, #0d1018); border: 1px solid var(--border, #1f2333); border-radius: 14px; box-shadow: 0 16px 40px rgba(0,0,0,0.6); padding: 10px; opacity: 0; transform: translateY(10px) scale(0.96); transform-origin: bottom right; pointer-events: none; transition: opacity 0.18s ease, transform 0.18s ease; }
.fab-menu.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.fab-menu-header { padding: 8px 12px 10px; border-bottom: 1px solid var(--border, #1f2333); margin-bottom: 6px; }
.fab-menu-title { font-weight: 700; font-size: 13px; color: var(--text, #e6e8ef); }
.fab-menu-sub { font-size: 10px; color: var(--text-2, #9ca3af); margin-top: 2px; letter-spacing: 0.04em; }
.fab-menu-list { display: flex; flex-direction: column; gap: 2px; }
.fab-menu-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; text-decoration: none; color: var(--text, #e6e8ef); transition: background 0.12s ease; }
.fab-menu-item:hover { background: linear-gradient(135deg, rgba(91,140,255,0.14), rgba(240,183,58,0.06)); }
.fab-menu-item .fab-emoji { font-size: 20px; flex-shrink: 0; width: 28px; text-align: center; }
.fab-menu-item .fab-text { flex: 1; min-width: 0; }
.fab-menu-item .fab-label { font-weight: 600; font-size: 13px; }
.fab-menu-item .fab-desc { font-size: 10px; color: var(--text-2, #9ca3af); margin-top: 1px; line-height: 1.3; }
@media (max-width: 600px) {
  #global-fab-root { right: 14px; bottom: 14px; }
  .fab-button { width: 52px; height: 52px; font-size: 26px; }
  .fab-menu { width: calc(100vw - 28px); max-width: 360px; right: -2px; }
}

/* 承認待ちパルスバッジ(自分が承認者の pending 件数)*/
.pulse-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: linear-gradient(135deg, var(--gold), #f5cc4a); color: #1a1410; font-weight: 700; font-size: 11px; margin-left: 6px; box-shadow: 0 0 0 0 rgba(240,183,58,0.7); animation: pulse-glow 1.6s infinite; }
.pulse-badge .pulse-dot { width: 6px; height: 6px; border-radius: 50%; background: #1a1410; }
@keyframes pulse-glow {
  0%   { box-shadow: 0 0 0 0   rgba(240,183,58,0.7); transform: scale(1); }
  50%  { box-shadow: 0 0 0 8px rgba(240,183,58,0);   transform: scale(1.06); }
  100% { box-shadow: 0 0 0 0   rgba(240,183,58,0);   transform: scale(1); }
}

/* タイムブロック クリック → スケジュール追加(本日のタイムブロック)*/
.timeline-block.empty-slot { cursor: pointer; transition: background 0.12s ease; border-radius: 6px; min-height: 36px; display: flex; align-items: center; }
.timeline-block.empty-slot:hover { background: rgba(91,140,255,0.10); }
.timeline-block.has-slot { cursor: pointer; transition: opacity 0.12s ease; }
.timeline-block.has-slot:hover { opacity: 0.78; }
.timeline-empty-hint { color: var(--text-3); font-size: 11px; padding: 4px 10px; opacity: 0; transition: opacity 0.15s ease; pointer-events: none; }
.timeline-block.empty-slot:hover .timeline-empty-hint { opacity: 0.85; color: var(--accent); font-weight: 600; }

/* ====== バッジ・ピル ====== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
  background: var(--bg-3); color: var(--text-2);
}
.badge.ok { background: rgba(74, 222, 128, .15); color: var(--ok); }
.badge.warn { background: rgba(251, 191, 36, .15); color: var(--warn); }
.badge.ng { background: rgba(248, 113, 113, .15); color: var(--ng); }
.badge.info { background: rgba(94, 158, 255, .15); color: var(--accent); }
.badge.purple { background: rgba(167, 139, 250, .15); color: var(--purple); }
.badge.pink { background: rgba(244, 114, 182, .15); color: var(--pink); }
.badge.teal { background: rgba(45, 212, 191, .15); color: var(--teal); }

/* ====== ボタン ====== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.btn:hover { background: var(--line); }
.btn.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--ng); }
.btn.sm { padding: 5px 10px; font-size: 12px; }

/* ====== フォーム ====== */
input, select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
}
/* iOS Safari は 16px 未満の input にフォーカスすると自動ズームするので、スマホでは 16px に */
@media (max-width: 768px) {
  input, select, textarea { font-size: 16px; padding: 11px 12px; }
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 158, 255, .15);
}
/* ブラウザのオートフィル白背景を上書き(ダークテーマ対応) */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text) !important;
  -webkit-box-shadow: 0 0 0px 1000px var(--bg) inset !important;
  caret-color: var(--text);
  transition: background-color 5000s ease-in-out 0s;
}
/* disabled 入力欄は半透明だが完全に編集不可だと分かるように */
input:disabled, select:disabled, textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: rgba(255,255,255,0.02);
}
textarea { resize: vertical; min-height: 70px; }
label {
  display: block;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 5px;
  font-weight: 500;
}

/* ====== テーブル ====== */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
}
.card .table-wrap { margin: 0 -10px; padding: 0 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  text-align: left; padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}
th { color: var(--text-2); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
tr:hover td { background: rgba(94, 158, 255, .04); }

/* ====== タイムライン ====== */
.timeline { display: grid; grid-template-columns: 60px 1fr; gap: 0; }
.timeline-time { font-size: 11px; color: var(--text-3); padding: 8px 0; border-right: 1px solid var(--line); padding-right: 8px; text-align: right; }
.timeline-block {
  padding: 8px 12px; border-bottom: 1px solid var(--line);
  min-height: 36px;
}
.timeline-task {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: rgba(94, 158, 255, .15);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 12px;
}

/* ====== カレンダー ====== */
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head { font-size: 11px; color: var(--text-3); text-align: center; padding: 6px; font-weight: 600; }
.cal-cell {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px;
  min-height: 70px;
  font-size: 11px;
  position: relative;
}
.cal-cell.today { border-color: var(--accent); background: rgba(94, 158, 255, .06); }
.cal-cell.weekend { background: var(--bg-2); }
.cal-cell.other { opacity: .35; }
.cal-cell .day-num { font-weight: 600; font-size: 12px; margin-bottom: 4px; }
.cal-cell .leave-mark {
  display: inline-block;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(167, 139, 250, .25);
  color: var(--purple);
  margin-bottom: 2px;
}
.cal-cell .event-mark {
  font-size: 10px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ====== チームグリッド ====== */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.member-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.member-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px; color: white;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.avatar > img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; border-radius: 50%;
  display: block;
}
.member-name { font-weight: 600; font-size: 14px; }
.member-role { font-size: 11px; color: var(--text-3); }
.member-status { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.member-task {
  font-size: 12px;
  padding: 6px 8px;
  background: var(--bg);
  border-radius: 5px;
  margin-bottom: 4px;
  border-left: 2px solid var(--accent);
}
.member-task.done { opacity: .55; border-left-color: var(--ok); text-decoration: line-through; }

/* ====== Status dot color set ====== */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.status-dot.work { background: var(--ok); }
.status-dot.break { background: var(--warn); }
.status-dot.off { background: var(--text-3); }
.status-dot.leave { background: var(--purple); }

/* ====== ナビ・タブ ====== */
.tabs {
  display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.tabs::-webkit-scrollbar { height: 4px; }
.tabs::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }
.tab {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  scroll-snap-align: start;
  flex-shrink: 0;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab:hover { color: var(--text); }

/* ====== 空状態 ====== */
.empty {
  text-align: center; padding: 30px;
  color: var(--text-3); font-size: 13px;
}

/* ====== 入口ページ ====== */
.entry-wrap {
  min-height: 100vh;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at top, rgba(94, 158, 255, .15), transparent 60%),
              radial-gradient(ellipse at bottom, rgba(167, 139, 250, .12), transparent 60%),
              var(--bg);
  padding: 30px;
}
.entry-card {
  max-width: 920px; width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 40px;
  box-shadow: var(--shadow);
}
.entry-card .logo {
  width: 48px; height: 48px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: grid; place-items: center;
  color: white; font-weight: 800; font-size: 20px;
  margin-bottom: 18px;
}
.entry-card h1 { margin: 0 0 6px; font-size: 24px; }
.entry-card .lead { color: var(--text-2); font-size: 14px; margin-bottom: 28px; }
.entry-options { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-top: 20px; }
@media (max-width: 720px) { .entry-options { grid-template-columns: 1fr; } }
.entry-opt {
  display: block;
  padding: 22px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: all .15s;
}
.entry-opt:hover {
  border-color: var(--accent);
  background: rgba(94, 158, 255, .05);
  transform: translateY(-2px);
  text-decoration: none;
}
.entry-opt .icon { font-size: 28px; margin-bottom: 10px; }
.entry-opt h3 { margin: 0 0 4px; font-size: 15px; color: var(--text); }
.entry-opt p { margin: 0; font-size: 12px; color: var(--text-2); line-height: 1.5; }

/* ====== モーダル ====== */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .65);
  display: none; place-items: center; z-index: 100; padding: 20px;
}
.modal-bg.show { display: grid; }
.modal {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h3 { margin: 0 0 16px; font-size: 16px; }
.modal-row { margin-bottom: 14px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* ====== 進捗バー ====== */
.progress {
  height: 6px; background: var(--bg-3); border-radius: 3px; overflow: hidden;
}
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--purple)); }

/* ====== サクセスフラッシュ (アクション完了画面) ====== */
.success-flash {
  position: fixed; inset: 0;
  background: rgba(13, 16, 24, .55);
  display: none; place-items: center;
  z-index: 300;
  backdrop-filter: blur(2px);
}
.success-flash.show { display: grid; animation: flash-fade-in .15s ease-out; }
@keyframes flash-fade-in { from { opacity: 0 } to { opacity: 1 } }

.success-flash-card {
  background: var(--bg-2);
  border: 1px solid var(--ok);
  border-radius: 14px;
  padding: 28px 36px;
  text-align: center;
  box-shadow: 0 0 36px rgba(74, 222, 128, .35);
  animation: flash-pop .25s cubic-bezier(.2,1.6,.4,1);
}
@keyframes flash-pop {
  from { transform: scale(.7); opacity: 0 }
  60% { transform: scale(1.05); opacity: 1 }
  to { transform: scale(1); opacity: 1 }
}
.success-flash-icon {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4ade80, #2dd4bf);
  display: grid; place-items: center;
  color: white; font-size: 32px; font-weight: 800;
  margin: 0 auto 12px;
  box-shadow: 0 6px 20px rgba(74, 222, 128, .4);
}
.success-flash-msg {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

/* 要素を一瞬光らせる (申請履歴の更新箇所など) */
.flash-highlight {
  animation: flash-glow 1.4s ease-out;
}
@keyframes flash-glow {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); background: transparent; }
  20% { box-shadow: 0 0 24px 4px rgba(74, 222, 128, .55); background: rgba(74, 222, 128, .1); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); background: transparent; }
}

/* ====== トースト ====== */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--bg-3); border: 1px solid var(--line);
  padding: 12px 20px; border-radius: 8px;
  font-size: 13px; color: var(--text);
  box-shadow: var(--shadow);
  z-index: 200;
  transform: translateY(20px); opacity: 0;
  transition: all .2s;
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ====== ユーティリティ ====== */
.muted { color: var(--text-2); }
.small { font-size: 11px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 12px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
hr.divider { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ====== バッジ ゴールド ====== */
.badge.gold { background: rgba(240, 183, 58, .15); color: var(--gold); }

/* ====== 緊急度カラー (期限までの残り時間で変化) ====== */
/* 期限が遠い → 青 → 緑 → 黄 → オレンジ → 赤 → 赤点滅 */
.urgency-far      { border-left: 3px solid #5e9eff !important; background: linear-gradient(to right, rgba(94,158,255,.10), transparent 60%) !important; }
.urgency-mid      { border-left: 3px solid #4ade80 !important; background: linear-gradient(to right, rgba(74,222,128,.10), transparent 60%) !important; }
.urgency-soon     { border-left: 3px solid #fbbf24 !important; background: linear-gradient(to right, rgba(251,191,36,.12), transparent 60%) !important; }
.urgency-near     { border-left: 3px solid #fb923c !important; background: linear-gradient(to right, rgba(251,146,60,.15), transparent 60%) !important; }
.urgency-imminent { border-left: 3px solid #f87171 !important; background: linear-gradient(to right, rgba(248,113,113,.18), transparent 60%) !important; }
.urgency-overdue  {
  border-left: 3px solid #ef4444 !important;
  background: linear-gradient(to right, rgba(239,68,68,.22), rgba(239,68,68,.05) 70%) !important;
  color: var(--text);
}
.urgency-overdue-blink {
  border-left: 3px solid #ef4444 !important;
  animation: urgent-blink 1s steps(2, start) infinite;
}
@keyframes urgent-blink {
  0%, 49%   { background: linear-gradient(to right, rgba(239,68,68,.45), rgba(239,68,68,.10) 70%) !important; box-shadow: 0 0 12px rgba(239,68,68,.4); }
  50%, 100% { background: linear-gradient(to right, rgba(239,68,68,.08), transparent 70%) !important; box-shadow: none; }
}
.urgency-done { opacity: .55; }

/* テーブル行にもグラデが効くように */
tr.urgency-far td, tr.urgency-mid td, tr.urgency-soon td,
tr.urgency-near td, tr.urgency-imminent td, tr.urgency-overdue td { background-clip: padding-box; }
tr.urgency-overdue td:first-child { border-left: 3px solid #ef4444; }
tr.urgency-overdue-blink td {
  animation: urgent-blink 1s steps(2, start) infinite;
}
tr.urgency-done td { opacity: .55; text-decoration: line-through; }

/* タスク進捗バー (member-task の中に入れる用) */
.task-progress {
  height: 5px;
  background: var(--bg-3);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
  position: relative;
}
.task-progress > .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width .25s ease;
}
.task-progress.done > .fill { background: linear-gradient(90deg, var(--ok), var(--teal)); }
.task-progress-label {
  font-size: 10px; color: var(--text-3);
  display: flex; justify-content: space-between; margin-top: 3px;
}

/* メンバーのリソース負荷バー */
.workload-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: 6px; border: 1px solid var(--line);
  font-size: 12px;
}
.workload-bar .lvl-emoji { font-size: 16px; line-height: 1; }
.workload-bar .lvl-label { font-weight: 600; }
.workload-bar .lvl-meter {
  flex: 1; height: 6px; background: var(--bg-3); border-radius: 3px; overflow: hidden;
}
.workload-bar .lvl-fill {
  height: 100%; transition: width .25s ease;
}
.workload-bar.lvl-free  { border-color: rgba(74,222,128,.4); }
.workload-bar.lvl-free  .lvl-fill { background: var(--ok); }
.workload-bar.lvl-free  .lvl-label { color: var(--ok); }
.workload-bar.lvl-normal { border-color: rgba(91,140,255,.4); }
.workload-bar.lvl-normal .lvl-fill { background: var(--accent); }
.workload-bar.lvl-normal .lvl-label { color: var(--accent); }
.workload-bar.lvl-busy { border-color: rgba(240,183,58,.5); background: rgba(240,183,58,.05); }
.workload-bar.lvl-busy .lvl-fill { background: var(--gold); }
.workload-bar.lvl-busy .lvl-label { color: var(--gold); }
.workload-bar.lvl-overflow {
  border-color: var(--ng);
  background: rgba(248,113,113,.08);
  animation: workload-pulse 2s ease-in-out infinite;
}
.workload-bar.lvl-overflow .lvl-fill { background: var(--ng); }
.workload-bar.lvl-overflow .lvl-label { color: var(--ng); font-weight: 700; }
@keyframes workload-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248,113,113,0); }
  50%      { box-shadow: 0 0 12px 2px rgba(248,113,113,.35); }
}

/* 緊急度ドット (バッジの左に付ける小さな印) */
.urgency-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle;
}
.urgency-dot.far { background: #5e9eff; }
.urgency-dot.mid { background: #4ade80; }
.urgency-dot.soon { background: #fbbf24; }
.urgency-dot.near { background: #fb923c; }
.urgency-dot.imminent { background: #f87171; }
.urgency-dot.overdue, .urgency-dot.overdue-blink { background: #ef4444; }
.urgency-dot.overdue-blink { animation: urgent-blink 1s steps(2, start) infinite; }

/* ====== チャート ====== */
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 12px; }
.bar-row .label { width: 90px; flex-shrink: 0; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .bar-track { flex: 1; height: 14px; background: var(--bg-3); border-radius: 7px; overflow: hidden; position: relative; }
.bar-row .bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); border-radius: 7px; }
.bar-row .bar-val { width: 60px; text-align: right; flex-shrink: 0; font-weight: 600; }

.donut { width: 120px; height: 120px; }
.donut-wrap { display: flex; align-items: center; gap: 16px; }
.donut-wrap .legend { font-size: 12px; }
.donut-wrap .legend-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.donut-wrap .legend-row .swatch { width: 10px; height: 10px; border-radius: 2px; }

/* ====== 通知 ====== */
.notif-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  margin-bottom: 8px;
}
.notif-item.warn { border-left-color: var(--warn); }
.notif-item.ng { border-left-color: var(--ng); }
.notif-item.info { border-left-color: var(--accent); }
.notif-item .icon { font-size: 18px; flex-shrink: 0; line-height: 1.2; }
.notif-item .body { flex: 1; min-width: 0; }
.notif-item .title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.notif-item .msg { font-size: 12px; color: var(--text-2); }
.notif-item .meta { font-size: 11px; color: var(--text-3); margin-top: 4px; }

/* ====== カンバン (採用/稟議) ====== */
.kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.kanban-col {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px;
  min-height: 200px;
}
.kanban-col h4 { margin: 0 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.kanban-card {
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px; margin-bottom: 8px;
  font-size: 12px; cursor: pointer;
}
.kanban-card:hover { border-color: var(--accent); }
.kanban-card .name { font-weight: 600; margin-bottom: 4px; }
.kanban-card .meta { font-size: 11px; color: var(--text-3); }
.kanban-card .stars { color: var(--gold); font-size: 11px; margin-top: 4px; }

/* ====== モバイル対応 ====== */
@media (max-width: 768px) {
  body { font-size: 14px; }

  header.app-header {
    padding: 10px 14px;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
    flex-wrap: wrap;
    gap: 8px;
  }
  header .brand { font-size: 14px; }
  header nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }
  header nav a {
    font-size: 13px; padding: 7px 14px; flex-shrink: 0;
    border-radius: 6px;
    scroll-snap-align: start;
  }
  header nav a.active { background: var(--bg-3); color: var(--text); }
  header .user-pill { padding: 5px 12px; font-size: 13px; }
  header .user-pill .btn.sm { padding: 4px 8px; font-size: 12px; min-height: 28px; }

  .container {
    padding: 14px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; }
  .grid.grid-2 { gap: 12px; }

  .tab { padding: 10px 14px; font-size: 13px; min-height: 42px; display: flex; align-items: center; }

  .kpi { padding: 12px 14px; }
  .kpi .value { font-size: 24px; }
  .kpi .label { font-size: 10px; }

  .card { padding: 14px; }
  .card h2 { font-size: 14px; }

  table { font-size: 13px; min-width: max-content; }
  th, td { padding: 10px 8px; }

  .timeline { grid-template-columns: 56px 1fr; }
  .timeline-time { font-size: 11px; padding: 8px 0; padding-right: 6px; }
  .timeline-task { font-size: 12px; padding: 6px 10px; }

  .calendar { gap: 2px; }
  .cal-cell {
    min-height: 60px; padding: 5px;
    font-size: 11px;
  }
  .cal-cell .day-num { font-size: 12px; margin-bottom: 3px; }
  .cal-cell .leave-mark, .cal-cell .event-mark { font-size: 10px; }
  .cal-head { font-size: 10px; padding: 4px; }

  .team-grid { grid-template-columns: 1fr; }
  .member-card { padding: 14px; }

  .entry-card { padding: 22px; border-radius: 12px; }
  .entry-options { grid-template-columns: 1fr !important; }
  .entry-opt { padding: 18px; }

  .kanban { grid-template-columns: 1fr; }

  /* 旧モーダル CSS は冒頭の @media (max-width: 768px) の新ルールに統合 (画面全体スクロール対応) */
  @keyframes slide-up {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  /* タッチ最小領域 */
  .btn { min-height: 42px; padding: 10px 16px; }
  .btn.sm { min-height: 36px; padding: 7px 12px; font-size: 13px; }
  input[type="checkbox"] { min-height: 22px; min-width: 22px; }

  /* バーチャート: ラベルのwidth拡大 */
  .bar-row .label { width: 100px; font-size: 12px; }
  .bar-row .bar-val { width: 70px; font-size: 11px; }

  /* 通知アイテムのアイコン縮小 */
  .notif-item { padding: 12px 10px; }
  .notif-item .icon { font-size: 20px; }

  /* トースト位置調整 */
  .toast {
    bottom: max(12px, env(safe-area-inset-bottom));
    right: 12px; left: 12px;
    text-align: center;
  }

  /* ページタイトル + アクションボタン群を縦積みに */
  .container > .flex-between {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .container > .flex-between > .flex.gap-1 {
    flex-wrap: wrap;
    gap: 6px;
  }
  .container > .flex-between > .flex.gap-1 > .btn {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
  }

  /* h1 行のサブタイトル (時刻 + Google ステータス) は読みやすく */
  .container h1 + .muted.small,
  .container > .flex-between .muted.small {
    line-height: 1.5;
  }
}

@media (max-width: 480px) {
  header.app-header {
    flex-direction: column;
    align-items: stretch;
  }
  header .brand { justify-content: center; }
  header nav { justify-content: flex-start; }
  header .user-pill { justify-content: center; }

  /* 1行で見えにくい長いタブ用 */
  .tabs { padding-left: 2px; }
  .tab { padding: 10px 12px; }

  .kpi .value { font-size: 22px; }

  /* テーブルセル詰める */
  th, td { padding: 8px 6px; font-size: 12px; }
}

/* スマホ実機での縦並び iframe 切替 (旧コードがあれば対応) */
iframe { max-width: 100%; }

@media (max-width: 480px) {
  header.app-header {
    flex-direction: column;
    align-items: stretch;
  }
  header .brand { justify-content: center; }
  header nav { justify-content: center; }
  header .user-pill { justify-content: center; }
}

/* ===========================================================
   📱 スマホ統合最適化 (2026-05-18 礒貝CEO 要望: スマホ閲覧主体に)
   - iOS Safari の自動ズーム回避(input font-size: 16px)
   - タブ container 横スクロール対応
   - 全グリッド 1 列化
   - モーダル全画面化
   - タッチターゲット 44x44px 確保
   - ボタンの可読性
   =========================================================== */
@media (max-width: 768px) {
  /* iOS Safari の自動ズーム回避 (input/select/textarea: 16px) */
  input, select, textarea, button { font-size: 16px !important; }
  input[type="checkbox"], input[type="radio"] { font-size: inherit !important; }

  /* タブ container を横スクロール (8〜10タブが画面に入らない場合の対応) */
  .tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 4px;
  }
  .tab {
    flex-shrink: 0;
    white-space: nowrap;
    min-width: max-content;
    padding: 12px 14px;
    font-size: 13px;
  }

  /* 全グリッドを 1 列に */
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; gap: 12px !important; }

  /* KPI カードを 2 列(画面が狭くても KPI は 2 つ並べる) */
  .grid.grid-4 { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
  .kpi { padding: 12px 10px !important; }
  .kpi .label { font-size: 11px !important; }
  .kpi .value { font-size: 22px !important; }
  .kpi .delta { font-size: 10px !important; }

  /* ボタンのタッチターゲット (44x44px 確保 = Apple HIG 推奨) */
  .btn { min-height: 44px; padding: 11px 16px; font-size: 14px; }
  .btn.sm { min-height: 36px; padding: 8px 12px; font-size: 13px; }

  /* 旧モーダル CSS は @media (max-width: 768px) の新ルール (画面全体スクロール) で上書き済 */
  /* min-height:100vh を残すと iOS Safari の URL バー分でフッターが隠れて登録ボタン押せない事故が再発するため、ここでは何も指定しない */

  /* 入力ラベル + 入力欄を縦並びにして可読性UP */
  .modal-row { display: block !important; margin-bottom: 14px; }
  .modal-row label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
  .modal-row input, .modal-row select, .modal-row textarea { width: 100% !important; }

  /* テーブルを横スクロール可能に */
  .table-wrap, table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 600px; }

  /* カード余白 */
  .card { padding: 14px !important; }
  .container { padding: 12px !important; }

  /* ヘッダー要素 stack */
  .flex-between { flex-wrap: wrap; gap: 8px; }
  .flex-between > * { flex: 1 1 auto; min-width: 0; }

  /* インラインカレンダー (休暇申請) は元から compact 設計だが、念のため */
  .inline-cal { padding: 10px !important; }
  .inline-cal button[data-cal-day] { min-height: 36px; padding: 6px 0 !important; }

  /* FAB の位置調整 (固定 FAB が画面下部のボタンを覆わないように) */
  .fab-btn, [id*="fab-button"] { bottom: 14px !important; right: 14px !important; }

  /* index/login の entry-card */
  .entry-card { padding: 20px !important; }
  .entry-options { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  /* さらに小さい画面 (iPhone SE 等) */
  h1 { font-size: 18px !important; }
  h2 { font-size: 16px !important; }
  h3 { font-size: 14px !important; }
  .kpi .value { font-size: 20px !important; }
  .container { padding: 10px !important; }
  .tab { padding: 10px 12px; font-size: 12px; }
}

/* ===== ❓ ヘルプボタン (全画面共通) ===== */
.help-btn {
  background: rgba(91,140,255,.12);
  border: 1px solid var(--accent, #5b8cff);
  color: var(--accent, #5b8cff);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  line-height: 1;
  vertical-align: middle;
  transition: all .15s;
  flex-shrink: 0;
}
.help-btn:hover { background: var(--accent, #5b8cff); color: #fff; transform: scale(1.1); }
.help-btn.sm { width: 18px; height: 18px; font-size: 10px }
.help-corner { position: absolute; top: 8px; right: 8px; z-index: 5 }
.help-corner-left { position: absolute; top: 8px; right: 60px; z-index: 5 }

/* ヘルプモーダル */
.help-modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.help-modal {
  max-width: 560px; width: 100%; max-height: 85vh; overflow-y: auto;
  background: var(--bg-2, #1a1f2e);
  border: 1px solid var(--line, #2a3045);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  color: var(--text, #ecf0f9);
}
.help-modal h3 {
  margin: 0 0 14px;
  color: var(--accent, #5b8cff);
  font-size: 16px;
  display: flex; align-items: center; gap: 8px;
}
.help-modal .help-body {
  font-size: 13px; line-height: 1.8;
  color: var(--text, #ecf0f9);
}
.help-modal .help-body ol, .help-modal .help-body ul { padding-left: 20px; margin: 8px 0 }
.help-modal .help-body li { margin-bottom: 4px }
.help-modal .help-body code { background: var(--bg-3, #252a3d); padding: 2px 6px; border-radius: 4px; font-size: 12px }
.help-modal .help-body .hint { background: rgba(74,222,128,.06); border:1px solid rgba(74,222,128,.30); color: #4ade80; padding: 8px 10px; border-radius: 6px; font-size: 12px; margin: 8px 0 }
.help-modal .help-body .warn { background: rgba(248,113,113,.06); border:1px solid rgba(248,113,113,.30); color: #f87171; padding: 8px 10px; border-radius: 6px; font-size: 12px; margin: 8px 0 }
.help-modal .help-close {
  background: var(--accent, #5b8cff); color: #fff; border: 0;
  padding: 8px 16px; border-radius: 8px; cursor: pointer;
  margin-top: 14px; font-weight: bold;
}
