:root {
    --brand-dark: #27500A;
    --brand-mid: #3B6D11;
    --brand-light: #EAF3DE;
    --brand-border: #C0DD97;
    --status-due: #E24B4A;
    --status-soon: #EF9F27;
    --status-ok: #639922;
    --task-water: #185FA5;
    --task-fert: #633806;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F1EFE8;
    --text-primary: #2C2C2A;
    --text-secondary: #5F5E5A;
    --text-hint: #888780;
    --border: #D3D1C7;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-pill: 99px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.5;
}

a { text-decoration: none; color: inherit; }

/* Layout */
:root {
    --sidebar-width: 220px;
}

.app-layout {
    display: grid;
    grid-template-rows: 52px 1fr;
    grid-template-columns: var(--sidebar-width) 1fr 300px;
    min-height: 100vh;
}

.topbar {
    grid-column: 1 / -1;
    grid-row: 1;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 52px;
    background: var(--brand-dark);
    color: var(--brand-light);
}

.topbar .brand {
    font-size: 18px;
    font-weight: 500;
    letter-spacing: -0.3px;
    color: #EAF3DE;
}

.topbar .topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar .lang-switch {
    font-size: 12px;
    color: #95D5B2;
    cursor: pointer;
}

.topbar .user-email {
    font-size: 12px;
    color: #95D5B2;
}

.sidebar {
    grid-column: 1;
    grid-row: 2;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 0.5px solid var(--border);
    padding: 20px 0;
    position: sticky;
    top: 52px;
    height: calc(100vh - 52px);
    display: flex;
    flex-direction: column;
}

.sidebar-resizer {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    cursor: col-resize;
    background: transparent;
    transition: background 0.15s;
}

.sidebar-resizer:hover,
.sidebar-resizer.dragging {
    background: var(--brand-border);
}

.main-content {
    grid-column: 2;
    grid-row: 2;
    padding: 24px;
}

/* Navigation */

.nav-section {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-hint);
    padding: 12px 20px 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.1s;
}

.nav-item:hover {
    background: var(--bg-primary);
}

.nav-item.active {
    background: var(--brand-light);
    color: var(--brand-dark);
    font-weight: 500;
    border-right: 2px solid var(--brand-mid);
}

.nav-badge {
    margin-left: auto;
    background: var(--brand-mid);
    color: var(--brand-light);
    font-size: 10px;
    padding: 1px 6px;
    border-radius: var(--radius-pill);
}

.nav-spacer {
    flex: 1;
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-title {
    font-size: 18px;
    font-weight: 500;
}

.task-count {
    font-size: 12px;
    color: var(--text-hint);
}

/* Buttons */
.btn {
    font-size: 12px;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    border: 0.5px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.1s;
}

.btn:hover {
    background: var(--bg-secondary);
}

.btn.primary {
    background: var(--brand-mid);
    color: var(--brand-light);
    border-color: var(--brand-mid);
}

.btn.primary:hover {
    background: var(--brand-dark);
}

.btn.danger {
    color: #791F1F;
    border-color: #F09595;
}

.btn.danger:hover {
    background: #FCEBEB;
}

.btn.back-btn {
    margin-bottom: 16px;
}

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

.plant-card {
    background: var(--bg-primary);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s;
    display: block;
}

.plant-card:hover {
    border-color: var(--text-hint);
}

.plant-card-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: var(--brand-light);
    display: block;
}

.plant-card-img-placeholder {
    width: 100%;
    height: 160px;
    background: linear-gradient(135deg, #EAF3DE 0%, #C0DD97 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: var(--brand-mid);
}

.plant-card-body {
    padding: 14px;
}

.plant-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--brand-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    font-size: 20px;
    color: var(--brand-mid);
}

.plant-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.plant-latin {
    font-size: 11px;
    color: var(--text-hint);
    margin-top: 2px;
}

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    margin-top: 10px;
}

.badge .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.badge.due { color: var(--status-due); background: #FCEBEB; }
.badge.soon { color: var(--status-soon); background: #FAEEDA; }
.badge.ok { color: var(--status-ok); background: var(--brand-light); }
.badge.gray { color: var(--text-hint); background: var(--bg-secondary); }

/* Today's care list */
.today-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.today-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-primary);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-md);
    transition: opacity 0.2s, transform 0.2s;
}

.today-item.urgent {
    border-left: 3px solid var(--status-due);
}

.today-item.normal {
    border-left: 3px solid var(--status-soon);
}

.today-item.fading {
    opacity: 0;
    transform: translateX(8px);
}

.task-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.task-icon.water {
    background: #E8F0FA;
    color: var(--task-water);
}

.task-icon.fert {
    background: #F5EDE4;
    color: var(--task-fert);
}

.task-info {
    flex: 1;
    min-width: 0;
}

.task-name {
    font-size: 13px;
    font-weight: 500;
}

.task-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.task-meta {
    font-size: 11px;
    color: var(--text-hint);
    margin-top: 2px;
}

.task-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Empty states */
.empty-state, .empty-today {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-hint);
    gap: 12px;
}

.empty-state i, .empty-today i {
    font-size: 40px;
    color: var(--brand-mid);
}

.empty-today i {
    color: var(--status-ok);
}

/* Plant detail */
.detail-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.detail-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--brand-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--brand-mid);
}

.detail-name {
    font-size: 18px;
    font-weight: 500;
}

.detail-latin {
    font-size: 12px;
    color: var(--text-hint);
}

.detail-header .badge {
    margin-left: auto;
    margin-top: 0;
}

.detail-section {
    background: var(--bg-primary);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
}

.section-title {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-hint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.section-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.info-row {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 0.5px solid var(--bg-secondary);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 12px;
    color: var(--text-hint);
    width: 80px;
    flex-shrink: 0;
}

.info-value {
    font-size: 12px;
    color: var(--text-secondary);
}

.why-toggle {
    font-size: 11px;
    color: var(--brand-mid);
    cursor: pointer;
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.why-box {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    margin-top: 6px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease, padding 0.25s ease;
    padding: 0 12px;
}

.why-box.open {
    max-height: 200px;
    padding: 8px 12px;
}

.action-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.action-row:last-child {
    margin-bottom: 0;
}

/* AI area */
.ai-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-input {
    width: 100%;
    padding: 10px 12px;
    border: 0.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: inherit;
    resize: vertical;
    background: var(--bg-secondary);
}

.ai-input:focus {
    outline: none;
    border-color: var(--brand-mid);
}

#ai-result .ai-box {
    background: var(--brand-light);
    border: 0.5px solid var(--brand-border);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 12px;
    line-height: 1.7;
    white-space: pre-wrap;
}

/* History */
.log-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 12px;
}

.log-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.log-dot.watered { background: var(--task-water); }
.log-dot.checked_no_water { background: var(--text-hint); }
.log-dot.fert { background: var(--task-fert); }

.log-date {
    color: var(--text-hint);
    width: 50px;
    flex-shrink: 0;
}

.log-desc {
    color: var(--text-secondary);
}

.empty-hint {
    font-size: 12px;
    color: var(--text-hint);
}

/* Settings */
.time-picker {
    display: flex;
    gap: 8px;
}

.time-btn.active {
    background: var(--brand-light);
    border-color: var(--brand-border);
    color: var(--brand-dark);
}

.input {
    width: 100%;
    padding: 8px 12px;
    border: 0.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--bg-secondary);
    margin-top: 8px;
}

.input:focus {
    outline: none;
    border-color: var(--brand-mid);
}

.coords-row {
    display: flex;
    gap: 8px;
}

/* Add plant page */
.add-plant {
    max-width: 500px;
}

.input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.input-group input {
    flex: 1;
    padding: 10px 14px;
    border: 0.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--bg-secondary);
}

.input-group input:focus {
    outline: none;
    border-color: var(--brand-mid);
}

.preview-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.preview-form label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-hint);
    margin-top: 8px;
    text-transform: uppercase;
}

.preview-form input,
.preview-form textarea {
    padding: 8px 12px;
    border: 0.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: inherit;
    background: var(--bg-secondary);
}

.preview-form input:focus,
.preview-form textarea:focus {
    outline: none;
    border-color: var(--brand-mid);
}

.hidden { display: none; }

.error {
    background: #FCEBEB;
    color: #791F1F;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
}

/* Auth pages (no sidebar) */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
}

.auth-form {
    background: var(--bg-primary);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 32px;
    width: 100%;
    max-width: 360px;
}

.auth-form h1 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 4px;
}

.auth-form .subtitle {
    font-size: 12px;
    color: var(--text-hint);
    margin-bottom: 20px;
}

.auth-form form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-form label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-hint);
    text-transform: uppercase;
}

.auth-form input {
    padding: 10px 12px;
    border: 0.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--bg-secondary);
}

.auth-form input:focus {
    outline: none;
    border-color: var(--brand-mid);
}

.auth-form .btn {
    margin-top: 8px;
    width: 100%;
    justify-content: center;
    padding: 10px;
}

.switch {
    text-align: center;
    margin-top: 16px;
    font-size: 12px;
    color: var(--text-hint);
}

.switch a {
    color: var(--brand-mid);
}

/* Responsive */
@media (max-width: 700px) {
    .app-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 52px 1fr auto;
    }
    .topbar { grid-column: 1; }
    .sidebar {
        grid-column: 1;
        grid-row: 3;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        flex-direction: row;
        padding: 8px 12px;
        z-index: 100;
        border-right: none;
        border-top: 0.5px solid var(--border);
    }
    .sidebar-resizer { display: none; }
    .nav-section, .nav-spacer { display: none; }
    .nav-item { padding: 8px 12px; font-size: 11px; }
    .main-content { grid-column: 1; grid-row: 2; padding: 16px; padding-bottom: 70px; }
    .today-item { flex-wrap: wrap; }
    .task-actions { width: 100%; margin-top: 8px; }
}

/* Detail photo */
.detail-photo-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.detail-photo-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.detail-photo-thumb-placeholder {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #EAF3DE 0%, #C0DD97 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--brand-mid);
    border-radius: var(--radius-md);
}

.photo-upload-btn {
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: rgba(0,0,0,0.5);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
}

.photo-upload-btn:hover { background: rgba(0,0,0,0.7); }

/* Recommendation tabs */
.rec-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.rec-tab {
    font-size: 12px;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    border: 0.5px solid var(--border);
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary);
}

.rec-tab.active {
    background: var(--brand-light);
    color: var(--brand-dark);
    border-color: var(--brand-border);
}

.rec-panel { display: none; }
.rec-panel.active { display: block; }

.rec-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 0.5px solid var(--border);
    font-size: 13px;
}

.rec-row:last-child { border-bottom: none; }
.rec-row span:first-child { color: var(--text-secondary); min-width: 100px; }
.rec-row span:last-child { color: var(--text-primary); text-align: right; flex: 1; }

/* Billing / Upgrade */
.upgrade-card {
    background: var(--brand-light);
    border: 0.5px solid var(--brand-border);
    border-radius: var(--radius-md);
    padding: 20px;
}

.upgrade-card h3 {
    font-size: 15px;
    font-weight: 500;
    color: var(--brand-dark);
    margin-bottom: 12px;
}

.pro-features { list-style: none; margin-bottom: 16px; }

.pro-features li {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pro-features li i { color: var(--brand-mid); font-size: 14px; }

.pro-price {
    font-size: 24px;
    font-weight: 500;
    color: var(--brand-dark);
    margin-bottom: 16px;
}

.pro-price span {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
}

.upgrade-btn {
    width: 100%;
    justify-content: center;
    padding: 10px;
    font-size: 14px;
}

.pro-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--brand-dark);
    background: var(--brand-light);
    border: 0.5px solid var(--brand-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
}

/* Colored action buttons */
.btn-check { background: #f0f0f0; color: #555; border: 1px solid #ddd; }
.btn-check:hover { background: #e4e4e4; }
.btn-water { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }
.btn-water:hover { background: #bbdefb; }
.btn-fert { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.btn-fert:hover { background: #c8e6c9; }
.btn-spray { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }
.btn-spray:hover { background: #ffe0b2; }
.btn-undo { background: #fce4ec; color: #c62828; border: 1px solid #ef9a9a; }
.btn-undo:hover { background: #ffcdd2; }

@keyframes successFlash {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); box-shadow: 0 0 12px rgba(76, 175, 80, 0.4); }
    100% { transform: scale(1); }
}
.btn-success-flash {
    animation: successFlash 0.4s ease;
}

/* Delete button on plant cards */
.plant-card-wrapper {
    position: relative;
}
.card-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.9);
    color: #c62828;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 2;
}
.plant-card-wrapper:hover .card-delete-btn {
    opacity: 1;
}
.card-delete-btn:hover {
    background: #ffcdd2;
}

/* Delete modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-box {
    background: #fff;
    border-radius: var(--radius-lg, 12px);
    padding: 24px;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.modal-box h3 {
    margin: 0 0 12px;
    font-size: 16px;
}
.modal-box p {
    margin: 0 0 16px;
    color: var(--text-secondary);
    font-size: 14px;
}
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    cursor: pointer;
}
.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* History page */
.history-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 8px);
    padding: 16px;
    text-align: center;
}
.stat-number {
    font-size: 28px;
    font-weight: 600;
    color: var(--brand-dark, #2e7d32);
}
.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.archived-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.archived-card {
    padding: 12px 16px;
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 8px);
}
.archived-reason {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.archived-date {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

/* Expanded care info */
.info-sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.issues-list {
    margin: 0;
    padding-left: 16px;
    font-size: 13px;
}
.issues-list li {
    margin-bottom: 4px;
}

/* Spray task icon */
.task-icon.spray {
    background: #fff3e0;
    color: #e65100;
}

/* Right panel */
.right-panel {
    grid-column: 3; grid-row: 2;
    border-left: 0.5px solid var(--border);
    background: var(--bg-secondary);
    position: sticky; top: 52px;
    height: calc(100vh - 52px);
    overflow: hidden;
    display: flex; flex-direction: column;
}

.panel-photo-wrapper {
    position: relative; flex-shrink: 0;
    height: 55%; overflow: hidden;
}
.panel-photo {
    width: 100%; height: 100%;
    object-fit: cover; object-position: center;
    display: block;
    transition: transform 8s ease-in-out;
}
.panel-photo:hover { transform: scale(1.04); }
.panel-photo-fallback {
    width: 100%; height: 100%;
    background: linear-gradient(160deg, #C8E8A0 0%, #4A8E25 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: 56px; color: #2D5A1B;
}
.panel-photo-fade {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 80px;
    background: linear-gradient(to bottom, transparent, var(--bg-secondary));
    pointer-events: none;
}

.panel-stats {
    flex: 1;
    padding: 16px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
}
.stat-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.right-panel .stat-card {
    background: var(--bg-primary);
    border: 0.5px solid var(--border);
    border-radius: 10px;
    height: 68px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-sizing: border-box;
    overflow: hidden;
    transition: border-color 0.15s;
}
.right-panel .stat-card:hover { border-color: var(--text-hint); }
.stat-icon-wrap {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.icon-green { background: #EAF3DE; color: #3B6D11; }
.icon-blue { background: #E6F1FB; color: #185FA5; }
.icon-amber { background: #FEF3EC; color: #B05C1A; }
.stat-body {
    min-width: 0;
    flex: 1;
}
.stat-num {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
}
.right-panel .stat-label {
    font-size: 10px;
    color: var(--text-hint);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.panel-tagline {
    margin-top: auto;
    font-size: 11px; color: var(--text-hint);
    text-align: center; letter-spacing: 0.03em;
    padding-top: 8px;
    border-top: 0.5px solid var(--border);
}

@media (max-width: 1100px) {
    .app-layout {
        grid-template-columns: var(--sidebar-width) 1fr;
    }
    .right-panel {
        display: none;
    }
}

@media (max-width: 640px) {
    .app-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none;
    }
    .right-panel {
        display: none;
    }
}

/* Backdate section */
.backdate-section { margin-top: 12px; }
.backdate-toggle {
    background: none; border: none; cursor: pointer;
    font-size: 12px; color: var(--text-hint);
    display: flex; align-items: center; gap: 6px;
    padding: 4px 0;
}
.backdate-toggle:hover { color: var(--brand-mid); }
.backdate-panel {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 12px; margin-top: 8px;
}
.backdate-row {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.backdate-select, .backdate-input {
    border: 0.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px; font-size: 13px;
    background: var(--bg-primary);
    color: var(--text-primary);
}
.backdate-hint {
    font-size: 11px; color: var(--text-hint);
    margin-top: 6px;
}
.log-backdated-tag {
    font-size: 10px; color: var(--text-hint);
    background: var(--bg-secondary);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 1px 6px; margin-left: auto;
}
