/* =====================================================================
   ルミナ店長検定  スタイル
   方針：資格・認定証の落ち着き。紺を基調に、朱色は「合格印」と現在の級だけに使う。
   本文はゴシック、社名・検定名・結果は明朝で格を出す。
   ===================================================================== */
:root {
  --paper: #f4f5f3;
  --surface: #ffffff;
  --surface-2: #eef0ee;
  --ink: #1f2933;
  --ink-2: #5b6670;
  --ink-3: #8a939b;
  --line: #dcdfdc;
  --line-strong: #c4c9c5;
  --navy: #23395b;          /* 紺：主要な操作・見出し */
  --navy-2: #2f4a73;
  --navy-soft: #e6ebf2;
  --shu: #b23a2a;           /* 朱：合格印・現在の級だけ */
  --shu-soft: #f7e7e3;
  --ok: #2d6a4f;
  --ok-soft: #e3efe8;
  --warn: #8a5a00;
  --warn-soft: #f8efd9;
  --ng: #b42318;
  --ng-soft: #fbe9e7;
  --radius: 10px;
  --radius-sm: 6px;
  --sans: "Noto Sans JP", system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  --serif: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  color-scheme: light;
}
html[data-theme="dark"] {
    --paper: #15191d; --surface: #1c2126; --surface-2: #242a30; --ink: #e9ecee; --ink-2: #aab3ba; --ink-3: #7d878f;
    --line: #2f363c; --line-strong: #414a51; --navy: #9db4d8; --navy-2: #b6c8e4; --navy-soft: #233247;
    --shu: #e0725f; --shu-soft: #3a211c; --ok: #7cc4a0; --ok-soft: #1b3127; --warn: #e3b55f; --warn-soft: #352a14; --ng: #f08a80; --ng-soft: #3a1d1a;
    color-scheme: dark;
  }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.75; }
a { color: var(--navy); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.45; font-weight: 700; }

/* ---------- 基本部品 ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin: 0 0 14px; }
.center { text-align: center; }
.stack { display: grid; gap: 14px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.spread { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.h-xl { font-family: var(--serif); font-size: 1.6rem; font-weight: 700; margin: 0 0 6px; letter-spacing: .02em; }
.h-lg { font-size: 1.2rem; margin: 0 0 10px; }
.h-md { font-size: 1.02rem; margin: 0 0 6px; }
.serif { font-family: var(--serif); }
.hint { font-size: .85rem; color: var(--ink-2); margin: 4px 0 0; line-height: 1.7; }
.muted { color: var(--ink-2); }
.strong { font-weight: 700; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.loading { padding: 48px 0; text-align: center; color: var(--ink-2); font-size: .92rem; }
.loading::before { content: ""; display: block; width: 28px; height: 28px; margin: 0 auto 12px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--navy); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }

.field { display: grid; gap: 6px; }
.label { font-weight: 700; font-size: .9rem; }
.input {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px var(--navy-soft); }
textarea.input { min-height: 110px; resize: vertical; line-height: 1.75; }
.input.big-code { font-size: 1.7rem; letter-spacing: .45em; text-align: center; font-weight: 500; padding-left: calc(14px + .45em); font-variant-numeric: tabular-nums; }
.form-error { color: var(--ng); margin: 0; font-size: .9rem; font-weight: 500; border-left: 3px solid var(--ng); padding: 4px 0 4px 10px; }
.form-error:empty { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 22px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 700; cursor: pointer; text-decoration: none; letter-spacing: .04em;
  transition: background .15s, border-color .15s; -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
html[data-theme="dark"] .btn-primary { color: #10192a; }
.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--surface); border-color: var(--line-strong); color: var(--ng); }
.btn-danger:hover { background: var(--ng-soft); border-color: var(--ng-soft); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 5px 14px; font-size: .85rem; letter-spacing: .02em; }
.link-btn { background: none; border: 0; color: var(--navy); cursor: pointer; padding: 4px 0; font-size: .88rem; text-decoration: underline; text-underline-offset: 3px; }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: .76rem; padding: 1px 9px; border-radius: 4px; font-weight: 500; border: 1px solid var(--line); color: var(--ink-2); background: var(--surface); white-space: nowrap; }
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: var(--ok-soft); }
.chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); background: var(--warn-soft); }
.chip.ng { color: var(--ng); border-color: color-mix(in srgb, var(--ng) 30%, transparent); background: var(--ng-soft); }
.chip.info, .chip.brand { color: var(--navy); border-color: color-mix(in srgb, var(--navy) 25%, transparent); background: var(--navy-soft); }
.callout { border-radius: var(--radius-sm); padding: 12px 16px; margin: 0 0 14px; font-size: .92rem; border: 1px solid; }
.callout p { margin: 2px 0; }
.callout.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.callout.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.callout.info { background: var(--navy-soft); color: var(--navy); border-color: color-mix(in srgb, var(--navy) 20%, transparent); }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px);
  background: var(--ink); color: var(--paper); padding: 11px 20px; border-radius: var(--radius-sm); font-size: .9rem;
  opacity: 0; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-warn { background: var(--ng); color: #fff; }
.toast-ok { background: var(--navy); color: #fff; }

/* ブランド表示 */
.brandmark { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink-2); font-size: .8rem; letter-spacing: .06em; }
.brandmark img { width: 22px; height: 22px; }
.brandmark .word { font-weight: 700; color: var(--ink); letter-spacing: .08em; }

/* ===================== 受験者の画面 ===================== */
.take { max-width: 560px; margin: 0 auto; padding: 0 16px calc(32px + env(safe-area-inset-bottom)); }
.company-band { padding: 22px 2px 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.company-name { font-family: var(--serif); font-size: 1.45rem; font-weight: 700; margin: 10px 0 2px; letter-spacing: .03em; line-height: 1.4; }
.company-sub { font-size: .85rem; color: var(--ink-2); }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0 0 18px; padding: 0; list-style: none; }
.steps li { font-size: .74rem; color: var(--ink-3); padding-top: 8px; border-top: 3px solid var(--line); }
.steps li.done { border-top-color: var(--navy-2); color: var(--ink-2); }
.steps li.now { border-top-color: var(--navy); color: var(--ink); font-weight: 700; }

.page-title { font-size: 1.2rem; margin: 0 0 6px; }
.lead { color: var(--ink-2); margin: 0 0 16px; font-size: .92rem; }
.timer-note { font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.sent-to { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 14px; margin: 0 0 14px; font-size: .92rem; overflow-wrap: anywhere; }

/* 級の段階 */
.rank-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.rank-big { font-family: var(--serif); font-size: 2rem; font-weight: 700; color: var(--ink); line-height: 1.2; }
.rank-big.none { font-size: 1.25rem; color: var(--ink-2); }
.ladder { display: flex; flex-direction: column-reverse; margin: 16px 0 4px 5px; border-left: 1px solid var(--line-strong); }
.rung { display: flex; align-items: baseline; gap: 12px; padding: 7px 0 7px 18px; position: relative; color: var(--ink-3); font-size: .92rem; }
.rung::before { content: ""; position: absolute; left: -5px; top: 50%; width: 9px; height: 9px; margin-top: -4px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line-strong); }
.rung.got { color: var(--ink-2); }
.rung.got::before { background: var(--navy); border-color: var(--navy); }
.rung.now { color: var(--ink); font-weight: 700; }
.rung.now::before { background: var(--shu); border-color: var(--shu); width: 11px; height: 11px; left: -6px; margin-top: -5px; }
.rung .note { font-size: .78rem; color: var(--ink-3); font-weight: 400; }
.rung .tag-now { font-size: .72rem; color: var(--shu); font-weight: 700; margin-left: auto; }

.exam-card { display: grid; gap: 4px; }
.exam-card .code { font-size: .76rem; color: var(--ink-3); letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.exam-card .title { font-family: var(--serif); font-size: 1.15rem; font-weight: 700; margin: 0; }
.meta-line { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .82rem; color: var(--ink-2); margin: 4px 0 10px; }

/* 問題 */
.exam-top {
  position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px;
  margin: 0 -16px 16px; padding: 12px 16px 0; background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(8px);
}
.progress-text { font-size: .85rem; color: var(--ink-2); }
.progress-text b { color: var(--ink); }
.timer { font-variant-numeric: tabular-nums; font-size: .88rem; font-weight: 700; color: var(--ink); }
.timer.warn { color: var(--ng); }
.progress { flex-basis: calc(100% + 32px); margin: 8px -16px 0; height: 3px; background: var(--line); }
.progress-bar { height: 100%; background: var(--navy); transition: width .25s; }
.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; font-size: .82rem; color: var(--ink-2); }
.q-no { font-weight: 700; color: var(--ink); font-size: .95rem; }
.q-points { margin-left: auto; }
.q-prompt { font-size: 1.06rem; font-weight: 500; margin: 0 0 18px; white-space: pre-wrap; line-height: 1.85; }
.choices { display: grid; gap: 8px; }
.choice {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 14px; min-height: 54px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface);
  transition: border-color .15s, background .15s; -webkit-tap-highlight-color: transparent;
}
.choice:hover { border-color: var(--navy-2); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:has(input:focus-visible) { outline: 2px solid var(--navy); outline-offset: 2px; }
.choice-mark { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .82rem; font-weight: 700; border: 1px solid var(--line-strong); color: var(--ink-2); }
.choice-text { padding-top: 1px; }
.choice.selected { border-color: var(--navy); background: var(--navy-soft); box-shadow: inset 3px 0 0 var(--navy); }
.choice.selected .choice-mark { background: var(--navy); border-color: var(--navy); color: #fff; }
.choice.reading { border-color: var(--navy-2); }
.q-nav { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; margin-bottom: 14px; }
.jump { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.jump summary { cursor: pointer; font-size: .88rem; color: var(--ink-2); }
.jump-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin-top: 12px; }
.jump-btn { min-height: 42px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); font-size: .88rem; cursor: pointer; font-variant-numeric: tabular-nums; }
.jump-btn.done { background: var(--navy-soft); border-color: transparent; color: var(--navy); font-weight: 700; }
.jump-btn.here { border-color: var(--ink); }

/* 読み上げ */
.speak-bar { display: flex; align-items: center; gap: 8px; margin: -6px 0 16px; }
.speak-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 6px 14px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: .85rem; cursor: pointer;
}
.speak-btn svg { width: 18px; height: 18px; flex: none; }
.speak-btn:hover { background: var(--surface-2); }
.speak-btn[aria-pressed="true"] { border-color: var(--navy); background: var(--navy-soft); color: var(--navy); font-weight: 700; }
.speak-rate { border: 0; background: none; color: var(--ink-2); font-size: .8rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 6px 2px; }
.speaking-line { background: linear-gradient(transparent 62%, color-mix(in srgb, var(--navy) 18%, transparent) 62%); }

/* 結果：合格印 */
.result { text-align: center; padding: 30px 22px; }
.seal {
  display: inline-grid; place-items: center; width: 104px; height: 104px; margin: 8px auto 24px;
  border: 3px solid var(--shu); border-radius: 8px; color: var(--shu);
  font-family: var(--serif); font-size: 2rem; font-weight: 700; letter-spacing: .05em; line-height: 1;
  transform: rotate(-6deg); box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 4px color-mix(in srgb, var(--shu) 70%, transparent);
  animation: stamp .45s cubic-bezier(.3, 1.4, .5, 1) both;
}
.seal.plain { border-width: 1px; border-color: var(--line-strong); color: var(--ink-2); box-shadow: none; transform: none; animation: none; font-size: 1.15rem; width: 88px; height: 88px; }
@keyframes stamp { from { transform: rotate(-6deg) scale(1.6); opacity: 0; } to { transform: rotate(-6deg) scale(1); opacity: 1; } }
.result-title { font-family: var(--serif); font-size: 1.35rem; margin: 0 0 6px; }
.score-num { font-family: var(--serif); font-size: 2.4rem; font-weight: 700; margin: 6px 0; font-variant-numeric: tabular-nums; line-height: 1.2; }
.score-num small { font-family: var(--sans); font-size: .95rem; color: var(--ink-2); font-weight: 400; }
.rankup { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 14px 0; margin: 16px 0; }
.rankup .k { font-size: .8rem; color: var(--ink-2); }
.rankup .v { font-family: var(--serif); font-size: 1.4rem; font-weight: 700; color: var(--shu); }
.footer-note { text-align: center; font-size: .76rem; color: var(--ink-3); margin-top: 28px; }

/* ===================== 管理画面 ===================== */
.admin-header {
  position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 20px;
  padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); min-height: 60px;
}
.admin-company { display: flex; flex-direction: column; line-height: 1.35; padding: 8px 0; }
.admin-company .name { font-family: var(--serif); font-weight: 700; font-size: 1.02rem; letter-spacing: .02em; }
.admin-nav { display: flex; gap: 2px; flex-wrap: wrap; align-items: stretch; align-self: stretch; }
.admin-nav a { display: flex; align-items: center; text-decoration: none; color: var(--ink-2); font-size: .88rem; padding: 0 12px; border-bottom: 2px solid transparent; min-height: 44px; }
.admin-nav a:hover { color: var(--ink); }
.admin-nav a.active { color: var(--ink); font-weight: 700; border-bottom-color: var(--navy); }
.admin-nav .link-btn { margin-left: 8px; align-self: center; }
.admin-main { max-width: 1100px; margin: 0 auto; padding: 26px 24px 64px; }
.login-wrap { max-width: 420px; margin: 8vh auto; padding: 0 16px; }
.login-brand { margin-bottom: 18px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head .h-lg { margin: 0; font-size: 1.3rem; }
.back { display: inline-block; margin-bottom: 12px; font-size: .88rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.tile { padding: 16px 20px; text-decoration: none; color: inherit; display: block; border-right: 1px solid var(--line); }
.tile:last-child { border-right: 0; }
.tile .k { font-size: .82rem; color: var(--ink-2); }
.tile .v { font-size: 1.8rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.tile.warn .v { color: var(--shu); }
.tile.link:hover { background: var(--surface-2); }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 14px; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .78rem; color: var(--ink-2); font-weight: 500; padding: 10px 14px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.table td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; font-size: .92rem; }
.table tr:first-child td { border-top: 0; }
.row-link { cursor: pointer; }
.row-link:hover, .row-link:focus { background: var(--surface-2); outline: none; }
.empty { text-align: center; padding: 36px 20px; color: var(--ink-2); }
.list-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.list-row:first-of-type { border-top: 0; }
.steps-list { margin: 6px 0 0; padding-left: 1.4em; }
.steps-list li { margin: 4px 0; }

.tabs { display: flex; overflow-x: auto; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tab { white-space: nowrap; border: 0; border-bottom: 2px solid transparent; background: none; padding: 10px 16px; font-size: .9rem; color: var(--ink-2); cursor: pointer; margin-bottom: -1px; }
.tab.on { color: var(--ink); font-weight: 700; border-bottom-color: var(--navy); }
.rank-bars { display: grid; gap: 8px; margin: 10px 0 0; }
.rank-bar { display: grid; grid-template-columns: minmax(120px, 190px) 1fr 44px; align-items: center; gap: 12px; font-size: .88rem; }
.rank-bar .track { height: 8px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.rank-bar .fill { height: 100%; background: var(--navy); }
.rank-bar .fill.none { background: var(--line-strong); }

.summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.summary .right { text-align: right; }
.answer.needs-grade { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); box-shadow: inset 3px 0 0 var(--warn); }
.choice-list { margin: 0 0 8px; padding-left: 1.6em; }
.choice-list li { padding: 3px 8px; border-radius: 4px; margin-bottom: 2px; }
.choice-list li.correct { background: var(--ok-soft); font-weight: 700; }
.choice-list li.picked:not(.correct) { background: var(--ng-soft); }
.pick-label { margin-left: 8px; font-size: .78rem; color: var(--ink-2); font-weight: 400; }
.response { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; }
.response-text { white-space: pre-wrap; margin: 4px 0 0; }
.rubric { border-left: 3px solid var(--warn); background: var(--warn-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 10px 14px; font-size: .88rem; }
.rubric p { margin: 4px 0 0; white-space: pre-wrap; }
.grade { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line-strong); display: grid; gap: 10px; }
.input.points { width: 110px; text-align: right; }

/* 検定エディタ */
.q-edit.check { border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); box-shadow: inset 3px 0 0 var(--warn); }
.q-edit-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.q-edit-head .tools { margin-left: auto; display: flex; gap: 4px; }
.icon-btn { min-width: 36px; height: 36px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-size: .8rem; color: var(--ink-2); }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.choice-edit { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; margin-bottom: 8px; }
.choice-edit label { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--ink-2); white-space: nowrap; }
.choice-edit input[type=radio] { width: 18px; height: 18px; accent-color: var(--ok); }
.tf-edit { display: flex; gap: 10px; }
.tf-edit label { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px; cursor: pointer; }
.tf-edit label:has(input:checked) { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.sticky-save { position: sticky; bottom: 0; z-index: 15; background: color-mix(in srgb, var(--paper) 95%, transparent); backdrop-filter: blur(6px); border-top: 1px solid var(--line); padding: 12px 0; margin-top: 8px; }
.drop { border: 1px dashed var(--navy-2); border-radius: var(--radius); padding: 30px 16px; text-align: center; background: var(--navy-soft); cursor: pointer; }
.drop:hover { border-style: solid; }
.drop .t { font-weight: 700; color: var(--navy); }
.choose-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.choose-card { text-align: left; cursor: pointer; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius); padding: 22px; }
.choose-card:hover { border-color: var(--navy); box-shadow: inset 0 3px 0 var(--navy); }
.choose-card .rec { font-size: .74rem; color: var(--navy); font-weight: 700; }

.store-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.store-row .main { flex: 1 1 300px; min-width: 0; }
.url-box { display: block; margin-top: 8px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: .84rem; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.store-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.store-actions details > summary { list-style: none; }
.store-actions details > summary::-webkit-details-marker { display: none; }
.pin-form { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.pin-form .input { width: 130px; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }

.rank-edit { display: grid; grid-template-columns: 40px 1fr 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.rank-edit .lv { font-size: .8rem; color: var(--ink-3); text-align: center; font-variant-numeric: tabular-nums; }
.rank-edit .lv.top { color: var(--shu); font-weight: 700; }

/* LP */
.landing { max-width: 680px; }
.landing .hero { padding: 48px 2px 28px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.landing .hero img { width: 44px; height: 44px; }
.landing .hero h1 { font-family: var(--serif); font-size: 2rem; margin: 14px 0 8px; letter-spacing: .04em; }
.landing .hero p { color: var(--ink-2); margin: 0; }
.landing .feature { padding: 16px 0; border-top: 1px solid var(--line); }
.landing .feature:first-child { border-top: 0; padding-top: 0; }
.landing .feature h2 { font-size: 1.02rem; margin: 0; }
.landing .feature p { margin: 4px 0 0; color: var(--ink-2); }

@media (max-width: 720px) {
  .admin-header { padding: 0 12px; }
  .admin-main { padding: 16px 12px 50px; }
  .admin-nav { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .admin-nav a { white-space: nowrap; }
  .tile { border-right: 0; border-bottom: 1px solid var(--line); }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-top: 1px solid var(--line); padding: 8px 0; }
  .table tr:first-child { border-top: 0; }
  .table td { border: 0; padding: 4px 14px; display: flex; gap: 12px; }
  .table td::before { content: attr(data-label); flex: 0 0 76px; font-size: .76rem; color: var(--ink-2); padding-top: 2px; }
  .rank-edit { grid-template-columns: 32px 1fr auto; }
  .rank-edit .note { grid-column: 2 / 3; }
  .rank-bar { grid-template-columns: 110px 1fr 40px; }
  .summary .right { text-align: left; }
}

.nowrap { white-space: nowrap; }
.lead + .card, .lead + section { margin-top: 4px; }

/* =====================================================================
   級の色（金・銀・銅・緑）
   ===================================================================== */
.tier-gold   { --tier: #a07c1c; --tier-soft: #f7efd6; --tier-line: #d9bd6a; }
.tier-silver { --tier: #6b737c; --tier-soft: #eef0f3; --tier-line: #b9c0c8; }
.tier-bronze { --tier: #8f5230; --tier-soft: #f6e8de; --tier-line: #cf9a77; }
.tier-green  { --tier: #2f6b4b; --tier-soft: #e3f0e8; --tier-line: #8fbca2; }
html[data-theme="dark"] .tier-gold { --tier: #e2c15c; --tier-soft: #3a3115; --tier-line: #8a7230; }
html[data-theme="dark"] .tier-silver { --tier: #c3cad2; --tier-soft: #2b3036; --tier-line: #69727c; }
html[data-theme="dark"] .tier-bronze { --tier: #e0a07a; --tier-soft: #3a261b; --tier-line: #8f5a3c; }
html[data-theme="dark"] .tier-green { --tier: #85c9a3; --tier-soft: #19302a; --tier-line: #3d7258; }
.rank-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; padding: 1px 10px 1px 8px; border-radius: 4px; color: var(--tier); background: var(--tier-soft); border: 1px solid var(--tier-line); white-space: nowrap; }
.rank-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tier); }
.rung.tier-gold.got::before, .rung.tier-silver.got::before, .rung.tier-bronze.got::before, .rung.tier-green.got::before { background: var(--tier); border-color: var(--tier); }
.rank-big.tiered { color: var(--tier); }

/* ライセンス一覧（受験者） */
.license-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.license-row:first-of-type { border-top: 0; }
.license-medal { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--tier-soft); color: var(--tier); border: 2px solid var(--tier-line); font-family: var(--serif); font-weight: 700; font-size: .95rem; }
.license-row .main { flex: 1; min-width: 0; }
.license-row .no { font-size: .74rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.license-row.past { opacity: .7; }

/* =====================================================================
   認定証（縦型の賞状）
   ===================================================================== */
.cert-wrap { display: grid; place-items: center; padding: 8px 0 20px; }
.cert {
  position: relative; width: min(100%, 520px); aspect-ratio: 1 / 1.414; background: #fffdf8; color: #2a2620;
  border: 10px solid var(--tier); outline: 1px solid var(--tier-line); outline-offset: -22px;
  box-shadow: inset 0 0 0 12px #fffdf8, inset 0 0 0 13px var(--tier-line), 0 1px 3px rgba(0,0,0,.12);
  padding: 9% 9% 7%; display: flex; flex-direction: column; align-items: center; text-align: center; font-family: var(--serif);
  container-type: inline-size;
}
.cert::before, .cert::after { content: ""; position: absolute; width: 22px; height: 22px; border: 2px solid var(--tier-line); }
.cert::before { top: 30px; left: 30px; border-right: 0; border-bottom: 0; }
.cert::after { bottom: 30px; right: 30px; border-left: 0; border-top: 0; }
.cert-title { font-size: clamp(1.7rem, 9.5cqi, 3rem); font-weight: 700; letter-spacing: .45em; margin: 2% 0 0 .45em; }
.cert-sub { font-family: var(--sans); font-size: clamp(.55rem, 2.2cqi, .75rem); letter-spacing: .4em; color: var(--tier); margin-bottom: 5%; }
.cert-emblem {
  width: 30%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; margin: 1% auto 5%;
  background: radial-gradient(circle at 35% 30%, #fff 0, var(--tier-soft) 55%, var(--tier-line) 100%);
  border: 3px double var(--tier); color: var(--tier);
}
.cert-emblem .lv { font-size: clamp(1.4rem, 8cqi, 2.4rem); font-weight: 700; line-height: 1; }
.cert-emblem .tier-name { font-family: var(--sans); font-size: clamp(.5rem, 2cqi, .7rem); letter-spacing: .2em; margin-top: 4px; }
.cert-name { font-size: clamp(1.25rem, 6.4cqi, 2rem); font-weight: 700; padding: 0 10% 2px; border-bottom: 1px solid #2a2620; margin-bottom: 4%; }
.cert-name small { font-size: .6em; margin-left: .5em; }
.cert-body { font-size: clamp(.78rem, 3.3cqi, 1.05rem); line-height: 2; margin: 0 0 4%; text-align: justify; }
.cert-meta { font-family: var(--sans); font-size: clamp(.6rem, 2.4cqi, .8rem); color: #5b5246; display: grid; grid-template-columns: auto auto; gap: 2px 14px; margin-bottom: auto; text-align: left; }
.cert-meta dt { color: #8a7f70; }
.cert-meta dd { margin: 0; font-variant-numeric: tabular-nums; }
.cert-foot { width: 100%; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 4%; }
.cert-date { font-size: clamp(.7rem, 2.8cqi, .95rem); text-align: left; }
.cert-company { font-size: clamp(.85rem, 3.8cqi, 1.2rem); font-weight: 700; text-align: right; line-height: 1.5; }
.cert-seal {
  flex: none; width: 17%; aspect-ratio: 1; border: 2px solid #b23a2a; border-radius: 4px; color: #b23a2a; display: grid; grid-template-columns: 1fr 1fr;
  font-size: clamp(.7rem, 3.4cqi, 1.05rem); font-weight: 700; line-height: 1; padding: 6%; gap: 2px; transform: rotate(-2deg); opacity: .9;
}
.cert-seal span { display: grid; place-items: center; }
.cert-brand { font-family: var(--sans); font-size: clamp(.5rem, 1.9cqi, .65rem); letter-spacing: .15em; color: #a39886; margin-top: 3%; }
.cert-void { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.cert-void span { border: 3px solid #8a8f96; color: #8a8f96; font-family: var(--sans); font-weight: 700; font-size: clamp(1rem, 7cqi, 2rem); padding: 4px 18px; transform: rotate(-18deg); background: rgba(255,253,248,.75); letter-spacing: .1em; }
.cert-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
@media print {
  @page { size: A4 portrait; margin: 10mm; }
  body { background: #fff !important; }
  body * { visibility: hidden; }
  .cert, .cert * { visibility: visible; }
  .cert { position: fixed; left: 0; top: 0; width: 190mm; box-shadow: inset 0 0 0 12px #fffdf8, inset 0 0 0 13px var(--tier-line); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* =====================================================================
   本部画面：アラート・最近の提出（コンパクト）・まとめ表示
   ===================================================================== */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .home-grid { grid-template-columns: 1fr; } }
.alert-card { border-color: color-mix(in srgb, var(--shu) 35%, var(--line)); box-shadow: inset 3px 0 0 var(--shu); }
.alert-row, .recent-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; align-items: center;
}
.alert-row:first-of-type, .recent-row:first-of-type { border-top: 0; }
.alert-row .who, .recent-row .who { font-weight: 700; font-size: .92rem; }
.alert-row .meta, .recent-row .meta { grid-column: 1 / 2; font-size: .78rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-row .side, .recent-row .side { grid-row: 1 / 3; grid-column: 2; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.recent-row:hover { background: var(--surface-2); }
.days { font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.days.expired { color: var(--shu); }
.days.expiring { color: var(--warn); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.card-head .h-md { margin: 0; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .input { min-height: 40px; width: auto; padding: 6px 12px; font-size: .88rem; }
.toolbar .grow { flex: 1 1 200px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 7px 14px; font-size: .85rem; cursor: pointer; color: var(--ink-2); border-left: 1px solid var(--line-strong); }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--navy); color: #fff; font-weight: 700; }
.group-head { display: flex; align-items: baseline; gap: 10px; margin: 18px 0 8px; }
.group-head h3 { margin: 0; font-size: 1rem; }
.group-head .count { font-size: .8rem; color: var(--ink-2); }
.th-sort { cursor: pointer; user-select: none; }
.th-sort.on { color: var(--ink); font-weight: 700; }
.import-box { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 16px; background: var(--surface-2); }
.import-errors { max-height: 220px; overflow: auto; font-size: .85rem; margin: 8px 0 0; padding-left: 1.2em; color: var(--ng); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

/* 写真取り込み（QR） */
.qr-panel { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: center; }
@media (max-width: 640px) { .qr-panel { grid-template-columns: 1fr; justify-items: center; } }
.qr-box { background: #fff; padding: 10px; border-radius: var(--radius); border: 1px solid var(--line); line-height: 0; }
.qr-steps { margin: 0; padding-left: 1.3em; }
.qr-steps li { margin: 4px 0; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 12px; }
.thumb { position: relative; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); aspect-ratio: 3 / 4; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .n { position: absolute; left: 6px; top: 6px; background: var(--navy); color: #fff; font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 3px; }
.thumb button { position: absolute; right: 6px; top: 6px; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: .72rem; padding: 3px 8px; border-radius: 3px; cursor: pointer; }
.waiting { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: .9rem; }
.waiting::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* スマホの撮影ページ */
.snap-shot { position: relative; }
.snap-shot input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.snap-count { font-size: 2.2rem; font-family: var(--serif); font-weight: 700; font-variant-numeric: tabular-nums; }

/* =====================================================================
   運営画面
   ===================================================================== */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; margin-bottom: 14px; }
.kpi { padding: 14px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.kpi .k { font-size: .78rem; color: var(--ink-2); }
.kpi .v { font-size: 1.5rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: .8rem; color: var(--ink-2); margin-left: 2px; }
.kpi.pos .v { color: var(--ok); }
.kpi.neg .v { color: var(--ng); }
.trend { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-items: end; height: 120px; margin-top: 8px; }
.trend .col { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; font-size: .75rem; color: var(--ink-2); }
.trend .bar { width: 60%; background: var(--navy); border-radius: 2px 2px 0 0; min-height: 2px; }
.trend .bar.stop { background: var(--line-strong); }
.trend .bars { display: flex; gap: 3px; align-items: flex-end; height: 80px; width: 100%; justify-content: center; }
.trend .bars .bar { width: 35%; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.money.neg { color: var(--ng); }
.cost-edit { display: grid; grid-template-columns: 1fr 140px auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.inline-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; align-items: end; padding: 12px; background: var(--surface-2); border-radius: var(--radius-sm); margin-top: 10px; }

a.choose-card { display: block; text-decoration: none; color: inherit; }
.license-medal { font-size: .85rem; }
button.back { background: none; border: 0; padding: 0; cursor: pointer; }
.ops-who { align-self: center; margin-left: 12px; font-size: .8rem; }
.hint.neg { color: var(--ng); }
.rank-bar .fill[class*="tier-"] { background: var(--tier); }
.table.fixed { table-layout: fixed; }
.page-head + .hint { margin-bottom: 12px; }
@media (max-width: 640px) { .alert-row .meta, .recent-row .meta { white-space: normal; } }

/* ===================== ログイン（2ステップ・OTP） =====================
   スーパーアドミン＝紫（当社の画面だと一目でわかる）／アドミン＝緑。もう一方の色を差し色に使う。 */
.auth-super { --a: #6d28d9; --a-2: #5b21b6; --a-soft: #f3eefe; --b: #16a34a; }
.auth-admin { --a: #15803d; --a-2: #166534; --a-soft: #ecf7f0; --b: #7c3aed; }
html[data-theme="dark"] .auth-super { --a: #a78bfa; --a-2: #c4b5fd; --a-soft: #2a2040; --b: #4ade80; }
html[data-theme="dark"] .auth-admin { --a: #4ade80; --a-2: #86efac; --a-soft: #15291d; --b: #a78bfa; }
.auth-mode .admin-main { max-width: none; padding: 0; }
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; box-sizing: border-box;
  background:
    radial-gradient(900px 500px at 0% 0%, color-mix(in srgb, var(--a) 9%, transparent), transparent 60%),
    radial-gradient(800px 500px at 100% 100%, color-mix(in srgb, var(--b) 8%, transparent), transparent 60%),
    var(--paper);
}
.auth-card {
  width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--a);
  border-radius: 14px; padding: 38px 40px 30px; box-shadow: 0 18px 50px -24px rgba(30, 20, 60, .35);
}
.auth-brand { display: flex; align-items: center; gap: 10px; }
.auth-brand img { width: 26px; height: 26px; }
.auth-word { font-size: 1.45rem; font-weight: 700; letter-spacing: .14em; color: var(--a); }
.auth-badge { background: var(--a); color: #fff; font-size: .66rem; font-weight: 700; letter-spacing: .2em; padding: 3px 8px 3px 10px; border-radius: 3px; white-space: nowrap; }
html[data-theme="dark"] .auth-badge { color: #120c22; }
.auth-sub { color: var(--ink-2); font-size: .9rem; margin: 6px 0 26px; }
.auth-step { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--a); letter-spacing: .08em; font-size: .9rem; margin-bottom: 14px; }
.auth-step .n { font-size: .72rem; letter-spacing: .14em; border: 1.5px solid var(--a); border-radius: 999px; padding: 1px 9px; }
.auth-page .label { color: var(--ink-2); font-size: .84rem; letter-spacing: .06em; }
.auth-input { font-size: 1.05rem; padding: 13px 14px; }
.auth-page .input:focus { outline: 2px solid var(--a); outline-offset: 1px; border-color: var(--a); }
.auth-btn { background: var(--a); font-weight: 700; padding: 14px; font-size: 1.02rem; letter-spacing: .06em; }
.auth-btn:hover { background: var(--a-2); }
html[data-theme="dark"] .auth-btn { color: #0d0a16; }
.auth-email { background: var(--a-soft); color: var(--a); font-weight: 700; text-align: center; border-radius: 8px; padding: 11px 12px; overflow-wrap: anywhere; }
.auth-note { color: var(--ink-2); font-size: .86rem; line-height: 1.75; margin: 12px 0 14px; }
.auth-note.small { font-size: .76rem; color: var(--ink-3); margin: 14px 0 0; text-align: center; }
.auth-code {
  font-size: 2.3rem; letter-spacing: .55em; text-align: center; font-weight: 500; padding: 16px 0 16px .55em;
  border: 2px solid var(--a); border-radius: 10px; font-variant-numeric: tabular-nums; font-family: ui-monospace, Menlo, Consolas, monospace;
}
.auth-code::placeholder { color: var(--line-strong); }
.auth-timer { text-align: center; color: var(--ink-2); font-size: .85rem; margin-top: -4px; }
.auth-timer .num { color: var(--a); font-weight: 700; }
.auth-links { text-align: center; margin: 14px 0 10px; }
.auth-resend { background: none; border: 0; color: var(--a); font-size: .88rem; cursor: pointer; padding: 6px; }
.auth-resend:disabled { color: var(--ink-3); cursor: default; }
.auth-resend:not(:disabled) { text-decoration: underline; text-underline-offset: 3px; }
.auth-foot { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; color: var(--ink-3); font-size: .76rem; line-height: 1.9; }
@media (max-width: 480px) { .auth-card { padding: 30px 22px 24px; } .auth-code { font-size: 1.9rem; letter-spacing: .45em; } }

/* ===================== スーパーアドミンの画面（当社） =====================
   紫の帯とバッジで「全クライアントを扱う当社の画面」だと一目でわかるようにする。差し色は緑。 */
.theme-super { --navy: #6d28d9; --navy-2: #5b21b6; --navy-soft: #f3eefe; --ok: #15803d; --ok-soft: #e3f4ea; }
html[data-theme="dark"] .theme-super { --navy: #a78bfa; --navy-2: #c4b5fd; --navy-soft: #2a2040; --ok: #4ade80; --ok-soft: #15291d; }
.theme-super .admin-header { background: #1e1238; border-bottom: 3px solid #16a34a; color: #fff; }
.theme-super .admin-company .name, .theme-super .brandmark .word { color: #fff; }
.theme-super .brandmark { color: #c9bdf0; }
.theme-super .admin-nav a { color: #c9bdf0; }
.theme-super .admin-nav a:hover, .theme-super .admin-nav a.active { color: #fff; }
.theme-super .admin-nav a.active { border-bottom-color: #4ade80; }
.theme-super .admin-nav .link-btn, .theme-super .ops-who { color: #e6defc; }
.super-badge { display: inline-block; background: #7c3aed; color: #fff; font-size: .62rem; font-weight: 700; letter-spacing: .2em; padding: 2px 7px 2px 9px; border-radius: 3px; margin-left: 8px; vertical-align: middle; font-family: var(--sans); }
.super-ribbon { background: linear-gradient(90deg, #6d28d9, #16a34a); color: #fff; font-size: .74rem; letter-spacing: .08em; text-align: center; padding: 3px 12px; }
.auth-mode .super-ribbon { display: none; }
.theme-admin .admin-badge { display: inline-block; background: #15803d; color: #fff; font-size: .6rem; font-weight: 700; letter-spacing: .2em; padding: 2px 7px 2px 9px; border-radius: 3px; margin-left: 6px; vertical-align: middle; }

/* ===================== プランの枠・依頼フォーム ===================== */
.callout:not(.warn):not(.info) { background: var(--surface-2); border-color: var(--line); color: var(--ink); line-height: 1.8; }
.h-sm { font-size: .95rem; margin: 10px 0 4px; }
.plan-meter { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 14px; }
.plan-meter .num.big { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.plan-meter .num small { font-size: .9rem; color: var(--ink-3); font-weight: 500; }
.plan-meter .track { height: 6px; background: var(--surface-2); border-radius: 99px; margin-top: 8px; overflow: hidden; }
.plan-meter .fill { height: 100%; background: var(--ok); border-radius: 99px; }
.plan-meter.near .fill { background: var(--warn); }
.plan-meter.full .fill { background: var(--ng); }
.plan-meter .hint { margin: 8px 0 0; }
.card.archived { opacity: .75; }
.archived-box { margin-top: 18px; }
.archived-box summary { cursor: pointer; color: var(--ink-2); font-size: .9rem; margin-bottom: 10px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
.admin-person { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.admin-person .avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; }
.req-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 480px) { .req-kinds { grid-template-columns: 1fr; } }
.req-kind { display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; font: inherit; font-size: .88rem; color: var(--ink); }
.req-kind .dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); flex: none; }
.req-kind.on { border-color: var(--navy); background: var(--navy-soft); font-weight: 700; }
.req-kind.on .dot { border-color: var(--navy); background: radial-gradient(circle, var(--navy) 45%, transparent 50%); }
.field .req { background: var(--ng); color: #fff; font-size: .66rem; padding: 1px 6px; border-radius: 3px; margin-left: 6px; vertical-align: middle; }

/* ===================== スーパーアドミン：左メニューの画面構成 ===================== */
.super-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.super-side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: #1e1238; color: #e6defc; display: flex; flex-direction: column; border-right: 3px solid #16a34a; }
.side-brand { padding: 24px 22px 18px; border-bottom: 1px solid rgba(255,255,255,.1); }
.side-brand .row-brand { display: flex; align-items: center; gap: 8px; }
.side-brand img { width: 24px; height: 24px; }
.side-brand .w { font-size: 1.15rem; font-weight: 700; letter-spacing: .12em; color: #fff; }
.side-brand .super-badge { margin: 10px 0 0; }
.side-brand .sub { font-size: .76rem; color: #b8a9e6; margin-top: 8px; }
.side-nav { display: flex; flex-direction: column; padding: 8px 0; flex: 1; }
.side-nav .sec { font-size: .7rem; letter-spacing: .14em; color: #8f7fc4; padding: 16px 22px 6px; }
.side-nav a { display: flex; align-items: center; justify-content: space-between; color: #d9cff7; text-decoration: none; padding: 10px 22px; font-size: .92rem; border-left: 3px solid transparent; }
.side-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav a.active { background: rgba(124, 58, 237, .28); color: #fff; font-weight: 700; border-left-color: #4ade80; }
.side-nav .count { background: #16a34a; color: #fff; font-size: .72rem; font-weight: 700; border-radius: 99px; padding: 1px 8px; }
.side-logout { margin: 12px 22px 22px; background: none; border: 1px solid rgba(255,255,255,.2); color: #f5c2c2; border-radius: 8px; padding: 9px; cursor: pointer; font: inherit; font-size: .88rem; }
.side-logout:hover { background: rgba(255,255,255,.06); }
.super-main { min-width: 0; display: flex; flex-direction: column; }
.super-top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--surface); border-bottom: 1px solid var(--line); padding: 16px 32px; }
.super-top::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, #6d28d9, #16a34a); }
.super-top h1 { margin: 0; font-size: 1.3rem; }
.super-top .who { color: var(--ink-2); font-size: .85rem; }
.super-content { padding: 26px 32px 64px; max-width: 1180px; width: 100%; box-sizing: border-box; }
.super-content .page-head .h-lg { display: none; }
.req-detail { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 12px 0; font-size: .9rem; }
.req-detail dt { color: var(--ink-3); }
.req-detail dd { margin: 0; overflow-wrap: anywhere; }
.plan-form .field.check { flex-direction: row; align-items: center; gap: 8px; }
@media (max-width: 860px) {
  .super-shell { grid-template-columns: 1fr; }
  .super-side { position: static; height: auto; border-right: 0; border-bottom: 3px solid #16a34a; }
  .side-nav { flex-direction: row; overflow-x: auto; padding: 0 8px; }
  .side-nav .sec { display: none; }
  .side-nav a { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; padding: 12px 14px; }
  .side-nav a.active { border-bottom-color: #4ade80; }
  .side-brand { padding: 14px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
  .side-brand .super-badge { margin: 0; }
  .side-brand .sub { display: none; }
  .side-logout { margin: 8px 16px 12px; }
  .super-top, .super-content { padding-left: 14px; padding-right: 14px; }
}

/* =====================================================================
   GOLD EDITION（改）
   ・文字はすべて読みやすい黒（暗い帯の上だけ象牙色）。文字に金の光沢は使わない
   ・金の光沢は「ボタン」と「メニューのプレート」だけ。線・バーは光沢なしの単色
   ・書体はゴシックに統一（BIZ UDPゴシック：読みやすさを重視したUD書体）
   ===================================================================== */
:root {
  --paper: #f5f2ea;
  --surface: #fffefb;
  --surface-2: #f2eee3;
  --ink: #1a1815;
  --ink-2: #57524a;
  --ink-3: #8a847a;
  --line: #e2dccd;
  --line-strong: #cec5b0;
  --navy: #1a1815;
  --navy-2: #3a362f;
  --navy-soft: #f3ecda;
  --gold: #a8801f;          /* 線・バー・印に使う単色の金 */
  --gold-deep: #7a5a12;
  --gold-soft: #f6eed6;
  --gold-metal: linear-gradient(180deg, #fbe7a6 0%, #e8c766 32%, #c9a03a 58%, #b38a26 78%, #dcbc63 100%);
  --sans: "BIZ UDPGothic", "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  --serif: var(--sans);
}
html[data-theme="dark"] {
    --paper: #14130f; --surface: #1c1a16; --surface-2: #25221c; --ink: #f2ede1; --ink-2: #c3bba9; --ink-3: #8e877a;
    --line: #322e26; --line-strong: #4a4436; --navy: #f2ede1; --navy-2: #d9d1bd; --navy-soft: #2b2619;
    --gold: #d6b25a; --gold-deep: #e6c77a; --gold-soft: #2b2518;
  }
body { font-family: var(--sans); letter-spacing: .02em; }
h1, h2, h3, .h-xl, .company-name, .admin-company .name, .cert *, .tile .v, .kpi .v, .rankup .v, .score-num { font-family: var(--sans); }
a { color: var(--gold-deep); }
:focus-visible { outline-color: var(--gold); }
::selection { background: #f0d98f; color: #1a1815; }

/* マークは使わない（文字のロゴだけ） */
.brandmark img, .auth-brand img, .side-brand img { display: none; }
.brandmark .word { color: var(--ink); font-weight: 700; letter-spacing: .12em; }

/* ---- 金の光沢：ボタン ---- */
.btn-primary, .auth-btn {
  background: var(--gold-metal); color: #1a1815; font-weight: 700; letter-spacing: .08em;
  border: 1px solid #94701b;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), inset 0 -2px 0 rgba(110,75,10,.28), 0 2px 6px rgba(110,80,10,.22);
}
.btn-primary:hover, .auth-btn:hover { filter: brightness(1.04); box-shadow: inset 0 1px 0 rgba(255,255,255,.8), inset 0 -2px 0 rgba(110,75,10,.28), 0 4px 10px rgba(110,80,10,.3); }
.btn-primary:active, .auth-btn:active { transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(90,60,5,.4); }
.btn-primary:disabled { filter: grayscale(.5); opacity: .6; }
html[data-theme="dark"] .btn-primary, html[data-theme="dark"] .auth-btn { color: #1a1815; }
.btn-ghost:hover { border-color: var(--gold); }

/* ---- 線・バーは光沢なしの単色 ---- */
.company-band { border-bottom: 2px solid var(--gold); }
.steps li.done { border-top-color: #cdb06a; }
.steps li.now { border-top-color: var(--gold); color: var(--ink); }
.progress-bar, .plan-meter .fill { background: var(--gold); }
.trend .bar { background: var(--gold); }
.trend .bar.stop { background: var(--line-strong); }
.timer-note, .rank-big { color: var(--ink); }
.choice.on, .choice.selected, .choice[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-soft); }
.seg button.on, .req-kind.on { border-color: var(--gold); background: var(--gold-soft); color: var(--ink); }
.req-kind.on .dot { border-color: var(--gold); background: radial-gradient(circle, var(--gold) 45%, transparent 50%); }
.chip.brand { background: var(--gold-soft); color: var(--gold-deep); border-color: #e3d2a0; }
.tile.link:hover { background: var(--gold-soft); }
.admin-person .avatar { background: var(--ink); color: #fff; }

/* ---- メニューのプレート（金の光沢） ---- */
/* アドミン（クライアントの管理画面）：上部メニューが金のプレート。文字は黒 */
.admin-header { background: var(--gold-metal); border-bottom: 1px solid #94701b; color: #1a1815;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 2px 8px rgba(90,65,10,.18); }
.admin-company .name { color: #1a1815; }
.admin-header .brandmark, .admin-header .brandmark .word { color: #2b2418; }
.admin-nav a { color: #3a3020; font-weight: 500; }
.admin-nav a:hover { color: #000; background: rgba(255,255,255,.22); }
.admin-nav a.active { color: #000; font-weight: 700; border-bottom: 3px solid #1a1815; background: rgba(255,255,255,.28); }
.admin-nav .link-btn { color: #1a1815; }
.theme-admin .admin-badge { background: #14532d; color: #fff; box-shadow: none; }

/* スーパーアドミン：左メニューは深い紫（当社専用と一目でわかる）。選択中の項目が金のプレート */
.super-side { background: #1b1030; border-right: 3px solid var(--gold); box-shadow: none; }
.side-brand .w { color: #fff8e8; font-weight: 700; letter-spacing: .12em; }
.super-badge { background: #6d28d9; color: #fff; box-shadow: none; }
.side-nav .sec { color: #a996d6; }
.side-nav a { color: #ebe4f8; border-left: 0; margin: 2px 12px; border-radius: 8px; padding: 10px 14px; }
.side-nav a:hover { background: rgba(255,255,255,.07); }
.side-nav a.active { background: var(--gold-metal); color: #1a1815; font-weight: 700; border-left: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65), 0 2px 6px rgba(0,0,0,.35); }
.side-nav .count { background: #16a34a; color: #fff; }
.super-top { border-bottom: 2px solid var(--gold); }
.super-top::before { display: none; }

/* ---- ログイン ---- */
.auth-super, .auth-admin { --a: #1a1815; --a-2: #000; --a-soft: #f6eed6; }
html[data-theme="dark"] .auth-super, html[data-theme="dark"] .auth-admin { --a: #f2ede1; --a-2: #fff; --a-soft: #2b2518; }
.auth-page { background: var(--paper); }
.auth-card { border: 1px solid var(--line); border-top: 4px solid var(--gold); box-shadow: 0 20px 50px -30px rgba(60,45,10,.45); }
.auth-card::before { display: none; }
.auth-word { color: var(--ink); font-size: 1.4rem; letter-spacing: .1em; white-space: nowrap; font-weight: 700; }
.auth-brand { flex-wrap: wrap; row-gap: 6px; }
.auth-badge { color: #fff; box-shadow: none; text-shadow: none; }
.auth-super .auth-badge { background: #6d28d9; }
.auth-admin .auth-badge { background: #15803d; }
.auth-step, .auth-timer .num, .auth-resend:not(:disabled) { color: var(--ink); }
.auth-step .n { border-color: var(--gold); color: var(--gold-deep); }
.auth-code { border: 2px solid var(--gold); background: var(--surface); color: var(--ink); box-shadow: none; }
.auth-email { background: var(--gold-soft); color: var(--ink); border: 1px solid #e3d2a0; }
.auth-page .input:focus { outline-color: var(--gold); border-color: var(--gold); }
@media (max-width: 480px) { .auth-word { font-size: 1.2rem; letter-spacing: .06em; } }

/* 認定証の金の級だけは、メダルらしい光沢を残す（文字は黒のまま） */
.tier-gold { --tier: #a8801f; --tier-soft: #f6eed6; --tier-line: #c9a03a; }
.tier-gold .license-medal, .rank-chip.tier-gold { background: var(--gold-metal); color: #1a1815; border-color: #94701b; }

/* ---- 修正：左メニューの選択中は「ボタン」ではなく、左の金の線と文字色で示す ---- */
.side-nav a { margin: 0; border-radius: 0; padding: 11px 22px; border-left: 4px solid transparent; }
.side-nav a.active { background: rgba(255, 255, 255, .08); color: #f3d98a; font-weight: 700; border-left: 4px solid #d6b25a; box-shadow: none; }

/* ---- 修正：入力欄の並び（見出しと入力欄の高さをそろえる） ---- */
.inline-form { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px 16px; align-items: end; padding: 16px; }
.inline-form .field { min-width: 0; gap: 6px; align-content: end; }
.inline-form .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inline-form .input { height: 48px; min-width: 0; }
.inline-form select.input { padding-right: 34px; text-overflow: ellipsis; }
.inline-form > .btn { height: 48px; }

/* 管理者の欄（クライアントのカード内） */
.admins-block { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.admin-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.admin-add { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr) auto; gap: 10px; }
.admin-add .input, .admin-add .btn { height: 48px; }
@media (max-width: 640px) { .admin-add { grid-template-columns: 1fr; } }
.kpi .v { white-space: nowrap; } .kpi .k { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===================== 管理画面（アドミン）：左メニューの画面構成 ===================== */
.client-shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.client-side { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line); }
.cs-brand { padding: 28px 24px 20px; display: grid; justify-items: start; gap: 10px; }
.cs-word { font-size: 1.25rem; font-weight: 700; letter-spacing: .16em; color: var(--ink); }
.client-side .admin-badge { margin: 0; font-size: .7rem; padding: 4px 10px 4px 12px; letter-spacing: .22em; border-radius: 4px; }
.cs-company { font-size: .86rem; color: var(--ink-2); line-height: 1.5; }
.cs-nav { display: grid; gap: 2px; padding: 6px 14px; flex: 1; align-content: start; }
.cs-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: .95rem; }
.cs-nav a svg { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .75; }
.cs-nav a:hover { background: var(--surface-2); }
.cs-nav a.active { background: var(--gold-soft); color: var(--gold-deep); font-weight: 700; }
.cs-nav a.active svg { opacity: 1; }
.cs-foot { padding: 16px 18px 22px; display: grid; gap: 12px; }
.cs-who { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 2px; font-size: .86rem; overflow-wrap: anywhere; background: var(--paper); }
.cs-who .k { color: var(--ink-3); font-size: .76rem; }
.cs-ver { font-size: .74rem; color: var(--ink-3); padding: 0 4px; }
.client-main { min-width: 0; display: flex; flex-direction: column; }
.client-top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 32px; background: var(--gold-metal); border-bottom: 1px solid #94701b; box-shadow: inset 0 1px 0 rgba(255,255,255,.55); color: #1a1815; }
.crumb { font-size: .92rem; color: #3a3020; display: flex; gap: 10px; align-items: center; }
.crumb #pageTitle { color: #1a1815; font-weight: 700; }
.crumb .sep { opacity: .5; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.client-top .btn-ghost { background: rgba(255,255,255,.55); border-color: rgba(90,65,10,.35); color: #1a1815; }
.client-top .btn-ghost:hover { background: rgba(255,255,255,.8); }
.client-content { padding: 30px 36px 48px; max-width: 1180px; width: 100%; box-sizing: border-box; }
.client-footer { margin-top: auto; padding: 18px 24px 26px; text-align: center; font-size: .8rem; color: var(--ink-3); }
.eyebrow { font-size: .74rem; font-weight: 700; letter-spacing: .28em; color: var(--gold-deep); margin: 0 0 4px; }
.client-content .page-head .h-lg, .client-content > h1.h-lg { font-size: 1.75rem; margin: 0; letter-spacing: .04em; }
.client-content .page-head { margin-bottom: 18px; }
@media (max-width: 900px) {
  .client-shell { grid-template-columns: 1fr; }
  .client-side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .cs-brand { padding: 14px 16px; grid-template-columns: auto auto 1fr; align-items: center; }
  .cs-nav { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; padding: 4px 10px 10px; }
  .cs-nav a { padding: 9px 12px; }
  .cs-foot { display: none; }
  .client-top { padding: 10px 14px; }
  .client-content { padding: 20px 16px 40px; }
}

/* ===================== ライト／ナイト切り替えボタン ===================== */
.theme-toggle { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-size: 1.05rem; line-height: 1; cursor: pointer; display: inline-grid; place-items: center; flex: none; }
.theme-toggle:hover { border-color: var(--gold); }
.client-top .theme-toggle { background: rgba(255,255,255,.55); border-color: rgba(90,65,10,.35); color: #1a1815; }
.theme-toggle.floating { position: fixed; top: 14px; right: 14px; z-index: 50; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
body:has(#shell:not([hidden])) .theme-toggle.floating { display: none; }

/* ===================== ナイトモードの色（落ち着いた墨色＋金） ===================== */
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"] .client-side { background: #1a1813; }
html[data-theme="dark"] .cs-who { background: #14130f; }
html[data-theme="dark"] .client-top { background: linear-gradient(180deg, #3a3122, #2a2418); border-bottom-color: #6b5520; color: #f2ede1; box-shadow: none; }
html[data-theme="dark"] .crumb, html[data-theme="dark"] .crumb #pageTitle { color: #f2ede1; }
html[data-theme="dark"] .client-top .btn-ghost, html[data-theme="dark"] .client-top .theme-toggle { background: rgba(0,0,0,.25); color: #f2ede1; border-color: #6b5520; }
html[data-theme="dark"] .cs-nav a.active { background: #2e2716; color: #f0d48a; }
html[data-theme="dark"] .admin-header { background: linear-gradient(180deg, #3a3122, #2a2418); color: #f2ede1; }
html[data-theme="dark"] .card, html[data-theme="dark"] .tiles, html[data-theme="dark"] .kpis { box-shadow: none; }
html[data-theme="dark"] .super-top { background: var(--surface); }
html[data-theme="dark"] .btn-ghost { background: var(--surface); color: var(--ink); }
html[data-theme="dark"] .input { background: #14130f; color: var(--ink); }
html[data-theme="dark"] .callout.warn { background: #2e2716; color: #f0d48a; border-color: #5a4a22; }
.input.readonly { display: flex; align-items: center; background: var(--surface-2); color: var(--ink-2); cursor: default; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) {
  .cs-company { display: none; }
  .cs-word { font-size: 1.05rem; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tile { border-bottom: 1px solid var(--line); }
}
