 :root {
            --primary: #1a472a;
            --accent: #c5a059; /* Gold for that "Old Book" feel */
            --bg: #f4f4f4;
            --sidebar-bg: #ffffff;
            --text: #2c2c2c;
            --border: #e0e0e0;
            --card-bg: #ffffff;
        }

        body.dark-mode {
            --primary: #4ca967;
            --accent: #d4af37;
            --bg: #1e1e1e;
            --sidebar-bg: #252525;
            --text: #e0e0e0;
            --border: #333;
            --card-bg: #2d2d2d;
        }

        body {
            margin: 0;
            font-family: 'Merriweather', serif;
            display: flex;
            height: 100vh;
            background-color: var(--bg);
            color: var(--text);
            overflow: hidden;
            transition: background 0.3s, color 0.3s;
        }

        /* SIDEBAR */
        #sidebar {
            width: 380px;
            background: var(--sidebar-bg);
            border-right: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            flex-shrink: 0;
            box-shadow: 2px 0 10px rgba(0,0,0,0.05);
        }

        .search-container {
            padding: 20px;
            background: var(--primary);
            color: white;
        }

        .search-container h2 {
            margin: 0 0 10px 0;
            font-family: 'Segoe UI', sans-serif;
            font-weight: 300;
            letter-spacing: 1px;
        }

        #searchInput {
            width: 100%;
            padding: 12px;
            border: none;
            border-radius: 4px;
            font-size: 1rem;
            box-sizing: border-box;
            background: rgba(255,255,255,0.9);
        }

        #palmList {
            overflow-y: auto;
            flex-grow: 1;
            list-style: none;
            padding: 0;
            margin: 0;
        }

        .palm-item {
            padding: 15px 20px;
            border-bottom: 1px solid var(--border);
            cursor: pointer;
            transition: all 0.2s;
        }

        .palm-item:hover { background-color: rgba(0,0,0,0.05); border-left: 4px solid var(--accent); }
        .palm-item.active { 
            background-color: rgba(0,0,0,0.08); 
            border-left: 6px solid var(--primary); 
        }
        
        .palm-item .name { font-weight: bold; display: block; font-family: 'Segoe UI', sans-serif; }
        .palm-item .meta { font-size: 0.75rem; opacity: 0.7; text-transform: uppercase; margin-top: 4px; display: block;}

        /* MAIN CONTENT */
        #main {
            flex-grow: 1;
            overflow-y: auto;
            padding: 0;
            scroll-behavior: smooth;
        }

        .content-wrapper {
            max-width: 1000px;
            margin: 0 auto;
            padding: 50px;
        }

        /* HEADER */
        .taxon-header {
            border-bottom: 1px solid var(--border);
            padding-bottom: 20px;
            margin-bottom: 40px;
        }

        .taxonomy-breadcrumbs {
            font-family: 'Segoe UI', sans-serif;
            font-size: 0.85rem;
            color: var(--accent);
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-bottom: 10px;
            display: block;
        }

        h1.scientific-name {
            font-size: 3rem;
            margin: 0;
            font-style: italic;
            line-height: 1.1;
        }

        .author {
            font-size: 1rem;
            opacity: 0.6;
            margin-left: 10px;
            font-style: normal;
        }

        /* GRID LAYOUT */
        .info-grid {
            display: grid;
            grid-template-columns: 2fr 1fr;
            gap: 40px;
        }

        /* TEXT SECTIONS */
        h2 {
            font-family: 'Segoe UI', sans-serif;
            font-size: 1.4rem;
            color: var(--primary);
            border-bottom: 2px solid var(--accent);
            padding-bottom: 5px;
            margin-top: 40px;
        }

        p { line-height: 1.8; font-size: 1.05rem; }

        /* GALLERY (The New Part) */
        .gallery-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 20px;
            margin-top: 20px;
        }

        .plate-card {
            background: var(--card-bg);
            border: 1px solid var(--border);
            border-radius: 6px;
            overflow: hidden;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            transition: transform 0.2s;
        }

        .plate-card:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.15); }

        .plate-img-wrapper {
            height: 250px;
            overflow: hidden;
            background: #eee;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .plate-img-wrapper img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: opacity 0.3s;
        }

        .plate-meta {
            padding: 10px;
            font-family: 'Segoe UI', sans-serif;
            font-size: 0.8rem;
            border-top: 1px solid var(--border);
        }

        .plate-source { font-weight: bold; color: var(--primary); display: block; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .plate-caption { color: var(--text); opacity: 0.8; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

        /* META SIDEBAR (Right) */
        .meta-box {
            background: var(--card-bg);
            padding: 20px;
            border-radius: 8px;
            border: 1px solid var(--border);
            position: sticky;
            top: 20px;
        }

        .meta-row { margin-bottom: 15px; }
        .meta-label { display: block; font-size: 0.75rem; text-transform: uppercase; color: #888; font-family: 'Segoe UI', sans-serif; }
        .meta-val { font-weight: bold; }

        /* TAGS */
        .tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; background: #eee; color: #333; margin-right: 5px; }
        .tag.accepted { background: #e6fffa; color: #006644; border: 1px solid #b7eb8f; }

        /* EMPTY STATE */
        #welcome {
            height: 100%;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            opacity: 0.4;
        }

        /* TOGGLE */
        .mode-toggle {
            position: absolute;
            top: 20px;
            right: 20px;
            cursor: pointer;
            padding: 10px;
            background: rgba(0,0,0,0.1);
            border-radius: 50%;
        }
		@media (max-width: 900px) {
		body { flex-direction: column; height: auto; overflow: auto; }
		#sidebar { width: 100%; max-height: 45vh; border-right: none; border-bottom: 1px solid var(--border); }
		#palmList { max-height: calc(45vh - 110px); }
		#main { overflow: auto; }
		.content-wrapper { padding: 18px; }
		.info-grid { grid-template-columns: 1fr; gap: 18px; }
		.meta-box { position: static; }
		h1.scientific-name { font-size: 2rem; }
}