/* Compass 共通スタイル。色はモック（docs/mockups/）から採寸した値。 */
:root {
  --navy: #44546A;        /* DOJIN カラー・基調 */
  --navy-dark: #333F50;
  --navy-soft: #AAB7C9;
  --border: #D6DCE4;
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --text: #1A1A1A;
  --text-muted: #7A7A7A;
  --warn-bg: #FDF3E3;
  --warn-line: #F0DBA0;
  --warn-text: #B7791F;
  --error-bg: #FDECEA;
  --error-text: #C0392B;
  --ok-bg: #E6F5EE;
  --ok-text: #1F7A4D;
  --radius: 6px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
}

/* ---- ヘッダー ---- */
.header {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
}
.header-brand { display: flex; align-items: center; gap: 10px; }
.header-title { font-size: 17px; font-weight: 700; letter-spacing: .02em; }
.header-sub { font-size: 12px; color: var(--navy-soft); }
.header-user { display: flex; align-items: center; gap: 14px; font-size: 13px; }

.btn-logout {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .55);
  color: #fff;
  border-radius: var(--radius);
  padding: 5px 12px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.btn-logout:hover { background: rgba(255, 255, 255, .12); }

/* ---- ボタン ---- */
.btn {
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
}
.btn:hover { background: var(--navy-dark); }
.btn:disabled { background: var(--navy-soft); cursor: not-allowed; }

/* ---- メッセージ ---- */
.msg { border-radius: var(--radius); padding: 10px 14px; font-size: 13px; margin-top: 14px; }
.msg-error { background: var(--error-bg); color: var(--error-text); }
.msg-warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-text); }
.msg-ok { background: var(--ok-bg); color: var(--ok-text); }

/* ---- ログイン ---- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%;
  max-width: 400px;
  padding: 40px 36px;
  text-align: center;
}
.login-logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 30px; }
.login-name { font-size: 26px; font-weight: 700; color: var(--navy); letter-spacing: .04em; }
.login-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.login-form label { font-size: 12px; color: var(--text-muted); }
.login-form input {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}
.login-form input:focus { outline: 2px solid var(--navy-soft); border-color: var(--navy); }
.login-note {
  margin-top: 24px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

/* ---- アプリ共通レイアウト（モック採寸） ---- */
.layout { display: flex; min-height: calc(100vh - 60px); }
.sidebar { width: 260px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--border); }
.navi {
  display: block; padding: 13px 16px; font-size: 13.5px; font-weight: 600;
  color: var(--text); border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent; text-decoration: none; cursor: pointer;
}
.navi.on { color: var(--navy-dark); background: var(--bg); border-left-color: var(--navy); }
.navi.disabled { color: #B9BEC4; cursor: default; }
.due-card {
  margin: 16px; background: #FFF8E6; border: 1px solid var(--warn-line);
  border-radius: 8px; padding: 12px; font-size: 12px; line-height: 1.7;
}
.main { flex: 1; padding: 24px 28px; }
.container { max-width: 940px; margin: 0 auto; }

.page-title { font-size: 18px; font-weight: 700; color: var(--navy-dark); }
.badge { border-radius: 999px; padding: 3px 12px; font-size: 11.5px; font-weight: 700; }
.badge-todo { background: var(--error-bg); color: var(--error-text); }
.badge-done { background: var(--ok-bg); color: var(--ok-text); }

.sec { font-size: 13px; font-weight: 700; color: var(--navy-dark); margin: 22px 0 8px;
       display: flex; align-items: center; gap: 8px; }
.sec .hint { font-weight: 400; color: var(--text-muted); font-size: 11.5px; }
.card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 16px; }

.chip {
  display: inline-block; background: var(--bg); border: 1px solid var(--navy-soft);
  color: var(--navy-dark); border-radius: 999px; padding: 3px 10px;
  font-size: 11px; font-weight: 600;
}
.chip-unplanned { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-text); }
.lock {
  background: #F1F3F4; border: 1px solid #E0E4E7; border-radius: 8px;
  padding: 10px 12px; font-size: 13px; color: #555; line-height: 1.6;
}
.lock.empty { color: #9AA0A5; }
.inp, .ta, select.sel {
  background: #fff; border: 1px solid var(--navy-soft); border-radius: 8px;
  padding: 10px 12px; font-size: 13px; line-height: 1.6;
  font-family: inherit; color: var(--text); width: 100%;
}
.ta { line-height: 1.7; min-height: 84px; resize: vertical; }
.inp:focus, .ta:focus, select.sel:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 2px rgba(68,84,106,.15); }
.inp.flagged { border-color: #E5B96B; background: #FFFDF7; }

table.results { width: 100%; border-collapse: collapse; }
table.results th { text-align: left; font-size: 11.5px; color: var(--text-muted);
                   font-weight: 600; padding: 0 0 6px 2px; }
table.results td { padding: 6px 8px 6px 0; vertical-align: top; }

.ach { display: flex; gap: 4px; justify-content: center; }
.ach button {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border);
  background: #fff; color: var(--text-muted); font-weight: 700; font-size: 14px;
  cursor: pointer; font-family: inherit; padding: 0;
}
.ach button.on[data-v="○"] { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-text); }
.ach button.on[data-v="△"] { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-text); }
.ach button.on[data-v="×"] { background: var(--error-bg); color: var(--error-text); border-color: var(--error-text); }

.goal-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 8px; }
.goal-row select.sel { width: 230px; flex-shrink: 0; }
.link-add { font-size: 12px; color: var(--navy-dark); font-weight: 600;
            background: none; border: none; cursor: pointer; font-family: inherit; padding: 4px 0; }
.link-del { background: none; border: none; color: var(--text-muted); cursor: pointer;
            font-size: 16px; line-height: 1; padding: 8px 4px; font-family: inherit; }
.link-del:hover { color: var(--error-text); }

/* 提出基準（AI差し戻し） */
.standards {
  display: flex; gap: 10px; margin-top: 12px; background: var(--bg);
  border: 1px solid var(--navy-soft); border-radius: 8px; padding: 12px;
  align-items: flex-start;
}
.standards .body { font-size: 12.5px; line-height: 1.75; color: var(--navy-dark); }
.standards .quote { color: var(--text-muted); }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; align-items: center; }
.btn-ghost {
  background: #fff; color: var(--navy-dark); border: 1px solid var(--navy);
  border-radius: 8px; padding: 11px 22px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.btn-ghost:hover { background: var(--bg); }
.save-state { font-size: 12px; color: var(--text-muted); margin-right: auto; }
.readonly-note { background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
                 padding: 14px; font-size: 13px; color: var(--text-muted); }

/* 今期の計画の参照（報告を書くときの手元資料） */
.plan-ref {
  margin-top: 14px; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 16px;
}
.plan-ref > summary {
  cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--navy-dark);
  list-style: none;
}
.plan-ref > summary::before { content: "▸ "; }
.plan-ref[open] > summary::before { content: "▾ "; }
.plan-ref > summary::-webkit-details-marker { display: none; }
.plan-ref-item { display: flex; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.plan-ref-item:first-of-type { margin-top: 8px; }
.plan-ref-cat {
  width: 68px; flex-shrink: 0; font-size: 11px; font-weight: 700;
  color: var(--navy-dark); padding-top: 2px;
}
.plan-ref-body { font-size: 12.5px; line-height: 1.75; white-space: pre-wrap; color: #444; }
.plan-ref-body.empty { color: #9AA0A5; }

.overwrite-note { font-size: 11.5px; color: var(--text-muted); }
.submitted-at { font-size: 12px; color: var(--text-muted); }

/* ---- 週次レビュー（画面5・モック採寸） ---- */
.admin-header { background: var(--navy); }
.review-layout { display: flex; gap: 0; min-height: calc(100vh - 60px); }
.review-list { width: 640px; flex-shrink: 0; border-right: 1px solid var(--border);
               background: #fff; overflow: auto; }
.review-detail { flex: 1; padding: 22px 26px; overflow: auto; }
.weekbar { display: flex; align-items: center; gap: 10px; padding: 14px 18px;
           border-bottom: 1px solid var(--border); }
.weekbar button { background: #fff; border: 1px solid var(--border); border-radius: 6px;
                  width: 28px; height: 28px; cursor: pointer; font-family: inherit;
                  color: var(--navy-dark); }
.weekbar button:disabled { color: #CBD1D8; cursor: not-allowed; }
.weekbar .label { font-size: 13px; font-weight: 700; color: var(--navy-dark); }
.counts { display: flex; gap: 8px; margin-left: auto; }
.count { font-size: 11px; border-radius: 999px; padding: 3px 10px; background: var(--bg);
         color: var(--navy-dark); }
.count.warn { background: var(--warn-bg); color: var(--warn-text); }
.count.err { background: var(--error-bg); color: var(--error-text); }

table.roster { width: 100%; border-collapse: collapse; }
table.roster th { background: var(--bg); color: var(--navy-dark); font-weight: 700;
                  font-size: 11.5px; text-align: left; padding: 8px 9px;
                  border-bottom: 1px solid var(--border); white-space: nowrap; }
table.roster td { font-size: 12px; padding: 7px 9px; border-bottom: 1px solid var(--border);
                  white-space: nowrap; }
table.roster tr.row { cursor: pointer; }
table.roster tr.row:hover td { background: #FAFBFC; }
table.roster tr.row.on td { background: #EEF2F7; }
table.roster tr.na { color: var(--text-muted); cursor: default; }
.pill { border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 600; }
.pill.ok { background: var(--ok-bg); color: var(--ok-text); }
.pill.ng { background: var(--error-bg); color: var(--error-text); }
.pill.todo { background: var(--warn-bg); color: var(--warn-text); }
.pill.mute { background: #F1F3F4; color: var(--text-muted); }

.rsec { font-size: 11.5px; font-weight: 700; color: var(--navy-dark); margin: 12px 0 3px; }
.rtxt { font-size: 12.5px; line-height: 1.75; white-space: pre-wrap; }
.rrow { font-size: 12.5px; line-height: 1.8; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.draft-box { background: #FFF8E6; border: 1px solid var(--warn-line); border-radius: 8px;
             padding: 12px 14px; font-size: 12.5px; line-height: 1.8; }
.draft-box b { color: var(--navy-dark); }
.choice { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.choice button { border-radius: 8px; padding: 9px 18px; font-size: 13px; font-weight: 600;
                 cursor: pointer; font-family: inherit; }
.choice .primary { background: var(--navy); color: #fff; border: none; font-weight: 700; }
.choice .primary:hover { background: var(--navy-dark); }
.choice .ghost { background: #fff; color: var(--navy-dark); border: 1px solid var(--navy); }
.choice .ghost:hover { background: var(--bg); }
.choice button:disabled { opacity: .5; cursor: not-allowed; }
.learn-note { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.empty-detail { color: var(--text-muted); font-size: 13px; padding: 40px 0; text-align: center; }

/* ---- 管理画面の横メニュー（モック採寸） ---- */
.admin-nav { background: #fff; border-bottom: 1px solid var(--border); display: flex;
             gap: 4px; padding: 0 18px; }
.atab { display: inline-flex; align-items: center; padding: 11px 16px; font-size: 13px;
        font-weight: 600; color: var(--text); border-bottom: 3px solid transparent;
        text-decoration: none; }
.atab.on { color: var(--navy-dark); border-bottom-color: var(--navy); }
.atab.off { color: #B9BEC4; cursor: default; }

/* ================= モバイル対応 ================= */

/* タブレット以下：レビュー画面を縦積みにする */
@media (max-width: 980px) {
  .review-layout { flex-direction: column; }
  .review-list { width: 100%; border-right: none;
                 border-bottom: 1px solid var(--border); max-height: 46vh; }
  .review-detail { padding: 18px 16px; }
}

/* スマートフォン */
@media (max-width: 700px) {
  body { font-size: 15px; }

  .header { padding: 10px 14px; gap: 8px; }
  .header-title { font-size: 15px; }
  .header-sub { display: none; }
  .header-user { font-size: 12px; gap: 8px; }

  .admin-nav { overflow-x: auto; padding: 0 8px; -webkit-overflow-scrolling: touch; }
  .atab { padding: 10px 12px; font-size: 12.5px; white-space: nowrap; }

  /* メンバー画面：サイドバーを上部に畳む */
  .layout { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border);
             display: flex; flex-wrap: wrap; align-items: center; }
  .sidebar > div[style] { display: none; }
  .navi { flex: 1; min-width: 44%; border-bottom: none; border-left: none;
          border-top: 2px solid transparent; text-align: center; padding: 11px 8px; }
  .navi.on { border-left-color: transparent; border-top-color: var(--navy); }
  .due-card { margin: 8px; width: 100%; }
  .main { padding: 16px 14px; }

  /* 今週の結果：表を1件ずつのカードに */
  table.results thead { display: none; }
  table.results, table.results tbody, table.results tr, table.results td { display: block; width: 100%; }
  table.results tr { border: 1px solid var(--border); border-radius: 10px;
                     padding: 10px 12px; margin-bottom: 12px; position: relative; }
  table.results td { padding: 6px 0; }
  table.results td::before {
    content: attr(data-label); display: block; font-size: 11px;
    color: var(--text-muted); font-weight: 600; margin-bottom: 3px;
  }
  table.results td.cell-del { position: absolute; top: 4px; right: 6px; width: auto; padding: 0; }
  table.results td.cell-del::before { content: none; }
  .ach { justify-content: flex-start; }
  .ach button { width: 38px; height: 38px; font-size: 16px; }

  /* 来週のゴール：セレクトと入力を縦に */
  .goal-row { flex-wrap: wrap; }
  .goal-row select.sel { width: 100%; }
  .goal-row .inp { width: 100%; }

  /* 操作ボタン */
  .actions { flex-wrap: wrap; gap: 8px; }
  .overwrite-note { order: 3; width: 100%; margin-right: 0; }
  .save-state { width: 100%; margin-right: 0; }
  .btn, .btn-ghost { flex: 1; padding: 13px 12px; }

  /* レビュー一覧：狭い画面では会社とグレードを省く */
  .col-company, .col-grade { display: none; }
  table.roster td, table.roster th { padding: 9px 8px; font-size: 12.5px; }
  .weekbar { flex-wrap: wrap; padding: 12px 14px; }
  .counts { width: 100%; margin-left: 0; margin-top: 6px; }
  .review-list { max-height: 40vh; }

  /* レビュー詳細 */
  .page-title { font-size: 16px; }
  .choice { flex-direction: column; }
  .choice button { width: 100%; padding: 13px; }
  .plan-ref-item { flex-direction: column; gap: 2px; }
  .plan-ref-cat { width: auto; }

  .login-card { padding: 30px 22px; }
}

/* 入力欄の自動ズームを防ぐ（iOS は 16px 未満で拡大する） */
@media (max-width: 700px) {
  .inp, .ta, select.sel, .login-form input { font-size: 16px; }
}

/* ---- フィードバック画面（画面2・モック採寸） ---- */
.stepper { display: flex; align-items: center; gap: 10px; font-size: 12.5px;
           font-weight: 600; color: var(--navy-dark); flex-wrap: wrap; }
.stepper .dot {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: var(--border); display: flex; align-items: center; justify-content: center;
}
.stepper .dot.done { background: var(--navy); }
.stepper .bar { flex: 1; min-width: 24px; height: 2px; background: var(--border); }
.stepper .bar.done { background: var(--navy); }
.stepper .step-text { line-height: 1.5; }
.stepper .step-at { font-weight: 400; color: var(--text-muted); font-size: 11.5px; }

.fb-card {
  background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--navy);
  border-radius: 10px; padding: 18px 20px;
}
.fb-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.fb-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.fb-title { font-weight: 700; font-size: 14px; color: var(--navy); }
.fb-meta { font-size: 11.5px; color: var(--text-muted); }
.fb-body { font-size: 13.5px; line-height: 1.9; white-space: pre-wrap; }

@media (max-width: 700px) {
  .stepper { gap: 8px; }
  .stepper .bar { display: none; }
  .stepper .step-text { min-width: calc(100% - 34px); }
  .fb-body { font-size: 14px; }
}

/* ---- 方針インプット（画面6） ---- */
.policy-layout { display: flex; min-height: calc(100vh - 104px); }
.policy-list { width: 380px; flex-shrink: 0; background: #fff;
               border-right: 1px solid var(--border); overflow: auto; }
.policy-detail { flex: 1; padding: 22px 26px; overflow: auto; }
.topic { padding: 13px 18px; border-bottom: 1px solid var(--border); cursor: pointer;
         border-left: 3px solid transparent; }
.topic:hover { background: #FAFBFC; }
.topic.on { background: var(--bg); border-left-color: var(--navy); }
.topic-name { font-size: 13.5px; font-weight: 700; color: var(--navy-dark); }
.topic-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip-toggle {
  border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: #fff; color: var(--text-muted);
  cursor: pointer; font-family: inherit;
}
.chip-toggle.on { background: var(--bg); border-color: var(--navy-soft); color: var(--navy-dark); }
.chip-toggle:hover { border-color: var(--navy); }

.policy-card { background: #fff; border: 1px solid var(--border); border-radius: 8px;
               padding: 12px 14px; margin-bottom: 10px; }
.policy-meta { display: flex; align-items: center; font-size: 11.5px;
               color: var(--text-muted); margin-bottom: 6px; }
.policy-body { font-size: 13px; line-height: 1.8; white-space: pre-wrap; }

@media (max-width: 980px) {
  .policy-layout { flex-direction: column; }
  .policy-list { width: 100%; border-right: none;
                 border-bottom: 1px solid var(--border); max-height: 40vh; }
  .policy-detail { padding: 18px 16px; }
}

/* ---------------------------------------------------------------- 画面9 月次ミーティング */

.dropzone { border: 1px dashed var(--navy-soft); border-radius: 8px; background: #FBFCFD;
  padding: 14px; text-align: center; margin-top: 8px; }
.dropzone.over { border-color: var(--navy); background: #EEF2F7; }
.dz-main { font-size: 12.5px; color: var(--text-muted); }
.dz-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.file-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
  padding: 6px 10px; margin-top: 6px; }
.file-name { font-size: 12.5px; font-weight: 600; word-break: break-all; }
.file-meta { font-size: 11px; color: var(--text-muted); margin-left: auto; }
.file-text { white-space: pre-wrap; font-size: 11.5px; line-height: 1.6;
  background: #FBFCFD; border: 1px solid var(--border); border-radius: 6px;
  padding: 10px; margin-top: 4px; max-height: 260px; overflow: auto;
  color: var(--text-muted); }

.org-card { border: 1px solid var(--border); border-left: 3px solid var(--navy);
  border-radius: 8px; background: #fff; padding: 10px 12px; margin-top: 10px; }
.org-cat { font-size: 13px; font-weight: 700; color: var(--navy-dark); margin-bottom: 6px; }
.org-field { margin-top: 6px; }
.org-label { font-size: 11.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 2px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px);
  background: var(--navy-dark); color: #fff; font-size: 12.5px; font-weight: 500;
  padding: 9px 16px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 50; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--error-text); }

@media (max-width: 700px) {
  .file-meta { margin-left: 0; width: 100%; }
}

@media (max-width: 700px) {
  /* 月次一覧は状態の列が3つあるので、狭い画面ではユニット名を省く */
  .review-layout.monthly .col-unit { display: none; }
}
