:root {
  color-scheme: light;
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-soft: #eef3ef;
  --text: #17211d;
  --muted: #60706a;
  --line: #d7e0db;
  --primary: #136f63;
  --primary-dark: #0d554c;
  --accent: #c57b31;
  --danger: #a33232;
  --shadow: 0 18px 48px rgba(28, 47, 39, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-shell {
  width: min(420px, 100%);
}

.login-panel {
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 26px;
  box-shadow: var(--shadow);
}

.login-panel h1 {
  padding-bottom: 8px;
}

.login-intro,
.login-note {
  color: var(--muted);
  line-height: 1.5;
}

.login-note {
  font-size: 0.78rem;
  text-align: center;
}

.login-error {
  border-left: 3px solid var(--danger);
  background: #fff1f1;
  padding: 9px 10px;
  color: var(--danger);
  font-size: 0.82rem;
}

.login-error[hidden] {
  display: none;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 44px;
}

.search-panel,
.results-panel,
.status-strip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.search-panel {
  padding: 22px;
}

.title-row,
.results-header,
.status-strip,
.actions,
.toggle-row,
.legend,
.top-meta,
.google-attribution {
  display: flex;
  align-items: center;
}

.title-row,
.results-header {
  justify-content: space-between;
  gap: 18px;
}

.title-row > div:first-child {
  flex: 0 0 190px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.8rem;
  line-height: 1.1;
}

h2 {
  font-size: 1.25rem;
}

.api-pill,
.mode-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: #fff7ed;
  color: #8a4c14;
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
}

.mode-pill {
  background: #edf4ff;
  color: #315b8a;
}

.top-meta {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.google-attribution {
  min-height: 34px;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.google-attribution img {
  width: 54px;
  height: auto;
  display: block;
}

.api-pill.ok {
  background: #e8f5ef;
  color: var(--primary-dark);
}

.view-tabs {
  display: flex;
  gap: 24px;
  margin-top: 22px;
  border-bottom: 1px solid var(--line);
}

.view-tab {
  min-height: 44px;
  padding: 8px 2px 11px;
  border-radius: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.view-tab:hover {
  background: transparent;
  color: var(--text);
}

.view-tab.active {
  border-bottom-color: var(--primary);
  color: var(--primary-dark);
}

.tab-count {
  min-width: 22px;
  display: inline-grid;
  place-items: center;
  margin-left: 5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.74rem;
}

.api-pill.error {
  background: #ffecec;
  color: var(--danger);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.span-2 {
  grid-column: span 2;
}

.span-4 {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 7px;
}

.field span,
.filter-box legend {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 9px 10px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(19, 111, 99, 0.2);
  outline-offset: 1px;
}

input:disabled {
  background: #f1f3f2;
  color: #8a9691;
}

.filter-box {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.filter-box legend {
  padding: 0 6px;
}

.filter-box label,
.toggle-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #26352f;
  font-size: 0.93rem;
}

.filter-box input,
.toggle-row input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--primary);
}

.toggle-row {
  flex-wrap: wrap;
  gap: 12px 20px;
}

[hidden] {
  display: none !important;
}

.usage-band {
  display: grid;
  gap: 16px;
  padding: 18px 0 4px;
  border-top: 1px solid var(--line);
}

.grid-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 62px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.grid-preview strong {
  display: block;
  line-height: 1.35;
}

.grid-preview strong.ok {
  color: var(--primary-dark);
}

.grid-preview strong.warning {
  color: #8a4c14;
}

.usage-heading,
.usage-state,
.quota-title,
.quota-balance {
  display: flex;
  align-items: center;
}

.usage-heading {
  justify-content: space-between;
  gap: 18px;
}

.usage-heading .status-label {
  margin-bottom: 4px;
}

.usage-state {
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  color: var(--muted);
  font-size: 0.8rem;
}

.usage-state strong {
  color: var(--primary-dark);
  font-size: 0.88rem;
}

.quota-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.quota-stat {
  min-width: 0;
  min-height: 184px;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 16px;
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
}

.quota-stat:last-child {
  border-right: 0;
}

.quota-title {
  min-height: 40px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.quota-title span {
  font-size: 0.88rem;
  font-weight: 850;
}

.quota-title small {
  max-width: 106px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.25;
  text-align: right;
}

.quota-balance {
  align-items: baseline;
  gap: 7px;
  white-space: nowrap;
}

.quota-balance strong {
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
}

.quota-balance span,
.quota-stat p {
  color: var(--muted);
  font-size: 0.76rem;
}

.quota-stat progress {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border: 0;
  border-radius: 4px;
  background: #d7e0db;
}

.quota-stat progress::-webkit-progress-bar {
  background: #d7e0db;
}

.quota-stat progress::-webkit-progress-value {
  background: var(--primary);
}

.quota-stat progress::-moz-progress-bar {
  background: var(--primary);
}

.quota-stat.warning progress::-webkit-progress-value,
.quota-stat.danger progress::-webkit-progress-value {
  background: var(--accent);
}

.quota-stat.warning progress::-moz-progress-bar,
.quota-stat.danger progress::-moz-progress-bar {
  background: var(--accent);
}

.quota-stat.danger .quota-balance strong {
  color: var(--danger);
}

.quota-stat p {
  margin: 0;
}

.quota-stat .quota-guard {
  margin-top: auto;
  color: var(--text);
}

.usage-estimate {
  display: grid;
  grid-template-columns: 112px 1fr;
  align-items: start;
  gap: 14px;
  padding: 2px 0;
}

.usage-estimate .status-label {
  margin: 0;
}

.usage-estimate p {
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 700;
}

.usage-explainer {
  border-top: 1px solid var(--line);
}

.usage-explainer summary {
  padding: 14px 0;
  color: var(--primary-dark);
  font-size: 0.86rem;
  font-weight: 850;
  cursor: pointer;
}

.usage-explanation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--line);
}

.usage-explanation-grid > div {
  min-height: 108px;
  padding: 14px;
  background: var(--surface);
}

.usage-explanation-grid strong {
  display: block;
  margin-bottom: 5px;
  font-size: 0.84rem;
}

.usage-explanation-grid p,
.usage-disclaimer {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.usage-disclaimer {
  padding: 12px 0 14px;
}

.usage-disclaimer a {
  display: inline-block;
  margin-left: 8px;
  white-space: nowrap;
}

.usage-disclaimer a:first-of-type {
  margin-left: 0;
}

.usage-heading h2 {
  color: var(--text);
}

.actions {
  justify-content: flex-end;
  gap: 10px;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: white;
  padding: 10px 16px;
  font-weight: 850;
  cursor: pointer;
}

button:hover {
  background: var(--primary-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

button.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

button.secondary:hover {
  background: var(--surface-soft);
}

button.compact {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.82rem;
}

dialog {
  width: min(430px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(23, 33, 29, 0.48);
}

.key-form {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.icon-button {
  width: 34px;
  min-height: 34px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
}

.icon-button:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.dialog-message {
  color: var(--muted);
  font-size: 0.84rem;
}

.status-strip {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 1px;
  margin: 16px 0;
  overflow: hidden;
  background: var(--line);
}

.status-strip > div {
  padding: 16px;
  background: var(--surface);
}

.status-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.results-panel {
  overflow: hidden;
}

.history-panel {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.history-header {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.history-layout {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  min-height: 520px;
}

.history-list {
  max-height: 680px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
}

.history-item {
  width: 100%;
  min-height: 108px;
  display: grid;
  gap: 7px;
  padding: 15px 18px;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  text-align: left;
}

.history-item:hover,
.history-item.active {
  background: var(--surface-soft);
}

.history-item.active {
  box-shadow: inset 3px 0 0 var(--primary);
}

.history-item-title,
.history-item-meta,
.history-item-footer,
.history-summary,
.history-actions {
  display: flex;
  align-items: center;
}

.history-item-title,
.history-item-footer {
  justify-content: space-between;
  gap: 12px;
}

.history-item-title strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item-meta,
.history-item-footer {
  color: var(--muted);
  font-size: 0.8rem;
}

.history-item-meta {
  gap: 6px;
}

.history-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf4ff;
  color: #315b8a;
  font-size: 0.72rem;
  font-weight: 850;
}

.history-status.completed {
  background: #e8f5ef;
  color: var(--primary-dark);
}

.history-status.failed {
  background: #ffecec;
  color: var(--danger);
}

.history-detail {
  min-width: 0;
  padding: 24px;
}

.history-detail-empty {
  min-height: 360px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.history-detail h3 {
  margin: 0;
  font-size: 1.35rem;
}

.history-detail > p {
  margin: 5px 0 0;
  color: var(--muted);
}

.history-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--line);
}

.history-summary > div {
  min-width: 0;
  padding: 13px;
  background: #fff;
}

.history-summary span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.history-summary strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.history-actions {
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.history-results-preview {
  margin-top: 26px;
  border-top: 1px solid var(--line);
}

.history-result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.history-result-row span {
  color: var(--muted);
  font-size: 0.82rem;
}

.history-empty {
  padding: 28px 18px;
  color: var(--muted);
  text-align: center;
}

.results-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.results-note {
  grid-column: 1 / -1;
  background: var(--surface);
  padding: 10px 14px 14px;
  color: var(--muted);
  font-size: 0.78rem;
}

.results-header p {
  margin-top: 5px;
  color: var(--muted);
}

.post-review-filter {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) repeat(2, minmax(130px, 170px)) auto auto;
  align-items: end;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: #f8faf8;
}

.post-review-filter[hidden] {
  display: none;
}

.post-review-filter > div,
.post-review-filter > label:not(.post-review-checkbox) {
  display: grid;
  gap: 4px;
}

.post-review-filter small,
.post-review-count {
  color: var(--muted);
  font-size: 0.72rem;
}

.post-review-filter input[type="date"] {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 7px 8px;
}

.post-review-checkbox {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.76rem;
  font-weight: 750;
}

.post-review-count {
  grid-column: 1 / -1;
}

.legend {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.78rem;
  font-weight: 850;
}

.tag.no_site {
  background: #edf2f7;
  color: #415163;
}

.tag.whatsapp {
  background: #e7f7ee;
  color: #0f6a3b;
}

.tag.instagram {
  background: #fff0f4;
  color: #a82755;
}

.tag.common_site {
  background: #fff5e8;
  color: #8a4c14;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8faf8;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td {
  font-size: 0.92rem;
}

.business-name {
  display: block;
  font-weight: 850;
}

.address,
.muted {
  color: var(--muted);
}

.link-list {
  display: grid;
  gap: 4px;
}

.contact-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 4px 0 2px;
}

.contact-dot {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
}

.contact-dot:hover {
  text-decoration: none;
}

.phone-dot {
  background: #edf4ff;
  color: #315b8a;
}

.whatsapp-dot,
.whatsapp-channel {
  background: #e7f7ee;
  color: #0f6a3b;
}

.channel-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid currentColor;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 850;
}

.channel-button:hover {
  text-decoration: none;
}

.instagram-channel {
  background: #fff0f4;
  color: #a82755;
}

.business-row td {
  border-bottom: 0;
}

.prospect-funnel-row > td {
  padding: 0 14px 12px;
}

.business-row.contacted td,
.prospect-funnel-row.contacted > td {
  background: #eff9f3;
}

.business-row.contacted td:first-child,
.prospect-funnel-row.contacted > td {
  box-shadow: inset 4px 0 0 #1c8b53;
}

.business-row.site-ready td,
.prospect-funnel-row.site-ready > td {
  background: #f2f7ff;
}

.business-row.site-ready td:first-child,
.prospect-funnel-row.site-ready > td {
  box-shadow: inset 4px 0 0 #315eaa;
}

.prospect-funnel {
  border-top: 1px solid var(--line);
}

.prospect-funnel summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--primary-dark);
  font-size: 0.8rem;
  font-weight: 850;
  cursor: pointer;
}

.prospect-stage {
  min-width: 62px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 4px 8px;
  font-size: 0.72rem;
  text-align: center;
}

.contacted .prospect-stage {
  background: #d9f2e3;
  color: #11673b;
}

.prospect-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  padding: 4px 0 12px;
}

.prospect-check,
.prospect-select {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px 10px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 750;
}

.prospect-check input {
  width: 17px;
  min-height: 17px;
  flex: 0 0 17px;
  accent-color: var(--primary);
}

.prospect-select {
  align-items: stretch;
  flex-direction: column;
  gap: 5px;
}

.prospect-select select {
  min-height: 32px;
  padding: 4px 7px;
  font-size: 0.78rem;
}

.prospect-notes {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 750;
}

.prospect-notes textarea {
  width: 100%;
  min-height: 82px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 11px;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  line-height: 1.45;
}

.prospect-notes textarea:focus {
  border-color: var(--primary);
  outline: 3px solid color-mix(in srgb, var(--primary) 16%, transparent);
}

.site-factory-card {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
  border: 1px solid #cbd8eb;
  border-radius: 12px;
  background: #f6f9ff;
  padding: 15px;
}

.site-factory-heading,
.site-approval-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.site-factory-heading > div {
  display: grid;
  gap: 3px;
}

.site-factory-kicker {
  color: #315eaa;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-template-pill {
  border-radius: 999px;
  background: #e2ebfb;
  color: #244b8d;
  padding: 5px 9px;
  font-size: 0.7rem;
  font-weight: 800;
}

.site-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.site-profile-grid label,
.site-image-upload {
  display: grid;
  gap: 5px;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 800;
}

.site-profile-grid input,
.site-profile-grid textarea,
.site-image-upload input {
  width: 100%;
  border: 1px solid #c7d3e5;
  border-radius: 8px;
  background: #fff;
  padding: 9px 10px;
  color: var(--text);
  font: inherit;
  font-weight: 500;
}

.site-profile-grid textarea {
  resize: vertical;
}

.site-profile-wide {
  grid-column: 1 / -1;
}

.google-services-summary {
  display: grid;
  gap: 6px;
  border: 1px solid #c7d3e5;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 800;
}

.google-services-summary p,
.google-services-summary ul {
  margin: 0;
  color: var(--muted);
  font-weight: 550;
  line-height: 1.45;
}

.google-services-summary ul {
  padding-left: 18px;
}

.google-photo-picker {
  display: grid;
  gap: 10px;
  border-top: 1px solid #d7e1f0;
  padding-top: 13px;
}

.google-photo-picker-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.google-photo-picker-heading > div {
  display: grid;
  gap: 3px;
}

.google-photo-picker-heading small,
.google-photo-empty {
  color: var(--muted);
  font-size: 0.72rem;
}

.google-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.google-photo-empty {
  grid-column: 1 / -1;
  margin: 0;
  border: 1px dashed #bfcde1;
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  text-align: center;
}

.google-photo-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-rows: 150px auto;
  border: 1px solid #c7d3e5;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
}

.google-photo-card > input {
  position: absolute;
  z-index: 2;
  top: 9px;
  left: 9px;
  width: 20px;
  min-height: 20px;
  accent-color: var(--primary);
}

.google-photo-card:has(> input:checked) {
  border-color: #315eaa;
  box-shadow: 0 0 0 2px rgba(49, 94, 170, .14);
}

.google-photo-card > img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  background: var(--surface-soft);
}

.google-photo-card-copy {
  display: grid;
  gap: 3px;
  padding: 9px;
}

.google-photo-card-copy small,
.google-photo-card-copy a,
.google-photo-card-copy > span {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.35;
}

.google-photo-card-copy a {
  color: var(--primary-dark);
}

.site-image-upload small,
.site-image-policy {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 550;
  line-height: 1.4;
}

.site-approval-check {
  min-width: min(100%, 330px);
  border-color: #aebfdb;
}

.site-build-state {
  color: #456087;
  font-size: 0.75rem;
  font-weight: 800;
  text-align: right;
}

.site-ready-link {
  display: inline-flex;
  border-radius: 8px;
  background: #315eaa;
  color: #fff;
  padding: 9px 12px;
}

.site-ready-actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.site-ready-stack {
  display: inline-grid;
  justify-items: end;
  gap: 7px;
}

.site-send-template {
  border: 0;
  background: #138568;
  cursor: pointer;
  font-size: inherit;
  font-weight: 800;
}

.site-send-template:hover {
  background: #0d7057;
}

.template-send-state {
  display: block;
  max-width: 460px;
  line-height: 1.4;
  text-align: right;
}

.template-send-state.success {
  color: #137257;
}

.template-send-state.error {
  color: var(--danger);
}

.site-ready-link-secondary {
  background: #eaf0fa;
  color: #315eaa;
}

.site-ready-link:hover {
  color: #fff;
  text-decoration: none;
}

.site-ready-link-secondary:hover {
  color: #274b88;
}

.template-send-dialog {
  width: min(720px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
  overflow-y: auto;
  border-radius: 14px;
}

.template-send-form {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.template-send-summary {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
}

.template-send-summary img {
  width: 86px;
  height: 86px;
  object-fit: cover;
  object-position: top;
  border-radius: 8px;
  background: #dfe6e3;
}

.template-send-summary div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.template-send-summary strong {
  font-size: 1rem;
}

.template-send-summary span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-send-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.template-send-wide {
  grid-column: 1 / -1;
}

.template-send-grid textarea {
  resize: vertical;
  line-height: 1.5;
}

.template-preview {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #cfe0da;
  border-radius: 11px;
  background: #f4faf7;
}

.template-preview > span {
  color: #3e665a;
  font-size: 0.69rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.template-preview p {
  margin: 0;
  color: #233c34;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-line;
}

.template-preview div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.template-preview div span {
  border-radius: 7px;
  padding: 8px;
  color: #1f6855;
  background: #fff;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 850;
}

.utility-confirmation {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e2c98d;
  border-radius: 10px;
  color: #6c5318;
  background: #fff9e9;
  font-size: 0.76rem;
  font-weight: 650;
  line-height: 1.45;
}

.utility-confirmation input {
  margin-top: 2px;
  accent-color: #138568;
}

.success-message {
  color: #137257;
}

.site-build-error {
  color: var(--danger);
}

.site-image-policy {
  margin: 0;
}

.prospect-save {
  grid-column: 1 / -1;
  min-height: 16px;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: right;
}

a {
  color: var(--primary-dark);
  font-weight: 750;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.error-message {
  color: var(--danger);
  font-weight: 800;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    margin-top: 10px;
  }

  .title-row,
  .results-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .post-review-filter {
    grid-template-columns: 1fr 1fr;
  }

  .post-review-filter > div,
  .post-review-count {
    grid-column: 1 / -1;
  }

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

  .title-row > div:first-child {
    flex-basis: auto;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .span-2,
  .span-4 {
    grid-column: 1;
  }

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

  .actions {
    justify-content: stretch;
  }

  .actions button {
    flex: 1;
  }

  .grid-preview {
    align-items: stretch;
    flex-direction: column;
  }

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

  .quota-stat:nth-child(2n) {
    border-right: 0;
  }

  .quota-stat:nth-child(-n + 4) {
    border-bottom: 1px solid var(--line);
  }

  .usage-heading {
    align-items: flex-start;
  }

  .usage-explanation-grid {
    grid-template-columns: 1fr;
  }

  .view-tabs {
    gap: 20px;
    overflow-x: auto;
  }

  .history-header {
    align-items: flex-start;
  }

  .history-layout {
    grid-template-columns: 1fr;
  }

  .history-list {
    max-height: 380px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .history-detail {
    padding: 18px;
  }

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

  .table-wrap {
    overflow: visible;
    padding: 12px;
  }

  table {
    min-width: 0;
    display: block;
  }

  thead {
    display: none;
  }

  tbody,
  .business-row,
  .prospect-funnel-row,
  .prospect-funnel-row > td {
    display: block;
    width: 100%;
  }

  .business-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
  }

  .business-row td {
    min-width: 0;
    padding: 12px;
    border-bottom: 1px solid var(--line);
  }

  .business-row td:first-child {
    grid-column: 1 / -1;
  }

  .business-row td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 850;
    text-transform: uppercase;
  }

  .prospect-funnel-row {
    margin-bottom: 14px;
  }

  .prospect-funnel-row > td {
    padding: 0 12px;
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 8px 8px;
  }

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

  .site-profile-grid {
    grid-template-columns: 1fr;
  }

  .site-profile-wide {
    grid-column: 1;
  }

  tbody > tr:not(.business-row):not(.prospect-funnel-row) {
    display: block;
  }

  tbody > tr:not(.business-row):not(.prospect-funnel-row) td {
    display: block;
    width: 100%;
  }
}

@media (max-width: 520px) {
  .login-page {
    padding: 12px;
  }

  .login-panel {
    padding: 20px;
  }

  .search-panel {
    padding: 16px;
  }

  .usage-heading {
    flex-direction: column;
    gap: 8px;
  }

  .usage-state {
    align-items: flex-start;
  }

  .quota-grid {
    grid-template-columns: 1fr;
  }

  .quota-stat,
  .quota-stat:nth-child(2n) {
    min-height: 168px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .quota-stat:last-child {
    border-bottom: 0;
  }

  .usage-estimate {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .usage-disclaimer a {
    display: block;
    margin: 7px 0 0;
    white-space: normal;
  }

  .business-row {
    grid-template-columns: 1fr;
  }

  .business-row td:first-child {
    grid-column: 1;
  }

  .prospect-controls {
    grid-template-columns: 1fr;
  }

  .site-factory-heading,
  .site-approval-row {
    align-items: stretch;
    flex-direction: column;
  }

  .site-template-pill,
  .site-build-state {
    align-self: flex-start;
    text-align: left;
  }
}

@media (max-width: 620px) {
  .template-send-form {
    padding: 16px;
  }

  .template-send-grid,
  .template-preview div {
    grid-template-columns: 1fr;
  }

  .template-send-wide {
    grid-column: 1;
  }

  .template-send-summary {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .template-send-summary img {
    width: 68px;
    height: 68px;
  }

  .site-ready-stack,
  .site-ready-actions {
    width: 100%;
    justify-content: stretch;
  }

  .site-ready-link {
    justify-content: center;
  }
}

.campaigns-panel {
  margin-top: 18px;
  display: grid;
  gap: 18px;
}

.campaigns-panel[hidden] {
  display: none;
}

.campaigns-header,
.campaign-form,
.campaign-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.campaigns-header {
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.campaigns-header p:last-child {
  margin-top: 7px;
  color: var(--muted);
}

.campaign-form {
  padding: 22px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.campaign-form-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 4px;
}

.campaign-form-heading div {
  display: grid;
  gap: 4px;
}

.campaign-form-heading p,
.campaign-guard p {
  color: var(--muted);
  font-size: 0.84rem;
}

.campaign-form textarea {
  resize: vertical;
}

.campaign-guard {
  padding: 13px 14px;
  border-left: 3px solid var(--accent);
  background: #fff8ef;
  display: grid;
  gap: 4px;
}

.campaign-list {
  display: grid;
  gap: 18px;
}

.campaign-card {
  padding: 22px;
  display: grid;
  gap: 18px;
}

.campaign-card-header,
.strategy-line,
.campaign-actions,
.campaign-manual-events {
  display: flex;
  align-items: center;
  gap: 12px;
}

.campaign-card-header {
  justify-content: space-between;
}

.campaign-card-header h3 {
  margin: 5px 0 4px;
  font-size: 1.2rem;
}

.campaign-card-header p,
.strategy-line p {
  color: var(--muted);
  font-size: 0.84rem;
}

.campaign-status,
.strategy-branch {
  display: inline-flex;
  width: fit-content;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--primary-dark);
  font-size: 0.72rem;
  font-weight: 800;
}

.campaign-status.failed {
  background: #fff0f0;
  color: var(--danger);
}

.campaign-status.active,
.campaign-status.ready {
  background: #e8f5ef;
}

.campaign-spend {
  min-width: 150px;
  display: grid;
  justify-items: end;
  gap: 2px;
}

.campaign-spend span,
.campaign-spend small,
.campaign-kpis span {
  color: var(--muted);
  font-size: 0.72rem;
}

.campaign-spend strong {
  font-size: 1.25rem;
}

.strategy-line {
  flex-wrap: wrap;
  padding: 13px 14px;
  background: var(--surface-soft);
  border-radius: 7px;
}

.strategy-line > div {
  display: grid;
  gap: 2px;
}

.strategy-line > div span {
  color: var(--muted);
  font-size: 0.72rem;
}

.strategy-line p {
  flex: 1 1 260px;
}

.campaign-kpis {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.campaign-kpis > div {
  min-height: 78px;
  padding: 12px;
  display: grid;
  align-content: center;
  gap: 5px;
  border-right: 1px solid var(--line);
}

.campaign-kpis > div:last-child {
  border-right: 0;
}

.campaign-kpis strong {
  font-size: 1.3rem;
}

.campaign-actions {
  flex-wrap: wrap;
}

.campaign-consent {
  flex: 1 1 300px;
  color: var(--muted);
  font-size: 0.78rem;
}

.campaign-consent.marketing {
  color: var(--primary-dark);
  font-weight: 800;
}

.campaign-error {
  padding: 9px 10px;
  border-left: 3px solid var(--danger);
  background: #fff0f0;
  color: var(--danger);
  font-size: 0.82rem;
}

.campaign-funnel-wrap {
  overflow-x: auto;
}

.campaign-funnel {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.campaign-funnel th,
.campaign-funnel td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.campaign-funnel th {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.campaign-manual-events {
  flex-wrap: wrap;
  padding-top: 2px;
}

.campaign-manual-events > span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.campaign-manual-events input,
.campaign-manual-events select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 8px 10px;
}

@media (max-width: 900px) {
  .campaign-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .campaign-form .span-4 {
    grid-column: 1 / -1;
  }

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

  .campaign-kpis > div {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 620px) {
  .campaigns-header,
  .campaign-card-header,
  .campaign-form-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .campaign-form {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .campaign-form .span-2,
  .campaign-form .span-4 {
    grid-column: 1;
  }

  .campaign-spend {
    justify-items: start;
  }

  .campaign-kpis {
    grid-template-columns: 1fr 1fr;
  }

  .campaign-actions button,
  .campaign-consent {
    width: 100%;
  }
}
