.user-detail-links {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
  color: #7a8ab0;
}
.user-detail-links a {
  color: #7a8ab0;
  text-decoration: underline;
  margin: 0 4px;
  transition: color 0.13s;
}
.user-detail-links a:hover {
  color: #533afd;
}
/* ユーザー詳細モーダル */
/* 左下バッジ直上に出すポップオーバー型モーダル */
.user-detail-modal.user-detail-modal-popover {
  position: absolute;
  width: auto;
  height: auto;
  background: none;
  box-shadow: none;
  z-index: 10010;
}
.user-detail-modal-popover .user-detail-modal-content {
  position: static;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 6px 32px rgba(60,80,120,0.18);
  padding: 24px 24px 18px 24px;
  min-width: 240px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
}
.user-detail-modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  font-size: 22px;
  color: #8a9ab8;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.user-detail-modal-main {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.user-detail-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #c8d9f0;
}
.user-detail-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.user-detail-name {
  font-size: 15px;
  font-weight: 700;
  color: #1a2a4a;
}
.user-detail-email {
  font-size: 13px;
  color: #6a7ea8;
}
.user-detail-logout-btn {
  display: block;
  margin-top: 10px;
  padding: 7px 0;
  width: 100%;
  background: #f5f7fb;
  color: #c0392b;
  border-radius: 8px;
  text-align: center;
  font-weight: 600;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.13s, color 0.13s;
}
.user-detail-logout-btn:hover {
  background: #ffeaea;
  color: #a93226;
}
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700&family=Source+Code+Pro:wght@500;700&display=swap');

:root {
  --bg: #f5f7fb;
  --sidebar: #eef2f8;
  --panel: #ffffff;
  --panel-soft: #f7f9fd;
  --line: #d9e1ef;
  --text: #1f2a3d;
  --muted: #5f6f86;
  --accent: #7ea9e1;
  --accent-2: #5e8fcf;
  --danger: #c35a5a;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 0% 0%, #e8f0ff, transparent 42%), var(--bg);
  color: var(--text);
  font-family: 'Noto Sans JP', sans-serif;
}



/* ── App shell: sidebar + main grid ── */
.app-shell {
  display: grid;
  grid-template-columns: 272px 1fr;
  min-height: 100vh;
  align-items: stretch;
  transition: grid-template-columns 0.25s cubic-bezier(.4,0,.2,1);
}

/* Desktop closed: collapse sidebar column */
.app-shell.sidebar-closed {
  grid-template-columns: 0 1fr;
}
.app-shell.sidebar-closed .sidebar {
  width: 0;
  min-width: 0;
  padding: 0;
  border: none;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* ── Sidebar toggle button (always visible in workspace-head) ── */
.sidebar-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}
.sidebar-toggle:hover {
  background: var(--line);
}


.sidebar {
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  padding: 18px 14px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden auto;
  width: 272px;
  min-width: 272px;
  transition: width 0.25s cubic-bezier(.4,0,.2,1), min-width 0.25s cubic-bezier(.4,0,.2,1), opacity 0.25s cubic-bezier(.4,0,.2,1), padding 0.25s cubic-bezier(.4,0,.2,1);
  box-sizing: border-box;
}

.brand-logo {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.5px;
  line-height: 1;
}

.logo-map {
  font-weight: 300;
  color: var(--text);
}

.logo-to {
  font-weight: 700;
  color: var(--accent-2);
}

.logo-list {
  font-weight: 700;
  color: var(--text);
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.menu {
  display: grid;
  gap: 6px;
  align-content: start;
  grid-auto-rows: min-content;
}

.menu-item {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  text-align: left;
  border-radius: 10px;
  padding: 11px 10px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.12s, border-color 0.12s;
  box-shadow: none;
}

.menu-item:hover {
  background: #dde6f5;
  border-color: #c8d9f0;
}

.menu-item:active {
  background: #cdd8ee;
}

.menu-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.menu-item.active {
  background: linear-gradient(135deg, #dfe9fb, #e9f1ff);
  border-color: #bdd0ee;
  font-weight: 600;
}

.sidebar-foot {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--muted);
  font-size: 12px;
}


/* シンプルなユーザーバッジ用 */
.user-card.simple-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #eef3fb;
  border-radius: 12px;
  margin-bottom: 10px;
}
.user-card.simple-user-card .user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid #c8d9f0;
}
.user-card.simple-user-card .user-name {
  font-size: 13px;
  font-weight: 600;
  color: #1a2a4a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.workspace-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: transparent;
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

.view {
  display: none;
  padding: 20px;
  min-width: 0;
}

.view.active {
  display: block;
}

#view-import {
  display: none;
  padding: 0;
  flex: 1;
}

#view-import.active {
  display: flex;
  flex-direction: column;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  padding: 16px;
}

.panel h3 {
  margin: 0 0 12px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  align-items: end;
}

.inline-actions {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 240px repeat(2, minmax(160px, 220px));
  gap: 10px;
  align-items: end;
}

.status-tabs {
  margin: 6px 0 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-tab.active {
  background: #c8dcf8;
  color: #1e3f74;
  box-shadow: 0 0 0 1px #a7c6f0 inset;
}

label {
  display: grid;
  gap: 5px;
  font-size: 13px;
  color: var(--muted);
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  padding: 10px;
}

button {
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(100, 150, 220, 0.30);
  transition: filter 0.15s, box-shadow 0.15s, transform 0.1s;
  user-select: none;
}

button:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 12px rgba(100, 150, 220, 0.45);
  transform: translateY(-1px);
}

button:active {
  filter: brightness(0.94);
  box-shadow: 0 1px 3px rgba(100, 150, 220, 0.25);
  transform: translateY(0);
}

button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
  transform: none;
  box-shadow: none;
}

button.ghost {
  background: #dbe7f8;
  color: #2c405f;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

button.ghost:hover {
  background: #ccddf5;
  box-shadow: 0 3px 8px rgba(0,0,0,0.13);
}

.chat-surface {
  min-height: 72vh;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #f8fbff, #f1f6ff);
  padding: 14px;
  overflow: auto;
  display: grid;
  gap: 10px;
}

.chat-item {
  max-width: 80%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
}

.chat-item.system {
  background: #e9f0fb;
  justify-self: start;
}

.chat-item.user {
  background: #d9e8ff;
  justify-self: end;
}

.table-wrap {
  overflow: auto;
  border: 1px solid #cfdbee;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: inset 0 1px 0 #f8fbff;
  max-width: 100%;
}

#view-leads #filter-form {
  margin-bottom: 14px;
}

.export-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

#export-result {
  margin: 0;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 980px;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid #e6edf8;
  padding: 10px 11px;
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

#lead-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, #f4f8ff, #edf4ff);
  color: #334766;
  font-weight: 700;
  white-space: nowrap;
}

#lead-table thead th.sortable {
  cursor: pointer;
  user-select: none;
}

#lead-table thead th.sortable:hover {
  background: linear-gradient(180deg, #eaf3ff, #e3eeff);
}

#lead-table .sort-indicator {
  display: inline-block;
  margin-left: 6px;
  width: 12px;
  color: #8ba0c2;
}

#lead-table thead th.sorted-asc .sort-indicator::before {
  content: "▲";
  font-size: 10px;
  color: #2f5fa7;
}

#lead-table thead th.sorted-desc .sort-indicator::before {
  content: "▼";
  font-size: 10px;
  color: #2f5fa7;
}

#lead-table tbody tr:nth-child(even) {
  background: #fbfdff;
}

#lead-table tbody tr:hover {
  background: #eef5ff;
}

#lead-table a {
  color: #2e5fa8;
  text-decoration: none;
  font-weight: 600;
}

#lead-table a:hover {
  text-decoration: underline;
}

#lead-table th:nth-child(1),
#lead-table td:nth-child(1) {
  width: 42px;
  text-align: center;
}

#lead-table th:nth-child(2),
#lead-table td:nth-child(2) {
  width: 210px;
}

#lead-table th:nth-child(3),
#lead-table td:nth-child(3) {
  width: 92px;
}

#lead-table th:nth-child(4),
#lead-table td:nth-child(4) {
  width: 92px;
}

#lead-table th:nth-child(5),
#lead-table td:nth-child(5) {
  width: 210px;
}

#lead-table th:nth-child(6),
#lead-table td:nth-child(6),
#lead-table th:nth-child(7),
#lead-table td:nth-child(7) {
  width: 92px;
}

#lead-table th:nth-child(8),
#lead-table td:nth-child(8) {
  width: 70px;
  text-align: center;
  white-space: nowrap;
  padding-left: 6px;
  padding-right: 6px;
}

#lead-table th:nth-child(9),
#lead-table td:nth-child(9) {
  width: 78px;
  text-align: center;
  white-space: nowrap;
  padding-left: 6px;
  padding-right: 6px;
}

#lead-table th:nth-child(10),
#lead-table td:nth-child(10) {
  width: 120px;
}

#lead-table th:nth-child(11),
#lead-table td:nth-child(11) {
  width: 120px;
}

#lead-table th:nth-child(12),
#lead-table td:nth-child(12) {
  width: 100px;
}

.contact-forms-2col {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 24px;
  align-items: start;
}

.contact-forms-proposal-col .proposal-builder {
  position: sticky;
  top: 16px;
}

@media (max-width: 1100px) {
  .contact-forms-2col {
    grid-template-columns: minmax(0, 1fr);
  }
  .contact-forms-list-col,
  .contact-forms-proposal-col {
    min-width: 0;
  }
  .contact-forms-proposal-col .proposal-builder {
    position: static;
  }
}

.proposal-builder {
  margin: 0;
  padding: 16px;
  border: 1px solid #d9e4f3;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff, #f3f8ff);
}

.proposal-builder-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

.proposal-builder-head h4 {
  margin: 0 0 6px;
  font-size: 16px;
}

.proposal-builder-head .muted {
  margin: 0;
}

#proposal-generator-form {
  width: 100%;
  grid-template-columns: 1fr;
  align-items: start;
}

#proposal-generator-form > label {
  min-width: 0;
}

.proposal-section-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #334766;
  grid-column: 1 / -1;
}

.proposal-service-field {
  grid-column: 1 / -1;
}

.proposal-output-tools {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.proposal-result {
  margin-top: 8px;
  width: 100%;
  min-height: 180px;
  line-height: 1.7;
  background: #ffffff;
  resize: vertical;
}

#contact-forms-table {
  min-width: 760px;
  table-layout: auto;
}

#contact-forms-table thead th {
  background: linear-gradient(180deg, #f4f8ff, #edf4ff);
  color: #334766;
  font-weight: 700;
  white-space: nowrap;
}

#contact-forms-table tbody tr:nth-child(even) {
  background: #fbfdff;
}

#contact-forms-table tbody tr:hover {
  background: #eef5ff;
}

#contact-forms-table th:nth-child(1),
#contact-forms-table td:nth-child(1) {
  width: 40%;
}

#contact-forms-table th:nth-child(2),
#contact-forms-table td:nth-child(2) {
  width: 30%;
}

#contact-forms-table th:nth-child(3),
#contact-forms-table td:nth-child(3) {
  width: 25%;
}

#contact-forms-table th:nth-child(4),
#contact-forms-table td:nth-child(4) {
  width: 5%;
  white-space: nowrap;
  text-align: center;
}

.table-link {
  display: inline-block;
  color: #2e5fa8;
  text-decoration: none;
  font-weight: 700;
}

.table-link:hover {
  text-decoration: underline;
}

.mini-url {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

.date-cell {
  white-space: nowrap;
}

.lead-name-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.generate-proposal-btn {
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}

#my-list-table th:nth-child(1),
#my-list-table td:nth-child(1) {
  width: 36px;
}

#my-list-table th:nth-child(2),
#my-list-table td:nth-child(2) {
  width: 160px;
}

#my-list-table th:nth-child(3),
#my-list-table td:nth-child(3),
#my-list-table th:nth-child(4),
#my-list-table td:nth-child(4),
#my-list-table th:nth-child(5),
#my-list-table td:nth-child(5),
#my-list-table th:nth-child(6),
#my-list-table td:nth-child(6) {
  width: 90px;
}

#my-list-table th:nth-child(7),
#my-list-table td:nth-child(7),
#my-list-table th:nth-child(8),
#my-list-table td:nth-child(8) {
  width: 110px;
}

#my-list-table th:nth-child(9),
#my-list-table td:nth-child(9),
#my-list-table th:nth-child(10),
#my-list-table td:nth-child(10) {
  width: 160px;
}

#history-table th:nth-child(1),
#history-table td:nth-child(1) {
  width: 170px;
}

#history-table th:nth-child(2),
#history-table td:nth-child(2) {
  width: 160px;
}

#history-table th:nth-child(3),
#history-table td:nth-child(3),
#history-table th:nth-child(4),
#history-table td:nth-child(4) {
  width: 120px;
}

#history-table th:nth-child(5),
#history-table td:nth-child(5) {
  width: 90px;
}

#history-table th:nth-child(6),
#history-table td:nth-child(6) {
  width: 210px;
}

#history-table th:nth-child(7),
#history-table td:nth-child(7) {
  width: 210px;
}

#history-table th:nth-child(8),
#history-table td:nth-child(8) {
  width: 96px;
}

mark {
  background: #ffe89a;
  color: #2a2a2a;
  padding: 0 1px;
  border-radius: 3px;
}

.show-timeline-btn {
  min-width: 72px;
  padding: 6px 8px;
  font-size: 11px;
}

#history-timeline {
  margin-top: 12px;
  max-height: 260px;
}

th {
  background: #eef3fb;
}

.simple-list {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  max-height: 300px;
  overflow: auto;
}

.simple-list .row {
  padding: 10px;
  border-bottom: 1px solid #e2e8f4;
  font-size: 12px;
}

.simple-list .row:last-child {
  border-bottom: 0;
}

.muted {
  color: var(--muted);
  font-size: 13px;
  margin-top: 10px;
}

.field-note {
  margin: -4px 0 0;
  font-size: 12px;
  color: #8a5a00;
}

.history-presets {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.history-summary {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.summary-total {
  font-size: 12px;
  color: #3d516f;
  font-weight: 700;
}

.summary-badge {
  border-radius: 999px;
  background: #e6eefc;
  color: #2a4572;
  padding: 2px 8px;
  font-size: 11px;
}

.summary-badge.channel {
  background: #e8f6ef;
  color: #22613e;
}

.status-badge,
.priority-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
}

.status-new {
  background: #e6eefc;
  color: #23467f;
}

.status-contacted {
  background: #e2f7ec;
  color: #1d6b41;
}

.status-nurturing {
  background: #fff4df;
  color: #8a5a00;
}

.status-closed {
  background: #e6e7eb;
  color: #3f4755;
}

.status-excluded {
  background: #fde6e6;
  color: #8a2f2f;
}

.priority-high {
  background: #fde4e4;
  color: #9e2525;
}

.priority-medium {
  background: #fff0d6;
  color: #8a5a00;
}

.priority-low {
  background: #e6f4ec;
  color: #21613f;
}

.timeline-row {
  display: grid;
  gap: 6px;
}

.timeline-message summary {
  cursor: pointer;
  color: #4a5f80;
}

.timeline-message pre {
  margin: 6px 0 0;
  padding: 10px;
  border-radius: 8px;
  background: #eef3fb;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 12px;
}

.timeline-message .copy-message-btn {
  margin-top: 6px;
}

/* ── ローディングスピナー ── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  vertical-align: middle;
  flex-shrink: 0;
}

.spinner.is-loading {
  display: inline-block;
}

/* ── マップ作成FAB ── */
.map-create-fab {
  display: none;
  position: fixed;
  bottom: 74px;
  right: 18px;
  z-index: 85;
}

.map-create-fab.is-visible {
  display: block;
}

.map-create-fab button {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: none;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(94, 143, 207, 0.45);
  transition: transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.map-create-fab button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(94, 143, 207, 0.55);
}

/* ── マップビュー ── */
#view-map {
  display: none;
  padding: 0;
  flex: 1;
  overflow: hidden;
}

#view-map.active {
  display: flex;
}

.map-view-layout {
  display: flex;
  width: 100%;
  height: calc(100vh - 50px);
}

.map-pin-sidebar {
  width: 260px;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 20px 16px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.map-pin-sidebar h3 {
  margin: 0 0 12px;
}

.map-canvas {
  flex: 1;
  height: 100%;
  min-height: 400px;
}

.map-pin-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.map-pin-item:last-child {
  border-bottom: none;
}

.map-pin-item:hover {
  background: var(--panel-soft);
  border-radius: 8px;
  margin: 0 -8px;
  padding: 10px 8px;
}

.map-pin-number {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.map-pin-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.map-pin-address {
  font-size: 11px;
  margin-top: 2px;
  line-height: 1.4;
}

.map-sheet-handle {
  display: none;
}

.map-sheet-body {
  /* desktop: inherits sidebar padding */
}

.map-no-key {
  padding: 20px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  border-radius: 10px;
  padding: 10px 12px;
  color: #ffffff;
  background: #3a4a66;
  box-shadow: 0 8px 20px rgba(30, 44, 68, 0.28);
  font-size: 12px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  background: #27643f;
}

.toast.error {
  background: #8d2f2f;
}

.hint-box {
  background: #eef5ff;
  border: 1px solid #bdd0ee;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.7;
}

.hint-title {
  font-weight: 700;
  color: #2c4a80;
  margin: 0 0 4px;
}

.hint-desc {
  color: #4a5f80;
  margin: 0 0 8px;
}

.hint-list {
  margin: 0 0 8px;
  padding-left: 18px;
  color: var(--text);
}

.hint-list li {
  margin-bottom: 2px;
}

.hint-list code,
.hint-example code {
  background: #d8e7fa;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  color: #1a3a6e;
}

.hint-example {
  color: var(--muted);
  margin: 0;
  font-size: 12px;
}

@media (max-width: 980px) {
  .proposal-builder-head {
    flex-direction: column;
  }

  #proposal-generator-form {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 720px;
  }

  .inline-actions {
    grid-template-columns: 1fr;
  }
}

/* Stripe-inspired refresh */
:root {
  --bg: #ffffff;
  --sidebar: #f7f9fe;
  --panel: #ffffff;
  --panel-soft: #f9fbff;
  --line: #e5edf5;
  --text: #061b31;
  --muted: #64748d;
  --label: #273951;
  --accent: #533afd;
  --accent-2: #4434d4;
  --accent-soft: #d6d9fc;
  --success-bg: rgba(21, 190, 83, 0.2);
  --success-text: #108c3d;
  --danger: #ea2261;
  --shadow-elevated: rgba(50, 50, 93, 0.25) 0 30px 45px -30px, rgba(0, 0, 0, 0.1) 0 18px 36px -18px;
  --shadow-soft: rgba(23, 23, 23, 0.08) 0 15px 35px;
}

body {
  background:
    radial-gradient(circle at 8% -2%, rgba(249, 107, 238, 0.18), transparent 30%),
    radial-gradient(circle at 88% 0%, rgba(83, 58, 253, 0.16), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
  color: var(--text);
  font-family: "sohne-var", "Noto Sans JP", "Segoe UI", sans-serif;
  font-feature-settings: "ss01" 1;
  letter-spacing: 0;
}

h1,
h2,
h3,
.workspace-head h2,
.panel h3 {
  color: #061b31;
  font-weight: 300;
}

.brand-logo .logo-to {
  color: var(--accent-2);
}

.brand p,
label,
.muted,
.mini-url,
.hint-desc,
.footer-note,
.field-note {
  color: var(--muted);
}

.app-shell {
  grid-template-columns: 272px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, #fbfcff 0%, #f5f8ff 100%);
  border-right: 1px solid var(--line);
}

.menu-item {
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 400;
}

.menu-item:hover {
  background: rgba(83, 58, 253, 0.06);
  border-color: #d6d9fc;
}

.menu-item.active {
  background: rgba(83, 58, 253, 0.12);
  border-color: #b9b9f9;
  color: #2e2b8c;
  font-weight: 500;
}

.workspace-head {
  background: transparent;
  border-bottom: none;
}

.view {
  padding: 24px;
}

.panel,
.table-wrap,
.simple-list,
.hint-box {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: var(--shadow-elevated);
}

.simple-list,
.hint-box,
.chat-surface {
  background: #f9fbff;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  background: #ffffff;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(83, 58, 253, 0.24);
  border-color: #533afd;
}

button,
.status-tab,
.history-range-btn {
  border-radius: 4px;
  background: #533afd;
  color: #ffffff;
  box-shadow: var(--shadow-elevated);
  font-weight: 400;
  letter-spacing: 0;
}

button:hover,
.status-tab:hover,
.history-range-btn:hover {
  background: #4434d4;
  filter: none;
  transform: translateY(0);
}

button.ghost,
button.status-tab,
.history-range-btn.ghost {
  background: transparent;
  color: #533afd;
  border: 1px solid #b9b9f9;
  box-shadow: none;
}

button.ghost:hover,
button.status-tab:hover,
.history-range-btn.ghost:hover {
  background: rgba(83, 58, 253, 0.05);
}

button.danger,
.toast.error {
  background: #ea2261;
  border-color: #ea2261;
  color: #ffffff;
}

.status-tab.active {
  background: #533afd;
  color: #ffffff;
  box-shadow: none;
}

th {
  background: #f8faff;
  color: #273951;
}

#lead-table thead th,
#contact-forms-table thead th {
  background: linear-gradient(180deg, #fcfdff 0%, #f3f7ff 100%);
  color: #273951;
  font-weight: 400;
}

#lead-table thead th.sortable:hover {
  background: linear-gradient(180deg, #f7f9ff 0%, #ecf1ff 100%);
}

#lead-table tbody tr:nth-child(even),
#contact-forms-table tbody tr:nth-child(even) {
  background: #fcfdff;
}

#lead-table tbody tr:hover,
#contact-forms-table tbody tr:hover {
  background: rgba(83, 58, 253, 0.05);
}

#lead-table a,
.table-link,
a {
  color: #533afd;
}

#lead-table .sort-indicator,
.hint-title {
  color: #2e2b8c;
}

.summary-badge,
.status-badge,
.priority-badge {
  border-radius: 4px;
}

.status-new,
.summary-badge {
  background: #e9ebff;
  color: #2e2b8c;
}

.status-contacted,
.priority-low,
.summary-badge.channel,
.toast.success {
  background: var(--success-bg);
  color: var(--success-text);
}

.status-nurturing,
.priority-medium {
  background: #fff1de;
  color: #9b6829;
}

.status-closed {
  background: #edf1f7;
  color: #273951;
}

.status-excluded,
.priority-high {
  background: #ffe6ef;
  color: #ea2261;
}

.chat-surface {
  border: 1px solid #d6d9fc;
  border-radius: 6px;
  box-shadow: var(--shadow-soft);
}

.chat-item.system {
  background: #eef1ff;
}

.chat-item.user {
  background: #e5e0ff;
}

.timeline-message pre,
code,
pre,
.hint-list code,
.hint-example code {
  font-family: "Source Code Pro", "SFMono-Regular", ui-monospace, monospace;
}

.hint-list code,
.hint-example code {
  background: #eef1ff;
  color: #2e2b8c;
}

.toast {
  border-radius: 4px;
  background: #061b31;
  box-shadow: var(--shadow-elevated);
}

.menu-item:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #533afd;
  outline-offset: 2px;
}

@media (max-width: 980px) {
  .view {
    padding: 16px;
  }

  .panel,
  .table-wrap,
  .simple-list,
  .hint-box {
    border-radius: 6px;
  }
}

.status-with-cat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* 黒猫歩きアニメーション */
.loading-cat {
  position: relative;
  width: 36px;
  height: 20px;
  display: inline-block;
  animation: black-cat-walk 0.6s steps(1) infinite;
}

/* フレーム1: 左足前 */
.loading-cat::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 20'%3E%3C!-- body --%3E%3Cellipse cx='17' cy='11' rx='9' ry='5' fill='%23111'/%3E%3C!-- head --%3E%3Ccircle cx='26' cy='8' r='5' fill='%23111'/%3E%3C!-- ears --%3E%3Cpolygon points='23,4 21,0 25,3' fill='%23111'/%3E%3Cpolygon points='28,4 27,0 30,3' fill='%23111'/%3E%3C!-- eye --%3E%3Ccircle cx='27.5' cy='7.5' r='1' fill='%23ffe066'/%3E%3C!-- tail --%3E%3Cpath d='M8 11 Q2 8 4 4' stroke='%23111' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C!-- legs walk frame1 --%3E%3Cline x1='13' y1='15' x2='11' y2='20' stroke='%23111' stroke-width='2' stroke-linecap='round'/%3E%3Cline x1='17' y1='15' x2='19' y2='20' stroke='%23111' stroke-width='2' stroke-linecap='round'/%3E%3Cline x1='21' y1='15' x2='23' y2='20' stroke='%23111' stroke-width='2' stroke-linecap='round'/%3E%3Cline x1='25' y1='13' x2='23' y2='18' stroke='%23111' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  animation: black-cat-frame 0.6s steps(1) infinite;
}

.loading-cat-body,
.loading-cat-ear,
.loading-cat-ear-left,
.loading-cat-ear-right,
.loading-cat-tail {
  display: none;
}

.loading-cat::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 2px;
  background: repeating-linear-gradient(90deg, rgba(100, 116, 141, 0.55) 0 2px, transparent 2px 4px);
  opacity: 0.4;
  animation: cat-track 0.6s linear infinite;
}

@keyframes black-cat-frame {
  0%, 100% {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 20'%3E%3Cellipse cx='17' cy='11' rx='9' ry='5' fill='%23111'/%3E%3Ccircle cx='26' cy='8' r='5' fill='%23111'/%3E%3Cpolygon points='23,4 21,0 25,3' fill='%23111'/%3E%3Cpolygon points='28,4 27,0 30,3' fill='%23111'/%3E%3Ccircle cx='27.5' cy='7.5' r='1' fill='%23ffe066'/%3E%3Cpath d='M8 11 Q2 8 4 4' stroke='%23111' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3Cline x1='12' y1='15' x2='10' y2='20' stroke='%23111' stroke-width='2' stroke-linecap='round'/%3E%3Cline x1='17' y1='15' x2='17' y2='20' stroke='%23111' stroke-width='2' stroke-linecap='round'/%3E%3Cline x1='22' y1='15' x2='24' y2='20' stroke='%23111' stroke-width='2' stroke-linecap='round'/%3E%3Cline x1='25' y1='13' x2='25' y2='18' stroke='%23111' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  }
  50% {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 20'%3E%3Cellipse cx='17' cy='11' rx='9' ry='5' fill='%23111'/%3E%3Ccircle cx='26' cy='8' r='5' fill='%23111'/%3E%3Cpolygon points='23,4 21,0 25,3' fill='%23111'/%3E%3Cpolygon points='28,4 27,0 30,3' fill='%23111'/%3E%3Ccircle cx='27.5' cy='7.5' r='1' fill='%23ffe066'/%3E%3Cpath d='M8 11 Q3 13 4 16' stroke='%23111' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3Cline x1='12' y1='15' x2='14' y2='20' stroke='%23111' stroke-width='2' stroke-linecap='round'/%3E%3Cline x1='17' y1='15' x2='15' y2='20' stroke='%23111' stroke-width='2' stroke-linecap='round'/%3E%3Cline x1='22' y1='15' x2='20' y2='20' stroke='%23111' stroke-width='2' stroke-linecap='round'/%3E%3Cline x1='25' y1='13' x2='27' y2='18' stroke='%23111' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  }
}

@keyframes black-cat-walk {
  0% { transform: translateX(0) translateY(0); }
  25% { transform: translateX(1px) translateY(-1px); }
  50% { transform: translateX(0) translateY(0); }
  75% { transform: translateX(-1px) translateY(-1px); }
  100% { transform: translateX(0) translateY(0); }
}

@keyframes cat-track {
  0% { background-position: 0 0; }
  100% { background-position: -6px 0; }
}

/* ═══════════════════════════════════
   モバイル (≤ 768px)
   ─ サイドバーはデフォルト非表示のオーバーレイ
═══════════════════════════════════ */
@media (max-width: 768px) {

  body {
    overflow-x: hidden;
  }

  /* アプリシェル: 1カラム */
  .app-shell {
    grid-template-columns: 1fr !important;
    min-height: 100dvh;
  }

  /* ── サイドバー: 固定オーバーレイ ── */
  .sidebar {
    position: fixed !important;
    left: 0;
    top: 0;
    width: 272px !important;
    min-width: 272px !important;
    height: 100dvh !important;
    z-index: 1000;
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s cubic-bezier(.4,0,.2,1), opacity 0.2s;
    border-right: 1px solid var(--line) !important;
    border-bottom: none !important;
    box-shadow: 4px 0 24px rgba(0,0,0,0.12);
    overflow: hidden auto !important;
    padding: 18px 14px !important;
    gap: 14px;
  }

  /* サイドバー開いた状態 (sidebar-closedなし) */
  .app-shell:not(.sidebar-closed) .sidebar {
    transform: translateX(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* モバイルの sidebar-closed: デスクトップの width:0 ルールを上書き */
  .app-shell.sidebar-closed .sidebar {
    transform: translateX(-100%) !important;
    width: 272px !important;
    min-width: 272px !important;
    padding: 18px 14px !important;
    border: 1px solid var(--line) !important;
    overflow: hidden auto !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  /* ── バックドロップ ── */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.38);
    z-index: 999;
    cursor: pointer;
  }

  .app-shell:not(.sidebar-closed) .sidebar-backdrop {
    display: block;
  }

  /* ── ワークスペースヘッダー ── */
  .workspace {
    min-width: 0;
  }

  .workspace-head {
    padding: 10px 14px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.92) !important;
    border-bottom: 1px solid var(--line) !important;
    backdrop-filter: blur(10px);
  }

  /* ── ビュー・パネル ── */
  .view {
    padding: 12px;
  }

  .panel {
    padding: 12px;
  }

  .panel h3 {
    font-size: 18px;
    line-height: 1.4;
  }

  /* ── フォーム ── */
  .form-grid,
  .form-grid.compact,
  .inline-actions,
  #my-list-update-form,
  #my-list-filter-form,
  #filter-form {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  input,
  select,
  textarea,
  button {
    min-height: 44px;
  }

  /* ── エクスポートツール ── */
  .export-tools,
  .my-list-add-tools {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .export-tools button,
  .my-list-add-tools button {
    width: 100%;
  }

  /* ── ステータスタブ ── */
  .status-tabs,
  .history-presets {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .status-tabs .status-tab,
  .history-presets button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  /* ── テーブル ── */
  table {
    min-width: 640px;
  }

  #contact-forms-table {
    min-width: 480px;
  }

  .lead-name-with-action {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  #contact-forms-table th:nth-child(1),
  #contact-forms-table td:nth-child(1) {
    width: 35%;
  }

  #contact-forms-table th:nth-child(2),
  #contact-forms-table td:nth-child(2) {
    width: 28%;
  }

  #contact-forms-table th:nth-child(3),
  #contact-forms-table td:nth-child(3) {
    width: 28%;
  }

  #contact-forms-table th:nth-child(4),
  #contact-forms-table td:nth-child(4) {
    width: 9%;
  }

  th, td {
    padding: 8px 9px;
    font-size: 12px;
  }

  /* ── トースト ── */
  .toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
  }

  /* ── マップ ボトムシート ── */
  .map-view-layout {
    position: relative;
    height: calc(100dvh - 50px);
  }

  .map-canvas {
    position: absolute !important;
    inset: 0;
    height: 100% !important;
    z-index: 0;
  }

  .map-pin-sidebar {
    position: absolute !important;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto !important;
    max-height: 65vh;
    padding: 0 !important;
    border-right: none !important;
    border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.14);
    transform: translateY(calc(100% - 56px));
    transition: transform 0.3s cubic-bezier(.4, 0, .2, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 10;
  }

  .map-pin-sidebar.is-expanded {
    transform: translateY(0);
  }

  .map-sheet-handle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 56px;
    flex-shrink: 0;
    cursor: pointer;
    gap: 6px;
    user-select: none;
  }

  .map-sheet-drag-bar {
    width: 36px;
    height: 4px;
    background: #c8cdd9;
    border-radius: 2px;
  }

  .map-sheet-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
  }

  .map-pin-sidebar h3 {
    display: none;
  }

  .map-sheet-body {
    overflow-y: auto;
    padding: 4px 16px 24px;
    flex: 1;
  }

  /* ── インポートヒーロー ── */
  .g-layout {
    padding: 16px;
    padding-bottom: 8vh;
    align-items: flex-start;
    padding-top: 6vh;
  }

  .g-greeting {
    font-size: 26px;
  }

  .g-sub {
    font-size: 14px;
    margin-bottom: 20px;
  }

  .import-search-bar {
    border-radius: 16px;
  }

  .import-search-input {
    font-size: 15px;
    padding: 14px 16px;
  }

  .import-search-btn {
    padding: 0;
    bottom: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    min-height: unset;
  }

  .quick-tag {
    font-size: 12px;
    padding: 7px 13px;
  }
}

/* ── Import page (Claude-like) ── */
.g-layout {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-bottom: 20vh;
}

.g-center {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.g-greeting {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0 0 10px;
  text-align: center;
  background: linear-gradient(135deg, #533afd 0%, #9b59f9 45%, #f05fa0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.25;
}

.g-name {
  -webkit-text-fill-color: transparent;
}

.g-sub {
  margin: 0 0 28px;
  font-size: 15px;
  color: var(--muted);
  text-align: center;
}

.import-search-form {
  width: 100%;
}

.import-search-bar {
  position: relative;
  border: 1.5px solid #e2e8f0;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.04);
  transition: border-color 0.2s, box-shadow 0.2s;
  padding: 16px 16px 56px 18px;
}

.import-search-bar:focus-within {
  border-color: #c0c0c0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.import-search-input {
  width: 100%;
  border: none;
  border-radius: 0;
  padding: 0;
  font-size: 16px;
  line-height: 1.7;
  background: transparent;
  color: var(--text);
  resize: none;
  min-height: 52px;
}

.import-search-input:focus {
  outline: none;
  border-color: transparent;
}

.import-search-input::placeholder {
  color: #a0aec0;
}

.import-search-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #533afd;
  color: #fff;
  box-shadow: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

.import-search-btn:hover {
  background: #4434d4;
  filter: none;
  transform: none;
  box-shadow: none;
}

.import-search-btn:active {
  transform: none;
  filter: none;
}

.g-chips {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.quick-tag {
  background: #f3f4f6;
  color: #374151;
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  box-shadow: none;
  font-weight: 400;
  letter-spacing: 0;
  transition: background 0.15s;
}

.quick-tag:hover {
  background: #e5e7eb;
  filter: none;
  transform: none;
  box-shadow: none;
}

.quick-tag:active {
  background: #d1d5db;
  filter: none;
  transform: none;
  box-shadow: none;
}

.import-result-msg {
  margin-top: 16px;
  font-size: 14px;
  text-align: center;
  width: 100%;
}


@media (max-width: 480px) {
  .view {
    padding: 10px;
  }

  .panel {
    padding: 10px;
  }

  .panel h3 {
    font-size: 16px;
  }

  table {
    min-width: 560px;
  }

  #contact-forms-table {
    min-width: 400px;
  }

  .g-greeting {
    font-size: 22px;
  }
}

/* ユーザーポップオーバー: 設定ボタン */
.user-detail-settings-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 7px 0;
  background: #f0edff;
  color: #533afd;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.13s;
}
.user-detail-settings-btn:hover {
  background: #e4dfff;
}

/* 設定モーダル オーバーレイ */
.settings-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 40, 0.45);
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 48px rgba(40, 50, 100, 0.22);
  display: flex;
  width: min(820px, 96vw);
  height: min(540px, 90vh);
  overflow: hidden;
}

/* 左ナビ */
.settings-nav {
  width: 192px;
  flex-shrink: 0;
  background: #f5f7fb;
  border-right: 1px solid #e4e9f2;
  display: flex;
  flex-direction: column;
  padding: 20px 10px 16px;
  gap: 2px;
}
.settings-nav-header {
  font-size: 11px;
  font-weight: 700;
  color: #8898aa;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 10px 10px;
}
.settings-nav-item {
  background: none;
  border: none;
  border-radius: 8px;
  padding: 9px 12px;
  text-align: left;
  font-size: 14px;
  color: #4a5568;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
}
.settings-nav-item:hover {
  background: #eaecf5;
}
.settings-nav-item.active {
  background: #e8e4ff;
  color: #533afd;
  font-weight: 700;
}
.settings-nav-item.settings-nav-danger {
  color: #c0392b;
  margin-top: auto;
}
.settings-nav-item.settings-nav-danger:hover {
  background: #ffeaea;
}
.settings-nav-item.settings-nav-danger.active {
  background: #ffeaea;
  color: #c0392b;
}

/* 右コンテンツ */
.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 32px 36px 28px;
  position: relative;
}
.settings-close-btn {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none !important;
  border: none;
  box-shadow: none !important;
  font-size: 22px;
  color: #8a9ab8;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 6px;
  transition: background 0.13s, color 0.13s;
}
.settings-close-btn:hover {
  background: #f0f2f7 !important;
  color: #333;
  filter: none;
  transform: none;
}
.settings-tab {
  display: none;
}
.settings-tab.active {
  display: block;
}
.settings-section-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a2a4a;
  margin: 0 0 22px;
}
.settings-field {
  margin-bottom: 20px;
}
.settings-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 6px;
}
.settings-value-text {
  font-size: 14px;
  color: #6a7ea8;
  padding: 7px 0;
}
.settings-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.settings-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #d2d8e8;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.13s;
}
.settings-input:focus {
  border-color: #533afd;
}
.settings-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d2d8e8;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.13s;
  box-sizing: border-box;
}
.settings-textarea:focus {
  border-color: #533afd;
}
.settings-save-btn {
  padding: 8px 18px;
  background: #533afd;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.13s;
}
.settings-save-btn:hover {
  background: #4434d4;
}
.settings-save-btn--loading {
  background: #7b68ee;
  pointer-events: none;
  position: relative;
  min-width: 64px;
}
.settings-save-btn--loading::after {
  content: '';
  display: block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: settings-spin 0.6s linear infinite;
  margin: 0 auto;
}
.settings-save-btn--done {
  background: #27ae60;
  pointer-events: none;
  animation: settings-done-pop 0.25s ease;
}
@keyframes settings-spin {
  to { transform: rotate(360deg); }
}
@keyframes settings-done-pop {
  0%   { transform: scale(0.85); }
  60%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.settings-hint {
  font-size: 12px;
  color: #8898aa;
  margin: 6px 0 0;
}
.settings-hint-danger {
  color: #c0392b;
}
.settings-hint-success {
  color: #27ae60;
}

/* 利用状況グリッド */
.settings-usage-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.settings-usage-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-usage-row-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.settings-usage-row-label {
  font-size: 13px;
  color: #5a6e8a;
  font-weight: 500;
}
.settings-usage-row-count {
  font-size: 14px;
  font-weight: 700;
  color: #1a2a4a;
}
.settings-usage-row-count--warn {
  color: #d97706;
}
.settings-usage-bar-track {
  height: 8px;
  background: #e8edf5;
  border-radius: 4px;
  overflow: hidden;
}
.settings-usage-bar-fill {
  height: 100%;
  background: #3b6fd4;
  border-radius: 4px;
  transition: width 0.4s ease;
}
.settings-usage-bar-fill--warn {
  background: #d97706;
}
.settings-usage-reset-hint {
  font-size: 11px;
  color: #8898aa;
  margin-top: 4px;
}
.settings-usage-row--meta {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid #e8edf5;
}
.settings-usage-row-meta {
  font-size: 13px;
  color: #8898aa;
}

/* 解約 */
.settings-danger-zone {
  border: 1px solid #f5c6cb;
  border-radius: 12px;
  padding: 22px 24px;
  background: #fffafa;
}
.settings-danger-title {
  font-size: 15px;
  font-weight: 700;
  color: #c0392b;
  margin: 0 0 10px;
}
.settings-danger-btn {
  margin-top: 14px;
  padding: 8px 18px;
  background: #fff;
  color: #c0392b;
  border: 1.5px solid #c0392b;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.13s;
}
.settings-danger-btn:hover {
  background: #ffeaea;
}
.settings-delete-btn {
  margin-top: 12px;
  padding: 9px 18px;
  background: #c0392b;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.13s;
}
.settings-delete-btn:hover {
  background: #a93226;
}

/* レスポンシブ */
@media (max-width: 600px) {
  .settings-modal {
    flex-direction: column;
    height: 92vh;
    border-radius: 12px;
  }
  .settings-nav {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid #e4e9f2;
    padding: 10px 8px 6px;
    gap: 4px;
  }
  .settings-nav-header {
    display: none;
  }
  .settings-nav-item.settings-nav-danger {
    margin-top: 0;
  }
  .settings-body {
    padding: 20px 18px 16px;
  }
  .settings-usage-list {
    gap: 14px;
  }
}

/* 提案文生成中インジケーター */
.proposal-generating-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 2px;
  font-size: 0.9em;
  color: var(--muted);
}
.proposal-generating-label {
  font-style: italic;
}
.pencil-icon {
  display: inline-block;
  animation: pencil-write 1s ease-in-out infinite;
  transform-origin: bottom right;
}
@keyframes pencil-write {
  0%   { transform: rotate(-8deg) translateX(0); }
  25%  { transform: rotate(4deg) translateX(3px); }
  50%  { transform: rotate(-8deg) translateX(6px); }
  75%  { transform: rotate(4deg) translateX(3px); }
  100% { transform: rotate(-8deg) translateX(0); }
}

/* 提案文日付リンク */
.proposal-date-link {
  background: none;
  border: none;
  padding: 0;
  color: #2e5fa8;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.8em;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: inherit;
  box-shadow: none;
}
.proposal-date-link:hover {
  text-decoration: underline;
  background: none;
  box-shadow: none;
  filter: none;
  transform: none;
}

/* 保存済み提案文モーダル */
.saved-proposal-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 48px rgba(40, 50, 100, 0.22);
  display: flex;
  flex-direction: column;
  width: min(600px, 96vw);
  max-height: 80vh;
  overflow: hidden;
}
.saved-proposal-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #e4e9f2;
  gap: 12px;
}
.saved-proposal-modal-title {
  font-size: 15px;
  font-weight: 600;
  color: #1a1f36;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.saved-proposal-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #8a94a8;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  flex-shrink: 0;
}
.saved-proposal-modal-close:hover {
  color: #1a1f36;
}
.saved-proposal-modal-body {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.7;
  color: #2c3354;
  overflow-y: auto;
  background: #fafbfe;
}
.saved-proposal-modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #e4e9f2;
  display: flex;
  justify-content: flex-end;
}

/* ======== Watchlist ======== */
.watchlist-group {
  margin-bottom: 24px;
}
.watchlist-group-label {
  font-size: 12px;
  font-weight: 600;
  color: #8898aa;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 0 8px;
  border-bottom: 1px solid #e4e9f2;
  margin-bottom: 8px;
}
.watchlist-group-label--changed {
  color: #d92d20;
}
.watchlist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #e4e9f2;
  background: #fff;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.watchlist-item--changed {
  border-color: #fecdca;
  background: #fff5f5;
}
.watchlist-item-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.watchlist-item-name {
  font-weight: 600;
  font-size: 14px;
  color: #1a1f36;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.watchlist-item-meta {
  font-size: 13px;
  color: #8898aa;
  white-space: nowrap;
}
.watchlist-change-badge {
  display: inline-flex;
  align-items: center;
  background: #fee4e2;
  color: #b42318;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  white-space: nowrap;
}
.watchlist-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.watchlist-item-checked {
  font-size: 12px;
  white-space: nowrap;
}
.watchlist-item-wrap {
  margin-bottom: 8px;
}
.watchlist-item-wrap .watchlist-item {
  margin-bottom: 0;
}
.watchlist-history {
  border: 1px solid #e4e9f2;
  border-top: none;
  border-radius: 0 0 8px 8px;
  background: #fafbfe;
  padding: 12px 14px;
}
.watchlist-history-loading {
  margin: 0;
  font-size: 13px;
}
.watchlist-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.watchlist-timeline-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed #e4e9f2;
  flex-wrap: wrap;
}
.watchlist-timeline-item:last-child {
  border-bottom: none;
}
.watchlist-timeline-date {
  font-size: 12px;
  color: #8898aa;
  min-width: 96px;
  font-variant-numeric: tabular-nums;
}
.watchlist-timeline-val {
  font-size: 13px;
  color: #1a1f36;
}
.watchlist-timeline-item--changed .watchlist-timeline-val {
  font-weight: 600;
}
.watchlist-timeline-nochange {
  font-size: 12px;
}

/* Watchlist 2-column layout */
#view-watchlist {
  display: none;
  padding: 0;
}
#view-watchlist.active {
  display: flex;
}
.watchlist-layout {
  display: flex;
  width: 100%;
  height: calc(100vh - 50px);
}
.watchlist-list-panel {
  width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.watchlist-list-header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.watchlist-list-header h3 {
  margin: 0 0 4px;
  font-size: 15px;
}
.watchlist-list-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.watchlist-list-scroll .watchlist-group {
  margin-bottom: 0;
}
.watchlist-list-scroll .watchlist-group-label {
  padding: 10px 16px 4px;
  margin-bottom: 0;
  border-bottom: none;
  font-size: 11px;
}
.watchlist-empty-msg {
  padding: 16px;
  font-size: 13px;
}
.watchlist-detail-panel {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: #fafbfe;
}
.watchlist-detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

/* Compact list items */
.watchlist-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.1s;
  user-select: none;
}
.watchlist-list-item:hover {
  background: #f0f2fa;
}
.watchlist-list-item--active {
  background: #eef0fb;
  border-left-color: #533afd;
}
.watchlist-list-item-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d1d5db;
  flex-shrink: 0;
}
.watchlist-list-item-indicator--changed {
  background: #d92d20;
}
.watchlist-list-item-name {
  font-size: 13px;
  color: #1a1f36;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.watchlist-list-change-badge {
  font-size: 10px;
  font-weight: 600;
  color: #b42318;
  background: #fee4e2;
  padding: 2px 6px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Detail panel */
.watchlist-detail-content {
  max-width: 720px;
}
.watchlist-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e4e9f2;
}
.watchlist-detail-name {
  font-size: 20px;
  font-weight: 700;
  color: #1a1f36;
  margin: 0 0 8px;
}
.watchlist-detail-name--changed {
  color: #b42318;
}
.watchlist-detail-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 14px;
  color: #1a1f36;
}
.watchlist-detail-rating,
.watchlist-detail-reviews {
  font-weight: 600;
}
.watchlist-detail-checked {
  font-size: 12px;
}
.watchlist-detail-changes {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.watchlist-detail-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.watchlist-detail-history-section .watchlist-group-label {
  padding: 0 0 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid #e4e9f2;
}

/* 詳細パネル内のセクション */
.watchlist-detail-section {
  margin-bottom: 28px;
}
.watchlist-section-label {
  font-size: 11px;
  font-weight: 700;
  color: #8898aa;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding-bottom: 8px;
  border-bottom: 1px solid #e4e9f2;
  margin-bottom: 12px;
}

/* 法人・基本情報グリッド */
.watchlist-corp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
}
.watchlist-corp-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.watchlist-corp-row--full {
  grid-column: 1 / -1;
}
.watchlist-corp-label {
  font-size: 11px;
  font-weight: 600;
  color: #8898aa;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.watchlist-corp-row span:not(.watchlist-corp-label) {
  font-size: 13px;
  color: #1a1f36;
  word-break: break-all;
}
.watchlist-corp-link {
  font-size: 13px;
  color: #533afd;
  text-decoration: none;
  word-break: break-all;
}
.watchlist-corp-link:hover {
  text-decoration: underline;
}
.watchlist-section-sublabel {
  font-size: 10px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 6px;
}
.watchlist-profile-text {
  white-space: pre-line;
}
.watchlist-profile-pending {
  font-size: 12px;
  margin: 0;
}

@media (max-width: 768px) {
  .watchlist-layout {
    flex-direction: column;
    height: auto;
  }
  .watchlist-list-panel {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--line);
    max-height: 280px;
  }
  .watchlist-detail-panel {
    padding: 16px;
  }
}
