:root {
    --primary: #1B5E20;
    --primary-light: #2E7D32;
    --accent: #FF6F00;
    --bg: #F1F8E9;
}

body {
    background: linear-gradient(135deg, #E8F5E9 0%, #F1F8E9 50%, #FFF8E1 100%);
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Login/register: college seal and all content within ONE centered white card. */
.auth-wrapper {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 26px 15px;
    background: linear-gradient(135deg, #eaf6e9 0%, #f0f8ed 52%, #fcf9e8 100%);
}
.auth-layout { width: min(100%, 420px); }
.auth-card {
    position: relative;
    background: #fff;
    border: 0;
    border-radius: 21px;
    padding: 37px 40px 38px;
    width: 100%;
    box-shadow: 0 15px 48px rgba(38,63,39,.105);
}
.auth-brand {
    margin: 0 auto 27px;
    text-align: center;
}
.auth-logo-aura {
    position: relative;
    isolation: isolate;
    display: grid;
    place-items: center;
    width: 137px;
    height: 130px;
    margin: 0 auto 12px;
}
.auth-logo-aura::before {
    content: '';
    position: absolute;
    z-index: -1;
    width: 74%;
    height: 78%;
    border-radius: 50%;
    background: conic-gradient(from 0deg, rgba(74, 153, 245,.48), rgba(116,208,135,.36), rgba(242,204,98,.35), rgba(74,153,245,.48));
    filter: blur(19px);
    opacity: .43;
    animation: brandAuraFlow 32s linear infinite, brandAuraBreathe 9s ease-in-out infinite;
}
.auth-college-logo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(30,61,47,.12));
    transform-origin: 50% 52%;
    animation: brandFloat 8s ease-in-out infinite, brandColorShift 24s ease-in-out infinite;
}
.auth-site-title {
    color: #111b2a;
    font-size: clamp(1.17rem, 4vw, 1.48rem);
    font-weight: 800;
    line-height: 1.5;
    letter-spacing: 0;
    margin: 0 0 4px;
}
.auth-college-name {
    color: #667580;
    font-size: .84rem;
    line-height: 1.7;
    max-width: 290px;
    margin: 0 auto;
}
.auth-register-header { margin: 0 0 21px; }
.auth-register-header h2 { font-size: 1.23rem; color: #152a1b; font-weight: 750; margin: 0 0 5px; }
.auth-register-header p { color: #68756a; font-size: .85rem; margin: 0; }
.auth-card .form-label {
    color: #152321;
    font-weight: 500;
    font-size: .88rem;
    margin-bottom: 8px;
}
.auth-card .form-control {
    border: 1px solid #d6dfe2;
    border-radius: 10px;
    background: #fff;
    color: #273743;
    font-size: 1rem;
    padding: 11px 14px;
    min-height: 49px;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.auth-card .form-control::placeholder { color: #657681; opacity: 1; }
.auth-card .form-control:focus {
    border-color: #31844b;
    box-shadow: 0 0 0 3px rgba(40,121,64,.11);
}
.auth-submit.btn-primary {
    background: #1b5e20;
    border: 1px solid #1b5e20;
    border-radius: 8px;
    min-height: 49px;
    font-weight: 700;
    font-size: 1.03rem;
    box-shadow: none;
    transition: background-color .2s ease, transform .2s ease;
}
.auth-submit.btn-primary:hover,
.auth-submit.btn-primary:focus-visible {
    background: #26732e;
    border-color: #26732e;
    transform: translateY(-1px);
}
.auth-submit.btn-primary:active { transform: translateY(0); }
.auth-switch { color: #24303c; font-size: .85rem; line-height: 1.7; }
.auth-switch a { color: #155cce; font-weight: 500; text-decoration: underline; }
.auth-switch a:hover { color: #0e4699; }
.navbar-college-logo { object-fit: contain; vertical-align: middle; margin-inline-end: 7px; }
@keyframes brandFloat {
    0%, 100% { transform: translateY(0) rotate(-.6deg) scale(1); }
    50% { transform: translateY(-5px) rotate(.6deg) scale(1.015); }
}
@keyframes brandColorShift {
    0%, 100% { filter: hue-rotate(0deg) saturate(1) drop-shadow(0 4px 6px rgba(30,61,47,.12)); }
    50% { filter: hue-rotate(9deg) saturate(1.09) drop-shadow(0 9px 10px rgba(29,90,100,.15)); }
}
@keyframes brandAuraFlow {
    to { transform: rotate(360deg); filter: hue-rotate(360deg) blur(19px); }
}
@keyframes brandAuraBreathe {
    0%, 100% { opacity: .29; scale: .95; }
    50% { opacity: .48; scale: 1.06; }
}
@media (max-width: 480px) {
    .auth-wrapper { padding: 18px 15px; }
    .auth-layout { max-width: 420px; }
    .auth-card { padding: 29px 26px 32px; border-radius: 20px; }
    .auth-logo-aura { width: 120px; height: 117px; margin-bottom: 10px; }
    .auth-brand { margin-bottom: 25px; }
    .auth-college-name { font-size: .79rem; }
    .navbar-brand { font-size: .88rem; line-height: 1.35; max-width: calc(100% - 68px); white-space: normal; }
    .navbar-college-logo { width: 30px; height: 28px; margin-inline-end: 4px; }
}
@media (prefers-reduced-motion: reduce) {
    .auth-logo-aura::before, .auth-college-logo { animation: none !important; }
    .auth-submit.btn-primary { transition: none; }
}

/* Navbar */
.navbar {
    background: linear-gradient(90deg, var(--primary), var(--primary-light)) !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.navbar-brand { font-weight: 700; }

/* Cards */
.card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.12);
}
.card-header {
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    color: white;
    border-radius: 16px 16px 0 0 !important;
    font-weight: 600;
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
}
.btn-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}
.btn-accent:hover {
    background: #E65100;
    color: white;
}

/* Stats */
.stat-card {
    text-align: center;
    padding: 1.5rem;
}
.stat-card .number {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary);
}
.stat-card .label {
    color: #666;
    font-size: 0.95rem;
}

/* Tables */
.table th {
    background: #E8F5E9;
    color: var(--primary);
    font-weight: 600;
}

/* Forms */
.form-select, .form-control {
    border-radius: 10px;
}

/* Alerts */
.alert {
    border-radius: 12px;
}

/* Quick dates */
.quick-date {
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 20px;
    background: #E8F5E9;
    margin: 2px;
    display: inline-block;
    font-size: 0.85rem;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}
.quick-date:hover, .quick-date.active {
    background: var(--primary);
    color: white;
}

.status-present { color: #2E7D32; font-weight: 600; }
.status-absent { color: #C62828; font-weight: 600; }

.badge-present { background: #2E7D32; }
.badge-absent { background: #C62828; }

footer {
    margin-top: 2rem;
}

/* Disable concurrent editing during remote D1 writes. */
body.is-saving #app-screen { pointer-events: none; opacity: .82; }
body.is-saving::after {
    content: 'جاري حفظ البيانات على Cloudflare…';
    position: fixed; z-index: 10000; top: 12px; left: 50%; transform: translateX(-50%);
    background: #12351b; color: white; padding: 10px 18px; border-radius: 30px;
    box-shadow: 0 5px 24px rgba(0,0,0,.24); font-weight: 600;
}
