* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --bg-primary: #F5F5F7;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #E8E8ED;
    --text-primary: #1D1D1F;
    --text-secondary: #6E6E73;
    --accent-blue: #007AFF;
    --accent-green: #34C759;
    --accent-orange: #FF9500;
    --accent-red: #FF3B30;
    --accent-purple: #5856D6;
    --card-bg: #FFFFFF;
    --bg: #F5F5F7;
    --border: #E8E8ED;
    --text-tertiary: #AEAEB2;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}
body { font-family: 'Ubuntu', -apple-system, sans-serif; background: var(--bg-primary); color: var(--text-primary); line-height: 1.6; min-height: 100vh; }
.app-container { display: flex; min-height: 100vh; }

/* Login */
.login-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #225D65, #1a4a52); }
.login-card { background: var(--bg-secondary); border-radius: var(--radius-lg); padding: 48px 40px; width: 100%; max-width: 400px; box-shadow: var(--shadow-md); }
.login-logo { font-size: 48px; text-align: center; margin-bottom: 8px; }
.login-title { font-size: 28px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.login-subtitle { font-size: 15px; color: var(--text-secondary); text-align: center; margin-bottom: 32px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-error { color: var(--accent-red); font-size: 14px; text-align: center; padding: 8px; background: #FFF0F0; border-radius: var(--radius-sm); }
.btn-login { width: 100%; margin-top: 8px; }
.login-footer { text-align: center; margin-top: 16px; }
.login-footer a { color: var(--accent-blue, #4F8EF7); text-decoration: none; font-size: 14px; }
.login-footer a:hover { text-decoration: underline; }
.nav-user { padding: 16px; margin-top: auto; border-top: 1px solid var(--bg-tertiary); }
.nav-user-name { font-weight: 600; font-size: 14px; margin-bottom: 8px; color: var(--text-primary); }

/* Sidebar */
.sidebar { width: 260px; background: var(--bg-secondary); padding: 24px 16px; box-shadow: var(--shadow-sm); position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 100; display: flex; flex-direction: column; }
.logo { font-size: 22px; font-weight: 700; margin-bottom: 32px; padding: 0 16px; display: flex; align-items: center; gap: 12px; }
.logo-icon { width: 40px; height: 40px; background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple)); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.nav-menu { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--text-secondary); text-decoration: none; font-weight: 500; border-radius: var(--radius-sm); transition: all 0.2s; cursor: pointer; font-size: 15px; }
.nav-link:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.nav-link.active { background: var(--accent-blue); color: white; }

/* Main */
.main-content { flex: 1; padding: 32px; overflow-y: auto; }
.section { display: none; }
.section.active { display: block; }
.page-header { margin-bottom: 28px; }
.page-title { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.page-subtitle { color: var(--text-secondary); font-size: 15px; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--bg-secondary); padding: 20px; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); transition: transform 0.2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon { width: 44px; height: 44px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 12px; }
.stat-icon.blue { background: rgba(0,122,255,0.1); }
.stat-icon.green { background: rgba(52,199,89,0.1); }
.stat-icon.orange { background: rgba(255,149,0,0.1); }
.stat-icon.red { background: rgba(255,59,48,0.1); }
.stat-icon.purple { background: rgba(88,86,214,0.1); }
.stat-value { font-size: 32px; font-weight: 700; margin-bottom: 2px; }
.stat-label { color: var(--text-secondary); font-size: 13px; }

/* Cards */
.card { background: var(--bg-secondary); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); margin-bottom: 24px; overflow: hidden; }
.card-header { padding: 20px 24px; border-bottom: 1px solid var(--bg-tertiary); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.card-title { font-size: 18px; font-weight: 600; }
.card-body { padding: 0; }
.card-body.padded { padding: 20px 24px; }

/* Buttons */
.btn { padding: 10px 20px; border-radius: var(--radius-md); border: none; cursor: pointer; font-family: inherit; font-weight: 500; font-size: 14px; transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { opacity: 0.9; }
.btn-primary { background: var(--accent-blue); color: white; }
.btn-success { background: var(--accent-green); color: white; }
.btn-danger { background: var(--accent-red); color: white; }
.btn-warning { background: #f59e0b; color: white; }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 20px; text-align: left; border-bottom: 1px solid var(--bg-tertiary); }
th { background: var(--bg-tertiary); font-weight: 600; color: var(--text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
tr:hover { background: rgba(0,0,0,0.02); }
tr:last-child td { border-bottom: none; }

/* Status badges */
.badge { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge-lead { background: rgba(142,142,147,0.12); color: #8E8E93; }
.badge-quoted { background: rgba(255,149,0,0.12); color: var(--accent-orange); }
.badge-accepted { background: rgba(0,122,255,0.12); color: var(--accent-blue); }
.badge-in_progress { background: rgba(88,86,214,0.12); color: var(--accent-purple); }
.badge-completed { background: rgba(52,199,89,0.12); color: var(--accent-green); }
.badge-invoiced { background: rgba(255,149,0,0.12); color: #E08500; }
.badge-paid { background: rgba(52,199,89,0.2); color: #248A3D; }
.badge-new { background: rgba(0,122,255,0.12); color: var(--accent-blue); }
.badge-blue { background: rgba(0,122,255,0.12); color: var(--accent-blue); }
.badge-green { background: rgba(52,199,89,0.12); color: var(--accent-green); }
.badge-purple { background: rgba(88,86,214,0.12); color: var(--accent-purple); }
.badge-grey { background: rgba(142,142,147,0.12); color: #8E8E93; }
.badge-orange { background: rgba(255,149,0,0.12); color: var(--accent-orange); }
.badge-red { background: rgba(239,68,68,0.12); color: #EF4444; }
.badge-contacted { background: rgba(255,149,0,0.12); color: var(--accent-orange); }
.badge-interested { background: rgba(52,199,89,0.12); color: var(--accent-green); }
.badge-active_referral { background: rgba(88,86,214,0.12); color: var(--accent-purple); }
.badge-cold { background: rgba(142,142,147,0.12); color: #8E8E93; }
.badge-overdue { background: rgba(255,59,48,0.12); color: var(--accent-red); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 14px; }
.form-input, .form-select, .form-textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--bg-tertiary); border-radius: var(--radius-sm); font-family: inherit; font-size: 14px; transition: border-color 0.2s; }
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--accent-blue); }
.form-textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Filters */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.filters .form-select, .filters .form-input { width: auto; min-width: 150px; padding: 8px 12px; font-size: 13px; }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; visibility: hidden; transition: all 0.3s; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal { background: var(--bg-secondary); border-radius: var(--radius-lg); width: 95%; max-width: 560px; max-height: 90vh; overflow-y: auto; padding: 28px; transform: scale(0.95); transition: transform 0.3s; }
.modal-overlay.active .modal { transform: scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title { font-size: 20px; font-weight: 700; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--bg-tertiary); cursor: pointer; font-size: 18px; transition: all 0.2s; }
.modal-close:hover { background: var(--accent-red); color: white; }

/* Toast */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 14px 24px; background: var(--text-primary); color: white; border-radius: var(--radius-md); box-shadow: var(--shadow-md); font-weight: 500; transform: translateY(100px); opacity: 0; transition: all 0.3s; z-index: 2000; font-size: 14px; }
.toast.show { transform: translateY(0); opacity: 1; }

/* Calendar */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-header { text-align: center; font-weight: 600; color: var(--text-secondary); font-size: 12px; padding: 8px 4px; }
.cal-day { aspect-ratio: 1.2; padding: 4px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; position: relative; transition: all 0.2s; min-height: 60px; }
.cal-day:hover { background: var(--bg-tertiary); }
.cal-day.today { background: rgba(0,122,255,0.08); }
.cal-day .day-num { font-weight: 600; font-size: 14px; }
.cal-day .day-jobs { margin-top: 2px; }
.cal-day .job-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin: 1px; }

/* Activity feed */
.activity-item { padding: 12px 0; border-bottom: 1px solid var(--bg-tertiary); display: flex; gap: 12px; align-items: flex-start; }
.activity-item:last-child { border-bottom: none; }
.activity-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.activity-text { flex: 1; }
.activity-text strong { font-weight: 600; }
.activity-time { font-size: 12px; color: var(--text-secondary); }

/* Quote calc */
.quote-section { margin-bottom: 24px; }
.quote-result { background: linear-gradient(135deg, #007AFF, #5856D6); color: white; padding: 24px; border-radius: var(--radius-lg); text-align: center; margin-top: 16px; }
.quote-price { font-size: 36px; font-weight: 700; }
.quote-range { font-size: 16px; opacity: 0.9; }

/* Responsive */
.mobile-menu-btn { display: none; position: fixed; top: 16px; left: 16px; z-index: 50; width: 44px; height: 44px; border-radius: var(--radius-sm); border: none; background: var(--bg-secondary); box-shadow: var(--shadow-sm); font-size: 20px; cursor: pointer; }
.mobile-close { display: none; }

@media (max-width: 768px) {
    .sidebar { position: fixed; left: -280px; top: 0; height: 100vh; transition: left 0.3s; z-index: 200; }
    .sidebar.open { left: 0; }
    .mobile-menu-btn { display: block; }
    .mobile-close { display: block; position: absolute; top: 16px; right: 16px; background: none; border: none; font-size: 24px; cursor: pointer; }
    .main-content { padding: 72px 16px 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    table { font-size: 13px; }
    th, td { padding: 8px 12px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}

/* Actions column */
.actions { white-space: nowrap; }
.actions .btn { margin-right: 4px; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-secondary); }
.empty-state .emoji { font-size: 48px; margin-bottom: 16px; }
.empty-state p { font-size: 15px; }

/* Quick status buttons */
.status-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.status-btn { padding: 3px 8px; border-radius: 4px; font-size: 11px; cursor: pointer; border: 1px solid var(--bg-tertiary); background: white; transition: all 0.15s; }
.status-btn:hover { border-color: var(--accent-blue); }
.status-btn.current { background: var(--accent-blue); color: white; border-color: var(--accent-blue); }
/* ====== Valuations ====== */
.val-entry { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--bg-tertiary); }
.val-entry:last-child { border-bottom: none; }
.val-entry-info { flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.val-entry-name { font-weight: 500; }
.val-entry-cat { font-size: 11px; color: var(--text-secondary); background: var(--bg-tertiary); padding: 2px 8px; border-radius: 10px; }
.val-entry-detail { font-size: 12px; color: var(--text-secondary); }
.val-entry-value { font-weight: 600; min-width: 80px; text-align: right; }
.val-entry-actions { display: flex; gap: 4px; }
.val-entry-actions button { background: none; border: none; cursor: pointer; font-size: 14px; padding: 2px 4px; }
.btn-sm { padding: 4px 10px !important; font-size: 12px !important; }
.btn-danger { background: var(--accent-red) !important; color: white !important; border-color: var(--accent-red) !important; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
/* ====== KANBAN ====== */
.kanban-container { height: calc(100vh - 160px); }
.kanban-scroll { overflow-x: auto; overflow-y: hidden; height: 100%; -webkit-overflow-scrolling: touch; }
.kanban-columns { display: flex; gap: 16px; height: 100%; min-width: max-content; padding-bottom: 16px; }
.kanban-column { min-width: 280px; max-width: 320px; background: var(--bg-primary); border-radius: var(--radius-md); display: flex; flex-direction: column; height: 100%; transition: min-width 0.2s ease, max-width 0.2s ease; }
.kanban-column.enquiry-collapsed { min-width: 48px; max-width: 48px; }
.kanban-column.enquiry-collapsed .kanban-column-title { display: none; }
.kanban-column.enquiry-collapsed .kanban-column-stats { flex-direction: column; gap: 4px; align-items: center; }
.kanban-column.enquiry-collapsed .kanban-column-header { flex-direction: column; padding: 10px 4px; gap: 6px; }
.kanban-column-header { padding: 14px 16px; background: var(--bg-secondary); border-radius: var(--radius-md) var(--radius-md) 0 0; font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.kanban-column-title { font-weight: 700; }
.kanban-column-stats { display: flex; gap: 12px; font-size: 12px; color: var(--text-secondary); }
.kanban-count { background: var(--bg-tertiary); padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.kanban-value { font-weight: 500; }
.kanban-cards { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }

.kanban-card { background: var(--bg-secondary); border-radius: var(--radius-sm); padding: 12px; box-shadow: var(--shadow-sm); cursor: grab; transition: transform 0.15s, box-shadow 0.15s; border-left: 3px solid transparent; position: relative; }
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: 0.5; transform: rotate(2deg); }

.priority-green { border-left-color: var(--accent-green); }
.priority-amber { border-left-color: var(--accent-orange); }
.priority-red { border-left-color: var(--accent-red); }
.card-priority-dot { position: absolute; top: 12px; right: 12px; width: 8px; height: 8px; border-radius: 50%; }
.priority-green .card-priority-dot { background: var(--accent-green); }
.priority-amber .card-priority-dot { background: var(--accent-orange); }
.priority-red .card-priority-dot { background: var(--accent-red); }

.card-name { font-weight: 700; font-size: 14px; margin-bottom: 6px; padding-right: 16px; }
.card-meta { margin-bottom: 6px; }
.card-type-badge { display: inline-block; font-size: 10px; color: white; padding: 2px 8px; border-radius: 10px; font-weight: 500; }
.card-value { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.card-value.has-value { color: var(--accent-green); }
.card-days { font-size: 11px; color: var(--text-secondary); }
.priority-amber .card-days { color: var(--accent-orange); }
.priority-red .card-days { color: var(--accent-red); }
.card-activity { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

.kanban-column.drag-over { background: rgba(0,122,255,0.05); outline: 2px dashed var(--accent-blue); outline-offset: -2px; border-radius: var(--radius-md); }

/* Funnel chart */
.funnel-chart { display: flex; flex-direction: column; gap: 4px; }
.funnel-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.funnel-label { min-width: 120px; font-size: 13px; font-weight: 500; text-align: right; }
.funnel-bar-container { flex: 1; height: 28px; background: var(--bg-tertiary); border-radius: 6px; overflow: hidden; }
.funnel-bar { height: 100%; border-radius: 6px; transition: width 0.5s ease; min-width: 20px; }
.funnel-count { min-width: 40px; font-weight: 700; font-size: 14px; }
.funnel-value { min-width: 80px; font-size: 13px; color: var(--text-secondary); }
.funnel-conversion { text-align: center; font-size: 11px; color: var(--text-secondary); padding: 2px 0; }

@media (max-width: 768px) {
  .kanban-column { min-width: 260px; }
  .kanban-scroll { scroll-snap-type: x mandatory; }
  .kanban-column { scroll-snap-align: start; }
}

@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ====== GARDEN PLANNER ====== */
.garden-layout { display: flex; flex-direction: column; gap: 24px; }
.garden-zone { border-radius: var(--radius-md); overflow: hidden; }
.garden-zone-header { display: flex; align-items: center; gap: 10px; padding: 16px 20px; }
.greenhouse-zone .garden-zone-header { background: linear-gradient(135deg, #fff3e0, #ffe0b2); }
.outdoor-zone .garden-zone-header { background: linear-gradient(135deg, #e8f5e9, #c8e6c9); }
.garden-zone-icon { font-size: 24px; }
.garden-zone-title { font-size: 18px; font-weight: 700; }
.garden-zone-subtitle { font-size: 13px; color: var(--text-secondary); margin-left: auto; }
.garden-beds { display: flex; flex-wrap: wrap; gap: 16px; padding: 16px 20px; }
.garden-bed { flex: 1; min-width: 280px; border-radius: var(--radius-sm); padding: 16px; }
.greenhouse-bed { background: rgba(255,149,0,0.06); border: 2px dashed rgba(255,149,0,0.3); }
.veg-bed { background: rgba(52,199,89,0.06); border: 2px dashed rgba(52,199,89,0.3); }
.herb-bed { background: rgba(88,86,214,0.06); border: 2px dashed rgba(88,86,214,0.3); }
.fruit-bed { background: rgba(255,59,48,0.06); border: 2px dashed rgba(255,59,48,0.3); }
.garden-bed-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }
.garden-crops-grid { display: flex; flex-wrap: wrap; gap: 10px; }

.crop-card { width: 90px; padding: 12px 8px; border-radius: var(--radius-sm); background: var(--bg-secondary); box-shadow: var(--shadow-sm); cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; text-align: center; position: relative; }
.crop-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.crop-planned { border-left: 3px solid var(--accent-orange); }
.crop-sown { border-left: 3px solid #2196F3; }
.crop-planted { border-left: 3px solid var(--accent-blue); }
.crop-growing { border-left: 3px solid var(--accent-purple); }
.crop-harvesting { border-left: 3px solid var(--accent-green); }
.crop-done { border-left: 3px solid #4CAF50; opacity: 0.7; }
.crop-emoji { font-size: 28px; margin-bottom: 4px; }
.crop-name { font-size: 12px; font-weight: 600; line-height: 1.2; }
.crop-variety { font-size: 10px; color: var(--text-secondary); }
.crop-qty { font-size: 10px; color: var(--text-secondary); margin-top: 2px; }
.crop-saving { font-size: 11px; font-weight: 600; color: var(--accent-green); margin-top: 4px; }
.crop-progress-bar { height: 4px; background: var(--bg-tertiary); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.crop-progress-fill { height: 100%; border-radius: 2px; background: var(--accent-green); transition: width 0.3s; }

/* Task Timeline */
.task-timeline { padding: 0; }
.timeline-date { margin-bottom: 16px; }
.timeline-date.overdue .timeline-date-label { color: var(--accent-red); font-weight: 600; }
.timeline-date.today .timeline-date-label { color: var(--accent-blue); font-weight: 600; }
.timeline-date-label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; padding: 8px 20px; background: var(--bg-tertiary); border-radius: var(--radius-sm); margin-bottom: 8px; }
.timeline-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 500; }
.overdue-badge { background: rgba(255,59,48,0.12); color: var(--accent-red); }
.today-badge { background: rgba(0,122,255,0.12); color: var(--accent-blue); }
.timeline-items { padding-left: 20px; }
.task-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 16px; border-radius: var(--radius-sm); transition: background 0.15s; border-bottom: 1px solid var(--bg-tertiary); }
.task-item:hover { background: var(--bg-tertiary); }
.task-item.done { opacity: 0.5; }
.task-item.done .task-title { text-decoration: line-through; }
.task-check { cursor: pointer; font-size: 18px; flex-shrink: 0; margin-top: 1px; user-select: none; }
.task-icon { font-size: 16px; flex-shrink: 0; }
.task-content { flex: 1; min-width: 0; }
.task-title { font-size: 14px; font-weight: 500; }
.task-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.task-crop { font-size: 11px; color: var(--accent-blue); margin-top: 2px; }
.task-actions { flex-shrink: 0; }

/* ====== ENERGY MONITOR ====== */
.energy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.energy-card { background: var(--bg-secondary); border-radius: 12px; padding: 16px; text-align: center; transition: transform 0.2s; }
.energy-card:hover { transform: translateY(-2px); }
.energy-icon { font-size: 24px; margin-bottom: 4px; }
.energy-value { font-size: 32px; font-weight: 700; line-height: 1.1; }
.energy-unit { font-size: 14px; font-weight: 400; opacity: 0.7; margin-left: 2px; }
.energy-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.energy-subtitle { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.energy-card-main { background: var(--bg-secondary); border-radius: 16px; padding: 20px; grid-column: span 2; display: flex; align-items: center; gap: 20px; }
.energy-icon-main { font-size: 40px; }
.energy-main-stats { display: flex; gap: 20px; flex: 1; }
.energy-stat { text-align: center; }
.energy-stat-value { font-size: 24px; font-weight: 700; display: block; }
.energy-stat-unit { font-size: 12px; color: var(--text-secondary); }
.energy-stat-label { font-size: 11px; color: var(--text-secondary); display: block; margin-top: 2px; }
.energy-soc-ring { flex-shrink: 0; }
.soc-ring-svg { width: 140px; height: 140px; }
.energy-panel { background: var(--bg-secondary); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.energy-panel-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--text-primary); }
.energy-bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.energy-bar-label { width: 80px; font-size: 13px; flex-shrink: 0; }
.energy-bar-track { flex: 1; height: 8px; background: var(--bg-tertiary); border-radius: 4px; overflow: hidden; }
.energy-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.energy-bar-value { width: 80px; font-size: 13px; font-weight: 600; text-align: right; flex-shrink: 0; }
.energy-details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.energy-detail-item { display: flex; justify-content: space-between; padding: 8px 12px; background: var(--bg-tertiary); border-radius: 8px; }
.energy-detail-label { font-size: 12px; color: var(--text-secondary); }
.energy-detail-value { font-size: 13px; font-weight: 500; }
.energy-loading { text-align: center; padding: 40px; color: var(--text-secondary); }
.energy-error { text-align: center; padding: 40px; color: var(--text-secondary); }
.energy-timestamp { font-size: 11px; color: var(--text-secondary); }
.energy-header-info { display: flex; align-items: center; gap: 12px; }
@media (max-width: 768px) {
  .energy-card-main { grid-column: span 2; flex-direction: column; }
  .energy-details-grid { grid-template-columns: 1fr; }
  .energy-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ====== NETWORK MONITOR ====== */
.network-status { font-size: 0.8rem; color: var(--text-secondary, #888); }
.network-status.fresh { color: #4caf50; }

.network-loading, .network-error { text-align: center; padding: 40px; color: var(--text-secondary, #888); }
.network-error { color: #f44336; }

.network-summary { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.network-stat { background: var(--bg-secondary, #1e1e2e); border-radius: 8px; padding: 12px 20px; text-align: center; min-width: 100px; }
.network-stat-num { display: block; font-size: 1.8rem; font-weight: 700; color: var(--accent, #7c3aed); }
.network-stat-label { font-size: 0.75rem; color: var(--text-secondary, #888); text-transform: uppercase; letter-spacing: 0.05em; }

.network-panel { background: var(--bg-secondary, #1e1e2e); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.network-panel-title { font-size: 1rem; font-weight: 600; margin: 0 0 12px 0; color: var(--text-primary, #eee); display: flex; align-items: center; gap: 8px; }
.network-panel-count { font-size: 0.75rem; font-weight: 400; color: var(--text-secondary, #888); margin-left: auto; }

.network-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }

.network-device-card {
  background: var(--bg-tertiary, #2a2a3e); border-radius: 10px; padding: 12px;
  border: 1px solid transparent; transition: border-color 0.2s, transform 0.1s;
}
.network-device-card:hover { border-color: var(--accent, #7c3aed); transform: translateY(-1px); }
.network-device-card.offline { opacity: 0.5; }

.network-device-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.network-device-icon { font-size: 1.4rem; }
.network-device-status { font-size: 0.7rem; }
.network-ha-badge { font-size: 0.6rem; background: #4caf50; color: #fff; border-radius: 3px; padding: 1px 4px; font-weight: 600; }

.network-device-name { font-weight: 600; font-size: 0.9rem; color: var(--text-primary, #eee); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.network-device-ip code { font-size: 0.8rem; background: var(--bg-primary, #111); padding: 2px 6px; border-radius: 4px; color: var(--accent, #7c3aed); }
.network-device-mac { font-size: 0.7rem; color: var(--text-secondary, #666); font-family: monospace; margin-top: 2px; }
.network-device-vendor { font-size: 0.75rem; color: var(--text-secondary, #999); margin-top: 3px; }
.network-device-desc { font-size: 0.7rem; color: var(--text-secondary, #777); margin-top: 4px; }

.network-device-ports { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
.network-port { font-size: 0.65rem; background: var(--bg-primary, #111); color: var(--text-secondary, #aaa); padding: 1px 5px; border-radius: 3px; }

.network-device-link { display: inline-block; margin-top: 6px; font-size: 0.75rem; color: var(--accent, #7c3aed); text-decoration: none; }
.network-device-link:hover { text-decoration: underline; }

.network-subnets { display: flex; gap: 12px; flex-wrap: wrap; }
.network-subnet { background: var(--bg-tertiary, #2a2a3e); border-radius: 8px; padding: 10px 14px; }
.network-subnet code { font-size: 0.85rem; color: var(--accent, #7c3aed); }
.network-subnet-gw { font-size: 0.75rem; color: var(--text-secondary, #888); margin-left: 8px; }

/* Network table view */
.network-table-wrap { overflow-x: auto; }
.network-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.network-table th { text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--bg-tertiary, #2a2a3e); color: var(--text-secondary, #888); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.network-table td { padding: 6px 10px; border-bottom: 1px solid var(--bg-tertiary, #2a2a3e); }
.network-table tr.offline td { opacity: 0.5; }
.network-table tr:hover td { background: var(--bg-tertiary, #2a2a3e); }
.network-link { color: var(--accent, #7c3aed); text-decoration: none; }
.network-link:hover { text-decoration: underline; }
.network-mac { font-size: 0.75rem; }
.network-desc { cursor: help; }

@media (max-width: 768px) {
  .network-cards { grid-template-columns: repeat(2, 1fr); }
  .network-summary { gap: 8px; }
  .network-stat { padding: 8px 12px; min-width: 80px; }
  .network-stat-num { font-size: 1.4rem; }
}
