:root {
    --green:     #35aa47;
    --green-dark:#2d9040;
    --green-pale:#eaf7ec;
    --text:      #333;
    --muted:     #888;
    --border:    #e0e0e0;
    --bg:        #f4f4f4;
    --white:     #fff;
    --radius:    6px;
}

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

body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
}

a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-dark); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.page-content { padding: 24px 0; }

/* ── Topbar ── */
.topbar {
    background: #f0f0f0;
    border-bottom: 1px solid #ddd;
    height: 34px;
    display: flex;
    align-items: center;
}
.topbar .container { display: flex; justify-content: flex-end; align-items: center; gap: 16px; }
.topbar__lang { display: flex; gap: 6px; }
.topbar__lang a { color: #888; font-size: 12px; font-weight: 600; text-transform: uppercase; }
.topbar__lang a.active, .topbar__lang a:hover { color: var(--green); }
.topbar .sep { color: #ccc; font-size: 12px; }
.topbar__auth { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.topbar__auth a { color: #666; }
.topbar__auth a:hover { color: var(--green); }

/* ── Header ── */
.header {
    background: var(--white);
    border-bottom: 2px solid var(--border);
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.header .container { display: flex; align-items: center; height: 56px; }
.header__logo { display: flex; align-items: center; gap: 6px; text-decoration: none; flex-shrink: 0; }
.header__logo img { height: 22px; }
.header__nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.header__nav a { padding: 6px 12px; color: var(--text); font-size: 13px; border-radius: var(--radius); transition: background .15s, color .15s; }
.header__nav a:hover { background: var(--green-pale); color: var(--green); }

/* ── Breadcrumb ── */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 16px; flex-wrap: wrap; }
.breadcrumb a { color: var(--green); }
.breadcrumb .sep { color: #ccc; }

/* ── Buttons ── */
.btn {
    display: inline-block; padding: 7px 18px;
    border-radius: var(--radius); font-size: 13px; font-weight: 600;
    cursor: pointer; border: none; text-decoration: none;
    transition: background .15s; line-height: 1.4;
}
.btn--green  { background: var(--green); color: var(--white); }
.btn--green:hover { background: var(--green-dark); color: var(--white); }
.btn--outline { border: 1px solid var(--green); color: var(--green); background: var(--white); }
.btn--outline:hover { background: var(--green-pale); }
.btn--sm { padding: 4px 12px; font-size: 12px; }
.btn--xs { padding: 3px 8px; font-size: 11px; }

/* ── Main page: brand tabs ── */
.catalog-section {
    background: var(--white); border-radius: 8px;
    border: 1px solid var(--border); padding: 24px; margin-bottom: 24px;
}
.catalog-section h2 { font-size: 17px; font-weight: 700; margin-bottom: 16px; }
.brands-tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 18px; gap: 0; }
.brands-tab {
    padding: 8px 18px; cursor: pointer; font-size: 13px; font-weight: 600;
    color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: color .15s;
}
.brands-tab:hover { color: var(--green); }
.brands-tab.active { color: var(--green); border-bottom-color: var(--green); }
.brands-pane { display: none; }
.brands-pane.active { display: block; }
.brands-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.brands-grid a {
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    padding: 10px 8px 8px; width: 90px;
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 11px; color: var(--text); background: #fafafa;
    text-align: center; transition: all .15s;
}
.brands-grid a img { width: 60px; height: 60px; object-fit: contain; }
.brands-grid a span { line-height: 1.2; }
.brands-grid a:hover { border-color: var(--green); color: var(--green); background: #eaf7ec; }

/* ── Search page ── */
.search-layout { display: grid; grid-template-columns: 220px 1fr; gap: 20px; }
.search-sidebar { background: var(--white); border-radius: 8px; border: 1px solid var(--border); padding: 16px; align-self: start; }
.search-sidebar h3 { font-size: 13px; font-weight: 700; margin-bottom: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
/* filter form */
.filter-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; }
.filter-group { margin-bottom: 10px; }
.filter-group label { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 3px; text-transform: uppercase; letter-spacing: .3px; }
.filter-group select, .filter-group input[type=number] {
    width: 100%; padding: 5px 7px; border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 12px; color: var(--text); background: var(--white); outline: none;
}
.filter-group select:focus, .filter-group input[type=number]:focus { border-color: var(--green); }
.filter-group--year .year-range { display: flex; align-items: center; gap: 4px; }
.filter-group--year input { text-align: center; }
.filter-section { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }
.filter-section summary { font-size: 12px; font-weight: 700; color: var(--text); cursor: pointer; padding: 4px 0 8px; list-style: none; display: flex; justify-content: space-between; }
.filter-section summary::after { content: '+'; color: var(--muted); }
.filter-section[open] summary::after { content: '−'; }
.filter-actions { display: flex; gap: 8px; margin-top: 14px; }
.filter-actions .btn { flex: 1; text-align: center; font-size: 12px; padding: 7px 8px; }
/* mod-card autos list */
.mod-card__body-type { font-size: 11px; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; }
.mod-card__autos { margin-top: 8px; }
.mod-card__autos-count { font-size: 11px; color: var(--muted); display: block; margin-bottom: 4px; }
.mod-card__auto-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.mod-card__auto-list a { font-size: 12px; color: var(--green); }
.mod-card__auto-list a:hover { text-decoration: underline; }
.search-results {}
.search-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.search-header h1 { font-size: 20px; font-weight: 700; }
.results-count { font-size: 13px; color: var(--muted); }

/* ── Mod card ── */
.mod-card {
    background: var(--white); border: 1px solid var(--border); border-radius: 8px;
    padding: 16px; margin-bottom: 12px; display: grid;
    grid-template-columns: 160px 1fr auto; gap: 16px; align-items: center;
    transition: box-shadow .15s;
}
.mod-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,.1); }
.mod-card__photo { width: 160px; height: 100px; object-fit: cover; border-radius: var(--radius); background: #f0f0f0; }
.mod-card__photo-placeholder { width: 160px; height: 100px; border-radius: var(--radius); background: #f0f0f0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.mod-card__info h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.mod-card__info h3 a { color: var(--text); }
.mod-card__info h3 a:hover { color: var(--green); }
.mod-card__specs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.mod-card__spec { font-size: 12px; color: var(--muted); }
.mod-card__spec strong { color: var(--text); }

/* ── Pagination ── */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 24px; }
.pagination a, .pagination span {
    padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 13px; color: var(--text); background: var(--white);
}
.pagination a:hover { border-color: var(--green); color: var(--green); }
.pagination .current { background: var(--green); color: var(--white); border-color: var(--green); }

/* ── Spec page ── */
.spec-layout { display: grid; grid-template-columns: 1fr 360px; gap: 24px; }
.spec-main {}
.spec-sidebar {}
.spec-photos { margin-bottom: 20px; }
.spec-photo-main-wrap { width: 100%; border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
.spec-photo-main { width: 100%; max-height: 500px; object-fit: cover; display: block; border-radius: 8px; }
.spec-thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.spec-thumb-wrap { width: 80px; height: 56px; background: #f0f0f0; border-radius: 4px; border: 2px solid transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; overflow: hidden; transition: border-color .15s; }
.spec-thumb-wrap:hover, .spec-thumb-wrap.active { border-color: var(--green); }
.spec-thumb { width: 100%; height: 100%; object-fit: contain; display: block; }

.spec-card {
    background: var(--white); border: 1px solid var(--border); border-radius: 8px;
    margin-bottom: 16px; overflow: hidden;
}
.spec-card__title {
    padding: 10px 16px; background: var(--green); color: var(--white);
    font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 8px;
}
.spec-table { width: 100%; border-collapse: collapse; }
.spec-table tr:nth-child(even) { background: #fafafa; }
.spec-table td { padding: 8px 16px; font-size: 13px; border-bottom: 1px solid #f0f0f0; }
.spec-table td:first-child { color: var(--muted); font-weight: 600; width: 55%; }
.spec-table td:last-child { color: var(--text); }

.spec-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.spec-subtitle { font-size: 14px; color: var(--muted); margin-bottom: 20px; }

/* ── Auto list in mod page ── */
.auto-list { display: flex; flex-direction: column; gap: 10px; }
.auto-item {
    background: var(--white); border: 1px solid var(--border); border-radius: 8px;
    padding: 14px 16px; display: flex; justify-content: space-between; align-items: center;
}
.auto-item__desc { font-size: 13px; color: var(--muted); }
.auto-item__specs { display: flex; gap: 16px; font-size: 13px; }
.auto-item__spec span { color: var(--muted); }

/* ── Footer ── */
.footer { background: var(--white); border-top: 1px solid var(--border); margin-top: 40px; padding: 16px 0; }
.footer .copyright { font-size: 12px; color: var(--muted); text-align: center; }

/* ── Responsive ── */
@media (max-width: 900px) {
    .spec-layout { grid-template-columns: 1fr; }
    .search-layout { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .mod-card { grid-template-columns: 1fr; }
    .mod-card__photo, .mod-card__photo-placeholder { width: 100%; }
}

/* ── Auth modals ── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: var(--white); border-radius: 10px; padding: 32px 28px; width: 400px; max-width: 95vw; position: relative; box-shadow: 0 8px 32px rgba(0,0,0,.18); }
.modal__close { position: absolute; top: 14px; right: 16px; background: none; border: none; font-size: 22px; cursor: pointer; color: #aaa; line-height: 1; }
.modal__close:hover { color: #555; }
.modal__tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.modal__tab { flex: 1; text-align: center; padding: 10px 0; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.modal__tab.active { color: var(--green); border-bottom-color: var(--green); }
.modal h2 { font-size: 20px; font-weight: 700; margin-bottom: 20px; }
.modal .field { margin-bottom: 14px; }
.modal .field input { width: 100%; padding: 9px 12px; border: 1px solid #d0d0d0; border-radius: var(--radius); font-size: 14px; outline: none; font-family: inherit; transition: border-color .15s; }
.modal .field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(53,170,71,.12); }
.modal .form-footer { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 16px; font-size: 12px; }
.modal .form-footer a { color: var(--green); }
.modal .form-footer label { display: flex; align-items: center; gap: 5px; color: var(--muted); cursor: pointer; }
.error-msg { color: #e03c3c; font-size: 12px; margin-top: 8px; display: none; }
.success-msg { color: var(--green); font-size: 12px; margin-top: 8px; display: none; }

/* ── Toasts ── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.15); animation: toast-in .25s ease; color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.toast--warning { background: #f39c12; }
.toast--success { background: var(--green); }
.toast--error   { background: #e03c3c; }
.toast--info    { background: #0da3e2; }
.toast__icon    { font-size: 16px; flex-shrink: 0; }
.toast__close   { margin-left: auto; background: none; border: none; color: #fff; font-size: 18px; cursor: pointer; opacity: .7; line-height: 1; padding: 0; }
.toast__close:hover { opacity: 1; }

/* ── Cabinet ── */
.cabinet-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; max-width: 900px; margin: 0 auto; }
.cabinet-sidebar { background: var(--white); border-radius: 8px; border: 1px solid var(--border); overflow: hidden; align-self: start; }
.cabinet-sidebar__user { padding: 20px; border-bottom: 1px solid var(--border); text-align: center; }
.cabinet-sidebar__user .name { font-weight: 700; font-size: 15px; margin-top: 4px; }
.cabinet-sidebar__user .email { font-size: 12px; color: var(--muted); }
.cabinet-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    border-left: 3px solid transparent;
    transition: all .15s;
}
.cabinet-nav a:hover { background: #eaf7ec; color: var(--green); }
.cabinet-nav a.active { background: #eaf7ec; color: var(--green); border-left-color: var(--green); }
.cabinet-nav a svg { flex-shrink: 0; }

.portlet {
    background: var(--white);
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
    overflow: hidden;
}
.portlet__title {
    padding: 12px 20px;
    background: var(--green);
    color: var(--white);
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.portlet__body { padding: 24px; }

.form-row {
    display: grid;
    grid-template-columns: 140px 1fr 100px;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}
.form-row:last-child { border-bottom: none; }
.form-row label { font-size: 13px; color: var(--muted); font-weight: 600; }
.form-row input,
.form-row select {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    width: 100%;
    transition: border-color .15s;
}
.form-row input:focus,
.form-row select:focus { border-color: var(--green); }
.form-row input[readonly] { background: #f8f8f8; color: var(--muted); cursor: default; }
.form-row .actions { display: flex; gap: 6px; visibility: hidden; }
.form-row.changed .actions { visibility: visible; }
.form-msg { font-size: 12px; margin-top: 12px; display: none; padding: 8px 12px; border-radius: var(--radius); }
.form-msg.success-msg { background: #edfae1; color: #3a7d1e; display: block; }
.form-msg.error-msg { background: #fdecea; color: #c0392b; display: block; }

@media (max-width: 768px) {
    .cabinet-layout { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .form-row .actions { visibility: visible; }
    .topbar__auth .btn-text { display: none; }
}
