/* omen-memo 共通スタイル
   - omen-sales のテーマ踏襲しつつ、誠人さん専用なので落ち着いた blue/ink 系に変更
   - 投げ込み即書き、目に負荷の少ない暗色寄り
*/
:root {
  --primary: #1f3a5f;
  --primary-light: #3a5d8f;
  --accent: #d4a574;
  --bg: #f5f5f0;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #888;
  --border: #e2dfd6;
  --error: #c33;
  --success: #2d6a4f;
  --warn: #c89000;
  --high: #c33;
  --mid: #888;
  --low: #aaa;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0 12px 24px;
  font-size: 16px;
  line-height: 1.6;
}
.container { max-width: 720px; margin: 0 auto; }

/* ナビ */
.nav-tabs {
  display: flex; gap: 0;
  background: #fff; border-bottom: 2px solid var(--primary);
  margin: 0 -12px 16px; padding: 0;
  overflow-x: auto;
  position: sticky; top: 0; z-index: 50;
  -webkit-overflow-scrolling: touch;
}
.nav-tabs a {
  padding: 14px 18px; text-decoration: none; color: #666;
  font-size: 14px; font-weight: 500;
  border-bottom: 3px solid transparent;
  white-space: nowrap; transition: all 0.15s;
}
.nav-tabs a:hover { background: #f6f4ee; color: #222; }
.nav-tabs a.active {
  color: var(--primary); border-bottom-color: var(--primary);
  background: #fbfaf4; font-weight: 700;
}
@media (max-width: 600px) { .nav-tabs a { padding: 12px 14px; font-size: 13px; } }

/* ヘッダ */
header {
  text-align: left;
  margin: 12px 0 16px;
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(31,58,95,0.18);
}
header h1 { margin: 0 0 4px; font-size: 20px; font-weight: 700; }
header .sub { font-size: 12px; opacity: 0.9; }

/* カード */
.card {
  background: var(--card);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border: 1px solid var(--border);
}

/* 入力 */
.memo-textarea {
  width: 100%;
  min-height: 220px;
  padding: 14px;
  font-size: 17px;
  line-height: 1.65;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: white;
  color: var(--text);
  font-family: inherit;
  resize: vertical;
}
.memo-textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31,58,95,0.12);
}

/* ボタン */
button.primary {
  width: 100%; padding: 16px; font-size: 17px; font-weight: 700;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white; border: none; border-radius: 10px; cursor: pointer;
  box-shadow: 0 4px 12px rgba(31,58,95,0.22);
  transition: transform 0.1s;
  margin-top: 12px;
}
button.primary:active { transform: scale(0.98); }
button.primary:disabled { opacity: 0.6; cursor: wait; }
button.ghost {
  padding: 8px 14px; font-size: 13px; font-weight: 500;
  background: white; color: var(--primary);
  border: 1px solid var(--primary-light); border-radius: 8px;
  cursor: pointer;
}

/* 自動分類インジケータ */
.auto-classify {
  font-size: 12px; color: var(--muted);
  display: flex; gap: 8px; align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
}
.auto-classify .pill {
  background: #f3eed8;
  color: #6a4f00;
  border: 1px solid #e0d7b5;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 11px;
}
.auto-classify .pill.tag { background: #e6eef8; color: var(--primary); border-color: #cfddf0; }
.auto-classify .pill.cat { background: #f4ebe0; color: #6c4c1e; border-color: #e3d3b8; }
.auto-classify .pill.imp-高 { background: #fde2e2; color: var(--high); border-color: #f7c0c0; }
.auto-classify .pill.imp-中 { background: #efeee8; color: #555; border-color: #d8d4c5; }
.auto-classify .pill.imp-低 { background: #f3f3f0; color: #888; border-color: #e0dfd6; }

/* トースト */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--success); color: white; padding: 14px 24px;
  border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  z-index: 1000; font-weight: 600; font-size: 14px;
  animation: slideUp 0.3s ease-out;
}
.toast.error { background: var(--error); }
@keyframes slideUp {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* リスト */
.memo-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: background 0.1s;
}
.memo-row:hover { background: #fbfaf4; }
.memo-row .meta {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  font-size: 11px; color: var(--muted);
  margin-bottom: 6px;
}
.memo-row .title {
  font-weight: 700; font-size: 15px; margin-bottom: 4px;
  color: var(--text);
}
.memo-row .preview {
  font-size: 13px; color: #555; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 700;
}
.badge.tag { background: #e6eef8; color: var(--primary); }
.badge.cat { background: #f4ebe0; color: #6c4c1e; }
.badge.imp-高 { background: #fde2e2; color: var(--high); }
.badge.imp-中 { background: #efeee8; color: #555; }
.badge.imp-低 { background: #f3f3f0; color: #888; }

/* チップ群（フィルタ） */
.chips {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px;
}
.chip {
  padding: 6px 12px; font-size: 12px; font-weight: 500;
  background: white; color: #555;
  border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer; transition: all 0.1s;
}
.chip:hover { background: #f6f4ee; }
.chip.active {
  background: var(--primary); color: white; border-color: var(--primary);
}

/* 検索ボックス */
.search-box {
  width: 100%; padding: 12px 14px; font-size: 15px;
  border: 1px solid var(--border); border-radius: 10px;
  background: white;
}

/* セレクト */
.select-row {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px;
}
.select-row select {
  padding: 8px 12px; font-size: 13px;
  border: 1px solid var(--border); border-radius: 8px;
  background: white;
}

/* ダイジェスト */
.digest-pre {
  background: #f8f6ee; border: 1px solid var(--border);
  padding: 14px; border-radius: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word;
}
.digest-section h3 {
  font-size: 14px; color: var(--primary);
  margin: 18px 0 8px; padding-bottom: 4px;
  border-bottom: 2px solid var(--primary);
}

/* モーダル */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20,30,18,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000; padding: 16px;
}
.modal-overlay.hidden { display: none; }
.modal-card {
  background: var(--card); border-radius: 14px;
  padding: 22px; max-width: 420px; width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  border: 1px solid var(--border);
}
.modal-card h2 {
  margin: 0 0 8px; color: var(--primary);
  font-size: 19px; text-align: center;
}
.modal-sub {
  margin: 0 0 16px; font-size: 12px; color: var(--muted);
  text-align: center; line-height: 1.6;
}

/* 編集モーダル */
.edit-modal textarea {
  width: 100%; min-height: 200px;
  padding: 12px; font-size: 15px; line-height: 1.6;
  border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit;
}
.edit-modal .row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin-top: 10px;
}
.edit-modal label {
  font-size: 12px; color: var(--muted); display: block;
}
.edit-modal select, .edit-modal input {
  width: 100%; padding: 8px 10px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 6px;
  margin-top: 4px;
}
.edit-modal .actions {
  display: flex; gap: 8px; margin-top: 14px;
}
.edit-modal .actions button { flex: 1; padding: 12px; font-size: 14px; }
.edit-modal .delete-btn {
  background: white; color: var(--error);
  border: 1px solid #f7c0c0; border-radius: 8px;
  cursor: pointer; padding: 12px; font-size: 14px;
}

/* 件数 */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.stat {
  text-align: center; padding: 12px 8px;
  background: var(--bg); border-radius: 8px;
}
.stat .n { font-size: 22px; font-weight: 700; color: var(--primary); }
.stat .l { font-size: 11px; color: var(--muted); display: block; }

/* グラフ簡易バー */
.bar-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 4px 0; }
.bar-row .lab { width: 90px; text-align: right; color: var(--muted); }
.bar-row .bar {
  flex: 1; height: 14px; border-radius: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
}
.bar-row .v { width: 40px; text-align: right; color: var(--text); font-weight: 600; }

/* トークン入力 */
.token-input {
  width: 100%; padding: 12px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 8px;
  font-family: ui-monospace, monospace;
}
