/* ============================================================
   辣椒育苗精细化服务平台 · 视觉系统
   ============================================================ */
:root {
  --chili-900: #5c1410;
  --chili-800: #7a1a14;
  --chili-700: #9b2119;
  --chili-600: #bf2c22;
  --chili-500: #d63a2b;
  --chili-400: #e85d4a;
  --chili-100: #fbe9e5;
  --chili-50: #fdf3ef;

  --leaf-700: #1f5c37;
  --leaf-600: #2c7a47;
  --leaf-500: #3f9558;
  --leaf-100: #e6f2e9;

  --amber-500: #e08a1e;
  --amber-100: #fdf0dc;

  --ink-900: #2a1c18;
  --ink-700: #4a3a34;
  --ink-500: #7b6a63;
  --ink-400: #9a8a82;
  --ink-300: #bdb0a8;

  --paper: #fbf7f2;
  --paper-2: #f6efe7;
  --card: #ffffff;
  --line: #ede2d8;
  --line-soft: #f4ece4;

  --shadow-sm: 0 1px 2px rgba(70, 35, 25, 0.05), 0 2px 8px rgba(70, 35, 25, 0.04);
  --shadow-md: 0 6px 24px rgba(70, 35, 25, 0.08);
  --shadow-lg: 0 18px 50px rgba(60, 25, 18, 0.16);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;

  --sidebar-w: 236px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink-900);
  background: var(--paper);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 500px at 88% -10%, rgba(214, 58, 43, 0.09), transparent 60%),
    radial-gradient(700px 420px at 6% 104%, rgba(63, 149, 88, 0.08), transparent 62%);
  pointer-events: none;
  z-index: 0;
}
a { color: var(--chili-600); text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: 0.2px; }
.hidden { display: none !important; }

/* ---------------- 布局 ---------------- */
.app { display: flex; min-height: 100vh; position: relative; z-index: 1; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px 18px;
  color: #f7ece6;
  background:
    radial-gradient(520px 300px at 20% 0%, rgba(232, 93, 74, 0.24), transparent 65%),
    linear-gradient(168deg, #34110d 0%, #4a1611 46%, #2c0f0b 100%);
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
}
.sidebar::after {
  content: "";
  position: absolute;
  right: -70px;
  bottom: -60px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 26px rgba(255, 255, 255, 0.028), 0 0 0 54px rgba(255, 255, 255, 0.018);
  pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px; }
.brand-mark {
  width: 42px; height: 42px;
  border-radius: 13px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, #e8584a, #b8241b);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.brand-mark svg { width: 26px; height: 26px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text b { font-size: 15px; letter-spacing: 0.6px; }
.brand-text span { font-size: 10.5px; color: rgba(255, 235, 228, 0.5); letter-spacing: 1.6px; text-transform: uppercase; }

.nav-group { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.nav-label {
  font-size: 10.5px; letter-spacing: 1.6px; color: rgba(255, 232, 224, 0.38);
  padding: 6px 10px 4px; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(255, 240, 234, 0.76);
  font-size: 13.5px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
  position: relative;
}
.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: 0.85; }
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-item.active {
  background: linear-gradient(100deg, rgba(232, 93, 74, 0.95), rgba(191, 44, 34, 0.72));
  color: #fff;
  box-shadow: 0 6px 16px rgba(140, 25, 15, 0.42);
}
.nav-item.active svg { opacity: 1; }
.nav-item.locked { opacity: 0.5; }
.nav-item .lock {
  margin-left: auto;
  font-size: 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  padding: 0 5px;
  line-height: 15px;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.65);
}
.nav-item .nav-dot {
  margin-left: auto; width: 6px; height: 6px; border-radius: 50%;
  background: #8ed9a4; box-shadow: 0 0 0 3px rgba(142, 217, 164, 0.14);
}

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.source-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 11.5px;
  color: rgba(255, 236, 228, 0.7);
  line-height: 1.5;
}
.source-card .row { display: flex; align-items: center; gap: 6px; }
.source-card b { color: #fff; font-size: 12px; font-weight: 500; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: 0 0 7px; }
.dot.live { background: #4ede7c; box-shadow: 0 0 0 3px rgba(78, 222, 124, 0.16); }
.dot.demo { background: #ffb547; box-shadow: 0 0 0 3px rgba(255, 181, 71, 0.16); }
.dot.off { background: #c7b6ae; }
.sidebar-user {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 11px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.avatar {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 30px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, #f0a58f, #c9493a);
  color: #fff; font-size: 12.5px; font-weight: 600;
}
.sidebar-user .who { font-size: 12.5px; color: #fff; line-height: 1.3; }
.sidebar-user .role { font-size: 10.5px; color: rgba(255, 236, 228, 0.55); }
.sidebar-user button {
  margin-left: auto; background: none; border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.8); font-size: 11px; border-radius: 7px;
  padding: 4px 8px; cursor: pointer;
}
.sidebar-user button:hover { background: rgba(255, 255, 255, 0.12); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: flex-end; gap: 16px;
  padding: 20px 30px 14px;
  background: linear-gradient(180deg, rgba(251, 247, 242, 0.96) 62%, rgba(251, 247, 242, 0.72));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(237, 226, 216, 0.7);
}
.page-title h1 { font-size: 21px; letter-spacing: 0.4px; }
.page-title p { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-500); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 5px 11px;
  font-size: 11.5px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-700);
  white-space: nowrap;
  flex: 0 0 auto;
  line-height: 1.5;
}
.pill.role-admin { background: var(--chili-50); border-color: #f6d6cf; color: var(--chili-700); }
.pill.role-user { background: var(--leaf-100); border-color: #cfe7d5; color: var(--leaf-700); }
.pill.role-visitor { background: #f2eee9; border-color: var(--line); color: var(--ink-500); }
.pill.amber { background: var(--amber-100); border-color: #f6e0bd; color: #98600f; }

.view { padding: 20px 30px 40px; display: flex; flex-direction: column; gap: 18px; max-width: 1560px; width: 100%; }
.view > * { animation: rise 0.42s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
.view > *:nth-child(2) { animation-delay: 0.05s; }
.view > *:nth-child(3) { animation-delay: 0.1s; }
.view > *:nth-child(4) { animation-delay: 0.14s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------------- 卡片 ---------------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.panel-head h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.panel-head h3 .bar {
  width: 4px; height: 15px; border-radius: 3px;
  background: linear-gradient(180deg, var(--chili-500), var(--amber-500));
}
.panel-head p { margin: 2px 0 0; font-size: 12px; color: var(--ink-400); }
.panel-head .tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel-body { padding: 18px 20px; }
.panel-body.tight { padding: 12px 14px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card::after {
  content: "";
  position: absolute; right: -28px; top: -28px;
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--tint, rgba(214, 58, 43, 0.08));
}
.stat-card .label { font-size: 12px; color: var(--ink-500); display: flex; align-items: center; gap: 6px; }
.stat-card .value { margin-top: 8px; display: flex; align-items: baseline; gap: 5px; }
.stat-card .value b { font-size: 27px; font-weight: 600; letter-spacing: -0.4px; font-variant-numeric: tabular-nums; }
.stat-card .value span { font-size: 12px; color: var(--ink-400); }
.stat-card .foot { margin-top: 7px; font-size: 11.5px; color: var(--ink-400); display: flex; align-items: center; gap: 5px; }
.stat-icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; position: absolute; right: 14px; top: 14px;
  background: var(--tint, rgba(214, 58, 43, 0.08)); color: var(--accent, var(--chili-600));
}
.stat-icon svg { width: 18px; height: 18px; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 6px; }
.tag.ok { background: var(--leaf-100); color: var(--leaf-700); }
.tag.warn { background: var(--amber-100); color: #9a6412; }
.tag.bad { background: var(--chili-100); color: var(--chili-700); }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 10px; padding: 9px 15px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--line);
  background: #fff; color: var(--ink-700);
  transition: all 0.16s ease;
  white-space: nowrap;
}
.btn:hover { border-color: #dccbbf; background: #fffaf6; transform: translateY(-1px); }
.btn:active { transform: none; }
.btn svg { width: 15px; height: 15px; }
.btn.primary {
  background: linear-gradient(135deg, var(--chili-600), var(--chili-500));
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px rgba(191, 44, 34, 0.24);
}
.btn.primary:hover { background: linear-gradient(135deg, var(--chili-700), var(--chili-600)); }
.btn.leaf {
  background: linear-gradient(135deg, var(--leaf-600), var(--leaf-500));
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px rgba(44, 122, 71, 0.2);
}
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-500); }
.btn.ghost:hover { background: var(--paper-2); color: var(--ink-900); }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------------- 选择器 / 标签 ---------------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff;
  font-size: 12.5px; color: var(--ink-700); cursor: pointer;
  transition: all 0.16s ease;
}
.chip:hover { border-color: #e2b7ac; color: var(--chili-700); }
.chip.active {
  background: var(--chili-50); border-color: #eab7ac; color: var(--chili-700);
  box-shadow: inset 0 0 0 1px rgba(214, 58, 43, 0.08);
}
.chip .count {
  font-size: 10.5px; background: rgba(0, 0, 0, 0.06); border-radius: 999px;
  padding: 0 6px; line-height: 16px;
}
.chip.active .count { background: rgba(214, 58, 43, 0.14); }
.chip.locked { opacity: 0.6; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-soft); padding: 0 4px; }
.tab {
  position: relative; padding: 9px 12px; font-size: 13px; color: var(--ink-500);
  cursor: pointer; border: none; background: none; border-radius: 8px 8px 0 0;
}
.tab:hover { color: var(--ink-900); background: var(--paper-2); }
.tab.active { color: var(--chili-700); font-weight: 600; }
.tab.active::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px;
  height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--chili-500), var(--amber-500));
}
.tab .m-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 6px; }

/* ---------------- 表单 ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; color: var(--ink-500); }
.field label b { color: var(--chili-600); font-weight: 500; }
input[type="text"], input[type="password"], input[type="datetime-local"], input[type="date"], select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  padding: 9px 11px;
  font-size: 13px;
  color: var(--ink-900);
  font-family: inherit;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: #e0a79a; box-shadow: 0 0 0 3px rgba(214, 58, 43, 0.09);
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-400) 50%), linear-gradient(135deg, var(--ink-400) 50%, transparent 50%); background-position: calc(100% - 15px) 17px, calc(100% - 10px) 17px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.filter-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr auto; gap: 12px; align-items: end; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-700); cursor: pointer; }
.switch input { display: none; }
.switch i {
  width: 36px; height: 20px; border-radius: 999px; background: #ddd0c7; position: relative; transition: background 0.18s ease;
}
.switch i::after {
  content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.18s ease;
}
.switch input:checked + i { background: var(--leaf-500); }
.switch input:checked + i::after { transform: translateX(16px); }

/* ---------------- 图表 ---------------- */
.chart { width: 100%; height: 340px; }
.chart.tall { height: 400px; }
.chart.short { height: 260px; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.chart-note { font-size: 11.5px; color: var(--ink-400); display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* ---------------- 设备卡片 ---------------- */
.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 12px; }
.device-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  background: linear-gradient(180deg, #fff, #fdfaf7);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  position: relative;
}
.device-card:hover { border-color: #e6bdb2; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.device-card.offline { opacity: 0.72; }
.device-card.offline .kv b { color: var(--ink-400); }
.device-card .d-head { display: flex; align-items: flex-start; gap: 8px; }
.device-card .d-name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.device-card .d-sn { font-size: 10.5px; color: var(--ink-400); font-family: var(--mono); margin-top: 2px; }
.device-card .d-group {
  font-size: 10px; color: var(--leaf-700); background: var(--leaf-100);
  border-radius: 5px; padding: 1px 6px; white-space: nowrap;
}
.status-dot { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; color: var(--leaf-700); }
.status-dot.off { color: var(--ink-400); }
.device-card .values { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; margin-top: 12px; }
.device-card .kv { display: flex; flex-direction: column; gap: 1px; }
.device-card .kv em { font-style: normal; font-size: 10.5px; color: var(--ink-400); display: flex; align-items: center; gap: 4px; }
.device-card .kv b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.2px; }
.device-card .kv b small { font-size: 10px; font-weight: 400; color: var(--ink-400); margin-left: 1px; }
.device-card .kv .none { color: var(--ink-300); font-weight: 400; }
.device-card .d-foot {
  margin-top: 11px; padding-top: 9px; border-top: 1px dashed var(--line);
  display: flex; align-items: center; gap: 10px; font-size: 10.5px; color: var(--ink-400);
  font-variant-numeric: tabular-nums;
}
.device-card .d-foot .sep { margin-left: auto; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow: auto; border-radius: 10px; border: 1px solid var(--line-soft); }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; font-weight: 500; color: var(--ink-500);
  background: #fbf6f0; padding: 9px 12px; white-space: nowrap;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
}
table.data td {
  padding: 9px 12px; border-bottom: 1px solid var(--line-soft);
  color: var(--ink-700); white-space: nowrap; font-variant-numeric: tabular-nums;
}
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: #fdf9f4; }
table.data .num { font-family: var(--mono); font-size: 12px; }
table.data .muted { color: var(--ink-400); }
table.data .sn { font-family: var(--mono); font-size: 11.5px; color: var(--ink-500); }
.tbl-scroll { max-height: 380px; overflow: auto; }

/* ---------------- 提示 / 空状态 ---------------- */
.notice {
  display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px;
  background: var(--amber-100); border: 1px solid #f4dfc0; color: #7d5410; font-size: 12.5px;
  line-height: 1.65;
}
.notice svg { width: 17px; height: 17px; flex: 0 0 17px; margin-top: 1px; }
.notice.info { background: #eef4f7; border-color: #d6e4ea; color: #27586b; }
.notice.leaf { background: var(--leaf-100); border-color: #cfe6d6; color: var(--leaf-700); }
.notice b { font-weight: 600; }
.empty {
  padding: 40px 20px; text-align: center; color: var(--ink-400); font-size: 12.5px;
}
.empty svg { width: 38px; height: 38px; opacity: 0.5; margin-bottom: 8px; }
.skeleton {
  border-radius: 10px; background: linear-gradient(90deg, #f4ece5 25%, #faf5f0 37%, #f4ece5 63%);
  background-size: 400% 100%; animation: shimmer 1.3s ease infinite; height: 100%;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.loading-block { height: 320px; padding: 12px; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff;
  animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 告警条 ---------------- */
.alert-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.alert-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; padding: 5px 10px; border-radius: 8px;
  background: var(--chili-50); border: 1px solid #f3d3cb; color: var(--chili-700);
}
.alert-chip.low { background: #eef4f7; border-color: #d5e5eb; color: #2a6072; }
.alert-chip b { font-weight: 600; }
.alert-chip span { color: var(--ink-500); }

/* ---------------- 上传 ---------------- */
.upload-layout { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 18px; align-items: start; }
.dropzone {
  border: 1.5px dashed #e3c7bc; border-radius: 16px;
  padding: 30px 20px; text-align: center; cursor: pointer;
  background: linear-gradient(180deg, #fffdfb, #fdf7f2);
  transition: all 0.2s ease;
}
.dropzone:hover, .dropzone.drag { border-color: var(--chili-400); background: var(--chili-50); }
.dropzone .ico {
  width: 52px; height: 52px; margin: 0 auto 10px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--chili-50); color: var(--chili-600);
}
.dropzone .ico svg { width: 25px; height: 25px; }
.dropzone b { font-size: 14px; }
.dropzone p { margin: 5px 0 0; font-size: 12px; color: var(--ink-400); }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.steps li { position: relative; padding-left: 30px; font-size: 12.5px; color: var(--ink-700); line-height: 1.6; }
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--chili-50); color: var(--chili-700);
  font-size: 11px; display: grid; place-items: center; font-weight: 600;
}
.steps li b { color: var(--ink-900); font-weight: 600; }
.result-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.result-cell {
  border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; background: #fffdfb;
}
.result-cell em { font-style: normal; font-size: 11px; color: var(--ink-400); display: block; }
.result-cell b { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.result-cell.ok b { color: var(--leaf-600); }
.result-cell.bad b { color: var(--chili-600); }

/* ---------------- 登录 ---------------- */
.login-root {
  position: fixed; inset: 0; z-index: 80;
  display: grid; grid-template-columns: 1.08fr 0.92fr;
  background: #1e0d0a;
  overflow: auto;
}
.login-visual {
  position: relative; overflow: hidden;
  background:
    radial-gradient(700px 500px at 80% 20%, rgba(214, 58, 43, 0.4), transparent 65%),
    linear-gradient(160deg, #2b0f0b, #591812 55%, #2a0d09);
  color: #fff; padding: 48px 54px; display: flex; flex-direction: column;
}
.login-visual .hero-img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0.42; mix-blend-mode: luminosity;
}
.login-visual::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(30, 12, 9, 0.3), rgba(30, 12, 9, 0.86));
}
.login-visual > * { position: relative; z-index: 2; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand .brand-mark { width: 46px; height: 46px; border-radius: 14px; }
.login-brand b { font-size: 17px; letter-spacing: 1px; }
.login-brand span { font-size: 10.5px; letter-spacing: 2.4px; color: rgba(255, 235, 228, 0.55); display: block; }
.login-hero { margin-top: auto; max-width: 470px; }
.login-hero h2 { font-size: 34px; line-height: 1.28; letter-spacing: 0.5px; }
.login-hero h2 em { font-style: normal; color: #ffb59e; }
.login-hero p { color: rgba(255, 236, 228, 0.68); font-size: 13.5px; line-height: 1.85; margin: 14px 0 0; }
.hero-points { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin-top: 26px; }
.hero-point { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: rgba(255, 240, 234, 0.85); }
.hero-point i {
  width: 22px; height: 22px; border-radius: 7px; flex: 0 0 22px;
  display: grid; place-items: center; background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.14); font-style: normal; font-size: 11px;
}
.login-foot { margin-top: 34px; font-size: 11px; color: rgba(255, 235, 228, 0.36); letter-spacing: 0.4px; }

.login-panel {
  background: var(--paper); display: flex; align-items: center; justify-content: center;
  padding: 40px 30px; position: relative;
}
.login-close {
  position: absolute; right: 22px; top: 20px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-500);
  border-radius: 9px; padding: 6px 11px; font-size: 12px; cursor: pointer;
}
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: 23px; letter-spacing: 0.4px; }
.login-card > p { color: var(--ink-500); font-size: 12.5px; margin: 7px 0 22px; }
.login-tabs { display: flex; background: #f1e8df; border-radius: 10px; padding: 3px; margin-bottom: 20px; }
.login-tab {
  flex: 1; text-align: center; padding: 8px; font-size: 12.5px; border-radius: 8px;
  cursor: pointer; color: var(--ink-500); border: none; background: none;
}
.login-tab.active { background: #fff; color: var(--chili-700); font-weight: 600; box-shadow: var(--shadow-sm); }
.login-form { display: flex; flex-direction: column; gap: 13px; }
.login-form .field label { font-size: 11.5px; }
.login-form input { padding: 11px 13px; border-radius: 10px; }
.login-submit { width: 100%; padding: 11px; font-size: 13.5px; border-radius: 10px; margin-top: 4px; }
.login-hint {
  margin-top: 18px; border: 1px dashed #e4d3c8; border-radius: 11px;
  padding: 12px 14px; font-size: 11.5px; color: var(--ink-500); line-height: 1.8;
  background: #fffdfa;
}
.login-hint b { color: var(--ink-700); }
.login-hint code {
  font-family: var(--mono); background: #f3eae1; border-radius: 4px; padding: 1px 5px;
  color: var(--chili-700); font-size: 11px;
}
.login-error {
  background: var(--chili-100); color: var(--chili-700); border: 1px solid #f1cfc7;
  border-radius: 9px; padding: 8px 11px; font-size: 12px;
}
.guest-link { margin-top: 14px; text-align: center; font-size: 12px; color: var(--ink-500); }
.guest-link button { border: none; background: none; color: var(--chili-700); cursor: pointer; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 90; background: rgba(40, 18, 13, 0.46);
  backdrop-filter: blur(3px); display: grid; place-items: center; padding: 24px;
  animation: fade 0.18s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(600px, 100%); max-height: 88vh; background: #fff; border-radius: 18px;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden;
  animation: pop 0.24s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.modal.wide { width: min(880px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(0.99); } }
.modal-head { padding: 17px 20px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 10px; }
.modal-head h3 { font-size: 15.5px; }
.modal-head p { margin: 2px 0 0; font-size: 11.5px; color: var(--ink-400); }
.modal-head .x { margin-left: auto; border: none; background: none; font-size: 19px; color: var(--ink-400); cursor: pointer; line-height: 1; padding: 4px; }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-foot { padding: 13px 20px; border-top: 1px solid var(--line-soft); display: flex; justify-content: flex-end; gap: 9px; background: #fffdfb; }
.device-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-height: 300px; overflow: auto; padding: 2px; }
.pick-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 9px; cursor: pointer; font-size: 12.5px;
  transition: all 0.14s ease;
}
.pick-item:hover { border-color: #e5bcb1; background: #fffaf7; }
.pick-item input { accent-color: var(--chili-600); }
.pick-item.on { border-color: #e8b5a8; background: var(--chili-50); }
.pick-item .sn { font-family: var(--mono); font-size: 10.5px; color: var(--ink-400); display: block; }

/* ---------------- Toast ---------------- */
.toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: #2c1611; color: #fff; border-radius: 10px; padding: 10px 16px;
  font-size: 12.5px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px;
  animation: toastIn 0.24s ease; max-width: 560px;
}
.toast.ok { background: #1f5133; }
.toast.err { background: #7d1f16; }
.toast .ic { width: 16px; height: 16px; flex: 0 0 16px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }

/* ---------------- 权限矩阵 ---------------- */
.perm-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); font-size: 12.5px; }
.perm-grid > div { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); }
.perm-grid > div:nth-child(-n+4) { font-weight: 600; color: var(--ink-500); background: #fbf6f0; font-size: 11.5px; }
.perm-grid .yes { color: var(--leaf-600); }
.perm-grid .no { color: var(--ink-300); }
.perm-grid .partial { color: var(--amber-500); }

/* ---------------- 管理页 ---------------- */
.admin-tabs { display: flex; gap: 6px; padding: 4px; background: #f2e9e0; border-radius: 11px; width: fit-content; }
.admin-tab {
  border: none; background: none; padding: 7px 15px; border-radius: 8px; font-size: 12.5px;
  color: var(--ink-500); cursor: pointer;
}
.admin-tab.active { background: #fff; color: var(--chili-700); font-weight: 600; box-shadow: var(--shadow-sm); }
.kv-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.kv-box { border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px; background: #fffdfb; }
.kv-box em { font-style: normal; font-size: 11px; color: var(--ink-400); display: block; }
.kv-box b { font-size: 13px; font-weight: 500; color: var(--ink-900); }
.codeurl { font-family: var(--mono); font-size: 11.5px; color: var(--ink-500); word-break: break-all; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .upload-layout { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; flex: none; height: auto; position: relative; flex-direction: row;
    align-items: center; padding: 12px 16px; gap: 14px; overflow-x: auto;
  }
  .brand { flex: 0 0 auto; }
  .brand-text span { display: none; }
  .nav-group { flex-direction: row; margin: 0; gap: 4px; flex-wrap: nowrap; }
  .nav-label, .sidebar-foot, .sidebar::after { display: none; }
  .nav-item { padding: 8px 10px; font-size: 12.5px; flex: 0 0 auto; white-space: nowrap; }
  .nav-item span { white-space: nowrap; }
  .nav-item .lock { display: none; }
  .main { width: 100%; }
  .topbar { padding: 14px 18px; }
  .view { padding: 16px 18px 32px; }
  .chart-grid { grid-template-columns: 1fr; }
  .login-root { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .perm-grid { font-size: 11.5px; }
}
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-title { width: 100%; }
  .page-title h1 { font-size: 18px; }
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .topbar-actions { width: 100%; margin-left: 0; flex-wrap: wrap; }
  .topbar-actions .hide-sm { display: none; }
  .device-pick { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: 1fr !important; }
  .chart { height: 280px; }
}
@media (max-width: 460px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* 天气实况与预报 */
#weather-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.weather-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(160deg, #fff 0%, #fdf8f1 100%);
}
.weather-card::before {
  content: '';
  position: absolute;
  right: -32px;
  top: -36px;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 154, 0, .13), transparent 70%);
  pointer-events: none;
}
.weather-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.weather-head b { font-size: 15px; color: var(--ink-900); }
.weather-head span { display: block; margin-top: 2px; font-size: 11px; color: var(--ink-400); }
.weather-time { font-size: 11px; color: var(--ink-400); white-space: nowrap; }
.weather-now { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.weather-icon { width: 48px; height: 48px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.weather-main { min-width: 86px; }
.weather-temp { font-size: 30px; line-height: 1; font-weight: 700; color: var(--ink-900); font-variant-numeric: tabular-nums; }
.weather-temp span { margin-left: 2px; font-size: 13px; font-weight: 500; color: var(--ink-400); }
.weather-text { margin-top: 4px; font-size: 12px; color: var(--ink-500); }
.weather-meta {
  margin-left: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 12px;
  font-size: 11.5px;
  color: var(--ink-500);
}
.weather-forecast {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.wf-day { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 2px 0; border-radius: 8px; }
.wf-day:hover { background: var(--paper-2); }
.wf-label { font-size: 10.5px; color: var(--ink-400); white-space: nowrap; }
.wf-icon { display: flex; }
.wf-temp { font-size: 10px; color: var(--ink-700); white-space: nowrap; font-variant-numeric: tabular-nums; }
.wf-rain { font-size: 10px; color: #2c7da0; }
.weather-error { display: flex; align-items: center; gap: 6px; padding: 16px 0; font-size: 12px; color: var(--chili-600); }
@media (max-width: 1100px) {
  #weather-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  #weather-grid { grid-template-columns: 1fr; }
  .weather-meta { margin-left: 0; }
}

/* 辣椒育苗气象风险 */
.risk-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.risk-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.risk-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}
.risk-head b { font-size: 14px; color: var(--ink-900); }
.risk-head span { display: block; margin-top: 3px; font-size: 11.5px; color: var(--ink-400); }
.risk-head .pill { margin-top: 0; white-space: nowrap; }
.risk-chart { width: 100%; min-height: 220px; }
.risk-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 11px;
  color: var(--ink-500);
}
.risk-legend span { display: inline-flex; align-items: center; gap: 5px; }
.risk-note { margin-top: 12px; font-size: 11.5px; color: var(--ink-400); line-height: 1.7; }
.risk-thresholds { margin-top: 10px; font-size: 12px; color: var(--ink-500); }
.risk-thresholds summary { cursor: pointer; color: var(--chili-700); }
.risk-threshold-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 10px;
}
.risk-threshold-col {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--paper);
}
.risk-threshold-col b { color: var(--ink-700); }
.risk-threshold-col p { margin: 4px 0 6px; font-size: 11.5px; color: var(--ink-400); }
.risk-threshold-col ul { margin: 0; padding-left: 16px; font-size: 11.5px; line-height: 1.8; }
@media (max-width: 980px) {
  .risk-grid, .risk-threshold-grid { grid-template-columns: 1fr; }
}
