:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --line: #e3e8ef;
  --ink: #1f2d3d;
  --muted: #7b8794;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --danger: #dc2626;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--brand); text-decoration: none; }

/* ---------- レイアウト ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: #11243f; color: #cdd9e8;
  display: flex; flex-direction: column; padding: 16px 0;
}
.brand { font-weight: 700; font-size: 18px; color: #fff; padding: 0 20px 16px; line-height: 1.2; }
.brand span { font-size: 12px; font-weight: 500; color: #8fa6c4; }
.brand.center { text-align: center; padding: 0 0 16px; }
.modules { display: flex; flex-direction: column; }
.mod { padding: 11px 20px; color: #cdd9e8; font-size: 14px; }
.mod:hover { background: #1b3454; color: #fff; }
.mod.is-active { background: var(--brand); color: #fff; }
.suite { margin-top: auto; padding: 16px 20px 0; border-top: 1px solid #1b3454; }
.suite-title { font-size: 11px; color: #6b829f; margin-bottom: 8px; }
.suite-link { display: block; color: #cdd9e8; font-size: 13px; padding: 5px 0; }
.suite-link:hover { color: #fff; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
}
.page-title { font-weight: 600; }
.userbox { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.badge { background: #eef2ff; color: var(--brand-dark); font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.logout { color: var(--muted); }
.content { padding: 24px; max-width: 720px; width: 100%; margin: 0 auto; }
.content.wide { max-width: 1180px; }

/* ---------- ボタン ---------- */
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.btn:hover { background: #f0f3f8; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.small { padding: 5px 12px; font-size: 13px; }

/* ---------- フィード ---------- */
.post-form { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 18px; }
.post-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 10px; resize: vertical; font: inherit; }
.post-form-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.empty { color: var(--muted); text-align: center; padding: 40px; }

.post { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 14px; }
.post-head { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.post-author { font-weight: 600; font-size: 14px; }
.post-time { font-size: 12px; color: var(--muted); }
.post-del { margin-left: auto; }
.post-del button { border: none; background: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.post-del button:hover { color: var(--danger); }
.post-body { margin: 12px 0; white-space: pre-wrap; word-break: break-word; line-height: 1.6; }
.post-actions { display: flex; gap: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.post-actions button { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 13px; }
.post-actions button:hover { color: var(--ink); }
.like-btn.liked { color: var(--danger); font-weight: 600; }

.comments { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.comment-list .comment { font-size: 13px; padding: 6px 0; }
.comment .c-author { font-weight: 600; margin-right: 6px; }
.comment .c-time { color: var(--muted); font-size: 11px; margin-left: 6px; }
.comment-form { display: flex; gap: 8px; margin-top: 8px; }
.comment-form input { flex: 1; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; font: inherit; }

/* ---------- 認証 ---------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 32px; width: 360px; box-shadow: 0 8px 30px rgba(17,36,63,.08); }
.auth-card .brand { color: var(--ink); }
.auth-card .brand span { color: var(--muted); }
.auth-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca;
  border-radius: 6px; padding: 10px; font-size: 13px; margin-bottom: 14px; }
.fld { display: block; margin-bottom: 14px; }
.fld span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.fld input { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 9px 11px; font: inherit; }
.auth-card .btn { width: 100%; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 13px; }

/* ---------- CRM ---------- */
.crm-subnav { display: flex; gap: 6px; margin-bottom: 16px; }
.crm-subnav a { padding: 6px 14px; border-radius: 6px; color: var(--muted); font-size: 14px; }
.crm-subnav a:hover { background: #eef2f8; }
.crm-subnav a.active { background: var(--brand); color: #fff; }

.kpi-row { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 16px; flex: 1; min-width: 130px; }
.kpi-label { display: block; font-size: 12px; color: var(--muted); }
.kpi-val { font-size: 18px; font-weight: 700; }

.new-deal { margin-bottom: 18px; }
.new-deal > summary { display: inline-block; list-style: none; cursor: pointer; }
.new-deal > summary::-webkit-details-marker { display: none; }
.grid-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-top: 10px; }
.grid-form .fld { margin-bottom: 0; }
.grid-form .fld.wide { grid-column: 1 / -1; }
.grid-form .fld input, .grid-form .fld select { width: 100%; border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 10px; font: inherit; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }

/* カンバン */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: #eef1f6; border-radius: 10px; width: 220px; flex-shrink: 0; display: flex; flex-direction: column; }
.kcol.is-won { background: #e7f6ec; }
.kcol.is-lost { background: #f6e9e9; }
.kcol-head { padding: 10px 12px; border-bottom: 1px solid rgba(0,0,0,.06); }
.kcol-title { font-weight: 700; font-size: 14px; }
.kcol-meta { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.kcol-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.dcard { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.dcard-title { font-weight: 600; font-size: 14px; display: block; }
.dcard-amount { color: var(--brand-dark); font-weight: 700; font-size: 13px; margin: 4px 0; }
.dcard-sub { font-size: 12px; color: var(--muted); }
.stage-select { width: 100%; margin-top: 8px; border: 1px solid var(--line); border-radius: 6px; padding: 4px; font-size: 12px; }

/* 詳細 */
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.detail-head h2 { margin: 0 0 4px; }
.detail-meta { font-size: 13px; color: var(--muted); }
.detail-amount { font-size: 22px; font-weight: 700; color: var(--brand-dark); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px;
  margin-bottom: 14px; display: flex; align-items: center; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
.inline-stage { display: flex; align-items: center; gap: 12px; }
.inline-stage select { border: 1px solid var(--line); border-radius: 6px; padding: 6px; font: inherit; }
.saved-hint { color: #16a34a; font-size: 13px; }
.del-deal { margin-left: auto; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.sec-title { font-size: 15px; margin: 18px 0 8px; }

.activity-form { display: flex; gap: 8px; width: 100%; flex-wrap: wrap; }
.activity-form select, .activity-form input[type=text], .activity-form input[type=date] {
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font: inherit; }
.activity-form input[type=text] { flex: 1; min-width: 160px; }
.activity-list { list-style: none; padding: 0; margin: 0; }
.act { display: flex; gap: 12px; align-items: flex-start; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.act.is-done { opacity: .55; }
.act.is-done .act-body { text-decoration: line-through; }
.act-kind { background: #eef2ff; color: var(--brand-dark); font-size: 11px; padding: 2px 8px;
  border-radius: 10px; flex-shrink: 0; }
.act-main { flex: 1; }
.act-body { font-size: 14px; }
.act-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.act-done { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 4px 10px;
  font-size: 12px; cursor: pointer; }

/* テーブル / ミニリスト */
.data-table { width: 100%; border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.data-table th, .data-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.data-table th { background: #f6f8fb; color: var(--muted); font-weight: 600; }
.data-table tr:last-child td { border-bottom: none; }
.mini-list { list-style: none; padding: 0; margin: 0 0 8px; }
.mini-list li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }

/* ---------- プロジェクト ---------- */
.proj-toolbar { margin-bottom: 14px; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.proj-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.proj-card.is-archived { opacity: .6; }
.proj-name { font-weight: 700; font-size: 16px; display: block; }
.proj-desc { font-size: 13px; color: var(--muted); margin: 6px 0; }
.proj-progress { margin: 10px 0; }
.bar { height: 8px; background: #eef1f6; border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); }
.proj-meta { font-size: 12px; color: var(--muted); }
.proj-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-top: 8px; }
.linkbtn { border: none; background: none; color: var(--brand); cursor: pointer; font-size: 12px; padding: 0; }

/* タスクカード */
.task-status { width: 100%; margin-top: 8px; border: 1px solid var(--line); border-radius: 6px; padding: 4px; font-size: 12px; }
.tcard-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.tag { background: #eef1f6; color: var(--muted); font-size: 11px; padding: 1px 7px; border-radius: 10px; }
.dep-tag { background: #fff4e5; color: #b45309; }
.prio-tag-high { background: #fde8e8; color: var(--danger); }
.prio-tag-normal { background: #eef2ff; color: var(--brand-dark); }
.prio-tag-low { background: #eef1f6; color: var(--muted); }
.dcard.prio-high { border-left: 3px solid var(--danger); }

/* ガント */
.gantt-range { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.gantt { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.gantt-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.gantt-label { width: 180px; flex-shrink: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-track { position: relative; flex: 1; height: 24px; background: #f4f6f9; border-radius: 5px; }
.gantt-bar { position: absolute; top: 3px; height: 18px; background: var(--brand); border-radius: 4px;
  color: #fff; font-size: 10px; line-height: 18px; padding: 0 6px; overflow: hidden; white-space: nowrap; min-width: 14px; }
.gantt-bar.status-done { background: #16a34a; }
.gantt-bar.status-doing { background: #f59e0b; }

/* タスク詳細 2カラム */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.inline-add { display: flex; gap: 8px; margin-top: 8px; }
.inline-add input, .inline-add select { flex: 1; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; font: inherit; }
.inline-del { display: inline; }
@media (max-width: 720px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- ドライブ ---------- */
.crumbs { font-size: 14px; margin-bottom: 14px; }
.crumbs .sep { color: var(--muted); margin: 0 6px; }
.drive-actions { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.drive-actions .inline-add { margin-top: 0; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; }
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.folder-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.folder-link { font-weight: 600; display: block; }
.folder-meta { font-size: 12px; color: var(--muted); margin: 4px 0; }
.folder-del { display: inline; }
.hint { font-size: 13px; color: var(--muted); margin-top: 10px; }

/* ---------- カレンダー ---------- */
.cal-header { display: flex; align-items: center; justify-content: center; gap: 20px; margin-bottom: 16px; }
.cal-header h2 { margin: 0; min-width: 160px; text-align: center; }
.cal-grid { width: 100%; border-collapse: collapse; table-layout: fixed; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cal-grid th { background: #f6f8fb; color: var(--muted); font-weight: 600; font-size: 13px; padding: 8px; border: 1px solid var(--line); }
.cal-grid th:first-child { color: #dc2626; }
.cal-grid th:last-child { color: #2563eb; }
.cal-cell { border: 1px solid var(--line); vertical-align: top; height: 96px; padding: 4px; }
.cal-cell.out { background: #f7f9fc; }
.cal-cell.out .cal-day { color: #c3ccd8; }
.cal-cell.today { background: #eff6ff; }
.cal-cell.today .cal-day { background: var(--brand); color: #fff; border-radius: 50%; width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center; }
.cal-day { font-size: 12px; color: var(--ink); margin-bottom: 3px; }
.cal-event { display: block; font-size: 11px; background: #dbeafe; color: #1e40af; border-radius: 4px;
  padding: 1px 5px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event.has-res { background: #fef3c7; color: #92400e; }
.cal-time { font-weight: 700; margin-right: 3px; }
.rsvp-form { display: flex; gap: 8px; }

/* ---------- topbar 検索/ベル ---------- */
.topsearch input { border: 1px solid var(--line); border-radius: 16px; padding: 6px 14px; font: inherit;
  width: 200px; background: #f6f8fb; }
.topsearch input:focus { background: #fff; outline: none; border-color: var(--brand); }
.bell { position: relative; font-size: 18px; text-decoration: none; }
.bell-badge { position: absolute; top: -6px; right: -10px; background: var(--danger); color: #fff;
  font-size: 10px; min-width: 16px; height: 16px; line-height: 16px; text-align: center;
  border-radius: 8px; padding: 0 4px; }

/* ---------- 横断検索 ---------- */
.search-big { display: flex; gap: 8px; margin-bottom: 18px; }
.search-big input { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; font: inherit; }
.search-summary { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.search-group { margin-bottom: 10px; }
.search-sub { color: var(--muted); font-size: 12px; margin-left: 8px; }

/* ---------- 通知 ---------- */
.notif-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.notif-head h2 { margin: 0; }
.notif-list { list-style: none; padding: 0; margin: 0; }
.notif { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
.notif.is-unread { border-left: 3px solid var(--brand); background: #f5f9ff; }
.notif-link { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; }
.notif-text { color: var(--ink); }
.notif-time { color: var(--muted); font-size: 12px; }
