@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

/* ================================================================
   AGOS ADMIN — UNIFIED DESIGN SYSTEM v5.0
   Mirrors AGOS WebSuite universal.css exactly.
   Enterprise-grade: offline, cache, toast, modal, scrollbars.
   ================================================================ */

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; overflow: hidden; }
body { height: 100%; margin: 0; font-family: 'Segoe UI', Arial, sans-serif; font-size: 13px; color: #1f2937; overflow: hidden; }

:root {
    --color-primary:       #0038A8;
    --color-primary-dark:  #002580;
    --color-primary-light: #e8f0fd;
    --color-success:       #137333;
    --color-success-dark:  #0d5c28;
    --color-success-light: #e6f4ea;
    --color-danger:        #d93025;
    --color-danger-dark:   #b52a1f;
    --color-warning:       #e37400;
    --color-warning-dark:  #c05e00;
    --sidebar-bg:          #001040;
    --sidebar-width:       240px;
    --border:              #e8eaed;
    --border-strong:       #dadce0;
    --bg-page:             #f1f3f4;
    --bg-card:             #ffffff;
    --bg-subtle:           #f8f9fa;
    --bg-hover:            #e8f0fe;
    --text-muted:          #5f6368;
    --text-label:          #3c4043;
    --btn-height:          26px;
    --input-height:        30px;
    --radius-sm:           4px;
    --radius-md:           6px;
    --radius-lg:           10px;
    --shadow-card:         0 1px 3px rgba(60,64,67,.12), 0 1px 2px rgba(60,64,67,.08);
    --shadow-modal:        0 12px 48px rgba(0,0,0,.22);
    --transition:          all 0.15s ease;
}

/* ── APP SHELL ────────────────────────────────────────────────── */
.dashboard-layout { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ──────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(175deg, #001040 0%, #001a5e 60%, #002580 100%);
    color: white; display: flex; flex-direction: column;
    position: fixed; left: 0; top: 0; height: 100vh;
    overflow: hidden;
    z-index: 300; flex-shrink: 0;
    box-shadow: 2px 0 12px rgba(0,0,0,.35);
    transition: transform 0.25s ease;
}

/* PH flag stripe at top of sidebar */
.sidebar-ph-stripe {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    display: flex;
    z-index: 10;
    flex-shrink: 0;
}
.stripe-blue { flex: 1; background: #0038A8; }
.stripe-red  { flex: 1; background: #CE1126; }
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

.sidebar-brand {
    padding: 17px 14px 10px; border-bottom: 1px solid rgba(252,209,22,.18);
    flex-shrink: 0; display: flex; flex-direction: column; align-items: center; text-align: center;
}
.sidebar-logo { width: 80px; height: 50px; object-fit: contain; margin: -10px auto -10px; display: block; }
.app-title { font-size: 16px; font-weight: 700; color: #fff; letter-spacing: -.1px; font-family: 'IBM Plex Sans', 'Segoe UI', sans-serif; }
.app-version { font-size: 10px; color: rgba(252,209,22,.55); margin-top: 2px; font-family: 'IBM Plex Sans', 'Segoe UI', sans-serif; letter-spacing: .3px; }
.welcome-user { margin-top: 7px; font-size: 11px; color: rgba(255,255,255,.6); line-height: 1.4; word-break: break-word; text-align: center; }
.welcome-user b { color: rgba(255,255,255,.88); }
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 2500; }

.menu { display: flex; flex-direction: column; flex: 1; overflow-y: auto; padding: 8px; min-height: 0; scrollbar-width: none; overscroll-behavior: contain; }
.menu::-webkit-scrollbar { display: none; }
.menu-section { font-size: 9.5px; font-weight: 700; color: rgba(252,209,22,.45); margin: 12px 6px 3px; letter-spacing: .8px; text-transform: uppercase; font-family: 'IBM Plex Sans', 'Segoe UI', sans-serif; }
.menu-btn {
    height: 32px; padding: 0 9px; border-radius: var(--radius-md);
    color: rgba(255,255,255,.78); text-decoration: none;
    display: flex; align-items: center; background: transparent; border: none;
    cursor: pointer; font-size: 12.5px; width: 100%;
    transition: background .15s, color .15s; gap: 9px; margin-bottom: 1px;
}
.menu-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.menu-btn.active { background: #0038A8; color: #fff; box-shadow: 0 2px 8px rgba(0,56,168,.4); }
.menu-spacer { flex-shrink: 0; min-height: 8px; }
.icon { font-family: 'Material Symbols Outlined'; font-size: 17px; width: 19px; flex-shrink: 0; opacity: .9; }
.logout-container { padding: 8px; border-top: 1px solid rgba(255,255,255,.08); flex-shrink: 0; }
.logout-btn { color: #ea8080; }
.logout-btn:hover { background: rgba(220,53,69,.15) !important; color: #f87171; }

.burger-btn {
    display: none; height: 24px; padding: 0 10px;
    border-radius: var(--radius-md); border: 1px solid rgba(0,56,168,.4);
    background: #0038A8; color: white;
    font-size: 11px; cursor: pointer; margin-bottom: 5px;
    align-items: center; justify-content: center;
    transition: all .15s; flex-shrink: 0; white-space: nowrap;
    font-family: 'IBM Plex Sans', 'Segoe UI', sans-serif;
}
.burger-btn:hover { background: #002580; }

/* ── Content Area ─────────────────────────────────────────────── */
.content-area {
    flex: 1; display: flex; flex-direction: column;
    padding: 8px 10px; min-height: 0;
    overflow-y: auto; overflow-x: hidden;
    margin-left: var(--sidebar-width); height: 100vh;
    scrollbar-width: thin; scrollbar-color: #9aa0a6 #e8eaed;
}
.content-area::-webkit-scrollbar { width: 7px; }
.content-area::-webkit-scrollbar-track { background: #e8eaed; border-radius: 4px; }
.content-area::-webkit-scrollbar-thumb { background: #9aa0a6; border-radius: 4px; }
.content-area::-webkit-scrollbar-thumb:hover { background: #5f6368; }

.content-card {
    flex: 1; display: flex; flex-direction: column;
    background: white; border-radius: var(--radius-lg);
    padding: 0 10px 6px 10px;
    box-shadow: var(--shadow-card); overflow: hidden; min-height: 0;
    border: 1px solid var(--border);
}

/* ── PAGE CHROME ──────────────────────────────────────────────── */
.page-header {
    display: flex; align-items: center; gap: 7px;
    position: sticky; top: 0; z-index: 50; background: white;
    padding: 7px 0 6px 0; border-bottom: 1px solid var(--border);
    margin-bottom: 8px; width: 100%; flex-shrink: 0; flex-wrap: wrap;
}
.page-header h3, .page-header h5 { margin: 0; font-size: 14px; font-weight: 700; color: #1a2332; white-space: nowrap; flex-shrink: 0; }
.page-header .header-left { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.page-header .header-center { display: flex; align-items: center; gap: 6px; flex: 1; flex-wrap: wrap; justify-content: center; }
.page-header .header-right { display: flex; align-items: center; gap: 5px; flex-shrink: 0; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }

.page-container { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.page-body { flex: 1; min-height: 0; overflow: hidden; }

/* ── TABLE VIEWPORT — always-visible dual scrollbars ────────── */
.card-fill { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.card-fill .card-header-bar { flex-shrink: 0; }

.table-viewport {
    flex: 1; min-height: 0; overflow-x: auto; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin; scrollbar-color: #9aa0a6 #e8eaed;
}
.table-viewport::-webkit-scrollbar { width: 7px; height: 8px; }
.table-viewport::-webkit-scrollbar-track { background: #e8eaed; border-radius: 4px; }
.table-viewport::-webkit-scrollbar-thumb { background: #9aa0a6; border-radius: 4px; }
.table-viewport::-webkit-scrollbar-thumb:hover { background: #5f6368; }
.table-viewport::-webkit-scrollbar-corner { background: #e8eaed; }

/* ── ANNOUNCEMENTS / ACTIVITIES BODY SCROLL ───────────────────── */
.announcements-body, .activities-body {
    flex: 1; min-height: 0;
    overflow-x: auto; overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: #9aa0a6 #e8eaed;
}
.announcements-body::-webkit-scrollbar,
.activities-body::-webkit-scrollbar { width: 7px; height: 8px; }
.announcements-body::-webkit-scrollbar-track,
.activities-body::-webkit-scrollbar-track { background: #e8eaed; border-radius: 4px; }
.announcements-body::-webkit-scrollbar-thumb,
.activities-body::-webkit-scrollbar-thumb { background: #9aa0a6; border-radius: 4px; }
.announcements-body::-webkit-scrollbar-corner,
.activities-body::-webkit-scrollbar-corner { background: #e8eaed; }

/* ── ANNOUNCEMENTS / ACTIVITIES CONTAINER ─────────────────────── */
.announcements-container, .activities-container {
    display: flex; flex-direction: column;
    flex: 1; min-height: 0; overflow: hidden;
}


.table-scroll-wrapper {
    overflow-x: auto; overflow-y: auto; max-height: 380px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin; scrollbar-color: #9aa0a6 #e8eaed;
}
.table-scroll-wrapper::-webkit-scrollbar { width: 7px; height: 8px; }
.table-scroll-wrapper::-webkit-scrollbar-track { background: #e8eaed; border-radius: 4px; }
.table-scroll-wrapper::-webkit-scrollbar-thumb { background: #9aa0a6; border-radius: 4px; }
.table-scroll-wrapper::-webkit-scrollbar-corner { background: #e8eaed; }

/* ── CARDS ────────────────────────────────────────────────────── */
.card { background: var(--bg-card); border-radius: var(--radius-lg); padding: 16px; border: 1px solid var(--border); box-shadow: var(--shadow-card); }
.card-header { font-size: 12.5px; font-weight: 700; color: #1a2332; border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.card-header-flex { display: flex; justify-content: space-between; align-items: center; }

/* ── TABS ─────────────────────────────────────────────────────── */
.tabs, .custom-tabs {
    display: flex; gap: 3px; background: #f1f3f4;
    padding: 3px; border-radius: 7px; margin-bottom: 9px; flex-wrap: wrap;
}
.tab-btn {
    border: none; background: transparent; padding: 3px 11px; border-radius: 5px;
    font-size: 11px; font-weight: 500; cursor: pointer; color: var(--text-muted);
    white-space: nowrap; transition: background .15s, color .15s, box-shadow .15s;
    height: 22px; display: inline-flex; align-items: center; gap: 4px;
}
.tab-btn:hover:not(.active) { background: var(--color-primary-light); color: var(--color-primary); }
.tab-btn.active { background: white; color: var(--color-primary); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ── FORMS ────────────────────────────────────────────────────── */
.form-group { margin-bottom: 5px; text-align: left; }
.form-control, .form-select {
    width: 100%; height: var(--input-height); padding: 3px 7px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-size: 12px; font-family: inherit; background-color: white;
    box-sizing: border-box; appearance: none; -webkit-appearance: none;
    transition: border-color .15s, box-shadow .15s; color: #1f2937;
}
.form-control:focus, .form-select:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 2px rgba(26,115,232,.16); }
.form-control[readonly], .form-select[disabled] { background: #f8f9fa; color: var(--text-muted); }
.form-select { background-image: url("data:image/svg+xml;utf8,<svg fill='gray' height='18' viewBox='0 0 24 24' width='18' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>"); background-repeat: no-repeat; background-position: right 5px center; padding-right: 22px; cursor: pointer; }
.form-control-sm, .form-select-sm { height: var(--input-height) !important; font-size: 12px !important; padding: 3px 7px !important; }
.form-label, label { font-weight: 600; font-size: 10.5px; color: var(--text-muted); display: block; margin-bottom: 2px; text-transform: uppercase; letter-spacing: .4px; }
textarea.form-control { height: auto; min-height: 80px; resize: vertical; }


/* ── BUTTONS ──────────────────────────────────────────────────── */
.btn-primary, .btn-success, .btn-danger, .btn-secondary, .btn-outline, .btn-warning, .btn-icon {
    height: var(--btn-height);
    padding: 0 11px;
    border-radius: var(--radius-sm);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    transition: var(--transition);
    font-family: inherit;
}
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-dark); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-success { background: var(--color-success); color: white; }
.btn-success:hover:not(:disabled) { background: var(--color-success-dark); }
.btn-success:disabled { opacity: .45; cursor: not-allowed; }
.btn-danger { background: var(--color-danger); color: white; }
.btn-danger:hover:not(:disabled) { background: var(--color-danger-dark); }
.btn-danger:disabled { opacity: .45; cursor: not-allowed; }
.btn-secondary, .btn-outline, .btn-outline-secondary, .btn-outline-primary, .btn-outline-danger {
    background: white; color: #3c4043; border: 1px solid var(--border-strong);
}
.btn-secondary:hover:not(:disabled), .btn-outline:hover:not(:disabled), .btn-outline-secondary:hover:not(:disabled) { background: #f1f3f4; border-color: #9aa0a6; }
.btn-outline-primary:hover:not(:disabled) { background: var(--color-primary-light); border-color: var(--color-primary); color: var(--color-primary); }
.btn-outline-danger:hover:not(:disabled) { background: #fce8e6; border-color: #f28b82; color: var(--color-danger); }
.btn-secondary:disabled, .btn-outline:disabled { opacity: .45; cursor: not-allowed; }
.btn-warning { background: var(--color-warning); color: white; }
.btn-warning:hover:not(:disabled) { background: var(--color-warning-dark); }
.btn-warning:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn-icon { width: var(--btn-height); padding: 0; background: white; border: 1px solid var(--border-strong); color: #3c4043; }
.btn-icon:hover:not(:disabled) { background: #f1f3f4; }
.btn-sm, .btn-xs { height: 22px !important; padding: 0 8px !important; font-size: 10.5px !important; border-radius: var(--radius-sm) !important; }
.btn-xs { height: 18px !important; padding: 0 6px !important; font-size: 10px !important; }
.btn-small { height: 22px; padding: 0 8px; font-size: 10.5px; border-radius: var(--radius-sm); }
.btn-action-icon { width: 24px; height: 24px; padding: 0; border-radius: 4px; border: 1px solid transparent; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); transition: all .15s; font-size: 13px; }
.btn-action-icon:hover { background: var(--bg-hover); border-color: var(--border); color: var(--color-primary); }
.btn-action-icon.danger:hover { background: #fce8e6; border-color: #f28b82; color: var(--color-danger); }
.close-btn { background: none; border: none; font-size: 19px; color: #9aa0a6; cursor: pointer; padding: 1px 3px; display: flex; align-items: center; transition: color .15s; }
.close-btn:hover { color: #3c4043; }
.mini-spinner { width: 11px; height: 11px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; animation: spin .65s linear infinite; display: inline-block; flex-shrink: 0; }

/* ── ROW ACTION BAR — hover-reveal floating pill ────────────── */
.rab {
    display: inline-flex; gap: 1px; align-items: center;
    background: #2563eb; border: 1px solid #cbd5e1; border-radius: 6px;
    padding: 2px; white-space: nowrap;
    box-shadow: 0 2px 10px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.03);
    opacity: 0; transition: opacity .12s, transform .12s;
    transform: translateY(2px); pointer-events: none;
}
tr:hover .rab, tr:focus-within .rab { opacity: 1; transform: translateY(0); pointer-events: auto; }
.rib {
    width: 26px; height: 26px; border: 1px solid #e5e7eb; background: #ffffff;
    border-radius: 4px; cursor: pointer; padding: 0; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    color: #9ca3af; transition: background .12s, color .12s;
}
.rib .icon { font-size: 15px; pointer-events: none; }
.rib:hover { background: #e2e8f0; color: #111827; }
.rib.view:hover  { color: #2563eb; background: #eff6ff; }
.rib.edit:hover  { color: #2563eb; background: #eff6ff; }
.rib.del:hover   { color: #dc2626; background: #fef2f2; }
.rib.add:hover   { color: #059669; background: #ecfdf5; }
.rib-div { width: 1px; height: 14px; background: #e5e7eb; margin: 0 1px; flex-shrink: 0; align-self: center; }
.td-act { width: 1%; padding: 0 4px !important; vertical-align: middle; }

/* ── TABLES ───────────────────────────────────────────────────── */
.table-compact, .outputs-table, .workplan-table, .announcements-table, .activities-table, .admin-table {
    width: max-content; min-width: 100%; border-collapse: collapse; font-size: 11.5px;
}
.table-compact th, .outputs-table th, .workplan-table th, .announcements-table th, .activities-table th, .admin-table th {
    text-align: left; font-weight: 600; font-size: 10.5px; padding: 5px 7px;
    border-bottom: 2px solid var(--border); background: #f8f9fa; white-space: nowrap;
    position: sticky; top: 0; z-index: 1; color: var(--text-muted); letter-spacing: .4px; text-transform: uppercase;
}
.table-compact td, .outputs-table td, .workplan-table td, .announcements-table td, .activities-table td, .admin-table td {
    padding: 4px 7px; font-size: 11.5px; border-bottom: 1px solid #f1f2f4; vertical-align: middle; line-height: 1.4;
}
.table-compact tbody tr:hover td, .outputs-table tbody tr:hover td, .workplan-table tbody tr:hover td,
.announcements-table tbody tr:hover td, .activities-table tbody tr:hover td, .admin-table tbody tr:hover td { background: #f4f8ff; }

.table { border-collapse: collapse; font-size: 11.5px; width: 100%; }
.table th { text-align: left; font-weight: 600; font-size: 10.5px; padding: 5px 7px; border-bottom: 2px solid var(--border); background: #f8f9fa; white-space: nowrap; color: var(--text-muted); letter-spacing: .4px; text-transform: uppercase; }
.table td { padding: 4px 7px; font-size: 11.5px; border-bottom: 1px solid #f1f2f4; vertical-align: middle; }
.table-hover tbody tr:hover td { background: #f4f8ff; }
.align-middle td, .align-middle th { vertical-align: middle !important; }

.action-cell { white-space: nowrap; vertical-align: middle !important; padding: 0 5px !important; }
.action-cell-inner { display: flex; align-items: flex-start; justify-content: flex-start; gap: 3px; min-height: 28px; }
.row-hover-actions { display: flex; gap: 3px; align-items: center; opacity: 0; transition: opacity .15s; }
tr:hover .row-hover-actions { opacity: 1; }
.table-responsive { overflow-x: auto; overflow-y: hidden; }
.body-cell { white-space: normal !important; word-break: break-word; max-width: 280px; }

/* ── MODAL ────────────────────────────────────────────────────── */
.modal-overlay, .modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    display: flex; justify-content: center; align-items: center;
    z-index: 4000; padding: 12px;
}
.modal-card, .modal-box {
    background: white; border-radius: var(--radius-lg);
    min-width: 420px; max-width: min(94vw, 600px);
    box-shadow: var(--shadow-modal); display: flex; flex-direction: column;
    max-height: 90vh; overflow-y: auto; z-index: 4001; animation: modalPopIn .15s ease-out;
    scrollbar-width: thin; scrollbar-color: #9aa0a6 #e8eaed;
    padding: 12px;
}
.modal-card::-webkit-scrollbar, .modal-box::-webkit-scrollbar { width: 6px; }
.modal-card::-webkit-scrollbar-thumb, .modal-box::-webkit-scrollbar-thumb { background: #9aa0a6; border-radius: 4px; }
@keyframes modalPopIn { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 13px 16px 11px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 13.5px; position: sticky; top: 0; background: white; z-index: 1; }
.modal-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 11px; }
.modal-body .form-group { display: flex; flex-direction: column; gap: 3px; }
.modal-body .form-group label { font-size: 10.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }
.modal-footer, .modal-actions { display: flex; justify-content: flex-end; gap: 6px; padding: 10px 16px 13px; border-top: 1px solid var(--border); }
.modal-header-sticky { position: sticky; top: 0; z-index: 10; background: white; padding: 9px 13px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-body-scroll { padding: 9px 13px; overflow-y: auto; overflow-x: auto; flex: 1; min-height: 0; scrollbar-width: thin; scrollbar-color: #9aa0a6 #e8eaed; }
.modal-body-scroll::-webkit-scrollbar { width: 6px; }
.modal-body-scroll::-webkit-scrollbar-thumb { background: #9aa0a6; border-radius: 4px; }
.modal-wide { max-width: min(94vw, 900px) !important; }
.modal-medium { max-width: min(94vw, 680px) !important; }

/* ── TOASTS ───────────────────────────────────────────────────── */
.toast-popup {
    position: fixed; bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(14px);
    background: #202124; color: white; padding: 9px 18px; border-radius: 7px;
    font-size: 12px; font-weight: 500; z-index: 9999;
    opacity: 0; transition: opacity .25s, transform .25s;
    pointer-events: none; white-space: nowrap; box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.toast-popup.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-popup.toast-success { background: var(--color-success); }
.toast-popup.toast-error   { background: var(--color-danger); }
.toast-popup.toast-warning { background: var(--color-warning); }

.kra-toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%) translateY(-12px); background: var(--color-success); color: white; padding: 10px 20px; border-radius: 10px; font-size: 13px; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,.25); opacity: 0; transition: all .35s ease; z-index: 9999; }
.kra-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── DRIVE SYNC ALERT ─────────────────────────────────────────── */
.sync-alert-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.35);
    display: flex; justify-content: center; align-items: center;
    z-index: 10000; padding: 16px; animation: modalPopIn .15s ease-out;
}
.sync-alert-box {
    background: white; border-radius: var(--radius-lg);
    min-width: 340px; max-width: 420px; padding: 24px 28px;
    box-shadow: 0 12px 40px rgba(0,0,0,.25); text-align: center;
    display: flex; flex-direction: column; gap: 8px;
}
.sync-alert-icon { margin-bottom: 4px; }
.sync-alert-title { font-size: 15px; font-weight: 700; color: var(--text-main); }
.sync-alert-operation { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.sync-alert-message {
    font-size: 11.5px; color: var(--color-danger); background: #fce8e6;
    border: 1px solid #f28b82; border-radius: var(--radius-sm);
    padding: 8px 10px; word-break: break-word; max-height: 100px;
    overflow-y: auto; text-align: left;
}
.sync-alert-remaining { font-size: 10.5px; color: var(--text-muted); font-weight: 500; }
.sync-alert-actions { display: flex; justify-content: center; gap: 8px; margin-top: 8px; }
.sync-alert-actions button { display: flex; align-items: center; gap: 4px; }

/* ── HINTS & ALERTS ───────────────────────────────────────────── */
.hint-warning { font-size: 11px; color: #7c3a00; background: #fff8e6; border: 1px solid #f0c060; border-radius: var(--radius-sm); padding: 5px 8px; }
.hint-success { font-size: 11px; color: #137333; background: var(--color-success-light); border: 1px solid #a8dab5; border-radius: var(--radius-sm); padding: 5px 8px; }
.alert-error  { font-size: 12px; color: #9c0a0a; background: #fce8e6; border: 1px solid #f28b82; border-radius: var(--radius-sm); padding: 6px 10px; }

/* ── BADGES ───────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; justify-content: center; padding: 2px 7px; border-radius: 9px; font-size: 10px; font-weight: 600; white-space: nowrap; }
.bg-success { background: var(--color-success-light) !important; color: var(--color-success) !important; border: 1px solid #a8dab5; }
.bg-danger  { background: #fce8e6 !important; color: var(--color-danger) !important; border: 1px solid #f28b82; }
.bg-warning { background: #fff3cd !important; color: #856404 !important; border: 1px solid #ffc107; }
.bg-dark    { background: #3c4043 !important; color: #fff !important; }
.bg-primary { background: var(--color-primary-light) !important; color: var(--color-primary) !important; border: 1px solid #a4c2f7; }
.ms-auto { margin-left: auto !important; }

/* ── LOADING & SPINNERS ───────────────────────────────────────── */
.page-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 50px 20px; color: var(--text-muted); gap: 9px; }
.spinner-border { display: inline-block; width: 20px; height: 20px; border: 2.5px solid rgba(0,0,0,.1); border-top-color: var(--color-primary); border-radius: 50%; animation: spin .65s linear infinite; vertical-align: middle; }
.spinner-border-sm { width: 14px !important; height: 14px !important; border-width: 2px !important; }
@keyframes spin { to { transform: rotate(360deg); } }
.text-center { text-align: center; }
.p-5 { padding: 3rem !important; }
.page-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 50px 20px; color: var(--text-muted); gap: 5px; text-align: center; }
.page-empty .empty-icon  { font-size: 38px; margin-bottom: 5px; }
.page-empty .empty-title { font-weight: 600; font-size: 13.5px; color: #3c4043; }
.page-empty .empty-desc  { font-size: 11.5px; max-width: 300px; }

/* ── SYNC BADGES ──────────────────────────────────────────────── */
.sync-badge { display: inline-block; padding: 1px 6px; border-radius: 9px; font-size: 10px; font-weight: 600; white-space: nowrap; }
.sync-badge-pending { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
.sync-badge-synced  { background: #e6f4ea; color: #137333; }
.sync-badge-syncing { background: #e8f0fe; color: #1a56db; border: 1px solid #a4c2f7; animation: agos-blink .9s step-start infinite; }
@keyframes agos-blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* ── TOOLTIPS ─────────────────────────────────────────────────── */
.help-tip { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 13px; height: 13px; font-size: 9.5px; font-weight: 700; background: var(--border); border-radius: 3px; cursor: help; margin-left: 4px; }
.tooltip-text { visibility: hidden; width: 190px; background: #202124; color: white; text-align: center; padding: 5px; border-radius: 5px; position: absolute; bottom: 130%; left: 50%; transform: translateX(-50%); font-size: 10.5px; opacity: 0; transition: opacity .2s; z-index: 10; pointer-events: none; }
.help-tip:hover .tooltip-text { visibility: visible; opacity: 1; }
.custom-tooltip { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #1a2332; color: white; padding: 5px 9px; font-size: 11px; border-radius: 6px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s ease; z-index: 999; box-shadow: 0 3px 8px rgba(0,0,0,.2); }
.has-tooltip:hover .custom-tooltip { opacity: 1; }
.info-icon { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-left: 5px; font-size: 11px; font-weight: 600; border: 1px solid var(--text-muted); border-radius: 3px; color: var(--text-muted); cursor: pointer; user-select: none; transition: all .15s; }
.info-icon:hover { background: var(--text-muted); color: white; }

/* ── SCORE SUMMARY BAR ────────────────────────────────────────── */
.score-summary-bar { display: flex; background: linear-gradient(135deg, #1a73e8, #1557b0); border-radius: 9px; overflow: hidden; margin: 5px 0; flex-shrink: 0; min-height: 48px; }
.score-item { flex: 1; padding: 9px 12px; border-right: 1px solid rgba(255,255,255,.15); text-align: center; }
.score-item:last-child { border-right: none; }
.score-label { font-size: 9.5px; color: rgba(255,255,255,.7); font-weight: 500; margin-bottom: 1px; text-transform: uppercase; letter-spacing: .4px; }
.score-value { font-size: 14px; font-weight: 700; color: white; }
.score-item.final .score-value { font-size: 15px; }

/* ── CALENDAR ─────────────────────────────────────────────────── */
.calendar-card { background: white; padding: 16px; width: 100%; border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-card); }
.month-nav-grid { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-bottom: 10px; }
.month-label { font-size: 15px; font-weight: 700; text-align: center; color: #1a2332; }
.calendar-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 10px; text-align: center; margin-bottom: 5px; font-weight: 600; color: var(--text-muted); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendar-day { height: 90px; background: #f8f9fa; padding: 6px; border-radius: 6px; cursor: pointer; border: 1px solid var(--border); transition: all .15s; display: flex; flex-direction: column; position: relative; }
.calendar-day:hover { background: var(--bg-hover); border-color: var(--color-primary); }
.has-entry { border: 2px solid var(--color-primary) !important; background: var(--color-primary-light) !important; }
.holiday-day { border: 2px solid var(--color-danger) !important; background: #fff5f5 !important; }
.holiday-day:hover { background: #ffe3e3 !important; }
.holiday-row td { background: #fff0f3 !important; }
.holiday-row:hover td { background: #fde8ed !important; }
.today-number { background: var(--color-primary); color: white; border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.day-number { font-size: 11px; font-weight: 600; align-self: flex-end; margin-bottom: 4px; }
.sunday { color: var(--color-danger); font-weight: 600; }
.calendar-list { list-style: disc; padding-left: 14px; margin: 0; }
.calendar-list li { font-size: 9.5px; line-height: 1.3; }
.more-items { color: var(--color-primary); font-weight: 600; font-size: 9.5px; }
.nav-btn { width: 28px; height: 28px; border: none; border-radius: var(--radius-sm); background: #f1f3f4; font-size: 14px; cursor: pointer; transition: background .15s; display: flex; align-items: center; justify-content: center; }
.nav-btn:hover { background: #e8eaed; }

/* ── SUPPORT / CHAT ───────────────────────────────────────────── */
.support-container { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.modern-chat-layout { display: flex; flex: 1; min-height: 480px; background: white; border-radius: var(--radius-lg); border: 1px solid var(--border); overflow: hidden; }
.chat-sidebar { width: 280px; border-right: 1px solid var(--border); background: var(--bg-subtle); overflow-y: auto; padding: 6px; flex-shrink: 0; scrollbar-width: thin; scrollbar-color: #9aa0a6 #e8eaed; }
.chat-sidebar::-webkit-scrollbar { width: 5px; }
.chat-sidebar::-webkit-scrollbar-thumb { background: #9aa0a6; border-radius: 4px; }
.chat-user-card { flex: 1; padding: 10px 12px; cursor: pointer; border-radius: var(--radius-md); border: 1px solid var(--border); background: white; margin-bottom: 5px; position: relative; transition: all .15s; }
.chat-user-card:hover { background: var(--bg-hover); border-color: var(--color-primary); transform: translateY(-1px); }
.chat-user-card.active { background: var(--color-primary-light); border: 1.5px solid var(--color-primary); }
.chat-user-name { font-weight: 600; font-size: 12.5px; }
.chat-user-id { font-size: 11px; color: var(--text-muted); }
.unread-badge { position: absolute; top: 10px; right: 10px; background: var(--color-danger); color: white; font-size: 10px; padding: 1px 6px; border-radius: 18px; font-weight: 600; }
.chat-content { flex: 1; display: flex; flex-direction: column; min-height: 0; background: white; }
.chat-header { padding: 10px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; display: flex; align-items: center; gap: 8px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 12px; background: var(--bg-subtle); min-height: 0; scrollbar-width: thin; scrollbar-color: #9aa0a6 #e8eaed; }
.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-thumb { background: #9aa0a6; border-radius: 4px; }
.message-row { display: flex; margin-bottom: 8px; }
.message-row.left  { justify-content: flex-start; }
.message-row.right { justify-content: flex-end; }
.message-bubble { max-width: 62%; padding: 8px 12px; border-radius: 14px; font-size: 12px; line-height: 1.45; }
.message-bubble.user  { background: white; border: 1px solid var(--border); }
.message-bubble.admin { background: var(--color-primary); color: white; }
.message-meta { font-size: 10px; margin-top: 3px; display: flex; justify-content: space-between; gap: 6px; opacity: .8; }
.chat-input { display: flex; padding: 10px; border-top: 1px solid var(--border); gap: 8px; flex-shrink: 0; background: white; }
.chat-input textarea { flex: 1; resize: none; border-radius: var(--radius-md); border: 1px solid var(--border-strong); padding: 6px 8px; font-size: 12px; font-family: inherit; transition: border-color .15s; }
.chat-input textarea:focus { outline: none; border-color: var(--color-primary); }
.mobile-toggle-btn { width: 28px; height: 28px; background: var(--color-primary); color: white; border: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; cursor: pointer; flex-shrink: 0; transition: all .15s; }
.mobile-toggle-btn:hover { background: var(--color-primary-dark); }
.ticket-item { background: white; border-radius: var(--radius-md); border: 1px solid var(--border); box-shadow: var(--shadow-card); transition: all .15s; padding: 10px 14px; cursor: pointer; }
.ticket-item:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); border-color: var(--color-primary); }
.hide-mobile { }
.hide-mobile-content { }

/* ── PROFILE CARD GRID (Users list) ──────────────────────────── */
.profile-card { background: white; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; cursor: pointer; display: flex; transition: all .18s; box-shadow: var(--shadow-card); }
.profile-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.1); border-color: var(--color-primary); }
.profile-card-inner { display: flex; gap: 12px; width: 100%; }
.profile-avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.profile-avatar-wrapper { position: relative; width: 56px; height: 56px; flex-shrink: 0; }
.profile-avatar-fallback { position: absolute; inset: 0; border-radius: 50%; background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark)); color: white; font-weight: 700; font-size: 16px; display: none; align-items: center; justify-content: center; }
.profile-avatar-fallback.show { display: flex; }
.profile-info { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.profile-name { font-weight: 600; font-size: 13.5px; word-break: break-word; margin-bottom: 2px; }
.profile-id { font-size: 11px; color: var(--color-primary); margin-bottom: 3px; }
.profile-position, .profile-designation { font-size: 11.5px; color: var(--text-muted); word-break: break-word; }

/* Profile detail sections */
.profile-section { background: white; border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow-card); border: 1px solid var(--border); }
.section-title { font-size: 12.5px; font-weight: 700; margin-bottom: 10px; color: #1a2332; }
.profile-grid-2 { display: grid; grid-template-columns: 160px 1fr; row-gap: 6px; column-gap: 12px; align-items: center; }
.profile-label { font-size: 10.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }
.profile-field { width: 100%; font-size: 12px; height: var(--input-height); overflow: hidden; padding: 3px 7px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: white; transition: border-color .15s; }
.profile-field:focus { outline: none; border-color: var(--color-primary); }
.profile-field[readonly], .profile-field:disabled { background: #f8f9fa; color: var(--text-muted); }
select.profile-field { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;utf8,<svg fill='gray' height='18' viewBox='0 0 24 24' width='18' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>"); background-repeat: no-repeat; background-position: right 5px center; padding-right: 22px; }

/* ── KRA / PERFORMANCE ────────────────────────────────────────── */
.kra-compact { font-size: 12.5px; }
.kra-compact h5 { font-size: 14px; font-weight: 700; }
.kra-compact h6 { font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.kra-compact table th { font-size: 10.5px; font-weight: 600; padding: 5px 6px !important; }
.kra-compact table td { font-size: 12px; padding: 4px 6px !important; vertical-align: middle; }
.kra-compact .form-control, .kra-compact .form-select { font-size: 12px !important; height: var(--input-height) !important; }
.kra-compact textarea.form-control { min-height: 55px; }
.kra-compact .btn { font-size: 11.5px; }
.kra-compact .compact-input { height: 26px; padding: 2px 6px; font-size: 12px; }

.performance-layout { display: grid; grid-template-columns: 70% 30%; gap: 10px; align-items: start; }
.performance-left, .performance-right { display: flex; flex-direction: column; gap: 10px; }
.perf-row-clickable { cursor: pointer; transition: background .1s; }
.perf-row-clickable:hover td { background: #f0f4ff; }
.perf-row-selected td { background: #dbeafe !important; border-left: 3px solid var(--color-primary); }
.part2-value { font-size: 12px; color: var(--text-label); background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 8px; min-height: 30px; line-height: 1.5; }

.performance-table { table-layout: fixed; min-width: 900px; width: 100%; }
.performance-table th:first-child, .performance-table td:first-child { white-space: normal; word-break: normal; }
.score-disabled { background-color: #f3f4f6 !important; color: #9ca3af !important; cursor: not-allowed; border-color: #e5e7eb !important; }
.perf-expand-btn { padding: 1px 5px; font-size: 10px; line-height: 1.3; border-radius: 4px; background: #f3f4f6; border: 1px solid #d1d5db; cursor: pointer; }
.perf-expand-btn:hover { background: #e5e7eb; }
.perf-expand-row td { background: #f8faff; padding: 0 !important; }
.perf-rating-panel { padding: 10px 14px 12px; font-size: 12px; }
.perf-rating-cols { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.perf-guide-row { display: flex; gap: 6px; align-items: flex-start; }
.perf-guide-score { font-weight: 700; color: var(--color-primary); min-width: 14px; flex-shrink: 0; }

/* ── ADMIN USERS PAGE ─────────────────────────────────────────── */
.admin-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.admin-search { max-width: 260px; }

/* ── PERMISSION DENIED ────────────────────────────────────────── */
.permission-denied { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; color: var(--text-muted); gap: 8px; text-align: center; }
.permission-denied .icon { font-size: 48px; color: var(--color-danger); }
.permission-denied h4 { font-size: 15px; font-weight: 700; color: #3c4043; margin: 0; }

/* ── MISC UTILITIES ───────────────────────────────────────────── */
.today-inline { font-size: 12.5px; font-weight: 600; color: var(--color-primary); white-space: nowrap; }
.page-title-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.page-title-row h5 { margin: 0; font-size: 14px; font-weight: 700; color: #1a2332; }
.sticky-top-bar { position: sticky; top: 0; z-index: 50; background: white; padding-bottom: 8px; }
.table-loading-overlay { position: absolute; inset: 0; background: rgba(255,255,255,.75); display: flex; align-items: center; justify-content: center; z-index: 5; backdrop-filter: blur(2px); border-radius: var(--radius-lg); }
.mobile-only { display: none; }
.no-print { }
@media print { .no-print { display: none !important; } }

/* Bootstrap util aliases */
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 4px !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 12px !important; }
.mb-4 { margin-bottom: 16px !important; }
.mt-2 { margin-top: 8px !important; }
.mt-3 { margin-top: 12px !important; }
.mt-4 { margin-top: 16px !important; }
.me-1 { margin-right: 4px !important; }
.me-2 { margin-right: 8px !important; }
.ms-1 { margin-left: 4px !important; }
.ms-2 { margin-left: 8px !important; }
.ms-auto { margin-left: auto !important; }
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 12px !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-bold { font-weight: 700 !important; }
.d-flex { display: flex !important; }
.d-none { display: none !important; }
.d-md-none { }
.align-items-center { align-items: center !important; }
.justify-content-end { justify-content: flex-end !important; }
.justify-content-between { justify-content: space-between !important; }
.text-end { text-align: right !important; }
.w-100 { width: 100% !important; }
.flex-1 { flex: 1; }
.overflow-hidden { overflow: hidden; }
.position-relative { position: relative; }

/* Grid system */
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.row.g-3 { gap: 10px; }
.col-md-2 { flex: 0 0 auto; width: calc(16.666% - 8px); min-width: 110px; }
.col-md-3 { flex: 0 0 auto; width: calc(25% - 8px); min-width: 130px; }
.col-md-4 { flex: 0 0 auto; width: calc(33.333% - 8px); }
.col-md-6 { flex: 0 0 auto; width: calc(50% - 4px); }
.col-md-12, .col-12 { flex: 0 0 100%; }
.col-lg-9 { flex: 1; min-width: 0; }
.col { flex: 1; min-width: 0; }

/* ── ACTIVITIES / ANNOUNCEMENTS HEADER LAYOUT ─────────────────── */
.activities-header, .announcements-header, .positions-header {
    display: grid; grid-template-columns: auto 1fr auto;
    align-items: center; gap: 10px; margin-bottom: 8px;
}
.activities-header .header-left, .announcements-header .header-left { justify-self: start; }
.activities-header .header-center, .announcements-header .header-center { justify-self: center; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.activities-header .header-right, .announcements-header .header-right { justify-self: end; display: flex; gap: 5px; align-items: center; }
.filter-select { width: 180px; }
.announcement-search { width: 220px; }

/* ── RESPONSIVE TABLET ────────────────────────────────────────── */
@media (max-width: 1000px) {
    .performance-layout { grid-template-columns: 1fr; }
    .col-md-2, .col-md-3, .col-md-4, .col-md-6 { width: 100%; }
}
@media (max-width: 900px) {
    .modal-card, .modal-box { min-width: unset; width: 92vw; }
}


/* ── RESPONSIVE MOBILE ────────────────────────────────────────── */
@media (max-width: 768px) {
    body, html { overflow: hidden; }
    .sidebar { transform: translateX(-100%); z-index: 3000; }
    .sidebar.show { transform: translateX(0); }
    .burger-btn { display: inline-flex; }
    .mobile-only { display: block; }
    .d-md-none { display: none !important; }
    .content-area { margin-left: 0 !important; padding: 5px 7px; }
    .content-card { padding: 0 7px 7px 7px; }
    .page-header { flex-direction: column; align-items: stretch; gap: 5px; padding: 6px 0 5px 0; }
    .page-header .header-left, .page-header .header-center { flex-direction: column; align-items: stretch; width: 100%; }
    .page-header .header-right { flex-direction: row; flex-wrap: wrap; margin-left: 0; }
    .page-header button, .page-header select, .page-header input { width: 100%; }
    .tabs, .custom-tabs { flex-wrap: wrap; }
    .tab-btn { flex: 1 1 auto; }
    .modal-overlay, .modal-backdrop { padding: 0; align-items: flex-end; }
    .modal-card, .modal-box { min-width: unset; width: 100%; max-width: 100%; border-bottom-left-radius: 0; border-bottom-right-radius: 0; max-height: 88vh; }
    .performance-layout { grid-template-columns: 1fr; }
    .score-summary-bar { flex-wrap: wrap; }
    .score-item { min-width: 40%; }
    .login-container { flex-direction: column; }
    .login-left { display: none !important; }
    .login-right { width: 100%; min-height: 100vh; }
    .login-card { margin-top: 14px; width: 92%; max-width: 400px; }
    .row { flex-direction: column; }
    .col-md-2, .col-md-3, .col-md-4, .col-md-6, .col-md-12 { width: 100%; }
    .activities-header, .announcements-header, .positions-header { display: flex !important; flex-direction: column !important; }
    .activities-header .header-left, .activities-header .header-center, .activities-header .header-right,
    .announcements-header .header-left, .announcements-header .header-center, .announcements-header .header-right { width: 100% !important; }
    .filter-select, .announcement-search { width: 100% !important; }
    .admin-header { flex-direction: column; }
    .admin-search { max-width: 100%; width: 100%; }
    .chat-sidebar.hide-mobile { display: none; }
    .chat-sidebar.show-mobile { display: block; width: 100%; }
    .modern-chat-layout { flex-direction: column; }
    .positions-header button {
        width: 100%;
    }
}

/* ── VACANCY ROWS ─────────────────────────────────────────────── */
.open-row td   { background: #fff5f5 !important; }
.open-row:hover td { background: #ffe8e8 !important; }
.filled-row td { background: #f0faf4 !important; }
.filled-row:hover td { background: #dcf5e7 !important; }

/* ── KRA COMPACT OVERRIDES ────────────────────────────────────── */
.kra-compact .table-secondary td { padding: 5px 7px !important; font-weight: 600; background: var(--bg-subtle); }
.kra-compact hr { margin: 8px 0; border-color: var(--border); }

/* ── POSITION TABLE ───────────────────────────────────────────── */
.position-table th { font-size: 10.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }
.position-table td { font-size: 11.5px; vertical-align: middle; }

/* ── POSITION SEARCH ──────────────────────────────────────────── */
.position-search { width: 240px; }
@media (max-width: 768px) { .position-search { width: 100% !important; } }

/* ── USERS LEFT PANEL ─────────────────────────────────────────── */
.users-left-panel { width: 200px; flex-shrink: 0; border-right: 1px solid var(--border); padding: 8px; overflow-y: auto; font-size: 12px; }
.users-left-panel::-webkit-scrollbar { width: 4px; }
.users-left-panel::-webkit-scrollbar-thumb { background: #9aa0a6; border-radius: 4px; }
.province-group-header { font-weight: 700; font-size: 12px; cursor: pointer; padding: 4px 6px; border-radius: var(--radius-sm); display: flex; align-items: center; gap: 5px; transition: background .12s; }
.province-group-header:hover { background: var(--bg-hover); }
.muni-item { font-size: 11.5px; color: var(--text-muted); cursor: pointer; padding: 2px 6px 2px 18px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: space-between; transition: background .12s; }
.muni-item:hover { background: var(--bg-hover); color: var(--color-primary); }

/* ── PROFILE GRID CARDS ───────────────────────────────────────── */
.profile-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; padding: 4px; }

/* ── USERS LAYOUT ─────────────────────────────────────────────── */
.users-layout { display: flex; flex: 1; min-height: 0; gap: 0; overflow: hidden; }
.users-right-panel { flex: 1; min-height: 0; min-width: 0; overflow: hidden; display: flex; flex-direction: column; }

/* ── EXPORT MODAL WIDE ────────────────────────────────────────── */
.modal-export { max-width: min(94vw, 500px) !important; }

/* ── CHIP / HERO BADGE ────────────────────────────────────────── */
.hero-badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 18px; font-size: 10.5px; font-weight: 600; }
.hero-badge.primary  { background: var(--color-primary-light); color: var(--color-primary); }
.hero-badge.secondary { background: var(--bg-subtle); color: var(--text-muted); }
.hero-badge.success  { background: var(--color-success-light); color: var(--color-success); }
.hero-badge.danger   { background: #fce8e6; color: var(--color-danger); }

/* ── TABLE-SECONDARY ROW ─────────────────────────────────────── */
.table-secondary { background: var(--bg-subtle) !important; }
.table-secondary td { font-weight: 600 !important; background: var(--bg-subtle) !important; }

/* ── PROGRESS BAR ─────────────────────────────────────────────── */
.progress { height: 6px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--color-primary); border-radius: 4px; transition: width .3s; }

/* ── ENSURE content-card fills height for flat pages ─────────── */
.content-card.h-100 { height: 100%; }

/* ── Small utility not in Bootstrap aliases ───────────────────── */
.fs-5 { font-size: 14px !important; }
.fs-6 { font-size: 12.5px !important; }
.small, .text-muted.small { font-size: 11px !important; }
.text-nowrap { white-space: nowrap; }
.border-end { border-right: 1px solid var(--border); }
.border-bottom { border-bottom: 1px solid var(--border); }
.p-3 { padding: 12px !important; }
.p-4 { padding: 16px !important; }
.px-2 { padding-left: 8px !important; padding-right: 8px !important; }
.px-3 { padding-left: 12px !important; padding-right: 12px !important; }
.px-4 { padding-left: 16px !important; padding-right: 16px !important; }
.py-1 { padding-top: 4px !important; padding-bottom: 4px !important; }
.py-2 { padding-top: 8px !important; padding-bottom: 8px !important; }
.py-3 { padding-top: 12px !important; padding-bottom: 12px !important; }
.py-4 { padding-top: 16px !important; padding-bottom: 16px !important; }
.pe-2 { padding-right: 8px !important; }
.ps-2 { padding-left: 8px !important; }
.h-100 { height: 100%; }
.mh-100 { max-height: 100%; }
.min-vh-100 { min-height: 100vh; }
.rounded { border-radius: var(--radius-md) !important; }
.rounded-circle { border-radius: 50% !important; }
.shadow-sm { box-shadow: var(--shadow-card) !important; }
.border { border: 1px solid var(--border) !important; }
.bg-light { background: var(--bg-subtle) !important; }
.bg-white { background: white !important; }
.text-primary { color: var(--color-primary) !important; }
.text-success { color: var(--color-success) !important; }
.text-danger  { color: var(--color-danger) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-dark    { color: #1f2937 !important; }
.text-secondary { color: var(--text-muted) !important; }

/* ── KRA EDITOR RENDER TREE COL ───────────────────────────────── */
.kra-col-third { flex: 0 0 33%; min-width: 200px; padding: 4px; }

/* ═══════════════════════════════════════════════════
   AGOS ADMIN — v5.1 PATCH (observation fixes)
   ═══════════════════════════════════════════════════ */

/* ── COLORED TAB VARIANTS ─────────────────────────────────────────── */

/* Green tab (Announcements Active) */
.tab-btn.tab-green.active {
    background: var(--color-success-light);
    color: var(--color-success);
    border: 1px solid #a8dab5;
}
.tab-btn.tab-green:hover:not(.active) {
    background: var(--color-success-light);
    color: var(--color-success);
}

/* Red tab (Announcements Expired) */
.tab-btn.tab-red.active {
    background: #fce8e6;
    color: var(--color-danger);
    border: 1px solid #f28b82;
}
.tab-btn.tab-red:hover:not(.active) {
    background: #fce8e6;
    color: var(--color-danger);
}

/* Blue tab (Activities - default active is already blue, keep) */
.tab-btn.tab-blue.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
    border: 1px solid #a4c2f7;
}
.tab-btn.tab-blue:hover:not(.active) {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

/* Orange tab (Activities Deadlines) */
.tab-btn.tab-orange.active {
    background: #fff3e0;
    color: var(--color-warning);
    border: 1px solid #ffcc80;
}
.tab-btn.tab-orange:hover:not(.active) {
    background: #fff3e0;
    color: var(--color-warning);
}

/* ── DEADLINE CALENDAR BOX ────────────────────────────────────────── */

.has-entry-deadline {
    border: 2px solid var(--color-warning) !important;
    background: #fff8ee !important;
}
.has-entry-deadline .calendar-list li {
    color: var(--color-warning);
}

/* ── USERS LAYOUT FIX ─────────────────────────────────────────────── */

/* Ensure content-card stretches fully in the layout */
.content-card { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* Fix users layout scrollable left panel */
.users-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Province card hover */
.province-card:hover { border-color: var(--color-primary) !important; background: var(--color-primary-light) !important; }

/* Employee table hover */
.emp-table-row:hover td { background: #f4f8ff; }

/* ── WORKPLAN / OUTPUTS FILTER MOBILE ────────────────────────────── */

@media (max-width: 768px) {
    .page-header .header-center select,
    .page-header .header-center input {
        width: 100% !important;
        min-width: 0 !important;
        flex: 1 1 100% !important;
    }
    .page-header .header-center {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ── PERFORMANCE / SCORE EDITOR ───────────────────────────────────── */

.performance-page {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.perf-header-left { flex: 1; min-width: 0; }
.perf-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.performance-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-shrink: 0;
    padding: 7px 0 6px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

/* ── SUPPORT CHAT SIDEBAR SCROLL ─────────────────────────────────── */

.modern-chat-layout { min-height: 0; flex: 1; display: flex; overflow: hidden; height: 100%; }
.chat-sidebar {
    scrollbar-width: thin;
    scrollbar-color: #9aa0a6 #e8eaed;
}

/* ── VACANCY MODAL PADDING ────────────────────────────────────────── */

.vacancy-modal .modal-body,
.vacancy-modal .modal-header,
.vacancy-modal .modal-footer {
    padding-left: 18px;
    padding-right: 18px;
}
.vacancy-modal .modal-body .form-group { margin-bottom: 10px; }
.vacancy-modal .modal-body label { margin-bottom: 3px; }

/* ── QR MODAL compact ─────────────────────────────────────────────── */
.qr-modal-box { max-width: 280px; text-align: center; }
.qr-modal-box img { width: 200px; height: 200px; object-fit: contain; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 8px; }

/* ── SCROLLBAR: always visible on all primary scroll areas ─────────── */
.page-body::-webkit-scrollbar,
.card-fill > div::-webkit-scrollbar { width: 7px; height: 8px; }
.page-body::-webkit-scrollbar-track,
.card-fill > div::-webkit-scrollbar-track { background: #e8eaed; border-radius: 4px; }
.page-body::-webkit-scrollbar-thumb,
.card-fill > div::-webkit-scrollbar-thumb { background: #9aa0a6; border-radius: 4px; }
.page-body::-webkit-scrollbar-thumb:hover,
.card-fill > div::-webkit-scrollbar-thumb:hover { background: #5f6368; }
.page-body::-webkit-scrollbar-corner,
.card-fill > div::-webkit-scrollbar-corner { background: #e8eaed; }

/* ── MINI SPINNER dark variant for sync badges ──────────────────────── */
.mini-spinner.dark {
    border-color: rgba(26,115,232,.2);
    border-top-color: var(--color-primary);
}

/* ═══════════════════════════════════════════════════
   PAGE-HEADER-STACK — responsive two-row header
   Replaces the old left/center/right 3-col layout
   ═══════════════════════════════════════════════════ */

.page-header-stack {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 16px 0 5px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
    flex-shrink: 0;
}

/* Top row: title left, action buttons right */
.ph-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}
.ph-row-top {
    justify-content: space-between;
}
.ph-title {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
}
.ph-title h5 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #1a2332;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ph-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

/* Filter row: tabs + inputs + action buttons all in one wrap row */
.ph-row-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.ph-row-filters select,
.ph-row-filters input {
    height: var(--input-height);
    font-size: 12px;
}

/* ── MOBILE: stack filter row items vertically ─────────────── */
@media (max-width: 768px) {
    .page-header-stack { padding: 5px 0 4px; }

    .ph-row-filters {
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
    }
    .ph-row-filters .custom-tabs {
        width: 100%;
    }
    .ph-row-filters .custom-tabs .tab-btn {
        flex: 1;
    }
    .ph-row-filters select,
    .ph-row-filters input {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        flex: unset !important;
    }
    .ph-row-filters button {
        width: 100% !important;
        flex-shrink: unset !important;
    }
    .ph-actions button {
        padding: 4px 10px;
    }

    /* Admin Users search full width on mobile */
    .admin-search-input {
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* ── VACANCY MODAL: proper padding ─────────────────────────── */
.vacancy-modal .modal-body { padding: 14px 18px; }
.vacancy-modal .modal-header { padding: 10px 18px; }
.vacancy-modal .modal-footer { padding: 10px 18px; }
.vacancy-modal .form-group,
.vacancy-modal .form-row { margin-bottom: 10px; }
.vacancy-modal label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 3px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .3px;
}
.vacancy-modal .form-control,
.vacancy-modal .form-select { font-size: 12.5px; }

/* ── KRA sticky header: scroll fix ─────────────────────────── */
.kra-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.kra-container .sticky-top-bar {
    flex-shrink: 0;
    background: white;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
}
.kra-container > div:last-child {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #9aa0a6 #e8eaed;
}

/* ── SCORING TAB scroll ─────────────────────────────────────── */
.content-card.kra-compact {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
.content-card.kra-compact .sticky-top-bar {
    flex-shrink: 0;
    background: white;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
}
.content-card.kra-compact > .table-scroll-wrapper,
.content-card.kra-compact > div:last-of-type {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #9aa0a6 #e8eaed;
}

/* ── QR MODAL centered layout ───────────────────────────────── */
.qr-employee-name {
    font-weight: 700;
    font-size: 14px;
    color: #1a2332;
    text-align: center;
    margin-top: 8px;
}
.qr-employee-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    text-align: center;
}

/* ── LOCATION HEADER in employee table ─────────────────────── */
.emp-location-header {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-primary);
    padding: 5px 8px 4px;
    border-bottom: 2px solid var(--color-primary-light);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

/* ── ADMIN SEARCH container ─────────────────────────────────── */
.admin-search-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.admin-search-input {
    max-width: 280px;
    flex: 1;
}
@media (max-width: 768px) {
    .admin-search-container { flex-direction: column; align-items: stretch; }
    .admin-search-input { max-width: 100% !important; }
}


.modern-modal { display: flex; flex-direction: column; max-height: 85vh; overflow: hidden; }

/* ── EMPLOYEES LEFT PANEL MOBILE ──────────────────────────────── */
@media (max-width: 768px) {
    .emp-left-panel { width: 140px !important; }
    .emp-left-panel.hidden-mobile { display: none !important; }
    .emp-right-panel.fullwidth-mobile { flex: 1 !important; width: 100% !important; }
}

/* ── VACANCY HEADER MOBILE STACK ─────────────────────────────── */
.positions-header {
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px;
}
@media (max-width: 768px) {
    .positions-header { flex-direction: column; align-items: stretch; }
    .positions-header .header-left,
    .positions-header .header-center,
    .positions-header .header-right { width: 100%; }
    .position-search { width: 100% !important; }
}

/* ── CMAT / VACANCY SEARCH+ACTION ROW LAYOUT ─────────────────── */
/* On desktop: action buttons sit right-aligned on their own line  */
.cmat-action-row {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    width: 100%;
}
/* On mobile: ph-row-filters stacks everything; inner row and
   action row both stretch full-width via ph-row-filters rule.
   Hide the inline Search/Clear buttons on mobile — they become
   part of the stacked column automatically, but we want them
   full-width, so override flex on the inner row.               */
@media (max-width: 768px) {
    .cmat-action-row { justify-content: stretch; }
    .cmat-action-row button { width: 100%; }
    .cmat-inline-btn { width: 100%; }
}
