/* Global theme tokens */
:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --bg-strong: #eef2f7;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e2e8f0;
    --border-strong: #cbd5f5;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #0ea5a8;
    --primary-strong: #0284c7;
    --accent: #f97316;
    --success: #16a34a;
    --danger: #ef4444;
    --shadow-soft: none;
    --shadow-card: none;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

html.dark {
    color-scheme: dark;
    --bg: #0b1220;
    --bg-strong: #0f172a;
    --surface: #0f172a;
    --surface-2: #111c2f;
    --border: #1f2a3f;
    --border-strong: #24324b;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --primary: #22d3ee;
    --primary-strong: #38bdf8;
    --accent: #fb923c;
    --success: #22c55e;
    --danger: #f87171;
    --shadow-soft: none;
    --shadow-card: none;
}

body {
    background:
        repeating-linear-gradient(
            90deg,
            rgba(15, 23, 42, 0.035) 0,
            rgba(15, 23, 42, 0.035) 1px,
            transparent 1px,
            transparent 120px
        ),
        linear-gradient(0deg, var(--bg), var(--bg));
    color: var(--text);
    min-height: 100vh;
}

html.dark body {
    background:
        repeating-linear-gradient(
            90deg,
            rgba(148, 163, 184, 0.08) 0,
            rgba(148, 163, 184, 0.08) 1px,
            transparent 1px,
            transparent 120px
        ),
        linear-gradient(0deg, var(--bg), var(--bg));
}

main {
    color: var(--text);
}


img {
    max-width: 100%;
    height: auto;
}

.shadow,
.shadow-sm,
.shadow-md,
.shadow-lg,
.shadow-xl,
.shadow-2xl,
.shadow-inner {
    box-shadow: none !important;
}

/* Typography helpers */
.gradient-text {
    background: linear-gradient(120deg, var(--primary-strong), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.section-title {
    font-size: clamp(1.1rem, 1.6vw, 1.6rem);
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.section-subtitle {
    color: var(--muted);
    font-size: 0.95rem;
}

/* Cards */
:where(.card) {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: none !important;
    padding: 1.25rem;
}

:where(.card.soft) {
    background: var(--surface-2);
}

:where(.card.hoverable) {
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

:where(.card.hoverable:hover) {
    transform: translateY(-2px);
    border-color: rgba(14, 165, 233, 0.45);
}

/* Dashboard hero */
.dashboard-hero {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius-lg) + 2px);
    padding: clamp(1.1rem, 2vw, 1.7rem);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

html.dark .dashboard-hero {
    background: var(--surface);
}

.dashboard-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hero-action {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.hero-action:hover {
    border-color: rgba(14, 165, 233, 0.5);
    background: var(--surface);
}

.dashboard-shell {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.dashboard-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-header .text-primary-600 {
    color: var(--primary-strong);
}

.dashboard-actions {
    display: grid;
    gap: 0.9rem;
}

.action-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(14, 165, 233, 0.12);
    color: var(--primary-strong);
}

.action-info h3 {
    font-weight: 700;
    color: var(--text);
    font-size: 0.98rem;
}

.action-info p {
    color: var(--muted);
    font-size: 0.85rem;
}

.leaderboard-card {
    --lb-accent: var(--primary-strong);
    background: linear-gradient(180deg, var(--surface), var(--surface-2));
    border: 1px solid var(--border);
    border-radius: calc(var(--radius-lg) + 2px);
    padding: 1rem 1.1rem 1.05rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    position: relative;
    overflow: hidden;
    text-align: right;
    min-height: 170px;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.leaderboard-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--lb-accent);
    opacity: 0.75;
}

.leaderboard-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 15% 15%, rgba(255, 255, 255, 0.8), transparent 55%);
    opacity: 0.35;
    pointer-events: none;
}

.leaderboard-card:hover {
    border-color: rgba(14, 165, 233, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.leaderboard-card[data-rank="1"] {
    --lb-accent: #f59e0b;
}

.leaderboard-card[data-rank="2"] {
    --lb-accent: #94a3b8;
}

.leaderboard-card[data-rank="3"] {
    --lb-accent: #d97706;
}

.leaderboard-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.leaderboard-rank {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.leaderboard-label {
    font-size: 0.72rem;
    color: var(--muted);
}

.leaderboard-rank-badge {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #ffffff;
    background: var(--lb-accent);
}

.leaderboard-score-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.08);
    color: var(--text);
    font-size: 0.8rem;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

.leaderboard-score-pill strong {
    font-weight: 700;
}

.leaderboard-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

.leaderboard-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.leaderboard-date-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--muted);
}

.leaderboard-score-pill i,
.leaderboard-date-pill i {
    color: var(--lb-accent);
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem 1.1rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid transparent;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--primary-strong);
    color: #ffffff;
    border-color: rgba(2, 132, 199, 0.4);
}

.btn-primary:hover {
    background: var(--primary);
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    border-color: rgba(14, 165, 233, 0.4);
}

.btn-outline {
    background: transparent;
    color: var(--primary-strong);
    border-color: rgba(14, 165, 233, 0.5);
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.badge-primary {
    background: rgba(14, 165, 233, 0.12);
    color: var(--primary-strong);
    border-color: rgba(14, 165, 233, 0.3);
}

.badge-success {
    background: rgba(34, 197, 94, 0.12);
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.35);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.35);
}

/* Stats and quick actions */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.1rem;
    box-shadow: none !important;
}

html.dark .stat-card {
    background: var(--surface);
}

.action-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    box-shadow: none !important;
}

.action-card:hover {
    transform: translateY(-2px);
    border-color: rgba(14, 165, 233, 0.45);
    background: var(--surface-2);
}

html.dark .action-card {
    background: var(--surface);
}

/* Forms */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="time"],
select,
textarea,
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.85rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="file"] {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
    padding: 0.45rem 0.5rem;
}

input[type="file"]::file-selector-button {
    margin-inline-end: 0.75rem;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

input[type="file"]::file-selector-button:hover {
    border-color: rgba(14, 165, 233, 0.5);
    background: var(--surface);
}

input[type="file"]::-webkit-file-upload-button {
    margin-inline-end: 0.75rem;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

input[type="file"]::-webkit-file-upload-button:hover {
    border-color: rgba(14, 165, 233, 0.5);
    background: var(--surface);
}

.input-field {
    width: 100%;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.85rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.input-field:focus {
    border-color: rgba(14, 165, 233, 0.6);
    box-shadow: none;
}

input:focus,
select:focus,
textarea:focus,
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: rgba(14, 165, 233, 0.6);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

input::placeholder,
textarea::placeholder {
    color: var(--muted);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
}

thead th {
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.85rem;
    border-bottom: 1px solid var(--border);
    text-align: right;
}

tbody td {
    padding: 0.85rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
    color: var(--text);
}

tbody tr:hover {
    background: rgba(14, 165, 233, 0.05);
}

/* Responsive tables */
@media (max-width: 768px) {
    table.responsive-table thead {
        display: none;
    }
    table.responsive-table,
    table.responsive-table tbody,
    table.responsive-table tr,
    table.responsive-table td {
        display: block;
        width: 100%;
    }
    table.responsive-table tr {
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        margin-bottom: 1rem;
        overflow: hidden;
        background: var(--surface);
    }
    table.responsive-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        border-bottom: 1px solid var(--border);
    }
    table.responsive-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--muted);
    }
}

/* Helpers */
.text-wrap-anywhere {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.line-clamp-1,
.line-clamp-2,
.line-clamp-3 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.line-clamp-1 {
    -webkit-line-clamp: 1;
}

.line-clamp-2 {
    -webkit-line-clamp: 2;
}

.line-clamp-3 {
    -webkit-line-clamp: 3;
}

@media (max-width: 640px) {
    .card {
        padding: 1rem;
    }
    .btn {
        width: 100%;
        justify-content: center;
    }
    .action-card {
        padding: 0.9rem;
    }
}

/* Important announcements slider */
.important-slider {
    aspect-ratio: 16 / 9;
    max-height: 420px;
}

@media (min-width: 1024px) {
    .important-slider {
        aspect-ratio: auto;
        height: clamp(550px, 38vh, 480px);
    }
}

.important-slider .slider-track,
.important-slider .slider-slide {
    height: 100%;
}

.important-slider .slider-slide > img,
.important-slider .slider-slide > div {
    width: 100%;
    height: 100%;
}
