:root {
    --bg: #f4f7f4;
    --surface: #ffffff;
    --text: #2d3b2d;
    --text-muted: #666;
    --text-faint: #888;
    --border: #ccc;
    --border-light: #f0f0f0;
    --header-bg: #2d6a2d;
    --shadow: rgba(0,0,0,0.08);
    --shadow-hover: rgba(0,0,0,0.12);
    --ai-bg: #f5f0ff;
}

[data-theme="dark"] {
    --bg: #1a241a;
    --surface: #22302a;
    --text: #ddeedd;
    --text-muted: #99bb99;
    --text-faint: #778877;
    --border: #3a4e3a;
    --border-light: #2a3a2a;
    --header-bg: #163016;
    --shadow: rgba(0,0,0,0.3);
    --shadow-hover: rgba(0,0,0,0.4);
    --ai-bg: #2a2040;
}

[data-font="large"] { font-size: 112%; }

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition: background 0.2s, color 0.2s;
}

header {
    background: var(--header-bg);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header h1 {
    font-size: 1.5rem;
}

.header-brand {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.header-title {
    color: white;
    text-decoration: none;
}

.header-byline {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
    letter-spacing: 0.03em;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

footer {
    background: var(--header-bg);
    color: rgba(255,255,255,0.85);
    margin-top: 3rem;
    padding: 2rem;
}

.footer-inner {
    max-width: 900px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.footer-about h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.footer-about p { font-size: 0.85rem; color: rgba(255,255,255,0.65); line-height: 1.5; }

.footer-how h4, .footer-coming h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.5);
    margin-bottom: 0.6rem;
}

.footer-how ul, .footer-coming ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.footer-how li, .footer-coming li {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.7);
}

.footer-base {
    max-width: 900px;
    margin: 1rem auto 0;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.45);
    text-align: center;
}

.footer-base strong { color: rgba(255,255,255,0.7); }
.footer-link { color: rgba(255,255,255,0.5); text-decoration: none; }
.footer-link:hover { color: rgba(255,255,255,0.8); }

.about-page { max-width: 860px; margin: 0 auto; }
.about-page h2 { margin-bottom: 0.8rem; }
.about-intro { color: var(--text-muted); margin-bottom: 1.5rem; line-height: 1.6; }
.about-image { width: 100%; border-radius: 10px; box-shadow: 0 2px 12px var(--shadow); }
.about-credit { margin-top: 1rem; text-align: center; color: var(--text-faint); font-size: 0.85rem; }

@media (max-width: 600px) {
    .footer-inner { grid-template-columns: 1fr; gap: 1.2rem; }
}

.settings-group {
    display: flex;
    gap: 0.4rem;
}

.icon-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover { background: rgba(255,255,255,0.25); }

main {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

main h2 {
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.btn {
    background: #4caf50;
    color: white;
    padding: 0.5rem 1.1rem;
    border-radius: 6px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
}

.btn.secondary {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.6);
}

.btn:hover {
    opacity: 0.9;
}

.plant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.plant-card {
    background: var(--surface);
    border-radius: 10px;
    padding: 1.2rem;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 4px var(--shadow);
    transition: box-shadow 0.15s;
}

.plant-card:hover {
    box-shadow: 0 3px 10px var(--shadow-hover);
}

.plant-card h2 {
    font-size: 1.1rem;
    margin-bottom: 0.4rem;
}

.species { color: var(--text-muted); font-style: italic; font-size: 0.9rem; }
.location { font-size: 0.85rem; color: var(--text-faint); margin-top: 0.3rem; }

.form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 500px;
}

.form label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.form input, .form textarea, .form select {
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
}

.inline-form {
    flex-direction: row;
    align-items: center;
    max-width: 700px;
}

.inline-form select, .inline-form input {
    flex: 1;
}

.plant-header {
    background: var(--surface);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 4px var(--shadow);
}

.plant-header h2 { font-size: 1.5rem; margin-bottom: 0.4rem; }
.notes { margin-top: 0.6rem; color: var(--text-muted); font-size: 0.95rem; }

.log-section, .history {
    background: var(--surface);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 4px var(--shadow);
}

.log-section h3, .history h3 {
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.sort-toggle {
    font-size: 0.8rem;
    color: #4caf50;
    text-decoration: none;
    border: 1px solid #4caf50;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

.sort-toggle:hover { background: #f0faf0; }

.event-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.event-list li {
    display: flex;
    gap: 1rem;
    align-items: baseline;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.95rem;
}

.event-type { font-weight: 600; min-width: 120px; }
.event-date { color: var(--text-faint); font-size: 0.85rem; }
.event-notes { color: var(--text-muted); }

.empty { color: var(--text-faint); font-style: italic; }

.card-thumbnail {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 0.7rem;
}

.photo-gallery {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.gallery-item {
    flex: 1 1 200px;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.gallery-photo {
    width: 100%;
    max-height: 280px;
    object-fit: cover;
    border-radius: 8px;
}

.photo-meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.meta-note { font-style: italic; color: var(--text-faint); }

.plant-photo-small {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

.photo-manage-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 0.4rem;
}

.photo-manage-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.btn-delete {
    background: transparent;
    border: 1px solid #e57373;
    color: #c62828;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
}

.btn-delete:hover { background: #fdecea; }

.form-section { display: flex; flex-direction: column; gap: 0.3rem; }
.field-label { font-size: 0.9rem; font-weight: 600; }
.field-hint { font-size: 0.8rem; color: #888; font-weight: normal; }

.plant-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.8rem 0 1rem;
}

.info-row {
    display: flex;
    gap: 0.6rem;
    font-size: 0.95rem;
}

.info-row dt {
    font-weight: 600;
    color: var(--text-muted);
    min-width: 80px;
}

.info-row dd { color: var(--text); }

.btn.secondary-green {
    background: transparent;
    border: 1px solid #4caf50;
    color: #2d6a2d;
    display: inline-block;
}

.plant-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1rem;
}

.btn-ai {
    background: #5c35a0;
}

.btn-ai:hover { opacity: 0.88; }

.event-list li.ai-event {
    background: var(--ai-bg);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    border-bottom: none;
    flex-direction: column;
    gap: 0.3rem;
}

.event-list li.ai-event .event-notes {
    white-space: pre-wrap;
    line-height: 1.6;
}
