:root {
  --bg: #f4f1e8;
  --panel: rgba(255, 252, 245, 0.88);
  --panel-border: rgba(63, 76, 52, 0.14);
  --text: #1d241b;
  --muted: #5f6958;
  --accent: #1d8b62;
  --accent-deep: #136347;
  --shadow: 0 24px 70px rgba(34, 48, 31, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(68, 162, 114, 0.16), transparent 35%),
    radial-gradient(circle at bottom right, rgba(242, 188, 83, 0.18), transparent 30%),
    var(--bg);
}

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

.shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  padding: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
  color: var(--accent-deep);
  font-weight: 700;
}

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

h1 {
  font-size: clamp(40px, 5vw, 64px);
  line-height: 0.95;
  margin-bottom: 16px;
}

.lede,
.muted,
.status-message,
td,
th {
  color: var(--muted);
}

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

label {
  display: grid;
  gap: 8px;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(38, 61, 42, 0.16);
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.8);
}

textarea {
  min-height: 180px;
  resize: vertical;
  color: var(--text);
  font: 13px/1.45 Consolas, "Courier New", monospace;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--accent), #3d9d73);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

a.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 12px 18px;
  text-decoration: none;
  font-weight: 700;
}

button.secondary {
  background: #dcecdf;
  color: #1b4c36;
}

button.danger {
  background: #fee2e2;
  color: #991b1b;
}

a.button-link.secondary {
  background: #dcecdf;
  color: #1b4c36;
}

button.ghost {
  background: transparent;
  color: var(--accent-deep);
  border: 1px solid rgba(29, 99, 71, 0.2);
}

.workspace {
  margin-top: 28px;
  display: grid;
  gap: 20px;
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.workspace-actions {
  display: flex;
  gap: 12px;
  align-items: end;
}

.dashboard-shell .workspace-header {
  align-items: flex-start;
  flex-wrap: wrap;
}

.dashboard-shell .workspace-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.limit-picker {
  min-width: 88px;
}

.customer-search-picker {
  min-width: 240px;
}

body.tracking-dashboard .workspace-header {
  align-items: flex-start;
  flex-wrap: wrap;
}

body.tracking-dashboard .workspace-header > div:first-child {
  flex: 1 1 360px;
}

body.tracking-dashboard .workspace-actions {
  flex: 1 1 620px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

body.tracking-dashboard .workspace-actions .limit-picker {
  min-width: 150px;
}

body.tracking-dashboard .workspace-actions .page-picker {
  min-width: 240px;
}

.stats-grid,
.views-grid {
  display: grid;
  gap: 20px;
}

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

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

.pseo-grid {
  grid-template-columns: minmax(360px, 0.9fr) minmax(0, 1.1fr);
}

.stat-card p {
  margin-bottom: 10px;
}

.stat-card strong {
  font-size: 36px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 14px 10px;
  border-bottom: 1px solid rgba(63, 76, 52, 0.1);
  vertical-align: top;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.person {
  display: grid;
  gap: 4px;
}

.primary-text {
  color: var(--text);
  font-weight: 600;
}

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(29, 139, 98, 0.1);
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 700;
}

a.chip {
  text-decoration: none;
}

.status-panel {
  color: var(--muted);
}

.status-panel--success {
  border-color: rgba(29, 139, 98, 0.28);
  color: var(--accent-deep);
}

.status-panel--error {
  border-color: rgba(155, 44, 44, 0.28);
  color: #9b2c2c;
}

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

.evidence-form button,
.wide-field {
  grid-column: 1 / -1;
}

.checkbox-field {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 10px;
}

.checkbox-field input {
  width: auto;
}

.inventory-list {
  display: grid;
  gap: 20px;
}

.dashboard-shell {
  width: min(1440px, calc(100% - 32px));
}

.dashboard-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 240px)) auto minmax(180px, 1fr);
  gap: 14px;
  align-items: end;
}

.dashboard-filters .status-message {
  margin: 0;
}

.funnel-filters {
  grid-template-columns: minmax(260px, 420px) repeat(2, minmax(180px, 220px)) auto minmax(180px, 1fr);
}

.leads-filters {
  grid-template-columns: minmax(280px, 1fr) minmax(220px, 320px) minmax(100px, 140px) auto minmax(180px, 1fr);
}

.sme-metrics-filters {
  grid-template-columns: repeat(2, minmax(180px, 220px)) auto minmax(180px, 1fr);
}

.funnel-table {
  min-width: 760px;
}

.leads-heading {
  gap: 16px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  text-align: right;
}

.pagination-controls button {
  padding: 9px 14px;
}

.pagination-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.leads-table {
  min-width: 1320px;
}

.sme-metrics-table {
  min-width: 1500px;
}

.customers-table {
  min-width: 2100px;
}

.table-action-button {
  width: fit-content;
  padding: 8px 11px;
  font-size: 0.78rem;
}

.email-history-cell {
  max-width: 360px;
  min-width: 280px;
  text-align: left !important;
  line-height: 1.55;
}

.email-history-item {
  color: var(--muted);
  font-size: 13px;
}

.email-history-separator {
  color: rgba(95, 105, 88, 0.58);
  font-weight: 700;
}

.hosted-sites-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.42fr) minmax(0, 1fr);
  gap: 20px;
}

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

.site-config-item {
  display: grid;
  width: 100%;
  gap: 10px;
  border: 1px solid rgba(63, 76, 52, 0.12);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--text);
  text-align: left;
}

.site-config-item.selected {
  border-color: rgba(29, 139, 98, 0.45);
  background: rgba(29, 139, 98, 0.1);
}

.site-config-item small,
.domain-list {
  color: var(--muted);
}

.site-editor-panel {
  min-width: 0;
}

.site-editor-form {
  display: grid;
  gap: 16px;
}

.create-site-form,
.add-page-form {
  display: grid;
  gap: 12px;
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid rgba(63, 76, 52, 0.12);
}

.create-site-form h3,
.add-page-form h3 {
  margin: 0;
}

.add-page-form {
  grid-template-columns: minmax(160px, 0.85fr) minmax(180px, 1fr) minmax(160px, 0.85fr) auto;
  align-items: end;
  margin-top: 0;
  padding: 16px;
  border: 1px solid rgba(63, 76, 52, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
}

.add-page-form h3,
.add-page-form .status-message {
  grid-column: 1 / -1;
}

.editor-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  gap: 12px;
  align-items: end;
}

.text-editor-section,
.page-meta-editor,
.block-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.text-editor-section {
  grid-template-columns: 1fr;
}

.page-meta-editor {
  padding: 16px;
  border: 1px solid rgba(63, 76, 52, 0.12);
  border-radius: 8px;
  background: rgba(250, 248, 241, 0.72);
}

.block-editor-list {
  display: grid;
  gap: 14px;
}

.block-editor {
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(63, 76, 52, 0.12);
  border-radius: 8px;
  background: white;
}

.block-editor legend {
  padding: 0 6px;
  color: var(--accent-deep);
  font-weight: 800;
}

.wide-field,
.text-editor-section label:nth-child(4),
.text-editor-section label:nth-child(6) {
  grid-column: 1 / -1;
}

.text-editor-section textarea,
.block-field-grid textarea {
  min-height: 120px;
  font-family: inherit;
}

.block-field-grid small {
  color: var(--muted);
  font-size: 0.78rem;
}

.preview-frame-wrap {
  overflow: hidden;
  border: 1px solid rgba(63, 76, 52, 0.14);
  border-radius: 16px;
  background: white;
}

.preview-frame-wrap iframe {
  display: block;
  width: 100%;
  height: min(70vh, 760px);
  border: 0;
}

.advanced-json {
  display: grid;
  gap: 14px;
  border: 1px solid rgba(63, 76, 52, 0.12);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.35);
}

.advanced-json summary {
  cursor: pointer;
  color: var(--accent-deep);
  font-weight: 700;
}

.advanced-json label {
  margin-top: 14px;
}

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

.domain-chip {
  text-decoration: none;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.leads-table td:not(:first-child),
.leads-table th:not(:first-child) {
  text-align: left;
}

.leads-table td:first-child {
  white-space: nowrap;
}

.notes-cell {
  max-width: 340px;
  color: var(--muted);
}

.funnel-table th:first-child,
.funnel-table td:first-child,
.funnel-table th:last-child,
.funnel-table td:last-child {
  text-align: left;
}

.funnel-table td:nth-child(2),
.funnel-table td:nth-child(3) {
  color: var(--text);
  font-weight: 700;
}

.distinct-user-cell {
  white-space: nowrap;
}

.text-action {
  margin-left: 10px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #dcecdf;
  color: #1b4c36;
  font-size: 12px;
}

.csv-output {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border-radius: 14px;
  border: 1px solid rgba(38, 61, 42, 0.16);
  padding: 14px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  font: 14px/1.6 Consolas, "Courier New", monospace;
}

.dashboard-stats .stat-card strong {
  font-size: 30px;
  line-height: 1.1;
}

.dense-table {
  min-width: 1180px;
}

.schedule-table {
  min-width: 2320px;
}

.dense-table th,
.dense-table td {
  padding: 12px 10px;
}

.dense-table td:not(:first-child),
.dense-table th:not(:first-child) {
  text-align: right;
}

.schedule-table td:nth-child(2),
.schedule-table th:nth-child(2) {
  text-align: left;
}

.sender-summary-row td {
  background: rgba(29, 139, 98, 0.08);
  border-top: 1px solid rgba(29, 99, 71, 0.18);
  border-bottom-color: rgba(29, 99, 71, 0.16);
}

.schedule-total-row td {
  background: rgba(29, 139, 98, 0.1);
  border-top: 1px solid rgba(29, 99, 71, 0.2);
  border-bottom-color: rgba(29, 99, 71, 0.18);
  color: var(--text);
  font-weight: 700;
}

.sender-summary-row td:first-child .primary-text {
  color: var(--accent-deep);
}

.template-detail {
  padding-left: 18px;
  border-left: 3px solid rgba(29, 139, 98, 0.18);
}

.template-outbox-list {
  display: grid;
  gap: 22px;
}

.template-outbox-section {
  display: grid;
  gap: 12px;
}

.template-outbox-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.template-outbox-table {
  min-width: 1180px;
}

.sender-spacer-row td {
  height: 14px;
  padding: 0;
  border: 0;
  background: transparent;
}

.stacked-list {
  display: grid;
  gap: 16px;
}

.inventory-section {
  display: grid;
  gap: 10px;
}

.inventory-section h4 {
  margin: 0;
}

.inventory-item {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid rgba(63, 76, 52, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.45);
}

.inventory-item span {
  color: var(--muted);
  font-size: 13px;
}

.hidden {
  display: none;
}

.empty-state {
  padding: 20px 0;
  color: var(--muted);
}

.background-glow {
  position: fixed;
  inset: auto;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.35;
  pointer-events: none;
}

.background-glow-a {
  top: 40px;
  right: 40px;
  background: rgba(29, 139, 98, 0.35);
}

.background-glow-b {
  bottom: 60px;
  left: 20px;
  background: rgba(242, 188, 83, 0.35);
}

.kids-shell {
  max-width: 1180px;
}

.kids-hero {
  min-height: 220px;
  display: grid;
  align-items: end;
  padding: 32px 0 24px;
}

.kids-hero h1 {
  max-width: 760px;
}

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

.kids-form,
.kids-admin-login,
.kids-setup-form {
  display: grid;
  gap: 14px;
}

.kids-admin-login {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}

.kids-admin-login .status-message {
  grid-column: 1 / -1;
}

.kids-setup-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  margin-top: 16px;
}

.current-session {
  display: grid;
  gap: 4px;
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid rgba(29, 139, 98, 0.18);
  border-radius: 16px;
  background: rgba(29, 139, 98, 0.08);
}

.current-session span {
  color: var(--muted);
}

.admin-login-panel {
  margin-top: 20px;
}

@media (max-width: 960px) {
  .hero,
  .views-grid,
  .stats-grid,
  .kids-grid,
  .kids-admin-login {
    grid-template-columns: 1fr;
  }

  .workspace-header {
    display: grid;
  }

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

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

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

  .dashboard-filters {
    grid-template-columns: 1fr;
  }

  .pagination-controls {
    justify-content: flex-start;
    flex-wrap: wrap;
    text-align: left;
  }

  .template-outbox-heading {
    display: grid;
  }

  .hosted-sites-grid {
    grid-template-columns: 1fr;
  }

  .editor-toolbar,
  .text-editor-section,
  .page-meta-editor,
  .block-field-grid,
  .add-page-form {
    grid-template-columns: 1fr;
  }
}
