/*
 * style.css — 民泊ブースター 営業デモ
 * 仕様: /design/minpaku-demo_claude-code-spec.md §9
 * 方針: 全画面1トーン、明るく余白広め、システムフォントのみ、375px基準。
 */

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}
input, textarea, select { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.3; }
p { margin: 0; }
a { color: inherit; }

/* ===== Design Tokens ===== */
:root {
  /* Accent: 落ち着いた青緑 (営業に刺さる、テック過剰でない) */
  --accent: #2C8C84;
  --accent-soft: #DDEEEC;
  --accent-strong: #1F6E68;

  /* Neutrals */
  --bg: #F6F7F8;
  --surface: #FFFFFF;
  --surface-2: #FAFBFC;
  --text: #1B2024;
  --text-muted: #5C6770;
  --border: #E4E7EA;
  --border-strong: #C9CFD4;

  /* Semantic */
  --ok: #2E8B57;
  --ok-soft: #E0F1E7;
  --warn: #C77700;
  --warn-soft: #FDEFD2;
  --danger: #C53030;
  --danger-soft: #FBE0E0;

  /* Geometry */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* Shadow (浅く) */
  --shadow-1: 0 1px 2px rgba(20, 26, 30, 0.04), 0 1px 1px rgba(20, 26, 30, 0.03);
  --shadow-2: 0 4px 12px rgba(20, 26, 30, 0.06);

  /* Anim */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --dur: 220ms;
}

/* ===== Layout shell ===== */
.app-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--space-3) var(--space-4);
  display: flex; align-items: center; gap: var(--space-3);
}
.brand {
  display: flex; align-items: center; gap: var(--space-2);
  font-weight: 800; font-size: 17px; letter-spacing: -0.01em;
  color: var(--accent-strong);
  user-select: none;
}
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
}
.brand-mark svg { width: 18px; height: 18px; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }

.tour-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  min-height: 36px;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.tour-btn:hover { background: var(--accent-strong); }
.tour-btn:active { transform: scale(0.97); }
.tour-btn.active { background: var(--danger); }

.back-btn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; color: var(--text-muted);
  min-height: 44px;
}

main.app-main {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--space-4);
  padding-bottom: var(--space-7);
}

.app-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: var(--space-5) var(--space-4) var(--space-6);
  margin-top: var(--space-5);
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

/* ===== Hero strip (1行コンセプト) ===== */
.hero-strip {
  margin: var(--space-2) 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(135deg, var(--accent-soft), #fff);
  border-radius: var(--radius);
  border: 1px solid var(--accent-soft);
}
.hero-strip h1 {
  font-size: 17px;
  color: var(--accent-strong);
  margin-bottom: 4px;
}
.hero-strip p {
  font-size: 13px;
  color: var(--text-muted);
}

/* ===== Card ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-1);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.card-link {
  cursor: pointer;
}
.card-link:hover {
  box-shadow: var(--shadow-2);
}
.card-link:active {
  transform: translateY(1px);
}
.card-header {
  display: flex; align-items: center; gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  display: flex; align-items: center; gap: 8px;
}
.card-title svg { color: var(--accent); }
.card-cta {
  margin-left: auto;
  font-size: 12px;
  color: var(--accent);
  display: inline-flex; align-items: center; gap: 2px;
}
.card-cta svg { width: 14px; height: 14px; }

/* ===== Badge / Chip ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.neutral { background: #EEF0F2; color: var(--text-muted); }

.chip {
  display: inline-flex; align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  min-height: 36px;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.chip:hover { background: var(--accent-soft); border-color: var(--accent); }
.chip.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.chip-row {
  display: flex; flex-wrap: wrap; gap: 8px;
}

/* ===== Button ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  min-height: 44px;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.btn:hover { background: var(--accent-strong); }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn.btn-ghost {
  background: var(--surface);
  color: var(--accent-strong);
  border: 1px solid var(--border-strong);
}
.btn.btn-ghost:hover { background: var(--accent-soft); }
.btn.btn-danger { background: var(--danger); }
.btn.btn-danger:hover { background: #A12525; }

/* ===== Meter (180日コンプラ) ===== */
.meter {
  margin-bottom: var(--space-3);
}
.meter-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 4px;
}
.meter-name { font-size: 13px; font-weight: 600; }
.meter-value { font-size: 12px; color: var(--text-muted); }
.meter-bar {
  height: 8px;
  background: #ECEEF0;
  border-radius: 999px;
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  transition: width 600ms var(--ease);
  border-radius: 999px;
}
.meter-fill.ok { background: var(--ok); }
.meter-fill.warn { background: var(--warn); }
.meter-fill.over { background: var(--danger); }
.meter-foot {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.meter-foot strong { font-weight: 700; }
.meter-foot.over strong { color: var(--danger); }
.meter-foot.warn strong { color: var(--warn); }
.meter-foot.ok strong { color: var(--ok); }

/* ===== Big number (収支スナップショット) ===== */
.kpi {
  display: flex; flex-direction: column; gap: 2px;
  padding: var(--space-3) 0;
}
.kpi-label { font-size: 12px; color: var(--text-muted); }
.kpi-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.kpi-value.danger { color: var(--danger); }
.kpi-sub { font-size: 12px; color: var(--text-muted); }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: var(--space-2);
}
.kpi-row .kpi { padding: 0; }
.kpi-row .kpi-value { font-size: 18px; }

/* ===== Inbox list ===== */
.inbox-row {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.inbox-row:last-child { border-bottom: 0; }
.inbox-row:hover { background: var(--surface-2); }
.inbox-row .ch-mark {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.inbox-row .ch-mark.airbnb { background: #FFE0E5; color: #C73954; }
.inbox-row .ch-mark.booking { background: #DDE6FA; color: #1F3D8E; }
.inbox-row .ch-mark.rakuten { background: #FBD7D7; color: #B71F1F; }
.inbox-row .ch-mark.jalan { background: #FCE6CC; color: #B66F1A; }
.inbox-row .body { flex: 1; min-width: 0; }
.inbox-row .meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.inbox-row .summary {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inbox-row .tail { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* ===== Timeline ===== */
.timeline { display: flex; flex-direction: column; gap: var(--space-2); }
.timeline-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.timeline-item .time {
  font-size: 13px; font-weight: 700; color: var(--text);
  min-width: 52px;
}
.timeline-item .label { font-size: 13px; flex: 1; }
.timeline-item .tag {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-muted);
}

/* ===== Turnover mini kanban ===== */
.turnover-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  background: var(--surface-2);
}
.turnover-card h4 {
  font-size: 14px; margin-bottom: 6px;
}
.lane-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 4px; margin: 8px 0;
  align-items: center;
}
.lane-step {
  font-size: 11px;
  padding: 6px 4px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
  text-align: center;
  border: 1px solid var(--border);
}
.lane-step.done { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-soft); }
.lane-step.current { background: var(--accent); color: #fff; border-color: var(--accent); animation: pulse 1.4s var(--ease) infinite; }

.verdict-bar {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 13px; font-weight: 600;
  border-radius: var(--radius-sm);
}

/* ===== Risk row ===== */
.risk-row {
  display: flex; gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}
.risk-row:last-child { border-bottom: 0; }
.risk-row .ico {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.risk-row .ico.danger { background: var(--danger-soft); color: var(--danger); }
.risk-row .ico.warn { background: var(--warn-soft); color: var(--warn); }
.risk-row .body { flex: 1; }
.risk-row .meta { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.risk-row .body p { font-size: 13px; margin-bottom: 4px; }
.risk-row .body .suggestion { font-size: 12px; color: var(--accent-strong); }

/* ===== Conversation view (M1) ===== */
.conv-wrap { display: flex; flex-direction: column; gap: var(--space-3); }
.bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble.guest {
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
}
.bubble.ai {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-top-right-radius: 4px;
}
.bubble.ai.draft {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border: 1px dashed var(--accent);
}
.bubble.note {
  align-self: stretch;
  background: var(--warn-soft);
  border: 1px solid var(--warn);
  color: var(--warn);
  font-size: 13px;
  text-align: center;
}

.bubble .ts { display: block; font-size: 10px; opacity: 0.7; margin-top: 4px; }

.typing-dots {
  display: inline-flex; gap: 4px;
  padding: 12px 16px;
  background: var(--accent-soft);
  border-radius: 16px;
  align-self: flex-end;
}
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  animation: dot 1.2s var(--ease) infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

.cursor-blink::after {
  content: '▌';
  margin-left: 2px;
  animation: blink 0.9s infinite;
}

.lang-tabs {
  display: flex; gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 26, 30, 0.5);
  z-index: 50;
  display: grid; place-items: center;
  padding: var(--space-4);
  animation: fade-in 200ms var(--ease);
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--space-5);
  animation: pop-in 280ms var(--ease);
}
.modal h3 { font-size: 18px; margin-bottom: var(--space-3); }
.modal-actions { display: flex; gap: 8px; margin-top: var(--space-4); justify-content: flex-end; }

/* ===== Toast ===== */
.toast-stack {
  position: fixed; bottom: 24px; left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; z-index: 60;
  pointer-events: none;
}
.toast {
  background: rgba(27, 32, 36, 0.92);
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  animation: toast-in 240ms var(--ease);
  pointer-events: auto;
}

/* ===== Spinner ===== */
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

/* ===== Damage photo grid ===== */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.photo-cell {
  position: relative;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #DDE2E6, #C4CCD2);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.photo-cell .label {
  position: absolute; left: 6px; bottom: 6px;
  font-size: 11px; color: #fff;
  background: rgba(0,0,0,0.42);
  padding: 2px 6px; border-radius: 4px;
}
.photo-cell .ai-tag {
  position: absolute; top: 6px; left: 6px;
  font-size: 11px;
  background: var(--warn);
  color: #fff;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 320ms var(--ease), transform 320ms var(--ease);
}
.photo-cell .ai-tag.show {
  opacity: 1;
  transform: translateY(0);
}
.photo-cell .icon-overlay {
  position: absolute;
  inset: 0;
  display: grid; place-items: center;
  color: rgba(255,255,255,0.7);
}
.photo-cell .icon-overlay svg { width: 32px; height: 32px; }

/* ===== Tour overlay ===== */
.tour-caption {
  position: fixed;
  left: 50%; bottom: 24px;
  transform: translateX(-50%);
  background: rgba(27, 32, 36, 0.92);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 55;
  max-width: 90vw;
  text-align: center;
  animation: slide-up 320ms var(--ease);
}
.tour-highlight {
  position: relative;
  z-index: 25;
  box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 6px var(--accent);
  border-radius: var(--radius);
  animation: highlight-pulse 1.4s var(--ease) infinite;
}

/* ===== Feedback (反応キャプチャ) ===== */
.feedback-card {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-top: var(--space-5);
}
.feedback-card h3 {
  color: var(--accent-strong);
  font-size: 16px;
  margin-bottom: var(--space-3);
}
.feedback-row {
  display: flex; flex-direction: column;
  gap: 8px;
  margin-bottom: var(--space-3);
}
.feedback-row label { font-size: 12px; color: var(--text-muted); }
.feedback-card .chip { background: var(--surface); }

/* ===== Chart wrapper ===== */
.chart-wrap {
  position: relative;
  height: 220px;
  margin-top: var(--space-3);
}

/* ===== Animations ===== */
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes dot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
@keyframes blink {
  50% { opacity: 0; }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(44, 140, 132, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(44, 140, 132, 0); }
}
@keyframes slide-up {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes highlight-pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 6px var(--accent); }
  50% { box-shadow: 0 0 0 6px var(--accent-soft), 0 0 0 10px rgba(44, 140, 132, 0.4); }
}

/* ===== View transitions ===== */
.view {
  animation: view-in 280ms var(--ease);
}
@keyframes view-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Small utilities ===== */
.row { display: flex; align-items: center; gap: var(--space-2); }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.muted { color: var(--text-muted); }
.danger { color: var(--danger); }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.small { font-size: 12px; }
.center { text-align: center; }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--border); margin: var(--space-3) 0; }

/* ===== Responsive (PC幅 ≥ 768px) ===== */
@media (min-width: 768px) {
  body { font-size: 16px; }
  main.app-main {
    padding: var(--space-5);
    max-width: 980px;
  }
  .hero-strip h1 { font-size: 20px; }
  /* PCはダッシュボードを2カラム */
  .dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
  }
  .dashboard-grid > .card { margin-bottom: 0; }
  .dashboard-grid > .full { grid-column: 1 / -1; }
}
