:root {
  --c-primary: #2f5bea;
  --c-primary-600: #1e40c4;
  --c-text: #1e2433;
  --c-text-sub: #6b7280;
  --c-border: #e5e8f0;
  --c-surface: #ffffff;
  --c-bg: #f4f6fb;
  --c-accent: #0e7c6f;
  --grad-main: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-600) 100%);
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(20,30,60,0.06);
  --shadow-md: 0 4px 12px rgba(20,30,60,0.08);
  --shadow-lg: 0 12px 32px rgba(20,30,60,0.14);
}

body { color: var(--c-text); background: var(--c-bg); font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif; line-height: 1.7; }

/* ===== ボタン（必須） ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.6rem 1.15rem; font-size: 0.9rem; font-weight: 600;
  border-radius: var(--r-md); border: 1.5px solid transparent;
  cursor: pointer; transition: all .18s; font-family: inherit; line-height: 1.2;
}
.btn-primary { background: var(--grad-main); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:disabled { background: #e5e7eb; color: #9ca3af; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-back { background: #fff; color: var(--c-text); border-color: var(--c-border); }
.btn-back:hover:not(:disabled) { background: #f3f4f6; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }

/* ===== 入力（必須） ===== */
.input, .textarea, .select {
  width: 100%; padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--c-border); border-radius: var(--r-md);
  font-size: 0.92rem; background: #fff; font-family: inherit; color: var(--c-text);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { resize: vertical; }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(47,91,234,.15);
}
.field { margin-bottom: 0.9rem; }
.field-label { display: block; font-size: 0.83rem; font-weight: 600; margin-bottom: 0.3rem; }
.req { color: #dc2626; font-size: 0.7rem; font-weight: 700; }

/* ===== カード（必須） ===== */
.card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-lg); padding: 1.15rem; box-shadow: var(--shadow-sm);
}

/* ===== モーダル（必須） ===== */
.modal { padding: 0; border: none; background: transparent; }
.modal::backdrop { background: rgba(0,0,0,0.4); }
.modal-inner { background: #fff; border-radius: var(--r-lg); width: min(560px, 92vw); box-shadow: var(--shadow-lg); }
.modal-inner.small { width: min(420px, 92vw); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.15rem; border-bottom: 1px solid var(--c-border); }
.modal-title { font-weight: 700; font-size: 1.02rem; }
.modal-close { background: transparent; border: none; cursor: pointer; color: var(--c-text-sub); font-size: 1.1rem; }
.modal-body { padding: 1.15rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.1rem; }

/* ===== トースト（必須） ===== */
.toast {
  background: #1f2937; color: #fff; padding: 0.7rem 1.05rem; border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); font-size: 0.88rem; animation: toast-in .2s ease; max-width: 340px;
}
.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }
.toast.is-leaving { animation: toast-out .22s ease forwards; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toast-out { to { transform: translateY(8px); opacity: 0; } }
.spinner { display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== ヘッダー・タブ ===== */
.app-header { background: #fff; border-bottom: 1px solid var(--c-border); position: sticky; top: 0; z-index: 30; }
.brand { font-weight: 800; font-size: 1rem; white-space: nowrap; }
.brand i { color: var(--c-primary); }
.demo-badge { background: #fde68a; color: #92600a; font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; letter-spacing: .04em; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 8px;
  font-size: 0.83rem; font-weight: 600; color: var(--c-text-sub); background: transparent;
  border: none; cursor: pointer; font-family: inherit;
}
.tab:hover { background: #eef2ff; color: var(--c-primary-600); }
.tab.active { background: var(--c-primary); color: #fff; }

/* ===== ビュー切替 ===== */
.view { display: none; }
.view.active { display: block; }

/* ===== 注意書き ===== */
.notice { background: #fffbeb; border: 1px solid #fde68a; color: #92600a; border-radius: var(--r-md); padding: 0.85rem 1rem; font-size: 0.83rem; line-height: 1.65; }
.notice strong { font-weight: 800; }
.notice-sub { margin-top: 0.5rem; font-size: 0.75rem; color: #a07b2b; }

/* ===== 集計・一覧 ===== */
.stat-box { background: #fff; border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 0.9rem 1rem; box-shadow: var(--shadow-sm); }
.stat-label { font-size: 0.78rem; color: var(--c-text-sub); margin-bottom: 0.2rem; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--c-primary); }
.pill { display: inline-block; font-size: 0.72rem; font-weight: 700; background: #eef2ff; color: var(--c-primary-600); padding: 2px 8px; border-radius: 999px; margin-left: 4px; }
.flow-list { padding-left: 1.2rem; margin: 0; line-height: 2; font-size: 0.9rem; }
.stack { display: flex; flex-direction: column; gap: 0.6rem; }

.item { border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 0.8rem 0.9rem; background: #fff; }
.item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.6rem; }
.item-name { font-weight: 700; font-size: 0.92rem; }
.item-meta { color: var(--c-text-sub); font-size: 0.76rem; margin-top: 2px; }
.item-body { font-size: 0.8rem; color: #4b5563; margin-top: 0.4rem; white-space: pre-wrap; }
.item-acts { display: flex; gap: 0.35rem; flex-shrink: 0; }
.tag { display: inline-block; font-size: 0.7rem; font-weight: 600; background: #eef2ff; color: var(--c-primary-600); padding: 1px 7px; border-radius: 999px; }
.price { font-weight: 700; color: var(--c-text); }
.empty { text-align: center; color: var(--c-text-sub); padding: 1.8rem 0.6rem; border: 1px dashed var(--c-border); border-radius: var(--r-md); font-size: 0.85rem; }

/* ===== 選択カード ===== */
.opt { border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 0.7rem 0.85rem; cursor: pointer; display: flex; gap: 0.6rem; align-items: flex-start; transition: border-color .15s, background .15s; }
.opt:hover { background: #f8f9fc; }
.opt.sel { border-color: var(--c-primary); background: #eef2ff; }
.opt input { margin-top: 4px; }
.opt .item-name { font-size: 0.88rem; }

/* ===== 提案書本文 ===== */
.doc { line-height: 1.85; }
.doc h1 { font-size: 1.25rem; font-weight: 800; border-bottom: 2px solid var(--c-border); padding-bottom: 0.5rem; margin: 0 0 0.6rem; }
.doc h2 { font-size: 1.02rem; font-weight: 700; color: var(--c-primary-600); margin: 1.3rem 0 0.4rem; }
.doc ul { padding-left: 1.4rem; margin: 0.4rem 0; }
.doc li { margin: 0.2rem 0; }
.doc p { margin: 0.5rem 0; }
.todo { background: #fff3cd; color: #92600a; font-weight: 700; padding: 0 5px; border-radius: 4px; font-size: 0.92em; }

/* ===== 下部注記 ===== */
.site-note { max-width: 56rem; margin: 1.5rem auto 0; padding: 1rem; border-top: 1px solid var(--c-border); color: var(--c-text-sub); font-size: 0.75rem; text-align: center; line-height: 1.6; }

/* ===== レスポンシブ ===== */
@media (max-width: 640px) {
  .tabs { width: 100%; margin-left: 0; }
  .tab { flex: 1; justify-content: center; padding: 7px 6px; }
  .tab span { display: none; }
  .tab i { font-size: 1rem; }
  .brand { font-size: 0.92rem; }
  .stat-value { font-size: 1.25rem; }
  .item-top { flex-direction: column; }
}