/* 管理画面。本人側のドック(モック/ドック_v0.html)と同じ暗い調子・同じ状態の色。配信中に横で開くので派手にしない。 */
:root {
  --bg: #141414;
  --panel: #1f1f1f;
  --panel-2: #272727;
  --deep: #181818;
  --title: #2f2f2f;
  --line: #3a3a3a;
  --line-soft: #323232;
  --text: #e4e4e4;
  --muted: #9b9b9b;
  --faint: #6f6f6f;
  --btn: #3a3a3a;
  --btn-hover: #444;
  --focus: #6aa0ff;
  --live: #e0484a;
  --ok: #4cae6a;
  --warn: #e2b93b;
  --warn-bg: #3a3218;
  --notified: #4a8fe0;
  --working: #2c5fb8;
  --checking: #8b64d6;
  --resolved: #3fa45b;
  --withdrawn: #6a6a6a;
  --primary: #2c4a7a;
  --primary-line: #3d5a8c;
  --team-bubble: #2d4670;
  --st-bubble: #343434;
  --line-chart: #7fa8e8;
  --font: "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 13px; line-height: 1.5; min-width: 320px;
}
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
[hidden] { display: none !important; }
a { color: #9cc0ff; }
h1 { font-size: 18px; margin: 0; font-weight: 600; }
h2 { font-size: 14px; margin: 0 0 8px; font-weight: 600; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
h3 { font-size: 13px; margin: 0 0 6px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--panel); padding: 6px 10px; z-index: 10; }
.skip:focus { left: 8px; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace; }

/* ---------- 頭の帯 ---------- */
.top {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--title); border-bottom: 1px solid var(--line); padding: 6px 16px; min-height: 44px;
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 600; }
.nav { display: flex; gap: 2px; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 3px; }
.nav a:hover { color: var(--text); background: #383838; }
.nav a[aria-current="page"] { color: var(--text); background: #3a3a3a; }
.conn { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); margin-left: auto; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--faint); }
.conn.open .dot { background: var(--ok); }
.conn.connecting .dot { background: var(--warn); }
.conn.down { color: var(--warn); }
.conn.down .dot { background: var(--live); }
.head-user { display: inline-flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
body:not(.logged-in) .conn { margin-left: auto; }

main { padding: 14px 16px 40px; max-width: 1440px; margin: 0 auto; outline: none; }
.page-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; }
.list-sub { margin: 0; }

/* ---------- 部品 ---------- */
.btn {
  min-height: 32px; padding: 0 12px; border-radius: 3px; border: 1px solid #4b4b4b;
  background: var(--btn); cursor: pointer; white-space: nowrap; flex: none;
}
.btn:hover:not(:disabled) { background: var(--btn-hover); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary-line); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: #33558c; }
.btn.danger { background: #5a2a2a; border-color: #7a3a3a; }
.btn.small { min-height: 28px; padding: 0 9px; font-size: 12px; }
.btn.wide { width: 100%; min-height: 40px; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 12px; padding: 4px; }
input:not([type=checkbox]):not([type=radio]), textarea {
  background: #121212; border: 1px solid var(--line); border-radius: 3px; padding: 6px 8px; min-height: 32px; width: 100%;
}
input:disabled, textarea:disabled { opacity: .55; }
select { background: #121212; border: 1px solid var(--line); border-radius: 3px; padding: 0 8px; min-height: 32px; }
.confirm-input { width: 150px !important; min-height: 28px !important; }
.nowrap { white-space: nowrap; }
tr.disabled th, tr.disabled td { color: var(--faint); }
.events { margin: 0; padding-left: 16px; font-size: 11px; color: var(--muted); }
.msg.sys .seen { margin-left: 4px; }
input.num:not([type=checkbox]) { width: 84px; }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: #4a8fe0; }
.chk { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; margin-right: 10px; cursor: pointer; }
.form-err { color: #f08a8a; font-size: 12px; margin: 6px 0; }
.panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: 4px; padding: 12px; min-width: 0; }
.pill { font-size: 11px; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.live { background: #3a1c1c; border-color: #6a2d2d; color: #ffb4b4; }
.pill.live::before { content: "● "; color: var(--live); }
.pill.idle { color: var(--text); }
.pill.stale { background: var(--warn-bg); border-color: #5a4a1c; color: var(--warn); }
.pill.off { color: var(--faint); }
.badge { font-size: 11px; padding: 0 7px; border-radius: 9px; line-height: 18px; white-space: nowrap; background: var(--c, #555); color: #fff; }
.s-notified { --c: var(--notified); }
.s-working { --c: var(--working); }
.s-checking { --c: var(--checking); }
.s-resolved { --c: var(--resolved); }
.s-withdrawn { --c: var(--withdrawn); }
.t { background: var(--deep); border: 1px solid var(--line-soft); border-radius: 3px; padding: 4px 8px; min-width: 0; }
.t-l { display: block; font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-v { font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t.hot { border-color: #5a4a1c; }
.t.hot .t-v { color: var(--warn); }
.t.hot .t-v::before { content: "⚠ "; font-size: 12px; }

/* ---------- ログイン ---------- */
.login-wrap { display: flex; justify-content: center; padding-top: 8vh; }
.login-card { width: 340px; max-width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.login-card label { font-size: 12px; color: var(--muted); margin-top: 6px; }
.login-card .btn { margin-top: 10px; }
.mock-hint { font-size: 11px; color: #d9c48a; background: #2e2a20; border: 1px solid #50462a; border-radius: 3px; padding: 6px 8px; margin: 10px 0 0; }

/* ---------- 一覧 ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 10px; }
@media (max-width: 860px) { .cards-grid { grid-template-columns: 1fr; } }
.s-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--panel); border: 1px solid var(--line-soft); border-left: 4px solid var(--line); border-radius: 4px; padding: 10px 12px;
}
.s-card:hover { border-color: #4a4a4a; background: #232323; }
.s-card.warn { border-left-color: var(--warn); }
.s-card.dim { opacity: .7; }
.c-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.c-name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-row2 { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin: 2px 0 8px; font-variant-numeric: tabular-nums; }
.c-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.t-req.has { border-color: #34507e; }
.t-req.has .t-v { color: #9cc0ff; font-weight: 600; }
.c-alerts, .d-alerts { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.c-alerts:empty, .d-alerts:empty { display: none; }
.c-alerts li, .d-alerts li { font-size: 12px; color: var(--warn); background: var(--warn-bg); border: 1px solid #5a4a1c; border-radius: 3px; padding: 2px 7px; }
.c-foot { font-size: 11px; color: var(--faint); margin-top: 6px; font-variant-numeric: tabular-nums; }

/* ---------- 詳細 ---------- */
.detail-head { align-items: center; }
.back { text-decoration: none; color: var(--muted); padding: 4px 6px; border-radius: 3px; }
.back:hover { color: var(--text); background: #2a2a2a; }
.dh-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }
.dh-actions { display: flex; gap: 6px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 10px; align-items: start; }
@media (max-width: 1080px) { .detail-grid { grid-template-columns: 1fr; } }
.col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.d-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
@media (max-width: 1280px) { .d-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; flex-wrap: wrap; }
.seg-b { background: var(--deep); border: 0; border-right: 1px solid var(--line); padding: 4px 9px; min-height: 28px; cursor: pointer; font-size: 12px; color: var(--muted); }
.seg-b:last-child { border-right: 0; }
.seg-b[aria-pressed="true"] { background: #2c4a7a; color: var(--text); }
.seg.small .seg-b { min-height: 24px; padding: 2px 7px; font-size: 11px; }
.chart { position: relative; min-height: 168px; }
.chart.small { min-height: 168px; margin-top: 6px; }
.chart-wrap { position: relative; }
.chart-svg { display: block; width: 100%; height: auto; }
.chart-svg .grid { stroke: #2c2c2c; stroke-width: 1; }
.chart-svg .axis { fill: var(--faint); font-size: 10px; font-family: var(--font); }
.chart-svg .line { fill: none; stroke: var(--line-chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .line.hot { stroke: var(--warn); }
.chart-svg .dot-last { fill: var(--line-chart); stroke: var(--panel); stroke-width: 2; }
.chart-svg .dot-last.hot { fill: var(--warn); }
.chart-svg .thr { stroke: #c46b6b; stroke-width: 1; stroke-dasharray: 4 4; }
.chart-svg .thr-label { fill: #c98a8a; font-size: 10px; font-family: var(--font); }
.chart-svg .cross { stroke: #6a6a6a; stroke-width: 1; }
.chart-svg .dot-hover { fill: var(--text); stroke: var(--panel); stroke-width: 2; }
.chart-svg .hit { fill: transparent; cursor: crosshair; }
.chart-tip { position: absolute; top: 0; width: 120px; text-align: center; font-size: 11px; background: #2c2c2c; border: 1px solid #4a4a4a; border-radius: 3px; padding: 2px 6px; pointer-events: none; font-variant-numeric: tabular-nums; }
.chart-empty { padding: 30px 0; text-align: center; }

.req-list { display: flex; flex-direction: column; gap: 5px; max-height: 420px; overflow-y: auto; }
.req-row {
  text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px;
  background: var(--deep); border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 3px; padding: 6px 9px; width: 100%;
}
.req-row:hover { background: #202020; }
.req-row.sel { border-color: #4a78c2; border-left-color: var(--c); background: #1c2433; }
.req-row.s-withdrawn .rr-title, .req-row.s-resolved .rr-title { color: var(--muted); }
.rr-top { display: flex; gap: 8px; align-items: center; }
.rr-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-detail { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-flags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.rr-flags:empty { display: none; }
.flag { font-size: 11px; border-radius: 3px; padding: 0 6px; }
.flag.warn { color: var(--warn); background: var(--warn-bg); border: 1px solid #5a4a1c; }
.flag.info { color: #cfe0ff; background: #20304a; border: 1px solid #34507e; }

.conv { display: flex; flex-direction: column; min-height: 560px; max-height: calc(100vh - 120px); position: sticky; top: 58px; }
@media (max-width: 1080px) { .conv { position: static; max-height: none; } }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -4px 0 8px; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 6px 12px; cursor: pointer; color: var(--muted); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: #4a8fe0; }
.conv-note { margin: 0 0 6px; }
.req-head { border: 1px solid var(--line-soft); background: var(--deep); border-radius: 3px; padding: 8px; margin-bottom: 8px; }
.rh-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 6px; }
.status-btns { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.st-b { min-height: 30px; padding: 0 10px; border-radius: 3px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; font-size: 12px; }
.st-b:hover:not(:disabled) { background: #333; }
.st-b[aria-pressed="true"] { background: var(--c); border-color: var(--c); color: #fff; font-weight: 600; }
.st-b:disabled { cursor: not-allowed; opacity: .5; }
.note { font-size: 12px; margin: 0 0 6px; }
.note.warn { color: var(--warn); }
.req-info { display: grid; grid-template-columns: auto 1fr; gap: 1px 10px; margin: 0; font-size: 12px; }
.req-info dt { color: var(--muted); }
.req-info dd { margin: 0; word-break: break-word; }
.snap { margin-top: 6px; font-size: 12px; }
.snap summary { cursor: pointer; color: var(--muted); }
.msgs { flex: 1; min-height: 160px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 4px 2px; }
.msg { max-width: 82%; display: flex; flex-direction: column; }
.msg.team { align-self: flex-end; align-items: flex-end; }
.msg.streamer { align-self: flex-start; }
.msg.sys { align-self: center; color: var(--faint); font-size: 12px; margin: 10px 0; }
.who { font-size: 10px; color: var(--muted); }
.bubble { padding: 5px 9px; border-radius: 8px; background: var(--st-bubble); white-space: pre-wrap; word-break: break-word; }
.team .bubble { background: var(--team-bubble); }
.msg-meta { font-size: 10px; color: var(--faint); font-variant-numeric: tabular-nums; }
.seen { color: #8fb4e8; }
.tmpl { display: flex; gap: 4px; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--line-soft); }
.chip { background: var(--deep); border: 1px solid var(--line); border-radius: 12px; padding: 2px 10px; min-height: 26px; cursor: pointer; font-size: 12px; }
.chip:hover { background: #2a2a2a; }
.conv-input { display: flex; gap: 6px; align-items: flex-end; }
.conv-input textarea { min-height: 52px; max-height: 140px; resize: vertical; }
.conv-send { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.conv-send .btn { min-height: 40px; min-width: 64px; }
.counter { font-variant-numeric: tabular-nums; }

.shot-box:empty { display: none; }
.shot-box { margin-bottom: 10px; }
.shot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 10px; border-radius: 3px; font-size: 12px; background: #20304a; border: 1px solid #34507e; color: #cfe0ff; }
.shot.declined, .shot.cancelled { background: #262626; border-color: var(--line); color: var(--muted); }
.shot.received { background: #1d3324; border-color: #2e5a3a; color: #a6dcb4; }
.shot-open { background: none; border: 1px solid #2e5a3a; padding: 0; cursor: zoom-in; border-radius: 3px; }
.shot-thumb { display: block; height: 54px; width: auto; }
.shot-dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 10px; max-width: 92vw; }
.shot-dialog::backdrop { background: rgba(0, 0, 0, .7); }
.shot-dialog img { display: block; max-width: 88vw; max-height: 78vh; }
.shot-dialog form { display: flex; justify-content: flex-end; margin-top: 8px; }

.settings-fold { margin-top: 10px; }
.settings-fold > summary { cursor: pointer; list-style: none; }
.settings-fold > summary h2 { display: inline-flex; margin: 0; }
.settings-fold > summary::before { content: "▸ "; color: var(--muted); }
.settings-fold[open] > summary::before { content: "▾ "; }
.settings-fold[open] > summary { margin-bottom: 10px; }
.thr-form, .busy-form { margin-bottom: 14px; }
.busy-form { display: flex; flex-direction: column; gap: 4px; max-width: 560px; }
.busy-form label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.busy-form .btn { align-self: flex-start; margin-top: 6px; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
thead th { font-size: 11px; color: var(--muted); font-weight: 400; }
tbody th { font-weight: 600; white-space: nowrap; }
td.actions { white-space: nowrap; }
td.actions > * { margin-right: 4px; }

.knobs { margin-top: 14px; border: 1px dashed #4a4a4a; border-radius: 4px; padding: 6px 10px; background: #1a1a1a; font-size: 12px; }
.knobs summary { cursor: pointer; color: var(--muted); }
.knobs-row { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 0 4px; }

/* ---------- 設定 ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: start; }
@media (max-width: 1080px) { .settings-grid { grid-template-columns: 1fr; } }
.secret { background: #2e2a20; border: 1px solid #50462a; color: #e8d9a6; border-radius: 4px; padding: 10px; margin: 0 0 10px; }
.secret p { margin: 0 0 6px; font-size: 12px; }
.secret-value { display: block; background: #121212; border: 1px solid var(--line); padding: 8px; border-radius: 3px; word-break: break-all; user-select: all; color: var(--text); margin-bottom: 8px; }
.row { display: flex; gap: 6px; align-items: center; }
.row > input { flex: 1; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.row.wrap input { flex: 1 1 140px; width: auto; }
.inline-form { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.inline-form label, .inline-form .label { font-size: 12px; color: var(--muted); }
.stack-form { display: flex; flex-direction: column; gap: 4px; }
.stack-form > label:not(.chk) { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stack-form fieldset { border: 1px solid var(--line); border-radius: 3px; margin: 8px 0 4px; padding: 4px 8px; }
.stack-form legend { font-size: 11px; color: var(--muted); }
.stack-form .btn { align-self: flex-start; margin-top: 6px; }
.tok.on { color: #a6dcb4; }
.tok.off { color: var(--faint); }
.confirm-wrap { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }

/* ---------- お知らせ ---------- */
.toast { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 6px; z-index: 20; max-width: min(420px, calc(100vw - 32px)); }
.toast-item { background: #2c2c2c; border: 1px solid #4a4a4a; border-left: 4px solid #4a8fe0; border-radius: 3px; padding: 7px 10px; font-size: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.toast-item.warn { border-left-color: var(--warn); }
.toast-item.good { border-left-color: var(--resolved); }
.toast-item.bad { border-left-color: var(--live); }

@media (prefers-reduced-motion: no-preference) {
  .s-card, .req-row, .btn { transition: background-color .12s; }
}

/* ---------- 2版目で足した物 ---------- */
.shot-ask { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.shot-ask select { max-width: 260px; }
.consent.ok { color: #a6dcb4; }
.flag.good { color: #a6dcb4; background: #1d3324; border: 1px solid #2e5a3a; }
.note.good { color: #a6dcb4; }
.st-cards { display: flex; flex-direction: column; gap: 6px; }
.st-card { border: 1px solid var(--line); border-radius: 4px; background: var(--deep); }
.st-card > summary { cursor: pointer; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 10px; list-style: none; }
.st-card > summary::before { content: "▸"; color: var(--muted); }
.st-card[open] > summary::before { content: "▾"; }
.st-name { font-weight: 600; }
.st-info { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; padding: 4px 12px 8px; font-size: 12px; }
.st-info dt { color: var(--muted); white-space: nowrap; }
.st-info dd { margin: 0; min-width: 0; word-break: break-word; }
.st-actions { border-top: 1px solid var(--line-soft); padding: 6px 12px 10px; display: flex; flex-direction: column; gap: 6px; }
.st-act-row { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.st-act-label { font-size: 11px; color: var(--muted); width: 104px; flex: none; padding-top: 6px; }
.st-act-row > :not(.st-act-label) { min-width: 0; }
.fb-ctl { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.fb-ctl input { min-width: 220px; flex: 1; }
.ch-input { width: 220px !important; }
.old-way { font-size: 12px; }
.old-way summary { cursor: pointer; color: var(--muted); padding: 4px 0; }
.danger-zone { border-top: 1px dashed var(--line-soft); padding-top: 6px; }
ul.plain { margin: 4px 0 8px; padding-left: 18px; }
.pill.live-ok { background: #1d3324; border-color: #2e5a3a; color: #a6dcb4; }
.dc-status { padding: 0 0 8px; }
.dc-status dd .btn { margin-left: 8px; }
.tok.bad { color: #f08a8a; }
.t-s { display: block; font-size: 10px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 14px; }
