/* ═══════════════════════════════════════════════════════════════
   EduSaaS Dashboard — dashboard.css
   Modern green-themed SaaS-style learning platform
═══════════════════════════════════════════════════════════════ */

/* ── Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Outfit:wght@600;700;800&display=swap');

/* ── Variables ── */
:root {
    --esd-green-50:   #f0fdf4;
    --esd-green-100:  #dcfce7;
    --esd-green-200:  #bbf7d0;
    --esd-green-400:  #4ade80;
    --esd-green-500:  #22c55e;
    --esd-green-600:  #16a34a;
    --esd-green-700:  #15803d;
    --esd-green-800:  #166534;
    --esd-green-900:  #14532d;

    --esd-sidebar-bg:    #0b1e12;
    --esd-sidebar-w:     256px;
    --esd-topbar-h:      60px;

    --esd-bg:        #f4f7f5;
    --esd-surface:   #ffffff;
    --esd-border:    #e5ede8;

    --esd-text-1:    #111827;
    --esd-text-2:    #374151;
    --esd-text-3:    #6b7280;
    --esd-text-4:    #9ca3af;

    --esd-blue-500:   #3b82f6;
    --esd-blue-100:   #dbeafe;
    --esd-amber-500:  #f59e0b;
    --esd-amber-100:  #fef3c7;
    --esd-purple-500: #8b5cf6;
    --esd-purple-100: #ede9fe;
    --esd-red-500:    #ef4444;
    --esd-red-100:    #fee2e2;

    --esd-shadow-sm:  0 1px 2px rgba(0,0,0,0.05);
    --esd-shadow:     0 2px 8px rgba(0,0,0,0.08);
    --esd-shadow-md:  0 4px 16px rgba(0,0,0,0.10);
    --esd-radius-sm:  8px;
    --esd-radius:     12px;
    --esd-radius-lg:  16px;

    --esd-font-ui:    'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --esd-font-head:  'Outfit', 'DM Sans', sans-serif;

    --esd-transition: 200ms cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset & base ── */
.esd-body *,
.esd-body *::before,
.esd-body *::after {
    box-sizing: border-box;
}

.esd-body {
    margin: 0;
    padding: 0;
    font-family: var(--esd-font-ui);
    font-size: 14px;
    color: var(--esd-text-1);
    background: var(--esd-bg);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Hide the default WP admin bar and theme elements */
.esd-body #wpadminbar,
.esd-body .site-header,
.esd-body .site-footer,
.esd-body .wp-block-template-part {
    display: none !important;
}

.esd-body.admin-bar { margin-top: 0 !important; }
.esd-body.admin-bar .esd-sidebar { top: 0; }

/* ═══════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════ */

.esd-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--esd-sidebar-w);
    height: 100vh;
    background: var(--esd-sidebar-bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 100;
    transition: transform var(--esd-transition);
}

/* Brand */
.esd-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.esd-brand__logo {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--esd-green-500), var(--esd-green-700));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(34,197,94,0.25);
}

.esd-brand__name {
    display: block;
    font-family: var(--esd-font-head);
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.esd-brand__tagline {
    display: block;
    font-size: 10px;
    font-weight: 500;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 2px;
}

/* Navigation */
.esd-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.esd-nav__section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.28);
    padding: 14px 8px 6px;
    text-transform: uppercase;
}

.esd-nav__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--esd-transition);
    margin-bottom: 2px;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

.esd-nav__item:hover {
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.85);
}

.esd-nav__item.is-active {
    background: rgba(34,197,94,0.14);
    color: var(--esd-green-400);
}

.esd-nav__item.is-active .esd-nav__icon {
    color: var(--esd-green-400);
}

.esd-nav__icon {
    color: rgba(255,255,255,0.4);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    transition: color var(--esd-transition);
}

/* Sidebar footer */
.esd-sidebar-footer {
    padding: 10px 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 4px;
}

.esd-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    flex: 1;
    min-width: 0;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--esd-transition), box-shadow var(--esd-transition);
}

.esd-user-card:hover {
    background: rgba(255,255,255,0.09);
}

.esd-user-card.is-active {
    background: rgba(34,197,94,0.12);
    box-shadow: inset 0 0 0 1px rgba(34,197,94,0.25);
}

.esd-user-card__avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(34,197,94,0.3);
}

.esd-user-card__info {
    flex: 1;
    min-width: 0;
}

.esd-user-card__name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.esd-user-card__role {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,0.35);
    margin-top: 1px;
}

.esd-logout-btn {
    color: rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    text-decoration: none;
    padding: 4px;
    border-radius: 6px;
    transition: all var(--esd-transition);
}

.esd-logout-btn:hover {
    color: var(--esd-red-500);
    background: rgba(239,68,68,0.1);
}

/* ═══════════════════════════════════════════════
   MAIN AREA
═══════════════════════════════════════════════ */

.esd-main {
    margin-left: var(--esd-sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--esd-transition);
}

/* Top bar */
.esd-topbar {
    height: var(--esd-topbar-h);
    background: var(--esd-surface);
    border-bottom: 1px solid var(--esd-border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--esd-shadow-sm);
}

.esd-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: var(--esd-text-2);
    cursor: pointer;
    border-radius: 6px;
    transition: all var(--esd-transition);
    padding: 0;
}

.esd-menu-toggle:hover { background: var(--esd-green-50); color: var(--esd-green-600); }

.esd-topbar__breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.esd-topbar__site {
    font-size: 13px;
    color: var(--esd-text-3);
}

.esd-topbar__sep {
    color: var(--esd-text-4);
    font-size: 13px;
}

.esd-topbar__page {
    font-size: 14px;
    font-weight: 600;
    color: var(--esd-text-1);
}

.esd-topbar__greeting {
    font-size: 13px;
    color: var(--esd-text-3);
    font-weight: 500;
}

/* Content */
.esd-content {
    flex: 1;
    overflow-y: auto;
}

.esd-content-inner {
    padding: 28px 32px 48px;
    max-width: 1200px;
}

/* ── Loading overlay ── */
.esd-content-inner.is-loading {
    pointer-events: none;
    opacity: 0.5;
}

/* ═══════════════════════════════════════════════
   PAGE HEADER
═══════════════════════════════════════════════ */

.esd-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.esd-page-title {
    font-family: var(--esd-font-head);
    font-size: 26px;
    font-weight: 700;
    color: var(--esd-text-1);
    margin: 0 0 4px;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.esd-page-subtitle {
    font-size: 14px;
    color: var(--esd-text-3);
    margin: 0;
    line-height: 1.5;
}

.esd-date-badge {
    font-size: 12px;
    font-weight: 500;
    color: var(--esd-green-700);
    background: var(--esd-green-50);
    border: 1px solid var(--esd-green-200);
    padding: 4px 12px;
    border-radius: 20px;
}

/* ═══════════════════════════════════════════════
   STATS STRIP
═══════════════════════════════════════════════ */

.esd-stats-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}

.esd-stats-strip--compact {
    grid-template-columns: repeat(3, 1fr);
    max-width: 600px;
}

.esd-stat-pill {
    background: var(--esd-surface);
    border: 1px solid var(--esd-border);
    border-radius: var(--esd-radius);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--esd-shadow-sm);
    transition: box-shadow var(--esd-transition);
}

.esd-stat-pill:hover {
    box-shadow: var(--esd-shadow);
}

.esd-stat-pill__icon {
    font-size: 22px;
    line-height: 1;
}

.esd-stat-pill__val {
    display: block;
    font-family: var(--esd-font-head);
    font-size: 20px;
    font-weight: 700;
    color: var(--esd-text-1);
    line-height: 1.1;
}

.esd-stat-pill__lbl {
    display: block;
    font-size: 11px;
    color: var(--esd-text-3);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
}

/* ═══════════════════════════════════════════════
   MODULE CARDS GRID
═══════════════════════════════════════════════ */

.esd-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.esd-section-title {
    font-family: var(--esd-font-head);
    font-size: 17px;
    font-weight: 700;
    color: var(--esd-text-1);
    margin: 0;
}

.esd-module-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.esd-module-card {
    background: var(--esd-surface);
    border: 1px solid var(--esd-border);
    border-radius: var(--esd-radius-lg);
    padding: 20px;
    box-shadow: var(--esd-shadow-sm);
    transition: all var(--esd-transition);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.esd-module-card:hover {
    box-shadow: var(--esd-shadow-md);
    border-color: var(--esd-green-200);
    transform: translateY(-1px);
}

.esd-module-card--blue:hover  { border-color: #bfdbfe; }
.esd-module-card--amber:hover { border-color: #fde68a; }
.esd-module-card--purple:hover{ border-color: #ddd6fe; }

.esd-module-card__header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.esd-module-card__icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.esd-module-card__title {
    font-family: var(--esd-font-head);
    font-size: 16px;
    font-weight: 700;
    color: var(--esd-text-1);
    margin: 0 0 3px;
    letter-spacing: -0.01em;
}

.esd-module-card__desc {
    font-size: 12.5px;
    color: var(--esd-text-3);
    margin: 0;
    line-height: 1.4;
}

.esd-module-card__stats {
    display: flex;
    gap: 24px;
}

.esd-module-card__stat-val {
    display: block;
    font-family: var(--esd-font-head);
    font-size: 19px;
    font-weight: 700;
    color: var(--esd-text-1);
    line-height: 1.1;
}

.esd-module-card__stat-lbl {
    display: block;
    font-size: 11px;
    color: var(--esd-text-4);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
}

.esd-module-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.esd-module-card__pct {
    font-size: 12px;
    color: var(--esd-text-3);
}

.esd-btn-link {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--esd-green-600);
    text-decoration: none;
    transition: color var(--esd-transition);
}

.esd-btn-link:hover { color: var(--esd-green-700); }

/* ═══════════════════════════════════════════════
   PROGRESS BARS
═══════════════════════════════════════════════ */

.esd-progress-bar {
    height: 6px;
    background: var(--esd-green-100);
    border-radius: 99px;
    overflow: hidden;
}

.esd-progress-bar--lg {
    height: 10px;
}

.esd-progress-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--esd-green-400), var(--esd-green-600));
    border-radius: 99px;
    transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

.esd-progress-bar__fill--amber {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.esd-progress-bar__fill--purple {
    background: linear-gradient(90deg, #a78bfa, #8b5cf6);
}

.esd-progress-bar__fill--blue {
    background: linear-gradient(90deg, #60a5fa, #3b82f6);
}

/* ═══════════════════════════════════════════════
   CARDS
═══════════════════════════════════════════════ */

.esd-card {
    background: var(--esd-surface);
    border: 1px solid var(--esd-border);
    border-radius: var(--esd-radius-lg);
    box-shadow: var(--esd-shadow-sm);
    overflow: hidden;
}

.esd-card--flush .esd-module-frame { border-radius: 0; padding: 0; }

.esd-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--esd-border);
    gap: 12px;
    flex-wrap: wrap;
}

.esd-card__title {
    font-family: var(--esd-font-head);
    font-size: 15px;
    font-weight: 700;
    color: var(--esd-text-1);
    margin: 0;
}

.esd-card__sub {
    font-size: 12px;
    color: var(--esd-text-3);
    margin: 2px 0 0;
}

/* ═══════════════════════════════════════════════
   TWO COLUMN LAYOUT
═══════════════════════════════════════════════ */

.esd-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 0;
}

/* ═══════════════════════════════════════════════
   ACTIVITY LIST
═══════════════════════════════════════════════ */

.esd-activity-list {
    padding: 4px 0;
}

.esd-activity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--esd-green-50);
    transition: background var(--esd-transition);
}

.esd-activity-item:last-child { border-bottom: none; }
.esd-activity-item:hover { background: var(--esd-green-50); }

.esd-activity-item__icon {
    font-size: 16px;
    flex-shrink: 0;
}

.esd-activity-item__body {
    flex: 1;
    min-width: 0;
}

.esd-activity-item__detail {
    font-size: 13px;
    color: var(--esd-text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.esd-activity-item__time {
    font-size: 11px;
    color: var(--esd-text-4);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════
   QUICK LAUNCH
═══════════════════════════════════════════════ */

.esd-quick-launch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 16px;
}

.esd-quick-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--esd-radius-sm);
    background: var(--esd-green-50);
    border: 1px solid var(--esd-green-100);
    color: var(--esd-green-700);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--esd-transition);
    cursor: pointer;
}

.esd-quick-btn:hover {
    background: var(--esd-green-100);
    border-color: var(--esd-green-200);
    color: var(--esd-green-800);
    transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════
   TABS
═══════════════════════════════════════════════ */

.esd-tabs {
    display: flex;
    gap: 2px;
    background: var(--esd-surface);
    border: 1px solid var(--esd-border);
    border-radius: var(--esd-radius);
    padding: 4px;
    margin-bottom: 16px;
    width: fit-content;
}

.esd-tab {
    padding: 8px 18px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--esd-text-3);
    cursor: pointer;
    transition: all var(--esd-transition);
}

.esd-tab:hover { color: var(--esd-text-1); background: var(--esd-green-50); }

.esd-tab.is-active {
    background: var(--esd-green-600);
    color: white;
    font-weight: 600;
}

.esd-tab-panel { display: none; }
.esd-tab-panel.is-active { display: block; }

/* ═══════════════════════════════════════════════
   MODULE FRAME (wraps shortcode content)
═══════════════════════════════════════════════ */

.esd-module-frame {
    background: var(--esd-surface);
    border: 1px solid var(--esd-border);
    border-radius: var(--esd-radius-lg);
    padding: 4px;
    box-shadow: var(--esd-shadow-sm);
}

.esd-module-frame--flush {
    padding: 0;
    border: none;
    box-shadow: none;
    background: transparent;
}

/* Ensure plugin content inherits fonts */
.esd-module-frame * {
    font-family: var(--esd-font-ui);
}

/* ═══════════════════════════════════════════════
   MODULE STATS ROW
═══════════════════════════════════════════════ */

.esd-module-stats-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.esd-mini-stat {
    background: var(--esd-surface);
    border: 1px solid var(--esd-border);
    border-radius: var(--esd-radius-sm);
    padding: 8px 14px;
    text-align: center;
    box-shadow: var(--esd-shadow-sm);
}

.esd-mini-stat__val {
    display: block;
    font-family: var(--esd-font-head);
    font-size: 18px;
    font-weight: 700;
    color: var(--esd-green-600);
    line-height: 1.1;
}

.esd-mini-stat__lbl {
    display: block;
    font-size: 10px;
    color: var(--esd-text-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

/* ═══════════════════════════════════════════════
   PROGRESS BANNER
═══════════════════════════════════════════════ */

.esd-progress-banner {
    background: var(--esd-surface);
    border: 1px solid var(--esd-border);
    border-radius: var(--esd-radius);
    padding: 14px 18px;
    margin-bottom: 20px;
    box-shadow: var(--esd-shadow-sm);
}

.esd-progress-banner__label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 500;
    color: var(--esd-text-2);
    margin-bottom: 8px;
}

/* ═══════════════════════════════════════════════
   SCORE BANNER (progress page)
═══════════════════════════════════════════════ */

.esd-score-banner {
    background: var(--esd-surface);
    border: 1px solid var(--esd-border);
    border-radius: var(--esd-radius-lg);
    padding: 24px;
    display: flex;
    gap: 28px;
    align-items: center;
    margin-bottom: 28px;
    box-shadow: var(--esd-shadow-sm);
    flex-wrap: wrap;
}

.esd-score-banner__title {
    font-family: var(--esd-font-head);
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--esd-text-1);
}

.esd-score-banner__sub {
    font-size: 13px;
    color: var(--esd-text-3);
    margin: 0 0 16px;
}

.esd-score-breakdown { display: flex; flex-direction: column; gap: 8px; }

.esd-score-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--esd-text-2);
}

.esd-score-row span { width: 90px; flex-shrink: 0; }

.esd-mini-bar {
    flex: 1;
    height: 6px;
    background: var(--esd-green-100);
    border-radius: 99px;
    overflow: hidden;
}

.esd-mini-bar div {
    height: 100%;
    background: linear-gradient(90deg, var(--esd-green-400), var(--esd-green-600));
    border-radius: 99px;
    transition: width 0.8s ease;
}

.esd-score-row b {
    width: 64px;
    text-align: right;
    flex-shrink: 0;
    font-weight: 600;
    color: var(--esd-text-1);
}

/* ═══════════════════════════════════════════════
   PROGRESS GRID
═══════════════════════════════════════════════ */

.esd-progress-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.esd-progress-card {
    background: var(--esd-surface);
    border: 1px solid var(--esd-border);
    border-radius: var(--esd-radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: var(--esd-shadow-sm);
    transition: box-shadow var(--esd-transition);
}

.esd-progress-card:hover {
    box-shadow: var(--esd-shadow-md);
}

.esd-progress-card__head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.esd-progress-card__icon {
    font-size: 24px;
    flex-shrink: 0;
}

.esd-progress-card__head h3 {
    font-family: var(--esd-font-head);
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 2px;
    color: var(--esd-text-1);
}

.esd-progress-card__head p {
    font-size: 12px;
    color: var(--esd-text-3);
    margin: 0;
}

.esd-progress-card__badge {
    margin-left: auto;
    flex-shrink: 0;
}

.esd-progress-card__stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    background: var(--esd-green-50);
    border-radius: var(--esd-radius-sm);
    padding: 10px;
}

.esd-progress-card__stats div {
    text-align: center;
}

.esd-progress-card__stats span {
    display: block;
    font-size: 10px;
    color: var(--esd-text-3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 3px;
}

.esd-progress-card__stats strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--esd-text-1);
}

/* ═══════════════════════════════════════════════
   BADGES
═══════════════════════════════════════════════ */

.esd-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    background: var(--esd-green-100);
    color: var(--esd-green-700);
    border: 1px solid var(--esd-green-200);
}

.esd-badge--blue   { background: var(--esd-blue-100); color: #1d4ed8; border-color: #bfdbfe; }
.esd-badge--amber  { background: var(--esd-amber-100); color: #92400e; border-color: #fde68a; }
.esd-badge--purple { background: var(--esd-purple-100); color: #5b21b6; border-color: #ddd6fe; }
.esd-badge--green  { background: var(--esd-green-100); color: var(--esd-green-700); border-color: var(--esd-green-200); }

/* ═══════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════ */

.esd-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--esd-radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--esd-transition);
    text-decoration: none;
    font-family: var(--esd-font-ui);
}

.esd-btn--primary {
    background: var(--esd-green-600);
    color: white;
    border-color: var(--esd-green-600);
}

.esd-btn--primary:hover {
    background: var(--esd-green-700);
    border-color: var(--esd-green-700);
    color: white;
}

.esd-btn--ghost {
    background: transparent;
    color: var(--esd-text-2);
    border-color: var(--esd-border);
}

.esd-btn--ghost:hover {
    background: var(--esd-green-50);
    border-color: var(--esd-green-200);
    color: var(--esd-green-700);
}

.esd-btn--sm {
    padding: 5px 12px;
    font-size: 12.5px;
}

.esd-btn--danger {
    background: var(--esd-red-100);
    color: var(--esd-red-500);
    border-color: #fecaca;
}

.esd-btn--danger:hover {
    background: var(--esd-red-500);
    color: white;
}

/* ═══════════════════════════════════════════════
   TABLES
═══════════════════════════════════════════════ */

.esd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.esd-table th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--esd-text-3);
    border-bottom: 1px solid var(--esd-border);
    background: var(--esd-green-50);
}

.esd-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--esd-border);
    color: var(--esd-text-2);
    vertical-align: middle;
}

.esd-table tr:last-child td { border-bottom: none; }
.esd-table tr:hover td { background: var(--esd-green-50); }

.esd-student-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.esd-student-cell div {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.esd-student-cell strong {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--esd-text-1);
}

.esd-student-cell span {
    font-size: 11.5px;
    color: var(--esd-text-3);
}

.esd-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--esd-border);
}

/* ═══════════════════════════════════════════════
   DETAIL GRID (teacher student detail)
═══════════════════════════════════════════════ */

.esd-detail-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 16px 20px;
}

.esd-detail-stat {
    background: var(--esd-green-50);
    border: 1px solid var(--esd-green-100);
    border-radius: var(--esd-radius);
    padding: 14px;
    text-align: center;
}

.esd-detail-stat span {
    display: block;
    font-size: 18px;
    margin-bottom: 6px;
}

.esd-detail-stat strong {
    display: block;
    font-family: var(--esd-font-head);
    font-size: 16px;
    font-weight: 700;
    color: var(--esd-green-700);
    margin-bottom: 2px;
}

.esd-detail-stat small {
    font-size: 11px;
    color: var(--esd-text-3);
}

/* ═══════════════════════════════════════════════
   PLUGIN STATUS GRID (admin)
═══════════════════════════════════════════════ */

.esd-plugin-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    padding: 16px;
}

.esd-plugin-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--esd-radius-sm);
    border: 1px solid;
    font-size: 13px;
    font-weight: 500;
}

.esd-plugin-status.is-active {
    background: var(--esd-green-50);
    border-color: var(--esd-green-200);
    color: var(--esd-green-700);
}

.esd-plugin-status.is-inactive {
    background: #fafafa;
    border-color: var(--esd-border);
    color: var(--esd-text-3);
}

.esd-plugin-status__icon { font-size: 18px; }
.esd-plugin-status__name { flex: 1; font-size: 12.5px; }

.esd-plugin-status__dot {
    font-size: 11px;
    font-weight: 600;
}

.is-active .esd-plugin-status__dot { color: var(--esd-green-600); }
.is-inactive .esd-plugin-status__dot { color: var(--esd-text-4); }

/* ═══════════════════════════════════════════════
   EMPTY / ERROR STATES
═══════════════════════════════════════════════ */

.esd-empty-state {
    padding: 28px 20px;
    text-align: center;
    color: var(--esd-text-3);
    font-size: 13.5px;
}

.esd-plugin-missing {
    padding: 48px 24px;
    text-align: center;
    color: var(--esd-text-2);
}

.esd-plugin-missing__icon {
    font-size: 40px;
    margin-bottom: 12px;
    display: block;
}

.esd-plugin-missing h3 {
    font-family: var(--esd-font-head);
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--esd-text-1);
}

.esd-plugin-missing p {
    font-size: 14px;
    color: var(--esd-text-3);
    margin: 0 0 20px;
}

.esd-access-denied {
    padding: 60px 24px;
    text-align: center;
}

.esd-access-denied h2 {
    font-family: var(--esd-font-head);
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 10px;
    color: var(--esd-red-500);
}

/* ═══════════════════════════════════════════════
   LOADING STATE
═══════════════════════════════════════════════ */

.esd-loading-state {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    color: var(--esd-text-3);
    font-size: 13.5px;
}

.esd-spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--esd-green-200);
    border-top-color: var(--esd-green-500);
    border-radius: 50%;
    animation: esd-spin 0.75s linear infinite;
    flex-shrink: 0;
}

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

/* Page transition shimmer */
.esd-content-inner.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: esd-shimmer 1.2s infinite;
}

@keyframes esd-shimmer {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100%); }
}

/* ═══════════════════════════════════════════════
   OVERLAY (mobile)
═══════════════════════════════════════════════ */

.esd-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 90;
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity var(--esd-transition);
}

.esd-overlay.is-visible {
    display: block;
    opacity: 1;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .esd-stats-strip { grid-template-columns: repeat(2, 1fr); }
    .esd-module-grid { grid-template-columns: 1fr; }
    .esd-progress-grid { grid-template-columns: 1fr; }
    .esd-detail-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    :root {
        --esd-sidebar-w: 260px;
    }

    .esd-sidebar {
        transform: translateX(-100%);
    }

    .esd-sidebar.is-open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }

    .esd-main {
        margin-left: 0;
    }

    .esd-menu-toggle {
        display: flex;
    }

    .esd-content-inner {
        padding: 20px 16px 40px;
    }

    .esd-stats-strip { grid-template-columns: repeat(2, 1fr); }
    .esd-two-col { grid-template-columns: 1fr; }
    .esd-page-header { flex-direction: column; }
    .esd-detail-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .esd-stats-strip { grid-template-columns: 1fr 1fr; }
    .esd-quick-launch { grid-template-columns: 1fr; }
    .esd-module-card__stats { flex-wrap: wrap; gap: 12px; }
}

/* ═══════════════════════════════════════════════
   SCROLLBAR STYLING
═══════════════════════════════════════════════ */

.esd-body ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.esd-body ::-webkit-scrollbar-track { background: transparent; }
.esd-body ::-webkit-scrollbar-thumb {
    background: var(--esd-green-200);
    border-radius: 99px;
}

.esd-body ::-webkit-scrollbar-thumb:hover {
    background: var(--esd-green-400);
}

/* ═══════════════════════════════════════════════
   PLUGIN CONTENT INTEGRATION
   Normalize styles from sub-plugins
═══════════════════════════════════════════════ */

.esd-module-frame .wrap,
.esd-module-frame .container {
    max-width: 100% !important;
    padding: 16px !important;
    margin: 0 !important;
}

/* Prevent plugin backgrounds from overriding ours */
.esd-module-frame > div > * {
    max-width: 100%;
}

/* ── Smooth fade on module load ── */
@keyframes esd-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.esd-content-inner {
    animation: esd-fade-in 0.25s ease forwards;
}

/* ═══════════════════════════════════════════════
   STORAGE QUOTA WIDGET
═══════════════════════════════════════════════ */

.esd-storage-widget {
    background: var(--esd-surface);
    border: 1px solid var(--esd-border);
    border-radius: var(--esd-radius-lg);
    box-shadow: var(--esd-shadow-sm);
    padding: 18px 22px 16px;
    margin-bottom: 28px;
    transition: border-color 0.3s;
}

.esd-storage-widget.is-limited {
    border-color: #ef4444;
    background: #fff7f7;
}

.esd-storage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 6px;
}

.esd-storage-header__left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.esd-storage-icon {
    font-size: 16px;
    line-height: 1;
}

.esd-storage-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--esd-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.esd-storage-label {
    font-size: 13px;
    color: var(--esd-text-secondary);
}

.esd-storage-label--warning {
    color: #b45309;
    font-weight: 600;
}

.esd-storage-label--critical {
    color: #dc2626;
    font-weight: 700;
}

.esd-storage-sep {
    margin: 0 3px;
    opacity: 0.5;
}

/* The track */
.esd-storage-bar {
    height: 10px;
    background: var(--esd-green-100);
    border-radius: 99px;
    overflow: hidden;
    position: relative;
}

/* The fill — default green */
.esd-storage-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--esd-green-400), var(--esd-green-600));
    border-radius: 99px;
    transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1), background 0.4s;
    position: relative;
}

/* Animated shimmer on the fill */
.esd-storage-bar__fill::after {
    content: '';
    position: absolute;
    top: 0; left: -60%; right: 0; bottom: 0;
    width: 60%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    animation: esd-shimmer 2.4s ease-in-out infinite;
    border-radius: 99px;
}

@keyframes esd-shimmer {
    0%   { left: -60%; }
    100% { left: 110%; }
}

.esd-storage-bar__fill--warning {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.esd-storage-bar__fill--critical {
    background: linear-gradient(90deg, #f87171, #dc2626);
    animation: esd-storage-pulse 1.6s ease-in-out infinite;
}

@keyframes esd-storage-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.82; }
}

/* Warning banner shown when limit is reached */
.esd-storage-warning {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 14px;
    padding: 13px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--esd-radius);
    animation: esd-fade-in 0.35s ease forwards;
}

.esd-storage-warning__icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.esd-storage-warning__body {
    font-size: 13.5px;
    line-height: 1.55;
    color: #7f1d1d;
}

.esd-storage-warning__body strong {
    color: #991b1b;
}

/* Dark-mode-friendly overrides */
@media (prefers-color-scheme: dark) {
    .esd-storage-widget.is-limited {
        background: rgba(239, 68, 68, 0.06);
    }
    .esd-storage-warning {
        background: rgba(239, 68, 68, 0.1);
        border-color: rgba(239, 68, 68, 0.35);
    }
    .esd-storage-warning__body {
        color: #fca5a5;
    }
    .esd-storage-warning__body strong {
        color: #fca5a5;
    }
}
