/* ============================================================
   ПРОМСТРОЙ — Корпоративный портал. Дизайн-система (концепт)
   Фирменные цвета: графит #2d2d2d + красный #e31e24
   ============================================================ */

:root {
  /* Бренд — графитовая шкала (сайдбар, тёмные блоки) */
  --navy-900: #1f1f1f;
  --navy-800: #2d2d2d;
  --navy-700: #3a3a3a;
  --navy-600: #4d4d4d;
  /* Акцент — фирменный красный */
  --walnut: #e31e24;
  --walnut-600: #c4151b;
  --walnut-100: #fde6e7;
  --gold: #f24a4f;

  /* Нейтральные */
  --bg: #f4f5f6;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --line: #e7e9ec;
  --line-2: #eef0f2;
  --text: #232323;
  --text-2: #5e636b;
  --text-3: #8b9099;

  /* Статусы */
  --green: #2f9e6b;
  --green-bg: #e4f5ec;
  --amber: #d9952a;
  --amber-bg: #fbf0d9;
  --red: #d6573f;
  --red-bg: #fbe7e2;
  --blue: #3273c4;
  --blue-bg: #e6eff9;
  --violet: #6d5bd0;
  --violet-bg: #ece9fa;

  --radius: 10px;
  --radius-sm: 8px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(20,36,63,.06), 0 1px 3px rgba(20,36,63,.04);
  --shadow: 0 4px 16px rgba(20,36,63,.08);
  --shadow-lg: 0 18px 50px rgba(20,36,63,.14);
  --sidebar-w: 256px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ================= Раскладка приложения ================= */
.app { display: flex; min-height: 100vh; }

/* --------- Сайдбар --------- */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy-900), var(--navy-800));
  color: #cdd6e6;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 22px 20px;
}
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(135deg, var(--walnut), var(--gold));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; font-size: 19px;
  box-shadow: 0 6px 16px rgba(227,30,36,.4);
}
.brand-name { font-weight: 800; color: #fff; letter-spacing: .14em; font-size: 16px; }
.brand-sub { font-size: 10.5px; color: #8493ad; letter-spacing: .18em; text-transform: uppercase; margin-top: 1px; }

.nav { padding: 6px 12px; overflow-y: auto; flex: 1; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: #6c7c98; padding: 16px 12px 7px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9.5px 12px; border-radius: 10px;
  color: #b7c2d6; font-weight: 500; font-size: 14px;
  margin-bottom: 2px; cursor: pointer; transition: .15s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: linear-gradient(135deg, var(--walnut), var(--walnut-600)); color: #fff; box-shadow: 0 6px 16px rgba(227,30,36,.35); }
.nav-item .ic { width: 19px; height: 19px; flex-shrink: 0; opacity: .9; }
.nav-item .badge { margin-left: auto; background: rgba(255,255,255,.16); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 20px; }

.sidebar-user {
  margin: 10px 12px; padding: 11px; border-radius: 12px;
  background: rgba(255,255,255,.05); display: flex; align-items: center; gap: 10px;
}
.sidebar-user .av { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; }
.sidebar-user .nm { font-size: 13px; color: #fff; font-weight: 600; }
.sidebar-user .rl { font-size: 11px; color: #8493ad; }

/* --------- Главная область --------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 64px; background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 18px;
  padding: 0 28px; position: sticky; top: 0; z-index: 20;
}
.page-title { font-size: 19px; font-weight: 700; }
.page-title .crumb { color: var(--text-3); font-weight: 500; font-size: 13px; display: block; margin-bottom: 1px; }

.search {
  margin-left: auto; display: flex; align-items: center; gap: 9px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 13px; width: 290px; color: var(--text-3);
}
.search input { border: none; background: none; outline: none; flex: 1; font-size: 13.5px; color: var(--text); font-family: inherit; }

.topbar-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); display: flex; align-items: center; justify-content: center;
  color: var(--text-2); position: relative; cursor: pointer;
}
.topbar-btn .dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; background: var(--red); border-radius: 50%; border: 2px solid #fff; }

.content { padding: 28px; max-width: 1320px; width: 100%; }

/* ================= Утилиты ================= */
.row { display: flex; gap: 22px; }
.col { flex: 1; min-width: 0; }
.grid { display: grid; gap: 20px; }
.muted { color: var(--text-2); }
.mb-0 { margin-bottom: 0; }

.section-head { display: flex; align-items: center; margin-bottom: 16px; gap: 12px; }
.section-head h2 { font-size: 17px; font-weight: 700; }
.section-head .link { margin-left: auto; color: var(--walnut-600); font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 5px; }

/* Карточки */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }

/* Кнопки */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 9px 16px; border-radius: 10px; font-weight: 600; font-size: 13.5px;
  border: 1px solid transparent; cursor: pointer; font-family: inherit; transition: .15s;
}
.btn-primary { background: linear-gradient(135deg, var(--walnut), var(--walnut-600)); color: #fff; box-shadow: 0 6px 16px rgba(227,30,36,.3); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-navy { background: var(--navy-800); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }

/* Чипы / бейджи */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 30px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2);
}
.chip.active { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 700;
}
.badge .d { width: 6px; height: 6px; border-radius: 50%; }
.b-green { background: var(--green-bg); color: var(--green); }
.b-amber { background: var(--amber-bg); color: var(--amber); }
.b-red { background: var(--red-bg); color: var(--red); }
.b-blue { background: var(--blue-bg); color: var(--blue); }
.b-violet { background: var(--violet-bg); color: var(--violet); }
.b-gray { background: #eef1f6; color: var(--text-2); }

/* Аватары */
.avatar {
  border-radius: 11px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; flex-shrink: 0; font-size: 15px;
}
.av-a { background: linear-gradient(135deg,#5b7cb5,#3a5a94); }
.av-b { background: linear-gradient(135deg,#cf9b56,#a9702f); }
.av-c { background: linear-gradient(135deg,#5aa782,#2f7a55); }
.av-d { background: linear-gradient(135deg,#a173c4,#6f4a9c); }
.av-e { background: linear-gradient(135deg,#c97f7f,#9c4a4a); }
.av-f { background: linear-gradient(135deg,#6f88a8,#465f80); }

/* Прогресс */
.progress { height: 8px; background: var(--line); border-radius: 20px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--walnut), var(--gold)); border-radius: 20px; }

/* KPI плитки */
.kpi { display: flex; align-items: center; gap: 14px; }
.kpi .ico { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi .v { font-size: 23px; font-weight: 800; line-height: 1.1; }
.kpi .l { font-size: 12.5px; color: var(--text-2); }

/* Таблица */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface-2); }

/* Изображение-плейсхолдер (градиент с сеткой) */
.ph { position: relative; overflow: hidden; background: linear-gradient(135deg,#26406b,#16243f); }
.ph.warm { background: linear-gradient(135deg,#b07b3e,#7c4f24); }
.ph.sky  { background: linear-gradient(135deg,#4a78b0,#2c4f7c); }
.ph.green{ background: linear-gradient(135deg,#3f7a5e,#27543f); }
.ph.slate{ background: linear-gradient(135deg,#5a6b86,#39465c); }
.ph::after { content:''; position:absolute; inset:0; background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px); background-size: 26px 26px; }
.ph .ph-ic { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.5); z-index: 1; }

.pill-tag { position: absolute; top: 12px; left: 12px; z-index: 2; }

/* Скроллбар (для скриншотов аккуратнее) */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #cfd6e2; border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   АДАПТИВНОСТЬ (планшет / мобильный)
   ============================================================ */
.burger { display: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); align-items: center; justify-content: center; color: var(--text); cursor: pointer; flex-shrink: 0; }
.nav-overlay { display: none; }

/* ----- Планшет ----- */
@media (max-width: 1024px) {
  .navgrid, .ecards, .pgrid, .kpis { grid-template-columns: repeat(2, 1fr) !important; }
  .grid-2, .news-layout, .faq-layout, .cal-layout, .map-layout, .obj-layout, .cab-layout, .admin-grid, .bk-layout {
    grid-template-columns: 1fr !important;
  }
  .faq-layout .topics { position: static; }
  .stat-card, .form-card, .topics { position: static !important; }
  .bk-layout { display: flex !important; flex-direction: column; }
}

/* ----- Мобильный ----- */
@media (max-width: 768px) {
  .burger { display: flex; }
  :root { --sidebar-w: 270px; }

  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; z-index: 60;
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.4);
  }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .nav-overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 55; }

  .topbar { padding: 0 14px; gap: 10px; height: 58px; }
  .search { display: none; }
  .page-title { font-size: 16px; }
  .page-title .crumb { font-size: 11px; }
  .content { padding: 16px 14px; }

  /* всё в одну колонку */
  .navgrid, .ecards, .pgrid, .kpis, .shop, .gallery, .thumbs,
  .grid-2, .news-layout, .faq-layout, .cal-layout, .map-layout, .obj-layout, .cab-layout, .admin-grid {
    grid-template-columns: 1fr !important;
  }
  .content .grid { grid-template-columns: 1fr !important; }

  /* Главная — герой */
  .hero { flex-direction: column !important; padding: 24px 20px !important; gap: 22px; }
  .hero h1 { font-size: 23px !important; }
  .hero-values { gap: 18px; flex-wrap: wrap; }

  /* Новости / объекты — горизонтальные карточки в столбик */
  .pinned, .pinned-big, .ncard { flex-direction: column !important; display: flex !important; }
  .pinned .ph, .pinned-big .ph, .ncard .ph { width: 100% !important; height: 170px !important; }

  /* Справочник / тулбары */
  .toolbar, .filters, .cal-head, .tabs { flex-wrap: wrap; }
  .bigsearch { min-width: 0; width: 100%; }

  /* FAQ */
  .acc-a { padding-left: 20px !important; }

  /* Карточка объекта */
  .slider .main-img { height: 230px !important; }
  .article h1, .obj-title { font-size: 22px !important; }
  .cover { height: 200px !important; }

  /* Календарь — компактнее */
  .day { min-height: 64px; padding: 5px; }
  .ev { font-size: 9.5px; padding: 2px 4px; }

  /* Бронирование — горизонтальный скролл сетки */
  .grid-card { overflow-x: auto; }
}

@media (max-width: 420px) {
  .hero-values { gap: 14px; }
  .navgrid, .ecards { grid-template-columns: 1fr !important; }
}
