/* ========== Reset & Base ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: #3D4A3E; background: #F8F6F0; line-height: 1.6; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ========== Top Nav ========== */
.top-nav { background: #FFFFFF; border-bottom: 1px solid #E8E6DF; position: sticky; top: 0; z-index: 100; }
.top-nav-inner { display: flex; align-items: center; justify-content: space-between; height: 52px; }
.top-nav-brand { font-weight: 700; font-size: 1.05rem; color: #3D4A3E; text-decoration: none; }
.top-nav-links { display: flex; gap: 24px; }
.top-nav-links a { color: #718072; font-size: 0.88rem; text-decoration: none; transition: color .2s; }
.top-nav-links a:hover { color: #5C715E; }

/* ========== Hero ========== */
.hero {
    background: #FFFFFF;
    color: #3D4A3E; padding: 60px 0 40px; text-align: center;
}
.hero h1 { font-size: 2.4rem; font-weight: 700; letter-spacing: 2px; }
.hero .accent { color: #5C715E; }
.hero-sub { font-size: 1.1rem; color: #718072; margin-top: 14px; max-width: 520px; margin-left: auto; margin-right: auto; }
.hero-image { margin-top: 28px; text-align: center; }
.hero-image img { max-width: 560px; width: 88%; border-radius: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }

/* ========== Section Title ========== */
.section-title { text-align: center; font-size: 1.7rem; font-weight: 700; margin-bottom: 8px; color: #3D4A3E; }
.section-desc { text-align: center; color: #718072; margin-bottom: 32px; font-size: 0.95rem; }

/* ========== Devices ========== */
.devices { padding: 50px 0 40px; }
.device-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.loading { text-align: center; color: #aaa; padding: 40px; font-size: 1rem; width: 100%; }

/* ========== Device Card ========== */
.device-card {
    background: #FFFFFF; border-radius: 16px; padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s; cursor: pointer;
    min-width: 0;
}
.device-card:hover { transform: translateY(-3px); box-shadow: 0 4px 16px rgba(92,113,94,0.12); }
.device-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.device-name { font-size: 1.1rem; font-weight: 600; color: #3D4A3E; }
.device-product { font-size: 0.82rem; color: #718072; margin-top: 2px; }
.device-status { font-size: 0.78rem; padding: 3px 10px; border-radius: 12px; font-weight: 500; }
.device-status.online { background: #E8F5E9; color: #4CAF50; }
.device-status.offline { background: #F0F0F0; color: #999; }

/* 3x2 Data Grid (sensors + actuators unified) */
.data-grid-6 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 18px 4px; border-radius: 10px; background: #EDECE8;
    min-height: 90px;
}
.grid-item.active { background: rgba(92,113,94,0.12); }
.grid-header { display: flex; align-items: center; margin-bottom: 2px; }
.grid-icon { font-size: 0.85rem; margin-right: 2px; }
.grid-label { font-size: 0.72rem; color: #5C715E; }
.grid-status { font-size: 0.72rem; color: #5C715E; }
.grid-row { display: flex; width: 100%; justify-content: center; gap: 8px; }
.grid-val { font-size: 0.92rem; font-weight: 700; color: #3D4A3E; line-height: 1.3; }
.grid-val.on { color: #5C715E; }
.grid-sub { font-size: 0.62rem; color: #718072; flex: 1; text-align: center; }

/* Care Score (used in radar card header) */
.care-score-value { font-size: 1.1rem; font-weight: 700; }
.care-score-value.good { color: #4CAF50; }
.care-score-value.ok { color: #D4A373; }
.care-score-value.bad { color: #BC4B51; }

/* Radar card (in device grid) */
.radar-card { display: flex; flex-direction: column; }
.radar-card canvas { max-height: 260px; margin-top: 8px; }

.snapshot-time { font-size: 0.72rem; color: #C8D8D0; margin-top: 8px; text-align: right; }
.today-stats { font-size: 0.78rem; color: #718072; text-align: center; margin-top: 10px; padding-top: 8px; border-top: 1px solid #E8E6E0; }
.grade-text { font-size: 0.85rem; color: #5C715E; text-align: center; margin-bottom: 8px; font-weight: 500; }

/* ========== Chart Section ========== */
.chart-section { padding: 50px 0 60px; background: #FFFFFF; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.chart-card { background: #F9F7F1; border-radius: 12px; padding: 20px; display: flex; flex-direction: column; min-width: 0; }
.chart-card h3 { font-size: 0.88rem; color: #718072; margin-bottom: 12px; text-align: center; }
.chart-card canvas { max-height: 220px; width: 100%; }
.chart-card.radar { text-align: center; }

/* ========== About ========== */
.about { padding: 50px 0; background: #FFFFFF; }
.about-content { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin-top: 24px; }
.about-card { padding: 24px 20px; border-radius: 14px; background: #F9F7F1; }
.about-card h3 { font-size: 1.05rem; margin-bottom: 8px; color: #3D4A3E; }
.about-card p { font-size: 0.88rem; color: #718072; line-height: 1.6; }
.about-image { text-align: center; margin-top: 28px; }
.about-image img { max-width: 420px; width: 80%; border-radius: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.06); }

/* ========== Footer ========== */
.footer { background: #3D4A3E; color: rgba(255,255,255,0.6); text-align: center; padding: 24px; font-size: 0.85rem; }
.footer-beian { margin-top: 8px; font-size: 0.78rem; }
.footer-beian a { color: rgba(255,255,255,0.5); text-decoration: none; margin: 0 8px; display: inline-flex; align-items: center; }
.footer-beian a:hover { color: rgba(255,255,255,0.5); }
.footer-beian span { color: rgba(255,255,255,0.5); margin: 0 8px; }
.beian-icon { width: 0.78rem; height: 0.78rem; margin-right: 3px; vertical-align: middle; }

/* ========== Responsive ========== */
@media (max-width: 800px) {
    .hero h1 { font-size: 1.8rem; }
    .hero-sub { font-size: 1rem; }
    .device-grid,
    .chart-grid { grid-template-columns: 1fr; max-width: 540px; margin-left: auto; margin-right: auto; }
    .about-content { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .about-content { grid-template-columns: 1fr; }
}
