:root {
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.84);
  --solid: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --blue: #0071e3;
  --blue-soft: #e8f2ff;
  --green: #248a3d;
  --orange: #b25e09;
  --red: #d70015;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #fbfbfd 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 22px;
  padding: 30px;
}

.sidebar,
.panel {
  background: var(--surface);
  border: 1px solid rgba(210, 210, 215, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.sidebar {
  min-height: calc(100vh - 60px);
  border-radius: 22px;
  padding: 18px;
}

.logo {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 8px 22px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #0a84ff, #5e5ce6);
  color: white;
  font-size: 17px;
  font-weight: 750;
}

.logo strong {
  display: block;
  font-size: 22px;
}

.logo span,
label span,
.meta,
.top p,
.empty,
.detail-empty {
  color: var(--muted);
}

.nav-item {
  width: 100%;
  height: 46px;
  display: flex;
  gap: 10px;
  align-items: center;
  border: 0;
  border-radius: 14px;
  padding: 0 14px;
  background: #eef5ff;
  color: var(--blue);
  font-weight: 650;
  text-align: left;
}

.nav-item:not(.active) {
  background: transparent;
  color: var(--muted);
}

.nav-item span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.view {
  display: none;
}

.view.active {
  display: flex;
}

.top {
  min-height: 132px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 8px 4px 8px 10px;
}

h1 {
  margin: 0;
  font-size: 46px;
  line-height: 1.05;
  font-weight: 760;
}

.top p {
  max-width: 720px;
  margin: 10px 0 0;
  font-size: 17px;
  line-height: 1.35;
}

.meta {
  max-width: 280px;
  text-align: right;
  font-size: 13px;
  line-height: 1.45;
}

.panel {
  border-radius: 22px;
}

.search-panel,
.filters {
  padding: 18px;
}

.search-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr 0.8fr 0.8fr auto;
  gap: 12px;
  align-items: end;
}

label {
  min-width: 0;
  display: grid;
  gap: 7px;
}

label span {
  padding-left: 12px;
  font-size: 12px;
  font-weight: 650;
}

input,
select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--solid);
  color: var(--ink);
  padding: 0 13px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
}

button[type="submit"],
.table-head button {
  height: 46px;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  color: white;
  padding: 0 18px;
  font-weight: 650;
  cursor: pointer;
}

.table-head button {
  height: 36px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  border: 1px solid var(--line);
}

.filters {
  display: grid;
  grid-template-columns: 1.1fr 1fr 0.8fr 0.8fr 0.9fr 0.9fr 0.9fr 0.8fr;
  gap: 10px;
}

.contact-filters {
  grid-template-columns: 1.1fr 0.8fr 0.9fr 1fr 0.8fr 0.8fr;
}

.split {
  min-height: 460px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
}

.table-panel {
  min-width: 0;
  overflow: hidden;
}

.table-head {
  height: 58px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.table-scroll {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

th,
td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid #ececf0;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: rgba(250, 250, 252, 0.95);
  font-weight: 650;
}

td {
  color: #2d2d2f;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: #f4f8ff;
}

.empty {
  height: 260px;
  text-align: center;
}

.owner-link {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0;
  font-weight: 650;
  cursor: pointer;
}

.pill {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: #f0f0f2;
  color: #55555a;
  font-size: 12px;
  font-weight: 650;
}

.pill.green {
  background: #eaf7ed;
  color: var(--green);
}

.pill.orange {
  background: #fff4e5;
  color: var(--orange);
}

.pill.red {
  background: #ffecef;
  color: var(--red);
}

.owner-detail {
  padding: 20px;
}

.detail-empty {
  min-height: 280px;
  display: grid;
  place-items: center;
  text-align: center;
}

.owner-head {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.avatar {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, #e8f2ff, #f8f8fb);
  color: var(--blue);
  font-size: 19px;
  font-weight: 760;
}

.owner-head h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.15;
}

.owner-head p,
.detail p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.detail {
  display: grid;
  gap: 10px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #ececf0;
  font-size: 14px;
}

.detail-row span:first-child {
  color: var(--muted);
}

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

.source-trace {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbff;
}

.source-trace > strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

.detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.action-button {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  color: white;
  padding: 0 14px;
  font-weight: 650;
  cursor: pointer;
}

.action-button:disabled {
  cursor: default;
  opacity: 1;
}

.action-button.secondary {
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  border: 1px solid var(--line);
}

.contacts-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 14px;
  align-items: start;
}

.contact-column {
  min-height: 220px;
  border: 1px solid rgba(210, 210, 215, 0.9);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.contact-column header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.contact-column header span {
  color: var(--muted);
  font-weight: 650;
}

.contact-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.contact-task {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--solid);
  padding: 10px;
}

.contact-task strong {
  display: block;
  margin-bottom: 6px;
}

.contact-task p,
.empty-mini {
  margin: 4px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.contact-task .co-owner {
  color: var(--orange);
  font-weight: 700;
}

.contact-task select {
  height: 36px;
  margin-top: 8px;
  border-radius: 10px;
}

.property-mini {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.6);
  font-size: 13px;
}

@media (max-width: 1100px) {
  .app {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .sidebar {
    min-height: auto;
  }

  .search-grid,
  .filters,
  .split,
  .contacts-board {
    grid-template-columns: 1fr;
  }

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

  .meta {
    text-align: left;
  }

  h1 {
    font-size: 38px;
  }
}
