/* ══════════════════════════════════════════════════════════════════
   AgenticMarket — Design Tokens
   Reused verbatim from timepersonajp/public/design/tokens.css
   (single source of truth shared with TimePersona.jp.ai)
   ══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Surfaces (warm-tinted neutrals) */
  --bg:            #fafaf8;
  --surface:       #ffffff;
  --surface-alt:   #f5f5f2;
  --surface-sunk:  #ebebe6;
  --surface-raised:#f5f5f5;

  /* Text */
  --text:          #1c1b1a;
  --text-muted:    #6b6a67;
  --text-subtle:   #a3a19d;

  /* Borders */
  --border:        #e7e5e0;
  --border-strong: #d6d3cd;

  /* Brand (iris deep indigo) */
  --brand:         #3a3aa4;
  --brand-hover:   #2e2e8a;
  --brand-soft:    #eeeeff;
  --brand-ink:     #1f1f6b;

  /* Accent (.jp.ai superscript) */
  --accent:        #b45309;
  --accent-soft:   #fef3e8;

  /* Semantic */
  --success:       #15803d;
  --success-soft:  #ecfdf5;
  --warn:          #b45309;
  --warn-soft:     #fef3e8;
  --danger:        #b91c1c;
  --danger-soft:   #fef2f2;
  --info:          #1d4ed8;
  --info-soft:     #eff6ff;

  --font-sans:  "Inter", "Noto Sans JP", "Hiragino Kaku Gothic ProN",
                "Hiragino Sans", "Yu Gothic", -apple-system, BlinkMacSystemFont,
                "Segoe UI", sans-serif;
  --font-jp:    "Noto Sans JP", "Hiragino Kaku Gothic ProN",
                "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-mono:  "JetBrains Mono", "SF Mono", "Monaco", "Menlo", monospace;

  --fs-xs:   11px;
  --fs-sm:   13px;
  --fs-base: 14px;
  --fs-md:   15px;
  --fs-lg:   17px;
  --fs-xl:   20px;
  --fs-2xl:  26px;
  --fs-3xl:  34px;
  --fs-4xl:  44px;

  --lh-tight: 1.3;
  --lh-base:  1.55;
  --lh-loose: 1.75;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(28, 27, 26, 0.04);
  --shadow-sm: 0 2px 6px rgba(28, 27, 26, 0.06);
  --shadow-md: 0 6px 20px rgba(28, 27, 26, 0.08);

  --header-h: 56px;
  --bottom-nav-h: 56px;
  --container-narrow: 720px;
  --container-base:   900px;
  --container-wide:   1100px;

  --z-header: 50;
  --z-modal:  100;
  --z-toast:  200;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: calc(var(--bottom-nav-h) + var(--sp-4));
}
@media (min-width: 768px) {
  body { padding-bottom: var(--sp-8); }
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
input, textarea, select { font-family: inherit; }
::selection { background: var(--brand-soft); color: var(--brand-ink); }

/* ── HEADER ─────────────────────────────────────────────── */
.tp-header {
  position: sticky;
  top: 0;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-6);
  gap: var(--sp-4);
}
.tp-logo {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
}
.tp-logo:hover { text-decoration: none; opacity: 0.8; }
.tp-logo__mark { color: var(--text); }
.tp-logo__tld {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  margin-left: 2px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--accent-soft);
  letter-spacing: 0.02em;
  position: relative;
  top: -6px;
}
.tp-header__spacer { flex: 1; }
.tp-nav { display: none; align-items: center; gap: 2px; }
@media (min-width: 720px) { .tp-nav { display: flex; } }
.tp-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.tp-nav__link:hover { background: var(--surface-alt); color: var(--text); text-decoration: none; }
.tp-nav__link.is-active { color: var(--brand); background: var(--brand-soft); }

/* ── BOTTOM NAV (mobile) ────────────────────────────────── */
.tp-bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: var(--z-header);
}
@media (min-width: 720px) { .tp-bottom-nav { display: none; } }
.tp-bottom-nav__link {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 10px; font-weight: 500; color: var(--text-muted); text-decoration: none;
}
.tp-bottom-nav__link.is-active { color: var(--brand); }
.tp-bottom-nav__icon { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; line-height: 1; }

/* ── LAYOUT ─────────────────────────────────────────────── */
.tp-page { max-width: var(--container-base); margin: 0 auto; padding: var(--sp-8) var(--sp-5); }
.tp-page--narrow { max-width: var(--container-narrow); }
.tp-page--wide   { max-width: var(--container-wide); }

.tp-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--sp-5); }
.tp-breadcrumb a { color: var(--text-muted); }
.tp-breadcrumb a:hover { color: var(--brand); }
.tp-breadcrumb__sep { color: var(--text-subtle); }

.tp-h1 { font-size: var(--fs-3xl); font-weight: 800; line-height: 1.2; letter-spacing: -0.02em; color: var(--text); }
.tp-h2 { font-size: var(--fs-2xl); font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; color: var(--text); }
.tp-h3 { font-size: var(--fs-xl); font-weight: 700; line-height: 1.3; color: var(--text); }
.tp-h4 { font-size: var(--fs-lg); font-weight: 700; color: var(--text); }
.tp-muted { color: var(--text-muted); }
.tp-subtle { color: var(--text-subtle); }
.tp-mono { font-family: var(--font-mono); }

.tp-section-title { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); margin: var(--sp-8) 0 var(--sp-4); }
.tp-section-title__label { font-size: var(--fs-sm); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }

/* ── CARD ───────────────────────────────────────────────── */
.tp-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-6); }
.tp-card--hover { transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
.tp-card--hover:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }

/* ── BUTTONS ────────────────────────────────────────────── */
.tp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; font-family: inherit; font-size: var(--fs-base); font-weight: 600;
  line-height: 1; border-radius: var(--r-sm); border: 1px solid transparent;
  background: transparent; color: var(--text); cursor: pointer; text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s; white-space: nowrap;
}
.tp-btn:hover { text-decoration: none; }
.tp-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.tp-btn--primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.tp-btn--primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.tp-btn--secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.tp-btn--secondary:hover { background: var(--surface-alt); border-color: var(--text-muted); }
.tp-btn--ghost { background: transparent; color: var(--text-muted); }
.tp-btn--ghost:hover { background: var(--surface-alt); color: var(--text); }
.tp-btn--sm { padding: 6px 12px; font-size: var(--fs-sm); }
.tp-btn--lg { padding: 12px 24px; font-size: var(--fs-md); }
.tp-btn--block { width: 100%; }

/* ── BADGE / TAG ────────────────────────────────────────── */
.tp-badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.5; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); white-space: nowrap;
}
.tp-badge--brand   { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
.tp-badge--success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.tp-badge--warn    { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tp-badge--danger  { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.tp-badge--info    { background: var(--info-soft); color: var(--info); border-color: transparent; }
.tp-badge--persona { background: #f5f2ea; color: #6a4d16; border-color: #ddd4c0; }
.tp-badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }
.tp-tag { display: inline-flex; align-items: center; padding: 2px 8px; font-size: var(--fs-xs); color: var(--text-muted); background: var(--surface-alt); border-radius: var(--r-sm); font-weight: 500; }
.tp-tag::before { content: '#'; color: var(--text-subtle); margin-right: 1px; }

/* ── FORM ───────────────────────────────────────────────── */
.tp-field { margin-bottom: var(--sp-4); }
.tp-label { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--text); margin-bottom: 6px; }
.tp-input, .tp-textarea, .tp-select {
  width: 100%; padding: 10px 12px; font-family: inherit; font-size: var(--fs-base); color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tp-input:focus, .tp-textarea:focus, .tp-select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.tp-textarea { resize: vertical; min-height: 96px; line-height: var(--lh-base); }
.tp-help { margin-top: 6px; font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.5; }

/* ── AVATAR ─────────────────────────────────────────────── */
.tp-avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 50%; background: var(--surface-alt); color: var(--text); font-weight: 700; font-size: 15px;
  flex-shrink: 0; border: 1px solid var(--border); overflow: hidden;
}
.tp-avatar--sm { width: 28px; height: 28px; font-size: 12px; }
.tp-avatar--lg { width: 52px; height: 52px; font-size: 19px; }
.tp-avatar--brand { background: var(--brand); color: #fff; border-color: transparent; }

/* ── ALERT ──────────────────────────────────────────────── */
.tp-alert { padding: 12px 14px; border-radius: var(--r-sm); font-size: var(--fs-sm); line-height: 1.6; border: 1px solid; }
.tp-alert--success { background: var(--success-soft); border-color: #bbf7d0; color: var(--success); }
.tp-alert--warn    { background: var(--warn-soft); border-color: #fcd9a8; color: var(--warn); }
.tp-alert--danger  { background: var(--danger-soft); border-color: #fecaca; color: var(--danger); }
.tp-alert--info    { background: var(--info-soft); border-color: #bfdbfe; color: var(--info); }

/* ── EMPTY STATE ────────────────────────────────────────── */
.tp-empty { text-align: center; padding: var(--sp-12) var(--sp-5); color: var(--text-muted); }
.tp-empty__title { font-size: var(--fs-md); font-weight: 600; color: var(--text); margin-bottom: 4px; }
.tp-empty__desc { font-size: var(--fs-sm); }

/* ── FOOTER ─────────────────────────────────────────────── */
.tp-footer {
  margin-top: var(--sp-12); padding: var(--sp-6) var(--sp-5); border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-3);
  font-size: var(--fs-xs); color: var(--text-muted);
}
.tp-footer__links { display: flex; gap: var(--sp-5); flex-wrap: wrap; }
.tp-footer__links a { color: var(--text-muted); }
.tp-footer__links a:hover { color: var(--brand); }

/* ── UTILS ──────────────────────────────────────────────── */
.tp-row { display: flex; align-items: center; }
.tp-row-gap-2 { gap: var(--sp-2); } .tp-row-gap-3 { gap: var(--sp-3); } .tp-row-gap-4 { gap: var(--sp-4); }
.tp-flex-spacer { flex: 1; }
.tp-divider { height: 1px; background: var(--border); margin: var(--sp-5) 0; border: 0; }
.tp-hide-mobile { display: none; }
@media (min-width: 720px) { .tp-hide-mobile { display: initial; } .tp-hide-desktop { display: none; } }

/* ── MODAL ──────────────────────────────────────────────── */
.tp-modal-backdrop, .tp-modal-overlay {
  position: fixed; inset: 0; background: rgba(28, 27, 26, 0.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: var(--sp-4);
  z-index: var(--z-modal); animation: tp-fade 0.15s ease-out;
}
.tp-modal {
  background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--border);
  box-shadow: var(--shadow-md); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  animation: tp-rise 0.2s ease-out;
}
.tp-modal__header { padding: var(--sp-5) var(--sp-6); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.tp-modal__title { font-size: var(--fs-lg); font-weight: 700; }
.tp-modal__close { background: none; border: none; font-size: 20px; color: var(--text-muted); cursor: pointer; line-height: 1; padding: 4px; }
.tp-modal__body   { padding: var(--sp-6); }
.tp-modal__footer { padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: var(--sp-2); }
@keyframes tp-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes tp-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
