/* FIBE社内ポータル 共通スタイル
   ・PC版（768px以上）とスマホ版（767px以下）を .pc-shell / .sp-shell で出し分ける
   ・ページ固有のスタイルは assets/css/pages/<page>.css に書く */

:root {
  --sidebar: #0c2b4e;
  --sidebar-2: #0a2443;
  --sidebar-text: #e6edf7;
  --side-active-1: #1873d3;
  --side-active-2: #0f5fb5;
  --side-accent: #3fd0ff;

  --primary: #1268e8;
  --primary-dark: #0b57cf;
  --primary-soft: #e8f1fe;
  --link: #1667d9;
  --icon-blue: #1a6fe0;

  --bg: #f1f5fb;
  --card: #ffffff;
  --border: #e4e9f1;
  --line: #edf0f5;
  --text: #17212f;
  --text-2: #344052;
  --muted: #6b7686;

  --green: #12a150;
  --green-soft: #e3f6ea;
  --orange: #f08a14;
  --orange-soft: #fff1dc;
  --red: #e5383b;
  --red-soft: #fde9ea;
  --purple: #7c6ff0;
  --purple-soft: #ece9fd;
  --gray-soft: #eef1f5;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(20, 40, 80, 0.06);
  --font: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
table { border-collapse: collapse; }

.icon { width: 1em; height: 1em; flex: none; vertical-align: -0.15em; }

/* ============ PC シェル ============ */
.pc-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 237px;
  flex: none;
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: var(--sidebar-text);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { display: flex; align-items: baseline; gap: 14px; padding: 18px 24px 26px; color: #fff; }
.brand-logo { font-size: 30px; font-weight: 800; letter-spacing: 0.01em; line-height: 1; }
.brand-sub { font-size: 16px; font-weight: 500; }
.side-nav { display: flex; flex-direction: column; gap: 3.5px; padding-right: 12px; }
.side-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 48px;
  padding: 0 24px;
  font-size: 16px;
  font-weight: 500;
  color: var(--sidebar-text);
  border-radius: 0 8px 8px 0;
}
.side-item .icon { width: 24px; height: 24px; }
.side-item:hover { background: rgba(255, 255, 255, 0.06); }
.side-item.is-active { background: linear-gradient(90deg, var(--side-active-1), var(--side-active-2)); color: #fff; }
.side-item.is-active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--side-accent); }

.pc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px 0 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.search {
  display: flex; align-items: center; gap: 10px;
  width: 530px; max-width: 45vw; height: 37px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafd;
  color: #8a94a3;
}
.search .icon { width: 18px; height: 18px; }
.search input { border: 0; outline: 0; background: transparent; flex: 1; font-size: 14px; }
.search input::placeholder { color: #8f99a8; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.bell { position: relative; border: 0; background: none; padding: 4px; color: #3f4b5c; cursor: pointer; }
.bell .icon { width: 24px; height: 24px; }
.bell-badge {
  position: absolute; top: -4px; right: -6px;
  min-width: 19px; height: 19px; border-radius: 10px;
  background: var(--red); color: #fff; font-size: 12px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid #fff;
}
.me { display: flex; align-items: center; gap: 10px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: #dfe5ee; }
.me-text { display: flex; flex-direction: column; line-height: 1.3; }
.me-text strong { font-size: 15px; }
.me-text small { font-size: 12px; color: var(--muted); }
.role-pill { background: var(--primary); color: #fff; font-size: 13px; font-weight: 700; padding: 4px 16px; border-radius: 999px; }
.me-toggle { border: 0; background: none; color: #334; cursor: pointer; padding: 0; }
.me-toggle .icon { width: 18px; height: 18px; }

.pc-main { padding: 18px 16px 24px 16px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding: 0 10px; margin-bottom: 16px; }
.page-title { font-size: 28px; font-weight: 800; letter-spacing: 0.02em; line-height: 1.35; }
.page-sub { font-size: 15px; color: var(--text-2); margin-top: 2px; }
.page-today { display: flex; align-items: center; gap: 22px; flex: none; white-space: nowrap; font-size: 15px; color: var(--text-2); padding-top: 16px; }
.weather { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 14px; }
.weather b { font-weight: 500; color: var(--text-2); }
.weather b.low { color: var(--link); }
.sun { color: #f6b21b; display: inline-flex; }
.sun .icon { width: 30px; height: 30px; }

/* ============ 共通部品 ============ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 700; }
.card-title .icon { width: 28px; height: 28px; color: var(--icon-blue); }
.card-link { display: inline-flex; align-items: center; gap: 4px; color: var(--link); font-size: 14px; font-weight: 500; white-space: nowrap; }
.card-link .icon { width: 15px; height: 15px; }

.grid { display: grid; gap: 14px; }

.badge {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 2px 10px; border-radius: 6px; font-size: 13px; font-weight: 700; white-space: nowrap;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-blue { background: var(--primary-soft); color: var(--primary); }
.badge-orange { background: var(--orange-soft); color: #c96a00; }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-gray { background: var(--gray-soft); color: var(--muted); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 8px;
  font-size: 15px; font-weight: 700; cursor: pointer;
  border: 1px solid transparent;
}
.btn .icon { width: 20px; height: 20px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-green { background: #16a35a; color: #fff; }
.btn-disabled { background: #cfd5dd; color: #fff; cursor: default; }

.table { width: 100%; font-size: 13px; }
.table th { background: #f3f6fa; color: var(--text-2); font-weight: 500; text-align: left; padding: 8px 12px; }
.table td { padding: 8px 12px; border-bottom: 1px solid var(--line); }

.up { color: var(--green); }
.down { color: var(--red); }
.muted { color: var(--muted); }
.num { font-feature-settings: "tnum"; }

/* ============ スマホ シェル ============ */
.sp-shell { background: #f6f8fc; min-height: 100vh; }
.sp-appbar {
  position: sticky; top: 0; z-index: 20;
  height: 56px; background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
}
.sp-menu-btn { position: absolute; left: 12px; top: 10px; width: 36px; height: 36px; border: 0; background: none; padding: 6px; color: var(--text); cursor: pointer; }
.sp-menu-btn .icon { width: 24px; height: 24px; }
.sp-title { font-size: 18px; font-weight: 700; }
.sp-main { padding: 20px 16px calc(84px + env(safe-area-inset-bottom)); }
.sp-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(64px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.sp-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: #8a93a1; }
.sp-tab .icon { width: 24px; height: 24px; }
.sp-tab.is-active { color: var(--primary); font-weight: 700; }

.sp-drawer { position: fixed; inset: 0; z-index: 50; display: flex; }
.sp-drawer[hidden] { display: none; }
.sp-drawer-panel { width: 270px; background: var(--sidebar); color: #fff; padding: 18px 0; overflow-y: auto; }
.sp-drawer-head { display: flex; align-items: baseline; gap: 10px; padding: 0 20px 18px; }
.sp-drawer-head .brand-logo { font-size: 24px; }
.sp-drawer-head .brand-sub { font-size: 13px; }
.sp-drawer-item { display: flex; align-items: center; gap: 14px; padding: 12px 20px; font-size: 15px; }
.sp-drawer-item .icon { width: 22px; height: 22px; }
.sp-drawer-item.is-active { background: var(--side-active-2); }
.sp-drawer-close { flex: 1; border: 0; background: rgba(10, 20, 40, 0.45); cursor: pointer; }

/* スマホ版の共通カード */
.sp-card { background: #fff; border-radius: 14px; box-shadow: 0 1px 4px rgba(20, 40, 80, 0.06); padding: 16px; }
.sp-section-title { font-size: 17px; font-weight: 700; margin: 22px 0 12px; }
.sp-section-title:first-child { margin-top: 0; }
.sp-btn { display: flex; align-items: center; justify-content: center; width: 100%; height: 48px; border-radius: 10px; font-size: 16px; font-weight: 700; }
.sp-btn-primary { background: var(--primary); color: #fff; }
.sp-btn-outline { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); }
.sp-list-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.sp-list-row:last-child { border-bottom: 0; }

/* ============ 出し分け（他の display 指定より後に置く） ============ */
.sp-shell { display: none; }
@media (max-width: 767px) {
  .pc-shell { display: none; }
  .sp-shell { display: block; }
}

/* ============ ログイン状態（session.js） ============ */
.avatar-initial { display: grid; place-items: center; background: #dbe6f5; color: var(--sidebar); font-size: 17px; font-weight: 700; }
.me-menu {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 30;
  min-width: 180px; padding: 6px; background: #fff;
  border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(20, 40, 80, 0.14);
}
.me-menu[hidden] { display: none; }
.me-menu a, .me-menu button {
  display: block; width: 100%; padding: 9px 12px; border: 0; background: none; border-radius: 6px;
  text-align: left; font-size: 14px; color: var(--text); cursor: pointer;
}
.me-menu a:hover, .me-menu button:hover { background: var(--gray-soft); }
.sp-drawer-logout { width: 100%; border: 0; background: none; color: #fff; font: inherit; cursor: pointer; margin-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.12); }

/* ============ 準備中（preparing.js） ============ */
.is-preparing { position: relative; }
.is-preparing > :not(.prep-veil) { filter: blur(3px) grayscale(0.4); opacity: 0.45; pointer-events: none; user-select: none; }
.prep-veil { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; }
.prep-label {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 16px; border-radius: 999px;
  background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow);
  color: var(--text-2); font-size: 14px; font-weight: 700;
}
.is-preparing-page > .prep-veil { align-items: flex-start; padding-top: 120px; }
.is-preparing-page > .prep-veil .prep-label { position: sticky; top: 140px; font-size: 16px; padding: 10px 22px; }
.is-preparing-inline { opacity: 0.5; pointer-events: none; }
.is-preparing-inline::after { content: "準備中"; margin-left: 8px; font-size: 11px; font-weight: 700; color: var(--muted); }
