/* 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; }


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[type=search], 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; }
.unlock-code code { font-size: 28px; letter-spacing: 0.12em; padding: 10px 16px; display: inline-block; user-select: all; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.form-actions .cancel { display: inline-flex; align-items: center; padding: 8px 16px; font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: none; border-radius: var(--radius-sm); }
.form-actions .cancel:hover { background: var(--surface-2); color: var(--text); }
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; } }

/* ---- 契約の画面（タブ・件数カード・一覧） ---- */
[hidden] { display: none !important; }
.js-only { display: none !important; }
.js .js-only { display: flex !important; }
.js p.js-only:not([hidden]) { display: block !important; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.page-head h1 { margin: 4px 0; }
.subtabs { display: flex; gap: 4px; box-shadow: inset 0 -1px 0 var(--line); margin: 8px 0 20px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; }
.subtabs a:hover { color: var(--text); }
.subtabs a.on { color: var(--text); box-shadow: inset 0 -2px 0 var(--honey); }
.subtabs .cnt { font-size: 12px; font-weight: 600; padding: 0 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.subtabs a.on .cnt { background: var(--honey-soft); border-color: transparent; color: var(--honey-text); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: var(--text); }
.stat:hover { border-color: var(--line-strong); }
.stat .n { font-size: 28px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat .s { font-size: 12px; color: var(--muted); }
.stat.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: color-mix(in srgb, var(--warn-soft) 55%, var(--surface)); }
.stat.warn .n { color: var(--warn); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }
.toolbar select, .toolbar input { width: auto; padding: 7px 10px; font-size: 14px; }
.toolbar .grow { flex: 1; }
.toolbar .clear { font-size: 13px; color: var(--muted); }
input[type=search].search { min-width: 220px; padding-left: 34px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23889' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px center; }
.count { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
table.list th, table.list td { padding: 7px 12px; }
table.list td.id { color: var(--muted); width: 56px; }
table.list .muted { color: var(--muted); font-size: 13px; }
.rowlink { color: var(--text); font-weight: 600; text-decoration: none; }
.rowlink:hover { color: var(--link); text-decoration: underline; }
.rowname { font-weight: 600; }
.dot { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.dot.ok { color: var(--ok); } .dot.off { color: var(--muted); }
.dot + .hint { display: inline; margin-left: 6px; }
.type { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 6px; white-space: nowrap; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.type.t51 { background: #e8f1ff; color: #1f4fa8; border-color: transparent; }
.type.t21 { background: #f1e9ff; color: #6a3fb5; border-color: transparent; }
.type.t22 { background: #e6f6ee; color: #1d7a4b; border-color: transparent; }
.type.t11 { background: #ffeede; color: #a8550c; border-color: transparent; }
.type.t99 { background: #f0f1f3; color: #555c69; border-color: transparent; }
.type.t92 { background: #e3f4f7; color: #0f6b7a; border-color: transparent; }
@media (prefers-color-scheme: dark) {
  .type.t51 { background: #182a46; color: #9cc0ff; } .type.t21 { background: #2a1f42; color: #cbb2ff; }
  .type.t22 { background: #15301f; color: #8fe0b4; } .type.t11 { background: #3a2412; color: #ffc08a; } .type.t99 { background: #23272f; color: #aab2c0; } .type.t92 { background: #12303a; color: #8fd6e6; }
}
.picker-tools { align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 10px; }
.picker-tools .search { flex: 1 1 220px; width: auto; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.picked { font-size: 13px; font-weight: 600; color: var(--honey-text); background: var(--honey-soft); padding: 2px 10px; border-radius: 999px; }
.checks .check { display: flex; align-items: center; gap: 8px; }
.checks .check .code { min-width: 34px; text-align: right; }
.checks .check .fname { font-weight: 600; }
.checks .check:has(input:checked) { background: color-mix(in srgb, var(--honey-soft) 60%, var(--surface)); }
@media (max-width: 640px) { .page-head .button { width: 100%; justify-content: center; } input[type=search].search { min-width: 0; flex: 1 1 100%; } }
.js-only-inline { display: none !important; }
.js .js-only-inline { display: inline-block !important; }

.badge, .dot, .type, button, .button, .nowrap-cell { white-space: nowrap; }

/* 行全体を押せる一覧 */
.rowlink, .rowlink:hover { color: inherit; text-decoration: none; font-weight: 600; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: color-mix(in srgb, var(--honey-soft) 45%, var(--surface)); }
tr.clickable td:last-child { position: relative; padding-right: 34px; }
tr.clickable td:last-child::after { content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; margin-top: -4px;
  border-right: 2px solid var(--line-strong); border-top: 2px solid var(--line-strong); transform: rotate(45deg); transition: border-color .15s, right .15s; }
tr.clickable:hover td:last-child::after { border-color: var(--honey-text); right: 11px; }
tr.clickable:focus-within td { background: color-mix(in srgb, var(--honey-soft) 45%, var(--surface)); }
@media (max-width: 640px) { table.cards tr.clickable { position: relative; padding-right: 30px; } table.cards tr.clickable td:last-child { padding-right: 0; position: static; } table.cards tr.clickable td:last-child::after { right: 14px; } }
/* 操作の記録 */
table.audit td { vertical-align: top; }
ul.changes { list-style: none; margin: 0; padding: 0; font-size: 13px; }
ul.changes li { padding: 1px 0; }
details.raw { margin-top: 4px; font-size: 12px; }
details.raw summary { cursor: pointer; color: var(--muted); display: inline-block; }
details.raw[open] summary { margin-bottom: 4px; }
details.raw pre { margin: 2px 0 8px; padding: 8px 10px; max-height: 320px; overflow: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; white-space: pre-wrap; word-break: break-all; max-width: 640px; }
.act { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); }
.act.a-login, .act.a-logout { color: var(--muted); }
.act.a-fail { color: var(--err); background: var(--err-soft); border-color: transparent; }
.act.a-export { color: var(--honey-text); background: var(--honey-soft); border-color: transparent; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
/* 保存して戻ったとき、触った行を光らせる */
@keyframes rowflash { 0%, 35% { background: color-mix(in srgb, var(--honey) 32%, var(--surface)); } 100% { background: transparent; } }
tr.flash td { animation: rowflash 2.6s ease-out; }
/* ---- マニュアル（「？」ボタン・右側のパネル・マニュアルのページ） ---- */
.help-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; margin-left: auto; border-radius: 50%; color: var(--muted); text-decoration: none; border: 1px solid transparent; }
.help-btn:hover { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.help-btn .icon { width: 20px; height: 20px; }
.help-btn + details.menu { margin-left: 4px; }
dialog.help-panel { position: fixed; inset: 0 0 0 auto; margin: 0; height: 100dvh; max-height: 100dvh; width: min(460px, 100vw); padding: 0; border: 0; border-left: 1px solid var(--line);
  background: var(--surface); color: var(--text); box-shadow: -12px 0 40px rgb(16 24 40 / 18%); display: none; flex-direction: column; z-index: 50; }
dialog.help-panel[open] { display: flex; animation: helpin .18s ease-out; }
dialog.help-panel::backdrop { background: rgb(16 24 40 / 28%); }
@keyframes helpin { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.help-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.help-head h2 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.help-head h2::before { content: none; }
.help-head h2 .icon { color: var(--honey-text); width: 18px; height: 18px; }
.help-close { border: 0; box-shadow: none; background: none; padding: 6px; border-radius: 8px; color: var(--muted); }
.help-close:hover { background: var(--surface-2); color: var(--text); }
.help-body { flex: 1; overflow: auto; padding: 16px 20px; font-size: 14px; line-height: 1.75; }
.help-foot { display: flex; gap: 16px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--line); font-size: 13px; }
.help-foot a { display: inline-flex; align-items: center; gap: 6px; }
.help-body ul, .help-article ul { padding-left: 20px; margin: 0 0 12px; }
.help-body li, .help-article li { margin: 4px 0; }
ol.steps { counter-reset: step; list-style: none; padding: 0; margin: 0 0 14px; }
ol.steps > li { counter-increment: step; position: relative; padding: 2px 0 8px 34px; }
ol.steps > li::before { content: counter(step); position: absolute; left: 0; top: 2px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--honey-soft); color: var(--honey-text); font-weight: 700; font-size: 13px; }
.help-note { background: var(--surface-2); border-left: 3px solid var(--honey); padding: 8px 12px; border-radius: 0 8px 8px 0; font-size: 13px; color: var(--muted); }
table.help-table { box-shadow: none; margin: 0 0 14px; font-size: 13.5px; }
table.help-table th { white-space: normal; width: 30%; background: var(--surface-2); color: var(--text); font-size: 13px; letter-spacing: 0; text-align: left; }
table.help-table thead th { width: auto; text-align: center; }
table.help-table td { text-align: left; }
table.help-table thead + tbody td { text-align: center; }
ol.flow { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; counter-reset: flow; }
ol.flow li { counter-increment: flow; position: relative; padding: 10px 14px 10px 46px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
ol.flow li::before { content: counter(flow); position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--ink-text); font-weight: 700; font-size: 13px; }
ol.flow li:not(:last-child)::after { content: ""; position: absolute; left: 23px; bottom: -9px; width: 2px; height: 8px; background: var(--line-strong); }
.help-page { display: grid; grid-template-columns: 230px 1fr; gap: 28px; align-items: start; }
.help-toc { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.help-toc a { padding: 6px 10px; border-radius: 8px; color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.help-toc a:hover { background: var(--surface-2); }
.help-toc a.on { background: var(--honey-soft); color: var(--honey-text); font-weight: 600; }
.help-toc .grp { margin: 12px 0 2px; padding: 0 10px; font-size: 12px; font-weight: 700; color: var(--muted); }
.help-article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 28px; max-width: 820px; }
.help-article h3 { font-size: 16px; margin: 26px 0 10px; }
.help-article h3:first-of-type { margin-top: 8px; }
.narrow-help { grid-template-columns: 1fr; }
body.auth .help-article { padding: 22px; }
.auth-help { text-align: center; margin-top: 16px; font-size: 13px; }
.auth-help a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
@media (max-width: 760px) { .help-page { grid-template-columns: 1fr; } .help-toc { position: static; flex-direction: row; flex-wrap: wrap; } .help-toc .grp { width: 100%; } .help-article { padding: 18px; } }
@media (max-width: 640px) { .help-btn { margin-left: auto; } }
/* FC 利用先の版 */
fieldset.editions { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
fieldset.editions legend { grid-column: 1 / -1; }
fieldset.editions > p { grid-column: 1 / -1; margin: 0; }
.edition-opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); cursor: pointer; }
.edition-opt:has(input:checked) { border-color: var(--honey); box-shadow: 0 0 0 3px var(--focus); }
.edition-opt input { margin-top: 4px; accent-color: var(--ink); }
.edition-opt .hint { display: block; margin-top: 2px; }
.edition { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 6px; white-space: nowrap; }
.edition.e-facility { background: #eef0ff; color: #3b45a8; }
.edition.e-home { background: #e9f6f2; color: #1f6f5a; }
@media (prefers-color-scheme: dark) { .edition.e-facility { background: #1f2346; color: #b3b9ff; } .edition.e-home { background: #14302a; color: #8fdcc6; } }
.checks .check.off-edition { outline: 1px dashed var(--err); color: var(--err); }
.edition.e-vital { background: #fff1db; color: #8a4b00; }
@media (prefers-color-scheme: dark) { .edition.e-vital { background: #3d2a12; color: #ffc27a; } }

/* 取込ファイルの一覧：列をまとめて 1 画面に収める。収まらない幅では表だけ横に動く（11/17） */
.table-scroll { overflow-x: auto; border-radius: var(--radius); }
table.list.dist th, table.list.dist td { padding: 7px 10px; vertical-align: top; }
table.list.dist td.out form.inline { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
table.list.dist td.out select { max-width: 11.5em; }

/* フォームの最後のボタンの上を空ける（本部・薬局のアカウントなど） */
.form .actions { margin-top: 20px; }

/* 11/17：消す・作り直すなど重い操作は赤い枠。押すと確かめの小窓（app.js の data-confirm） */
button.danger-outline { color: var(--err); border-color: var(--err); background: var(--surface); }
button.danger { background: var(--err); border-color: var(--err); color: #fff; }
dialog.confirm { border: 0; border-radius: 12px; padding: 20px 22px; max-width: 480px; width: calc(100% - 32px); box-shadow: 0 10px 30px rgb(0 0 0 / 25%); background: var(--surface); color: var(--text); }
dialog.confirm::backdrop { background: rgb(16 24 40 / 45%); }
dialog.confirm h2 { margin: 0 0 8px; font-size: 17px; }
dialog.confirm .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* 11/18：パネルの動画 */
.help-video { margin: 0 0 14px; } .help-video video { width: 100%; border-radius: 8px; background: #000; } .help-video figcaption { font-size: 12px; color: var(--muted); }

/* 表の中のボタンは線を引かず、薄い色の面（TMS と同じ見た目。11/18） */
table.list button:not(.primary):not(.link), table.list .button:not(.primary) { border: 0; box-shadow: none; background: #f2f4f7; color: #344054; border-radius: 10px; padding: 7px 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; transition: background .15s, color .15s; }
table.list button:not(.primary):not(.link):hover, table.list .button:not(.primary):hover { background: #e4e7ec; color: #101828; }
table.list button.danger-outline { background: #fef3f2; color: #b42318; }
table.list button.danger-outline:hover { background: #fee4e2; color: #912018; }
table.list select { border-radius: 10px; }
table.list a:not(.button) { text-decoration: none; }
table.list a:not(.button):hover { text-decoration: underline; }
@media (prefers-color-scheme: dark) {
  table.list button:not(.primary):not(.link), table.list .button:not(.primary) { background: #2a3140; color: #e3e8ef; }
  table.list button:not(.primary):not(.link):hover { background: #343c4d; }
  table.list button.danger-outline { background: #3d211b; color: #f2a08c; }
}

/* ページの切り替え中：上の帯と、押したところを薄く（TMS と同じ。11/18） */
.nav-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 1000; pointer-events: none; opacity: 0; transition: opacity .2s; overflow: hidden; }
.nav-progress.on { opacity: 1; }
.nav-progress.on::before { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; background: #f2b705; box-shadow: 0 0 8px #f2b705; animation: navbar 1.1s ease-in-out infinite; }
@keyframes navbar { from { left: -40%; } to { left: 100%; } }
.is-loading { opacity: .6; cursor: progress; }
@media (prefers-reduced-motion: reduce) { .nav-progress.on::before { animation: none; left: 0; width: 100%; } }

/* 取込ファイルの表（11/18 見やすく）：FC の名前を 1 か所にまとめ、会社は 1 行で切る。鍵の「作り直す」は日付の下 */
table.list.dist td { vertical-align: middle; }
table.list.dist td.fcname { min-width: 15em; max-width: 22em; }
table.list.dist td.fcname .nm { font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
table.list.dist .fcid { font-family: var(--mono, ui-monospace, monospace); font-size: 12px; color: var(--muted); min-width: 1.6em; text-align: right; }
table.list.dist td.fcname .one { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: calc(1.6em + 8px); }
table.list.dist td.key form.inline { display: block; margin-top: 4px; }
table.list.dist tr.pending td:first-child { box-shadow: inset 3px 0 0 #f2b705; }
table.list.dist tbody tr:hover td { background: color-mix(in srgb, #f2b705 5%, transparent); }
/* 「作り直す」などの赤い面が、灰色の面に負けないように */
table.list button.danger-outline:not(.primary):not(.link) { background: #fef3f2; color: #b42318; }
table.list button.danger-outline:not(.primary):not(.link):hover { background: #fee4e2; color: #912018; }

/* 上のメニューは固定のまま、ぼかしはやめる（中の「使い方」のつまみを画面の右端に固定するため。ぼかしがあると固定の位置が帯の中になる。11/18） */
header.top { position: sticky; top: 0; backdrop-filter: none; background: var(--surface); }
/* 使い方の入口は、TMS と同じく画面の右端の真ん中の縦のつまみ（押すと右からパネル） */
a.help-btn { position: fixed; right: 0; top: 50%; transform: translateY(-50%); z-index: 60; width: auto; height: auto; margin: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px; border: 0; border-radius: 12px 0 0 12px;
  background: #1d2027; color: #fff; box-shadow: -4px 4px 14px rgb(16 24 40 / 18%); transition: padding .15s, background .15s; }
a.help-btn::after { content: "使い方"; writing-mode: vertical-rl; letter-spacing: .15em; font-size: 13px; font-weight: 700; }
a.help-btn:hover { background: #000; color: #fff; border: 0; padding-right: 12px; }
a.help-btn .icon { width: 18px; height: 18px; }
.help-btn + details.menu { margin-left: auto; }
@media print { a.help-btn { display: none; } }

/* ログアウトは名前のメニューの外の別のボタン（TMS と同じ。11/18） */
.logout-form { margin: 0; }
button.logout-btn { background: transparent; border: 0; box-shadow: none; color: var(--text); font-weight: 600; font-size: 14px; padding: 8px 10px; border-radius: 10px; display: inline-flex; align-items: center; gap: 6px; }
button.logout-btn:hover { background: var(--surface-2); }
@media (max-width: 640px) { button.logout-btn { font-size: 0; gap: 0; } button.logout-btn .icon { width: 20px; height: 20px; } }
