/**
 * SMS 2 – Research Monitoring UI
 * Enhanced adviser-facing research monitoring pages
 * Works with dashboard-academic.css and theme.css
 */

/* ══════════════════════════════════════════════════
   LIVE INDICATOR
══════════════════════════════════════════════════ */
.rm-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    font-size: 0.75rem;
    font-weight: 700;
    color: #10b981;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.rm-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    position: relative;
    flex-shrink: 0;
}

.rm-live-dot::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.35);
    animation: rm-pulse 1.8s ease-out infinite;
}

@keyframes rm-pulse {
    0%   { transform: scale(0.6); opacity: 0.9; }
    100% { transform: scale(2.2); opacity: 0; }
}

/* Last refresh bar */
.rm-refresh-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    background: var(--sms-surface-muted, #f1f5f9);
    font-size: 0.78rem;
    color: var(--sms-text-muted);
    font-weight: 600;
    transition: color 0.3s;
    margin-top: 1.5rem;
}

.rm-refresh-bar.rm-just-updated {
    color: #10b981;
}

.rm-refresh-icon {
    font-size: 0.8rem;
    transition: transform 0.5s ease;
}

.rm-refresh-bar.rm-spinning .rm-refresh-icon {
    animation: rm-spin 0.6s linear;
}

@keyframes rm-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ══════════════════════════════════════════════════
   PAGE HEADER
══════════════════════════════════════════════════ */
.rm-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.rm-page-header-left h4 {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--sms-heading);
    margin: 0 0 0.2rem;
    letter-spacing: -0.02em;
}

.rm-page-header-left p {
    margin: 0;
    font-size: 0.88rem;
    color: var(--sms-text-muted);
}

.rm-page-header-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════
   GROUP HERO CARD
══════════════════════════════════════════════════ */
.rm-group-hero {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    padding: 1.4rem 1.5rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--sms-primary, #2563eb) 0%, #1d4ed8 60%, #1e3a8a 100%);
    color: #fff;
    box-shadow: 0 12px 32px rgba(37, 99, 235, 0.28);
}

.rm-group-hero::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -8%;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    pointer-events: none;
}

.rm-group-hero::after {
    content: '';
    position: absolute;
    bottom: -30%;
    right: 15%;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    pointer-events: none;
}

.rm-group-hero-body {
    position: relative;
    z-index: 1;
}

.rm-group-hero .badge {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(4px);
    font-size: 0.82rem;
    padding: 0.35rem 0.8rem;
}

.rm-group-hero h5 {
    color: #fff;
    font-weight: 800;
    font-size: 1.25rem;
    margin: 0.6rem 0 0.3rem;
}

.rm-group-hero p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.5;
}

.rm-group-hero-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.rm-hero-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.rm-hero-stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.rm-hero-stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.2rem;
}

/* Hero progress bar */
.rm-hero-progress {
    margin-top: 1rem;
}

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

.rm-hero-progress-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.rm-hero-progress-pct {
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
}

.rm-hero-progress-track {
    height: 10px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.rm-hero-progress-fill {
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, rgba(255,255,255,0.85), rgba(255,255,255,0.6));
    transition: width 0.5s ease;
    min-width: 4px;
}

/* ══════════════════════════════════════════════════
   STAT CHIPS ROW
══════════════════════════════════════════════════ */
.rm-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.rm-stat-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 1rem 1.1rem;
    border-radius: 14px;
    background: var(--sms-surface);
    border: 1px solid var(--sms-glass-border);
    box-shadow: var(--sms-shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rm-stat-chip:hover {
    transform: translateY(-2px);
    box-shadow: var(--sms-shadow-md);
}

.rm-stat-chip-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.rm-stat-chip-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--sms-heading);
    line-height: 1;
}

.rm-stat-chip-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--sms-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ══════════════════════════════════════════════════
   GROUP CARDS (My Research Groups)
══════════════════════════════════════════════════ */
.rm-group-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.rm-group-card:hover {
    transform: translateY(-3px);
}

.rm-group-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.85rem;
}

.rm-group-badge-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.rm-group-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--sms-heading);
    margin: 0 0 0.3rem;
    line-height: 1.3;
}

.rm-group-subtitle {
    font-size: 0.85rem;
    color: var(--sms-text);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rm-group-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--sms-text-muted);
    font-weight: 600;
    margin-top: 0.75rem;
}

/* Progress section inside group card */
.rm-group-progress-section {
    margin-top: auto;
    padding-top: 1rem;
}

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

.rm-progress-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--sms-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.rm-progress-pct {
    font-size: 1rem;
    font-weight: 800;
    color: var(--sms-primary, #2563eb);
}

.rm-progress-track {
    height: 10px;
    border-radius: 5px;
    background: var(--sms-border-soft, #e8eef7);
    overflow: hidden;
    margin-bottom: 0.85rem;
}

.rm-progress-fill {
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    transition: width 0.5s ease;
    min-width: 4px;
}

/* Action buttons at bottom of card */
.rm-group-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.rm-primary-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-radius: 10px;
    background: var(--sms-primary, #2563eb);
    color: #fff !important;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
    border: none;
}

.rm-primary-action:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    color: #fff !important;
}

.rm-secondary-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
}

.rm-sec-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.45rem 0.5rem;
    border-radius: 8px;
    background: var(--sms-surface-muted, #f1f5f9);
    color: var(--sms-text) !important;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid var(--sms-border);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    white-space: nowrap;
    overflow: hidden;
}

.rm-sec-action:hover {
    background: var(--sms-primary, #2563eb);
    color: #fff !important;
    border-color: transparent;
}

/* ══════════════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════════════ */
.rm-empty {
    text-align: center;
    padding: 4rem 2rem;
}

.rm-empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    background: var(--sms-surface-muted);
    color: var(--sms-text-muted);
    margin-bottom: 1.25rem;
}

.rm-empty h6 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--sms-heading);
    margin-bottom: 0.4rem;
}

.rm-empty p {
    font-size: 0.88rem;
    color: var(--sms-text-muted);
    margin: 0;
    max-width: 28rem;
    margin-inline: auto;
}

/* ══════════════════════════════════════════════════
   MILESTONE CARDS
══════════════════════════════════════════════════ */
.rm-milestone-card {
    position: relative;
    overflow: hidden;
}

.rm-milestone-number {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 800;
    flex-shrink: 0;
    background: var(--sms-primary, #2563eb);
    color: #fff;
}

.rm-milestone-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.rm-milestone-header-text {
    flex: 1;
    min-width: 0;
}

.rm-milestone-header-pct {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    flex-shrink: 0;
}

.rm-milestone-name {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--sms-heading);
    margin: 0 0 0.2rem;
    line-height: 1.3;
}

.rm-milestone-desc {
    font-size: 0.82rem;
    color: var(--sms-text-muted);
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rm-milestone-progress {
    height: 8px;
    border-radius: 4px;
    background: var(--sms-border-soft, #e8eef7);
    overflow: hidden;
    margin-bottom: 0.85rem;
}

.rm-milestone-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    min-width: 4px;
}

.rm-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.rm-milestone-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin: 0.85rem 0;
    padding: 0.8rem;
    border-radius: 10px;
    background: var(--sms-surface-muted);
    font-size: 0.8rem;
}

.rm-milestone-date-item-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--sms-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.2rem;
}

.rm-milestone-date-item-value {
    font-weight: 700;
    color: var(--sms-heading);
}

.rm-note-block {
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    font-size: 0.82rem;
    line-height: 1.5;
    margin-bottom: 0.6rem;
}

/* ══════════════════════════════════════════════════
   SUBMITTED UPDATES
══════════════════════════════════════════════════ */
.rm-update-card {
    position: relative;
    overflow: hidden;
}

.rm-update-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 4px 0 0 4px;
    background: var(--rm-accent, #3b82f6);
}

.rm-update-header {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.rm-update-meta {
    flex: 1;
    min-width: 0;
}

.rm-update-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--sms-heading);
    margin: 0 0 0.3rem;
    line-height: 1.3;
}

.rm-update-sub {
    font-size: 0.8rem;
    color: var(--sms-text-muted);
    margin: 0;
}

.rm-update-pct-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    text-align: center;
}

.rm-update-pct-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--sms-primary, #2563eb);
    line-height: 1;
}

.rm-update-pct-delta {
    font-size: 0.75rem;
    font-weight: 700;
    margin-top: 0.15rem;
}

.rm-section-block {
    padding: 0.85rem 1rem;
    border-radius: 10px;
    margin-bottom: 0.65rem;
}

.rm-section-block-label {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.rm-section-block-body {
    font-size: 0.9rem;
    line-height: 1.65;
}

/* Action Buttons */
.rm-action-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-top: 0.85rem;
    border-top: 1px solid var(--sms-border-soft, #e8eef7);
    margin-top: 0.5rem;
}

.rm-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all 0.18s ease;
    text-decoration: none;
    white-space: nowrap;
}

.rm-btn-comment {
    background: transparent;
    border-color: var(--sms-primary, #2563eb);
    color: var(--sms-primary, #2563eb);
}

.rm-btn-comment:hover {
    background: var(--sms-primary, #2563eb);
    color: #fff;
}

.rm-btn-revision {
    background: transparent;
    border-color: #f59e0b;
    color: #f59e0b;
}

.rm-btn-revision:hover {
    background: #f59e0b;
    color: #fff;
}

.rm-btn-approve {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
}

.rm-btn-approve:hover {
    background: #059669;
    border-color: #059669;
}

.rm-btn-history {
    background: transparent;
    border-color: var(--sms-border);
    color: var(--sms-text-muted);
}

.rm-btn-history:hover {
    background: var(--sms-surface-muted);
    color: var(--sms-heading);
}

.rm-ai-generate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 36px;
    border: 1px solid var(--sms-primary);
    background: var(--sms-primary);
    color: #fff;
    font-weight: 750;
}
.rm-ai-generate-btn:hover,
.rm-ai-generate-btn:focus {
    background: var(--sms-primary-dark, var(--sms-primary));
    border-color: var(--sms-primary-dark, var(--sms-primary));
    color: #fff;
}
.rm-ai-generate-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.rm-ai-launcher {
    display: grid;
    gap: 0.7rem;
    margin-top: 0.8rem;
    padding: 0.9rem;
    border: 1px solid var(--sms-border);
    border-radius: 10px;
    background: var(--sms-surface-solid);
}
.rm-ai-launcher-copy h3 {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    color: var(--sms-heading);
    font-size: 0.95rem;
    font-weight: 780;
}
.rm-ai-launcher-copy h3 i { color: var(--sms-primary); }
.rm-ai-launcher-copy p {
    margin: 0.16rem 0 0;
    color: var(--sms-text-muted);
    font-size: 0.73rem;
}
.rm-ai-eyebrow {
    display: block;
    margin-bottom: 0.16rem;
    color: var(--sms-primary);
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
}
.rm-ai-file-meta {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--sms-border-soft);
    border-radius: 8px;
    background: var(--sms-surface-muted);
}
.rm-ai-file-icon {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 8px;
    background: var(--sms-primary-xlight);
    color: var(--sms-primary);
}
.rm-ai-file-meta > span:nth-child(2) { min-width: 0; }
.rm-ai-file-meta strong,
.rm-ai-file-meta small { display: block; }
.rm-ai-file-meta strong {
    overflow: hidden;
    color: var(--sms-heading);
    font-size: 0.73rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rm-ai-file-meta small { color: var(--sms-text-muted); font-size: 0.63rem; }
.rm-ai-file-status {
    color: var(--sms-text-muted);
    font-size: 0.62rem;
    font-weight: 700;
    text-align: right;
}
.rm-ai-controls {
    display: grid;
    grid-template-columns: minmax(170px, 1fr) auto;
    align-items: end;
    gap: 0.55rem;
}
.rm-ai-controls label {
    grid-column: 1;
    margin-bottom: -0.38rem;
    color: var(--sms-text-muted);
    font-size: 0.64rem;
    font-weight: 700;
}
.rm-ai-controls select { grid-column: 1; min-height: 36px; font-size: 0.74rem; }
.rm-ai-controls button { grid-column: 2; grid-row: 1 / span 2; }
.rm-ai-format-note,
.rm-ai-live {
    margin: 0;
    color: var(--sms-text-muted);
    font-size: 0.64rem;
    line-height: 1.45;
}
.rm-ai-live:not(:empty) {
    padding: 0.5rem 0.6rem;
    border-radius: 7px;
    background: var(--sms-surface-muted);
}
.rm-ai-progress {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.55rem;
    color: var(--sms-primary);
    font-size: 0.66rem;
}
.rm-ai-progress[hidden] { display: none; }
.rm-ai-progress > span {
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--sms-border-soft);
}
.rm-ai-progress > span::after {
    display: block;
    width: 38%;
    height: 100%;
    border-radius: inherit;
    background: var(--sms-primary);
    content: '';
    animation: rm-ai-progress 1.2s ease-in-out infinite alternate;
}
@keyframes rm-ai-progress { to { transform: translateX(160%); } }

.rm-ai-panel {
    margin-top: 0.75rem;
    padding: 0.9rem;
    border: 1px solid var(--sms-border);
    border-left: 3px solid var(--sms-primary);
    border-radius: 10px;
    background: var(--sms-surface-solid);
}
.rm-ai-panel-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}
.rm-ai-panel-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    color: var(--sms-heading);
    font-size: 0.92rem;
    font-weight: 780;
}
.rm-ai-panel-title i { color: var(--sms-primary); }
.rm-ai-panel-sub {
    margin: 0.18rem 0 0;
    color: var(--sms-text-muted);
    font-size: 0.69rem;
}
.rm-ai-verdict {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.24rem 0.58rem;
    border: 1px solid color-mix(in srgb, var(--sms-success) 25%, var(--sms-border));
    background: color-mix(in srgb, var(--sms-success) 9%, var(--sms-surface-solid));
    color: var(--sms-success);
    font-size: 0.64rem;
    font-weight: 750;
}
.rm-ai-panel[data-verdict="needs_revision"] .rm-ai-verdict {
    border-color: color-mix(in srgb, var(--sms-warning) 28%, var(--sms-border));
    background: color-mix(in srgb, var(--sms-warning) 10%, var(--sms-surface-solid));
    color: var(--sms-warning);
}
.rm-ai-metadata {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.45rem;
    margin-bottom: 0.7rem;
}
.rm-ai-metadata span {
    display: grid;
    gap: 0.08rem;
    min-width: 0;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--sms-border-soft);
    border-radius: 7px;
    background: var(--sms-surface-muted);
}
.rm-ai-metadata small { color: var(--sms-text-muted); font-size: 0.58rem; }
.rm-ai-metadata strong {
    overflow: hidden;
    color: var(--sms-heading);
    font-size: 0.65rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rm-ai-tabs {
    display: flex;
    gap: 0.2rem;
    overflow-x: auto;
    border-bottom: 1px solid var(--sms-border);
}
.rm-ai-tabs [role="tab"] {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0.42rem 0.65rem;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--sms-text-muted);
    font-size: 0.68rem;
    font-weight: 700;
}
.rm-ai-tabs [role="tab"].is-active,
.rm-ai-tabs [role="tab"][aria-selected="true"] {
    border-bottom-color: var(--sms-primary);
    color: var(--sms-primary);
}
.rm-ai-tab-content { padding-top: 0.75rem; }
.rm-ai-tab-content [role="tabpanel"][hidden] { display: none; }
.rm-ai-tab-content h4 {
    margin: 0 0 0.35rem;
    color: var(--sms-heading);
    font-size: 0.78rem;
    font-weight: 750;
}
.rm-ai-tab-content h5 {
    margin: 0.75rem 0 0.35rem;
    color: var(--sms-heading);
    font-size: 0.69rem;
    font-weight: 750;
}
.rm-ai-summary {
    margin: 0;
    color: var(--sms-text);
    font-size: 0.75rem;
    line-height: 1.55;
}
.rm-ai-overview-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.6rem;
}
.rm-ai-overview-stats span {
    padding: 0.26rem 0.5rem;
    border-radius: 6px;
    background: var(--sms-surface-muted);
    color: var(--sms-text-muted);
    font-size: 0.62rem;
}
.rm-ai-overview-stats strong { color: var(--sms-heading); }
.rm-ai-key-points,
.rm-ai-section-list,
.rm-ai-finding-list {
    display: grid;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.rm-ai-key-points li {
    position: relative;
    padding: 0.4rem 0.5rem 0.4rem 1.15rem;
    border-radius: 6px;
    background: var(--sms-surface-muted);
    color: var(--sms-text);
    font-size: 0.69rem;
}
.rm-ai-key-points li::before {
    position: absolute;
    left: 0.45rem;
    color: var(--sms-primary);
    content: '\2022';
    font-weight: 800;
}
.rm-ai-section-list li {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 0.4rem;
    padding: 0.42rem 0;
    border-bottom: 1px solid var(--sms-border-soft);
}
.rm-ai-section-list li > span { color: var(--sms-success); }
.rm-ai-section-list li strong { color: var(--sms-heading); font-size: 0.69rem; }
.rm-ai-section-list li p { margin: 0.12rem 0 0; color: var(--sms-text-muted); font-size: 0.65rem; }
.rm-ai-finding-list li {
    border: 1px solid var(--sms-border-soft);
    border-radius: 7px;
    background: var(--sms-surface-solid);
}
.rm-ai-finding-list details { padding: 0.48rem 0.58rem; }
.rm-ai-finding-list summary {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--sms-heading);
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
}
.rm-ai-finding-list details p { margin: 0.42rem 0 0; color: var(--sms-text); font-size: 0.67rem; line-height: 1.45; }
.rm-ai-finding-list blockquote {
    margin: 0.42rem 0 0;
    padding: 0.35rem 0.55rem;
    border-left: 2px solid var(--sms-primary);
    background: var(--sms-surface-muted);
    color: var(--sms-text-muted);
    font-size: 0.64rem;
}
.rm-ai-severity {
    flex: 0 0 auto;
    padding: 0.12rem 0.35rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--sms-warning) 12%, var(--sms-surface-solid));
    color: var(--sms-warning);
    font-size: 0.55rem;
    text-transform: uppercase;
}
.rm-ai-severity.attention {
    background: color-mix(in srgb, var(--sms-danger) 10%, var(--sms-surface-solid));
    color: var(--sms-danger);
}
.rm-ai-empty-note { margin: 0; color: var(--sms-text-muted); font-size: 0.68rem; }
.rm-ai-example {
    margin-top: 0.2rem;
    color: var(--sms-text-muted);
    font-size: 0.67rem;
    font-style: italic;
}
.rm-ai-gate-note {
    flex-basis: 100%;
    background: var(--sms-surface-muted);
    color: var(--sms-text);
    border: 1px solid var(--sms-border);
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 550;
}

/* Feedback thread */
.rm-feedback-thread {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 10px;
    background: var(--sms-surface-muted);
    border: 1px solid var(--sms-border-soft);
}

.rm-feedback-thread-title {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--sms-heading);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.rm-feedback-item {
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    line-height: 1.5;
}

.rm-feedback-item:last-child {
    margin-bottom: 0;
}

.rm-feedback-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.rm-feedback-item-type {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
}

.rm-feedback-item-time {
    font-size: 0.72rem;
    color: var(--sms-text-muted);
    font-weight: 600;
}

/* ══════════════════════════════════════════════════
   TIMELINE (Feedback History)
══════════════════════════════════════════════════ */
.rm-timeline {
    position: relative;
    padding-left: 3rem;
}

.rm-timeline::before {
    content: '';
    position: absolute;
    left: 19px;
    top: 0;
    bottom: 1.5rem;
    width: 2px;
    background: linear-gradient(to bottom, var(--sms-primary, #2563eb), var(--sms-border, #dbe3f0));
    border-radius: 2px;
}

.rm-timeline-item {
    position: relative;
    margin-bottom: 1.75rem;
}

.rm-timeline-item:last-child {
    margin-bottom: 0;
}

.rm-timeline-dot {
    position: absolute;
    left: -2.55rem;
    top: 1.1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    z-index: 2;
    flex-shrink: 0;
}

.rm-timeline-content {
    position: relative;
}

.rm-timeline-card {
    border-radius: 14px;
    border: 1px solid var(--sms-glass-border);
    background: var(--sms-surface);
    padding: 1rem 1.15rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rm-timeline-card:hover {
    transform: translateX(3px);
    box-shadow: var(--sms-shadow-md);
}

.rm-timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.rm-timeline-header-left {
    flex: 1;
    min-width: 0;
}

.rm-timeline-header-right {
    text-align: right;
    flex-shrink: 0;
}

.rm-timeline-date {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--sms-heading);
}

.rm-timeline-time {
    font-size: 0.7rem;
    color: var(--sms-text-muted);
    margin-top: 0.1rem;
}

.rm-timeline-re {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--sms-heading);
    margin: 0.35rem 0 0.15rem;
}

.rm-timeline-to {
    font-size: 0.78rem;
    color: var(--sms-text-muted);
    font-weight: 600;
}

.rm-timeline-body {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--sms-text);
    padding: 0.75rem 0.9rem;
    border-radius: 8px;
}

.student-feedback-message,
.rm-timeline-body--feedback {
    background: var(--feedback-bg, var(--sms-surface-muted));
    border: 1px solid var(--sms-border-soft);
    border-left: 3px solid var(--feedback-color, var(--sms-primary));
    border-radius: 8px;
    color: var(--sms-text);
}

.student-feedback-message {
    background: var(--sms-surface-solid, #fff);
}

.student-feedback-status {
    border-color: rgba(14, 165, 233, 0.24);
    color: #0f5f72;
}

.rm-timeline-status-change {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    margin-top: 0.6rem;
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ══════════════════════════════════════════════════
   FILTER BAR
══════════════════════════════════════════════════ */
.rm-filter-bar {
    padding: 1rem 1.15rem;
    border-radius: 14px;
    background: var(--sms-surface);
    border: 1px solid var(--sms-glass-border);
    margin-bottom: 1.5rem;
}

/* ══════════════════════════════════════════════════
   TABLE ENHANCEMENTS
══════════════════════════════════════════════════ */
.rm-milestone-table th {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sms-text-muted);
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--sms-border-soft);
    white-space: nowrap;
}

.rm-milestone-table td {
    padding: 0.85rem 1rem;
    font-size: 0.88rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--sms-border-soft);
}

.rm-milestone-table tbody tr {
    transition: background 0.15s;
}

.rm-milestone-table tbody tr:hover {
    background: var(--sms-surface-muted);
}

/* ══════════════════════════════════════════════════
   BACK BUTTON
══════════════════════════════════════════════════ */
.rm-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1.1rem;
    border-radius: 10px;
    background: var(--sms-surface-muted);
    border: 1px solid var(--sms-border);
    color: var(--sms-text) !important;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
}

.rm-back-btn:hover {
    background: var(--sms-surface);
    border-color: var(--sms-primary, #2563eb);
    color: var(--sms-primary, #2563eb) !important;
}

/* ══════════════════════════════════════════════════
   MODAL ENHANCEMENTS
══════════════════════════════════════════════════ */
.rm-modal .modal-content {
    border-radius: 16px;
    border: 1px solid var(--sms-glass-border);
    overflow: hidden;
}

.rm-modal .modal-header {
    padding: 1.15rem 1.4rem 1rem;
    border-bottom: 1px solid var(--sms-border-soft);
}

.rm-modal .modal-title {
    font-weight: 800;
    font-size: 1rem;
}

.rm-modal .modal-body {
    padding: 1.25rem 1.4rem;
}

/* ══════════════════════════════════════════════════
   STAGE BADGE
══════════════════════════════════════════════════ */
.rm-stage-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    border-radius: 8px;
    background: var(--sms-surface-muted);
    border-left: 3px solid var(--sms-primary, #2563eb);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--sms-heading);
}

/* ══════════════════════════════════════════════════
   DARK MODE OVERRIDES
══════════════════════════════════════════════════ */
[data-theme="dark"] .rm-stat-chip {
    background: rgba(16, 24, 48, 0.62);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .rm-group-hero {
    background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 50%, #2563eb 100%);
}

[data-theme="dark"] .rm-progress-track {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .rm-milestone-dates {
    background: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .rm-feedback-thread {
    background: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .rm-filter-bar {
    background: rgba(16, 24, 48, 0.62);
}

[data-theme="dark"] .rm-sec-action {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8) !important;
}

[data-theme="dark"] .rm-back-btn {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8) !important;
}

[data-theme="dark"] .rm-timeline-card {
    background: rgba(16, 24, 48, 0.62);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .student-feedback-message,
[data-theme="dark"] .rm-timeline-body--feedback {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(148, 163, 184, 0.18);
    border-left-color: var(--feedback-color, var(--sms-primary));
    color: var(--sms-text-strong);
}

[data-theme="dark"] .student-feedback-message {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .student-feedback-status,
[data-theme="dark"] .rm-timeline-status-change {
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(96, 165, 250, 0.24);
    color: #93c5fd;
}

[data-theme="dark"] .rm-refresh-bar {
    background: rgba(255, 255, 255, 0.04);
}

/* ── Section blocks (accomplishments / problems / next activity / attachment) ── */
[data-theme="dark"] .rm-section-block {
    background: rgba(255, 255, 255, 0.05) !important;
    border-left-color: rgba(255, 255, 255, 0.18) !important;
}

[data-theme="dark"] .rm-section-block-label {
    color: var(--sms-text-muted) !important;
}

[data-theme="dark"] .rm-section-block-body {
    color: var(--sms-text) !important;
}

/* Keep the left-border accent colour visible — let only the bg go dark */
[data-theme="dark"] .rm-section-block[style*="border-left:3px solid #10b981"] {
    border-left-color: #10b981 !important;
}
[data-theme="dark"] .rm-section-block[style*="border-left:3px solid #f59e0b"] {
    border-left-color: #f59e0b !important;
}
[data-theme="dark"] .rm-section-block[style*="border-left:3px solid #3b82f6"] {
    border-left-color: #3b82f6 !important;
}
[data-theme="dark"] .rm-section-block[style*="border-left:3px solid #64748b"] {
    border-left-color: rgba(148, 163, 184, 0.45) !important;
}

/* ── Feedback items ── */
[data-theme="dark"] .rm-feedback-item {
    background: rgba(255, 255, 255, 0.05) !important;
    border-left-color: rgba(255, 255, 255, 0.18) !important;
}

/* ── Status pills (submitted-updates & revision monitoring) ── */
[data-theme="dark"] .rm-status-pill {
    background: rgba(255, 255, 255, 0.08) !important;
    color: var(--sms-text-muted) !important;
}
/* Per-status dark tints */
[data-theme="dark"] .rm-status-pill[data-status="In Progress"] {
    background: rgba(251, 191, 36, 0.16) !important;
    color: #fde68a !important;
}
[data-theme="dark"] .rm-status-pill[data-status="Submitted for Review"] {
    background: rgba(59, 130, 246, 0.18) !important;
    color: #93c5fd !important;
}
[data-theme="dark"] .rm-status-pill[data-status="Revision Requested"] {
    background: rgba(248, 113, 113, 0.18) !important;
    color: #fca5a5 !important;
}
[data-theme="dark"] .rm-status-pill[data-status="Approved"] {
    background: rgba(52, 211, 153, 0.16) !important;
    color: #6ee7b7 !important;
}
[data-theme="dark"] .rm-status-pill[data-status="Completed"] {
    background: rgba(5, 150, 105, 0.20) !important;
    color: #6ee7b7 !important;
}

/* ══════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .rm-group-hero-stats {
        gap: 1rem;
    }

    .rm-hero-stat-value {
        font-size: 1.4rem;
    }

    .rm-stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .rm-secondary-actions {
        grid-template-columns: 1fr 1fr;
    }

    .rm-secondary-actions .rm-sec-action:last-child {
        grid-column: 1 / -1;
    }

    .rm-timeline {
        padding-left: 2.5rem;
    }

    .rm-timeline-dot {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
        left: -2.1rem;
    }

    .rm-update-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .rm-update-pct-block {
        flex-direction: row;
        align-items: baseline;
        gap: 0.5rem;
    }

    .rm-page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .rm-page-header-right {
        width: 100%;
        justify-content: flex-end;
    }
}

.student-ai-example {
    margin-bottom: 1rem;
    padding: 0.9rem;
    border: 1px solid var(--sms-border);
    border-left: 3px solid var(--sms-primary);
    border-radius: 10px;
    background: var(--sms-surface-solid);
    box-shadow: var(--sms-shadow-xs);
}
.student-ai-example-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.8rem;
}
.student-ai-example-kicker {
    color: var(--sms-primary);
    font-size: 0.61rem;
    font-weight: 800;
    text-transform: uppercase;
}
.student-ai-example-header h2 {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.12rem 0 0;
    color: var(--sms-heading);
    font-size: 0.95rem;
    font-weight: 780;
}
.student-ai-example-header h2 i { color: var(--sms-primary); }
.student-ai-example-header p {
    margin: 0.15rem 0 0;
    color: var(--sms-text-muted);
    font-size: 0.7rem;
}
.student-ai-example-badge,
.student-ai-example-status {
    flex: 0 0 auto;
    padding: 0.2rem 0.45rem;
    border: 1px solid var(--sms-border-soft);
    border-radius: 999px;
    background: var(--sms-surface-muted);
    color: var(--sms-text-muted);
    font-size: 0.59rem;
    font-weight: 700;
}
.student-ai-example-document {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.65rem;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--sms-border-soft);
    border-radius: 8px;
    background: var(--sms-surface-muted);
}
.student-ai-example-file-icon {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 7px;
    background: var(--sms-primary-xlight);
    color: var(--sms-primary);
}
.student-ai-example-document strong,
.student-ai-example-document small { display: block; }
.student-ai-example-document strong { color: var(--sms-heading); font-size: 0.68rem; }
.student-ai-example-document small { color: var(--sms-text-muted); font-size: 0.6rem; }
.student-ai-example-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 0.9rem;
    margin-top: 0.7rem;
}
.student-ai-example-grid h3 {
    margin: 0 0 0.28rem;
    color: var(--sms-heading);
    font-size: 0.72rem;
    font-weight: 750;
}
.student-ai-example-grid h4 {
    margin: 0.55rem 0 0.2rem;
    color: var(--sms-heading);
    font-size: 0.66rem;
    font-weight: 750;
}
.student-ai-example-summary p,
.student-ai-example-observations details p {
    margin: 0;
    color: var(--sms-text);
    font-size: 0.66rem;
    line-height: 1.5;
}
.student-ai-example-summary ul {
    display: grid;
    gap: 0.22rem;
    margin: 0;
    padding-left: 1rem;
    color: var(--sms-text-muted);
    font-size: 0.64rem;
}
.student-ai-example-observations details {
    padding: 0.38rem 0;
    border-top: 1px solid var(--sms-border-soft);
}
.student-ai-example-observations summary {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--sms-heading);
    font-size: 0.64rem;
    font-weight: 700;
    cursor: pointer;
}
.student-ai-example-observations details p { padding: 0.3rem 0 0 0.35rem; color: var(--sms-text-muted); }
.student-ai-example-tag {
    flex: 0 0 auto;
    padding: 0.1rem 0.32rem;
    border-radius: 999px;
    font-size: 0.52rem;
    text-transform: uppercase;
}
.student-ai-example-tag.attention { background: color-mix(in srgb, var(--sms-warning) 12%, var(--sms-surface-solid)); color: var(--sms-warning); }
.student-ai-example-tag.review { background: color-mix(in srgb, var(--sms-info) 12%, var(--sms-surface-solid)); color: var(--sms-info); }
.student-ai-example-disclaimer {
    margin: 0.5rem 0 0;
    padding-top: 0.4rem;
    border-top: 1px solid var(--sms-border-soft);
    color: var(--sms-text-muted);
    font-size: 0.59rem;
    line-height: 1.4;
}
.student-file-selection {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.45rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--sms-border-soft);
    border-radius: 7px;
    background: var(--sms-surface-muted);
}
.student-file-selection[hidden] { display: none; }
.student-file-selection > span:first-child {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 7px;
    background: var(--sms-primary-xlight);
    color: var(--sms-primary);
}
.student-file-selection > div { min-width: 0; }
.student-file-selection strong,
.student-file-selection small { display: block; }
.student-file-selection strong {
    overflow: hidden;
    color: var(--sms-heading);
    font-size: 0.67rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.student-file-selection small { color: var(--sms-text-muted); font-size: 0.6rem; }
.student-file-selection-state { color: var(--sms-text-muted); font-size: 0.58rem; font-weight: 700; }

@media (max-width: 767.98px) {
    .rm-ai-metadata { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .student-ai-example-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
    .rm-ai-controls { grid-template-columns: 1fr; }
    .rm-ai-controls label,
    .rm-ai-controls select,
    .rm-ai-controls button { grid-column: 1; grid-row: auto; }
    .rm-ai-controls button { width: 100%; }
    .rm-ai-file-meta { grid-template-columns: 32px minmax(0, 1fr); }
    .rm-ai-file-status { grid-column: 2; text-align: left; }
    .student-ai-example-header { flex-direction: column; }
    .student-ai-example-document { grid-template-columns: 30px minmax(0, 1fr); }
    .student-ai-example-status { grid-column: 2; width: fit-content; }
    .student-file-selection { grid-template-columns: 28px minmax(0, 1fr); }
    .student-file-selection-state { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
    .rm-ai-progress > span::after { animation: none; }
}
