:root {
  color-scheme: light;
  --text: #253247;
  --muted: #66758b;
  --line: #d5dfeb;
  --blue: #155eef;
  --header: #edf4f9;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: #fff;
  font-size: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; height: 100vh; height: 100dvh; overflow: hidden; }
main { height: 100%; display: flex; flex-direction: column; min-height: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button, input, select, textarea { border: 1px solid #b9c8dc; border-radius: 5px; background: #fff; }
button { padding: 6px 12px; font-weight: 600; }
button:hover { background: #eff6ff; border-color: #84adff; }
button:disabled { opacity: .5; cursor: default; }
select {
  height: 34px;
  padding: 4px 28px 4px 8px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23445566' stroke-width='1.7'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
}
:focus-visible { outline: 3px solid #84adff; outline-offset: -2px; }
button.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.table-wrap { overflow: auto; flex: 1; min-height: 0; background: #fff; }
table { width: 100%; min-width: 600px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.date-col { width: 12%; }
.area-col { width: 8%; }
.built-col { width: 16%; }
.price-col { width: 16%; }
.phone-col { width: 18%; }
.status-col { width: 30%; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); text-align: left; vertical-align: top; }
th:last-child, td:last-child { border-right: 0; }
th { position: sticky; top: 0; background: var(--header); z-index: 1; height: 52px; font-size: 16px; vertical-align: middle; color: #344054; box-shadow: 0 1px 0 #b9c8dc; }
th .sort { padding: 0; border: 0; border-radius: 0; background: none; text-align: left; width: 100%; font-size: 16px; }
th span { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 2px; }
th[aria-sort=ascending] .sort::after { content: ' · по возрастанию'; font-size: 12px; font-weight: 400; color: var(--blue); }
th[aria-sort=descending] .sort::after { content: ' · по убыванию'; font-size: 12px; font-weight: 400; color: var(--blue); }
td { font-size: 16px; line-height: 1.35; font-variant-numeric: tabular-nums; }
tbody tr:nth-child(even) { background: #f7faff; }
tbody tr:hover { background: #eff6ff; }
tbody tr.is-current, tbody tr.is-current:hover { background: #fff0a6; }
tbody tr:last-child td { border-bottom: 0; }
.built-line { display: block; white-space: nowrap; }
.built-label { font-size: 12px; color: var(--muted); display: inline-block; min-width: 35px; }
.money { white-space: nowrap; }
.phones a { display: block; white-space: nowrap; text-decoration: none; color: #175cd3; }
.phones a:hover { text-decoration: underline; }
.muted { color: #8b98aa; }
.status-editor { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 4px 6px; align-items: start; }
.contact-status { width: 100%; font-size: 16px; min-width: 0; }
.comment-button { grid-column: 2; grid-row: 1; width: 100%; height: 34px; font-size: 14px; color: var(--muted); padding: 4px 6px; font-weight: 600; }
.comment-button.has-comment { color: var(--blue); border-color: #84adff; background: #eff6ff; }
.save-message { grid-column: 1 / -1; grid-row: 2; font-size: 12px; color: #267048; }
.save-message:empty { display: none; }
.save-message.error { color: #b42318; }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; }
.pagination { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 10px; border-top: 1px solid var(--line); background: #f5f8fc; color: var(--muted); font-size: 14px; }
.pagination>label { flex-direction: row; align-items: center; font-weight: 400; }
.pagination select { height: 30px; }
#statistics { line-height: 1.3; font-variant-numeric: tabular-nums; white-space: nowrap; }
#statistics span { display: block; }
.pages { display: flex; align-items: center; gap: 10px; }
.pages button { font-size: 14px; padding: 5px 10px; }
.error-banner { flex-shrink: 0; padding: 8px 12px; border-bottom: 1px solid #f0a8a1; background: #fff2f1; color: #b42318; }
.error-banner[hidden] { display: none; }
dialog { border: 1px solid var(--line); border-radius: 12px; padding: 24px; width: min(540px, calc(100% - 32px)); color: var(--text); box-shadow: 0 24px 80px #10182830; }
dialog::backdrop { background: #16284170; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
h2 { font-size: 22px; margin: 0; }
.close { border: 0; font-size: 28px; padding: 0 8px; color: var(--muted); }
#comment-context { color: var(--muted); font-size: 14px; margin: 8px 0 24px; }
textarea { width: 100%; padding: 12px; resize: vertical; min-height: 140px; margin-top: 8px; line-height: 1.5; }
#comment-error { color: #b42318; font-size: 14px; min-height: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.login-page { display: grid; place-items: center; padding: 20px; background: #f5f8fc; overflow: auto; }
.login-card { display: block; height: auto; width: min(100%, 360px); padding: 28px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.login-card h1 { margin: 0 0 24px; font-size: 26px; }
.login-card input { width: 100%; height: 42px; padding: 8px 10px; margin-top: 7px; }
.login-card button { width: 100%; height: 40px; }
#login-message { min-height: 22px; margin: 12px 0; font-size: 14px; color: #b42318; }
@media (max-width: 1100px) {
  .date-col { width: 13%; }
  .area-col { width: 10%; }
  .built-col { width: 14%; }
  .price-col { width: 18%; }
  .phone-col { width: 21%; }
  .status-col { width: 24%; }
  th, td { padding: 5px 6px; }
  th { padding-left: 4px; padding-right: 4px; }
  td, th, th .sort, .contact-status { font-size: 14px; }
  .status-editor { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .comment-button { grid-column: 1; grid-row: 2; height: 27px; font-size: 14px; }
  .save-message { grid-row: 3; }
  .contact-status { height: 30px; }
  .phones a { white-space: normal; overflow-wrap: anywhere; }
  .built-label { min-width: 28px; font-size: 11px; }
}
@media (max-width: 760px) {
  .built-label { display: none; }
}
@media (max-width: 600px) {
  .pagination { flex-wrap: wrap; gap: 6px 12px; }
  .pagination>label { font-size: 12px; }
  .pages { margin-left: auto; }
}
