/* ============================================================
 * Patent Intern Copilot — Design Tokens (Color-Vision Safe)
 * 配色思想:
 *   - 赤・緑を排除し、ネイビー / 青 / 水色 / シルバー / 濃ピンク のみ
 *   - 状態は「色 + 形状 + アイコン + ラベル」で常に三重化
 *   - 背景は紙のような白〜ごく淡いシルバー
 *   - 法務ツールとしての品格は維持（派手さを抑える）
 * ============================================================ */

:root {
  /* Brand */
  --navy: #0F2747;            /* 深いネイビー (Primary) */
  --navy-2: #1B3D6B;
  --navy-soft: #E6ECF4;       /* 紙の上の藍 */

  --blue: #2E6BD6;            /* 青 (Action / Info) */
  --blue-2: #1E4FA8;
  --blue-soft: #DCE8FB;

  --sky: #5BAEDC;             /* 水色 (進行中・補助) */
  --sky-soft: #E1F1FA;

  --silver: #C9CED6;          /* シルバー (枠 / 未着手) */
  --silver-2: #A6ACB7;
  --silver-soft: #F2F4F7;

  --pink: #C8166C;            /* 濃いピンク (危険・差戻し・期限超過) */
  --pink-2: #9B0F53;
  --pink-soft: #FBE0EE;

  --gold: #B8860B;            /* 注意（黄系のみ。緑系は使わない） */
  --gold-soft: #F5EAC8;

  /* Semantic ※ 赤緑を使わず形状とアイコンで識別保証 */
  --c-primary: var(--navy);
  --c-primary-soft: var(--navy-soft);
  --c-primary-strong: #081A33;

  --c-accent: var(--pink);
  --c-accent-soft: var(--pink-soft);

  --c-info: var(--blue);
  --c-info-soft: var(--blue-soft);

  --c-progress: var(--sky);     /* 作業中 = 水色 */
  --c-progress-soft: var(--sky-soft);

  --c-warn: var(--gold);        /* 注意 = 金（黄） */
  --c-warn-soft: var(--gold-soft);

  --c-danger: var(--pink);      /* 危険 = 濃ピンク（赤の代替） */
  --c-danger-soft: var(--pink-soft);

  --c-approved: var(--navy);    /* 承認/完了 = ネイビー塗潰し（緑の代替） */
  --c-approved-soft: var(--navy-soft);

  /* Surfaces */
  --bg: #FFFFFF;                /* 背景は白 */
  --bg-2: #FAFBFC;              /* 微シルバー */
  --surface: #FFFFFF;
  --surface-2: var(--silver-soft);
  --border: #E4E7EC;
  --border-strong: var(--silver);

  /* Text */
  --text: #0F1B2D;
  --text-2: #4A5568;
  --text-muted: #8892A2;

  /* Typography */
  --font-jp: 'Noto Sans JP', system-ui, -apple-system, sans-serif;
  --font-en: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Spacing */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;

  /* Radius */
  --r-sm: 4px; --r-md: 8px; --r-lg: 12px; --r-pill: 999px;

  --shadow-1: 0 1px 2px rgba(15, 39, 71, 0.04);
  --shadow-2: 0 4px 16px rgba(15, 39, 71, 0.08);
  --shadow-card: 0 1px 0 rgba(15, 39, 71, 0.03);

  --topbar-h: 56px;
  --bottomtab-h: 64px;

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --d-micro: 150ms; --d-std: 250ms; --d-page: 400ms;
}

/* Dark mode はライト基調を維持しつつ、白を黒紺に */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0B1626;
    --bg-2: #0F1D33;
    --surface: #122443;
    --surface-2: #16294C;
    --border: #1E3458;
    --border-strong: #2A4574;
    --text: #E8EDF5;
    --text-2: #B5C0D2;
    --text-muted: #7E8CA3;
    --c-primary: #6FA0E6;
    --c-primary-soft: #1A2D52;
    --silver-soft: #16294C;
    --c-progress-soft: #16294C;
    --c-info-soft: #16294C;
    --c-warn-soft: #2E2614;
    --c-danger-soft: #3D0F25;
    --c-approved-soft: #1A2D52;
    --navy-soft: #1A2D52;
    --pink-soft: #3D0F25;
    --sky-soft: #16294C;
    --blue-soft: #16294C;
    --gold-soft: #2E2614;
  }
}

[data-theme='dark'] {
  --bg: #0B1626;
  --bg-2: #0F1D33;
  --surface: #122443;
  --surface-2: #16294C;
  --border: #1E3458;
  --border-strong: #2A4574;
  --text: #E8EDF5;
  --text-2: #B5C0D2;
  --text-muted: #7E8CA3;
  --c-primary: #6FA0E6;
  --c-primary-soft: #1A2D52;
  --c-approved: #6FA0E6;
  --silver-soft: #16294C;
  --navy-soft: #1A2D52;
  --pink-soft: #3D0F25;
  --sky-soft: #16294C;
  --blue-soft: #16294C;
  --gold-soft: #2E2614;
}

[data-theme='light'] {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
}

/* ----- Reset ----- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  font-family: var(--font-jp);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-feature-settings: "palt";
}
body {
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
button, input, textarea, select {
  font-family: inherit; font-size: inherit; color: inherit;
}
button { cursor: pointer; border: none; background: none; padding: 0; }
a { color: inherit; text-decoration: none; }
input, textarea { outline: none; }
ul, ol { padding: 0; margin: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ----- Typography ----- */
.t-display { font-size: 28px; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
.t-h1 { font-size: 20px; line-height: 1.3; font-weight: 700; }
.t-h2 { font-size: 17px; line-height: 1.4; font-weight: 600; }
.t-body { font-size: 15px; line-height: 1.6; font-weight: 400; }
.t-caption { font-size: 13px; line-height: 1.5; font-weight: 500; color: var(--text-2); }
.t-micro { font-size: 11px; line-height: 1.4; font-weight: 500; color: var(--text-muted); letter-spacing: 0.02em; }
.t-mono { font-family: var(--font-mono); }

/* ============================================================
 * Login screen
 * ============================================================ */
.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 0% 0%, var(--navy-soft) 0, transparent 35%),
    radial-gradient(circle at 100% 100%, var(--sky-soft) 0, transparent 40%);
}
.login__head {
  padding: var(--sp-6) var(--sp-5) var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.login__brand-mark {
  width: 44px; height: 44px;
  display: inline-block;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(15, 39, 71, 0.18));
}
.login__brand-text strong { font-size: 18px; font-weight: 700; color: var(--navy); display: block; line-height: 1.2; letter-spacing: -0.01em; }
.login__brand-text small { font-size: 11px; color: var(--text-muted); letter-spacing: 0.04em; }

.login__main {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: var(--sp-5);
  gap: var(--sp-5);
}
.login__hero {
  text-align: center;
  max-width: 520px;
}
.login__hero h1 {
  font-size: 28px; font-weight: 700; line-height: 1.3; margin: 0;
  color: var(--navy);
  letter-spacing: -0.01em;
}
.login__hero p {
  margin: 12px 0 0; font-size: 14px; color: var(--text-2); line-height: 1.7;
}

.login__panel {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-2);
}
.login__panel-title {
  font-size: 13px; font-weight: 600; color: var(--text-2);
  letter-spacing: 0.04em; text-transform: uppercase;
  margin-bottom: var(--sp-3);
  display: flex; align-items: center; gap: 8px;
}
.login__panel-title i { color: var(--blue); }

.account-card {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color var(--d-micro) var(--ease), background var(--d-micro) var(--ease), transform var(--d-micro) var(--ease);
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
}
.account-card:hover {
  border-color: var(--navy);
  background: var(--bg-2);
}
.account-card:active { transform: translateY(1px); }
.account-card__avatar {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
  flex-shrink: 0;
}
.account-card__avatar--intern-a { background: var(--blue-soft); color: var(--blue-2); }
.account-card__avatar--intern-b { background: var(--sky-soft); color: var(--navy); }
.account-card__avatar--intern-c { background: var(--silver-soft); color: var(--navy); }
.account-card__avatar--supervisor { background: var(--navy); color: #fff; }

.account-card__body { flex: 1; min-width: 0; }
.account-card__role {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--text-muted); text-transform: uppercase;
  margin-bottom: 2px;
}
.account-card__name { font-size: 15px; font-weight: 600; color: var(--text); }
.account-card__sub { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); margin-top: 2px; }
.account-card__arrow { color: var(--silver-2); font-size: 14px; }

.login__creds {
  margin-top: var(--sp-4);
  padding: var(--sp-3);
  background: var(--bg-2);
  border-radius: var(--r-md);
  border: 1px dashed var(--border-strong);
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.7;
}
.login__creds code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--surface);
  padding: 1px 6px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  color: var(--navy);
}

.login__divider {
  display: flex; align-items: center; gap: var(--sp-3);
  margin: var(--sp-4) 0 var(--sp-3);
  color: var(--text-muted);
  font-size: 11px; letter-spacing: 0.08em;
}
.login__divider::before, .login__divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.login__manual { display: grid; gap: var(--sp-3); }

.login__foot {
  padding: var(--sp-4) var(--sp-5);
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}

/* ============================================================
 * App Shell
 * ============================================================ */
.app {
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr var(--bottomtab-h);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
}

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--sp-3);
  height: var(--topbar-h);
  padding: 0 var(--sp-4);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar__back {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-md); color: var(--text-2);
}
.topbar__back:hover { background: var(--surface-2); }
.topbar__title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.topbar__title strong {
  font-size: 15px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar__title small {
  font-size: 11px; color: var(--text-muted); font-family: var(--font-mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar__right { display: flex; gap: var(--sp-2); align-items: center; }
.topbar__icon {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-md); color: var(--text-2); position: relative;
}
.topbar__icon:hover { background: var(--surface-2); }
.topbar__icon .badge-dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--pink);
  border: 1.5px solid var(--surface);
}

.main {
  overflow-y: auto;
  padding: var(--sp-4);
  padding-bottom: calc(var(--sp-7) + var(--sp-5));
  -webkit-overflow-scrolling: touch;
}

.bottomtab {
  position: sticky; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: var(--bottomtab-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomtab__item {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: 11px; font-weight: 500;
  position: relative;
  transition: color var(--d-micro) var(--ease);
  min-height: 44px;
}
.bottomtab__item i { font-size: 18px; }
.bottomtab__item.is-active { color: var(--navy); }
.bottomtab__item.is-active::before {
  content: ''; position: absolute; top: 0; left: 50%;
  transform: translateX(-50%);
  width: 32px; height: 2px;
  background: var(--navy);
  border-radius: 0 0 2px 2px;
}

/* AI FAB */
.ai-fab {
  position: fixed;
  right: var(--sp-4);
  bottom: calc(var(--bottomtab-h) + var(--sp-4) + env(safe-area-inset-bottom));
  z-index: 25;
  width: 56px; height: 56px;
  border-radius: var(--r-pill);
  background: var(--navy);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-2);
  transition: transform var(--d-micro) var(--ease);
}
.ai-fab:hover { transform: scale(1.05); }
.ai-fab i { font-size: 22px; }

/* ============================================================
 * Components
 * ============================================================ */

/* Button */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  padding: 10px 16px;
  border-radius: var(--r-md);
  font-size: 14px; font-weight: 600;
  min-height: 44px;
  transition: background var(--d-micro) var(--ease), border-color var(--d-micro) var(--ease);
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn--primary { background: var(--navy); color: #fff; }
.btn--primary:hover { background: var(--c-primary-strong); }
.btn--blue { background: var(--blue); color: #fff; }
.btn--blue:hover { background: var(--blue-2); }
.btn--outline { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn--outline:hover { background: var(--surface-2); border-color: var(--navy); }
.btn--ghost { background: transparent; color: var(--text); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--pink { background: var(--pink); color: #fff; }
.btn--pink:hover { background: var(--pink-2); }
.btn--approve { background: var(--navy); color: #fff; }   /* 承認は形（チェックアイコン）+ ネイビー */
.btn--approve:hover { background: var(--c-primary-strong); }
.btn--reject { background: #fff; color: var(--pink); border: 1.5px solid var(--pink); } /* 差戻しはピンクのアウトライン + ↩アイコン */
.btn--reject:hover { background: var(--pink-soft); }
.btn--sm { padding: 6px 10px; min-height: 32px; font-size: 13px; }
.btn--block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
  box-shadow: var(--shadow-card);
}
.card--clickable {
  cursor: pointer;
  transition: border-color var(--d-micro) var(--ease), background var(--d-micro) var(--ease);
}
.card--clickable:hover { border-color: var(--navy); }
.card__header {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}
.card__title { font-size: 15px; font-weight: 600; color: var(--text); flex: 1; }
.card__sub { font-size: 12px; color: var(--text-2); font-family: var(--font-mono); }
.card__row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.card__actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); flex-wrap: wrap; }
.card--accent { border-left: 3px solid var(--pink); }      /* 差戻し */
.card--info-accent { border-left: 3px solid var(--blue); } /* 情報 */

/* StatusDot — 色 + 形状 + 内側マークで識別保証 */
.status-dot {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  border: 1.5px solid transparent;
}
/* 未着手: 中空シルバー（○） */
.status-dot--todo {
  background: transparent;
  border-color: var(--silver-2);
}
/* 作業中: 水色塗潰し + 内側ドット（●） */
.status-dot--progress {
  background: var(--sky);
  border-color: var(--sky);
}
/* レビュー中: 半月のネイビー（◐） */
.status-dot--review,
.status-dot--review_requested {
  background: linear-gradient(90deg, var(--navy) 50%, transparent 50%);
  border-color: var(--navy);
}
/* 承認/完了: ネイビー塗潰し + 中央チェック相当のリング（■相当） */
.status-dot--approved,
.status-dot--done {
  background: var(--navy);
  border-color: var(--navy);
  box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 3px var(--navy);
}
/* 差戻し: 濃ピンク + 二重リング (◉) */
.status-dot--rejected {
  background: var(--pink);
  border-color: var(--pink);
  box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 3px var(--pink);
}
.status-dot-pair { display: inline-flex; gap: 3px; }

/* Badge */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  font-size: 12px; font-weight: 500;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.badge--navy { background: var(--navy-soft); color: var(--navy); border-color: transparent; }
.badge--blue { background: var(--blue-soft); color: var(--blue-2); border-color: transparent; }
.badge--sky { background: var(--sky-soft); color: var(--navy); border-color: transparent; }
.badge--pink { background: var(--pink-soft); color: var(--pink-2); border-color: transparent; }
.badge--gold { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.badge--silver { background: var(--silver-soft); color: var(--text-2); border-color: transparent; }
/* 互換 */
.badge--success { background: var(--navy-soft); color: var(--navy); border-color: transparent; }
.badge--warning { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.badge--danger { background: var(--pink-soft); color: var(--pink-2); border-color: transparent; }
.badge--info { background: var(--blue-soft); color: var(--blue-2); border-color: transparent; }
.badge--accent { background: var(--pink-soft); color: var(--pink-2); border-color: transparent; }

/* Deadline Badge */
.deadline {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500;
  font-family: var(--font-mono);
  color: var(--text-2);
}
.deadline--warm { color: var(--gold); }
.deadline--hot {
  color: var(--pink-2);
  font-weight: 600;
}
.deadline--hot::before {
  content: '\f06a'; /* fa-circle-exclamation */
  font-family: 'Font Awesome 6 Free'; font-weight: 900;
  margin-right: 2px;
}
.deadline i { font-size: 11px; }

/* Progress bar */
.progress {
  width: 100%; height: 4px;
  background: var(--surface-2);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  background: var(--blue);
  border-radius: inherit;
  transition: width var(--d-std) var(--ease);
}
.progress__bar--warn { background: var(--gold); }
.progress__bar--hot {
  background: repeating-linear-gradient(
    -45deg,
    var(--pink) 0 6px,
    var(--pink-2) 6px 12px
  );
}

/* Section header */
.section-h {
  display: flex; align-items: center; gap: var(--sp-2);
  margin: var(--sp-5) 0 var(--sp-3);
  font-size: 13px; font-weight: 600;
  color: var(--text-2);
}
.section-h:first-child { margin-top: 0; }
.section-h .count { color: var(--text-muted); font-weight: 400; }

/* Greeting */
.greeting { margin-bottom: var(--sp-5); }
.greeting__hello { font-size: 20px; font-weight: 700; color: var(--text); }
.greeting__sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }

/* Tabs */
.tabs {
  display: flex; gap: var(--sp-1);
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-4);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs__item {
  padding: 12px 14px;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  margin-bottom: -1px;
}
.tabs__item.is-active { color: var(--navy); border-bottom-color: var(--navy); }

/* AI Card */
.ai-card {
  background: var(--navy-soft);
  border: 1px solid transparent;
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  margin: var(--sp-3) 0;
}
.ai-card__head {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 12px; font-weight: 600;
  color: var(--navy);
  margin-bottom: var(--sp-2);
  letter-spacing: 0.02em;
}
.ai-card__head i { font-size: 13px; color: var(--blue); }

/* AI marker */
.ai-marker {
  border-left: 3px solid var(--blue);
  padding: var(--sp-2) var(--sp-3);
  margin: var(--sp-3) 0;
  background: var(--blue-soft);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}
.ai-marker__label {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600;
  color: var(--blue-2);
  margin-bottom: 4px;
  letter-spacing: 0.04em;
}
.ai-marker__actions { margin-top: var(--sp-2); display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* Citation chip */
.cite-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  font-size: 11px;
  background: var(--silver-soft);
  color: var(--navy);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  margin: 2px 4px 2px 0;
}

/* Form */
.field { margin-bottom: var(--sp-4); }
.field__label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: var(--sp-2); }
.input, .textarea, .select {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: 15px;
  min-height: 44px;
  transition: border-color var(--d-micro) var(--ease), box-shadow var(--d-micro) var(--ease);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.6; font-family: var(--font-jp); }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}
.field__hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Empty */
.empty {
  text-align: center;
  padding: var(--sp-7) var(--sp-4);
  color: var(--text-muted);
}
.empty i { font-size: 32px; margin-bottom: var(--sp-3); display: block; color: var(--silver); }

/* Sheet */
.sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 27, 45, 0.5);
  z-index: 50;
  opacity: 0; pointer-events: none;
  transition: opacity var(--d-std) var(--ease);
}
.sheet-overlay.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  max-height: 88vh;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform var(--d-std) var(--ease);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet.is-open { transform: translateY(0); }
.sheet__handle {
  width: 36px; height: 4px;
  background: var(--silver);
  border-radius: var(--r-pill);
  margin: 8px auto;
  flex-shrink: 0;
}
.sheet__head {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--sp-2);
}
.sheet__head h3 { font-size: 15px; font-weight: 600; flex: 1; margin: 0; }
.sheet__body { flex: 1; overflow-y: auto; padding: var(--sp-4); }
.sheet__foot { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); }

/* Chat */
.chat-msg { margin-bottom: var(--sp-4); display: flex; gap: var(--sp-2); }
.chat-msg__avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 13px; color: var(--text-2);
}
.chat-msg--ai .chat-msg__avatar { background: var(--navy); color: #fff; }
.chat-msg__body { flex: 1; font-size: 14px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.chat-msg__cites { margin-top: var(--sp-2); }

/* Score */
.score {
  text-align: center;
  padding: var(--sp-5) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-4);
}
.score__num { font-size: 44px; font-weight: 700; color: var(--navy); font-family: var(--font-en); letter-spacing: -0.02em; }
.score__total { font-size: 16px; color: var(--text-muted); }
.score__label { margin-top: var(--sp-2); font-size: 13px; }
.score__bar { width: 100%; height: 6px; background: var(--surface-2); border-radius: var(--r-pill); overflow: hidden; margin: var(--sp-3) 0; }
.score__bar > div { height: 100%; border-radius: inherit; transition: width var(--d-std) var(--ease); }

/* Check item — 形状アイコンで状態を識別 */
.check-item {
  display: flex; gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
}
.check-item:last-child { border-bottom: none; }
.check-item__icon {
  flex-shrink: 0; width: 24px;
  display: inline-flex; align-items: flex-start; justify-content: center;
  padding-top: 2px;
}
.check-item__icon i { font-size: 16px; }
/* OK = ネイビーのチェック（fa-circle-check） */
.check-item__icon--ok i { color: var(--navy); }
/* WARN = 金の三角（fa-triangle-exclamation） */
.check-item__icon--warn i { color: var(--gold); }
/* ERROR = 濃ピンクの×（fa-circle-xmark） */
.check-item__icon--err i { color: var(--pink); }
.check-item__body { flex: 1; }
.check-item__type { font-size: 13px; font-weight: 600; }
.check-item__msg { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.check-item__loc { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); margin-top: 2px; }

/* Diff — 赤緑を使わず、ネイビー系 vs 濃ピンク系で識別 */
.diff {
  font-family: var(--font-mono); font-size: 13px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  white-space: pre-wrap;
  margin: var(--sp-2) 0;
  line-height: 1.6;
}
.diff .add {
  background: var(--blue-soft);
  color: var(--blue-2);
  display: block; padding: 2px 6px;
  border-left: 3px solid var(--blue);
}
.diff .add::before { content: '+ '; font-weight: 700; }
.diff .del {
  background: var(--pink-soft);
  color: var(--pink-2);
  display: block; padding: 2px 6px;
  border-left: 3px solid var(--pink);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.diff .del::before { content: '− '; font-weight: 700; text-decoration: none; display: inline-block; }

/* Editor */
.editor {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  min-height: 60vh;
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-wrap;
  outline: none;
}
.editor:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }

.editor-toolbar {
  position: sticky;
  bottom: calc(var(--bottomtab-h) + var(--sp-3) + env(safe-area-inset-bottom));
  z-index: 20;
  display: flex; gap: var(--sp-1);
  padding: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  margin: var(--sp-3) auto 0;
  width: max-content; max-width: 100%;
  overflow-x: auto;
  box-shadow: var(--shadow-2);
}
.editor-toolbar button {
  padding: 6px 10px;
  border-radius: var(--r-pill);
  font-size: 13px; color: var(--text-2);
  white-space: nowrap;
}
.editor-toolbar button:hover { background: var(--surface-2); }
.editor-toolbar .ai { color: var(--blue); font-weight: 600; }

/* Toast */
.toast-host {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--bottomtab-h) + var(--sp-4) + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center;
  gap: var(--sp-2); z-index: 60;
  pointer-events: none; padding: 0 var(--sp-4);
}
.toast {
  pointer-events: auto;
  background: var(--text);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--r-pill);
  font-size: 13px; max-width: 90vw;
  animation: toastIn var(--d-std) var(--ease);
  box-shadow: var(--shadow-2);
}
@keyframes toastIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Halo (PII) */
.halo {
  box-shadow: 0 0 0 3px var(--blue-soft);
  border-color: var(--blue);
}

/* List */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.list__item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  min-height: 56px;
}
.list__item:last-child { border-bottom: none; }
.list__item i { color: var(--text-2); width: 20px; text-align: center; }
.list__item-body { flex: 1; min-width: 0; }
.list__item-title { font-size: 14px; font-weight: 500; }
.list__item-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Stub / Live pill */
.pill-stub { font-size: 11px; padding: 2px 8px; border-radius: var(--r-pill); background: var(--gold-soft); color: var(--gold); font-weight: 600; letter-spacing: 0.04em; }
.pill-live { font-size: 11px; padding: 2px 8px; border-radius: var(--r-pill); background: var(--blue-soft); color: var(--blue-2); font-weight: 600; letter-spacing: 0.04em; }

/* Layout helpers */
.row { display: flex; align-items: center; gap: var(--sp-3); }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: var(--sp-3); }
.muted { color: var(--text-muted); }
.text-2 { color: var(--text-2); }
.center { text-align: center; }

/* ============================================================
 * Responsive
 * ============================================================ */
@media (min-width: 641px) {
  .main { padding: var(--sp-5); padding-bottom: calc(var(--sp-7) + var(--sp-5)); max-width: 760px; margin: 0 auto; width: 100%; }
}

@media (min-width: 1025px) {
  .app {
    grid-template-columns: 240px 1fr 320px;
    grid-template-rows: var(--topbar-h) 1fr;
    grid-template-areas:
      "sidebar topbar topbar"
      "sidebar main aibar";
  }
  .topbar { grid-area: topbar; }
  .main {
    grid-area: main;
    max-width: none;
    padding: var(--sp-5) var(--sp-6);
    padding-bottom: var(--sp-6);
  }
  .bottomtab { display: none; }
  .ai-fab { display: none; }
  .sidebar {
    grid-area: sidebar;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: var(--sp-4);
    overflow-y: auto;
    display: flex; flex-direction: column;
  }
  .ai-bar {
    grid-area: aibar;
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex; flex-direction: column;
  }
}

@media (max-width: 1024px) {
  .sidebar, .ai-bar { display: none; }
}

.sidebar__brand {
  margin-bottom: var(--sp-5);
  display: flex; align-items: center; gap: var(--sp-2);
  color: var(--navy);
}
.sidebar__brand-mark {
  width: 32px; height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}
.sidebar__brand-text {
  display: flex; flex-direction: column; line-height: 1.15;
}
.sidebar__brand-text strong {
  font-size: 16px; font-weight: 700; color: var(--navy); letter-spacing: -0.01em;
}
.sidebar__brand-text small {
  font-size: 10px; color: var(--text-muted); letter-spacing: 0.04em; margin-top: 1px;
}
.sidebar__nav-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 10px 12px; border-radius: var(--r-md);
  color: var(--text-2);
  font-size: 14px; font-weight: 500;
  margin-bottom: 2px;
}
.sidebar__nav-item:hover { background: var(--surface-2); }
.sidebar__nav-item.is-active { background: var(--navy-soft); color: var(--navy); }
.sidebar__nav-item i { width: 18px; text-align: center; }

.sidebar__user {
  margin-top: auto;
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: var(--surface-2);
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 12px;
}
.sidebar__user-avatar {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  background: var(--navy);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}

.ai-bar__head {
  padding: var(--sp-4);
  border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 14px;
  display: flex; align-items: center; gap: var(--sp-2);
}
.ai-bar__body { flex: 1; overflow-y: auto; padding: var(--sp-4); }
.ai-bar__foot { border-top: 1px solid var(--border); padding: var(--sp-3); }

/* Toggle (PII) */
.toggle { position: relative; width: 44px; height: 26px; display: inline-block; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle__track {
  position: absolute; inset: 0;
  background: var(--silver);
  border-radius: 999px;
  transition: background 200ms;
}
.toggle__thumb {
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: white; border-radius: 50%;
  transition: left 200ms;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle__track { background: var(--blue); }
.toggle input:checked + .toggle__track + .toggle__thumb,
.toggle input:checked ~ .toggle__thumb { left: 21px; }

/* ============================================================
 * v0.4.0 — 拡張機能用 Components
 * ============================================================ */

/* ----- Command Palette (⌘K) ----- */
.cmdk-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 27, 45, 0.55);
  backdrop-filter: blur(2px);
  z-index: 70;
  opacity: 0; pointer-events: none;
  transition: opacity 200ms var(--ease);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh;
}
.cmdk-overlay.is-open { opacity: 1; pointer-events: auto; }
.cmdk {
  width: min(640px, calc(100% - 32px));
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 48px rgba(15, 39, 71, 0.25);
  border: 1px solid var(--border);
  transform: translateY(-12px) scale(0.98);
  opacity: 0;
  transition: transform 200ms var(--ease), opacity 200ms var(--ease);
  overflow: hidden;
}
.cmdk-overlay.is-open .cmdk { transform: translateY(0) scale(1); opacity: 1; }
.cmdk__head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.cmdk__head i { color: var(--text-muted); }
.cmdk__input {
  flex: 1; border: none; outline: none;
  font-size: 16px; font-family: inherit;
  background: transparent; color: var(--text);
}
.cmdk__kbd {
  font-family: var(--font-mono); font-size: 11px;
  background: var(--surface-2);
  padding: 2px 6px; border-radius: 4px;
  color: var(--text-muted); border: 1px solid var(--border);
}
.cmdk__list { max-height: 50vh; overflow-y: auto; padding: 8px; }
.cmdk__group-title {
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 10px 8px 6px;
}
.cmdk__item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 14px;
  transition: background 100ms;
}
.cmdk__item:hover, .cmdk__item.is-focused {
  background: var(--navy-soft);
}
.cmdk__item-icon {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--navy);
  flex-shrink: 0;
}
.cmdk__item-body { flex: 1; min-width: 0; }
.cmdk__item-title { font-weight: 500; }
.cmdk__item-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.cmdk__foot {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-muted);
  background: var(--bg-2);
}
.cmdk__foot span { display: inline-flex; align-items: center; gap: 4px; }

/* ----- Gantt Chart ----- */
.gantt {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: var(--sp-4);
}
.gantt__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.gantt__title {
  font-weight: 600; font-size: 14px;
  display: flex; align-items: center; gap: 8px;
}
.gantt__legend {
  display: flex; gap: 12px;
  font-size: 11px; color: var(--text-2);
}
.gantt__legend i {
  display: inline-block; width: 12px; height: 8px;
  border-radius: 2px; margin-right: 4px;
  vertical-align: middle;
}
.gantt__scroll { overflow-x: auto; }
.gantt__grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  min-width: 100%;
  position: relative;
}
.gantt__col-header {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 8px 12px;
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  position: sticky; left: 0; z-index: 2;
}
.gantt__date-row {
  display: flex;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.gantt__date-cell {
  flex: 0 0 32px;
  text-align: center;
  padding: 6px 0;
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  border-right: 1px solid var(--border);
}
.gantt__date-cell--weekend { background: var(--silver-soft); }
.gantt__date-cell--today {
  background: var(--blue-soft);
  color: var(--blue-2);
  font-weight: 700;
}
.gantt__date-cell-month {
  font-size: 9px;
  display: block;
  color: var(--text-muted);
}
.gantt__row-label {
  padding: 12px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  background: var(--surface);
  position: sticky; left: 0; z-index: 1;
  min-height: 56px;
}
.gantt__row-label-text { flex: 1; min-width: 0; }
.gantt__row-label-title {
  font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gantt__row-label-sub {
  font-size: 11px; color: var(--text-muted);
  font-family: var(--font-mono);
}
.gantt__track {
  position: relative;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  min-height: 56px;
}
.gantt__track-bg {
  position: absolute; inset: 0;
  display: flex;
  pointer-events: none;
}
.gantt__track-bg-cell {
  flex: 0 0 32px;
  border-right: 1px solid var(--border);
}
.gantt__track-bg-cell--weekend { background: var(--silver-soft); }
.gantt__track-bg-cell--today {
  background: var(--blue-soft);
}
.gantt__bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 24px;
  border-radius: var(--r-pill);
  display: flex; align-items: center;
  padding: 0 10px;
  font-size: 11px; font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  transition: filter 150ms, transform 150ms;
  box-shadow: 0 1px 3px rgba(15, 39, 71, 0.2);
}
.gantt__bar:hover { filter: brightness(1.1); transform: translateY(-50%) scale(1.02); }
.gantt__bar--blue { background: linear-gradient(135deg, var(--blue) 0%, var(--blue-2) 100%); }
.gantt__bar--sky { background: linear-gradient(135deg, var(--sky) 0%, var(--blue) 100%); color: #fff; }
.gantt__bar--navy { background: linear-gradient(135deg, var(--navy-2) 0%, var(--navy) 100%); }
.gantt__bar--pink {
  background: repeating-linear-gradient(45deg, var(--pink) 0 8px, var(--pink-2) 8px 16px);
}
.gantt__bar--silver { background: var(--silver-2); color: var(--text); }
.gantt__bar-progress {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.25);
  border-radius: inherit;
}
.gantt__bar-icon { margin-right: 4px; }
.gantt__deadline-marker {
  position: absolute;
  top: 4px; bottom: 4px;
  width: 2px;
  background: var(--pink);
  z-index: 3;
}
.gantt__deadline-marker::before {
  content: '';
  position: absolute; top: -2px; left: -4px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--pink);
}
.gantt__today-line {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--blue);
  z-index: 3;
  pointer-events: none;
}

/* ----- Heatmap (期限ヒートマップ) ----- */
.heatmap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20px, 1fr));
  gap: 3px;
  padding: var(--sp-3);
}
.heatmap__cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--silver-soft);
  position: relative;
  cursor: pointer;
}
.heatmap__cell[data-load="1"] { background: var(--sky-soft); }
.heatmap__cell[data-load="2"] { background: var(--sky); }
.heatmap__cell[data-load="3"] { background: var(--blue); }
.heatmap__cell[data-load="4"] {
  background: repeating-linear-gradient(45deg, var(--pink) 0 4px, var(--pink-2) 4px 8px);
}
.heatmap__cell--today {
  outline: 2px solid var(--navy);
  outline-offset: 1px;
  z-index: 2;
}
.heatmap__cell:hover {
  transform: scale(1.4);
  z-index: 3;
  box-shadow: 0 4px 12px rgba(15, 39, 71, 0.2);
  transition: transform 150ms;
}
.heatmap__cell-tip {
  position: absolute;
  bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 150ms;
  z-index: 10;
}
.heatmap__cell:hover .heatmap__cell-tip { opacity: 1; }
.heatmap__legend {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-muted);
  padding: 4px 12px 12px;
}
.heatmap__legend-cell {
  width: 12px; height: 12px;
  border-radius: 2px;
}

/* ----- Timer (工数記録) ----- */
.timer-card {
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue-2) 100%);
  color: #fff;
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
  position: relative;
  overflow: hidden;
}
.timer-card::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(91, 174, 220, 0.3) 0%, transparent 60%);
  pointer-events: none;
}
.timer-card__head {
  display: flex; align-items: center; justify-content: space-between;
  position: relative; z-index: 1;
}
.timer-card__label {
  font-size: 12px; opacity: 0.85;
  letter-spacing: 0.04em;
}
.timer-card__display {
  font-family: var(--font-mono);
  font-size: 36px; font-weight: 700;
  letter-spacing: -0.02em;
  margin: 8px 0;
  position: relative; z-index: 1;
  font-variant-numeric: tabular-nums;
}
.timer-card__display--running .timer-card__pulse {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--sky);
  margin-right: 8px;
  animation: pulse 1.6s infinite;
  vertical-align: middle;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}
.timer-card__matter {
  font-size: 13px; opacity: 0.9;
  position: relative; z-index: 1;
  margin-bottom: 12px;
}
.timer-card__actions {
  display: flex; gap: 8px;
  position: relative; z-index: 1;
}
.timer-card__btn {
  flex: 1;
  padding: 10px 12px;
  border-radius: var(--r-md);
  font-weight: 600; font-size: 13px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  transition: background 150ms;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.timer-card__btn:hover { background: rgba(255, 255, 255, 0.28); }
.timer-card__btn--stop { background: var(--pink); border-color: var(--pink); }
.timer-card__btn--stop:hover { background: var(--pink-2); }

.time-entry {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.time-entry:last-child { border-bottom: none; }
.time-entry__dur {
  font-family: var(--font-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 56px;
  text-align: right;
  color: var(--navy);
}
.time-entry__body { flex: 1; min-width: 0; }
.time-entry__title {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.time-entry__sub {
  font-size: 11px; color: var(--text-muted);
}
.time-entry__icon {
  color: var(--blue);
}

/* ----- KPI Dashboard ----- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: var(--sp-4);
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}
.kpi-card__label {
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.kpi-card__value {
  font-size: 28px; font-weight: 700;
  color: var(--navy);
  font-family: var(--font-en);
  letter-spacing: -0.02em;
  margin-top: 4px;
  display: flex; align-items: baseline; gap: 4px;
  line-height: 1.2;
}
.kpi-card__unit {
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
}
.kpi-card__delta {
  font-size: 11px; font-weight: 600;
  margin-top: 4px;
  display: inline-flex; align-items: center; gap: 3px;
}
.kpi-card__delta--up { color: var(--blue-2); }
.kpi-card__delta--down { color: var(--pink-2); }
.kpi-card__spark {
  position: absolute;
  right: 12px; bottom: 8px;
  width: 56px; height: 24px;
  pointer-events: none;
  opacity: 0.6;
}

/* ----- Sparkline ----- */
.sparkline { width: 100%; height: 100%; }
.sparkline__path { fill: none; stroke: var(--blue); stroke-width: 1.5; }
.sparkline__area { fill: var(--blue-soft); }

/* ----- Wizard ----- */
.wizard-steps {
  display: flex; align-items: center;
  gap: 8px;
  margin-bottom: var(--sp-4);
  overflow-x: auto;
  padding: 4px 0;
}
.wizard-step {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  background: var(--surface-2);
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.wizard-step.is-active {
  background: var(--navy);
  color: #fff;
}
.wizard-step.is-done {
  background: var(--navy-soft);
  color: var(--navy);
}
.wizard-step__num {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
}
.wizard-step.is-done .wizard-step__num {
  background: var(--navy);
  color: #fff;
}
.wizard-step:not(.is-active):not(.is-done) .wizard-step__num {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}
.wizard-step + .wizard-step::before {
  content: '';
  width: 12px; height: 1px;
  background: var(--border-strong);
  margin-right: -2px; margin-left: -2px;
  flex-shrink: 0;
}

/* ----- Drop zone (拒絶理由通知 アップロード) ----- */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: var(--sp-7) var(--sp-4);
  text-align: center;
  background: var(--bg-2);
  transition: border-color 150ms, background 150ms;
  cursor: pointer;
}
.dropzone:hover, .dropzone.is-drag {
  border-color: var(--blue);
  background: var(--blue-soft);
}
.dropzone__icon {
  font-size: 32px;
  color: var(--silver-2);
  margin-bottom: 12px;
}
.dropzone:hover .dropzone__icon, .dropzone.is-drag .dropzone__icon { color: var(--blue); }

/* ----- Issue extraction result ----- */
.issue-card {
  border-left: 3px solid var(--gold);
  background: var(--surface);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: 12px 14px;
  margin-bottom: 10px;
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.issue-card--high { border-left-color: var(--pink); }
.issue-card--mid { border-left-color: var(--gold); }
.issue-card--low { border-left-color: var(--sky); }
.issue-card__head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.issue-card__law {
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 700;
  background: var(--navy-soft);
  color: var(--navy);
  padding: 2px 6px; border-radius: 4px;
}
.issue-card__sev {
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: var(--r-pill);
  letter-spacing: 0.04em;
}
.issue-card__sev--high { background: var(--pink-soft); color: var(--pink-2); }
.issue-card__sev--mid { background: var(--gold-soft); color: var(--gold); }
.issue-card__sev--low { background: var(--sky-soft); color: var(--navy); }
.issue-card__detail {
  font-size: 13px; color: var(--text-2);
  margin-top: 6px; line-height: 1.65;
}
.issue-card__action {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--blue-soft);
  border-radius: var(--r-md);
  font-size: 12px;
  color: var(--blue-2);
  display: flex; gap: 6px;
}
.issue-card__action i { color: var(--blue); flex-shrink: 0; margin-top: 2px; }

/* ----- Audit Log ----- */
.audit-log {
  border-left: 2px solid var(--border-strong);
  margin-left: 12px;
  padding-left: 16px;
  position: relative;
}
.audit-entry {
  position: relative;
  margin-bottom: var(--sp-3);
  padding-bottom: 4px;
}
.audit-entry::before {
  content: '';
  position: absolute;
  left: -22px; top: 4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--silver-2);
}
.audit-entry--ai::before { border-color: var(--blue); background: var(--blue-soft); }
.audit-entry--review::before { border-color: var(--navy); background: var(--navy); }
.audit-entry--reject::before { border-color: var(--pink); background: var(--pink); }
.audit-entry--approve::before {
  border-color: var(--navy);
  background: var(--navy);
  box-shadow: inset 0 0 0 2px #fff;
}
.audit-entry--edit::before { border-color: var(--sky); background: var(--sky); }
.audit-entry__time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.audit-entry__title {
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}
.audit-entry__by {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 2px;
}
.audit-entry__detail {
  font-size: 12px;
  color: var(--text-2);
  background: var(--bg-2);
  padding: 6px 10px;
  border-radius: var(--r-md);
  margin-top: 6px;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  word-break: break-word;
}

/* ----- Swipe-to-approve card ----- */
.swipe-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-3);
  background: var(--bg-2);
}
.swipe-wrapper__bg {
  position: absolute; inset: 0;
  display: flex; align-items: center;
  padding: 0 24px;
  font-weight: 700; font-size: 14px;
  z-index: 0;
}
.swipe-wrapper__bg--left {
  background: var(--navy);
  color: #fff;
  justify-content: flex-start;
}
.swipe-wrapper__bg--right {
  background: var(--pink);
  color: #fff;
  justify-content: flex-end;
}
.swipe-wrapper__bg-icon { font-size: 18px; margin: 0 8px; }
.swipe-wrapper__card {
  position: relative;
  z-index: 1;
  background: var(--surface);
  transform: translateX(0);
  transition: transform 250ms var(--ease);
  touch-action: pan-y;
}
.swipe-wrapper.is-swiping .swipe-wrapper__card {
  transition: none;
}

/* ----- Tooltip ----- */
.tip { position: relative; }
.tip:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 5;
}

/* ----- Pill kbd shortcuts ----- */
kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text-2);
}

/* ----- Confetti / Celebration micro ----- */
.celebrate {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  overflow: hidden;
}
.celebrate__piece {
  position: absolute;
  width: 8px; height: 12px;
  top: -20px;
  animation: confetti 2200ms cubic-bezier(0.2, 0.6, 0.4, 1) forwards;
}
@keyframes confetti {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(540deg); opacity: 0.4; }
}

/* ----- Floating action sub-fab ----- */
.fab-stack {
  position: fixed;
  right: var(--sp-4);
  bottom: calc(var(--bottomtab-h) + var(--sp-4) + 76px + env(safe-area-inset-bottom));
  z-index: 24;
  display: flex; flex-direction: column; gap: 8px;
  align-items: flex-end;
  pointer-events: none;
  opacity: 0; transform: translateY(8px);
  transition: opacity 200ms, transform 200ms;
}
.fab-stack.is-open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.fab-stack__item {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 8px 14px 8px 8px;
  font-size: 13px; font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow-2);
}
.fab-stack__item i {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
}

/* ----- KBD hint floating ----- */
.kbd-hint {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 5;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
  box-shadow: var(--shadow-card);
}
@media (max-width: 1024px) { .kbd-hint { display: none; } }

/* ----- Doc generator wizard textarea ----- */
.gen-wizard__hero {
  text-align: center;
  padding: var(--sp-4) var(--sp-3);
}
.gen-wizard__hero i {
  font-size: 36px;
  color: var(--blue);
  margin-bottom: 8px;
}
.gen-wizard__hero h2 {
  font-size: 18px; font-weight: 700;
  margin: 0 0 4px;
}
.gen-wizard__hero p {
  font-size: 13px; color: var(--text-2);
  margin: 0;
}

/* ----- Choice tile ----- */
.choice-tile {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  text-align: left; width: 100%;
  margin-bottom: 8px;
  transition: border-color 150ms, background 150ms;
}
.choice-tile:hover { border-color: var(--navy); background: var(--bg-2); }
.choice-tile__icon {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: var(--navy-soft);
  color: var(--navy);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.choice-tile__body { flex: 1; min-width: 0; }
.choice-tile__title { font-weight: 600; font-size: 14px; }
.choice-tile__sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* ----- Tag pill (filter) ----- */
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filter-pill {
  padding: 6px 12px;
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 500;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid transparent;
  transition: all 150ms;
}
.filter-pill:hover { background: var(--navy-soft); }
.filter-pill.is-active {
  background: var(--navy);
  color: #fff;
}

/* ----- Citation result ----- */
.cite-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex; gap: 10px;
}
.cite-card__icon {
  width: 32px; height: 32px;
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--blue-soft);
  color: var(--blue-2);
  flex-shrink: 0;
}
.cite-card__icon--judgment { background: var(--gold-soft); color: var(--gold); }
.cite-card__icon--decision { background: var(--gold-soft); color: var(--gold); }
.cite-card__icon--knowhow { background: var(--sky-soft); color: var(--navy); }
.cite-card__body { flex: 1; min-width: 0; }
.cite-card__title { font-weight: 600; font-size: 13px; }
.cite-card__snippet { font-size: 12px; color: var(--text-2); margin-top: 4px; line-height: 1.5; }
.cite-card__score {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-muted);
}
