/**
 * IAG Design System — Components
 * Reusable UI building blocks: header, buttons, cards, tables,
 * chips, modals, sidebar, nav, badges, forms, loader, empty state.
 *
 * All values use tokens from tokens.css.
 */

/* ════════════════════════════════════════════════════════════════
   PAGE HEADER
   Brand identity: Internal Audit & Governance – Faiyum Health
   ════════════════════════════════════════════════════════════════ */

.page-header {
    background: var(--brand-primary);
    background-image: 
        radial-gradient(ellipse at top right, rgba(20,184,166,0.15) 0%, transparent 60%),
        radial-gradient(ellipse at bottom left, rgba(4,120,115,0.20) 0%, transparent 60%);
    padding: max(1rem, env(safe-area-inset-top, 1rem)) 1.25rem 3.5rem;
    position: relative;
    z-index: var(--z-sticky);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    max-height: 120px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.header-center {
    flex: 1;
    text-align: center;
    padding-inline: var(--space-2);
}

.header-btn {
    width: var(--tap-min);
    height: var(--tap-min);
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: var(--radius-sm);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition-base);
    backdrop-filter: blur(8px);
    flex-shrink: 0;
    position: relative;
}
.header-btn[aria-label="القائمة"] { display: none; }
@media (min-width: 1024px) {
    .header-btn[aria-label="القائمة"] { display: flex !important; }
}
.header-btn:hover { background: rgba(255,255,255,0.20); }

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.header-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: var(--radius-full);
    padding: 4px 14px;
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    color: rgba(255,255,255,0.95);
    backdrop-filter: blur(8px);
    margin-bottom: var(--space-2);
    letter-spacing: 0.3px;
}

.header-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
    mix-blend-mode: screen;
    flex-shrink: 0;
    border-radius: var(--radius-xs);
    opacity: 0.92;
}

.header-title {
    font-size: var(--text-lg);
    font-weight: var(--font-black);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-bottom: 2px;
    line-height: 1.2;
}

.header-sub {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.60);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Header bell dot — kept identical to the copy in drawers.css so cascade
   order can never shift its position/border (was previously right:7px with a
   brand-primary ring, which fought the drawers.css rule → misplaced badge). */
.notif-dot {
    position: absolute;
    top: 4px;
    inset-inline-start: 4px;
    width: 9px;
    height: 9px;
    background: #dc2626;
    border-radius: 50%;
    border: 2px solid #fff;
}


/* ════════════════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 10px 18px;
    min-height: var(--tap-min);
    border-radius: var(--radius-md);
    font-family: var(--font-base);
    font-weight: var(--font-bold);
    font-size: var(--text-base);
    cursor: pointer;
    border: none;
    transition: all var(--transition-base);
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: var(--brand-primary-teal);
    color: #ffffff;
    box-shadow: var(--shadow-brand);
}
.btn-primary:hover {
    background: var(--brand-primary-hover);
    box-shadow: var(--shadow-brand-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--brand-primary-teal);
    border: 1.5px solid var(--brand-primary-teal);
}
.btn-secondary:hover {
    background: var(--brand-primary-light);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-3);
    border: 1px solid var(--color-border);
}
.btn-ghost:hover { background: var(--color-surface-2); }

.btn-danger {
    background: var(--color-danger);
    color: #ffffff;
}
.btn-danger:hover { background: #b91c1c; }

.btn-icon {
    width: var(--tap-min);
    height: var(--tap-min);
    padding: 0;
    border-radius: var(--radius-sm);
    background: var(--color-surface-2);
    color: var(--color-text-4);
    border: 1.5px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-base);
    flex-shrink: 0;
}
.btn-icon:hover {
    background: var(--brand-primary-light);
    color: var(--brand-primary-teal);
    border-color: var(--brand-primary-teal);
}

.btn-danger-ghost {
    background: var(--color-danger-light);
    color: var(--color-danger);
    border: 1.5px solid var(--color-danger-border);
    border-radius: var(--radius-sm);
    min-height: var(--tap-min);
    padding: 0 14px;
    font-weight: var(--font-extrabold);
    font-size: var(--text-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    white-space: nowrap;
    flex-shrink: 0;
    font-family: var(--font-base);
    transition: all var(--transition-base);
}
.btn-danger-ghost:hover { background: #fee2e2; }
.btn-danger-ghost.active {
    background: var(--color-danger);
    color: #ffffff;
    border-color: var(--color-danger);
    box-shadow: 0 4px 12px rgba(220,38,38,0.3);
}

/* Modal action buttons */
.btn-modal-primary {
    padding: 8px 16px;
    background: var(--brand-primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: var(--font-bold);
    font-size: var(--text-base);
    cursor: pointer;
    font-family: var(--font-base);
    transition: background var(--transition-base);
}
.btn-modal-primary:hover { background: #084f4a; }

.btn-modal-cancel {
    padding: 8px 16px;
    background: #e5e7eb;
    color: #374151;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: var(--font-bold);
    font-size: var(--text-base);
    cursor: pointer;
    font-family: var(--font-base);
    transition: background var(--transition-base);
}
.btn-modal-cancel:hover { background: #d1d5db; }

.modal-close-btn {
    padding: var(--space-2);
    background: var(--color-surface-3);
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    min-width: var(--tap-min);
    min-height: var(--tap-min);
}
.modal-close-btn:hover { background: var(--color-danger-light); color: var(--color-danger); }


/* ════════════════════════════════════════════════════════════════
   FORM INPUTS
   ════════════════════════════════════════════════════════════════ */

.f-label {
    display: block;
    font-size: var(--text-xs);
    font-weight: var(--font-extrabold);
    color: var(--color-text-5);
    margin-bottom: 5px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.f-input {
    width: 100%;
    height: var(--tap-min);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    outline: none;
    background: var(--color-surface-2);
    color: var(--color-text-2);
    transition: all var(--transition-base);
    padding: 0 var(--space-3);
    font-family: var(--font-base);
    -webkit-appearance: none;
    appearance: none;
}
.f-input:focus {
    border-color: var(--brand-primary-teal);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(15,118,110,0.08);
}
.f-input option { background: #ffffff; color: var(--color-text-2); }

.search-wrapper { position: relative; }
.search-input   { padding-inline-end: 12px; padding-inline-start: 42px; }
.search-icon    {
    position: absolute;
    inset-inline-start: 13px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--color-text-5);
    pointer-events: none;
}


/* ════════════════════════════════════════════════════════════════
   FILTER CARD (Floating glass panel)
   ════════════════════════════════════════════════════════════════ */

.filter-container {
    margin: -2.8rem 1rem 1.5rem;
    position: relative;
    z-index: var(--z-filter);
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: 1.25rem;
    box-shadow: var(--shadow-lg), 0 1px 0 rgba(255,255,255,0.8);
    border: 1px solid var(--color-border);
}
@media (min-width: 1024px) {
    .filter-container {
        max-width: var(--content-max);
        margin: -2.8rem auto 1.5rem;
    }
}

.filter-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
@media (min-width: 1024px) {
    .filter-grid { flex-direction: row; align-items: flex-end; }
    .filter-item-search { flex: 2; }
    .filter-item { flex: 1; }
}

.filter-actions {
    display: flex;
    gap: var(--space-2);
    align-items: flex-end;
}


/* ════════════════════════════════════════════════════════════════
   STAT / KPI CARDS
   ════════════════════════════════════════════════════════════════ */

.stats-wrapper {
    padding: 0 1rem 1.2rem;
    max-width: var(--content-max);
    margin: 0 auto;
}

.stats-row-big {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
}
@media (min-width: 768px) {
    .stats-row-big { grid-template-columns: repeat(6, 1fr); }
}

.stat-card-big,
.stat-card-small {
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: all var(--transition-spring);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.stat-card-big   { border-radius: var(--radius-lg); padding: 16px 12px; }
.stat-card-small { border-radius: var(--radius-md); padding: var(--space-3); }

/* color accent bar bottom */
.stat-card-big::after,
.stat-card-small::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 100%;
    height: 4px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    opacity: 0;
    transition: opacity var(--transition-base);
}
.stat-card-big:hover,
.stat-card-small:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
    border-color: var(--color-border-strong);
}
.stat-card-big:hover::after,
.stat-card-small:hover::after { opacity: 1; }

.stat-card-big.active,
.stat-card-small.active {
    border-color: var(--brand-primary-teal) !important;
    background: var(--brand-primary-light);
    box-shadow: 0 0 0 3px rgba(15,118,110,0.12);
}
.stat-card-big.active .lbl,
.stat-card-big.active .num,
.stat-card-small.active .lbl,
.stat-card-small.active .num { color: var(--brand-primary-teal) !important; }

.stat-card-big .num   { font-size: 2rem;   font-weight: var(--font-black); line-height: 1; margin-bottom: 4px; letter-spacing: -0.5px; }
.stat-card-big .lbl   { font-size: var(--text-xs);  font-weight: var(--font-extrabold); color: var(--color-text-5); letter-spacing: 0.3px; }
.stat-card-small .num { font-size: 1.5rem; font-weight: var(--font-black); line-height: 1; margin-bottom: 3px; }
.stat-card-small .lbl { font-size: 0.62rem; font-weight: var(--font-extrabold); color: var(--color-text-5); letter-spacing: 0.3px; }

/* Semantic status colors */
.txt-total   { color: #334155; }
.txt-late    { color: var(--color-danger); }
.txt-new     { color: var(--color-info); }
.txt-pending { color: var(--color-warning); }
.txt-approved{ color: var(--color-success); }
.txt-followup{ color: var(--color-purple); }

#st-total::after    { background: #94a3b8; }
#st-late::after     { background: var(--color-danger); }
#st-new::after      { background: var(--color-info); }
#st-pending::after  { background: var(--color-warning); }
#st-approved::after { background: var(--color-success); }
#st-followup::after { background: var(--color-purple); }


/* ════════════════════════════════════════════════════════════════
   CONTEXT BAR + CHIPS (Quick Filters)
   ════════════════════════════════════════════════════════════════ */

.context-bar {
    max-width: var(--content-max);
    margin: 0 1rem var(--space-3);
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}
@media (min-width: 1024px) {
    .context-bar { margin: 0 auto var(--space-3); }
}

.ctx-label   { font-size: var(--text-sm); color: var(--color-text-5); font-weight: var(--font-bold); }
.ctx-total   { font-size: var(--text-base); font-weight: var(--font-black); color: #334155; }
.ctx-divider { width: 1px; height: 18px; background: var(--color-border); flex-shrink: 0; }
.ctx-chips-row {
    display: flex;
    gap: var(--space-1);
    flex-wrap: wrap;
    align-items: center;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: var(--font-extrabold);
    cursor: pointer;
    border: 1.5px solid var(--color-border);
    transition: all var(--transition-fast);
    font-family: var(--font-base);
    background: var(--color-surface-2);
    color: var(--color-text-3);
    white-space: nowrap;
    min-height: 32px;
}
.chip:hover { background: var(--color-surface-3); border-color: var(--color-border-strong); color: var(--color-text-2); }
.chip.active {
    background: var(--brand-primary-teal);
    color: #ffffff;
    border-color: var(--brand-primary-teal);
    box-shadow: 0 3px 10px rgba(15,118,110,0.25);
}
.chip-count {
    background: rgba(0,0,0,0.08);
    border-radius: var(--radius-sm);
    padding: 0 6px;
    font-size: var(--text-xs);
}
.chip.active .chip-count { background: rgba(255,255,255,0.25); }

/* Legacy ctx-chip alias */
.ctx-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: var(--radius-full); font-size: var(--text-sm); font-weight: var(--font-extrabold); cursor: pointer; border: 1.5px solid var(--color-border); transition: all var(--transition-fast); font-family: var(--font-base); background: var(--color-surface-2); color: var(--color-text-3); white-space: nowrap; }
.ctx-chip:hover { background: var(--color-surface-3); border-color: var(--color-border-strong); color: var(--color-text-2); }
.ctx-chip.active { background: var(--brand-primary-teal); color: #ffffff; border-color: var(--brand-primary-teal); box-shadow: 0 3px 10px rgba(15,118,110,0.25); }
.ctx-count { background: rgba(0,0,0,0.08); border-radius: var(--radius-sm); padding: 0 6px; font-size: var(--text-xs); }
.ctx-chip.active .ctx-count { background: rgba(255,255,255,0.25); }


/* ════════════════════════════════════════════════════════════════
   BADGES / PILLS
   ════════════════════════════════════════════════════════════════ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge-green  { background: var(--color-success-light); color: #065f46; border-color: var(--color-success-border); }
.badge-red    { background: var(--color-danger-light);  color: #991b1b; border-color: var(--color-danger-border); }
.badge-yellow { background: var(--color-warning-light); color: #92400e; border-color: var(--color-warning-border); }
.badge-blue   { background: var(--color-info-light);    color: #1d4ed8; border-color: var(--color-info-border); }
.badge-purple { background: var(--color-purple-light);  color: #6d28d9; border-color: var(--color-purple-border); }
.badge-grey   { background: var(--color-surface-2);     color: var(--color-text-5); border-color: var(--color-border); }

/* Attachment pills */
.attach-pill  { font-size: var(--text-xs); font-weight: var(--font-extrabold); padding: 4px 10px; border-radius: var(--radius-full); display: inline-flex; align-items: center; gap: var(--space-1); cursor: pointer; border: 1px solid transparent; white-space: nowrap; transition: var(--transition-fast); font-family: var(--font-base); }
.attach-green  { background: var(--color-success-light); color: #065f46; border-color: var(--color-success-border); }
.attach-green:hover  { background: var(--color-success-border); }
.attach-warn   { background: var(--color-warning-light); color: #92400e; border-color: var(--color-warning-border); }
.attach-warn:hover   { background: var(--color-warning-border); }
.attach-danger { background: var(--color-danger-light); color: #991b1b; border-color: var(--color-danger-border); }
.attach-danger:hover { background: var(--color-danger-border); }
.attach-grey   { background: var(--color-surface-2); color: var(--color-text-5); border-color: var(--color-border); cursor: default; }

.badge-missing { display: inline-flex; align-items: center; gap: var(--space-1); background: var(--color-warning-light); color: #92400e; font-size: 0.62rem; font-weight: var(--font-extrabold); padding: 2px 8px; border-radius: var(--radius-sm); border: 1px solid var(--color-warning-border); }
.badge-case { display: inline-flex; align-items: center; gap: 3px; font-size: 0.65rem; font-weight: var(--font-extrabold); padding: 2px 8px; border-radius: var(--radius-sm); }
.badge-case-na { background: var(--color-purple-light); color: #6d28d9; border: 1px solid var(--color-purple-border); }
.badge-case-sq { background: var(--color-warning-light); color: #92400e; border: 1px solid var(--color-warning-border); }
.linked-in     { font-size: 0.65rem; color: var(--color-text-3); background: var(--color-surface-2); border-radius: var(--radius-xs); padding: 2px 7px; font-weight: var(--font-bold); border: 1px solid var(--color-border); }


/* ════════════════════════════════════════════════════════════════
   DATA TABLE
   ════════════════════════════════════════════════════════════════ */

.table-wrapper  { padding: 0 1rem 5rem; max-width: var(--content-max); margin: 0 auto; }
.table-container {
    width: 100%;
    overflow-x: auto;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.data-table {
    width: 100%;
    text-align: right;
    border-collapse: collapse;
}
.data-table th {
    background: var(--color-surface-2);
    padding: 12px 14px;
    font-size: var(--text-sm);
    color: var(--color-text-4);
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
    font-weight: var(--font-extrabold);
    font-family: var(--font-base);
}
.data-table td {
    padding: 11px 14px;
    font-size: var(--text-base);
    border-bottom: 1px solid var(--color-surface-3);
    vertical-align: middle;
    font-family: var(--font-base);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--color-surface-2); }
.data-table tr.row-missing td:first-child { border-inline-end: 3px solid var(--color-warning); }

.missing-tag          { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--radius-xs); font-size: var(--text-xs); font-weight: var(--font-bold); margin: 1px; }
.missing-tag-assignee { background: var(--color-danger-light);  color: var(--color-danger);  border: 1px solid var(--color-danger-border); }
.missing-tag-case     { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.missing-tag-archive  { background: var(--color-warning-light); color: #92400e; border: 1px solid var(--color-warning-border); }


/* ════════════════════════════════════════════════════════════════
   MODAL
   ════════════════════════════════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(3px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    padding: var(--space-4);
}
.modal-overlay.open { display: flex; }

.modal-box {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    width: 92%;
    max-width: 520px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.22s ease;
}

.modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-surface-2);
}

.modal-title {
    font-size: var(--text-lg);
    font-weight: var(--font-extrabold);
    color: var(--color-text-2);
    margin: 0;
}

.modal-id {
    font-size: var(--text-sm);
    color: var(--color-text-4);
    font-family: var(--font-mono);
    margin: 0;
}

.modal-body  { padding: 1.25rem; }
.modal-footer {
    padding: 1rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-2);
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
}

.modal-detail-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* Detail item rows inside modal */
.data-item    { border-bottom: 1px solid var(--color-surface-3); padding-bottom: var(--space-1); margin-bottom: var(--space-1); }
.data-label   { font-size: var(--text-sm); color: var(--color-text-4); font-weight: var(--font-bold); }
.data-val     { font-size: var(--text-md); color: var(--color-text-1); font-weight: var(--font-semibold); }

.modal-select { width: 100%; height: auto; padding: 10px var(--space-3); margin-bottom: var(--space-4); }
.modal-label  { display: block; font-size: var(--text-base); font-weight: var(--font-bold); color: #374151; margin-bottom: var(--space-2); }
.modal-note   { font-size: var(--text-sm); color: var(--color-text-4); background: var(--color-warning-light); padding: var(--space-2); border-radius: var(--radius-xs); border: 1px solid var(--color-warning-border); margin: 0; }

/* Edit-in-modal helpers */
.edit-field  { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-1); }
.edit-input  { flex: 1; height: 36px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); padding: 0 10px; font-size: var(--text-base); font-family: var(--font-base); outline: none; background: var(--color-warning-light); }
.edit-input:focus { border-color: var(--brand-primary-teal); box-shadow: 0 0 0 2px rgba(15,118,110,0.1); background: #fff; }
.edit-btn    { height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: none; font-weight: var(--font-bold); font-size: var(--text-sm); cursor: pointer; font-family: var(--font-base); display: flex; align-items: center; gap: var(--space-1); white-space: nowrap; }
.edit-btn-save { background: var(--brand-primary-teal); color: #ffffff; }
.edit-btn-save:hover { background: var(--brand-primary-hover); }
.edit-btn-save:disabled { background: var(--color-text-5); cursor: not-allowed; }

.upload-area { border: 2px dashed var(--color-border-strong); border-radius: var(--radius-sm); padding: var(--space-4); text-align: center; cursor: pointer; transition: var(--transition-base); background: var(--color-warning-light); margin-top: var(--space-1); }
.upload-area:hover { border-color: var(--brand-primary-teal); background: var(--brand-primary-light); }
.upload-area.uploading { opacity: 0.6; pointer-events: none; }


/* ════════════════════════════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════════════════════════════ */

.side-menu {
    position: fixed;
    top: 0;
    inset-inline-start: -280px;
    width: 280px;
    height: 100vh;
    background: var(--color-surface);
    box-shadow: 4px 0 24px rgba(0,0,0,0.12);
    z-index: var(--z-sidebar);
    transition: inset-inline-start var(--transition-slow) cubic-bezier(0.4,0,0.2,1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.side-menu.open { inset-inline-start: 0; }

.menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.4);
    backdrop-filter: blur(3px);
    z-index: calc(var(--z-sidebar) - 1);
    display: none;
}
.menu-overlay.open { display: block; }

.side-menu-header {
    background: var(--brand-primary);
    background-image: radial-gradient(ellipse at top right, rgba(20,184,166,0.25) 0%, transparent 60%);
    padding: 1.5rem 1.25rem;
    color: #ffffff;
    flex-shrink: 0;
}

.menu-user-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.menu-avatar {
    width: var(--tap-min);
    height: var(--tap-min);
    background: rgba(255,255,255,0.12);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.2);
}
.menu-avatar svg,
.menu-avatar i { width: 22px; height: 22px; color: #ffffff; }

.menu-user-info { min-width: 0; }
#menu-user { font-weight: var(--font-black); font-size: var(--text-md); color: #ffffff; }
#menu-role { font-size: var(--text-xs); color: var(--brand-teal-muted); font-weight: var(--font-extrabold); letter-spacing: 0.5px; }

.side-menu-body { flex: 1; padding: 0.5rem 0; overflow-y: auto; background: var(--color-surface); }

.menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 11px 20px;
    cursor: pointer;
    color: #334155;
    font-weight: var(--font-bold);
    font-size: var(--text-base);
    border-inline-end: 3px solid transparent;
    transition: all var(--transition-fast);
    text-decoration: none;
    font-family: var(--font-base);
    width: 100%;
    box-sizing: border-box;
    background: transparent;
    border-top: none;
    border-bottom: none;
    border-left: none;
}
.menu-item svg,
.menu-item i { width: 18px; height: 18px; color: var(--color-text-5); flex-shrink: 0; transition: color var(--transition-fast); }
.menu-item:hover { background: #f0fdf9; color: var(--brand-primary-teal); border-inline-end-color: #14b8a6; }
.menu-item:hover svg,
.menu-item:hover i { color: var(--brand-primary-teal); }
.menu-item.active {
    background: var(--brand-primary-light);
    color: var(--brand-primary-teal);
    border-inline-end-color: var(--brand-primary-teal);
    font-weight: var(--font-black);
}
.menu-item.active svg,
.menu-item.active i { color: var(--brand-primary-teal); }

.menu-footer {
    border-top: 1px solid var(--color-surface-3);
    padding: 0.75rem;
    background: var(--color-surface-2);
    flex-shrink: 0;
}

.btn-logout {
    width: 100%;
    color: var(--color-danger);
    justify-content: center;
    background: transparent;
    border: 1px solid var(--color-border);
}
.btn-logout:hover { background: var(--color-danger-light); border-color: var(--color-danger-border); }


/* ════════════════════════════════════════════════════════════════
   IAG PREMIUM SIDEBAR
   Centralized design — migrated from settings.css
   Applied via .iag-premium-sidebar on <aside class="side-menu">
   ════════════════════════════════════════════════════════════════ */

.iag-premium-sidebar {
    background-color: #f8fafc;
    border-left: 1px solid rgba(0,0,0,0.05);
    box-shadow: -5px 0 25px rgba(0,0,0,0.04);
}

/* Premium Profile Card (Sidebar Header) */
.iag-premium-sidebar .premium-profile-card {
    background: linear-gradient(145deg, #0a3d35 0%, #0c4a40 100%);
    padding: 2rem 1rem 1rem;
    position: relative;
    color: white;
    text-align: center;
    border-bottom-left-radius: var(--radius-2xl);
    border-bottom-right-radius: var(--radius-2xl);
    box-shadow: 0 8px 25px rgba(10, 61, 53, 0.15);
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.iag-premium-sidebar .premium-profile-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at top right, rgba(201,162,39,0.15) 0%, transparent 60%);
    pointer-events: none;
}

.iag-premium-sidebar .profile-avatar {
    width: 56px;
    height: 56px;
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.25);
    border-radius: 50%;
    margin: 0 auto 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    position: relative;
    z-index: 2;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.iag-premium-sidebar .profile-avatar i,
.iag-premium-sidebar .profile-avatar svg {
    width: 26px;
    height: 26px;
    color: #ffffff;
}

.iag-premium-sidebar .profile-info {
    position: relative;
    z-index: 2;
}

.iag-premium-sidebar .profile-name {
    font-size: 1.1rem;
    font-weight: 900;
    margin-bottom: 0.15rem;
    letter-spacing: 0.02em;
    color: #ffffff;
}

.iag-premium-sidebar .profile-role {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.85);
    font-weight: 700;
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: rgba(0,0,0,0.2);
    border-radius: var(--radius-xl);
}

/* Sidebar Body */
.iag-premium-sidebar .sidebar-flex-body {
    display: flex;
    flex-direction: column;
    padding: 0 0.75rem 0.5rem;
    flex: 0 0 auto;
    overflow-y: auto;
}

.iag-premium-sidebar #side-nav {
    display: flex;
    flex-direction: column;
}

/* Navigation Links — override the global .menu-item */
.iag-premium-sidebar .menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.65rem 1rem;
    margin-bottom: 0.25rem;
    border-radius: var(--radius-md);
    color: #475569;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all var(--transition-base);
    background: transparent;
    border: none;
    border-inline-end: none;
    width: 100%;
    text-align: right;
    cursor: pointer;
    font-family: var(--font-base);
    box-sizing: border-box;
}

.iag-premium-sidebar .menu-item i,
.iag-premium-sidebar .menu-item svg {
    color: #64748b;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    transition: color var(--transition-base);
}

.iag-premium-sidebar .menu-item:hover {
    background: rgba(12, 74, 64, 0.05);
    color: #0c4a40;
    border-inline-end-color: transparent;
}

.iag-premium-sidebar .menu-item:hover i,
.iag-premium-sidebar .menu-item:hover svg {
    color: #0c4a40;
}

.iag-premium-sidebar .menu-item.active {
    background: rgba(12, 74, 64, 0.92);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(12, 74, 64, 0.15);
    border-inline-end-color: transparent;
    font-weight: 800;
}

.iag-premium-sidebar .menu-item.active i,
.iag-premium-sidebar .menu-item.active svg {
    color: #ffffff;
}

/* Sidebar Footer */
.iag-premium-sidebar .menu-footer {
    margin-top: 0.5rem;
    padding: 1rem;
    border-top: 1px solid rgba(0,0,0,0.06);
    background: transparent;
    flex-shrink: 0;
}

.iag-premium-sidebar .btn-logout {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    background: transparent;
    color: #ef4444;
    font-weight: 700;
    font-size: 0.9rem;
    border: 1px solid rgba(239, 68, 68, 0.2);
    transition: all var(--transition-base);
    cursor: pointer;
    font-family: var(--font-base);
}

.iag-premium-sidebar .btn-logout i,
.iag-premium-sidebar .btn-logout svg {
    width: 18px;
    height: 18px;
    color: #ef4444;
}

.iag-premium-sidebar .btn-logout:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.3);
}



/* ════════════════════════════════════════════════════════════════
   FIVE-STAR BOTTOM NAVIGATION
   ════════════════════════════════════════════════════════════════ */

/* Hide completely on desktop */
@media (min-width: 769px) {
    .bottom-nav { display: none !important; }
}

/* Premium Floating Design — Mobile only */
@media (max-width: 768px) {

    /* Floating Glassmorphism Container */
    .bottom-nav {
        position: fixed;
        bottom: max(16px, env(safe-area-inset-bottom, 16px));
        left: 16px;
        right: 16px;
        background: rgba(255, 255, 255, 0.88);
        backdrop-filter: blur(24px) saturate(200%);
        -webkit-backdrop-filter: blur(24px) saturate(200%);
        border: 1px solid rgba(255, 255, 255, 0.8);
        box-shadow: 0 12px 36px rgba(10, 61, 53, 0.12), 0 2px 8px rgba(10, 61, 53, 0.05);
        height: 68px;
        border-radius: var(--radius-full);
        padding: 4px 8px;
        justify-content: space-between;
        align-items: center;
        display: flex;
        z-index: var(--z-nav);
    }

    /* Base Nav Item — static vertical layout */
    .nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 54px;
        color: #94a3b8;
        text-decoration: none;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        position: relative;
        border-radius: var(--radius-xl);
        margin: 0 4px;
        gap: 4px;
        font-size: 0.65rem;
        font-weight: 700;
    }

    .nav-item i, .nav-item svg {
        width: 22px;
        height: 22px;
        stroke-width: 2.2px;
        transition: all var(--transition-slow);
    }

    .nav-item span {
        font-size: 0.65rem;
        font-weight: 700;
        letter-spacing: -0.2px;
        transition: all var(--transition-slow);
    }

    /* Hover — inactive items */
    .nav-item:not(.active):hover {
        color: #64748b;
        background: rgba(0, 0, 0, 0.03);
    }

    /* Active — vertical pill with green highlight */
    .nav-item.active {
        background: rgba(10, 61, 53, 0.1);
        color: #0a3d35;
        box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.5);
        transform: translateY(-2px);
    }

    .nav-item.active i,
    .nav-item.active svg {
        color: #0a3d35;
        stroke-width: 2.5px;
        transform: scale(1.1);
    }

    .nav-item.active span {
        font-weight: 800;
        color: #0a3d35;
    }

    /* Sub-label badge */
    .nav-item-sub {
        font-size: 0.55rem;
        color: var(--color-warning);
        font-weight: 800;
    }

    /* Floating Plus Button */
    .nav-plus-btn {
        width: 60px;
        height: 60px;
        background: linear-gradient(135deg, #0c4a40 0%, #065f46 100%);
        border: none;
        border-radius: 50%;
        box-shadow: 0 8px 24px rgba(10, 61, 53, 0.35), inset 0 2px 6px rgba(255, 255, 255, 0.4);
        display: flex;
        align-items: center;
        justify-content: center;
        margin-top: -22px;
        z-index: 10;
        transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
        cursor: pointer;
        flex-shrink: 0;
        margin-left: 4px;
        margin-right: 4px;
    }

    .nav-plus-btn:hover {
        transform: translateY(-4px) scale(1.05);
        box-shadow: 0 12px 28px rgba(10, 61, 53, 0.45), inset 0 2px 6px rgba(255, 255, 255, 0.5);
    }

    .nav-plus-btn:active {
        transform: translateY(2px) scale(0.95);
        box-shadow: 0 4px 12px rgba(10, 61, 53, 0.2);
    }

    .nav-plus-btn i,
    .nav-plus-btn svg {
        width: 28px;
        height: 28px;
        color: #ffffff;
        stroke-width: 2.5px;
    }

} /* end @media (max-width: 768px) */


/* Quick Menu Overlay */
.quick-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.6);
    backdrop-filter: blur(4px);
    z-index: calc(var(--z-nav) + 1);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 1rem;
    opacity: 0; pointer-events: none;
    transition: opacity var(--transition-slow);
}
.quick-menu-overlay.active { opacity: 1; pointer-events: auto; }

.quick-menu-card {
    width: 100%;
    max-width: 400px;
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 -8px 32px rgba(0,0,0,0.15);
}
.quick-menu-overlay.active .quick-menu-card { transform: translateY(0); }

.quick-menu-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.quick-menu-header h3 { font-weight: var(--font-black); color: var(--color-text-2); }
.q-close { background: var(--color-surface-3); border: none; border-radius: 50%; padding: 6px; cursor: pointer; }

.quick-menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.q-item {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    text-decoration: none; color: var(--color-text-3); font-size: var(--text-xs); font-weight: var(--font-bold);
    padding: 12px; border-radius: var(--radius-lg); transition: background 0.2s;
}
.q-item:hover { background: var(--brand-primary-light); color: var(--brand-primary-teal); }
.q-item i { width: 24px; height: 24px; color: var(--brand-primary-teal); }


/* ════════════════════════════════════════════════════════════════
   LOADER / EMPTY STATE
   ════════════════════════════════════════════════════════════════ */

.loader-box {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--color-text-5);
}

.empty-box {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-5);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    font-weight: var(--font-bold);
}

/* Canonical empty state — page aliases (.exec-empty / .occ-empty) share it so
   every screen shows the same "no data" treatment. */
.empty-state,
.exec-empty,
.occ-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-5);
    font-size: var(--text-sm);
}
.empty-state svg,
.empty-state i {
    width: 48px; height: 48px;
    margin-bottom: var(--space-3);
    opacity: 0.35;
    display: block;
    margin-inline: auto;
}

/* ════════════════════════════════════════════════════════════════
   CLS GUARDS — layout-shift insurance
   ════════════════════════════════════════════════════════════════ */

/* Keep the scrollbar gutter reserved so content never jumps sideways
   when a page grows past the viewport. */
html { scrollbar-gutter: stable; }

/* <i data-lucide> is an empty inline element until lucide.createIcons()
   swaps it for an <svg>; give it a box up-front so icons don't pop the
   layout when they materialize. */
i[data-lucide] {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
}

/* ════════════════════════════════════════════════════════════════
   CARDS (generic .card)
   ════════════════════════════════════════════════════════════════ */

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-spring), transform var(--transition-spring);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

/* ════════════════════════════════════════════════════════════════
   TABS
   ════════════════════════════════════════════════════════════════ */

.tab-bar { display: flex; gap: var(--space-1); background: var(--color-surface-3); border-radius: var(--radius-md); padding: var(--space-1); }
.tab-btn { flex: 1; padding: 8px 12px; border: none; cursor: pointer; border-radius: var(--radius-sm); font-family: var(--font-base); font-size: var(--text-sm); font-weight: var(--font-bold); background: transparent; color: var(--color-text-3); transition: all var(--transition-fast); }
.tab-btn.active { background: var(--color-surface); color: var(--brand-primary-teal); box-shadow: var(--shadow-xs); }

/* ════════════════════════════════════════════════════════════════
   DIVIDER / UTILITIES
   ════════════════════════════════════════════════════════════════ */

.divider { height: 1px; background: var(--color-border); margin: 1rem 0; }

/* Print */
@media print {
    .bottom-nav, .side-menu, .menu-overlay, .header-btn { display: none !important; }
    .page-header { padding-bottom: 1rem; }
    body { padding-bottom: 0; }
}
/* Notification Dropdown */
.notif-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    inset-inline-end: 0;
    width: 300px;
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 32px rgba(0,0,0,0.15);
    border: 1px solid var(--color-border);
    opacity: 0; pointer-events: none;
    transform: translateY(-10px);
    transition: all 0.25s ease;
    z-index: 1000;
}
.header-btn.notif-active + .notif-dropdown {
    opacity: 1; pointer-events: auto;
    transform: translateY(0);
}

.notif-dd-header { padding: 12px 16px; border-bottom: 1px solid var(--color-border); font-weight: var(--font-black); font-size: var(--text-sm); }
.notif-dd-body { max-height: 350px; overflow-y: auto; }
.notif-dd-item {
    padding: 12px 16px; border-bottom: 1px solid var(--color-surface-3); display: flex; gap: 10px;
    text-decoration: none; color: var(--color-text-2); font-size: var(--text-xs);
}
.notif-dd-item:hover { background: var(--color-surface-2); }
.notif-dd-footer { padding: 10px; text-align: center; border-top: 1px solid var(--color-border); }
.notif-dd-footer a { color: var(--brand-primary-teal); font-weight: var(--font-black); text-decoration: none; font-size: var(--text-xs); }
