/* ============================================================
   College ERP — Admin Design System
   Font: Inter | Palette: Slate/Blue
   ============================================================ */

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

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
    --font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

    /* Gray scale */
    --gray-50:       #F8FAFC;
    --gray-100:      #F1F5F9;
    --gray-200:      #E2E8F0;
    --gray-300:      #CBD5E1;
    --gray-400:      #94A3B8;
    --gray-500:      #64748B;
    --gray-600:      #475569;
    --gray-700:      #334155;
    --gray-800:      #1E293B;
    --gray-900:      #0F172A;

    /* Blue */
    --blue-50:       #EFF6FF;
    --blue-100:      #DBEAFE;
    --blue-200:      #BFDBFE;
    --blue-500:      #3B82F6;
    --blue-600:      #2563EB;
    --blue-700:      #1D4ED8;

    /* Semantic */
    --green-50:      #F0FDF4;
    --green-100:     #DCFCE7;
    --green-600:     #16A34A;
    --green-700:     #15803D;

    --amber-50:      #FFFBEB;
    --amber-100:     #FEF3C7;
    --amber-600:     #D97706;
    --amber-700:     #B45309;

    --red-50:        #FEF2F2;
    --red-100:       #FEE2E2;
    --red-600:       #DC2626;
    --red-700:       #B91C1C;

    --sky-50:        #F0F9FF;
    --sky-100:       #E0F2FE;
    --sky-600:       #0284C7;

    /* Surface */
    --bg:            var(--gray-50);
    --surface:       #FFFFFF;
    --surface-raised:#FFFFFF;
    --border:        var(--gray-200);
    --border-input:  var(--gray-300);

    /* Text */
    --text-primary:  var(--gray-900);
    --text-secondary:var(--gray-500);
    --text-tertiary: var(--gray-400);
    --text-inverse:  #FFFFFF;

    /* Primary action */
    --primary:       var(--blue-600);
    --primary-hover: var(--blue-700);
    --primary-light: var(--blue-50);
    --primary-ring:  var(--blue-200);

    /* Layout */
    --sidebar-w:     256px;
    --topbar-h:      57px;
    --content-px:    32px;
    --content-py:    28px;

    /* Radius */
    --r-xs:          3px;
    --r-sm:          5px;
    --r:             7px;
    --r-lg:          10px;
    --r-xl:          14px;
    --r-full:        9999px;

    /* Shadow */
    --shadow-xs:     0 1px 2px 0 rgba(0,0,0,.05);
    --shadow-sm:     0 1px 3px 0 rgba(0,0,0,.08), 0 1px 2px -1px rgba(0,0,0,.06);
    --shadow:        0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
    --shadow-lg:     0 10px 15px -3px rgba(0,0,0,.07), 0 4px 6px -4px rgba(0,0,0,.04);
    --shadow-modal:  0 20px 60px rgba(0,0,0,.18);

    /* Transitions */
    --t-fast:        100ms ease;
    --t:             160ms ease;
    --t-slow:        240ms ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; -webkit-text-size-adjust: 100%; }

body {
    font-family:     var(--font);
    font-size:       14px;
    line-height:     1.5;
    color:           var(--text-primary);
    background:      var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
ul, ol { list-style: none; }

/* ── Shell layout ──────────────────────────────────────────── */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
    width:            var(--sidebar-w);
    flex-shrink:      0;
    background:       var(--surface);
    border-right:     1px solid var(--border);
    display:          flex;
    flex-direction:   column;
    position:         fixed;
    top:              0;
    left:             0;
    bottom:           0;
    overflow-y:       auto;
    z-index:          40;
    scrollbar-width:  thin;
    scrollbar-color:  var(--gray-200) transparent;
}

.sidebar-logo {
    display:        flex;
    align-items:    center;
    gap:            10px;
    padding:        18px 20px 16px;
    border-bottom:  1px solid var(--border);
}

.sidebar-logo-mark {
    width:           32px;
    height:          32px;
    background:      var(--primary);
    border-radius:   var(--r-sm);
    display:         flex;
    align-items:     center;
    justify-content: center;
    flex-shrink:     0;
}

.sidebar-logo-mark svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.sidebar-logo-text {
    overflow: hidden;
}

.sidebar-college-name {
    font-size:    13px;
    font-weight:  600;
    color:        var(--text-primary);
    white-space:  nowrap;
    overflow:     hidden;
    text-overflow:ellipsis;
    line-height:  1.3;
}

.sidebar-system-label {
    font-size:   11px;
    color:       var(--text-tertiary);
    margin-top:  1px;
    font-weight: 450;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
}

.nav-section {
    margin-bottom: 4px;
}

.nav-section-label {
    font-size:    10.5px;
    font-weight:  600;
    color:        var(--text-tertiary);
    letter-spacing: .06em;
    text-transform: uppercase;
    padding:      8px 10px 4px;
    margin-top:   4px;
}

.nav-item {
    display:        flex;
    align-items:    center;
    gap:            9px;
    padding:        7px 10px;
    border-radius:  var(--r-sm);
    color:          var(--text-secondary);
    font-weight:    450;
    font-size:      13.5px;
    cursor:         pointer;
    transition:     background var(--t-fast), color var(--t-fast);
    position:       relative;
    margin-bottom:  1px;
}

.nav-item:hover {
    background: var(--gray-100);
    color:      var(--text-primary);
}

.nav-item.active {
    background:  var(--blue-50);
    color:       var(--primary);
    font-weight: 500;
}

.nav-item.active::before {
    content:    '';
    position:   absolute;
    left:       -10px;
    top:        6px;
    bottom:     6px;
    width:      3px;
    background: var(--primary);
    border-radius: 0 var(--r-full) var(--r-full) 0;
}

.nav-item-icon {
    width:    18px;
    height:   18px;
    flex-shrink: 0;
    opacity:  .7;
}

.nav-item.active .nav-item-icon { opacity: 1; }

.nav-badge {
    margin-left:    auto;
    font-size:      11px;
    font-weight:    600;
    background:     var(--red-600);
    color:          white;
    border-radius:  var(--r-full);
    padding:        1px 6px;
    min-width:      18px;
    text-align:     center;
    line-height:    16px;
}

.sidebar-footer {
    padding:        12px 10px;
    border-top:     1px solid var(--border);
}

.sidebar-user {
    display:        flex;
    align-items:    center;
    gap:            9px;
    padding:        8px 10px;
    border-radius:  var(--r-sm);
    cursor:         pointer;
    transition:     background var(--t-fast);
}

.sidebar-user:hover { background: var(--gray-100); }

.sidebar-avatar {
    width:           32px;
    height:          32px;
    border-radius:   var(--r-full);
    background:      var(--gray-800);
    color:           white;
    display:         flex;
    align-items:     center;
    justify-content: center;
    font-size:       13px;
    font-weight:     600;
    flex-shrink:     0;
}

.sidebar-user-info {
    overflow: hidden;
    flex: 1;
}

.sidebar-user-name {
    font-size:    13px;
    font-weight:  500;
    color:        var(--text-primary);
    white-space:  nowrap;
    overflow:     hidden;
    text-overflow:ellipsis;
}

.sidebar-user-role {
    font-size:    11.5px;
    color:        var(--text-tertiary);
    text-transform: capitalize;
}

/* ── Main area ─────────────────────────────────────────────── */
.main-area {
    flex:        1;
    margin-left: var(--sidebar-w);
    display:     flex;
    flex-direction: column;
    min-height:  100vh;
}

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

.topbar-breadcrumb {
    display:     flex;
    align-items: center;
    gap:         6px;
    flex:        1;
    min-width:   0;
}

.breadcrumb-item {
    font-size:   13.5px;
    color:       var(--text-tertiary);
    white-space: nowrap;
}

.breadcrumb-item.current {
    color:       var(--text-primary);
    font-weight: 500;
    overflow:    hidden;
    text-overflow: ellipsis;
}

.breadcrumb-sep {
    color: var(--gray-300);
    font-size: 13px;
    flex-shrink: 0;
}

.topbar-actions {
    display:     flex;
    align-items: center;
    gap:         8px;
    flex-shrink: 0;
}

.topbar-icon-btn {
    width:           34px;
    height:          34px;
    border-radius:   var(--r-sm);
    border:          1px solid var(--border);
    background:      var(--surface);
    display:         flex;
    align-items:     center;
    justify-content: center;
    cursor:          pointer;
    color:           var(--text-secondary);
    transition:      background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
    position:        relative;
}

.topbar-icon-btn:hover {
    background:    var(--gray-50);
    border-color:  var(--gray-300);
    color:         var(--text-primary);
}

.topbar-icon-btn svg { width: 16px; height: 16px; }

.topbar-notif-dot {
    position:   absolute;
    top:        6px;
    right:      6px;
    width:      7px;
    height:     7px;
    background: var(--red-600);
    border-radius: var(--r-full);
    border:     2px solid white;
}

/* ── Page content ──────────────────────────────────────────── */
.page-content {
    flex:    1;
    padding: var(--content-py) var(--content-px);
}

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

.page-title {
    font-size:   20px;
    font-weight: 600;
    color:       var(--text-primary);
    letter-spacing: -.01em;
    line-height: 1.3;
}

.page-subtitle {
    font-size:  13px;
    color:      var(--text-secondary);
    margin-top: 2px;
}

.page-actions {
    display:    flex;
    align-items:center;
    gap:        8px;
    flex-shrink:0;
}

/* ── Stat cards ─────────────────────────────────────────────── */
.stats-grid {
    display:               grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap:                   16px;
    margin-bottom:         28px;
}

.stat-card {
    background:    var(--surface);
    border:        1px solid var(--border);
    border-radius: var(--r-lg);
    padding:       20px 22px;
}

.stat-label {
    font-size:   12.5px;
    font-weight: 500;
    color:       var(--text-secondary);
    letter-spacing: .01em;
}

.stat-value {
    font-size:   26px;
    font-weight: 700;
    color:       var(--text-primary);
    letter-spacing: -.03em;
    margin-top:  6px;
    line-height: 1;
}

.stat-value.text-success { color: var(--green-600); }
.stat-value.text-warning { color: var(--amber-600); }
.stat-value.text-danger  { color: var(--red-600);   }

.stat-footer {
    font-size:  12px;
    color:      var(--text-tertiary);
    margin-top: 6px;
}

/* ── Card ───────────────────────────────────────────────────── */
.card {
    background:    var(--surface);
    border:        1px solid var(--border);
    border-radius: var(--r-lg);
    overflow:      hidden;
}

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

.card-title {
    font-size:   14px;
    font-weight: 600;
    color:       var(--text-primary);
}

.card-subtitle {
    font-size:  12.5px;
    color:      var(--text-secondary);
    margin-top: 1px;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding:        14px 20px;
    border-top:     1px solid var(--border);
    background:     var(--gray-50);
    display:        flex;
    align-items:    center;
    justify-content:space-between;
    gap:            12px;
}

/* ── Table ──────────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

.data-table thead tr {
    border-bottom: 2px solid var(--border);
}

.data-table th {
    padding:        10px 14px;
    text-align:     left;
    font-size:      11.5px;
    font-weight:    600;
    color:          var(--text-secondary);
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space:    nowrap;
    background:     var(--gray-50);
}

.data-table th:first-child { padding-left: 20px; }
.data-table th:last-child  { padding-right: 20px; }

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition:    background var(--t-fast);
}

.data-table tbody tr:last-child { border-bottom: none; }

.data-table tbody tr:hover { background: var(--gray-50); }

.data-table td {
    padding:     12px 14px;
    color:       var(--text-primary);
    vertical-align: middle;
}

.data-table td:first-child { padding-left: 20px; }
.data-table td:last-child  { padding-right: 20px; }

.table-empty {
    padding:    48px 20px;
    text-align: center;
    color:      var(--text-tertiary);
    font-size:  13.5px;
}

.table-empty-title {
    font-size:   14px;
    font-weight: 500;
    color:       var(--text-secondary);
    margin-bottom: 4px;
}

/* Checkbox column */
.data-table .col-check {
    width:    44px;
    padding-right: 0;
}

/* Actions column */
.data-table .col-actions {
    width:      120px;
    text-align: right;
}

/* Student name cell */
.student-cell {
    display:    flex;
    align-items:center;
    gap:        10px;
}

.student-avatar {
    width:           32px;
    height:          32px;
    border-radius:   var(--r-full);
    background:      var(--gray-200);
    color:           var(--gray-600);
    display:         flex;
    align-items:     center;
    justify-content: center;
    font-size:       12px;
    font-weight:     600;
    flex-shrink:     0;
    overflow:        hidden;
}

.student-avatar img {
    width:     100%;
    height:    100%;
    object-fit:cover;
}

.student-name {
    font-weight: 500;
    color:       var(--text-primary);
    line-height: 1.3;
}

.student-enrollment {
    font-size:  12px;
    color:      var(--text-tertiary);
    margin-top: 1px;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
    display:       inline-flex;
    align-items:   center;
    gap:           4px;
    padding:       2px 8px;
    border-radius: var(--r-full);
    font-size:     11.5px;
    font-weight:   500;
    line-height:   18px;
    white-space:   nowrap;
}

.badge-success { background: var(--green-100);  color: var(--green-700); }
.badge-warning { background: var(--amber-100);  color: var(--amber-700); }
.badge-danger  { background: var(--red-100);    color: var(--red-700);   }
.badge-info    { background: var(--sky-100);    color: var(--sky-600);   }
.badge-neutral { background: var(--gray-100);   color: var(--gray-600);  }
.badge-primary { background: var(--blue-100);   color: var(--blue-700);  }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    gap:             6px;
    padding:         0 14px;
    height:          34px;
    border-radius:   var(--r-sm);
    font-size:       13.5px;
    font-weight:     500;
    border:          1px solid transparent;
    cursor:          pointer;
    transition:      background var(--t-fast), border-color var(--t-fast),
                     box-shadow var(--t-fast), color var(--t-fast);
    white-space:     nowrap;
    text-decoration: none;
    line-height:     1;
    user-select:     none;
}

.btn:focus-visible {
    outline:     2px solid var(--primary);
    outline-offset: 2px;
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-sm {
    height:      28px;
    padding:     0 10px;
    font-size:   12.5px;
    border-radius: var(--r-xs);
}

.btn-sm svg { width: 13px; height: 13px; }

/* Primary */
.btn-primary {
    background:  var(--primary);
    border-color:var(--primary);
    color:       white;
}
.btn-primary:hover {
    background:  var(--primary-hover);
    border-color:var(--primary-hover);
}

/* Secondary */
.btn-secondary {
    background:  var(--surface);
    border-color:var(--border-input);
    color:       var(--text-primary);
}
.btn-secondary:hover {
    background:  var(--gray-50);
    border-color:var(--gray-300);
}

/* Danger */
.btn-danger {
    background:  var(--red-600);
    border-color:var(--red-600);
    color:       white;
}
.btn-danger:hover {
    background:  var(--red-700);
    border-color:var(--red-700);
}

/* Ghost */
.btn-ghost {
    background:   transparent;
    border-color: transparent;
    color:        var(--text-secondary);
}
.btn-ghost:hover {
    background:  var(--gray-100);
    color:       var(--text-primary);
}

/* Link */
.btn-link {
    background:  transparent;
    border-color:transparent;
    color:       var(--primary);
    padding:     0;
    height:      auto;
}
.btn-link:hover { color: var(--primary-hover); text-decoration: underline; }

.btn:disabled, .btn[disabled] {
    opacity: .45;
    cursor:  not-allowed;
    pointer-events: none;
}

/* ── Form elements ──────────────────────────────────────────── */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display:       block;
    font-size:     13px;
    font-weight:   500;
    color:         var(--text-primary);
    margin-bottom: 6px;
}

.form-label .required {
    color:       var(--red-600);
    margin-left: 2px;
}

.form-control {
    width:         100%;
    height:        36px;
    padding:       0 11px;
    border:        1px solid var(--border-input);
    border-radius: var(--r-sm);
    background:    var(--surface);
    color:         var(--text-primary);
    font-size:     13.5px;
    outline:       none;
    transition:    border-color var(--t-fast), box-shadow var(--t-fast);
    appearance:    none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow:   0 0 0 3px var(--primary-ring);
}

.form-control::placeholder { color: var(--text-tertiary); }
.form-control:disabled, .form-control[readonly] {
    background:  var(--gray-100);
    color:       var(--text-secondary);
    cursor:      not-allowed;
}

textarea.form-control {
    height:      auto;
    min-height:  90px;
    padding:     9px 11px;
    resize:      vertical;
    line-height: 1.5;
}

select.form-control {
    padding-right: 30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat:   no-repeat;
    background-position: right 10px center;
    cursor: pointer;
}

.form-hint {
    font-size:  12px;
    color:      var(--text-tertiary);
    margin-top: 4px;
}

.form-error {
    font-size:  12px;
    color:      var(--red-600);
    margin-top: 4px;
    display:    flex;
    align-items:center;
    gap:        4px;
}

.form-control.is-invalid {
    border-color: var(--red-600);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px var(--red-100);
}

/* Toggle / Yes-No */
.toggle-wrap {
    display:    flex;
    align-items:center;
    gap:        10px;
    cursor:     pointer;
    user-select:none;
}

.toggle-input { display: none; }

.toggle-track {
    width:         42px;
    height:        24px;
    border-radius: var(--r-full);
    background:    var(--gray-300);
    position:      relative;
    transition:    background var(--t);
    flex-shrink:   0;
}

.toggle-thumb {
    width:         18px;
    height:        18px;
    border-radius: var(--r-full);
    background:    white;
    position:      absolute;
    top:           3px;
    left:          3px;
    box-shadow:    var(--shadow-xs);
    transition:    left var(--t);
}

.toggle-input:checked + .toggle-track {
    background: var(--primary);
}

.toggle-input:checked + .toggle-track .toggle-thumb {
    left: 21px;
}

.toggle-label {
    font-size:  13.5px;
    color:      var(--text-primary);
    font-weight:450;
}

/* Checkbox */
.checkbox-wrap {
    display:    flex;
    align-items:center;
    gap:        8px;
    cursor:     pointer;
}

input[type="checkbox"] {
    width:         15px;
    height:        15px;
    border:        1.5px solid var(--border-input);
    border-radius: var(--r-xs);
    appearance:    none;
    cursor:        pointer;
    transition:    background var(--t-fast), border-color var(--t-fast);
    position:      relative;
    flex-shrink:   0;
    background:    white;
}

input[type="checkbox"]:checked {
    background:    var(--primary);
    border-color:  var(--primary);
}

input[type="checkbox"]:checked::after {
    content:  '';
    position: absolute;
    top:      2px;
    left:     4px;
    width:    5px;
    height:   9px;
    border:   2px solid white;
    border-top:   none;
    border-left:  none;
    transform:    rotate(45deg);
}

input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Form grid */
.form-grid {
    display:               grid;
    grid-template-columns: repeat(2, 1fr);
    gap:                   0 20px;
}

.form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.form-col-full { grid-column: 1 / -1; }

.form-section {
    margin-bottom: 28px;
}

.form-section-title {
    font-size:     13px;
    font-weight:   600;
    color:         var(--text-secondary);
    letter-spacing:.04em;
    text-transform:uppercase;
    margin-bottom: 16px;
    padding-bottom:10px;
    border-bottom: 1px solid var(--border);
}

/* ── Filter bar ─────────────────────────────────────────────── */
.filter-bar {
    background:    var(--surface);
    border:        1px solid var(--border);
    border-radius: var(--r-lg);
    padding:       16px 20px;
    margin-bottom: 16px;
}

.filter-bar-top {
    display:     flex;
    align-items: center;
    gap:         10px;
    flex-wrap:   wrap;
}

.filter-search-wrap {
    position:   relative;
    flex:       1;
    min-width:  200px;
}

.filter-search-wrap svg {
    position:    absolute;
    left:        11px;
    top:         50%;
    transform:   translateY(-50%);
    width:       15px;
    height:      15px;
    color:       var(--text-tertiary);
    pointer-events: none;
}

.filter-search {
    width:         100%;
    height:        34px;
    padding:       0 11px 0 34px;
    border:        1px solid var(--border-input);
    border-radius: var(--r-sm);
    background:    var(--surface);
    font-size:     13.5px;
    color:         var(--text-primary);
    outline:       none;
    transition:    border-color var(--t-fast), box-shadow var(--t-fast);
}

.filter-search:focus {
    border-color: var(--primary);
    box-shadow:   0 0 0 3px var(--primary-ring);
}

.filter-select {
    height:        34px;
    padding:       0 30px 0 11px;
    border:        1px solid var(--border-input);
    border-radius: var(--r-sm);
    background:    var(--surface);
    font-size:     13px;
    color:         var(--text-primary);
    outline:       none;
    cursor:        pointer;
    appearance:    none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat:   no-repeat;
    background-position: right 9px center;
    transition:    border-color var(--t-fast);
    min-width:     130px;
    font-family:   var(--font);
}

.filter-select:focus { border-color: var(--primary); }

.filter-chips {
    display:    flex;
    align-items:center;
    gap:        6px;
    flex-wrap:  wrap;
    margin-top: 10px;
}

.filter-chip {
    display:       inline-flex;
    align-items:   center;
    gap:           5px;
    padding:       3px 8px 3px 10px;
    border-radius: var(--r-full);
    background:    var(--blue-50);
    border:        1px solid var(--blue-200);
    font-size:     12.5px;
    color:         var(--blue-700);
    font-weight:   500;
}

.filter-chip-remove {
    width:      16px;
    height:     16px;
    border-radius:var(--r-full);
    background: transparent;
    border:     none;
    cursor:     pointer;
    color:      var(--blue-500);
    display:    flex;
    align-items:center;
    justify-content:center;
    padding:    0;
    transition: background var(--t-fast);
}

.filter-chip-remove:hover { background: var(--blue-100); }
.filter-chip-remove svg { width: 10px; height: 10px; }

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
    display:     flex;
    align-items: center;
    gap:         4px;
}

.page-link {
    display:         flex;
    align-items:     center;
    justify-content: center;
    width:           32px;
    height:          32px;
    border-radius:   var(--r-sm);
    border:          1px solid var(--border);
    font-size:       13px;
    color:           var(--text-secondary);
    background:      var(--surface);
    transition:      background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
    cursor:          pointer;
    text-decoration: none;
}

.page-link:hover {
    background:  var(--gray-100);
    border-color:var(--gray-300);
    color:       var(--text-primary);
}

.page-link.active {
    background:  var(--primary);
    border-color:var(--primary);
    color:       white;
    font-weight: 600;
}

.page-link.disabled {
    opacity:        .4;
    pointer-events: none;
}

.page-info {
    font-size:  13px;
    color:      var(--text-secondary);
    margin-left:4px;
}

/* ── Alerts / Flash messages ────────────────────────────────── */
.alert {
    display:       flex;
    align-items:   flex-start;
    gap:           10px;
    padding:       12px 16px;
    border-radius: var(--r);
    border:        1px solid transparent;
    font-size:     13.5px;
    margin-bottom: 16px;
}

.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

.alert-success {
    background:  var(--green-50);
    border-color:var(--green-100);
    color:       var(--green-700);
}

.alert-error {
    background:  var(--red-50);
    border-color:var(--red-100);
    color:       var(--red-700);
}

.alert-warning {
    background:  var(--amber-50);
    border-color:var(--amber-100);
    color:       var(--amber-700);
}

.alert-info {
    background:  var(--sky-50);
    border-color:var(--sky-100);
    color:       var(--sky-600);
}

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
    display:          none;
    position:         fixed;
    inset:            0;
    background:       rgba(15,23,42,.45);
    z-index:          100;
    align-items:      center;
    justify-content:  center;
    padding:          24px;
    backdrop-filter:  blur(2px);
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background:    var(--surface);
    border-radius: var(--r-xl);
    box-shadow:    var(--shadow-modal);
    width:         100%;
    max-width:     520px;
    max-height:    90vh;
    display:       flex;
    flex-direction:column;
    animation:     modal-in var(--t-slow) ease;
}

.modal-lg { max-width: 720px; }
.modal-sm { max-width: 380px; }

@keyframes modal-in {
    from { opacity: 0; transform: translateY(-10px) scale(.98); }
    to   { opacity: 1; transform: translateY(0)     scale(1);   }
}

.modal-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    padding:         18px 22px 16px;
    border-bottom:   1px solid var(--border);
    flex-shrink:     0;
}

.modal-title {
    font-size:   15px;
    font-weight: 600;
    color:       var(--text-primary);
}

.modal-close {
    width:           30px;
    height:          30px;
    border-radius:   var(--r-sm);
    border:          none;
    background:      transparent;
    cursor:          pointer;
    display:         flex;
    align-items:     center;
    justify-content: center;
    color:           var(--text-tertiary);
    transition:      background var(--t-fast), color var(--t-fast);
}

.modal-close:hover {
    background: var(--gray-100);
    color:      var(--text-primary);
}

.modal-close svg { width: 16px; height: 16px; }

.modal-body {
    padding:    20px 22px;
    overflow-y: auto;
    flex:       1;
}

.modal-footer {
    display:         flex;
    align-items:     center;
    justify-content: flex-end;
    gap:             8px;
    padding:         14px 22px;
    border-top:      1px solid var(--border);
    flex-shrink:     0;
    background:      var(--gray-50);
    border-radius:   0 0 var(--r-xl) var(--r-xl);
}

/* ── Drag-and-drop list (field manager) ─────────────────────── */
.draggable-list {
    display:       flex;
    flex-direction:column;
    gap:           0;
}

.draggable-item {
    display:         flex;
    align-items:     center;
    gap:             12px;
    padding:         11px 16px;
    border-bottom:   1px solid var(--border);
    background:      var(--surface);
    transition:      background var(--t-fast);
    user-select:     none;
}

.draggable-item:last-child { border-bottom: none; }

.draggable-item:hover { background: var(--gray-50); }

.draggable-item.dragging {
    background: var(--blue-50);
    box-shadow: var(--shadow);
    border-radius: var(--r);
    border: 1px solid var(--blue-200);
    opacity: .95;
}

.drag-handle {
    cursor:  grab;
    color:   var(--text-tertiary);
    display: flex;
    padding: 2px 0;
    flex-shrink: 0;
}

.drag-handle:active { cursor: grabbing; }
.drag-handle svg    { width: 14px; height: 14px; }

.draggable-item-info {
    flex: 1;
    min-width: 0;
}

.draggable-item-label {
    font-size:   13.5px;
    font-weight: 500;
    color:       var(--text-primary);
}

.draggable-item-meta {
    font-size:  12px;
    color:      var(--text-tertiary);
    margin-top: 1px;
}

.draggable-item-toggles {
    display:    flex;
    align-items:center;
    gap:        16px;
    flex-shrink:0;
}

.toggle-col {
    display:       flex;
    flex-direction:column;
    align-items:   center;
    gap:           4px;
    min-width:     52px;
}

.toggle-col-label {
    font-size:  10.5px;
    color:      var(--text-tertiary);
    text-align: center;
    line-height:1.2;
}

.draggable-item-actions {
    display:    flex;
    align-items:center;
    gap:        4px;
    flex-shrink:0;
}

.core-tag {
    font-size:    10.5px;
    color:        var(--text-tertiary);
    border:       1px solid var(--border);
    border-radius:var(--r-full);
    padding:      1px 7px;
    font-weight:  500;
}

/* ── Profile layout ─────────────────────────────────────────── */
.profile-header {
    display:     flex;
    align-items: flex-start;
    gap:         20px;
    padding:     24px;
    border-bottom:1px solid var(--border);
}

.profile-photo {
    width:         72px;
    height:        72px;
    border-radius: var(--r-xl);
    background:    var(--gray-200);
    object-fit:    cover;
    flex-shrink:   0;
    display:       flex;
    align-items:   center;
    justify-content:center;
    overflow:      hidden;
    font-size:     24px;
    font-weight:   600;
    color:         var(--gray-500);
}

.profile-photo img { width: 100%; height: 100%; object-fit: cover; }

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

.profile-name {
    font-size:   20px;
    font-weight: 700;
    color:       var(--text-primary);
    letter-spacing:-.01em;
    line-height: 1.2;
}

.profile-enrollment {
    font-size:   13.5px;
    color:       var(--text-secondary);
    margin-top:  3px;
    font-family: 'SF Mono','Fira Code',monospace;
}

.profile-tags {
    display:    flex;
    align-items:center;
    gap:        6px;
    flex-wrap:  wrap;
    margin-top: 8px;
}

.profile-detail-grid {
    display:               grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap:                   0;
}

.profile-detail-item {
    padding:     14px 20px;
    border-bottom:1px solid var(--border);
    border-right: 1px solid var(--border);
}

.profile-detail-item:nth-child(even) { border-right: none; }

.profile-detail-label {
    font-size:  11.5px;
    color:      var(--text-tertiary);
    font-weight:500;
    letter-spacing:.03em;
    text-transform:uppercase;
}

.profile-detail-value {
    font-size:  13.5px;
    color:      var(--text-primary);
    margin-top: 3px;
    font-weight:450;
    word-break: break-word;
}

/* ── Skeleton loading ───────────────────────────────────────── */
@keyframes shimmer {
    from { background-position: -200% 0; }
    to   { background-position:  200% 0; }
}

.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: var(--r-sm);
}

/* ── Utility ─────────────────────────────────────────────────── */
.text-muted       { color: var(--text-secondary); }
.text-tertiary    { color: var(--text-tertiary); }
.text-success     { color: var(--green-600); }
.text-danger      { color: var(--red-600); }
.text-warning     { color: var(--amber-600); }
.text-primary-c   { color: var(--primary); }
.font-mono        { font-family: 'SF Mono','Fira Code',monospace; }
.font-medium      { font-weight: 500; }
.font-semibold    { font-weight: 600; }
.flex             { display: flex; }
.items-center     { align-items: center; }
.justify-between  { justify-content: space-between; }
.gap-2            { gap: 8px; }
.gap-3            { gap: 12px; }
.mt-1             { margin-top: 4px; }
.mt-2             { margin-top: 8px; }
.mt-4             { margin-top: 16px; }
.mb-4             { margin-bottom: 16px; }
.mb-6             { margin-bottom: 24px; }
.truncate         { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-only          { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .form-grid   { grid-template-columns: 1fr; }
    .form-grid-3 { grid-template-columns: repeat(2,1fr); }
    .stats-grid  { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 768px) {
    :root {
        --content-px: 16px;
        --content-py: 20px;
    }
    .sidebar { transform: translateX(-100%); transition: transform var(--t); }
    .sidebar.open { transform: translateX(0); }
    .main-area { margin-left: 0; }
    .stats-grid { grid-template-columns: repeat(2,1fr); }
    .form-grid-3 { grid-template-columns: 1fr; }
    .topbar { padding: 0 16px; }
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
