/* Notionクイックメモ — 淡々・機能的。色は最小限のモノクロ＋1アクセント。 */
:root {
  --bg: #0a0a0a;
  --surface: #161616;
  --surface-2: #1f1f1f;
  --line: #2a2a2a;
  --text: #f2f2f2;
  --text-dim: #8a8a8a;
  --accent: #d8443c; /* Nothingの赤 */
  --ok: #3ddc84;
  --radius: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* ---- ヘッダ ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.topbar .title { font-size: 15px; font-weight: 600; letter-spacing: .02em; }
.topbar .spacer { flex: 1; }
.topbar .mode-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.iconbtn {
  appearance: none; border: none; background: transparent; color: var(--text-dim);
  width: 38px; height: 38px; border-radius: 10px; font-size: 18px; cursor: pointer;
  display: grid; place-items: center;
}
.iconbtn:active { background: var(--surface-2); }

/* ---- 一覧 ---- */
.list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
}
.list.reverse { flex-direction: column-reverse; justify-content: flex-start; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.card .meta { color: var(--text-dim); font-size: 12px; margin-top: 6px; display: flex; gap: 8px; align-items: center; }
.card .badge { font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-dim); }
.card.unsorted { border-style: dashed; }

.empty { color: var(--text-dim); text-align: center; padding: 32px 16px; font-size: 14px; line-height: 1.7; }
.loading { color: var(--text-dim); text-align: center; padding: 24px; font-size: 13px; }

/* ---- 入力欄（下部固定） ---- */
.composer {
  border-top: 1px solid var(--line);
  background: var(--bg);
  padding: 10px 12px calc(10px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.composer .row { display: flex; gap: 8px; align-items: flex-end; }
textarea.input {
  flex: 1;
  resize: none;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  font: inherit;
  font-size: 16px; /* iOSズーム防止 */
  line-height: 1.4;
  max-height: 40vh;
  min-height: 46px;
}
textarea.input:focus { outline: none; border-color: var(--text-dim); }

.btn {
  appearance: none;
  border: none;
  border-radius: var(--radius);
  padding: 0 18px;
  height: 46px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  flex-shrink: 0;
}
.btn:disabled { opacity: .4; }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn.block { width: 100%; }

/* レビュー：選択中の製品バー */
.product-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.product-bar .name { font-weight: 600; flex: 1; }
.product-bar .spec { color: var(--text-dim); font-size: 12px; }
.product-bar .change { color: var(--accent); font-size: 13px; cursor: pointer; }

.spec-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 8px 12px 0;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-dim);
  white-space: pre-wrap;
  line-height: 1.5;
}
.spec-box .label { color: var(--text); font-weight: 600; margin-bottom: 4px; font-size: 12px; letter-spacing: .04em; }

/* 製品選択リスト（チップ） */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 12px; overflow-y: auto; }
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}
.chip:active { background: var(--surface-2); }
.chip.unsorted-chip { border-style: dashed; color: var(--text-dim); }

/* ---- 設定画面 ---- */
.settings { flex: 1; overflow-y: auto; padding: 16px; }
.settings h2 { font-size: 16px; margin: 0 0 4px; }
.settings .hint { color: var(--text-dim); font-size: 12px; line-height: 1.6; margin: 4px 0 16px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; margin-bottom: 6px; color: var(--text); }
.field .sub { color: var(--text-dim); font-size: 11px; margin-bottom: 6px; }
.field input {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  font-size: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.field input:focus { outline: none; border-color: var(--text-dim); }
.settings .actions { display: flex; gap: 10px; margin-top: 8px; }
.status-line { font-size: 12px; padding: 8px 0; min-height: 20px; }
.status-line.ok { color: var(--ok); }
.status-line.err { color: var(--accent); }

/* ---- トースト ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-bottom));
  transform: translateX(-50%) translateY(20px);
  background: #fff;
  color: #000;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 50;
  box-shadow: 0 6px 24px rgba(0,0,0,.5);
  max-width: 86vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--accent); color: #fff; }

/* モーダル（製品選択など） */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 40;
  display: flex; align-items: flex-end;
}
.sheet {
  background: var(--bg); width: 100%; max-height: 80dvh;
  border-radius: 16px 16px 0 0; border-top: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding-bottom: var(--safe-bottom);
}
.sheet .sheet-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.sheet .sheet-head .title { font-weight: 600; flex: 1; }
