:root {
  --bg: #121827; --panel: #1e2742; --panel2: #2a3558; --border: #3b4a78;
  --text: #f1f2f7; --sub: #a9b2cc; --accent: #f2c14e; --danger: #ef5466; --ok: #4ade80; --warn: #f5a524; --off: #6b7491;
  /* 属性の色（ゲームの Theme に近い） */
  --flame: #e5533d; --aqua: #3b8fe0; --gale: #3fb77a;
  /* レア度の色 */
  --r-n: #8a93ad; --r-r: #4f9be8; --r-sr: #b46ee8; --r-ssr: #f2c14e;
  /* 費用の棒（状態の色とは分ける） */
  --bar: #7aa2ff;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 system-ui, "Hiragino Sans", "Noto Sans JP", sans-serif; }
header { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--border); }
h1 { font-size: 18px; margin: 0; color: var(--accent); }
h2 { font-size: 17px; margin: 0 0 12px; }
section h2:not(:first-child) { margin-top: 24px; }
nav { display: flex; flex-wrap: wrap; gap: 6px; }
nav button, button { background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; cursor: pointer; font: inherit; }
nav button.active { background: var(--accent); color: var(--bg); font-weight: bold; }
button.primary { background: var(--accent); color: var(--bg); font-weight: bold; }
button.danger { background: var(--danger); }
button:disabled { opacity: .45; cursor: not-allowed; }
main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 16px; max-width: 1200px; margin: 0 auto; }
@media (min-width: 960px) { main { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); } }
/* お金のタブは 1 列で広く使う */
main.wide { max-width: 1400px; }
@media (min-width: 960px) { main.wide { grid-template-columns: minmax(0, 1fr); } }
section { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; min-width: 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
th { color: var(--sub); font-weight: normal; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
label { display: block; margin: 10px 0 4px; color: var(--sub); font-size: 13px; }
input, select, textarea { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font: inherit; }
textarea { min-height: 120px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline > * { flex: 1; }
.inline.wrap { flex-wrap: wrap; }
.inline.wrap > * { flex: 1 1 140px; }
.inline.wrap > button { flex: 0 0 auto; }
.note { color: var(--sub); font-size: 13px; }
.hint { color: var(--sub); font-size: 12px; margin: 4px 0 0; }
.error { color: var(--danger); font-weight: bold; }
.okmsg { color: var(--ok); font-weight: bold; }
.sub { color: var(--sub); font-size: 13px; }
a { color: var(--accent); }
.status { display: inline-block; padding: 0 8px; border-radius: 10px; background: var(--panel2); font-size: 12px; }
.status.published { background: #2f8f5b; } .status.scheduled { background: #b07d1f; } .status.draft { background: #3a4b82; }
.status.reverted, .status.cancelled { background: #4a4f62; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
pre { background: var(--bg); padding: 8px; border-radius: 6px; overflow: auto; max-height: 260px; font-size: 12px; }
details { margin: 12px 0; }
summary { cursor: pointer; color: var(--sub); }
#toast { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 600px; margin: 0 auto; background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; display: none; }
#toast.show { display: block; }
#toast.bad { border-color: var(--danger); }

/* ---------------- キャラを作る ---------------- */
fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px 14px; margin: 0 0 16px; min-width: 0; }
legend { padding: 0 6px; color: var(--accent); font-weight: bold; }
.field { margin-top: 10px; }
.field > label { margin-top: 0; }
.field .inline > .idtag { flex: 0 0 auto; }
.idtag { display: inline-block; padding: 6px 10px; border-radius: 6px; background: var(--panel2); font-family: ui-monospace, Menlo, monospace; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border-radius: 999px; padding: 4px 12px; font-size: 14px; }
.chip.on { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: bold; }
/* 属性の札は属性の色で */
.chips.el .chip.Flame { border-color: var(--flame); }
.chips.el .chip.Aqua { border-color: var(--aqua); }
.chips.el .chip.Gale { border-color: var(--gale); }
.chips.el .chip.on.Flame { background: var(--flame); border-color: var(--flame); color: #fff; }
.chips.el .chip.on.Aqua { background: var(--aqua); border-color: var(--aqua); color: #fff; }
.chips.el .chip.on.Gale { background: var(--gale); border-color: var(--gale); color: #fff; }
/* ゲームでの見え方（カードの見本） */
.cardpv { border: 2px solid var(--border); border-left-width: 8px; border-radius: 10px; padding: 10px 14px; background: var(--panel2); margin-bottom: 12px; }
.cardpv.Flame { border-color: var(--flame); }
.cardpv.Aqua { border-color: var(--aqua); }
.cardpv.Gale { border-color: var(--gale); }
.cardpv p { margin: 6px 0; }
.cardpv-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.cardpv-head strong { font-size: 17px; }
.rar { display: inline-block; min-width: 40px; text-align: center; padding: 0 6px; border-radius: 6px; font-weight: bold; font-size: 13px; color: var(--bg); background: var(--r-n); }
.rar.R { background: var(--r-r); }
.rar.SR { background: var(--r-sr); color: #fff; }
.rar.SSR { background: var(--r-ssr); }
.tag { display: inline-block; margin-right: 8px; padding: 0 8px; border-radius: 6px; font-size: 12px; background: var(--bg); color: var(--sub); border: 1px solid var(--border); }
.errors, .warnings { margin: 8px 0; padding: 8px 12px 8px 28px; border-radius: 8px; font-size: 14px; }
.errors { background: rgba(239, 84, 102, .12); border: 1px solid var(--danger); color: #ffc2ca; }
.warnings { background: rgba(245, 165, 36, .12); border: 1px solid var(--warn); color: #ffe0a8; }
pre.prompt { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; font-size: 12.5px; }
.looks { padding-left: 18px; font-size: 13px; }
.looks li { margin: 6px 0; }

/* ---------------- お金 ---------------- */
.billhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.billhead h2 { margin: 0; }
.billgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 12px 0 8px; }
.bill { background: var(--panel2); border: 1px solid var(--border); border-top: 4px solid var(--off); border-radius: 10px; padding: 12px; min-width: 0; }
.bill.ok { border-top-color: var(--ok); }
.bill.warn { border-top-color: var(--warn); }
.bill.bad { border-top-color: var(--danger); }
.bill header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0; background: none; border: 0; }
.bill p { margin: 6px 0 0; }
.bill details { margin: 8px 0 0; }
.badge { display: inline-block; padding: 0 8px; border-radius: 10px; font-size: 12px; background: var(--off); color: #fff; }
.badge.ok { background: #2f8f5b; }
.badge.warn { background: var(--warn); color: var(--bg); }
.badge.bad { background: var(--danger); }
.big { font-size: 26px; font-weight: bold; margin: 8px 0 4px; font-variant-numeric: tabular-nums; }
.big small { font-size: 13px; font-weight: normal; color: var(--sub); }
/* 月の予算の棒（幅は 5% 刻みのクラス） */
.meter { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; margin-top: 8px; }
.meter span { display: block; height: 100%; background: var(--ok); }
.meter span.warn { background: var(--warn); }
.meter span.bad { background: var(--danger); }
.meter .w0 { width: 0; } .meter .w1 { width: 5%; } .meter .w2 { width: 10%; } .meter .w3 { width: 15%; } .meter .w4 { width: 20%; }
.meter .w5 { width: 25%; } .meter .w6 { width: 30%; } .meter .w7 { width: 35%; } .meter .w8 { width: 40%; } .meter .w9 { width: 45%; }
.meter .w10 { width: 50%; } .meter .w11 { width: 55%; } .meter .w12 { width: 60%; } .meter .w13 { width: 65%; } .meter .w14 { width: 70%; }
.meter .w15 { width: 75%; } .meter .w16 { width: 80%; } .meter .w17 { width: 85%; } .meter .w18 { width: 90%; } .meter .w19 { width: 95%; }
.meter .w20 { width: 100%; }
/* 直近の日ごとの費用（高さは 10 段のクラス） */
.bars { display: flex; align-items: flex-end; gap: 2px; height: 44px; margin-top: 10px; padding-bottom: 2px; border-bottom: 1px solid var(--border); }
.bars span { flex: 1; min-width: 2px; background: var(--bar); border-radius: 2px 2px 0 0; }
.bars .h1 { height: 4px; } .bars .h2 { height: 8px; } .bars .h3 { height: 12px; } .bars .h4 { height: 16px; } .bars .h5 { height: 20px; }
.bars .h6 { height: 24px; } .bars .h7 { height: 28px; } .bars .h8 { height: 32px; } .bars .h9 { height: 36px; } .bars .h10 { height: 40px; }
.nowrap { white-space: nowrap; }
/* 狭い画面では表を横に送る（文字を 1 字ずつに折らない） */
.tablewrap { overflow-x: auto; }
table.entries td, table.settings th, table.settings td { white-space: nowrap; overflow-wrap: normal; }
table.entries td:nth-child(5) { white-space: normal; min-width: 8em; }
/* 消した記録（見積もりに入らない）。打ち消し線と薄い色で生きている記録と分ける */
table.entries tr.deleted td:not(:last-child) { text-decoration: line-through; opacity: 0.55; }
table.settings input { min-width: 6em; }
table.peers td { min-width: 4em; } table.peers td:nth-child(1) { min-width: 7em; } table.peers td:nth-child(4) { min-width: 12em; }

/* ---------------- シーズン ---------------- */
.status.season-active { background: #2f8f5b; } .status.season-upcoming { background: #3a4b82; }
.status.season-due { background: #b07d1f; } .status.season-closed { background: #4a4f62; }
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.tiers label { margin: 0; }
.tiers input { margin-top: 2px; }
