* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #eae4db;        /* ベージュ（基調） */
  --surface: #f6f3ee;   /* アイボリー（ヘッダー・タブバー） */
  --card: #ffffff;
  --ink: #1a1a1a;       /* 墨黒 */
  --sub: #8a857c;       /* 灰茶（補助文字） */
  --line: #ddd6cb;      /* 罫線 */
  --warm: #b96a4b;      /* テラコッタ（注意系の控えめなアクセント） */
  --r: 2px;             /* 基本の角丸（シャープ方針） */
  --tabbar-h: calc(56px + env(safe-area-inset-bottom));
}

html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.7;
}

/* ===== ビュー切替 ===== */
.view { display: none; min-height: 100vh; padding-bottom: var(--tabbar-h); }
.view.active { display: block; }

.app-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(246,243,238,.95);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  padding: calc(14px + env(safe-area-inset-top)) 20px 14px;
  border-bottom: 1px solid var(--line);
}
.brand { text-align: center; margin-bottom: 12px; }
.brand h1 {
  font-size: 21px; font-weight: 500;
  letter-spacing: .32em; text-indent: .32em;
}
.brand-sub {
  display: block;
  font-size: 9px; font-weight: 500;
  letter-spacing: .34em; text-indent: .34em;
  text-transform: uppercase;
  color: var(--sub);
  margin-top: 1px;
}

.search-row { display: flex; gap: 8px; }
.search-row #search-input { flex: 1; }
.scan-btn {
  flex-shrink: 0;
  border: 1px solid var(--ink); border-radius: var(--r);
  background: var(--card); color: var(--ink);
  font-family: inherit; font-size: 13px; font-weight: 600; letter-spacing: .08em;
  padding: 0 16px;
}
.scan-btn:active { background: var(--surface); }

#search-input {
  width: 100%; font-size: 16px;
  padding: 11px 16px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--card); outline: none;
  font-family: inherit;
  -webkit-appearance: none;
}
#search-input:focus { border-color: var(--ink); }
#search-input::placeholder { color: #b5aea2; }

.chips { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; border: 1px solid var(--line); border-radius: var(--r);
  padding: 5px 14px; font-size: 13px; background: var(--card); color: var(--ink);
  font-family: inherit; letter-spacing: .04em;
}
.chip.on { border-color: transparent; font-weight: 600; }
.chip.pill { border-radius: 999px; }
.chips + .chips { margin-top: 6px; }
.chips[hidden] { display: none; }

/* ===== リスト ===== */
.list { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }

.person-card {
  background: var(--card); border-radius: var(--r); padding: 0;
  border-left: 4px solid var(--line);
  overflow: hidden;
  cursor: pointer;
}
/* 人物名エリア：マイマーク色の背景で5段階を識別（マークなしは白のまま） */
.person-card .name-band { padding: 10px 16px 8px; font-size: 17px; font-weight: 600; letter-spacing: .02em; }
.person-card .card-body { padding: 0 16px 12px; }
.person-card .snippet { font-size: 13px; color: var(--sub);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.person-card .meta { font-size: 12px; color: var(--sub); margin-top: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cat-chip { display: inline-block; font-size: 11px; border-radius: var(--r); padding: 1px 9px; font-weight: 500; letter-spacing: .04em; background: var(--surface); color: var(--sub); }

/* フォロー中（マイマークとは別の公開ステータス） */
.follow-chip {
  display: inline-block; font-size: 11px; color: var(--sub);
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); padding: 1px 8px; letter-spacing: .04em;
}

/* イベントタグ（幹事CSV由来：昼の部・夜の部など） */
.event-chip {
  display: inline-block; font-size: 11px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); padding: 1px 10px; letter-spacing: .04em;
}

/* マイマーク（当日の分類メモ用タグ） */
.mark-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; letter-spacing: .04em; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--card);
  padding: 1px 8px;
}
.mark-tag i, .mark-btn i, .mark-option i {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0;
}

.empty {
  text-align: center; color: var(--sub); padding: 56px 24px; font-size: 14px;
  background: var(--card); border-radius: var(--r);
}

/* ===== タイムライン ===== */
.tl-item { background: var(--card); border-radius: var(--r); padding: 14px 16px; cursor: pointer; }
.tl-item .tl-date { font-size: 12px; color: var(--sub); letter-spacing: .04em; }
.tl-item .tl-name { font-weight: 600; margin-top: 2px; }
.tl-item .tl-place { color: var(--ink); }
.tl-item .tl-memo { font-size: 14px; margin-top: 4px; white-space: pre-wrap; }

/* ===== タブバー ===== */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  height: var(--tabbar-h);
  display: flex;
  background: rgba(246,243,238,.96);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; border: none; background: none; font-size: 10px; color: #a89f92;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  letter-spacing: .14em;
  font-family: inherit;
}
.tab .tab-icon { width: 22px; height: 22px; }
.tab.active { color: var(--ink); font-weight: 600; }

/* ===== FAB（操作慣習として円のまま） ===== */
.fab {
  position: fixed; right: 20px; bottom: calc(var(--tabbar-h) + 16px); z-index: 15;
  width: 54px; height: 54px; border-radius: 50%; border: none;
  background: var(--ink); color: var(--surface); font-size: 26px; font-weight: 300;
  box-shadow: 0 6px 16px rgba(26,26,26,.22);
}

/* ===== モーダル ===== */
.modal { position: fixed; inset: 0; z-index: 30; background: var(--bg); overflow-y: auto; }
.modal[hidden] { display: none; }
.modal-page { min-height: 100%; display: flex; flex-direction: column; }
.modal-header {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(246,243,238,.95);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  padding: calc(12px + env(safe-area-inset-top)) 14px 12px;
  border-bottom: 1px solid var(--line);
}
.modal-header strong { font-size: 15px; letter-spacing: .1em; font-weight: 600; }
.icon-btn {
  border: none; background: none; color: var(--ink); font-size: 15px; padding: 6px 8px;
  font-family: inherit; letter-spacing: .04em;
}
.icon-btn.strong { font-weight: 700; }
.modal-body { flex: 1; padding: 18px 20px; }
.modal-footer {
  position: sticky; bottom: 0;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: rgba(246,243,238,.95);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}

/* ===== QR読み取り ===== */
.header-spacer { width: 72px; }
.scan-body {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 20px; gap: 16px;
}
#scan-video {
  width: 100%; max-width: 420px; aspect-ratio: 1;
  object-fit: cover; background: #000;
  border: 1px solid var(--ink); border-radius: var(--r);
}
.scan-hint { font-size: 13px; color: var(--sub); text-align: center; }

.profile-link {
  display: inline-block; margin: 10px 20px 0;
  font-size: 13px; color: var(--ink);
  text-decoration: underline; text-underline-offset: 3px;
}

/* ===== ブリーフィング ===== */
.brief-head { background: var(--card); border-radius: 3px; padding: 0 0 14px; margin-bottom: 16px; overflow: hidden; }
.brief-name { padding: 18px 20px 14px; font-size: 24px; font-weight: 700; letter-spacing: .03em; }
.brief-head .sub { font-size: 13px; margin-top: 2px; padding: 0 20px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.mark-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--card); color: var(--ink);
  font-size: 12px; font-family: inherit; letter-spacing: .04em;
  padding: 2px 10px;
}

.brief-section { background: var(--card); border-radius: var(--r); padding: 14px 16px; margin-bottom: 12px; }
.brief-section h3 {
  font-size: 10.5px; color: var(--sub); margin-bottom: 6px;
  letter-spacing: .2em; font-weight: 600;
}
.brief-section .content { font-size: 15px; white-space: pre-wrap; }
.brief-section.last-talk { background: #f4eee1; }
.brief-note { font-size: 12px; color: var(--sub); text-align: center; margin: 12px 0 4px; letter-spacing: .04em; }

.hist-item { border-top: 1px solid #efe9df; padding: 9px 0; }
.hist-item:first-of-type { border-top: none; }
.hist-item .h-date { font-size: 12px; color: var(--sub); }
.hist-item .h-memo { font-size: 14px; white-space: pre-wrap; }

/* ===== フォーム ===== */
.form label { display: block; font-size: 12px; color: var(--sub); margin-bottom: 16px; letter-spacing: .08em; }
.form input, .form textarea, .form select {
  display: block; width: 100%; margin-top: 5px;
  font-size: 16px; color: var(--ink);
  padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--card); outline: none; font-family: inherit;
  -webkit-appearance: none;
}
.form input:focus, .form textarea:focus, .form select:focus { border-color: var(--ink); }
.form .req { color: var(--warm); font-size: 11px; margin-left: 6px; }

/* ===== データタブ ===== */
.data-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--card); border-radius: var(--r); padding: 18px; }
.card h2 {
  font-size: 12px; margin-bottom: 10px;
  letter-spacing: .18em; font-weight: 600; color: var(--sub);
}
.card .hint { font-size: 12px; color: var(--sub); margin-bottom: 10px; }
.stats { font-size: 14px; }

.btn {
  display: block; width: 100%; text-align: center;
  font-size: 15px; padding: 12px; margin-top: 8px;
  border: 1px solid var(--ink); border-radius: var(--r);
  background: var(--card); color: var(--ink); font-family: inherit;
  letter-spacing: .06em;
}
.btn:active { background: var(--surface); }
.btn-primary { background: var(--ink); color: var(--surface); border-color: var(--ink); font-weight: 600; }
.btn-danger { background: none; color: var(--warm); border-color: var(--warm); margin-top: 22px; }
.btn-wide { width: 100%; }
.file-btn { cursor: pointer; }

.cat-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cat-row input[type="text"] {
  flex: 1; font-size: 15px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--card); font-family: inherit; color: var(--ink); outline: none;
}
.cat-row input[type="text"]:focus { border-color: var(--ink); }
.cat-row input[type="color"] { width: 40px; height: 36px; border: 1px solid var(--line); border-radius: var(--r); background: none; padding: 2px; }
.cat-row .cat-del { border: none; background: none; color: var(--warm); font-size: 18px; padding: 4px 8px; }

/* ===== マイマーク切替シート ===== */
.sheet {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(26,26,26,.4);
  display: flex; align-items: flex-end;
}
.sheet[hidden] { display: none; }
.sheet-box {
  width: 100%;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 18px 20px calc(18px + env(safe-area-inset-bottom));
}
.sheet-box h3 {
  font-size: 11px; color: var(--sub); font-weight: 600;
  letter-spacing: .2em; margin-bottom: 12px; text-align: center;
}
.mark-option {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  font-size: 15px; font-family: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 14px; margin-bottom: 8px;
  letter-spacing: .04em;
}
.mark-option.current { border-color: var(--ink); font-weight: 600; }
.mark-option i.none { border: 1px solid var(--line); background: var(--card); }

/* カラー切替シート（色見本のみ・文字ラベルなし） */
.color-options { display: flex; gap: 12px; justify-content: center; margin-bottom: 14px; }
.color-swatch {
  width: 46px; height: 46px;
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 0; font-family: inherit;
}
.color-swatch.none { background: var(--card); color: var(--sub); font-size: 14px; }
.color-swatch.current { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ===== トースト ===== */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 24px); transform: translateX(-50%);
  background: var(--ink); color: var(--surface); font-size: 14px;
  padding: 10px 20px; border-radius: var(--r); z-index: 50;
  max-width: 86vw; text-align: center; letter-spacing: .04em;
}
