/* NOVA 動画発注 叩き台 — 配色は管理ツール (ace-progress discord.css) に合わせる */
:root {
  --bg: #1c1d20; --panel: #181a1c; --deep: #0e0f10; --hover: #2b2d31; --line: #000;
  --text: #dbdee1; --muted: #949ba4; --white: #fff; --link: #00a8fc;
  --accent: #5865F2; --accent-h: #4752C4;
  --green: #23a55a; --yellow: #f0b232; --red: #f23f43; --pink: #eb459e;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "gg sans", -apple-system, "Segoe UI", "Hiragino Sans", sans-serif; font-size: 14px; color: var(--text); background: var(--deep); }
a { color: var(--link); text-decoration: none; }
button { cursor: pointer; background: var(--hover); color: var(--white); border: none; border-radius: 4px; padding: 6px 14px; font-size: 13px; font-weight: 500; font-family: inherit; }
button:hover { background: #3a3c41; }
button.primary { background: var(--accent); }
button.primary:hover { background: var(--accent-h); }
button.success { background: var(--green); }
button.danger { background: transparent; color: var(--red); border: 1px solid var(--red); }
button:disabled { opacity: .4; cursor: not-allowed; }
input, select, textarea { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-family: inherit; font-size: 13px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 72px; resize: vertical; }

/* ヘッダーと視点切り替え */
header.top { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--deep); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
header.top .brand { font-weight: 700; color: var(--white); }
header.top .brand small { color: var(--muted); font-weight: 400; margin-left: 8px; font-size: 12px; }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--pink)); display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.avatar.sm { width: 20px; height: 20px; font-size: 10px; }
.role-switch { display: flex; gap: 6px; align-items: center; padding: 6px 16px; background: var(--panel); border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.role-switch a { padding: 4px 10px; border-radius: 4px; background: var(--bg); color: var(--text); }
.role-switch a.active { background: var(--accent); color: #fff; }
.role-switch .note { margin-left: auto; }

/* レイアウト */
.app { display: grid; grid-template-columns: 200px 1fr; min-height: calc(100vh - 82px); }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 8px 0; }
.side a { display: flex; justify-content: space-between; color: var(--muted); padding: 8px 10px; margin: 2px 6px; border-radius: 4px; font-size: 13px; }
.side a:hover { background: var(--hover); color: var(--text); }
.side a.active { background: var(--hover); color: var(--white); }
.side .cnt { background: var(--red); color: #fff; border-radius: 8px; font-size: 11px; padding: 0 6px; }
.side hr { border: 0; border-top: 1px solid var(--line); margin: 8px 12px; }
.side .cap { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .5px; padding: 8px 16px 4px; }
main { background: var(--bg); padding: 16px; overflow: auto; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 16px; align-items: start; }
.section { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 14px; }
.section > h2 { color: var(--muted); font-size: 11px; letter-spacing: .5px; font-weight: 700; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.muted { color: var(--muted); font-size: 12px; }
.row-label { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.row-label:last-child { border-bottom: none; }
.row-label > span:first-child { color: var(--muted); flex-shrink: 0; }
.row-label > span:last-child { text-align: right; word-break: break-all; }

/* 集計カード */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.stat .n { font-size: 22px; font-weight: 700; color: var(--white); margin-top: 4px; }
.stat .n small { font-size: 12px; color: var(--muted); font-weight: 400; }
.stat.warn .n { color: var(--yellow); }
.stat.alert .n { color: var(--red); }

/* 状態タグ */
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.tag.s-new { background: #2b2d31; color: #b5bac1; }
.tag.s-wip { background: #1e3a2a; color: #57d38c; }
.tag.s-check { background: #3a2a1a; color: var(--yellow); }
.tag.s-fix { background: #3a1a2a; color: #f47fb5; }
.tag.s-done { background: #1e2a4a; color: #8ea1ff; }
.tag.s-hold { background: #3a1a1a; color: #ff8a8d; }
.tag.late { background: var(--red); color: #fff; }

/* 一覧表 */
table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th { text-align: left; color: var(--muted); font-size: 11px; font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 9px 8px; border-bottom: 1px solid #111214; vertical-align: middle; }
table.list tr.r { cursor: pointer; }
table.list tr.r:hover td { background: #202226; }
table.list tr.r.active td { background: var(--hover); }
.filters { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.filters select, .filters input { width: auto; }
.chip { font-size: 12px; padding: 4px 10px; border-radius: 12px; background: var(--bg); color: var(--muted); cursor: pointer; border: 1px solid var(--line); }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 進行ステップ */
.steps { display: flex; gap: 4px; margin: 4px 0 12px; }
.steps div { flex: 1; text-align: center; font-size: 11px; padding: 6px 2px; border-radius: 4px; background: var(--bg); color: var(--muted); }
.steps div.done { background: #1e2a4a; color: #8ea1ff; }
.steps div.now { background: var(--accent); color: #fff; font-weight: 700; }

/* やり取り (スレッド) */
.thread { display: flex; flex-direction: column; gap: 10px; max-height: 340px; overflow-y: auto; padding-right: 4px; }
.msg { display: flex; gap: 8px; }
.msg .body { flex: 1; }
.msg .meta { font-size: 12px; color: var(--muted); }
.msg .meta b { color: var(--white); margin-right: 6px; }
.msg .meta .did { color: var(--link); margin-right: 6px; }
.msg .txt { font-size: 13px; margin-top: 2px; line-height: 1.55; white-space: pre-wrap; }
.msg.sys .txt { color: var(--muted); font-size: 12px; }
.compose { display: flex; gap: 8px; margin-top: 10px; }
.compose textarea { min-height: 40px; }

.notice { background: #3a2a1a; color: var(--yellow); border-radius: 6px; padding: 8px 10px; font-size: 12px; margin-bottom: 10px; }
.notice.info { background: #1e2a4a; color: #aab6ff; }
.notice.red { background: #3a1a1a; color: #ff8a8d; }
.price { font-size: 20px; font-weight: 700; color: var(--white); }
.pending { color: var(--muted); font-size: 13px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.field .req { color: var(--red); margin-left: 4px; }
.radios { display: flex; gap: 8px; flex-wrap: wrap; }
.radios label { display: flex; align-items: center; gap: 4px; background: var(--bg); border: 1px solid var(--line); padding: 6px 10px; border-radius: 6px; font-size: 13px; color: var(--text); font-weight: 400; cursor: pointer; }
.radios input { width: auto; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.quota { display: flex; gap: 4px; margin-top: 6px; }
.quota span { flex: 1; height: 8px; border-radius: 4px; background: var(--hover); }
.quota span.used { background: var(--accent); }
.log { font-size: 12px; color: var(--muted); }
.log div { padding: 4px 0; border-bottom: 1px solid #111214; }
.log b { color: var(--link); font-weight: 500; }
.hidden { display: none !important; }

/* 折り畳み式の詳細 (行の下に広げる) */
table.list tr.r td:first-child::before { content: '›'; display: inline-block; width: 14px; color: var(--muted); transition: transform .15s; }
table.list tr.r.active td:first-child::before { transform: rotate(90deg); color: var(--white); }
table.list tr.exp > td { padding: 0 0 14px; background: var(--hover); border-bottom: 1px solid var(--line); }
.exp-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding: 12px; }
.exp-grid .section { margin-bottom: 0; background: var(--panel); }
.exp-grid .col { display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 900px) { .exp-grid { grid-template-columns: 1fr; } .app { grid-template-columns: 1fr; } .side { display: flex; flex-wrap: wrap; } .stats { grid-template-columns: repeat(2, 1fr) !important; } }
.compose button { white-space: nowrap; align-self: flex-end; }

/* 共有ページ用: 暗い配色で固定・スマホ幅で表は枠内で横スクロール */
:root { color-scheme: dark; }
header.top { top: env(safe-area-inset-top, 0px); }
main { min-width: 0; }
.section:has(> table.list) { overflow-x: auto; }
table.list { min-width: 640px; }

/* 月次レポート (管理ツールの月次レポートと同じ並び) */
.rep-head { font-size: 16px !important; color: var(--white) !important; letter-spacing: 0 !important; }
.rep-nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 13px; margin-bottom: 14px; }
table.list .num { text-align: right; font-variant-numeric: tabular-nums; }
table.list tfoot td { padding: 10px 8px; border-top: 1px solid var(--line); font-weight: 700; color: var(--white); }
#rep-stats { grid-template-columns: repeat(2, 1fr); }

/* 記載項目の案内 (新しく依頼する) */
.guide { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 8px; font-size: 13px; line-height: 1.7; }
.guide-title { color: var(--white); font-weight: 700; margin-bottom: 8px; }
.guide dl { display: grid; gap: 4px; }
.guide dt { color: var(--white); font-weight: 600; margin-top: 6px; }
.guide dd { color: var(--text); padding-left: 1.2em; }
.guide ul { margin: 4px 0 0 1.2em; color: var(--muted); }

/* 長文の入力欄は書いた分だけ縦に広がる (中でスクロールさせない) */
textarea { overflow: hidden; resize: none; min-height: 72px; }
#n-memo { min-height: 120px; }
.field.back { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.field.back select { width: auto; }
