:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #e2e5ea;
  --text: #1f2430;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar h1 { font-size: 18px; margin: 0; }
.topbar-actions { display: flex; gap: 8px; }

.filters {
  display: flex;
  gap: 8px;
  padding: 12px 24px;
  flex-wrap: wrap;
}

.filters input, .filters select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}

main { padding: 0 24px 32px; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

th { background: #fafbfc; color: var(--muted); font-weight: 600; }

tbody tr:hover { background: #f9fafb; }

.empty-msg { color: var(--muted); padding: 24px; text-align: center; }

.status-select {
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 13px;
}

.status-badge-未接触 { color: #6b7280; }
.status-badge-提案済み { color: #2563eb; }
.status-badge-商談中 { color: #d97706; }
.status-badge-成約 { color: #16a34a; }
.status-badge-見送り { color: #9ca3af; }

.row-actions { display: flex; gap: 6px; white-space: nowrap; }

.btn {
  border: none;
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #eef0f3; color: var(--text); }
.btn-secondary:hover { background: #e2e5ea; }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: #fecaca; }
.btn-mail { background: #ecfdf5; color: #059669; }
.btn-mail:hover { background: #d1fae5; }
.btn-small { padding: 4px 8px; font-size: 12px; }

dialog {
  border: none;
  border-radius: 12px;
  padding: 24px;
  width: min(520px, 92vw);
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

dialog::backdrop { background: rgba(15,17,21,0.4); }

dialog h2 { margin-top: 0; font-size: 16px; }

#lead-form, #template-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#lead-form label, #template-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

.checkbox-label { flex-direction: row !important; align-items: center; gap: 8px !important; }

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.req { color: var(--danger); }
.hint { font-size: 12px; color: var(--muted); margin-top: -8px; }

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

a.maps-link { color: var(--primary); text-decoration: none; }
a.maps-link:hover { text-decoration: underline; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171c;
    --surface: #1d2027;
    --border: #2b2f38;
    --text: #e5e7eb;
    --muted: #9aa2b1;
  }
  th { background: #191c22; }
  tbody tr:hover { background: #23262e; }
  .btn-secondary { background: #2b2f38; color: var(--text); }
  .btn-secondary:hover { background: #343846; }
}
