
.cosmo-activity-meta{display:block;margin-top:6px}
.cosmo-wrapper{display:inline-flex;flex-direction:column;gap:4px;max-width:360px}
.cosmo-badge{display:inline-flex;align-items:center;gap:6px;background:#f8f9fa;border:1px solid #e9ecef;padding:4px 12px;border-radius:20px;font-size:12px;color:#495057;font-weight:500;box-shadow:0 1px 3px rgba(0,0,0,0.06);white-space:nowrap}
.cosmo-badge.custom{background:#e3f2fd;border-color:#90caf9;color:#0d47a1;font-weight:600}
.cosmo-badge.done{background:#e8f5e9;border-color:#a5d6a7;color:#1b5e20;font-weight:700}
.cosmo-progress-track{width:180px;height:6px;background:#e9ecef;border-radius:10px;overflow:hidden;margin-top:3px}
.cosmo-progress-fill{height:100%;background:linear-gradient(90deg,#1e6055,#43a047);border-radius:10px;transition:width 0.6s ease}
.cosmo-meta-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:11px;color:#616161;margin-top:2px}
.cosmo-percent{background:#1976d2;color:white;padding:2px 8px;border-radius:10px;font-weight:700;font-size:11px}
.cosmo-countdown{display:inline-flex;align-items:center;gap:5px;background:#fff3e0;border:1px solid #ffe0b2;color:#e65100;padding:3px 9px;border-radius:20px;font-size:11px;font-weight:600}
.cosmo-badge i{font-size:13px}

/* =========================================================
   ACTIVITY META - safe layout
   The metadata belongs to the main activity row only. The course index
   is intentionally not modified, preventing duplicate badges and overlap.
   ========================================================= */
.courseindex .cosmo-activity-meta {
    display: none !important;
}

.activity-item > .cosmo-activity-meta,
li.activity > .cosmo-activity-meta,
.activity-item .activity-info > .cosmo-activity-meta,
li.activity .activity-info > .cosmo-activity-meta {
    display: block !important;
    width: 100%;
    max-width: 320px;
    margin: 7px 0 0 0;
    clear: both;
    position: static !important;
}

.activity-item .cosmo-wrapper,
li.activity .cosmo-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    max-width: 320px;
}

.activity-item .cosmo-badge,
li.activity .cosmo-badge {
    white-space: nowrap;
    max-width: 100%;
}

/* Prevent Moodle/Moove flex rules from placing the badge on top of the title. */
.activity-item .activity-info,
li.activity .activity-info {
    min-width: 0;
}

.activity-item .activityname,
li.activity .activityname,
.activity-item .activity-name,
li.activity .activity-name {
    min-width: 0;
    overflow: visible;
}

/* =========================================================
   COSMO PHASE 1 - PROFESSIONAL LEARNER DASHBOARD
   ========================================================= */
.cosmo-dashboard-enabled .cosmo-dashboard,
.cosmo-dashboard {
    --cosmo-primary: #1769e0;
    --cosmo-primary-dark: #0d3f88;
    --cosmo-text: #172b4d;
    --cosmo-muted: #6b778c;
    --cosmo-border: #e7edf5;
    --cosmo-surface: #ffffff;
    --cosmo-bg: #f5f8fc;
    max-width: 1480px;
    margin: 0 auto;
    padding: 22px 24px 44px;
    color: var(--cosmo-text);
}
.cosmo-dashboard,
.cosmo-dashboard * { box-sizing: border-box; }
.cosmo-dashboard a { text-decoration: none; }
.cosmo-dashboard-main { min-width: 0; }
.cosmo-dashboard { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; }
.cosmo-welcome-card {
    min-height: 205px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 32px 38px;
    border-radius: 18px;
    background: linear-gradient(115deg, #edf6ff 0%, #f7fbff 60%, #e9f4ff 100%);
    border: 1px solid #dcecff;
}
.cosmo-welcome-copy { position: relative; z-index: 2; max-width: 65%; }
.cosmo-eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .14em; color: var(--cosmo-primary); margin-bottom: 9px; }
.cosmo-welcome-card h2 { margin: 0 0 7px; font-size: clamp(25px, 3vw, 34px); line-height: 1.18; font-weight: 750; color: #17375f; }
.cosmo-welcome-card p { margin: 0; color: #5c7594; font-size: 15px; }
.cosmo-welcome-illustration { position: absolute; right: 22px; bottom: -18px; width: 290px; height: 210px; opacity: .9; }
.cosmo-orbit { position: absolute; border: 1px solid rgba(23,105,224,.12); border-radius: 50%; }
.orbit-one { width: 245px; height: 120px; right: 0; top: 25px; transform: rotate(-15deg); }
.orbit-two { width: 190px; height: 95px; right: 38px; top: 48px; transform: rotate(18deg); }
.cosmo-book { position: absolute; display: block; border-radius: 5px; color: #fff; box-shadow: 0 10px 20px rgba(33,83,139,.14); }
.book-one { right: 70px; bottom: 42px; width: 105px; height: 16px; padding: 0 12px; background: #3b82e8; transform: rotate(-7deg); }
.book-two { right: 44px; bottom: 25px; width: 125px; height: 17px; background: #67a4ed; transform: rotate(3deg); }
.cosmo-laptop { position: absolute; right: 88px; bottom: 63px; width: 100px; height: 64px; border: 8px solid #1f5eaa; border-radius: 9px 9px 4px 4px; background: #dceeff; display: flex; align-items: center; justify-content: center; font-size: 34px; color: #3c83df; }
.cosmo-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin: 15px 0 25px; }
.cosmo-stat-card { min-height: 118px; padding: 17px; border: 1px solid var(--cosmo-border); border-radius: 13px; background: var(--cosmo-surface); box-shadow: 0 4px 15px rgba(31,53,79,.035); display: flex; flex-direction: column; transition: transform .18s ease, box-shadow .18s ease; }
.cosmo-stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(31,53,79,.09); }
.cosmo-stat-icon { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px; margin-bottom: 8px; }
.icon-blue { background: #e8f1ff; color: #1769e0; }
.icon-green { background: #e7f8ef; color: #16824b; }
.icon-orange { background: #fff2df; color: #d97706; }
.icon-purple { background: #f0eaff; color: #7048d9; }
.cosmo-stat-card strong { font-size: 25px; line-height: 1; color: #17375f; }
.cosmo-stat-card > span:last-child { margin-top: 6px; color: var(--cosmo-muted); font-size: 12px; }
.cosmo-section { margin-bottom: 25px; }
.cosmo-section-heading, .cosmo-side-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.cosmo-section-heading h3, .cosmo-side-heading h3 { margin: 0; font-size: 18px; color: #17375f; font-weight: 750; }
.cosmo-section-heading a, .cosmo-side-heading a { font-size: 12px; color: var(--cosmo-primary); font-weight: 650; }
.cosmo-course-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.cosmo-course-card { overflow: hidden; border: 1px solid var(--cosmo-border); border-radius: 13px; background: #fff; box-shadow: 0 3px 13px rgba(31,53,79,.035); }
.cosmo-course-cover { height: 120px; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; background: linear-gradient(135deg, #2d7eea, #68a9f1); background-size: cover; background-position: center; }
.cosmo-course-card:nth-child(3n+2) .cosmo-course-cover { background: linear-gradient(135deg, #26b57a, #69d49c); }
.cosmo-course-card:nth-child(3n) .cosmo-course-cover { background: linear-gradient(135deg, #6852df, #9b8be9); }
.cosmo-cover-mark { color: rgba(255,255,255,.86); font-size: 18px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.cosmo-course-cover[style]::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(0,0,0,.18)); }
.cosmo-course-menu { position: absolute; z-index: 2; top: 9px; right: 10px; width: 27px; height: 27px; border-radius: 50%; background: rgba(255,255,255,.94); color: #36516f; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.cosmo-course-body { padding: 14px 15px 16px; }
.cosmo-course-category { color: #7c8da5; text-transform: uppercase; font-size: 10px; letter-spacing: .06em; font-weight: 750; }
.cosmo-course-body h4 { margin: 4px 0 5px; min-height: 38px; font-size: 15px; line-height: 1.3; }
.cosmo-course-body h4 a { color: #183a63; }
.cosmo-course-body p { height: 31px; overflow: hidden; margin: 0 0 11px; font-size: 11px; line-height: 1.45; color: #7a889a; }
.cosmo-progress-line, .cosmo-overall-bar { height: 6px; overflow: hidden; background: #e9eef5; border-radius: 99px; }
.cosmo-progress-line span, .cosmo-overall-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #1769e0, #4c96f2); }
.cosmo-course-meta { display: flex; justify-content: space-between; margin: 7px 0 11px; color: #73839a; font-size: 10px; }
.cosmo-course-meta span:first-child { color: var(--cosmo-primary); font-weight: 800; }
.cosmo-resume { display: flex; align-items: center; justify-content: space-between; color: var(--cosmo-primary); font-size: 12px; font-weight: 750; }
.cosmo-resume span { font-size: 16px; }
.cosmo-side-card { margin-bottom: 15px; padding: 18px; border: 1px solid var(--cosmo-border); border-radius: 14px; background: #fff; box-shadow: 0 3px 13px rgba(31,53,79,.035); }
.cosmo-profile-card { display: flex; align-items: center; gap: 13px; }
.cosmo-avatar-wrap img { width: 48px !important; height: 48px !important; border-radius: 50%; object-fit: cover; }
.cosmo-profile-card strong { display: block; color: #17375f; font-size: 14px; }
.cosmo-profile-card a { display: block; margin-top: 3px; color: var(--cosmo-primary); font-size: 11px; }
.cosmo-events { display: flex; flex-direction: column; }
.cosmo-event { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 11px; padding: 11px 0; border-top: 1px solid #edf1f6; }
.cosmo-event:first-child { border-top: 0; padding-top: 0; }
.cosmo-event-date { width: 43px; height: 46px; border-radius: 9px; background: #f1f6fd; color: var(--cosmo-primary); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.cosmo-event-date b { font-size: 17px; line-height: 1; }
.cosmo-event-date small { margin-top: 3px; font-size: 9px; font-weight: 700; text-transform: uppercase; }
.cosmo-event-info { min-width: 0; display: flex; flex-direction: column; }
.cosmo-event-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #27476c; font-size: 12px; }
.cosmo-event-info small, .cosmo-event-info em { margin-top: 3px; color: #8090a3; font-size: 10px; font-style: normal; }
.cosmo-event-info em { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cosmo-quick-links { display: flex; flex-direction: column; }
.cosmo-quick-links a { padding: 9px 0; border-top: 1px solid #edf1f6; color: #3d5877; font-size: 12px; }
.cosmo-quick-links a:first-child { border-top: 0; }
.cosmo-quick-links a:hover { color: var(--cosmo-primary); }
.cosmo-overall-card { text-align: center; }
.cosmo-donut { --value: 0%; width: 116px; height: 116px; margin: 7px auto 12px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(#1769e0 var(--value), #e7edf5 0); position: relative; }
.cosmo-donut::after { content: ''; position: absolute; inset: 9px; background: #fff; border-radius: 50%; }
.cosmo-donut span { position: relative; z-index: 1; color: #17375f; font-size: 25px; font-weight: 800; }
.cosmo-overall-label { color: #75859a; font-size: 11px; margin-bottom: 9px; }
.cosmo-empty-card { text-align: center; padding: 36px 20px; border: 1px dashed #cad5e3; border-radius: 13px; background: #fff; }
.cosmo-empty-icon { width: 46px; height: 46px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; background: #edf5ff; color: var(--cosmo-primary); }
.cosmo-empty-card h4 { margin: 0 0 5px; }
.cosmo-empty-card p { color: #75859a; font-size: 12px; margin-bottom: 15px; }
.cosmo-empty-inline { padding: 15px 0; color: #8593a6; font-size: 12px; }
.cosmo-activity-list { overflow: hidden; border: 1px solid var(--cosmo-border); border-radius: 13px; background: #fff; }
.cosmo-recent-item { min-height: 62px; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid #edf1f6; }
.cosmo-recent-item:last-child { border-bottom: 0; }
.cosmo-recent-icon { flex: 0 0 34px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #e9f8ef; color: #17834e; font-weight: 800; }
.cosmo-recent-copy { min-width: 0; display: flex; flex-direction: column; flex: 1; }
.cosmo-recent-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #2a4769; font-size: 12px; }
.cosmo-recent-copy span, .cosmo-recent-item time { color: #8997a8; font-size: 10px; }
.cosmo-recent-item time { white-space: nowrap; }
@media (max-width: 1150px) {
    .cosmo-dashboard { grid-template-columns: 1fr; }
    .cosmo-dashboard-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; align-items: start; }
    .cosmo-side-card { margin-bottom: 0; }
}
@media (max-width: 800px) {
    .cosmo-dashboard { padding: 14px 10px 30px; }
    .cosmo-stat-grid { grid-template-columns: repeat(2, 1fr); }
    .cosmo-course-grid { grid-template-columns: repeat(2, 1fr); }
    .cosmo-dashboard-side { grid-template-columns: 1fr; }
    .cosmo-welcome-card { padding: 25px 22px; min-height: 180px; }
    .cosmo-welcome-copy { max-width: 100%; }
    .cosmo-welcome-illustration { opacity: .22; right: -30px; }
}
@media (max-width: 560px) {
    .cosmo-stat-grid, .cosmo-course-grid { grid-template-columns: 1fr; }
    .cosmo-course-cover { height: 135px; }
    .cosmo-welcome-card h2 { font-size: 24px; }
    .cosmo-recent-item { align-items: flex-start; }
    .cosmo-recent-item time { display: none; }
}


/* FIX 2.0.6 - force visible */
.cosmo-activity-meta{display:block !important;margin-top:8px !important;visibility:visible !important;opacity:1 !important}
.cosmo-wrapper{display:inline-flex !important;flex-direction:column;gap:5px;max-width:400px;z-index:2}
.cosmo-badge{display:inline-flex !important;align-items:center;gap:6px;background:#e3f2fd !important;border:1px solid #90caf9 !important;padding:5px 14px !important;border-radius:20px !important;font-size:13px !important;color:#0d47a1 !important;font-weight:600 !important;box-shadow:0 1px 3px rgba(0,0,0,0.08)}
.cosmo-badge.done{background:#e8f5e9 !important;border-color:#a5d6a7 !important;color:#1b5e20 !important}
.cosmo-progress-track{width:200px;height:7px;background:#e9ecef;border-radius:10px;overflow:hidden;margin-top:4px}
.cosmo-progress-fill{height:100%;background:linear-gradient(90deg,#1e6055,#43a047);border-radius:10px;transition:width 0.6s ease}
.cosmo-meta-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:12px;color:#616161;margin-top:3px}
.cosmo-percent{background:#1976d2;color:white;padding:2px 9px;border-radius:10px;font-weight:700;font-size:11px}
.cosmo-countdown{display:inline-flex;align-items:center;gap:5px;background:#fff3e0;border:1px solid #ffe0b2;color:#e65100;padding:3px 10px;border-radius:20px;font-size:11px;font-weight:600}
/* Ensure not hidden by course index */
.courseindex .cosmo-activity-meta{display:none !important}
.activity-item .cosmo-activity-meta, li.activity .cosmo-activity-meta{display:block !important;width:100%;max-width:360px;margin:8px 0 0 0;clear:both}


/* Cosmo v2.0.9 ULTRA FORCE */
.cosmo-activity-meta{display:block !important;visibility:visible !important;opacity:1 !important;margin-top:10px !important;margin-bottom:5px !important;position:relative !important;z-index:10 !important}
.cosmo-wrapper{display:flex !important;flex-direction:column !important;gap:6px !important;max-width:500px !important;background:rgba(255,255,255,0.9) !important;padding:4px !important;border-radius:8px !important}
.cosmo-badge{display:inline-flex !important;align-items:center !important;gap:6px !important;background:#e3f2fd !important;border:2px solid #2196f3 !important;padding:6px 16px !important;border-radius:24px !important;font-size:14px !important;color:#0d47a1 !important;font-weight:700 !important;box-shadow:0 2px 8px rgba(33,150,243,0.3) !important}
.cosmo-badge.done{background:#e8f5e9 !important;border-color:#4caf50 !important;color:#1b5e20 !important}
.cosmo-progress-track{width:220px !important;height:8px !important;background:#e0e0e0 !important;border-radius:10px !important;overflow:hidden !important;margin-top:5px !important;display:block !important}
.cosmo-progress-fill{height:100% !important;background:linear-gradient(90deg,#1e6055,#43a047) !important;border-radius:10px !important;transition:width 0.6s ease !important;display:block !important}
.cosmo-meta-row{display:flex !important;gap:8px !important;align-items:center !important;flex-wrap:wrap !important;font-size:12px !important;color:#616161 !important;margin-top:4px !important}
.cosmo-percent{background:#1976d2 !important;color:white !important;padding:3px 10px !important;border-radius:12px !important;font-weight:800 !important;font-size:12px !important}
.cosmo-countdown{display:inline-flex !important;align-items:center !important;gap:5px !important;background:#fff3e0 !important;border:1px solid #ff9800 !important;color:#e65100 !important;padding:4px 12px !important;border-radius:20px !important;font-size:12px !important;font-weight:700 !important}
/* Force visible in all themes */
li.activity .cosmo-activity-meta, div.activity-item .cosmo-activity-meta, .activity-item .cosmo-activity-meta{display:block !important}
.courseindex .cosmo-activity-meta{display:none !important}


/* Cosmo 2.1.0 production fixes */
.cosmo-course-cover {
    position: relative;
    overflow: hidden;
}
.cosmo-course-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.cosmo-course-cover .cosmo-course-menu {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
}

.cosmo-activity-meta {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100%;
    margin: 8px 0 4px !important;
    clear: both;
}
.cosmo-wrapper {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    width: min(100%, 520px);
    max-width: 520px;
}
.cosmo-progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
}
.cosmo-progress-title {
    color: #34495e;
    font-weight: 700;
}
.cosmo-progress-track {
    width: 100% !important;
    max-width: 520px;
    height: 8px !important;
    background: #e9ecef !important;
    border-radius: 10px !important;
    overflow: hidden;
}
.cosmo-progress-fill {
    height: 100% !important;
    background: linear-gradient(90deg, #1e6055, #43a047) !important;
    border-radius: 10px;
    transition: width .4s ease;
}
.cosmo-meta-row {
    display: flex !important;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    color: #667085;
    font-size: 11px;
    line-height: 1.5;
}
.cosmo-meta-row > span {
    white-space: nowrap;
}
.cosmo-percent {
    display: inline-flex;
    align-items: center;
    background: #1976d2 !important;
    color: #fff !important;
    padding: 2px 9px;
    border-radius: 12px;
    font-weight: 800;
}
.cosmo-countdown {
    display: inline-flex;
    align-items: center;
    background: #fff3e0 !important;
    border: 1px solid #ffcc80;
    color: #e65100 !important;
    padding: 2px 9px;
    border-radius: 12px;
    font-weight: 700;
}
.cosmo-grade {
    display: inline-flex;
    align-items: center;
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: #256029;
    padding: 2px 9px;
    border-radius: 12px;
    font-weight: 600;
}
.cosmo-grade small {
    margin-left: 3px;
}
.cosmo-grade-empty {
    background: #f5f6f8;
    border-color: #e1e4e8;
    color: #7a8594;
}
.cosmo-complete .cosmo-progress-title {
    color: #1b5e20;
}
