/* 管理画面の共通スタイル。白基調に紺のアクセント。 */
:root {
	--ink: #1b2536; --ink-soft: #5b6678; --line: #dfe4ec; --ground: #f3f5f8; --surface: #fff;
	--navy: #1f3a68; --navy-dark: #16294b; --navy-soft: #e8edf6;
	--ok: #18794e; --ok-soft: #e3f4ec; --busy: #9a6200; --busy-soft: #fdf2d8; --bad: #b3261e; --bad-soft: #fbe7e5; --idle: #e9ecf1;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 15px/1.6 "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--navy); }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
h1 { margin: 0; font-size: 22px; font-weight: 700; }
h2 { margin: 0 0 10px; font-size: 16px; font-weight: 700; }

/* 枠組み */
.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--navy); color: #fff; padding: 20px 12px; display: flex; flex-direction: column; gap: 20px; }
.brand { font-size: 17px; font-weight: 700; letter-spacing: .06em; color: var(--navy); padding: 0 10px; text-decoration: none; }
.shop { padding: 0 10px; font-size: 13px; color: #c5d0e4; }
.side .brand { color: #fff; }
.shop strong { display: block; color: #fff; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: block; padding: 9px 10px; border-radius: 6px; color: #e3e9f4; text-decoration: none; }
.nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav a.here { background: #fff; color: var(--navy); font-weight: 600; }
.side :focus-visible { outline-color: #fff; }
.main { min-width: 0; padding: 28px clamp(16px, 4vw, 40px) 56px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-descr { color: var(--ink-soft); font-size: 13px; margin: -12px 0 16px; }
.count { color: var(--ink-soft); font-size: 14px; margin-left: 8px; font-weight: 400; }

/* ログイン */
.auth { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 28px; width: 100%; max-width: 380px; display: grid; gap: 16px; }
.auth-card .brand { padding: 0; font-size: 20px; }

/* 通知 */
#flashMessage, .message, .notice { background: var(--ok-soft); color: var(--ok); border-radius: 6px; padding: 9px 14px; margin-bottom: 16px; }
.notice-warn { background: #ffd7e9; color: var(--ink); border-radius: 6px; padding: 9px 14px; margin-bottom: 16px; }
.notice-warn a { color: inherit; font-weight: 600; margin-left: 8px; }
.notice-as { background: var(--busy-soft); color: var(--ink); border-radius: 6px; padding: 9px 14px; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#authMessage, .notice.bad { background: var(--bad-soft); color: var(--bad); border-radius: 6px; padding: 9px 14px; margin-bottom: 12px; }
.error-message { color: var(--bad); font-weight: 600; font-size: 13px; margin-top: 4px; }

/* ボタン */
.btn { display: inline-block; border: 1px solid var(--line); background: var(--surface); padding: 6px 12px; border-radius: 6px; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--ink); line-height: 1.5; }
.btn:hover { background: var(--ground); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary, input[type=submit] { background: var(--navy); border: 1px solid var(--navy); color: #fff; font-weight: 600; padding: 9px 18px; border-radius: 6px; cursor: pointer; }
.btn-primary:hover, input[type=submit]:hover { background: var(--navy-dark); }
.btn-danger { color: var(--bad); }
.small { padding: 3px 10px; font-size: 13px; }
.inline-form { display: inline; margin: 0; }

/* タグ */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tag { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 12px; font-size: 13px; color: var(--ink); text-decoration: none; }
.tag:hover { background: var(--ground); }
.tag.here { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip { display: inline-block; background: var(--ground); border-radius: 4px; padding: 0 7px; font-size: 12px; color: var(--ink-soft); margin-right: 4px; }

/* 一覧 */
.rows { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.row { display: grid; grid-template-columns: 168px minmax(0, 1fr) auto; gap: 18px; padding: 16px; align-items: center; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.thumb { display: flex; width: 168px; aspect-ratio: 16 / 9; border-radius: 5px; align-items: center; justify-content: center; font-size: 12px; overflow: hidden; background: #101826; text-decoration: none; }
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb.busy { background: var(--busy-soft); color: var(--busy); }
.thumb.bad { background: var(--bad-soft); color: var(--bad); }
.thumb.idle { background: var(--idle); color: var(--ink-soft); }
.body { min-width: 0; }
.titleline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.title { font-size: 16px; font-weight: 600; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
a.title:hover { text-decoration: underline; }
.pill { font-size: 12px; font-weight: 600; padding: 1px 9px; border-radius: 999px; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.busy { background: var(--busy-soft); color: var(--busy); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.idle { background: var(--idle); color: var(--ink-soft); }
.meta { font-size: 13px; color: var(--ink-soft); margin-top: 2px; font-variant-numeric: tabular-nums; }
.urlline { display: flex; align-items: center; gap: 8px; margin-top: 8px; min-width: 0; }
.url { font-size: 13px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.errline { font-size: 13px; color: var(--bad); margin-top: 6px; }
.encoding { height: 6px; background: var(--busy-soft); border-radius: 3px; overflow: hidden; margin-top: 10px; max-width: 320px; position: relative; }
.encoding i { position: absolute; inset: 0 auto 0 0; width: 40%; background: var(--busy); animation: mup-slide 1.6s ease-in-out infinite alternate; }
@keyframes mup-slide { to { left: 60%; } }
@media (prefers-reduced-motion: reduce) { .encoding i { animation: none; } }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: 14px; color: var(--ink-soft); }
.pager a { text-decoration: none; }
.pager a:hover { color: var(--navy-dark); }
.empty { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 40px 16px; text-align: center; color: var(--ink-soft); }

/* フォーム */
.form { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 24px; max-width: 720px; display: grid; gap: 18px; margin-bottom: 16px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-weight: 600; font-size: 14px; }
.req { color: var(--bad); font-weight: 400; font-size: 13px; margin-left: 6px; }
input[type=text], input[type=password], input[type=url], textarea, select { border: 1px solid var(--line); border-radius: 6px; padding: 8px 11px; background: var(--surface); width: 100%; }
select { width: auto; }
textarea { min-height: 90px; font-size: 13px; }
::placeholder { color: #a8b0bd; opacity: 1; }
.hint { font-size: 13px; color: var(--ink-soft); }
form .submit { margin: 0; }
.submit-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* 投稿 */
#dropzone { border: 2px dashed #b7c1d1; border-radius: 8px; padding: 34px 16px; text-align: center; background: #fafbfd; color: var(--ink-soft); cursor: pointer; }
#dropzone strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
#dropzone:hover, #dropzone.over { border-color: var(--navy); background: var(--navy-soft); }
#upload-picked { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
#upload-error { color: var(--bad); font-weight: 600; }
.upload-track { height: 10px; background: var(--navy-soft); border-radius: 5px; overflow: hidden; }
#upload-bar { background: var(--navy); height: 100%; width: 0; }
#upload-status { margin-top: 6px; font-size: 13px; font-variant-numeric: tabular-nums; }

/* 編集 */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 20px; margin-bottom: 16px; max-width: 980px; }
.panel.bad { background: var(--bad-soft); border-color: var(--bad-soft); color: var(--bad); }
.preview { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.preview-player { min-width: 0; max-width: 100%; }
.preview-side { flex: 1 1 260px; min-width: 0; display: grid; gap: 10px; }
.check { display: flex; align-items: center; gap: 6px; }
.linkrow { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.linkrow:first-of-type { border-top: 0; }
.linkrow .label { color: var(--ink-soft); font-size: 13px; }
.linkrow a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coderow { display: grid; gap: 6px; margin-top: 10px; }
.coderow-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
details summary { cursor: pointer; font-size: 14px; color: var(--ink-soft); margin-top: 6px; }

/* アカウント */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 8px 14px; color: var(--ink-soft); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.here { color: var(--navy); border-bottom-color: var(--navy); font-weight: 600; }
.scroll-x { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
table.data th { text-align: left; color: var(--ink-soft); font-weight: 600; font-size: 13px; background: #fafbfd; }
table.data th, table.data td { padding: 10px 12px; border-top: 1px solid var(--line); white-space: nowrap; }
table.data td.name { font-weight: 600; }
table.data td.muted { color: #9aa3b1; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
.danger-zone { border-top: 1px solid var(--line); padding-top: 16px; max-width: 720px; }

@media (max-width: 760px) {
	.shell { grid-template-columns: minmax(0, 1fr); }
	.side { padding: 14px 16px; gap: 10px; }
	.brand, .shop { padding: 0; }
	.nav { flex-direction: row; flex-wrap: wrap; }
	.row { grid-template-columns: minmax(0, 1fr); }
	.thumb { width: 100%; }
	.actions { justify-content: flex-start; }
	.form, .panel { padding: 16px; }
	.linkrow { grid-template-columns: minmax(0, 1fr) auto; }
	.linkrow .label { grid-column: 1 / -1; }
}
