/* Compass for パートナー 共通の見た目（style 属性は使わない：CSP） */
:root {
  --bg: #f4f6f9; --panel: #ffffff; --line: #dde3ea; --text: #1d2733; --muted: #66707c;
  --brand: #1f4e79; --brand-2: #2f6fa8; --accent: #e8f1fa;
  --ok: #1d7a46; --ok-bg: #e6f4ec; --err: #b42318; --err-bg: #fdecea; --info: #1f4e79; --info-bg: #e8f1fa;
  --warn: #9a5b00; --warn-bg: #fff4e0;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", "Hiragino Sans", Meiryo, sans-serif; color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.6; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.35; margin: 0 0 .6em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; margin-top: 1.2em; }
h1 .mi, h2 .mi { vertical-align: -4px; color: var(--brand); }
code { background: #f3f5f8; border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; font-size: 13px; word-break: break-all; }
code.key { font-size: 16px; letter-spacing: .08em; background: var(--accent); padding: 6px 10px; border-radius: 6px; }

.mi { font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal; line-height: 1; display: inline-block;
      white-space: nowrap; direction: ltr; -webkit-font-smoothing: antialiased; font-variation-settings: "FILL" 0, "wght" 400; vertical-align: -3px; margin-right: 4px; }
.mi.s16 { font-size: 16px; } .mi.s18 { font-size: 18px; } .mi.s20 { font-size: 20px; } .mi.s24 { font-size: 24px; }
.mi.s32 { font-size: 32px; } .mi.s48 { font-size: 48px; }

/* 上部バー */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; padding: 10px 20px;
       background: var(--brand); color: #fff; flex-wrap: wrap; }
.top a, .top .brand { color: #fff; }
.brand { font-weight: 700; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.switcher { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.switcher select { max-width: 360px; padding: 6px 8px; border-radius: 6px; border: 0; font: inherit; }
.switch-form { display: flex; align-items: center; gap: 6px; }
.partner-name { font-weight: 500; }
.me { display: flex; align-items: center; gap: 10px; }
.me-link { display: flex; align-items: center; }
.top .btn.ghost { color: #fff; border-color: rgba(255,255,255,.5); }

/* 本体 */
.wrap { display: flex; min-height: calc(100vh - 56px); }
.side { width: 230px; flex: none; background: var(--panel); border-right: 1px solid var(--line); padding: 14px 10px; }
.nav { display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-radius: 8px; color: var(--text); margin-bottom: 2px; }
.nav:hover { background: var(--accent); text-decoration: none; }
.nav.on { background: var(--accent); color: var(--brand); font-weight: 700; }
.nav.disabled { color: #a0a8b2; cursor: default; }
.nav-head { margin: 16px 10px 6px; font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: .05em; }
.main { flex: 1; min-width: 0; padding: 24px; max-width: 1280px; }
.page-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.page-title .sub { font-size: 14px; color: var(--muted); font-weight: 400; margin-left: 8px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.card.narrow { max-width: 440px; margin: 0 auto; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.form-row { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: end; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field > span, .field > legend { font-size: 13px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=url], input[type=date], select {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); min-width: 0; }
input:focus, select:focus, .btn:focus { outline: 2px solid var(--brand-2); outline-offset: 1px; }
fieldset.also { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 12px; grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; }
.field.check { flex-direction: row; align-items: center; padding-bottom: 10px; }

.btn { display: inline-flex; align-items: center; gap: 2px; font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
       background: #fff; color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--accent); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--err); border-color: #f1c4bf; }
.btn.danger:hover { background: var(--err-bg); }
.btn.ghost { background: transparent; }
.btn.on { background: var(--accent); color: var(--brand); border-color: var(--brand-2); font-weight: 700; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.wide { width: 100%; justify-content: center; margin-top: 4px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.done { border-color: var(--ok); color: var(--ok); }
form.inline { display: inline-flex; align-items: center; gap: 6px; margin: 2px 4px 2px 0; flex-wrap: wrap; }
form.rename input[type=text] { width: 220px; }
form.search { margin-bottom: 10px; }

.pill { display: inline-block; padding: 1px 10px; border-radius: 999px; background: var(--accent); color: var(--brand); font-size: 12px; font-weight: 700; }
.top .pill { background: rgba(255,255,255,.18); color: #fff; }
.pill.small { font-size: 11px; padding: 0 8px; }
.pill.warn { background: var(--warn-bg); color: var(--warn); }

.flash { display: flex; gap: 6px; align-items: flex-start; padding: 10px 14px; border-radius: 8px; margin: 0 0 14px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--err-bg); color: var(--err); }
.flash.info { background: var(--info-bg); color: var(--info); }

table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { font-size: 12px; color: var(--muted); font-weight: 700; background: #fafbfc; white-space: nowrap; }
table.list.small td { font-size: 13px; }
table.list tr.warn td { background: var(--warn-bg); }
.right { text-align: right; } .center { text-align: center; } .nowrap { white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: 13px; }
dl.kv { display: grid; grid-template-columns: 9em 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; }
ul.plain { list-style: none; padding: 0; margin: 0; } ul.plain li { padding: 4px 0; }
ol.steps { padding-left: 1.3em; }
.pager { display: flex; gap: 8px; margin-top: 10px; }

.linkbox { background: var(--warn-bg); border: 1px solid #f3d9a4; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; }
.linkbox-head { font-weight: 700; color: var(--warn); margin-bottom: 6px; }
.linkbox-row { display: flex; gap: 8px; } .linkbox-row input { flex: 1; }


/* 一覧・詳細 */
.tabs { display: flex; gap: 6px; margin: 0 0 12px; flex-wrap: wrap; }
.tab { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--text); }
.tab.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.tab:hover { text-decoration: none; }
.bulk { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-bottom: 12px; }
.bulk .field { margin-bottom: 0; }
.reason { display: flex; gap: 4px; align-items: flex-start; color: var(--warn); font-size: 13px; margin-top: 4px; }
.reason.k-wait { color: var(--info); }
.reason.k-check { color: var(--warn); }
.reason.k-empty { color: var(--warn); }
.reason.k-missing { color: #5b6573; }
.reason.k-info, .reason.k-note { color: var(--muted); }
h2 .sub { margin-left: 10px; font-size: 13px; font-weight: 400; color: var(--muted); }
textarea.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; width: 100%; }
ul.cols { columns: 2; column-gap: 24px; } ul.cols li { break-inside: avoid; }
label.check { display: inline-flex; gap: 6px; align-items: center; margin-right: 12px; }
details.plans { margin: 6px 0; } details.plans summary { cursor: pointer; color: var(--info); font-size: 13px; }
ul.reasons { list-style: none; padding: 0; margin: 0 0 12px; }
ul.reasons li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 4px 0; }
ul.reasons li .reason { margin-top: 0; }
ul.reasons li b { white-space: nowrap; font-weight: 600; }
.err { color: var(--err); }
.strong { font-weight: 700; }
table.list th.num, table.list td.num { text-align: right; white-space: nowrap; }
.diff { display: block; font-size: 12px; color: var(--muted); }
.diff .mi { margin-right: 0; }
table.sites tr.sub th { font-weight: 400; background: #fff; padding-top: 0; }
table.list tr.muted td { color: var(--muted); }
.wide-table { overflow-x: auto; }
.stats { display: flex; flex-wrap: wrap; gap: 12px 28px; margin: 6px 0 14px; }
.stats .lab { display: block; font-size: 12px; color: var(--muted); }
.stats b { font-size: 22px; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .axis { fill: var(--muted); font-size: 11px; }
svg.chart .ln { fill: none; stroke-width: 2; }
svg.chart .ln0 { stroke: var(--brand); } svg.chart .ln1 { stroke: #7aa7d6; } svg.chart .ln2 { stroke: #9a5b00; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.lg::before { content: ""; display: inline-block; width: 14px; height: 3px; margin-right: 4px; vertical-align: middle; }
.lg0::before { background: var(--brand); } .lg1::before { background: #7aa7d6; } .lg2::before { background: #9a5b00; }
pre.cmd { background: #f3f5f8; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; white-space: pre-wrap; word-break: break-all; }

/* ログイン前の画面 */
body.guest { background: linear-gradient(180deg, #e8f1fa 0%, #f4f6f9 60%); }
.guest-main { padding: 48px 16px; }
.guest-brand { display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 20px; font-weight: 700; color: var(--brand); margin-bottom: 20px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* 表記の割り当て（各行の欄に代理店アカウント名を直接書く） */
form.toolbar { display: flex; width: 100%; margin: 0 0 12px; }
.grow { flex: 1; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
table.aliases td.acc { min-width: 240px; }
table.aliases td.acc input[type="text"] { width: 100%; padding: 5px 8px; }
table.list tr.changed td { background: var(--accent); }
table.list tr.changed td.acc input[type="text"] { border-color: var(--brand-2); font-weight: 700; }
button.linkish { font: inherit; background: none; border: 0; padding: 0; color: var(--brand-2); cursor: pointer; text-align: left; }
button.linkish:hover { text-decoration: underline; }
.editbar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap;
           margin: 12px -20px -20px; padding: 10px 20px; background: var(--panel); border-top: 1px solid var(--line);
           border-radius: 0 0 var(--radius) var(--radius); box-shadow: 0 -4px 12px rgba(0, 0, 0, .06); }
.editbar b { font-size: 18px; }
.only-sm { display: none; }

/* サイト詳細の内訳（月ごと） */
h2.section-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 22px 0 10px; }
h2.section-title .sub { font-size: 13px; color: var(--muted); font-weight: 400; }
h2.section-title .btn { margin-left: auto; }
.grid.two > .span2 { grid-column: 1 / -1; }
.grid.bd { grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); }
.grid.bd.ga4 { grid-template-columns: repeat(auto-fit, minmax(640px, 1fr)); }   /* 7 列の表が横に切れない幅 */
.grid.bd > .card { margin-bottom: 0; min-width: 0; }
.grid.bd td.label { white-space: nowrap; }
.grid.bd td.path { word-break: break-all; min-width: 12em; }
.grid.bd th { white-space: nowrap; }
.grid.bd h3 { margin-top: 0; }
details.more { margin-top: 8px; }
details.more summary { cursor: pointer; color: var(--brand-2); font-size: 13px; }
p.actions { margin: 8px 0 0; }

@media (max-width: 760px) {
  .top { padding: 8px 12px; gap: 8px; }
  .brand span { font-size: 14px; }
  .me { margin-left: auto; }
  .switcher { flex: 1 1 100%; order: 3; }
  .switch-form { flex: 1; min-width: 0; }
  .switcher select { max-width: none; width: 100%; min-width: 0; }
  table.list td, table.list th { white-space: nowrap; }
  code.key { display: inline-block; max-width: 100%; word-break: break-all; }
  .wrap { flex-direction: column; }
  .side { width: auto; border-right: 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px; }
  .nav-head { width: 100%; margin: 6px 4px 0; }
  .main { padding: 16px; }
  table.list { display: block; overflow-x: auto; }
  dl.kv { grid-template-columns: 1fr; gap: 2px; }
  ul.cols { columns: 1; }
  dl.kv dd { margin-bottom: 8px; }
  /* 表記の割り当て: 横に流さず 1 行を 1 枚に（入力中も表記が見えるように） */
  table.list.aliases { display: block; overflow: visible; }
  table.aliases thead { display: none; }
  table.aliases tbody { display: block; }
  table.aliases tr { display: grid; grid-template-columns: 30px 1fr; column-gap: 6px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
  table.list.aliases td { display: block; border: 0; padding: 2px 0; white-space: normal; background: transparent; }
  table.aliases td.chk { grid-row: 1 / span 3; padding-top: 4px; }
  table.aliases td.n { display: none; }
  table.aliases td.cand::before { content: "候補 "; color: var(--muted); }
  table.aliases td.acc { min-width: 0; }
  table.list.aliases tr.changed { background: var(--accent); }
  .only-sm { display: block; }
  .grid.bd { grid-template-columns: minmax(0, 1fr); }
}
