:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface2: #f8f8f8;
  --surface3: #f1f1f1;
  --border: #e8e8e8;
  --border2: #d4d4d4;
  --text: #111111;
  --text-muted: #888888;
  --text-dim: #555555;
  --primary: #111111;
  --accent: #ea4c89;
  --accent-hover: #c73872;
  --success: #22c55e;
  --error: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
code { background: var(--surface2); padding: 2px 8px; border-radius: 4px; font-size: 13px; font-family: monospace; color: var(--accent); }

.container { max-width: 1280px; margin: 0 auto; padding: 0 32px; }

/* NAVBAR */
.navbar { position: fixed; top: 0; left: 0; right: 0; z-index: 100; background: rgba(255,255,255,0.97); backdrop-filter: blur(20px); border-bottom: 1px solid var(--border); height: 96px; }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 96px; }
.logo { display: flex; align-items: center; gap: 14px; color: var(--text); font-weight: 700; font-size: 22px; letter-spacing: -.03em; }
.logo img { height: 64px; width: auto; }
.logo-text { color: var(--text); }
.nav-links { display: flex; gap: 2px; align-items: center; }
.nav-links a { padding: 10px 18px; border-radius: 8px; color: var(--text-dim); font-size: 15px; font-weight: 500; transition: all .15s; }
.nav-links a:hover { color: var(--text); background: var(--surface2); }
.nav-links a.active { color: var(--text); background: var(--surface2); font-weight: 600; }
.btn-logout { color: var(--error) !important; }

.has-nav { padding-top: 120px; }
.page-content { padding: 40px 0 100px; }
.page-title { font-size: 28px; font-weight: 700; margin-bottom: 6px; letter-spacing: -.03em; color: var(--text); }
.page-subtitle { color: var(--text-muted); margin-bottom: 32px; font-size: 15px; }
.centered { text-align: center; padding-top: 80px; }

/* AUTH */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #f5f5f5; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 48px 44px; width: 100%; max-width: 420px; box-shadow: 0 4px 40px rgba(0,0,0,.08); }
.auth-logo { text-align: center; margin-bottom: 20px; }
.auth-logo img { height: 48px; width: auto; }
.auth-title { text-align: center; font-size: 22px; font-weight: 700; margin-bottom: 4px; letter-spacing: -.03em; }
.auth-subtitle { text-align: center; color: var(--text-muted); margin-bottom: 32px; font-size: 14px; }
.auth-hint { text-align: center; color: var(--text-muted); font-size: 13px; margin-top: 24px; line-height: 1.6; }

/* FORM */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 7px; letter-spacing: -.01em; }
input, select, textarea {
  width: 100%; background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); padding: 11px 14px;
  font-size: 15px; outline: none; transition: border .15s; font-family: inherit;
}
input:focus, select:focus { border-color: var(--text); }
input::placeholder { color: var(--text-muted); }
select option { background: var(--surface); }

/* BUTTONS */
.btn { display: inline-block; padding: 11px 24px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; border: none; cursor: pointer; transition: all .15s; letter-spacing: -.01em; }
.btn-primary { background: var(--text); color: #fff; }
.btn-primary:hover { background: #333; transform: translateY(-1px); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { border-color: var(--text); }
.btn-full { width: 100%; text-align: center; display: block; }

/* ALERTS */
.alert { padding: 13px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 20px; font-weight: 500; }
.alert-error { background: #fff0f0; border: 1px solid #fecaca; color: #dc2626; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #16a34a; }
.alert-info { background: #f0f4ff; border: 1px solid #c7d2fe; color: #4338ca; }

/* CARDS */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }

/* DASHBOARD */
.status-card { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; padding: 20px 24px; }
.status-active { border-color: #bbf7d0; background: #f0fdf4; }
.status-expired { border-color: #fecaca; background: #fff0f0; }
.status-icon { font-size: 28px; }
.status-label { font-size: 17px; font-weight: 700; color: var(--text); }
.status-date { color: var(--text-muted); font-size: 14px; margin-top: 2px; }
.info-row { margin-bottom: 12px; font-size: 15px; }
.info-label { color: var(--text-muted); margin-right: 8px; }
.dashboard-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.expired-icon { font-size: 56px; margin-bottom: 16px; }

/* VIDEOS */
.videos-grid { display: grid; gap: 24px; }
.video-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; transition: box-shadow .2s; }
.video-card:hover { box-shadow: 0 8px 32px rgba(0,0,0,.08); }
.video-number { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); margin-bottom: 8px; font-weight: 700; }
.video-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; letter-spacing: -.02em; }
.video-desc { color: var(--text-muted); margin-bottom: 20px; font-size: 14px; }
.video-player { position: relative; width: 100%; padding-bottom: 56.25%; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface2); }
.video-player iframe, .video-player video { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }

/* CATALOG */
.catalog-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.sync-badge { font-size: 12px; color: var(--text-muted); background: var(--surface2); padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border); font-weight: 500; }
.filter-form { background: var(--surface2); border-radius: var(--radius-lg); padding: 16px 20px; margin-bottom: 24px; border: 1px solid var(--border); }
.filter-section-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; margin: 14px 0 8px; }
.filter-form .filter-row:first-child { margin-bottom: 0; }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.filter-row:last-child { margin-bottom: 0; }
.filter-row input, .filter-row select { flex: 1; min-width: 130px; background: var(--surface); }
.results-info { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; font-weight: 500; }

.products-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 20px; }
.product-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; display: block; color: var(--text); transition: all .2s; }
.product-card:hover { border-color: #ccc; box-shadow: 0 8px 32px rgba(0,0,0,.1); transform: translateY(-4px); }
.product-img { aspect-ratio: 4/3; overflow: hidden; background: var(--surface2); display: flex; align-items: center; justify-content: center; }
.product-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.product-card:hover .product-img img { transform: scale(1.05); }
.no-photo { font-size: 32px; color: var(--text-muted); opacity: .2; }
.product-info { padding: 16px; }
.product-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; line-height: 1.4; color: var(--text); letter-spacing: -.01em; }
.product-article { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; font-family: monospace; }
.product-price { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.no-price { color: var(--text-muted); font-size: 13px; font-weight: 400; }
.product-availability { font-size: 11px; color: var(--success); margin-top: 5px; font-weight: 600; }

/* PRODUCT DETAIL */
.back-link { color: var(--text-muted); font-size: 14px; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 28px; transition: color .15s; font-weight: 500; }
.back-link:hover { color: var(--text); }
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; }
@media (max-width: 768px) { .product-detail { grid-template-columns: 1fr; } }
.gallery-main img { width: 100%; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.gallery-thumbs .thumb { width: 68px; height: 68px; object-fit: cover; border-radius: var(--radius-sm); cursor: pointer; border: 2px solid transparent; opacity: .7; transition: all .15s; }
.gallery-thumbs .thumb:hover, .gallery-thumbs .thumb.active { border-color: var(--text); opacity: 1; }
.no-photo-large { background: var(--surface2); border-radius: var(--radius-lg); height: 300px; display: flex; align-items: center; justify-content: center; font-size: 48px; opacity: .15; }
.product-detail-title { font-size: 24px; font-weight: 700; margin-bottom: 20px; line-height: 1.3; letter-spacing: -.03em; }
.product-detail-price { font-size: 32px; font-weight: 800; color: var(--text); margin: 16px 0 24px; letter-spacing: -.04em; }
.detail-row { display: flex; gap: 8px; font-size: 14px; margin-bottom: 8px; }
.detail-row span:first-child { color: var(--text-muted); min-width: 100px; font-weight: 500; }
.detail-row strong { color: var(--text); }
.availability-badge { background: #f0fdf4; color: #16a34a; padding: 3px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; border: 1px solid #bbf7d0; }
.product-description, .product-chars { margin-top: 24px; }
.product-description h3, .product-chars h3 { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 12px; }
.product-description p { color: var(--text-dim); font-size: 14px; line-height: 1.7; }
.chars-table { width: 100%; border-collapse: collapse; }
.chars-table td { padding: 8px 0; font-size: 14px; border-bottom: 1px solid var(--border); }
.chars-table td:first-child { color: var(--text-muted); width: 45%; font-weight: 500; }
.product-meta { margin-top: 24px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-muted); }
.avito-link { color: var(--text); font-weight: 600; }

/* PAGINATION */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 48px; flex-wrap: wrap; }
.page-btn { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px 16px; color: var(--text-dim); font-size: 15px; font-weight: 600; transition: all .15s; min-width: 44px; text-align: center; }
.page-btn:hover { border-color: var(--text); color: var(--text); }
.page-btn-active { background: var(--text) !important; color: #fff !important; border-color: var(--text) !important; }
.page-btn-arrow { padding: 10px 18px; font-size: 14px; }
.page-dots { padding: 10px 8px; color: var(--text-muted); font-size: 15px; }
.page-info { color: var(--text-muted); font-size: 14px; font-weight: 500; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .nav-links a { padding: 6px 10px; font-size: 13px; }
  .dashboard-actions { flex-direction: column; }
  .filter-row { flex-direction: column; }
  .filter-row input, .filter-row select { min-width: 0; }
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .auth-card { padding: 32px 24px; margin: 16px; }
  .page-title { font-size: 22px; }
}

/* DASHBOARD SECTIONS */
.dashboard-section { margin-top: 48px; }
.section-title { font-size: 18px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 20px; }

.mini-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.mini-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden; display: block; color: var(--text); transition: all .2s; }
.mini-card:hover { border-color: #ccc; box-shadow: 0 4px 16px rgba(0,0,0,.08); transform: translateY(-2px); }
.mini-img { aspect-ratio: 4/3; overflow: hidden; background: var(--surface2); display: flex; align-items: center; justify-content: center; }
.mini-img img { width: 100%; height: 100%; object-fit: cover; }
.mini-info { padding: 10px 12px; }
.mini-title { font-size: 12px; font-weight: 600; line-height: 1.4; color: var(--text); }
.mini-price { font-size: 13px; font-weight: 700; color: var(--text); margin-top: 4px; }
.mini-date { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.fav-videos-list { display: flex; flex-direction: column; gap: 8px; }
.fav-video-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm); transition: all .15s; color: var(--text); }
.fav-video-item:hover { border-color: #ccc; }
.fav-video-num { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; min-width: 50px; }
.fav-video-title { font-size: 14px; font-weight: 600; }

/* FAVORITE BUTTON */
.fav-btn { background: var(--surface2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 9px 18px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s; color: var(--text); }
.fav-btn:hover { border-color: #ccc; }
.fav-btn.fav-active { background: #fff0f5; border-color: #fecdd3; color: #e11d48; }

@media (max-width: 768px) {
  .mini-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

/* DESCRIPTION HTML CONTENT (from feed) */
.description-html { color: var(--text-dim); font-size: 14px; line-height: 1.7; }
.description-html p { margin-bottom: 10px; }
.description-html ul, .description-html ol { margin: 10px 0 10px 20px; }
.description-html li { margin-bottom: 4px; }
.description-html strong, .description-html b { color: var(--text); font-weight: 700; }
.description-html h1, .description-html h2, .description-html h3 { font-size: 15px; font-weight: 700; color: var(--text); margin: 14px 0 6px; }
.description-html a { color: var(--text); text-decoration: underline; }
.description-html img { max-width: 100%; border-radius: var(--radius-sm); margin: 8px 0; }
.description-html .Markdown-Word { display: inline; }

/* BRAND SELECTION GRID (carro.by style) */
.brands-section { margin-bottom: 28px; }
.brands-title { font-size: 18px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 14px; }
.brands-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 10px; }
.brand-card {
  position: relative; display: flex; align-items: flex-start; justify-content: flex-start;
  height: 90px; background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; color: var(--text);
  overflow: hidden; transition: all .15s;
}
.brand-card:hover { border-color: #ccc; box-shadow: 0 4px 16px rgba(0,0,0,.08); transform: translateY(-2px); }
.brand-card span {
  position: relative; z-index: 2; font-size: 13px; font-weight: 700;
  background: rgba(255,255,255,.88); padding: 3px 8px; border-radius: 6px;
  backdrop-filter: blur(2px);
}
.brand-card img {
  position: absolute; top: 0; height: 100%; width: 75%;
  object-fit: cover; opacity: .92; z-index: 1;
}
/* Car image bleeds off the right edge of the card */
.brand-card.peek-right img { right: -15%; left: auto; object-position: left center; }
/* Car image bleeds off the left edge of the card */
.brand-card.peek-left img { left: -15%; right: auto; object-position: right center; }

@media (max-width: 1024px) {
  .brands-grid { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 600px) {
  .brands-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .brand-card { height: 70px; padding: 8px 10px; }
  .brand-card span { font-size: 11px; }
}

/* PARTS CATEGORY GRID (carro.by-style top categories) */
.categories-section { margin-bottom: 28px; }
.categories-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.category-card {
  display: flex; align-items: center; justify-content: flex-start;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 12px; min-height: auto;
  color: var(--text); transition: all .15s; gap: 4px;
}
.category-card:hover { border-color: #ccc; box-shadow: 0 4px 16px rgba(0,0,0,.08); transform: translateY(-2px); }
.category-card span { font-size: 12px; font-weight: 700; line-height: 1.2; }
.category-card img { height: 38px; max-width: 60px; object-fit: contain; flex-shrink: 0; }

@media (max-width: 1024px) {
  .categories-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .categories-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .category-card { padding: 6px 10px; min-height: auto; }
  .category-card span { font-size: 11px; }
  .category-card img { height: 30px; max-width: 46px; }
}

/* Active state for quick-filter buttons (category/brand grids) */
.category-card.active, .brand-card.active {
  border-color: var(--primary, #1a1a1a);
  box-shadow: 0 0 0 2px var(--primary, #1a1a1a) inset;
}