/* ADNOK Chat — team inbox (stand-alone app at /team-inbox/ and the dashboard "Chat" screen). */

.aci {
	--aci-navy: #0C1A2E;
	--aci-deep: #13294A;
	--aci-brand: #2A58A3;
	--aci-amber: #E39A2D;
	--aci-amber-light: #E8B66A;
	--aci-muted: #5B6B82;
	--aci-mist: #B9C6D6;
	--aci-line: #E1E6ED;
	--aci-light: #F4F6F9;
	--aci-active: #EAF0FA;
	--aci-danger: #B42318;
	--aci-font: "IBM Plex Sans Arabic", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Tahoma, sans-serif;
	--aci-font-display: Alexandria, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Tahoma, sans-serif;
	position: relative;
	display: flex; flex-direction: column;
	font-family: var(--aci-font); font-size: 15px; line-height: 1.5; color: var(--aci-navy);
	-webkit-font-smoothing: antialiased;
}
.aci *, .aci *::before, .aci *::after { box-sizing: border-box; }
.aci [hidden] { display: none !important; }
:where(.aci) button { margin: 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:where(.aci) :where(input, textarea) { margin: 0; font: inherit; color: inherit; }
:where(.aci) :where(h1, h2, p) { margin: 0; }
.aci a { color: var(--aci-brand); }
.aci :focus-visible { outline: 2px solid var(--aci-amber); outline-offset: 2px; }
.aci .ac-ico { display: block; flex-shrink: 0; }
[dir="rtl"] .aci .aci-back .ac-ico,
[dir="rtl"] .aci .aci-send .ac-ico,
.aci[dir="rtl"] .aci-back .ac-ico,
.aci[dir="rtl"] .aci-send .ac-ico { transform: scaleX(-1); }

/* Stand-alone app fills the screen */
html, body.aci-body { height: 100%; }
body.aci-body { margin: 0; overflow: hidden; background: var(--aci-navy, #0C1A2E); overscroll-behavior: none; }
.aci--app { height: 100vh; height: 100dvh; background: #EEF1F5; }

/* Inside the dashboard */
.aci--admin {
	height: calc(100vh - var(--wp-admin--admin-bar--height, 32px) - 120px);
	min-height: 560px; margin-top: 14px;
	border: 1px solid #DCDCDE; border-radius: 10px; overflow: hidden; background: #fff;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Tahoma, sans-serif;
}
.aci--admin { --aci-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Tahoma, sans-serif; --aci-font-display: var(--aci-font); }

/* ---------- Top bar ---------- */

.aci-top {
	flex-shrink: 0;
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	padding: max(10px, env(safe-area-inset-top)) 12px 10px 16px;
	padding-inline: 16px 10px;
	background: var(--aci-navy); color: #fff;
	border-bottom: 3px solid var(--aci-amber);
	min-height: 60px;
}
.aci--admin .aci-top { padding-top: 10px; min-height: 56px; }
.aci-top__brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.aci-logo { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--aci-deep); flex-shrink: 0; }
.aci-logo img { display: block; width: 26px; height: auto; }
.aci-top__titles { display: flex; flex-direction: column; min-width: 0; }
.aci-top__title { display: flex; align-items: center; gap: 8px; font-family: var(--aci-font-display); font-size: 17px; font-weight: 600; line-height: 1.25; }
.aci-top__team { font-size: 12.5px; color: var(--aci-mist); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aci-top__actions { display: flex; align-items: center; gap: 4px; }

.aci-icon-btn {
	position: relative; display: grid; place-items: center;
	width: 42px; height: 42px; border-radius: 10px; color: inherit;
	transition: background-color .15s;
}
.aci-top .aci-icon-btn:hover { background: rgba(255, 255, 255, .1); }
.aci-bell__dot {
	position: absolute; top: 9px; inset-inline-end: 9px;
	width: 9px; height: 9px; border-radius: 50%;
	background: #8A97A8; box-shadow: 0 0 0 2px var(--aci-navy);
}
.aci-bell.is-on .aci-bell__dot { background: #34C77B; }
.aci-bell.is-off .aci-bell__dot { background: var(--aci-amber); }

.aci-chip {
	display: inline-flex; align-items: center; gap: 6px;
	height: 34px; padding: 0 12px; border-radius: 999px;
	background: var(--aci-amber); color: var(--aci-navy);
	font-size: 13.5px; font-weight: 600; white-space: nowrap;
}
.aci-chip .ac-ico { transform: rotate(90deg); }

.aci-count {
	display: inline-block; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
	background: var(--aci-amber); color: var(--aci-navy);
	font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; font-family: var(--aci-font);
}

.aci-menu { position: relative; }
.aci-menu__list {
	position: absolute; z-index: 30; top: calc(100% + 6px); inset-inline-end: 0;
	min-width: 230px; padding: 6px; border-radius: 10px;
	background: #fff; color: var(--aci-navy);
	box-shadow: 0 18px 40px -14px rgba(12, 26, 46, .45), 0 0 0 1px rgba(12, 26, 46, .08);
}
.aci-menu__who { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--aci-light); font-size: 12.5px; color: var(--aci-muted); }
.aci-menu__who strong { color: var(--aci-navy); font-size: 14px; overflow-wrap: anywhere; }
.aci .aci-menu__item { display: flex; align-items: center; width: 100%; padding: 10px; border-radius: 6px; font-size: 14px; text-align: start; text-decoration: none; color: var(--aci-navy); }
.aci-menu__item:hover { background: var(--aci-light); }

/* ---------- Screens ---------- */

.aci-screen { flex: 1; min-height: 0; display: flex; }
.aci-screen--loading { align-items: center; justify-content: center; }
.aci-spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--aci-line); border-top-color: var(--aci-brand); animation: aci-spin .8s linear infinite; }
@keyframes aci-spin { to { transform: rotate(360deg); } }

/* Sign-in and access screens */
.aci-gate { align-items: center; justify-content: center; padding: 24px 16px; background: var(--aci-navy); overflow-y: auto; }
.aci-card { width: 100%; max-width: 400px; padding: 30px 26px; border-radius: 12px; background: #fff; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .5); display: flex; flex-direction: column; gap: 14px; }
.aci-gate__logo { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 4px; border-radius: 16px; background: var(--aci-navy); color: #fff; }
.aci-gate__logo img { width: 38px; height: auto; display: block; }
.aci-gate__title { font-family: var(--aci-font-display); font-size: 21px; font-weight: 700; text-align: center; }
.aci-gate__text { color: var(--aci-muted); text-align: center; font-size: 14.5px; line-height: 1.6; margin-top: -6px; }
.aci-field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.aci-field input {
	width: 100%; height: 48px; padding: 0 14px;
	border: 1px solid #C9D2DE; border-radius: 6px; background: #fff;
	font-size: 16px; font-weight: 400; color: var(--aci-navy);
}
.aci-field input:focus { outline: none; border-color: var(--aci-brand); box-shadow: 0 0 0 3px rgba(42, 88, 163, .18); }
[dir="rtl"] .aci-field input[dir="ltr"] { text-align: right; }
.aci-pass { position: relative; display: block; }
.aci-pass input { padding-inline-end: 48px; }
.aci-pass__toggle { position: absolute; inset-block: 0; inset-inline-end: 0; width: 46px; display: grid; place-items: center; color: var(--aci-muted); }
.aci-pass__toggle .ac-ico--eye-off, .aci-pass__toggle[aria-pressed="true"] .ac-ico--eye { display: none; }
.aci-pass__toggle[aria-pressed="true"] .ac-ico--eye-off { display: block; }
.aci-error { padding: 10px 14px; border-radius: 6px; background: #FBEAEA; color: #8A1F1F; font-size: 14px; }
.aci-link { align-self: center; font-size: 14px; font-weight: 600; text-underline-offset: 3px; }

.aci-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 48px; padding: 0 20px; border-radius: 6px;
	font-family: var(--aci-font-display); font-size: 15.5px; font-weight: 600; text-decoration: none;
	transition: background-color .15s, box-shadow .15s, opacity .15s;
}
.aci-btn--primary { background: var(--aci-navy); color: #fff; }
.aci-btn--primary:hover { background: var(--aci-deep); color: #fff; }
.aci-btn--ghost { background: transparent; color: var(--aci-navy); box-shadow: inset 0 0 0 1.5px var(--aci-line); }
.aci-btn--ghost:hover { box-shadow: inset 0 0 0 1.5px var(--aci-navy); }
.aci-btn--small { flex-shrink: 0; min-height: 34px; padding: 0 14px; font-size: 13.5px; border-radius: 999px; background: var(--aci-navy); color: #fff; }
.aci-btn--block { width: 100%; }
.aci-btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- Inbox layout ---------- */

.aci-inbox { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); width: 100%; }

.aci-list { display: flex; flex-direction: column; min-height: 0; background: #fff; border-inline-end: 1px solid var(--aci-line); }
.aci-list__tools { flex-shrink: 0; padding: 12px 12px 10px; border-bottom: 1px solid var(--aci-line); display: flex; flex-direction: column; gap: 10px; }
.aci-search { position: relative; display: block; color: var(--aci-muted); }
.aci-search .ac-ico { position: absolute; top: 50%; inset-inline-start: 12px; transform: translateY(-50%); pointer-events: none; }
.aci-search input {
	width: 100%; height: 40px; padding-inline: 38px 12px;
	border: 1px solid transparent; border-radius: 8px; background: var(--aci-light);
	font-size: 14.5px; color: var(--aci-navy);
}
.aci-search input:focus { outline: none; border-color: var(--aci-brand); background: #fff; }
.aci-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 3px; border-radius: 8px; background: var(--aci-light); }
.aci-tab { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; border-radius: 6px; font-size: 13.5px; font-weight: 600; color: var(--aci-muted); }
.aci-tab[aria-selected="true"] { background: #fff; color: var(--aci-navy); box-shadow: 0 1px 3px rgba(12, 26, 46, .14); }

.aci-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 12px 0; padding: 10px 12px; border-radius: 8px; background: #FFF6E8; color: #6B4206; font-size: 13.5px; line-height: 1.45; }
.aci-offline { margin: 10px 12px 0; padding: 8px 12px; border-radius: 8px; background: #FFF6E8; color: #6B4206; font-size: 13px; text-align: center; }

.aci-threads { flex: 1; min-height: 0; margin: 0; padding: 6px; list-style: none; overflow-y: auto; overscroll-behavior: contain; }
.aci-threads li { margin: 0; }
.aci-thread {
	position: relative; display: flex; align-items: center; gap: 12px;
	width: 100%; padding: 11px 10px; border-radius: 10px; text-align: start;
	transition: background-color .12s;
}
.aci-thread:hover { background: var(--aci-light); }
.aci-thread.is-active { background: var(--aci-active); }
.aci-thread.is-active::before { content: ""; position: absolute; inset-block: 12px; inset-inline-start: 0; width: 3px; border-radius: 3px; background: var(--aci-amber); }
.aci-thread__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.aci-thread__top > :first-child, .aci-thread__bottom > :first-child { min-width: 0; }
.aci-thread__top, .aci-thread__bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.aci-thread__name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aci-thread__time { flex-shrink: 0; font-size: 12px; color: var(--aci-muted); }
.aci-thread__preview { min-width: 0; font-size: 13.5px; color: var(--aci-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aci-thread__you { font-weight: 600; }
.aci-thread.is-unread .aci-thread__name { font-weight: 700; }
.aci-thread.is-unread .aci-thread__preview { color: var(--aci-navy); font-weight: 500; }
.aci-thread.is-unread .aci-thread__time { color: #9A5B0C; font-weight: 600; }
.aci-list__empty { margin: 24px 20px; color: var(--aci-muted); text-align: center; font-size: 14px; line-height: 1.6; }
.aci-more { margin: 4px 12px 12px; height: 38px; border-radius: 8px; background: var(--aci-light); font-size: 13.5px; font-weight: 600; color: var(--aci-navy); }

.aci-avatar {
	--h: 215;
	display: inline-grid; place-items: center; flex-shrink: 0;
	width: 44px; height: 44px; border-radius: 50%;
	background: hsl(var(--h) 50% 92%); color: hsl(var(--h) 45% 28%);
	font-family: var(--aci-font-display); font-weight: 600; font-size: 15px; line-height: 1;
}

/* ---------- Conversation ---------- */

.aci-conv { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--aci-light); }
.aci-conv__empty { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px; color: var(--aci-muted); text-align: center; font-size: 14px; }
.aci-conv__empty strong { color: var(--aci-navy); font-size: 17px; font-family: var(--aci-font-display); }
.aci-conv__empty-icon { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--aci-brand); box-shadow: 0 1px 3px rgba(12, 26, 46, .1); margin-bottom: 6px; }
.aci-conv__body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.aci-conv__head { flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; padding-inline: 16px 10px; background: #fff; border-bottom: 1px solid var(--aci-line); }
.aci-back { display: none !important; margin-inline-start: -8px; color: var(--aci-navy); }
.aci-conv__who { flex: 1; min-width: 0; }
.aci-conv__name { font-family: var(--aci-font-display); font-size: 16.5px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aci-conv__meta { display: flex; flex-wrap: wrap; gap: 0 10px; min-width: 0; font-size: 13px; color: var(--aci-muted); }
.aci-conv__meta a { max-width: 100%; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aci-conv__meta a:hover { text-decoration: underline; }
.aci-conv__actions { display: flex; align-items: center; gap: 2px; }
.aci-conv__actions .aci-icon-btn { color: var(--aci-muted); width: 40px; height: 40px; }
.aci-conv__actions .aci-icon-btn:hover { background: var(--aci-light); color: var(--aci-navy); }
.aci-conv__actions .aci-icon-btn--danger:hover { color: var(--aci-danger); background: #FBEAEA; }

.aci-log { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; padding: 14px 18px 10px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.aci-log:focus { outline: none; }
.aci-log > .aci-spinner { margin: auto; }
.aci-older { align-self: center; min-height: 22px; font-size: 12px; color: var(--aci-muted); }
.aci-day { align-self: center; margin: 14px 0 6px; padding: 3px 12px; border-radius: 999px; background: rgba(12, 26, 46, .06); color: var(--aci-muted); font-size: 12px; font-weight: 500; }

.aci-msg { display: flex; flex-direction: column; max-width: min(78%, 620px); margin-top: 3px; }
.aci-msg.is-first { margin-top: 12px; }
.aci-msg--client { align-self: flex-start; align-items: flex-start; }
.aci-msg--team { align-self: flex-end; align-items: flex-end; }
.aci-bubble { max-width: 100%; padding: 9px 13px 6px; border-radius: 14px; font-size: 15px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.aci-msg--client .aci-bubble { background: #fff; border: 1px solid #E3E8EF; box-shadow: 0 1px 2px rgba(12, 26, 46, .05); }
.aci-msg--team .aci-bubble { background: var(--aci-deep); color: #fff; }
.aci-msg--client.is-last .aci-bubble { border-end-start-radius: 4px; }
.aci-msg--team.is-last .aci-bubble { border-end-end-radius: 4px; }
.aci-bubble a { color: inherit; text-decoration: underline; }
.aci-time { display: block; margin-top: 2px; font-size: 11px; opacity: .65; text-align: end; }
.aci-msg.is-pending .aci-bubble { opacity: .7; }
.aci-msg.is-failed .aci-bubble { background: #8A2A2A; cursor: pointer; }
.aci-status { margin: 4px 4px 0; font-size: 11.5px; color: var(--aci-muted); }
.aci-status.is-seen { color: var(--aci-brand); font-weight: 600; }
.aci-status.is-failed { color: var(--aci-danger); font-weight: 600; cursor: pointer; }

.aci-reply {
	flex-shrink: 0; display: flex; align-items: flex-end; gap: 8px;
	padding: 10px 10px 10px 16px; padding-inline: 16px 10px;
	background: #fff; border-top: 1px solid var(--aci-line);
}
.aci-reply textarea { flex: 1; min-height: 44px; max-height: 160px; padding: 11px 2px; border: 0; outline: none; resize: none; background: transparent; font-size: 16px; line-height: 1.4; }
.aci-reply textarea::placeholder { color: #8391A5; opacity: 1; }
.aci-reply textarea:focus, .aci-reply textarea:focus-visible { outline: none; }
.aci-reply:focus-within { border-top-color: var(--aci-brand); box-shadow: inset 0 1px 0 var(--aci-brand); }
.aci-send { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: var(--aci-navy); color: #fff; transition: background-color .15s; }
.aci-send:hover:not([disabled]) { background: var(--aci-brand); }
.aci-send[disabled] { background: var(--aci-line); cursor: default; }
.aci-reply__hint { flex-shrink: 0; padding: 0 16px 8px; background: #fff; font-size: 11.5px; color: var(--aci-muted); }
.aci--app .aci-reply__hint { padding-bottom: max(8px, env(safe-area-inset-bottom)); }

/* ---------- Notifications panel and toast ---------- */

.aci-pop {
	position: absolute; z-index: 40; top: 68px; inset-inline-end: 12px;
	width: min(360px, calc(100% - 24px)); padding: 20px 20px 18px; border-radius: 12px;
	background: #fff; color: var(--aci-navy);
	box-shadow: 0 24px 60px -18px rgba(12, 26, 46, .5), 0 0 0 1px rgba(12, 26, 46, .08);
	display: flex; flex-direction: column; gap: 10px;
}
.aci--app .aci-pop { top: calc(68px + env(safe-area-inset-top)); }
.aci-pop__close { position: absolute; top: 8px; inset-inline-end: 8px; width: 34px; height: 34px; color: var(--aci-muted); }
.aci-pop__close:hover { background: var(--aci-light); }
.aci-pop__title { padding-inline-end: 30px; font-family: var(--aci-font-display); font-size: 17px; font-weight: 700; line-height: 1.35; }
.aci-pop__text { color: var(--aci-muted); font-size: 14px; line-height: 1.6; }
.aci-pop__actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.aci-pop__status { padding: 9px 12px; border-radius: 8px; background: var(--aci-light); font-size: 13.5px; line-height: 1.5; }
.aci-pop__status.is-ok { background: #E7F3EC; color: #1E5B3A; }
.aci-pop__status.is-bad { background: #FBEAEA; color: #8A1F1F; }
.aci-steps { margin: 0; padding-inline-start: 20px; color: var(--aci-navy); font-size: 14px; line-height: 1.7; }

.aci-toast {
	position: absolute; z-index: 50; inset-inline: 0; bottom: max(18px, env(safe-area-inset-bottom));
	width: max-content; max-width: calc(100% - 32px); margin-inline: auto;
	padding: 10px 16px; border-radius: 999px;
	background: var(--aci-navy); color: #fff; font-size: 14px; line-height: 1.4;
	box-shadow: 0 12px 30px -12px rgba(12, 26, 46, .6);
}

/* ---------- Phones and narrow screens ---------- */

@media (max-width: 899px) {
	.aci-inbox { grid-template-columns: minmax(0, 1fr); }
	.aci-inbox[data-pane="list"] .aci-conv { display: none; }
	.aci-inbox[data-pane="conv"] .aci-list { display: none; }
	.aci-back { display: grid !important; }
	.aci-msg { max-width: 86%; }
	.aci-reply__hint { display: none; }
	.aci--app .aci-reply { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}
@media (max-width: 899px) and (pointer: fine) {
	.aci-reply__hint { display: block; }
}
@media (max-width: 520px) {
	.aci-top__team { display: none; }
	.aci-chip span { display: none; }
	.aci-chip { width: 34px; padding: 0; justify-content: center; }
	.aci-pop { inset-inline: 12px; width: auto; }
	.aci-conv__meta span { display: none; }
}
@media (pointer: coarse) {
	.aci-reply__hint { display: none !important; }
}
