:root {
  color-scheme: light;
  --ink: #0f231f;
  --muted: #5b756f;
  --line: #dce9e5;
  --surface: #ffffff;
  --bg: #f4faf8;
  --brand: #0f6e5f;
  --brand-dark: #0b5347;
  --brand-darker: #0b3d33;
  --tint-50: #f0fdf9;
  --tint-100: #e6f4f1;
  --tint-200: #cfe9e1;
  --tint-300: #7fe0c4;
  --error: #b42318;
  --error-bg: #fdecec;
  --success: #087443;
  --success-bg: #e3f6ec;
  --warn: #92400e;
  --warn-bg: #fef3c7;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% -10%, rgba(15, 110, 95, 0.14), transparent 32rem), var(--bg);
}

button,
input,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

/* Header */

header.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(20px, 4vw, 56px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

header.site-header h1 {
  font-size: 17px;
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}

header.site-header h1::before {
  content: '';
  display: inline-block;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(155deg, var(--brand), var(--brand-dark));
  box-shadow: 0 8px 20px rgba(15, 110, 95, 0.22);
}

main {
  width: min(1040px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(28px, 5vw, 52px) 0 72px;
}

/* Login/register layout: pitch on the left, form on the right, on wide screens */

#login-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  align-items: start;
  gap: clamp(24px, 4vw, 48px);
}

@media (max-width: 860px) {
  #login-view {
    grid-template-columns: 1fr;
  }
}

.pitch {
  padding-top: 4px;
}

.pitch .eyebrow {
  color: var(--brand-dark);
}

.pitch h1 {
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.15;
  margin: 6px 0 14px;
  letter-spacing: -0.01em;
}

.pitch p.lede {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  margin: 0 0 26px;
  max-width: 46ch;
}

.earnings-grid {
  display: grid;
  gap: 14px;
}

.earnings-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
}

.earnings-plan {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink);
}

.earnings-amounts {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 10px 0 6px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-weight: 700;
  font-size: 20px;
  color: var(--brand-dark);
}

.earnings-amounts span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

.earnings-total {
  color: var(--muted);
  font-size: 12.5px;
}

.how-it-works {
  margin-top: 26px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.how-it-works li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.5;
}

.how-it-works .step-num {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--tint-100);
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Panels / forms */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(15, 35, 31, 0.04);
}

#login-form,
#register-form {
  padding: 30px;
  display: flex;
  flex-direction: column;
}

#register-form {
  margin-top: 20px;
}

.panel h2 {
  margin: 0 0 4px;
  font-size: 19px;
}

.panel .eyebrow {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

fieldset {
  border: none;
  padding: 0;
  margin: 22px 0 0;
}

fieldset:first-of-type {
  margin-top: 0;
}

legend {
  padding: 0 0 10px;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-dark);
  border-bottom: 1px solid var(--line);
  width: 100%;
  margin-bottom: 4px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 14px 0 6px;
  color: var(--ink);
}

.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 12px;
}

input[type='text'],
input[type='email'],
input[type='tel'],
input[type='password'],
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 110, 95, 0.12);
}

input[type='file'] {
  font-size: 13px;
  margin-top: 4px;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 9px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  transition:
    background 0.15s ease,
    opacity 0.15s ease;
}

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

.button-primary {
  background: var(--brand);
  color: #fff;
}

.button-primary:hover:not(:disabled) {
  background: var(--brand-dark);
}

.button-quiet {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.button-quiet:hover:not(:disabled) {
  background: var(--tint-100);
  color: var(--ink);
}

#login-button,
#register-button {
  width: 100%;
  margin-top: 22px;
  padding: 12px 18px;
}

.form-status {
  color: var(--error);
  font-size: 13px;
  min-height: 18px;
  margin: 10px 0 0;
}

.form-status.success {
  color: var(--success);
}

.form-hint {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 4px;
  line-height: 1.5;
}

.link-button {
  background: none;
  border: none;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  padding: 0;
  margin-top: 14px;
  text-align: center;
  width: 100%;
}

.link-button:hover:not(:disabled) {
  text-decoration: underline;
}

.inline-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.inline-check input {
  flex: 0 0 auto;
  width: 18px;
  min-height: 18px;
  margin-top: 1px;
  accent-color: var(--brand);
}

.consent-check {
  padding: 14px 16px;
  border-radius: 13px;
  background: var(--tint-50);
  border: 1px solid var(--tint-200);
}

/* Agent dashboard */

#agent-view {
  max-width: 760px;
  margin: 0 auto;
}

#agent-id-panel {
  padding: 28px 30px;
  text-align: center;
}

.agent-photo-preview {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--tint-200);
  display: block;
  margin: 0 auto 14px;
}

#agent-code-display {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 34px;
  letter-spacing: 0.04em;
  color: var(--brand-dark);
  margin: 4px 0 10px;
}

#agent-id-panel .form-hint {
  max-width: 48ch;
  margin: 0 auto;
}

#agent-id-panel label {
  text-align: left;
  max-width: 260px;
  margin-left: auto;
  margin-right: auto;
}

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 24px 0;
}

@media (max-width: 640px) {
  .stat-tiles {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-tile {
  padding: 16px 18px;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  margin-top: 4px;
  color: var(--ink);
}

.table-heading {
  font-size: 14px;
  font-weight: 700;
  margin: 28px 0 10px;
  color: var(--ink);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th,
td {
  text-align: left;
  padding: 13px 16px;
  vertical-align: top;
}

thead th {
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--line);
}

tbody tr:last-child {
  border-bottom: none;
}

.empty-row td {
  color: var(--muted);
  font-style: italic;
}

/* Spacing utilities -- CSP here is style-src 'self' (no 'unsafe-inline'), so ad-hoc inline
   style="margin-top: ..." attributes are silently dropped by the browser; use these instead. */
.mt-8 {
  margin-top: 8px;
}

.mt-14 {
  margin-top: 14px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-18 {
  margin-top: 18px;
}
