/* FC ID発行。色はロゴ（黒の線と、はちみつ色の黄）に合わせる */
:root {
  --bg: #f4f5f7; --surface: #fff; --surface-2: #f8f9fb; --text: #15181e; --muted: #667085; --line: #e4e7ec; --line-strong: #d0d5dd;
  --ink: #1d2027; --ink-text: #fff; --honey: #f2b705; --honey-soft: #fff5cc; --honey-text: #7a5a00;
  --link: #1f56d6; --focus: color-mix(in srgb, var(--honey) 55%, transparent);
  --ok: #157f3c; --ok-soft: #e6f4ea; --warn: #a45200; --warn-soft: #fff1db; --err: #b42318; --err-soft: #fdecea;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 8%);
  --radius: 12px; --radius-sm: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1014; --surface: #161a21; --surface-2: #1b2029; --text: #e7e9ee; --muted: #98a2b3; --line: #262c36; --line-strong: #343b48;
    --ink: #f2b705; --ink-text: #15181e; --honey-soft: #3a2f0a; --honey-text: #ffd65c;
    --link: #8fb4ff; --ok: #6fd393; --ok-soft: #12301d; --warn: #f5b25c; --warn-soft: #3a2a12; --err: #ff8a80; --err-soft: #3b1715;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.65 "Inter", system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  font-feature-settings: "palt"; -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

/* ---- ヘッダー ---- */
header.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--line); }
header.top .bar { max-width: 1240px; margin: 0 auto; padding: 8px 24px; display: flex; align-items: center; gap: 12px 28px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand .name, .auth-brand .name { font-weight: 700; letter-spacing: .02em; }
.brand .name { font-size: 16px; padding-left: 12px; border-left: 1px solid var(--line-strong); }
.logo { display: inline-flex; background: #fff; border-radius: 8px; }
.logo img { display: block; height: auto; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { padding: 6px 12px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab.on { background: var(--honey-soft); color: var(--honey-text); }
.tab { display: inline-flex; align-items: center; gap: 7px; }
.tab .icon { opacity: .85; }
.icon { flex: none; vertical-align: -3px; }

/* アカウントのメニュー（右上の名前を押すと開く） */
details.menu { margin-left: auto; position: relative; }
details.menu summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid transparent; cursor: pointer; user-select: none; }
details.menu summary::-webkit-details-marker { display: none; }
details.menu summary:hover, details.menu[open] summary { background: var(--surface-2); border-color: var(--line); }
details.menu summary .icon { color: var(--muted); transition: transform .15s; }
details.menu[open] summary .icon { transform: rotate(180deg); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--honey); color: #15181e; font-weight: 700; font-size: 14px; }
.who { display: flex; flex-direction: column; line-height: 1.25; }
.who .nm { font-weight: 600; font-size: 14px; }
.who .role { font-size: 11.5px; color: var(--muted); }
.menu-list { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgb(16 24 40 / 14%); z-index: 20; }
.menu-head { padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 14px; display: flex; flex-direction: column; }
.menu-head span { font-weight: 400; font-size: 12px; color: var(--muted); }
.menu-list a, .menu-list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; box-shadow: none; color: var(--text); font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; }
.menu-list a:hover, .menu-list button:hover { background: var(--surface-2); }
.menu-list form { margin: 0; }
.menu-list button { color: var(--err); }
.menu-list .icon { color: var(--muted); }
.menu-list button .icon { color: currentColor; }

main { max-width: 1240px; margin: 0 auto; padding: 24px 24px 64px; }


/* ---- 見出し ---- */
h1 { font-size: 24px; line-height: 1.3; margin: 4px 0 20px; letter-spacing: .01em; }
h2 { font-size: 16px; margin: 36px 0 12px; display: flex; align-items: center; gap: 8px; }
h2::before { content: ""; width: 4px; height: 18px; border-radius: 2px; background: var(--honey); }
.sub { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 6px; }
.crumbs { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.crumbs a { color: var(--muted); }
p { margin: 0 0 12px; }

/* ---- ログイン画面 ---- */
body.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px;
  background: radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--honey) 18%, transparent), transparent 60%), var(--bg); }
body.auth main { width: 100%; max-width: 440px; padding: 0; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 20px; }
.auth-brand .logo { padding: 8px 14px; border-radius: 14px; box-shadow: var(--shadow); }
.auth-brand .name { font-size: 18px; }
.narrow { background: var(--surface); padding: 28px; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 30px rgb(16 24 40 / 8%); }
.narrow h1 { font-size: 20px; margin-bottom: 12px; }
.narrow button.primary { width: 100%; justify-content: center; padding: 11px; margin-top: 4px; font-size: 15px; }

/* ---- カード・表 ---- */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); font-size: 14px; overflow: hidden; }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .04em; white-space: nowrap; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 70%, var(--surface)); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.empty { color: var(--muted); text-align: center; padding: 28px; }
tr.inactive td { color: var(--muted); }
tr.pending td:first-child { box-shadow: inset 3px 0 0 var(--honey); }
.nowrap { white-space: nowrap; }
table.audit td { vertical-align: top; }
table.audit pre { margin: 0; font-size: 12px; white-space: pre-wrap; word-break: break-all; max-width: 360px; color: var(--muted); }


dl.props { max-width: 760px; display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0 0 16px; background: var(--surface); padding: 18px 22px; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
dl.props dt { color: var(--muted); font-size: 13px; }
dl.props dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
dl.props code { word-break: break-all; }
.pre { white-space: pre-wrap; }
/* 一覧の「変更」は控えめなボタンに */
a.edit { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; text-decoration: none; color: var(--muted); padding: 3px 12px 3px 10px; border: 1px solid var(--line-strong); border-radius: 999px; }
a.edit:hover { color: var(--text); background: var(--surface-2); }
a.edit .icon { width: 13px; height: 13px; }

/* ---- フォーム ---- */
.form { max-width: 680px; background: var(--surface); padding: 24px 26px; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.field { display: block; margin: 0 0 18px; }
.field .label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.hint { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
td .hint, .check .hint { display: inline; margin: 0; }
input[type=text], input[type=password], input[type=date], input:not([type]), select, textarea {
  width: 100%; max-width: 100%; padding: 9px 12px; font: 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:focus, textarea:focus { outline: none; border-color: var(--honey); box-shadow: 0 0 0 4px var(--focus); }
input[type=file] { font: inherit; font-size: 14px; color: var(--muted); max-width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-size: 13px; font-weight: 600; margin-right: 10px; padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); cursor: pointer; }
input[type=file]::file-selector-button:hover { background: var(--surface-2); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--ink); vertical-align: -3px; }
.filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.filter select, .filter input { width: auto; padding: 6px 10px; font-size: 14px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row .field { flex: 1; min-width: 200px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 0 0 18px; padding: 12px 16px; background: var(--surface-2); }
legend { font-weight: 600; font-size: 13px; padding: 0 6px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 2px 16px; max-height: 440px; overflow: auto; }
.check { display: block; padding: 5px 6px; border-radius: 6px; cursor: pointer; }
.check:hover { background: var(--surface); }
.check.inactive { color: var(--muted); }

/* ---- ボタン ---- */
button, .button {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; font: inherit; font-size: 14px; font-weight: 600; line-height: 1.4;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  cursor: pointer; text-decoration: none; box-shadow: var(--shadow); transition: background .15s, transform .05s;
}
button:hover, .button:hover { background: var(--surface-2); }
button:active, .button:active { transform: translateY(1px); }
button.primary { background: var(--ink); color: var(--ink-text); border-color: var(--ink); }
button.primary:hover { background: color-mix(in srgb, var(--ink) 85%, var(--honey)); }
button.link { border: 0; background: none; color: var(--link); padding: 0; box-shadow: none; text-decoration: underline; }
form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
form.inline select { width: auto; padding: 5px 8px; font-size: 13px; }
form.inline button { padding: 5px 12px; font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 8px; }

/* ---- 小物 ---- */
.code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; color: var(--muted); background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }
code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .92em; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 9px; border-radius: 999px; }
.badge.ok { color: var(--ok); background: var(--ok-soft); }
.badge.off { color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); }
.badge.warn { color: var(--warn); background: var(--warn-soft); }
.error { background: var(--err-soft); color: var(--err); border: 1px solid color-mix(in srgb, var(--err) 30%, transparent); padding: 10px 14px; border-radius: var(--radius-sm); margin: 0 0 16px; font-size: 14px; }
.error ul { margin: 0; padding-left: 20px; }
.notice { background: var(--ok-soft); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); padding: 10px 14px; border-radius: var(--radius-sm); margin: 0 0 16px; font-size: 14px; font-weight: 600; }
.qr { text-align: center; }
.qr img { background: #fff; padding: 8px; border-radius: 10px; border: 1px solid var(--line); }
.secret code { display: inline-block; font-size: 20px; padding: 8px 14px; background: var(--honey-soft); color: var(--honey-text); border-radius: var(--radius-sm); user-select: all; }
ul { padding-left: 22px; }

/* ---- スマートフォン ---- */
@media (max-width: 640px) {
  header.top { backdrop-filter: none; background: var(--surface); } /* ぼかしがあると下のメニューの固定位置がずれるため */
  header.top .bar { padding: 8px 16px; flex-wrap: nowrap; gap: 10px; }
  .brand .name { font-size: 15px; padding-left: 10px; }
  .logo img { width: 62px; height: auto; }
  .who, details.menu summary > .icon { display: none; }
  details.menu summary { padding: 2px; }
  main { padding: 20px 16px calc(84px + env(safe-area-inset-bottom)); }
  h1 { font-size: 21px; margin-bottom: 16px; }

  /* メニューは画面の下に固定（親指で押しやすい位置） */
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; flex-wrap: nowrap; justify-content: space-around; gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: saturate(160%) blur(10px); border-top: 1px solid var(--line); }
  .tab { flex: 1; flex-direction: column; gap: 3px; padding: 6px 2px; border-radius: 10px; font-size: 11px; text-align: center; }
  .tab .icon { width: 22px; height: 22px; opacity: 1; }
  .tab.on { background: none; color: var(--text); }
  .tab.on .icon { color: var(--honey-text); background: var(--honey-soft); border-radius: 999px; padding: 3px 12px; box-sizing: content-box; }

  /* 表は1行を1枚のカードに */
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards { background: none; border: 0; box-shadow: none; overflow: visible; }
  table.cards thead { display: none; }
  table.cards tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 14px; margin-bottom: 10px; }
  table.cards tbody tr:hover td { background: none; }
  table.cards td { display: flex; justify-content: flex-end; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 7px 0; border-bottom: 1px dashed var(--line); text-align: right; }
  table.cards td:last-child { border-bottom: 0; }
  table.cards td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; flex: none; margin-right: auto; }
  table.cards td:not([data-label])::before, table.cards td[data-label=""]::before { content: none; }
  table.cards td:not([data-label]) { justify-content: flex-end; }
  table.cards td.empty { justify-content: center; padding: 16px 0; }
  table.cards tr.pending td:first-child { box-shadow: none; }
  table.cards tr.pending { border-left: 4px solid var(--honey); }
  table.cards td form.inline { flex-wrap: wrap; justify-content: flex-end; }
  table.audit.cards pre { max-width: 60vw; text-align: left; }

  dl.props { grid-template-columns: 1fr; gap: 2px; padding: 14px 16px; }
  dl.props dd { margin-bottom: 8px; }
  .filter select, .filter input { flex: 1 1 140px; }
  .form { padding: 18px 16px; }
  .checks { grid-template-columns: 1fr; }
}
@media (max-width: 640px) { table:not(.cards) { display: block; overflow-x: auto; } }