/* Несущий слой (nessloy.xyz) — несущая способность штампа, метод характеристик (v2.0.0).
   Палитра сайта: фон #F0F4F8, карточки #FFF/#F7F9FB, рамки #D5E0E8/#B8C7D4, акцент #3E5463,
   угольный #2B343B, теплый #8C6239 / #B84A39 для грунта и эпюр.
   Все правила изолированы в .nsk; элементы управления защищены от стилей темы. */

.nsk {
	--k-bg: #F0F4F8; --k-card: #FFFFFF; --k-subtle: #F7F9FB;
	--k-accent: #3E5463; --k-accent-dark: #2C3E4B; --k-muted-accent: #5A7182; --k-soft: #E6EDF2;
	--k-ink: #2B343B; --k-body: #333333; --k-muted: #5C6B77;
	--k-line: #D5E0E8; --k-line2: #B8C7D4;
	--k-warm: #8C6239; --k-red: #B84A39;
	--k-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--k-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

	position: relative; box-sizing: border-box;
	max-width: 1320px; margin: 8px auto 24px; padding: 0 0 20px;
	background: var(--k-bg); border: 1px solid var(--k-line); border-radius: 12px; overflow: hidden;
	font-family: var(--k-font); font-size: 15px; line-height: 1.5; color: var(--k-ink); text-align: left;
	-webkit-text-size-adjust: 100%;
}
.nsk *, .nsk *::before, .nsk *::after { box-sizing: border-box; }
.nsk p, .nsk dl, .nsk dt, .nsk dd { margin: 0; padding: 0; }
.nsk sub { font-size: .72em; line-height: 0; vertical-align: -.25em; }
.nsk [hidden] { display: none !important; }
.nsk-hp { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }

/* ---------- Шапка ---------- */
.nsk-head {
	display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
	padding: 20px 24px; margin: 0 0 20px;
	background: linear-gradient(135deg, #2B343B 0%, #34414B 100%); border-bottom: 3px solid var(--k-accent);
}
.nsk-head__main { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1 1 520px; }
.nsk-badge { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 8px; background: var(--k-accent); border: 1px solid rgba(255,255,255,.18); }
.nsk .nsk-title {
	margin: 0 0 4px !important; padding: 0 !important; border: 0 !important; background: none !important;
	font: 700 21px/1.3 var(--k-font) !important; letter-spacing: 0 !important; text-transform: none !important;
	color: #fff !important; -webkit-text-fill-color: #fff !important; text-shadow: none !important;
}
.nsk .nsk-sub { font-size: 13.5px; color: #C9D4DC !important; -webkit-text-fill-color: #C9D4DC !important; }
.nsk-status { display: inline-flex; align-items: center; gap: 8px; flex: none; white-space: nowrap; padding: 7px 14px; border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); color: #fff; font-size: 13px; font-weight: 600; }
.nsk-status__dot { width: 9px; height: 9px; border-radius: 50%; background: #9AABB8; }
.nsk-status[data-state="ok"] .nsk-status__dot { background: #6FCF97; box-shadow: 0 0 0 3px rgba(111,207,151,.25); }
.nsk-status[data-state="busy"] .nsk-status__dot { background: #E6C27A; animation: nsk-pulse 1s infinite; }
.nsk-status[data-state="warn"] .nsk-status__dot { background: #E6C27A; }
.nsk-status[data-state="error"] .nsk-status__dot { background: #E58B8B; }
@keyframes nsk-pulse { 50% { opacity: .35; } }

/* ---------- Сетка ---------- */
.nsk-grid { display: grid; grid-template-columns: minmax(330px, 400px) minmax(0, 1fr); gap: 20px; align-items: start; padding: 0 20px; }
.nsk-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.nsk-card { background: var(--k-card); border: 1px solid var(--k-line); border-radius: 10px; padding: 18px; margin: 0; box-shadow: 0 1px 2px rgba(43,52,59,.04), 0 6px 18px rgba(43,52,59,.06); min-width: 0; }
.nsk-card__head { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--k-line); }
.nsk-num { flex: none; padding: 3px 8px; border-radius: 4px; background: var(--k-accent); color: #fff; font: 700 12px/1.4 var(--k-mono); }
.nsk .nsk-card__title {
	margin: 0 !important; padding: 0 !important; border: 0 !important; background: none !important;
	font: 700 15.5px/1.35 var(--k-font) !important; letter-spacing: 0 !important; text-transform: none !important;
	color: var(--k-ink) !important; -webkit-text-fill-color: var(--k-ink) !important;
}

/* ---------- Поля ---------- */
.nsk-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.nsk-field { display: flex; flex-direction: column; min-width: 0; }
.nsk-field--wide { grid-column: 1 / -1; }
.nsk .nsk-field label { display: block; margin: 0 0 5px; padding: 0; font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--k-ink); }
.nsk-field label i { font-family: Georgia, "Times New Roman", serif; }
.nsk-input { display: flex; align-items: stretch; min-height: 42px; background: #fff; border: 1px solid var(--k-line2); border-radius: 6px; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.nsk-input:hover { border-color: #93A7B6; }
.nsk-input:focus-within { border-color: var(--k-accent); box-shadow: 0 0 0 3px rgba(62,84,99,.16); }
.nsk .nsk-input input {
	flex: 1 1 auto; min-width: 0; width: 100% !important; height: auto !important; max-width: none !important;
	margin: 0 !important; padding: 8px 10px !important; border: 0 !important; border-radius: 0 !important;
	background: transparent !important; box-shadow: none !important; outline: none !important;
	font: 600 15px/1.2 var(--k-font) !important; font-variant-numeric: tabular-nums;
	color: var(--k-ink) !important; -webkit-text-fill-color: var(--k-ink) !important; -webkit-appearance: none; appearance: none;
}
.nsk-unit { display: flex; align-items: center; justify-content: center; flex: none; min-width: 44px; padding: 0 9px; background: var(--k-subtle); border-left: 1px solid var(--k-line); font-size: 12px; font-weight: 600; color: var(--k-muted); white-space: nowrap; }
.nsk-hint { display: block; margin-top: 4px; font-size: 11.5px; color: var(--k-muted); }
.nsk-err { display: none; margin-top: 4px; font-size: 11.5px; font-weight: 600; line-height: 1.35; color: #8A2E2E; }
.nsk-field.has-error .nsk-err { display: block; }
.nsk-field.has-error .nsk-hint { display: none; }
.nsk-field.has-error .nsk-input { border-color: #C87A7A; background: #FDF2F2; box-shadow: 0 0 0 3px rgba(200,122,122,.15); }

.nsk-range-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.nsk-range-top label { margin: 0 !important; }
.nsk-pill { flex: none; padding: 2px 9px; border-radius: 999px; background: var(--k-soft); color: var(--k-accent); font: 600 11.5px/1.6 var(--k-font); white-space: nowrap; }
.nsk .nsk-field input[type="range"] {
	-webkit-appearance: none; appearance: none; width: 100%; height: 6px; margin: 10px 0 4px; padding: 0; border: 0; border-radius: 999px;
	background: linear-gradient(90deg, #D5E0E8, #3E5463); box-shadow: none; outline: none; cursor: pointer;
}
.nsk input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid var(--k-accent); box-shadow: 0 1px 4px rgba(43,52,59,.25); }
.nsk input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--k-accent); }
.nsk input[type="range"]:focus-visible { box-shadow: 0 0 0 3px rgba(62,84,99,.25); }
.nsk-range-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--k-muted); }

/* ---------- Результаты ---------- */
.nsk-alerts:empty { display: none; }
.nsk-alerts { display: grid; gap: 6px; margin-bottom: 12px; }
.nsk-alert { padding: 9px 12px; border-radius: 6px; background: #FBF3E2; border: 1px solid #EAD5A8; border-left: 4px solid #D4A443; color: #6B4A0E; font-size: 12.5px; line-height: 1.45; }
.nsk-alert--bad { background: #FDF2F2; border-color: #E3B4B4; border-left-color: #C87A7A; color: #8A2E2E; font-weight: 600; }
.nsk.is-stale .nsk-kpis, .nsk.is-stale .nsk-kv { opacity: .55; transition: opacity .2s; }

.nsk-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.nsk-kpi { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 12px; border: 1px solid var(--k-line); border-radius: 8px; background: #fff; overflow: hidden; min-width: 0; }
.nsk-kpi::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--k-muted-accent); }
.nsk-kpi--main { grid-column: 1 / -1; background: linear-gradient(180deg, #F2F6FA, #fff); }
.nsk-kpi--main::before { height: 4px; background: linear-gradient(90deg, var(--k-accent), var(--k-red)); }
.nsk-kpi__label { font-size: 12px; color: var(--k-muted); line-height: 1.35; }
.nsk-kpi__label b { color: var(--k-ink); }
.nsk-kpi__val { display: flex; align-items: baseline; gap: 6px; font-size: 22px; font-weight: 750; line-height: 1.15; color: var(--k-ink); font-variant-numeric: tabular-nums; }
.nsk-kpi--main .nsk-kpi__val { font-size: 34px; color: var(--k-accent-dark); }
.nsk-kpi__val small { font-size: 13px; font-weight: 600; color: var(--k-muted); }
.nsk-kpi__sub { font: 500 12px/1.4 var(--k-mono); color: var(--k-muted-accent); }

.nsk-kv { margin-top: 12px !important; border: 1px solid var(--k-line); border-radius: 8px; background: var(--k-subtle); padding: 4px 12px !important; }
.nsk-kv > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--k-line); font-size: 12.5px; }
.nsk-kv > div:last-child { border-bottom: 0; }
.nsk-kv dt { color: var(--k-muted); }
.nsk-kv dd { flex: none; font-weight: 700; color: var(--k-ink); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

.nsk-details > summary { list-style: none; cursor: pointer; display: flex !important; align-items: center; justify-content: space-between; }
.nsk-details > summary::-webkit-details-marker { display: none; }
.nsk-details > summary::after { content: ""; flex: none; width: 8px; height: 8px; margin-left: 12px; border-right: 2px solid var(--k-muted-accent); border-bottom: 2px solid var(--k-muted-accent); transform: rotate(45deg); transition: transform .2s; }
.nsk-details[open] > summary { margin-bottom: 12px !important; padding-bottom: 10px !important; border-bottom: 1px solid var(--k-line) !important; }
.nsk-details[open] > summary::after { transform: rotate(225deg); }
.nsk-method p { margin: 0 0 10px !important; font-size: 13px; line-height: 1.55; color: var(--k-body); }
.nsk-method p:last-child { margin-bottom: 0 !important; }

/* ---------- Схема ---------- */
.nsk-stage-card { position: sticky; top: 16px; }
.nsk-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.nsk-seg { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; background: var(--k-soft); border: 1px solid var(--k-line); border-radius: 8px; }
.nsk .nsk-seg label { position: relative; margin: 0 !important; cursor: pointer; }
.nsk-seg input, .nsk-chip input { position: absolute; left: 0; top: 0; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.nsk-seg span { display: block; padding: 6px 14px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--k-muted-accent); transition: background .15s, color .15s; white-space: nowrap; }
.nsk-seg label:hover span { background: rgba(255,255,255,.7); color: var(--k-ink); }
.nsk-seg input:checked + span { background: var(--k-accent); color: #fff; box-shadow: 0 1px 3px rgba(43,52,59,.2); }
.nsk-seg input:focus-visible + span, .nsk-chip input:focus-visible + span { outline: 2px solid var(--k-accent); outline-offset: 2px; }
.nsk-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.nsk .nsk-chip { position: relative; margin: 0 !important; cursor: pointer; }
.nsk-chip span { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--k-line2); background: #fff; font-size: 12.5px; font-weight: 600; color: var(--k-muted); white-space: nowrap; transition: background .15s, color .15s, border-color .15s; }
.nsk-chip span::before { content: ""; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #C3CDD6; }
.nsk-chip:hover span { border-color: var(--k-accent); color: var(--k-ink); }
.nsk-chip input:checked + span { background: var(--k-soft); border-color: #9EB3C2; color: var(--k-accent-dark); }
.nsk-chip input:checked + span::before { background: var(--k-accent); }

.nsk-stage { position: relative; width: 100%; height: 420px; border: 1px solid var(--k-line); border-radius: 8px; overflow: hidden; background: #fff; }
.nsk-stage canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; cursor: grab; touch-action: none; }
.nsk-stage canvas:active { cursor: grabbing; }
.nsk-zoom { position: absolute; right: 10px; top: 10px; display: flex; gap: 6px; }
.nsk .nsk-tool, .nsk .nsk-tool:focus {
	display: inline-flex !important; align-items: center !important; justify-content: center !important;
	width: 34px !important; height: 34px !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important;
	border: 1px solid var(--k-line2) !important; border-radius: 7px !important; background: rgba(255,255,255,.94) !important;
	color: var(--k-ink) !important; -webkit-text-fill-color: var(--k-ink) !important; box-shadow: 0 1px 3px rgba(43,52,59,.12) !important;
	font: 600 18px/1 var(--k-font) !important; text-transform: none !important; text-decoration: none !important; letter-spacing: 0 !important; cursor: pointer;
}
.nsk .nsk-tool--wide { width: auto !important; padding: 0 12px !important; font-size: 13px !important; }
.nsk .nsk-tool:hover, .nsk .nsk-tool:active { background: var(--k-soft) !important; border-color: var(--k-accent) !important; color: var(--k-accent-dark) !important; -webkit-text-fill-color: var(--k-accent-dark) !important; }
.nsk .nsk-tool:focus-visible { outline: 2px solid var(--k-accent) !important; outline-offset: 2px !important; }
.nsk-loader { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: rgba(43,52,59,.88); color: #fff; font-size: 13px; font-weight: 600; }
.nsk-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; animation: nsk-spin .7s linear infinite; }
@keyframes nsk-spin { to { transform: rotate(360deg); } }

.nsk-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12.5px; color: var(--k-body); }
.nsk-lg { display: inline-flex; align-items: center; gap: 7px; }
.nsk-lg i { display: inline-block; flex: none; width: 16px; height: 12px; border-radius: 3px; border: 1px solid rgba(43,52,59,.15); }
.nsk-lg i.nsk-ramp { width: 64px; background: linear-gradient(90deg, #FBF3E4, #F1D3A3, #E0A16A, #C46A4A, #8E3B3F, #4A2638); }
.nsk-lg i.nsk-line { width: 18px; height: 0; border: 0; border-top: 2px solid; border-radius: 0; }
.nsk-line--a { border-top-color: rgba(122,62,34,.85) !important; }
.nsk-line--b { border-top-color: rgba(62,84,99,.85) !important; }
.nsk-line--z { border-top: 2px dashed #8E3B3F !important; }
.nsk-lg--stress { display: none; }
.nsk.is-stressmode .nsk-lg--zones { display: none; }
.nsk.is-stressmode .nsk-lg--stress { display: inline-flex; }
.nsk .nsk-hint-line { margin-top: 6px !important; font-size: 11.5px; color: var(--k-muted); }

/* ---------- Адаптивность ---------- */
@media (max-width: 1080px) {
	.nsk-grid { grid-template-columns: 1fr; }
	.nsk-stage-card { position: static; order: -1; }
	.nsk-side { order: 1; }
}
@media (max-width: 640px) {
	.nsk { margin: 8px 0 20px; border-radius: 10px; font-size: 14px; }
	.nsk-head { padding: 16px; margin-bottom: 14px; }
	.nsk-badge { display: none; }
	.nsk .nsk-title { font-size: 18px !important; }
	.nsk .nsk-sub { font-size: 12.5px; }
	.nsk-grid { padding: 0 12px; gap: 14px; }
	.nsk-card { padding: 14px; }
	.nsk .nsk-input input { font-size: 16px !important; }
	.nsk-toolbar { flex-direction: column; align-items: stretch; }
	.nsk-seg { display: grid; width: 100%; max-width: 100%; }
	.nsk-seg span { text-align: center; padding: 7px 8px; }
	.nsk-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
	.nsk-chips::-webkit-scrollbar { display: none; }
	.nsk-chip { flex: none; }
	.nsk-kv dt { font-size: 12px; }
}
@media (max-width: 380px) {
	.nsk-fields { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .nsk * { transition: none !important; animation: none !important; } }
@media print {
	.nsk { border: 0; background: #fff; }
	.nsk-head { background: #fff; border-bottom: 2px solid #2B343B; }
	.nsk .nsk-title { color: #000 !important; -webkit-text-fill-color: #000 !important; }
	.nsk .nsk-sub { color: #333 !important; -webkit-text-fill-color: #333 !important; }
	.nsk-status, .nsk-zoom, .nsk-toolbar, .nsk-hint-line { display: none !important; }
	.nsk-grid { grid-template-columns: 1fr; }
	.nsk-stage-card { position: static; }
	.nsk-card { box-shadow: none; break-inside: avoid; }
}
.nsk.is-stressmode .nsk-line--a { border-top-color: rgba(43,52,59,.6) !important; }
.nsk.is-stressmode .nsk-line--b { border-top-color: #C9B79F !important; }
