/* =========================================================================
   DESIGN TOKENS + SHARED UI — LIGHT THEME (default)
   Location : src/assets/theme/css/light-theme.css
   Load     : globally via angular.json "styles" (before dark-theme.css)

   Rule of thumb: components never hard-code colors. Use the variables
   below, or the shared .hg-* classes (cards, buttons, inputs, icons,
   tables, popovers, popups, backgrounds).
   ========================================================================= */


/* -------------------------------------------------------------------------
   1. TOKENS
   ------------------------------------------------------------------------- */
:root,
[data-theme="light"] {
    color-scheme: light;

    /* ---- Brand palette (raw values — prefer the semantic tokens below) ---- */
    --hg-navy-950: #010532;
    /* primary brand navy        */
    --hg-navy-800: #0b1150;
    --hg-slate-800: #133247;
    /* deep slate                */
    --hg-slate-600: #3c566a;
    --hg-blue-700: #1a5fc2;
    --hg-blue-600: #2172e6;
    /* primary action blue       */
    --hg-blue-400: #5b9cf5;
    --hg-blue-200: #c3d6fb;
    --hg-blue-100: #dce8fd;
    --hg-blue-50: #f0f4ff;
    /* soft blue surface         */
    --hg-orange-600: #dc7a05;
    --hg-orange-500: #f38c0c;
    /* accent / rewards          */
    --hg-orange-300: #f9b860;
    --hg-orange-50: #fff4e6;
    --hg-white: #ffffff;

    /* ---- Status ---- */
    --hg-success: #16a34a;
    --hg-success-soft: #e7f7ee;
    --hg-success-text: #15803d;
    --hg-success-border: #bbf7d0;
    --hg-danger: #e5484d;
    --hg-danger-soft: #fdecec;
    --hg-danger-text: #c62828;
    --hg-danger-border: #fecaca;
    --hg-warning: #f38c0c;
    --hg-warning-soft: #fff4e6;
    --hg-warning-text: #b45309;
    --hg-warning-border: #fde68a;
    --hg-info: #2172e6;
    --hg-info-soft: #f0f4ff;
    --hg-info-text: var(--hg-blue-700);
    --hg-info-border: var(--hg-blue-200);

    /* ---- Brand (semantic) ---- */
    --color-primary: var(--hg-blue-600);
    --color-primary-hover: var(--hg-blue-700);
    --color-primary-soft: var(--hg-blue-50);
    --color-primary-contrast: #ffffff;
    --color-secondary: var(--hg-navy-950);
    --color-secondary-soft: #e8e9f3;
    --color-accent: var(--hg-orange-500);
    --color-accent-soft: var(--hg-orange-50);
    --color-accent-border: #fbd399;

    /* ---- Text ---- */
    --color-heading: var(--hg-navy-950);
    --color-text: #1d2440;
    --color-text-muted: #5b6480;
    --color-text-subtle: #8a92a8;
    --color-text-inverse: #ffffff;
    --color-link: var(--hg-blue-600);
    --color-link-hover: var(--hg-blue-700);

    /* ---- Borders ---- */
    --color-border: #e1e7f5;
    --color-border-strong: #c3d6fb;
    --color-divider: #edf1f9;

    /* ---- Backgrounds ---- */
    --bg-body: #f6f8fd;
    --bg-surface: #ffffff;
    --bg-surface-raised: #ffffff;
    --bg-surface-soft: var(--hg-blue-50);
    --bg-surface-muted: #f8faff;
    --bg-input: #ffffff;
    --bg-input-disabled: #f2f4f9;
    --bg-overlay: rgba(1, 5, 50, 0.55);
    --bg-glow: rgba(33, 114, 230, 0.12);
    --bg-hero: linear-gradient(165deg, #f0f4ff 0%, #e6eeff 55%, #dce8fd 100%);
    --bg-pattern: radial-gradient(circle at 1px 1px, rgba(33, 114, 230, 0.08) 1px, transparent 0) 0 0 / 22px 22px;

    /* ---- Gradients ---- */
    --gradient-primary: linear-gradient(135deg, #2172e6 0%, #0b1150 100%);
    --gradient-primary-hover: linear-gradient(135deg, #2b7df0 0%, #010532 100%);
    --gradient-navy: linear-gradient(135deg, #0b1150 0%, #133247 100%);
    --gradient-accent: linear-gradient(135deg, #f9b860 0%, #f38c0c 100%);
    --gradient-accent-hover: linear-gradient(135deg, #f38c0c 0%, #dc7a05 100%);
    --gradient-heading: linear-gradient(90deg, #2172e6 0%, #133247 100%);

    /* ---- Dashboard widgets & tabs ---- */
    --tabs-track-bg: #eef2fa;
    --widget-header-icon: var(--hg-blue-400);
    --pill-on-dark-bg: rgba(255, 255, 255, 0.14);
    --pill-on-dark-border: rgba(255, 255, 255, 0.28);
    --pill-on-dark-hover: rgba(255, 255, 255, 0.24);
    --shadow-accent: 0 8px 20px rgba(243, 140, 12, 0.28);

    /* ---- Icon boxes ---- */
    --icon-box-bg: var(--hg-blue-50);
    --icon-box-color: var(--hg-blue-600);
    --icon-box-accent-bg: var(--hg-orange-50);
    --icon-box-accent-color: var(--hg-orange-500);
    --icon-box-navy-bg: #e8e9f3;
    --icon-box-navy-color: var(--hg-navy-950);

    /* ---- Tables ---- */
    --table-head-bg: var(--hg-navy-950);
    --table-head-color: #ffffff;
    --table-row-bg: #ffffff;
    --table-row-alt-bg: #f8faff;
    --table-row-hover-bg: var(--hg-blue-50);
    --table-border: var(--color-border);

    /* ---- Popups / popovers / tooltips ---- */
    --popup-bg: #ffffff;
    --popup-color: var(--color-text);
    --popup-border: var(--color-border);
    --tooltip-bg: var(--hg-navy-950);
    --tooltip-color: #ffffff;

    /* ---- Focus ---- */
    --focus-ring: 0 0 0 4px rgba(33, 114, 230, 0.18);
    --focus-ring-danger: 0 0 0 4px rgba(229, 72, 77, 0.15);

    /* ---- Shadows ---- */
    --shadow-xs: 0 1px 2px rgba(1, 5, 50, 0.06);
    --shadow-sm: 0 4px 12px rgba(1, 5, 50, 0.06);
    --shadow-md: 0 10px 30px rgba(1, 5, 50, 0.08);
    --shadow-lg: 0 24px 60px rgba(1, 5, 50, 0.12);
    --shadow-primary: 0 10px 24px rgba(33, 114, 230, 0.35);

    /* ---- Radius ---- */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-pill: 999px;

    /* ---- Type scale ---- */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.375rem;
    --font-size-2xl: 1.75rem;
    --font-size-3xl: 2.25rem;

    /* ---- Motion ---- */
    --transition: 0.2s ease;

    /* ---- Loaders / skeletons ---- */
    --loader-color: var(--hg-blue-600);
    --loader-track: rgba(33, 114, 230, 0.15);
    --loader-accent: var(--hg-orange-500);
    --loader-overlay-bg: rgba(246, 248, 253, 0.82);
    --skeleton-base: #e8eef9;
    --skeleton-shine: #f6f9ff;

    /* ---- Decorated popup strength ---- */
    --popup-glow-mix: 18%;
    --popup-line-mix: 16%;
    --popup-wave-mix: 9%;
    --popup-wave2-mix: 15%;
}


/* -------------------------------------------------------------------------
   2. BASE
   ------------------------------------------------------------------------- */
body {
    background-color: var(--bg-body);
    color: var(--color-text);
    transition: background-color var(--transition), color var(--transition);
}


/* -------------------------------------------------------------------------
   3. BACKGROUND + TEXT UTILITIES
   ------------------------------------------------------------------------- */
.hg-bg-body {
    background: var(--bg-body);
}

.hg-bg-surface {
    background: var(--bg-surface);
}

.hg-bg-soft {
    background: var(--bg-surface-soft);
}

.hg-bg-muted {
    background: var(--bg-surface-muted);
}

.hg-bg-hero {
    background: var(--bg-hero);
}

.hg-bg-pattern {
    background: var(--bg-pattern), var(--bg-surface);
}

.hg-bg-primary {
    background: var(--gradient-primary);
    color: var(--color-text-inverse);
}

.hg-bg-accent {
    background: var(--gradient-accent);
    color: #ffffff;
}

.hg-text-primary {
    color: var(--color-primary);
}

.hg-text-accent {
    color: var(--color-accent);
}

.hg-text-heading {
    color: var(--color-heading);
}

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

.hg-text-gradient {
    background: var(--gradient-heading);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}


/* -------------------------------------------------------------------------
   4. CARD
   ------------------------------------------------------------------------- */
.hg-card {
    background: var(--bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    color: var(--color-text);
}


/* -------------------------------------------------------------------------
   5. CHIPS + BADGES
   ------------------------------------------------------------------------- */
.hg-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-pill);
    background: var(--color-primary-soft);
    color: var(--color-primary);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
}

.hg-chip--accent {
    background: var(--color-accent-soft);
    color: var(--color-accent);
}

.hg-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: var(--font-size-xs);
    font-weight: 600;
    background: var(--hg-info-soft);
    color: var(--hg-info);
}

.hg-badge--success {
    background: var(--hg-success-soft);
    color: var(--hg-success);
}

.hg-badge--danger {
    background: var(--hg-danger-soft);
    color: var(--hg-danger);
}

.hg-badge--warning {
    background: var(--hg-warning-soft);
    color: var(--hg-warning);
}


/* -------------------------------------------------------------------------
   6. ICON BOX  (works with "bi bi-*" and "fa fa-*")
   ------------------------------------------------------------------------- */
.hg-icon-box {
    --hg-icon-size: 44px;
    width: var(--hg-icon-size);
    height: var(--hg-icon-size);
    min-width: var(--hg-icon-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--icon-box-bg);
    color: var(--icon-box-color);
    font-size: calc(var(--hg-icon-size) * 0.45);
    box-shadow: var(--shadow-xs);
}

.hg-icon-box>i {
    line-height: 1;
}

.hg-icon-box--sm {
    --hg-icon-size: 34px;
    border-radius: var(--radius-sm);
}

.hg-icon-box--lg {
    --hg-icon-size: 56px;
    border-radius: var(--radius-lg);
}

.hg-icon-box--round {
    border-radius: 50%;
}

.hg-icon-box--accent {
    background: var(--icon-box-accent-bg);
    color: var(--icon-box-accent-color);
}

.hg-icon-box--navy {
    background: var(--icon-box-navy-bg);
    color: var(--icon-box-navy-color);
}

.hg-icon-box--solid {
    background: var(--gradient-primary);
    color: #ffffff;
}


/* -------------------------------------------------------------------------
   7. BUTTONS
   ------------------------------------------------------------------------- */
.hg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.7rem 1.4rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition), box-shadow var(--transition),
        transform var(--transition), color var(--transition), opacity var(--transition);
}

.hg-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.hg-btn:disabled,
.hg-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.hg-btn-primary {
    background: var(--gradient-primary);
    color: var(--color-primary-contrast);
    box-shadow: var(--shadow-primary);
}

.hg-btn-primary:hover:not(:disabled) {
    background: var(--gradient-primary-hover);
    color: var(--color-primary-contrast);
    transform: translateY(-1px);
}

.hg-btn-accent {
    background: var(--gradient-accent);
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(243, 140, 12, 0.3);
}

.hg-btn-accent:hover:not(:disabled) {
    color: #ffffff;
    transform: translateY(-1px);
}

.hg-btn-outline {
    background: transparent;
    border-color: var(--color-border-strong);
    color: var(--color-primary);
}

.hg-btn-outline:hover:not(:disabled) {
    background: var(--color-primary-soft);
}

.hg-btn-lg {
    padding: 0.95rem 2.25rem;
    font-size: 1.0625rem;
    border-radius: var(--radius-lg);
}

.hg-btn-sm {
    padding: 0.45rem 0.9rem;
    font-size: var(--font-size-sm);
    border-radius: var(--radius-sm);
}

.hg-btn-block {
    width: 100%;
}


/* -------------------------------------------------------------------------
   8. FORMS
   ------------------------------------------------------------------------- */
.hg-label {
    margin: 0;
    font-weight: 600;
    color: var(--color-heading);
}

.hg-required {
    color: var(--hg-danger);
    margin-left: 2px;
}

.hg-form-control {
    width: 100%;
    height: 52px;
    padding: 0 1rem;
    background: var(--bg-input);
    color: var(--color-text);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.975rem;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.hg-form-control::placeholder {
    color: var(--color-text-subtle);
    opacity: 1;
}

.hg-form-control:hover {
    border-color: var(--color-border-strong);
}

.hg-form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--focus-ring);
    background: var(--bg-input);
    color: var(--color-text);
}

.hg-form-control:disabled {
    background: var(--bg-input-disabled);
    cursor: not-allowed;
}

.hg-form-control.is-invalid,
.hg-form-control.ng-invalid.ng-touched {
    border-color: var(--hg-danger);
}

.hg-form-control.is-invalid:focus {
    box-shadow: var(--focus-ring-danger);
}

/* Input with leading icon */
.hg-input-group {
    position: relative;
}

.hg-input-group>.hg-input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    color: var(--color-text-subtle);
    font-size: 1.05rem;
    line-height: 1;
    pointer-events: none;
    transition: color var(--transition);
}

.hg-input-group>.hg-form-control {
    padding-left: 46px;
}

.hg-input-group:focus-within>.hg-input-icon {
    color: var(--color-primary);
}

.hg-error {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.4rem;
    color: var(--hg-danger);
    font-size: 0.8125rem;
    font-weight: 500;
}

/* Checkbox */
.hg-check {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.hg-check input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    position: static;
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    margin: 1px 0 0;
    border: 2px solid var(--color-border-strong);
    border-radius: 6px;
    background: var(--bg-input) center / 14px no-repeat;
    cursor: pointer;
    transition: background-color var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.hg-check input[type="checkbox"]:hover {
    border-color: var(--color-primary);
}

.hg-check input[type="checkbox"]:checked {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M3.5 8.5l3 3 6-6.5'/%3e%3c/svg%3e");
}

.hg-check input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.hg-check label {
    margin: 0;
    color: var(--color-text);
    line-height: 1.5;
    cursor: pointer;
}

.hg-divider {
    border: 0;
    border-top: 1px solid var(--color-divider);
    margin: 1.5rem 0;
    opacity: 1;
}


/* -------------------------------------------------------------------------
   8.1 DROPDOWN  (themed replacement for a native <select>)
   Angular: <app-hg-dropdown [options]="list" allLabel="All subjects"
              icon="bi-layers" [(ngModel)]="value"></app-hg-dropdown>
   Component: src/app/theme/hg-dropdown. Short list that scrolls, search box
   when there are more than 8 options, opens upward near the screen bottom.
   size="sm" = compact (rows per page). All colours from tokens → dark ready.
   ------------------------------------------------------------------------- */
app-hg-dropdown {
    display: block;
    min-width: 0;
}

.hgdd {
    position: relative;
}

.hgdd__btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--color-text);
    font: inherit;
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.hgdd--sm .hgdd__btn {
    min-height: 34px;
    padding: 0 8px 0 10px;
    font-size: 13px;
}

.hgdd__btn:hover {
    border-color: var(--color-border-strong);
}

.hgdd__btn:focus-visible,
.hgdd.is-open .hgdd__btn {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--focus-ring);
}

.hgdd__btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.hgdd__icon {
    flex: 0 0 auto;
    color: var(--color-text-subtle);
    font-size: 14px;
}

.hgdd.is-open .hgdd__icon {
    color: var(--color-primary);
}

.hgdd__value {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    color: var(--color-heading);
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.hgdd__value.is-placeholder {
    color: var(--color-text-subtle);
    font-weight: 500;
}

.hgdd__chev {
    flex: 0 0 auto;
    color: var(--color-text-subtle);
    font-size: 12px;
    transition: transform 0.25s ease, color var(--transition);
}

.hgdd.is-open .hgdd__chev {
    color: var(--color-primary);
    transform: rotate(180deg);
}

@keyframes hgdd-in {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes hgdd-in-up {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.hgdd__panel {
    position: absolute;
    z-index: 40;
    top: calc(100% + 6px);
    left: 0;
    min-width: 100%;
    width: max-content;
    max-width: min(320px, calc(100vw - 32px));
    overflow: hidden;
    border: 1px solid var(--popup-border);
    border-radius: var(--radius-md);
    background: var(--popup-bg);
    box-shadow: var(--shadow-lg);
    color: var(--popup-color);
    transform-origin: top left;
    animation: hgdd-in 0.18s cubic-bezier(0.22, 0.7, 0.24, 1) both;
}

.hgdd.is-right .hgdd__panel {
    left: auto;
    right: 0;
    transform-origin: top right;
}

.hgdd.is-up .hgdd__panel {
    top: auto;
    bottom: calc(100% + 6px);
    transform-origin: bottom left;
    animation-name: hgdd-in-up;
}

.hgdd__search {
    position: relative;
    display: block;
    margin: 0;
    padding: 8px;
    border-bottom: 1px solid var(--color-divider);
}

.hgdd__search .bi {
    position: absolute;
    left: 20px;
    top: 50%;
    color: var(--color-text-subtle);
    transform: translateY(-50%);
    pointer-events: none;
}

.hgdd__search input {
    width: 100%;
    min-width: 180px;
    height: 34px;
    padding: 0 10px 0 32px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--color-text);
    font: inherit;
    font-size: 13px;
}

.hgdd__search input::placeholder {
    color: var(--color-text-subtle);
}

.hgdd__search input:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* short list: about 6 rows, then it scrolls */
.hgdd__list {
    display: grid;
    gap: 2px;
    max-height: 252px;
    padding: 6px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-strong) transparent;
}

.hgdd--sm .hgdd__list {
    max-height: 210px;
}

.hgdd__list::-webkit-scrollbar {
    width: 6px;
}

.hgdd__list::-webkit-scrollbar-thumb {
    border-radius: 6px;
    background: var(--color-border-strong);
}

.hgdd__opt {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 36px;
    padding: 6px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--color-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.hgdd--sm .hgdd__opt {
    min-height: 32px;
}

.hgdd__opt:hover,
.hgdd__opt:focus-visible {
    outline: none;
    background: var(--bg-surface-soft);
}

.hgdd__opt-text {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.25;
}

.hgdd__opt-text b,
.hgdd__opt-text small {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.hgdd__opt-text b {
    color: var(--color-heading);
    font-size: 13.5px;
    font-weight: 500;
}

.hgdd__opt-text small {
    color: var(--color-text-muted);
    font-size: 11.5px;
}

.hgdd__opt.is-selected {
    background: var(--color-primary-soft);
}

.hgdd__opt.is-selected .hgdd__opt-text b {
    color: var(--color-primary);
    font-weight: 700;
}

.hgdd__opt .bi-check2 {
    flex: 0 0 auto;
    color: var(--color-primary);
    font-size: 15px;
}

.hgdd__none {
    padding: 14px 10px;
    color: var(--color-text-muted);
    font-size: 13px;
    text-align: center;
}

@media (prefers-reduced-motion: reduce) {
    .hgdd__panel {
        animation: none;
    }

    .hgdd__chev {
        transition: none;
    }
}


/* -------------------------------------------------------------------------
   9. POPOVER  (hover + keyboard focus, no JS)
   Markup:
   <span class="hg-popover">
     <button type="button" class="hg-popover__trigger">label</button>
     <span class="hg-popover__content" role="tooltip">...</span>
   </span>
   ------------------------------------------------------------------------- */
.hg-popover {
    position: relative;
    display: inline-block;
}

.hg-popover__trigger {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-weight: 600;
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.hg-popover__trigger:hover {
    color: var(--color-link-hover);
}

.hg-popover__trigger:focus-visible {
    outline: none;
    border-radius: 4px;
    box-shadow: var(--focus-ring);
}

.hg-popover__content {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 12px);
    z-index: 50;
    width: min(320px, 80vw);
    padding: 1rem 1.1rem;
    background: var(--popup-bg);
    color: var(--popup-color);
    border: 1px solid var(--popup-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-size: var(--font-size-sm);
    font-weight: 400;
    line-height: 1.55;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 6px);
    transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
}

.hg-popover__content::after {
    content: "";
    position: absolute;
    left: calc(50% - 7px);
    bottom: -8px;
    width: 14px;
    height: 14px;
    background: var(--popup-bg);
    border-right: 1px solid var(--popup-border);
    border-bottom: 1px solid var(--popup-border);
    transform: rotate(45deg);
}

.hg-popover__title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
    font-weight: 700;
    color: var(--color-heading);
}

.hg-popover:hover .hg-popover__content,
.hg-popover:focus-within .hg-popover__content {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

@media (max-width: 575.98px) {

    .hg-popover__content,
    .hg-popover:hover .hg-popover__content,
    .hg-popover:focus-within .hg-popover__content {
        left: -40px;
        transform: none;
    }

    .hg-popover__content::after {
        left: 60px;
    }
}


/* -------------------------------------------------------------------------
   10. TABLES
   <div class="hg-table-wrap"><table class="hg-table">...</table></div>
   ------------------------------------------------------------------------- */
.hg-table-wrap {
    overflow: auto;
    background: var(--table-row-bg);
    border: 1px solid var(--table-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.hg-table {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--color-text);
}

.hg-table thead th {
    padding: 0.9rem 1rem;
    background: var(--table-head-bg);
    color: var(--table-head-color);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    border: 0;
}

.hg-table tbody td {
    padding: 0.85rem 1rem;
    background: var(--table-row-bg);
    border-top: 1px solid var(--table-border);
    vertical-align: middle;
}

.hg-table tbody tr:nth-child(even) td {
    background: var(--table-row-alt-bg);
}

.hg-table tbody tr:hover td {
    background: var(--table-row-hover-bg);
}


/* -------------------------------------------------------------------------
   11. POPUPS — Bootstrap modal + SweetAlert ("sweetalert" package)
   SweetAlert injects its own CSS at runtime (after ours), so every swal
   rule here is prefixed with .swal-overlay to win on specificity.
   ------------------------------------------------------------------------- */
.modal-backdrop.show {
    background: var(--bg-overlay);
    opacity: 1;
}

.modal-content {
    background: var(--popup-bg);
    color: var(--popup-color);
    border: 1px solid var(--popup-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.modal-header,
.modal-footer {
    border-color: var(--color-divider);
}

.modal-title {
    color: var(--color-heading);
    font-weight: 700;
}

.swal-overlay {
    background-color: var(--bg-overlay);
}

.swal-overlay .swal-modal {
    background: var(--popup-bg);
    border: 1px solid var(--popup-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.swal-overlay .swal-title {
    color: var(--color-heading);
    font-weight: 700;
}

.swal-overlay .swal-text {
    color: var(--color-text-muted);
    text-align: center;
}

.swal-overlay .swal-footer {
    text-align: center;
}

.swal-overlay .swal-button {
    padding: 10px 28px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    font-weight: 600;
    box-shadow: var(--shadow-primary);
}

.swal-overlay .swal-button:not([disabled]):hover {
    background: var(--gradient-primary-hover);
}

.swal-overlay .swal-button:focus {
    box-shadow: var(--focus-ring);
}

.swal-overlay .swal-button--cancel {
    background: var(--bg-surface-soft);
    color: var(--color-primary);
    box-shadow: none;
}

.swal-overlay .swal-button--cancel:not([disabled]):hover {
    background: var(--color-border);
}

.swal-overlay .swal-button--danger {
    background: var(--hg-danger);
}


/* -------------------------------------------------------------------------
   12. LOADING KIT
   All colors come from --loader-* / --skeleton-* tokens (dark theme
   overrides them), so every loader works in both themes.
   ------------------------------------------------------------------------- */

/* ---- 12.1 Spinner -------------------------------------------------------
   <span class="hg-spinner"></span>
   <span class="hg-spinner hg-spinner--sm"></span>   (inside buttons)
   <span class="hg-spinner hg-spinner--lg"></span>
   Inside a button it inherits the button text colour.
   ------------------------------------------------------------------------ */
.hg-spinner {
    --hg-spinner-size: 24px;
    display: inline-block;
    flex: 0 0 auto;
    width: var(--hg-spinner-size);
    height: var(--hg-spinner-size);
    border: 3px solid var(--loader-track);
    border-top-color: var(--loader-color);
    border-radius: 50%;
    vertical-align: middle;
    animation: hg-spin 0.7s linear infinite;
}

.hg-spinner--sm {
    --hg-spinner-size: 16px;
    border-width: 2px;
}

.hg-spinner--lg {
    --hg-spinner-size: 44px;
    border-width: 4px;
}

.hg-btn .hg-spinner {
    border-color: currentColor;
    border-right-color: transparent;
    opacity: 0.9;
}

/* ---- 12.2 Dots ----------------------------------------------------------
   <span class="hg-dots"><i></i><i></i><i></i></span>
   ------------------------------------------------------------------------ */
.hg-dots {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.hg-dots i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    animation: hg-dot 1s ease-in-out infinite;
}

.hg-dots i:nth-child(2) {
    animation-delay: 0.15s;
}

.hg-dots i:nth-child(3) {
    animation-delay: 0.3s;
}

/* ---- 12.3 Button loading state ------------------------------------------
   <button class="hg-btn hg-btn-primary" [class.is-loading]="loading"
           [disabled]="loading" [attr.aria-busy]="loading">
     <span *ngIf="loading" class="hg-spinner hg-spinner--sm"></span>
     {{ loading ? 'Saving…' : 'Save' }}
   </button>
   ------------------------------------------------------------------------ */
.hg-btn.is-loading,
.hg-btn.is-loading:disabled {
    opacity: 0.92;
    cursor: progress;
    pointer-events: none;
}

.hg-btn-primary.is-loading,
.hg-btn-accent.is-loading {
    background-size: 200% 200%;
    animation: hg-btn-shift 1.6s ease-in-out infinite;
}

/* Flying icon (paper plane etc.) — animates while the button .is-loading
   <span class="hg-btn-fly"><i class="fa fa-paper-plane"></i></span>        */
.hg-btn-fly {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25em;
    height: 1.25em;
    overflow: hidden;
}

.hg-btn-fly>i {
    display: block;
    line-height: 1;
    transition: transform var(--transition);
}

.hg-btn:hover:not(:disabled) .hg-btn-fly>i {
    transform: translate(2px, -2px);
}

.hg-btn.is-loading .hg-btn-fly>i {
    animation: hg-fly 1.1s cubic-bezier(0.55, 0, 0.45, 1) infinite;
}

/* ---- 12.4 Top progress bar (route change / page fetch) ------------------
   <div class="hg-progress-bar" *ngIf="loading"></div>
   Add .hg-progress-bar--fixed to pin it to the top of the viewport.
   ------------------------------------------------------------------------ */
.hg-progress-bar {
    position: relative;
    height: 3px;
    width: 100%;
    overflow: hidden;
    background: var(--loader-track);
    border-radius: var(--radius-pill);
}

.hg-progress-bar::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 40%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--loader-color), var(--loader-accent));
    animation: hg-progress 1.2s ease-in-out infinite;
}

.hg-progress-bar--fixed {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2000;
    border-radius: 0;
}

/* ---- 12.5 Page loader ---------------------------------------------------
   Full page (fixed overlay):
   <div class="hg-page-loader hg-page-loader--overlay" *ngIf="loading">
     <div class="hg-loader">
       <span class="hg-loader__ring"></span>
       <i class="fa fa-graduation-cap"></i>
     </div>
     <p class="hg-loader__text">Loading<span class="hg-dots"><i></i><i></i><i></i></span></p>
   </div>
   Inside a page area: drop --overlay (renders as a centred block).
   ------------------------------------------------------------------------ */
.hg-page-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-height: 320px;
    padding: 2rem;
    color: var(--color-text-muted);
    animation: hg-fade-in 0.25s ease both;
}

.hg-page-loader--overlay {
    position: fixed;
    inset: 0;
    z-index: 1900;
    min-height: 0;
    background: var(--loader-overlay-bg);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.hg-loader {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--bg-surface);
    box-shadow: var(--shadow-md);
    color: var(--loader-color);
    font-size: 1.6rem;
}

.hg-loader>i {
    animation: hg-pulse 1.4s ease-in-out infinite;
}

.hg-loader__ring {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 3px solid var(--loader-track);
    border-top-color: var(--loader-color);
    border-right-color: var(--loader-accent);
    animation: hg-spin 0.9s linear infinite;
}

.hg-loader__text {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    margin: 0;
    font-weight: 600;
    color: var(--color-text-muted);
}

.hg-loader__text .hg-dots i {
    width: 4px;
    height: 4px;
}

/* ---- 12.6 Section / card overlay ----------------------------------------
   <div class="hg-loading-wrap">
     ...card or form content...
     <div class="hg-loading-mask" *ngIf="loading"><span class="hg-spinner hg-spinner--lg"></span></div>
   </div>
   ------------------------------------------------------------------------ */
.hg-loading-wrap {
    position: relative;
}

.hg-loading-mask {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    background: var(--loader-overlay-bg);
    animation: hg-fade-in 0.2s ease both;
}

/* ---- 12.7 Skeletons -----------------------------------------------------
   <span class="hg-skeleton hg-skeleton--text"></span>
   <span class="hg-skeleton hg-skeleton--title"></span>
   <span class="hg-skeleton hg-skeleton--circle"></span>
   <span class="hg-skeleton hg-skeleton--btn"></span>
   <div  class="hg-skeleton hg-skeleton--block" style="height:160px"></div>
   Width helpers: .hg-w-25 / .hg-w-50 / .hg-w-75 / .hg-w-100
   ------------------------------------------------------------------------ */
.hg-skeleton {
    display: block;
    position: relative;
    overflow: hidden;
    background: var(--skeleton-base);
    border-radius: var(--radius-sm);
}

.hg-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent 0%, var(--skeleton-shine) 50%, transparent 100%);
    animation: hg-shimmer 1.4s ease-in-out infinite;
}

.hg-skeleton--text {
    height: 12px;
    width: 100%;
    margin: 6px 0;
    border-radius: var(--radius-pill);
}

.hg-skeleton--title {
    height: 20px;
    width: 60%;
    margin: 4px 0 12px;
    border-radius: var(--radius-pill);
}

.hg-skeleton--circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.hg-skeleton--avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    flex: 0 0 auto;
}

.hg-skeleton--btn {
    height: 44px;
    width: 160px;
    border-radius: var(--radius-md);
}

.hg-skeleton--input {
    height: 52px;
    width: 100%;
    border-radius: var(--radius-md);
}

.hg-skeleton--block {
    width: 100%;
    min-height: 120px;
    border-radius: var(--radius-lg);
}

.hg-w-25 {
    width: 25% !important;
}

.hg-w-50 {
    width: 50% !important;
}

.hg-w-75 {
    width: 75% !important;
}

.hg-w-100 {
    width: 100% !important;
}

/* ---- 12.8 Table loading -------------------------------------------------
   a) Thin bar under the header while (re)loading existing rows:
      <div class="hg-table-wrap" [class.is-loading]="loading"> ... </div>
   b) Skeleton rows on first load:
      <tr class="hg-skeleton-row" *ngFor="let r of [1,2,3,4,5]">
        <td><span class="hg-skeleton hg-skeleton--text"></span></td> ...
      </tr>
   ------------------------------------------------------------------------ */
.hg-table-wrap {
    position: relative;
}

.hg-table-wrap.is-loading::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    z-index: 3;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--loader-color), var(--loader-accent), transparent);
    background-size: 50% 100%;
    background-repeat: no-repeat;
    animation: hg-table-bar 1.1s linear infinite;
}

.hg-table-wrap.is-loading tbody {
    opacity: 0.55;
    transition: opacity var(--transition);
    pointer-events: none;
}

.hg-table .hg-skeleton-row td,
.hg-table .hg-skeleton-row:hover td {
    background: var(--table-row-bg);
}

.hg-table .hg-skeleton-row td {
    padding-top: 1.05rem;
    padding-bottom: 1.05rem;
}

.hg-table .hg-skeleton-row:nth-child(3n+2) .hg-skeleton--text {
    width: 70%;
}

.hg-table .hg-skeleton-row:nth-child(3n) .hg-skeleton--text {
    width: 85%;
}

/* ---- 12.9 Keyframes ---------------------------------------------------- */
@keyframes hg-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes hg-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes hg-shimmer {
    100% {
        transform: translateX(100%);
    }
}

@keyframes hg-dot {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes hg-pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(0.86);
        opacity: 0.7;
    }
}

@keyframes hg-progress {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(260%);
    }
}

@keyframes hg-table-bar {
    0% {
        background-position: -50% 0;
    }

    100% {
        background-position: 150% 0;
    }
}

@keyframes hg-btn-shift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* paper plane: flies out top-right, re-enters bottom-left */
@keyframes hg-fly {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 1;
    }

    40% {
        transform: translate(140%, -140%) rotate(-12deg) scale(0.7);
        opacity: 0;
    }

    41% {
        transform: translate(-140%, 140%) rotate(-12deg) scale(0.7);
        opacity: 0;
    }

    75% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(0, 0);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {

    .hg-spinner,
    .hg-loader__ring {
        animation-duration: 1.6s;
    }

    .hg-skeleton::after,
    .hg-dots i,
    .hg-loader>i,
    .hg-btn.is-loading,
    .hg-btn.is-loading .hg-btn-fly>i,
    .hg-table-wrap.is-loading::before {
        animation: none;
    }
}


/* -------------------------------------------------------------------------
   13. DECORATED POPUP
   A popup surface with: top glow, curved contour lines in the corners,
   a dotted patch, and layered waves along the bottom. Pure CSS, themed.

   Tone variants:  hg-popup--primary (default) | --warning | --success | --danger

   a) Custom / Bootstrap modal:
      <div class="modal-content hg-popup hg-popup--warning"> ... </div>

   b) Full markup:
      <div class="hg-popup hg-popup--warning">
        <button type="button" class="hg-popup__close" aria-label="Close"><i class="bi bi-x-lg"></i></button>
        <div class="hg-popup__icon">
          <i class="bi bi-bell-fill hg-popup__icon-ring"></i>
          <span class="hg-popup__badge">!</span>
        </div>
        <h3 class="hg-popup__title">Fees Overdue</h3>
        <p class="hg-popup__text">Gentle reminder: ...</p>
        <div class="hg-popup__actions">
          <button class="hg-btn hg-btn-primary"><i class="bi bi-check2"></i> Sure</button>
        </div>
      </div>

   c) SweetAlert: automatic — every swal() is styled, see 13.1.
   ------------------------------------------------------------------------- */
.hg-popup,
.swal-overlay .swal-modal {
    --hg-popup-tone: var(--color-primary);
    --hg-popup-tone-2: var(--color-accent);
    position: relative;
    overflow: hidden;
    isolation: isolate;
    padding: 2.25rem 2rem 2rem;
    background:
        /* soft top glow */
        radial-gradient(75% 60% at 50% -10%,
            color-mix(in srgb, var(--hg-popup-tone) var(--popup-glow-mix), transparent) 0%,
            transparent 70%),
        var(--popup-bg);
    color: var(--popup-color);
    border: 1px solid var(--popup-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.hg-popup--primary {
    --hg-popup-tone: var(--color-primary);
    --hg-popup-tone-2: var(--color-accent);
}

.hg-popup--warning {
    --hg-popup-tone: var(--hg-warning);
    --hg-popup-tone-2: var(--color-primary);
}

.hg-popup--success {
    --hg-popup-tone: var(--hg-success);
    --hg-popup-tone-2: var(--color-primary);
}

.hg-popup--danger {
    --hg-popup-tone: var(--hg-danger);
    --hg-popup-tone-2: var(--hg-warning);
}

/* Corner contour lines + dotted patch, each faded out by the mask */
.hg-popup::before,
.swal-overlay .swal-modal::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        /* curved lines — top-right */
        repeating-radial-gradient(circle at 106% -12%,
            transparent 0 22px,
            color-mix(in srgb, var(--hg-popup-tone) var(--popup-line-mix), transparent) 22px 23.5px) right top / 190px 150px no-repeat,
        /* curved lines — bottom-left */
        repeating-radial-gradient(circle at -8% 112%,
            transparent 0 20px,
            color-mix(in srgb, var(--hg-popup-tone-2) var(--popup-line-mix), transparent) 20px 21.5px) left bottom / 170px 140px no-repeat,
        /* dotted patch — top-left */
        radial-gradient(circle,
            color-mix(in srgb, var(--hg-popup-tone-2) 30%, transparent) 1.3px, transparent 1.6px) 22px 22px / 12px 12px;
    /* fade each decoration out toward the centre */
    -webkit-mask-image:
        radial-gradient(180px 150px at 100% 0%, #000 30%, transparent 100%),
        radial-gradient(170px 140px at 0% 100%, #000 30%, transparent 100%),
        radial-gradient(90px 70px at 40px 34px, #000 0%, transparent 100%);
    mask-image:
        radial-gradient(180px 150px at 100% 0%, #000 30%, transparent 100%),
        radial-gradient(170px 140px at 0% 100%, #000 30%, transparent 100%),
        radial-gradient(90px 70px at 40px 34px, #000 0%, transparent 100%);
}

/* Bottom double wave */
.hg-popup::after,
.swal-overlay .swal-modal::after {
    content: "";
    position: absolute;
    left: -2%;
    right: -2%;
    bottom: 0;
    height: 42%;
    max-height: 120px;
    z-index: -1;
    pointer-events: none;
    background:
        linear-gradient(180deg,
            color-mix(in srgb, var(--hg-popup-tone) var(--popup-wave2-mix), transparent),
            color-mix(in srgb, var(--hg-popup-tone) var(--popup-wave-mix), transparent));
    -webkit-mask:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 100' preserveAspectRatio='none'%3E%3Cpath d='M0 62 C70 30 130 30 200 55 S330 92 400 48 V100 H0Z' fill='%23000' fill-opacity='.55'/%3E%3Cpath d='M0 80 C80 58 150 96 230 78 S350 50 400 70 V100 H0Z' fill='%23000'/%3E%3Cpath d='M0 48 C90 18 150 40 210 46 S330 70 400 30' fill='none' stroke='%23000' stroke-width='1.6' stroke-opacity='.9'/%3E%3C/svg%3E") center bottom / 100% 100% no-repeat;
    mask:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 100' preserveAspectRatio='none'%3E%3Cpath d='M0 62 C70 30 130 30 200 55 S330 92 400 48 V100 H0Z' fill='%23000' fill-opacity='.55'/%3E%3Cpath d='M0 80 C80 58 150 96 230 78 S350 50 400 70 V100 H0Z' fill='%23000'/%3E%3Cpath d='M0 48 C90 18 150 40 210 46 S330 70 400 30' fill='none' stroke='%23000' stroke-width='1.6' stroke-opacity='.9'/%3E%3C/svg%3E") center bottom / 100% 100% no-repeat;
}

/* keep all real content above the decoration */
.hg-popup>*,
.swal-overlay .swal-modal>* {
    position: relative;
    z-index: 1;
}

/* Close button */
.hg-popup__close {
    position: absolute !important;
    top: 14px;
    right: 14px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--popup-border);
    border-radius: 50%;
    background: color-mix(in srgb, var(--popup-bg) 80%, transparent);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    color: var(--color-text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), transform var(--transition);
}

.hg-popup__close:hover {
    color: var(--color-heading);
    background: var(--bg-surface-soft);
    transform: rotate(90deg);
}

.hg-popup__close:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Icon with halo rings */
.hg-popup__icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 76px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%,
            color-mix(in srgb, var(--hg-popup-tone) 22%, var(--popup-bg)),
            color-mix(in srgb, var(--hg-popup-tone) 10%, var(--popup-bg)));
    color: var(--hg-popup-tone);
    font-size: 2rem;
    box-shadow:
        0 0 0 8px color-mix(in srgb, var(--hg-popup-tone) 9%, transparent),
        0 0 0 16px color-mix(in srgb, var(--hg-popup-tone) 5%, transparent),
        0 12px 26px color-mix(in srgb, var(--hg-popup-tone) 28%, transparent);
}

.hg-popup__icon>i {
    line-height: 1;
    transform-origin: 50% 10%;
}

.hg-popup--warning .hg-popup__icon>i {
    animation: hg-ring 2.4s ease-in-out infinite;
}

.hg-popup__badge {
    position: absolute;
    top: 2px;
    right: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--hg-danger);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 800;
    border: 2px solid var(--popup-bg);
    animation: hg-pop 2.4s ease-in-out infinite;
}

.hg-popup__title {
    margin: 0 0 0.5rem;
    font-size: var(--font-size-2xl);
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--color-heading);
}

.hg-popup__text {
    max-width: 34ch;
    margin: 0 auto 1.5rem;
    color: var(--color-text-muted);
    font-size: 1rem;
    line-height: 1.55;
}

.hg-popup__actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.hg-popup__actions .hg-btn {
    min-width: 150px;
}

/* -------------------------------------------------------------------------
   13.1 SweetAlert — every swal() gets the decorated popup automatically.
   No code changes needed:  swal("Done", "…", "success")
   Tone follows the icon: success → green, error → red, warning → orange,
   info / no icon → blue.  (Needs :has(), all current browsers support it.)
   ------------------------------------------------------------------------- */
.swal-overlay .swal-modal {
    padding: 1.75rem 1.25rem 1.5rem;
}

.swal-overlay .swal-modal:has(.swal-icon--success) {
    --hg-popup-tone: var(--hg-success);
    --hg-popup-tone-2: var(--color-primary);
}

.swal-overlay .swal-modal:has(.swal-icon--error) {
    --hg-popup-tone: var(--hg-danger);
    --hg-popup-tone-2: var(--hg-warning);
}

.swal-overlay .swal-modal:has(.swal-icon--warning) {
    --hg-popup-tone: var(--hg-warning);
    --hg-popup-tone-2: var(--color-primary);
}

.swal-overlay .swal-modal:has(.swal-icon--info) {
    --hg-popup-tone: var(--hg-info);
    --hg-popup-tone-2: var(--color-accent);
}

.swal-overlay .swal-modal .swal-title {
    padding: 0 1rem;
    margin: 0.5rem 0 0.25rem !important;
    font-size: var(--font-size-2xl);
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--color-heading);
}

.swal-overlay .swal-modal .swal-text {
    display: block;
    max-width: 34ch;
    margin: 0 auto;
    padding: 0 1rem;
    color: var(--color-text-muted);
    font-size: 1rem;
    line-height: 1.55;
    text-align: center;
}

.swal-overlay .swal-modal .swal-footer {
    margin-top: 1.25rem;
    padding: 0 1rem;
    background: transparent;
    border: 0;
    text-align: center;
}

.swal-overlay .swal-modal .swal-button {
    min-width: 140px;
}

/* Icon → same halo look as .hg-popup__icon, tinted by tone */
.swal-overlay .swal-modal .swal-icon {
    --hg-swal-icon-bg: color-mix(in srgb, var(--hg-popup-tone) 12%, var(--popup-bg));
    margin: 0.5rem auto 1rem;
    border-color: color-mix(in srgb, var(--hg-popup-tone) 45%, transparent);
    background-color: var(--hg-swal-icon-bg);
    box-shadow:
        0 0 0 8px color-mix(in srgb, var(--hg-popup-tone) 9%, transparent),
        0 0 0 16px color-mix(in srgb, var(--hg-popup-tone) 5%, transparent),
        0 12px 26px color-mix(in srgb, var(--hg-popup-tone) 24%, transparent);
}

/* success icon draws its animation with solid "cover" shapes — match them
   to the icon fill and clip them to the circle so no squares show */
.swal-overlay .swal-modal .swal-icon--success {
    overflow: hidden;
    border-color: transparent;
}

.swal-overlay .swal-modal .swal-icon--success::before,
.swal-overlay .swal-modal .swal-icon--success::after,
.swal-overlay .swal-modal .swal-icon--success__hide-corners {
    background: var(--hg-swal-icon-bg) !important;
}

.swal-overlay .swal-modal .swal-icon--success__ring {
    border-color: color-mix(in srgb, var(--hg-popup-tone) 45%, transparent);
    top: -4px;
    left: -4px;
}

.swal-overlay .swal-modal .swal-icon--success__line {
    background-color: var(--hg-popup-tone);
}

.swal-overlay .swal-modal .swal-icon--error__line {
    background-color: var(--hg-popup-tone);
}

.swal-overlay .swal-modal .swal-icon--warning__body,
.swal-overlay .swal-modal .swal-icon--warning__dot {
    background-color: var(--hg-popup-tone);
}

.swal-overlay .swal-modal .swal-icon--info::before,
.swal-overlay .swal-modal .swal-icon--info::after {
    background-color: var(--hg-popup-tone);
}

.swal-overlay .swal-modal .swal-icon--warning {
    animation: none;
}

.swal-overlay .swal-modal .swal-icon--warning__body {
    animation: hg-pulse 1.6s ease-in-out infinite;
}

/* Opt-in variants still work: swal({ ..., className: "hg-popup--warning" }) */
.swal-overlay .swal-modal.hg-popup--primary {
    --hg-popup-tone: var(--color-primary);
    --hg-popup-tone-2: var(--color-accent);
}

.swal-overlay .swal-modal.hg-popup--warning {
    --hg-popup-tone: var(--hg-warning);
    --hg-popup-tone-2: var(--color-primary);
}

.swal-overlay .swal-modal.hg-popup--success {
    --hg-popup-tone: var(--hg-success);
    --hg-popup-tone-2: var(--color-primary);
}

.swal-overlay .swal-modal.hg-popup--danger {
    --hg-popup-tone: var(--hg-danger);
    --hg-popup-tone-2: var(--hg-warning);
}

@keyframes hg-ring {

    0%,
    60%,
    100% {
        transform: rotate(0);
    }

    64% {
        transform: rotate(14deg);
    }

    70% {
        transform: rotate(-12deg);
    }

    76% {
        transform: rotate(8deg);
    }

    82% {
        transform: rotate(-5deg);
    }

    88% {
        transform: rotate(0);
    }
}

@keyframes hg-pop {

    0%,
    60%,
    100% {
        transform: scale(1);
    }

    70% {
        transform: scale(1.18);
    }
}

@media (prefers-reduced-motion: reduce) {

    .hg-popup__icon>i,
    .hg-popup__badge {
        animation: none;
    }
}


/* -------------------------------------------------------------------------
   14. PAGE PATTERNS  (dashboard / list pages)
   Reusable across student pages. All colours from tokens → dark ready.
   ------------------------------------------------------------------------- */

/* ---- 14.1 Sidebar + content layout --------------------------------------
   <div class="row hg-layout">
     <div class="menuleft">…sidebar…</div>
     <div class="hg-layout__main">…page…</div>
   </div>
   ------------------------------------------------------------------------ */
.hg-layout {
    flex-wrap: nowrap;
}

.hg-layout>.menuleft,
.hg-layout>.hg-layout__side {
    flex: 0 0 auto;
}

.hg-layout__main {
    flex: 1 1 0;
    min-width: 0;
    padding-left: 15px;
    padding-right: 15px;
}

@media (max-width: 767.98px) {
    .hg-layout {
        flex-wrap: wrap;
    }

    .hg-layout>.menuleft,
    .hg-layout>.hg-layout__side,
    .hg-layout__main {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ---- 14.2 Page header ---------------------------------------------------
   <header class="hg-page-head">
     <span class="hg-icon-box hg-icon-box--lg"><i class="bi bi-chat-dots"></i></span>
     <div class="hg-page-head__text"><h1>Title</h1><p>Subtitle</p></div>
     <div class="hg-page-head__actions">…buttons…</div>
   </header>
   ------------------------------------------------------------------------ */
.hg-page-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.hg-page-head__text {
    flex: 1 1 auto;
    min-width: 0;
}

.hg-page-head__text h1 {
    margin: 0;
    font-size: clamp(1.4rem, 2.2vw, 1.85rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--color-heading);
}

.hg-page-head__text p {
    margin: 0.2rem 0 0;
    color: var(--color-text-muted);
}

.hg-page-head__actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

@media (max-width: 575.98px) {
    .hg-page-head {
        flex-wrap: wrap;
    }

    .hg-page-head__actions {
        width: 100%;
    }

    .hg-page-head__actions .hg-btn {
        flex: 1 1 auto;
    }
}

/* ---- 14.3 Stat cards ----------------------------------------------------
   <button type="button" class="hg-stat hg-stat--info" [class.is-active]="…">
     <span class="hg-stat__icon"><i class="bi bi-file-earmark-text"></i></span>
     <span class="hg-stat__body"><strong>Submitted</strong><span>3 Feedback</span></span>
   </button>
   Tones: --primary (default) | --info | --warning | --success | --danger
   ------------------------------------------------------------------------ */
.hg-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.hg-stat {
    --hg-stat-tone: var(--color-primary);
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    padding: 1.1rem 1.2rem;
    overflow: hidden;
    text-align: left;
    font: inherit;
    color: var(--color-text);
    background:
        radial-gradient(120% 140% at 0% 0%,
            color-mix(in srgb, var(--hg-stat-tone) 10%, transparent) 0%, transparent 60%),
        var(--bg-surface);
    border: 1.5px solid color-mix(in srgb, var(--hg-stat-tone) 18%, var(--color-border));
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

button.hg-stat {
    cursor: pointer;
}

button.hg-stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

button.hg-stat:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.hg-stat.is-active {
    border-color: var(--hg-stat-tone);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--hg-stat-tone) 16%, transparent), var(--shadow-md);
}

/* soft corner ring */
.hg-stat::after {
    content: "";
    position: absolute;
    right: -28px;
    bottom: -28px;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 14px solid color-mix(in srgb, var(--hg-stat-tone) 7%, transparent);
    pointer-events: none;
}

.hg-stat__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--hg-stat-tone) 14%, var(--bg-surface));
    color: var(--hg-stat-tone);
    font-size: 1.45rem;
}

.hg-stat__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.hg-stat__body strong {
    color: var(--color-heading);
    font-size: 1.05rem;
    font-weight: 700;
}

.hg-stat__body span {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.hg-stat__value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-heading);
    line-height: 1.1;
}

.hg-stat--primary {
    --hg-stat-tone: var(--color-primary);
}

.hg-stat--info {
    --hg-stat-tone: var(--hg-info);
}

.hg-stat--warning {
    --hg-stat-tone: var(--hg-warning);
}

.hg-stat--success {
    --hg-stat-tone: var(--hg-success);
}

.hg-stat--danger {
    --hg-stat-tone: var(--hg-danger);
}

[data-theme="dark"] .hg-stat--info {
    --hg-stat-tone: #8b7cf6;
}

/* keep info distinct from primary on dark */
@media (max-width: 575.98px) {
    .hg-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.6rem;
    }

    .hg-stat {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
        padding: 0.85rem;
    }

    .hg-stat__icon {
        flex-basis: 40px;
        width: 40px;
        height: 40px;
        font-size: 1.15rem;
    }

    .hg-stat__body strong {
        font-size: 0.95rem;
    }

    .hg-stat__body span {
        font-size: 0.82rem;
    }
}

/* ---- 14.4 Filter tabs (pills) -------------------------------------------
   <div class="hg-tabs" role="tablist">
     <button class="hg-tab is-active" role="tab"><i class="bi bi-…"></i> All <span class="hg-tab__count">3</span></button>
   </div>
   ------------------------------------------------------------------------ */
.hg-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hg-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.95rem;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    background: var(--bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-xs);
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.hg-tab>i {
    font-size: 1rem;
    line-height: 1;
}

.hg-tab:hover {
    border-color: var(--color-border-strong);
    background: var(--bg-surface-soft);
}

.hg-tab:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.hg-tab__count {
    min-width: 22px;
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-pill);
    background: var(--bg-surface-soft);
    color: var(--color-text-muted);
    font-size: 0.78rem;
    text-align: center;
}

.hg-tab.is-active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: #ffffff;
    box-shadow: var(--shadow-primary);
}

.hg-tab.is-active>i {
    color: inherit !important;
}

.hg-tab.is-active .hg-tab__count {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* ---- 14.5 Soft table variant + cells ------------------------------------
   <div class="hg-table-wrap"><table class="hg-table hg-table--soft">…</table></div>
   ------------------------------------------------------------------------ */
.hg-table--soft thead th {
    text-align: left;
    background: var(--bg-surface-soft);
    color: var(--color-heading);
    font-size: 0.875rem;
    letter-spacing: 0;
    text-transform: none;
    border-bottom: 1px solid var(--table-border);
}

.hg-table--soft thead th>i {
    margin-right: 0.45rem;
    color: var(--color-primary);
    font-size: 0.95rem;
}

.hg-table--soft tbody tr:nth-child(even) td {
    background: var(--table-row-bg);
}

.hg-table--soft tbody tr:hover td {
    background: var(--table-row-hover-bg);
}

.hg-table--soft td+td,
.hg-table--soft th+th {
    border-left: 1px solid var(--color-divider);
}

.hg-cell-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.45;
}

.hg-cell-muted {
    color: var(--color-text-subtle);
}

/* Empty state row / block */
.hg-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2.5rem 1rem;
    color: var(--color-text-muted);
    text-align: center;
}

.hg-empty>.hg-icon-box {
    --hg-icon-size: 60px;
    border-radius: 50%;
    margin-bottom: 0.25rem;
}

.hg-empty strong {
    color: var(--color-heading);
    font-size: 1.05rem;
}

/* Larger badge with icon */
.hg-badge--lg {
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    white-space: nowrap;
}

.hg-badge--lg>i {
    font-size: 1rem;
    line-height: 1;
}

/* Square icon-only button */
.hg-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--color-text);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.hg-icon-btn:hover:not(:disabled) {
    border-color: var(--color-border-strong);
    background: var(--bg-surface-soft);
    color: var(--color-primary);
}

.hg-icon-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.hg-icon-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.hg-icon-btn.is-active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: #ffffff;
    box-shadow: var(--shadow-primary);
    font-weight: 700;
}

/* ---- 14.6 Pagination ----------------------------------------------------
   <div class="hg-pagination">
     <span class="hg-pagination__info">Showing 1 to 10 of 42 records</span>
     <div class="hg-pagination__controls">
       <select class="hg-select hg-select--sm">…</select>
       <div class="hg-pagination__pages">
         <button class="hg-icon-btn"><i class="bi bi-chevron-double-left"></i></button> …
       </div>
     </div>
   </div>
   ------------------------------------------------------------------------ */
.hg-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 0.25rem 0;
    color: var(--color-text-muted);
    font-size: 0.925rem;
}

.hg-pagination__info strong {
    color: var(--color-heading);
}

.hg-pagination__controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.hg-pagination__pages {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.hg-select {
    height: 44px;
    padding: 0 2.25rem 0 0.9rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--bg-input) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%238a92a8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3.5 6l4.5 4.5L12.5 6'/%3e%3c/svg%3e") no-repeat right 0.75rem center / 14px;
    color: var(--color-text);
    font: inherit;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.hg-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--focus-ring);
}

.hg-select--sm {
    height: 38px;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
}

/* ---- 14.7 Dialog (PrimeNG p-dialog) -------------------------------------
   <p-dialog styleClass="hg-dialog" …>
   Covers PrimeNG ≤ 9 (.ui-dialog) and ≥ 10 (.p-dialog).
   Prefix with body to override node_modules nova-light theme in dark mode.
   ------------------------------------------------------------------------ */
body .hg-dialog.ui-dialog,
body .hg-dialog.p-dialog,
.hg-dialog.ui-dialog,
.hg-dialog.p-dialog {
    max-width: calc(100vw - 32px);
    padding: 0 !important;
    overflow: hidden !important;
    background: var(--popup-bg) !important;
    color: var(--popup-color) !important;
    border: 1px solid var(--popup-border) !important;
    border-radius: var(--radius-xl) !important;
    box-shadow: var(--shadow-lg) !important;
}

body .hg-dialog .ui-dialog-titlebar,
body .hg-dialog .p-dialog-header,
.hg-dialog .ui-dialog-titlebar,
.hg-dialog .p-dialog-header {
    display: flex !important;
    align-items: center !important;
    padding: 1.1rem 1.5rem !important;
    background:
        radial-gradient(80% 160% at 0% 0%, color-mix(in srgb, var(--color-primary) 12%, transparent), transparent 60%),
        var(--popup-bg) !important;
    border: 0 !important;
    border-bottom: 1px solid var(--color-divider) !important;
    color: var(--color-heading) !important;
}

body .hg-dialog .ui-dialog-title,
body .hg-dialog .p-dialog-title,
.hg-dialog .ui-dialog-title,
.hg-dialog .p-dialog-title {
    font-size: 1.2rem !important;
    font-weight: 800 !important;
    color: var(--color-heading) !important;
}

body .hg-dialog .ui-dialog-titlebar-icon,
body .hg-dialog .p-dialog-header-icon,
.hg-dialog .ui-dialog-titlebar-icon,
.hg-dialog .p-dialog-header-icon {
    width: 36px !important;
    height: 36px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-left: auto !important;
    border: 1px solid var(--popup-border) !important;
    border-radius: 50% !important;
    background: var(--popup-bg) !important;
    color: var(--color-text-muted) !important;
    transition: transform var(--transition), color var(--transition), background var(--transition) !important;
}

body .hg-dialog .ui-dialog-titlebar-icon:hover,
body .hg-dialog .p-dialog-header-icon:hover,
.hg-dialog .ui-dialog-titlebar-icon:hover,
.hg-dialog .p-dialog-header-icon:hover {
    transform: rotate(90deg) !important;
    color: var(--color-heading) !important;
    background: var(--bg-surface-soft) !important;
}

body .hg-dialog .ui-dialog-content,
body .hg-dialog .p-dialog-content,
.hg-dialog .ui-dialog-content,
.hg-dialog .p-dialog-content {
    padding: 1.4rem 1.5rem !important;
    max-height: calc(100vh - 160px) !important;
    overflow: auto !important;
    background: var(--popup-bg) !important;
    color: var(--popup-color) !important;
    border: 0 !important;
}

.ui-widget-overlay,
.ui-dialog-mask,
.p-dialog-mask.p-component-overlay {
    background-color: var(--bg-overlay) !important;
}

/* ---- 14.8 Emoji / choice rating -----------------------------------------
   <div class="hg-rating" role="radiogroup">
     <label class="hg-rating__opt hg-rating__opt--danger">
       <input type="radio" …>
       <span class="hg-rating__face"><i class="bi bi-emoji-frown-fill"></i><span>Sad</span></span>
     </label>
   </div>
   ------------------------------------------------------------------------ */
.hg-rating {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.75rem;
}

.hg-rating__opt {
    --hg-rate-tone: var(--color-primary);
    position: relative;
    margin: 0;
    cursor: pointer;
}

.hg-rating__opt--danger {
    --hg-rate-tone: var(--hg-danger);
}

.hg-rating__opt--warning {
    --hg-rate-tone: var(--hg-warning);
}

.hg-rating__opt--success {
    --hg-rate-tone: var(--hg-success);
}

.hg-rating__opt>input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.hg-rating__face {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    padding: 1rem 0.75rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    color: var(--color-text-muted);
    font-weight: 600;
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition), transform var(--transition);
}

.hg-rating__face>i {
    font-size: 2rem;
    line-height: 1;
    color: var(--hg-rate-tone);
    opacity: 0.45;
    transition: transform var(--transition), opacity var(--transition);
}

.hg-rating__opt:hover .hg-rating__face>i {
    opacity: 0.8;
}

.hg-rating__opt:hover .hg-rating__face {
    border-color: color-mix(in srgb, var(--hg-rate-tone) 45%, var(--color-border));
    transform: translateY(-2px);
}

.hg-rating__opt>input:focus-visible+.hg-rating__face {
    box-shadow: var(--focus-ring);
}

.hg-rating__opt>input:checked+.hg-rating__face {
    border-color: var(--hg-rate-tone);
    background: color-mix(in srgb, var(--hg-rate-tone) 9%, var(--bg-surface));
    color: var(--color-heading);
    box-shadow: 0 8px 20px color-mix(in srgb, var(--hg-rate-tone) 22%, transparent);
}

.hg-rating__opt>input:checked+.hg-rating__face>i {
    opacity: 1;
    transform: scale(1.15);
}

/* ---- 14.9 Textarea + Dropzone -------------------------------------------- */
.hg-textarea {
    width: 100%;
    min-height: 110px;
    padding: 0.8rem 1rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--color-text);
    font: inherit;
    line-height: 1.5;
    resize: vertical;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.hg-textarea::placeholder {
    color: var(--color-text-subtle);
}

.hg-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--focus-ring);
}

.hg-field-hint {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.4rem;
    color: var(--color-text-subtle);
    font-size: 0.8125rem;
}

.hg-field-hint .is-ok {
    color: var(--hg-success);
    font-weight: 600;
}

.hg-dropzone {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border: 1.5px dashed var(--color-border-strong);
    border-radius: var(--radius-lg);
    background: var(--bg-surface-muted);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.hg-dropzone:hover,
.hg-dropzone.is-dragging {
    border-color: var(--color-primary);
    background: var(--bg-surface-soft);
}

.hg-dropzone.is-dragging {
    box-shadow: var(--focus-ring);
}

.hg-dropzone:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.hg-dropzone__text {
    flex: 1 1 auto;
    min-width: 0;
}

.hg-dropzone__text strong {
    display: block;
    color: var(--color-heading);
}

.hg-dropzone__text span {
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.hg-dropzone__text u {
    color: var(--color-link);
    text-underline-offset: 3px;
}

.hg-file-pill {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    animation: hg-fade-in 0.2s ease both;
}

.hg-file-pill__name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-weight: 600;
    color: var(--color-heading);
}

.hg-file-pill__size {
    color: var(--color-text-subtle);
    font-size: 0.8rem;
    white-space: nowrap;
}

/* ---- 14.10 Mini stat chips (compact, for page headers) ------------------
   <div class="hg-mini-stats">
     <div class="hg-mini-stat hg-mini-stat--success">
       <span class="hg-mini-stat__icon"><i class="bi bi-check2"></i></span>
       <span><strong>2 Called</strong><small>Completed</small></span>
     </div>
   </div>
   ------------------------------------------------------------------------ */
.hg-mini-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.hg-mini-stat {
    --hg-mini-tone: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 1rem 0.6rem 0.6rem;
    background: var(--bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.hg-mini-stat__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--hg-mini-tone) 14%, var(--bg-surface));
    color: var(--hg-mini-tone);
    font-size: 1.2rem;
}

.hg-mini-stat strong {
    display: block;
    color: var(--color-heading);
    font-size: 1rem;
    line-height: 1.2;
    white-space: nowrap;
}

.hg-mini-stat small {
    display: block;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.hg-mini-stat--success {
    --hg-mini-tone: var(--hg-success);
}

.hg-mini-stat--warning {
    --hg-mini-tone: var(--hg-warning);
}

.hg-mini-stat--danger {
    --hg-mini-tone: var(--hg-danger);
}

.hg-mini-stat--info {
    --hg-mini-tone: var(--hg-info);
}

/* Header with soft decorative wash (top-right) */
.hg-page-head--decor {
    position: relative;
    isolation: isolate;
    flex-wrap: wrap;
}

.hg-page-head--decor::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: -60px;
    right: 10%;
    width: 420px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(closest-side, var(--bg-glow), transparent);
    pointer-events: none;
}

.hg-back-btn {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    font-size: 1.25rem;
    box-shadow: var(--shadow-sm);
}

/* ---- 14.11 Filter bar ---------------------------------------------------
   <div class="hg-filter-bar">
     <div class="hg-filter">
       <label class="hg-filter__label" for="f1">Status</label>
       <div class="hg-input-group">
         <i class="bi bi-activity hg-input-icon"></i>
         <select id="f1" class="hg-select">…</select>
       </div>
     </div>
   </div>
   ------------------------------------------------------------------------ */
.hg-filter-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
    background: var(--bg-surface-soft);
    border-radius: var(--radius-lg);
}

.hg-filter {
    min-width: 0;
}

.hg-filter__label {
    display: block;
    margin: 0 0 0.4rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-heading);
}

.hg-form-control--sm {
    height: 44px;
    font-size: 0.925rem;
    border-radius: var(--radius-sm);
}

.hg-input-group>.hg-select {
    width: 100%;
    padding-left: 42px;
}

.hg-input-group>.hg-input-icon {
    left: 14px;
}

.hg-input-group>.hg-select,
.hg-input-group>.hg-form-control--sm {
    padding-left: 42px;
}

/* native date input: tone down the browser chrome */
input[type="date"].hg-form-control {
    padding-right: 0.75rem;
}

input[type="date"].hg-form-control:invalid,
input[type="date"].hg-form-control.is-empty {
    color: var(--color-text-subtle);
}

input[type="date"].hg-form-control::-webkit-calendar-picker-indicator {
    opacity: 0.55;
    cursor: pointer;
}

.hg-filter-bar__actions {
    display: flex;
    align-items: flex-end;
}

/* ---- 14.12 Sortable table header ----------------------------------------
   <th><button type="button" class="hg-th-sort" (click)="setSort('x')">
         <i class="bi bi-calendar3"></i> Label <i class="bi hg-th-sort__ico" [ngClass]="sortIcon('x')"></i>
       </button></th>
   ------------------------------------------------------------------------ */
.hg-th-sort {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-weight: inherit;
    color: inherit;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}

.hg-th-sort>i:first-child {
    color: var(--color-primary);
}

.hg-th-sort__ico {
    margin-left: auto;
    color: var(--color-text-subtle);
    font-size: 0.85rem;
    transition: color var(--transition);
}

.hg-th-sort:hover .hg-th-sort__ico,
.hg-th-sort.is-sorted .hg-th-sort__ico {
    color: var(--color-primary);
}

.hg-th-sort:focus-visible {
    outline: none;
    border-radius: 4px;
    box-shadow: var(--focus-ring);
}

/* Card that wraps filter bar + table + pagination */
.hg-panel {
    padding: 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

.hg-panel .hg-table-wrap {
    box-shadow: none;
}

.hg-panel .hg-pagination {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-divider);
}

@media (max-width: 575.98px) {
    .hg-panel {
        padding: 1rem;
        border-radius: var(--radius-lg);
    }

    .hg-filter-bar {
        grid-template-columns: 1fr 1fr;
        padding: 0.9rem;
        gap: 0.75rem;
    }

    .hg-filter--wide {
        grid-column: 1 / -1;
    }

    /* save width: drop the leading icons inside filter fields */
    .hg-filter-bar .hg-input-icon {
        display: none;
    }

    .hg-filter-bar .hg-input-group>.hg-select,
    .hg-filter-bar .hg-input-group>.hg-form-control,
    .hg-filter-bar .hg-input-group>.hg-form-control--sm {
        padding-left: 0.75rem;
    }

    .hg-filter-bar .hg-select {
        padding-right: 1.9rem;
        background-position: right 0.6rem center;
    }
}

.hg-select.is-empty {
    color: var(--color-text-subtle);
}

.hg-select option {
    color: var(--color-text);
    background: var(--bg-input);
}

/* Neutral badge (cancelled / unknown states) */
.hg-badge--neutral {
    background: var(--bg-surface-soft);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

/* ---- Header & Announcement Bar light theme styling ---- */
.header-main {
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

[data-theme="light"] .announcement-bar {
    background: linear-gradient(90deg, #0b1150 0%, #152277 50%, #0b1150 100%) !important;
    color: #ffffff !important;
    border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* ---- Student Portal: Remove top space between header and page content ---- */
section.sptb:has(app-institute-student-sidebar),
.sptb:has(app-institute-student-sidebar) {
    padding: 0 0 36px 0 !important;
    margin-top: 0 !important;
}

section.sptb:has(app-institute-student-sidebar) > .container,
section.sptb:has(app-institute-student-sidebar) > .container-fluid,
.sptb:has(app-institute-student-sidebar) > .container,
.sptb:has(app-institute-student-sidebar) > .container-fluid {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

section.sptb:has(app-institute-student-sidebar) > .container > .row,
section.sptb:has(app-institute-student-sidebar) > .container-fluid > .row,
.sptb:has(app-institute-student-sidebar) > .container > .row,
.sptb:has(app-institute-student-sidebar) > .container-fluid > .row {
    margin-top: 0 !important;
    padding-top: 0 !important;
}
