/* =============================================================
   社内ポータル 共通スタイル

   方針:
     - スマホを基準に設計し、PC はその拡大版(設計仕様書 §8)
     - 文字は大きめ、押す場所は最低 48px(年齢層の幅を考慮)
     - 余白を広く取り、色数を絞る。装飾より読みやすさ
     - 色はロゴ(EIKOSYA)の水色を基調にする
       ※ ロゴを差し替えたら `node scripts/make_icons.mjs` で基調色を再確認
   ============================================================= */

:root {
  /* ロゴの色。見出しの線・図形・強調に使う */
  --brand: #009fe8;
  /* 白抜き文字を載せる用の濃い版(コントラスト確保のため) */
  --brand-strong: #0077b0;
  --brand-deep: #005a86;
  --brand-tint: #eaf7fe;
  --brand-tint-line: #bfe6fa;

  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --line: #e4e8ee;
  --line-strong: #cfd6e0;

  --text: #10151c;
  --muted: #5f6b7a;
  --faint: #8b96a5;

  --accent: #d2691e;
  --danger: #c0392b;
  --ok: #12805c;
  --warn: #b45309;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 12px 28px -18px rgba(16, 24, 40, 0.28);
  --max: 820px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
    "Yu Gothic Medium", "Yu Gothic", Meiryo, system-ui, sans-serif;
  font-size: 16.5px;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-deep); }

/* ── ヘッダ ───────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.site-header a { text-decoration: none; color: inherit; }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
/* ロゴは「図形」と「社名」を別画像にして、それぞれ読める大きさで並べる
   (1 枚のまま縮めると社名が潰れるため。生成は scripts/make_icons.mjs) */
.brand .mark { height: 28px; width: auto; display: block; }
.brand .wordmark { height: 21px; width: auto; display: block; }
.brand .brand-label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding-left: 10px;
  border-left: 1px solid var(--line-strong);
  white-space: nowrap;
}
.site-header .spacer { flex: 1; }
.site-header .user {
  font-size: 13.5px;
  color: var(--muted);
  white-space: nowrap;
}

/* 画面が狭いときは、社名の右の説明とユーザー名を省いて幅を確保する */
@media (max-width: 560px) {
  .brand .brand-label { display: none; }
  .site-header .user { display: none; }
  .site-header .inner { padding: 10px 16px; }
  main { padding: 22px 16px 64px; }
}

/* ── ナビ ─────────────────────────────────── */
.nav {
  position: sticky;
  top: 55px;
  z-index: 29;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav .inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  gap: 2px;
  padding: 0 12px;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 13px 12px 11px;
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease;
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--brand-deep); border-bottom-color: var(--brand); }

/* ── レイアウト ───────────────────────────── */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 20px 72px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.card > h1:first-child, .card > h2:first-child { margin-top: 0; }

h1 {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.5;
  margin: 0 0 20px;
}
h2 { font-size: 18.5px; font-weight: 700; margin: 26px 0 12px; }
h3 { font-size: 16px; font-weight: 700; margin: 22px 0 8px; }

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.section-head h1, .section-head h2 { margin: 0; flex: 1; min-width: 180px; }

/* 見出しの前に置く小さなラベル */
.eyebrow {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 6px;
}

/* ── 一覧 ────────────────────────────────── */
.list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--line); }
.list a {
  display: block;
  padding: 15px 34px 15px 2px;
  color: var(--text);
  text-decoration: none;
  min-height: 48px;
  border-radius: var(--radius-sm);
  position: relative;
  transition: background 0.15s ease;
}
.list a::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--faint);
  border-bottom: 2px solid var(--faint);
  transform: translateY(-50%) rotate(-45deg);
}
.list a:hover { background: var(--surface-2); }
.list a:hover::after { border-color: var(--brand); }
.list .row-title { font-weight: 600; display: block; line-height: 1.6; }
.list .row-meta { font-size: 13.5px; color: var(--muted); display: block; margin-top: 3px; }
.list .row-excerpt {
  font-size: 14px;
  color: var(--muted);
  display: block;
  margin-top: 5px;
  line-height: 1.7;
}

/* 規則の一覧など、1 件を 1 行に収めたい一覧に付ける。
   規則名・更新情報・説明を横に並べ、入りきらない分は「…」で省く
   (行頭が揃っているほうが目的のものを探しやすいため) */
.list.inline-rows a { display: flex; align-items: baseline; gap: 14px; }
.list.inline-rows .row-title,
.list.inline-rows .row-meta,
.list.inline-rows .row-excerpt {
  display: block;
  margin-top: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list.inline-rows .row-title { flex: 0 1 auto; max-width: 50%; }
.list.inline-rows .row-meta { flex: 0 0 auto; }
.list.inline-rows .row-excerpt { flex: 1 1 auto; min-width: 0; }

/* 画面が狭いときは、補足の説明を省いて規則名と更新情報を読める幅に保つ */
@media (max-width: 620px) {
  .list.inline-rows .row-excerpt { display: none; }
  .list.inline-rows .row-title { max-width: none; }
}

/* ── バッジ ──────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.03em;
  padding: 5px 8px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: 1px;
}
.badge-new { background: var(--brand); color: #fff; }
.badge-pin { background: #fff6ec; color: var(--warn); border: 1px solid #f3d5ac; }
.badge-past { background: #eef1f4; color: var(--muted); }
.badge-attach { background: var(--brand-tint); color: var(--brand-deep); border: 1px solid var(--brand-tint-line); }
.badge-read { background: #e9f6f1; color: var(--ok); border: 1px solid #b6ddcd; }

/* ── フォーム ─────────────────────────────── */
label { display: block; font-weight: 600; margin: 18px 0 7px; font-size: 14.5px; }
label.inline {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: normal;
  margin: 10px 0;
  font-size: 16px;
}

input[type="text"], input[type="password"], input[type="search"],
input[type="number"], input[type="datetime-local"], input[type="date"],
input[type="file"], select, textarea {
  width: 100%;
  font-size: 16.5px;
  font-family: inherit;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  min-height: 50px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus, [contenteditable]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 159, 232, 0.18);
}
textarea { min-height: 120px; resize: vertical; }
input[type="checkbox"] { width: 21px; height: 21px; min-height: 0; accent-color: var(--brand-strong); }
input[type="file"] { padding: 10px; background: var(--surface-2); }

.hint { font-size: 13.5px; color: var(--muted); margin: 7px 0 0; line-height: 1.75; }

/* ── ボタン ──────────────────────────────── */
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 16px;
  font-family: inherit;
  font-weight: 600;
  padding: 13px 22px;
  min-height: 50px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--brand-strong);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
button:hover, .button:hover { background: var(--brand-deep); }
button:active, .button:active { transform: translateY(1px); }
button:disabled { background: #aab4c0; cursor: not-allowed; }
button.secondary, .button.secondary {
  background: #fff;
  color: var(--brand-deep);
  border-color: var(--line-strong);
}
button.secondary:hover, .button.secondary:hover { background: var(--brand-tint); border-color: var(--brand-tint-line); }
button.danger { background: var(--danger); }
button.danger:hover { background: #99291c; }
button.small, .button.small { font-size: 13.5px; padding: 8px 14px; min-height: 40px; border-radius: 8px; }
button.ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--line-strong);
}
button.ghost:hover { background: var(--surface-2); color: var(--text); }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; align-items: center; }
.button-block { width: 100%; }

/* ── メッセージ ───────────────────────────── */
.message {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  margin: 16px 0;
  font-size: 14.5px;
  line-height: 1.75;
  display: none;
  border: 1px solid transparent;
}
.message.show { display: block; }
.message.error { background: #fdf0ee; color: #8f2418; border-color: #f0c4bd; }
.message.ok { background: #eaf7f2; color: #0e5f45; border-color: #b6ddcd; }
.message.info { background: var(--brand-tint); color: var(--brand-deep); border-color: var(--brand-tint-line); }

.empty, .loading { color: var(--faint); padding: 28px 0; text-align: center; font-size: 15px; }

/* ── 通達本文 ─────────────────────────────── */
.notice-body { font-size: 16.5px; line-height: 1.95; }
.notice-body h2 { font-size: 18px; margin: 28px 0 10px; padding-left: 12px; border-left: 3px solid var(--brand); }
.notice-body h3 { font-size: 16px; }
.notice-body p { margin: 0 0 1.1em; }
.notice-body img { max-width: 100%; height: auto; border-radius: 8px; }
.notice-body ul, .notice-body ol { padding-left: 1.4em; }
.notice-body li { margin-bottom: 0.4em; }
.notice-body table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 15px; }
.notice-body th, .notice-body td { border: 1px solid var(--line); padding: 10px; }
.notice-body th { background: var(--surface-2); }
.notice-body blockquote {
  margin: 16px 0;
  padding: 4px 16px;
  border-left: 3px solid var(--line-strong);
  color: var(--muted);
}
.meta-line { font-size: 13.5px; color: var(--muted); margin: 6px 0 20px; }

/* ── 表(管理画面)────────────────────────── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 560px; }
/* 列数が多い表。狭い画面では横スクロールで見る(ボタンを縦積みにしない) */
table.data.wide { min-width: 900px; }
table.data th, table.data td {
  border-bottom: 1px solid var(--line);
  padding: 12px 12px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
table.data th.wrap, table.data td.wrap { white-space: normal; min-width: 220px; }
/* ボタンが並ぶ列。幅が足りなければ横スクロールではなく折り返す */
table.data td.actions {
  white-space: normal;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
/* 並べ替えの ↑ ↓。横に 2 つ並ぶ幅に収める */
table.data td.actions.arrows { flex-wrap: nowrap; gap: 4px; }
button.arrow {
  padding: 6px 0;
  min-width: 36px;
  min-height: 34px;
  font-size: 15px;
  line-height: 1;
}
button.arrow:disabled { background: #fff; color: #c3cad4; border-color: var(--line); }
table.data th {
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: var(--surface-2); }
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, "Courier New", monospace; }

/* ── 統計タイル ───────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.stat .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 30px; font-weight: 700; line-height: 1.35; letter-spacing: -0.01em; }
.stat.attention { border-color: #f3d5ac; background: #fffaf3; }
.stat.attention .value { color: var(--warn); }

/* ── タブ ────────────────────────────────── */
.tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tabs button {
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  font-weight: 600;
  font-size: 14.5px;
  padding: 9px 16px;
  min-height: 42px;
  border-radius: 999px;
}
.tabs button:hover { background: var(--surface-2); color: var(--text); }
.tabs button[aria-selected="true"] {
  background: var(--brand-strong);
  color: #fff;
  border-color: var(--brand-strong);
}

/* ── PDF 表示 ─────────────────────────────── */
.pdf-frame {
  width: 100%;
  height: 78vh;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

/* ── 見たまま編集(通達作成)──────────────── */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 9px;
  border: 1px solid var(--line-strong);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--surface-2);
}
.editor-toolbar button {
  font-size: 13.5px;
  padding: 8px 12px;
  min-height: 40px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-weight: 600;
}
.editor-toolbar button:hover { background: var(--brand-tint); border-color: var(--brand-tint-line); }
.editor {
  border: 1px solid var(--line-strong);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 16px;
  min-height: 260px;
  background: #fff;
  font-size: 16.5px;
  line-height: 1.95;
}
.editor:empty::before { content: attr(data-placeholder); color: var(--faint); }

/* ── ログイン画面 ─────────────────────────── */
.login-wrap { max-width: 430px; margin: 0 auto; padding: 48px 20px 72px; }
.login-logo { display: block; margin: 0 auto 26px; height: 74px; width: auto; }
.login-wrap .card { padding: 28px 26px; border-radius: 18px; box-shadow: var(--shadow); }
.login-title { text-align: center; font-size: 19px; font-weight: 700; margin: 0 0 6px; }
.login-sub { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.login-notes {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.9;
  margin: 22px 0 0;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

/* ── ホームの見出し ───────────────────────── */
.greeting { display: flex; align-items: baseline; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.greeting .name { font-size: 25px; font-weight: 700; }
.greeting .sub { font-size: 14px; color: var(--muted); }

/* ── 社訓ページ ───────────────────────────── */
.philosophy-hero {
  text-align: center;
  padding: 44px 20px 40px;
  background: linear-gradient(180deg, #ffffff 0%, var(--brand-tint) 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  margin-bottom: 22px;
}
.philosophy-hero img { height: 92px; width: auto; margin-bottom: 18px; }
.philosophy-hero p { color: var(--muted); font-size: 14.5px; margin: 0; }

.creed { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); padding: 30px 26px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.creed .creed-label {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.26em;
  color: var(--brand);
  display: block;
  margin-bottom: 14px;
}
.creed .creed-lead {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.6;
  letter-spacing: 0.02em;
  margin: 0 0 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.creed p { margin: 0 0 1em; line-height: 2; color: #263140; }
.creed p:last-child { margin-bottom: 0; }

/* VALUE(5 DNA)の 5 項目 */
.dna { list-style: none; margin: 0; padding: 0; counter-reset: dna; }
.dna li {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.dna li:first-child { padding-top: 0; }
.dna li:last-child { border-bottom: none; padding-bottom: 0; }
.dna .dna-no {
  flex: none;
  width: 34px;
  font-size: 22px;
  font-weight: 700;
  color: var(--brand);
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
.dna .dna-text { font-size: 19px; font-weight: 700; line-height: 1.6; letter-spacing: 0.02em; }

@media (min-width: 760px) {
  .dna .dna-no { font-size: 25px; width: 42px; }
  .dna .dna-text { font-size: 21px; }
}

/* ── 個人情報の取り扱いの掲示 ─────────────── */
.privacy-note { font-size: 14px; color: var(--muted); }
.privacy-note summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  padding: 6px 0;
  list-style: revert;
}
.privacy-note summary::marker { color: var(--faint); }
.privacy-note p { margin: 10px 0; line-height: 1.9; }
.privacy-note strong { color: var(--text); }
.login-wrap .privacy-note {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

/* ── フッタ ──────────────────────────────── */
.footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 20px 56px;
  font-size: 12.5px;
  color: var(--faint);
  text-align: center;
  line-height: 1.9;
}
.footer img { height: 24px; width: auto; opacity: 0.55; display: block; margin: 0 auto 12px; }

/* ── PC 表示 ─────────────────────────────── */
@media (min-width: 760px) {
  main { padding: 36px 20px 88px; }
  h1 { font-size: 28px; }
  .card { padding: 26px; }
  .creed { padding: 40px 38px; }
  .creed .creed-lead { font-size: 30px; }
  .philosophy-hero { padding: 60px 24px 54px; }
}

/* 印刷時は操作部分を消す */
@media print {
  .site-header, .nav, .button-row, .tabs, .footer { display: none !important; }
  body { background: #fff; }
  .card { border: none; box-shadow: none; padding: 0; }
}

/* 動きを減らす設定の端末では、遷移効果を止める */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
