/* ============================================================
   機械代管理システム 共通スタイル
   経理データを長時間見るため、目が疲れにくい配色と余白にしている。
   ライト／ダークはブラウザの設定に追従する。
   ============================================================ */

:root {
  color-scheme: light dark;

  --bg: #f2f4f8;
  --bg-soft: #e8ecf3;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --line: #dde3ec;
  --line-strong: #c3ccdb;

  --text: #16202e;
  --text-soft: #5a6779;
  --text-faint: #8a95a6;

  --accent: #2f5fd0;
  --accent-strong: #24499f;
  --accent-soft: #e8efff;

  --ok: #17795e;
  --ok-soft: #e2f5ef;
  --warn: #9a6400;
  --warn-soft: #fdf3dd;
  --danger: #b3261e;
  --danger-soft: #fdecea;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 32, 51, .06), 0 8px 24px rgba(20, 32, 51, .06);
  --shadow-sm: 0 1px 2px rgba(20, 32, 51, .08);
  --sidebar-w: 232px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151c;
    --bg-soft: #161b24;
    --surface: #1a212b;
    --surface-2: #202836;
    --line: #2b3543;
    --line-strong: #3b4757;

    --text: #e6ebf2;
    --text-soft: #a3b0c2;
    --text-faint: #7c8899;

    --accent: #6b9bff;
    --accent-strong: #8db4ff;
    --accent-soft: #1e2b45;

    --ok: #5fd2ac;
    --ok-soft: #14322a;
    --warn: #e8b75a;
    --warn-soft: #35290f;
    --danger: #ff8b82;
    --danger-soft: #3a1c1a;

    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Yu Gothic UI", "Hiragino Sans", "Noto Sans JP", "Meiryo", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 数字は等幅にして桁を揃える */
.num, td.num, th.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  text-align: right;
  white-space: nowrap;
}

/* ---------------------------------------------- ログイン画面 */

.auth {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  background: var(--bg);
}

.auth__art {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 46px 52px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  color: #f4f7ff;
  background: linear-gradient(155deg, #14213f 0%, #0f1a30 55%, #0b1322 100%);
}

/* 背景に薄い方眼を敷き、ゆっくり流して動きを出す */
.auth__art::before {
  content: "";
  position: absolute;
  inset: -60px;
  z-index: -2;
  background-image:
    linear-gradient(rgba(255, 255, 255, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .055) 1px, transparent 1px);
  background-size: 46px 46px;
  animation: grid-drift 18s linear infinite;
}

@keyframes grid-drift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(46px, 46px, 0); }
}

/* 漂う光の玉。3つを別々の速さで動かして単調さを消す。 */
.orb {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(58px);
  opacity: .55;
  will-change: transform;
}
.orb--1 {
  width: 460px; height: 460px; top: -110px; left: -90px;
  background: radial-gradient(circle, #3f74f0 0%, transparent 70%);
  animation: float-a 14s ease-in-out infinite;
}
.orb--2 {
  width: 400px; height: 400px; bottom: -130px; right: -70px;
  background: radial-gradient(circle, #2a4fb8 0%, transparent 70%);
  animation: float-b 17s ease-in-out infinite;
}
.orb--3 {
  width: 300px; height: 300px; top: 42%; left: 52%;
  background: radial-gradient(circle, #4fb3e8 0%, transparent 70%);
  opacity: .32;
  animation: float-c 20s ease-in-out infinite;
}

@keyframes float-a {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(110px, 84px) scale(1.2); }
}
@keyframes float-b {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-100px, -72px) scale(1.16); }
}
@keyframes float-c {
  0%, 100% { transform: translate(0, 0); }
  33%      { transform: translate(-92px, 66px); }
  66%      { transform: translate(78px, -58px); }
}

/* 書類を読み取っている様子を表す走査線 */
.scanline {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 130px;
  z-index: -1;
  background: linear-gradient(180deg, transparent 0%, rgba(122, 164, 255, .16) 50%, transparent 100%);
  animation: scan 5.2s cubic-bezier(.45, 0, .55, 1) infinite;
}

@keyframes scan {
  0%       { transform: translateY(-140px); opacity: 0; }
  12%      { opacity: 1; }
  88%      { opacity: 1; }
  100%     { transform: translateY(100dvh); opacity: 0; }
}

.auth__brand { display: flex; align-items: center; gap: 12px; }
.auth__mark {
  width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .13);
  border: 1px solid rgba(255, 255, 255, .2);
  font-size: 19px;
}
.auth__brandname { font-weight: 700; letter-spacing: .04em; font-size: 14.5px; }

.auth__center { display: grid; align-content: center; justify-items: start; }

/* 社名を1文字ずつ、回りながら飛び込ませる。出たあとも軽く波打たせる。 */
.auth__logo {
  position: relative;
  margin: 0;
  font-size: clamp(30px, 3.6vw, 46px);
  font-weight: 700;
  letter-spacing: .14em;
  line-height: 1.3;
  perspective: 700px;
}
.auth__logo span {
  display: inline-block;
  opacity: 0;
  transform: translateY(56px) rotateX(-80deg) scale(.55);
  filter: blur(10px);
  /* 飛び込み → そのまま波打ちへ続ける */
  animation:
    burst .85s cubic-bezier(.16, 1.5, .3, 1) forwards,
    wave 3.6s ease-in-out infinite;
}
.auth__logo span:nth-child(1) { animation-delay: .05s, 1.0s; }
.auth__logo span:nth-child(2) { animation-delay: .13s, 1.1s; }
.auth__logo span:nth-child(3) { animation-delay: .21s, 1.2s; }
.auth__logo span:nth-child(4) { animation-delay: .32s, 1.3s; }
.auth__logo span:nth-child(5) { animation-delay: .40s, 1.4s; }
.auth__logo span:nth-child(6) { animation-delay: .48s, 1.5s; }
.auth__logo span:nth-child(7) { animation-delay: .56s, 1.6s; }
.auth__logo span:nth-child(8) { animation-delay: .64s, 1.7s; }
.auth__logo span:nth-child(9) { animation-delay: .72s, 1.8s; }

@keyframes burst {
  0% {
    opacity: 0;
    transform: translateY(56px) rotateX(-80deg) scale(.55);
    filter: blur(10px);
    text-shadow: none;
  }
  55% {
    opacity: 1;
    transform: translateY(-10px) rotateX(12deg) scale(1.14);
    filter: blur(0);
    text-shadow: 0 0 26px rgba(130, 175, 255, .95), 0 0 60px rgba(90, 140, 255, .6);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotateX(0) scale(1);
    filter: blur(0);
    text-shadow: 0 0 18px rgba(120, 165, 255, .28);
  }
}

/* 出現後、上下にゆらぐ */
@keyframes wave {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

/* 文字の上を光が走る */
.auth__logo::after {
  content: "";
  position: absolute;
  top: -12%;
  left: -35%;
  width: 28%;
  height: 124%;
  pointer-events: none;
  transform: skewX(-18deg);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, .55) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  mix-blend-mode: screen;
  animation: sweep 4.6s 1.2s cubic-bezier(.5, 0, .4, 1) infinite;
}

@keyframes sweep {
  0%       { left: -35%; opacity: 0; }
  12%      { opacity: 1; }
  60%      { opacity: 1; }
  75%, 100% { left: 118%; opacity: 0; }
}

/* 社名の下に伸びる線。伸びたあとは光が往復する。 */
.auth__rule {
  position: relative;
  overflow: hidden;
  height: 2px;
  width: 0;
  margin-top: 22px;
  border-radius: 2px;
  background: linear-gradient(90deg, #6f9dff, rgba(111, 157, 255, 0));
  animation: rule-grow .8s .7s cubic-bezier(.22, .8, .3, 1) forwards;
}
.auth__rule::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, #eaf2ff, transparent);
  transform: translateX(-100%);
  animation: rule-shine 4s 1.8s ease-in-out infinite;
}

@keyframes rule-grow {
  to { width: 300px; }
}
@keyframes rule-shine {
  0%       { transform: translateX(-100%); }
  60%, 100% { transform: translateX(220%); }
}

.auth__foot { font-size: 12px; color: rgba(244, 247, 255, .45); }

.auth__form { display: grid; place-items: center; padding: 40px 28px; }
.auth__panel { width: 100%; max-width: 380px; }
.auth__panel h2 { margin: 0 0 4px; font-size: 21px; }
.auth__lead { margin: 0 0 26px; color: var(--text-soft); font-size: 13px; }

/* 動きを減らす設定の人には静止した状態で見せる */
@media (prefers-reduced-motion: reduce) {
  .auth__art::before, .orb, .scanline,
  .auth__logo span, .auth__logo::after,
  .auth__rule, .auth__rule::after {
    animation: none;
  }
  .auth__logo span { opacity: 1; transform: none; filter: none; }
  .auth__logo::after { display: none; }
  .auth__rule { width: 300px; }
  .scanline { display: none; }
}

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth__art { padding: 30px 24px; gap: 26px; min-height: 240px; }
  .auth__logo { letter-spacing: .1em; }
  .auth__rule { animation-name: rule-grow-sm; }
  @keyframes rule-grow-sm { to { width: 180px; } }
}

/* ---------------------------------------------- フォーム部品 */

.field { margin-bottom: 16px; }
.field > label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
}

.input, select.input, textarea.input {
  width: 100%;
  padding: 11px 13px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, select.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s, transform .06s;
}
.btn:hover { background: var(--accent-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--block { width: 100%; }
.btn--ghost {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line-strong);
}
.btn--ghost:hover { background: var(--surface-2); }
.btn--sm { padding: 7px 13px; font-size: 13px; }

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert--error { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.alert--warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.alert--ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }

/* ---------------------------------------------- アプリの骨格 */

.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100dvh; }

.side {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
}
.side__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line);
}
.side__mark {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  color: #fff; font-size: 15px;
  background: linear-gradient(140deg, #3f6de0, #23417f);
}
.side__title { font-weight: 700; font-size: 14px; letter-spacing: .02em; }
.side__nav { padding: 12px 10px; display: grid; gap: 2px; overflow-y: auto; }
.side__label {
  padding: 12px 10px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--text-faint);
}
.side__link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 13.5px;
}
.side__link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.side__link.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side__icon { width: 18px; text-align: center; }
.side__foot { margin-top: auto; padding: 14px; border-top: 1px solid var(--line); }
.side__user { font-size: 12.5px; color: var(--text-soft); margin-bottom: 8px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 16px 26px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { margin: 0; font-size: 17px; font-weight: 700; }
.topbar__sub { margin: 2px 0 0; font-size: 12.5px; color: var(--text-soft); }
.content { padding: 24px 26px 56px; max-width: 1440px; width: 100%; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; }
  .side__nav { display: flex; padding: 8px; }
  .side__label, .side__foot { display: none; }
  .content { padding: 18px 14px 40px; }
}

/* ---------------------------------------------- カード・表 */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.card__head h2 { margin: 0; font-size: 14.5px; font-weight: 700; }
.card__note { font-size: 12.5px; color: var(--text-soft); }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.stat { padding: 16px 18px; }
.stat__label { font-size: 12px; color: var(--text-soft); margin-bottom: 6px; }
.stat__value { font-size: 25px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat__unit { font-size: 13px; font-weight: 500; color: var(--text-soft); margin-left: 3px; }
.stat__foot { margin-top: 6px; font-size: 12px; color: var(--text-faint); }

.tablewrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
table.data thead th {
  position: sticky; top: 0;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  border-bottom: 1px solid var(--line-strong);
  z-index: 1;
}
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
/* 合計行（ダッシュボードのメーカー別 振込・でんさい） */
table.data tfoot th { border-top: 2px solid var(--line-strong); border-bottom: 0; background: var(--surface-2); font-weight: 700; }
table.data td.wrap { white-space: normal; min-width: 16em; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
}
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--muted { background: var(--bg-soft); color: var(--text-soft); }

.empty { padding: 44px 20px; text-align: center; color: var(--text-faint); }
.empty__icon { font-size: 30px; display: block; margin-bottom: 8px; opacity: .6; }

/* 月別の支払額を横棒で見せる簡易グラフ */
.bars { display: grid; gap: 9px; }
.bar { display: grid; grid-template-columns: 5.5em 1fr 8.5em; align-items: center; gap: 10px; }
.bar__label { font-size: 12.5px; color: var(--text-soft); }
.bar__track { height: 9px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.bar__fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #4b7bef, #7aa4ff); }
.bar__value { font-size: 12.5px; font-variant-numeric: tabular-nums; text-align: right; }

.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.toolbar .field { margin-bottom: 0; }
.toolbar .field--grow { flex: 1 1 220px; }

.section-title { margin: 26px 0 12px; font-size: 13px; font-weight: 700; color: var(--text-soft); letter-spacing: .04em; }
.stack { display: grid; gap: 16px; }

/* ============================================================
   ログイン後の画面の作り込み
   数字が主役なので、色と余白でめりはりを付ける。
   ============================================================ */

/* ---- 画面上部の見出し帯 ---- */

.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
  color: #eef3ff;
  background: linear-gradient(120deg, #1b2f5e 0%, #16233f 60%, #131c2f 100%);
  box-shadow: var(--shadow);
}
.hero::after {
  content: "";
  position: absolute;
  right: -70px; top: -90px;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(96, 145, 255, .38) 0%, transparent 68%);
  pointer-events: none;
}
.hero__row { position: relative; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px; }
.hero__label { font-size: 12px; letter-spacing: .08em; color: rgba(238, 243, 255, .62); }
.hero__sub { margin-top: 4px; font-size: 12px; color: rgba(238, 243, 255, .62); }
.hero__value { font-size: 34px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.25; }
.hero__value small { font-size: 15px; font-weight: 500; margin-left: 4px; color: rgba(238, 243, 255, .7); }
.hero__meta { display: flex; flex-wrap: wrap; gap: 20px; }
.hero__meta div { font-size: 12.5px; color: rgba(238, 243, 255, .68); }
.hero__meta strong { display: block; font-size: 17px; color: #eef3ff; font-variant-numeric: tabular-nums; }

/* 月を選ぶタブ */
.monthtabs { position: relative; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.monthtab {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  color: rgba(238, 243, 255, .72);
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  transition: background .15s, color .15s;
}
.monthtab:hover { background: rgba(255, 255, 255, .16); color: #fff; text-decoration: none; }
.monthtab.is-active { background: #fff; color: #1b2f5e; font-weight: 700; border-color: #fff; }

/* ---- 色付きの数字カード ---- */

.stat {
  position: relative;
  overflow: hidden;
  padding: 18px 18px 18px 22px;
  transition: transform .16s, box-shadow .16s;
}
.stat::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--tone, var(--accent));
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.stat__icon {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: 14px;
  color: var(--tone, var(--accent));
  background: var(--tone-soft, var(--accent-soft));
}
.stat--blue { --tone: #2f5fd0; --tone-soft: #e8efff; }
.stat--green { --tone: #17795e; --tone-soft: #e2f5ef; }
.stat--amber { --tone: #9a6400; --tone-soft: #fdf3dd; }
.stat--violet { --tone: #6146c6; --tone-soft: #eeeaff; }
@media (prefers-color-scheme: dark) {
  .stat--blue { --tone: #6b9bff; --tone-soft: #1e2b45; }
  .stat--green { --tone: #5fd2ac; --tone-soft: #14322a; }
  .stat--amber { --tone: #e8b75a; --tone-soft: #35290f; }
  .stat--violet { --tone: #a893ff; --tone-soft: #241f3f; }
}

/* ---- 決済方法の内訳（円グラフ） ---- */

.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut {
  width: 132px; height: 132px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: grid; place-items: center;
  background: conic-gradient(var(--slices, var(--accent) 0 100%));
  position: relative;
}
.donut::after {
  content: "";
  position: absolute;
  inset: 17px;
  border-radius: 50%;
  background: var(--surface);
}
.donut__center { position: relative; z-index: 1; text-align: center; line-height: 1.3; }
.donut__center b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.donut__center span { font-size: 11px; color: var(--text-soft); }
.legend { display: grid; gap: 8px; min-width: 0; }
.legend__item { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend__dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.legend__name { color: var(--text-soft); }
.legend__value { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---- 棒グラフを伸ばす ---- */

.bar__fill { width: 0; transition: width .9s cubic-bezier(.22, .8, .3, 1); }
.bar.is-current .bar__label { color: var(--text); font-weight: 700; }
.bar.is-current .bar__fill { background: linear-gradient(90deg, #1f47a8, #4b7bef); }
.bar__track { position: relative; }

/* ---- 順位の丸 ---- */

.rank {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px;
  border-radius: 7px;
  font-size: 11.5px; font-weight: 700;
  background: var(--bg-soft); color: var(--text-soft);
}
.rank--1 { background: #fbe9c4; color: #8a5a00; }
.rank--2 { background: #e4e8ef; color: #4d5a6d; }
.rank--3 { background: #f4ddcb; color: #85512a; }
@media (prefers-color-scheme: dark) {
  .rank--1 { background: #40320f; color: #f0c465; }
  .rank--2 { background: #2c3543; color: #b9c5d6; }
  .rank--3 { background: #3d2b1c; color: #dda06a; }
}

/* ---- カードの登場 ---- */

.reveal { opacity: 0; transform: translateY(10px); animation: reveal .5s cubic-bezier(.22, .8, .3, 1) forwards; }
.reveal:nth-child(1) { animation-delay: .02s; }
.reveal:nth-child(2) { animation-delay: .07s; }
.reveal:nth-child(3) { animation-delay: .12s; }
.reveal:nth-child(4) { animation-delay: .17s; }
.reveal:nth-child(5) { animation-delay: .22s; }
@keyframes reveal { to { opacity: 1; transform: translateY(0); } }

/* ---- 表を見やすく ---- */

table.data tbody tr { transition: background .12s; }
table.data tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
table.data tbody tr:hover { background: var(--accent-soft); }

/* 進捗を示す細い帯 */
.mini-bar { height: 5px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; margin-top: 6px; }
.mini-bar > i { display: block; height: 100%; border-radius: 999px; background: var(--tone, var(--accent)); }

/* サイドメニューの現在地を目立たせる */
.side__link { position: relative; }
.side__link.is-active::before {
  content: "";
  position: absolute;
  left: -10px; top: 50%;
  width: 3px; height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  transform: translateY(-50%);
}

@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; opacity: 1; transform: none; }
  .bar__fill { transition: none; }
  .stat:hover { transform: none; }
}

/* ---- 台帳から書類をダウンロードするボタン ---- */

td.docs { white-space: nowrap; }
.doc {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 24px;
  padding: 0 7px;
  margin-right: 4px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid transparent;
  transition: transform .12s, filter .12s;
}
.doc:hover { text-decoration: none; transform: translateY(-1px); filter: brightness(1.06); }
.doc--invoice { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.doc--contract { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.doc--zip { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }

/* ---- 一括ダウンロードの選択バー ---- */

.selbar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  transform: translate(-50%, 20px);
  opacity: 0;
  transition: transform .18s cubic-bezier(.22,.8,.3,1), opacity .18s;
}
.selbar.is-shown { transform: translate(-50%, 0); opacity: 1; }
.selbar__count { font-size: 13px; color: var(--text-soft); padding-left: 6px; }
.selbar__count b { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }

/* 行の選択が分かるようにする */
table.data tbody tr.is-selected { background: var(--accent-soft); }
table.data input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .selbar { transition: none; }
}

/* ---- 絞り込み結果をまとめて選ぶときの案内 ---- */

.allnote {
  padding: 9px 18px;
  font-size: 13px;
  color: var(--accent);
  background: var(--accent-soft);
  border-bottom: 1px solid var(--line);
}
.allnote b { font-variant-numeric: tabular-nums; }
.linklike {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}
.linklike:hover { opacity: .8; }

/* ---- 確認状態の切り替えボタン ---- */

.statusbtn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 7px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: var(--bg-soft);
  color: var(--text-soft);
  border: 1px solid var(--line-strong);
  transition: background .13s, color .13s, border-color .13s, transform .1s;
}
.statusbtn:hover { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.statusbtn:active { transform: scale(.96); }
.statusbtn__mark { font-size: 12px; line-height: 1; }
.statusbtn.is-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.statusbtn.is-confirmed { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.statusbtn.is-confirmed:hover { background: var(--bg-soft); color: var(--text-soft); border-color: var(--line-strong); }
.statusbtn.is-busy { opacity: .5; pointer-events: none; }

/* 確認済みにした瞬間に光らせる */
.statusbtn.is-flash { animation: statusflash .55s ease-out; }
@keyframes statusflash {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); }
  100% { box-shadow: 0 0 0 12px transparent; }
}

.btn--ok { background: var(--ok); }
.btn--ok:hover { background: color-mix(in srgb, var(--ok) 82%, #000); }

@media (prefers-reduced-motion: reduce) {
  .statusbtn.is-flash { animation: none; }
}

/* ---- 台帳の修正画面（左：入力／右：書類） ---- */

.editlayout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
@media (max-width: 1200px) {
  .editlayout { grid-template-columns: 1fr; }
  .viewer { position: static !important; height: 70vh; }
}

.formgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}
.formgrid .field { margin-bottom: 0; }
.formgrid .field--wide { grid-column: 1 / -1; }
.input--num { text-align: right; font-variant-numeric: tabular-nums; }

.calcgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
.calcgrid > div { display: grid; gap: 2px; }
.calcgrid span { font-size: 12px; color: var(--text-soft); }
.calcgrid b { font-size: 18px; font-variant-numeric: tabular-nums; }
.calcgrid__total { color: var(--accent); }

/* 台帳の修正画面：契約書の支払条件と一括払いへの変更 */
.planbox { padding: 14px 18px 16px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.planbox__lead { margin: 0; }
.planbox__terms summary { cursor: pointer; font-size: 13px; color: var(--text-soft); }
.planbox__terms ul { margin: 6px 0 0 18px; padding: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.planbox__form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.planbox__form .field { margin-bottom: 0; }
.planbox__hint { margin: 0; font-size: 12px; }
.planbox .btn { justify-self: start; }
.planmethods { display: grid; gap: 6px; }
.planmethods__title { font-size: 13px; color: var(--text-soft); }
.planmethods__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; font-variant-numeric: tabular-nums; }
.planmethods__row .input { width: auto; min-width: 150px; padding-block: 4px; }
.planmethods__check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-top: 4px; }

/* 機械一覧：表の中で直接入力する欄 */
table.machines td { vertical-align: middle; }
.input--cell { padding: 3px 6px; font-size: 12.5px; min-width: 92px; }
.input--mini { min-width: 60px; }

/* 書類のビューア。スクロールしても付いてくる。 */
.viewer {
  position: sticky;
  top: 78px;
  height: calc(100dvh - 110px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.viewer__tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.viewer__tab {
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-soft);
  background: transparent;
  border: 1px solid transparent;
}
.viewer__tab:hover { background: var(--bg-soft); }
.viewer__tab.is-active { background: var(--accent); color: #fff; }
.viewer__open { margin-left: auto; font-size: 12px; }
.viewer__frame { flex: 1; width: 100%; border: 0; background: var(--bg-soft); }
.doc--edit { background: var(--bg-soft); color: var(--text-soft); border-color: var(--line-strong); }

/* ---- シート選択のボタン列 ---- */

.sheetpick__label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-soft);
  margin-bottom: 8px;
}
.sheetpick__count {
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-soft);
  color: var(--text-faint);
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--text-soft);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: background .13s, color .13s, border-color .13s;
}
.chip:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.chip.is-active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }

/* シートの中身は行が多いので詰めて表示する */
.sheetview { max-height: 70vh; overflow: auto; }
table.data--compact th, table.data--compact td { padding: 5px 9px; font-size: 12.5px; }
td.rownum, th.rownum {
  position: sticky; left: 0;
  width: 46px;
  text-align: right;
  color: var(--text-faint);
  background: var(--surface-2);
  font-variant-numeric: tabular-nums;
}
table.data--compact tbody tr:hover td.rownum { background: var(--accent-soft); }

/* ---- ファイルの種類を示す小さな印 ---- */

.filemark {
  display: inline-grid;
  place-items: center;
  width: 20px; height: 20px;
  margin-right: 6px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 700;
  vertical-align: -4px;
  color: #fff;
  background: #1d7044;              /* Excel */
}
.filemark--pdf { background: #b3261e; }  /* PDF */

/* ---- メーカー別サマリー ---- */

.makerlayout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
@media (max-width: 1100px) {
  .makerlayout { grid-template-columns: 1fr; }
}

.makerlist { list-style: none; margin: 0; padding: 0; max-height: 70vh; overflow-y: auto; }
.makerlist__item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  transition: background .12s;
}
.makerlist__item:hover { background: var(--surface-2); text-decoration: none; }
.makerlist__item.is-active { background: var(--accent-soft); }
.makerlist__item.is-active .makerlist__name { color: var(--accent); font-weight: 700; }
.makerlist__name { font-size: 13px; line-height: 1.4; }
.makerlist__amount { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.makerlist__count { grid-column: 1 / -1; font-size: 11.5px; color: var(--text-faint); }

/* ---- Excel出力画面の押印指定 ---- */
.stampform { position: relative; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.stampform__row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.stampform__label { font-size: 12px; font-weight: 700; color: var(--text-soft); letter-spacing: .04em; }
.stampform__name {
  width: 92px; padding: 7px 10px; font-size: 14px; font-weight: 700; text-align: center;
  color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; transition: border-color .15s, box-shadow .15s;
}
.stampform__name:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.stampform__check {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px;
  font-size: 12.5px; color: var(--text-soft); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.stampform__check:hover { border-color: var(--accent); color: var(--text); }
.stampform__check:has(input:checked) { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.stampform__hint { margin: 0; font-size: 11.5px; color: var(--text-faint); }

/* ---- サイドバーの管理画面リンク（管理者だけに出る） ---- */
.side__link--admin { color: var(--text-faint); }
.side__link--admin:hover { color: var(--accent); }

/* ---- 処理中のオーバーレイ（Excel出力） ----
   display:flex は hidden 属性より強いので、消えている状態を明示する。
   これが無いと透明な覆いが画面を覆い続け、何もクリックできなくなる。 */
.busy[hidden] { display: none; }
.busy {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg) 74%, transparent);
  backdrop-filter: blur(3px);
  animation: busyfade .18s ease-out;
}
@keyframes busyfade { from { opacity: 0; } to { opacity: 1; } }

.busy__panel {
  width: min(400px, calc(100vw - 40px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 26px 64px rgba(20, 32, 51, .22);
  overflow: hidden;
}

/* 上部の演出。ログイン画面の光の玉と走査線に合わせている */
.busy__art {
  position: relative; height: 96px; overflow: hidden;
  background: radial-gradient(130% 150% at 18% -10%, #27407a 0%, #16233a 55%, #101a2c 100%);
}
.busy__orb { position: absolute; border-radius: 50%; filter: blur(18px); opacity: .55; }
.busy__orb--1 {
  width: 90px; height: 90px; left: -16px; top: -24px; background: #4f7bff;
  animation: busyfloat 5s ease-in-out infinite;
}
.busy__orb--2 {
  width: 70px; height: 70px; right: 8px; top: 34px; background: #7bc8ff;
  animation: busyfloat 6.4s ease-in-out infinite reverse;
}
@keyframes busyfloat {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(14px, -12px); }
}
.busy__scan {
  position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, #9ec2ff, transparent);
  animation: busyscan 1.9s linear infinite;
}
@keyframes busyscan {
  0%   { transform: translateY(0); opacity: 0; }
  12%  { opacity: 1; }
  100% { transform: translateY(96px); opacity: 0; }
}
.busy__head {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; text-align: center; padding: 0 16px;
}
.busy__head b { font-size: 15px; font-weight: 700; letter-spacing: .03em; }
.busy__now { margin-top: 4px; font-size: 11.5px; color: #a9bde0; }

.busy__body { padding: 18px 26px 22px; }

/* 横並びのステッパー */
.busy__steps { display: flex; margin: 0; padding: 0; list-style: none; }
.busy__steps li { position: relative; flex: 1; text-align: center; }
/* 丸と丸をつなぐ線。進んだところだけ色が付く */
.busy__steps li::before {
  content: ""; position: absolute; top: 9px; left: -50%;
  width: 100%; height: 2px; background: var(--line);
  transition: background .3s;
}
.busy__steps li:first-child::before { display: none; }
.busy__steps li.is-done::before,
.busy__steps li.is-active::before { background: var(--accent); }

.busy__steps i {
  position: relative; display: block; width: 20px; height: 20px; margin: 0 auto 8px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--line);
  font-style: normal; font-size: 11px; font-weight: 700; line-height: 16px;
  color: var(--text-faint);
  transition: background .3s, border-color .3s, color .3s;
}
.busy__steps li.is-done i {
  background: var(--accent); border-color: var(--accent); color: #fff; font-size: 0;
}
.busy__steps li.is-done i::after { content: "✓"; font-size: 11px; }
.busy__steps li.is-active i {
  border-color: var(--accent); color: var(--accent);
  animation: busypulse 1.4s ease-in-out infinite;
}
@keyframes busypulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--accent-soft); }
  50%      { box-shadow: 0 0 0 7px var(--accent-soft); }
}

.busy__steps em {
  display: block; font-style: normal; font-size: 10.5px; line-height: 1.35;
  color: var(--text-faint); transition: color .3s;
}
.busy__steps li.is-done em { color: var(--text-soft); }
.busy__steps li.is-active em { color: var(--text); font-weight: 700; }

.busy__note { margin: 16px 0 0; text-align: center; font-size: 11.5px; color: var(--text-faint); }

@media (prefers-reduced-motion: reduce) {
  .busy, .busy__orb, .busy__scan, .busy__steps li.is-active i { animation: none; }
}

/* 送信直後のボタン（覆いが出るまでの一瞬に反応を見せる） */
.btn.is-busy { opacity: .6; cursor: progress; }

/* ---- データ取得ページ ---- */
.hero__foot { margin-top: 6px; font-size: 12px; color: var(--text-soft); }
.btn--lg { padding: 11px 22px; font-size: 14px; }
.muted { font-size: 12px; color: var(--text-faint); line-height: 1.7; }
.muted code {
  padding: 2px 6px; border-radius: 5px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 11.5px; color: var(--text-soft);
}
/* 何をするかの手順。番号を丸で見せる */
.steplist { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steplist li {
  position: relative;
  padding: 8px 0 8px 34px;
  font-size: 13px;
  color: var(--text-soft);
  counter-increment: step;
}
.steplist li + li { border-top: 1px solid var(--line); }
.steplist li::before {
  content: counter(step);
  position: absolute; left: 0; top: 8px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11px; font-weight: 700; line-height: 22px; text-align: center;
}
.steplist b { color: var(--text); margin-right: 8px; }

/* ---- データ取得の範囲指定 ---- */
.syncform { position: relative; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.syncform__row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.syncform__row--end { justify-content: flex-end; }
.syncform__label { font-size: 12px; font-weight: 700; color: var(--text-soft); letter-spacing: .04em; }
.syncform__select {
  padding: 7px 10px; font-size: 13px; font-weight: 700;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.syncform__select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.syncform__select:disabled { opacity: .45; cursor: not-allowed; }
.syncform__tilde { color: var(--text-faint); font-size: 13px; }

/* ---- 探している様子（レーダー） ---- */
.busy__panel--wide { width: min(440px, calc(100vw - 40px)); }
.busy__art--tall { height: 176px; }

.radar {
  position: absolute; left: 50%; top: 46px; transform: translate(-50%, -50%);
  width: 108px; height: 108px;
}
/* 外へ広がる輪 */
.radar__ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid rgba(158, 194, 255, .55);
  animation: radarpulse 2.4s ease-out infinite;
}
.radar__ring--2 { animation-delay: .8s; }
.radar__ring--3 { animation-delay: 1.6s; }
@keyframes radarpulse {
  0%   { transform: scale(.28); opacity: 0; }
  18%  { opacity: .9; }
  100% { transform: scale(1); opacity: 0; }
}
/* 回る光の線 */
.radar__sweep {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg,
    rgba(126, 170, 255, .55) 0deg, rgba(126, 170, 255, 0) 70deg, transparent 360deg);
  -webkit-mask: radial-gradient(circle, transparent 16px, #000 17px);
  mask: radial-gradient(circle, transparent 16px, #000 17px);
  animation: radarspin 2.2s linear infinite;
}
@keyframes radarspin { to { transform: rotate(360deg); } }
/* 見つかった印 */
.radar__blip {
  position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: #cfe1ff; box-shadow: 0 0 8px rgba(158, 194, 255, .9);
  opacity: 0; animation: radarblip 2.2s linear infinite;
}
.radar__blip--1 { left: 74%; top: 30%; animation-delay: .35s; }
.radar__blip--2 { left: 28%; top: 40%; animation-delay: 1.1s; }
.radar__blip--3 { left: 58%; top: 72%; animation-delay: 1.6s; }
.radar__blip--4 { left: 40%; top: 20%; animation-delay: 2.0s; }
@keyframes radarblip {
  0%, 100% { opacity: 0; transform: scale(.6); }
  8%       { opacity: 1; transform: scale(1.25); }
  45%      { opacity: .35; transform: scale(1); }
}
/* 中央の虫めがね */
.radar__core {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 22px; color: #dbe8ff; opacity: .9;
  animation: radarcore 2.2s ease-in-out infinite;
}
@keyframes radarcore {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50%      { transform: translate(-50%, -50%) scale(1.12); }
}
.busy__head--bottom { justify-content: flex-end; padding-bottom: 14px; }

/* ---- 見つけた件数 ---- */
.tally {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-bottom: 18px;
}
.tally__item {
  padding: 10px 6px; text-align: center;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
}
.tally__item--accent { background: var(--accent-soft); border-color: transparent; }
.tally__num {
  display: block; font-size: 21px; font-weight: 800; line-height: 1.2;
  color: var(--text); font-variant-numeric: tabular-nums;
}
.tally__item--accent .tally__num { color: var(--accent); }
.tally__label { display: block; margin-top: 2px; font-size: 10.5px; color: var(--text-faint); }

@media (prefers-reduced-motion: reduce) {
  .radar__ring, .radar__sweep, .radar__blip, .radar__core { animation: none; }
  .radar__blip { opacity: .8; }
}

/* ---- 差し替え確認の対比表示 ---- */
.versus { display: grid; grid-template-columns: 1fr 44px 1fr; gap: 0; align-items: stretch; }
.versus__side {
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}
/* 後から取り込んだほうを目立たせる（差し替えなら普通はこちらが正） */
.versus__side--new { background: var(--accent-soft); border-color: transparent; }
.versus__mid { display: flex; align-items: center; justify-content: center; }
.versus__arrow { color: var(--text-faint); font-size: 16px; }

.versus__tag {
  display: inline-block; margin-bottom: 8px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  background: var(--surface); color: var(--text-soft); border: 1px solid var(--line);
}
.versus__tag--new { background: var(--accent); color: #fff; border-color: transparent; }
.versus__name { font-size: 14px; font-weight: 700; word-break: break-all; line-height: 1.45; }

.versus__meta { margin: 12px 0 10px; padding: 0; font-size: 12.5px; }
.versus__meta > div {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 5px 0; border-bottom: 1px solid var(--line);
}
.versus__meta dt { margin: 0; color: var(--text-faint); }
.versus__meta dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }

.versus__path {
  margin-bottom: 12px; font-size: 11px; color: var(--text-faint); word-break: break-all;
}
.versus__detail { margin-top: 14px; }
.versus__detail summary {
  font-size: 12px; color: var(--accent); cursor: pointer; user-select: none;
}
.versus__detail p { margin: 8px 0 0; word-break: break-all; }

.btn--block { display: block; width: 100%; text-align: center; }

@media (max-width: 820px) {
  .versus { grid-template-columns: 1fr; }
  .versus__mid { padding: 8px 0; }
  .versus__arrow { transform: rotate(90deg); display: inline-block; }
}

/* サイドバーの件数バッジ */
.side__count {
  margin-left: auto;
  min-width: 18px; padding: 1px 6px; border-radius: 999px;
  background: var(--warn-soft); color: var(--warn);
  font-size: 10.5px; font-weight: 700; text-align: center;
}

/* ============================================================
   マニュアルとチュートリアル
   ============================================================ */

/* ---- チュートリアルの吹き出し ---- */
.tutorial-tip {
  position: absolute; z-index: 120;
  max-width: 320px; padding: 10px 13px;
  background: var(--text); color: #eef3fb;
  border-radius: 10px;
  font-size: 12.5px; line-height: 1.6;
  box-shadow: 0 10px 30px rgba(20, 32, 51, .28);
  pointer-events: none;
}
.tutorial-tip strong { color: #9ec2ff; }
/* 三角の羽根。上に出るときは下向き、下に出るときは上向き。 */
.tutorial-tip::after {
  content: ""; position: absolute; left: 50%; margin-left: -6px;
  border: 6px solid transparent;
}
.tutorial-tip::after { top: 100%; border-top-color: var(--text); }
.tutorial-tip.below::after {
  top: auto; bottom: 100%;
  border-top-color: transparent; border-bottom-color: var(--text);
}

/* 説明がある場所の目印。オンのときだけ出す。 */
.tutorial-on [data-tip] { box-shadow: inset 3px 0 0 var(--accent); }
.tutorial-on [data-tip]:focus { box-shadow: 0 0 0 3px var(--accent-soft); }
.tutorial-on button[data-tip],
.tutorial-on a[data-tip] { box-shadow: 0 0 0 2px var(--accent-soft); }

/* ---- サイドバーのチュートリアル切替 ---- */
.side__tutorial {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 7px 11px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  font-size: 11.5px; color: var(--text-soft); cursor: pointer;
  transition: border-color .15s, color .15s;
}
.side__tutorial:hover { border-color: var(--accent); color: var(--text); }
.side__switch {
  padding: 1px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700;
  background: var(--bg-soft); color: var(--text-faint);
}
.side__switch.is-on { background: var(--accent-soft); color: var(--accent); }

/* ---- 初回の確認 ---- */
.modalback {
  position: fixed; inset: 0; z-index: 130;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(3px);
}
.modalback[hidden] { display: none; }
.modal {
  width: min(420px, calc(100vw - 40px));
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 26px 64px rgba(20, 32, 51, .22);
  overflow: hidden;
}
.modal__art {
  height: 74px; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(130% 150% at 18% -10%, #27407a 0%, #16233a 55%, #101a2c 100%);
  color: #fff; font-size: 15px; font-weight: 700; letter-spacing: .03em;
}
.modal__body { padding: 18px 22px 20px; }
.modal__text { margin: 0 0 18px; font-size: 12.5px; line-height: 1.75; color: var(--text-soft); }
.modal__row { display: flex; justify-content: flex-end; gap: 8px; }

/* ---- マニュアル本文 ---- */
.manual { display: grid; grid-template-columns: 190px 1fr; gap: 22px; align-items: start; }
@media (max-width: 900px) { .manual { grid-template-columns: 1fr; } }

.manual-toc {
  position: sticky; top: 16px;
  padding: 14px 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.manual-toc__label {
  padding: 0 8px 8px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .08em; color: var(--text-faint);
}
.manual-toc a {
  display: block; padding: 7px 9px; border-radius: 7px;
  font-size: 12.5px; color: var(--text-soft); text-decoration: none;
  transition: background .15s, color .15s;
}
.manual-toc a:hover { background: var(--accent-soft); color: var(--accent); }

.manual-body { display: flex; flex-direction: column; gap: 16px; }
.manual-body section { scroll-margin-top: 16px; }
.manual-lead { margin: 0 0 16px; font-size: 13px; line-height: 1.85; color: var(--text-soft); }

/* 手順。番号を丸で見せ、縦線でつなぐ。 */
.manual-steps { margin: 0; padding: 0; list-style: none; counter-reset: mstep; }
.manual-steps li {
  position: relative; padding: 0 0 16px 34px; counter-increment: mstep;
}
.manual-steps li::before {
  content: counter(mstep);
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11px; font-weight: 700; line-height: 22px; text-align: center;
}
.manual-steps li::after {
  content: ""; position: absolute; left: 10.5px; top: 26px; bottom: 4px;
  width: 1px; background: var(--line);
}
.manual-steps li:last-child { padding-bottom: 0; }
.manual-steps li:last-child::after { display: none; }
.manual-steps__name { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.manual-steps__text { font-size: 12.5px; line-height: 1.8; color: var(--text-soft); }

/* 補足の囲み */
.manual-box { margin-top: 16px; padding: 12px 14px; border-radius: 10px; }
.manual-box__label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em; margin-bottom: 6px;
}
.manual-box ul { margin: 0; padding-left: 17px; }
.manual-box li { margin: 5px 0; font-size: 12.5px; line-height: 1.75; }
.manual-box--tips { background: var(--accent-soft); }
.manual-box--tips .manual-box__label { color: var(--accent); }
.manual-box--notes { background: var(--warn-soft); }
.manual-box--notes .manual-box__label { color: var(--warn); }

/* よくある質問 */
.manual-qa { margin: 16px 0 0; }
.manual-qa dt {
  position: relative; padding: 10px 0 4px 22px;
  font-size: 13px; font-weight: 700;
  border-top: 1px solid var(--line);
}
.manual-qa dt::before {
  content: "Q"; position: absolute; left: 0; top: 10px;
  color: var(--accent); font-weight: 800; font-size: 12px;
}
.manual-qa dd {
  margin: 0 0 10px; padding-left: 22px;
  font-size: 12.5px; line-height: 1.8; color: var(--text-soft);
}

/* ---- 印刷 ---- */
@media print {
  .side, .topbar, .no-print, .tutorial-tip, .modalback { display: none !important; }
  .shell, .main, .content { display: block; margin: 0; padding: 0; }
  .manual { grid-template-columns: 1fr; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}
