/* ============================================================
   Dahlia Breeding Tracker — Stylesheet
   Palette: Lavender + Sage Green | Light Mode Only
   ============================================================ */

:root {
    /* Lavender */
    --lav-50:  #F6F2FB;
    --lav-100: #EDE6F5;
    --lav-200: #D8CDED;
    --lav-300: #C0AEDE;
    --lav-400: #A48EC9;
    --lav-500: #8B6FB5;
    --lav-600: #7559A0;
    --lav-700: #5D4580;

    /* Sage */
    --sage-50:  #EEF3E8;
    --sage-100: #D9E8CD;
    --sage-200: #B8CEA8;
    --sage-300: #93B381;
    --sage-400: #74985E;
    --sage-500: #5C7D47;
    --sage-600: #4A6639;
    --sage-700: #3A4F2C;

    /* Neutrals */
    --n-50:  #FAFAFA;
    --n-100: #F3F1F7;
    --n-200: #E6E2EF;
    --n-300: #CFC9DF;
    --n-400: #9E98B3;
    --n-500: #6E6885;
    --n-600: #4C4766;
    --n-700: #302C47;
    --n-800: #1E1B33;

    /* Semantic */
    --bg:            #F5F2FB;
    --surface:       #FFFFFF;
    --border:        var(--n-200);
    --text:          var(--n-700);
    --text-muted:    var(--n-400);
    --primary:       var(--lav-500);
    --primary-dark:  var(--lav-600);
    --primary-light: var(--lav-50);
    --secondary:       var(--sage-500);
    --secondary-dark:  var(--sage-600);
    --secondary-light: var(--sage-50);
    --danger:        #C0454A;
    --danger-light:  #FBEAEA;
    --success:       #3D7A38;
    --success-light: #EAF4E8;
    --warning:       #9A6B0A;
    --warning-light: #FEF5DC;

    /* Typography */
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    /* Radius */
    --r-sm:   0.375rem;
    --r:      0.5rem;
    --r-lg:   0.75rem;
    --r-xl:   1rem;
    --r-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(90, 60, 140, 0.08);
    --shadow:    0 2px 10px rgba(90, 60, 140, 0.12);
    --shadow-lg: 0 4px 20px rgba(90, 60, 140, 0.16);

    --transition: 150ms ease;
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
button { font-family: var(--font); }

/* ---- LAYOUT ---- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
}
main {
    padding-top: 1.5rem;
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 768px) {
    main { padding-bottom: 2rem; }
}

/* ---- SITE HEADER ---- */
.site-header {
    background: var(--surface);
    border-bottom: 2px solid var(--lav-200);
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 1px 6px rgba(90,60,140,0.07);
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: 56px;
}
.site-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--lav-600);
    text-decoration: none;
    letter-spacing: -0.01em;
}
.site-logo svg { width: 26px; height: 26px; flex-shrink: 0; }
.site-logo img { width: 32px; height: 32px; flex-shrink: 0; }

/* Desktop nav */
.desktop-nav {
    display: none;
    align-items: center;
    gap: 0.25rem;
}
.desktop-nav a {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    border-radius: var(--r-full);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--n-500);
    transition: all var(--transition);
    text-decoration: none;
}
.desktop-nav a:hover { background: var(--lav-100); color: var(--lav-600); }
.desktop-nav a.nav-active { background: var(--lav-100); color: var(--lav-600); font-weight: 700; }
.desktop-nav a.nav-active-sage { background: var(--sage-50); color: var(--sage-600); font-weight: 700; }
.desktop-nav svg { width: 16px; height: 16px; }
.header-right { display: flex; align-items: center; gap: 0.75rem; }
/* ---- USER MENU ---- */
.user-menu { position: relative; }
.user-menu-btn {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--n-500);
    border: 1.5px solid var(--n-300);
    border-radius: var(--r-full);
    padding: 0.25rem 0.75rem;
    background: transparent;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 36px;
    font-family: inherit;
}
.user-menu-btn:hover,
.user-menu-btn[aria-expanded="true"] {
    color: var(--lav-600);
    border-color: var(--lav-400);
    background: var(--lav-50);
}
.user-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.375rem);
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    min-width: 168px;
    z-index: 200;
    padding: 0.25rem 0;
}
.user-menu-dropdown.open { display: block; }
.user-menu-dropdown a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    color: var(--text);
    text-decoration: none;
    transition: background var(--transition);
}
.user-menu-dropdown a:hover { background: var(--lav-50); color: var(--lav-700); }
.user-menu-divider { border-top: 1px solid var(--border); margin: 0.25rem 0; }

@media (min-width: 768px) {
    .desktop-nav { display: flex; }
}

/* ---- BOTTOM NAV (Mobile) ---- */
.bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-top: 1.5px solid var(--lav-200);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -2px 12px rgba(90,60,140,0.10);
}
.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 0.5rem 0;
    min-height: 56px;
    color: var(--n-400);
    font-size: 0.6875rem;
    font-weight: 500;
    text-decoration: none;
    transition: color var(--transition);
}
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a.nav-active { color: var(--lav-600); }
.bottom-nav a.nav-active-sage { color: var(--sage-600); }
@media (min-width: 768px) { .bottom-nav { display: none; } }

/* ---- FLASH MESSAGES ---- */
.flash {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--r);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    animation: flashIn 0.25s ease;
}
.flash-success { background: var(--success-light); color: var(--success); border: 1px solid #B8DFB5; }
.flash-error   { background: var(--danger-light);  color: var(--danger);  border: 1px solid #F0C4C4; }
.flash-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #F0DCA0; }
@keyframes flashIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- CARDS ---- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--lav-50);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.card-header h2, .card-header h3 { margin: 0; }
.card-body { padding: 1.25rem; }
.card-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--n-50);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1.25rem;
    border-radius: var(--r-full);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
    min-height: 44px;
    line-height: 1;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary   { background: var(--lav-500);  color: #fff; }
.btn-primary:hover  { background: var(--lav-600);  color: #fff; }
.btn-secondary { background: var(--sage-500); color: #fff; }
.btn-secondary:hover { background: var(--sage-600); color: #fff; }
.btn-outline   { background: transparent; color: var(--lav-600); border: 1.5px solid var(--lav-400); }
.btn-outline:hover { background: var(--lav-100); color: var(--lav-600); }
.btn-ghost     { background: transparent; color: var(--n-600); border: 1.5px solid var(--n-300); }
.btn-ghost:hover   { background: var(--n-100); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: #a53a3e; color: #fff; }
.btn-danger-outline { background: transparent; color: var(--danger); border: 1.5px solid var(--danger); }
.btn-danger-outline:hover { background: var(--danger-light); }
.btn-sm { padding: 0.3rem 0.875rem; font-size: 0.8125rem; min-height: 36px; }
.btn-lg { padding: 0.75rem 1.75rem; font-size: 1rem; min-height: 52px; }
.btn-icon { width: 44px; height: 44px; padding: 0; border-radius: var(--r); }
.btn-icon.btn-sm { width: 34px; height: 34px; }

/* ---- STOCK CONTROLS ---- */
.stock-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.stock-btn {
    width: 44px; height: 44px;
    border: none;
    border-radius: var(--r);
    font-size: 1.25rem;
    font-weight: 700;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
    font-family: var(--font);
    flex-shrink: 0;
}
.stock-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.stock-btn-minus { background: var(--lav-100); color: var(--lav-700); }
.stock-btn-minus:hover { background: var(--lav-200); }
.stock-btn-plus  { background: var(--sage-100); color: var(--sage-700); }
.stock-btn-plus:hover  { background: var(--sage-200); }
.stock-controls-sm .stock-btn { width: 30px; height: 30px; font-size: 1rem; }
.stock-controls-sm .stock-count { font-size: 1rem; min-width: 28px; font-weight: 700; }
.stock-count {
    font-size: 1.375rem;
    font-weight: 800;
    color: var(--n-800);
    min-width: 44px;
    text-align: center;
    transition: color 0.25s, transform 0.15s;
}

/* ---- FORMS ---- */
.form-group  { margin-bottom: 1.25rem; }
.form-group:last-child { margin-bottom: 0; }
.form-row    { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 580px) {
    .form-row-2 { grid-template-columns: 1fr 1fr; }
    .form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
}
label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--n-600);
    margin-bottom: 0.375rem;
}
.label-optional { font-weight: 400; color: var(--n-400); font-size: 0.8125rem; margin-left: 0.25rem; }
input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--n-300);
    border-radius: var(--r);
    font-size: 1rem;
    font-family: var(--font);
    color: var(--n-800);
    background: var(--surface);
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
    appearance: none;
    min-height: 44px;
}
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237559A0' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px;
    padding-right: 2.25rem;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--lav-400);
    box-shadow: 0 0 0 3px rgba(139,111,181,0.15);
}
.form-hint  { font-size: 0.8125rem; color: var(--n-400); margin-top: 0.25rem; }
.form-error { font-size: 0.8125rem; color: var(--danger);  margin-top: 0.25rem; }

/* File upload */
.file-upload-area {
    border: 2px dashed var(--lav-300);
    border-radius: var(--r);
    padding: 1.5rem 1rem;
    text-align: center;
    background: var(--lav-50);
    cursor: pointer;
    transition: all var(--transition);
    color: var(--n-500);
}
.file-upload-area:hover { border-color: var(--lav-500); background: var(--lav-100); }
.file-upload-area.drag-over { border-color: var(--lav-600); background: var(--lav-100); box-shadow: 0 0 0 3px var(--lav-200); }
.file-upload-area.drag-over svg { color: var(--lav-600); }
.file-upload-area input[type="file"] { display: none; }
.file-upload-area svg { width: 32px; height: 32px; margin: 0 auto 0.5rem; color: var(--lav-400); transition: color var(--transition); }
.file-upload-label { font-size: 0.875rem; color: var(--n-500); margin-top: 0.25rem; }

/* ---- Promoted Banner ---- */
.promoted-banner {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    background: var(--lav-50);
    border: 1px solid var(--lav-200);
    border-radius: var(--r);
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    color: var(--lav-700);
    margin-bottom: 1.25rem;
}
.promoted-banner svg { flex-shrink: 0; color: var(--lav-500); }
.promoted-banner a { color: var(--lav-700); }

/* ---- Upload Progress Overlay ---- */
.upload-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.upload-overlay-box {
    background: var(--surface);
    border-radius: var(--r-lg);
    padding: 2rem 2.5rem;
    width: min(420px, 90vw);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}
.upload-overlay-box svg { flex-shrink: 0; }
.upload-progress-label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--n-800);
}
.upload-progress-track {
    width: 100%;
    height: 8px;
    background: var(--lav-100);
    border-radius: var(--r-full);
    overflow: hidden;
}
.upload-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, var(--lav-400), var(--sage-400));
    border-radius: var(--r-full);
    transition: width 0.15s ease;
}
.upload-progress-sub {
    font-size: 0.8125rem;
    color: var(--n-400);
    min-height: 1.2em;
}

/* ---- PAGE HEADER ---- */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.page-header h1 { display: flex; align-items: center; gap: 0.625rem; }
.page-header h1 svg { width: 28px; height: 28px; color: var(--lav-500); }
.page-header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---- BACK LINK ---- */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--n-400);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    text-decoration: none;
    transition: color var(--transition);
}
.back-link:hover { color: var(--lav-600); }
.back-link svg { width: 16px; height: 16px; }

/* ---- BADGES ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 0.5rem;
    border-radius: var(--r-full);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.4;
}
.badge-lav     { background: var(--lav-100);  color: var(--lav-700); }
.badge-sage    { background: var(--sage-100); color: var(--sage-700); }
.badge-neutral { background: var(--n-100);   color: var(--n-600); }
.badge-status-watching    { background: #EEF2FF; color: #4338CA; }
.badge-status-promising   { background: #FEF9EE; color: #B45309; }
.badge-status-tobenamed   { background: var(--sage-50);  color: var(--sage-700); }
.badge-status-named       { background: var(--lav-100);  color: var(--lav-700); }
.badge-status-dropped     { background: var(--n-100);    color: var(--n-400); }

/* ---- FILTER BAR ---- */
.filter-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1rem;
    margin-bottom: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}
.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 130px; }
.filter-bar select,
.filter-bar input { min-height: 40px; font-size: 0.875rem; padding: 0.5rem 0.75rem; }
.filter-bar select { padding-right: 2rem; }

/* ---- VARIETY GRID ---- */
.variety-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 560px)  { .variety-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px)  { .variety-grid { grid-template-columns: 1fr 1fr 1fr; } }

.variety-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow var(--transition), transform var(--transition);
}
.variety-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.variety-card-thumb {
    width: 100%; aspect-ratio: 4/3; object-fit: contain;
    background: linear-gradient(135deg, var(--lav-50), var(--sage-50));
}
.variety-card-thumb-placeholder {
    width: 100%; aspect-ratio: 4/3;
    background: linear-gradient(135deg, var(--lav-100), var(--sage-50));
    display: flex; align-items: center; justify-content: center;
    color: var(--lav-300);
}
.variety-card-thumb-placeholder svg { width: 40px; height: 40px; }

.variety-card-body { padding: 0.875rem; flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }
.variety-card-name { font-size: 0.9375rem; font-weight: 700; color: var(--n-800); line-height: 1.3; }
.variety-card-sub  { font-size: 0.8125rem; color: var(--n-400); }
.variety-card-meta { display: flex; flex-wrap: wrap; gap: 0.375rem; }

.variety-card-stock {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}
.variety-card-stock-label { font-size: 0.9375rem; font-weight: 700; color: var(--n-800); flex: 1; }
.variety-card-stock-count { font-size: 1.25rem; font-weight: 800; color: var(--lav-600); }

.variety-card-actions {
    display: flex;
    gap: 0.375rem;
    padding: 0.625rem 0.875rem;
    border-top: 1px solid var(--border);
    background: var(--n-50);
}

/* ---- SEEDLING LIST ---- */
.seedling-list { display: flex; flex-direction: column; gap: 0.75rem; }

.seedling-row {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 0.75rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
    text-decoration: none;
    color: inherit;
}
.seedling-row:hover { box-shadow: var(--shadow); }

.seedling-thumb {
    width: 68px; height: 68px;
    border-radius: var(--r);
    object-fit: cover;
    flex-shrink: 0;
}
.seedling-thumb-placeholder {
    width: 68px; height: 68px;
    border-radius: var(--r);
    background: linear-gradient(135deg, var(--sage-100), var(--lav-100));
    display: flex; align-items: center; justify-content: center;
    color: var(--n-300);
    flex-shrink: 0;
}
.seedling-thumb-placeholder svg { width: 28px; height: 28px; }

.seedling-info { flex: 1; min-width: 0; }
.seedling-id   { font-size: 0.8125rem; font-weight: 700; color: var(--lav-600); font-family: monospace; letter-spacing: 0.04em; }
.seedling-name { font-weight: 600; color: var(--n-800); font-size: 0.9375rem; }
.seedling-meta { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.25rem; }
.seedling-actions { display: flex; flex-direction: column; gap: 0.375rem; flex-shrink: 0; }

/* ---- DETAIL VIEW ---- */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}
@media (min-width: 600px) { .detail-grid { grid-template-columns: 1fr 1fr; } }

.detail-field {}
.detail-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--n-400);
    margin-bottom: 0.2rem;
}
.detail-value { font-size: 0.9375rem; color: var(--n-800); font-weight: 500; }
.detail-value-empty { color: var(--n-300); font-style: italic; }

/* ---- PHOTO GALLERY ---- */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}
.photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--r);
    overflow: hidden;
    border: 2.5px solid transparent;
    transition: border-color var(--transition);
}
.photo-item.is-cover { border-color: var(--lav-500); }
.photo-item img {
    width: 100%; height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform var(--transition);
}
.photo-item:hover img { transform: scale(1.03); }
.photo-item-overlay {
    position: absolute; inset: 0;
    background: rgba(30,27,51,0.55);
    opacity: 0;
    transition: opacity var(--transition);
    display: flex; align-items: center; justify-content: center;
    gap: 0.375rem;
}
.photo-item:hover .photo-item-overlay { opacity: 1; }
.photo-cover-badge {
    position: absolute; top: 0.375rem; left: 0.375rem;
    background: var(--lav-500); color: #fff;
    font-size: 0.6875rem; font-weight: 700;
    padding: 2px 0.4rem; border-radius: var(--r-full);
}

/* ---- PLANNER VIEW ---- */
.planner-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    margin-bottom: 0.5rem;
    transition: box-shadow var(--transition);
}
.planner-item:hover { box-shadow: var(--shadow); }
.planner-rank {
    width: 32px; height: 32px; flex-shrink: 0;
    background: var(--lav-100);
    border-radius: var(--r-full);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8125rem; font-weight: 700; color: var(--lav-600);
}
.planner-bar-wrap { width: 120px; flex-shrink: 0; }
.planner-bar {
    height: 6px;
    background: linear-gradient(to right, var(--lav-300), var(--sage-400));
    border-radius: var(--r-full);
}
.planner-bar-label { font-size: 0.6875rem; color: var(--n-400); margin-top: 2px; }
.planner-name { flex: 1; font-weight: 700; color: var(--n-800); min-width: 0; }
.planner-meta { display: flex; flex-wrap: wrap; gap: 0.375rem; align-items: center; flex-shrink: 0; width: 160px; }
.planner-stock { font-weight: 700; color: var(--lav-600); font-size: 0.875rem; white-space: nowrap; }

/* Planted state */
.planner-item.planted {
    border-left: 3px solid var(--success);
    background: var(--success-light);
}
.planner-item.planted .planner-name { color: var(--n-500); }

/* Planting controls (location select + plant button) */
.planner-plant-controls {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.375rem;
    flex-wrap: wrap;
}
.location-select {
    font-size: 0.75rem;
    padding: 0.2rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text);
    min-width: 100px;
    max-width: 150px;
    cursor: pointer;
}
.plant-btn {
    font-size: 0.75rem;
    font-family: var(--font);
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: var(--r-sm);
    border: 1.5px solid var(--n-300);
    background: var(--surface);
    color: var(--n-600);
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
    -webkit-tap-highlight-color: transparent;
}
.plant-btn:active { opacity: 0.7; }
.plant-btn.planted {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.plant-btn:disabled { opacity: 0.5; cursor: default; }

/* Planting progress bar */
.planner-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.planner-progress-bar-wrap {
    flex: 1;
    height: 8px;
    background: var(--n-200);
    border-radius: var(--r-full);
    overflow: hidden;
}
.planner-progress-bar {
    height: 100%;
    background: var(--success);
    border-radius: var(--r-full);
    transition: width 0.4s ease;
    min-width: 0;
}
#planted-progress {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--success);
    white-space: nowrap;
}

/* ---- SEASON LOG ---- */
.season-log-entry {
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    margin-bottom: 1rem;
}
.season-log-header {
    background: var(--sage-50);
    border-bottom: 1px solid var(--sage-100);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.season-log-year { font-weight: 700; font-size: 1.125rem; color: var(--sage-700); }
.season-log-body { padding: 1rem; }
.season-log-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.season-stat-label { font-size: 0.75rem; color: var(--n-400); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.season-stat-value { font-size: 1rem; font-weight: 700; color: var(--n-700); }

/* ---- LOGIN PAGE ---- */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(145deg, var(--lav-100) 0%, var(--sage-50) 60%, var(--lav-50) 100%);
    padding: 1.5rem;
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--lav-200);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
}
.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.login-logo svg { width: 52px; height: 52px; margin: 0 auto 0.75rem; }
.login-logo h1 { font-size: 1.625rem; color: var(--lav-600); }
.login-logo p  { color: var(--n-400); font-size: 0.875rem; margin-top: 0.25rem; }

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center;
    padding: 3.5rem 2rem;
    color: var(--n-400);
}
.empty-state svg { width: 56px; height: 56px; margin: 0 auto 1rem; opacity: 0.4; }
.empty-state h3  { color: var(--n-500); margin-bottom: 0.5rem; }
.empty-state p   { font-size: 0.875rem; }

/* ---- TABS ---- */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    display: inline-flex; align-items: center; gap: 0.375rem;
    padding: 0.625rem 1rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 0.875rem; font-weight: 500;
    color: var(--n-400);
    white-space: nowrap;
    text-decoration: none;
    transition: all var(--transition);
}
.tab:hover { color: var(--lav-600); }
.tab.active { color: var(--lav-600); border-bottom-color: var(--lav-500); font-weight: 700; }
.tab svg { width: 15px; height: 15px; }

/* ---- VIEW PAGE PHOTO GALLERY ---- */
.view-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.625rem;
    margin-bottom: 1.5rem;
}
.view-gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--r);
    overflow: hidden;
    border: 3px solid transparent;
    background: linear-gradient(135deg, var(--lav-50), var(--sage-50));
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.view-gallery-item.is-cover { border-color: var(--lav-500); }
.view-gallery-item:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.view-gallery-item img {
    width: 100%; height: 100%;
    object-fit: contain;
    transition: transform var(--transition);
}
.view-gallery-item:hover img { transform: scale(1.04); }
.view-gallery-item.drag-over { border-color: var(--sage-400); box-shadow: 0 0 0 3px var(--sage-200); }
.view-gallery-item[draggable="true"] { cursor: grab; }
.view-gallery-item[draggable="true"]:active { cursor: grabbing; }
.view-gallery-drag-hint {
    font-size: 0.75rem; color: var(--n-400);
    text-align: center; margin-bottom: 0.75rem;
    margin-top: -0.25rem;
}

/* ---- LIGHTBOX ---- */
.lightbox {
    display: none;
    position: fixed; inset: 0;
    background: rgba(10,8,25,0.92);
    z-index: 1000;
    align-items: center; justify-content: center;
    padding: 1rem;
}
.lightbox.open { display: flex; }
.lightbox img  { max-width: 100%; max-height: 75vh; border-radius: var(--r); object-fit: contain; }
.lightbox-close {
    position: absolute; top: 1rem; right: 1rem;
    width: 44px; height: 44px;
    background: rgba(255,255,255,0.15);
    border: none; border-radius: var(--r-full);
    color: #fff; font-size: 1.375rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background var(--transition);
}
.lightbox-close:hover { background: rgba(255,255,255,0.25); }
.lightbox-counter {
    position: absolute; top: 1.1rem; left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.65); font-size: 0.8125rem;
    pointer-events: none;
}
.lightbox-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 48px; height: 48px;
    background: rgba(255,255,255,0.15);
    border: none; border-radius: var(--r-full);
    color: #fff; font-size: 1.5rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background var(--transition);
}
.lightbox-nav:hover { background: rgba(255,255,255,0.28); }
.lightbox-nav-prev { left: 0.75rem; }
.lightbox-nav-next { right: 0.75rem; }
.lightbox-actions {
    position: absolute; bottom: 1.5rem; left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 0.625rem;
    z-index: 10;
}

/* ---- TABLE ---- */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th {
    text-align: left; padding: 0.625rem 0.875rem;
    border-bottom: 2px solid var(--border);
    font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--n-400); background: var(--n-50);
    white-space: nowrap;
}
td { padding: 0.625rem 0.875rem; border-bottom: 1px solid var(--border); color: var(--n-700); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--lav-50); }
th a { color: var(--n-400); display: inline-flex; align-items: center; gap: 0.25rem; text-decoration: none; }
th a:hover { color: var(--lav-600); }

/* ---- UTILITIES ---- */
.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: 0.875rem; }
.text-xs      { font-size: 0.8125rem; }
.text-center  { text-align: center; }
.font-bold    { font-weight: 700; }
.font-mono    { font-family: monospace; }
.flex         { display: flex; }
.flex-wrap    { flex-wrap: wrap; }
.items-center { align-items: center; }
.gap-2        { gap: 0.5rem; }
.gap-3        { gap: 0.75rem; }
.gap-4        { gap: 1rem; }
.mt-2         { margin-top: 0.5rem; }
.mt-4         { margin-top: 1rem; }
.mt-6         { margin-top: 1.5rem; }
.mb-2         { margin-bottom: 0.5rem; }
.mb-4         { margin-bottom: 1rem; }
.mb-6         { margin-bottom: 1.5rem; }
.divider      { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.w-full       { width: 100%; }

/* Spinner */
.spinner {
    width: 18px; height: 18px;
    border: 2px solid var(--lav-200);
    border-top-color: var(--lav-500);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Confirmation overlay helper */
.delete-confirm-row { background: var(--danger-light) !important; }

/* ---- DASHBOARD ---- */
.dash-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 640px) {
    .dash-stat-grid { grid-template-columns: repeat(2, 1fr); }
}
.dash-stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 1.25rem 1rem;
    text-align: center;
}
.dash-stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--lav-600);
    line-height: 1;
    margin-bottom: 0.375rem;
}
.dash-stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 500;
}
.dash-two-col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}
@media (max-width: 640px) {
    .dash-two-col { grid-template-columns: 1fr; }
}
.dash-bar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.625rem;
}
.dash-bar-row:last-child { margin-bottom: 0; }
.dash-bar-label {
    width: 120px;
    flex-shrink: 0;
    font-size: 0.8125rem;
}
.dash-bar-track {
    flex: 1;
    height: 8px;
    background: var(--n-100);
    border-radius: 99px;
    overflow: hidden;
}
.dash-bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.4s ease;
    min-width: 2px;
}
.dash-bar-lav  { background: var(--lav-400); }
.dash-bar-sage { background: var(--sage-400); }
.dash-bar-count {
    width: 24px;
    text-align: right;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--n-600);
    flex-shrink: 0;
}
.dash-checklist {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.dash-checklist-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.625rem;
    border-radius: var(--r);
    font-size: 0.875rem;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all var(--transition);
}
.dash-checklist-item--empty {
    background: var(--lav-50);
    border-color: var(--lav-200);
    color: var(--lav-700);
}
.dash-checklist-item--empty:hover {
    background: var(--lav-100);
    border-color: var(--lav-400);
}
.dash-checklist-item--done {
    background: var(--sage-50);
    border-color: var(--sage-200);
    color: var(--sage-700);
}
.dash-checklist-item--done:hover { background: var(--sage-100); }
