:root {
  --bg: #f3f5f8;
  --card: #fff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #0f5fbf;
  --ok: #047857;
  --err: #b91c1c;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(180deg, #e8eef6 0%, var(--bg) 240px);
  color: var(--ink);
}
.page { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { margin: 0 0 8px; font-size: 28px; }
h2 { margin: 28px 0 12px; font-size: 18px; }
.muted { color: var(--muted); font-size: 14px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
}
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
input, select, textarea, button {
  font: inherit;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
}
button {
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
button.secondary { background: #eef2f7; color: var(--ink); }
button:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 12px;
}
.btn-with-icon svg {
  display: block;
  flex: 0 0 auto;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  background: #eef2f7;
  color: var(--ink);
}
.icon-btn svg {
  display: block;
}
.field-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--ink);
}
.check input {
  width: 16px;
  height: 16px;
  padding: 0;
  margin: 0;
  -webkit-appearance: checkbox;
  appearance: checkbox;
}
.switch-field {
  align-items: start;
}
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 44px;
  height: 24px;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 44px;
  height: 24px;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}
.switch-ui {
  display: block;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #d1d5db;
  position: relative;
  pointer-events: none;
}
.switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
}
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { left: 22px; }
.interests-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 16px 0 10px;
}
.interest-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin: 0 0 12px;
  min-width: 0;
}
.interest-card legend { display: none; }
.interest-head {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto 36px;
  gap: 8px;
  align-items: center;
}
.interest-name { width: 100%; min-width: 0; }
.interest-use { white-space: nowrap; }
.interest-body {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.interest-card[data-collapsed] .interest-body { display: none; }
.interest-card[data-collapsed] .js-toggle-interest svg {
  transform: rotate(-90deg);
}
.fields-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.job-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 12px;
  padding: 4px 0;
  font-size: 14px;
}
.job-id { font-size: 12px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
@media (max-width: 720px) {
  .interest-head {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
  }
  .interest-use { grid-column: 1 / -1; }
  .fields-2 { grid-template-columns: 1fr; }
}
.status { margin-top: 10px; font-size: 14px; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2f7;
  font-size: 12px;
  font-weight: 700;
}
.badge.on { background: #d1fae5; color: var(--ok); }
.badge.off { background: #fee2e2; color: var(--err); }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 8px 6px;
  vertical-align: top;
}
th { cursor: pointer; background: #f8fafc; position: sticky; top: 0; }
th.sorted { color: var(--accent); }
.table-wrap { overflow: auto; max-height: 65vh; }
a { color: var(--accent); }
.clients-wrap { overflow: auto; }
.clients-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.clients-table th, .clients-table td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 8px 6px;
  vertical-align: middle;
}
.clients-table th {
  cursor: default;
  background: #f8fafc;
  position: static;
}
.clients-table tr.is-disabled td { color: var(--muted); }
.password-once {
  font-size: 14px;
  background: #ecfdf5;
  padding: 2px 6px;
  border-radius: 6px;
}
button.danger {
  background: var(--err);
  color: #fff;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal-card {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  width: min(440px, 100%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.modal-head h3 {
  margin: 0;
  font-size: 18px;
}
.modal-text {
  margin: 12px 0 16px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
