/* Absolute City — дашборд. Две темы по утверждённому макету:
   director — золото / тёмно-зелёный / серый; realtor — жемчужный / серый / бирюзовый. */

:root, [data-theme="realtor"] {
  --bg: #F2F1EE;
  --surface: #FFFFFF;
  --surface-2: #F7F6F3;
  --line: #E4E2DD;
  --line-strong: #CFCDC7;
  --text: #23272A;
  --muted: #5F676B;
  --accent: #0B7A7A;
  --accent-hover: #075F5F;
  --on-accent: #FFFFFF;
  --accent-soft: #DCEFED;
  --accent-soft-text: #075F5F;
  --danger: #A23A24;
  --danger-line: #E5C4BC;
  --ok-bg: #DCEFED;
  --ok-text: #075F5F;
  --err-bg: #F8E3DD;
  --err-text: #8E2F1C;
  --brand-font: "Manrope", system-ui, sans-serif;
  --brand-weight: 800;
  --brand-color: #23272A;
  --side-bg: #FFFFFF;
}

[data-theme="director"] {
  --bg: #0E1915;
  --surface: #15241F;
  --surface-2: #1B2C26;
  --line: #26372F;
  --line-strong: #3A4C44;
  --text: #ECEFEA;
  --muted: #A3AEA8;
  --accent: #C9A45C;
  --accent-hover: #D8B670;
  --on-accent: #14110A;
  --accent-soft: #2A2A1C;
  --accent-soft-text: #E3C88A;
  --danger: #F0A08E;
  --danger-line: #5A3A33;
  --ok-bg: #1E3027;
  --ok-text: #E3C88A;
  --err-bg: #3A2320;
  --err-text: #F5B7A8;
  --brand-font: "Cormorant Garamond", Georgia, serif;
  --brand-weight: 700;
  --brand-color: #E3C88A;
  --side-bg: #0B1511;
}

[data-theme="login"] {
  --bg: #141920;
  --surface: #1C232C;
  --line: #333B45;
  --text: #EDE8DC;
  --muted: #A9B0B8;
  --accent: #63B3AE;
  --accent-hover: #7FC4BF;
  --on-accent: #0E1A1A;
  --err-bg: #3A2320;
  --err-text: #F5B7A8;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 500 15px/1.45 "Manrope", system-ui, sans-serif;
}
a { color: var(--accent); }
h1, h2 { margin: 0; }
.strong { font-weight: 700; }
.big { font-size: 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font: 700 15px "Manrope", sans-serif; text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 800; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; }
.btn-lg { min-height: 54px; font-size: 16px; width: 100%; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 13px; font-weight: 700; color: var(--muted); }
.field input, .field select, .field textarea {
  min-height: 50px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface-2, var(--surface)); color: var(--text);
  padding: 0 14px; font: 500 16px "Manrope", sans-serif; width: 100%;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.alert { padding: 12px 14px; border-radius: 12px; font-weight: 600; font-size: 14px; }
.alert-error { background: var(--err-bg); color: var(--err-text); }
.alert-ok { background: var(--ok-bg); color: var(--ok-text); }

/* ---------- вход ---------- */
.login {
  min-height: 100vh; max-width: 420px; margin: 0 auto;
  padding: 72px 24px 32px; display: flex; flex-direction: column; gap: 44px;
}
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.login-key { color: var(--accent); }
.login-title { font: 600 38px/1 "Cormorant Garamond", Georgia, serif; letter-spacing: 0.06em; }
.login-sub { color: var(--muted); font-size: 14px; }
.login-form { display: flex; flex-direction: column; gap: 18px; }
.login-form .field input { background: var(--surface); }
.login-foot { margin-top: auto; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- каркас ---------- */
.shell { display: flex; min-height: 100vh; }
.side { display: none; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 16px; background: var(--side-bg); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand-sm {
  font-family: var(--brand-font); font-weight: var(--brand-weight); color: var(--brand-color);
  font-size: 15px; letter-spacing: 0.08em; text-decoration: none; white-space: nowrap;
}
[data-theme="director"] .brand-sm { font-size: 19px; letter-spacing: 0.05em; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-soft-text);
  font-weight: 800; font-size: 16px; text-decoration: none;
}
[data-theme="director"] .avatar { background: var(--surface); border: 1px solid var(--accent); }
.avatar-lg { width: 60px; height: 60px; font-size: 22px; }

.tabs { display: flex; gap: 8px; padding: 14px 16px 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; min-height: 40px; padding: 0 16px; border-radius: 20px;
  display: inline-flex; align-items: center; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line-strong); color: var(--text);
  font-weight: 600; font-size: 14px;
}
.tab.is-active { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 700; }
[data-theme="director"] .tab.is-active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.content { padding: 16px; display: flex; flex-direction: column; gap: 16px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 800; }
[data-theme="director"] .page-head h1 { font-family: "Cormorant Garamond", Georgia, serif; font-size: 34px; color: var(--brand-color); }

.panel, .empty, .card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
}
.panel { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.panel h2 { font-size: 17px; font-weight: 800; }
.empty { padding: 32px 20px; text-align: center; }
.empty p { margin: 6px 0 0; }
.stack { display: flex; flex-direction: column; gap: 14px; max-width: 560px; }
.profile-head { display: flex; align-items: center; gap: 14px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card { overflow: hidden; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.price { font-size: 22px; font-weight: 800; }
[data-theme="director"] .price { color: var(--brand-color); }

/* ---------- компьютер: боковое меню ---------- */
@media (min-width: 960px) {
  .side {
    display: flex; flex-direction: column; gap: 20px; width: 288px; flex: none;
    padding: 24px 16px; background: var(--side-bg); border-right: 1px solid var(--line);
    position: sticky; top: 0; height: 100vh;
  }
  .topbar, .tabs { display: none; }
  .content { padding: 28px 32px; gap: 20px; }
  .brand {
    font-family: var(--brand-font); font-weight: var(--brand-weight); color: var(--brand-color);
    font-size: 22px; letter-spacing: 0.06em; padding: 0 6px; white-space: nowrap;
  }
  [data-theme="director"] .brand { font-size: 26px; }
  .btn-add { min-height: 48px; white-space: nowrap; }
  .side-nav { display: flex; flex-direction: column; gap: 4px; }
  .side-link {
    display: flex; justify-content: space-between; align-items: center; min-height: 44px;
    padding: 0 14px; border-radius: 12px; color: var(--text); font-weight: 600; text-decoration: none;
    border: 1px solid transparent;
  }
  .side-link:hover { background: var(--surface-2); }
  .side-link.is-active { background: var(--surface-2); border-color: var(--line-strong); color: var(--accent); }
  [data-theme="realtor"] .side-link.is-active { background: var(--accent-soft); border-color: transparent; color: var(--accent-soft-text); }
  .side-link .cnt { font-size: 13px; color: var(--muted); }
  .side-sep { height: 1px; background: var(--line); margin: 8px 0; }
  .side-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 0 6px; }
}

/* ---------- этап 3: форма, объявление, карточки ---------- */
.back {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
}
.page-head:has(.back) { justify-content: flex-start; align-items: center; }
.center { text-align: center; }

.lform { display: flex; flex-direction: column; gap: 12px; max-width: 720px; }
.lab { font-size: 14px; font-weight: 800; color: var(--text); display: flex; gap: 8px; align-items: center; }
.lab-sub { font-size: 13px; font-weight: 700; color: var(--muted); min-height: 22px; display: flex; align-items: center; }
.num {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: var(--accent-soft); color: var(--accent-soft-text);
  font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center;
}
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field textarea { padding: 12px 14px; line-height: 1.5; min-height: 150px; resize: vertical; }
.field-err { color: var(--err-text); font-size: 13px; font-weight: 700; }
.field-err:empty { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span {
  display: inline-flex; align-items: center; justify-content: center; min-width: 46px; min-height: 44px;
  padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface);
  font-weight: 700; font-size: 15px; color: var(--text); cursor: pointer; user-select: none;
}
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.check { display: flex; align-items: center; gap: 12px; min-height: 44px; font-weight: 600; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.check .small { margin-left: auto; }

.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 600px) { .photo-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.ph { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph:first-child::after {
  content: "главное"; position: absolute; left: 6px; bottom: 6px; padding: 2px 8px; border-radius: 8px;
  background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 700;
}
.ph-add:first-child::after { content: none; }
.ph-x {
  position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.62); color: #fff; font-size: 20px; line-height: 1; cursor: pointer;
}
.ph.is-removed img { opacity: .25; }
.ph-add {
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  border: 2px dashed var(--accent); color: var(--accent); background: transparent;
}
.ph-add input, .video-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.video-pick {
  position: relative; display: flex; align-items: center; justify-content: center; min-height: 56px; padding: 0 12px;
  border-radius: 12px; border: 2px dashed var(--accent); color: var(--accent); font-weight: 700; cursor: pointer; text-align: center;
}

.submit-box { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 24px; }
.btn:disabled { opacity: .6; cursor: wait; }
.progress { position: relative; height: 40px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.progress-bar { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent-soft); transition: width .2s; }
.progress span { position: relative; display: flex; height: 100%; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }

.detail { display: flex; flex-direction: column; gap: 10px; max-width: 900px; }
.gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: 16px; }
.gallery-item { flex: 0 0 100%; scroll-snap-align: start; aspect-ratio: 4 / 3; background: var(--surface-2); border-radius: 16px; overflow: hidden; }
@media (min-width: 960px) { .gallery-item { flex-basis: 70%; } }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-main { display: flex; flex-direction: column; gap: 12px; }
.big-price { font-size: 28px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.title-line { font-size: 18px; }
.params { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 4px 16px; }
.params div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.params div:last-child { border-bottom: 0; }
.params dt { color: var(--muted); }
.params dd { margin: 0; font-weight: 700; text-align: right; }
.desc { white-space: pre-line; line-height: 1.6; }
.video { width: 100%; max-height: 70vh; border-radius: 12px; background: #000; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { padding: 6px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-soft-text); font-weight: 700; font-size: 13px; }
.badge-reduced { background: #B4462F; color: #fff; }
[data-theme="director"] .badge-reduced { background: var(--accent); color: var(--on-accent); }
.actions { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.readonly-note { font-size: 13px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }

.card { display: flex; flex-direction: column; }
.card-photo {
  position: relative; display: flex; align-items: center; justify-content: center;
  aspect-ratio: 16 / 10; background: var(--surface-2); text-decoration: none;
}
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge-on-photo { position: absolute; top: 10px; padding: 4px 10px; border-radius: 8px; font-weight: 800; font-size: 12px; }
.badge-on-photo.badge-reduced { left: 10px; }
.badge-mine { right: 10px; background: var(--accent-soft); color: var(--accent-soft-text); }
.badge-count { left: auto; right: 10px; top: auto; bottom: 10px; background: rgba(0,0,0,.6); color: #fff; }
.card-title { color: var(--text); text-decoration: none; }
.facts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.card-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }

/* кнопка выхода */
.btn-logout { border-color: var(--danger-line); color: var(--danger); background: transparent; width: 100%; min-height: 48px; }
.btn-logout:hover { background: var(--surface-2); }
.btn-block { width: 100%; }

/* ---------- этап 4: действия, окно подтверждения, фильтры ---------- */
.act-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.act-grid .btn { min-height: 44px; font-size: 14px; padding: 0 10px; }
.act-grid-big .btn { min-height: 52px; font-size: 15px; }
.btn-danger { color: var(--danger); border-color: var(--danger-line); background: transparent; }
.btn-danger-solid { background: #A23A24; border-color: #A23A24; color: #fff; }
[data-theme="director"] .btn-danger-solid { background: #C2553E; border-color: #C2553E; }
.old-price { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 6px; }

.sheet {
  border: 0; padding: 0; width: 100%; max-width: 520px; margin: auto auto 0; border-radius: 24px 24px 0 0;
  background: var(--surface); color: var(--text); border-top: 1px solid var(--accent);
}
@media (min-width: 640px) { .sheet { margin: auto; border-radius: 24px; border: 1px solid var(--line-strong); } }
.sheet::backdrop { background: rgba(4, 9, 7, .62); }
.sheet-body { padding: 12px 20px 28px; display: flex; flex-direction: column; gap: 14px; }
.sheet-handle { width: 44px; height: 5px; border-radius: 3px; background: var(--line-strong); align-self: center; }
.sheet-title { font-size: 22px; font-weight: 800; }
[data-theme="director"] .sheet-title { font-family: "Cormorant Garamond", Georgia, serif; font-size: 30px; color: var(--brand-color); }
.sheet-summary { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-weight: 700; }
.sheet p { margin: 0; line-height: 1.5; }

.filters { padding: 0; gap: 0; }
.filters summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 0 16px; font-weight: 800;
}
.filters summary::-webkit-details-marker { display: none; }
.sort-label { margin-left: auto; font-weight: 600; }
.filter-form { display: flex; flex-direction: column; gap: 14px; padding: 4px 16px 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.range { display: flex; flex-direction: column; gap: 8px; }
.range input {
  min-height: 46px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface-2);
  color: var(--text); padding: 0 12px; font: 500 15px "Manrope", sans-serif; width: 100%;
}
.filters .field select { min-height: 46px; }

/* атрибут hidden должен скрывать элемент при любых стилях */
[hidden] { display: none !important; }

/* ---------- этап 5: сотрудники, мобильная доработка ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.add-staff { padding: 0; gap: 0; }
.add-staff-sum { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 16px; font-weight: 800; color: var(--accent); }
.add-staff-sum::-webkit-details-marker { display: none; }
.stack-form { display: flex; flex-direction: column; gap: 14px; padding: 14px 16px 16px; border-top: 1px solid var(--line); }
.staff-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.staff-card.is-off { opacity: .7; }
.staff-head { display: flex; align-items: center; gap: 12px; }
.staff-who { flex: 1; min-width: 0; }
.badge-off { background: var(--err-bg); color: var(--err-text); }
.inline-form { display: flex; gap: 8px; }
.inline-form input {
  flex: 1; min-width: 0; min-height: 46px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text); padding: 0 12px; font: 500 15px "Manrope", sans-serif;
}
.sub-details { display: flex; flex-direction: column; gap: 8px; }
.sub-details summary { cursor: pointer; font-weight: 700; color: var(--accent); min-height: 40px; display: flex; align-items: center; }
.sub-details[open] { gap: 10px; }

/* телефон: отступы под «чёлку» и нижнюю панель, крупнее поля */
.topbar { padding-top: max(12px, env(safe-area-inset-top)); }
.content { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
@media (max-width: 420px) {
  .grid2 { gap: 10px; }
  .page-head h1 { font-size: 22px; }
  [data-theme="director"] .page-head h1 { font-size: 30px; }
}

/* кнопка «Разместил» и пометка «не назначен» */
.realtor-btn {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px;
  border-radius: 10px; border: 1px dashed var(--line-strong); background: transparent; color: var(--text);
  font: 600 13px "Manrope", sans-serif; cursor: pointer;
}
.realtor-btn:hover { border-color: var(--accent); }
.realtor-btn.is-unassigned, .unassigned-text { color: var(--err-text); border-color: var(--danger-line); font-weight: 700; }
