/* Учёт аренды — спокойный сине-серый минимализм */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e4e8ef;
  --border-strong: #d2d9e3;
  --text: #1f2a37;
  --text-muted: #6b7785;
  --text-soft: #95a0ad;
  --accent: #3d5a80;
  --accent-hover: #2f4763;
  --accent-soft: #eaf0f6;
  --green: #2f8f5b;
  --green-soft: #e6f4ec;
  --red: #b8485c;
  --red-soft: #fbeaed;
  --amber: #c2872b;
  --amber-soft: #f9f0df;
  --radius: 10px;
  --radius-sm: 7px;
  --gap: 20px;
  --shadow: 0 1px 2px rgba(16, 30, 54, 0.04), 0 2px 8px rgba(16, 30, 54, 0.05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* --- Шапка / навигация --- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  white-space: nowrap;
}
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-size: 15px;
}
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav-user { display: flex; align-items: center; gap: 14px; color: var(--text-muted); font-size: 14px; white-space: nowrap; }

/* --- Контейнер --- */
.container { max-width: 1120px; margin: 0 auto; padding: 28px 24px 60px; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: var(--gap);
  flex-wrap: wrap;
}
.page-head h1 { font-size: 24px; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.page-head .sub { color: var(--text-muted); margin-top: 3px; font-size: 14px; }

.breadcrumbs { font-size: 13px; color: var(--text-soft); margin-bottom: 14px; }
.breadcrumbs a { color: var(--text-muted); }

/* --- Кнопки --- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  background: var(--accent); color: #fff;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--accent-hover); color: #fff; }
.btn-light { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-light:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #9d3b4d; color:#fff; }
.btn-sm { padding: 6px 11px; font-size: 13px; }

/* --- Единый вертикальный ритм между блоками --- */
/* Все крупные блоки разделяются одинаковым отступом снизу (--gap). */
.card, .grid, .steps, .toolbar, .dash-search { margin-bottom: var(--gap); }
/* Внутри грида интервалы задаёт сам грид (gap) — карточки не добавляют отступ */
.grid > .card { margin-bottom: 0; }

/* --- Карточки --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 22px; }
.card-title { font-size: 15px; font-weight: 700; margin: 0 0 14px; display:flex; align-items:center; justify-content:space-between; gap:10px;}

.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 820px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* --- Шаги на главной --- */
.steps { display: grid; gap: var(--gap); grid-template-columns: repeat(3, 1fr); }
@media (max-width: 820px){ .steps { grid-template-columns: 1fr; } }
.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 12px;
  position: relative;
}
.step-num {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.step h3 { margin: 0; font-size: 17px; }
.step p { margin: 0; color: var(--text-muted); font-size: 14px; flex: 1; }
.step-count { font-size: 28px; font-weight: 700; color: var(--text); }
.step-count small { font-size: 14px; font-weight: 500; color: var(--text-soft); }

/* --- Метрики --- */
.metric { display:flex; flex-direction:column; gap:4px; }
.metric .v { font-size: 26px; font-weight: 700; }
.metric .l { color: var(--text-muted); font-size: 13px; }

/* --- Таблицы --- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; padding: 11px 14px;
  color: var(--text-muted); font-weight: 600; font-size: 12.5px;
  text-transform: uppercase; letter-spacing: .03em;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- Бейджи --- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 12.5px; font-weight: 600; line-height: 1.6;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-gray { background: #eef1f5; color: var(--text-muted); }
.badge-blue { background: var(--accent-soft); color: var(--accent); }
.dot { width:7px; height:7px; border-radius:50%; background: currentColor; display:inline-block; }

/* --- Формы --- */
.form-row { margin-bottom: 16px; }
.form-grid { display: grid; gap: 16px 20px; grid-template-columns: repeat(2, 1fr); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 680px){ .form-grid { grid-template-columns: 1fr; } }
label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
label .opt { color: var(--text-soft); font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px; font-family: var(--font); color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 78px; }
.help { font-size: 12.5px; color: var(--text-soft); margin-top: 5px; }
.file-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.file-preview-link { display: inline-flex; align-items: center; gap: 5px; font-size: 13px;
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--accent); text-decoration: none; cursor: pointer; }
.file-preview-link:hover { border-color: var(--accent); }
.pagination { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; padding: 14px 4px 4px; font-size: 13px; }
.pagination-links { display: flex; gap: 8px; }
.errorlist { color: var(--red); font-size: 13px; margin: 6px 0 0; padding-left: 18px; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }

/* Чекбоксы коммуналки */
.check-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 18px; }
@media (max-width:680px){ .check-grid { grid-template-columns: 1fr; } }
.check {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; font-weight: 500; font-size: 14px;
}
.check:hover { background: var(--surface-2); }
.check input { width: auto; }

/* --- Фильтры / toolbar --- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar form { display: flex; gap: 10px; flex: 1; min-width: 200px; }
.toolbar input[type=text] { max-width: 320px; }
.chips { display: flex; gap: 7px; }
.chip {
  padding: 6px 13px; border-radius: 20px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border-strong); color: var(--text-muted); background: #fff;
}
.chip:hover { background: var(--surface-2); color: var(--text); }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* --- Список свойств (карточка детали) --- */
.props { display: grid; grid-template-columns: max-content 1fr; gap: 10px 22px; font-size: 14px; }
.props dt { color: var(--text-muted); }
.props dd { margin: 0; font-weight: 500; }

/* --- Пустое состояние --- */
.empty { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty .ico { font-size: 34px; opacity: .5; }
.empty h3 { margin: 12px 0 6px; color: var(--text); }

/* --- Сообщения --- */
.messages { margin-bottom: var(--gap); display: grid; gap: 8px; }
.msg { padding: 11px 15px; border-radius: var(--radius-sm); font-size: 14px; border: 1px solid; }
.msg-success { background: var(--green-soft); border-color: #bfe3cd; color: #226c45; }
.msg-error { background: var(--red-soft); border-color: #f0c4cd; color: #8d3142; }
.msg-info { background: var(--accent-soft); border-color: #cfdcea; color: var(--accent-hover); }
.msg-warning { background: var(--amber-soft); border-color: #ecd6a8; color: #8a5f1c; }

/* --- Пикер помещений в договоре --- */
.lines-table { width: 100%; border-collapse: collapse; }
.lines-table th { text-align:left; font-size:12.5px; color:var(--text-muted); font-weight:600; padding:8px 10px; text-transform:uppercase; letter-spacing:.03em;}
.lines-table td { padding: 8px 10px; border-top: 1px solid var(--border); vertical-align: top; }
.lines-table input, .lines-table select { padding: 7px 10px; }
.line-sum { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.summary-bar {
  display:flex; gap:28px; flex-wrap:wrap;
  margin-top: 14px; padding: 14px 18px;
  background: var(--accent-soft); border-radius: var(--radius-sm);
}
.summary-bar .metric .v { font-size: 20px; color: var(--accent-hover); }

.inline-link { font-size: 13px; }
.muted { color: var(--text-muted); }
.soft { color: var(--text-soft); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
hr.sep { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* --- Кликабельный бейдж статуса + модалка --- */
button.badge {
  border: none; font: inherit; cursor: pointer;
}
button.badge:hover { filter: brightness(0.95); }
.badge .caret { opacity: .6; font-size: 10px; margin-left: 2px; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(20, 30, 45, .45);
  display: none; place-items: center; z-index: 50; padding: 20px;
}
.modal-overlay.open { display: grid; }
.modal {
  background: var(--surface); border-radius: 14px;
  box-shadow: 0 12px 44px rgba(16, 30, 54, .22);
  width: 100%; max-width: 400px; padding: 24px;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.modal-head strong { font-size: 16px; }
.modal-sub { color: var(--text-muted); font-size: 13px; margin: 0 0 16px; }
.modal-x { border: none; background: transparent; cursor: pointer; font-size: 16px; color: var(--text-muted); line-height: 1; }
.sm-options { display: grid; gap: 8px; }
.sm-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; font-weight: 500; font-size: 14px;
}
.sm-opt:hover { background: var(--surface-2); }
.sm-opt input { width: auto; }

/* Модалка предпросмотра PDF */
.pdf-modal { max-width: 920px; width: 92vw; padding: 0; }
.pdf-modal .modal-head { padding: 14px 18px; border-bottom: 1px solid var(--border); margin: 0; }
#pdf-modal-frame { width: 100%; height: 76vh; border: none; display: block; background: var(--surface-2); border-radius: 0 0 14px 14px; }

/* --- Поиск на главной --- */
.dash-search {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 8px 10px 8px 16px;
}
.dash-search svg { color: var(--text-soft); flex-shrink: 0; }
.dash-search input {
  flex: 1; border: none; box-shadow: none; padding: 8px 4px; font-size: 15px;
}
.dash-search input:focus { outline: none; box-shadow: none; }
.dash-search .btn { flex-shrink: 0; }

/* --- Колокольчик уведомлений --- */
.bell-wrap { position: relative; display: flex; align-items: center; }
.bell-btn {
  position: relative; display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 9px;
  border: 1px solid transparent; background: transparent; cursor: pointer;
  color: var(--text-muted); transition: background .15s, color .15s;
}
.bell-btn:hover { background: var(--surface-2); color: var(--text); }
.bell-badge {
  position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px;
  padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}
/* Модалка уведомлений — выезжает сверху вниз */
.notif-overlay {
  position: fixed; inset: 0; background: rgba(20, 30, 45, .38);
  opacity: 0; visibility: hidden;
  transition: opacity .22s ease, visibility 0s linear .32s;
  z-index: 60;
}
.notif-overlay.open { opacity: 1; visibility: visible; transition: opacity .22s ease; }
.notif-panel {
  position: fixed; top: 0; left: 50%;
  transform: translate(-50%, -110%);
  width: 580px; max-width: 94vw;
  background: var(--surface);
  border-radius: 0 0 16px 16px;
  box-shadow: 0 20px 55px rgba(16, 30, 54, .28);
  overflow: hidden;
  transition: transform .32s cubic-bezier(.22, .61, .36, 1);
}
.notif-overlay.open .notif-panel { transform: translate(-50%, 0); }
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 20px; font-weight: 700; font-size: 15px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.notif-close {
  border: none; background: transparent; cursor: pointer;
  font-size: 16px; color: var(--text-muted); line-height: 1;
  width: 30px; height: 30px; border-radius: 7px;
}
.notif-close:hover { background: var(--border); color: var(--text); }
.notif-list { max-height: 70vh; overflow-y: auto; }
.notif-section {
  padding: 10px 20px; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-soft);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.notif-item {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--border); color: var(--text);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-2); }
.notif-text { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-date { font-size: 13px; color: var(--text-muted); }
.notif-empty { padding: 44px 20px; text-align: center; color: var(--text-muted); font-size: 14.5px; }

/* --- Страница входа --- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 32px; }
.auth-card .brand-mark { width: 42px; height: 42px; font-size: 20px; border-radius: 11px; margin-bottom: 18px; }
.auth-card h1 { font-size: 22px; margin: 0 0 6px; }
.auth-card p.sub { color: var(--text-muted); margin: 0 0 22px; font-size: 14px; }
.auth-card .btn { width: 100%; justify-content: center; margin-top: 6px; }
