:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #fbfcfe;
  --text: #151922;
  --muted: #737b8c;
  --border: #e6e9ef;
  --line: #edf0f5;
  --brand: #1d4ed8;
  --brand-soft: #eef4ff;
  --brand-dark: #12317a;
  --success: #0f766e;
  --danger: #b91c1c;
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --shadow: 0 18px 45px rgba(16, 24, 40, .07);
  --shadow-soft: 0 10px 25px rgba(16, 24, 40, .05);
  --sidebar-w: 280px;
  --header-h: 76px;
}

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

body {
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(29, 78, 216, .08), transparent 32%),
    linear-gradient(180deg, #fbfcff 0%, var(--bg) 260px);
  color: var(--text);
  font-size: 14px;
}

button, input, a, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}

/* SIDEBAR */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, .76);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 22px;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 14px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 42px; height: 42px;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 12px 24px rgba(29, 78, 216, .22);
  font-size: 20px; font-weight: 800;
}

.brand-title { font-size: 16px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.brand-subtitle { margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 500; }

.nav-block { display: flex; flex-direction: column; gap: 6px; }
.nav-label { color: #a0a7b5; text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 800; padding: 0 10px 5px; }

.nav-item {
  width: 100%; border: 0; cursor: pointer; background: transparent;
  color: var(--muted);
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; border-radius: 15px;
  transition: .18s ease; text-align: left;
  text-decoration: none;
}
.nav-item:hover { background: var(--panel); color: var(--text); box-shadow: var(--shadow-soft); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 800; }

.nav-icon {
  width: 28px; height: 28px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: #f2f4f8;
  flex: 0 0 auto; font-size: 14px;
}
.nav-item.active .nav-icon { background: #dbe8ff; }
.nav-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-count {
  min-width: 28px; height: 24px;
  border-radius: 999px;
  display: inline-grid; place-items: center;
  background: #f1f3f7; color: #7b8494;
  font-size: 12px; font-weight: 800; padding: 0 8px;
}
.nav-item.active .nav-count { background: var(--brand); color: #fff; }

/* MAIN */
.main { min-width: 0; padding: 22px 28px 42px; }

.topbar {
  height: var(--header-h);
  display: flex; align-items: center;
  gap: 16px; margin-bottom: 20px;
}

.mobile-menu {
  display: none;
  border: 1px solid var(--border); background: var(--panel);
  width: 44px; height: 44px;
  border-radius: 14px; cursor: pointer;
  box-shadow: var(--shadow-soft); font-size: 18px;
}

.search {
  flex: 1; max-width: 680px; height: 50px;
  background: rgba(255, 255, 255, .82);
  border: 1px solid var(--border); border-radius: 18px;
  display: flex; align-items: center;
  gap: 10px; padding: 0 16px;
  box-shadow: var(--shadow-soft);
}
.search svg { color: #98a2b3; flex: 0 0 auto; }
.search input {
  border: 0; outline: 0; background: transparent;
  width: 100%; color: var(--text); font-weight: 600;
}
.search input::placeholder { color: #a0a7b5; font-weight: 500; }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.ghost-btn, .primary-btn {
  height: 44px; padding: 0 16px;
  border-radius: 15px; font-weight: 800;
  cursor: pointer; transition: .18s ease;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; white-space: nowrap; border: 0;
}
.ghost-btn { border: 1px solid var(--border); background: rgba(255, 255, 255, .82); color: var(--text); }
.primary-btn { border: 1px solid var(--brand); background: var(--brand); color: #fff; box-shadow: 0 12px 28px rgba(29, 78, 216, .22); }
.ghost-btn:hover, .primary-btn:hover { transform: translateY(-1px); }
.danger-btn { border: 1px solid var(--danger); background: var(--danger); color: #fff; }

/* HERO */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, .6fr);
  gap: 18px; margin-bottom: 22px;
}

.hero-card {
  position: relative; overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(255, 255, 255, .78)),
    radial-gradient(circle at 80% 10%, rgba(29, 78, 216, .16), transparent 30%);
  padding: 28px; box-shadow: var(--shadow);
}

.hero-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
  font-size: 12px; font-weight: 800; margin-bottom: 16px;
}

.hero h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1; letter-spacing: -.05em;
  max-width: 780px; margin-bottom: 14px;
}
.hero p { max-width: 720px; color: var(--muted); font-size: 15px; line-height: 1.65; font-weight: 500; }

.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 22px; }
.stat { padding: 16px; border-radius: 18px; background: var(--panel-soft); border: 1px solid var(--line); }
.stat b { display: block; font-size: 24px; letter-spacing: -.04em; margin-bottom: 4px; }
.stat span { color: var(--muted); font-size: 12px; font-weight: 700; }

.upload-card {
  border: 1px dashed #b8c5da;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, .72);
  padding: 22px; box-shadow: var(--shadow-soft);
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 260px;
}
.upload-icon {
  width: 54px; height: 54px; border-radius: 18px;
  background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center;
  font-size: 24px; margin-bottom: 14px;
}
.upload-card h3 { font-size: 18px; letter-spacing: -.03em; margin-bottom: 8px; }
.upload-card p { color: var(--muted); line-height: 1.55; font-size: 13px; font-weight: 500; }

/* SECTION HEAD */
.section-head {
  display: flex; align-items: end; justify-content: space-between;
  gap: 16px; margin: 28px 0 14px;
}
.section-title h2 { font-size: 22px; letter-spacing: -.04em; margin-bottom: 5px; }
.section-title p { color: var(--muted); font-size: 13px; font-weight: 500; }

/* CARDS GRID */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }

.asset-card {
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-soft);
  transition: .18s ease;
}
.asset-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #cbd5e1; }

.asset-preview {
  position: relative; height: 178px;
  background:
    linear-gradient(45deg, #f4f6fa 25%, transparent 25%),
    linear-gradient(-45deg, #f4f6fa 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f4f6fa 75%),
    linear-gradient(-45deg, transparent 75%, #f4f6fa 75%);
  background-color: #fbfcfe;
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0px;
  display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.asset-preview img { max-width: 92%; max-height: 92%; object-fit: contain; }

.badge {
  position: absolute; top: 12px; left: 12px;
  height: 28px; display: inline-flex; align-items: center;
  padding: 0 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .88);
  color: var(--brand);
  border: 1px solid rgba(29, 78, 216, .14);
  font-size: 11px; font-weight: 900;
  backdrop-filter: blur(10px);
}

.asset-body { padding: 15px; }
.asset-title-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.asset-title { flex: 1; font-size: 14px; font-weight: 700; letter-spacing: -.02em; line-height: 1.35; }
.asset-format {
  flex: 0 0 auto;
  padding: 4px 8px; border-radius: 8px;
  background: #f1f3f7; color: #5a6273;
  font-size: 10px; font-weight: 900; letter-spacing: .04em;
}
.asset-meta {
  display: flex; flex-wrap: wrap; gap: 6px;
  color: var(--muted); font-size: 12px; font-weight: 500;
  margin-bottom: 12px;
}

.asset-actions { display: flex; gap: 8px; }
.small-btn {
  flex: 1; height: 36px;
  border: 1px solid var(--border); background: var(--panel);
  color: var(--text); border-radius: 11px;
  font-size: 12px; font-weight: 800;
  cursor: pointer; transition: .18s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none;
}
.small-btn:not(.main) { flex: 0 0 auto; width: 40px; padding: 0; }
.small-btn.main { background: var(--text); color: #fff; border-color: var(--text); }
.small-btn:hover { transform: translateY(-1px); }

/* PRODUCTS (категории фото товаров) */
.products { display: flex; flex-direction: column; gap: 12px; }
.product-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  text-decoration: none; color: inherit;
  transition: .18s ease;
}
.product-row:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.product-photos { display: flex; gap: 6px; }
.product-photo {
  width: 52px; height: 52px;
  border-radius: 12px;
  background: linear-gradient(145deg, #ffffff, #eef4ff);
  border: 1px solid #d9e5ff;
  display: grid; place-items: center;
  font-size: 22px; overflow: hidden;
}
.product-photo img { width: 100%; height: 100%; object-fit: cover; }
.product-info b { display: block; font-size: 15px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 3px; }
.product-info span { color: var(--muted); font-size: 12px; font-weight: 600; }

/* EMPTY */
.empty {
  padding: 60px 20px; text-align: center;
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}
.empty-icon { font-size: 36px; margin-bottom: 10px; }
.empty b { display: block; font-size: 15px; margin-bottom: 4px; }
.empty span { color: var(--muted); font-size: 13px; }

/* MODAL для просмотра в полный размер */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .75);
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal.open { display: flex; }
.modal img { max-width: 100%; max-height: 90vh; border-radius: var(--radius-md); }
.modal-close {
  position: absolute; top: 20px; right: 20px;
  width: 44px; height: 44px;
  border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .9);
  font-size: 18px; cursor: pointer;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0;
    height: 100vh; width: 280px;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: grid; place-items: center; }
  .hero { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .main { padding: 16px; }
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .section-head { flex-direction: column; align-items: stretch; }
}

/* Кнопки одинаковой высоты */
.asset-actions {
  align-items: stretch;
}
.asset-actions .small-btn {
  height: auto;
  min-height: 36px;
  padding: 8px 12px;
  white-space: normal;
  text-align: center;
  line-height: 1.3;
}

/* Превью целиком (contain) */
.asset-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  max-width: none;
  max-height: none;
  padding: 8px;
}
