:root {
  --bg: #f5f6f9;
  --panel: #ffffff;
  --panel-2: #f2f4f8;
  --line: #dfe3ec;
  --line-strong: #c7cddb;
  --navy: #2b3348;
  --navy-2: #3c465f;
  --text: #1d2233;
  --sub: #4b5266;
  --muted: #7a8199;
  --accent: #3b62d9;
  --accent-soft: #eaeffc;
  --ok: #12855a;
  --done: #8b93a7;
  --ng: #d33049;
  --warn: #b7791f;
  --radius: 10px;
  font-family: "Yu Gothic UI", "Meiryo", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
}

a { color: var(--accent); }
.hidden { display: none !important; }

/* ---------------- ヘッダー ---------------- */
header.top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 20px;
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 30;
  flex-wrap: wrap;
}
header.top h1 { font-size: 16px; margin: 0; letter-spacing: .04em; font-weight: 700; }
header.top .spacer { flex: 1; }
header.top .who { font-size: 13px; color: #cfd5e4; }
header.top button {
  background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.28); color: #fff;
}
header.top button:hover { background: rgba(255,255,255,.22); }

nav.tabs { display: flex; gap: 2px; background: var(--navy); padding: 0 14px; }
nav.tabs button {
  background: transparent; border: none; border-radius: 0; color: #b9c1d4;
  padding: 9px 18px; font-weight: 700; font-size: 13.5px; letter-spacing: .04em;
  border-bottom: 3px solid transparent;
}
nav.tabs button:hover { background: rgba(255,255,255,.07); color: #fff; }
nav.tabs button.active { color: #fff; border-bottom-color: #7ea2ff; background: rgba(255,255,255,.07); }

main { max-width: 1180px; margin: 0 auto; padding: 18px 16px 80px; }

.notice {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--sub);
  background: #fdf5e4;
  border: 1px solid #f0d9a8;
  border-radius: 8px;
  padding: 5px 12px;
  display: inline-block;
}

/* ---------------- 会議日サイドバー ---------------- */
.board { display: flex; gap: 16px; align-items: flex-start; }
.board-main { flex: 1; min-width: 0; }

.daynav {
  flex: 0 0 194px; width: 194px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px; position: sticky; top: 88px; max-height: calc(100vh - 108px); overflow: auto;
}
.daynav-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 2px 6px 8px;
}
.daynav-head button { padding: 1px 9px; font-size: 14px; line-height: 1.3; }
.day-item {
  display: flex; align-items: center; gap: 6px; width: 100%; text-align: left;
  border: none; background: none; border-radius: 7px; padding: 7px 9px;
  font-size: 13px; color: var(--text); margin-bottom: 1px;
}
.day-item:hover { background: var(--panel-2); border: none; }
.day-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.day-item .n {
  margin-left: auto; font-size: 11px; color: var(--muted); background: var(--panel-2);
  border-radius: 999px; padding: 0 7px; font-weight: 400;
}
.day-item.active .n { background: #fff; color: var(--accent); }
.day-item .mark { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex: 0 0 5px; }
.day-item .mark.empty { background: transparent; }
.daynav .sep { border-top: 1px solid var(--line); margin: 6px 2px; }

.daybar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--navy); color: #fff; border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 14px;
}
.daybar h2 { font-size: 16px; margin: 0; letter-spacing: .03em; }
.daybar .count { font-size: 12px; color: #b9c1d4; }
.daybar .spacer { flex: 1; }
.daybar button { background: rgba(255,255,255,.13); border-color: rgba(255,255,255,.3); color: #fff; }
.daybar button:hover { background: rgba(255,255,255,.24); }
.daybar button.primary { background: #fff; border-color: #fff; color: var(--navy); font-weight: 700; }
.daybar button.primary:hover { background: #e8ecf7; }

.dup-list { border: 1px solid var(--line); border-radius: 8px; max-height: 320px; overflow: auto; }
.dup-row { display: flex; gap: 9px; align-items: flex-start; padding: 8px 11px; border-bottom: 1px solid var(--line); }
.dup-row:last-child { border-bottom: none; }
.dup-row input { width: auto; margin-top: 3px; flex: 0 0 auto; }
.dup-row .t { flex: 1; min-width: 0; }
.dup-row .t .sub { font-size: 11.5px; color: var(--muted); }

/* ---------------- ボタン ---------------- */
button, .btn {
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 7px 13px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: var(--panel-2); border-color: #a9b3c9; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
button.primary:hover { background: #2f52c0; border-color: #2f52c0; }
button.danger { color: var(--ng); border-color: #f0bcc4; }
button.danger:hover { background: #fdeef0; border-color: #e59aa6; }
button.small { padding: 3px 9px; font-size: 12px; }
button.link { border: none; background: none; color: var(--accent); padding: 2px 4px; }
button.link:hover { background: none; text-decoration: underline; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------- フォーム ---------------- */
input, select, textarea {
  font: inherit; color: var(--text); background: #fff;
  border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; min-height: 100px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 700; }
.field { margin-bottom: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }

/* ---------------- ツールバー ---------------- */
.toolbar {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 16px;
}
.toolbar .f { min-width: 130px; }
.toolbar .f label { margin-bottom: 3px; }
.toolbar .grow { flex: 1; }
.toolbar select, .toolbar input { padding: 6px 9px; }

/* ---------------- タグ ---------------- */
.tag {
  display: inline-block; font-size: 11.5px; font-weight: 700; line-height: 1.5;
  padding: 1px 9px; border-radius: 999px; border: 1px solid transparent;
  background: var(--panel-2); color: var(--sub); white-space: nowrap;
}
.tag-pick {
  cursor: pointer; user-select: none; font-size: 12.5px; padding: 4px 12px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--sub);
}
.tag-pick.on { border-color: transparent; color: #fff; }
.tagbox { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ---------------- 報告カード ---------------- */
.daygroup { margin-bottom: 26px; }
.daygroup > h2 {
  font-size: 15px; margin: 0 0 10px; padding: 7px 14px; border-radius: 8px;
  background: var(--navy); color: #fff; letter-spacing: .04em;
  display: flex; align-items: center; gap: 10px;
}
.daygroup > h2 .count { font-size: 12px; font-weight: 400; color: #b9c1d4; }
.subgroup { margin: 0 0 12px; }
.subgroup > h3 {
  font-size: 13px; margin: 0 0 6px; color: var(--sub);
  padding: 3px 10px; border-left: 4px solid var(--navy-2); background: var(--panel-2); border-radius: 0 6px 6px 0;
  display: flex; align-items: center; gap: 8px;
}
.subgroup > h3 .mgr { font-size: 11px; color: var(--muted); font-weight: 400; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 14px; margin-bottom: 8px;
}
.card.done { background: #fafbfc; border-style: dashed; }
.card.done .card-title { color: var(--done); text-decoration: line-through; }
.card-head { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.card-title { font-weight: 700; font-size: 14.5px; flex: 1; min-width: 200px; word-break: break-word; }
.card-body { margin-top: 6px; color: var(--sub); white-space: pre-wrap; word-break: break-word; }
.card-meta { margin-top: 7px; font-size: 11.5px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-date { font-size: 11.5px; color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 44px 10px; }

/* ---------------- 市場調査 ---------------- */
.week {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px;
}
.week.current { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.week h2 { font-size: 14px; margin: 0 0 2px; }
.week .assignee { font-size: 12.5px; color: var(--sub); }
.week .body { margin-top: 8px; white-space: pre-wrap; color: var(--sub); word-break: break-word; }
.badge-week { font-size: 11px; background: var(--accent); color: #fff; padding: 1px 8px; border-radius: 999px; margin-left: 8px; }

/* ---------------- 設定 ---------------- */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 16px;
}
.panel h2 { font-size: 15px; margin: 0 0 4px; }
.panel .hint { font-size: 12px; color: var(--muted); margin: 0 0 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11.5px; color: var(--muted); font-weight: 700; }
td.actions { text-align: right; white-space: nowrap; }
tr.off td { color: var(--muted); background: #fafbfc; }

/* ---------------- モーダル ---------------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(20,25,40,.5);
  display: flex; align-items: flex-start; justify-content: center; padding: 30px 14px;
  overflow: auto; z-index: 60;
}
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 560px;
  padding: 20px 22px; box-shadow: 0 12px 40px rgba(20,25,40,.28);
}
.modal h2 { margin: 0 0 14px; font-size: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.modal-actions .left { margin-right: auto; }

.msg { padding: 9px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.msg.error { background: #fdeef0; border: 1px solid #f0bcc4; color: #a01f33; }
.msg.ok { background: #e8f6ef; border: 1px solid #a8dcc4; color: #0d6b49; }

/* ---------------- ログイン ---------------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--navy); }
.login-box { background: #fff; border-radius: 12px; padding: 28px 26px; width: 100%; max-width: 380px; box-shadow: 0 14px 44px rgba(0,0,0,.3); }
.login-box h1 { font-size: 18px; margin: 0 0 4px; }
.login-box .sub { font-size: 12.5px; color: var(--muted); margin-bottom: 18px; }

/* ---------------- スマホ ---------------- */
@media (max-width: 700px) {
  header.top { padding: 10px 12px; gap: 8px; }
  header.top h1 { font-size: 14px; }
  nav.tabs { padding: 0 4px; }
  nav.tabs button { flex: 1; padding: 9px 6px; font-size: 12.5px; }
  main { padding: 14px 10px 70px; }

  /* 会議日サイドバーは横並びのタブ帯にする */
  .board { display: block; }
  .daynav {
    width: auto; position: static; max-height: none; margin-bottom: 12px;
    padding: 8px 10px; overflow: visible;
  }
  .daynav-head { padding-bottom: 6px; }
  #day-list { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
  .day-item { width: auto; flex: 0 0 auto; border: 1px solid var(--line); white-space: nowrap; margin-bottom: 0; }
  .day-item.active { border-color: var(--accent); }
  .daynav .sep { display: none; }
  .daybar { padding: 10px; }
  .daybar h2 { font-size: 14px; }

  .toolbar { padding: 10px; }
  .toolbar .f { min-width: calc(50% - 5px); }
  .row > * { min-width: 100%; }
  table { font-size: 12px; }
  th, td { padding: 6px 4px; }
}
