/*
  ============================================================================
  Мои коммунальные — карта стилей
  ============================================================================
  01. База, токены и общие компоненты
  02. Формы и сообщения
  03. Авторизация
  04. Каркас приложения и навигация
  05. Главная: сводка, адреса, услуги и счётчики
  06. История показаний
  07. Модальные окна и уведомления
  08. Адаптивность

  Брейкпоинты находятся в конце файла:
  1024px+ — десктоп; до 1023px — планшеты и мобильный landscape;
  до 479px — вертикальные телефоны.
  ============================================================================
*/

/* ========================================================================== */
/* 01. База, токены и общие компоненты                                        */
/* ========================================================================== */

/* Цвета, размеры и типографика приложения */
:root {
  --ink: #17251f;
  --muted: #6d7a74;
  --line: #dde5e0;
  --surface: #ffffff;
  --canvas: #f5f7f5;
  --green: #176b4d;
  --green-dark: #0e543b;
  --green-soft: #e6f3ed;
  --blue-soft: #e9f2fb;
  --orange-soft: #fff1dd;
  --danger: #b73a3a;
  --danger-soft: #fdeaea;
  --shadow: 0 18px 48px rgba(19, 51, 39, 0.08);
  --radius-lg: 1.5rem;
  --radius-md: 1rem;
  --radius-sm: 0.75rem;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 20rem;
  background: var(--canvas);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 0.2rem solid rgba(23, 107, 77, 0.25);
  outline-offset: 0.12rem;
}

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

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 750;
  text-decoration: none;
}

.brand > span:first-child {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  border-radius: 0.8rem;
  background: var(--green-soft);
  font-size: 1.25rem;
}

.brand--light {
  color: #fff;
}

.brand--light > span:first-child {
  background: rgba(255, 255, 255, 0.13);
}

.eyebrow {
  margin-bottom: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow--green {
  margin-bottom: 0.55rem;
  color: var(--green);
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.72rem 1rem;
  border: 0.0625rem solid transparent;
  border-radius: 0.8rem;
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
}

.button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.button--primary {
  color: #fff;
  background: var(--green);
  box-shadow: 0 0.5rem 1.2rem rgba(23, 107, 77, 0.16);
}

.button--primary:hover {
  background: var(--green-dark);
}

.button--secondary {
  border-color: var(--line);
  color: var(--ink);
  background: #fff;
}

.button--secondary:hover {
  border-color: #becbc4;
  background: #fafcfb;
}

.button--danger {
  color: #fff;
  background: var(--danger);
}

.button--wide {
  width: 100%;
}

.button--tiny {
  min-height: 48px;
  padding: 0.36rem 0.65rem;
  border-color: #cfe2d9;
  color: var(--green);
  background: #f7fbf9;
  font-size: 0.72rem;
}

.icon-button,
.mini-action {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  cursor: pointer;
  background: transparent;
}

.icon-button {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.7rem;
}

.icon-button--soft {
  background: #f0f4f2;
}

.mini-action {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 0.55rem;
  font-size: 0.85rem;
}

.mini-action:hover {
  background: #edf3f0;
}

/* Поля форм */
.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.45rem;
}

.field > span:first-child {
  color: #415049;
  font-size: 0.82rem;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  height: 48px;
  min-height: 48px;
  padding: 0 0.5rem;
  border: 0.0625rem solid #d8e0dc;
  border-radius: 12px;
  color: var(--ink);
  outline: none;
  background: #fff;
  line-height: 1;
}

.field input::placeholder {
  color: #a2ada7;
}

.field input[readonly] {
  cursor: not-allowed;
  color: #66736c;
  border-color: #e0e6e3;
  background: #f1f4f2;
}

.field input:focus,
.field select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 0.2rem rgba(23, 107, 77, 0.09);
}

.field small {
  color: #859089;
  font-size: 0.7rem;
  line-height: 1.4;
}

/* Вспомогательные контейнеры форм и системные сообщения */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-grid {
  display: grid;
  gap: 0.9rem;
}

.form-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-note {
  padding: 0.85rem 0.95rem;
  border: 0.0625rem solid #d5e7de;
  border-radius: 0.75rem;
  color: #53625b;
  background: #f1f8f5;
  font-size: 0.76rem;
  line-height: 1.55;
}

.notice {
  margin-bottom: 1rem;
  padding: 0.85rem 0.95rem;
  border-radius: 0.8rem;
  font-size: 0.8rem;
  line-height: 1.45;
}

.notice--error {
  border: 0.0625rem solid #f2cdcd;
  color: #8f2d2d;
  background: var(--danger-soft);
}

/* ========================================================================== */
/* 03. Авторизация                                                            */
/* ========================================================================== */
.auth-page {
  padding: 1rem;
  background: #e9efeb;
}

.auth-shell {
  display: grid;
  width: min(75rem, 100%);
  min-height: calc(100vh - 2rem);
  margin: 0 auto;
  grid-template-columns: minmax(0, 1.05fr) minmax(25rem, 0.95fr);
  overflow: hidden;
  border-radius: 1.75rem;
  background: #fff;
  box-shadow: 0 2rem 5rem rgba(25, 55, 44, 0.11);
}

.auth-intro {
  display: flex;
  position: relative;
  min-height: 38rem;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 2.2rem;
  color: #fff;
  background:
    radial-gradient(circle at 88% 15%, rgba(179, 223, 199, 0.32), transparent 24%),
    radial-gradient(circle at 18% 90%, rgba(255, 255, 255, 0.09), transparent 30%),
    linear-gradient(145deg, #0d5039, #153c2f 70%);
}

.auth-intro::after {
  position: absolute;
  right: -4rem;
  bottom: -5rem;
  width: 22rem;
  height: 22rem;
  border: 0.0625rem solid rgba(255, 255, 255, 0.09);
  border-radius: 50%;
  box-shadow: 0 0 0 3rem rgba(255, 255, 255, 0.025), 0 0 0 6rem rgba(255, 255, 255, 0.018);
  content: "";
}

.auth-intro__content {
  position: relative;
  z-index: 1;
  max-width: 30rem;
}

.auth-intro h1 {
  max-width: 35rem;
  margin-bottom: 1.1rem;
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.auth-intro__content > p:last-child {
  max-width: 31rem;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 1rem;
  line-height: 1.65;
}

.auth-feature-row {
  display: flex;
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.auth-feature-row span {
  padding: 0.55rem 0.75rem;
  border: 0.0625rem solid rgba(255, 255, 255, 0.11);
  border-radius: 2rem;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.72rem;
}

.auth-panel {
  display: grid;
  place-items: center;
  padding: 3rem clamp(1.5rem, 5vw, 5rem);
}

.auth-card {
  width: min(25rem, 100%);
}

.auth-card__heading {
  margin-bottom: 1.7rem;
}

.auth-card__emoji {
  display: grid;
  width: 3rem;
  height: 3rem;
  margin-bottom: 1.15rem;
  place-items: center;
  border-radius: 0.9rem;
  background: var(--green-soft);
  font-size: 1.45rem;
}

.auth-card h2 {
  margin-bottom: 0.45rem;
  font-size: 1.8rem;
  letter-spacing: -0.03em;
}

.auth-card__heading p,
.auth-switch {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.password-field {
  display: flex;
  position: relative;
  align-items: center;
}

.password-field input {
  padding-right: 3.2rem;
}

.password-field .icon-button {
  position: absolute;
  right: 0.25rem;
  width: 48px;
  height: 48px;
}

.auth-switch {
  margin: 1.3rem 0 0;
  text-align: center;
}

.auth-switch a {
  font-weight: 750;
}

/* ========================================================================== */
/* 04. Каркас приложения и навигация                                          */
/* ========================================================================== */
.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 16.5rem minmax(0, 1fr);
}

.sidebar {
  display: flex;
  position: fixed;
  z-index: 10;
  top: 0;
  bottom: 0;
  left: 0;
  width: 16.5rem;
  flex-direction: column;
  padding: 1.4rem 1.15rem;
  border-right: 0.0625rem solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.sidebar > .brand {
  margin: 0 0.55rem 2.1rem;
}

.main-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.8rem;
  padding: 0.78rem 0.85rem;
  border: 0;
  border-radius: 0.75rem;
  cursor: pointer;
  color: #617068;
  background: transparent;
  font-size: 0.84rem;
  font-weight: 700;
  text-align: left;
}

.nav-item > span:first-child {
  display: grid;
  width: 1.8rem;
  height: 1.8rem;
  place-items: center;
  border-radius: 0.5rem;
  font-size: 1.05rem;
}

.nav-item.is-active {
  color: var(--green-dark);
  background: var(--green-soft);
}

.nav-item.is-active > span:first-child {
  color: #fff;
  background: var(--green);
}

.sidebar-tip {
  display: flex;
  gap: 0.65rem;
  margin-top: auto;
  margin-bottom: 1rem;
  padding: 0.9rem;
  border: 0.0625rem solid #e2e9e5;
  border-radius: 0.9rem;
  background: #fafcfb;
}

.sidebar-tip > span {
  font-size: 1rem;
}

.sidebar-tip p {
  margin: 0;
  color: #728078;
  font-size: 0.68rem;
  line-height: 1.45;
}

.sidebar-tip strong {
  display: block;
  margin-bottom: 0.15rem;
  color: #405048;
}

.profile-block {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding-top: 1rem;
  border-top: 0.0625rem solid var(--line);
}

.profile-avatar {
  display: grid;
  width: 2.45rem;
  height: 2.45rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-size: 0.82rem;
  font-weight: 800;
}

.profile-avatar--small {
  width: 2.2rem;
  height: 2.2rem;
}

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

.profile-copy strong {
  overflow: hidden;
  font-size: 0.77rem;
  text-overflow: ellipsis;
}

.profile-copy small {
  color: #8b9690;
  font-size: 0.63rem;
}

.main-content {
  min-width: 0;
  grid-column: 2;
  padding: 2.4rem clamp(1.5rem, 4vw, 4rem) 4rem;
}

.app-view {
  width: min(78rem, 100%);
  margin: 0 auto;
}

.app-view[hidden] {
  display: none;
}

.mobile-header,
.mobile-nav {
  display: none;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.7rem;
}

.page-header h1 {
  margin-bottom: 0.4rem;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  letter-spacing: -0.04em;
}

.page-description {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.page-actions {
  display: grid;
  width: min(100%, 26rem);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 0.7rem;
}

.page-actions .button {
  width: 100%;
}

/* В «Истории» остаётся только выбор месяца — он занимает обе колонки. */
.page-actions > .month-control:only-child {
  grid-column: 1 / -1;
}

.month-control {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.month-control span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.month-control input,
.month-control select {
  width: 100%;
  height: 48px;
  min-height: 48px;
  padding: 0 0.5rem;
  border: 0.0625rem solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
}

/* ========================================================================== */
/* 05. Главная — сводка, адреса, услуги и счётчики                             */
/* ========================================================================== */

/* Сводка по выбранному периоду */
.summary-list {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 0;
  padding-bottom: 24px;
}

.summary-item,
.summary-card {
  display: flex;
  width: 100%;
  flex: 0 0 auto;
  min-height: 7.6rem;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem;
  border: 0.0625rem solid var(--line);
  border-radius: 1.15rem;
  background: #fff;
  box-shadow: 0 0.8rem 2.4rem rgba(22, 52, 41, 0.035);
}

.summary-item--featured,
.summary-card--featured {
  border-color: transparent;
  color: #fff;
  background:
    radial-gradient(circle at 85% 10%, rgba(255, 255, 255, 0.12), transparent 33%),
    linear-gradient(135deg, #176b4d, #104a37);
}

.summary-item__icon,
.summary-card__icon {
  display: grid;
  width: 3rem;
  height: 3rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.13);
  font-size: 1.35rem;
}

.summary-item__icon--blue,
.summary-card__icon--blue {
  background: var(--blue-soft);
}

.summary-item__icon--orange,
.summary-card__icon--orange {
  background: var(--orange-soft);
}

.summary-item > div,
.summary-card > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.summary-item small,
.summary-card small {
  margin-bottom: 0.28rem;
  color: var(--muted);
  font-size: 0.68rem;
}

.summary-item--featured small,
.summary-item--featured span,
.summary-card--featured small,
.summary-card--featured span {
  color: rgba(255, 255, 255, 0.68);
}

.summary-item strong,
.summary-card strong {
  margin-bottom: 0.15rem;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  letter-spacing: -0.035em;
}

.summary-item > div > span,
.summary-card > div > span {
  color: #8a958f;
  font-size: 0.66rem;
}

/* Список адресов */
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}

.section-heading > div {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.12rem;
}

.section-heading span {
  padding: 0.24rem 0.5rem;
  border-radius: 2rem;
  color: #718078;
  background: #e8eeeb;
  font-size: 0.62rem;
  font-weight: 700;
}

.address-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.address-card {
  min-width: 0;
  align-self: start;
  overflow: hidden;
  border: 0.0625rem solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 1.1rem 3rem rgba(24, 52, 41, 0.045);
}

.address-card__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.15rem 1.15rem 0.95rem;
}

.address-card__pin {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0.85rem;
  background: var(--green-soft);
  font-size: 1.25rem;
}

.address-card__title {
  min-width: 0;
  flex: 1;
}

.address-card__title h3 {
  overflow: hidden;
  margin-bottom: 0.2rem;
  font-size: 0.97rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.address-card__title p {
  overflow: hidden;
  margin-bottom: 0;
  color: #87928c;
  font-size: 0.66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-actions {
  display: flex;
  gap: 0.1rem;
}

.entity-actions--compact {
  margin-left: 0.15rem;
}

/* Услуги и счётчики внутри карточки адреса */
.service-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0 0.85rem;
}

.service-block {
  overflow: hidden;
  border: 0.0625rem solid #e2e8e5;
  border-radius: 1rem;
  background: #fbfcfb;
}

.service-block__header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem;
}

.service-icon {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0.7rem;
  background: #fff;
  box-shadow: 0 0.25rem 0.7rem rgba(31, 55, 46, 0.06);
  font-size: 1.05rem;
}

.service-block__header > span:nth-child(2) {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.service-block__header > span:nth-child(2) strong {
  overflow: hidden;
  font-size: 0.78rem;
  text-overflow: ellipsis;
}

.service-block__header > span:nth-child(2) small {
  color: #87928c;
  font-size: 0.59rem;
}

.service-total {
  flex: 0 0 auto;
  font-size: 0.8rem;
}

.meter-list {
  display: flex;
  flex-direction: column;
  border-top: 0.0625rem solid #e4eae7;
}

.meter-row {
  display: grid;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.8rem;
  grid-template-columns: minmax(0, 1fr) auto;
  background: #fff;
}

.meter-row + .meter-row {
  border-top: 0.0625rem solid #edf1ef;
}

.meter-row__main,
.meter-row__amount {
  display: flex;
  gap: 8px;
  min-width: 0;
  flex-direction: column;
}

.meter-row__main strong,
.meter-row__amount strong {
  font-size: 0.86rem;
}

.meter-row__main small,
.meter-row__amount small {
  color: #8b9690;
  font-size: 0.68rem;
}

.meter-row__main .meter-row__difference {
  margin-top: 0.15rem;
  color: var(--green);
  font-weight: 750;
}

.meter-row__amount {
  align-items: flex-end;
}

.meter-row__actions {
  display: flex;
  flex-direction: row;
  justify-content: center; /* по горизонтали */
  align-items: center;
  grid-column: 1 / -1;
  gap: 0.25rem;
}

.meter-empty {
  margin: 0;
  padding: 0.8rem;
  color: #87928c;
  background: #fff;
  font-size: 0.65rem;
}

.text-button {
  margin: 0.65rem 1rem 0.95rem;
  padding: 0;
  border: 0;
  cursor: pointer;
  color: var(--green);
  background: transparent;
  font-size: 0.7rem;
  font-weight: 750;
}

.address-card > .text-button {
  margin-top: 1.25rem;
}

.text-button--small {
  margin: 0.65rem 0.8rem;
  font-size: 0.63rem;
}

.address-card__footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0.9rem 1.15rem;
  border-top: 0.0625rem solid #e4ebe7;
  background: #f1f7f4;
}

.address-card__footer > span {
  display: flex;
  flex-direction: column;
}

.address-card__footer small {
  color: #75827b;
  font-size: 0.6rem;
}

.address-card__footer strong {
  margin-top: 0.13rem;
  color: var(--green-dark);
  font-size: 1.15rem;
}

/* Пустые и загрузочные состояния */
.inline-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.2rem;
  border: 0.0625rem dashed #d7e0db;
  border-radius: 0.9rem;
  color: #7c8982;
}

.inline-empty p {
  margin: 0;
  font-size: 0.72rem;
}

.empty-state {
  padding: 3.5rem 1.5rem;
  border: 0.0625rem dashed #ccd8d2;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.62);
  text-align: center;
  grid-column: 1 / -1;
}

.empty-state > span {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 2.3rem;
}

.empty-state h3 {
  margin-bottom: 0.35rem;
}

.empty-state p {
  margin: 0 auto 1.1rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.skeleton-block,
.skeleton-card {
  min-height: 7.6rem;
  border-color: #e4e9e6;
  background: linear-gradient(110deg, #f0f3f1 8%, #f7f9f8 18%, #f0f3f1 33%);
}

.skeleton-card {
  min-height: 23rem;
}

/* ========================================================================== */
/* 06. История показаний                                                      */
/* ========================================================================== */
.history-summary {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 1rem;
  color: #fff;
  background: linear-gradient(135deg, #176b4d, #104a37);
}

.history-summary__icon {
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.12);
  font-size: 1.25rem;
}

.history-summary > span:last-child {
  display: flex;
  flex-direction: column;
}

.history-summary small {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.65rem;
}

.history-summary strong {
  font-size: 1.2rem;
}

.filter-bar {
  display: grid;
  align-items: end;
  margin-bottom: 1rem;
  padding: 1rem;
  border: 0.0625rem solid var(--line);
  border-radius: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 0.75rem;
  background: #fff;
}

.field--compact input,
.field--compact select {
  height: 48px;
  min-height: 48px;
  font-size: 0.76rem;
}

.filter-reset {
  min-height: 2.65rem;
}

.table-card {
  overflow: hidden;
  border: 0.0625rem solid var(--line);
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 1rem 2.5rem rgba(24, 52, 41, 0.04);
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  white-space: nowrap;
}

th,
td {
  padding: 0.85rem 0.8rem;
  border-bottom: 0.0625rem solid #e8edea;
  text-align: left;
}

th {
  color: #78847e;
  background: #f8faf9;
  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td > small {
  display: block;
  margin-top: 0.18rem;
  color: #89958e;
  font-size: 0.6rem;
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.1rem;
}

.loading-state,
.history-empty {
  padding: 3rem 1rem;
  color: var(--muted);
  text-align: center;
}

.loading-state--error {
  color: var(--danger);
}

.history-empty {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 0.25rem;
}

.history-empty span {
  margin-bottom: 0.35rem;
  font-size: 2rem;
}

.history-empty small {
  color: #89958e;
}

/* ========================================================================== */
/* 07. Модальные окна и уведомления                                           */
/* ========================================================================== */
.modal,
.confirm-modal {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 1rem;
  border: 0;
  background: transparent;
}

.modal::backdrop,
.confirm-modal::backdrop {
  background: rgba(15, 29, 23, 0.56);
}

.modal[open] {
  display: grid;
  place-items: center;
}

.modal-card {
  width: min(34rem, 100%);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  border-radius: 1.25rem;
  background: #fff;
  box-shadow: 0 2rem 6rem rgba(10, 28, 21, 0.25);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.15rem 0.9rem;
  border-bottom: 0.0625rem solid var(--line);
}

.modal-header > div {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-header > div > span:last-child {
  display: flex;
  flex-direction: column;
}

.modal-emoji {
  display: grid;
  width: 2.7rem;
  height: 2.7rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0.8rem;
  background: var(--green-soft);
  font-size: 1.25rem;
}

.modal-header h2 {
  margin-bottom: 0.18rem;
  font-size: 1.08rem;
}

.modal-header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.4;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.15rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  padding: 0.9rem 1.15rem 1.15rem;
  border-top: 0.0625rem solid var(--line);
}

.emoji-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.emoji-choices button {
  display: grid;
  width: 2.3rem;
  height: 2.3rem;
  place-items: center;
  border: 0.0625rem solid var(--line);
  border-radius: 0.65rem;
  cursor: pointer;
  background: #fff;
}

.emoji-choices button:hover {
  border-color: #b7cec3;
  background: var(--green-soft);
}

.reading-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 0.9rem;
  border-radius: 0.75rem;
  color: #486056;
  background: var(--green-soft);
  font-size: 0.75rem;
}

.danger-link {
  align-self: flex-start;
  padding: 0;
  border: 0;
  cursor: pointer;
  color: var(--danger);
  background: transparent;
  font-size: 0.7rem;
  font-weight: 700;
}

.confirm-modal[open] {
  display: grid;
  place-items: center;
}

.confirm-card {
  width: min(25rem, 100%);
  padding: 1.6rem;
  border-radius: 1.2rem;
  background: #fff;
  box-shadow: 0 2rem 6rem rgba(10, 28, 21, 0.25);
  text-align: center;
}

.confirm-card__emoji {
  display: grid;
  width: 3.4rem;
  height: 3.4rem;
  margin: 0 auto 0.9rem;
  place-items: center;
  border-radius: 50%;
  background: var(--danger-soft);
  font-size: 1.5rem;
}

.confirm-card h2 {
  margin-bottom: 0.4rem;
  font-size: 1.2rem;
}

.confirm-card p {
  margin-bottom: 1.2rem;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.confirm-card__actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
}

.toast-region {
  display: flex;
  position: fixed;
  z-index: 100;
  right: 1rem;
  bottom: 1rem;
  width: min(22rem, calc(100% - 2rem));
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.8rem 0.9rem;
  border: 0.0625rem solid #dce6e1;
  border-radius: 0.8rem;
  background: #fff;
  box-shadow: var(--shadow);
}

.toast--error {
  border-color: #efcccc;
}

.toast p {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.45;
}

/* ========================================================================== */
/* 08. Адаптивность                                                           */
/* ========================================================================== */

/* До 1023px — планшеты и мобильный landscape */
@media (max-width: 1023px) {
  .address-grid {
    grid-template-columns: 1fr;
  }
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-intro {
    min-height: 23rem;
  }

  .auth-intro h1 {
    max-width: 32rem;
    font-size: clamp(2rem, 8vw, 3.2rem);
  }

  .auth-panel {
    padding-block: 2.4rem;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .main-content {
    padding: 0 1rem 6.5rem;
  }

  .summary-list {
    display: flex;
    width: 100%;
    flex-direction: column;
  }

  .summary-item,
  .summary-card {
    width: 100%;
  }

  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 -1rem 1.35rem;
    padding: 0.85rem 1rem;
    border-bottom: 0.0625rem solid var(--line);
    background: #fff;
  }

  .mobile-nav {
    display: flex;
    flex-direction: row;
  justify-content: center;
  gap: 4rem;
  padding-bottom: 1rem;
    position: fixed;
    z-index: 20;
    right: 0;
    bottom: 0;
    left: 0;
    height: 5.8rem;
    align-items: center;
    border-top: 0.0625rem solid var(--line);
    grid-template-columns: 1fr auto 1fr;
    background: rgba(255, 255, 255, 0.98);
  }

  .mobile-nav__item {
    display: flex;
    height: 100%;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.12rem;
    border: 0;
    color: #819088;
    background: transparent;
  }

  .mobile-nav__item span {
    font-size: 1.25rem;
  }

  .mobile-nav__item small {
    font-size: 0.6rem;
    font-weight: 700;
  }

  .mobile-nav__item.is-active {
    color: var(--green);
  }

  .mobile-nav__add {
    display: flex;
    width: 3.4rem;
    height: 3.4rem;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: var(--green);
    box-shadow: 0 0.6rem 1.5rem rgba(23, 107, 77, 0.25);
    font-family: Arial, sans-serif;
    font-size: 1.5rem;
    line-height: 1;
    text-align: center;
  }

  .mobile-nav__add span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 1;
    text-align: center;
  }

  .filter-bar {
    grid-template-columns: repeat(3, 1fr);
  }

  .filter-reset {
    grid-column: 1 / -1;
  }
}

/* До 479px — вертикальные телефоны */
@media (max-width: 479px) {
  .auth-page {
    padding: 0;
  }

  .auth-shell {
    min-height: 100vh;
    border-radius: 0;
  }

  .auth-intro {
    min-height: 20rem;
    padding: 1.25rem;
  }

  .auth-panel {
    padding: 2rem 1.15rem 2.5rem;
  }

  .page-header {
    align-items: stretch;
    flex-direction: column;
    gap: 1rem;
  }

  .page-actions {
    display: flex;
    width: 100%;
    align-items: stretch;
    flex-direction: column;
    gap: 0.7rem;
  }

  .month-control input,
  .month-control select,
  .page-actions .button {
    width: 100%;
  }

  .filter-bar {
    grid-template-columns: 1fr;
  }

  .filter-reset {
    grid-column: auto;
  }

  .table-card,
  .table-scroll {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  table,
  tbody {
    display: block;
  }

  thead {
    display: none;
  }

  tbody tr {
    display: grid;
    margin-bottom: 0.75rem;
    padding: 0.85rem;
    border: 0.0625rem solid var(--line);
    border-radius: 1rem;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
    background: #fff;
  }

  tbody td {
    display: flex;
    min-width: 0;
    flex-direction: column;
    padding: 0;
    border: 0;
    white-space: normal;
  }

  tbody td::before {
    margin-bottom: 0.15rem;
    color: #8a958f;
    content: attr(data-label);
    font-size: 0.56rem;
    font-weight: 700;
    text-transform: uppercase;
  }

  tbody td:nth-child(2),
  tbody .table-actions,
  tbody td:only-child {
    grid-column: 1 / -1;
  }

  tbody .table-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-direction: row;
    padding-top: 0.55rem;
    border-top: 0.0625rem solid #edf1ef;
  }

  tbody .table-actions::before {
    margin-right: auto;
    content: "Действия";
  }

  .form-grid--two {
    grid-template-columns: 1fr;
  }

  .modal {
    align-items: end;
    padding: 0;
  }

  .modal[open] {
    place-items: end center;
  }

  .modal-card {
    width: 100%;
    max-height: 92vh;
    border-radius: 1.25rem 1.25rem 0 0;
  }

  .modal-footer .button {
    flex: 1;
  }

  .toast-region {
    right: 0.75rem;
    bottom: 5.3rem;
    width: calc(100% - 1.5rem);
  }
  .auth-intro h1 {
    margin-bottom: 0.75rem;
    font-size: 2.15rem;
  }

  .auth-intro__content > p:last-child {
    font-size: 0.83rem;
  }

  .auth-feature-row span:nth-child(n+3) {
    display: none;
  }

  .summary-item,
  .summary-card {
    min-height: 6.3rem;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.9rem;
  }

  .summary-item__icon,
  .summary-card__icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.7rem;
    font-size: 1rem;
  }

  .summary-item strong,
  .summary-card strong {
    font-size: 1.25rem;
  }

  .summary-item small,
  .summary-card small {
    font-size: 0.6rem;
  }

  .address-card__header {
    padding-inline: 0.9rem;
  }

  .address-card__pin {
    width: 2.4rem;
    height: 2.4rem;
  }

  .service-list {
    padding-inline: 0.65rem;
  }

  .meter-row__actions .button--tiny {
    flex: 1;
  }

  .address-card__footer {
    padding-inline: 0.9rem;
  }
}

/* Системное предпочтение: уменьшенное движение */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}