/* Stonepedia: регистрация и каталог поставщика. Шрифт и цвет текста — от темы сайта.
   Акцент можно сменить в теме: .spj { --spj-accent: #…; } */
.spj {
	--spj-accent: #2b2b2b;
	--spj-accent-ink: #fff;
	--spj-line: rgba(0, 0, 0, .16);
	--spj-soft: rgba(0, 0, 0, .04);
	--spj-muted: rgba(0, 0, 0, .58);
	--spj-error: #b42318;
	--spj-good: #1e6b45;
	--spj-warn: #8a5a00;
	font: inherit;
	color: inherit;
}
.spj *, .spj *::before, .spj *::after { box-sizing: border-box; }
.spj [hidden] { display: none !important; }

.spj input[type="text"], .spj input[type="email"], .spj input[type="tel"], .spj select, .spj textarea {
	width: 100%;
	min-height: 44px;
	padding: 9px 12px;
	border: 1px solid var(--spj-line);
	border-radius: 6px;
	background: #fff;
	color: inherit;
	font: inherit;
}
.spj input:focus-visible, .spj select:focus-visible, .spj-btn:focus-visible,
.spj-kind input:focus-visible + span, .spj-seg input:focus-visible + span, .spj-photo:focus-within {
	outline: 2px solid var(--spj-accent);
	outline-offset: 2px;
}

.spj-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 10px 20px;
	border: 1px solid var(--spj-accent);
	border-radius: 6px;
	background: var(--spj-accent);
	color: var(--spj-accent-ink);
	font: inherit;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}
.spj-btn:hover { opacity: .9; color: var(--spj-accent-ink); }
.spj-btn[disabled] { opacity: .55; cursor: default; }
.spj-btn-ghost { background: transparent; color: var(--spj-accent); }
.spj-btn-ghost:hover { background: var(--spj-soft); color: var(--spj-accent); }
.spj-btn-sm { min-height: 36px; padding: 6px 14px; font-size: .9em; }

.spj-error { color: var(--spj-error); margin: 12px 0 0; }
.spj-field-error { color: var(--spj-error); font-size: .85em; }
.spj .is-invalid input { border-color: var(--spj-error); }
.spj input[type="password"], .spj input[type="url"] { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--spj-line); border-radius: 6px; background: #fff; color: inherit; font: inherit; }
.spj-pass { position: relative; display: block; }
.spj-pass input { padding-right: 44px !important; }
.spj .spj-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0 !important; background: transparent !important; color: inherit !important; cursor: pointer; padding: 0 !important; opacity: .6; box-shadow: none !important; }
.spj-check { display: flex; gap: 8px; align-items: center; font-size: .9em; cursor: pointer; margin: 0; }
.spj-check input { width: 18px; height: 18px; }
.spj-card-box { display: flex; flex-direction: column; gap: 14px; padding: 18px; border: 1px solid var(--spj-line); border-radius: 12px; background: #fff; }
.spj-forgot { margin-top: 14px; font-size: .92em; }
.spj-forgot summary { cursor: pointer; color: var(--spj-muted); }
.spj-forgot .spj-login-form { margin-top: 12px; }
.spj-muted { color: var(--spj-muted); }

/* ---------- RU / EN ---------- */
.spj-lang { display: flex; justify-content: flex-end; gap: 4px; margin: 0 0 12px; font-size: .85em; font-weight: 600; }
.spj-lang a, .spj-lang span { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 32px; padding: 0 8px; border: 1px solid var(--spj-line); border-radius: 6px; text-decoration: none; color: inherit; }
.spj-lang .is-on { background: var(--spj-accent); color: var(--spj-accent-ink); border-color: var(--spj-accent); }

/* ---------- регистрация ---------- */
.spj-join { max-width: 460px; }
.spj-promise { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--spj-soft); font-size: .92em; }
.spj-form { display: flex; flex-direction: column; gap: 14px; }
.spj-field { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.spj-label { font-size: .9em; font-weight: 600; padding: 0; }
.spj-kinds { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.spj-kinds legend { margin-bottom: 8px; }
.spj-kind { position: relative; display: block; cursor: pointer; margin: 0; }
.spj-kind input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.spj-kind span {
	display: block;
	padding: 12px 14px;
	border: 1px solid var(--spj-line);
	border-radius: 8px;
	font-weight: 500;
}
.spj-kind:hover span { border-color: var(--spj-accent); }
.spj-kind input:checked + span { border-color: var(--spj-accent); box-shadow: inset 0 0 0 1px var(--spj-accent); background: var(--spj-soft); }
.spj-kinds.is-invalid .spj-kind span { border-color: var(--spj-error); }
.spj-consent { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: flex-start; font-size: .9em; cursor: pointer; }
.spj-consent input { width: 18px; height: 18px; margin-top: 2px; flex: 0 0 auto; }
.spj-consent > span:not(.spj-field-error) { flex: 1 1 0; min-width: 0; }
.spj-consent .spj-field-error { flex-basis: 100%; padding-left: 28px; }
.spj-submit { width: 100%; min-height: 50px; }
.spj-note { margin: 0; font-size: .9em; color: var(--spj-muted); text-align: center; }
.spj-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* ---------- заявка покупателя ---------- */
.spj-request { max-width: 560px; }
.spj-request .spj-lead { margin: 0 0 14px; }
.spj-contacts { margin: 0 0 14px; font-size: 1.05em; line-height: 1.6; }
.spj-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.spj textarea { min-height: 88px; resize: vertical; }
.spj .is-invalid textarea { border-color: var(--spj-error); }
.spj-hint { margin: 0 0 18px; padding: 12px 14px; border: 1px solid var(--spj-line); border-radius: 8px; background: var(--spj-soft); }
@media (max-width: 560px) { .spj-two { grid-template-columns: 1fr; } }

/* ---------- список поставщиков (администратор) ---------- */
.spj-sup-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.spj-sup { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--spj-line); border-radius: 8px; background: #fff; }
.spj-sup-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.spj-sup-main .spj-muted { font-size: .85em; overflow-wrap: anywhere; }
.spj-sup .spj-btn { white-space: nowrap; flex: 0 0 auto; }
@media (max-width: 560px) { .spj-sup { flex-direction: column; align-items: stretch; } }

/* ---------- предложения поставщиков в карточке камня ---------- */
.spj-offers { margin: 28px 0; clear: both; }
.spj-offers-title { font-size: 1.25em; margin: 0 0 12px; }
.spj-offers-list { display: flex; flex-direction: column; gap: 10px; }
.spj-offer { display: grid; grid-template-columns: 88px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--spj-line); border-radius: 10px; background: #fff; }
.spj-offer img, .spj-offer-ph { width: 88px; height: 66px; object-fit: cover; border-radius: 6px; display: block; }
.spj-offer-ph { background: var(--spj-soft); }
.spj-offer p { margin: 0; font-size: .92em; }
.spj-offer-det { font-weight: 600; }
.spj-offer .spj-qty { color: var(--spj-good); font-weight: 600; }
.spj-offer-buy { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.spj-offer .spj-price { font-weight: 700; font-size: 1em; white-space: nowrap; }
@media (max-width: 560px) {
	.spj-offer { grid-template-columns: 72px minmax(0, 1fr); }
	.spj-offer img, .spj-offer-ph { width: 72px; height: 54px; }
	.spj-offer-buy { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; text-align: left; }
}

/* ---------- кабинет: шапка и вкладки ---------- */
.spj-cab-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.spj-cab-top .spj-lang { margin: 0; }
.spj-cab-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.spj-avatar { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--spj-accent); color: var(--spj-accent-ink); font-weight: 700; font-size: 1.3em; }
.spj-cab-id .spj-who { flex-basis: auto; }
.spj-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--spj-line); margin-bottom: 16px; overflow-x: auto; }
.spj .spj-tab { background: transparent !important; color: inherit !important; border: 0 !important; border-bottom: 2px solid transparent !important; border-radius: 0 !important; padding: 10px 14px !important; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; opacity: .65; box-shadow: none !important; margin: 0 0 -1px; min-height: 44px; }
.spj .spj-tab.is-on { opacity: 1; border-bottom-color: var(--spj-accent) !important; }
.spj-tab .spj-count { color: var(--spj-muted); font-weight: 400; }
.spj-badge { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: #c2410c; color: #fff; font-size: .75em; text-align: center; }
.spj-req-list { display: flex; flex-direction: column; gap: 8px; }
.spj-req { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--spj-line); border-radius: 8px; background: #fff; }
.spj-company-form { max-width: 560px; }
.spj-videos { margin: 28px 0; clear: both; }
.spj-video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.spj-video { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; }
.spj-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- мой каталог ---------- */
.spj-gate p + p { margin-top: 12px; }
.spj-login { max-width: 460px; }
.spj-login-form { display: flex; flex-direction: column; gap: 12px; }
.spj-login .spj-lead { margin: 0; }
.spj-login > .spj-note { margin-top: 14px; }
.spj-ok { margin: 0; padding: 10px 12px; border-radius: 6px; background: #dcefe4; color: var(--spj-good); }
.spj-who { margin: 0; font-size: .85em; color: var(--spj-muted); flex-basis: 100%; }
.spj-gate .spj-btn + .spj-btn { margin-left: 8px; }
.spj-cab-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.spj-company { margin: 0; font-weight: 600; font-size: 1.1em; }
.spj-lead { margin: 2px 0 0; color: var(--spj-muted); }
.spj-count { margin: 0; color: var(--spj-muted); font-size: .9em; }
.spj-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 8px; }
.spj-bulk { margin: 0; }
.spj-bulk-hint { font-size: .85em; color: var(--spj-muted); flex: 1 1 220px; }
.spj-progress { margin: 8px 0 0; font-weight: 600; }
.spj-empty { padding: 28px 16px; text-align: center; border: 1px dashed var(--spj-line); border-radius: 8px; color: var(--spj-muted); }

.spj-rows { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.spj-row {
	position: relative;
	display: grid;
	grid-template-columns: 108px minmax(0, 1fr);
	grid-template-areas: "photo fields" "side fields";
	grid-template-rows: auto 1fr;
	gap: 8px 14px;
	padding: 12px;
	border: 1px solid var(--spj-line);
	border-radius: 10px;
	background: #fff;
}

.spj-photo {
	grid-area: photo;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 108px;
	height: 108px;
	border: 1.5px dashed var(--spj-line);
	border-radius: 8px;
	background: var(--spj-soft);
	cursor: pointer;
	overflow: hidden;
	margin: 0;
	text-align: center;
}
.spj-photo:hover { border-color: var(--spj-accent); }
.spj-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.spj-photo-text { position: relative; font-size: .82em; font-weight: 600; padding: 6px; line-height: 1.25; }
.spj-photo.has-photo { border-style: solid; }
.spj-photo.has-photo .spj-photo-text {
	position: absolute; left: 0; right: 0; bottom: 0;
	background: rgba(0, 0, 0, .55); color: #fff; font-weight: 500; padding: 3px; opacity: 0; transition: opacity .15s;
}
.spj-photo.has-photo:hover .spj-photo-text, .spj-photo.has-photo:focus-within .spj-photo-text { opacity: 1; }
.spj-photo.is-loading { opacity: .5; }

.spj-fields {
	grid-area: fields;
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	grid-template-areas: "name name" "seg finish" "dims dims" "price qty" "video video";
	gap: 8px 10px;
	align-items: end;
}
.spj-namebox { grid-area: name; position: relative; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.spj-incat { font-size: .78em; color: var(--spj-good); text-decoration: none; }
.spj-videobox { grid-area: video; }
.spj-name { font-weight: 600; padding-right: 44px !important; }
.spj-seg { grid-area: seg; display: flex; border: 1px solid var(--spj-line); border-radius: 6px; overflow: hidden; min-height: 44px; }
.spj-seg label { margin: 0; position: relative; display: flex; flex: 1 1 0; cursor: pointer; }
.spj-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.spj-seg span { display: flex; flex: 1; align-items: center; justify-content: center; padding: 0 10px; font-size: .92em; }
.spj-seg label + label span { border-left: 1px solid var(--spj-line); }
.spj-seg input:checked + span { background: var(--spj-accent); color: var(--spj-accent-ink); }
.spj-finish { grid-area: finish; }
.spj-dims { grid-area: dims; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.spj-num { display: flex; flex-direction: column; gap: 3px; margin: 0; min-width: 0; }
.spj-cap { font-size: .78em; color: var(--spj-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spj-row.is-slab .spj-thickness { border-color: var(--spj-accent); }
.spj-pricebox { grid-area: price; }
.spj-qtybox { grid-area: qty; }
.spj-qty-in { flex: 1 1 auto; min-width: 0; }
.spj-unit { flex: 0 0 70px; width: 70px !important; padding-left: 8px !important; padding-right: 4px !important; }
.spj-card .spj-qty { color: var(--spj-good); font-weight: 600; }
.spj-price-line { display: flex; gap: 6px; max-width: 280px; }
.spj-price-in { flex: 1 1 auto; min-width: 0; }
.spj-cur { flex: 0 0 64px; width: 64px !important; padding-left: 8px !important; padding-right: 4px !important; }

.spj-side { grid-area: side; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.spj-chip { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .76em; font-weight: 600; line-height: 1.3; }
.spj-chip-draft { background: #f2f2f2; color: var(--spj-muted); }
.spj-chip-pending { background: #fcf0d4; color: var(--spj-warn); }
.spj-chip-publish { background: #dcefe4; color: var(--spj-good); }
.spj-save { font-size: .76em; color: var(--spj-muted); min-height: 1.2em; }
.spj-save.is-bad { color: var(--spj-error); }
/* кнопка удаления: защищена от стилей кнопок темы */
.spj .spj-row .spj-del {
	position: absolute; top: 16px; right: 16px;
	width: 36px; height: 36px; min-height: 0; padding: 0; margin: 0;
	border: 1px solid transparent !important; border-radius: 6px; box-shadow: none !important;
	background: transparent !important; color: var(--spj-muted) !important;
	font: inherit; font-size: 22px; line-height: 1; text-transform: none; letter-spacing: 0;
	cursor: pointer;
}
.spj .spj-row .spj-del:hover, .spj .spj-row .spj-del:focus-visible { border-color: var(--spj-line) !important; color: var(--spj-error) !important; }

/* ---------- склад онлайн ---------- */
.spj-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.spj-filter a, .spj-pages a, .spj-pages span {
	padding: 6px 14px; border: 1px solid var(--spj-line); border-radius: 999px; text-decoration: none; color: inherit; font-size: .92em;
}
.spj-filter a.is-on, .spj-pages .is-on { background: var(--spj-accent); border-color: var(--spj-accent); color: var(--spj-accent-ink); }
.spj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; margin-top: 16px; }
.spj-card { border: 1px solid var(--spj-line); border-radius: 10px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.spj-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.spj-card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.spj-card h3 { font-size: 1em; margin: 0; }
.spj-card h3 a { color: inherit; }
.spj-card p { margin: 0; font-size: .88em; }
.spj-price { font-weight: 700; font-size: 1em !important; margin-top: auto !important; padding-top: 6px; }
.spj-card .spj-btn { align-self: flex-start; margin-top: 6px; }
.spj-pages { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 20px; }

/* ---------- телефон ---------- */
@media (max-width: 560px) {
	.spj-row { grid-template-columns: 84px minmax(0, 1fr); grid-template-areas: "photo side" "fields fields"; grid-template-rows: auto auto; }
	.spj-photo { width: 84px; height: 84px; }
	.spj-side { padding-right: 40px; align-self: center; }
	.spj-fields { grid-template-areas: "name name" "seg seg" "finish finish" "dims dims" "price qty" "video video"; }
	.spj-name { padding-right: 12px !important; }
	.spj-price-line { max-width: none; }
	.spj-actions .spj-btn { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
	.spj-photo-text { transition: none; }
}

/* ---------- ИИ-консультант ---------- */
.spj-chat { position: fixed; right: 16px; bottom: 16px; z-index: 99990; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; font-size: 15px; }
.spj .spj-chat-open { display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 20px 0 16px !important; border: 0 !important; border-radius: 999px !important; background: #1f2328 !important; color: #fff !important; font: inherit; font-weight: 600; cursor: pointer; box-shadow: 0 6px 24px rgba(0,0,0,.22) !important; }
.spj-chat-ico { font-size: 1.2em; }
.spj-chat.is-open .spj-chat-open { display: none; }
.spj-chat-panel { width: 380px; max-width: calc(100vw - 32px); height: min(620px, calc(100vh - 32px)); display: flex; flex-direction: column; background: #fff; color: #1f2328; border-radius: 16px; box-shadow: 0 12px 48px rgba(0,0,0,.25); overflow: hidden; }
.spj-chat-panel[hidden] { display: none !important; }
.spj-chat-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; background: #1f2328; color: #fff; }
.spj .spj-chat-x { background: transparent !important; border: 0 !important; color: #fff !important; font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px !important; box-shadow: none !important; min-height: 0; }
.spj-chat-list { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: #f6f7f8; }
.spj-chat-msg { max-width: 88%; padding: 10px 12px; border-radius: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.spj-chat-msg.is-user { align-self: flex-end; background: #1f2328; color: #fff; border-bottom-right-radius: 4px; }
.spj-chat-msg.is-assistant { align-self: flex-start; background: #fff; border: 1px solid rgba(0,0,0,.08); border-bottom-left-radius: 4px; }
.spj-chat-msg.is-wait { opacity: .65; font-style: italic; }
.spj-chat-ref { font-weight: 600; text-decoration: none; }
.spj-chat-src { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(0,0,0,.08); display: flex; flex-direction: column; gap: 3px; font-size: .86em; }
.spj-chat-src span { color: rgba(0,0,0,.55); }
.spj-chat-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 0; background: #f6f7f8; }
.spj-chat-chips[hidden] { display: none; }
.spj .spj-chat-chip { border: 1px solid rgba(0,0,0,.15) !important; background: #fff !important; color: inherit !important; border-radius: 999px !important; padding: 6px 12px !important; font: inherit; font-size: .86em; cursor: pointer; box-shadow: none !important; min-height: 0; }
.spj-chat-form { display: flex; gap: 8px; padding: 10px 12px; background: #f6f7f8; }
.spj .spj-chat-in { flex: 1; resize: none; min-height: 44px; max-height: 120px; padding: 11px 12px; border: 1px solid rgba(0,0,0,.15); border-radius: 10px; font: inherit; background: #fff; }
.spj .spj-chat-send { flex: 0 0 44px; height: 44px; border: 0 !important; border-radius: 10px !important; background: #1f2328 !important; color: #fff !important; font-size: 18px; cursor: pointer; padding: 0 !important; }
.spj .spj-chat-send[disabled] { opacity: .5; }
.spj-chat-req { display: block; padding: 10px 14px 14px; text-align: center; font-weight: 600; background: #f6f7f8; color: #1f2328; }
@media (max-width: 560px) {
	.spj-chat { right: 12px; bottom: 12px; }
	.spj-chat.is-open { inset: 0; right: 0; bottom: 0; }
	.spj-chat-panel { width: 100vw; max-width: 100vw; height: 100dvh; border-radius: 0; }
	.spj-chat-open-t { display: none; }
	.spj .spj-chat-open { width: 56px; height: 56px; padding: 0 !important; justify-content: center; }
}
