/* =================================================================
   PBL Evaluation System — Modern Dashboard Stylesheet v2.0
   Inspired by modern dashboard design with gradient accents
   ================================================================= */

:root {
    /* Brand — modern indigo/violet */
    --brand-primary:    #6366f1;       /* indigo-500 */
    --brand-primary-dk: #4f46e5;
    --brand-secondary:  #8b5cf6;
    --brand-accent:     #ec4899;
    --brand-mint:       #10b981;

    /* Gradients */
    --grad-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --grad-pink:    linear-gradient(135deg, #ec4899 0%, #f472b6 100%);
    --grad-blue:    linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    --grad-mint:    linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --grad-amber:   linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    --grad-card:    linear-gradient(135deg, #f5f3ff 0%, #fdf4ff 100%);

    /* Surfaces */
    --bg-app:       #f8fafc;
    --bg-card:      #ffffff;
    --bg-soft:      #f5f3ff;
    --bg-sidebar:   #ffffff;

    /* Text */
    --text-primary:   #1e293b;
    --text-secondary: #64748b;
    --text-muted:     #94a3b8;

    /* Borders */
    --border-soft:   #f1f5f9;
    --border-strong: #e2e8f0;

    /* Status */
    --success: #10b981;
    --warning: #f59e0b;
    --danger:  #ef4444;
    --info:    #3b82f6;

    /* Shadows */
    --shadow-sm:   0 1px 2px rgba(99,102,241,0.05), 0 1px 3px rgba(99,102,241,0.06);
    --shadow-md:   0 4px 12px rgba(99,102,241,0.08), 0 2px 4px rgba(99,102,241,0.04);
    --shadow-lg:   0 12px 24px rgba(99,102,241,0.12), 0 4px 8px rgba(99,102,241,0.06);
    --shadow-xl:   0 20px 40px rgba(99,102,241,0.15), 0 8px 16px rgba(99,102,241,0.08);
    --shadow-glow: 0 0 0 4px rgba(99,102,241,0.15);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --sidebar-width: 260px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-app);
    color: var(--text-primary);
    margin: 0;
    min-height: 100vh;
    line-height: 1.6;
    font-size: 14px;
}

/* ---------------------------------------------------------------
   APP LAYOUT — sidebar + main
--------------------------------------------------------------- */
.app-layout { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-soft);
    padding: 1.5rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .5rem .75rem;
    margin-bottom: 2rem;
    text-decoration: none;
    color: inherit;
}
.sidebar-brand .brand-mark {
    width: 40px; height: 40px;
    border-radius: var(--radius-md);
    background: var(--grad-primary);
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    box-shadow: var(--shadow-md);
}
.sidebar-brand .brand-text { font-weight: 700; font-size: 1rem; }
.sidebar-brand .brand-text small {
    display: block;
    font-weight: 400;
    font-size: .72rem;
    color: var(--text-muted);
    line-height: 1.2;
}

.sidebar-section {
    color: var(--text-muted);
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 0 .75rem;
    margin: 1.25rem 0 .5rem;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .25rem;
}
.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem .85rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: .9rem;
    transition: all .15s;
}
.sidebar-nav .nav-link:hover {
    background: var(--bg-soft);
    color: var(--brand-primary);
}
.sidebar-nav .nav-link.active {
    background: var(--grad-primary);
    color: #fff;
    box-shadow: var(--shadow-md);
}
.sidebar-nav .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar-nav .nav-link .badge-mini {
    margin-left: auto;
    font-size: .68rem;
    padding: .1rem .5rem;
    border-radius: 100px;
    background: var(--brand-accent);
    color: #fff;
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding: 1.25rem;
    background: var(--grad-card);
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid rgba(99,102,241,0.1);
}

/* ---------------------------------------------------------------
   MAIN AREA
--------------------------------------------------------------- */
.app-main { flex: 1; min-width: 0; }

.app-topbar {
    border-bottom: 1px solid var(--border-soft);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(8px);
    background: rgba(255,255,255,0.85);
}

.topbar-search {
    flex: 1;
    max-width: 400px;
    position: relative;
}
.topbar-search input {
    width: 100%;
    border: 1px solid var(--border-soft);
    background: var(--bg-soft);
    border-radius: 100px;
    padding: .55rem 1rem .55rem 2.5rem;
    font-size: .9rem;
    transition: all .15s;
    font-family: inherit;
}
.topbar-search input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-glow);
    background: #fff;
}
.topbar-search i {
    position: absolute;
    left: .9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .85rem; }
.topbar-bell {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--bg-soft);
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: all .15s;
    border: 0;
}
.topbar-bell:hover { background: var(--brand-primary); color: #fff; }
.topbar-bell .dot {
    position: absolute; top: 8px; right: 10px;
    width: 8px; height: 8px;
    background: var(--brand-accent);
    border-radius: 50%;
    border: 2px solid #fff;
}
.topbar-user {
    display: flex; align-items: center; gap: .65rem;
    cursor: pointer;
    padding: .25rem .5rem .25rem .25rem;
    border-radius: 100px;
    transition: background .15s;
}
.topbar-user:hover { background: var(--bg-soft); }
.topbar-user .avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--grad-primary);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600;
    font-size: .9rem;
}
.topbar-user .info { display: flex; flex-direction: column; line-height: 1.2; }
.topbar-user .info .name { font-weight: 600; font-size: .85rem; }
.topbar-user .info .role { font-size: .72rem; color: var(--text-muted); }

/* ---------------------------------------------------------------
   PAGE CONTENT
--------------------------------------------------------------- */
.app-content { padding: 2rem; }

.page-header {
    margin-bottom: 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: end;
    flex-wrap: wrap;
    gap: 1rem;
}
.page-header h1 {
    font-size: 1.6rem;
    margin: 0 0 .25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.page-header .subtitle {
    color: var(--text-secondary);
    font-size: .9rem;
    margin: 0;
}

/* ---------------------------------------------------------------
   STAT CARDS
--------------------------------------------------------------- */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-soft);
    transition: all .2s;
    position: relative;
    overflow: hidden;
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.stat-card .icon-box {
    width: 48px; height: 48px;
    border-radius: var(--radius-md);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    margin-bottom: .85rem;
    color: #fff;
    box-shadow: var(--shadow-md);
}
.icon-box.icon-primary { background: var(--grad-primary); }
.icon-box.icon-pink    { background: var(--grad-pink); }
.icon-box.icon-blue    { background: var(--grad-blue); }
.icon-box.icon-mint    { background: var(--grad-mint); }
.icon-box.icon-amber   { background: var(--grad-amber); }

.stat-card .label { color: var(--text-secondary); font-size: .82rem; font-weight: 500; margin-bottom: .25rem; }
.stat-card .value {
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
}
.stat-card .trend {
    margin-top: .5rem;
    font-size: .78rem;
    font-weight: 600;
    color: var(--success);
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}
.stat-card .trend.down { color: var(--danger); }

.stat-card.featured {
    background: var(--grad-primary);
    color: #fff;
    border: 0;
}
.stat-card.featured .label,
.stat-card.featured .value { color: #fff; }
.stat-card.featured .label { opacity: .85; }
.stat-card.featured .icon-box {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(8px);
}

/* ---------------------------------------------------------------
   CARDS
--------------------------------------------------------------- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
    overflow: hidden;
}
.card-header {
    padding: 1.15rem 1.5rem;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}
.card-header .title {
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.card-header .title i { color: var(--brand-primary); }
.card-body { padding: 1.5rem; }
.card-body.p-0 { padding: 0; }
.card-footer {
    padding: 1rem 1.5rem;
    background: var(--bg-soft);
    border-top: 1px solid var(--border-soft);
}

/* ---------------------------------------------------------------
   TABLES
--------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
    background: var(--bg-soft);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: .78rem;
    text-align: left;
    padding: .85rem 1rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    border-bottom: 1px solid var(--border-soft);
}
.table td {
    padding: .9rem 1rem;
    border-bottom: 1px solid var(--border-soft);
    font-size: .88rem;
    vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--bg-soft); }

.table-responsive { overflow-x: auto; }

/* ---------------------------------------------------------------
   BUTTONS
--------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-weight: 600;
    font-size: .85rem;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
    text-decoration: none;
    line-height: 1.4;
}
.btn-primary {
    background: var(--grad-primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-success {
    background: var(--grad-mint);
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.btn-success:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-warning {
    background: var(--grad-amber);
    color: #fff;
}
.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-outline-primary {
    background: transparent;
    color: var(--brand-primary);
    border-color: var(--border-strong);
}
.btn-outline-primary:hover {
    background: var(--brand-primary);
    color: #fff;
    border-color: var(--brand-primary);
}
.btn-outline-secondary {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-strong);
}
.btn-outline-secondary:hover { background: var(--bg-soft); }
.btn-sm { padding: .35rem .75rem; font-size: .78rem; }
.btn-lg { padding: .7rem 1.5rem; font-size: .95rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; }
.w-100 { width: 100%; }

/* ---------------------------------------------------------------
   BADGES
--------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: .28em .7em;
    font-size: .72em;
    font-weight: 600;
    border-radius: 100px;
    line-height: 1.4;
}
.badge.bg-primary { background: var(--brand-primary); color: #fff; }
.badge.bg-success { background: var(--success); color: #fff; }
.badge.bg-warning { background: var(--warning); color: #fff; }
.badge.bg-danger  { background: var(--danger); color: #fff; }
.badge.bg-info    { background: var(--info); color: #fff; }
.badge.bg-secondary { background: var(--text-secondary); color: #fff; }
.badge.bg-primary-soft { background: rgba(99,102,241,0.12); color: var(--brand-primary); }
.badge.bg-success-soft { background: rgba(16,185,129,0.12); color: var(--success); }
.badge.bg-warning-soft { background: rgba(245,158,11,0.15); color: #b45309; }
.badge.bg-danger-soft  { background: rgba(239,68,68,0.12); color: var(--danger); }
.badge.bg-info-soft    { background: rgba(59,130,246,0.12); color: var(--info); }
.badge.bg-pink-soft    { background: rgba(236,72,153,0.12); color: var(--brand-accent); }
.badge.bg-light { background: var(--bg-soft); color: var(--text-secondary); }

/* compatibility with old class names */
.bg-primary-subtle { background: rgba(99,102,241,0.12); }
.bg-success-subtle { background: rgba(16,185,129,0.12); }
.bg-warning-subtle { background: rgba(245,158,11,0.15); }
.bg-danger-subtle  { background: rgba(239,68,68,0.12); }
.bg-info-subtle    { background: rgba(59,130,246,0.12); }
.text-primary-emphasis { color: var(--brand-primary); }
.text-success-emphasis { color: var(--success); }
.text-warning-emphasis { color: #b45309; }
.text-danger-emphasis  { color: var(--danger); }
.text-info-emphasis    { color: var(--info); }

/* ---------------------------------------------------------------
   PROGRESS
--------------------------------------------------------------- */
.progress {
    background: var(--bg-soft);
    border-radius: 100px;
    overflow: hidden;
    height: 8px;
}
.progress-bar {
    background: var(--grad-primary);
    height: 100%;
    border-radius: 100px;
    transition: width .3s;
}
.progress-bar.bg-success { background: var(--grad-mint); }
.progress-bar.bg-pink    { background: var(--grad-pink); }
.progress-bar.bg-blue    { background: var(--grad-blue); }

/* ---------------------------------------------------------------
   GROUP CARDS
--------------------------------------------------------------- */
.group-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: all .2s;
}
.group-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
    border-color: rgba(99,102,241,0.3);
}
.group-no {
    display: inline-block;
    background: var(--grad-primary);
    color: #fff;
    padding: .3rem .85rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: .85rem;
    box-shadow: var(--shadow-sm);
}
.group-tag {
    display: inline-block;
    margin-left: .5rem;
    padding: .2rem .65rem;
    background: var(--grad-amber);
    color: #fff;
    border-radius: 100px;
    font-size: .7rem;
    font-weight: 600;
}
.group-tag.research { background: var(--grad-pink); }
.member-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: var(--bg-soft);
    border-radius: 100px;
    padding: .2rem .75rem .2rem .2rem;
    font-size: .78rem;
    margin: .15rem;
    color: var(--text-primary);
    transition: all .15s;
}
.member-chip:hover { background: rgba(99,102,241,0.1); }
.member-chip img,
.member-chip .avatar-mini {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--grad-primary);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .65rem;
    font-weight: 600;
    object-fit: cover;
}

/* ---------------------------------------------------------------
   RUBRIC LEVELS
--------------------------------------------------------------- */
.level-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .85rem;
    margin-top: .85rem;
}
.level-option {
    border: 2px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 1rem;
    cursor: pointer;
    transition: all .15s;
    text-align: center;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    align-items: center;
}
.level-option input[type="radio"] { display: none; }
.level-option:hover {
    border-color: var(--brand-primary);
    background: var(--bg-soft);
    transform: translateY(-2px);
}
.level-option.selected {
    border-color: var(--brand-primary);
    background: var(--grad-card);
    box-shadow: var(--shadow-md);
}
.level-option .level-num {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--bg-soft);
    color: var(--brand-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: .5rem;
}
.level-option.selected .level-num {
    background: var(--grad-primary);
    color: #fff;
    box-shadow: var(--shadow-md);
}
.level-option .level-label {
    display: block;
    font-weight: 600;
    margin-bottom: .25rem;
    font-size: .85rem;
}
.level-option .level-desc {
    display: block;
    font-size: .72rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ---------------------------------------------------------------
   EVAL GRID (teacher's batch evaluation)
--------------------------------------------------------------- */
.eval-grid-wrap {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
}
.eval-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
    background: var(--bg-card);
}
.eval-grid th, .eval-grid td {
    border-bottom: 1px solid var(--border-soft);
    padding: .65rem .5rem;
    text-align: center;
    vertical-align: middle;
}
.eval-grid th {
    background: var(--bg-soft);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: .75rem;
    padding: 1rem .5rem;
}
.eval-grid .student-photo {
    width: 44px; height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: var(--shadow-sm);
}
.eval-grid .level-cell {
    cursor: pointer;
    border-radius: 100px;
    transition: all .15s;
    border: 1.5px solid var(--border-strong);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    font-weight: 600;
    font-size: .8rem;
    color: var(--text-secondary);
}
.eval-grid .level-cell:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}
.eval-grid .level-cell.selected {
    background: var(--grad-primary);
    color: #fff;
    border-color: transparent;
    box-shadow: var(--shadow-md);
}
.table-active td {
    background: rgba(99,102,241,0.06) !important;
    font-weight: 600;
    color: var(--text-primary);
}

/* ---------------------------------------------------------------
   RUBRIC SECTION
--------------------------------------------------------------- */
.rubric-section {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
    margin-bottom: 1.25rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.rubric-section-head {
    background: var(--grad-primary);
    color: #fff;
    padding: 1rem 1.5rem;
    font-weight: 600;
    font-size: 1rem;
}
.rubric-section-head small {
    opacity: .85;
    font-weight: 400;
    margin-left: .5rem;
    font-size: .8rem;
}
.rubric-item {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-soft);
}
.rubric-item:last-child { border-bottom: 0; }
.rubric-item .item-title {
    font-weight: 600;
    font-size: .95rem;
}

/* ---------------------------------------------------------------
   AVATAR
--------------------------------------------------------------- */
.avatar-circle {
    border-radius: 50%;
    background: var(--grad-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

/* ---------------------------------------------------------------
   LOGIN PAGE
--------------------------------------------------------------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    padding: 2rem;
    position: relative;
    overflow: hidden;
}
.login-wrap::before,
.login-wrap::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
}
.login-wrap::before { width: 400px; height: 400px; top: -150px; left: -150px; }
.login-wrap::after  { width: 500px; height: 500px; bottom: -200px; right: -200px; }
.login-card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.2);
    position: relative;
    z-index: 1;
}
.login-card .brand {
    text-align: center;
    margin-bottom: 2rem;
}
.login-card .brand-icon {
    width: 72px; height: 72px;
    border-radius: var(--radius-lg);
    background: var(--grad-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-lg);
}
.login-card h1 {
    font-size: 1.5rem;
    margin: 0 0 .25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.login-card .subtitle {
    color: var(--text-secondary);
    font-size: .9rem;
}

/* ---------------------------------------------------------------
   FORM
--------------------------------------------------------------- */
.form-group, .mb-3 { margin-bottom: 1.15rem; }
.form-label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: .45rem;
    color: var(--text-primary);
}
.form-control, .form-select {
    width: 100%;
    padding: .65rem 1rem;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-family: inherit;
    transition: all .15s;
    background: var(--bg-card);
}
.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-glow);
}
.form-control:disabled { background: var(--bg-soft); color: var(--text-muted); }
.form-control-sm { padding: .4rem .7rem; font-size: .82rem; }
.form-select-sm { padding: .4rem .7rem; font-size: .82rem; }
.form-text { font-size: .75rem; color: var(--text-muted); margin-top: .25rem; }

.input-group {
    display: flex;
    align-items: stretch;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: all .15s;
    background: #fff;
}
.input-group:focus-within {
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-glow);
}
.input-group-text {
    padding: .65rem 1rem;
    background: var(--bg-soft);
    color: var(--text-secondary);
    font-size: .85rem;
    display: flex;
    align-items: center;
}
.input-group .form-control {
    border: 0;
    flex: 1;
    box-shadow: none;
}
.input-group .form-control:focus { box-shadow: none; }
.input-group .btn { border-radius: 0; }

.psu-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1rem;
    background: var(--bg-soft);
    color: var(--brand-primary);
    border-radius: 100px;
    font-size: .82rem;
    font-weight: 500;
}

/* ---------------------------------------------------------------
   AUTOSAVE BADGE
--------------------------------------------------------------- */
.autosave-badge {
    font-size: .8rem;
    color: var(--text-muted);
    margin-left: 1rem;
}
.autosave-badge.text-success { color: var(--success); font-weight: 600; }
.autosave-badge.text-warning { color: var(--warning); }
.autosave-badge.text-danger  { color: var(--danger); }

/* ---------------------------------------------------------------
   ALERT
--------------------------------------------------------------- */
.alert {
    padding: .85rem 1.15rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    border: 1px solid transparent;
    font-size: .88rem;
    display: flex;
    align-items: flex-start;
    gap: .65rem;
}
.alert-success { background: rgba(16,185,129,0.08); color: #065f46; border-color: rgba(16,185,129,0.2); }
.alert-danger  { background: rgba(239,68,68,0.08); color: #991b1b; border-color: rgba(239,68,68,0.2); }
.alert-warning { background: rgba(245,158,11,0.08); color: #92400e; border-color: rgba(245,158,11,0.2); }
.alert-info    { background: rgba(59,130,246,0.08); color: #1e40af; border-color: rgba(59,130,246,0.2); }

/* ---------------------------------------------------------------
   FORM CHECK
--------------------------------------------------------------- */
.form-check { display: flex; align-items: center; gap: .5rem; }
.form-check-input {
    width: 18px; height: 18px;
    accent-color: var(--brand-primary);
}
.form-check-label { user-select: none; }

/* ---------------------------------------------------------------
   MODAL (Bootstrap-compatible)
--------------------------------------------------------------- */
.modal { z-index: 1000; }
.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 0;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}
.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-soft);
}
.modal-header .modal-title { font-weight: 700; }
.modal-body { padding: 1.5rem; }
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-soft);
    background: var(--bg-soft);
}

/* ---------------------------------------------------------------
   LIST GROUP
--------------------------------------------------------------- */
.list-group { border-radius: var(--radius-md); overflow: hidden; }
.list-group-flush .list-group-item {
    border-left: 0; border-right: 0; border-radius: 0;
}
.list-group-item {
    padding: .85rem 1.25rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-soft);
}
.list-group-item:last-child { border-bottom: 0; }
.list-group-item:hover { background: var(--bg-soft); }

/* ---------------------------------------------------------------
   DROPDOWN
--------------------------------------------------------------- */
.dropdown-menu {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    background: var(--bg-card);
    min-width: 320px;
    max-height: 420px;
    overflow-y: auto;
    padding: 0;
}
.dropdown-item {
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--border-soft);
    text-decoration: none;
    color: var(--text-primary);
    transition: background .15s;
    display: block;
}
.dropdown-item:last-child { border-bottom: 0; }
.dropdown-item:hover { background: var(--bg-soft); }
.dropdown-item.unread {
    background: rgba(99,102,241,0.04);
    border-left: 3px solid var(--brand-primary);
}

/* ---------------------------------------------------------------
   CHART
--------------------------------------------------------------- */
.chart-wrapper {
    position: relative;
    height: 300px;
}
.chart-wrapper.tall { height: 380px; }

/* ---------------------------------------------------------------
   NAV PILLS (tabs)
--------------------------------------------------------------- */
.nav-pills {
    display: flex;
    gap: .35rem;
    background: var(--bg-card);
    padding: .35rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-soft);
    list-style: none;
    margin: 0 0 1rem;
}
.nav-pills .nav-item { list-style: none; }
.nav-pills .nav-link {
    padding: .55rem 1.1rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: .88rem;
    transition: all .15s;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}
.nav-pills .nav-link:hover {
    background: var(--bg-soft);
    color: var(--brand-primary);
}
.nav-pills .nav-link.active {
    background: var(--grad-primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

/* ---------------------------------------------------------------
   RESPONSIVE
--------------------------------------------------------------- */
@media (max-width: 1024px) {
    .app-sidebar { width: 80px; padding: 1rem .5rem; }
    .sidebar-brand .brand-text,
    .sidebar-section,
    .sidebar-nav .nav-link span,
    .sidebar-footer { display: none; }
    .sidebar-nav .nav-link { justify-content: center; padding: .7rem; }
}
@media (max-width: 768px) {
    .app-sidebar { display: none; }
    .app-content { padding: 1rem; }
    .level-grid { grid-template-columns: repeat(2, 1fr); }
    .topbar-search { display: none; }
}

/* ---------------------------------------------------------------
   GRID UTILITIES (Bootstrap-like)
--------------------------------------------------------------- */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -.5rem;
}
.row > [class^="col-"] { padding: 0 .5rem; }
.row.g-2 { margin: 0 -.25rem; }
.row.g-2 > [class^="col-"] { padding: 0 .25rem; }
.row.g-3 { margin: 0 -.375rem; }
.row.g-3 > [class^="col-"] { padding: 0 .375rem; }
.row > * { box-sizing: border-box; }

.col-12 { flex: 0 0 100%; max-width: 100%; }
.col-md-3 { flex: 0 0 25%; max-width: 25%; }
.col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.col-md-6 { flex: 0 0 50%; max-width: 50%; }
.col-md-8 { flex: 0 0 66.667%; max-width: 66.667%; }
.col-md-9 { flex: 0 0 75%; max-width: 75%; }
.col-lg-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.col-lg-5 { flex: 0 0 41.667%; max-width: 41.667%; }
.col-lg-6 { flex: 0 0 50%; max-width: 50%; }
.col-lg-7 { flex: 0 0 58.333%; max-width: 58.333%; }
.col-lg-8 { flex: 0 0 66.667%; max-width: 66.667%; }
.col-md-2 { flex: 0 0 16.666%; max-width: 16.666%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }

@media (max-width: 768px) {
    [class^="col-md-"], [class^="col-lg-"] { flex: 0 0 100%; max-width: 100%; }
}

.container, .container-fluid {
    margin: 0 auto;
    padding: 0 1rem;
}
.container { max-width: 1200px; }

/* ---------------------------------------------------------------
   UTILITIES
--------------------------------------------------------------- */
.flex { display: flex; }
.d-flex { display: flex; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-block { display: block; }
.d-none { display: none; }
.d-grid { display: grid; }
.flex-1 { flex: 1; }
.flex-fill { flex: 1 1 auto; }
.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.align-items-end { align-items: flex-end; }
.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-around { justify-content: space-around; }
.justify-content-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-column { flex-direction: column; }
.gap-1 { gap: .25rem; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--brand-primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.text-info    { color: var(--info); }
.text-white   { color: #fff; }
.fw-semibold { font-weight: 600; }
.fw-bold { font-weight: 700; }
.fw-medium { font-weight: 500; }
.fst-italic { font-style: italic; }
.small { font-size: .82rem; }
.fs-1 { font-size: 2rem; }
.fs-4 { font-size: 1.5rem; }
.fs-5 { font-size: 1.25rem; }
.fs-6 { font-size: 1rem; }
.h3 { font-size: 1.75rem; font-weight: 700; }
.h5 { font-size: 1.15rem; font-weight: 600; }
.h6 { font-size: 1rem; font-weight: 600; }
.text-end { text-align: right; }
.text-center { text-align: center; }
.text-decoration-none { text-decoration: none; }
.opacity-50 { opacity: .5; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.ms-1 { margin-left: .25rem; }
.ms-2 { margin-left: .5rem; }
.ms-3 { margin-left: .75rem; }
.me-1 { margin-right: .25rem; }
.me-2 { margin-right: .5rem; }
.me-3 { margin-right: .75rem; }
.ps-3 { padding-left: .75rem; }
.py-1 { padding-top: .25rem; padding-bottom: .25rem; }
.py-2 { padding-top: .5rem; padding-bottom: .5rem; }
.py-3 { padding-top: .75rem; padding-bottom: .75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-5 { padding-top: 2rem; padding-bottom: 2rem; }
.p-1 { padding: .25rem; }
.p-2 { padding: .5rem; }
.p-3 { padding: .75rem; }
.p-4 { padding: 1rem; }
.h-100 { height: 100%; }
.rounded { border-radius: var(--radius-sm); }
.rounded-circle { border-radius: 50%; }
.border { border: 1px solid var(--border-strong); }
.border-3 { border-width: 3px; }
.border-info { border-color: var(--info); }
.border-start { border-left-style: solid; }
.bg-soft { background: var(--bg-soft); }

/* ---------------------------------------------------------------
   PRINT
--------------------------------------------------------------- */
@media print {
    .app-sidebar, .app-topbar, .no-print { display: none !important; }
    .app-content { padding: 0; }
    body { background: #fff; }
    .card { box-shadow: none; border: 1px solid #ccc; }
    .group-card { page-break-inside: avoid; }
}
