body {
  font-family: Arial, sans-serif;
  background: #f4f6f8;
  color: #1f2937;
  margin: 0;
  padding: 0;
}

.container {
  max-width: 1550px;
  margin: 0 auto;
  padding: 18px 24px;
}

.page-title {
  font-size: 30px;
  font-weight: 700;
  margin: 0 0 14px;
}

h1, h2, h3 {
  margin-top: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #111827;
  color: white;
  padding: 14px 24px;
}

.topbar a {
  color: white;
  margin-right: 20px;
  text-decoration: none;
  font-weight: bold;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.top-metrics {
  margin-bottom: 12px;
}

.compact-metrics {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.dashboard-compact .section {
  margin-bottom: 12px;
}

.compact-section {
  padding: 12px 14px;
}

.compact-group-title {
  font-size: 20px;
  margin-bottom: 10px;
}

.compact-status-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.card {
  background: white;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.compact-card {
  padding: 12px 14px;
  min-height: 74px;
}

.card-link {
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.card-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
}

.card-label {
  font-size: 18px;
  font-weight: 600;
}

.metric {
  font-size: 34px;
  font-weight: bold;
  margin-top: 8px;
}

.compact-metric {
  font-size: 26px;
  margin-top: 6px;
}

.metric-small {
  font-size: 22px;
}

.section {
  background: white;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  margin-bottom: 18px;
}

.total-row {
  font-size: 16px;
}

.sticky-filters-wrap {
  position: sticky;
  top: 58px;
  z-index: 900;
  background: #f4f6f8;
  padding-top: 6px;
}

.sticky-filters {
  margin-bottom: 12px;
}

.table-wrap {
  overflow: auto;
  background: white;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  max-height: calc(100vh - 240px);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #f9fafb;
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.wrap-cell {
  white-space: normal;
  min-width: 260px;
}

.col-region {
  width: 120px;
  max-width: 120px;
  white-space: normal;
}

.col-city {
  width: 110px;
  max-width: 110px;
  white-space: normal;
}

.narrow-col {
  min-width: 140px;
}

.status {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e5e7eb;
  font-size: 12px;
  font-weight: bold;
  color: #111827;
}

.status-search { background: #e5e7eb; color: #111827; }
.status-reject { background: #fecaca; color: #991b1b; }
.status-estimate { background: #bfdbfe; color: #1d4ed8; }
.status-finance { background: #ddd6fe; color: #6d28d9; }
.status-kp-prep { background: #fde68a; color: #92400e; }
.status-kp-sent { background: #fdba74; color: #9a3412; }
.status-paperwork { background: #fef08a; color: #854d0e; }
.status-build { background: #bae6fd; color: #075985; }
.status-foundation { background: #99f6e4; color: #115e59; }
.status-tower { background: #bbf7d0; color: #166534; }
.status-ok { background: #86efac; color: #166534; }
.status-pause { background: #d1d5db; color: #374151; }
.status-cancel { background: #fca5a5; color: #991b1b; }
.status-rent { background: #f9a8d4; color: #9d174d; }

.kv {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 10px 16px;
}

.kv div {
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

.label {
  color: #6b7280;
  font-weight: 600;
}

.actions {
  margin-top: 16px;
}

.btn {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 10px;
  background: #111827;
  color: white;
  text-decoration: none;
  margin-right: 8px;
  margin-bottom: 8px;
  border: none;
  cursor: pointer;
  font-size: 14px;
}

.btn-light {
  background: #e5e7eb;
  color: #111827;
}

.btn-back {
  font-size: 22px;
  font-weight: 800;
  padding: 14px 24px;
  border-radius: 14px;
  background: #b91c1c;
}

.filters {
  display: grid;
  gap: 16px;
  align-items: start;
}

.filters-5 {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.filters input,
.filters select,
.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: white;
  font: inherit;
}

.multi-select {
  min-height: 120px;
}

.multi-hint {
  margin-top: 8px;
  font-size: 12px;
  color: #6b7280;
}

.label-inline {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #374151;
}

.filters-actions {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 16px;
}

.ok-box {
  padding: 12px 14px;
  background: #dcfce7;
  border-radius: 10px;
  color: #166534;
  font-weight: bold;
}

.error-box {
  padding: 12px 14px;
  background: #fee2e2;
  border-radius: 10px;
  color: #991b1b;
  font-weight: bold;
  margin-bottom: 16px;
}

.inline-radio {
  display: flex;
  gap: 20px;
  margin-bottom: 10px;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.field-value {
  min-height: 20px;
}

.field-empty {
  background: #fee2e2;
  color: #991b1b;
  font-weight: 700;
  padding: 6px 10px !important;
  border-radius: 8px;
}

.report-wrap {
  overflow: auto;
  max-height: calc(100vh - 240px);
}

.report-table .report-row {
  position: relative;
}

.report-link {
  color: #1d4ed8;
  font-weight: 700;
  text-decoration: none;
}

.report-link:hover {
  text-decoration: underline;
}

.report-hover-card {
  display: none;
  position: absolute;
  left: 10px;
  top: 42px;
  z-index: 50;
  width: 360px;
  white-space: normal;
  padding: 14px;
  border-radius: 12px;
  background: #111827;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  line-height: 1.4;
}

.report-row td:first-child {
  position: relative;
}

.report-row td:first-child:hover .report-hover-card {
  display: block;
}


.comments-block {
    max-width: 1000px;
}

#comment-form {
    margin-bottom: 20px;
}

#new-comment-text {
    width: 100%;
    min-height: 110px;
    border: 1px solid #d5dbe3;
    border-radius: 10px;
    padding: 12px;
    font-size: 14px;
    resize: vertical;
    background: #fff;
    box-sizing: border-box;
}

.comment-actions {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
}

.comment-card {
    background: #fff;
    border: 1px solid #dce3ea;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 12px;
}

.comment-card.system {
    background: #f4f7fb;
    border-left: 4px solid #5b7fff;
}

.comment-header {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #666;
}

.comment-author {
    font-weight: 700;
    color: #222;
}

.comment-role {
    background: #eef3ff;
    color: #4666cc;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
}

.comment-date {
    margin-left: auto;
}

.comment-text {
    white-space: pre-wrap;
    line-height: 1.5;
    color: #222;
}

.comment-empty {
    padding: 16px;
    border: 1px dashed #cfd7df;
    border-radius: 12px;
    color: #666;
    background: #fafbfd;
}

/* === COMMENTS_WIDGET_START === */
.comments-widget-wrap {
    margin-top: 24px;
    background: #fff;
    border: 1px solid #dce3ea;
    border-radius: 14px;
    padding: 18px;
}

.comments-widget-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 14px;
}

.comments-widget-form textarea {
    width: 100%;
    min-height: 110px;
    border: 1px solid #d5dbe3;
    border-radius: 10px;
    padding: 12px;
    font-size: 14px;
    resize: vertical;
    background: #fff;
    box-sizing: border-box;
}

.comments-widget-actions {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.comments-widget-btn {
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
}

.comments-widget-btn.primary {
    background: #2f6fed;
    color: #fff;
}

.comments-widget-list {
    margin-top: 18px;
}

.comments-widget-card {
    background: #fff;
    border: 1px solid #dce3ea;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 12px;
}

.comments-widget-card.system {
    background: #f4f7fb;
    border-left: 4px solid #5b7fff;
}

.comments-widget-head {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #666;
}

.comments-widget-author {
    font-weight: 700;
    color: #222;
}

.comments-widget-role {
    background: #eef3ff;
    color: #4666cc;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
}

.comments-widget-date {
    margin-left: auto;
}

.comments-widget-text {
    white-space: pre-wrap;
    line-height: 1.5;
    color: #222;
}

.comments-widget-empty {
    padding: 16px;
    border: 1px dashed #cfd7df;
    border-radius: 12px;
    color: #666;
    background: #fafbfd;
}
/* === COMMENTS_WIDGET_END === */

.status-sold {
  background: #111827;
  color: #ffffff;
}
