/* ==========================================================================
   Avir UI kit — shared by the admin panel and the client portal.
   Tokens and components inspired by Chakra UI / Material UI.
   ========================================================================== */

:root {
	--ahp-brand-50: #e7f5f4;
	--ahp-brand-100: #c4e6e4;
	--ahp-brand-200: #9dd5d2;
	--ahp-brand-500: #0e7c7b;
	--ahp-brand-600: #0b6564;
	--ahp-brand-700: #0a5150;
	--ahp-accent: #1a9c52;
	--ahp-accent-50: #e6f6ec;
	--ahp-blue: #2563eb;
	--ahp-blue-50: #eaf1ff;
	--ahp-amber: #b45309;
	--ahp-amber-50: #fff4de;
	--ahp-red: #d0312d;
	--ahp-red-50: #fdecec;
	--ahp-gray-50: #f7f9fa;
	--ahp-gray-100: #eef2f4;
	--ahp-gray-200: #e1e7ea;
	--ahp-gray-300: #cbd5da;
	--ahp-gray-400: #9aa8b0;
	--ahp-gray-500: #6b7b84;
	--ahp-gray-700: #36464f;
	--ahp-gray-900: #13222a;
	--ahp-radius-sm: 6px;
	--ahp-radius: 10px;
	--ahp-radius-lg: 14px;
	--ahp-shadow-sm: 0 1px 2px rgba(16, 35, 45, .06);
	--ahp-shadow: 0 1px 3px rgba(16, 35, 45, .08), 0 1px 2px rgba(16, 35, 45, .04);
	--ahp-shadow-md: 0 6px 16px -4px rgba(16, 35, 45, .14), 0 2px 6px -2px rgba(16, 35, 45, .08);
	--ahp-shadow-lg: 0 20px 40px -12px rgba(16, 35, 45, .28), 0 6px 14px -6px rgba(16, 35, 45, .12);
	--ahp-ring: 0 0 0 3px rgba(14, 124, 123, .28);
	--ahp-ease: cubic-bezier(.2, .8, .2, 1);
	--ahp-ease-out: cubic-bezier(0, 0, .2, 1);
}

/* ---------------------------------------------------------------- Buttons */
.ahp-btn {
	--_bg: var(--ahp-brand-600);
	--_bg-hover: var(--ahp-brand-700);
	--_fg: #fff;
	--_border: transparent;
	position: relative;
	overflow: hidden;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 40px;
	padding: 0 18px;
	border-radius: var(--ahp-radius);
	border: 1.5px solid var(--_border);
	background: var(--_bg);
	color: var(--_fg) !important;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	letter-spacing: .01em;
	text-decoration: none !important;
	white-space: nowrap;
	cursor: pointer;
	user-select: none;
	box-shadow: var(--ahp-shadow-sm);
	transition: background-color .18s var(--ahp-ease), box-shadow .18s var(--ahp-ease), transform .12s var(--ahp-ease), border-color .18s, color .18s;
	-webkit-tap-highlight-color: transparent;
}
.ahp-btn:hover { background: var(--_bg-hover); box-shadow: var(--ahp-shadow-md); transform: translateY(-1px); }
.ahp-btn:active { transform: translateY(0) scale(.97); box-shadow: var(--ahp-shadow-sm); }
.ahp-btn:focus-visible { outline: none; box-shadow: var(--ahp-ring); }
.ahp-btn[disabled], .ahp-btn.is-disabled { opacity: .5; pointer-events: none; }
.ahp-btn svg { flex-shrink: 0; }

.ahp-btn--accent { --_bg: var(--ahp-accent); --_bg-hover: #138244; }
.ahp-btn--danger { --_bg: var(--ahp-red); --_bg-hover: #b0231f; }
.ahp-btn--outline { --_bg: #fff; --_bg-hover: var(--ahp-brand-50); --_fg: var(--ahp-brand-600); --_border: var(--ahp-gray-300); box-shadow: none; }
.ahp-btn--outline:hover { --_border: var(--ahp-brand-500); }
.ahp-btn--ghost { --_bg: transparent; --_bg-hover: var(--ahp-gray-100); --_fg: var(--ahp-gray-700); box-shadow: none; }
.ahp-btn--ghost:hover { box-shadow: none; transform: none; }
.ahp-btn--danger-ghost { --_bg: transparent; --_bg-hover: var(--ahp-red-50); --_fg: var(--ahp-red); box-shadow: none; }
.ahp-btn--danger-ghost:hover { box-shadow: none; transform: none; }
.ahp-btn--sm { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.ahp-btn--lg { min-height: 48px; padding: 0 24px; font-size: 15px; }
.ahp-btn--block { width: 100%; }
.ahp-btn--icon { width: 40px; padding: 0; }
.ahp-btn--icon.ahp-btn--sm { width: 32px; }

/* Loading state */
.ahp-btn.is-loading { color: transparent !important; pointer-events: none; }
.ahp-btn.is-loading::after {
	content: '';
	position: absolute;
	inset: 0;
	margin: auto;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	border: 2px solid currentColor;
	border-color: var(--_fg) var(--_fg) var(--_fg) transparent;
	animation: ahp-spin .7s linear infinite;
}

/* Page-load progress bar (top of screen) */
.ahp-navprogress {
	position: fixed;
	top: 0;
	left: 0;
	height: 3px;
	width: 0;
	background: linear-gradient(90deg, #0e7c7b, #1fb463);
	box-shadow: 0 0 10px rgba(14, 124, 123, .55);
	z-index: 2147483647;
	transition: width .5s cubic-bezier(.2, .8, .2, 1);
	border-radius: 0 3px 3px 0;
}

/* Material ripple */
.ahp-ripple-host { position: relative; overflow: hidden; }
.ahp-ripple-wave {
	position: absolute;
	border-radius: 50%;
	pointer-events: none;
	background: currentColor;
	opacity: .22;
	transform: scale(0);
	animation: ahp-ripple .6s var(--ahp-ease-out) forwards;
}
.ahp-btn:not(.ahp-btn--outline):not(.ahp-btn--ghost):not(.ahp-btn--danger-ghost) .ahp-ripple-wave { background: #fff; opacity: .35; }

/* -------------------------------------------------------------- Form controls */
.ahp-input, .ahp-textarea {
	width: 100%;
	min-height: 40px;
	padding: 8px 12px;
	border: 1.5px solid var(--ahp-gray-300);
	border-radius: var(--ahp-radius);
	background: #fff;
	color: var(--ahp-gray-900);
	font: inherit;
	font-size: 14px;
	transition: border-color .15s, box-shadow .15s;
}
.ahp-input:hover, .ahp-textarea:hover { border-color: var(--ahp-gray-400); }
.ahp-input:focus, .ahp-textarea:focus { outline: none; border-color: var(--ahp-brand-500); box-shadow: var(--ahp-ring); }
.ahp-label { display: block; font-weight: 600; font-size: 13px; color: var(--ahp-gray-700); margin: 0 0 6px; }
.ahp-help { font-size: 12.5px; color: var(--ahp-gray-500); margin: 6px 0 0; }
.ahp-field-group { margin-bottom: 16px; }
.ahp-field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
@media (max-width: 600px) { .ahp-field-row { grid-template-columns: minmax(0, 1fr); } }

/* Custom checkbox / radio (scoped to plugin surfaces) */
.ahp-ui input[type=checkbox], .ahp-portal input[type=checkbox], .ahp-auth input[type=checkbox], .ahp-drawer input[type=checkbox],
.ahp-ui input[type=radio], .ahp-drawer input[type=radio] {
	-webkit-appearance: none;
	appearance: none;
	width: 18px;
	height: 18px;
	min-width: 18px;
	margin: 0 6px 0 0;
	border: 1.5px solid var(--ahp-gray-400);
	border-radius: 5px;
	background: #fff;
	display: inline-grid;
	place-content: center;
	vertical-align: middle;
	cursor: pointer;
	box-shadow: none;
	transition: background-color .15s, border-color .15s, box-shadow .15s, transform .1s;
}
.ahp-ui input[type=radio], .ahp-drawer input[type=radio] { border-radius: 50%; }
.ahp-ui input[type=checkbox]::before, .ahp-portal input[type=checkbox]::before, .ahp-auth input[type=checkbox]::before, .ahp-drawer input[type=checkbox]::before {
	content: '';
	width: 10px;
	height: 10px;
	margin: 0;
	float: none;
	clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
	background: #fff;
	transform: scale(0);
	transition: transform .15s var(--ahp-ease);
}
.ahp-ui input[type=radio]::before, .ahp-drawer input[type=radio]::before {
	content: '';
	width: 8px;
	height: 8px;
	margin: 0;
	float: none;
	border-radius: 50%;
	background: #fff;
	transform: scale(0);
	transition: transform .15s var(--ahp-ease);
}
.ahp-ui input[type=checkbox]:checked, .ahp-portal input[type=checkbox]:checked, .ahp-auth input[type=checkbox]:checked, .ahp-drawer input[type=checkbox]:checked,
.ahp-ui input[type=radio]:checked, .ahp-drawer input[type=radio]:checked { background: var(--ahp-brand-600); border-color: var(--ahp-brand-600); }
.ahp-ui input[type=checkbox]:checked::before, .ahp-portal input[type=checkbox]:checked::before, .ahp-auth input[type=checkbox]:checked::before, .ahp-drawer input[type=checkbox]:checked::before,
.ahp-ui input[type=radio]:checked::before, .ahp-drawer input[type=radio]:checked::before { transform: scale(1); }
.ahp-ui input[type=checkbox]:focus-visible, .ahp-portal input[type=checkbox]:focus-visible, .ahp-auth input[type=checkbox]:focus-visible, .ahp-drawer input[type=checkbox]:focus-visible,
.ahp-ui input[type=radio]:focus-visible, .ahp-drawer input[type=radio]:focus-visible { outline: none; box-shadow: var(--ahp-ring); }
.ahp-ui input[type=checkbox]:active, .ahp-ui input[type=radio]:active { transform: scale(.9); }

/* Switch */
.ahp-ui input[type=checkbox].ahp-switch, .ahp-drawer input[type=checkbox].ahp-switch {
	width: 36px;
	min-width: 36px;
	height: 20px;
	border-radius: 999px;
	border: 0;
	background: var(--ahp-gray-300);
	place-content: center start;
	padding: 2px;
}
.ahp-ui input[type=checkbox].ahp-switch::before, .ahp-drawer input[type=checkbox].ahp-switch::before {
	clip-path: none;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	transform: translateX(0);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.ahp-ui input[type=checkbox].ahp-switch:checked, .ahp-drawer input[type=checkbox].ahp-switch:checked { background: var(--ahp-accent); }
.ahp-ui input[type=checkbox].ahp-switch:checked::before, .ahp-drawer input[type=checkbox].ahp-switch:checked::before { transform: translateX(16px); }
.ahp-check-row { display: flex; align-items: center; gap: 4px; font-size: 14px; cursor: pointer; margin: 6px 0; }

/* ------------------------------------------------------------ Custom select */
.ahp-select { position: relative; display: inline-block; min-width: 150px; max-width: 100%; vertical-align: middle; }
.ahp-select__native { position: absolute !important; opacity: 0 !important; pointer-events: none !important; width: 100% !important; height: 100% !important; inset: 0; }
.ahp-select__trigger {
	position: relative;
	width: 100%;
	min-height: 40px;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 36px 0 12px !important;
	border: 1.5px solid var(--ahp-gray-300) !important;
	border-radius: var(--ahp-radius) !important;
	background: #fff !important;
	color: var(--ahp-gray-900) !important;
	font: inherit;
	font-size: 14px !important;
	text-align: left;
	cursor: pointer;
	box-shadow: none !important;
	transition: border-color .15s, box-shadow .15s;
}
.ahp-select__trigger:hover { border-color: var(--ahp-gray-400) !important; }
.ahp-select__trigger:focus-visible, .ahp-select.is-open .ahp-select__trigger { outline: none; border-color: var(--ahp-brand-500) !important; box-shadow: var(--ahp-ring) !important; }
.ahp-select__value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.ahp-select.is-placeholder .ahp-select__value { color: var(--ahp-gray-500); }
.ahp-select__chevron { position: absolute; right: 12px; top: 50%; margin-top: -8px; color: var(--ahp-gray-500); transition: transform .2s var(--ahp-ease); }
.ahp-select.is-open .ahp-select__chevron { transform: rotate(180deg); }
.ahp-select.is-invalid .ahp-select__trigger { border-color: var(--ahp-red) !important; box-shadow: 0 0 0 3px rgba(208, 49, 45, .18) !important; }
.ahp-select--sm .ahp-select__trigger { min-height: 32px; font-size: 13px !important; }

.ahp-popover {
	position: absolute;
	z-index: 1000010;
	background: #fff;
	border: 1px solid var(--ahp-gray-200);
	border-radius: var(--ahp-radius);
	box-shadow: var(--ahp-shadow-lg);
	opacity: 0;
	transform: translateY(-6px) scale(.97);
	transform-origin: top center;
	transition: opacity .16s var(--ahp-ease), transform .16s var(--ahp-ease);
	font-family: inherit;
}
.ahp-popover.is-up { transform-origin: bottom center; transform: translateY(6px) scale(.97); }
.ahp-popover.is-open { opacity: 1; transform: none; }
.ahp-select__menu { padding: 6px; max-width: 420px; }
.ahp-select__search { padding: 2px 2px 6px; }
.ahp-select__search input { width: 100%; min-height: 34px; padding: 6px 10px; border: 1.5px solid var(--ahp-gray-200); border-radius: 8px; font-size: 13px; }
.ahp-select__search input:focus { outline: none; border-color: var(--ahp-brand-500); }
.ahp-select__list { max-height: 260px; overflow-y: auto; overscroll-behavior: contain; }
.ahp-select__option {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 8px 10px;
	border-radius: 7px;
	font-size: 14px;
	color: var(--ahp-gray-900);
	cursor: pointer;
	transition: background-color .1s;
}
.ahp-select__option.is-active { background: var(--ahp-gray-100); }
.ahp-select__option.is-selected { color: var(--ahp-brand-600); font-weight: 600; }
.ahp-select__option.is-selected::after { content: ''; width: 14px; height: 14px; background: var(--ahp-brand-600); clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); flex-shrink: 0; }
.ahp-select__option.is-disabled { opacity: .45; pointer-events: none; }
.ahp-select__empty { padding: 10px; color: var(--ahp-gray-500); font-size: 13px; text-align: center; }

/* ------------------------------------------------------------ Dropdown menu */
.ahp-menu-wrap { position: relative; display: inline-block; }
.ahp-dropdown {
	position: absolute;
	right: 0;
	top: calc(100% + 8px);
	min-width: 290px;
	max-width: calc(100vw - 20px);
	padding: 6px;
	z-index: 100050;
	background: #fff;
	border: 1px solid var(--ahp-gray-200);
	border-radius: var(--ahp-radius);
	box-shadow: var(--ahp-shadow-lg);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-8px) scale(.96);
	transform-origin: top right;
	transition: opacity .16s var(--ahp-ease), transform .16s var(--ahp-ease), visibility .16s;
}
.ahp-dropdown--left { right: auto; left: 0; transform-origin: top left; }
.ahp-menu-wrap.is-open .ahp-dropdown { opacity: 1; visibility: visible; transform: none; }
.ahp-dropdown__item {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	box-sizing: border-box;
	padding: 9px 10px;
	border: 0;
	border-radius: 7px;
	background: transparent;
	color: var(--ahp-gray-900) !important;
	font: inherit;
	font-size: 14px;
	text-align: left;
	text-decoration: none !important;
	cursor: pointer;
	transition: background-color .1s;
}
.ahp-dropdown__item:hover, .ahp-dropdown__item:focus-visible { background: var(--ahp-gray-100); outline: none; }
.ahp-dropdown__item svg { color: var(--ahp-gray-500); }
.ahp-dropdown__item small { display: block; color: var(--ahp-gray-500); font-size: 12px; }
.ahp-dropdown__sep { height: 1px; background: var(--ahp-gray-200); margin: 6px 4px; }
.ahp-dropdown__label { padding: 6px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ahp-gray-500); }

/* ------------------------------------------------------------------ Drawers */
.ahp-lock, .ahp-lock body { overflow: hidden !important; }
.ahp-drawer { position: fixed; inset: 0; z-index: 100000; font-family: inherit; }
.ahp-drawer[hidden] { display: none; }
.ahp-drawer__overlay {
	position: absolute;
	inset: 0;
	background: rgba(10, 25, 32, .48);
	backdrop-filter: blur(2px);
	opacity: 0;
	transition: opacity .28s var(--ahp-ease);
}
.ahp-drawer.is-open .ahp-drawer__overlay { opacity: 1; }
.ahp-drawer__panel {
	position: absolute;
	display: flex;
	flex-direction: column;
	background: #fff;
	box-shadow: var(--ahp-shadow-lg);
	transition: transform .32s var(--ahp-ease);
	max-width: 100vw;
	max-height: 100vh;
}
.ahp-drawer--right .ahp-drawer__panel { top: 0; right: 0; bottom: 0; width: 480px; transform: translateX(100%); }
.ahp-drawer--left .ahp-drawer__panel { top: 0; left: 0; bottom: 0; width: 380px; transform: translateX(-100%); }
.ahp-drawer--top .ahp-drawer__panel { top: 0; left: 0; right: 0; max-height: 80vh; transform: translateY(-100%); border-radius: 0 0 var(--ahp-radius-lg) var(--ahp-radius-lg); }
.ahp-drawer--bottom .ahp-drawer__panel { left: 0; right: 0; bottom: 0; max-height: 85vh; transform: translateY(100%); border-radius: var(--ahp-radius-lg) var(--ahp-radius-lg) 0 0; }
.ahp-drawer--wide .ahp-drawer__panel { width: 720px; }
.ahp-drawer.is-open .ahp-drawer__panel { transform: none; }
.ahp-drawer--bottom .ahp-drawer__panel::before {
	content: '';
	width: 44px;
	height: 5px;
	border-radius: 99px;
	background: var(--ahp-gray-300);
	margin: 10px auto 0;
	flex-shrink: 0;
}
.ahp-drawer--top .ahp-drawer__inner, .ahp-drawer--bottom .ahp-drawer__inner { width: 100%; max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; min-height: 0; flex: 1; }
.ahp-drawer__inner { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.ahp-drawer__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px 14px; border-bottom: 1px solid var(--ahp-gray-200); flex-shrink: 0; }
.ahp-drawer__head h2 { margin: 0 !important; font-size: 18px !important; font-weight: 700 !important; color: var(--ahp-gray-900) !important; line-height: 1.3 !important; padding: 0 !important; }
.ahp-drawer__head p { margin: 4px 0 0; color: var(--ahp-gray-500); font-size: 13px; }
.ahp-drawer__close {
	flex-shrink: 0;
	width: 34px;
	height: 34px;
	border-radius: 8px;
	border: 0;
	background: transparent;
	color: var(--ahp-gray-500);
	display: grid;
	place-items: center;
	cursor: pointer;
	transition: background-color .15s, color .15s, transform .2s var(--ahp-ease);
}
.ahp-drawer__close:hover { background: var(--ahp-gray-100); color: var(--ahp-gray-900); transform: rotate(90deg); }
.ahp-drawer__body { padding: 18px 22px; overflow-y: auto; flex: 1; min-height: 0; overscroll-behavior: contain; }
.ahp-drawer__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--ahp-gray-200); background: var(--ahp-gray-50); flex-shrink: 0; }
.ahp-drawer form { display: flex; flex-direction: column; min-height: 0; height: 100%; margin: 0; }
.ahp-drawer--top form, .ahp-drawer--bottom form { height: auto; }
.ahp-drawer .ahp-select { width: 100%; }

/* -------------------------------------------------------------------- Modal */
.ahp-modal { position: fixed; inset: 0; z-index: 1000020; display: grid; place-items: center; padding: 16px; }
.ahp-modal__overlay { position: absolute; inset: 0; background: rgba(10, 25, 32, .5); opacity: 0; transition: opacity .2s var(--ahp-ease); }
.ahp-modal__box {
	position: relative;
	width: 100%;
	max-width: 420px;
	background: #fff;
	border-radius: var(--ahp-radius-lg);
	box-shadow: var(--ahp-shadow-lg);
	padding: 24px;
	opacity: 0;
	transform: translateY(12px) scale(.96);
	transition: opacity .22s var(--ahp-ease), transform .22s var(--ahp-ease);
}
.ahp-modal.is-open .ahp-modal__overlay { opacity: 1; }
.ahp-modal.is-open .ahp-modal__box { opacity: 1; transform: none; }
.ahp-modal__icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 14px; background: var(--ahp-red-50); color: var(--ahp-red); }
.ahp-modal__icon--info { background: var(--ahp-brand-50); color: var(--ahp-brand-600); }
.ahp-modal__box h3 { margin: 0 0 6px !important; font-size: 18px !important; color: var(--ahp-gray-900); }
.ahp-modal__box p { margin: 0 0 20px; color: var(--ahp-gray-500); font-size: 14px; line-height: 1.5; }
.ahp-modal__actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ------------------------------------------------------------------- Toasts */
.ahp-toasts { position: fixed; top: 16px; right: 20px; z-index: 1000030; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.ahp-toast {
	position: relative;
	overflow: hidden;
	display: flex;
	gap: 12px;
	align-items: flex-start;
	padding: 14px 40px 14px 14px;
	background: #fff;
	border-radius: var(--ahp-radius);
	box-shadow: var(--ahp-shadow-lg);
	border-left: 4px solid var(--ahp-brand-600);
	font-size: 14px;
	line-height: 1.45;
	color: var(--ahp-gray-900);
	pointer-events: auto;
	animation: ahp-toast-in .35s var(--ahp-ease) both;
}
.ahp-toast.is-leaving { animation: ahp-toast-out .25s var(--ahp-ease) both; }
.ahp-toast__icon { width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--ahp-brand-600); }
.ahp-toast--success { border-left-color: var(--ahp-accent); }
.ahp-toast--success .ahp-toast__icon { background: var(--ahp-accent); }
.ahp-toast--error { border-left-color: var(--ahp-red); }
.ahp-toast--error .ahp-toast__icon { background: var(--ahp-red); }
.ahp-toast--warning { border-left-color: #f59e0b; }
.ahp-toast--warning .ahp-toast__icon { background: #f59e0b; }
.ahp-toast__close { position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--ahp-gray-500); cursor: pointer; display: grid; place-items: center; }
.ahp-toast__close:hover { background: var(--ahp-gray-100); }
.ahp-toast__bar { position: absolute; left: 0; bottom: 0; height: 3px; background: currentColor; opacity: .18; animation: ahp-shrink linear forwards; }
.ahp-flash-src { display: none !important; }

/* --------------------------------------------------------------- Tooltip */
[data-ahp-tip] { position: relative; }
[data-ahp-tip]:hover::after, [data-ahp-tip]:focus-visible::after {
	content: attr(data-ahp-tip);
	position: absolute;
	bottom: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%);
	padding: 5px 9px;
	background: var(--ahp-gray-900);
	color: #fff;
	font-size: 12px;
	font-weight: 500;
	line-height: 1.3;
	white-space: nowrap;
	border-radius: 6px;
	pointer-events: none;
	z-index: 50;
	animation: ahp-fade .15s ease both;
}

/* ------------------------------------------------- Theme-proofing (Astra/Elementor button styles) */
.ahp-btn:focus { background: var(--_bg); color: var(--_fg) !important; border-color: var(--_border); }
.ahp-btn:hover, .ahp-btn:focus:hover { background: var(--_bg-hover); }
.ahp-drawer__close, .ahp-drawer__close:focus, .ahp-toast__close, .ahp-toast__close:focus,
.ahp-puser, .ahp-puser:focus, .ahp-userbtn, .ahp-userbtn:focus, .ahp-dropdown__item, .ahp-dropdown__item:focus, .ahp-side__help:focus {
	background-color: transparent !important;
	border: 0 !important;
	box-shadow: none;
	text-transform: none !important;
	letter-spacing: normal !important;
	min-height: 0;
}
.ahp-drawer__close, .ahp-toast__close { padding: 0 !important; color: var(--ahp-gray-500) !important; }
.ahp-drawer__close:hover, .ahp-toast__close:hover, .ahp-puser:hover, .ahp-userbtn:hover, .ahp-dropdown__item:hover { background-color: var(--ahp-gray-100) !important; color: var(--ahp-gray-900) !important; }
.ahp-drawer__close:focus-visible, .ahp-dropdown__item:focus-visible { box-shadow: var(--ahp-ring) !important; }
.ahp-puser, .ahp-dropdown__item { color: var(--ahp-gray-900) !important; }
.ahp-side__help:focus { background-color: var(--ahp-accent-50) !important; }

/* --------------------------------------------------------------- Kbd + misc */
.ahp-kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--ahp-gray-300); border-bottom-width: 2px; border-radius: 5px; font-size: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ahp-gray-500); background: #fff; line-height: 1.5; }
.ahp-avatar-circle { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--ahp-brand-600), var(--ahp-accent)); flex-shrink: 0; }
.ahp-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--ahp-red); }
.ahp-count {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border-radius: 99px;
	background: var(--ahp-red);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	display: grid;
	place-items: center;
	box-shadow: 0 0 0 2px #fff;
}

/* --------------------------------------------------------------- Animations */
.ahp-reveal > * { animation: ahp-fade-up .45s var(--ahp-ease) both; }
.ahp-reveal > *:nth-child(2) { animation-delay: .04s; }
.ahp-reveal > *:nth-child(3) { animation-delay: .08s; }
.ahp-reveal > *:nth-child(4) { animation-delay: .12s; }
.ahp-reveal > *:nth-child(5) { animation-delay: .16s; }
.ahp-reveal > *:nth-child(6) { animation-delay: .2s; }
.ahp-reveal > *:nth-child(n+7) { animation-delay: .24s; }

@keyframes ahp-ripple { to { transform: scale(1); opacity: 0; } }
@keyframes ahp-spin { to { transform: rotate(360deg); } }
@keyframes ahp-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ahp-fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes ahp-toast-in { from { opacity: 0; transform: translateX(110%); } to { opacity: 1; transform: none; } }
@keyframes ahp-toast-out { to { opacity: 0; transform: translateX(110%); } }
@keyframes ahp-shrink { from { width: 100%; } to { width: 0; } }
@keyframes ahp-grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes ahp-pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes ahp-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, .35); } 50% { box-shadow: 0 0 0 8px rgba(37, 99, 235, 0); } }

@media (prefers-reduced-motion: reduce) {
	.ahp-reveal > *, .ahp-toast, .ahp-drawer__panel, .ahp-popover, .ahp-dropdown, .ahp-modal__box, .ahp-btn { animation: none !important; transition: none !important; }
}
@media (max-width: 600px) {
	.ahp-drawer--right .ahp-drawer__panel, .ahp-drawer--left .ahp-drawer__panel, .ahp-drawer--wide .ahp-drawer__panel { width: 100vw; }
	.ahp-toasts { right: 16px; top: 16px; }
}

/* Role chip (Admin / Client) */
.ahp-rolechip { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; background: var(--ahp-brand-50); color: var(--ahp-brand-700); white-space: nowrap; }
.ahp-rolechip--admin { background: #f1eaff; color: #6d28d9; }

/* Document placeholder (shown when no document is uploaded yet) */
.ahp-docph { display: flex; align-items: center; gap: 16px; padding: 16px; border: 1.5px dashed var(--ahp-gray-300); border-radius: var(--ahp-radius-lg); background: linear-gradient(180deg, #fbfdfd, #f4f8f8); color: var(--ahp-gray-700); }
.ahp-docph__art { flex-shrink: 0; width: 64px; filter: drop-shadow(0 6px 10px rgba(16, 35, 45, .10)); }
.ahp-docph__art svg { display: block; width: 100%; height: auto; }
.ahp-docph__text strong { display: block; font-size: 14.5px; color: var(--ahp-gray-900); margin-bottom: 2px; }
.ahp-docph__text span { display: block; font-size: 13px; color: var(--ahp-gray-500); line-height: 1.45; }
.ahp-docph--sm { gap: 12px; padding: 10px 12px; max-width: 460px; }
.ahp-docph--sm .ahp-docph__art { width: 38px; }
.ahp-docph--sm .ahp-docph__text strong { font-size: 13.5px; }
.ahp-docph--sm .ahp-docph__text span { font-size: 12.5px; }
.ahp-docph--lg { flex-direction: column; text-align: center; padding: 40px 20px; }
.ahp-docph--lg .ahp-docph__art { width: 120px; animation: ahp-fade-up .5s var(--ahp-ease) both; }
.ahp-docph--lg .ahp-docph__text strong { font-size: 17px; }
.ahp-docph--lg .ahp-docph__text span { max-width: 420px; margin: 0 auto; }

/* Account menu header (role + name + id) */
.ahp-dropdown__head { display: flex; align-items: center; gap: 12px; padding: 12px 14px 14px; margin: -6px -6px 6px; border-bottom: 1px solid var(--ahp-gray-200); background: var(--ahp-gray-50); border-radius: var(--ahp-radius) var(--ahp-radius) 0 0; }
.ahp-dropdown__head .ahp-avatar-circle { width: 42px; height: 42px; font-size: 14px; flex: 0 0 42px; }
.ahp-dropdown__head > div { min-width: 0; flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.ahp-dropdown__head strong { font-size: 14.5px; color: var(--ahp-gray-900); line-height: 1.25; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ahp-dropdown__head small { font-size: 12px; color: var(--ahp-gray-500); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ahp-dropdown__head .ahp-rolechip { font-size: 10px; padding: 2px 8px; }

/* Client logo avatars */
.ahp-avatar--logo { background: #fff !important; border: 1px solid var(--ahp-gray-200); overflow: hidden; padding: 3px; }
.ahp-avatar--logo img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: inherit; }

/* Return-to-row highlight flash */
@keyframes ahp-rowflash-bg { 0%, 18% { background: rgba(31,180,99,.18); } 100% { background: transparent; } }
@keyframes ahp-rowflash-ring { 0%, 15% { box-shadow: 0 0 0 2px #1fb463, 0 10px 30px -10px rgba(31,180,99,.55); } 100% { box-shadow: 0 1px 2px rgba(16,40,38,.06); } }
tr.ahp-rowflash > td { animation: ahp-rowflash-bg 2.6s ease; }
.ahp-rowflash:not(tr) { animation: ahp-rowflash-ring 2.6s ease; border-radius: 14px; }
