/* ==================== SYSTEM VARIABLE DESIGN ==================== */
:root {
    /* Fonts */
    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    
    /* Layout Constants */
    --sidebar-width: 260px;
    --header-height: 80px;
    --border-radius-sm: 8px;
    --border-radius-md: 14px;
    --border-radius-lg: 20px;
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Dark Theme (Default) Variables */
    --bg-base: #0b0c10;
    --bg-surface: #141620;
    --bg-card: rgba(26, 29, 41, 0.75);
    --bg-card-hover: rgba(36, 40, 56, 0.9);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-focus: rgba(99, 102, 241, 0.5);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-inverse: #0b0c10;
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-tint: rgba(99, 102, 241, 0.15);
    
    --success: #10b981;
    --success-tint: rgba(16, 185, 129, 0.12);
    --success-border: rgba(16, 185, 129, 0.3);
    
    --warning: #f59e0b;
    --warning-tint: rgba(245, 158, 11, 0.12);
    --warning-border: rgba(245, 158, 11, 0.3);
    
    --danger: #ef4444;
    --danger-tint: rgba(239, 68, 68, 0.12);
    
    --info: #06b6d4;
    --info-tint: rgba(6, 182, 212, 0.12);

    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --card-glow-purple: rgba(99, 102, 241, 0.15);
    --card-glow-orange: rgba(245, 158, 11, 0.15);
    --card-glow-blue: rgba(6, 182, 212, 0.15);
    --card-glow-green: rgba(16, 185, 129, 0.15);
    --bg-input: #1b1e2c;
    --border-input: rgba(255, 255, 255, 0.12);
}

/* Light Theme Variables overrides */
.light-theme {
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-hover: #f1f5f9;
    --border-color: rgba(15, 23, 42, 0.08);
    --border-color-focus: rgba(99, 102, 241, 0.4);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-inverse: #ffffff;
    
    --primary-tint: rgba(99, 102, 241, 0.06);
    --success-tint: rgba(16, 185, 129, 0.06);
    --warning-tint: rgba(245, 158, 11, 0.06);
    --danger-tint: rgba(239, 68, 68, 0.06);
    --info-tint: rgba(6, 182, 212, 0.06);
    
    --glass-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.05), 0 8px 32px 0 rgba(31, 38, 135, 0.03);
    --card-glow-purple: rgba(99, 102, 241, 0.03);
    --card-glow-orange: rgba(245, 158, 11, 0.03);
    --card-glow-blue: rgba(6, 182, 212, 0.03);
    --card-glow-green: rgba(16, 185, 129, 0.03);
    --bg-input: #f8fafc;
    --border-input: #e2e8f0;
}

/* ==================== CORE DEFAULTS ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Utility Helpers */
.hidden {
    display: none !important;
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }
.text-primary { color: var(--primary); }

.bg-success-tint { background-color: var(--success-tint); }
.bg-warning-tint { background-color: var(--warning-tint); }
.bg-info-tint { background-color: var(--info-tint); }
.bg-primary-tint { background-color: var(--primary-tint); }

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.btn-primary:active {
    transform: translateY(0);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-main);
}
.btn-outline:hover {
    background-color: var(--border-color);
    border-color: var(--text-muted);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}
.btn-danger:hover {
    background-color: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-icon-only {
    padding: 8px;
    border-radius: 8px;
    width: 36px;
    height: 36px;
}

/* ==================== BADGES ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 9999px;
}
.badge-success {
    background-color: var(--success-tint);
    color: var(--success);
    border: 1px solid var(--success-border);
}
.badge-warning {
    background-color: var(--warning-tint);
    color: var(--warning);
    border: 1px solid var(--warning-border);
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: var(--border-radius-sm);
    background-color: var(--bg-surface);
    border-left: 4px solid var(--primary);
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.3);
    min-width: 300px;
    max-width: 450px;
    animation: toast-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: opacity 0.3s, transform 0.3s;
}

@keyframes toast-slide-in {
    from {
        transform: translateX(100%) translateY(0);
        opacity: 0;
    }
    to {
        transform: translateX(0) translateY(0);
        opacity: 1;
    }
}

.toast-success { border-left-color: var(--success); }
.toast-warning { border-left-color: var(--warning); }
.toast-danger { border-left-color: var(--danger); }

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}
.toast-body {
    flex-grow: 1;
}
.toast-title {
    font-weight: 700;
    font-size: 13px;
}
.toast-msg {
    font-size: 12px;
    color: var(--text-muted);
}
.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    display: flex;
}
.toast-close:hover {
    color: var(--text-main);
}

/* ==================== FORM INPUTS ==================== */
.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.form-group label.required-field::after {
    content: " *";
    color: var(--danger);
}

.input-icon-wrapper {
    position: relative;
    width: 100%;
}

.input-icon-wrapper input,
.input-icon-wrapper textarea,
.filter-select {
    width: 100%;
    padding: 11px 16px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: 10px;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    outline: none;
    transition: all var(--transition-fast);
}

.input-icon-wrapper input:focus,
.input-icon-wrapper textarea:focus,
.filter-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-tint);
}

.input-icon-wrapper input.error-input,
.input-icon-wrapper textarea.error-input {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* Input icons placement */
.input-icon-left {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.input-icon-wrapper input {
    padding-left: 42px;
}

/* Password Toggle Icon Adjustments */
.password-toggle-btn {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
}
.password-toggle-btn:hover {
    color: var(--text-main);
}

/* Textarea Icon Fix */
.text-area-icon {
    top: 18px;
}
.textarea-wrapper textarea {
    padding-left: 42px;
}

.error-message {
    font-size: 11px;
    font-weight: 500;
    color: var(--danger);
    margin-top: 2px;
    display: none;
}

.error-message.visible {
    display: block;
}

/* Placeholder Styling */
input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    font-weight: 400;
    opacity: 0.65;
}

/* ==================== LOGIN SCREEN ==================== */
/* ==================== LOGIN SCREEN ==================== */
.login-screen-bg {
    position: relative;
    min-height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background-image: url('school_bus.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1;
}

.login-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.45) 0%, rgba(15, 23, 42, 0.8) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 0;
}

.login-card {
    background-color: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 24px;
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 440px;
    padding: 48px;
    z-index: 1;
    animation: scale-up 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes scale-up {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo-icon-container {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background-color: rgba(99, 102, 241, 0.08);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px auto;
    border: 1px solid rgba(99, 102, 241, 0.12);
}

.logo-icon {
    width: 24px;
    height: 24px;
}

.login-header h1 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
    color: var(--text-main);
}

.login-header p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.login-helper {
    background-color: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 12px;
    margin-bottom: 24px;
}

.cred-hints {
    font-size: 11px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cred-hints span {
    font-weight: 600;
    color: var(--text-muted);
}

.hint-tags {
    display: flex;
    gap: 8px;
}

.hint-tag {
    background-color: var(--border-color);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 700;
    transition: all var(--transition-fast);
    border: 1px dashed transparent;
}

.hint-tag:hover {
    border-color: var(--primary);
    background-color: var(--primary-tint);
    color: var(--text-main);
}

/* ==================== MAIN APP LAYOUT ==================== */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding-left: 8px;
}

.brand-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--info) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}
.brand-logo i {
    width: 18px;
    height: 18px;
}

.brand-name {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-main) 30%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Profile Widget */
.user-profile-widget {
    background-color: var(--primary-tint);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}

.user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* Nav Links */
.sidebar-nav {
    flex-grow: 1;
}

.sidebar-nav ul {
    list-style-type: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.nav-link i {
    width: 18px;
    height: 18px;
}

.nav-link:hover {
    color: var(--text-main);
    background-color: var(--border-color);
}

.nav-link.active {
    color: white;
    background-color: var(--primary);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

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

.btn-logout {
    width: 100%;
    justify-content: flex-start;
    color: var(--danger);
    background: transparent;
    border: 1px solid transparent;
}
.btn-logout:hover {
    background-color: var(--danger-tint);
    border-color: rgba(239, 68, 68, 0.2);
}

/* Content Panel Wrapper */
.content-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Header bar */
.app-header {
    height: var(--header-height);
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.header-left h2 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.header-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.date-time-widget {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--border-color);
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    font-size: 12px;
    font-weight: 600;
}
.date-time-widget i {
    width: 14px;
    height: 14px;
    color: var(--primary);
}

/* Theme Toggle Button */
.theme-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}
.theme-toggle-btn:hover {
    background-color: var(--border-color);
    transform: rotate(15deg);
}

.theme-toggle-btn i {
    width: 18px;
    height: 18px;
}

/* Visual state for Toggle Icon */
.dark-theme .sun-icon { display: block; }
.dark-theme .moon-icon { display: none; }
.light-theme .sun-icon { display: none; }
.light-theme .moon-icon { display: block; }

/* Main Scrollable View Area */
.main-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px 0;
}

/* View transition wrappers */
.app-view {
    display: none;
    animation: fade-in 0.3s ease forwards;
}

.app-view.active {
    display: block;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== VIEW 1: DASHBOARD VIEW ==================== */
/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
    padding: 0 24px;
}

.kpi-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 24px;
    box-shadow: var(--glass-shadow);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-2px);
}

/* Neon glows for cards */
.kpi-card.purple-glow:hover { box-shadow: 0 8px 30px var(--card-glow-purple); }
.kpi-card.orange-glow:hover { box-shadow: 0 8px 30px var(--card-glow-orange); }
.kpi-card.blue-glow:hover { box-shadow: 0 8px 30px var(--card-glow-blue); }
.kpi-card.green-glow:hover { box-shadow: 0 8px 30px var(--card-glow-green); }

.kpi-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.kpi-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kpi-icon-container {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.kpi-icon-container i {
    width: 18px;
    height: 18px;
}

.kpi-value {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

.kpi-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}

.kpi-subtext {
    color: var(--text-muted);
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background-color: var(--border-color);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 4px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--info) 100%);
    border-radius: 999px;
    transition: width 0.8s ease-in-out;
}

/* Dashboard Row 2 Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 24px;
}

.dashboard-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.flex-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.card-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.card-body {
    padding: 24px;
    flex-grow: 1;
}

/* Charts Wrapper */
.chart-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    position: relative;
}

.chart-content {
    position: relative;
    width: 100%;
    max-height: 240px;
}

/* Custom Offline/Fallback Chart fallback */
.chart-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
}

.fallback-donut {
    width: 140px;
    height: 140px;
    transform: rotate(-90deg);
}

.donut-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 12;
}

.donut-fill {
    fill: none;
    stroke: var(--primary);
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dasharray 0.8s ease-in-out;
}

.fallback-legend {
    display: flex;
    gap: 20px;
    font-size: 12px;
    font-weight: 600;
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
}
.legend-dot.received { background-color: var(--success); }
.legend-dot.pending { background-color: var(--warning); }

/* ==================== VIEW 2: FORM VIEW ==================== */
.form-container {
    width: 100%;
}

.form-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    border-left: none;
    border-right: none;
    border-radius: 0;
    padding: 24px;
}

.form-card-header {
    margin-bottom: 30px;
}

.form-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: var(--primary-tint);
    color: var(--primary);
    padding: 6px 12px;
    border-radius: var(--border-radius-sm);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.form-mode-badge.edit-mode {
    background-color: var(--warning-tint);
    color: var(--warning);
}

.form-card-header h3 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.form-card-header p {
    font-size: 13px;
    color: var(--text-muted);
}

.form-row {
    display: flex;
    gap: 20px;
}

.col-6 {
    width: 50%;
}

/* Status selection Tile Styles */
.status-tiles {
    display: flex;
    gap: 16px;
    margin-top: 4px;
}

.status-tile {
    flex: 1;
    position: relative;
    border: 1px solid var(--border-input);
    border-radius: 10px;
    padding: 12px 16px;
    cursor: pointer;
    background-color: var(--bg-input);
    transition: all var(--transition-fast);
}

.status-tile input[type="radio"] {
    position: absolute;
    top: 14px;
    right: 14px;
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    margin: 0;
}

.status-tile-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-tile-content i {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.tile-label {
    display: flex;
    flex-direction: column;
}

.tile-label strong {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
}

.tile-label span {
    font-size: 11px;
    color: var(--text-muted);
}

/* Checked Tile highlights */
.status-tile:has(input[type="radio"]:checked) {
    border-width: 2px;
}

.pending-tile:has(input[type="radio"]:checked) {
    border-color: var(--warning);
    background-color: var(--warning-tint);
}
.pending-tile:has(input[type="radio"]:checked) i {
    color: var(--warning);
}

.received-tile:has(input[type="radio"]:checked) {
    border-color: var(--success);
    background-color: var(--success-tint);
}
.received-tile:has(input[type="radio"]:checked) i {
    color: var(--success);
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

/* ==================== VIEW 3: REPORTS ==================== */
/* Filters */
.filter-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    border-left: none;
    border-right: none;
    border-radius: 0;
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: var(--glass-shadow);
}

.filter-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.flex-1 {
    flex: 1;
}

.filter-group label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 36px !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
}

.action-group {
    align-self: flex-end;
}

/* Records Table */
.report-table-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    border-left: none;
    border-right: none;
    border-radius: 0;
    box-shadow: var(--glass-shadow);
    overflow: hidden;
}

.table-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-header h3 {
    font-size: 16px;
    font-weight: 800;
}

.record-count-badge {
    background-color: var(--border-color);
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
    margin-left: 8px;
}

.header-info {
    display: flex;
    align-items: center;
}

.table-actions {
    display: flex;
    gap: 8px;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

/* Master Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.data-table th,
.data-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table th {
    background-color: rgba(0, 0, 0, 0.05);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
    user-select: none;
}

.data-table th.sortable {
    cursor: pointer;
}
.data-table th.sortable:hover {
    color: var(--text-main);
    background-color: var(--primary-tint);
}

.sort-icon {
    width: 12px;
    height: 12px;
    display: inline-block;
    vertical-align: middle;
    margin-left: 4px;
    opacity: 0.5;
}

.data-table tbody tr {
    transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
    background-color: var(--bg-card-hover);
}

.col-sr {
    width: 60px;
    font-weight: 700;
    color: var(--text-muted);
}

.col-actions {
    width: 120px;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    font-weight: 500;
}
.empty-state td {
    padding: 48px;
}

/* Row Action Buttons */
.action-btns {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.action-btn {
    border: 1px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
    padding: 6px;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn i {
    width: 14px;
    height: 14px;
}

.action-btn:hover {
    color: var(--text-main);
    background-color: var(--border-color);
}

.btn-edit-row:hover {
    color: var(--warning);
    border-color: var(--warning);
    background-color: var(--warning-tint);
}

.btn-delete-row:hover {
    color: var(--danger);
    border-color: var(--danger);
    background-color: var(--danger-tint);
}

/* Pagination Footer */
.table-footer {
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
}

.pagination-info {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-pages {
    display: flex;
    gap: 4px;
}

.page-num {
    border: 1px solid var(--border-color);
    background-color: transparent;
    color: var(--text-main);
    font-weight: 600;
    font-size: 12px;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.page-num:hover {
    background-color: var(--border-color);
}

.page-num.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ==================== DIALOGS & MODALS ==================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fade-in-backdrop 0.2s ease forwards;
}

@keyframes fade-in-backdrop {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
    padding: 32px;
    max-width: 460px;
    width: 100%;
    text-align: center;
    animation: scale-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-icon-container {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px auto;
}

.modal-danger .modal-icon-container {
    background-color: var(--danger-tint);
    color: var(--danger);
}
.modal-danger .modal-icon-container i {
    width: 24px;
    height: 24px;
}

.modal-card h3 {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 8px;
}

.modal-card p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* ==================== RESPONSIVE DESIGN BREAKPOINTS ==================== */
@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    .app-layout {
        grid-template-columns: 1fr; /* Full width content, sidebar floats or turns into top bar */
    }
    
    .sidebar {
        display: none; /* In a real app we might toggle this, but since we are simple we hide for now or let them scroll */
    }
    
    /* Responsive header changes if sidebar is hidden */
    .app-header {
        padding: 0 20px;
    }
    
    .main-content {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    .col-6 {
        width: 100%;
    }
    .status-tiles {
        flex-direction: column;
    }
    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    .table-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
}

/* ==================== QUICK ACTION NAVIGATION CARDS ==================== */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-top: 8px;
    padding: 0 24px;
}

.action-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 32px;
    box-shadow: var(--glass-shadow);
    display: flex;
    align-items: center;
    gap: 24px;
    transition: all var(--transition-fast);
}

.action-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 8px 30px var(--card-glow-purple);
}

.action-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background-color: var(--primary-tint);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.action-card:hover .action-card-icon {
    background-color: var(--primary);
    color: white;
}

.action-card-icon i {
    width: 24px;
    height: 24px;
}

.action-card-content h3 {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 4px;
    color: var(--text-main);
}

.action-card-content p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

@media (max-width: 768px) {
    .quick-actions-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== PRINT MEDIA STYLES ==================== */
@media print {
    body {
        background-color: white !important;
        color: black !important;
        font-size: 12px;
    }
    
    .sidebar,
    .app-header,
    .filter-card,
    .table-header .table-actions,
    .table-footer,
    .action-btns,
    .col-actions,
    .theme-toggle-btn {
        display: none !important;
    }
    
    .app-layout {
        grid-template-columns: 1fr !important;
    }
    
    .content-wrapper,
    .main-content {
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        height: auto !important;
    }
    
    .report-table-card {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
    }
    
    .data-table {
        width: 100% !important;
        border-collapse: collapse !important;
    }
    
    .data-table th {
        background-color: #f3f4f6 !important;
        color: black !important;
        border-bottom: 2px solid black !important;
    }
    
    .data-table td {
        border-bottom: 1px solid #e5e7eb !important;
        color: black !important;
        padding: 8px 12px !important;
    }
    
    .badge {
        border: 1px solid black !important;
        color: black !important;
        background: none !important;
        padding: 2px 6px !important;
    }
}

/* ==================== APP FOOTER ==================== */
.app-footer {
    height: 48px;
    padding: 0 24px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.app-footer strong {
    color: var(--text-main);
}

.app-footer .footer-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px var(--success);
    animation: status-pulse 2s infinite ease-in-out;
}

@keyframes status-pulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(0.9);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

.version-tag {
    background-color: var(--border-color);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 10px;
}

/* ==================== MOBILE NAVIGATION ==================== */
.mobile-nav {
    display: none;
}

@media (max-width: 992px) {
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        background-color: var(--bg-surface);
        border-top: 1px solid var(--border-color);
        z-index: 1000;
        justify-content: space-around;
        align-items: center;
        box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.05);
    }
    
    .mobile-nav-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        color: var(--text-muted);
        text-decoration: none;
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.02em;
        flex: 1;
        height: 100%;
        transition: all var(--transition-fast);
    }
    
    .mobile-nav-link i {
        width: 18px;
        height: 18px;
    }
    
    .mobile-nav-link:hover {
        color: var(--text-main);
    }
    
    .mobile-nav-link.active {
        color: var(--primary);
    }
    
    .mobile-logout-link {
        color: var(--danger);
        opacity: 0.8;
    }
    
    .mobile-logout-link:hover {
        color: var(--danger);
        opacity: 1;
    }
    
    /* Ensure content wrapper ends above bottom navigation bar */
    .content-wrapper {
        height: calc(100vh - 60px);
    }
}

@media (max-width: 600px) {
    .kpi-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
        padding: 0 16px !important;
    }
    
    .quick-actions-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
        padding: 0 16px !important;
    }
    
    .form-card,
    .filter-card,
    .report-table-card {
        padding: 20px 16px !important;
    }
    
    .app-header {
        padding: 0 16px !important;
    }
}
