/* ================================================================
   AGOS UNIVERSAL DESIGN SYSTEM  v4.0 — Enterprise Grade
   Full mobile fix, compact buttons, hover actions, page caching
   ================================================================ */

*, *::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; }
.dashboard-layout.offline-active { height: calc(100vh - 36px); }

/* ── 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-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; text-align: center; font-family: 'IBM Plex Sans', 'Segoe UI', sans-serif; }
.app-version { font-size: 10px; color: rgba(252,209,22,.55); margin-top: 2px; text-align: center; 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 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;
}

.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,
.workplan-header,
.profile-header,
.outputs-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,
.profile-header h3,
.workplan-header h3,
.outputs-header h3 {
    margin: 0; font-size: 14px; font-weight: 700;
    color: #1a2332; white-space: nowrap; flex-shrink: 0;
}

.page-header .header-left,
.workplan-header .header-left,
.profile-header .header-left,
.outputs-header .header-left { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }

.page-header .header-center,
.workplan-header .header-center,
.profile-header .header-center,
.outputs-header .header-center { display: flex; align-items: center; gap: 6px; flex: 1; flex-wrap: wrap; justify-content: center; }

.page-header .header-right,
.workplan-header .header-right,
.profile-header .header-right,
.outputs-header .header-right { display: flex; align-items: center; gap: 5px; flex-shrink: 0; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }

.header-filters { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }

/* ── Period Group Selector ────────────────────────────────────────────── */
.period-group {
    display: inline-flex;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #e8eaed;
    border-radius: 6px;
    overflow: hidden;
}

    .period-group select {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        height: 26px !important;
        font-size: 12px !important;
        padding: 0 20px 0 8px !important;
        border-radius: 0 !important;
        font-family: inherit !important;
    }

        .period-group select:focus {
            background: #e8f0fe !important;
            outline: none !important;
        }

.period-sep {
    width: 1px;
    background: #e8eaed;
    align-self: stretch;
}

.profile-actions, .card-actions { display: flex; gap: 5px; align-items: center; flex-shrink: 0; flex-wrap: wrap; }

.workplan-container,
.outputs-container,
.profile-container,
.perf-container { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }

/* Let horizontal scroll pass through on body wrappers */
.workplan-body-scroll,
.outputs-body-scroll { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }

.workplan-body,
.outputs-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding-bottom: 6px; }

/* Performance/KRA scroll area */
.perf-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding-bottom: 8px; }

.profile-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding-bottom: 12px; }

/* table-scroll-wrapper — used in stacked-card pages (Profile).
   max-height constrains the box so BOTH scrollbars are always visible. */
.table-scroll-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 340px;
    -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-thumb:hover { background: #5f6368; }
.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-icon { font-size: 14px; }
.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-label, .profile-label {
    font-weight: 600; font-size: 10.5px; color: var(--text-muted);
    display: block; margin-bottom: 2px;
    text-transform: uppercase; letter-spacing: .4px;
}

.form-row { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }

/* ── 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 { background: white; color: #3c4043; border: 1px solid var(--border-strong); }
.btn-secondary:hover:not(:disabled),
.btn-outline:hover:not(:disabled) { background: #f1f3f4; border-color: #9aa0a6; }
.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-icon:disabled { opacity: .45; cursor: not-allowed; }

.btn-small { height: 22px !important; padding: 0 8px !important; font-size: 10.5px !important; border-radius: var(--radius-sm) !important; }
.btn-xs    { height: 18px; padding: 0 6px; font-size: 10px; border-radius: var(--radius-sm); }

/* Icon-only action buttons in table rows */
.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); }
.btn-action-icon.warning:hover { background: #fef9c3; border-color: #fde047; color: var(--color-warning); }

.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; }

.workplan-toolbar { display: flex; gap: 5px; margin-bottom: 8px; align-items: center; flex-wrap: wrap; }

.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; }
.th-act,
.td-act {
    width: 1%;
    white-space: nowrap;
    padding: 0 !important;
}

/* ── TABLES ────────────────────────────────────────────────────── */

.outputs-table, .accomplishment-table, .timelog-table,
.workplan-table, .table-compact {
    width: max-content; min-width: 100%;
    border-collapse: collapse; font-size: 11.5px; table-layout: auto;
}

.outputs-table th, .accomplishment-table th, .timelog-table th,
.workplan-table th, .table-compact 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;
}

.outputs-table td, .accomplishment-table td, .timelog-table td,
.workplan-table td, .table-compact td {
    padding: 4px 7px; font-size: 11.5px;
    border-bottom: 1px solid #f1f2f4;
    vertical-align: middle; line-height: 1.4;
}

.outputs-table tbody tr:hover td,
.accomplishment-table tbody tr:hover td,
.timelog-table tbody tr:hover td,
.workplan-table tbody tr:hover td,
.table-compact tbody tr:hover td { background: #f4f8ff; }

.weekend-row td { background: #e5e7eb !important; color: var(--text-muted); }

/* Action cell — always vertically centered */
.action-cell {
    white-space: nowrap;
    vertical-align: middle !important;
    padding: 0 5px !important;
    width: 60px;
}
.action-cell-inner {
    display: flex; align-items: center;
    justify-content: flex-end; gap: 3px;
    min-height: 28px;
}

/* Hover-reveal action buttons */
.row-hover-actions {
    display: flex; gap: 3px; align-items: center;
    opacity: 0; transition: opacity .15s;
}
tr:hover .row-hover-actions { opacity: 1; }

/* ── 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;
    padding: 15px;
}

@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-card h4, .modal-card h3 { margin: 0 0 3px; font-size: 14px; font-weight: 700; color: #1a2332; }

/* ── 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;
}
.toast-popup.show       { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-popup.toast-success { background: #137333; }
.toast-popup.toast-error   { background: #d93025; }

.toast-message { position: fixed; top: 36px; left: 50%; transform: translateX(-50%); background: var(--color-primary); color: white; padding: 10px 20px; border-radius: 9px; box-shadow: 0 6px 20px rgba(0,0,0,.2); font-size: 12.5px; font-weight: 500; z-index: 9999; }

.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; }

.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; }

/* ── LOADING & EMPTY ───────────────────────────────────────────── */

.page-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 50px 20px; color: var(--text-muted); gap: 9px; }
.page-loading .spinner-border { width: 22px; height: 22px; border-width: 2.5px; border-color: var(--color-primary) transparent transparent transparent; border-style: solid; border-radius: 50%; animation: spin .75s linear infinite; }
.page-loading span { font-size: 12.5px; }

@keyframes spin { to { transform: rotate(360deg); } }

.spinner-border { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(0,0,0,.1); border-top-color: var(--color-primary); border-radius: 50%; animation: spin .65s linear infinite; vertical-align: middle; }

.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; }

/* ── LOGIN PAGE ────────────────────────────────────────────────── */

.login-container { display: flex; height: 100vh; }
.login-left { flex: 1; background: url('/Assets/login-bg.jpg') center/cover no-repeat; display: flex; justify-content: center; align-items: center; color: white; }
.left-overlay { text-align: center; max-width: 600px; background: rgba(0,0,0,.18); padding: 26px 30px; border-radius: 13px; backdrop-filter: blur(3px); }
.left-overlay h1 { font-size: 34px; margin-bottom: 7px; }
.left-overlay h3 { margin-bottom: 12px; }
.login-right { width: 460px; background: #f1f3f4; display: flex; justify-content: center; align-items: center; }
.login-card { width: 365px; background: white; padding: 30px; border-radius: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.13); text-align: center; }
.agency-logo  { width: 120px; margin-bottom: 12px; }
.agency-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.agos-title   { font-size: 21px; font-weight: 700; color: var(--color-primary); margin-bottom: 4px; }
.sub-text     { color: var(--text-muted); margin-bottom: 20px; font-size: 12px; }
.show-password { text-align: left; font-size: 12px; margin-bottom: 12px; }
.login-btn { display: block; width: 100%; height: var(--btn-height); background: var(--color-primary); color: white; border: none; border-radius: var(--radius-sm); font-weight: 600; font-size: 11.5px; cursor: pointer; transition: background .15s; }
.login-btn:hover { background: var(--color-primary-dark); }
.form-links { margin-top: 14px; font-size: 12.5px; }
.form-links a { color: var(--color-primary); text-decoration: none; cursor: pointer; margin: 0 6px; }
.form-links a:hover { text-decoration: underline; }
.register-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; }
.dat-terminal-btn { display: inline-flex; align-items: center; padding: 9px 18px; background: rgba(255,255,255,.12); border: 1.5px solid rgba(255,255,255,.35); border-radius: 9px; color: white; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; backdrop-filter: blur(6px); transition: background .2s, border-color .2s; }
.dat-terminal-btn:hover { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.6); color: #fff; text-decoration: none; }
.mobile-terminal-wrapper { display: none; }
.lp-submit {
    display: inline-block;
    width: 100%;
    height: 42px;
    line-height: 42px;
    text-align: center;
    background: linear-gradient(135deg, #4f8cff, #2563eb);
    color: #fff;
    font-weight: 600;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s ease;
}

    .lp-submit:hover {
        background: linear-gradient(135deg, #3b7df0, #1d4ed8);
        transform: translateY(-1px);
    }

/* ── 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; } }

/* ── ANNOUNCEMENT CARDS ─────────────────────────────────────────── */

.announcements-scroll { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; flex: 1; }
.announcement-card { padding: 8px 10px; border-radius: 6px; border-left: 3px solid; cursor: pointer; transition: background .15s; background: var(--bg-subtle); }
.announcement-card:hover         { background: #e8f0fe; }
.announcement-card.urgent        { border-color: #e37400; background: #fff8e6; }
.announcement-card.urgent:hover  { background: #fef0cc; }
.announcement-card.important     { border-color: var(--color-primary); }
.announcement-card-title   { font-weight: 600; font-size: 12px; margin-bottom: 2px; }
.announcement-card-date    { font-size: 10px; color: var(--text-muted); margin-bottom: 3px; }
.announcement-card-preview { font-size: 11px; color: #4b5563; line-height: 1.4; }

/* ── CALENDAR ──────────────────────────────────────────────────── */

.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.calendar-nav { display: flex; align-items: center; gap: 8px; }
.calendar-nav-btn, .month-btn { width: 26px; height: 26px; border: none; border-radius: var(--radius-sm); background: #f1f3f4; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s; }
.calendar-nav-btn:hover, .month-btn:hover { background: #e8eaed; }
.calendar-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 10px; text-align: center; margin-bottom: 4px; font-weight: 600; color: var(--text-muted); }
.calendar-weekdays .sun { color: #d93025; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 40px; column-gap: 3px; row-gap: 4px; font-size: 9.5px; }
.calendar-day { position: relative; background: #f8f9fa; border-radius: 4px; min-height: 40px; padding: 3px; display: flex; flex-direction: column; align-items: flex-end; overflow: hidden; cursor: pointer; }
.calendar-day:hover { background: #e8f0fe; }
.calendar-day.sun { color: #d93025; font-weight: 600; }
.calendar-day-has-entry { background: #e8f0fe; border: 1.5px solid var(--color-primary); }
.calendar-day-today { outline: 2px solid var(--color-primary); outline-offset: -2px; }
.calendar-day-selected { background: var(--color-primary-light) !important; border: 1.5px solid var(--color-primary); }
.calendar-day-number { font-weight: 600; font-size: 9.5px; }
.calendar-day-entries { font-size: 9px; line-height: 1.2; width: 100%; }
.calendar-entry-text { font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }
.calendar-entry-dot { width: 4px; height: 4px; background: var(--color-primary); border-radius: 50%; margin: 2px auto 0; }
.calendar-empty { height: 40px; }
.calendar-add-btn { position: absolute; top: 3px; right: 3px; width: 16px; height: 16px; border: none; border-radius: 3px; background: var(--color-success); color: white; font-size: 12px; opacity: 0; cursor: pointer; transition: opacity .15s; display: flex; align-items: center; justify-content: center; line-height: 1; }
.calendar-day:hover .calendar-add-btn { opacity: 1; }

/* ── DASHBOARD GRID ────────────────────────────────────────────── */

.dashboard-grid {
    display: grid;
    grid-template-columns: 200px 1fr 230px;
    grid-template-rows: auto auto 1fr;
    gap: 12px;
    padding: 4px 4px 16px 0;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    align-items: start;
}

.profile-card       { grid-column: 1; grid-row: 1 / span 3; }
.announcements-card { grid-column: 2; grid-row: 1; }
.events-card        { grid-column: 2; grid-row: 2; }
.todo-card          { grid-column: 2; grid-row: 3; }
.calendar-card      { grid-column: 3; grid-row: 1 / span 3; display: flex; flex-direction: column; }

.dash-profile-photo-wrap { display: flex; justify-content: center; margin-bottom: 8px; }
.dash-profile-photo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 3px solid var(--color-primary-light); box-shadow: 0 2px 8px rgba(26,115,232,.18); }
.dash-profile-initials { width: 72px; height: 72px; border-radius: 50%; background: linear-gradient(135deg, var(--color-primary), #1557b0); color: white; font-size: 22px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.dash-profile-name { font-size: 13px; font-weight: 700; text-align: center; margin-bottom: 2px; }
.dash-profile-role { font-size: 11px; color: var(--text-muted); text-align: center; margin-bottom: 1px; }
.dash-profile-location { font-size: 10.5px; color: var(--text-muted); text-align: center; margin-top: 5px; }
.dash-profile-chips { display: flex; justify-content: center; gap: 5px; margin-top: 7px; flex-wrap: wrap; }
.profile-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 18px; background: var(--color-success-light); color: var(--color-success); font-size: 10.5px; font-weight: 600; border: 1px solid #a8dab5; }
.chip-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.chip-dot.green { background: var(--color-success); }
.dash-stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.dash-stat { background: var(--bg-subtle); border-radius: 7px; padding: 7px 9px; text-align: center; border: 1px solid var(--border); }
.dash-stat-value { font-size: 16px; font-weight: 700; color: var(--color-primary); }
.dash-stat-label { font-size: 10px; color: var(--text-muted); margin-top: 1px; }
.dash-quick-links { margin-top: 10px; display: flex; flex-direction: column; gap: 3px; }
.dash-quick-link { display: flex; align-items: center; gap: 7px; padding: 6px 8px; border-radius: 5px; background: var(--bg-subtle); border: 1px solid var(--border); text-decoration: none; color: #3c4043; font-size: 11.5px; font-weight: 500; transition: all .15s; cursor: pointer; }
.dash-quick-link:hover { background: var(--bg-hover); border-color: var(--color-primary); color: var(--color-primary); }
.dash-quick-link .icon { font-size: 14px; color: var(--color-primary); }

.event-card { padding: 6px 8px; border-radius: 6px; background: var(--bg-subtle); border-left: 3px solid var(--color-primary); cursor: pointer; margin-bottom: 4px; transition: background .15s; }
.event-card:hover { background: #e8f0fe; }
.event-card-type { font-size: 9.5px; font-weight: 700; text-transform: uppercase; margin-bottom: 1px; }
.event-card-type.activity { color: var(--color-primary); }
.event-card-type.deadline { color: var(--color-danger); }
.event-card-title { font-size: 12px; font-weight: 600; }
.event-card-meta  { font-size: 10px; color: var(--text-muted); margin-top: 1px; }

.todo-card-item { padding: 6px 8px; border-radius: 6px; background: var(--bg-subtle); border-left: 3px solid var(--color-success); cursor: pointer; margin-bottom: 4px; transition: background .15s; }
.todo-card-item:hover { background: #e6f4ea; }
.todo-card-time  { font-size: 10px; color: var(--text-muted); margin-bottom: 1px; }
.todo-card-title { font-size: 12px; font-weight: 600; }
.todo-card-meta  { font-size: 10px; color: var(--text-muted); margin-top: 1px; }

/* ── PERFORMANCE PAGE ──────────────────────────────────────────── */

.performance-layout { display: grid; grid-template-columns: 70% 30%; gap: 10px; padding: 0 0 10px 0; align-items: start; }
.performance-left, .performance-right { display: flex; flex-direction: column; gap: 10px; }
.kra-table-container, .scores-table-container { overflow-x: auto; }

.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; }

/* ── WORKPLAN PAGE ─────────────────────────────────────────────── */

.workplan-layout { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(440px, 2fr); gap: 8px; flex-shrink: 0; }
.workplan-table { grid-column: 1 / span 2; }
.activities-panel { overflow-x: auto; min-width: 0; }
.center-nav { display: flex; align-items: center; gap: 8px; }
.month-title { font-weight: 600; font-size: 13px; }

/* ── PROFILE PAGE ──────────────────────────────────────────────── */

.profile-hero-card { border-radius: var(--radius-lg); overflow: hidden; padding: 0; position: relative; background: white; border: 1px solid var(--border); min-height:min-content; }
.profile-hero-banner { height: 30px; background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%); }
.profile-hero-body { display: flex; align-items: flex-end; gap: 14px; padding: 0 18px 14px; position: relative; }
.profile-hero-avatar-wrap { position: relative; margin-top: -36px; flex-shrink: 0; }
.profile-hero-avatar { width: 72px; height: 72px; border-radius: 50%; border: 3px solid white; object-fit: cover; box-shadow: 0 2px 8px rgba(0,0,0,.18); display: flex; align-items: center; justify-content: center; }
.profile-hero-initials { background: linear-gradient(135deg, #1a73e8, #1557b0); color: white; font-size: 22px; font-weight: 700; }
.profile-hero-upload-btn { position: absolute; bottom: 0; right: 0; width: 22px; height: 22px; background: white; border-radius: 50%; border: 1.5px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 11px; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.14); }
.profile-hero-info { flex: 1; padding-bottom: 3px; }
.profile-hero-name { font-size: 15px; font-weight: 700; color: #1a2332; margin-bottom: 4px; }
.profile-hero-meta { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 4px; }
.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: #e8f0fe; color: var(--color-primary); }
.hero-badge.secondary { background: #f1f3f4; color: var(--text-muted); }
.hero-badge.status   { background: var(--color-success-light); color: var(--color-success); }
.profile-hero-location { font-size: 11px; color: var(--text-muted); }
.profile-hero-qr { margin-left: auto; padding-bottom: 3px; flex-shrink: 0; }

.profile-grid { display: grid; grid-template-columns: 150px 1fr 150px 1fr; gap: 4px 8px; align-items: center; }
.employment-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.employment-field { display: flex; flex-direction: column; }
.employment-field label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); margin-bottom: 2px; }

.profile-label { font-size: 10.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; padding: 2px 0; }

.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; }

/* ── SUPPORT PAGE ──────────────────────────────────────────────── */

.support-layout { display: grid; grid-template-columns: 40% 60%; gap: 12px; padding: 0 0 10px 0; min-height: 0; flex: 1; align-items: start; }
.support-layout .card { min-width: 0; }
.support-form { display: flex; flex-direction: column; gap: 8px; }
.support-desc { height: 100px; }
.support-chat-card { flex: 1; min-height: 0; max-height: calc(100vh - 160px); display: flex; flex-direction: column; }
.chat-container { display: flex; flex-direction: column; height: 100%; min-height: 400px; max-height: calc(100vh - 180px); }
.chat-messages { flex: 1; overflow-y: auto; padding: 8px; min-height: 0; }
.chat-row { display: flex; margin-bottom: 7px; }
.chat-row.user  { justify-content: flex-end; }
.chat-row.admin { justify-content: flex-start; }
.chat-bubble { max-width: 300px; padding: 7px 11px; border-radius: 13px; background: #e8eaed; font-size: 12px; }
.chat-row.user .chat-bubble { background: var(--color-primary); color: white; }
.chat-meta { font-size: 10px; margin-top: 3px; opacity: .75; }
.chat-input { display: flex; gap: 7px; padding: 7px; border-top: 1px solid var(--border); flex-shrink: 0; background: white; position: sticky; bottom: 0; }

/* ── MISC ──────────────────────────────────────────────────────── */

.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; flex: 1; }

.no-print { }
@media print { .no-print { display: none !important; } }

.mobile-only { display: none; }

/* ── RESPONSIVE TABLET ─────────────────────────────────────────── */

@media (max-width: 1100px) {
    .dashboard-grid { grid-template-columns: 190px 1fr 210px; }
}

@media (max-width: 1000px) {
    .login-left { flex: 0.8; }
    .login-right { width: 380px; }
    .performance-layout { grid-template-columns: 1fr; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .profile-card, .announcements-card, .events-card, .todo-card, .calendar-card { grid-column: unset; grid-row: unset; }
    .workplan-layout { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .login-left { display: none !important; }
    .login-container { justify-content: center; align-items: center; background: url('/Assets/login-bg.jpg') center/cover no-repeat; }
    .login-right { width: 100%; min-height: 100vh; height: auto; background: transparent; align-items: center; justify-content: center; }
    .login-card { width: 90%; max-width: 420px; margin: 0 auto; }
    .register-grid { grid-template-columns: 1fr; }
    .modal-card, .modal-box { min-width: unset; width: 92vw; }
    .profile-grid { grid-template-columns: 1fr 1fr; }
    .support-layout { grid-template-columns: 1fr; }
}

/* ── RESPONSIVE MOBILE ─────────────────────────────────────────── */

@media (max-width: 768px) {
    body, html { overflow: hidden; }

    .sidebar { transform: translateX(-100%); z-index: 3000; }
    .sidebar.open { transform: translateX(0); }

    .burger-btn { display: inline-flex; }
    .mobile-only { display: block; }

    .content-area { margin-left: 0 !important; padding: 5px 7px; overflow-y: auto; height: 100vh; }
    .content-card { padding: 0 7px 7px 7px; }

    .page-header,
    .workplan-header,
    .profile-header,
    .outputs-header { flex-direction: column; align-items: stretch; gap: 5px; padding: 6px 0 5px 0; }

    .page-header .header-left,
    .workplan-header .header-left,
    .profile-header .header-left,
    .outputs-header .header-left,
    .page-header .header-center,
    .workplan-header .header-center,
    .profile-header .header-center,
    .outputs-header .header-center { flex-direction: column; align-items: stretch; width: 100%; }

    .page-header .header-right,
    .workplan-header .header-right,
    .profile-header .header-right,
    .outputs-header .header-right { flex-direction: row; flex-wrap: wrap; margin-left: 0; }

    .page-header button,
    .workplan-header button,
    .profile-header button,
    .outputs-header button,
    .workplan-header select,
    .profile-header select,
    .outputs-header select,
    .workplan-header input,
    .profile-header input,
    .outputs-header input { width: 100%; }

    .header-filters { flex-direction: column; align-items: stretch; width: 100%; }
    .header-filters > * { width: 100% !important; }

    .profile-actions, .card-actions { flex-direction: row; flex-wrap: wrap; width: 100%; margin-left: 0; }
    .profile-actions > *, .card-actions > * { flex: 1; justify-content: center; min-width: 0; }

    .tabs, .custom-tabs { flex-wrap: wrap; }
    .tab-btn { flex: 1 1 auto; white-space: normal; text-align: center; }

    .performance-layout, .workplan-layout, .outputs-layout,
    .support-layout, .dashboard-grid { grid-template-columns: 1fr; }
    .support-layout {
        flex: unset;
        overflow-y: auto;
    }
    .support-chat-card {
        height: 70vh;
        min-height: 320px;
    }
    .support-form .form-control,
    .support-form .form-select,
    .support-form textarea,
    .support-form button {
        width: 100%;
        box-sizing: border-box;
    }
    .support-desc { height: 80px; }

    .workplan-table { grid-column: 1; }

    .profile-card, .announcements-card, .events-card, .todo-card, .calendar-card { order: unset; grid-row: unset; grid-column: unset; }
    .profile-card { order: 1; }
    .announcements-card { order: 2; }
    .events-card { order: 3; }
    .todo-card { order: 4; }
    .calendar-card { order: 5; }

    .profile-grid { grid-template-columns: 1fr 1fr; }
    .employment-grid { grid-template-columns: 1fr; }
    .profile-hero-body { flex-wrap: wrap; }
    .profile-hero-qr { margin-left: 0; }

    .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; }

    .score-summary-bar { flex-wrap: wrap; }
    .score-item { min-width: 40%; }
    .chat-bubble { max-width: 82%; }

    .mobile-terminal-wrapper { display: block; width: 100%; padding: 14px 12px 0; }
    .mobile-terminal-wrapper .dat-terminal-btn { display: flex; width: 100%; height: 46px; font-size: 13.5px; font-weight: 700; border-radius: 9px; border: none; background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark)); color: white; justify-content: center; align-items: center; }
    .left-overlay .dat-terminal-btn { display: none; }

    .login-container { flex-direction: column; align-items: center; justify-content: flex-start; }
    .login-left { display: none !important; }
    .login-right { width: 100%; min-height: 100vh; height: auto; background: transparent; }
    .login-card { margin-top: 14px; width: 92%; max-width: 400px; }
    .register-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .profile-grid { grid-template-columns: 1fr; }
    .login-card { width: 92%; padding: 20px; }
    .agos-title { font-size: 18px; }
}


/* ── Mobile header filter selects go full-width ──────────────────── */
@media (max-width: 768px) {
    .header-center .form-select,
    .header-center select {
        width: 100% !important;
        min-width: 0 !important;
    }
    .header-center {
        flex-direction: column;
        align-items: stretch;
    }
    /* Training table - badge and button stay inline, don't wrap awkwardly */
    .training-hours-badge { flex-shrink: 0; }
    /* Profile training card-actions stay contained */
    .card .card-actions {
        flex-shrink: 0;
        flex-wrap: nowrap;
        overflow: hidden;
    }
}


/* ── Performance KRA table — fixed layout, no wide expansion ───── */
.perf-kra-table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    font-size: 12px;
    table-layout: fixed;
}

.perf-kra-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;
    overflow: hidden;
    text-overflow: ellipsis;
}

.perf-kra-table td {
    padding: 5px 7px;
    font-size: 12px;
    border-bottom: 1px solid #f1f2f4;
    vertical-align: top;
    line-height: 1.45;
    overflow: hidden;
    word-break: break-word;
    white-space: normal;
}

.perf-kra-table tbody tr:hover td { background: #f4f8ff; }

/* Column widths for perf-kra-table */
.perf-kra-table col.col-guide    { width: 36px; }
.perf-kra-table col.col-cat      { width: 72px; }
.perf-kra-table col.col-kra      { width: 22%; }
.perf-kra-table col.col-si       { width: 30%; }
.perf-kra-table col.col-period   { width: 72px; }
.perf-kra-table col.col-score    { width: 52px; }
.perf-kra-table col.col-detail   { width: 44px; }

/* Perf table scroll wrapper - always show scrollbar */
.perf-table-scroll {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: auto;
    scrollbar-color: #9aa0a6 #e8eaed;
    padding-bottom: 10px;
}
.perf-table-scroll::-webkit-scrollbar { height: 8px; }
.perf-table-scroll::-webkit-scrollbar-track { background: #e8eaed; border-radius: 4px; }
.perf-table-scroll::-webkit-scrollbar-thumb { background: #9aa0a6; border-radius: 4px; }
.perf-table-scroll::-webkit-scrollbar-thumb:hover { background: #5f6368; }


/* ── Table viewport scroll — both axes, always visible scrollbars ─
   Usage:
     Parent card:   class="card card-fill" (flex:1 min-height:0)
     Inner wrapper: class="table-viewport"
   The wrapper fills the parent exactly → both scrollbars at viewport edge
   ──────────────────────────────────────────────────────────────── */

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

.card-fill .card-header {
    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; }

/* Data tables inside .table-viewport expand to content width */
.table-viewport table:not(.perf-kra-table) {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
}

/* workplan-body and outputs-body — do NOT scroll vertically at body level.
   All scrolling happens inside the constrained .table-viewport boxes.     */
.workplan-body { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 8px; padding-bottom: 0; }
.outputs-body  { flex: 1; min-height: 0; overflow: hidden; padding-bottom: 0; }
.perf-body     { flex: 1; min-height: 0; overflow: hidden; padding-bottom: 0; }

/* workplan-layout: top grid only (activities + calendar), auto height */
.workplan-layout {
    flex-shrink: 0;
}

/* workplan-entries: the entries table section below the top grid */
.workplan-entries {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
