:root {
  --bg: #f4f6f9; --panel: #ffffff; --text: #1d2733; --muted: #66727f; --line: #dde3ea;
  --brand: #1f4e78; --brand-2: #2e75b6; --accent-bg: #e8f1fa;
  --ok: #2e7d32; --warn: #b26a00; --warn-bg: #fff3dc; --bad: #c62828; --bad-bg: #fde7e7; --hit: #fffbd1;
  --radius: 8px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  font-family: "Meiryo UI", "Yu Gothic UI", "Hiragino Sans", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg:#14181d; --panel:#1d232a; --text:#e5e9ee; --muted:#98a3ae; --line:#2e3741; --brand:#7fb3e6; --brand-2:#8cc0f0; --accent-bg:#1f3347;
    --warn:#ffb74d; --warn-bg:#3a2c12; --bad:#ff8a80; --bad-bg:#3d1c1c; --hit:#3a3815; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 13px; }
a { color: var(--brand-2); }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px; padding: 0 20px; height: 52px;
  background: #1f4e78; color: #fff; box-shadow: var(--shadow); }
.brand { font-weight: 700; font-size: 16px; white-space: nowrap; }
#tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
#tabs::-webkit-scrollbar { display: none; }
#tabs a { color: #cfe0f1; text-decoration: none; padding: 16px 14px; white-space: nowrap; border-bottom: 3px solid transparent; }
#tabs a:hover { color: #fff; }
#tabs a.active { color: #fff; border-bottom-color: #ffc000; font-weight: 700; }
main { padding: 20px; max-width: 1600px; margin: 0 auto; }
h1 { font-size: 20px; margin: 0 0 4px; }
.sub { color: var(--muted); margin: 0 0 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .spacer, .spacer { flex: 1; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-2); outline-offset: -1px; }
input[type=search] { min-width: 240px; }
.btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 6px; padding: 6px 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--brand-2); }
.btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; font-weight: 700; }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.small { padding: 3px 8px; font-size: 12px; }
.icon-btn { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }

/* tables */
.table-wrap { overflow: auto; max-height: calc(100vh - 210px); }
table { border-collapse: separate; border-spacing: 0; width: 100%; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; background: var(--panel); z-index: 2; font-weight: 700; color: var(--muted); font-size: 12px; white-space: nowrap; cursor: pointer; user-select: none; }
th.nosort { cursor: default; }
th .arrow { font-size: 10px; margin-left: 2px; }
tbody tr:hover { background: var(--accent-bg); }
tbody tr.clickable { cursor: pointer; }
tr.dim td { color: var(--muted); }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.nowrap { white-space: nowrap; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* tags */
.tag { display: inline-block; padding: 1px 8px; margin: 1px 3px 1px 0; border-radius: 999px; background: var(--accent-bg); color: var(--brand); font-size: 12px; border: 1px solid transparent; cursor: pointer; white-space: nowrap; }
.tag:hover { border-color: var(--brand-2); }
.tag.retired { background: var(--bad-bg); color: var(--bad); }
.tag.static { cursor: default; }
.tag.static:hover { border-color: transparent; }
.chip-filter { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--brand-2); color: #fff; font-size: 12px; }
.chip-filter button { border: 0; background: rgba(255,255,255,.25); color: #fff; border-radius: 999px; width: 18px; height: 18px; cursor: pointer; line-height: 1; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.ok { background: var(--accent-bg); color: var(--brand); }
.badge.muted { background: var(--line); color: var(--muted); }
.badge.kind { font-size: 12px; padding: 2px 9px; }
.badge.kind.lump { background: var(--accent-bg); color: var(--brand); }
.badge.kind.unit { background: #e6f4ea; color: #1e7b3a; }
@media (prefers-color-scheme: dark) { .badge.kind.unit { background: #1c3324; color: #8fd5a4; } }
.st-稼働中 { color: var(--ok); font-weight: 700; }
.st-廃止予定, .st-廃止済 { color: var(--muted); }

/* dashboard */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { padding: 16px; }
.card .label { color: var(--muted); font-size: 12px; }
.card .value { font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.card .value.alert { color: var(--bad); }
.card .value small { font-size: 13px; font-weight: 400; color: var(--muted); margin: 0 2px 0 3px; }
.section-title { font-size: 15px; font-weight: 700; margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--line); }

/* cost */
.cost-cell { white-space: nowrap; line-height: 1.5; }
.cost-cell .cost-u { font-weight: 700; }
.cost-cell .cost-c { color: var(--muted); }
.cost-panel { margin-bottom: 16px; }
.cost-panel .section-title svg { vertical-align: -3px; color: var(--brand-2); }
.cost-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.cost-tile { padding: 14px 16px 16px; border-right: 1px solid var(--line); border-top: 1px solid transparent; }
.cost-tile:last-child { border-right: 0; }
.cost-tile.est { background: var(--accent-bg); }
.cost-tile .label { font-size: 13px; font-weight: 700; }
.cost-tile .note { font-size: 11px; color: var(--muted); margin-top: 2px; }
.cost-tile .u { font-size: 21px; font-weight: 800; margin-top: 10px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.cost-tile .c { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cost-tile .waste { display: inline-block; margin-top: 8px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--warn-bg); color: var(--warn); }
.field[hidden] { display: none; }
.cost-calc { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 16px; padding: 10px 12px; border-radius: var(--radius); background: var(--accent-bg); }
.cost-calc > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.cost-calc .k { font-size: 12px; color: var(--muted); font-weight: 700; min-width: 6em; }
.cost-calc b { font-size: 16px; font-variant-numeric: tabular-nums; }

/* ranking */
.rank-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-bottom: 16px; }
.rank-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.rank-head .ico { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; color: #fff; }
.rank-head.top .ico { background: linear-gradient(135deg, #ffd54f, #f59e0b); box-shadow: 0 3px 10px rgba(245, 158, 11, .35); }
.rank-head.worst .ico { background: linear-gradient(135deg, #ff8a80, #d93a3a); box-shadow: 0 3px 10px rgba(217, 58, 58, .3); }
.rank-head .tag-en { font-size: 11px; font-weight: 800; letter-spacing: .16em; color: var(--muted); }
.rank-head.top .tag-en { color: #d48806; }
.rank-head.worst .tag-en { color: var(--bad); }
.rank-head h2 { margin: 0; font-size: 16px; }
.seg { margin-left: auto; display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; flex: none; }
.seg button { font: inherit; font-size: 12px; border: 0; background: none; color: var(--muted); padding: 4px 12px; cursor: pointer; }
.seg button.on { background: var(--brand-2); color: #fff; font-weight: 700; }
.rank-list { list-style: none; margin: 0; padding: 6px 0 8px; }
.rank-item { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 16px; cursor: pointer; }
.rank-item:hover { background: var(--accent-bg); }
.rank-no { position: relative; justify-self: center; display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%;
  font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; background: var(--line); color: var(--muted); }
.rank-no .crown { position: absolute; top: -13px; color: #f59e0b; filter: drop-shadow(0 1px 1px rgba(0,0,0,.2)); }
.top .rank-no.r1 { width: 46px; height: 46px; font-size: 24px; background: linear-gradient(135deg, #fff1a8, #f5b301); color: #5c4200; box-shadow: 0 3px 10px rgba(245, 179, 1, .45); }
.top .rank-no.r2 { width: 42px; height: 42px; font-size: 21px; background: linear-gradient(135deg, #f5f7f8, #a7b4bc); color: #36454f; }
.top .rank-no.r3 { width: 40px; height: 40px; font-size: 20px; background: linear-gradient(135deg, #ffd9c4, #cd7f4b); color: #5a2a0e; }
.worst .rank-no { background: var(--bad-bg); color: var(--bad); }
.worst .rank-no.r1 { width: 42px; height: 42px; font-size: 21px; background: linear-gradient(135deg, #ff9a8f, #d93a3a); color: #fff; }
.rank-name { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-name small { margin-left: 6px; font-size: 11px; font-weight: 400; color: var(--muted); }
.rank-bar { height: 6px; margin-top: 7px; border-radius: 999px; background: var(--line); overflow: hidden; }
.rank-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand-2), #4fc3f7); }
.worst .rank-bar span { background: linear-gradient(90deg, #ffab91, var(--bad)); }
.rank-val { text-align: right; font-size: 26px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rank-val small { margin-left: 2px; font-size: 12px; color: var(--muted); }
.rank-sub { font-size: 11px; font-weight: 400; color: var(--muted); white-space: nowrap; }

/* requests */
.nav-count { display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: #ffc000; color: #1d2733; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; }
.nav-count[hidden] { display: none; }
.req-summary { display: grid; gap: 6px; margin-bottom: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--accent-bg); }
.req-row { display: grid; grid-template-columns: 8.5em minmax(0, 1fr); gap: 10px; align-items: baseline; overflow-wrap: anywhere; }
.req-row .k { font-size: 12px; font-weight: 700; color: var(--muted); }
.badge.new { background: var(--bad); color: #fff; letter-spacing: .05em; }
tr.unread td { background: var(--hit); }
.notice-panel { margin-bottom: 16px; border-left: 4px solid #ffc000; }
.notice-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px 6px; }
.notice-head h2 { margin: 0; font-size: 15px; }
.notice-head .btn { margin-left: auto; }
.notice-list { list-style: none; margin: 0; padding: 0 0 6px; }
.notice-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px 10px; align-items: center; padding: 8px 16px; border-top: 1px solid var(--line); }
.notice-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.notice-ico { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; font-weight: 800; color: #fff; background: var(--muted); }
.notice-item.approved .notice-ico { background: var(--ok); }
.notice-item.rejected .notice-ico { background: var(--bad); }
.notice-text { overflow-wrap: anywhere; line-height: 1.6; }
@media (max-width: 720px) { .notice-item { grid-template-columns: 28px minmax(0, 1fr); } .notice-actions { grid-column: 2; } }
.news-panel { margin-bottom: 16px; }
.news-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.news-head h2 { margin: 0; font-size: 16px; }
.news-head .tag-en { font-size: 11px; font-weight: 800; letter-spacing: .16em; color: var(--brand-2); }
.news-head .legend { margin-left: auto; }
.news-ico { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; color: #fff;
  background: linear-gradient(135deg, #4fc3f7, var(--brand-2)); box-shadow: 0 3px 10px rgba(46, 117, 182, .3); }
.news-list { list-style: none; margin: 0; padding: 4px 0; }
.news-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 16px; }
.news-badges { display: inline-flex; gap: 4px; margin-right: 8px; vertical-align: 2px; }
.news-badges:empty { display: none; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 14px 0 4px; }
.pager:empty { display: none; }
.btn:disabled { opacity: .45; cursor: default; }
.badge.cat { background: var(--panel); color: var(--muted); border: 1px solid var(--line); font-weight: 700; }
.news-meta { margin-top: 2px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.news-body > .legend, .news-body > .notice-msg { margin-top: 2px; }
.news-item + .news-item { border-top: 1px dashed var(--line); }
.news-date { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; font-size: 18px; font-variant-numeric: tabular-nums; color: var(--brand); }
.news-name { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.news-name small { margin: 0 6px; font-size: 11px; font-weight: 400; color: var(--muted); }
.empty.small { padding: 18px; }
@media (max-width: 720px) { .news-item { grid-template-columns: minmax(0, 1fr); } .news-side { justify-self: start; } }
/* NEWS tabs / banners */
.news-tabs { margin-left: auto; display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.news-tabs button { font: inherit; font-size: 12px; border: 0; background: none; color: var(--muted); padding: 5px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.news-tabs button.on { background: var(--panel); color: var(--brand); font-weight: 700; box-shadow: var(--shadow); }
.news-tabs .n { display: inline-block; min-width: 16px; margin-left: 5px; padding: 0 5px; border-radius: 999px; background: var(--brand-2); color: #fff; font-size: 10px; line-height: 16px; text-align: center; }
.news-sub { padding: 10px 16px 0; font-size: 12px; font-weight: 700; color: var(--warn); }
.news-foot { margin: 0; padding: 0 16px 10px; }
.news-banners { display: grid; gap: 8px; margin-bottom: 12px; }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 14px; border-radius: var(--radius); cursor: pointer; line-height: 1.6; }
.banner.important { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad); }
.banner.important b { color: var(--bad); }
.banner.mine { background: var(--warn-bg); color: var(--text); border: 1px solid var(--warn); }
.banner .more { margin-left: auto; font-size: 12px; text-decoration: underline; }
.notice-msg { margin-top: 3px; padding: 4px 8px; border-radius: 6px; background: var(--warn-bg); font-size: 12px; }
.link { color: var(--brand-2); cursor: pointer; text-decoration: underline; }
.news-name.link { text-decoration: none; }
.news-name.link:hover { text-decoration: underline; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ann-body { padding: 12px 14px; border-radius: var(--radius); background: var(--accent-bg); line-height: 1.8; overflow-wrap: anywhere; }
.ban-warn:empty { display: none; }
.ban-warn { margin-top: 4px; padding: 6px 10px; border-radius: 6px; font-size: 12px; font-weight: 700; line-height: 1.6; }
.ban-warn.bad { background: var(--bad-bg); color: var(--bad); }
.ban-warn.warn { background: var(--warn-bg); color: var(--warn); }
label.check { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0; font-size: 13px; cursor: pointer; }
label.check input { margin-top: 3px; }
.board-sec { margin-bottom: 16px; }
td.w-wide { min-width: 260px; }
.board-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.board-head h2 { margin: 0; font-size: 15px; }
#modal-body textarea[name="body"] { min-height: 120px; }
.req-warn.bad { background: var(--bad-bg); color: var(--bad); }
.req-warn { margin: 0 0 12px; padding: 8px 12px; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn); font-weight: 700; }

/* matrix */
.matrix { width: auto; }
.matrix th.app { vertical-align: bottom; padding: 8px 4px; width: 76px; min-width: 76px; max-width: 76px; white-space: normal; text-align: center; color: var(--text); font-size: 11px; line-height: 1.35; word-break: break-all; }
.matrix th.app small { display: block; color: var(--muted); font-weight: 400; }
.matrix td.cell { text-align: center; cursor: pointer; padding: 6px 4px; font-size: 15px; color: var(--brand-2); border-left: 1px solid var(--line); }
.matrix td.cell:hover { background: var(--accent-bg); outline: 1px solid var(--brand-2); }
.matrix td.cell.stopped { color: var(--muted); font-size: 12px; }
.matrix tr.retired td { background: var(--bad-bg); }
.matrix th.sticky-col, .matrix td.sticky-col { position: sticky; left: 0; background: var(--panel); z-index: 1; }
.matrix th.sticky-col { z-index: 3; }
.legend { color: var(--muted); font-size: 12px; }

/* modal */
dialog { border: 0; border-radius: 10px; padding: 0; width: min(920px, 96vw); max-height: 92vh; background: var(--panel); color: var(--text); box-shadow: 0 20px 50px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(10,20,30,.45); }
dialog form { display: flex; flex-direction: column; max-height: 92vh; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 16px; margin: 0; }
.modal-body { padding: 14px 18px; overflow: auto; }
.modal-foot { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 12px; padding: 10px 12px 12px; }
legend { font-weight: 700; color: var(--brand); padding: 0 6px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 12px; color: var(--muted); font-weight: 700; }
.field label .req { color: var(--bad); }
.field .hint { font-size: 11px; color: var(--muted); }
.field.error input, .field.error select { border-color: var(--bad); }

/* tag input */
.tag-input { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; background: var(--panel); min-height: 33px; }
.tag-input:focus-within { outline: 2px solid var(--brand-2); outline-offset: -1px; }
.tag-input input { border: 0; outline: 0; padding: 2px; flex: 1; min-width: 100px; }
.tag-input .tag { cursor: default; }
.tag-input .tag button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 0 0 4px; font-size: 13px; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: #1d2733; color: #fff; padding: 10px 18px; border-radius: 8px; opacity: 0; transition: .25s; pointer-events: none; z-index: 100; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--bad); }
/* popover（最前面の層）として出すときに、ブラウザ標準の枠・余白・全面配置を打ち消す */
#toast[popover] { inset: auto; top: auto; right: auto; bottom: 24px; left: 50%; margin: 0; border: 0; overflow: visible; width: auto; height: auto; max-width: min(90vw, 720px); }
#toast[popover]::backdrop { display: none; }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.settings-grid .panel { padding: 0 0 14px; }
.settings-grid .inner { padding: 12px 14px 0; display: flex; flex-direction: column; gap: 10px; }
.lists-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.lists-grid textarea { width: 100%; height: 120px; resize: vertical; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.note { color: var(--muted); font-size: 12px; line-height: 1.6; }

/* login / account */
body.auth-mode #tabs, body.auth-mode #userbox { display: none; }
#userbox { margin-left: auto; display: flex; gap: 10px; align-items: center; white-space: nowrap; font-size: 12px; }
#userbox .who { color: #cfe0f1; }
#userbox .who b { color: #fff; }
#userbox button { font: inherit; background: none; border: 1px solid rgba(255,255,255,.45); color: #fff; border-radius: 6px; padding: 3px 10px; cursor: pointer; }
#userbox button:hover { background: rgba(255,255,255,.12); }
.notice { margin: 12px 20px 0; padding: 10px 14px; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn); font-weight: 700; }
.auth-box { max-width: 400px; margin: 48px auto; padding: 24px 24px 20px; }
.auth-box h1 { margin-bottom: 6px; }
.auth-box form { display: flex; flex-direction: column; gap: 12px; }
.auth-box input { width: 100%; }
.auth-box .btn { padding: 8px 14px; }
.auth-box .msg { color: var(--bad); min-height: 1.2em; font-weight: 700; }
.pw-row { display: flex; gap: 6px; }
.pw-row input { flex: 1; }
@media (max-width: 1280px) { #userbox .who span { display: none; } }
@media (max-width: 720px) {
  #userbox .who { display: none; } .notice { margin: 12px 12px 0; }
  .topbar { gap: 8px; padding: 0 10px; } .brand { display: none; } main { padding: 12px; }
  input[type=search] { min-width: 0; width: 100%; }
}

/* ===== 裏ダッシュボード（insights.js） ===== */
:root { --c1: #2e75b6; --c2: #1f4e78; --c3: #5b9bd5; --c4: #ffc000; --c5: #70ad47; --c6: #ed7d31; --c7: #a5a5a5; --c8: #8064a2; --track: #eef2f6; }
@media (prefers-color-scheme: dark) { :root { --c2: #4f86bf; --track: #262e37; } }
.in-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 560px), 1fr)); gap: 16px; }
.in-card { padding: 16px 18px 18px; min-width: 0; }
.in-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 4px; }
.in-head h2 { font-size: 15px; margin: 0; }
.in-no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand-2); color: #fff; font-size: 12px; font-weight: 700; margin-right: 6px; vertical-align: 1px; }
.in-why { color: var(--muted); margin: 0 0 12px; line-height: 1.6; }
.in-src { color: var(--muted); font-size: 11px; margin: 12px 0 0; border-top: 1px dashed var(--line); padding-top: 8px; line-height: 1.6; }
.in-svg { display: block; width: 100%; height: auto; }
.in-svg text, .in-donut text { fill: var(--text); font-family: inherit; }
.in-svg .muted, .in-donut .muted { fill: var(--muted); }
.in-svg .grid-line { stroke: var(--line); }
.in-donut-wrap { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.in-donut { width: 210px; flex: none; }
.in-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 220px; }
.in-legend li { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line); }
.in-legend li:last-child { border-bottom: 0; }
.in-legend .sw { width: 12px; height: 12px; border-radius: 3px; }
.in-legend .amt { font-variant-numeric: tabular-nums; text-align: right; }
.in-legend .pct { color: var(--muted); font-variant-numeric: tabular-nums; width: 46px; text-align: right; }
.in-summary { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-bottom: 10px; color: var(--muted); }
.in-summary b { color: var(--text); font-size: 15px; }
.in-summary b.warn { color: var(--warn); } .in-summary b.bad, .bad-text { color: var(--bad); }
/* 列（名前・バー・数値）は全行で共有して、バーの長さと 100% の線の位置をそろえる */
.in-lic { display: grid; grid-template-columns: minmax(100px, 170px) 1fr minmax(120px, auto); gap: 6px 10px; }
.in-lic-row { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; padding: 2px 4px; border-radius: 4px; }
.in-lic-row[data-lic-type], .in-lic-row[data-in-app] { cursor: pointer; }
.in-lic-row[data-lic-type]:hover, .in-lic-row[data-in-app]:hover, .in-events li:hover { background: var(--accent-bg); }
.in-lic-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.in-lic-row .bar { position: relative; height: 16px; background: var(--track); border-radius: 4px; }
.in-lic-row .fill { height: 100%; border-radius: 4px; background: var(--c1); }
.in-lic-row .fill.low { background: var(--c4); } .in-lic-row .fill.over { background: var(--bad); }
.in-lic-row .cap { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: .55; }
.in-lic-row .val { font-variant-numeric: tabular-nums; font-size: 12px; white-space: nowrap; }
.in-chip { margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.in-keys { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 12px; margin-top: 10px; }
.in-keys span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; background: var(--k); }
.in-events { list-style: none; margin: 12px 0 0; padding: 0; max-height: 220px; overflow: auto; border-top: 1px solid var(--line); }
.in-events li { display: grid; grid-template-columns: 86px 112px 1fr; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--line); align-items: center; cursor: pointer; }
.in-events .d { font-variant-numeric: tabular-nums; color: var(--muted); }
.in-stack { display: flex; height: 30px; border-radius: 6px; overflow: hidden; }
.in-stack div { display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; min-width: 0; }
@media (max-width: 560px) { .in-lic { grid-template-columns: 1fr; } .in-lic-row { grid-template-columns: 1fr auto; gap: 4px 10px; } .in-lic-row .bar { grid-column: 1 / -1; order: 3; } .in-events li { grid-template-columns: 80px 1fr; } .in-events li > span:last-child { grid-column: 1 / -1; } }

/* ===== 利用者の権限（設定・入出力） ===== */
.perm-grid { display: grid; gap: 4px; }
.perm-row { display: grid; grid-template-columns: 160px 1fr; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.perm-row:last-child { border-bottom: 0; }
.perm-label { font-weight: 700; }
.perm-choices { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.perm-choices .radio { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.perm-choices input:disabled + * , .perm-choices input:disabled { cursor: default; }
.matrix.readonly td.cell { cursor: default; }
.matrix.readonly td.cell:hover { background: inherit; }
@media (max-width: 560px) { .perm-row { grid-template-columns: 1fr; gap: 4px; } }

/* ===== 入力の一時保存（drafts.js） ===== */
.draft-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; padding: 8px 12px; border-radius: 6px; background: var(--warn-bg); color: var(--warn); font-weight: 700; font-size: 12px; }
.drafts-bar { margin: 12px 20px 0; padding: 10px 14px; border-radius: var(--radius); background: var(--warn-bg); color: var(--text); border: 1px solid var(--line); }
.drafts-bar .drafts-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; color: var(--warn); }
.drafts-bar ul { list-style: none; margin: 8px 0 0; padding: 0; }
.drafts-bar li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 4px 0; border-top: 1px dashed var(--line); }
.drafts-bar li .t { font-weight: 700; margin-right: auto; }
@media (max-width: 720px) { .drafts-bar { margin: 12px 12px 0; } }

/* ===== 自動ログアウトの前の警告（idle.js） ===== */
dialog.idle-dialog { width: min(440px, 92vw); padding: 18px 22px 16px; border-top: 4px solid var(--warn); }
.idle-dialog h2 { margin: 0 0 8px; font-size: 16px; color: var(--warn); }
.idle-dialog p { margin: 0 0 8px; line-height: 1.7; }
.idle-dialog #idle-left { font-size: 18px; font-variant-numeric: tabular-nums; color: var(--bad); }
.idle-dialog .row-actions { justify-content: flex-end; margin-top: 8px; }

/* NEWS：10 件を超えた分は「▽ 残り N 件を表示」で開く（アコーディオン） */
.news-more > summary { list-style: none; cursor: pointer; text-align: center; padding: 8px; margin-top: 2px; color: var(--brand); font-size: 12px; font-weight: 700; border-top: 1px dashed var(--line); border-radius: 4px; }
.news-more > summary::-webkit-details-marker { display: none; }
.news-more > summary:hover { background: var(--accent-bg); }
.news-more .c, .news-more[open] .o { display: none; }
.news-more[open] .c { display: inline; }
/* 保有マトリクスのセルのメニュー（利用中・停止中・未利用） */
.mx-menu { position: fixed; z-index: 60; min-width: 210px; padding: 4px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.mx-menu button { display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; border-radius: 5px; background: none; color: inherit; font: inherit; cursor: pointer; white-space: nowrap; }
.mx-menu button:hover:not([disabled]), .mx-menu button:focus-visible { background: var(--accent-bg); outline: none; }
.mx-menu button[disabled] { color: var(--muted); cursor: default; }
.mx-menu .mk { display: inline-block; width: 1.2em; text-align: center; color: var(--brand-2); }
.mx-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
