:root {
    --primary: #0b3d6e;
    --primary-light: #1a5a9e;
    --accent: #c9a227;
    --bg: #f4f6f9;
    --surface: #ffffff;
    --text: #1a2332;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #059669;
    --error: #dc2626;
    --warning: #d97706;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
    --sidebar-w: 280px;
    --sidebar-w-icons: 72px;
    --topbar-h: clamp(3.25rem, 2.5rem + 2vw, 4rem);
    --touch-min: 44px;
    --font-body: clamp(0.875rem, 0.82rem + 0.25vw, 1rem);
    --font-label: clamp(0.78rem, 0.74rem + 0.2vw, 0.85rem);
    --font-h1: clamp(1.1rem, 1rem + 0.6vw, 1.35rem);
    --font-h2: clamp(1rem, 0.92rem + 0.4vw, 1.15rem);
    --font-h3: clamp(0.92rem, 0.86rem + 0.3vw, 1.05rem);
    --font-stat: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
    --table-font-size: clamp(0.75rem, 0.68rem + 0.35vw, 0.875rem);
    --table-head-font-size: clamp(0.7rem, 0.64rem + 0.3vw, 0.82rem);
    --table-cell-pad-y: clamp(0.35rem, 0.28rem + 0.2vw, 0.6rem);
    --table-cell-pad-x: clamp(0.35rem, 0.28rem + 0.25vw, 0.75rem);
    --content-pad: clamp(0.75rem, 2vw, 1.5rem);
    --content-max: 100%;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
}

img, svg, video {
    max-width: 100%;
    height: auto;
}

.hidden { display: none !important; }

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, #0a2540 100%);
    padding: 1rem;
}

.login-card {
    background: var(--surface);
    border-radius: 12px;
    padding: clamp(1.25rem, 4vw, 2rem);
    width: 100%;
    max-width: min(420px, calc(100vw - 2rem));
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.login-card--wide { max-width: 560px; }

.login-footer {
    margin-top: 1.25rem;
    text-align: center;
    font-size: .9rem;
    color: var(--text-muted);
}

.login-footer a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.login-footer a:hover { text-decoration: underline; }

.login-header { text-align: center; margin-bottom: 1.5rem; }
.login-header h1 { font-size: var(--font-h2); color: var(--primary); margin-top: .5rem; }
.login-header p { color: var(--text-muted); font-size: clamp(0.82rem, 0.78rem + 0.2vw, 0.9rem); }

.logo-mark {
    width: 56px; height: 56px;
    background: var(--primary);
    color: #fff;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}
.logo-mark.sm { width: 40px; height: 40px; font-size: .85rem; border-radius: 8px; }

.wpu-logo {
    display: block;
    object-fit: contain;
    flex-shrink: 0;
    background: transparent;
}
.wpu-logo--sm {
    width: 44px;
    height: 44px;
}
.wpu-logo--lg {
    width: 88px;
    height: 88px;
    margin: 0 auto .5rem;
}

/* Layout */
#app {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100vw;
    min-height: 100vh;
    min-height: 100dvh;
    transition: margin-left 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

body.no-scroll {
    overflow: hidden;
    touch-action: none;
}

body.sidebar-menu-open #app {
    margin-left: var(--sidebar-w);
    width: calc(100% - var(--sidebar-w));
    max-width: calc(100vw - var(--sidebar-w));
}

body.sidebar-menu-open.sidebar-icons-mode #app {
    margin-left: var(--sidebar-w-icons);
    width: calc(100% - var(--sidebar-w-icons));
    max-width: calc(100vw - var(--sidebar-w-icons));
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100%;
    background: #1a1a2e;
    color: #eef2f7;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 1.5rem 0 2rem;
    -webkit-overflow-scrolling: touch;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0 1.2rem 1.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.sidebar-brand strong {
    display: block;
    font-size: 0.95rem;
    color: #eef2f7;
}

.sidebar-brand small {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
}

.close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: #d0d8e6;
    font-size: 1.4rem;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sidebar.open .close-btn {
    display: flex;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

.close-btn:focus-visible {
    outline: 2px solid #7a9ed4;
    outline-offset: 2px;
}

@media (max-width: 1023px) {
    .sidebar:not(.open) {
        transform: translateX(-100%) !important;
    }

    body.sidebar-menu-open #app {
        margin-left: 0;
    }
}

.nav-list {
    list-style: none;
    padding: 1.2rem 0.8rem 0;
    flex: 1;
}

.nav-list li {
    margin-bottom: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    color: #c8d0e0;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 450;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.nav-item i {
    width: 20px;
    font-size: 1.1rem;
    color: #7a8aa8;
    transition: color 0.2s;
    flex-shrink: 0;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: white;
    border-color: rgba(255, 255, 255, 0.04);
}

.nav-item:hover i {
    color: #b6c8e8;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.08);
}

.nav-item.active i {
    color: #b6c8e8;
}

.nav-item:focus-visible {
    outline: 2px solid #7a9ed4;
    outline-offset: 2px;
}

.user-section {
    margin-top: auto;
    padding: 1.2rem 1.2rem 0.2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.4rem 0.2rem;
}

.user-info .avatar {
    background: #2d4b8c;
    width: 38px;
    height: 38px;
    border-radius: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.user-info .avatar-img,
.user-info img.avatar {
    width: 38px;
    height: 38px;
    border-radius: 40px;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.15);
}

.user-info .details {
    line-height: 1.3;
    min-width: 0;
}

.user-info .name {
    font-weight: 500;
    color: #eef2f7;
    font-size: 0.95rem;
}

.user-info .role {
    font-size: 0.78rem;
    color: #94a3b8;
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 0.7rem 1rem;
    margin-top: 0.3rem;
    border-radius: 10px;
    color: #d0d8e6;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.logout-link i {
    width: 20px;
    color: #a0aec0;
}

.logout-link:hover {
    background: rgba(255, 70, 70, 0.08);
    color: #f2b0b0;
}

.logout-link:hover i {
    color: #f2b0b0;
}

.main-content {
    flex: 1;
    min-width: 0;
    width: 100%;
}

.topbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: clamp(0.5rem, 2vw, 1rem);
    padding: clamp(0.65rem, 1.5vw, 1rem) var(--content-pad);
    min-height: var(--topbar-h);
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border-bottom: 1px solid #e9edf4;
    position: sticky;
    top: 0;
    z-index: 20;
}

.hamburger {
    background: transparent;
    border: none;
    font-size: 1.7rem;
    color: #1a1a2e;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: var(--touch-min);
    min-height: var(--touch-min);
    flex-shrink: 0;
}

.hamburger:hover {
    background: #eef2f7;
}

.hamburger:focus-visible {
    outline: 2px solid #2d4b8c;
    outline-offset: 2px;
}

.topbar-title {
    font-size: var(--font-h1);
    font-weight: 600;
    color: #1a1a2e;
    letter-spacing: -0.01em;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: clamp(0.35rem, 1vw, 0.5rem);
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
}

.topbar-actions .gap-1 {
    justify-content: flex-end;
}

.topbar-actions .btn {
    flex-shrink: 0;
}

.topbar-title span:first-child {
    color: #3a5f9e;
    font-weight: 700;
}

.content-area {
    padding: var(--content-pad);
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* Cards & Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}
.stat-card h3 { font-size: var(--font-stat); color: var(--primary); }
.stat-card p { color: var(--text-muted); font-size: clamp(0.82rem, 0.78rem + 0.2vw, 0.9rem); }
.stat-card--overload { border-left-color: #d97706; }
.stat-card--overload h3 { color: #d97706; }
.stat-card--underload { border-left-color: #dc2626; }
.stat-card--underload h3 { color: #dc2626; }

.dashboard-report-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.dashboard-report-section-title {
    font-size: 1rem;
    margin: 1.25rem 0 .75rem;
    padding-top: .5rem;
    border-top: 1px solid var(--border, #e5e7eb);
}
.dashboard-report-section-title:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}
.dashboard-report-table th.num,
.dashboard-report-table td.num { text-align: right; }
.dashboard-load-badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 4px;
    font-size: .75rem;
    font-weight: 600;
    text-transform: capitalize;
}
.dashboard-load-badge--overload { background: #fef3c7; color: #92400e; }
.dashboard-load-badge--underload { background: #fee2e2; color: #991b1b; }
.dashboard-load-badge--normal { background: #d1fae5; color: #065f46; }

.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.card-header {
    padding: clamp(0.75rem, 2vw, 1rem) clamp(1rem, 2.5vw, 1.25rem);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
    background: #f8fafc;
}
.card-header h3 { font-size: var(--font-h3); color: var(--primary); }
.card-body { padding: clamp(1rem, 2.5vw, 1.25rem); }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: var(--font-label);
    font-weight: 600;
    margin-bottom: .35rem;
    color: var(--text);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 500;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: .6rem .75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .9rem;
    font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(11,61,110,.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .75rem;
}

.form-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 1rem; }
.form-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 1rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: clamp(0.5rem, 1.5vw, 0.6rem) clamp(0.85rem, 2vw, 1.1rem);
    border: none;
    border-radius: 6px;
    font-size: clamp(0.82rem, 0.78rem + 0.2vw, 0.9rem);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, opacity .15s;
    max-width: 100%;
    white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--error); color: #fff; }
.btn-ghost { background: transparent; color: inherit; border: 1px solid var(--border); }
.btn-sm {
    padding: clamp(0.3rem, 1vw, 0.35rem) clamp(0.55rem, 1.5vw, 0.7rem);
    font-size: clamp(0.75rem, 0.72rem + 0.15vw, 0.8rem);
    min-height: 36px;
}
.btn-block { width: 100%; }
.btn-icon {
    background: none; border: none; font-size: 1.25rem;
    cursor: pointer; padding: .25rem; color: inherit;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    width: 100%;
    min-width: 0;
    overscroll-behavior-x: contain;
}

.table-wrap thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: 0 1px 0 var(--border);
}

.table-wrap > table {
    width: 100%;
    min-width: max-content;
    table-layout: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--table-font-size);
}

th, td {
    padding: var(--table-cell-pad-y) var(--table-cell-pad-x);
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    white-space: normal;
    line-height: 1.35;
}

tr:hover td { background: #fafbfc; }

/* Badges */
.badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    text-transform: capitalize;
}
.badge-draft { background: #e2e8f0; color: #475569; }
.badge-submitted { background: #dbeafe; color: #1d4ed8; }
.badge-dept_approved, .badge-dean_approved, .badge-vp_ride_approved,
.badge-director_bao_approved, .badge-vp_sas_approved, .badge-vpaa_approved { background: #fef3c7; color: #92400e; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-returned { background: #fee2e2; color: #991b1b; }

/* Signatory status monitoring (dashboard) */
.signatory-monitor-card {
    margin-top: 1.25rem;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.signatory-monitor-card-header {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1rem 1.5rem;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
    border-bottom: 1px solid var(--border);
}
.signatory-monitor-card-header h3 {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: 1.05rem;
}
.signatory-monitor-card-header h3::before {
    content: '';
    width: 4px;
    height: 1.1rem;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--accent), #e8c547);
}
.signatory-monitor-card-desc {
    margin-top: .25rem;
    font-size: .82rem;
    color: var(--text-muted);
    max-width: 36rem;
}
.signatory-monitor-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem 1rem;
    margin-left: auto;
}
.signatory-legend-item {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-muted);
}
.signatory-legend-item i {
    width: .65rem;
    height: .65rem;
    border-radius: 50%;
    display: inline-block;
}
.signatory-legend-item--signed i { background: var(--success); box-shadow: 0 0 0 3px #d1fae5; }
.signatory-legend-item--pending i { background: #cbd5e1; box-shadow: 0 0 0 3px #f1f5f9; }

.signatory-monitor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem 1rem;
    margin-bottom: 1.25rem;
}
.signatory-monitor-semester {
    flex: 0 1 14rem;
    min-width: 12rem;
}
.signatory-monitor-search {
    flex: 1 1 16rem;
    max-width: 32rem;
}
.signatory-monitor-toolbar .form-group {
    margin-bottom: 0;
}
.signatory-monitor-count {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}
.signatory-monitor-empty {
    margin: 0;
    padding: 1.5rem 0;
    text-align: center;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.signatory-monitor-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.25rem !important;
}

.signatory-monitor-item {
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    background: var(--surface);
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.signatory-monitor-header {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "title progress"
        "title action";
    gap: .75rem 1.25rem;
    padding: 1rem 1.15rem;
    background: linear-gradient(135deg, #f0f4f8 0%, #fafbfc 100%);
    border-bottom: 1px solid var(--border);
}

.signatory-monitor-title-block { grid-area: title; min-width: 0; }
.signatory-monitor-title-block h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--primary);
    line-height: 1.3;
}
.signatory-monitor-subtitle {
    margin: .15rem 0 .45rem;
    font-size: .85rem;
    color: var(--text-muted);
}
.signatory-monitor-meta { display: flex; flex-wrap: wrap; gap: .35rem; }

.signatory-monitor-progress-block {
    grid-area: progress;
    min-width: 10rem;
    max-width: 14rem;
}
.signatory-monitor-progress-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .5rem;
    margin-bottom: .35rem;
    font-size: .75rem;
    color: var(--text-muted);
}
.signatory-monitor-progress-label strong {
    font-size: .95rem;
    color: var(--primary);
}
.signatory-monitor-progress {
    height: .45rem;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}
.signatory-monitor-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary-light), var(--success));
    transition: width .35s ease;
}

.signatory-monitor-view {
    grid-area: action;
    align-self: start;
    white-space: nowrap;
}

.signatory-timeline {
    padding: .75rem 1rem .85rem;
    overflow-x: auto;
}

.signatory-timeline-group { margin-bottom: .25rem; }
.signatory-timeline-group--compact {
    display: flex;
    align-items: stretch;
    gap: .6rem;
    margin-bottom: .45rem;
}
.signatory-timeline-group--compact:last-child { margin-bottom: 0; }
.signatory-timeline-track {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
}
.signatory-timeline-group-title {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--primary);
    margin: 0 0 .65rem;
    padding-bottom: .35rem;
    border-bottom: 1px dashed #cbd5e1;
}
.signatory-timeline-group--compact .signatory-timeline-group-title {
    flex: 0 0 4.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: .35rem .2rem;
    border-bottom: none;
    border-right: 1px dashed #cbd5e1;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-align: center;
    line-height: 1.25;
    white-space: nowrap;
}
.signatory-timeline-group--compact .signatory-timeline-row {
    align-items: center;
    min-height: 100%;
}
.signatory-timeline-group--compact .signatory-step {
    flex: 1 1 7.25rem;
    min-width: 7.25rem;
    max-width: 9rem;
    gap: .35rem;
}
.signatory-timeline-group--compact .signatory-step-marker {
    width: 1.5rem;
    height: 1.5rem;
}
.signatory-timeline-group--compact .signatory-step-dot {
    width: 1.35rem;
    height: 1.35rem;
}
.signatory-timeline-group--compact .signatory-step-card {
    min-height: 0;
    padding: .5rem .55rem;
}
.signatory-timeline-group--compact .signatory-timeline-row .signatory-step:only-child {
    flex: 0 1 11rem;
    max-width: 13rem;
}

.signatory-timeline-row {
    display: flex;
    align-items: stretch;
    gap: 0;
    min-width: min-content;
}
.signatory-timeline-row--single {
    justify-content: center;
    max-width: 18rem;
    margin: 0 auto;
}

.signatory-timeline-connector {
    flex: 0 0 1.25rem;
    align-self: center;
    height: 2px;
    margin: 0 -.15rem;
    background: linear-gradient(90deg, #cbd5e1, #94a3b8);
    position: relative;
    top: -.85rem;
}
.signatory-step--signed + .signatory-timeline-connector,
.signatory-timeline-row:has(.signatory-step--signed) .signatory-timeline-connector {
    background: linear-gradient(90deg, #86efac, #22c55e);
}

.signatory-timeline-bridge {
    width: 2px;
    height: .85rem;
    margin: .15rem auto;
    background: #cbd5e1;
}
.signatory-timeline-bridge--section {
    height: 1rem;
    margin: .5rem auto;
}

.signatory-step {
    flex: 1 1 9.5rem;
    min-width: 9.5rem;
    max-width: 11.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .45rem;
}

.signatory-step-marker {
    position: relative;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.signatory-step-num {
    position: relative;
    z-index: 1;
    font-size: .62rem;
    font-weight: 700;
    color: #64748b;
    line-height: 1;
}
.signatory-step--signed .signatory-step-num { display: none; }

.signatory-step-dot {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    background: #fff;
    transition: border-color .2s, background .2s, box-shadow .2s;
}
.signatory-step--signed .signatory-step-dot {
    border-color: var(--success);
    background: var(--success);
    box-shadow: 0 0 0 4px #ecfdf5;
}
.signatory-step--signed .signatory-step-dot::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
}
.signatory-step--pending .signatory-step-dot {
    background: #f8fafc;
}

.signatory-step-card {
    width: 100%;
    padding: .65rem .7rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    min-height: 5.5rem;
    display: flex;
    flex-direction: column;
    gap: .3rem;
    transition: border-color .2s, box-shadow .2s;
}
.signatory-step--signed .signatory-step-card {
    border-color: #bbf7d0;
    background: linear-gradient(180deg, #f0fdf4 0%, #fff 100%);
}
.signatory-step--pending .signatory-step-card {
    border-style: dashed;
    background: #fafbfc;
}
.signatory-step:hover .signatory-step-card {
    box-shadow: 0 4px 12px rgba(11, 61, 110, .08);
}

.signatory-step-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .35rem;
}
.signatory-step-role {
    font-size: .68rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
}
.signatory-step-badge {
    flex-shrink: 0;
    padding: .1rem .35rem;
    border-radius: 999px;
    font-size: .58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.signatory-step-badge--signed {
    background: #d1fae5;
    color: #065f46;
}
.signatory-step-badge--pending {
    background: #f1f5f9;
    color: #64748b;
}

.signatory-step-name {
    font-size: .78rem;
    font-weight: 600;
    color: #065f46;
    line-height: 1.25;
    word-break: break-word;
    margin: 0;
}
.signatory-step-pending {
    font-size: .72rem;
    font-style: italic;
    color: var(--text-muted);
    margin: .15rem 0 0;
}
.signatory-step-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem .4rem;
    margin-top: auto;
    padding-top: .2rem;
}
.signatory-step-chip {
    display: inline-block;
    padding: .1rem .35rem;
    border-radius: 4px;
    font-size: .62rem;
    font-weight: 600;
    background: #e0f2fe;
    color: #0369a1;
}
.signatory-step-date {
    font-size: .62rem;
    color: var(--text-muted);
    align-self: center;
}

@media (max-width: 768px) {
    .signatory-monitor-header {
        grid-template-columns: 1fr;
        grid-template-areas:
            "title"
            "progress"
            "action";
    }
    .signatory-monitor-progress-block { max-width: none; }
    .signatory-monitor-view { width: 100%; }
    .signatory-timeline-group--compact {
        flex-direction: column;
        align-items: stretch;
    }
    .signatory-timeline-group--compact .signatory-timeline-group-title {
        flex: none;
        width: auto;
        writing-mode: horizontal-tb;
        transform: none;
        border-right: none;
        border-bottom: 1px dashed #cbd5e1;
        padding: 0 0 .35rem;
        margin-bottom: .35rem;
        justify-content: flex-start;
    }
    .signatory-timeline-group--compact .signatory-timeline-row {
        flex-wrap: nowrap;
        min-width: min-content;
    }
    .signatory-timeline-connector {
        flex: 0 0 1rem;
        width: auto;
        height: 2px;
        margin: 0 -.1rem;
        top: -.65rem;
    }
    .signatory-step {
        flex: 0 0 8rem;
        min-width: 8rem;
        max-width: 8.5rem;
    }
    .signatory-monitor-legend { margin-left: 0; }
}

/* Workload form sections */
.section-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    padding: .75rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}
.section-tab {
    padding: .5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    cursor: pointer;
    font-size: .85rem;
    white-space: nowrap;
}
.section-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.unit-settings-table .unit-select-col {
    width: 2.5rem;
    text-align: center;
}
.unit-settings-table .action-col {
    white-space: nowrap;
}

.users-table .select-col {
    width: 2.5rem;
    text-align: center;
}
.users-table .action-col {
    white-space: nowrap;
}

.workloads-table .select-col {
    width: 2.5rem;
    text-align: center;
}
.workloads-table .action-col {
    white-space: nowrap;
}

.workload-section { display: none; }
.workload-section.active { display: block; }

.form-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: .75rem;
    color: var(--text);
}

.teaching-table-wrap {
    border: 1px solid #111;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    width: 100%;
    min-width: 0;
    overscroll-behavior-x: contain;
}

.teaching-table-wrap thead th {
    position: static;
    box-shadow: none;
}

.teaching-form-scroll-hint {
    margin: 0 0 0.5rem;
    font-size: 0.82rem;
    font-style: italic;
    color: var(--text-muted);
}

.teaching-form-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    line-height: 1.35;
    table-layout: auto;
    background: #fff;
    color: #111;
}

.teaching-form-table th,
.teaching-form-table td {
    padding: 0.45rem 0.4rem;
    vertical-align: top;
    border: 1px solid #111;
    background: #fff;
    color: #111;
    height: auto;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    line-height: 1.35;
    hyphens: auto;
}

.teaching-form-table thead th {
    background: #fff;
    color: #111;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 600;
    font-size: 0.78rem;
    text-align: center;
    vertical-align: middle;
    white-space: normal;
    padding: 0.5rem 0.4rem;
    line-height: 1.3;
}

.teaching-form-table thead th.col-group {
    background: #fff;
    font-size: 0.8rem;
}

.teaching-form-table thead th.col-ojt {
    white-space: normal;
    min-width: 5.5rem;
    font-size: 0.72rem;
    line-height: 1.25;
}

.teaching-form-table tbody tr:nth-child(even) td { background: #fff; }
.teaching-form-table tbody tr:hover td { background: #fff; }
.teaching-table-wrap > table {
    width: max-content;
    min-width: 100%;
}

/* Column sizing — rem mins like RIDE; JS may refine, table scrolls horizontally */
.teaching-form-table .col-course {
    text-align: left;
    min-width: 11rem;
    max-width: none;
    white-space: normal;
}

.teaching-form-table .col-docs {
    text-align: left;
    min-width: 10rem;
    max-width: none;
    white-space: normal;
}

.teaching-form-table .col-narrow {
    text-align: center;
    min-width: 3rem;
    max-width: none;
    white-space: nowrap;
}

.teaching-form-table .col-ch {
    text-align: center;
    min-width: 3rem;
    max-width: none;
    white-space: nowrap;
}

.teaching-form-table .col-days,
.teaching-form-table .col-room {
    text-align: center;
    min-width: 4.5rem;
    max-width: none;
    white-space: normal;
}

.teaching-form-table .col-student,
.teaching-form-table .col-total {
    text-align: center;
    min-width: 3.25rem;
    max-width: none;
    white-space: nowrap;
}

.teaching-form-table .col-wh {
    text-align: center;
    min-width: 5rem;
    max-width: none;
    white-space: normal;
}

.teaching-form-table .col-time {
    text-align: center;
    min-width: 7rem;
    max-width: none;
    white-space: nowrap;
    overflow: visible;
}

.teaching-form-table .col-total {
    background: #fff;
    font-weight: 600;
}

.teaching-form-table .col-wh {
    background: #fff;
    font-weight: 600;
}

.teaching-form-table .cell-input {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    margin: 0;
    padding: 0.2rem 0.15rem;
    font-size: inherit;
    font-family: inherit;
    color: #111;
    line-height: 1.35;
}

.teaching-form-table .col-course .cell-input,
.teaching-form-table .col-docs .cell-input {
    width: 100%;
    text-align: left;
}

.teaching-form-table .col-narrow .cell-input,
.teaching-form-table .col-ch .cell-input,
.teaching-form-table .col-student .cell-input,
.teaching-form-table .col-total .cell-input,
.teaching-form-table .col-room .cell-input,
.teaching-form-table .col-time .cell-input,
.teaching-form-table .col-days .cell-input,
.teaching-form-table .col-wh .cell-input { text-align: center; }

.teaching-form-table .cell-input:hover { border: 0; background: transparent; }
.teaching-form-table .cell-input:focus {
    outline: 1px solid #111;
    outline-offset: -1px;
    border: 0;
    background: #fff;
    box-shadow: none;
}

.teaching-form-table .cell-input:disabled {
    color: #111;
    background: transparent;
    border: 0;
    font-weight: 600;
}

.teaching-form-table .cell-input::placeholder { color: #94a3b8; }

.teaching-form-table input[type="time"].cell-input {
    width: auto;
    min-width: clamp(5.5rem, 18vw, 7rem);
    max-width: 100%;
    font-size: clamp(0.72rem, 0.68rem + 0.2vw, 0.82rem);
    padding: clamp(0.2rem, 0.15rem + 0.1vw, 0.3rem) clamp(0.25rem, 0.2rem + 0.1vw, 0.35rem);
    box-sizing: border-box;
}

.teaching-form-table .teaching-footer td {
    background: #fff;
    border: 1px solid #111;
    padding: .75rem .5rem;
}

.teaching-form-table .consultation-cell {
    display: flex;
    align-items: center;
    gap: .6rem;
    text-align: left;
}

.teaching-form-table .consultation-cell label {
    font-weight: 600;
    font-size: .82rem;
    white-space: nowrap;
    color: var(--text);
}

.teaching-form-table .consultation-cell input {
    flex: 1;
    border: 1px solid #111;
    border-radius: 0;
    padding: .4rem .6rem;
    font-size: inherit;
    min-width: 0;
    background: #fff;
}

.teaching-form-table .consultation-cell input:focus {
    outline: 1px solid #111;
    outline-offset: 0;
    border-color: #111;
    box-shadow: none;
}

.teaching-form-table .consultation-cell--empty {
    padding: .75rem .5rem;
}

.teaching-form-table .subtotal-label {
    text-align: right !important;
    font-weight: 600;
    font-size: .82rem;
    color: var(--text);
}

.teaching-form-table .subtotal-value {
    text-align: center !important;
    font-weight: 700;
    font-size: .9rem;
    color: #111;
    background: #fff !important;
}

.teaching-form-table .action-col {
    width: 2.25rem;
    padding: .25rem;
    text-align: center;
}

.teaching-form-table .action-col .remove-entry {
    position: static;
    opacity: .5;
    font-size: 1.1rem;
    line-height: 1;
}

.teaching-form-table .action-col .remove-entry:hover { opacity: 1; color: var(--error); }

.teaching-form-table tbody tr:last-child td { border-bottom: 1px solid #111; }

.teaching-form-table .teaching-empty-row {
    text-align: center;
    padding: 1rem;
}

/* Hide number input spinners for cleaner look */
.teaching-form-table input[type="number"].cell-input {
    -moz-appearance: textfield;
    appearance: textfield;
}
.teaching-form-table input[type="number"].cell-input::-webkit-inner-spin-button,
.teaching-form-table input[type="number"].cell-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.research-form-table .col-nature,
.extension-form-table .col-nature,
.quasi-form-table .col-nature,
.admin-form-table .col-nature {
    text-align: left;
    min-width: 8rem;
    max-width: none;
    white-space: normal;
}

.research-form-table .col-category,
.extension-form-table .col-category,
.quasi-form-table .col-category,
.admin-form-table .col-category {
    text-align: left;
    min-width: 7rem;
    max-width: none;
    white-space: normal;
}

.quasi-form-table .col-level {
    text-align: center;
    min-width: 3.5rem;
    max-width: none;
    white-space: nowrap;
}

.research-form-table .col-particulars,
.extension-form-table .col-particulars,
.quasi-form-table .col-particulars,
.admin-form-table .col-particulars {
    text-align: left;
    min-width: 11rem;
    max-width: none;
    white-space: normal;
}

.research-form-table .col-days,
.extension-form-table .col-days,
.production-form-table .col-days,
.quasi-form-table .col-days,
.admin-form-table .col-days {
    text-align: center;
    min-width: 4.5rem;
    max-width: none;
    white-space: normal;
}

.research-form-table .col-time,
.extension-form-table .col-time,
.production-form-table .col-time,
.quasi-form-table .col-time,
.admin-form-table .col-time {
    min-width: 7rem;
    max-width: none;
}

.research-form-table .col-days-week,
.extension-form-table .col-days-week,
.production-form-table .col-days-week,
.quasi-form-table .col-days-week,
.admin-form-table .col-days-week {
    text-align: center;
    min-width: 4rem;
    max-width: none;
    white-space: nowrap;
}

.research-form-table .col-wh,
.extension-form-table .col-wh,
.production-form-table .col-wh,
.quasi-form-table .col-wh,
.admin-form-table .col-wh {
    min-width: 5rem;
    max-width: none;
    white-space: normal;
}

.research-form-table .col-docs,
.extension-form-table .col-docs,
.production-form-table .col-docs,
.quasi-form-table .col-docs,
.admin-form-table .col-docs {
    min-width: 10rem;
    max-width: none;
    white-space: normal;
}

.production-form-table .col-activity {
    text-align: left;
    min-width: 12rem;
    max-width: none;
    white-space: normal;
}

.research-form-table thead th.col-wrap,
.extension-form-table thead th.col-wrap,
.production-form-table thead th.col-wrap,
.quasi-form-table thead th.col-wrap,
.admin-form-table thead th.col-wrap {
    white-space: normal;
    font-size: clamp(0.68rem, 0.62rem + 0.25vw, 0.76rem);
    line-height: 1.3;
    min-width: clamp(3.5rem, 6%, 5rem);
}

.research-form-table .col-nature .cell-input,
.extension-form-table .col-nature .cell-input,
.quasi-form-table .col-nature .cell-input,
.admin-form-table .col-nature .cell-input,
.research-form-table .col-category .cell-input,
.extension-form-table .col-category .cell-input,
.quasi-form-table .col-category .cell-input,
.admin-form-table .col-category .cell-input,
.research-form-table .col-particulars .cell-input,
.extension-form-table .col-particulars .cell-input,
.quasi-form-table .col-particulars .cell-input,
.admin-form-table .col-particulars .cell-input,
.production-form-table .col-activity .cell-input {
    width: 100%;
    text-align: left;
}

.research-form-table select.cell-input,
.extension-form-table select.cell-input,
.quasi-form-table select.cell-input,
.admin-form-table select.cell-input {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: .2rem .15rem;
    font-size: inherit;
    font-family: inherit;
    color: #111;
    cursor: pointer;
}

.research-form-table select.cell-input:hover,
.extension-form-table select.cell-input:hover,
.quasi-form-table select.cell-input:hover,
.admin-form-table select.cell-input:hover {
    border: 0;
    background: transparent;
}

.research-form-table select.cell-input:focus,
.extension-form-table select.cell-input:focus,
.quasi-form-table select.cell-input:focus,
.admin-form-table select.cell-input:focus {
    outline: 1px solid #111;
    outline-offset: -1px;
    border: 0;
    background: #fff;
    box-shadow: none;
}

.official-time-wrap {
    margin: 0.75rem 0;
    text-align: center;
}

.official-time-wrap .form-section-title {
    text-align: center;
}

.official-time-wrap .official-time-table-wrap {
    display: inline-block;
    width: auto;
    max-width: 100%;
    text-align: left;
}

.official-time-form-table {
    width: auto;
    min-width: 0;
    max-width: 100%;
    table-layout: fixed;
}

.official-time-form-table .col-label {
    text-align: left;
    white-space: nowrap;
    font-size: .82rem;
    font-variant-numeric: tabular-nums;
}

.official-time-form-table .col-day {
    text-align: center;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.official-time-form-table input[type="time"].cell-input {
    width: 100%;
    text-align: center;
    font-size: .8rem;
    padding: .3rem .2rem;
}

.official-time-form-table tbody tr:nth-child(even) td { background: #fafbfc; }
.official-time-form-table tbody tr:hover td { background: #f0f7ff; }

/* Approval / signature block */
.signature-block-card { margin-top: 1rem; }
.signature-block { max-width: 52rem; margin: 0 auto; font-size: .88rem; }
.signature-section-title {
    font-weight: 700;
    margin: 0 0 1rem;
    font-size: .95rem;
}
.signature-grid { display: flex; flex-direction: column; gap: 1.75rem; margin-bottom: 1.75rem; }
.signature-grid-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem 3rem;
}
.signature-slot { min-width: 0; text-align: center; display: flex; flex-direction: column; align-items: center; }
.signature-slot--center {
    max-width: 22rem;
    margin: 0 auto 1.75rem;
    text-align: center;
}
.signature-proxy {
    font-size: .72rem;
    color: var(--text-muted);
    margin: 0 0 .35rem;
    line-height: 1.3;
}
.signature-method-options { margin-bottom: .35rem; }
.signature-method {
    font-size: .72rem;
    color: var(--text-muted);
    margin: 0 0 .15rem;
    line-height: 1.3;
}
.signature-method--selected {
    font-weight: 600;
    color: var(--text);
}
.signature-method-field .signature-method-choices {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-top: .35rem;
}
.signature-method-choice {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    font-size: .88rem;
    line-height: 1.35;
    cursor: pointer;
}
.signature-method-choice input { margin-top: .2rem; flex-shrink: 0; }
.signature-name {
    margin: 0 0 .25rem;
    min-height: 1.2rem;
    font-size: .88rem;
    text-align: center;
    max-width: 14rem;
}
.signature-name--signed {
    font-weight: 600;
    color: var(--text);
}
.signature-line {
    border-bottom: 1px solid #000;
    margin: .15rem auto .45rem;
    width: 11rem;
    max-width: 85%;
    min-height: 1px;
}
.signature-role {
    margin: 0;
    font-size: .84rem;
    line-height: 1.35;
    text-align: center;
    max-width: 14rem;
    margin-left: auto;
    margin-right: auto;
}
.signature-divider {
    border: none;
    border-top: 1px dashed var(--border);
    margin: .5rem 0 1.25rem;
}

@media (max-width: 768px) {
    .signature-grid-row { grid-template-columns: 1fr; gap: 1.5rem; }
    .signature-slot--center { max-width: none; }
}

@media print {
    .signature-block-card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
    .signature-line { border-bottom-color: #000; }
}

.research-form-table .col-days-week .cell-input,
.extension-form-table .col-days-week .cell-input,
.production-form-table .col-days-week .cell-input,
.quasi-form-table .col-days-week .cell-input,
.admin-form-table .col-days-week .cell-input,
.quasi-form-table .col-level .cell-input {
    text-align: center;
}

.entry-block {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
    position: relative;
}
.entry-block .remove-entry {
    position: absolute;
    top: .5rem;
    right: .5rem;
}

.summary-panel {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
    margin-top: .75rem;
}
.summary-item { text-align: center; }
.summary-item .value { font-size: 1.5rem; font-weight: 700; }
.summary-item .label { font-size: .75rem; opacity: .85; }
.summary-total { border-top: 1px solid rgba(255,255,255,.2); margin-top: 1rem; padding-top: 1rem; text-align: center; }
.summary-total .value { font-size: 2rem; }
.summary-total.underload .value,
.summary-total .value.underload-text { color: #ff6b6b; }
.summary-total.overload .value,
.summary-total .value.overload-text { color: #fbbf24; }
.underload-text { color: #dc2626; font-weight: 700; }
.overload-text { color: #d97706; font-weight: 700; }
.underload-warning-body,
.overload-warning-body { margin-bottom: .75rem; }

.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .75rem;
    margin-bottom: 1rem;
}
.profile-item label { font-size: .75rem; color: var(--text-muted); display: block; }
.profile-item span { font-weight: 600; }

.profile-page {
    display: grid;
    gap: 1rem;
    max-width: 900px;
}

.profile-card .card-body.profile-picture-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
}

.profile-avatar-wrap {
    flex-shrink: 0;
}

.profile-avatar-img,
.profile-avatar-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-avatar-placeholder {
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
}

.profile-avatar-img {
    border: 3px solid var(--border);
}

.profile-picture-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.profile-upload-btn {
    cursor: pointer;
    margin: 0;
}

.profile-picture-hint {
    font-size: 0.8rem;
    margin: 0;
}

.profile-form-actions {
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.computed-value {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    padding: .5rem .75rem;
    font-weight: 600;
    color: var(--primary);
}

.alert {
    padding: .75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: .9rem;
}
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-info { background: #dbeafe; color: #1e40af; }
.alert-warning { background: #fef3c7; color: #92400e; }

.text-muted { color: var(--text-muted); }
code {
    font-family: Consolas, 'Courier New', monospace;
    font-size: .9em;
    background: #f1f5f9;
    padding: .15rem .4rem;
    border-radius: 4px;
}
.credentials-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: .75rem;
}
.credentials-box code { font-size: 1rem; }
.text-right { text-align: right; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.gap-1 { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.action-col.gap-1 {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.loading { text-align: center; padding: 3rem; color: var(--text-muted); }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: clamp(0.5rem, 3vw, 1rem);
}
.modal {
    background: var(--surface);
    border-radius: 12px;
    width: 100%;
    max-width: min(500px, calc(100vw - 1.5rem));
    max-height: min(90vh, 90dvh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-header {
    padding: clamp(0.75rem, 2vw, 1rem) clamp(1rem, 2.5vw, 1.25rem);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 0.75rem;
}
.modal-header h3 {
    font-size: var(--font-h3);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.modal-body {
    padding: clamp(1rem, 2.5vw, 1.25rem);
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}
.modal-footer {
    padding: clamp(0.75rem, 2vw, 1rem) clamp(1rem, 2.5vw, 1.25rem);
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: clamp(0.35rem, 1vw, 0.5rem);
    flex-shrink: 0;
}

.modal--doc-viewer {
    max-width: min(960px, calc(100vw - 1.5rem));
    width: 100%;
}

.modal--doc-viewer .modal-body {
    padding: 0;
    overflow: hidden;
}

/* Logout confirmation dialog */
.logout-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    padding: clamp(0.75rem, 3vw, 1.25rem);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.logout-confirm-overlay.is-visible {
    opacity: 1;
}

.logout-confirm-overlay.is-closing {
    opacity: 0;
}

.logout-confirm-dialog {
    background: var(--surface);
    border-radius: 14px;
    width: 100%;
    max-width: min(420px, calc(100vw - 1.5rem));
    padding: clamp(1.25rem, 3vw, 1.75rem);
    text-align: center;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
    transform: scale(0.92);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.logout-confirm-overlay.is-visible .logout-confirm-dialog {
    transform: scale(1);
    opacity: 1;
}

.logout-confirm-overlay.is-closing .logout-confirm-dialog {
    transform: scale(0.92);
    opacity: 0;
}

.logout-confirm-icon {
    width: 3.5rem;
    height: 3.5rem;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(220, 38, 38, 0.12);
    color: var(--error);
    font-size: 1.35rem;
}

.logout-confirm-title {
    font-size: var(--font-h2);
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.logout-confirm-message {
    color: var(--text-muted);
    font-size: var(--font-body);
    line-height: 1.55;
    margin-bottom: 1.5rem;
}

.logout-confirm-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.65rem;
}

.logout-confirm-actions .btn {
    min-width: 7.5rem;
    min-height: var(--touch-min);
    justify-content: center;
}

.logout-confirm-logout {
    position: relative;
    min-width: 8.5rem;
}

.logout-confirm-logout-text.hidden {
    visibility: hidden;
}

.logout-confirm-spinner {
    display: none;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: logout-confirm-spin 0.7s linear infinite;
    position: absolute;
    left: 50%;
    top: 50%;
    margin: -0.5rem 0 0 -0.5rem;
}

.logout-confirm-spinner:not(.hidden) {
    display: block;
}

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

@media (max-width: 480px) {
    .logout-confirm-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .logout-confirm-actions .btn {
        width: 100%;
        min-width: 0;
    }
}

.doc-viewer {
    background: #1a1a1a;
    min-height: 70vh;
    max-height: calc(90vh - 8rem);
    display: flex;
    align-items: center;
    justify-content: center;
}

.doc-viewer--pdf iframe {
    width: 100%;
    height: 70vh;
    min-height: 480px;
    border: 0;
    background: #fff;
}

.doc-viewer--image img {
    max-width: 100%;
    max-height: calc(90vh - 8rem);
    object-fit: contain;
}

.doc-viewer--fallback {
    background: var(--surface);
    min-height: auto;
    padding: 2rem 1.5rem;
    text-align: center;
}

@media (min-width: 1024px) {
    .sidebar:not(.open) {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .overlay {
        display: none !important;
    }

    body.no-scroll {
        overflow: auto;
        touch-action: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .overlay {
        transition: none;
    }
}

@media (max-width: 768px) {
    .topbar {
        gap: 0.65rem;
    }
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .card-body { padding: var(--content-pad); }
    .section-tabs { padding: 0.5rem var(--content-pad); }
    .teaching-form-table .consultation-cell {
        flex-direction: column;
        align-items: stretch;
        gap: 0.4rem;
    }
    .teaching-form-table .consultation-cell label { white-space: normal; }
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: clamp(0.85rem, 2.5vw, 0.95rem);
        padding: clamp(0.5rem, 1.5vw, 0.65rem) clamp(0.6rem, 2vw, 0.75rem);
    }
}

@media (max-width: 480px) {
    :root {
        --sidebar-w: 260px;
        --table-font-size: 0.78rem;
        --table-head-font-size: 0.72rem;
    }
    .stats-grid { grid-template-columns: 1fr; }
    .summary-grid { grid-template-columns: repeat(2, 1fr); }
}

@media print {
    .sidebar, .topbar, .section-tabs, .btn, .modal-overlay { display: none !important; }
    #app { margin-left: 0; }
    .teaching-table-wrap { box-shadow: none; border: 1px solid #000; }
    .teaching-form-table th,
    .teaching-form-table td { border-color: #000; }
}

.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    margin-left: auto;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
}

.messages-list { display: flex; flex-direction: column; gap: 0.75rem; }

.message-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 1rem;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.message-item:hover { border-color: var(--primary-light); box-shadow: var(--shadow); }
.message-item.unread { border-left: 4px solid var(--warning); background: #fffbeb; }

.message-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-bottom: 0.35rem;
}

.message-item-header h4 { font-size: clamp(0.88rem, 0.84rem + 0.2vw, 0.95rem); color: var(--primary); }
.message-item-meta { font-size: clamp(0.75rem, 0.72rem + 0.15vw, 0.8rem); color: var(--text-muted); }
.message-item-body { font-size: clamp(0.82rem, 0.78rem + 0.2vw, 0.875rem); white-space: pre-wrap; color: var(--text); word-break: break-word; }

.message-reply-divider {
    margin: 1rem 0;
    border: none;
    border-top: 1px solid var(--border);
}

.message-reply-form { margin-bottom: 0; }
.message-reply-form textarea { resize: vertical; min-height: 4.5rem; }

.return-notice {
    border-left: 4px solid var(--warning);
    background: #fffbeb;
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.return-notice h4 { color: var(--warning); margin-bottom: 0.35rem; }
.return-notice p { white-space: pre-wrap; margin: 0; }

/* Dedicated print page (print.php) */
body.print-page {
    margin: 0;
    padding: 0;
    background: #fff;
}

body.print-page .faculty-workload-form { display: block !important; }

#fw-print-shell {
    width: 100%;
    max-width: 100%;
}

body.print-page .signature-method-options { display: none !important; }

body.print-page .signature-block-card,
body.print-page .signature-block-card .card-body {
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
}

/* Hide browser-extension overlays injected outside our print shell */
@media print {
    body.print-page > *:not(#fw-print-shell) {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        overflow: hidden !important;
    }

    body.print-page iframe,
    body.print-page [class*="qr" i],
    body.print-page [id*="qr" i],
    body.print-page [class*="extension" i]:not(.fw-print-table *) {
        display: none !important;
    }
}

/* ── E-Faculty Workload Official Print Form ── */
.print-only { display: none; }

.faculty-workload-form {
    font-family: Arial, Helvetica, sans-serif;
    color: #000;
    font-size: 9pt;
    line-height: 1.3;
}

.fw-letterhead-top {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    align-items: center;
    gap: 0.75rem;
}

.fw-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    background: transparent;
}

.fw-republic { margin: 0; font-size: 9pt; }
.fw-university { margin: 0.1rem 0 0; font-size: 13pt; font-weight: 700; }
.fw-tagline {
    margin: 0;
    font-size: 7pt;
    font-weight: 700;
    text-align: right;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    max-width: 11rem;
    line-height: 1.25;
}

.fw-rule {
    border: none;
    border-top: 1px solid #000;
    margin: 0.4rem 0 0.5rem;
}

.fw-office {
    text-align: center;
    margin: 0 0 0.25rem;
    font-size: 9pt;
    font-weight: 600;
}

.fw-title {
    text-align: center;
    margin: 0;
    font-size: 14pt;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.fw-semester {
    text-align: center;
    margin: 0.15rem 0 0.6rem;
    font-size: 10pt;
    font-weight: 600;
}

.fw-section-label {
    margin: 0 0 0.35rem;
    font-weight: 700;
    font-size: 9pt;
}

.fw-profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 2rem;
    margin-bottom: 0.5rem;
}

.fw-field {
    display: flex;
    gap: 0.35rem;
    align-items: baseline;
    margin-bottom: 0.2rem;
    font-size: 8.5pt;
}

.fw-field-label { white-space: nowrap; font-weight: 600; }
.fw-field-value {
    flex: 1;
    border-bottom: 1px solid #000;
    min-height: 1.1em;
    padding-bottom: 1px;
}

.fw-workload-label {
    margin: 0.35rem 0 0.15rem;
    font-weight: 700;
    font-size: 9pt;
}

.fw-footnote {
    margin: 0.35rem 0 0;
    font-size: 7.5pt;
    font-style: italic;
}

.fw-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.fw-print-section {
    margin-bottom: 0.35rem;
    break-inside: avoid;
    page-break-inside: avoid;
}

.fw-print-section .fw-table-wrap {
    margin-bottom: 0;
}

.fw-print-table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    font-size: 7.5pt;
}

.fw-print-table th,
.fw-print-table td {
    border: 1px solid #000;
    padding: 2px 3px;
    vertical-align: middle;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.fw-print-table .col-num {
    text-align: center;
    white-space: nowrap;
}

.fw-print-table thead th {
    background: #f0f0f0;
    font-weight: 700;
    text-align: center;
    font-size: 7pt;
    line-height: 1.2;
}

.fw-print-table .col-course,
.fw-print-table .col-particulars,
.fw-print-table .col-activity { text-align: left; }

.fw-print-table tfoot td { font-weight: 600; font-size: 7.5pt; }
.fw-print-table .fw-subtotal-label { text-align: right; }
.fw-print-table .fw-subtotal-value,
.fw-value-red { color: #c00; font-weight: 700; text-align: center; }
.fw-value-overload { color: #d97706; font-weight: 700; text-align: center; }
.fw-print-table .fw-empty-row td { height: 1.35rem; }

.fw-summary-block {
    margin: 0.75rem auto;
    max-width: 22rem;
    text-align: center;
}

.fw-summary-title {
    margin: 0 0 0.35rem;
    font-size: 10pt;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.fw-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
    margin: 0 auto;
}

.fw-summary-table th,
.fw-summary-table td {
    border: 1px solid #000;
    padding: 4px 8px;
}

.fw-summary-table th { background: #f0f0f0; font-weight: 700; }
.fw-summary-table td:last-child { text-align: center; width: 40%; }
.fw-summary-table .fw-total-row td { font-weight: 700; }

.fw-official-time-wrap {
    margin: 0.75rem 0;
    text-align: center;
}

.fw-official-time-wrap .fw-table-wrap {
    display: inline-block;
    width: auto;
    max-width: 100%;
    text-align: left;
}

.fw-official-time-wrap .official-time-form-table {
    width: auto;
    max-width: 100%;
    font-size: 8pt;
    border-collapse: collapse;
    table-layout: fixed;
}

.fw-official-time-wrap .official-time-form-table th,
.fw-official-time-wrap .official-time-form-table td {
    border: 1px solid #000;
    padding: 2px 4px;
}

.fw-official-time-wrap .official-time-form-table .col-label {
    text-align: left;
    white-space: nowrap;
}

.fw-official-time-wrap .official-time-form-table .col-day {
    text-align: center;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.fw-official-time-wrap .form-section-title {
    font-size: 9pt;
    font-weight: 700;
    margin-bottom: 0.25rem;
    text-align: center;
}

.fw-print-signatures {
    margin-top: 1rem;
    font-size: 8pt;
    break-inside: avoid;
    page-break-inside: avoid;
}

.fw-signature-block {
    width: 100%;
    max-width: 100%;
}

.fw-signature-faculty {
    width: 14rem;
    max-width: 42%;
    margin-left: auto;
    margin-bottom: 1.25rem;
    text-align: center;
}

.fw-sig-proxy {
    margin: 0 0 0.35rem;
    font-size: 6.5pt;
    color: #333;
    line-height: 1.25;
}

.fw-signature-heading {
    margin: 0 0 0.75rem;
    font-size: 9pt;
    font-weight: 700;
}

.fw-signature-recommending {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 3rem;
    align-items: stretch;
    margin-bottom: 1.25rem;
}

.fw-signature-col {
    display: grid;
    grid-template-rows: repeat(3, 1fr);
    gap: 0.85rem;
    align-items: end;
}

.fw-sig-slot {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    min-height: 3.25rem;
    text-align: center;
}

.fw-sig-slot--spacer {
    visibility: hidden;
    pointer-events: none;
}

.fw-sig-name {
    margin: 0 0 0.15rem;
    min-height: 1.1em;
    font-size: 8pt;
    font-weight: 600;
    line-height: 1.2;
    max-width: 3.25in;
}

.fw-sig-name--empty {
    font-weight: 400;
}

.fw-sig-line {
    border-bottom: 1px solid #000;
    margin: 0 auto;
    height: 0;
    width: 2.5in;
    max-width: 90%;
}

.fw-signature-faculty .fw-sig-line,
.fw-signature-center .fw-sig-line {
    width: 2.65in;
}

.fw-sig-role {
    margin: 0.2rem 0 0;
    font-size: 7pt;
    font-weight: 700;
    line-height: 1.25;
    max-width: 3.25in;
}

.fw-signature-center {
    width: 14rem;
    max-width: 45%;
    margin: 0 auto 1rem;
    text-align: center;
}

.fw-signature-center .fw-sig-slot {
    min-height: 3rem;
}

.fw-signature-divider {
    border: none;
    border-top: 1px dashed #000;
    margin: 0.75rem 0 1rem;
}

@media print {
    .fw-signature-recommending {
        gap: 1rem 2.5rem;
    }

    .fw-sig-slot {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

.workload-print-page-1 {
    break-after: page;
    page-break-after: always;
}

.workload-print-continued {
    width: 100%;
}

.workload-print-closing {
    margin-top: 0.5rem;
    break-inside: avoid-page;
    page-break-inside: avoid;
}

.fw-print-section .fw-workload-label {
    margin-top: 0;
}

@page { size: letter landscape; margin: 0.35in; }

@media print {
    .screen-only,
    .sidebar,
    .topbar,
    .section-tabs,
    .btn,
    .modal-overlay,
    .return-notice,
    .signature-method-options { display: none !important; }

    .print-only { display: block !important; }

    body { background: #fff !important; }
    #app { display: block !important; }
    .main-content {
        margin: 0 !important;
        width: 100% !important;
        max-width: none !important;
    }
    .content-area { padding: 0 !important; }

    .faculty-workload-form {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .fw-print-table thead th { background: #f0f0f0 !important; }
    .fw-value-red,
    .fw-print-table .fw-subtotal-value { color: #c00 !important; }
    .fw-value-overload { color: #d97706 !important; }

    .teaching-table-wrap,
    .fw-print-table { box-shadow: none !important; }
}

/* Supporting documents (multi-attachment) */
.supporting-docs {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.78rem;
    line-height: 1.35;
}

.supporting-docs--view {
    align-items: flex-start;
}

.supporting-doc-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
}

.supporting-doc-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    max-width: 100%;
}

.supporting-doc-link {
    color: var(--accent, #1a5fb4);
    text-decoration: none;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.supporting-doc-link:hover {
    text-decoration: underline;
}

.supporting-doc-remove {
    flex-shrink: 0;
    font-size: 1rem;
    line-height: 1;
    color: var(--danger, #c0392b);
}

.supporting-doc-upload {
    align-self: flex-start;
    margin-top: 0.15rem;
    cursor: pointer;
}

.supporting-doc-hint {
    font-size: 0.72rem;
}

.teaching-form-table .col-docs .supporting-docs--edit {
    min-width: 7rem;
}

.teaching-form-table .col-docs .supporting-doc-upload {
    padding: 0.15rem 0.4rem;
    font-size: 0.72rem;
}

/* ═══════════════════════════════════════════════════════════════
   Responsive System — breakpoints: 320, 375, 425, 576, 768,
   992, 1024, 1200, 1366, 1440, 1600, 1920, 2560
   ═══════════════════════════════════════════════════════════════ */

/* Sticky footer layout for auth pages */
.login-page {
    padding: clamp(0.75rem, 3vw, 1.5rem);
}

.login-card--wide {
    max-width: min(560px, calc(100vw - 2rem));
}

/* Stats grid equal-height cards */
.stats-grid {
    grid-auto-rows: 1fr;
}

.stat-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
    height: 100%;
}

/* App shell sticky footer */
#app {
    min-height: 100vh;
    min-height: 100dvh;
}

.main-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.content-area {
    flex: 1;
    width: 100%;
    max-width: var(--content-max);
}

/* Tablet: icon-only sidebar (768px–1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .sidebar.sidebar--icons {
        width: var(--sidebar-w-icons);
        transform: translateX(0);
        padding: 1rem 0 1.5rem;
        overflow-x: hidden;
    }

    .sidebar.sidebar--icons .sidebar-header {
        justify-content: center;
        padding: 0 0.5rem 1rem;
    }

    .sidebar.sidebar--icons .sidebar-brand {
        justify-content: center;
    }

    .sidebar.sidebar--icons .sidebar-brand > div:last-child {
        display: none;
    }

    .sidebar.sidebar--icons .close-btn {
        display: none !important;
    }

    .sidebar.sidebar--icons .nav-list {
        padding: 0.75rem 0.35rem 0;
    }

    .sidebar.sidebar--icons .nav-item {
        justify-content: center;
        padding: 0.75rem 0.5rem;
        font-size: 0;
        gap: 0;
    }

    .sidebar.sidebar--icons .nav-item i {
        font-size: 1.25rem;
        width: auto;
        margin: 0;
    }

    .sidebar.sidebar--icons .nav-badge {
        position: absolute;
        top: 0.25rem;
        right: 0.25rem;
        margin-left: 0;
        min-width: 1rem;
        height: 1rem;
        font-size: 0.6rem;
    }

    .sidebar.sidebar--icons .nav-list li {
        position: relative;
    }

    .sidebar.sidebar--icons .user-info {
        justify-content: center;
        padding: 0.4rem 0;
    }

    .sidebar.sidebar--icons .user-info .details {
        display: none;
    }

    .sidebar.sidebar--icons .logout-link {
        justify-content: center;
        font-size: 0;
        padding: 0.75rem 0.5rem;
    }

    .sidebar.sidebar--icons .logout-link i {
        font-size: 1.15rem;
        width: auto;
    }

    .sidebar.sidebar--icons .user-section {
        padding: 1rem 0.35rem 0.2rem;
    }

    body.sidebar-menu-open.sidebar-icons-mode #app {
        margin-left: var(--sidebar-w-icons);
        width: calc(100% - var(--sidebar-w-icons));
        max-width: calc(100vw - var(--sidebar-w-icons));
    }

    body.sidebar-menu-open.sidebar-expanded #app {
        margin-left: 0;
    }

    .sidebar.open:not(.sidebar--icons) {
        width: var(--sidebar-w);
    }

    .sidebar.open:not(.sidebar--icons) .close-btn {
        display: flex;
    }
}

/* Small phones (320px–575px) */
@media (max-width: 575px) {
    .btn:not(.btn-sm):not(.btn-icon) {
        min-height: var(--touch-min);
    }

    .login-page .btn {
        min-height: var(--touch-min);
    }

    .topbar {
        flex-wrap: wrap;
    }

    .topbar-title {
        order: 2;
        flex: 1 1 100%;
        white-space: normal;
        text-overflow: unset;
    }

    .topbar-actions {
        order: 3;
        flex: 1 1 100%;
        justify-content: flex-start;
    }

    .hamburger {
        order: 1;
    }

    .modal-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }

    .card-header .btn,
    .card-header .gap-1 {
        width: 100%;
        justify-content: flex-start;
    }

    .dashboard-report-header {
        flex-direction: column;
        align-items: stretch;
    }

    .signatory-monitor-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .signatory-monitor-semester,
    .signatory-monitor-search {
        flex: 1 1 100%;
        max-width: none;
        min-width: 0;
    }

    .signatory-monitor-count {
        white-space: normal;
    }

    .profile-page {
        max-width: none;
    }

    .summary-item .value {
        font-size: clamp(1.15rem, 4vw, 1.5rem);
    }

    .summary-total .value {
        font-size: clamp(1.35rem, 5vw, 2rem);
    }

    .btn-sm {
        min-height: var(--touch-min);
    }

    .action-col .btn-sm {
        min-height: 36px;
    }
}

/* Large phones / small tablets (576px–767px) */
@media (min-width: 576px) and (max-width: 767px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
    }

    .topbar-actions {
        max-width: 60%;
    }
}

/* Tablet portrait adjustments (768px–991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .signature-grid-row {
        gap: 1.5rem 2rem;
    }

    .official-time-wrap .official-time-table-wrap {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .official-time-form-table {
        min-width: 36rem;
    }

    .form-grid-2,
    .form-grid-3 {
        grid-template-columns: 1fr 1fr;
    }
}

/* Small laptops (992px–1023px) */
@media (min-width: 992px) and (max-width: 1023px) {
    .content-area {
        --content-pad: clamp(1rem, 2vw, 1.35rem);
    }
}

/* Small laptops / tablets landscape (1024px–1199px) */
@media (min-width: 1024px) and (max-width: 1199px) {
    .signatory-step {
        flex: 1 1 8.5rem;
        min-width: 8.5rem;
        max-width: 10.5rem;
    }
}

/* Standard laptops (1200px–1365px) */
@media (min-width: 1200px) and (max-width: 1365px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

/* Desktop monitors (1366px–1439px) */
@media (min-width: 1366px) {
    :root {
        --content-max: 100%;
    }
}

/* Large desktop (1440px–1599px) */
@media (min-width: 1440px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }

    .content-area {
        padding: clamp(1.25rem, 1.5vw, 1.75rem);
    }
}

/* Wide desktop (1600px–1919px) */
@media (min-width: 1600px) {
    :root {
        --content-max: min(100%, 1560px);
    }

    .content-area {
        margin-inline: auto;
    }
}

/* Full HD (1920px+) */
@media (min-width: 1920px) {
    :root {
        --content-max: min(100%, 1720px);
        --font-body: clamp(0.9375rem, 0.875rem + 0.15vw, 1.0625rem);
    }

    .stat-card {
        padding: clamp(1.25rem, 1.5vw, 1.5rem);
    }
}

/* 2K / 4K / Ultrawide (2560px+) */
@media (min-width: 2560px) {
    :root {
        --content-max: min(100%, 2200px);
        --sidebar-w: 300px;
    }

    .content-area {
        padding: clamp(1.5rem, 1.2vw, 2.5rem);
    }

    .stat-card h3 {
        font-size: clamp(1.75rem, 1.5rem + 0.5vw, 2.25rem);
    }
}

/* Print form on-screen preview (non-print) */
@media screen and (max-width: 767px) {
    .fw-letterhead-top {
        grid-template-columns: 60px 1fr;
        gap: 0.5rem;
    }

    .fw-logo {
        width: 60px;
        height: 60px;
    }

    .fw-tagline {
        grid-column: 1 / -1;
        text-align: center;
        max-width: none;
    }

    .fw-profile-grid {
        grid-template-columns: 1fr;
    }

    .fw-signature-recommending {
        grid-template-columns: 1fr;
    }
}

/* Focus states for keyboard navigation */
.btn:focus-visible,
.nav-item:focus-visible,
.form-group input:focus-visible,
.form-group select:focus-visible,
.form-group textarea:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

/* Prevent horizontal page scroll */
body,
#app,
.main-content,
.content-area {
    overflow-x: clip;
}

@supports not (overflow-x: clip) {
    body,
    #app,
    .main-content,
    .content-area {
        overflow-x: hidden;
    }
}
