/* Hermes УК — собственные стили в духе Tailwind, без сборки и CDN. */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8ef;
  --border-strong: #cdd5df;
  --text: #101828;
  --text-2: #475467;
  --text-3: #7c8698;
  --brand: #17486b;
  --brand-2: #1f6394;
  --brand-soft: #eaf2f9;
  --accent: #0f766e;
  --success: #067647;
  --success-soft: #e7f6ec;
  --warning: #b54708;
  --warning-soft: #fef3e6;
  --danger: #b42318;
  --danger-soft: #fdeceb;
  --info: #175cd3;
  --info-soft: #eaf1fd;
  --muted-soft: #f1f4f8;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .05);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, .10);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
.icon { display: inline-block; vertical-align: -4px; flex: 0 0 auto; }

/* ---- каркас ---- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px;
  flex: 0 0 236px;
  background: #0f2b3e;
  color: #cfe0ec;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 14px;
  color: #fff;
  font-size: 16px;
  letter-spacing: -.01em;
}
.brand.inline { padding: 0; color: var(--text); flex: 1; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(255, 255, 255, .12); color: #8fd0ff;
}
.brand.inline .brand-mark { background: var(--brand-soft); color: var(--brand); }
.brand-text b { font-weight: 700; color: #fff; }
.brand.inline .brand-text b { color: var(--brand); }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  color: #b9cfdd; font-size: 13.5px; font-weight: 500;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav-item.is-active { background: rgba(143, 208, 255, .16); color: #fff; }
.nav-item.is-active .icon { color: #8fd0ff; }
.sidebar-foot { margin-top: auto; padding: 14px 18px; font-size: 12px; color: #6f8da3; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; display: flex; align-items: center; gap: 14px;
  padding: 0 24px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-weight: 600; font-size: 15px; flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12.5px;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11.5px; color: var(--text-3); }
.icon-btn {
  border: 1px solid transparent; background: transparent; color: var(--text-2);
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--muted-soft); color: var(--text); }
.content { padding: 22px 24px 40px; max-width: 1440px; width: 100%; }
.content-public { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.resident-top { gap: 16px; }

/* ---- страница ---- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title { font-size: 21px; font-weight: 650; }
.page-sub { color: var(--text-2); font-size: 13px; margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- карточки ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title { font-size: 14.5px; font-weight: 600; }
.card-body { padding: 16px 18px; }
.card-body.tight { padding: 0; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
.grid-1-2 { grid-template-columns: 1fr 2fr; }
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3, .grid-2, .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
}

/* ---- KPI ---- */
.kpi { padding: 16px 18px; display: flex; gap: 12px; align-items: flex-start; }
.kpi-icon { width: 38px; height: 38px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--brand-soft); color: var(--brand); flex: 0 0 auto; }
.kpi-icon.warn { background: var(--warning-soft); color: var(--warning); }
.kpi-icon.danger { background: var(--danger-soft); color: var(--danger); }
.kpi-icon.ok { background: var(--success-soft); color: var(--success); }
.kpi-label { font-size: 12.5px; color: var(--text-2); }
.kpi-value { font-size: 23px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; }
.kpi-note { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.kpi-value.danger { color: var(--danger); }

/* ---- таблицы ---- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-weight: 600; color: var(--text-2);
  padding: 10px 16px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap; font-size: 12.5px;
}
.table td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbfd; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .mono { font-variant-numeric: tabular-nums; }
.row-link { cursor: pointer; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }

/* ---- бейджи ---- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 550; white-space: nowrap; line-height: 1.6;
}
.badge-neutral { background: var(--muted-soft); color: var(--text-2); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: #eef1f4; color: #596579; }
.badge-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-2); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---- кнопки ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 8px 13px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 550;
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); }
.btn-danger { background: #fff; border-color: #f0b9b3; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---- формы ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 760px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--text-3); }
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=month], input[type=tel], input[type=email], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border-strong);
  border-radius: 8px; font: inherit; font-size: 13.5px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(31, 99, 148, .12); }
textarea { min-height: 84px; resize: vertical; }
.form-actions { display: flex; gap: 8px; margin-top: 18px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.filter-bar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.filter-bar .field { min-width: 150px; }

/* ---- уведомления ---- */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; display: flex; gap: 8px; align-items: flex-start; }
.alert-ok { background: var(--success-soft); color: #04563a; }
.alert-err { background: var(--danger-soft); color: #8a1c13; }
.alert-warn { background: var(--warning-soft); color: #7a3d06; }
.alert-info { background: var(--info-soft); color: #12428f; }

/* ---- пустое состояние ---- */
.empty { padding: 36px 20px; text-align: center; color: var(--text-3); }
.empty .empty-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--surface-2); color: var(--text-3); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.empty h4 { color: var(--text); font-size: 14px; margin-bottom: 4px; }
.empty p { margin: 0 0 12px; font-size: 13px; }

/* ---- график (CSS-бар) ---- */
.chart { display: flex; flex-direction: column; gap: 12px; }
.chart-row { display: grid; grid-template-columns: 120px 1fr 44px; gap: 10px; align-items: center; font-size: 13px; }
.chart-bar { height: 10px; border-radius: 999px; background: var(--muted-soft); overflow: hidden; }
.chart-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--brand-2); }
.chart-bar > span.c-warning { background: #e59a3d; }
.chart-bar > span.c-success { background: #2e9e6b; }
.chart-bar > span.c-neutral { background: #8b9bb0; }
.chart-bar > span.c-danger { background: #d45a4d; }
.chart-count { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---- списки, таймлайн ---- */
.defs { display: grid; grid-template-columns: 180px 1fr; gap: 9px 16px; font-size: 13.5px; }
.defs dt { color: var(--text-2); }
.defs dd { margin: 0; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 12px; padding: 10px 0; position: relative; }
.timeline-item:not(:last-child)::before { content: ""; position: absolute; left: 11px; top: 30px; bottom: -2px; width: 2px; background: var(--border); }
.tl-dot { width: 24px; height: 24px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; z-index: 1; }
.tl-body { flex: 1; min-width: 0; }
.tl-meta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.tl-text { font-size: 13.5px; }
.comment-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }

/* ---- вход ---- */
.login-wrap { width: 100%; max-width: 400px; }
.login-card { background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; }
.login-head { background: linear-gradient(135deg, #0f2b3e, #17486b); color: #fff; padding: 26px 26px 22px; }
.login-head .brand { padding: 0 0 8px; }
.login-head p { margin: 0; color: #a8c6da; font-size: 13px; }
.login-body { padding: 22px 26px 26px; }
.tabs { display: flex; gap: 4px; background: var(--muted-soft); padding: 4px; border-radius: 9px; margin-bottom: 18px; }
.tabs a, .tabs button { flex: 1; text-align: center; padding: 7px 10px; border-radius: 7px; font-size: 13px; font-weight: 550; color: var(--text-2); border: none; background: transparent; cursor: pointer; text-decoration: none; font-family: inherit; }
.tabs .is-active { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.login-body .field { margin-bottom: 13px; }
.login-body .btn { width: 100%; margin-top: 6px; padding: 10px; }
.demo-hint { margin-top: 16px; font-size: 12px; color: var(--text-3); line-height: 1.7; }
.demo-hint code { background: var(--muted-soft); padding: 1px 5px; border-radius: 4px; font-size: 11.5px; color: var(--text-2); }
[hidden] { display: none !important; }

/* ---- печать (квитанция, акт) ---- */
.sheet-wrap { background: var(--bg); padding: 24px; min-height: 100vh; }
.sheet-toolbar { max-width: 760px; margin: 0 auto 14px; display: flex; gap: 8px; justify-content: flex-end; }
.sheet {
  background: #fff; max-width: 760px; margin: 0 auto; padding: 36px 44px;
  color: #111; font-size: 13px; line-height: 1.55; border-radius: 4px;
  box-shadow: var(--shadow);
}
.sheet h1 { font-size: 18px; text-align: center; margin-bottom: 4px; }
.sheet h2 { font-size: 14px; margin: 18px 0 8px; }
.sheet .sheet-sub { text-align: center; color: #555; font-size: 12.5px; margin-bottom: 20px; }
.sheet .sheet-head { display: flex; justify-content: space-between; border-bottom: 1px solid #bbb; padding-bottom: 10px; margin-bottom: 14px; font-size: 12.5px; color: #333; }
.sheet table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sheet th, .sheet td { border: 1px solid #c9c9c9; padding: 6px 8px; }
.sheet th { background: #f3f3f3; text-align: left; font-weight: 600; }
.sheet .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sheet .total td { font-weight: 700; background: #f7f7f7; }
.sheet .signs { display: flex; justify-content: space-between; margin-top: 34px; gap: 30px; }
.sheet .sign { flex: 1; border-top: 1px solid #999; padding-top: 5px; font-size: 11.5px; color: #444; }
.sheet .note { font-size: 11.5px; color: #555; margin-top: 16px; }
.sheet ul { margin: 6px 0; padding-left: 20px; }

@media print {
  body { background: #fff; }
  .sheet-wrap { padding: 0; background: #fff; }
  .sheet-toolbar, .topbar, .sidebar, .no-print { display: none !important; }
  .sheet { box-shadow: none; max-width: none; margin: 0; padding: 0; border-radius: 0; }
  a { color: inherit; text-decoration: none; }
  @page { size: A4; margin: 16mm; }
}

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .18s ease; }
  .sidebar.is-open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .shell { display: block; }
  .content { padding: 16px; }
}

/* ссылка на профиль в верхней панели */
.topbar-profile { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; padding: 4px 8px; border-radius: 8px; }
.topbar-profile:hover { background: var(--muted-soft); text-decoration: none; }

/* чек-листы и подзадачи в карточке заявки */
.checklist { display: flex; flex-direction: column; gap: 2px; }
.check-item { display: flex; align-items: flex-start; gap: 10px; padding: 7px 4px; border-radius: 7px; cursor: pointer; font-size: 13.5px; }
.check-item:hover { background: var(--muted-soft); }
.check-box { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px; border: 1.5px solid var(--border-strong, #cfd4dc); border-radius: 5px; background: #fff; color: #fff; display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
.check-item.is-done .check-box { background: var(--brand); border-color: var(--brand); }
.check-text { flex: 1; min-width: 0; line-height: 1.35; }
.check-item.is-done .check-text { color: var(--text-3); text-decoration: line-through; }

/* плашки имени прикреплённого файла */
.file-chip { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 5px; background: var(--muted-soft); font-size: 11.5px; color: var(--text-2); }

/* внутреннее (скрытое от жителя) событие в ленте */
.tl-dot.tl-internal { background: #fdf3d7; color: #a16207; }

/* типовая карточка «определения» в карточке заявки */
.defs { display: grid; grid-template-columns: minmax(150px, 210px) 1fr; gap: 8px 16px; margin: 0; font-size: 13.5px; }
.defs dt { color: var(--text-3); }
.defs dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* однострочные ячейки и плотный список */
.nowrap { white-space: nowrap; }
.card-body.tight { padding: 0; }
.card-body.tight a:last-child { border-bottom: none; }
