/* =====================================================================
   Staff Portal — "Arch & Circle" Mid-Century Sage Geometric
   Pattern : Modern Geometric / Scandinavian / Arch & Circle
   Palette : Sage #7A8C73 · Olive #5C6B55 · Moss #8A9980
             Light Sage #B6C0AE · Warm Ivory #E9E6D8 · Linen #D8D4C7
   ===================================================================== */

:root{
    /* Backgrounds */
    --bg: #E9E6D8;             /* warm ivory */
    --paper: #FFFDF5;          /* warm white for cards / inputs */
    --surface: #D8D4C7;        /* linen beige */
    --surface-2: #B6C0AE;      /* light sage */

    /* Greens */
    --accent: #7A8C73;         /* sage — primary */
    --accent-soft: #B6C0AE;    /* light sage */
    --accent-tint: #CBD3C1;    /* pale sage tint for gradients */
    --moss: #8A9980;           /* muted medium green */
    --accent-dark: #5C6B55;    /* olive */
    --accent-ink: #2A3325;     /* deep olive ink */
    --sage: #7A8C73;

    /* Text */
    --text: #22291E;
    --text-secondary: #3C4534;
    --muted: #6E7663;
    --text-on-accent: #FDFCF4;
    --on-dark: #EDEAE0;

    /* Borders */
    --border: #CFC9B8;
    --border-soft: rgba(207,201,184,0.85);
    --line: #CFC9B8;
    --line-strong: #B6C0AE;

    /* Legacy mappings for compatibility */
    --bg-light-1: #E9E6D8;
    --bg-light-2: #F2F0E6;
    --grey-1: #D8D4C7;
    --grey-2: #B6C0AE;
    --grey-3: #CFC9B8;
    --grey-4: #C2CBB6;

    --text-dark: #22291E;
    --text-muted: #6E7663;
    --danger: #A6492A;         /* warm terracotta */
    --danger-soft: #F7E9E1;
    --success: #5F7A3F;
    --success-soft: #E4EAD3;

    --radius: 28px;
    --radius-lg: 36px;
    --radius-sm: 16px;
    --radius-pill: 999px;

    --shadow: 0 12px 40px rgba(47,54,38,.10);
    --shadow-hover: 0 20px 56px rgba(47,54,38,.15);
    --shadow-soft: 0 8px 28px rgba(47,54,38,.07);
    --shadow-accent: 0 12px 32px rgba(92,107,85,.30);

    --font-display: "Geist", "SF Pro Display", "Space Grotesk", -apple-system, sans-serif;
    --font-body: "Geist", "Inter", "SF Pro Text", -apple-system, sans-serif;
}

/* Base Reset */
*, *::before, *::after { box-sizing: border-box; }

html{
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body{
    margin: 0;
    font-family: var(--font-body);
    color: var(--text);
    background-color: var(--bg);
    /* Subtle Arch & Circle tile over warm ivory gradient */
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cg opacity='.30'%3E%3Cpath d='M0 120 A60 60 0 0 1 120 120 Z' fill='%237A8C73'/%3E%3Ccircle cx='60' cy='60' r='16' fill='none' stroke='%237A8C73' stroke-width='2.5'/%3E%3Crect x='120' width='120' height='120' fill='%238A9980'/%3E%3Cpath d='M120 0 L190 0 A70 70 0 0 1 120 70 Z' fill='%23E9E6D8'/%3E%3Crect y='120' width='120' height='108' fill='%23B6C0AE'/%3E%3Cg fill='%23E9E6D8'%3E%3Crect x='10' y='120' width='7' height='108'/%3E%3Crect x='30' y='120' width='7' height='108'/%3E%3Crect x='50' y='120' width='7' height='108'/%3E%3Crect x='70' y='120' width='7' height='108'/%3E%3Crect x='90' y='120' width='7' height='108'/%3E%3C/g%3E%3Crect y='228' width='240' height='12' fill='%23D8D4C7'/%3E%3Ccircle cx='180' cy='180' r='56' fill='%235C6B55'/%3E%3Ccircle cx='180' cy='180' r='40' fill='none' stroke='%23E9E6D8' stroke-width='2'/%3E%3C/g%3E%3C/svg%3E"),
        linear-gradient(180deg, #F2F0E4 0%, #E9E6D8 34%, #E3DFCF 100%);
    background-repeat: repeat, no-repeat;
    background-size: 260px 260px, cover;
    background-attachment: fixed, fixed;
    min-height: 100vh;
    letter-spacing: -0.01em;
}

::selection{ background: var(--accent-soft); color: var(--text); }

h1, h2, h3, .brand, .code, .section-badge, .nav-title strong{
    font-family: var(--font-display);
    letter-spacing: -0.03em;
}

/* =====================================================================
   ANIMATIONS — Apple level smoothness
   ===================================================================== */
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(22px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeScaleIn {
    from { opacity: 0; transform: scale(.96) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes popIn {
    from { opacity: 0; transform: scale(.92) translateY(16px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes slideDownFade {
    from { opacity: 0; transform: translateY(-20px); filter: blur(8px); }
    to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}
@keyframes rowFadeIn {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes auroraDrift {
    0%   { transform: translate(0, 0) rotate(0deg); }
    50%  { transform: translate(2.4%, 3%) rotate(2deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}
@keyframes auroraDriftReverse {
    0%   { transform: translate(0, 0) rotate(0deg); }
    50%  { transform: translate(-2.4%, -2%) rotate(-2deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}
@keyframes gridPan {
    from { transform: translate(0,0); }
    to   { transform: translate(44px,44px); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes floatSoft {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
@keyframes pulseAccent {
    0% { box-shadow: 0 0 0 0 rgba(122,140,115,0.45); }
    70% { box-shadow: 0 0 0 14px rgba(122,140,115,0); }
    100% { box-shadow: 0 0 0 0 rgba(122,140,115,0); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* =====================================================================
   LOGIN PAGE — Sage Geometric Composition
   ===================================================================== */
.login-wrapper{
    position: relative;
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    overflow: hidden;
    isolation: isolate;
    background: radial-gradient(
        circle at 50% 30%,
        #F6F4E9 0%,
        #E9E6D8 36%,
        #D8D4C7 66%,
        #B6C0AE 92%,
        #8A9980 130%
    );
}

.login-bg{
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(
        circle at 50% 30%,
        #F6F4E9 0%,
        #E9E6D8 36%,
        #D8D4C7 66%,
        #B6C0AE 92%,
        #8A9980 130%
    );
    overflow: hidden;
}

/* Arch & Circle tile, gently revealed around the edges */
.login-bg::before{
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cpath d='M0 120 A60 60 0 0 1 120 120 Z' fill='%237A8C73'/%3E%3Ccircle cx='60' cy='60' r='16' fill='none' stroke='%23E9E6D8' stroke-width='2.5'/%3E%3Crect x='120' width='120' height='120' fill='%238A9980'/%3E%3Cpath d='M120 0 L190 0 A70 70 0 0 1 120 70 Z' fill='%23E9E6D8'/%3E%3Cg fill='%23E9E6D8'%3E%3Ccircle cx='152' cy='96' r='3'/%3E%3Ccircle cx='166' cy='96' r='3'/%3E%3Ccircle cx='180' cy='96' r='3'/%3E%3C/g%3E%3Crect y='120' width='120' height='108' fill='%23B6C0AE'/%3E%3Cg fill='%23E9E6D8'%3E%3Crect x='10' y='120' width='7' height='108'/%3E%3Crect x='30' y='120' width='7' height='108'/%3E%3Crect x='50' y='120' width='7' height='108'/%3E%3Crect x='70' y='120' width='7' height='108'/%3E%3Crect x='90' y='120' width='7' height='108'/%3E%3C/g%3E%3Crect y='228' width='240' height='12' fill='%23D8D4C7'/%3E%3Ccircle cx='180' cy='180' r='56' fill='%235C6B55'/%3E%3Ccircle cx='180' cy='180' r='40' fill='none' stroke='%23E9E6D8' stroke-width='2'/%3E%3C/svg%3E");
    background-size: 240px 240px;
    opacity: .22;
    mask-image: radial-gradient(ellipse 85% 75% at 50% 42%, transparent 30%, #000 88%);
    -webkit-mask-image: radial-gradient(ellipse 85% 75% at 50% 42%, transparent 30%, #000 88%);
}

.login-bg .aurora{
    position: absolute;
    will-change: transform;
}

/* Large woven sage circle */
.aurora-a{
    width: 58vw;
    max-width: 680px;
    aspect-ratio: 1;
    top: -16%;
    left: -12%;
    border-radius: 50%;
    background:
        repeating-linear-gradient(45deg, rgba(233,230,216,.14) 0 4px, transparent 4px 10px),
        repeating-linear-gradient(-45deg, rgba(233,230,216,.14) 0 4px, transparent 4px 10px),
        var(--accent);
    box-shadow: 0 30px 80px rgba(92,107,85,.30);
    animation: auroraDrift 26s ease-in-out infinite;
}

/* Olive half-dome arch rising from the bottom edge */
.aurora-b{
    width: clamp(340px, 46vw, 640px);
    aspect-ratio: 2 / 1;
    bottom: -2px;
    right: -7%;
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
    background:
        repeating-linear-gradient(45deg, rgba(233,230,216,.13) 0 4px, transparent 4px 10px),
        repeating-linear-gradient(-45deg, rgba(233,230,216,.13) 0 4px, transparent 4px 10px),
        var(--accent-dark);
    box-shadow: 0 -18px 60px rgba(42,51,37,.22);
    animation: auroraDriftReverse 30s ease-in-out infinite;
}

/* Moss ring — nods to the concentric swirl artwork */
.aurora-c{
    width: clamp(170px, 22vw, 260px);
    aspect-ratio: 1;
    top: 34%;
    left: 56%;
    border-radius: 50%;
    border: clamp(14px, 1.8vw, 24px) solid rgba(138,153,128,.55);
    opacity: .85;
    animation: floatSoft 9s ease-in-out infinite;
}

.grid-overlay{
    position: absolute;
    inset: -44px;
    background-image:
        linear-gradient(to right, rgba(34,41,30,0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(34,41,30,0.05) 1px, transparent 1px);
    background-size: 44px 44px;
    animation: gridPan 20s linear infinite;
    mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 35%, transparent 85%);
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 35%, transparent 85%);
    opacity: .55;
}

.login-card{
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    background: rgba(255,253,246,0.88);
    backdrop-filter: blur(24px) saturate(1.25);
    -webkit-backdrop-filter: blur(24px) saturate(1.25);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-hover), inset 0 1px 0 rgba(255,255,255,0.85);
    border: 1px solid rgba(255,255,255,0.65);
    padding: 42px 36px 32px;
    animation: popIn .65s cubic-bezier(.22,.9,.32,1) both;
}

.login-card::before{
    content: "";
    position: absolute;
    top: 0; left: 20px; right: 20px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.9), transparent);
}
.login-card::after{
    content: "";
    position: absolute;
    top: 14px; left: 50%; transform: translateX(-50%);
    width: 42px; height: 5px;
    border-radius: 99px;
    background: var(--surface-2);
    opacity: .55;
}

.login-card-head{
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 6px;
}
.brand-mark{
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background:
        repeating-linear-gradient(45deg, rgba(233,230,216,.16) 0 3px, transparent 3px 7px),
        repeating-linear-gradient(-45deg, rgba(233,230,216,.16) 0 3px, transparent 3px 7px),
        var(--accent-dark);
    color: var(--text-on-accent);
    box-shadow: 0 8px 20px rgba(42,51,37,0.24);
    font-weight: 800;
    letter-spacing: -0.02em;
}
.login-card h1{
    margin: 0;
    font-size: 22px;
    font-weight: 720;
    color: var(--text);
    letter-spacing: -0.04em;
    line-height: 1.1;
}
.login-card p.sub{
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}
.login-blurb{
    margin: 18px 0 24px;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-secondary);
    font-weight: 450;
}
.login-foot-tags{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.login-foot-tags span{
    font-size: 11px;
    font-weight: 650;
    color: var(--text-secondary);
    background: var(--surface);
    padding: 6px 12px;
    border-radius: 99px;
    border: 1px solid var(--border);
    letter-spacing: -0.01em;
}

/* Forms — Luxury warm inputs */
.form-group{ margin-bottom: 20px; }
.form-group label{
    display: block;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .6px;
}
.form-group input,
.form-group select{
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1.2px solid var(--border);
    background: rgba(255,253,246,0.95);
    font-size: 14.5px;
    font-family: inherit;
    font-weight: 500;
    color: var(--text);
    outline: none;
    transition: all .22s cubic-bezier(.22,.9,.32,1);
    box-shadow: 0 1px 2px rgba(47,54,38,.04);
}
.form-group input::placeholder{ color: var(--muted); font-weight: 450; }
.form-group input:focus,
.form-group select:focus{
    border-color: var(--accent-dark);
    background: var(--paper);
    box-shadow: 0 0 0 4px rgba(92,107,85,0.14), 0 4px 16px rgba(47,54,38,.07);
}
.form-group input:disabled,
.form-group select:disabled{
    opacity: .55;
    cursor: not-allowed;
}

/* Buttons — Woven Sage CTA */
.btn{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 22px;
    border: none;
    border-radius: 99px;
    background:
        repeating-linear-gradient(45deg, rgba(253,252,244,.10) 0 3px, transparent 3px 7px),
        repeating-linear-gradient(-45deg, rgba(253,252,244,.10) 0 3px, transparent 3px 7px),
        var(--accent);
    color: var(--text-on-accent);
    font-size: 14px;
    font-weight: 720;
    letter-spacing: -0.02em;
    cursor: pointer;
    transition: all .22s cubic-bezier(.22,.9,.32,1);
    box-shadow: var(--shadow-accent);
}
.btn:hover{
    background:
        repeating-linear-gradient(45deg, rgba(253,252,244,.10) 0 3px, transparent 3px 7px),
        repeating-linear-gradient(-45deg, rgba(253,252,244,.10) 0 3px, transparent 3px 7px),
        var(--accent-dark);
    transform: translateY(-1px);
    box-shadow: 0 16px 36px rgba(92,107,85,.40);
}
.btn:active{ transform: scale(.98) translateY(0); }
.btn:disabled{
    background: var(--surface);
    color: var(--muted);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}
.btn-block{ width: 100%; text-align: center; }

.btn-save-marks{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 20px;
    border: none;
    border-radius: 99px;
    background:
        repeating-linear-gradient(45deg, rgba(237,234,224,.08) 0 3px, transparent 3px 7px),
        repeating-linear-gradient(-45deg, rgba(237,234,224,.08) 0 3px, transparent 3px 7px),
        var(--accent-ink);
    color: var(--on-dark);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: all .2s ease;
    box-shadow: 0 6px 18px rgba(42,51,37,.24);
}
.btn-save-marks:hover{ transform: translateY(-1px); box-shadow: 0 10px 26px rgba(42,51,37,.30); }
.btn-save-marks:active{ transform: scale(.98); }

.alert{
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 13px;
    margin-bottom: 18px;
    font-weight: 550;
    animation: fadeSlideUp .4s ease both;
    border: 1px solid transparent;
}
.alert-error{
    background: var(--danger-soft);
    color: #7E3520;
    border-color: #E6C4B4;
}
.alert-success{
    background: var(--success-soft);
    color: #3E5426;
    border-color: #C4D2A4;
}

@media (max-width: 480px){
    .login-wrapper{ padding: 20px 16px; }
    .login-card{ padding: 32px 24px 26px; border-radius: 26px; }
}

/* =====================================================================
   DASHBOARD SHELL — Frosted Ivory Glass
   ===================================================================== */
.topbar{
    background: rgba(233,230,216,0.82);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border-bottom: 1px solid var(--border);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 0 rgba(255,255,255,.55) inset, 0 8px 32px rgba(47,54,38,.07);
    position: sticky;
    top: 0;
    z-index: 20;
    animation: slideDownFade .55s cubic-bezier(.22,.9,.32,1) both;
}
.topbar .brand{
    font-size: 17px;
    font-weight: 750;
    color: var(--text);
    letter-spacing: -0.04em;
    display: flex;
    align-items: center;
    gap: 10px;
}
.topbar .brand::before{
    content: "";
    width: 28px; height: 28px;
    border-radius: 9px;
    background:
        repeating-linear-gradient(45deg, rgba(233,230,216,.22) 0 3px, transparent 3px 7px),
        repeating-linear-gradient(-45deg, rgba(233,230,216,.22) 0 3px, transparent 3px 7px),
        var(--accent-dark);
    display: inline-block;
    box-shadow: 0 4px 12px rgba(42,51,37,.22);
}
.topbar .staff-info{
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    font-weight: 500;
}
.topbar .staff-info .badge{
    background: var(--accent);
    color: var(--text-on-accent);
    padding: 6px 14px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 750;
    letter-spacing: -0.01em;
    box-shadow: 0 4px 12px rgba(122,140,115,.38);
}
.topbar a.logout{
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 650;
    font-size: 12.5px;
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 99px;
    background: rgba(255,253,246,0.75);
    transition: all .2s ease;
}
.topbar a.logout:hover{ background: var(--accent-ink); color: var(--on-dark); border-color: var(--accent-ink); transform: translateY(-1px); }

/* FULL WIDTH BACKGROUND — container takes 100% viewport, cards keep same design */
.container{
    max-width: none;
    width: 100%;
    margin: 20px 0 0 0;
    padding: 0 16px 48px;
    box-sizing: border-box;
}
.container > .card:nth-of-type(1),
.container > .card:nth-of-type(2){
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}
#studentPanel{
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.card{
    background: rgba(255,253,246,0.82);
    backdrop-filter: blur(18px) saturate(1.15);
    -webkit-backdrop-filter: blur(18px) saturate(1.15);
    border: 1px solid rgba(255,255,255,0.65);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.85);
    border-radius: var(--radius);
    padding: 26px 26px;
    margin-bottom: 22px;
    animation: fadeSlideUp .6s cubic-bezier(.22,.9,.32,1) both;
}
.card:nth-of-type(1){ animation-delay: .06s; }
.card:nth-of-type(2){ animation-delay: .14s; }
.card:nth-of-type(3){ animation-delay: .22s; }

.card h2{
    margin: 0;
    font-size: 15px;
    color: var(--text);
    font-weight: 700;
    letter-spacing: -0.03em;
}
.card-head-row{
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    margin-bottom: 20px;
}
.reset-link{
    font-size: 12.5px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 650;
    padding: 6px 12px;
    border-radius: 99px;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: all .15s ease;
}
.reset-link:hover{ color: var(--text); background: var(--paper); }

.count-pill{
    background: var(--accent);
    color: var(--text-on-accent);
    font-size: 11.5px;
    font-weight: 750;
    padding: 6px 14px;
    border-radius: 99px;
    box-shadow: 0 3px 10px rgba(122,140,115,.34);
}

.filters{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px,1fr));
    gap: 18px;
}
.filters .form-group{ margin-bottom: 0; }

/* Sections */
.section-block{
    margin-bottom: 30px;
    animation: fadeSlideUp .6s ease both;
}
.section-block:last-child{ margin-bottom: 0; }
.section-heading{
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.section-badge{
    background:
        repeating-linear-gradient(45deg, rgba(237,234,224,.10) 0 3px, transparent 3px 7px),
        repeating-linear-gradient(-45deg, rgba(237,234,224,.10) 0 3px, transparent 3px 7px),
        var(--accent-ink);
    color: var(--on-dark);
    font-size: 12px;
    font-weight: 700;
    padding: 7px 16px;
    border-radius: 99px;
    letter-spacing: -0.01em;
    box-shadow: 0 4px 14px rgba(42,51,37,.22);
}
.section-count{
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 600;
}

/* Paper Cards — Apple Card style */
.paper-grid{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px,1fr));
    gap: 18px;
}
.paper-card{
    background: rgba(255,253,246,0.92);
    border: 1px solid rgba(207,201,184,0.9);
    border-radius: 20px;
    padding: 18px 20px;
    cursor: pointer;
    transition: all .28s cubic-bezier(.22,.9,.32,1);
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: fadeScaleIn .5s ease both;
    box-shadow: 0 2px 12px rgba(47,54,38,.05), inset 0 1px 0 rgba(255,255,255,.9);
    position: relative;
    overflow: hidden;
}
.paper-card::before{
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent) 0%, var(--moss) 50%, var(--accent-dark) 100%);
    opacity: 0;
    transition: opacity .25s ease;
}
.paper-card:hover{
    box-shadow: var(--shadow-hover), inset 0 1px 0 rgba(255,255,255,.9);
    transform: translateY(-4px) scale(1.01);
    border-color: var(--accent-dark);
}
.paper-card:hover::before{ opacity: 1; }
.paper-card:active{ transform: translateY(-1px) scale(.99); }
.paper-card.is-active{
    border-color: var(--accent-dark);
    box-shadow: 0 0 0 2px var(--accent-dark), var(--shadow-hover);
    animation: fadeScaleIn .5s ease both, pulseAccent 1.2s ease-out .15s;
}
.paper-card.is-active::before{ opacity: 1; }

.paper-card-top{
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.paper-card .code{
    font-weight: 780;
    color: var(--text);
    font-size: 14.5px;
    letter-spacing: -0.03em;
}
.paper-card .title{
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.45;
    min-height: 18px;
    font-weight: 480;
}
.paper-card .meta{
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    font-size: 11px;
}
.paper-card-footer{
    margin-top: 6px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--accent-dark);
    display: flex;
    align-items: center;
    gap: 6px;
}
.paper-card-footer::after{
    content: "↗";
    font-size: 12px;
    transition: transform .2s ease;
    display: inline-block;
}
.paper-card:hover .paper-card-footer::after{ transform: translate(2px,-2px); }

.tag{
    padding: 4px 11px;
    border-radius: 99px;
    background: var(--surface);
    color: var(--text-secondary);
    font-weight: 650;
    white-space: nowrap;
    border: 1px solid var(--border);
    font-size: 10.5px;
    letter-spacing: -0.01em;
}
.tag.obe{ background: #DCE4D0; color: #3E4E2B; border-color: #BCCBA6; }
.tag.non-obe{ background: #F0E1D6; color: #7E4530; border-color: #DFC2B0; }

/* Component select */
.component-select-wrap{
    margin-bottom: 20px;
    padding: 18px 20px;
    background: rgba(255,253,246,0.8);
    border: 1px solid var(--border);
    border-radius: 18px;
    animation: fadeSlideUp .35s ease both;
    box-shadow: var(--shadow-soft);
}
.component-select-wrap label{
    display: block;
    margin-bottom: 10px;
    font-size: 11px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text);
}
.component-select-wrap select{
    width: 100%;
    max-width: 360px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1.2px solid var(--border);
    background: var(--paper);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    outline: none;
    cursor: pointer;
    transition: all .2s ease;
}
.component-select-wrap select:focus{
    border-color: var(--accent-dark);
    box-shadow: 0 0 0 4px rgba(92,107,85,0.14);
}

/* Mark inputs */
.mark-input{
    width: 92px;
    padding: 9px 12px;
    border-radius: 12px;
    border: 1.2px solid var(--border);
    background: var(--paper);
    font-size: 13px;
    font-weight: 650;
    color: var(--text);
    outline: none;
    transition: all .18s ease;
    box-shadow: 0 1px 3px rgba(47,54,38,.05);
}
.mark-input:focus{
    border-color: var(--accent-dark);
    box-shadow: 0 0 0 4px rgba(92,107,85,0.14);
}

.pattern-block{ margin-bottom: 20px; animation: fadeSlideUp .35s ease both; }
.pattern-heading{
    font-size: 12px;
    font-weight: 750;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 12px;
}

table.pattern-table tfoot .pattern-total-row td{
    background: var(--accent-soft);
    color: var(--text);
    font-weight: 800;
    border-top: 1.5px solid var(--text);
    border-bottom: none;
}

.save-marks-row{
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
    padding: 16px 20px;
    border: 1px solid var(--border);
    border-top: 0;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    background: rgba(233,230,216,0.75);
}
.save-status{
    font-size: 12.5px;
    font-weight: 650;
    color: var(--muted);
    min-width: 150px;
}
.save-status.save-ok{ color: var(--success); }
.save-status.save-fail{ color: var(--danger); }

/* Tables */
table.data-table{
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
}
table.data-table th{
    background: var(--surface);
    color: var(--text);
    text-align: left;
    padding: 12px 16px;
    font-weight: 750;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
}
table.data-table td{
    padding: 11px 16px;
    border-bottom: 1px solid rgba(207,201,184,0.65);
    background: rgba(255,253,246,0.75);
}
table.data-table tbody tr{ animation: rowFadeIn .35s ease both; }
table.data-table tr:hover td{ background: var(--paper); }
table.data-table tr:last-child td{ border-bottom: none; }

.empty-msg{
    padding: 36px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 13.5px;
    animation: fadeSlideUp .4s ease both;
}
.spinner{
    text-align: center;
    padding: 28px;
    font-size: 13px;
    color: var(--text);
    font-weight: 600;
}
.spinner::after{
    content: "";
    display: inline-block;
    width: 16px; height: 16px;
    margin-left: 10px;
    border: 2px solid var(--surface);
    border-top-color: var(--accent-dark);
    border-radius: 50%;
    vertical-align: middle;
    animation: spin .7s linear infinite;
}

#studentPanel{
    display: none;
    width: 100%;
    opacity: 0;
    transform: translateY(-16px);
    transition: all .32s cubic-bezier(.22,.9,.32,1);
}
#studentPanel.panel-open{
    opacity: 1;
    transform: translateY(0);
}
/* =====================================================================
   REMOVE EMPTY CHECKERED BOX — Keep only HCC logo box
   ===================================================================== */

/* Hide the empty checkered decorative box in topbar */
.topbar .brand::before {
    display: none !important;
}

/* Make the HCC logo brand-mark-sm the main visible logo */
.brand-mark-sm {
    background-image: url('https://hcctrichy.ac.in/img/logo.png') !important;
    background-color: #FFFDF5 !important;
    background-size: 80% !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-blend-mode: normal !important;
    border: 1.5px solid var(--accent) !important;
    box-shadow: 0 3px 10px rgba(92, 107, 85, 0.3) !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
    display: inline-flex !important;
}

.brand-mark-sm svg {
    display: none !important;
}
/* =====================================================================
   CLOSE PANEL BUTTON — Move to top position
   ===================================================================== */

.close-panel {
    float: right;
    position: relative;
    top: -12px;
    margin-top: -8px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: auto !important;
    height: auto !important;
    min-height: 36px;
    padding: 8px 16px !important;
    border-radius: 99px !important;
    background: var(--surface) !important;
    color: var(--text-secondary) !important;
    font-weight: 700 !important;
    font-size: 12.5px !important;
    letter-spacing: -0.01em;
    border: 1px solid var(--border) !important;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(47, 54, 38, 0.06);
    z-index: 5;
}

.close-panel:hover {
    background: var(--accent-ink) !important;
    color: var(--on-dark) !important;
    border-color: var(--accent-ink) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 14px rgba(42, 51, 37, 0.25);
}

.close-panel:active {
    transform: translateY(0) !important;
}

@media (max-width: 640px){
    .topbar{ flex-direction: column; align-items: flex-start; gap: 12px; padding: 14px 18px; }
    .topbar .staff-info{ flex-wrap: wrap; gap: 10px; }
    .container{ padding: 0 12px 32px; margin: 14px 0 0 0; width: 100%; max-width: none; }
    .card{ padding: 20px 18px; border-radius: 22px; }
    .component-select-wrap select{ max-width: 100%; }
}

/* =====================================================================
   QUESTION-WISE MARK ENTRY — upgraded
   ===================================================================== */
.compact-empty{ padding: 18px 4px; }
.pattern-empty{
    margin-top: 0;
    border: 1.5px dashed var(--border);
    border-radius: 18px;
    background: rgba(255,253,246,0.6);
}
.component-help{
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.6;
    font-weight: 450;
}
.pattern-summary{
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(255,253,246,0.95), rgba(216,212,199,0.55));
    box-shadow: var(--shadow-soft);
}
.pattern-eyebrow{
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 750;
    letter-spacing: .6px;
    text-transform: uppercase;
}
.pattern-summary h3{
    margin: 0;
    color: var(--text);
    font-family: var(--font-display);
    font-size: 15px;
    line-height: 1.35;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.pattern-stat-list{
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}
.pattern-stat{
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 99px;
    background: var(--paper);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}
.pattern-stat strong{
    color: var(--text);
    font-size: 12.5px;
}
.mode-stat{ color: var(--text); text-transform: capitalize; }

.table-scroll{
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--paper);
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-soft);
}
.table-scroll table{ min-width: 100%; }
.pattern-table-scroll table{ width: max-content; min-width: 100%; }
.pattern-table th,
.pattern-table td{
    max-width: 260px;
    min-width: 110px;
    white-space: normal;
    overflow-wrap: anywhere;
    vertical-align: top;
}
.pattern-table tfoot .pattern-total-row td{
    background: var(--accent-soft);
    color: var(--text);
    font-weight: 800;
    border-top: 2px solid var(--text) !important;
}
.pattern-table tfoot .pattern-total-row td[data-column="rbtlevel"]{
    background: var(--accent-ink);
    color: var(--on-dark);
}

.student-marks-scroll{
    max-height: 68vh;
    overflow: auto;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--paper);
    box-shadow: var(--shadow-soft);
}
.student-marks-table{
    width: max-content !important;
    min-width: 100%;
    border-collapse: separate !important;
    border-spacing: 0;
}
.student-marks-table th,
.student-marks-table td{
    white-space: nowrap;
    vertical-align: middle;
}
.student-marks-table thead th{
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--surface);
}
.student-marks-table .sticky-col{
    position: sticky;
    z-index: 2;
    background: var(--paper);
}
.student-marks-table thead .sticky-col{
    z-index: 5;
    background: var(--surface);
}
.student-marks-table .sticky-index{
    left: 0;
    width: 52px;
    min-width: 52px;
    text-align: center;
}
.student-marks-table .sticky-roll{
    left: 52px;
    width: 154px;
    min-width: 154px;
    text-align: left;
}
.student-marks-table .sticky-name{
    left: 206px;
    width: 190px;
    min-width: 190px;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    font-weight: 700;
    box-shadow: 8px 0 16px -12px rgba(42,51,37,.28);
}

.student-roll-stack{
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    min-width: 0;
    line-height: 1.1;
}
.student-roll-number{
    max-width: 100%;
    overflow: hidden;
    color: var(--text);
    font-size: 12px;
    font-weight: 850;
    text-overflow: ellipsis;
}
.student-register-number{
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    overflow: hidden;
    padding: 4px 8px;
    border: 1px solid rgba(95,122,63,.24);
    border-radius: 999px;
    background: var(--success-soft);
    color: var(--accent-dark);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.question-mark-head,
.total-mark-head{
    min-width: 122px;
    text-align: center !important;
}
.question-column-title{
    display: block;
    color: var(--text);
    font-size: 12.5px;
    font-weight: 800;
}
.question-mark-head small,
.total-mark-head small{
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    text-transform: none;
}
.total-mark-head{
    background: var(--accent-ink) !important;
}
.total-mark-head .question-column-title,
.total-mark-head small{
    color: var(--on-dark);
}
.question-mark-cell,
.student-total-cell{
    text-align: center;
}
.question-mark-input{
    width: 80px;
    text-align: center;
}
.mark-input.input-invalid{
    border-color: var(--danger);
    background: var(--danger-soft);
    box-shadow: 0 0 0 4px rgba(166,73,42,.12);
}
.student-total{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 86px;
    min-height: 36px;
    padding: 7px 12px;
    border-radius: 99px;
    background: var(--accent-soft);
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
}
.student-marks-table tr.row-total-invalid td{
    background: #FBF1EC;
}
.student-total.total-invalid{
    background: var(--danger-soft);
    color: var(--danger);
    box-shadow: inset 0 0 0 1px #E4B4A4;
}
.save-summary{
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-right: auto;
}
.save-summary strong{
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}
.save-summary span{
    color: var(--muted);
    font-size: 11.5px;
}
@media (max-width: 760px){
    .pattern-summary{ flex-direction: column; }
    .pattern-stat-list{ justify-content: flex-start; }
    .student-marks-scroll{ max-height: 72vh; }
    .save-marks-row{ align-items: stretch; border-radius: 0 0 18px 18px; }
    .save-summary,
    .btn-save-marks,
    .save-status{ width: 100%; }
    .btn-save-marks{ text-align: center; justify-content: center; }
}

/* =====================================================================
   INTERNAL ASSESSMENT PAGE — Sage Geometric Scoped
   ===================================================================== */
body.internal-entry-page{
    --page-bg: #E9E6D8;
    --surface: #FFFDF5;
    --surface-soft: #F1EEE1;
    --line: #CFC9B8;
    --line-strong: #B6C0AE;
    --primary: #5C6B55;
    --primary-dark: #22291E;
    --primary-soft: #B6C0AE;
    --text: #22291E;
    --muted: #6E7663;
    --success: #5F7A3F;
    --success-soft: #E4EAD3;
    --danger: #A6492A;
    --danger-soft: #F7E9E1;
    --warning: #8A6A1F;
    --warning-soft: #F6ECD2;
    --shadow: 0 12px 40px rgba(47,54,38,.10);
    --radius: 28px;
    --radius-sm: 18px;
}
body.internal-entry-page,
body.internal-entry-page *{ box-sizing: border-box; }
body.internal-entry-page{
    margin: 0;
    min-height: 100vh;
    background-color: var(--page-bg);
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cg opacity='.30'%3E%3Cpath d='M0 120 A60 60 0 0 1 120 120 Z' fill='%237A8C73'/%3E%3Ccircle cx='60' cy='60' r='16' fill='none' stroke='%237A8C73' stroke-width='2.5'/%3E%3Crect x='120' width='120' height='120' fill='%238A9980'/%3E%3Cpath d='M120 0 L190 0 A70 70 0 0 1 120 70 Z' fill='%23E9E6D8'/%3E%3Crect y='120' width='120' height='108' fill='%23B6C0AE'/%3E%3Cg fill='%23E9E6D8'%3E%3Crect x='10' y='120' width='7' height='108'/%3E%3Crect x='30' y='120' width='7' height='108'/%3E%3Crect x='50' y='120' width='7' height='108'/%3E%3Crect x='70' y='120' width='7' height='108'/%3E%3Crect x='90' y='120' width='7' height='108'/%3E%3C/g%3E%3Crect y='228' width='240' height='12' fill='%23D8D4C7'/%3E%3Ccircle cx='180' cy='180' r='56' fill='%235C6B55'/%3E%3Ccircle cx='180' cy='180' r='40' fill='none' stroke='%23E9E6D8' stroke-width='2'/%3E%3C/g%3E%3C/svg%3E"),
        radial-gradient(circle at 50% 16%, #F5F3E7 0%, #E9E6D8 34%, #DDD9C8 62%, #C9CDB9 100%);
    background-repeat: repeat, no-repeat;
    background-size: 260px 260px, cover;
    background-attachment: fixed, fixed;
    color: var(--text);
    font-family: var(--font-body);
}
body.internal-entry-page button,
body.internal-entry-page input,
body.internal-entry-page select{ font: inherit; }
body.internal-entry-page a{ color: inherit; }

body.internal-entry-page .internal-nav{
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 22px;
    background: rgba(233,230,216,0.86);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 32px rgba(47,54,38,.07);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
}
body.internal-entry-page .nav-left,
body.internal-entry-page .nav-right{
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
body.internal-entry-page .back-link{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 9px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--primary-dark);
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
    transition: .22s cubic-bezier(.22,.9,.32,1);
    box-shadow: 0 2px 10px rgba(47,54,38,.05);
}
body.internal-entry-page .back-link:hover{
    border-color: var(--primary);
    background: var(--primary);
    color: var(--on-dark);
    transform: translateX(-2px) translateY(-1px);
}
body.internal-entry-page .nav-title{ min-width: 0; }
body.internal-entry-page .nav-title strong{
    display: block;
    overflow: hidden;
    color: var(--primary-dark);
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: -0.03em;
}
body.internal-entry-page .nav-title span{
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 500;
}
body.internal-entry-page .staff-chip{
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    min-width: 0;
    padding: 8px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: 0 2px 10px rgba(47,54,38,.05);
}
body.internal-entry-page .staff-chip strong{
    max-width: 230px;
    overflow: hidden;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}
body.internal-entry-page .staff-chip small{
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
}
/* INTERNAL PAGE FULL WIDTH EDGE-TO-EDGE */
body.internal-entry-page .internal-page{
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0 0 32px 0;
    box-sizing: border-box;
}
body.internal-entry-page .hero-card,
body.internal-entry-page .workspace-card,
body.internal-entry-page .error-card{
    width: 100%;
    max-width: none;
    margin: 0;
    border-left: 0;
    border-right: 0;
    border-top: 1px solid rgba(207,201,184,0.85);
    border-bottom: 1px solid rgba(207,201,184,0.85);
    border-radius: 0;
    box-shadow: 0 12px 40px rgba(47,54,38,.07);
    backdrop-filter: blur(18px) saturate(1.15);
    -webkit-backdrop-filter: blur(18px) saturate(1.15);
    box-sizing: border-box;
}
body.internal-entry-page .hero-card{
    border-top: 0;
    padding: 20px 18px;
    background-color: rgba(255,253,246,0.93);
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cg opacity='.5'%3E%3Cpath d='M0 120 A60 60 0 0 1 120 120 Z' fill='%237A8C73'/%3E%3Ccircle cx='60' cy='60' r='16' fill='none' stroke='%237A8C73' stroke-width='2.5'/%3E%3Crect x='120' width='120' height='120' fill='%238A9980'/%3E%3Cpath d='M120 0 L190 0 A70 70 0 0 1 120 70 Z' fill='%23FFFDF5'/%3E%3Crect y='120' width='120' height='108' fill='%23B6C0AE'/%3E%3Cg fill='%23FFFDF5'%3E%3Crect x='10' y='120' width='7' height='108'/%3E%3Crect x='30' y='120' width='7' height='108'/%3E%3Crect x='50' y='120' width='7' height='108'/%3E%3Crect x='70' y='120' width='7' height='108'/%3E%3Crect x='90' y='120' width='7' height='108'/%3E%3C/g%3E%3Crect y='228' width='240' height='12' fill='%23D8D4C7'/%3E%3Ccircle cx='180' cy='180' r='56' fill='%235C6B55'/%3E%3Ccircle cx='180' cy='180' r='40' fill='none' stroke='%23FFFDF5' stroke-width='2'/%3E%3C/g%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right -52px top -64px;
    background-size: 320px 320px;
}
body.internal-entry-page .workspace-card{
    margin-top: 0;
    background: rgba(255,253,246,0.93);
}
body.internal-entry-page .error-card{
    background: rgba(255,253,246,0.93);
}
body.internal-entry-page .hero-card{
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    gap: 20px;
    padding: 22px 26px;
}
body.internal-entry-page .eyebrow{
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .7px;
    text-transform: uppercase;
}
body.internal-entry-page .hero-card h1{
    margin: 0;
    color: var(--primary-dark);
    font-family: var(--font-display);
    font-size: clamp(19px, 2.1vw, 26px);
    line-height: 1.2;
    font-weight: 750;
    letter-spacing: -0.04em;
}
body.internal-entry-page .hero-card p{
    max-width: 900px;
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
    font-weight: 450;
}
body.internal-entry-page .hero-meta{
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
body.internal-entry-page .meta-pill{
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--primary-dark);
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(47,54,38,.05);
}
body.internal-entry-page .meta-pill strong{ font-weight: 850; }
body.internal-entry-page .workspace-card{ overflow: hidden; }
body.internal-entry-page .component-navigation{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(135deg, rgba(255,253,246,0.9), rgba(216,212,199,0.5));
}
body.internal-entry-page .component-tabs{
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
body.internal-entry-page .component-tab{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--primary-dark);
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 750;
    transition: .22s cubic-bezier(.22,.9,.32,1);
    box-shadow: 0 2px 10px rgba(47,54,38,.04);
}
body.internal-entry-page .component-tab:hover{
    border-color: var(--primary);
    transform: translateY(-1px);
}
body.internal-entry-page .component-tab.active{
    border-color: var(--primary);
    background:
        repeating-linear-gradient(45deg, rgba(237,234,224,.08) 0 3px, transparent 3px 7px),
        repeating-linear-gradient(-45deg, rgba(237,234,224,.08) 0 3px, transparent 3px 7px),
        var(--primary);
    color: var(--on-dark);
    box-shadow: 0 8px 22px rgba(92,107,85,.28);
}
body.internal-entry-page .pattern-status{
    color: var(--muted);
    font-size: 11.5px;
    text-align: right;
}
body.internal-entry-page .pattern-status strong{
    display: block;
    max-width: 520px;
    overflow: hidden;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}
body.internal-entry-page .info-grid{
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
}
body.internal-entry-page .info-item{
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,253,246,0.85);
    box-shadow: 0 2px 8px rgba(47,54,38,.04);
}
body.internal-entry-page .info-item span{
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .5px;
    text-transform: uppercase;
}
body.internal-entry-page .info-item strong{
    display: block;
    overflow: hidden;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}
body.internal-entry-page .table-toolbar{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 20px;
}
body.internal-entry-page .table-toolbar h2{
    margin: 0;
    color: var(--primary-dark);
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 750;
    letter-spacing: -0.03em;
}
body.internal-entry-page .table-toolbar p{
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 500;
}
body.internal-entry-page .toolbar-actions{
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}
body.internal-entry-page .save-state{
    min-width: 160px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
    text-align: right;
}
body.internal-entry-page .save-state.success{ color: var(--success); }
body.internal-entry-page .save-state.error{ color: var(--danger); }
body.internal-entry-page .btn-save{
    min-height: 42px;
    padding: 11px 20px;
    border: 0;
    border-radius: 999px;
    background:
        repeating-linear-gradient(45deg, rgba(253,252,244,.10) 0 3px, transparent 3px 7px),
        repeating-linear-gradient(-45deg, rgba(253,252,244,.10) 0 3px, transparent 3px 7px),
        var(--accent);
    color: var(--text-on-accent);
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: -0.01em;
    box-shadow: var(--shadow-accent);
    transition: .22s cubic-bezier(.22,.9,.32,1);
}
body.internal-entry-page .btn-save:hover{
    background:
        repeating-linear-gradient(45deg, rgba(253,252,244,.10) 0 3px, transparent 3px 7px),
        repeating-linear-gradient(-45deg, rgba(253,252,244,.10) 0 3px, transparent 3px 7px),
        var(--accent-dark);
    transform: translateY(-1px);
    box-shadow: 0 16px 36px rgba(92,107,85,.40);
}
body.internal-entry-page .btn-save:disabled{ cursor: wait; opacity: .65; transform: none; }
body.internal-entry-page .marks-scroll{
    width: 100%;
    max-height: calc(100vh - 295px);
    overflow: auto;
    border-top: 1px solid var(--line);
    background: var(--surface);
    overscroll-behavior: contain;
}
body.internal-entry-page .marks-table{
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
}
body.internal-entry-page .marks-table th,
body.internal-entry-page .marks-table td{
    min-width: 96px;
    padding: 9px 10px;
    border-right: 1px solid #E5E0CE;
    border-bottom: 1px solid #E5E0CE;
    background: var(--surface);
    text-align: center;
    white-space: nowrap;
}
body.internal-entry-page .marks-table thead th{
    position: sticky;
    top: 0;
    z-index: 5;
    background: #DDD9C8;
    color: var(--primary-dark);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: -0.01em;
}
body.internal-entry-page .marks-table tbody tr:hover td{ background: #F5F3E7; }
body.internal-entry-page .marks-table .sticky-index,
body.internal-entry-page .marks-table .sticky-roll,
body.internal-entry-page .marks-table .sticky-name{
    position: sticky;
    z-index: 3;
}
body.internal-entry-page .marks-table thead .sticky-index,
body.internal-entry-page .marks-table thead .sticky-roll,
body.internal-entry-page .marks-table thead .sticky-name{
    z-index: 8;
    background: #DDD9C8;
}
body.internal-entry-page .sticky-index{ left: 0; width: 50px; min-width: 50px !important; }
body.internal-entry-page .sticky-roll{
    left: 50px;
    width: 156px;
    min-width: 156px !important;
    text-align: left !important;
}
body.internal-entry-page .sticky-name{
    left: 206px;
    width: 190px;
    min-width: 190px !important;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left !important;
    font-weight: 750;
    box-shadow: 10px 0 20px -16px rgba(42,51,37,.4);
}

body.internal-entry-page .question-head{ min-width: 116px !important; }
body.internal-entry-page .question-head span{
    display: block;
    color: var(--primary-dark);
    font-size: 11.5px;
    font-weight: 850;
}
body.internal-entry-page .question-head small{
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 9.5px;
    font-weight: 600;
}
body.internal-entry-page .question-head .section-mini{
    display: inline-flex;
    margin-bottom: 5px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--text-on-accent);
    font-size: 9px;
    font-weight: 750;
    letter-spacing: .2px;
}
body.internal-entry-page .total-head{
    min-width: 120px !important;
    background: var(--primary-dark) !important;
    color: var(--on-dark) !important;
}
body.internal-entry-page .total-head small{
    display: block;
    margin-top: 3px;
    color: #C7C2B1;
    font-size: 9.5px;
}
body.internal-entry-page .mark-input{
    width: 80px;
    min-height: 36px;
    padding: 7px 9px;
    border: 1.2px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--primary-dark);
    outline: none;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    transition: .18s ease;
    box-shadow: 0 1px 3px rgba(47,54,38,.05);
}
body.internal-entry-page .mark-input:focus{
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(92,107,85,0.16);
}
body.internal-entry-page .mark-input.invalid{
    border-color: var(--danger);
    background: var(--danger-soft);
    box-shadow: 0 0 0 4px rgba(166,73,42,.12);
}
body.internal-entry-page .student-total{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 86px;
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 99px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
}
body.internal-entry-page .student-total.invalid{
    background: var(--danger-soft);
    color: var(--danger);
}
body.internal-entry-page .empty-row td{
    padding: 40px 20px;
    color: var(--muted);
    font-size: 13px;
}
body.internal-entry-page .notice{
    margin: 0 20px 14px;
    padding: 12px 14px;
    border: 1px solid #E3D5A6;
    border-radius: 14px;
    background: var(--warning-soft);
    color: var(--warning);
    font-size: 11.5px;
    line-height: 1.6;
    font-weight: 550;
}
body.internal-entry-page .error-card{
    padding: 30px;
    border-color: #E4BFB7;
}
body.internal-entry-page .error-card h1{
    margin: 0 0 10px;
    color: var(--danger);
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 750;
}
body.internal-entry-page .error-card p{
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}
@media (max-width: 1000px){
    body.internal-entry-page .hero-card{ grid-template-columns: 1fr; }
    body.internal-entry-page .hero-meta{ justify-content: flex-start; }
    body.internal-entry-page .info-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
    body.internal-entry-page .marks-scroll{ max-height: calc(100vh - 340px); }
}
@media (max-width: 720px){
    body.internal-entry-page .internal-nav{ align-items: flex-start; padding: 12px; }
    body.internal-entry-page .nav-right{ display: none; }
    body.internal-entry-page .internal-page{ padding: 0 0 24px 0; width: 100%; max-width: none; }
    body.internal-entry-page .hero-card{
        padding: 16px 14px;
        border-radius: 0;
        background-position: right -90px top -90px;
    }
    body.internal-entry-page .component-navigation,
    body.internal-entry-page .table-toolbar{ align-items: flex-start; flex-direction: column; }
    body.internal-entry-page .pattern-status{ text-align: left; }
    body.internal-entry-page .pattern-status strong{ max-width: calc(100vw - 48px); }
    body.internal-entry-page .info-grid{ grid-template-columns: 1fr; }
    body.internal-entry-page .toolbar-actions{ width: 100%; justify-content: space-between; }
    body.internal-entry-page .save-state{ min-width: 0; text-align: left; }
    body.internal-entry-page .marks-scroll{ max-height: 66vh; }
    body.internal-entry-page .workspace-card{ border-radius: 0; }
}
body.internal-entry-page .internal-sql-error{
    margin: 20px;
    padding: 20px;
    border: 1px solid #E4BFB7;
    border-radius: 14px;
    background: #fff;
    color: #8a3a24;
    font-family: ui-monospace, SFMono-Regular, monospace;
    white-space: pre-wrap;
    font-size: 12px;
}

/* =====================================================================
   INTERNAL MARK-ENTRY VALIDATION STATES
   ===================================================================== */
body.internal-entry-page .mark-input::placeholder{
    color: #8b9083;
    font-weight: 700;
    opacity: 1;
}
body.internal-entry-page .mark-input:focus-visible{
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(92,107,85,.18);
}
body.internal-entry-page .mark-input[aria-invalid="true"],
body.internal-entry-page .mark-input.invalid{
    border-color: var(--danger);
    background: var(--danger-soft);
    color: var(--danger);
    box-shadow: 0 0 0 4px rgba(166,73,42,.12);
}
body.internal-entry-page .mark-input.choice-readonly{
    border-color: var(--line);
    background: #ECE8DA;
    color: #9aa08f;
    cursor: not-allowed;
    opacity: .75;
    box-shadow: none;
}
body.internal-entry-page .marks-table tbody tr.student-absent-row > td,
body.internal-entry-page .marks-table tbody tr.student-absent-row:hover > td{
    background-color: #FBF3CF !important;
}
body.internal-entry-page .marks-table .mark-input.absent-mark-input{
    border-color: #D9A825 !important;
    background-color: #FCEC9F !important;
    color: #6A4A00 !important;
    cursor: default;
    font-weight: 850;
    opacity: 1;
    box-shadow: none;
}
body.internal-entry-page .marks-table .mark-input.absent-mark-input:focus,
body.internal-entry-page .marks-table .mark-input.absent-mark-input:focus-visible{
    border-color: #B98E12 !important;
    box-shadow: 0 0 0 4px rgba(217,168,37,.24) !important;
}
body.internal-entry-page .marks-table tr.row-total-invalid > td{
    background-color: #FBF1EC;
}
body.internal-entry-page .student-total.invalid,
body.internal-entry-page .student-total.total-invalid{
    background: var(--danger-soft);
    color: var(--danger);
    box-shadow: inset 0 0 0 1px #E4B4A4;
}
@media (max-width: 720px){
    body.internal-entry-page .mark-input{
        width: 74px;
        min-height: 36px;
        padding: 7px;
        font-size: 12px;
    }
    body.internal-entry-page .marks-table th,
    body.internal-entry-page .marks-table td{
        padding: 8px;
    }
}

/* =====================================================================
   INDEX PAGE QUESTION-ENTRY VALIDATION STATES
   ===================================================================== */
.student-marks-table .question-mark-input::placeholder{
    color: #8b9083;
    font-weight: 700;
    opacity: 1;
}
.student-marks-table .question-mark-input[aria-invalid="true"],
.student-marks-table .question-mark-input.input-invalid{
    border-color: var(--danger);
    background: var(--danger-soft);
    color: var(--danger);
    box-shadow: 0 0 0 4px rgba(166,73,42,.12);
}
.student-marks-table tbody tr.student-absent-row > td,
.student-marks-table tbody tr.student-absent-row:hover > td{
    background-color: #FBF3CF !important;
}
.student-marks-table .question-mark-input.absent-mark-input{
    border-color: #D9A825 !important;
    background-color: #FCEC9F !important;
    color: #6A4A00 !important;
    font-weight: 850;
    opacity: 1;
    box-shadow: none;
}
.student-marks-table .question-mark-input.absent-mark-input:focus,
.student-marks-table .question-mark-input.absent-mark-input:focus-visible{
    border-color: #B98E12 !important;
    box-shadow: 0 0 0 4px rgba(217,168,37,.24) !important;
}
.student-marks-table tr.row-total-invalid > td{
    background-color: #FBF1EC;
}

/* =====================================================================
   EXTRA POLISH — Luxury Micro-interactions
   ===================================================================== */
.login-card-head, .card-head-row, .topbar, .component-navigation{
    -webkit-font-smoothing: antialiased;
}

/* subtle loader skeleton */
@keyframes skeletonShimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}
.skeleton{
    background: linear-gradient(90deg, var(--surface) 25%, #EFEBDD 50%, var(--surface) 75%);
    background-size: 800px 100%;
    animation: skeletonShimmer 1.6s ease-in-out infinite;
    border-radius: 12px;
}

/* Scrollbar — Apple thin, sage tinted */
*::-webkit-scrollbar{ width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb{
    background: var(--surface-2);
    border-radius: 99px;
    border: 2px solid transparent;
    background-clip: content-box;
}
*::-webkit-scrollbar-track{ background: transparent; }
*::-webkit-scrollbar-thumb:hover{ background: var(--moss); background-clip: content-box; }
/* ═══════════════════════════════════════════════════════════════════════
   QUEUE PAGE — CAPACITY FULL / TEACHER CALLING ANIMATION
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Sage palette tokens (queue-scoped) ── */
.queue-page {
    --accent: #7A8C73;
    --accent-soft: #B6C0AE;
    --accent-tint: #CBD3C1;
    --moss: #8A9980;
    --accent-dark: #5C6B55;
    --accent-ink: #2A3325;
    --sage: #7A8C73;

    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 20px;
    overflow-y: auto;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: linear-gradient(145deg, #f7f8f5 0%, #eef0ea 40%, #e4e8de 100%);
}

/* ── Animated aurora background ── */
.queue-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.queue-aurora {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.35;
}

.queue-aurora-a {
    width: 600px;
    height: 600px;
    top: -200px;
    left: -100px;
    background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
    animation: queueAuroraA 12s ease-in-out infinite alternate;
}

.queue-aurora-b {
    width: 500px;
    height: 500px;
    bottom: -150px;
    right: -80px;
    background: radial-gradient(circle, var(--accent-tint) 0%, transparent 70%);
    animation: queueAuroraB 15s ease-in-out infinite alternate;
}

.queue-aurora-c {
    width: 400px;
    height: 400px;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, var(--moss) 0%, transparent 70%);
    animation: queueAuroraC 10s ease-in-out infinite alternate;
    opacity: 0.2;
}

@keyframes queueAuroraA {
    0%   { transform: translate(0, 0) scale(1); opacity: 0.35; }
    50%  { transform: translate(80px, 60px) scale(1.15); opacity: 0.25; }
    100% { transform: translate(-40px, 30px) scale(1.05); opacity: 0.3; }
}

@keyframes queueAuroraB {
    0%   { transform: translate(0, 0) scale(1); opacity: 0.3; }
    50%  { transform: translate(-60px, -40px) scale(1.1); opacity: 0.4; }
    100% { transform: translate(30px, -20px) scale(0.95); opacity: 0.35; }
}

@keyframes queueAuroraC {
    0%   { transform: translate(-50%, -50%) scale(1); opacity: 0.2; }
    100% { transform: translate(-45%, -55%) scale(1.2); opacity: 0.15; }
}

.queue-grid-overlay {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(122, 140, 115, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(122, 140, 115, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    animation: queueGridDrift 40s linear infinite;
}

@keyframes queueGridDrift {
    0%   { background-position: 0 0; }
    100% { background-position: 48px 48px; }
}

/* ── Queue card ── */
.queue-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 560px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(30px) saturate(1.6);
    -webkit-backdrop-filter: blur(30px) saturate(1.6);
    border-radius: 24px;
    border: 1px solid rgba(122, 140, 115, 0.18);
    box-shadow:
        0 4px 24px rgba(42, 51, 37, 0.06),
        0 12px 48px rgba(42, 51, 37, 0.04),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    overflow: hidden;
    animation: queueCardEntry 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes queueCardEntry {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.96);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── SVG Animation Scene ── */
.queue-animation-wrap {
    width: 100%;
    padding: 24px 20px 8px;
    display: flex;
    justify-content: center;
    background: linear-gradient(180deg, rgba(203, 211, 193, 0.2) 0%, transparent 100%);
}

.queue-scene {
    width: 100%;
    max-width: 480px;
    height: auto;
}

/* Teacher arm waving animation */
.teacher-arm-wave {
    transform-origin: 104px 145px;
    animation: teacherWave 2s ease-in-out infinite;
}

@keyframes teacherWave {
    0%, 100% { transform: rotate(0deg); }
    15%      { transform: rotate(-8deg); }
    30%      { transform: rotate(5deg); }
    45%      { transform: rotate(-6deg); }
    60%      { transform: rotate(3deg); }
    75%      { transform: rotate(-4deg); }
}

/* Phone signal waves */
.phone-wave {
    animation: phoneWavePulse 2.4s ease-out infinite;
}

.phone-wave-1 {
    animation-delay: 0s;
}

.phone-wave-2 {
    animation-delay: 0.4s;
}

.phone-wave-3 {
    animation-delay: 0.8s;
}

@keyframes phoneWavePulse {
    0%   { opacity: 0; transform: scale(0.8); }
    20%  { opacity: 0.8; transform: scale(1); }
    60%  { opacity: 0.4; transform: scale(1.05); }
    100% { opacity: 0; transform: scale(1.1); }
}

/* Speech bubble float */
.speech-bubble {
    animation: speechBubbleFloat 3s ease-in-out infinite;
}

@keyframes speechBubbleFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-5px); }
}

/* Teacher head subtle nod */
.teacher-head {
    transform-origin: 120px 120px;
    animation: teacherNod 3s ease-in-out infinite;
}

@keyframes teacherNod {
    0%, 100% { transform: translateY(0); }
    30%      { transform: translateY(-2px); }
    60%      { transform: translateY(1px); }
}

/* ERP staff typing arms */
.erp-arm-left {
    transform-origin: 361px 140px;
    animation: erpTypeLeft 0.6s ease-in-out infinite alternate;
}

.erp-arm-right {
    transform-origin: 389px 140px;
    animation: erpTypeRight 0.5s ease-in-out infinite alternate-reverse;
}

@keyframes erpTypeLeft {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(-3deg); }
}

@keyframes erpTypeRight {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(3deg); }
}

/* Desk phone ringing */
.desk-phone-ring {
    transform-origin: 437px 172px;
    animation: deskPhoneVibrate 0.15s ease-in-out infinite alternate;
}

@keyframes deskPhoneVibrate {
    0%   { transform: rotate(-2deg); }
    100% { transform: rotate(2deg); }
}

/* Desk ring waves */
.desk-ring {
    animation: deskRingPulse 1.8s ease-out infinite;
}

.desk-ring-1 { animation-delay: 0s; }
.desk-ring-2 { animation-delay: 0.3s; }
.desk-ring-3 { animation-delay: 0.6s; }

@keyframes deskRingPulse {
    0%   { opacity: 0; transform: scale(0.9); }
    25%  { opacity: 0.7; transform: scale(1); }
    70%  { opacity: 0.3; transform: scale(1.05); }
    100% { opacity: 0; transform: scale(1.1); }
}

/* Screen content blinking */
.screen-line-1 {
    animation: screenBlink 2s ease-in-out infinite;
}

.screen-line-2 {
    animation: screenBlink 2s ease-in-out 0.4s infinite;
}

.screen-line-3 {
    animation: screenBlink 2s ease-in-out 0.8s infinite;
}

@keyframes screenBlink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.3; }
}

/* ERP head slight movement */
.erp-head {
    transform-origin: 375px 120px;
    animation: erpHeadLook 4s ease-in-out infinite;
}

@keyframes erpHeadLook {
    0%, 100% { transform: translateX(0); }
    40%      { transform: translateX(2px); }
    70%      { transform: translateX(-1px); }
}

/* Call path pulse */
.call-path {
    animation: callPathPulse 3s ease-in-out infinite;
}

@keyframes callPathPulse {
    0%, 100% { opacity: 0.4; }
    50%      { opacity: 0.8; }
}

/* Monitor glow */
.erp-screen {
    animation: monitorGlow 3s ease-in-out infinite;
}

@keyframes monitorGlow {
    0%, 100% { fill: #7A8C73; }
    50%      { fill: #8A9980; }
}

/* ── Queue content block ── */
.queue-content {
    padding: 20px 32px 32px;
    text-align: center;
}

/* Pulsing phone icon */
.queue-icon-pulse {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-tint), var(--accent-soft));
    margin-bottom: 16px;
    position: relative;
    animation: queueIconBreathe 2.5s ease-in-out infinite;
}

.queue-icon-pulse::before,
.queue-icon-pulse::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid var(--accent-soft);
    opacity: 0;
    animation: queueIconRing 2.5s ease-out infinite;
}

.queue-icon-pulse::after {
    inset: -14px;
    animation-delay: 0.5s;
}

@keyframes queueIconBreathe {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.06); }
}

@keyframes queueIconRing {
    0%   { opacity: 0.6; transform: scale(0.9); }
    100% { opacity: 0; transform: scale(1.4); }
}

.queue-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-ink);
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}

.queue-subtitle {
    font-size: 0.92rem;
    color: var(--accent-dark);
    line-height: 1.55;
    margin: 0 0 24px;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

.queue-subtitle strong {
    color: var(--accent);
    font-weight: 700;
}

/* ── Stats row ── */
.queue-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.queue-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 80px;
}

.queue-stat-number {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
    letter-spacing: -0.03em;
}

.queue-stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--moss);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ── Progress bar ── */
.queue-progress-wrap {
    width: 100%;
    max-width: 360px;
    height: 6px;
    background: var(--accent-tint);
    border-radius: 100px;
    margin: 0 auto 16px;
    overflow: hidden;
    position: relative;
}

.queue-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-dark));
    border-radius: 100px;
    transition: width 1s linear;
}

/* ── Auto-retry message ── */
.queue-auto-retry {
    font-size: 0.82rem;
    color: var(--moss);
    margin: 0 0 20px;
    line-height: 1.5;
}

.queue-auto-retry strong {
    color: var(--accent);
}

/* ── Action buttons ── */
.queue-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-queue-retry {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    border: none;
    padding: 10px 28px;
    border-radius: 12px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
}

.btn-queue-retry:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(92, 107, 85, 0.3);
}

.btn-queue-retry:active:not(:disabled) {
    transform: translateY(0);
}

.btn-queue-retry:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-queue-back {
    background: transparent;
    color: var(--accent-dark);
    border: 1.5px solid var(--accent-soft);
    padding: 10px 24px;
    border-radius: 12px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-queue-back:hover {
    background: var(--accent-tint);
    border-color: var(--accent);
    color: var(--accent-ink);
    transform: translateY(-1px);
}

/* ── Responsive adjustments ── */
@media (max-width: 540px) {
    .queue-card {
        border-radius: 18px;
        max-width: 100%;
    }

    .queue-content {
        padding: 16px 20px 24px;
    }

    .queue-title {
        font-size: 1.25rem;
    }

    .queue-subtitle {
        font-size: 0.85rem;
    }

    .queue-stats {
        gap: 16px;
    }

    .queue-stat-number {
        font-size: 1.4rem;
    }

    .queue-animation-wrap {
        padding: 16px 12px 4px;
    }

    .queue-scene {
        max-width: 100%;
    }

    .queue-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-queue-retry,
    .btn-queue-back {
        text-align: center;
    }
}

@media (max-width: 380px) {
    .queue-animation-wrap {
        padding: 12px 8px 0;
    }

    .queue-content {
        padding: 12px 16px 20px;
    }

    .queue-title {
        font-size: 1.1rem;
    }

    .queue-stats {
        gap: 12px;
    }

    .queue-stat-number {
        font-size: 1.2rem;
    }
}

/* ── Prefers reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .queue-aurora,
    .queue-grid-overlay,
    .teacher-arm-wave,
    .phone-wave,
    .speech-bubble,
    .teacher-head,
    .erp-arm-left,
    .erp-arm-right,
    .desk-phone-ring,
    .desk-ring,
    .screen-line-1,
    .screen-line-2,
    .screen-line-3,
    .erp-head,
    .call-path,
    .erp-screen,
    .queue-icon-pulse,
    .queue-icon-pulse::before,
    .queue-icon-pulse::after,
    .call-dot {
        animation: none !important;
    }

    .queue-card {
        animation: none;
        opacity: 1;
    }

    .phone-wave {
        opacity: 0.5 !important;
    }

    .desk-ring {
        opacity: 0.4 !important;
    }
}
/* =====================================================================
   AUTO-SAVE INDICATOR LIGHTS — Top-Right Corner Dot
   Yellow = user is typing / unsaved
   Green  = auto-save completed successfully
   ===================================================================== */

/* Wrap all mark input cells so the dot can sit on the corner */
.question-mark-cell,
.student-marks-table tbody td:has(.question-mark-input),
body.internal-entry-page .marks-table tbody td:has(.mark-input),
body.internal-entry-page .marks-table tbody td:has(.editable-mark) {
    position: relative;
}

/* Base indicator dot (hidden by default) */
.question-mark-cell::after,
.student-marks-table tbody td:has(.question-mark-input)::after,
body.internal-entry-page .marks-table tbody td:has(.mark-input)::after,
body.internal-entry-page .marks-table tbody td:has(.editable-mark)::after {
    content: "";
    position: absolute;
    top: 6px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: transparent;
    box-shadow: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
    z-index: 2;
}

/* YELLOW LIGHT — user is typing / has unsaved changes */
.question-mark-cell.is-dirty::after,
.student-marks-table tbody td.is-dirty::after,
body.internal-entry-page .marks-table tbody td.is-dirty::after {
    opacity: 1;
    background: #F5C518;
    box-shadow:
        0 0 0 2px rgba(245, 197, 24, 0.25),
        0 0 8px rgba(245, 197, 24, 0.55),
        inset 0 -1px 1px rgba(0, 0, 0, 0.15);
    animation: dirtyDotPulse 1.6s ease-in-out infinite;
}

@keyframes dirtyDotPulse {
    0%, 100% {
        box-shadow:
            0 0 0 2px rgba(245, 197, 24, 0.25),
            0 0 6px rgba(245, 197, 24, 0.5),
            inset 0 -1px 1px rgba(0, 0, 0, 0.15);
    }
    50% {
        box-shadow:
            0 0 0 3px rgba(245, 197, 24, 0.4),
            0 0 12px rgba(245, 197, 24, 0.8),
            inset 0 -1px 1px rgba(0, 0, 0, 0.15);
    }
}

/* GREEN LIGHT — auto-save just completed successfully */
.question-mark-cell.is-saved::after,
.student-marks-table tbody td.is-saved::after,
body.internal-entry-page .marks-table tbody td.is-saved::after {
    opacity: 1;
    background: #5F7A3F;
    box-shadow:
        0 0 0 2px rgba(95, 122, 63, 0.3),
        0 0 8px rgba(95, 122, 63, 0.6),
        inset 0 -1px 1px rgba(0, 0, 0, 0.15);
    animation: savedDotFlash 1.8s ease-out;
}

@keyframes savedDotFlash {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    30% {
        transform: scale(1.5);
        opacity: 1;
        box-shadow:
            0 0 0 5px rgba(95, 122, 63, 0.35),
            0 0 16px rgba(95, 122, 63, 0.9);
    }
    60% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Reduced motion respect */
@media (prefers-reduced-motion: reduce) {
    .question-mark-cell.is-dirty::after,
    .student-marks-table tbody td.is-dirty::after,
    body.internal-entry-page .marks-table tbody td.is-dirty::after,
    .question-mark-cell.is-saved::after,
    .student-marks-table tbody td.is-saved::after,
    body.internal-entry-page .marks-table tbody td.is-saved::after {
        animation: none !important;
    }
}
/* =====================================================================
   EXPORT EXCEL BUTTON — Matches Save Draft / Final Submit exactly
   ===================================================================== */

.btn-export-excel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 11px 20px;
    border: 0;
    border-radius: 999px;
    background:
        repeating-linear-gradient(45deg, rgba(253,252,244,.10) 0 3px, transparent 3px 7px),
        repeating-linear-gradient(-45deg, rgba(253,252,244,.10) 0 3px, transparent 3px 7px),
        var(--accent);
    color: var(--text-on-accent) !important;
    cursor: pointer;
    font-family: var(--font-body) !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    letter-spacing: -0.01em !important;
    line-height: 1 !important;
    text-transform: none;
    box-shadow: var(--shadow-accent);
    transition: .22s cubic-bezier(.22,.9,.32,1);
    text-decoration: none;
    white-space: nowrap;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    animation: exportBtnFadeIn 0.5s ease both;
}

.btn-export-excel::before {
    content: "📊";
    font-size: 15px;
    line-height: 1;
    display: inline-block;
}

.btn-export-excel:hover {
    background:
        repeating-linear-gradient(45deg, rgba(253,252,244,.10) 0 3px, transparent 3px 7px),
        repeating-linear-gradient(-45deg, rgba(253,252,244,.10) 0 3px, transparent 3px 7px),
        var(--accent-dark);
    transform: translateY(-1px);
    box-shadow: 0 16px 36px rgba(92, 107, 85, 0.4);
}

.btn-export-excel:active {
    transform: scale(0.98);
}

.btn-export-excel:disabled {
    cursor: not-allowed;
    opacity: 0.65;
    transform: none;
}

@keyframes exportBtnFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}