:root {
            /* Color Palette (Muted Texan Dark Mode - Soft Red, White, Navy) */
            --bg-main: #0f172a;       /* Soft Navy / Slate */
            --bg-secondary: #1e293b;  /* Lighter Slate */
            --bg-tertiary: #334155;   /* Medium Slate */
            --text-main: #f1f5f9;     /* Soft White */
            --text-muted: #94a3b8;    /* Muted Gray */
            --text-dark: #64748b;     /* Dark Gray */
            --accent: #b91c1c;        /* Classic Brick Red */
            --accent-hover: #991b1b;  /* Darker Brick Red */
            --accent-glow: rgba(185, 28, 28, 0.15);
            --white: #ffffff;
            --blue-accent: #60a5fa;   /* Soft Steel Blue */
        }

        /* Custom Scrollbar for a premium look */
        ::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }
        ::-webkit-scrollbar-track {
            background: var(--bg-secondary); 
        }
        ::-webkit-scrollbar-thumb {
            background: var(--bg-tertiary); 
            border-radius: 4px;
        }
        ::-webkit-scrollbar-thumb:hover {
            background: var(--text-dark); 
        }
        
        /* Sticky Headers */
        th.header-sort {
            position: sticky;
            top: 0;
            z-index: 20;
            background-color: var(--text-main); /* slate-100 */
        }
        html.dark th.header-sort {
            background-color: var(--bg-tertiary); /* dark mode */
        }
        th.header-filter {
            position: sticky;
            top: 40px;
            z-index: 10;
            background-color: var(--white);
        }
        html.dark th.header-filter {
            background-color: var(--bg-secondary);
        }
        table { border-collapse: separate; border-spacing: 0; }
        th, td { border-bottom: 1px solid #cbd5e1; } /* slate-300 */
        html.dark th, html.dark td { border-bottom: 1px solid var(--bg-tertiary); } /* slate-700 */

        /* Texas Cosmic Theme Backgrounds */
        body {
            background-color: var(--text-main); /* slate-100 */
            background-image: 
                radial-gradient(circle at 85% 15%, rgba(226, 232, 240, 0.6) 0%, transparent 40%),
                radial-gradient(circle at 15% 85%, rgba(185, 28, 28, 0.05) 0%, transparent 45%),
                url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%2394a3b8' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
            background-attachment: fixed;
        }
        
        html.dark body {
            background-color: var(--bg-main); /* slate-900 */
            background-image: 
                radial-gradient(circle at 85% 15%, rgba(30, 41, 59, 0.8) 0%, transparent 40%),
                radial-gradient(circle at 15% 85%, var(--accent-glow) 0%, transparent 45%), /* Classic Brick Red glow */
                url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
            background-attachment: fixed;
        }

        /* Passport Print Styles */
        .passport-card {
            width: 100%; max-width: 400px;
            background-color: #0f172a;
            border: 1px solid #334155;
            padding: 32px;
            position: relative;
            color: #f1f5f9;
            font-family: inherit;
            margin: 0 auto;
        }
        .passport-card * {
            -webkit-print-color-adjust: exact !important;
            print-color-adjust: exact !important;
        }
        .badge-verified {
            position: absolute; top: -12px; right: -12px;
            background-color: #b91c1c; color: #ffffff;
            font-size: 10px; font-weight: 700; letter-spacing: 0.2em;
            text-transform: uppercase; padding: 4px 12px;
            box-shadow: 0 4px 6px rgba(0,0,0,0.3);
        }
        .pc-header { text-align: center; border-bottom: 1px solid #334155; padding-bottom: 24px; margin-bottom: 32px; }
        .pc-header i { color: #b91c1c; font-size: 2rem; margin-bottom: 16px; }
        .pc-header h3 { font-size: 1.5rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.2em; margin: 0; color: #ffffff;}
        .pc-header p { font-size: 10px; color: #64748b; letter-spacing: 0.2em; text-transform: uppercase; margin-top: 8px; }
        .pc-photo { width: 100%; height: 160px; background-color: #334155; border-radius: 4px; margin-bottom: 20px; overflow: hidden; position: relative; border: 1px solid #1e293b; }
        .pc-photo img { width: 100%; height: 100%; object-fit: cover; opacity: 0.85; filter: grayscale(20%) contrast(1.2); }
        .pc-photo-overlay { position: absolute; bottom: 0; left: 0; width: 100%; padding: 16px 12px 8px; background: linear-gradient(to top, rgba(15,23,42,0.95), transparent); color: white; font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; font-weight: 700; }
        .pc-data-row { margin-bottom: 20px; }
        .pc-label { display: block; color: #64748b; font-size: 10px; text-transform: uppercase; letter-spacing: 0.2em; margin-bottom: 4px; font-weight: bold; }
        .pc-value { color: #f1f5f9; font-size: 14px; letter-spacing: 0.05em; }
        .pc-value.highlight { color: #b91c1c; font-weight: 700; }
        .pc-mini-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid #334155; }
        .pc-data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
        .pc-value.success { color: #22c55e; font-weight: 700; font-size: 12px; }
        .pc-footer { margin-top: 32px; padding-top: 24px; border-top: 1px solid #334155; display: flex; justify-content: space-between; align-items: center; }
        .barcode-stub { display: flex; gap: 4px; }
        .barcode-line { width: 4px; height: 16px; background-color: #991b1b; }
        .qr-code-stub { width: 40px; height: 40px; background-color: white; padding: 2px; border-radius: 4px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
        .qr-dot { background-color: #0f172a; width: 100%; height: 100%; border-radius: 1px; }
        .qr-dot.filled { background-color: #b91c1c; }

        @media print {
            body * { visibility: hidden; }
            #passport-print-modal, #passport-print-modal * { visibility: visible; }
            #passport-print-modal { position: absolute; left: 0; top: 0; width: 100%; height: 100%; background: white; padding-top: 40px; display: flex !important; justify-content: center; align-items: flex-start; }
            .no-print { display: none !important; }
            .passport-card { transform: scale(1.25); transform-origin: top center; box-shadow: none; border: 1px solid #334155; }
        }

        /* Responsive Tables for Mobile */
        @media (max-width: 768px) {
            #table-view { padding-left: 0.5rem; padding-right: 0.5rem; }
            #table-view > div { border: none !important; box-shadow: none !important; background: transparent !important; }
            table, thead, tbody, th, td, tr { display: block; }
            thead tr { position: absolute; top: -9999px; left: -9999px; } /* Hide headers visually */
            tr { 
                background: white; 
                margin-bottom: 1rem; 
                border-radius: 0.75rem; 
                box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1); 
                border: 1px solid #e2e8f0;
                overflow: hidden;
            }
            html.dark tr { 
                background: var(--bg-secondary); 
                border-color: var(--bg-tertiary); 
            }
            td { 
                border: none !important; 
                border-bottom: 1px solid #f1f5f9 !important; 
                position: relative; 
                padding: 0.75rem 1rem 0.75rem 40% !important; 
                min-height: 64px;
                display: flex;
                align-items: center;
                justify-content: flex-end;
                text-align: right;
            }
            html.dark td { border-bottom-color: rgba(51, 65, 85, 0.5) !important; }
            td:last-child { border-bottom: 0 !important; }
            td::before { 
                content: attr(data-label); 
                position: absolute; 
                left: 1rem; 
                width: 35%; 
                padding-right: 10px; 
                white-space: nowrap; 
                font-weight: 700; 
                font-size: 0.7rem; 
                color: #64748b;
                text-transform: uppercase;
                text-align: left;
                letter-spacing: 0.05em;
            }
            html.dark td::before { color: #94a3b8; }
            
            /* Inputs should stretch */
            td select, td input[type="text"], td input[type="number"], td input[type="date"] {
                width: 100%;
                max-width: 220px;
                padding-top: 0.5rem;
                padding-bottom: 0.5rem;
            }

            /* Specific Mobile Table Tweaks */
            td[data-label="Date"] { display: none !important; } /* Hide global Date on feeding log */
            td[data-label="Sex"], td[data-label="Gender"] { display: none !important; } /* Hide Sex on mobile since it's under Name */
            
            /* Highlight Card Headers */
            td[data-label="Name"], td[data-label="Males"], td[data-label="Sire"], td[data-label="Trait / Complex"] {
                background-color: #f8fafc;
                padding: 1rem !important;
                justify-content: flex-start;
                text-align: left;
                font-size: 1.1rem;
                border-bottom: 2px solid #e2e8f0 !important;
            }
            html.dark td[data-label="Name"], html.dark td[data-label="Males"], html.dark td[data-label="Sire"], html.dark td[data-label="Trait / Complex"] { 
                background-color: rgba(15, 23, 42, 0.6); 
                border-bottom-color: var(--bg-tertiary) !important;
            }
            td[data-label="Name"]::before, td[data-label="Males"]::before, td[data-label="Sire"]::before, td[data-label="Trait / Complex"]::before { display: none; } /* Hide label */
            td[data-label="Name"] > div, td[data-label="Males"] > div, td[data-label="Sire"] > div, td[data-label="Trait / Complex"] > div { width: 100%; justify-content: flex-start; }
        }

        /* Texas Panel borders */
        .texas-panel {
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        }
        html.dark .texas-panel {
            border: 1px solid var(--bg-tertiary); /* slate-700 */
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
            background-color: rgba(30, 41, 59, 0.90); /* slate-800 with opacity */
            backdrop-filter: blur(12px);
        }
