:root {
  --bg: #f3f2ed;
  --card: #ffffff;
  --text: #1e2126;
  --muted: #5a6470;
  --accent: #0d6f5f;
  --accent-soft: #e4f3f0;
  --line: #d6dce3;
  --danger: #a11f1f;
  --success: #146c2e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top right, #f9f4e8 0, var(--bg) 45%);
  color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  line-height: 1.4;
}

.container {
  width: min(1200px, 94vw);
  margin: 0 auto;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.nav-row {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 700;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.nav-links a {
  color: var(--text);
  text-decoration: none;
}

.card {
  margin: 1.4rem 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.2rem;
}

h1 {
  margin: 0 0 1rem;
}

h2 {
  margin: 1.2rem 0 0.6rem;
  font-size: 1.1rem;
}

.space-between {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.button-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.table-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.table-list li {
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
}

.table-list li:last-child {
  border-bottom: 0;
}

.table-link-button {
  min-width: 280px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 0.55rem 0.8rem;
  text-decoration: none;
  font-weight: 600;
}

.table-link-button:hover {
  background: var(--accent-soft);
}

.pill {
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: 0.4rem;
}

.button,
button {
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  padding: 0.45rem 0.9rem;
  text-decoration: none;
  cursor: pointer;
  display: inline-block;
  font-size: 0.95rem;
}

.button.secondary,
button.secondary {
  background: white;
  color: var(--text);
  border-color: var(--line);
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  cursor: pointer;
}

.inline-form {
  display: inline;
}

.search-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}

input,
select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  font-size: 0.95rem;
}

input[type="text"],
input[type="number"] {
  min-width: 240px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

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

th {
  background: var(--accent-soft);
  white-space: nowrap;
}

.sort-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.sort-link:hover {
  color: var(--accent);
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover td {
  background: #e4f2ed;
}

.clickable-row:focus td {
  outline: 2px solid #7aaea6;
  outline-offset: -2px;
}

.inactive-row td {
  background: #eceff2;
  color: #7b848f;
}

.inactive-row a,
.inactive-row button {
  color: inherit;
}

.inactive-row:hover td {
  background: #e3e7ec;
}

.inactive-row .copy-email {
  text-decoration-color: #a4adb7;
}

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

.error {
  color: var(--danger);
  font-size: 0.88rem;
  margin-top: 0.2rem;
}

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

.pager {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.row-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
}

.company-inactive a {
  color: #7b848f;
}

.copy-email {
  border: 0;
  background: transparent;
  color: #0b4d95;
  text-decoration: underline;
  padding: 0;
  margin: 0;
  font: inherit;
  cursor: pointer;
}

.copy-email:hover {
  color: #083d77;
}

/* Boolean badges */
.badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
}

.badge-yes {
  background: #d4edda;
  color: #155724;
}

.badge-no {
  background: #f0d0d0;
  color: #721c24;
}

/* Form styles */
.form-group {
  margin-bottom: 0.8rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 600;
  font-size: 0.92rem;
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 200px;
}

/* Autocomplete dropdown */
.autocomplete-wrap {
  position: relative;
}

.suggestions-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.suggestion-item {
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  font-size: 0.92rem;
}

.suggestion-item:hover {
  background: var(--accent-soft);
}

.resolved-inline {
  font-size: 0.92rem;
}

@media (max-width: 700px) {
  .nav-row {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 0.6rem 0;
  }

  input[type="text"],
  input[type="number"] {
    min-width: 170px;
    width: 100%;
  }

  .search-row {
    flex-direction: column;
  }

  .form-row {
    flex-direction: column;
  }
}
