/* Dashboard の見た目。
   色は中立（無彩色＋紺 1 色）。事業のブランド色ではない（ブランドは実資料から決める）。 */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #5b6470;
  --line: #d8dee4;
  --accent: #2f5d8a;
  --accent-text: #ffffff;
  --ok: #1a7f37;
  --warn: #9a6700;
  --err: #b42318;
  --chip: #eef1f4;
  --radius: 10px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #1a1f25;
    --text: #e6e9ed;
    --muted: #9aa4af;
    --line: #2d343c;
    --accent: #7fb0de;
    --accent-text: #0d1117;
    --ok: #57c26d;
    --warn: #e0b040;
    --err: #ff7b72;
    --chip: #252b33;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
}
.loading { padding: 40px 20px; color: var(--muted); text-align: center; }

/* 上の帯 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: env(safe-area-inset-top) 16px 0;
}
.topbar-row { display: flex; align-items: center; gap: 10px; min-height: 52px; max-width: 1080px; margin: 0 auto; }
.brand { font-weight: 700; font-size: 17px; margin-right: auto; white-space: nowrap; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; line-height: 1.5; background: var(--chip); color: var(--muted); white-space: nowrap;
}
.badge.mock { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
nav.tabs { display: flex; gap: 4px; max-width: 1080px; margin: 0 auto; overflow-x: auto; }
nav.tabs a {
  padding: 10px 14px; color: var(--muted); text-decoration: none; font-size: 15px;
  border-bottom: 3px solid transparent; white-space: nowrap;
}
nav.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
/* 狭い画面（iPhone など）で、タブが 5 つ並んでも横にはみ出さないようにする */
@media (max-width: 430px) {
  nav.tabs { gap: 0; }
  nav.tabs a { padding: 10px 8px; font-size: 14px; }
}
.count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--err); color: #fff; font-size: 12px; text-align: center; }

main { max-width: 1080px; margin: 0 auto; padding: 20px 16px calc(40px + env(safe-area-inset-bottom)); }
h1 { font-size: 22px; margin: 4px 0 16px; line-height: 1.4; }
h2 { font-size: 17px; margin: 28px 0 10px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.grid { display: grid; gap: 12px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.stat .num { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat .label { color: var(--muted); font-size: 13px; }

/* 一覧の行 */
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.row { display: flex; align-items: center; gap: 10px; padding: 12px 2px; color: inherit; text-decoration: none; }
.row .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.unread .title { font-weight: 700; }
.row time { color: var(--muted); font-size: 12px; white-space: nowrap; }

.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; background: var(--chip); color: var(--muted); white-space: nowrap; }
.chip.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.chip.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.chip.err { background: color-mix(in srgb, var(--err) 14%, transparent); color: var(--err); }
.chip.run { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }

/* 入力 */
label { display: block; font-size: 14px; font-weight: 600; margin: 14px 0 4px; }
label .hint { font-weight: 400; color: var(--muted); }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
textarea { resize: vertical; min-height: 44px; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.check input { width: 18px; height: 18px; }
button {
  font: inherit; font-weight: 600; min-height: 44px; padding: 8px 18px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.danger { color: var(--err); }
button:disabled { opacity: 0.5; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.notice { padding: 10px 12px; border-radius: 8px; background: var(--chip); font-size: 14px; margin: 10px 0; }
.notice.err { background: color-mix(in srgb, var(--err) 12%, transparent); color: var(--err); }
.notice.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.notice.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--warn); }

/* スライド */
.slides { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.slide { padding: 12px; }
.slide img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.slide .no { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.slide label { font-size: 12px; font-weight: 400; color: var(--muted); margin: 8px 0 2px; }
.slide textarea { font-size: 14px; padding: 6px 8px; }
.slide textarea.changed { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
/* 文章 */
.switch { margin-top: 0; }
fieldset { border: 0; margin: 14px 0 0; padding: 0; }
legend { font-size: 14px; font-weight: 600; padding: 0; margin-bottom: 4px; }
legend .hint { font-weight: 400; color: var(--muted); }
fieldset .check { margin: 8px 0 0; }
.content h3 { font-size: 16px; margin: 0 0 4px; line-height: 1.8; }
.content textarea.changed { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.fieldtools { display: flex; justify-content: flex-end; margin-top: 4px; }
button.mini { min-height: 32px; padding: 2px 10px; font-size: 13px; font-weight: 400; color: var(--muted); }
.msgline { min-height: 1.5em; margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.diff span, .diff del, .diff ins { white-space: pre-wrap; }
/* 顧客 */
.row.wrap { flex-wrap: wrap; }
.row.wrap .title { white-space: normal; min-width: 120px; }
.searchbar { display: flex; gap: 8px; margin-bottom: 12px; }
.searchbar input { flex: 1; }
.reason { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.reason input { width: min(100%, 280px); }
.reason .msg { font-size: 13px; color: var(--err); }
details { margin-top: 8px; }
summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.savebar {
  position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 16px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
}
.savebar .msg { flex: 1; min-width: 160px; font-size: 14px; color: var(--muted); }
.diff { font-size: 14px; padding: 8px 0; border-top: 1px solid var(--line); }
.diff del { color: var(--err); text-decoration: line-through; }
.diff ins { color: var(--ok); text-decoration: none; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
code.secret { display: block; padding: 10px; background: var(--chip); border-radius: 8px; overflow-wrap: anywhere; font-size: 13px; user-select: all; }

.login { max-width: 420px; margin: 12vh auto 0; }

@media (max-width: 560px) {
  h1 { font-size: 20px; }
  .row { flex-wrap: wrap; }
  .row .title { flex-basis: 100%; white-space: normal; }
}
