/* Статичний візуал під мобільний кабінет (TMA / partner) */
:root {
	--tg-content-safe-top: env(safe-area-inset-top, 0px);
	--tg-content-safe-bottom: env(safe-area-inset-bottom, 0px);
	--tg-content-safe-left: env(safe-area-inset-left, 0px);
	--tg-content-safe-right: env(safe-area-inset-right, 0px);
	--bg-page: #f3f4f6;
	--bg-card: #fff;
	--border: #e5e7eb;
	--text: #111827;
	--text-muted: #6b7280;
	--blue: #2563eb;
	--blue-dark: #1d4ed8;
	--green: #22c55e;
	--green-dark: #16a34a;
	--radius: 12px;
	--radius-sm: 8px;
	--shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
	--font-base: "Roboto", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
	--font-display: "Exo 2", "Roboto", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
	font-family: var(--font-base);
}

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

body {
	margin: 0;
	background: var(--bg-page);
	color: var(--text);
	min-height: 100dvh;
	-webkit-tap-highlight-color: transparent;
}

.scanner-backdrop {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	z-index: 400;
}

.scanner-backdrop.is-open {
	display: block;
}

.scanner {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 401;
	background: #000;
	color: #fff;
}

.scanner.is-open {
	display: flex;
	flex-direction: column;
}

.scanner__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: calc(14px + var(--tg-content-safe-top)) calc(16px + var(--tg-content-safe-right))
		14px calc(16px + var(--tg-content-safe-left));
	background: rgba(0, 0, 0, 0.7);
}

.scanner__title {
	font-family: var(--font-base);
	font-weight: 500;
	font-size: 16px;
}

.scanner__close {
	width: 40px;
	height: 40px;
	border-radius: 20px;
	border: 1px solid rgba(255, 255, 255, 0.35);
	background: transparent;
	color: #fff;
	cursor: pointer;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.scanner__close-icon {
	display: block;
	width: 40px;
	height: 40px;
	filter: invert(1) brightness(2);
}

.scanner__viewport {
	flex: 1;
	position: relative;
	overflow: hidden;
}

.scanner__video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.scanner__frame {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	/* Narrow rectangular frame to avoid extra text */
	width: min(300px, 70vw);
	height: min(84px, 18vh);
	border: 2px solid rgba(255, 255, 255, 0.85);
	border-radius: 6px;
	box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
}

.scanner__hint {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	bottom: 18px;
	font-family: var(--font-base);
	font-size: 13px;
	color: rgba(255, 255, 255, 0.9);
	background: rgba(0, 0, 0, 0.55);
	padding: 8px 10px;
	border-radius: 10px;
}

.scanner__bottom {
	padding: 14px 16px 18px;
	background: rgba(0, 0, 0, 0.7);
	display: grid;
	gap: 8px;
}

.scanner__btn {
	height: 48px;
	border-radius: 10px;
	border: none;
	background: #fff;
	color: #111827;
	font-family: var(--font-base);
	font-weight: 600;
	font-size: 16px;
	cursor: pointer;
}

.scanner__status {
	min-height: 18px;
	font-family: var(--font-base);
	font-size: 13px;
	color: rgba(255, 255, 255, 0.85);
}

.scanner__canvas {
	display: none;
}

.confirm-backdrop {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	z-index: 300;
}

.confirm-backdrop.is-open {
	display: block;
}

.confirm {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 301;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.confirm.is-open {
	display: flex;
}

.confirm__card {
	width: min(560px, 100%);
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
	padding: 18px 22px 18px;
}

.confirm__title {
	font-family: var(--font-base);
	font-weight: 400;
	font-size: 15px;
	line-height: normal;
	color: #111827;
	margin: 0 0 16px;
	text-align: center;
}

.confirm__actions {
	display: flex;
	justify-content: center;
	gap: 18px;
	padding-top: 4px;
}

.confirm__btn {
	width: 90px;
	height: 56px;
	border-radius: 6px;
	border: 1px solid #e5e7eb;
	font-family: var(--font-base);
	font-weight: 600;
	font-size: 18px;
	cursor: pointer;
}

.confirm__btn--no {
	background: #f1f1f1;
	color: #111827;
}

.confirm__btn--yes {
	color: #fff;
	background: linear-gradient(90deg, #55969a 0%, #1fba59 100%);
}

.panel-backdrop {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.15);
	z-index: 200;
}

.panel-backdrop.is-open {
	display: block;
}

.panel {
	position: fixed;
	inset: 0;
	background: #fff;
	z-index: 201;
	transform: translateX(100%);
	transition: transform 0.22s ease;
	display: flex;
	flex-direction: column;
}

.panel.is-open {
	transform: translateX(0);
}

.panel__header {
	position: relative;
	padding: calc(18px + var(--tg-content-safe-top)) calc(22px + var(--tg-content-safe-right)) 20px
		calc(22px + var(--tg-content-safe-left)) !important;
	min-height: calc(124px + var(--tg-content-safe-top)); /* щоб форма не залазила на заголовок */
}

.panel__title {
	margin: 0;
	font-family: var(--font-display);
	font-weight: 500; /* Exo 2 Medium */
	font-size: 28px;
	line-height: 32px;
	letter-spacing: 0;
	position: absolute;
	top: calc(72px + var(--tg-content-safe-top));
	left: 50%;
	transform: translateX(-50%);
	text-align: center;
	white-space: nowrap;
	margin-top: 0 !important;
	color: #000;
	font-synthesis: none;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

.panel__close {
	position: absolute;
	top: 18px;
	right: 22px;
	width: 40px;
	height: 40px;
	border-radius: 20px;
	border: 1px solid #c9d3e7;
	background: #fff;
	cursor: pointer;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.panel__close-icon {
	display: block;
	width: 40px;
	height: 40px;
}

.panel__body {
	padding: 0 22px 18px !important;
	display: grid;
	gap: 16px !important;
	flex: 1 1 auto;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.inst-list {
	display: grid;
	gap: 14px;
}

.inst.inst-card,
.inst-card {
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	padding: 12px 14px 14px;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.inst-card__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 12px;
	min-height: 36px;
}

.inst-card__title {
	font-family: var(--font-display);
	font-weight: 500;
	font-size: 14px;
	line-height: 1.2;
	color: #374151;
}

.inst-card__remove {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	margin: -4px -6px -4px 0;
	padding: 0;
	border: none;
	background: transparent;
	border-radius: 8px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #9ca3af;
	-webkit-tap-highlight-color: transparent;
}

.inst-card__remove:hover {
	background: rgba(239, 68, 68, 0.1);
	color: #dc2626;
}

.inst-card__remove:active {
	background: rgba(239, 68, 68, 0.18);
}

.inst-card__remove-icon {
	display: block;
}

.inst-card__body {
	display: grid;
	gap: 16px;
}

.field {
	display: grid;
	gap: 8px !important;
}

.field__label {
	font-family: var(--font-base);
	font-weight: 400;
	color: #8f939b;
	font-size: 13px;
	line-height: normal;
}

.field__input,
.field__select {
	width: 100%;
	height: 44px;
	border: 1px solid #c9d3e7;
	border-radius: 4px;
	padding: 10px 14px;
	font-family: var(--font-base);
	font-weight: 400;
	font-size: 15px;
	line-height: normal;
	outline: none;
	background: #fff;
}

.field__control {
	position: relative;
}

.field__error {
	display: none;
	margin-top: 6px;
	font-family: var(--font-base);
	font-weight: 400;
	font-size: 12px;
	line-height: 1.2;
	color: #e31e24;
	white-space: pre-line;
	word-break: break-word;
}

.field__input.is-error {
	border-color: #e31e24;
}

.field__error.is-active {
	display: block;
}

.verify-help {
	background: #f3f4f6;
	border-radius: 4px;
	padding: 14px 12px 14px;
	text-align: center;
}

.verify-help__text {
	font-family: var(--font-base);
	font-weight: 400;
	font-size: 13px;
	line-height: 1.25;
	color: #6b7280;
	margin-bottom: 10px;
}

.verify-help__link {
	display: inline-block;
	font-family: var(--font-base);
	font-weight: 600;
	font-size: 16px;
	color: #1fba59;
	text-decoration: none;
}

.verify-help__link:active {
	opacity: 0.8;
}

.after-verify {
	display: grid;
	gap: 16px;
}

/* [hidden] інакше перебивається правилом display: grid вище */
.after-verify[hidden] {
	display: none !important;
}

[data-client-sms-field][hidden] {
	display: none !important;
}

[data-manager-field][hidden] {
	display: none !important;
}

.after-verify__title {
	margin: 0;
	font-family: var(--font-display);
	font-weight: 500;
	font-size: 18px;
	line-height: 24px;
	color: #111827;
}

.panel__footer {
	position: sticky;
	bottom: 0;
	z-index: 20;
	display: flex;
	flex-direction: column;
	gap: 0;
	padding: 0;
	margin: 0;
	flex-shrink: 0;
}

.panel__footer-slot {
	display: grid;
	grid-template-columns: 1fr;
}

.panel__footer-slot > .btn {
	grid-row: 1;
	grid-column: 1;
	width: 100%;
}

.panel__footer-slot > [hidden] {
	display: none !important;
}

.panel__footer::before {
	content: "";
	position: absolute;
	left: -22px;
	right: -22px;
	top: 0;
	bottom: 0;
	background: #fff;
	box-shadow: 0 -8px 18px rgba(17, 24, 39, 0.08);
	z-index: -1;
}

.inst-card__remove:disabled {
	opacity: 0.35;
	cursor: not-allowed;
	pointer-events: none;
}

#add-panel form.is-post-verify .inst-card__body [data-inst-serial],
#add-panel form.is-post-verify .inst-card__body [data-inst-secret] {
	background: #f3f4f6;
	color: #4b5563;
	cursor: default;
}

#add-panel form.add-panel__form {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
	overflow: hidden;
	padding: 0 22px 18px !important;
	gap: 0 !important;
}

.add-panel__scroll {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	display: grid;
	gap: 16px;
	align-content: start;
	padding-bottom: 8px;
}

#add-panel .panel__footer {
	position: relative;
	bottom: auto;
	padding-top: 8px;
	margin-top: auto;
}

.panel__footer .btn--primary,
.panel__footer .btn--register {
	width: 100%;
	box-sizing: border-box;
}

#add-panel .panel__footer .btn--primary {
	height: 52px;
	border-radius: 6px;
	font-weight: 600;
}

#add-panel .panel__footer .btn--register {
	height: 52px;
	border-radius: 6px;
	font-weight: 600;
}

.btn--register {
	height: 52px;
	border-radius: 6px;
	background: #aeb1b4;
	color: #fff;
	font-weight: 600;
}

.btn--register:disabled {
	opacity: 1;
}

.btn--register:not(:disabled) {
	background: linear-gradient(90deg, #55969a 0%, #1fba59 100%);
}

.btn--register[hidden],
[data-btn-register][hidden] {
	display: none !important;
}

.field__input.is-locked,
#add-panel form.is-sms-sent [data-client-phone] {
	background: #f3f4f6;
	color: #4b5563;
	cursor: default;
}

.tma-toast {
	position: fixed;
	left: 50%;
	bottom: calc(18px + var(--tg-content-safe-bottom, env(safe-area-inset-bottom, 0px)));
	transform: translateX(-50%) translateY(12px);
	z-index: 400;
	max-width: min(420px, calc(100vw - 32px));
	padding: 12px 16px;
	border-radius: 8px;
	background: #111827;
	color: #fff;
	font-family: var(--font-base);
	font-size: 14px;
	line-height: 1.35;
	text-align: center;
	box-shadow: 0 8px 24px rgba(17, 24, 39, 0.28);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.tma-toast.is-visible {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

.tma-toast--error {
	background: #b91c1c;
}

.field__control .field__input {
	padding-right: 44px;
}

.scan-btn {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
	width: 32px;
	height: 32px;
	border: none;
	background: transparent;
	padding: 0;
	border-radius: 6px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.scan-btn:active {
	background: rgba(0, 0, 0, 0.04);
}

.field__select:disabled {
	background-color: #ffffff; /* у макеті виглядає як звичайне поле */
	border-color: #e5e7eb;
	color: #b2b3b3;
	cursor: default;
}

.field__select:disabled option {
	color: #b2b3b3;
}

.req {
	color: #e31e24;
	font-weight: 500;
}

.field__input::placeholder {
	color: #b2b3b3;
}

.btn {
	width: 100%;
	height: 48px;
	border-radius: 4px;
	border: 1px solid transparent;
	font-family: var(--font-base);
	font-weight: 500;
	font-size: 15px;
	line-height: normal;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
}

.btn--ghost {
	height: 46px;
	background: #efefef;
	border-color: #efefef;
	color: #b2b3b3;
}

.btn--ghost:disabled {
	opacity: 1;
}

.btn--ghost:not(:disabled) {
	background: #f3f4f6;
	border-color: #f3f4f6;
	color: #111827;
	font-weight: 600;
}

.btn--ghost:not(:disabled) .btn__icon {
	color: #e31e24;
}

.btn__icon {
	font-size: 18px;
	line-height: 1;
	color: #b2b3b3;
}

.btn--primary {
	height: 48px;
	background: #aeb1b4;
	color: #fff;
	font-weight: 500; /* Roboto Medium */
}

.btn--primary:not(:disabled) {
	background: linear-gradient(90deg, #55969a 0%, #1fba59 100%);
}

.field__select {
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath fill='%239CA3AF' d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 36px;
}

.manager-select {
	position: relative;
}

.manager-select__btn {
	width: 100%;
	height: 44px;
	border: 1px solid #c9d3e7;
	border-radius: 4px;
	background: #fff;
	padding: 10px 14px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	font-family: var(--font-base);
	font-weight: 400;
	font-size: 15px;
	cursor: pointer;
}

.manager-select__left {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.manager-select__value {
	color: #111827;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.manager-select__chev {
	width: 14px;
	height: 14px;
	flex: 0 0 auto;
	background: center / contain no-repeat
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath fill='%239CA3AF' d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
}

.manager-select__menu {
	display: none;
	position: absolute;
	left: 0;
	right: 0;
	top: calc(100% + 8px);
	background: #fff;
	border: 1px solid #c9d3e7;
	border-radius: 6px;
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
	padding: 8px;
	z-index: 260;
}

.manager-select.is-open .manager-select__menu {
	display: block;
}

.manager-select__item {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 10px;
	border: none;
	background: #fff;
	border-radius: 6px;
	cursor: pointer;
}

.manager-select__item:active {
	background: #f3f4f6;
}

.manager-select__avatar {
	width: 32px;
	height: 32px;
	border-radius: 16px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(90deg, #55969a 0%, #1fba59 100%);
	color: #fff;
	font-family: var(--font-base);
	font-weight: 700;
	font-size: 12px;
}

.manager-select__avatar--btn {
	flex: 0 0 auto;
}

.manager-select__name {
	font-family: var(--font-base);
	font-weight: 500;
	font-size: 14px;
	color: #111827;
}

.app {
	max-width: 430px;
	margin: 0 auto;
	min-height: 100dvh;
	background: var(--bg-page);
	position: relative;
}

/* Drawer */
.drawer-backdrop {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.35);
	z-index: 100;
}

.drawer-backdrop.is-open {
	display: block;
}

.drawer {
	position: fixed;
	top: 0;
	left: 0;
	width: min(300px, 86vw);
	height: 100dvh;
	padding-top: var(--tg-content-safe-top);
	background: var(--bg-card);
	z-index: 101;
	transform: translateX(-100%);
	transition: transform 0.2s ease;
	box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
	display: flex;
	flex-direction: column;
}

.drawer.is-open {
	transform: translateX(0);
}

.drawer__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px calc(16px + var(--tg-content-safe-right)) 12px calc(16px + var(--tg-content-safe-left));
	border-bottom: 1px solid var(--border);
}

.drawer__logo {
	font-weight: 800;
	font-size: 1.25rem;
	color: var(--blue);
	letter-spacing: 0.02em;
}

.brand-logo {
	display: block;
	height: 22px;
	width: auto;
}

.top-bar__logo .brand-logo {
	height: 20px;
	margin: 0 auto;
}

.drawer__close {
	font-size: 1.5rem;
	line-height: 1;
	padding: 4px 8px;
}

.drawer__nav {
	padding: 12px 0;
	overflow-y: auto;
	flex: 1;
}

.drawer__link {
	display: block;
	padding: 12px 20px;
	color: var(--text);
	text-decoration: none;
	font-size: 0.95rem;
	border-left: 3px solid transparent;
}

.drawer__link:hover {
	background: #f9fafb;
}

.drawer__link--active {
	font-weight: 600;
	border-left-color: var(--blue);
	background: #eff6ff;
}

.drawer__link--danger {
	color: #b91c1c;
	margin-top: 8px;
	border-top: 1px solid var(--border);
}

/* Top bar */
.main {
	padding-bottom: 24px;
}

.top-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: calc(10px + var(--tg-content-safe-top)) calc(12px + var(--tg-content-safe-right))
		10px calc(12px + var(--tg-content-safe-left));
	background: #ffffff;
	border-bottom: none;
	box-shadow: none;
	position: sticky;
	top: 0;
	z-index: 50;
}

.top-bar__logo {
	flex: 0 0 auto;
	margin-right: auto;
	display: flex;
	align-items: center;
}

.top-bar__actions {
	display: flex;
	align-items: center;
	gap: 10px;
}

.icon-btn {
	border: none;
	background: transparent;
	padding: 8px;
	cursor: pointer;
	border-radius: var(--radius-sm);
	font-size: 1.1rem;
	line-height: 1;
	color: var(--text);
}

.is-hidden {
	display: none !important;
}

.icon-btn:active {
	opacity: 0.85;
}

.icon-btn--square {
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
	padding: 0;
}

.action-icon {
	display: block;
	width: 44px;
	height: 44px;
	margin: 0;
	user-select: none;
	pointer-events: none;
}

/* У кнопок фон "всередині" SVG (градієнт), тож тут лишаємо прозоро */

.icon-btn--bell {
	position: relative;
	padding: 8px 10px;
}

.bell-icon {
	display: inline-block;
	width: 22px;
	height: 22px;
	border: 2px solid var(--text);
	border-radius: 10px 10px 0 0;
	border-bottom: none;
	position: relative;
}

.bell-icon::after {
	content: "";
	position: absolute;
	left: 50%;
	bottom: -4px;
	transform: translateX(-50%);
	width: 8px;
	height: 4px;
	background: var(--text);
	border-radius: 0 0 4px 4px;
}

.badge {
	position: absolute;
	top: 2px;
	right: 2px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	font-size: 11px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
	background: #ef4444;
	color: #fff;
	border-radius: 9px;
}

.hamburger {
	display: block;
	width: 20px;
	height: 2px;
	background: var(--text);
	box-shadow: 0 6px 0 var(--text), 0 -6px 0 var(--text);
	border-radius: 1px;
}

/* Search */
.search-wrap {
	padding: 10px 12px 14px;
	background: var(--bg-card);
	box-shadow: 0 6px 18px rgba(17, 24, 39, 0.12);
	position: relative;
	z-index: 1;
}

.search-bar {
	display: flex;
	align-items: stretch;
	background: #fff;
	border: 1px solid #d1d5db;
	border-radius: var(--radius);
	overflow: hidden;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-bar.is-active {
	border-color: #374151;
	box-shadow: 0 0 0 1px rgba(55, 65, 81, 0.15);
}

.search,
.search__field {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 1 1 auto;
	min-width: 0;
	padding: 8px 12px;
	background: #fff;
}

.search__icon {
	width: 20px;
	height: 20px;
	opacity: 0.55;
	flex: 0 0 auto;
}

.search__input {
	flex: 1;
	border: none;
	background: transparent;
	font-size: 0.9rem;
	color: var(--text);
	min-width: 0;
	font-family: var(--font-base);
	font-weight: 400;
}

.search__input::placeholder {
	color: var(--text-muted);
}

.search__input:focus {
	outline: none;
}

.search__submit {
	flex: 0 0 auto;
	display: none;
	align-items: center;
	justify-content: center;
	min-width: 88px;
	padding: 0 18px;
	border: none;
	border-left: 1px solid #e5e7eb;
	background: linear-gradient(90deg, #55969a 0%, #1fba59 100%);
	color: #fff;
	font-family: var(--font-base);
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.search-bar.is-active .search__submit {
	display: inline-flex;
}

.search__submit:active {
	opacity: 0.92;
}

/* Content */
.content {
	padding: 8px 12px 24px;
}

.page-header {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
}

.page-back {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	margin: 0;
	padding: 2px 6px 2px 0;
	border: none;
	background: transparent;
	color: #6b7280;
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1.25;
	font-family: var(--font-body, "Roboto", sans-serif);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.page-back[hidden] {
	display: none !important;
}

.page-back:active {
	color: #374151;
}

.page-back__icon {
	flex-shrink: 0;
	margin-left: -2px;
}

.page-title {
	font-size: 1.5rem;
	font-weight: 500;
	margin: 0 0 16px;
	letter-spacing: -0.02em;
	font-family: var(--font-display);
}

/* Повноекранний оверлей: (1) сторінка під ним (2) шар розмиття (3) індикатор по центру */
.page-loading {
	position: fixed;
	inset: 0;
	z-index: 350;
	isolation: isolate;
	transform: translateZ(0);
	-webkit-transform: translateZ(0);
}

.page-loading[hidden] {
	display: none !important;
}

.page-loading:not([hidden]) {
	display: flex;
	align-items: center;
	justify-content: center;
}

.page-loading__blur {
	position: absolute;
	inset: 0;
	z-index: 0;
	background: rgba(243, 244, 246, 0.08);
	backdrop-filter: blur(4px) saturate(1.05);
	-webkit-backdrop-filter: blur(4px) saturate(1.05);
}

.page-loading__center {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

.page-loading__glass {
	pointer-events: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: none;
	box-shadow: none;
	padding: 0;
	width: auto;
	height: auto;
	border-radius: 0;
}

.page-loading__spinner {
	width: 32px;
	height: 32px;
	border: 3px solid rgba(37, 99, 235, 0.22);
	border-top-color: var(--blue);
	border-radius: 50%;
	animation: page-loading-spin 0.7s linear infinite;
}

@keyframes page-loading-spin {
	to {
		transform: rotate(360deg);
	}
}

.tma-auth-gate {
	position: fixed;
	inset: 0;
	z-index: 2000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: calc(24px + var(--tg-content-safe-top)) calc(16px + var(--tg-content-safe-right))
		calc(24px + var(--tg-content-safe-bottom)) calc(16px + var(--tg-content-safe-left));
	background: var(--bg, #f3f4f6);
}

.tma-auth-gate[hidden] {
	display: none !important;
}

.tma-auth-gate__card {
	max-width: 360px;
	width: 100%;
	text-align: center;
	background: var(--bg-card, #fff);
	border: 1px solid var(--border, #e5e7eb);
	border-radius: var(--radius, 12px);
	padding: 28px 20px;
	box-shadow: var(--shadow, 0 4px 24px rgba(0, 0, 0, 0.08));
}

.tma-auth-gate__logo {
	display: block;
	margin: 0 auto 16px;
	height: 40px;
	width: auto;
}

.tma-auth-gate__title {
	margin: 0 0 12px;
	font-family: "Exo 2", system-ui, sans-serif;
	font-size: 1.15rem;
	font-weight: 500;
	color: var(--text, #111827);
}

.tma-auth-gate__text {
	margin: 0;
	font-size: 0.95rem;
	line-height: 1.45;
	color: #4b5563;
}

.app[aria-hidden="true"] {
	visibility: hidden;
	pointer-events: none;
}

.stats-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	margin-bottom: 20px;
}

.stat-card {
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 12px;
	box-shadow: var(--shadow);
}

.stat-card__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 6px;
	margin-bottom: 8px;
}

.stat-card__value-wrap {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.stat-card__label {
	font-size: 0.72rem;
	line-height: 1.25;
	color: var(--text-muted);
	font-family: var(--font-base);
	font-weight: 400;
}

.info-hint {
	width: 18px;
	height: 18px;
	padding: 0;
	border: 1px solid #a6a9ab;
	border-radius: 50%;
	background: transparent;
	font-size: 12px;
	font-weight: 400;
	color: #a6a9ab;
	cursor: default;
	flex-shrink: 0;
	font-family: var(--font-base);
}

.stat-card__value-wrap .info-hint {
	width: 12px;
	height: 12px;
	font-size: 8px;
	line-height: 12px;
	border-width: 1px;
	margin-top: 2px;
}

.tooltip__body {
	display: none;
	position: absolute;
	top: 30px;
	left: 0;
	min-width: 220px;
	max-width: 260px;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
	padding: 10px 10px 12px;
	z-index: 20;
}

.tooltip__body.is-active {
	display: block;
}

.tooltip__body-inner {
	position: relative;
	padding-right: 22px;
}

.tooltip__close {
	position: absolute;
	top: -2px;
	right: -2px;
	width: 24px;
	height: 24px;
	border: none;
	background: transparent;
	padding: 0;
	cursor: pointer;
}

.tooltip__content p {
	margin: 0;
	font-family: var(--font-base);
	font-weight: 400;
	font-size: 0.82rem;
	line-height: 1.25;
	color: #111827;
	white-space: pre-line;
}

.tooltip__title {
	font-family: var(--font-base);
	font-weight: 500;
	font-size: 0.82rem;
	line-height: 1.25;
	color: #111827;
	margin: 0 0 6px 0;
}

.stat-card__value-wrap {
	position: relative;
}

/* Tooltip centered on mobile (iPhone) */
@media (max-width: 480px) {
	.tooltip__body {
		position: fixed;
		inset: 0;
		top: 0;
		left: 0;
		min-width: 0;
		max-width: none;
		background: rgba(0, 0, 0, 0.45);
		border: none;
		border-radius: 0;
		box-shadow: none;
		padding: 16px;
		z-index: 500;
	}

	.tooltip__body.is-active {
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.tooltip__body-inner {
		width: min(340px, 100%);
		background: #fff;
		border: 1px solid #e5e7eb;
		border-radius: 10px;
		box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
		padding: 14px 14px 14px;
	}

	.tooltip__close {
		top: 6px;
		right: 6px;
	}
}

.stat-card__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.stat-card__value {
	font-size: 1.5rem;
	font-weight: 500;
	letter-spacing: -0.03em;
	font-family: var(--font-display);
	line-height: 29px;
}

.stat-card__icon {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	background: transparent;
}

.stat-icon {
	display: block;
	width: 40px;
	height: 40px;
}

/* Level */
.level-block {
	margin-bottom: 20px;
}

.level-block__label {
	font-size: 0.85rem;
	color: var(--text-muted);
	margin-bottom: 8px;
	font-family: var(--font-base);
	font-weight: 400;
}

.level-badge {
	display: inline-flex;
	align-items: center;
	justify-content: flex-start;
	height: 44px;
}

.level-badge__img {
	display: block;
	height: 44px;
	width: auto;
}

/* Table */
.table-section {
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
	box-shadow: var(--shadow);
}

.table-section__title {
	font-size: 1rem;
	font-weight: 500;
	margin: 0;
	padding: 14px 12px;
	border-bottom: 1px solid var(--border);
	font-family: var(--font-display);
}

.table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.data-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95rem;
	line-height: 1.35;
	min-width: 920px; /* щоб таблиця точно скролилась на мобільному */
}

.data-table thead th {
	text-align: center;
	vertical-align: middle;
	padding: 20px 12px;
	min-height: 70px;
	background: #f3f4f6;
	color: var(--text-muted);
	font-weight: 500;
	font-size: 0.9rem;
	line-height: 1.3;
	font-family: var(--font-base);
}

.data-table thead th[data-sort-col] {
	cursor: pointer;
	user-select: none;
}

.data-table thead th .th-inner {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	max-width: 100%;
	vertical-align: middle;
}

.data-table thead th .th-label {
	text-align: center;
	white-space: normal;
	word-break: break-word;
	overflow-wrap: break-word;
}

.data-table thead th .th-label--nowrap {
	white-space: nowrap;
	word-break: normal;
	overflow-wrap: normal;
}

.data-table thead th .th-label--break {
	word-break: normal;
	overflow-wrap: normal;
}

.data-table__empty td {
	text-align: center;
	vertical-align: middle;
	padding: 24px 12px;
	color: var(--text-muted);
	font-size: 0.95rem;
}

.data-table thead th .sort-icon {
	flex: 0 0 14px;
	width: 14px;
	height: 14px;
	margin: 0;
	opacity: 1;
	align-self: center;
}

.data-table tbody td {
	padding: 20px 12px;
	min-height: 102px;
	border-bottom: 1px solid var(--border);
	text-align: center;
	vertical-align: middle;
	box-sizing: border-box;
}

.data-table tbody td.cell-client {
	line-height: 1.35;
}

.cell-client__name {
	display: block;
}

.cell-client__phone {
	display: block;
	margin-top: 10px;
	font-size: 0.92em;
	color: var(--text-muted);
}

.data-table tbody td.cell-seller {
	line-height: 1.35;
}

.cell-seller__name {
	display: block;
}

.cell-seller__id {
	display: block;
	font-size: 0.92em;
	color: var(--text-muted);
}

.data-table tbody tr:nth-child(odd) {
	background: #ffffff;
}

.data-table tbody tr:nth-child(even) {
	background: #f3f4f6;
}

.data-table thead th:nth-child(1),
.data-table tbody td:nth-child(1) {
	min-width: 164px;
	width: 164px;
}

.pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 6px;
	padding: 12px;
	border-top: 1px solid var(--border);
	background: var(--bg-card);
}

.page-btn {
	min-width: 36px;
	height: 36px;
	padding: 0 10px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: #fff;
	font-size: 0.9rem;
	cursor: pointer;
}

.page-btn--current {
	background: var(--text);
	color: #fff;
	border-color: var(--text);
}

.page-ellipsis {
	padding: 0 4px;
	color: var(--text-muted);
}
