/* SYS (システム管理) (sys) — 業務アプリ群 共通デザイン（hotta-hagane.co.jp 実測デザインシステム実装）
   DESIGN.md 準拠。hotta-hagane2024 テーマ（WordPress）の CSS 実測値をトークン化。
   和文フォント UD新ゴ NT DB はモリサワ商用のためヒラギノ/游ゴシック代替。数字・欧文は Mulish。 */

/* ================= Design Tokens（実測値） ================= */
:root {
  /* Brand */
  --navy:        #004080;  /* コーポレートネイビー（唯一のブランド色） */
  --navy-deep:   #004f8a;  /* 深色バリアント */
  --link-blue:   #0172bb;  /* テキストリンク */
  --bright-blue: #0074ff;  /* 強調アクセント */
  --sky-pale:    #c8e9ff;  /* 淡い空色ティント（バッジ地） */

  /* Category palette（トップページ由来 — 部門/分類の色分け用） */
  --cat-red:     #c40023;
  --cat-yellow:  #eabb00;
  --cat-orange:  #d16a1a;
  --cat-sky:     #42a5d6;
  --cat-blue:    #0d75b7;
  --cat-magenta: #bc0077;
  --cat-wine:    #811333;

  /* Surface */
  --canvas:   #ffffff;
  --bg-alt:   #f1f1f1;
  --hairline: #d5d3d3;
  --gray-400: #c1c1c1;
  --gray-700: #767676;

  /* Text */
  --ink:      #000000;
  --ink-soft: #333333;
  --on-navy:  #ffffff;

  /* Radius（実測: 10 / 20 / 30 / 40px。影は使わない＝フラット） */
  --r-btn: 10px; --r-card: 20px; --r-lg: 30px; --r-xl: 40px; --r-full: 9999px;

  /* Typeface — UD新ゴ NT DB（商用）→ ヒラギノ/游ゴシック代替。数字は Mulish */
  --font: "UD新ゴ NT DB", "UD Shin Go NT DemiBold",
          "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro",
          "Yu Gothic UI", "游ゴシック", "Meiryo", sans-serif;
  --font-num: "Mulish", var(--font);
}

/* ================= Base ================= */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--canvas);
  color: var(--ink);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: 0.02em;      /* 本文もややワイド（サイト実測の字間文化） */
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link-blue); }

/* ================= Topbar（ネイビーバンド） ================= */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; padding: 0 24px;
  background: var(--navy);
  color: var(--on-navy);
}
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.topbar-emoji { font-size: 22px; line-height: 1; }
.topbar-title {
  font-size: 16px; font-weight: bold; letter-spacing: 3px;
  color: var(--on-navy);
}
.topbar-code {
  font-size: 12px; font-weight: bold; letter-spacing: 1px;
  padding: 3px 12px; border-radius: var(--r-full);
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: var(--on-navy);
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-user { font-size: 13px; letter-spacing: 1px; color: var(--sky-pale); }
.logout-form { margin: 0; }
.btn-logout {
  font-family: var(--font);
  font-size: 13px; font-weight: bold; letter-spacing: 1px;
  padding: 8px 18px; cursor: pointer;
  background: transparent; color: var(--on-navy);
  border: 1px solid #fff; border-radius: var(--r-btn);
  transition: background-color 0.3s, color 0.3s;
}
.btn-logout:hover { background: #fff; color: var(--navy); }

/* ================= Layout ================= */
.main { max-width: 1100px; margin: 0 auto; padding: 24px 30px; }

/* ================= Flash ================= */
.flash-wrap { margin-bottom: 16px; }
.flash {
  padding: 12px 20px; margin-bottom: 8px;
  border-radius: var(--r-btn);
  font-size: 14px; font-weight: bold;
  background: var(--bg-alt); color: var(--ink-soft);
  border: 1px solid var(--hairline);
}
.flash-danger  { background: #fff; color: var(--cat-red); border: 1px solid var(--cat-red); }
.flash-warning { background: #fff; color: var(--cat-orange); border: 1px solid var(--cat-orange); }
.flash-success { background: var(--sky-pale); color: var(--navy); border: 1px solid var(--navy); }

/* ================= Login ================= */
.page-login .main { max-width: none; padding: 0; }
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 48px 24px;
  background: var(--bg-alt);
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-top: 6px solid var(--navy);   /* コーポレートカラーのアクセントバー */
  border-radius: var(--r-card);
  padding: 44px 36px;
  text-align: center;
}
.login-emoji { font-size: 48px; line-height: 1; margin-bottom: 4px; }
.login-title {
  margin: 20px 0 8px;
  font-size: 24px; font-weight: bold; line-height: 1.4; letter-spacing: 5px;
  color: var(--ink);
}
.login-subtitle {
  display: block;
  margin: 0 0 28px;
  font-size: 13px; font-weight: bold; letter-spacing: 3px;
  color: var(--gray-700);
}
.login-label {
  display: block; text-align: left;
  font-size: 13px; font-weight: bold; letter-spacing: 1px;
  color: var(--ink);
  margin: 16px 0 6px;
}
.login-input {
  width: 100%; height: 46px;
  padding: 10px 16px;
  font-family: var(--font); font-size: 16px;
  background: var(--canvas); color: var(--ink);
  border: 1px solid var(--gray-400);
  border-radius: var(--r-btn);
}
.login-input::placeholder { color: var(--gray-400); }
.login-input:focus {
  outline: 2px solid var(--link-blue);
  outline-offset: -1px;
  border-color: transparent;
}
.login-btn {
  position: relative;
  width: 100%; margin-top: 30px;
  height: 56px; padding: 0 40px 0 24px;
  font-family: var(--font); font-size: 16px; font-weight: bold; letter-spacing: 2px;
  background: var(--navy); color: var(--on-navy);
  border: 1px solid var(--navy); border-radius: var(--r-btn);
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s;
}
.login-btn::after {                 /* シェブロン矢印（サイト署名の CTA 記号） */
  content: ""; position: absolute;
  width: 10px; height: 10px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  top: 50%; right: 24px;
  transform: translateY(-50%) rotate(-45deg);
}
.login-btn:hover { background: #fff; color: var(--navy); }

/* ================= Home（旧スケルトン互換） ================= */
.home { display: flex; justify-content: center; padding-top: 48px; }
.home-card {
  width: 100%; max-width: 600px;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-top: 6px solid var(--navy);
  border-radius: var(--r-card);
  padding: 48px 40px;
  text-align: center;
}
.home-emoji { font-size: 56px; line-height: 1; margin-bottom: 4px; }
.home-title {
  margin: 20px 0 8px;
  font-size: 28px; font-weight: bold; line-height: 1.4; letter-spacing: 5px;
  color: var(--ink);
}
.home-lead { margin: 10px 0; font-size: 16px; font-weight: bold; line-height: 1.6; }
.home-note { margin: 10px 0 0; font-size: 14px; line-height: 1.6; color: var(--gray-700); }
.home-badge {
  display: inline-block; margin-top: 28px;
  font-size: 12px; font-weight: bold; letter-spacing: 1px;
  padding: 5px 16px; border-radius: var(--r-full);
  background: var(--sky-pale); color: var(--navy);
}

/* ================= Dashboard ================= */
.dash { padding: 8px 0 48px; }
.dash-hero { padding: 36px 0 8px; }
.dash-title {
  margin: 0 0 8px;
  font-size: 28px; font-weight: bold; line-height: 1.4; letter-spacing: 3px;
  color: var(--ink);
}
.dash-date { margin: 0; font-size: 14px; letter-spacing: 1px; color: var(--gray-700); }

.stat-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
  margin: 24px 0;
}
.stat-card {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: 22px 24px;
  border-left: 6px solid var(--navy);   /* ネイビーの縦アクセント */
}
.stat-label {
  margin: 0 0 8px;
  font-size: 13px; font-weight: bold; letter-spacing: 1px;
  color: var(--gray-700);
}
.stat-value {
  margin: 0;
  font-family: var(--font-num);
  font-size: 38px; font-weight: 800; line-height: 1.1;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.stat-delta { margin: 8px 0 0; font-size: 13px; font-weight: bold; color: var(--link-blue); }
.stat-delta-muted { color: var(--gray-700); }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.dash-card {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: 24px;
}
.dash-card-wide { grid-column: 1 / -1; }
.dash-card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ink);   /* 黒罫線（会社概要テーブルの文法） */
}
.dash-card-title {
  margin: 0;
  font-size: 17px; font-weight: bold; letter-spacing: 2px;
  color: var(--ink);
}
.dash-card-link {
  font-size: 13px; font-weight: bold; letter-spacing: 1px;
  color: var(--link-blue); text-decoration: none;
}

.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 14px; line-height: 1.6;
}
.data-table th {
  text-align: left; padding: 0 8px 8px 0;
  font-size: 12px; font-weight: bold; letter-spacing: 1px;
  color: var(--gray-700);
  border-bottom: 1px solid var(--ink);
}
.data-table td {
  padding: 12px 8px 12px 0;
  border-bottom: 1px dotted var(--gray-400);   /* 点線罫（モバイル表の文法） */
  color: var(--ink);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table .num {
  text-align: right; white-space: nowrap;
  font-family: var(--font-num); font-variant-numeric: tabular-nums;
}

.list-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 13px 0;
  border-bottom: 1px dotted var(--gray-400);
}
.list-row:last-child { border-bottom: none; }
.list-main { font-size: 15px; color: var(--ink); }
.list-strong { font-weight: bold; }
.list-meta { font-size: 13px; color: var(--gray-700); white-space: nowrap; }

.pill-badge {
  display: inline-block;
  font-size: 12px; font-weight: bold; letter-spacing: 1px; line-height: 1.4;
  padding: 3px 12px; border-radius: var(--r-full);
  background: var(--bg-alt); color: var(--ink-soft);
  border: 1px solid var(--hairline);
  white-space: nowrap;
}
.pill-badge-blue   { background: var(--sky-pale); color: var(--navy); border-color: var(--sky-pale); }
.pill-badge-ink    { background: var(--navy); color: var(--on-navy); border-color: var(--navy); }
.pill-badge-red    { background: #fff; color: var(--cat-red); border-color: var(--cat-red); }
.pill-badge-yellow { background: #fff; color: var(--cat-orange); border-color: var(--cat-yellow); }

.link-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.link-tile {
  position: relative; display: block; text-align: center;
  padding: 14px 28px 14px 16px;
  font-size: 14px; font-weight: bold; letter-spacing: 1px;
  background: var(--canvas); color: var(--navy);
  border: 1px solid var(--navy);
  border-radius: var(--r-btn);
  text-decoration: none;
  transition: background-color 0.3s, color 0.3s;
}
.link-tile::after {
  content: ""; position: absolute;
  width: 8px; height: 8px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  top: 50%; right: 14px;
  transform: translateY(-50%) rotate(-45deg);
}
.link-tile:hover { background: var(--navy); color: var(--on-navy); }

.dash-note {
  margin-top: 40px; text-align: center;
  font-size: 12px; letter-spacing: 1px;
  color: var(--gray-700);
}

/* ================= App Switcher（アプリ一覧・相互リンク） ================= */
.app-switcher { position: relative; }
.app-switcher-btn {
  display: inline-flex; align-items: center; gap: 8px;
  list-style: none; cursor: pointer; user-select: none;
  font-family: var(--font);
  font-size: 13px; font-weight: bold; letter-spacing: 1px;
  padding: 8px 18px;
  background: transparent; color: var(--on-navy);
  border: 1px solid #fff; border-radius: var(--r-btn);
  transition: background-color 0.3s, color 0.3s;
}
.app-switcher-btn::-webkit-details-marker { display: none; }
.app-switcher-btn::after {              /* 下向きシェブロン */
  content: ""; display: inline-block;
  width: 7px; height: 7px; margin-top: -4px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.3s;
}
.app-switcher-btn:hover { background: #fff; color: var(--navy); }
.app-switcher[open] .app-switcher-btn { background: #fff; color: var(--navy); }
.app-switcher[open] .app-switcher-btn::after { transform: rotate(-135deg); margin-top: 4px; }
.app-switcher-menu {
  position: absolute; right: 0; top: calc(100% + 10px);
  min-width: 250px; padding: 8px;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-top: 4px solid var(--navy);
  border-radius: var(--r-btn);
  z-index: 30;
}
.app-switcher-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 30px 12px 12px;
  font-size: 14px; font-weight: bold; letter-spacing: 1px;
  color: var(--ink); text-decoration: none;
  border-bottom: 1px dotted var(--gray-400);
  border-radius: 6px;
  transition: background-color 0.2s;
}
.app-switcher-item:last-child { border-bottom: none; }
.app-switcher-item::after {             /* 右向きシェブロン */
  content: ""; position: absolute;
  width: 7px; height: 7px;
  border-right: 2px solid var(--navy); border-bottom: 2px solid var(--navy);
  top: 50%; right: 12px;
  transform: translateY(-50%) rotate(-45deg);
}
.app-switcher-item:hover { background: var(--bg-alt); }
.app-switcher-item.is-current {
  background: var(--sky-pale); color: var(--navy);
  pointer-events: none;
}
.app-switcher-item.is-current::after { content: none; }
.app-switcher-emoji { font-size: 18px; line-height: 1; }

/* ================= Responsive（実測ブレークポイント: 768 / 1024） ================= */
@media (max-width: 1023px) {
  .stat-row { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .main { padding: 16px; }
  .topbar { padding: 0 16px; }
  .topbar-title { display: none; }
  .stat-row { grid-template-columns: 1fr; }
  .dash-title { font-size: 22px; letter-spacing: 2px; }
  .home-title, .login-title { font-size: 20px; letter-spacing: 3px; }
  .login-card { padding: 36px 20px; }
  .data-table { display: block; overflow-x: auto; }
}
