/* フロアレイアウト 共通スタイル */
:root {
  --red: #d62b24;
  --red-dark: #a81f19;
  --ink: #1a1a1a;
  --muted: #6b6559;
  --bg: #f4f2ec;
  --panel: #ffffff;
  --line: #e0dbcf;
  --line-strong: #c9c2b2;
  --blue: #1f6feb;
  --ok: #3d7a3d;
  --warn: #b7791f;
  --font: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic", sans-serif;
  --mono: "BIZ UDGothic", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--red-dark); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 14px 0 8px; }

/* ── ヘッダー ── */
.app-header {
  display: flex; align-items: center; gap: 18px;
  height: 48px; padding: 0 16px;
  background: var(--red); color: #fff;
  position: sticky; top: 0; z-index: 50;
}
.app-header .brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.app-header nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.app-header nav a { color: #fff; text-decoration: none; padding: 6px 12px; border-radius: 4px; white-space: nowrap; opacity: .88; }
.app-header nav a:hover { background: rgba(255,255,255,.14); opacity: 1; }
.app-header nav a.on { background: rgba(0,0,0,.2); opacity: 1; font-weight: 700; }
.app-header .who { font-size: 12px; white-space: nowrap; display: flex; gap: 8px; align-items: center; }
.app-header .link { color: #fff; }

/* ── 部品 ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  height: 32px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 5px;
  background: #fff; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--ink);
}
.btn:hover { border-color: #9c9483; background: #faf8f3; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-dark); }
.btn.small { height: 26px; padding: 0 8px; font-size: 12px; }
.btn.danger { color: #b3261e; }
.btn.on { background: #2b2a27; color: #fff; border-color: #2b2a27; }
.btn svg { width: 16px; height: 16px; flex: none; }
button.link { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
input[type=text], input[type=number], input[type=date], input[type=search], select, textarea {
  height: 32px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 5px; background: #fff; min-width: 0;
}
textarea { height: auto; padding: 6px 8px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field > span { font-size: 12px; color: var(--muted); }
.field.check { flex-direction: row; align-items: center; gap: 6px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.page { padding: 20px; max-width: 1400px; margin: 0 auto; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #ece8de; white-space: nowrap; }
.tag.current { background: #fbe1df; color: var(--red-dark); font-weight: 700; }
.tag.draft { background: #e3ecfb; color: #174ea6; }
.tag.archive { background: #ece8de; color: var(--muted); }

table.grid { border-collapse: collapse; width: 100%; background: #fff; }
table.grid th, table.grid td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: middle; }
table.grid th { font-size: 12px; color: var(--muted); font-weight: 400; background: #faf8f3; position: sticky; top: 0; z-index: 1; }
table.grid tr:hover td { background: #fcfbf7; }
table.grid tr.sel td { background: #fff4f2; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }

/* ── 通知・ダイアログ ── */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: #2b2a27; color: #fff; padding: 10px 18px; border-radius: 6px;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 200; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #b3261e; }
.toast.ok { background: var(--ok); }
.modal-bg { position: fixed; inset: 0; background: rgba(20,18,14,.45); display: grid; place-items: center; z-index: 150; padding: 16px; }
.modal { background: #fff; border-radius: 10px; padding: 20px; width: 420px; max-width: 100%; max-height: 90vh; overflow: auto; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal.wide { width: 760px; }
.modal-body { margin-bottom: 12px; line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ── 凡例 ── */
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 12px; }
.legend .lg { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.legend .lg i { width: 12px; height: 12px; border-radius: 2px; display: inline-block; border: 1px solid rgba(0,0,0,.2); }
.legend.seq b { display: inline-block; width: 140px; height: 12px; border-radius: 2px; border: 1px solid rgba(0,0,0,.15); }

/* ── SVG ── */
svg.plan { display: block; width: 100%; height: 100%; background: #e9e5dc; user-select: none; touch-action: none; }
svg.plan text { font-family: var(--font); pointer-events: none; }
svg.plan .fx { cursor: pointer; }

/* ── ログイン ── */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card { width: 340px; max-width: 100%; }
.login-card h1 { color: var(--red); }

@media (max-width: 720px) {
  .app-header { gap: 8px; padding: 0 10px; }
  .app-header .brand span { display: none; }
  .page { padding: 12px; }
}
