/* Shared ERP profile hover popover (Class Teachers + any .profile-hover-link) */

.profile-presence-dot {
    width: 13px;
    height: 13px;
    border-radius: 9999px;
    border: 2px solid #fff;
    background: #94a3b8;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}
.profile-presence-dot.is-online {
    background: #22c55e;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(34, 197, 94, 0.25), 0 0 12px rgba(34, 197, 94, 0.45);
}
.profile-presence-dot.is-offline { background: #94a3b8; }
.profile-presence-dot.inline-dot,
.profile-presence-dot.hover-card-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    vertical-align: middle;
}

.profile-hover-popover {
    position: fixed;
    top: 0;
    left: 0;
    width: min(340px, calc(100vw - 24px));
    max-height: min(520px, calc(100vh - 24px));
    background: #fff;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 14px;
    box-shadow:
        0 2px 8px rgba(15, 23, 42, 0.06),
        0 16px 40px rgba(15, 23, 42, 0.12);
    overflow-x: hidden;
    overflow-y: auto;
    pointer-events: auto;
    z-index: 2147482700;
    animation: slsProfileHoverIn 0.16s ease-out;
    transform-origin: top center;
}
html.dm-chromium-page-zoom .profile-hover-popover {
    zoom: calc(1 / var(--site-zoom, 1));
}
@keyframes slsProfileHoverIn {
    from { opacity: 0; transform: translateY(6px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.profile-hover-popover .phc-cover {
    height: 72px;
    background: linear-gradient(135deg, #0d9488 0%, #2563eb 100%);
    overflow: hidden;
    position: relative;
}
.profile-hover-popover .phc-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.profile-hover-popover .phc-body { padding: 0 1rem 1rem; }
.profile-hover-popover .phc-top {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.65rem;
    margin-top: -2rem;
    position: relative;
    z-index: 1;
}
.profile-hover-popover .phc-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}
.profile-hover-popover .phc-avatar {
    width: 64px;
    height: 64px;
    border-radius: 9999px;
    object-fit: cover;
    border: 3px solid #fff;
    background: #fff;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.1);
}
.profile-hover-popover .hover-card-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
}
.profile-hover-popover .phc-meta {
    margin-top: 0.55rem;
    min-width: 0;
}
.profile-hover-popover .phc-name .sls-verified-badge {
    display: inline-flex;
    width: 15px;
    height: 15px;
    margin-inline-start: 4px;
    vertical-align: -2px;
    flex-shrink: 0;
}
.profile-hover-popover .phc-name .sls-verified-badge svg {
    width: 100%;
    height: 100%;
    display: block;
}

.profile-hover-popover .phc-name {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
    min-width: 0;
}
.profile-hover-popover .phc-name a,
.profile-hover-popover .phc-name > span:first-child {
    color: inherit;
    text-decoration: none;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-hover-popover .phc-name a:hover { color: #2563eb; }
.profile-hover-popover .phc-role {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    margin-top: 0.1rem;
}
.profile-hover-popover .phc-role--bio {
    font-weight: 500;
    line-height: 1.45;
    color: #475569;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}
/* Parent-of {Student} · Grade/Class chips (BUG-431) */
.profile-hover-popover .phc-parent-of {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.35rem;
    min-width: 0;
    max-width: 100%;
}
.profile-hover-popover .phc-parent-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    max-width: 100%;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    background: #e7f3ff;
    color: #166fe5;
    border: 1px solid #cde3ff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.3;
}
.profile-hover-popover .phc-parent-badge i {
    flex-shrink: 0;
    font-size: 0.62rem;
    opacity: 0.9;
}
.profile-hover-popover .phc-parent-badge > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
html[data-theme="dark"] .profile-hover-popover .phc-parent-badge {
    background: #1e3a5f !important;
    color: #93c5fd !important;
    border-color: #334155 !important;
}
/* Class Teachers Role + Subject two-cell (All assignments parity) */
.sls-duty-rs-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.35rem;
    min-width: 0;
}
.sls-duty-rs {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 0.4rem;
    align-items: stretch;
    min-width: 0;
}
.sls-duty-rs:not(:has(.sls-duty-rs__subjects)) {
    grid-template-columns: 1fr;
}
.sls-duty-rs__role,
.sls-duty-rs__subjects {
    min-width: 0;
}
.sls-duty-rs__subjects {
    padding-inline-start: 0.4rem;
    border-inline-start: 1px solid #e2e8f0;
}
.sls-duty-rs .ct-pill-stack {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 4px;
    align-items: stretch;
}
.sls-duty-rs .ct-pill {
    display: inline-flex;
    align-items: flex-start;
    gap: 5px;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.3;
    padding: 4px 8px;
    border-radius: 0.65rem;
    border: 1px solid transparent;
    box-sizing: border-box;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
}
.sls-duty-rs__role .ct-pill { width: 100%; }
.sls-duty-rs .ct-pill--tone-indigo { background: #eef2ff; color: #3730a3; border-color: #c7d2fe; }
.sls-duty-rs .ct-pill--tone-teal   { background: #f0fdfa; color: #0f766e; border-color: #99f6e4; }
.sls-duty-rs .ct-pill--tone-amber  { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.sls-duty-rs .ct-pill--tone-pink   { background: #fdf2f8; color: #be185d; border-color: #fbcfe8; }
.sls-duty-rs .ct-pill--tone-violet { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.sls-duty-rs .ct-pill--tone-sky    { background: #f0f9ff; color: #0369a1; border-color: #bae6fd; }
.sls-duty-rs .ct-pill--tone-rose   { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.sls-duty-rs .ct-pill--tone-lime   { background: #f7fee7; color: #4d7c0f; border-color: #d9f99d; }
.sls-duty-rs .ct-pill--tone-cyan   { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.sls-duty-rs .ct-pill--tone-orange { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.sls-duty-rs .ct-pill--tone-emerald { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.sls-duty-rs .ct-pill--tone-slate  { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }
.sls-duty-rs .ct-pill--role-control { font-weight: 800; }
.sls-duty-rs .ct-pill--role-hod {
    border-inline-start-width: 4px;
    border-inline-start-color: currentColor;
    font-weight: 800;
}
.sls-duty-rs .ct-pill--role-senior {
    border-inline-start-width: 3px;
    border-inline-start-color: currentColor;
    font-weight: 700;
}
.sls-duty-rs .ct-pill--role-subject { font-weight: 600; }
.sls-duty-rs .ct-pill--role-support {
    border-style: dashed;
    font-weight: 600;
}
.sls-duty-rs .ct-pill--tutor {
    box-shadow: inset 0 0 0 1.5px #ea580c;
    font-weight: 800;
}
.profile-hover-popover .phc-duty { margin-top: 0.15rem; }
.profile-hover-popover .phc-you-pill {
    align-self: center;
    font-size: 0.625rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: 9999px;
    padding: 0.2rem 0.5rem;
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}
.profile-hover-popover .phc-presence {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
}
.profile-hover-popover .phc-presence.is-online { color: #047857; }
.profile-hover-popover .phc-presence.is-offline { color: #64748b; }
.profile-hover-popover .phc-badge {
    flex-shrink: 0;
    align-self: center;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border-radius: 9999px;
    padding: 0.22rem 0.55rem;
    background: #f1f5f9;
    color: #475569;
}
.profile-hover-popover .phc-badge.is-friend {
    background: #eff6ff;
    color: #1d4ed8;
}
.profile-hover-popover .phc-bio {
    margin: 0.75rem 0 0;
    padding-left: 0.65rem;
    border-left: 2px solid #e2e8f0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #64748b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.profile-hover-popover .phc-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
    margin-top: 0.9rem;
    padding-top: 0.85rem;
    border-top: 1px solid #f1f5f9;
}
.profile-hover-popover .phc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 36px;
    border-radius: 9px;
    font-size: 0.8125rem;
    font-weight: 600;
    border: 1px solid transparent;
    transition: background 0.15s ease, color 0.15s ease;
    text-decoration: none;
    cursor: pointer;
}
.profile-hover-popover .phc-btn-profile {
    background: #2563eb;
    color: #fff;
}
.profile-hover-popover .phc-btn-profile:hover { background: #1d4ed8; color: #fff; }
.profile-hover-popover .phc-btn-message {
    background: #f8fafc;
    color: #334155;
    border-color: #e2e8f0;
}
.profile-hover-popover .phc-btn-message:hover:not(:disabled) { background: #f1f5f9; }
.profile-hover-popover .phc-btn-message:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.profile-hover-popover.phc-own .phc-btn-message {
    background: #2563eb;
    color: #fff;
    border-color: transparent;
}
.profile-hover-popover.phc-own .phc-btn-message:hover:not(:disabled) { background: #1d4ed8; }
.profile-hover-popover.phc-own .phc-btn-profile {
    background: #f8fafc;
    color: #334155;
    border: 1px solid #e2e8f0;
}
.profile-hover-popover.phc-own .phc-btn-profile:hover { background: #f1f5f9; }

/* Dark mode */
html[data-theme="dark"] .profile-hover-popover {
    background: var(--color-card, #1e293b) !important;
    border-color: var(--color-border, #334155) !important;
    box-shadow: 0 24px 56px rgba(0, 0, 0, 0.55) !important;
}
html[data-theme="dark"] .profile-hover-popover .phc-avatar {
    border-color: var(--color-card, #1e293b) !important;
    background: #0f172a !important;
}
html[data-theme="dark"] .profile-hover-popover .phc-name,
html[data-theme="dark"] .profile-hover-popover .phc-name a {
    color: #f1f5f9 !important;
}
html[data-theme="dark"] .profile-hover-popover .phc-name a:hover { color: #93c5fd !important; }
html[data-theme="dark"] .profile-hover-popover .phc-role,
html[data-theme="dark"] .profile-hover-popover .phc-role--bio,
html[data-theme="dark"] .profile-hover-popover .phc-bio {
    color: #94a3b8 !important;
}
html[data-theme="dark"] .sls-duty-rs__subjects {
    border-inline-start-color: #334155 !important;
}
html[data-theme="dark"] .sls-duty-rs .ct-pill--tone-indigo { background: #312e81 !important; color: #c7d2fe !important; border-color: #4338ca !important; }
html[data-theme="dark"] .sls-duty-rs .ct-pill--tone-teal   { background: #134e4a !important; color: #99f6e4 !important; border-color: #0f766e !important; }
html[data-theme="dark"] .sls-duty-rs .ct-pill--tone-amber  { background: #78350f !important; color: #fde68a !important; border-color: #b45309 !important; }
html[data-theme="dark"] .sls-duty-rs .ct-pill--tone-pink   { background: #831843 !important; color: #fbcfe8 !important; border-color: #be185d !important; }
html[data-theme="dark"] .sls-duty-rs .ct-pill--tone-violet { background: #4c1d95 !important; color: #ddd6fe !important; border-color: #6d28d9 !important; }
html[data-theme="dark"] .sls-duty-rs .ct-pill--tone-sky    { background: #0c4a6e !important; color: #bae6fd !important; border-color: #0369a1 !important; }
html[data-theme="dark"] .sls-duty-rs .ct-pill--tone-rose   { background: #881337 !important; color: #fecdd3 !important; border-color: #be123c !important; }
html[data-theme="dark"] .sls-duty-rs .ct-pill--tone-lime   { background: #365314 !important; color: #d9f99d !important; border-color: #4d7c0f !important; }
html[data-theme="dark"] .sls-duty-rs .ct-pill--tone-cyan   { background: #155e75 !important; color: #a5f3fc !important; border-color: #0e7490 !important; }
html[data-theme="dark"] .sls-duty-rs .ct-pill--tone-orange { background: #7c2d12 !important; color: #fed7aa !important; border-color: #c2410c !important; }
html[data-theme="dark"] .sls-duty-rs .ct-pill--tone-emerald { background: #064e3b !important; color: #a7f3d0 !important; border-color: #047857 !important; }
html[data-theme="dark"] .sls-duty-rs .ct-pill--tone-slate  { background: #1e293b !important; color: #cbd5e1 !important; border-color: #475569 !important; }
html[data-theme="dark"] .profile-hover-popover .phc-bio {
    border-left-color: #334155 !important;
}
html[data-theme="dark"] .profile-hover-popover .phc-you-pill,
html[data-theme="dark"] .profile-hover-popover .phc-badge {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}
html[data-theme="dark"] .profile-hover-popover .phc-badge.is-friend {
    background: #1e3a5f !important;
    color: #93c5fd !important;
}
html[data-theme="dark"] .profile-hover-popover .phc-actions {
    border-top-color: #334155 !important;
}
html[data-theme="dark"] .profile-hover-popover .phc-btn-message,
html[data-theme="dark"] .profile-hover-popover.phc-own .phc-btn-profile {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
html[data-theme="dark"] .profile-hover-popover .phc-btn-message:hover:not(:disabled),
html[data-theme="dark"] .profile-hover-popover.phc-own .phc-btn-profile:hover {
    background: #1e293b !important;
}
html[data-theme="dark"] .profile-presence-dot {
    border-color: var(--color-card, #1e293b);
}
