/* Тёмная тема — теперь тема по умолчанию (по явному предпочтению
   пользователя), светлая доступна как осознанный выбор через
   переключатель в шапке ([data-theme="light"] на <html>, см. app.js). */
:root {
  --bg: #0d0f14;
  --card-bg: #161922;
  --border: #262b36;
  --border-strong: #333947;
  --ink: #eef0f4;
  --ink-muted: #9aa1b0;
  --primary: #6d8dff;
  --primary-dark: #5372e0;
  --primary-soft: rgba(109, 141, 255, 0.16);
  --green: #3ecf7e;
  --green-bg: rgba(62, 207, 126, 0.14);
  --yellow: #f2b84b;
  --yellow-bg: rgba(242, 184, 75, 0.14);
  --red: #f26363;
  --red-bg: rgba(242, 99, 99, 0.14);
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 28px -8px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --font-body: "Manrope", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-heading: var(--font-body);
}

:root[data-theme="light"] {
  --bg: #f5f6f9;
  --card-bg: #ffffff;
  --border: #e7e9ef;
  --border-strong: #d8dbe3;
  --ink: #171b26;
  --ink-muted: #6b7280;
  --primary: #2f6fed;
  --primary-dark: #244fb0;
  --primary-soft: #eaf1ff;
  --green: #16a34a;
  --green-bg: #e7f8ee;
  --yellow: #b7791f;
  --yellow-bg: #fdf3dc;
  --red: #dc2626;
  --red-bg: #fdecec;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 10px 24px -6px rgba(16, 24, 40, 0.1);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
}

/* Тестовая палитра по мокапу дизайнера из Google Stitch («Grid
   Command» — см. DESIGN.md в присланных .zip) — доступна только через
   ?theme=preview (см. app.js), нигде в обычном интерфейсе не
   переключается и не влияет на других пользователей. Цвета — из
   реального YAML-токенсета мокапа (совпадает с тем, что видно на
   скриншотах), а не из его же текстового описания — они местами
   расходятся, за основу взято то, что реально отрисовано. Warning-тон
   (жёлтый/статус "Ожидается") в токенах мокапа не описан вообще —
   оставлен текущий, чтобы не гадать. Если понравится, эти значения
   переносятся в основной :root, а этот блок и temporary-переключатель
   в app.js удаляются. */
:root[data-theme="preview"] {
  --bg: #0f131d;
  --card-bg: #171b26;
  --border: #1c1f2a;
  --border-strong: #313540;
  --ink: #dfe2f1;
  --ink-muted: #8c909f;
  --primary: #adc6ff;
  --primary-dark: #4d8eff;
  --primary-soft: rgba(173, 198, 255, 0.16);
  --green: #4edea3;
  --green-bg: rgba(78, 222, 163, 0.14);
  --yellow: #f2b84b;
  --yellow-bg: rgba(242, 184, 75, 0.14);
  --red: #ffb4ab;
  --red-bg: rgba(255, 180, 171, 0.14);
  --radius: 4px;
  --radius-lg: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --font-body: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-heading: "Plus Jakarta Sans", var(--font-body);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}

h1,
h3 {
  margin: 0 0 12px 0;
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 24px;
  font-weight: 800;
}

h3 {
  font-size: 15px;
}

p {
  color: var(--ink-muted);
}

.hidden {
  display: none !important;
}

button {
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--ink);
  padding: 8px 14px;
}

button:hover {
  filter: brightness(0.97);
}

input,
select {
  font-family: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--ink);
  width: 100%;
}

input:disabled {
  background: var(--bg);
  color: var(--ink-muted);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-primary.full {
  width: 100%;
  margin-top: 8px;
  padding: 10px 14px;
}

.btn-secondary {
  background: var(--card-bg);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-danger {
  background: var(--red-bg);
  border-color: var(--red);
  color: var(--red);
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  padding: 0;
  text-decoration: underline;
}

.small-btn {
  font-size: 12px;
  padding: 4px 10px;
}

.error-text {
  color: var(--red);
  font-size: 13px;
  margin-top: 6px;
  min-height: 1em;
}

.warning-box {
  background: var(--yellow-bg);
  color: var(--yellow);
  border: 1px solid var(--yellow);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-top: 10px;
  font-size: 13px;
}

/* ---------- Вход ---------- */
#loginView {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px;
  width: 320px;
}

.login-card .field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

/* ---------- Приложение: каркас ---------- */
.app-wrap {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 210px;
  flex-shrink: 0;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.01em;
  padding: 8px 10px 20px;
}

.logo-mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  background: none;
  border: none;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 13.5px;
}

.nav-item svg {
  flex-shrink: 0;
}

.nav-item #navUnreadBadge {
  margin-left: auto;
}

.nav-item:hover {
  background: var(--bg);
}

.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

.who {
  font-size: 13px;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.who-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.who-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  cursor: pointer;
}

.who-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.who-avatar-remove {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  border: 2px solid var(--card-bg);
  font-size: 10px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.who-avatar-wrap:hover .who-avatar-remove {
  opacity: 1;
}

.who-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.2;
}

.who-name {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.who-name:hover {
  color: var(--primary);
  text-decoration: underline;
}

.who-role {
  display: inline-block;
  width: fit-content;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
}

.who-sep {
  width: 1px;
  align-self: stretch;
  background: var(--border);
  margin: 2px 0;
}

.theme-toggle {
  display: flex;
  align-items: center;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px;
  cursor: pointer;
  flex-shrink: 0;
}

.theme-toggle .knob {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
  transform: translateX(0);
}

:root[data-theme="light"] .theme-toggle .knob {
  transform: translateX(18px);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  width: 12px;
  height: 12px;
  stroke: #fff;
}

.theme-toggle .icon-sun {
  display: none;
}

.theme-toggle .icon-moon {
  display: block;
}

:root[data-theme="light"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="light"] .theme-toggle .icon-moon {
  display: none;
}

.who-lang-select {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 8px;
  cursor: pointer;
}

.who-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.who-btn {
  background: none;
  border: none;
  color: var(--ink-muted);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.who-btn:hover {
  background: var(--bg);
  color: var(--ink);
}

.who-btn-danger:hover {
  background: var(--red-bg);
  color: var(--red);
}

.content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- Карточки / бейджи / таблицы ---------- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink-muted);
  vertical-align: middle;
}

.badge.green {
  background: var(--green-bg);
  color: var(--green);
}

.badge.red {
  background: var(--red-bg);
  color: var(--red);
}

.badge.yellow {
  background: var(--yellow-bg);
  color: var(--yellow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table th,
table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}

table th {
  color: var(--ink-muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

table tbody tr:hover td {
  background: rgba(127, 127, 127, 0.06);
}

a {
  color: var(--ink);
}

a:visited {
  color: var(--ink);
}

a:hover {
  color: var(--primary);
}

.mono {
  font-variant-numeric: tabular-nums;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}

.list-item:last-child {
  border-bottom: none;
}

/* ---------- Слоты документов счётчика (Договор/ТУ/Разрешения) ---------- */
.doc-slot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.doc-slot:last-child {
  border-bottom: none;
}

.doc-slot-label {
  font-weight: 600;
  min-width: 180px;
  flex: none;
}

.doc-slot-body {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.doc-slot-files {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 200px;
}

.doc-slot-file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  flex-wrap: wrap;
}

.doc-slot-empty {
  color: var(--ink-muted);
  font-size: 13px;
}

.doc-slot-upload {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.doc-slot-upload input[type="file"] {
  max-width: 200px;
  font-size: 12px;
}

.section-title,
.section-title-list h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
  margin: 12px 0 6px;
}

/* ---------- Формы ---------- */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 10px;
}

.form-row .field {
  flex: 1 1 160px;
  min-width: 140px;
}

.meters-filter-row .field {
  flex: 0 1 170px;
  min-width: 140px;
}

.meters-filter-row .field input {
  width: 100%;
}

.form-section {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.field-checkbox .checkbox-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}

.field-checkbox input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.form-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary-dark);
  margin-bottom: 12px;
}

/* ---------- Дашборд ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.stat-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px;
  text-align: left;
}

.stat-box .num {
  font-family: "JetBrains Mono", monospace;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stat-box .label {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 4px;
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.stat-icon.tint-primary {
  background: var(--primary-soft);
  color: var(--primary);
}

.stat-icon.tint-green {
  background: var(--green-bg);
  color: var(--green);
}

.stat-icon.tint-yellow {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.stat-icon.tint-red {
  background: var(--red-bg);
  color: var(--red);
}

.progress-bar {
  height: 7px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}

.progress-bar > div {
  height: 100%;
}

/* ---------- Адреса: хлебные крошки ---------- */
.geo-breadcrumb {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark);
}

/* ---------- Адреса: пять колонок ---------- */
.add-inline {
  display: flex;
  margin-bottom: 12px;
}

.add-inline input {
  flex: 1 1 auto;
  min-width: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}

.add-inline input:focus {
  position: relative;
  z-index: 1;
}

.btn-icon-add {
  flex: 0 0 auto;
  width: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  line-height: 1;
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-icon-add:hover {
  background: var(--primary-dark);
}

/* ---------- Адресная иерархия: вертикальный стек, город -> ... -> квартира ---------- */
.geo-stack {
  display: flex;
  flex-direction: column;
}

.geo-section {
  padding-block: 20px;
  border-bottom: 1px solid var(--border);
}

.geo-section:first-child {
  padding-top: 4px;
}

.geo-section:last-child {
  border-bottom: none;
}

.geo-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.geo-section-head h3 {
  margin: 0;
}

.geo-add-toggle {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--card-bg);
  color: var(--ink-muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.geo-add-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.geo-add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.geo-add-row.hidden {
  display: none;
}

.geo-add-row input {
  max-width: 260px;
}

.geo-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.geo-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.geo-chip.no-actions {
  padding-right: 14px;
}

.geo-chip:hover {
  border-color: var(--border-strong);
}

.geo-chip.selected {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, var(--card-bg));
  font-weight: 600;
}

.geo-chip.inactive {
  opacity: 0.6;
}

.geo-chip-icon {
  width: 22px;
  height: 22px;
  flex: none;
  border: none;
  border-radius: 999px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  color: var(--ink-muted);
}

.geo-chip-icon svg {
  width: 13px;
  height: 13px;
}

.geo-chip-icon.edit:hover {
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  color: var(--primary);
}

.geo-chip-icon.delete:hover {
  background: var(--red-bg);
  color: var(--red);
}

.geo-empty-hint {
  color: var(--ink-muted);
  font-size: 13px;
}

/* ---------- Вкладки справочников ---------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: -1px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.mc-header-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

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

@media (max-width: 900px) {
  .spec-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.spec-label {
  font-size: 11.5px;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.spec-value {
  font-size: 13.5px;
  font-weight: 600;
}

.mc-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-item {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.tab-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

/* ---------- Список чекбоксов (города для руководителя филиала) ---------- */
.checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  max-height: 160px;
  overflow-y: auto;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

.checkbox-item input {
  width: auto;
}

/* ---------- Счётчики: быстрые фильтры, кликабельные строки ---------- */
.quick-filter.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ---------- Модальное окно ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  width: 320px;
}

.modal-card .field {
  margin-bottom: 12px;
}

/* ---------- Модалка профиля ---------- */
.profile-card {
  width: 300px;
  position: relative;
  padding: 20px;
}

.modal-close-x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border: none;
  background: none;
  border-radius: 50%;
  color: var(--ink-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.modal-close-x:hover {
  background: var(--bg);
  color: var(--ink);
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 5px;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-bottom: 16px;
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.profile-row-icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.85;
}

.profile-row-label {
  color: var(--ink-muted);
  min-width: 70px;
  flex-shrink: 0;
}

.profile-row-value {
  color: var(--ink);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.profile-action-btn {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: var(--bg);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.profile-action-btn:hover {
  background: var(--border);
}

/* ---------- Мобильная вёрстка (ТЗ разд. 8, 27: ввод показания и фото
   с телефона за минимум действий) ----------
   Фиксированный боковой сайдбар в 210px не оставляет места под контент
   на экране телефона — превращаем его в горизontальную прокручиваемую
   полосу сверху, контент разворачиваем на всю ширину под ней. */
@media (max-width: 700px) {
  .app-wrap {
    flex-direction: column;
    min-height: auto;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .logo {
    display: none;
  }

  .nav-item {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
  }

  .content {
    padding: 12px;
  }

  .form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .form-row .field,
  .form-row > button {
    width: 100%;
    flex: 1 1 auto;
  }

  table {
    font-size: 12px;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    white-space: nowrap;
  }
}
