/* NYC Guides — mobile-first */
:root {
  --bg: #ffffff;
  --surface: #f5f6f8;
  --surface-2: #eceef2;
  --line: #e2e5ea;
  --text: #14181f;
  --muted: #6b7280;
  --accent: #d9452f;
  --accent-dark: #b5361f;
  --accent-soft: #fdeceb;
  --navy: #10263f;
  --green: #1a7f52;
  --green-soft: #e6f4ed;
  --amber: #9a6300;
  --amber-soft: #fdf1dc;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 38, 63, .06), 0 8px 24px rgba(16, 38, 63, .06);
  --tap: 44px;

  /* Сервис всегда светлый — нативные контролы тоже */
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 1em; }

.container { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.container--wide { max-width: 1040px; }

/* --- Хедер --- */
.header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header__inner { display: flex; align-items: center; gap: 12px; height: 56px; }
.logo { font-weight: 700; font-size: 1.05rem; color: var(--text); letter-spacing: -.02em; }
.logo:hover { text-decoration: none; }
.logo span { color: var(--accent); }
.header__spacer { flex: 1; }
.header__link { color: var(--muted); font-size: .9rem; font-weight: 500; }

.nav { display: flex; gap: 4px; overflow-x: auto; padding: 8px 0; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 999px;
  font-size: .9rem; font-weight: 500; color: var(--muted); background: var(--surface);
}
.nav a:hover { text-decoration: none; }
.nav a.is-active { background: var(--navy); color: var(--bg); }

main { padding: 20px 0 48px; }
.page-head { margin-bottom: 16px; }
.page-head p { color: var(--muted); margin: 0; }

/* --- Карточки --- */
.card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin-bottom: 14px;
}
.card__body { padding: 14px 16px; }
.card__media { aspect-ratio: 16 / 10; background: var(--surface-2); overflow: hidden; }
.card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__title { font-size: 1.05rem; font-weight: 650; margin: 0 0 4px; color: var(--text); }
.card__meta { color: var(--muted); font-size: .88rem; display: flex; flex-wrap: wrap; gap: 4px 12px; }

.tile { display: block; color: inherit; }
.tile:hover { text-decoration: none; }

.grid { display: grid; gap: 14px; }
@media (min-width: 700px) { .grid--2 { grid-template-columns: 1fr 1fr; } }

/* --- Календарь --- */
.day { margin-bottom: 26px; }
.day__head {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px;
  position: sticky; top: 56px; background: var(--bg); padding: 6px 0; z-index: 10;
}
.day__date { font-weight: 700; font-size: 1.05rem; }
.day__weekday { color: var(--muted); font-size: .9rem; }

.event {
  display: flex; gap: 12px; padding: 12px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--bg); margin-bottom: 10px; color: inherit;
  box-shadow: var(--shadow);
}
.event:hover { text-decoration: none; border-color: var(--accent); }
.event__time {
  flex: 0 0 54px; font-weight: 700; font-size: 1rem; color: var(--accent);
  display: flex; flex-direction: column; align-items: flex-start;
}
.event__thumb { flex: 0 0 64px; height: 64px; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.event__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.event__body { flex: 1; min-width: 0; }
.event__title { font-weight: 600; margin-bottom: 2px; }
.event__meta { font-size: .85rem; color: var(--muted); }

/* --- Бейджи --- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .78rem; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.badge--ok { background: var(--green-soft); color: var(--green); }
.badge--warn { background: var(--amber-soft); color: var(--amber); }
.badge--danger { background: var(--accent-soft); color: var(--accent-dark); }

/* --- Кнопки --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 11px 18px; border-radius: var(--radius-sm);
  font-size: 1rem; font-weight: 600; font-family: inherit;
  border: 1px solid transparent; cursor: pointer; text-align: center;
  background: var(--accent); color: #fff;
}
.btn:hover { text-decoration: none; background: var(--accent-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--block { display: flex; width: 100%; }
.btn--ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--sm { min-height: 36px; padding: 7px 13px; font-size: .88rem; }
.btn--danger { background: transparent; color: var(--accent); border-color: var(--line); }
.btn--danger:hover { background: var(--accent-soft); color: var(--accent-dark); }
.btn--ok { background: var(--green); }
.btn--ok:hover { background: var(--green); filter: brightness(.92); }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Формы --- */
.field { margin-bottom: 14px; }
.field label, .label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 5px; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 5px; }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=url], textarea, select {
  width: 100%; min-height: var(--tap); padding: 11px 13px; font-size: 16px; font-family: inherit;
  color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius-sm); outline: none;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field--row { display: flex; gap: 10px; }
.field--row > * { flex: 1; }

.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.code-input { letter-spacing: .5em; font-size: 1.5rem !important; text-align: center; font-weight: 700; }

/* --- Флеш-сообщения --- */
.flash { padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 12px; font-size: .92rem; font-weight: 500; }
.flash--success { background: var(--green-soft); color: var(--green); }
.flash--error { background: var(--accent-soft); color: var(--accent-dark); }

/* --- Статистика --- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border-radius: var(--radius); padding: 13px 14px; }
.stat__value { font-size: 1.4rem; font-weight: 700; letter-spacing: -.02em; }
.stat__label { font-size: .8rem; color: var(--muted); }
.stat--accent { background: var(--accent); color: #fff; }
.stat--accent .stat__label { color: rgba(255,255,255,.8); }

/* --- Списки/таблицы --- */
.list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.list__item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.list__item:last-child { border-bottom: none; }
.list__item--link { color: inherit; }
.list__item--link:hover { text-decoration: none; background: var(--surface); }
.list__main { flex: 1; min-width: 0; }
.list__title { font-weight: 600; }
.list__sub { font-size: .85rem; color: var(--muted); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- Аватары --- */
.avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--surface-2); flex: 0 0 auto; }
.avatar--lg { width: 84px; height: 84px; }
.avatar--placeholder { display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); }

/* --- Галерея --- */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gallery__item { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.gallery__item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery__item.is-cover { outline: 3px solid var(--accent); outline-offset: -3px; }
.gallery__tag {
  position: absolute; top: 5px; left: 5px; background: var(--accent); color: #fff;
  font-size: .68rem; font-weight: 700; padding: 2px 7px; border-radius: 999px;
}
.gallery__actions { position: absolute; bottom: 0; left: 0; right: 0; display: flex; gap: 1px; }
.gallery__actions button {
  flex: 1; border: 0; background: rgba(16, 38, 63, .82); color: #fff; font-size: .72rem;
  padding: 7px 2px; cursor: pointer; font-family: inherit; font-weight: 600;
}
.gallery__actions button:hover { background: var(--accent); }

/* Публичная галерея-карусель */
.carousel { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px 4px; }
.carousel::-webkit-scrollbar { display: none; }
.carousel img {
  flex: 0 0 86%; scroll-snap-align: center; aspect-ratio: 4/3; object-fit: cover;
  border-radius: var(--radius); background: var(--surface-2);
}
@media (min-width: 700px) { .carousel img { flex-basis: 55%; } }

/* --- Нижняя навигация кабинета --- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; display: flex;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px; font-size: .68rem; font-weight: 600; color: var(--muted); min-height: var(--tap);
}
.tabbar a:hover { text-decoration: none; }
.tabbar a.is-active { color: var(--accent); }
.tabbar__icon { font-size: 1.15rem; line-height: 1; }
.tabbar__dot {
  position: absolute; transform: translate(12px, -4px);
  background: var(--accent); color: #fff; border-radius: 999px;
  font-size: .6rem; padding: 1px 5px; font-weight: 700;
}
.has-tabbar main { padding-bottom: 90px; }

/* --- Мелочи --- */
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.strong { font-weight: 650; }
.price { font-weight: 700; font-size: 1.05rem; }
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty__icon { font-size: 2.2rem; margin-bottom: 8px; }
.divider { height: 1px; background: var(--line); margin: 20px 0; border: 0; }
.section { margin-bottom: 26px; }
.section__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section__head h2 { margin: 0; }
.stack > * + * { margin-top: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row--between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.sticky-cta {
  position: sticky; bottom: 0; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); margin-top: 20px;
}
.desc { white-space: pre-line; }
.footer { border-top: 1px solid var(--line); padding: 20px 0 34px; color: var(--muted); font-size: .85rem; }
.auth-wrap { max-width: 400px; margin: 8vh auto; padding: 0 18px; }
.auth-card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 20px; }
.debug-code {
  margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--amber-soft); color: var(--amber); font-size: .85rem; font-weight: 600;
}

/* На узких экранах кнопки в строке списка уезжают на отдельную строку */
@media (max-width: 560px) {
  .list__item { flex-wrap: wrap; }
  .list__item > .btn-row,
  .list__item > .btn { flex: 1 1 100%; }
  .list__item > .btn-row .btn { flex: 1; }
}

/* Плейсхолдер вместо фото занимает весь слот */
.card__media > .avatar--placeholder,
.event__thumb > .avatar--placeholder {
  width: 100%; height: 100%; font-size: 1.6rem; background: var(--surface-2);
}
.card__media > .avatar--placeholder { font-size: 2.4rem; }

/* Журналы: на узких экранах строка таблицы становится карточкой */
@media (max-width: 760px) {
  .table--stack thead { display: none; }
  .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
  .table--stack tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table--stack tr:last-child { border-bottom: none; }
  .table--stack td { border: none; padding: 2px 0; white-space: normal; }
  .table--stack td.num { text-align: left; }
  .table--stack td:empty { display: none; }
  .table--stack td[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--muted); font-size: .8rem;
  }
  .table--stack td[data-label="_"]::before { content: none; }
  .table-wrap:has(.table--stack) { border-radius: var(--radius); }
}
@media (max-width: 760px) { .table--stack td.col-arrow { display: none; } }

/* --- Плитки гидов: только фото и имя --- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 620px) { .tiles { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
@media (min-width: 900px) { .tiles { grid-template-columns: repeat(4, 1fr); } }

.tile-card {
  display: flex; flex-direction: column; color: inherit;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: border-color .15s ease;
}
.tile-card:hover { text-decoration: none; border-color: var(--accent); }
.tile-card__photo { aspect-ratio: 1; background: var(--surface-2); }
.tile-card__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-card__photo .avatar--placeholder { width: 100%; height: 100%; font-size: 2rem; }
.tile-card__name {
  padding: 10px 12px 12px; font-weight: 650; font-size: .98rem; line-height: 1.25;
  text-align: center;
}

/* Ровные плитки: имя и описание не растягивают карточку сверх двух строк */
