:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #667383;
  --line: #d8e0e8;
  --surface: #f5f7f9;
  --panel: #ffffff;
  --teal: #0d766e;
  --blue: #2e5f9e;
  --amber: #b7791f;
  --red: #b83232;
  --shadow: 0 16px 42px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: var(--surface);
  line-height: 1.5;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 32px max(24px, 6vw) 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
}

.brand {
  font-size: 1.05rem;
  font-weight: 850;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-nav a {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 750;
}

.top-nav a:hover,
.top-nav a[aria-current="page"] {
  color: var(--ink);
  background: #edf2f5;
}

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

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin: 8px 0 0;
  font-size: 1.25rem;
}

h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.ghost-button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  font-weight: 750;
  cursor: pointer;
}

.ghost-button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.ghost-button.primary-action {
  color: #fff;
  border-color: var(--teal);
  background: var(--teal);
}

.ghost-button.primary-action:hover {
  color: #fff;
  background: #095f59;
}

.ghost-button.danger:hover {
  border-color: var(--red);
  color: var(--red);
}

.app-shell {
  width: min(1240px, 92vw);
  margin: 0 auto;
  padding: 28px 0 48px;
}

.portal-shell {
  width: min(980px, 92vw);
}

.hero-panel,
.portal-heading {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: clamp(28px, 6vw, 56px);
}

.portal-heading {
  padding: 24px;
}

.hero-panel h1,
.portal-heading h1 {
  max-width: 920px;
}

.hero-panel p:not(.eyebrow),
.portal-heading p {
  max-width: 760px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.role-card {
  display: grid;
  gap: 10px;
  min-height: 190px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.role-card:hover {
  border-color: var(--teal);
  transform: translateY(-1px);
}

.landlord-card:hover {
  border-color: var(--blue);
}

.role-card p {
  margin: 0;
  color: var(--muted);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

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

.workspace.single {
  grid-template-columns: 1fr;
}

.panel,
.score-panel,
.result-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
}

.panel-heading {
  margin-bottom: 18px;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
}

.role-pill.landlord {
  background: var(--blue);
}

.role-pill.tenant {
  background: var(--teal);
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfcfd;
}

input {
  min-height: 42px;
  padding: 0 12px;
}

select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  min-height: 112px;
  padding: 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  outline: 3px solid rgba(13, 118, 110, 0.15);
}

.form-divider {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 24px 0 16px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.helper-text {
  margin: -4px 0 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

.form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.form-actions .helper-text {
  margin: 0;
}

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

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

.check-grid label {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--ink);
  font-weight: 650;
}

.check-grid input {
  width: 16px;
  min-height: 16px;
  margin: 0 8px 0 0;
  accent-color: var(--teal);
}

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

.match-list-panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.match-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.match-card h3 {
  margin-bottom: 6px;
}

.match-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  color: var(--muted);
  list-style: none;
}

.match-meta li {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 700;
}

.match-score {
  min-width: 78px;
  color: var(--teal);
  font-size: 1.8rem;
  font-weight: 850;
  text-align: right;
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

.score-panel {
  padding: 22px;
}

.score-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
}

#score {
  font-size: clamp(2.6rem, 8vw, 5.2rem);
  line-height: 1;
}

#verdict {
  max-width: 520px;
  color: var(--muted);
  text-align: right;
}

.score-track {
  overflow: hidden;
  height: 12px;
  margin-top: 18px;
  border-radius: 999px;
  background: #e6ebf0;
}

.score-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
  transition: width 180ms ease, background 180ms ease;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 18px;
}

.result-grid article {
  min-height: 190px;
  padding: 20px;
}

ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

#introMessage {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 900px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace,
  .role-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

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

  .match-card {
    grid-template-columns: 1fr;
  }

  .match-score {
    text-align: left;
  }

  .form-divider {
    align-items: stretch;
    flex-direction: column;
  }

  #verdict {
    text-align: left;
  }
}

@media (max-width: 560px) {
  .field-grid,
  .check-grid {
    grid-template-columns: 1fr;
  }

  .panel,
  .score-panel,
  .result-grid article {
    padding: 16px;
  }
}
