:root {
  color-scheme: light;
  --ink: #19221d;
  --muted: #637168;
  --line: #d8e1d8;
  --panel: #ffffff;
  --paper: #f2f7ef;
  --accent: #0c8a63;
  --accent-strong: #006b50;
  --soft: #edf7f0;
  --rose: #d45d6e;
  --blue: #3d6ea8;
  --shadow: 0 16px 36px rgba(34, 52, 42, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #e5f3e8 0, #f7faf5 230px, var(--paper) 100%);
  color: var(--ink);
  font-family:
    Inter, "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui,
    sans-serif;
}

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

button,
.search-link {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: 0;
}

h2 {
  font-size: 21px;
  letter-spacing: 0;
}

h3 {
  font-size: 18px;
  letter-spacing: 0;
}

.topbar {
  align-items: center;
  display: grid;
  gap: 16px;
  grid-template-columns: auto 1fr auto;
  padding: 22px clamp(18px, 4vw, 48px) 16px;
}

.brand {
  min-width: 0;
}

.top-actions {
  justify-self: start;
}

.header-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.hidden {
  display: none;
}

.sync-status {
  background: var(--soft);
  border: 1px solid #cfe0d5;
  border-radius: 999px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  min-height: 32px;
  padding: 7px 11px;
}

.eyebrow {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.primary {
  background: var(--accent);
  box-shadow: 0 8px 18px rgba(12, 138, 99, 0.22);
  color: #fff;
}

.secondary,
.search-link {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.app-shell {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
  padding: 0 clamp(18px, 4vw, 48px) 22px;
}

.panel,
.detail-card,
.settings-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.search-panel,
.results-panel,
.detail-card,
.settings-box {
  padding: 20px;
}

.search-panel {
  display: grid;
  gap: 14px;
}

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

.search-main {
  align-items: end;
  background: #f9fcf8;
  border: 1px solid #cfe1d2;
  border-radius: 12px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(260px, 1.4fr) minmax(180px, 0.7fr) 132px;
  padding: 12px;
}

.search-submit {
  min-height: 46px;
}

.area-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.area-presets button {
  background: #fff;
  border: 1px solid #cfe1d2;
  border-radius: 999px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  min-height: 30px;
  padding: 0 12px;
}

.area-presets button:hover,
.area-presets button.is-active,
.search-link:hover,
.lead-row:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 18px rgba(34, 52, 42, 0.08);
}

.area-presets button.is-active {
  background: var(--accent);
  color: #fff;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 900;
  gap: 7px;
}

input,
select,
textarea {
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 42px;
  padding: 10px 11px;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(12, 138, 99, 0.12);
  outline: none;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.auto-source {
  background: var(--soft);
  border: 1px solid #cfe0d5;
  border-radius: 999px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
  padding: 9px 13px;
  width: max-content;
}

.search-footer {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 0.8fr) 1fr;
}

.search-links {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.helper-text {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.7;
  max-width: 900px;
}

.run-status {
  background: var(--soft);
  border: 1px solid #cfe0d5;
  border-radius: 8px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  padding: 10px;
}

.workspace {
  display: grid;
  gap: 18px;
}

.summary-band {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}

.summary-band article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 92px;
  padding: 16px;
}

.summary-band span {
  display: block;
  font-size: 26px;
  font-weight: 950;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.summary-band p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  margin-top: 8px;
}

.results-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
}

.results-panel {
  min-width: 0;
  overflow: hidden;
}

.panel-head {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.results-panel .panel-head {
  background: #f9fcf8;
  border-bottom: 1px solid var(--line);
  margin: -20px -20px 16px;
  padding: 18px 20px;
}

.panel-head input {
  max-width: 320px;
}

.panel-subcopy {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin-top: 6px;
}

.result-tools {
  display: grid;
  gap: 10px;
  grid-template-columns: 150px minmax(220px, 320px);
}

.lead-list {
  display: grid;
  gap: 12px;
}

.lead-row {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr auto;
  padding: 16px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.lead-row:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(12, 138, 99, 0.12);
  outline: none;
}

.lead-row.is-selected {
  border-color: var(--accent);
  box-shadow:
    inset 4px 0 0 var(--accent),
    0 12px 26px rgba(34, 52, 42, 0.09);
}

.lead-row:hover {
  transform: translateY(-1px);
}

.name-row,
.socials {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lead-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin-top: 7px;
}

.lead-source {
  color: #526258;
  font-size: 12px;
  font-weight: 800;
  margin-top: 6px;
}

.badge {
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  min-height: 25px;
  padding: 4px 9px;
}

.score {
  background: #2f6f8f;
}

.status-unreached {
  background: var(--rose);
}

.status-contacted {
  background: var(--blue);
}

.excluded {
  background: #5f6670;
}

.detail-panel {
  position: sticky;
  top: 16px;
}

.detail-card {
  border-top: 4px solid var(--accent);
  display: grid;
  gap: 16px;
}

.detail-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}

.detail-grid div {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.detail-grid dt,
.section-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.detail-grid dd {
  font-size: 15px;
  font-weight: 900;
  margin: 7px 0 0;
  overflow-wrap: anywhere;
}

.detail-socials {
  display: grid;
  gap: 8px;
}

.signal-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.signal-list span {
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #33413a;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  min-height: 30px;
  padding: 5px 10px;
}

.social-link {
  background: var(--soft);
  border: 1px solid #cfe0d5;
  border-radius: 999px;
  color: var(--accent-strong);
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  min-height: 30px;
  padding: 5px 10px;
  text-decoration: none;
}

.attack-check {
  align-items: center;
  background: var(--soft);
  border: 1px solid #cfe0d5;
  border-radius: 12px;
  color: var(--accent-strong);
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  font-weight: 900;
  gap: 9px;
  min-height: 42px;
  padding: 0 12px;
  width: max-content;
}

.attack-check.large {
  font-size: 16px;
  min-height: 50px;
}

.attack-check input {
  accent-color: var(--accent);
  min-height: auto;
  padding: 0;
  width: auto;
}

.disabled-check {
  cursor: not-allowed;
  opacity: 0.5;
}

.is-excluded {
  background: #f5f6f5;
  opacity: 0.82;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.7;
  padding: 34px;
  text-align: center;
}

dialog {
  border: 0;
  padding: 0;
  width: min(560px, calc(100vw - 28px));
}

dialog::backdrop {
  background: rgba(23, 32, 27, 0.35);
}

.settings-box {
  display: grid;
  gap: 14px;
}

@media (max-width: 1120px) {
  .results-layout {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }

  .summary-band {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .search-main,
  .search-footer {
    grid-template-columns: 1fr;
  }

  .search-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .summary-band,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .lead-row {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .panel-head {
    display: grid;
  }

  .panel-head input,
  .result-tools,
  .attack-check {
    max-width: none;
    width: 100%;
  }

  .result-tools {
    grid-template-columns: 1fr;
  }
}
