/* Арендометр — базовая тема */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #1c2430;
  --muted: #6b7787;
  --line: #e3e8ee;
  --brand: #1f5f8b;
  --brand-dark: #164563;
  --accent: #c8a04a;
  --danger: #b23c3c;
  --ok: #2f7d5b;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }

.container { max-width: 1120px; margin: 0 auto; padding: 28px 20px 56px; }

/* Шапка */
.topbar { background: #10202e; color: #fff; }
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 28px; min-height: 60px; flex-wrap: wrap;
}
.brand { color: #fff; font-size: 19px; font-weight: 700; letter-spacing: .01em; }
.brand span { color: var(--accent); }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { color: #c6d3de; padding: 8px 12px; border-radius: 8px; font-size: 14px; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.userbox { display: flex; align-items: center; gap: 12px; }
.user-name { color: #e8eef4; font-size: 14px; }

/* Заголовок страницы */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.head-actions { display: flex; gap: 10px; }

/* Карточки */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-title { font-size: 16px; margin-bottom: 14px; }
.card-subtitle { font-size: 14px; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.empty { color: var(--muted); text-align: center; padding: 34px 20px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); margin-top: 16px; }

/* Статистика */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.stat-warn { border-color: #f0d2d2; background: #fff8f8; }
.stat-warn .stat-value { color: var(--danger); }

/* Таблицы */
.table-card { padding: 6px 6px 2px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 12px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; background: #fafbfc; }
.table tbody tr:hover { background: #fafcfe; }
.table tfoot td { border-bottom: none; background: #fafbfc; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: none; }

/* Договор */
.contract-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 4px; }
.contract-head h2 { margin: 6px 0 0; font-size: 18px; }
.contract-object { color: var(--muted); margin: 0 0 14px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin: 0 0 16px; }
.facts-vertical { grid-template-columns: 1fr; }
.facts div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* Бейджи */
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: #eef2f6; color: #4a5a6a; text-transform: uppercase; letter-spacing: .04em; }
.badge-active, .badge-issued { background: #e7f3ec; color: var(--ok); }
.badge-draft { background: #f5f0e2; color: #8a6a1f; }
.badge-terminated { background: #f7e9e9; color: var(--danger); }

/* Кнопки */
.btn { display: inline-block; border: 1px solid transparent; border-radius: 9px; padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer; background: #eef2f6; color: var(--ink); transition: background .15s ease; }
.btn:hover { text-decoration: none; background: #e3e9f0; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; color: #c6d3de; border-color: rgba(255,255,255,.25); }
.btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-block { width: 100%; }
.btn-small { padding: 5px 12px; font-size: 13px; }

/* Формы */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; font-weight: 600; color: #3b4757; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  font: inherit; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid rgba(31,95,139,.25); border-color: var(--brand); }
.field-error input { border-color: var(--danger); }
.error { color: var(--danger); font-size: 12px; }

/* Сообщения */
.messages { margin-bottom: 18px; }
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 8px; font-size: 14px; border: 1px solid transparent; }
.alert-success { background: #eaf5ef; border-color: #cfe8db; color: #215c41; }
.alert-error { background: #fdf0f0; border-color: #f2d2d2; color: #8e2f2f; }
.alert-warning { background: #fdf7e8; border-color: #f0e3bf; color: #7a5d15; }
.alert-info { background: #eef4fa; border-color: #d6e4f0; color: #1f4f73; }

/* Прочее */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.text-danger { color: var(--danger); }
.section-title { margin: 30px 0 12px; font-size: 18px; }
.plain-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.plain-list li { padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.plain-list li:last-child { border-bottom: none; padding-bottom: 0; }
.link { font-weight: 600; font-size: 14px; }
.footer { max-width: 1120px; margin: 0 auto; padding: 0 20px 32px; color: var(--muted); font-size: 12px; }

/* Вход */
.login-wrap { display: flex; justify-content: center; padding: 40px 0; }
.login-card { width: 100%; max-width: 400px; }
.login-title { font-size: 24px; text-align: center; }
.login-title span { color: var(--accent); }
.login-card .muted { text-align: center; margin-top: 0; }
.login-card .form { margin-top: 18px; }
