@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

/* ==========================================================================
   RUDY shell — scoped under body.rudy-app so it never leaks into TED
   ========================================================================== */

:root {
    --rudy-bg: #ffffff;
    --rudy-sidebar-bg: #f6f8fa;
    --rudy-detail-bg: #fbfcfd;
    --rudy-surface: #ffffff;
    --rudy-border: #e5e7eb;
    --rudy-border-soft: #eef0f2;
    --rudy-border-strong: #d0d5db;
    --rudy-text: #1f2933;
    --rudy-text-strong: #111827;
    --rudy-text-muted: #6b7280;
    --rudy-text-faint: #9ca3af;

    --rudy-accent: #058ced;
    --rudy-accent-hover: #047bc4;
    --rudy-accent-soft: #e5f6fe;

    --rudy-info: #0ea5b7;          /* role pill / "ADMIN" */
    --rudy-info-strong: #0891a3;
    --rudy-warning: #f59e0b;
    --rudy-success: #10b981;
    --rudy-danger: #ef4444;

    --rudy-topbar-h: 52px;
    --rudy-sidebar-w: 252px;
    --rudy-detail-w: 400px;
    --rudy-radius: 10px;
    --rudy-radius-sm: 6px;

    --rudy-shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
    --rudy-shadow-card-hover: 0 4px 12px rgba(16, 24, 40, 0.08), 0 2px 4px rgba(16, 24, 40, 0.04);
}

[data-rudy-theme="dark"] {
    --rudy-bg: #15181c;
    --rudy-sidebar-bg: #1a1d22;
    --rudy-detail-bg: #1a1d22;
    --rudy-surface: #1f2429;
    --rudy-border: #2f3640;
    --rudy-border-soft: #262b30;
    --rudy-border-strong: #3a424c;
    --rudy-text: #e5e9ed;
    --rudy-text-strong: #f5f7fa;
    --rudy-text-muted: #9aa4ad;
    --rudy-text-faint: #6b7783;
    --rudy-accent: #5a8dd6;
    --rudy-accent-hover: #7aa6e3;
    --rudy-accent-soft: #1f2c3d;
    --rudy-info: #14b8c8;
    --rudy-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
    --rudy-shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.5);
}

body.rudy-app {
    margin: 0;
    background: var(--rudy-bg);
    color: var(--rudy-text);
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Dark-mode overrides for Bootstrap utility classes that don't auto-theme
   ========================================================================== */
[data-rudy-theme="dark"] body.rudy-app .bg-light,
[data-rudy-theme="dark"] body.rudy-app .bg-white {
    background-color: var(--rudy-surface) !important;
    color: var(--rudy-text) !important;
}
[data-rudy-theme="dark"] body.rudy-app .text-dark { color: var(--rudy-text) !important; }
[data-rudy-theme="dark"] body.rudy-app .text-muted,
[data-rudy-theme="dark"] body.rudy-app .text-body-secondary {
    color: var(--rudy-text-muted) !important;
}
[data-rudy-theme="dark"] body.rudy-app .text-black-50 { color: var(--rudy-text-faint) !important; }
[data-rudy-theme="dark"] body.rudy-app hr { border-color: var(--rudy-border); opacity: 1; }
[data-rudy-theme="dark"] body.rudy-app .border,
[data-rudy-theme="dark"] body.rudy-app .border-top,
[data-rudy-theme="dark"] body.rudy-app .border-bottom,
[data-rudy-theme="dark"] body.rudy-app .border-start,
[data-rudy-theme="dark"] body.rudy-app .border-end { border-color: var(--rudy-border) !important; }

/* Bootstrap "table-light" header rows revert to dark surface */
[data-rudy-theme="dark"] body.rudy-app .table-light,
[data-rudy-theme="dark"] body.rudy-app .table-light > th,
[data-rudy-theme="dark"] body.rudy-app .table-light > td {
    --bs-table-bg: var(--rudy-surface);
    --bs-table-color: var(--rudy-text);
    background-color: var(--rudy-surface);
    color: var(--rudy-text);
    border-color: var(--rudy-border);
}
[data-rudy-theme="dark"] body.rudy-app .table {
    --bs-table-color: var(--rudy-text);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--rudy-border);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.05);
}
[data-rudy-theme="dark"] body.rudy-app .table > thead { color: var(--rudy-text); }

/* Cards & list groups */
[data-rudy-theme="dark"] body.rudy-app .card {
    --bs-card-bg: var(--rudy-surface);
    --bs-card-color: var(--rudy-text);
    --bs-card-border-color: var(--rudy-border);
    background: var(--rudy-surface);
    border-color: var(--rudy-border);
    color: var(--rudy-text);
}
[data-rudy-theme="dark"] body.rudy-app .card-header,
[data-rudy-theme="dark"] body.rudy-app .card-footer {
    background: var(--rudy-surface-alt, var(--rudy-bg));
    border-color: var(--rudy-border);
}
[data-rudy-theme="dark"] body.rudy-app .list-group-item {
    background: var(--rudy-surface);
    color: var(--rudy-text);
    border-color: var(--rudy-border);
}

/* Forms, modals, dropdowns */
[data-rudy-theme="dark"] body.rudy-app .form-control,
[data-rudy-theme="dark"] body.rudy-app .form-select,
[data-rudy-theme="dark"] body.rudy-app .input-group-text {
    background-color: var(--rudy-surface);
    color: var(--rudy-text);
    border-color: var(--rudy-border);
}
[data-rudy-theme="dark"] body.rudy-app .form-control::placeholder { color: var(--rudy-text-faint); }
[data-rudy-theme="dark"] body.rudy-app .form-control:disabled,
[data-rudy-theme="dark"] body.rudy-app .form-select:disabled {
    background-color: var(--rudy-bg);
    color: var(--rudy-text-muted);
}
[data-rudy-theme="dark"] body.rudy-app .modal-content {
    background: var(--rudy-surface);
    color: var(--rudy-text);
    border-color: var(--rudy-border);
}
[data-rudy-theme="dark"] body.rudy-app .modal-header,
[data-rudy-theme="dark"] body.rudy-app .modal-footer { border-color: var(--rudy-border); }
[data-rudy-theme="dark"] body.rudy-app .btn-close { filter: invert(1) grayscale(0.4); }
[data-rudy-theme="dark"] body.rudy-app .dropdown-menu {
    background: var(--rudy-surface);
    color: var(--rudy-text);
    border-color: var(--rudy-border);
}
[data-rudy-theme="dark"] body.rudy-app .dropdown-item { color: var(--rudy-text); }
[data-rudy-theme="dark"] body.rudy-app .dropdown-item:hover,
[data-rudy-theme="dark"] body.rudy-app .dropdown-item:focus {
    background: var(--rudy-bg);
    color: var(--rudy-accent);
}
[data-rudy-theme="dark"] body.rudy-app .dropdown-divider { border-color: var(--rudy-border); }

/* Alerts — soften the bright Bootstrap defaults for dark backgrounds */
[data-rudy-theme="dark"] body.rudy-app .alert-info {
    background: #0c2333; color: #93c5fd; border-color: #1e3a5f;
}
[data-rudy-theme="dark"] body.rudy-app .alert-success {
    background: #0d2818; color: #6ee7b7; border-color: #1f4d36;
}
[data-rudy-theme="dark"] body.rudy-app .alert-warning {
    background: #2b1f06; color: #fcd34d; border-color: #5a3f0b;
}
[data-rudy-theme="dark"] body.rudy-app .alert-danger {
    background: #2b0f0f; color: #fca5a5; border-color: #5a1d1d;
}

/* Badges using "text-dark" override (e.g. bg-warning text-dark, bg-light text-dark) */
[data-rudy-theme="dark"] body.rudy-app .badge.bg-light {
    background: var(--rudy-bg) !important;
    color: var(--rudy-text) !important;
}

/* Outline / light / link buttons */
[data-rudy-theme="dark"] body.rudy-app .btn-light {
    background: var(--rudy-surface);
    color: var(--rudy-text);
    border-color: var(--rudy-border);
}
[data-rudy-theme="dark"] body.rudy-app .btn-light:hover { background: var(--rudy-bg); }
[data-rudy-theme="dark"] body.rudy-app .btn-outline-secondary {
    color: var(--rudy-text);
    border-color: var(--rudy-border);
}
[data-rudy-theme="dark"] body.rudy-app .btn-outline-secondary:hover {
    background: var(--rudy-bg);
    color: var(--rudy-text);
}

/* Pagination, breadcrumbs, nav-pills (Bootstrap), tabs */
[data-rudy-theme="dark"] body.rudy-app .page-link {
    background: var(--rudy-surface);
    color: var(--rudy-accent);
    border-color: var(--rudy-border);
}
[data-rudy-theme="dark"] body.rudy-app .page-item.disabled .page-link {
    background: var(--rudy-bg);
    color: var(--rudy-text-faint);
}
[data-rudy-theme="dark"] body.rudy-app .nav-tabs {
    border-color: var(--rudy-border);
}
[data-rudy-theme="dark"] body.rudy-app .nav-tabs .nav-link {
    color: var(--rudy-text-muted);
}
[data-rudy-theme="dark"] body.rudy-app .nav-tabs .nav-link.active {
    background: var(--rudy-surface);
    color: var(--rudy-text);
    border-color: var(--rudy-border) var(--rudy-border) var(--rudy-surface);
}

/* Custom callouts in the RUDY shell that had hardcoded light tints */
[data-rudy-theme="dark"] body.rudy-app .rudy-card-callout {
    background: #2b1f06;
    color: #fcd34d;
}
[data-rudy-theme="dark"] body.rudy-app .rudy-fun-fact {
    background: #2b1f06;
    color: #fcd34d;
}
[data-rudy-theme="dark"] body.rudy-app .rudy-pending-badge {
    background: #2b1f06;
    color: #fcd34d;
    border-color: #5a3f0b;
}
[data-rudy-theme="dark"] body.rudy-app .rudy-history-changes {
    background: var(--rudy-bg);
    color: var(--rudy-text-muted);
}

/* No-sidebar layout: full-width main, no panels at all */
body.rudy-no-side-panels .rudy-shell {
    grid-template-columns: 1fr !important;
}
body.rudy-no-side-panels .rudy-sidebar,
body.rudy-no-side-panels .rudy-detail-panel { display: none; }
body.rudy-no-side-panels .rudy-hamburger { display: none; }

/* Sidebar-only layout: nav sidebar visible, detail panel hidden (default for TED) */
body.rudy-no-detail-panel .rudy-shell {
    grid-template-columns: var(--rudy-sidebar-w) 1fr !important;
}
body.rudy-no-detail-panel.rudy-sidebar-collapsed .rudy-shell {
    grid-template-columns: 0 1fr !important;
}
body.rudy-no-detail-panel .rudy-detail-panel { display: none; }

/* TED nav sidebar */
.rudy-nav { padding: 14px 12px 24px; }
.rudy-nav-section { margin-bottom: 18px; }
.rudy-nav-header {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--rudy-text-faint);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 0 10px 6px;
}
.rudy-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 6px;
    color: var(--rudy-text);
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 500;
    margin-bottom: 1px;
    transition: background 0.12s ease;
}
.rudy-nav-link:hover {
    background: var(--rudy-bg);
    color: var(--rudy-accent);
}
.rudy-nav-link.active {
    background: var(--rudy-accent-soft);
    color: var(--rudy-accent);
    font-weight: 600;
}
.rudy-nav-link i { font-size: 0.95rem; opacity: 0.85; width: 16px; text-align: center; }

body.rudy-app a { color: var(--rudy-accent); text-decoration: none; }
body.rudy-app a:hover { color: var(--rudy-accent-hover); }

/* ---------- Platform bar (thin strip above the system topbar) ---------- */
.rudy-platformbar {
    height: 36px;
    background: #0e4275;
    color: rgba(255,255,255,.8);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    font-size: 0.72rem;
    letter-spacing: 0.4px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,.12);
}
.rudy-platformbar-left {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.rudy-platformbar-logo {
    height: 22px;
    width: auto;
    opacity: 0.95;
}
.rudy-platformbar-name {
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.6px;
}
.rudy-platformbar-tagline {
    color: rgba(255,255,255,.6);
    font-weight: 400;
}
.rudy-platformbar-version {
    color: #64748b;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.65rem;
}
[data-rudy-theme="dark"] .rudy-platformbar {
    background: #07203f;
    border-bottom-color: rgba(255,255,255,.1);
}

/* ---------- Topbar ---------- */
.rudy-topbar {
    height: var(--rudy-topbar-h);
    background: var(--rudy-surface);
    border-bottom: 1px solid var(--rudy-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.rudy-topbar-left,
.rudy-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rudy-hamburger {
    background: transparent;
    border: none;
    color: var(--rudy-text);
    font-size: 1.15rem;
    width: 34px;
    height: 34px;
    border-radius: var(--rudy-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.rudy-hamburger:hover { background: var(--rudy-sidebar-bg); }

.rudy-brand {
    font-weight: 700;
    font-size: 0.78rem;
    text-decoration: none;
    color: var(--rudy-text-muted);
    letter-spacing: 0.6px;
    margin-right: 6px;
    text-transform: lowercase;
}
.rudy-brand-text { color: var(--rudy-text-muted); }
.rudy-brand-accent { color: var(--rudy-text); font-weight: 800; }

.rudy-breadcrumb {
    font-size: 0.875rem;
    color: var(--rudy-text-muted);
    margin-left: 8px;
    display: flex;
    align-items: center;
}
.rudy-breadcrumb a { color: var(--rudy-text-muted); }
.rudy-breadcrumb a:hover { color: var(--rudy-accent); }
.rudy-breadcrumb-sep { margin: 0 8px; color: var(--rudy-text-faint); }
.rudy-breadcrumb-current { color: var(--rudy-text-strong); font-weight: 500; }

.rudy-system-switcher .rudy-switcher-btn {
    background: var(--rudy-accent-soft);
    color: var(--rudy-accent);
    border: 1px solid transparent;
    border-radius: var(--rudy-radius-sm);
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    letter-spacing: 0.3px;
}
.rudy-system-switcher .rudy-switcher-btn:hover {
    background: var(--rudy-accent);
    color: #fff;
}
.rudy-switcher-icon { font-size: 0.7rem; opacity: 0.8; }
.rudy-switcher-menu .dropdown-item.active {
    background: var(--rudy-accent-soft);
    color: var(--rudy-accent);
    font-weight: 600;
}

.rudy-themetoggle {
    background: transparent;
    border: none;
    color: var(--rudy-text);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
}
.rudy-themetoggle:hover { background: var(--rudy-sidebar-bg); }

.rudy-user .rudy-user-btn {
    background: transparent;
    border: none;
    color: var(--rudy-text);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px 4px 10px;
    border-radius: var(--rudy-radius-sm);
    cursor: pointer;
}
.rudy-user .rudy-user-btn:hover { background: var(--rudy-sidebar-bg); }
/* B13: the user dropdown can have 15+ items for admin (TED + RUDY + PLATO +
   Platform + sign out). On short viewports the menu used to overflow off
   the bottom of the page with no scroll, leaving items like "Sign out"
   unreachable. Constrain height and scroll when needed. */
.rudy-topbar-right .dropdown-menu {
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}
.rudy-user-name { font-size: 0.85rem; font-weight: 500; }
.rudy-user-role {
    background: var(--rudy-info);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 11px;
    letter-spacing: 0.6px;
}

/* ---------- Shell layout ---------- */
.rudy-shell {
    display: grid;
    grid-template-columns: var(--rudy-sidebar-w) 1fr 0;
    flex: 1;
    min-height: 0;
    transition: grid-template-columns 0.2s ease;
}

body.rudy-detail-open .rudy-shell {
    grid-template-columns: var(--rudy-sidebar-w) 1fr var(--rudy-detail-w);
}
body.rudy-sidebar-collapsed .rudy-shell {
    grid-template-columns: 0 1fr 0;
}
body.rudy-sidebar-collapsed.rudy-detail-open .rudy-shell {
    grid-template-columns: 0 1fr var(--rudy-detail-w);
}

.rudy-sidebar {
    background: var(--rudy-sidebar-bg);
    border-right: 1px solid var(--rudy-border-soft);
    overflow-y: auto;
    height: 100%;
    transition: transform 0.2s ease;
}
body.rudy-sidebar-collapsed .rudy-sidebar {
    transform: translateX(-100%);
    border-right: none;
}

.rudy-main {
    background: var(--rudy-bg);
    overflow-y: auto;
    height: 100%;
    padding: 22px 28px 32px;
}

.rudy-detail-panel {
    background: var(--rudy-detail-bg);
    border-left: 1px solid var(--rudy-border-soft);
    overflow-y: auto;
    height: 100%;
    transition: transform 0.2s ease;
    transform: translateX(100%);
}
body.rudy-detail-open .rudy-detail-panel {
    transform: translateX(0);
}

.rudy-footer {
    text-align: center;
    color: var(--rudy-text-faint);
    font-size: 0.7rem;
    padding: 6px 0;
    background: var(--rudy-surface);
    border-top: 1px solid var(--rudy-border-soft);
}

/* ---------- Sidebar filter components ---------- */
.rudy-sidebar-inner { padding: 14px 14px 24px; }

.rudy-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--rudy-surface);
    border: 1px solid var(--rudy-border);
    border-radius: var(--rudy-radius-sm);
    padding: 7px 10px;
    margin-bottom: 10px;
}
.rudy-search input {
    border: none;
    outline: none;
    background: transparent;
    flex: 1;
    font-size: 0.85rem;
    color: var(--rudy-text);
}
.rudy-search input::placeholder { color: var(--rudy-text-faint); }
.rudy-search i { color: var(--rudy-text-faint); font-size: 0.9rem; }

.rudy-newsearch {
    width: 100%;
    background: var(--rudy-accent-soft);
    color: var(--rudy-accent);
    border: 1px dashed transparent;
    border-radius: var(--rudy-radius-sm);
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    margin-bottom: 18px;
}
.rudy-newsearch:hover { background: var(--rudy-accent); color: #fff; }

.rudy-filter-group {
    border-bottom: 1px solid var(--rudy-border-soft);
    padding: 12px 0;
}
.rudy-filter-group:last-child { border-bottom: none; }
.rudy-filter-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--rudy-text-strong);
    cursor: pointer;
    user-select: none;
    margin-bottom: 10px;
}
.rudy-filter-group-header i.rudy-fg-icon { color: var(--rudy-warning); }
.rudy-filter-group-header .rudy-fg-chevron {
    margin-left: auto;
    color: var(--rudy-text-faint);
    font-size: 0.75rem;
    transition: transform 0.15s ease;
}
.rudy-filter-group.collapsed .rudy-fg-chevron { transform: rotate(-90deg); }
.rudy-filter-group.collapsed .rudy-filter-group-body { display: none; }

.rudy-filter-group-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-left: 2px;
}
.rudy-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.83rem;
    color: var(--rudy-text);
    cursor: pointer;
}
.rudy-filter-option input { accent-color: var(--rudy-accent); }
.rudy-filter-option:hover { color: var(--rudy-accent); }

/* ---------- Main content components ---------- */
.rudy-page-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--rudy-text-strong);
    margin: 8px 0 14px;
}

.rudy-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.rudy-page-toolbar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.rudy-page-toolbar .rudy-btn {
    font-size: 0.78rem;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.rudy-tabs {
    display: flex;
    gap: 28px;
    border-bottom: 1px solid var(--rudy-border);
    margin-bottom: 14px;
}
.rudy-tab {
    background: transparent;
    border: none;
    padding: 10px 0 12px;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--rudy-text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.rudy-tab:hover { color: var(--rudy-text-strong); }
.rudy-tab.active {
    color: var(--rudy-text-strong);
    font-weight: 600;
    border-bottom-color: var(--rudy-accent);
}

.rudy-result-count {
    font-size: 0.85rem;
    color: var(--rudy-text-muted);
    margin: 6px 0 14px;
}

/* ---------- Cards ---------- */
.rudy-card {
    background: var(--rudy-surface);
    border: 1px solid var(--rudy-border);
    border-radius: var(--rudy-radius);
    box-shadow: var(--rudy-shadow-card);
    padding: 18px 20px;
    margin-bottom: 12px;
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 16px;
    align-items: flex-start;
    cursor: pointer;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.rudy-card:hover {
    box-shadow: var(--rudy-shadow-card-hover);
    border-color: var(--rudy-border-strong);
}
.rudy-card.selected {
    border-color: var(--rudy-accent);
    box-shadow: 0 0 0 1px var(--rudy-accent), var(--rudy-shadow-card-hover);
}

.rudy-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--rudy-sidebar-bg);
    color: var(--rudy-text-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
}
.rudy-avatar.lg { width: 64px; height: 64px; font-size: 1.2rem; }

.rudy-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--rudy-text-strong);
    margin: 0 0 6px;
}
.rudy-card-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.rudy-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--rudy-sidebar-bg);
    color: var(--rudy-text-muted);
    border: 1px solid var(--rudy-border-soft);
    padding: 2px 8px;
    border-radius: 11px;
    font-size: 0.72rem;
    font-weight: 500;
}
.rudy-pill.accent {
    background: var(--rudy-accent-soft);
    color: var(--rudy-accent);
    border-color: transparent;
}
.rudy-pill-partner {
    background: #fff3cd;
    color: #856404;
    border-color: #ffc107;
}
[data-rudy-theme="dark"] body.rudy-app .rudy-pill-partner {
    background: #3a2e00;
    color: #ffd54f;
    border-color: #ffc107;
}
.rudy-pill-year {
    background: #d1e7dd;
    color: #0f5132;
    border-color: #75b798;
    font-weight: 600;
}
[data-rudy-theme="dark"] body.rudy-app .rudy-pill-year {
    background: #0c2e22;
    color: #75dcab;
    border-color: #146c43;
}
.rudy-pill-year-missing {
    background: transparent;
    color: var(--rudy-text-muted);
    border-style: dashed;
    opacity: 0.7;
}
.rudy-tag-select {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 11px;
    border: 1px dashed var(--rudy-border-soft);
    background: var(--rudy-sidebar-bg);
    color: var(--rudy-text-muted);
    cursor: pointer;
    max-width: 150px;
}
.rudy-tag-select.rudy-pill-tagged {
    background: #e0e7ff;
    color: #3730a3;
    border: 1px solid #6366f1;
}
[data-rudy-theme="dark"] .rudy-tag-select.rudy-pill-tagged {
    background: #1e1b4b;
    color: #c7d2fe;
    border-color: #6366f1;
}
.rudy-card-address {
    font-size: 0.82rem;
    color: var(--rudy-text-muted);
    margin-bottom: 6px;
}
.rudy-card-desc {
    font-size: 0.85rem;
    color: var(--rudy-text);
    line-height: 1.5;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.rudy-card-callout {
    background: #fef9e7;
    border-left: 3px solid var(--rudy-warning);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #92670d;
    margin-bottom: 10px;
}
.rudy-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.rudy-card-actions .rudy-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--rudy-accent);
    color: #fff;
    border: none;
    cursor: pointer;
    text-decoration: none;
}
.rudy-card-actions .rudy-action-btn:hover { background: var(--rudy-accent-hover); color: #fff; }
.rudy-card-actions .rudy-social {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--rudy-sidebar-bg);
    color: var(--rudy-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    text-decoration: none;
}
.rudy-card-actions .rudy-social:hover { background: var(--rudy-accent); color: #fff; }
.rudy-card-actions .rudy-email {
    font-size: 0.78rem;
    color: var(--rudy-text-muted);
}

/* ---------- Detail panel ---------- */
.rudy-detail-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--rudy-border-soft);
}
.rudy-detail-title-block {
    flex: 1;
    min-width: 0;
}
.rudy-detail-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--rudy-text-strong);
    margin: 0 0 6px;
    word-wrap: break-word;
}
.rudy-detail-subtabs {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}
.rudy-detail-subtab {
    background: var(--rudy-surface);
    border: 1px solid var(--rudy-border);
    border-radius: 11px;
    font-size: 0.7rem;
    padding: 2px 8px;
    color: var(--rudy-text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.rudy-detail-subtab.active { background: var(--rudy-accent-soft); color: var(--rudy-accent); border-color: transparent; }

.rudy-detail-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.rudy-detail-actions .rudy-icon-btn {
    background: var(--rudy-surface);
    border: 1px solid var(--rudy-border);
    color: var(--rudy-text);
    width: 32px;
    height: 32px;
    border-radius: var(--rudy-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
}
.rudy-detail-actions .rudy-icon-btn:hover { background: var(--rudy-sidebar-bg); }
.rudy-detail-actions .rudy-icon-btn.primary { background: var(--rudy-warning); color: #fff; border-color: var(--rudy-warning); }
.rudy-detail-actions .rudy-icon-btn.primary:hover { background: #d97706; }

.rudy-detail-body { padding: 12px 16px 24px; }
.rudy-detail-section { margin-bottom: 18px; }
.rudy-detail-section-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--rudy-accent);
    letter-spacing: 0.8px;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--rudy-border-soft);
}
.rudy-detail-section p { font-size: 0.85rem; line-height: 1.55; color: var(--rudy-text); margin: 0 0 8px; }
/* Plain <ul> lists in detail sections (address lines etc) */
.rudy-detail-section > ul { padding-left: 0; list-style: none; margin: 0; }
.rudy-detail-section > ul li {
    font-size: 0.83rem;
    color: var(--rudy-text);
    padding-left: 18px;
    position: relative;
    margin-bottom: 4px;
}
.rudy-detail-section > ul li::before {
    content: "📍";
    position: absolute;
    left: 0;
    font-size: 0.85rem;
}

/* Richtext display: rendered HTML from RTE fields — Word-style bullets */
.rudy-richtext-display { font-size: 0.88rem; line-height: 1.65; color: var(--rudy-text); }
.rudy-richtext-display ul,
.rudy-richtext-display ol { margin: 4px 0 4px 0; padding-left: 24px; }
.rudy-richtext-display ul { list-style: disc; }
.rudy-richtext-display ol { list-style: decimal; }
.rudy-richtext-display li { margin-bottom: 2px; }
.rudy-richtext-display a { color: var(--rudy-accent, #1d4ed8); text-decoration: underline; }
.rudy-richtext-display p { margin: 0 0 4px; }

/* Word-style bullets in RTE editor */
.rudy-rte-editor ul { list-style: disc; margin: 4px 0; padding-left: 24px; }
.rudy-rte-editor ol { list-style: decimal; margin: 4px 0; padding-left: 24px; }
.rudy-rte-editor li { margin-bottom: 2px; }

.rudy-detail-section.flush { padding: 0; overflow: hidden; }
.rudy-hero-image {
    display: block;
    width: 100%;
    max-height: 140px;
    object-fit: cover;
}

.rudy-info-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.rudy-info-chip {
    background: var(--rudy-surface);
    border: 1px solid var(--rudy-border);
    border-radius: var(--rudy-radius-sm);
    padding: 6px 12px;
    display: inline-flex;
    flex-direction: column;
    min-width: 84px;
}
.rudy-info-chip .lbl {
    font-size: 0.65rem;
    color: var(--rudy-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.rudy-info-chip .val {
    font-size: 1rem;
    font-weight: 700;
    color: var(--rudy-text-strong);
}

.rudy-fun-fact {
    background: #fef3c7;
    border-left: 3px solid var(--rudy-warning);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #92670d;
    line-height: 1.5;
}

.rudy-prog-link {
    padding: 8px 6px;
    border-bottom: 1px solid var(--rudy-border-soft);
    cursor: pointer;
    border-radius: var(--rudy-radius-sm);
    transition: background 0.12s ease;
}
.rudy-prog-link:hover { background: var(--rudy-sidebar-bg); }
.rudy-prog-link:last-child { border-bottom: none; }
.rudy-prog-link-name {
    font-weight: 600;
    font-size: 0.86rem;
    color: var(--rudy-accent);
}
.rudy-prog-link-meta {
    font-size: 0.75rem;
    color: var(--rudy-text-muted);
    margin-top: 2px;
}

/* ---------- Card hover action buttons ---------- */
.rudy-card { position: relative; }
.rudy-card-quick-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.rudy-card:hover .rudy-card-quick-actions { opacity: 1; }
.rudy-card-quick-actions .rudy-icon-btn {
    background: var(--rudy-surface);
    border: 1px solid var(--rudy-border);
    color: var(--rudy-text);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0;
}
.rudy-card-quick-actions .rudy-icon-btn:hover { background: var(--rudy-sidebar-bg); }
.rudy-card-quick-actions .rudy-icon-btn.danger { color: var(--rudy-danger); border-color: #fca5a5; }
.rudy-card-quick-actions .rudy-icon-btn.danger:hover { background: #fee2e2; }
.rudy-card-quick-actions .rudy-icon-btn.warning { color: #b45309; border-color: #fcd34d; }
.rudy-card-quick-actions .rudy-icon-btn.warning:hover { background: #fef3c7; }
.rudy-card-quick-actions .rudy-icon-btn.purple { color: #6d28d9; border-color: #c4b5fd; }
.rudy-card-quick-actions .rudy-icon-btn.purple:hover { background: #ede9fe; }

/* Pending edit / assigned badges on cards */
.rudy-card-badges {
    position: absolute;
    top: 12px;
    right: 90px;
    display: flex;
    gap: 4px;
}
.rudy-pending-badge {
    background: #fef3c7;
    color: #92670d;
    border: 1px solid #fcd34d;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    letter-spacing: 0.3px;
}
.rudy-assigned-badge {
    background: #ede9fe;
    color: #5b21b6;
    border: 1px solid #c4b5fd;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    letter-spacing: 0.3px;
}

/* ---------- Edit form inside detail panel ---------- */
.rudy-edit-form .form-group { margin-bottom: 12px; }
.rudy-edit-form label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--rudy-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}
.rudy-edit-form input,
.rudy-edit-form select,
.rudy-edit-form textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--rudy-border);
    border-radius: var(--rudy-radius-sm);
    background: var(--rudy-surface);
    color: var(--rudy-text);
    font-size: 0.85rem;
    font-family: inherit;
}
.rudy-edit-form textarea { resize: vertical; min-height: 60px; }
.rudy-edit-form input:focus,
.rudy-edit-form select:focus,
.rudy-edit-form textarea:focus {
    outline: none;
    border-color: var(--rudy-accent);
    box-shadow: 0 0 0 3px var(--rudy-accent-soft);
}
.rudy-form-actions {
    position: sticky;
    bottom: 0;
    background: var(--rudy-detail-bg);
    border-top: 1px solid var(--rudy-border);
    padding: 12px 16px;
    margin: 16px -16px -24px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.rudy-btn {
    padding: 7px 16px;
    border-radius: var(--rudy-radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
}
.rudy-btn-primary { background: var(--rudy-accent); color: #fff; }
.rudy-btn-primary:hover { background: var(--rudy-accent-hover); }
.rudy-btn-secondary { background: var(--rudy-surface); color: var(--rudy-text); border-color: var(--rudy-border); }
.rudy-btn-secondary:hover { background: var(--rudy-sidebar-bg); }
.rudy-btn-danger { background: var(--rudy-danger); color: #fff; }
.rudy-btn-danger:hover { background: #dc2626; }

/* History list */
.rudy-history-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--rudy-border-soft);
    font-size: 0.83rem;
}
.rudy-history-item:last-child { border-bottom: none; }
.rudy-history-meta {
    color: var(--rudy-text-muted);
    font-size: 0.72rem;
    margin-bottom: 4px;
}
.rudy-history-changes {
    background: var(--rudy-surface);
    border: 1px solid var(--rudy-border-soft);
    border-radius: 4px;
    padding: 6px 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.7rem;
    color: var(--rudy-text-muted);
    margin-top: 4px;
    white-space: pre-wrap;
    max-height: 80px;
    overflow-y: auto;
}

/* Notifications bell */
.rudy-bell {
    position: relative;
    background: transparent;
    border: none;
    color: var(--rudy-text);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.rudy-bell:hover { background: var(--rudy-sidebar-bg); }
.rudy-bell-dot {
    position: absolute;
    top: 4px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--rudy-danger);
    border-radius: 50%;
    border: 2px solid var(--rudy-surface);
    display: none;
}
.rudy-bell.has-new .rudy-bell-dot { display: block; }
.rudy-bell-menu {
    width: 360px;
    max-height: 480px;
    overflow-y: auto;
    padding: 0;
}
.rudy-bell-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--rudy-border-soft);
    font-size: 0.82rem;
    cursor: pointer;
}
.rudy-bell-item:hover { background: var(--rudy-sidebar-bg); }
.rudy-bell-item:last-child { border-bottom: none; }
.rudy-bell-item .meta { font-size: 0.7rem; color: var(--rudy-text-muted); }
.rudy-bell-empty {
    padding: 20px;
    text-align: center;
    color: var(--rudy-text-muted);
    font-size: 0.85rem;
}

/* Modal customisation for upload + assign */
.rudy-modal-form-group { margin-bottom: 12px; }
.rudy-modal-form-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--rudy-text-muted);
    margin-bottom: 4px;
    display: block;
}
.rudy-modal-form-group input[type="file"] {
    display: block;
    width: 100%;
    padding: 6px;
    border: 1px dashed var(--rudy-border-strong);
    border-radius: 6px;
    background: var(--rudy-bg);
}

/* Programme exam-requirements editor */
.rudy-exam-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}
.rudy-exam-tab {
    background: var(--rudy-surface);
    border: 1px solid var(--rudy-border);
    border-radius: 14px;
    padding: 5px 14px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--rudy-text-muted);
    cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
}
.rudy-exam-tab:hover { background: var(--rudy-accent-soft, #eaf1fb); color: var(--rudy-accent, #1d4ed8); border-color: var(--rudy-accent, #1d4ed8); }
.rudy-exam-tab.active {
    background: var(--rudy-accent);
    color: #fff;
    border-color: transparent;
}

/* Image upload preview */
.rudy-upload-preview {
    width: 100%;
    max-height: 140px;
    object-fit: cover;
    border-radius: 6px;
    margin-top: 8px;
}

/* System chooser cards (post-login) */
.rudy-system-card {
    display: block;
    background: var(--rudy-surface);
    border: 1px solid var(--rudy-border);
    border-radius: var(--rudy-radius);
    padding: 28px 24px 20px;
    color: var(--rudy-text);
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    height: 100%;
    box-shadow: var(--rudy-shadow-card);
}
.rudy-system-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--rudy-shadow-card-hover);
    border-color: var(--rudy-accent);
    color: var(--rudy-text);
}
.rudy-system-card-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 11px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    margin-bottom: 12px;
}
.rudy-system-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--rudy-text-strong);
    margin: 0 0 6px;
}
.rudy-system-card-cta {
    margin-top: 14px;
    color: var(--rudy-accent);
    font-weight: 600;
    font-size: 0.9rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
    .rudy-shell { grid-template-columns: 1fr !important; }
    .rudy-sidebar,
    .rudy-detail-panel {
        position: fixed;
        top: var(--rudy-topbar-h);
        bottom: 0;
        z-index: 1020;
        width: 280px;
    }
    .rudy-sidebar { left: 0; }
    .rudy-detail-panel { right: 0; width: min(420px, 92vw); }
    .rudy-breadcrumb { display: none; }
    .rudy-user-name { display: none; }
}

/* ---------- Legacy components (kept until pages migrate in step 3) ---------- */
#programmes-table th { font-size: 0.85rem; }
#programmes-table td { font-size: 0.85rem; vertical-align: middle; }
#programmes-table .badge { font-size: 0.7rem; }

.pending-card {
    border-left: 4px solid var(--rudy-warning);
    margin-bottom: 12px;
}
.pending-card.action-add { border-left-color: var(--rudy-success); }
.pending-card.action-edit { border-left-color: #17a2b8; }
.pending-card.action-delete { border-left-color: var(--rudy-danger); }

.uni-card { transition: box-shadow 0.15s; }
.uni-card:hover { box-shadow: var(--rudy-shadow-card-hover); }
.uni-logo { max-height: 60px; max-width: 80px; object-fit: contain; }

.consultant-group { margin-bottom: 1.5rem; }
.consultant-group h5 { color: var(--rudy-accent); }

.filter-chip {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    background: var(--rudy-accent-soft);
    color: var(--rudy-accent);
    margin: 2px;
}

/* Programme selection (mark for report) */
.rudy-card-selected {
    border-color: var(--rudy-accent) !important;
    box-shadow: 0 0 0 2px var(--rudy-accent-soft), 0 2px 12px rgba(13,110,253,.15) !important;
}
.rudy-card-selected::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--rudy-accent);
    border-radius: 12px 0 0 12px;
}
.rudy-mark-btn { color: #6b7280; border-color: #d1d5db; }
.rudy-mark-btn:hover { color: var(--rudy-accent); border-color: var(--rudy-accent); }
.rudy-mark-btn.active { color: var(--rudy-accent); background: var(--rudy-accent-soft); border-color: var(--rudy-accent); }

/* Inline filter search input (genre / major) */
.rudy-filter-search {
    width: 100%; box-sizing: border-box;
    padding: 5px 8px; margin-bottom: 6px;
    border: 1px solid var(--rudy-border, #e5e7eb);
    border-radius: var(--rudy-radius-sm, 6px);
    font-size: .8rem; background: var(--rudy-surface, #fff);
    color: var(--rudy-text, #1f2933);
}
.rudy-filter-search:focus {
    outline: none;
    border-color: var(--rudy-accent, #1d4ed8);
    box-shadow: 0 0 0 2px var(--rudy-accent-soft, #eaf1fb);
}

/* Major subject suggestion dropdown */
.rudy-major-suggestions {
    position: absolute; left: 0; right: 0; z-index: 200;
    background: var(--rudy-surface, #fff);
    border: 1px solid var(--rudy-border, #e5e7eb);
    border-radius: var(--rudy-radius-sm, 6px);
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    max-height: 200px; overflow-y: auto;
    margin-top: -2px;
}
.rudy-major-suggest-item {
    padding: 7px 10px; cursor: pointer; font-size: .8rem;
    border-bottom: 1px solid var(--rudy-border-soft, #eef0f2);
}
.rudy-major-suggest-item:last-child { border-bottom: none; }
.rudy-major-suggest-item:hover { background: var(--rudy-accent-soft, #eaf1fb); color: var(--rudy-accent, #1d4ed8); }

/* University picker */
.rudy-uni-picker { position: relative; }
.rudy-uni-picker-input-row { display: flex; gap: 6px; }
.rudy-uni-picker-input-row input[type="text"] { flex: 1; min-width: 0; }
.rudy-uni-picker-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 200;
    background: var(--rudy-surface, #fff);
    border: 1px solid var(--rudy-border, #e5e7eb);
    border-radius: var(--rudy-radius-sm, 6px);
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    max-height: 220px; overflow-y: auto; margin-top: 2px;
}
.rudy-uni-picker-item {
    padding: 8px 12px; cursor: pointer; font-size: .875rem;
    border-bottom: 1px solid var(--rudy-border-soft, #eef0f2);
}
.rudy-uni-picker-item:last-child { border-bottom: none; }
.rudy-uni-picker-item:hover { background: var(--rudy-accent-soft, #eaf1fb); color: var(--rudy-accent, #1d4ed8); }
.rudy-uni-picker-add-form {
    border: 1px solid var(--rudy-border, #e5e7eb);
    border-radius: var(--rudy-radius-sm, 6px);
    padding: 12px; margin-top: 8px;
    background: var(--rudy-sidebar-bg, #f6f8fa);
}
.rudy-form-error { color: var(--rudy-danger, #ef4444); font-size: .8rem; margin-top: 4px; }

/* Extra-small button (Bootstrap 5 dropped btn-xs) */
.btn-xs { padding: .15rem .45rem; font-size: .75rem; border-radius: .2rem; line-height: 1.4; }

/* Change history diff table */
.rudy-diff-table { width: 100%; border-collapse: collapse; font-size: .72rem; margin-top: 4px; }
.rudy-diff-table th { font-size: .65rem; text-transform: uppercase; letter-spacing: .04em; color: var(--rudy-text-muted); padding: 2px 6px; border-bottom: 1px solid var(--rudy-border-soft); }
.rudy-diff-table td { padding: 2px 6px; vertical-align: top; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rudy-diff-field { color: var(--rudy-text-muted); font-style: italic; }
.rudy-diff-old { color: #dc2626; text-decoration: line-through; opacity: .75; }
.rudy-diff-new { color: #16a34a; font-weight: 600; }
.rudy-diff-summary { color: var(--rudy-text-muted); font-style: italic; padding: 3px 0; font-size: .75rem; }
[data-rudy-theme="dark"] .rudy-diff-old { color: #fca5a5; }
[data-rudy-theme="dark"] .rudy-diff-new { color: #86efac; }

/* History action badge in detail panel */
.rudy-history-action { display: inline-block; font-size: .65rem; font-weight: 700; text-transform: uppercase;
    padding: 1px 6px; border-radius: 10px; }
.rudy-history-action--created, .rudy-history-action--create { background: #dcfce7; color: #15803d; }
.rudy-history-action--updated, .rudy-history-action--update { background: #dbeafe; color: #1d4ed8; }
.rudy-history-action--deleted, .rudy-history-action--delete { background: #fee2e2; color: #dc2626; }
.rudy-history-action--approved { background: #fef9c3; color: #a16207; }
.rudy-history-action--merged { background: #ede9fe; color: #6d28d9; }
[data-rudy-theme="dark"] .rudy-history-action--created,
[data-rudy-theme="dark"] .rudy-history-action--create { background: rgba(21,128,61,.25); color: #86efac; }
[data-rudy-theme="dark"] .rudy-history-action--updated,
[data-rudy-theme="dark"] .rudy-history-action--update { background: rgba(29,78,216,.25); color: #93c5fd; }
[data-rudy-theme="dark"] .rudy-history-action--deleted,
[data-rudy-theme="dark"] .rudy-history-action--delete { background: rgba(220,38,38,.25); color: #fca5a5; }

/* Platform RUDY history inline diff */
.rh-field { color: var(--rudy-text-muted); font-style: italic; font-size: .75rem; }
.rh-old { color: #dc2626; text-decoration: line-through; font-size: .75rem; }
.rh-new { color: #16a34a; font-weight: 600; font-size: .75rem; }
[data-rudy-theme="dark"] .rh-old { color: #fca5a5; }
[data-rudy-theme="dark"] .rh-new { color: #86efac; }

/* Layout editor drag-and-drop */
.layout-drag-handle { cursor: grab; font-size: 1.1rem; }
.layout-drag-over { border-top: 3px solid var(--rudy-accent, #1d4ed8) !important; background: var(--rudy-accent-soft, #eaf1fb) !important; }
[data-rudy-theme="dark"] .layout-drag-over { background: rgba(29,78,216,.15) !important; }

/* ---------- Full-screen edit modal ---------- */
/* ============================================================
   Full-screen edit modal
   ============================================================ */
.rudy-edit-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1060;
    background: rgba(10,15,30,.6);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 32px 20px 48px;
}
.rudy-edit-modal-dialog {
    background: var(--rudy-bg, #fff);
    border: 1px solid var(--rudy-border, #e2e6ea);
    border-radius: 16px;
    width: 100%;
    max-width: 1120px;
    min-height: 500px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25), 0 4px 12px rgba(0,0,0,.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
[data-rudy-theme="dark"] .rudy-edit-modal-dialog {
    background: var(--rudy-bg, #15181c);
    border-color: var(--rudy-border, #2a3040);
    box-shadow: 0 20px 60px rgba(0,0,0,.55);
}

/* Header */
.rudy-edit-modal-dialog .rudy-detail-header {
    border-radius: 16px 16px 0 0;
    padding: 18px 28px 16px;
    background: var(--rudy-surface, #f9fafb);
    border-bottom: 1px solid var(--rudy-border-soft, #eef0f2);
    flex-shrink: 0;
}
[data-rudy-theme="dark"] .rudy-edit-modal-dialog .rudy-detail-header {
    background: var(--rudy-surface, #1a1f27);
}

/* Modal content wrapper must be flex so the body can scroll within the dialog */
#rudy-edit-modal-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Scrollable body */
.rudy-edit-modal-dialog .rudy-detail-body {
    padding: 24px 32px 36px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Section dividers */
.rudy-edit-modal-dialog .rudy-detail-section {
    border-top: 1px solid var(--rudy-border-soft, #eef0f2);
    padding-top: 24px;
    margin-top: 24px;
}
.rudy-edit-modal-dialog .rudy-detail-section:first-child { border-top: none; padding-top: 0; margin-top: 0; }

/* Section headers in modal — slightly larger, with left accent bar */
.rudy-edit-modal-dialog .rudy-detail-section-header {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.9px;
    color: var(--rudy-accent, #1d4ed8);
    margin-bottom: 16px;
    padding: 0 0 8px 10px;
    border-bottom: 1px solid var(--rudy-border-soft, #eef0f2);
    border-left: 3px solid var(--rudy-accent, #1d4ed8);
}

/* ---- Two-column form grid ---- */
.rudy-edit-modal-dialog .rudy-edit-form .rudy-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 24px;
}
.rudy-edit-modal-dialog .rudy-edit-form .rudy-form-grid .form-group {
    margin-bottom: 14px;
}
.rudy-edit-modal-dialog .rudy-edit-form .rudy-form-grid .form-group.full-width,
.rudy-edit-modal-dialog .rudy-edit-form .rudy-form-grid [data-field-type="richtext"],
.rudy-edit-modal-dialog .rudy-edit-form .rudy-form-grid [data-field-type="textarea"],
.rudy-edit-modal-dialog .rudy-edit-form .rudy-form-grid [data-field-type="university-picker"] {
    grid-column: 1 / -1;
}

/* Labels */
.rudy-edit-modal-dialog .form-group label {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--rudy-text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
    display: block;
}

/* Inputs, selects */
.rudy-edit-modal-dialog .form-group input[type="text"],
.rudy-edit-modal-dialog .form-group input[type="date"],
.rudy-edit-modal-dialog .form-group input[type="number"],
.rudy-edit-modal-dialog .form-group select {
    height: 42px;
    font-size: 0.9rem;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--rudy-border, #d1d5db);
    background: var(--rudy-surface, #fff);
    color: var(--rudy-text, #111827);
    width: 100%;
    transition: border-color .15s, box-shadow .15s;
}
.rudy-edit-modal-dialog .form-group input[type="text"]:focus,
.rudy-edit-modal-dialog .form-group input[type="date"]:focus,
.rudy-edit-modal-dialog .form-group input[type="number"]:focus,
.rudy-edit-modal-dialog .form-group select:focus {
    outline: none;
    border-color: var(--rudy-accent, #1d4ed8);
    box-shadow: 0 0 0 3px var(--rudy-accent-soft, rgba(29,78,216,.12));
}
[data-rudy-theme="dark"] .rudy-edit-modal-dialog .form-group input,
[data-rudy-theme="dark"] .rudy-edit-modal-dialog .form-group select {
    background: var(--rudy-surface, #1f2429);
    border-color: var(--rudy-border, #2f3640);
    color: var(--rudy-text, #e2e8f0);
}

/* Textareas */
.rudy-edit-modal-dialog .form-group textarea {
    min-height: 90px;
    font-size: 0.9rem;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--rudy-border, #d1d5db);
    resize: vertical;
    width: 100%;
    transition: border-color .15s, box-shadow .15s;
}
.rudy-edit-modal-dialog .form-group textarea:focus {
    outline: none;
    border-color: var(--rudy-accent, #1d4ed8);
    box-shadow: 0 0 0 3px var(--rudy-accent-soft, rgba(29,78,216,.12));
}

/* Save / action bar */
.rudy-edit-modal-dialog .rudy-form-actions {
    padding: 16px 0 0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid var(--rudy-border-soft, #eef0f2);
    margin-top: 4px;
}

/* ---- Qual section: tabs + form side-by-side on large screens ---- */
@media (min-width: 800px) {
}

/* ---------- Rich-text toolbar ---------- */
.rudy-rte-wrap { position: relative; }
.rudy-rte-toolbar {
    display: flex;
    gap: 2px;
    padding: 5px 8px;
    background: var(--rudy-surface, #f8f9fa);
    border: 1px solid var(--rudy-border, #e5e7eb);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    flex-wrap: wrap;
}
.rudy-rte-toolbar button {
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 2px 7px;
    font-size: .8rem;
    cursor: pointer;
    color: var(--rudy-text, #1a202c);
    line-height: 1.5;
    transition: background .12s;
}
.rudy-rte-toolbar button:hover { background: var(--rudy-accent-soft, #eaf1fb); border-color: var(--rudy-border, #e5e7eb); }
.rudy-rte-toolbar button.active { background: var(--rudy-accent-soft, #eaf1fb); border-color: var(--rudy-accent, #1d4ed8); color: var(--rudy-accent, #1d4ed8); }
.rudy-rte-toolbar .rte-sep { width: 1px; background: var(--rudy-border, #e5e7eb); margin: 2px 4px; }
[data-rudy-theme="dark"] .rudy-rte-toolbar { background: var(--rudy-surface, #1f2429); border-color: var(--rudy-border, #2f3640); }
[data-rudy-theme="dark"] .rudy-rte-toolbar button { color: var(--rudy-text, #e2e8f0); }

.rudy-rte-editor {
    min-height: 90px;
    padding: 10px 12px;
    border: 1px solid var(--rudy-border, #e5e7eb);
    border-radius: 0 0 10px 10px;
    background: var(--rudy-bg, #fff);
    color: var(--rudy-text, #1a202c);
    font-size: .9rem;
    line-height: 1.6;
    outline: none;
    overflow-y: auto;
    transition: border-color .15s, box-shadow .15s;
}
.rudy-rte-editor:focus { border-color: var(--rudy-accent, #1d4ed8); box-shadow: 0 0 0 2px rgba(29,78,216,.12); }
[data-rudy-theme="dark"] .rudy-rte-editor { background: var(--rudy-surface, #1f2429); border-color: var(--rudy-border, #2f3640); color: var(--rudy-text, #e2e8f0); }
.rudy-rte-editor ul { margin: 4px 0; padding-left: 22px; }
.rudy-rte-editor a { color: var(--rudy-accent, #1d4ed8); text-decoration: underline; }
/* Link input row */
.rudy-rte-link-row {
    display: none;
    gap: 6px;
    align-items: center;
    padding: 4px 6px;
    background: var(--rudy-surface, #f8f9fa);
    border: 1px solid var(--rudy-border, #e5e7eb);
    border-top: none;
}
.rudy-rte-link-row input {
    flex: 1;
    border: 1px solid var(--rudy-border, #e5e7eb);
    border-radius: 4px;
    padding: 3px 8px;
    font-size: .8rem;
    background: var(--rudy-bg, #fff);
    color: var(--rudy-text, #1a202c);
}
.rudy-rte-link-row button {
    padding: 3px 10px;
    font-size: .8rem;
    border-radius: 4px;
    border: 1px solid var(--rudy-border, #e5e7eb);
    background: var(--rudy-accent-soft, #eaf1fb);
    color: var(--rudy-accent, #1d4ed8);
    cursor: pointer;
}
