
:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f0f2f5; --border: #dfe3e8; --border-strong: #c7ced6;
  --text: #1b1f24; --text-2: #4b5563; --text-3: #6b7280;
  --accent: #2557d6; --accent-hover: #1d47b3; --accent-soft: #e8eefc; --on-accent: #ffffff;
  --ok: #1a7f4b; --ok-soft: #e3f4ea; --warn: #9a5b00; --warn-soft: #fdf1dc; --danger: #c0352b; --danger-soft: #fbe7e5;
  --muted-soft: #eef0f3;
  --radius: 10px; --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --font: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216; --surface: #161a20; --surface-2: #1d222a; --border: #2a313b; --border-strong: #3a4350;
    --text: #e7eaee; --text-2: #b3bac4; --text-3: #8b94a0;
    --accent: #6b93ff; --accent-hover: #86a7ff; --accent-soft: #1b2847; --on-accent: #0b1020;
    --ok: #4cc38a; --ok-soft: #13291e; --warn: #e0a84a; --warn-soft: #2d2412; --danger: #f07167; --danger-soft: #2e1715;
    --muted-soft: #222831;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    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.75 var(--font); font-feature-settings: "palt" 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.4; margin: 0; font-weight: 650; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
p { margin: 0 0 .75rem; }
code, .mono { font-family: var(--mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }

/* 枠 */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-in { max-width: 72rem; margin: 0 auto; padding: 0 1.25rem; height: 3.5rem; display: flex; align-items: center; gap: 1.25rem; }
.brand { font-weight: 700; color: var(--text); letter-spacing: .01em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 7px; background: var(--accent); color: var(--on-accent); font-size: .8rem; margin-right: .5rem; vertical-align: -.35rem; }
.nav { display: flex; gap: .25rem; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a { color: var(--text-2); padding: .4rem .75rem; border-radius: var(--radius-sm); white-space: nowrap; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); font-weight: 600; }
.who { display: flex; align-items: center; gap: .75rem; color: var(--text-3); font-size: .85rem; white-space: nowrap; }
.tenant-name { color: var(--text-2); font-weight: 600; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; }
.main { max-width: 72rem; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-head p { color: var(--text-3); margin: .25rem 0 0; }
.crumb { font-size: .85rem; color: var(--text-3); margin-bottom: .25rem; }

/* 面 */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card, .grid + .card, .card + .grid { margin-top: 1.25rem; }
.grid > .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.card-body { padding: 1.25rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
.stat { padding: 1rem 1.25rem; }
.stat-label { color: var(--text-3); font-size: .85rem; }
.stat-value { font-size: 1.75rem; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.3; }
.stat-sub { color: var(--text-3); font-size: .8rem; }
.kv { display: grid; grid-template-columns: 10rem 1fr; gap: .5rem 1rem; margin: 0; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv + .row-actions { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }

/* 表 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .7rem 1.25rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--text-3); font-weight: 600; font-size: .8rem; background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.actions { text-align: right; white-space: nowrap; }

/* 札 */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; background: var(--muted-soft); color: var(--text-2); }
.badge::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--accent-soft); color: var(--accent); }

/* ボタンと入力 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-size: .9rem; line-height: 1.4; font-weight: 600; padding: .5rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.danger:hover { background: var(--danger-soft); }
.btn { min-height: 2.5rem; }
.btn.small { padding: .25rem .6rem; font-size: .82rem; min-height: 0; }
.checkbox { display: flex; gap: .5rem; align-items: center; font-weight: 400 !important; }
.btn:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 1px; border-color: var(--accent); }
form.inline { display: inline; }
.field { display: grid; gap: .35rem; margin-bottom: 1rem; }
.field label { font-weight: 600; font-size: .9rem; }
.field .hint { color: var(--text-3); font-size: .82rem; }
input[type=text], input[type=email], input[type=number], input[type=url], input[type=search], select {
  font: inherit; width: 100%; padding: .55rem .75rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
}
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.toolbar input[type=search] { flex: 1; min-width: 12rem; }
.toolbar select { width: auto; }
.card-head > form.toolbar { flex: 1; }
.toolbar input, .toolbar select, .toolbar .btn { height: 2.5rem; }
.toolbar .btn.small { height: auto; }
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* 知らせ */
.notice { padding: .85rem 1.1rem; border-radius: var(--radius); margin-bottom: 1.25rem; border: 1px solid transparent; }
.notice.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.danger { background: var(--danger-soft); color: var(--danger); }
.empty { text-align: center; padding: 3rem 1.25rem; color: var(--text-3); }
.empty strong { display: block; color: var(--text); font-size: 1.05rem; margin-bottom: .35rem; }
.todo { list-style: none; margin: 0; padding: 0; }
.todo li { display: flex; gap: .75rem; align-items: flex-start; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.todo li:last-child { border-bottom: 0; }
.check { flex: none; width: 1.25rem; height: 1.25rem; border-radius: 50%; border: 2px solid var(--border-strong); margin-top: .2rem; }
.check.done { background: var(--ok); border-color: var(--ok); }
.muted { color: var(--text-3); }
.small { font-size: .85rem; }
.keybox { font: 1.3rem/1.4 var(--mono); letter-spacing: .04em; padding: 1rem 1.25rem; border: 2px solid var(--accent); border-radius: var(--radius); background: var(--accent-soft); user-select: all; overflow-wrap: anywhere; }
.code { margin: .25rem 0; padding: .75rem 1rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font: .82rem/1.6 var(--mono); overflow-x: auto; white-space: pre; user-select: all; }
.steps { list-style: none; margin: 0; padding: 0; }
.step { display: flex; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--border); }
.step:first-child { padding-top: 0; }
.step:last-child { border-bottom: 0; padding-bottom: 0; }
.step-num { flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; font-weight: 700; font-variant-numeric: tabular-nums; border: 2px solid var(--border-strong); color: var(--text-3); background: var(--surface); }
.step.current .step-num { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.step.done .step-num { border-color: var(--ok); background: var(--ok); color: #fff; }
.step-main { flex: 1; min-width: 0; padding-top: .2rem; }
.step-title { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-weight: 650; }
.step.todo .step-title { color: var(--text-3); font-weight: 500; }
.step.done .step-title { color: var(--text-2); font-weight: 500; }
.step-body { margin: .5rem 0 1rem; color: var(--text-2); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: .85rem 1.25rem; border-top: 1px solid var(--border); color: var(--text-3); font-size: .85rem; }

/* ログインの画面 */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; }
.auth-box { width: 100%; max-width: 26rem; }
.auth h1 { font-size: 1.25rem; margin-bottom: 1rem; }
.auth-foot { text-align: center; margin-top: 1rem; }
.auth .brand { display: block; text-align: center; margin-bottom: 1.25rem; font-size: 1.1rem; }

@media (max-width: 40rem) {
  body { font-size: 14.5px; }
  .topbar-in { gap: .25rem .75rem; padding: .5rem 1rem 0; height: auto; flex-wrap: wrap; }
  .brand { flex: 1; }
  .nav { order: 3; flex-basis: 100%; margin: 0 -.5rem; padding-bottom: .35rem; }
  .who .email { display: none; }
  .main { padding: 1.25rem 1rem 3rem; }
  th, td { padding: .6rem .9rem; }
  .kv { grid-template-columns: 1fr; gap: .1rem; }
  .kv dd { margin-bottom: .6rem; }
  .hide-sm { display: none; }
}
