/* PDF в Word и Excel — в стиле темы Admin-Lic. Всё изолировано в .apc-app */

.apc-root {
	--apc-card: #252a35;
	--apc-card-2: #2a303c;
	--apc-line: rgba(255, 255, 255, .075);
	--apc-line-2: rgba(255, 255, 255, .12);
	--apc-text: #e3e6ed;
	--apc-muted: #949bab;
	--apc-faint: #6f7686;
	--apc-amber: #845adf;
	--apc-amber-2: #9e7bea;
	--apc-amber-ink: #ffffff;
	--apc-amber-soft: rgba(132, 90, 223, .12);
	--apc-green: #34d399;
	--apc-green-soft: rgba(52, 211, 153, .12);
	--apc-red: #f87171;
	--apc-red-soft: rgba(248, 113, 113, .13);
	--apc-blue: #60a5fa;
	--apc-blue-soft: rgba(96, 165, 250, .12);
	--apc-violet: #a78bfa;
	--apc-violet-soft: rgba(167, 139, 250, .12);
	--apc-well: rgba(0, 0, 0, .2);
	--apc-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 18px 40px -24px rgba(0, 0, 0, .7);
	display: block;
	max-width: 100%;
	color: var(--apc-text);
	font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.45;
}

html[data-theme="light"] .apc-root {
	--apc-card: #fff;
	--apc-card-2: #f9fafc;
	--apc-line: rgba(15, 23, 42, .08);
	--apc-line-2: rgba(15, 23, 42, .14);
	--apc-text: #232a3b;
	--apc-muted: #737985;
	--apc-faint: #98a2b3;
	--apc-amber: #7448d4;
	--apc-amber-2: #845adf;
	--apc-amber-soft: rgba(132, 90, 223, .12);
	--apc-well: rgba(15, 23, 42, .04);
	--apc-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px -20px rgba(15, 23, 42, .25);
}

.apc-app,
.apc-app *,
.apc-app *::before,
.apc-app *::after {
	box-sizing: border-box;
}

.apc-app svg {
	width: 16px;
	height: 16px;
	flex: none;
	display: block;
}

.apc-app h1,
.apc-app h2,
.apc-app h3,
.apc-app p {
	margin: 0;
	padding: 0;
	letter-spacing: normal;
	text-transform: none;
}

.apc-app [hidden] {
	display: none !important;
}

.apc-sr-only {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
	clip: rect(0 0 0 0) !important;
}

/* Шапка */
.apc-head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 18px;
}

.apc-eyebrow {
	color: var(--apc-amber);
	font-size: 11px;
	font-weight: 800;
	letter-spacing: .14em;
	text-transform: uppercase;
	margin-bottom: 4px;
}

.apc-app .apc-title {
	font-size: clamp(22px, 2.4vw, 28px);
	font-weight: 800;
	line-height: 1.15;
	color: var(--apc-text);
	font-family: inherit;
}

.apc-app .apc-sub {
	color: var(--apc-muted);
	margin-top: 6px;
	max-width: 700px;
}

.apc-head-actions {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.apc-pill {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 7px 12px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	color: var(--apc-green);
	background: var(--apc-green-soft);
	border: 1px solid rgba(52, 211, 153, .22);
}

/* Кнопки */
.apc-app button {
	font: inherit;
	margin: 0;
	text-transform: none;
	letter-spacing: normal;
	box-shadow: none;
	min-height: 0;
	line-height: 1.2;
}

.apc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 40px;
	padding: 0 16px;
	border-radius: 11px;
	border: 1px solid var(--apc-line-2);
	background: var(--apc-card-2);
	color: var(--apc-text);
	font-weight: 700;
	font-size: 13.5px;
	cursor: pointer;
	white-space: nowrap;
	transition: background .15s, border-color .15s, transform .1s, opacity .15s, filter .15s;
}

.apc-btn:hover:not(:disabled) {
	border-color: rgba(132, 90, 223, .45);
	background: var(--apc-amber-soft);
}

.apc-btn:active:not(:disabled) {
	transform: translateY(1px);
}

.apc-btn:disabled {
	opacity: .45;
	cursor: not-allowed;
}

.apc-btn--primary {
	background: linear-gradient(180deg, var(--apc-amber-2), var(--apc-amber));
	border-color: transparent;
	color: var(--apc-amber-ink);
	box-shadow: 0 8px 22px -10px rgba(132, 90, 223, .7);
}

.apc-btn--primary:hover:not(:disabled) {
	background: linear-gradient(180deg, #a988f0, var(--apc-amber-2));
	border-color: transparent;
}

.apc-btn--lg {
	height: 46px;
	padding: 0 26px;
	font-size: 14.5px;
}

.apc-btn--ghost {
	background: transparent;
}

.apc-btn--word,
.apc-btn--excel {
	color: #fff;
	border-color: transparent;
}

.apc-btn--word {
	background: linear-gradient(180deg, #3b82f6, #1d5bd8);
	box-shadow: 0 8px 22px -10px rgba(59, 130, 246, .8);
}

.apc-btn--excel {
	background: linear-gradient(180deg, #22a861, #15803d);
	box-shadow: 0 8px 22px -10px rgba(34, 168, 97, .8);
}

.apc-btn--word:hover:not(:disabled),
.apc-btn--excel:hover:not(:disabled) {
	border-color: transparent;
	filter: brightness(1.1);
	background-color: transparent;
}

.apc-btn--word:hover:not(:disabled) {
	background: linear-gradient(180deg, #4d8ff7, #2563eb);
}

.apc-btn--excel:hover:not(:disabled) {
	background: linear-gradient(180deg, #2bbd6e, #16a34a);
}

.apc-app button:focus-visible,
.apc-app input:focus-visible,
.apc-app select:focus-visible {
	outline: 2px solid var(--apc-amber);
	outline-offset: 2px;
}

.apc-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	justify-content: center;
}

.apc-card .apc-actions {
	justify-content: flex-start;
	margin-top: 16px;
}

/* Карточки */
.apc-card {
	background: linear-gradient(180deg, var(--apc-card-2), var(--apc-card));
	border: 1px solid var(--apc-line);
	border-radius: 16px;
	box-shadow: var(--apc-shadow);
	padding: 20px;
	margin-bottom: 16px;
	min-width: 0;
}

.apc-card-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 14px;
	flex-wrap: wrap;
	margin-bottom: 16px;
}

.apc-app .apc-card-head h3 {
	font-size: 16px;
	font-weight: 800;
	color: var(--apc-text);
	font-family: inherit;
	line-height: 1.3;
}

.apc-app .apc-card-head p {
	font-size: 12.5px;
	color: var(--apc-muted);
	margin-top: 3px;
}

/* Загрузка */
.apc-upload {
	padding: 10px;
}

.apc-drop {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 14px;
	padding: 40px 20px 28px;
	border-radius: 12px;
	border: 1.5px dashed var(--apc-line-2);
	background: radial-gradient(600px 220px at 50% 0%, rgba(96, 165, 250, .08), transparent 70%);
	transition: border-color .2s, background-color .2s;
}

.apc-drop.is-over {
	border-color: var(--apc-amber);
	background-color: var(--apc-amber-soft);
}

.apc-drop-icon {
	width: 60px;
	height: 60px;
	border-radius: 18px;
	display: grid;
	place-items: center;
	color: var(--apc-blue);
	background: var(--apc-blue-soft);
	border: 1px solid rgba(96, 165, 250, .3);
	box-shadow: 0 0 40px -6px rgba(96, 165, 250, .45);
}

.apc-drop-icon svg {
	width: 26px;
	height: 26px;
}

.apc-drop-text {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.apc-drop-text strong {
	font-size: 17px;
	font-weight: 800;
}

.apc-drop-text span,
.apc-limits {
	color: var(--apc-muted);
	font-size: 13px;
}

.apc-limits {
	color: var(--apc-faint);
	font-size: 12px;
}

.apc-file {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	max-width: 100%;
	padding: 8px 14px;
	border-radius: 10px;
	background: var(--apc-card-2);
	border: 1px solid var(--apc-line-2);
	font-weight: 700;
}

.apc-file svg {
	color: var(--apc-amber);
}

.apc-file span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	min-width: 0;
}

.apc-file em {
	font-style: normal;
	font-weight: 500;
	font-size: 12px;
	color: var(--apc-muted);
}

.apc-error {
	margin: 10px;
	padding: 12px 14px;
	border-radius: 10px;
	color: var(--apc-red);
	background: var(--apc-red-soft);
	border: 1px solid rgba(248, 113, 113, .3);
	font-weight: 600;
	font-size: 13px;
}

/* KPI */
.apc-kpis {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 14px;
	margin-bottom: 16px;
}

.apc-kpi {
	--tone: var(--apc-amber);
	--tone-soft: var(--apc-amber-soft);
	display: flex;
	gap: 14px;
	align-items: flex-start;
	padding: 16px 16px 16px 18px;
	border-radius: 14px;
	border: 1px solid var(--apc-line);
	background: linear-gradient(180deg, var(--apc-card-2), var(--apc-card));
	box-shadow: inset 2px 0 0 var(--tone), var(--apc-shadow);
	min-width: 0;
}

.apc-kpi--blue { --tone: var(--apc-blue); --tone-soft: var(--apc-blue-soft); }
.apc-kpi--green { --tone: var(--apc-green); --tone-soft: var(--apc-green-soft); }
.apc-kpi--violet { --tone: var(--apc-violet); --tone-soft: var(--apc-violet-soft); }

.apc-kpi-ic {
	width: 36px;
	height: 36px;
	border-radius: 10px;
	display: grid;
	place-items: center;
	flex: none;
	color: var(--tone);
	background: var(--tone-soft);
}

.apc-kpi-body {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.apc-kpi-body span {
	font-size: 12px;
	color: var(--apc-muted);
	font-weight: 600;
}

.apc-kpi-body b {
	font-size: 20px;
	font-weight: 800;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.apc-kpi-body small {
	font-size: 11.5px;
	color: var(--apc-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Поля */
.apc-fields {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 12px;
}

.apc-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 0;
	min-width: 0;
}

.apc-field > span {
	font-size: 11.5px;
	font-weight: 700;
	color: var(--apc-muted);
}

.apc-app .apc-field input,
.apc-app .apc-field select {
	width: 100%;
	height: 40px;
	padding: 0 12px;
	margin: 0;
	border-radius: 10px;
	border: 1px solid var(--apc-line-2);
	background-color: var(--apc-well);
	color: var(--apc-text);
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	box-shadow: none;
}

html[data-theme="light"] .apc-app .apc-field input,
html[data-theme="light"] .apc-app .apc-field select {
	background-color: #fff;
}

.apc-app .apc-field select option {
	background: var(--apc-card);
	color: var(--apc-text);
}

/* Прогресс */
.apc-progress {
	margin-top: 16px;
}

.apc-progress-top {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	font-size: 12.5px;
	font-weight: 700;
	margin-bottom: 8px;
}

.apc-progress-top span:last-child {
	color: var(--apc-amber);
	font-variant-numeric: tabular-nums;
}

.apc-bar {
	position: relative;
	height: 6px;
	border-radius: 99px;
	background: var(--apc-well);
	overflow: hidden;
}

.apc-bar i {
	position: absolute;
	inset: 0 auto 0 0;
	width: 0;
	border-radius: inherit;
	background: linear-gradient(90deg, var(--apc-amber), var(--apc-amber-2));
	box-shadow: 0 0 14px rgba(132, 90, 223, .6);
	transition: width .2s ease;
}

.apc-bar.is-indeterminate i {
	width: 35% !important;
	animation: apc-indet 1.1s ease-in-out infinite;
}

@keyframes apc-indet {
	0% { left: -35%; }
	100% { left: 100%; }
}

/* Переключатель вида */
.apc-seg {
	display: inline-flex;
	padding: 3px;
	border-radius: 11px;
	background: var(--apc-well);
	border: 1px solid var(--apc-line);
}

.apc-app .apc-seg button {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	border: 0;
	background: transparent;
	color: var(--apc-muted);
	font-weight: 700;
	font-size: 12.5px;
	padding: 7px 12px;
	border-radius: 8px;
	cursor: pointer;
}

.apc-app .apc-seg button.is-active {
	color: var(--apc-amber);
	background: var(--apc-amber-soft);
}

/* Предпросмотр: «лист бумаги» */
.apc-preview {
	max-height: 560px;
	overflow: auto;
	padding: 28px 32px;
	border-radius: 12px;
	background: #fff;
	color: #1f2937;
	font-family: Calibri, "Segoe UI", Arial, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}

.apc-preview p {
	margin: 0 0 10px !important;
	color: #1f2937;
}

.apc-preview h3,
.apc-preview h4 {
	margin: 16px 0 8px;
	color: #111827;
	font-family: inherit;
	line-height: 1.25;
}

.apc-preview h3 {
	font-size: 20px;
}

.apc-preview h4 {
	font-size: 16px;
}

.apc-pagebreak {
	position: relative;
	margin: 22px 0;
	text-align: center;
	font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	color: #9ca3af;
}

.apc-pagebreak::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	border-top: 1px dashed #d1d5db;
}

.apc-pagebreak {
	background: linear-gradient(#fff, #fff) center / 120px 100% no-repeat;
}

.apc-table-wrap {
	overflow-x: auto;
	margin: 0 0 12px;
}

.apc-table {
	border-collapse: collapse;
	font-size: 13px;
	min-width: 50%;
}

.apc-table td,
.apc-table th {
	border: 1px solid #cbd5e1;
	padding: 4px 8px;
	vertical-align: top;
	color: #1f2937;
	text-align: left;
}

.apc-table--sheet th {
	background: #f1f5f9;
	color: #64748b;
	font-weight: 600;
	font-size: 11.5px;
	text-align: center;
}

.apc-table td.is-num {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.apc-sheet-note {
	margin-bottom: 10px;
	font-size: 12px;
	font-weight: 700;
	color: #16a34a;
}

.apc-note {
	margin-top: 14px !important;
	font-size: 12px;
	color: var(--apc-faint);
}

/* Тост */
.apc-toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	z-index: 100002;
	max-width: min(620px, calc(100vw - 32px));
	padding: 12px 16px;
	border-radius: 12px;
	font-weight: 700;
	font-size: 13px;
	color: var(--apc-text);
	background: var(--apc-card-2);
	border: 1px solid var(--apc-line-2);
	box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .6);
	transform: translate(-50%, 20px);
	opacity: 0;
	pointer-events: none;
	transition: opacity .2s, transform .2s;
}

.apc-toast.is-show {
	opacity: 1;
	transform: translate(-50%, 0);
}

.apc-toast.is-ok {
	border-color: rgba(52, 211, 153, .45);
}

.apc-toast.is-error {
	border-color: rgba(248, 113, 113, .55);
	color: var(--apc-red);
}

@media (max-width: 1100px) {
	.apc-kpis {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.apc-fields {
		grid-template-columns: 1fr 1fr;
	}
}

@media (max-width: 640px) {
	.apc-card {
		padding: 16px;
	}

	.apc-kpi-ic {
		display: none;
	}

	.apc-fields {
		grid-template-columns: 1fr;
	}

	.apc-preview {
		padding: 16px;
	}

	.apc-card .apc-actions .apc-btn {
		flex: 1 1 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.apc-app *,
	.apc-app *::before,
	.apc-app *::after {
		animation: none !important;
		transition: none !important;
	}
}
