:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --panel-soft: #eef6f4;
  --ink: #18212b;
  --muted: #62707f;
  --line: #d9e0e6;
  --line-strong: #bdc8d2;
  --primary: #0f766e;
  --primary-dark: #0b5e58;
  --accent: #b45309;
  --danger: #b42318;
  --success: #137333;
  --shadow: 0 16px 38px rgba(24, 33, 43, 0.08);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button,
a.button {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0 14px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  white-space: nowrap;
}

button:hover,
a.button:hover {
  border-color: var(--primary);
}

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

.primary-button {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

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

.quiet-button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--muted);
}

.danger-text {
  color: var(--danger);
}

.loading-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--primary);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0;
}

.app-frame {
  min-height: 100vh;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand-copy strong {
  font-size: 1rem;
}

.brand-copy span,
.small-muted,
label span {
  color: var(--muted);
  font-size: 0.86rem;
}

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

.code-chip,
.status-pill {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  min-height: 34px;
  padding: 6px 12px;
  background: #f8fafb;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.status-pill {
  color: var(--success);
  background: #eef8f1;
  border-color: #c8e3d0;
  font-size: 0.84rem;
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(320px, 1.15fr);
  background: #ffffff;
}

.auth-side {
  padding: 44px;
  background: #102a43;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
}

.auth-side .brand-mark {
  background: #ffffff;
  color: #102a43;
}

.auth-side h1 {
  margin: 28px 0 14px;
  font-size: 2.1rem;
  line-height: 1.08;
}

.auth-side p {
  max-width: 44ch;
  color: #cbd8e4;
  line-height: 1.6;
}

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

.auth-metrics div {
  border-top: 1px solid rgba(255, 255, 255, 0.24);
  padding-top: 14px;
}

.auth-metrics strong {
  display: block;
  font-size: 1.4rem;
}

.auth-metrics span {
  color: #cbd8e4;
}

.auth-panel {
  display: grid;
  align-content: center;
  padding: 40px;
}

.form-surface {
  width: min(620px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.tab-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 22px;
}

.tab-row button {
  border-color: transparent;
  background: #f1f4f6;
}

.tab-row button.active {
  background: var(--ink);
  color: #ffffff;
}

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

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 700;
  color: var(--ink);
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 9px 11px;
  background: #ffffff;
  color: var(--ink);
}

input:focus,
select:focus,
button:focus-visible,
a.button:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.22);
  outline-offset: 2px;
}

.notice {
  border-radius: 7px;
  border: 1px solid #f0d3c2;
  background: #fff7ed;
  color: #8a3b0a;
  padding: 11px 12px;
  line-height: 1.45;
}

.notice.success {
  border-color: #c8e3d0;
  background: #eef8f1;
  color: var(--success);
}

.dashboard {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px 28px 48px;
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric {
  min-height: 108px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 16px;
  display: grid;
  align-content: space-between;
  gap: 12px;
}

.metric span {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

.metric strong {
  font-size: 1.34rem;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.92fr) minmax(420px, 1.08fr);
  gap: 18px;
  align-items: start;
}

/* No campaign URL yet, so the preview panel is absent -- let the form span the row
   rather than leaving a half-width gap. */
.workspace-grid.is-single {
  grid-template-columns: 1fr;
}

.panel,
.data-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.panel-header {
  padding: 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-header h2,
.data-section h2 {
  margin: 0;
  font-size: 1.08rem;
}

.panel-body {
  padding: 18px;
}

.campaign-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

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

.campaign-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
}

.campaign-row.active {
  border-color: var(--primary);
  background: var(--panel-soft);
}

.campaign-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.campaign-main strong,
.url-line {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.url-line {
  color: var(--muted);
  font-size: 0.86rem;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preview-toolbar {
  min-width: 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.preview-url {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.84rem;
}

.preview-card {
  display: grid;
  gap: 14px;
  padding: 20px 22px 24px;
  background: #edf1f4;
  border-radius: 0 0 var(--radius) var(--radius);
}

.preview-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.preview-card-head strong {
  display: block;
  font-size: 17px;
}

.preview-card-head span {
  display: block;
}

.password-field {
  position: relative;
  display: block;
}

/* Room for the button so a long password never runs underneath it. */
.password-field input {
  width: 100%;
  padding-right: 46px;
}

.password-reveal {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #6b7280);
  cursor: pointer;
}

.password-reveal:hover {
  color: var(--ink, #122019);
  background: rgba(15, 118, 110, 0.08);
}

.password-reveal:focus-visible {
  outline: 2px solid var(--teal, #0f766e);
  outline-offset: 2px;
}

.link-button {
  justify-self: start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--teal, #0f766e);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.link-button:hover {
  color: var(--teal-deep, #0f4c40);
}

.security-panel {
  gap: 14px;
}

.security-panel .notice {
  margin: 0;
}

.recovery-panel {
  display: grid;
  gap: 14px;
  justify-items: start;
}

.recovery-panel h2 {
  margin: 0;
  font-size: 20px;
}

.recovery-panel p {
  margin: 0;
}

.already-premium {
  display: grid;
  gap: 12px;
  justify-items: start;
  padding: 28px 26px;
}

.already-premium h2 {
  margin: 0;
  font-size: 22px;
}

.already-premium p {
  margin: 0;
}

.already-premium-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
  color: var(--teal, #0f766e);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.outreach-block {
  display: grid;
  gap: 12px;
  padding: 20px 22px;
  border-top: 1px solid var(--line, #e6eae7);
}

.outreach-block h3 {
  margin: 0;
  font-size: 16px;
}

.outreach-text {
  width: 100%;
  resize: vertical;
  font: 400 14px/1.55 var(--sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  color: var(--body, #334640);
  background: var(--paper, #ffffff);
  border: 1px solid var(--line, #e6eae7);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.outreach-block code {
  font-family: var(--mono, ui-monospace, Menlo, Consolas, monospace);
  background: rgba(15, 118, 110, 0.10);
  padding: 1px 5px;
  border-radius: 4px;
}

.campaign-url-block {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  background: var(--paper, #ffffff);
  border: 1px solid var(--line, #e6eae7);
  border-radius: var(--radius);
}

.campaign-url-label {
  font-weight: 600;
  font-size: 14px;
}

.campaign-url-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.campaign-url-input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--mono, ui-monospace, Menlo, Consolas, monospace);
  font-size: 13px;
  padding: 10px 12px;
}

@media (max-width: 640px) {
  .campaign-url-row {
    flex-direction: column;
  }
}

.preview-card code {
  font-family: var(--mono, ui-monospace, Menlo, Consolas, monospace);
  background: rgba(15, 118, 110, 0.10);
  padding: 1px 5px;
  border-radius: 4px;
}

.empty-state {
  min-height: 230px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 28px;
}

.data-section {
  margin-top: 18px;
  overflow: hidden;
}

.data-section h2 {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

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

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

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

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

td strong {
  display: block;
}

.money {
  font-weight: 800;
}

.checkout-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(320px, 1.05fr);
  background: #ffffff;
}

.checkout-info {
  padding: 38px;
  background: #f4f8f6;
  border-right: 1px solid var(--line);
  display: grid;
  align-content: center;
  gap: 22px;
}

.checkout-info h1 {
  margin: 0;
  font-size: 2rem;
}

.checkout-detail-grid,
.receipt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.detail-box,
.receipt-box {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  padding: 14px;
  display: grid;
  gap: 6px;
}

.detail-box span,
.receipt-box span {
  color: var(--muted);
  font-size: 0.82rem;
}

.detail-box strong,
.receipt-box strong {
  overflow-wrap: anywhere;
}

.checkout-form-wrap {
  padding: 38px;
  display: grid;
  align-content: center;
}

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

.receipt-reference {
  border: 1px solid #c8e3d0;
  border-radius: var(--radius);
  background: #eef8f1;
  padding: 18px;
  display: grid;
  gap: 6px;
}

.receipt-reference strong {
  font-size: 1.42rem;
  overflow-wrap: anywhere;
}

.demo-banner {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid #f0c27a;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: #fdf6ec;
  color: #7a4a08;
  font-size: 0.9rem;
  line-height: 1.45;
}

.demo-banner strong {
  color: var(--accent);
}

.method-picker {
  margin: 0;
  padding: 0;
  border: 0;
}

.method-picker legend {
  padding: 0 0 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.method-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.method-tab {
  flex: 1 1 auto;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.method-tab:hover {
  border-color: var(--primary);
  color: var(--ink);
}

.method-tab.is-active {
  border-color: var(--primary);
  background: var(--panel-soft);
  color: var(--primary-dark);
  font-weight: 600;
}

.instrument-picker {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 8px;
}

.instrument-picker legend {
  padding: 0 0 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.instrument-option {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
}

.instrument-option:hover {
  border-color: var(--primary);
}

.instrument-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--panel-soft);
}

.instrument-option input {
  width: auto;
  margin: 0;
}

.instrument-copy {
  display: grid;
  gap: 2px;
}

.embed-block {
  padding: 16px 18px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.embed-block h3 {
  margin: 0;
  font-size: 0.98rem;
}

.embed-block .section-hint {
  margin: 0;
}

.embed-block code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--panel-soft);
  font-size: 0.82rem;
}

.embed-code {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
}

.delete-confirm {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #f0c27a;
  border-radius: var(--radius);
  background: #fdf6ec;
}

.delete-confirm p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #7a4a08;
}

.payout-current {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.consent {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.consent input {
  width: auto;
  margin-top: 3px;
}

.section-hint {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.subscription-summary {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
}

.subscription-summary h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--success);
}

.subscription-summary p {
  margin: 0;
  line-height: 1.55;
}

.manage-link {
  display: flex;
  gap: 8px;
}

.manage-link input {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.danger-button {
  border-color: var(--danger);
  background: var(--danger);
}

.danger-button:hover {
  border-color: #8f1c12;
  background: #8f1c12;
}

.status-pill.is-off {
  color: var(--muted);
}

@media (max-width: 980px) {
  .auth-layout,
  .checkout-layout,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .auth-side,
  .checkout-info {
    min-height: auto;
  }

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

@media (max-width: 680px) {
  .topbar,
  .dashboard,
  .auth-side,
  .auth-panel,
  .checkout-info,
  .checkout-form-wrap {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .auth-side h1,
  .checkout-info h1 {
    font-size: 1.65rem;
  }

  .two-col,
  .summary-band,
  .campaign-form,
  .checkout-detail-grid,
  .receipt-grid {
    grid-template-columns: 1fr;
  }

  .campaign-form .primary-button {
    width: 100%;
  }

  .preview-card {
    padding: 16px 16px 20px;
  }
}
