<!-- 待办预警 -->
<template>
  <div class="app-container todo-warning-page" v-loading="loading">
    <el-card shadow="never" class="page-card header-card">
      <div class="page-header">
        <div>
          <div class="page-title">待办预警</div>
          <div class="page-subtitle">展示当前登录用户需处置的预警列表，支持“我的待办”和“我的已办”快速查阅与筛选</div>
        </div>
        <el-button type="primary" icon="Refresh" @click="loadCurrentTabData">刷新</el-button>
      </div>
    </el-card>

    <div class="summary-grid">
      <el-card shadow="hover" class="summary-card danger">
        <div class="summary-label">我的待办</div>
        <div class="summary-value">{{ todoCount }}</div>
        <div class="summary-desc">当前用户待处理预警数量</div>
      </el-card>
      <el-card shadow="hover" class="summary-card success">
        <div class="summary-label">我的已办</div>
        <div class="summary-value">{{ doneCount }}</div>
        <div class="summary-desc">当前用户已处理完成预警数量</div>
      </el-card>
      <el-card shadow="hover" class="summary-card primary">
        <div class="summary-label">当前视图</div>
        <div class="summary-value">{{ filteredList.length }}</div>
        <div class="summary-desc">本页筛选后可查看记录数</div>
      </el-card>
    </div>

    <el-card shadow="never" class="page-card">
      <el-form :model="queryParams" :inline="true">
        <el-form-item label="预警名称">
          <el-input
            v-model="queryParams.warningName"
            placeholder="请输入预警名称"
            clearable
            style="width: 220px"
            @keyup.enter="handleQuery"
          />
        </el-form-item>
        <el-form-item label="预警编号">
          <el-input v-model="queryParams.warningNo" placeholder="请输入预警编号" clearable style="width: 200px" />
        </el-form-item>
        <el-form-item label="预警专项">
          <el-input v-model="queryParams.warningSpecial" placeholder="请输入预警专项" clearable style="width: 200px" />
        </el-form-item>
        <el-form-item label="预警类型">
          <el-select v-model="queryParams.warningType" clearable placeholder="请选择预警类型" style="width: 180px">
            <el-option
              v-for="item in warningTypeOptions"
              :key="item.dictValue"
              :label="item.dictLabel"
              :value="item.dictValue"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="预警级别">
          <el-select v-model="queryParams.warningLevel" clearable placeholder="请选择预警级别" style="width: 180px">
            <el-option
              v-for="item in warningLevelOptions"
              :key="item.dictValue"
              :label="item.dictLabel"
              :value="item.dictValue"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="处置人">
          <el-input v-model="queryParams.handler" placeholder="请输入处置人" clearable style="width: 180px" />
        </el-form-item>
        <el-form-item label="发布人">
          <el-input v-model="queryParams.publisher" placeholder="请输入发布人" clearable style="width: 180px" />
        </el-form-item>
        <el-form-item label="报警编号">
          <el-input v-model="queryParams.alarmCode" placeholder="请输入报警编号" clearable style="width: 180px" />
        </el-form-item>
        <el-form-item label="报警位置">
          <el-input v-model="queryParams.location" placeholder="请输入报警位置" clearable style="width: 200px" />
        </el-form-item>
        <el-form-item label="权属单位">
          <el-input v-model="queryParams.ownershipUnit" placeholder="请输入权属单位" clearable style="width: 180px" />
        </el-form-item>
        <el-form-item label="发布时间">
          <el-date-picker
            v-model="queryParams.dateRange"
            type="datetimerange"
            value-format="YYYY-MM-DD HH:mm:ss"
            range-separator="至"
            start-placeholder="开始时间"
            end-placeholder="结束时间"
            style="width: 360px"
          />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="Search" @click="handleQuery">查询</el-button>
          <el-button icon="Refresh" @click="resetQuery">重置</el-button>
        </el-form-item>
      </el-form>
    </el-card>

    <el-card shadow="never" class="page-card">
      <el-tabs v-model="activeTab" @tab-change="handleTabChange">
        <el-tab-pane :label="`我的待办 (${todoCount})`" name="TODO" />
        <el-tab-pane :label="`我的已办 (${doneCount})`" name="DONE" />
      </el-tabs>

      <el-table :data="pagedList" @row-click="handleViewDetail">
        <el-table-column label="序号" width="70" align="center">
          <template #default="scope">
            {{ (pagination.pageNum - 1) * pagination.pageSize + scope.$index + 1 }}
          </template>
        </el-table-column>
        <el-table-column label="预警名称" prop="warningName" min-width="180" show-overflow-tooltip />
        <el-table-column label="预警编号" prop="warningNo" width="170" />
        <el-table-column label="预警专项" prop="warningSpecial" width="140" show-overflow-tooltip />
        <el-table-column label="预警类型" prop="warningTypeText" width="120" />
        <el-table-column label="处置人" prop="handler" width="120" />
        <el-table-column label="发布人" prop="publisher" width="120" />
        <el-table-column label="报警编号" width="160">
          <template #default="scope">
            {{ scope.row.alarmCodeList.length ? scope.row.alarmCodeList.join("，") : "-" }}
          </template>
        </el-table-column>
        <el-table-column label="报警位置" prop="location" min-width="180" show-overflow-tooltip />
        <el-table-column label="权属单位" prop="ownershipUnit" width="160" show-overflow-tooltip />
        <el-table-column label="预警级别" width="110" align="center">
          <template #default="scope">
            <el-tag :type="getLevelTagType(scope.row.warningLevel)">
              {{ scope.row.warningLevelText || "-" }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column label="发布时间" prop="publishTime" width="180" />
        <el-table-column label="状态" width="100" align="center">
          <template #default="scope">
            <el-tag :type="activeTab === 'TODO' ? 'danger' : 'success'">
              {{ activeTab === "TODO" ? "待办" : "已办" }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column label="操作" fixed="right" width="220" align="center">
          <template #default="scope">
            <el-button link type="primary" @click.stop="handleViewDetail(scope.row)">查看详情</el-button>
            <template v-if="activeTab === 'TODO'">
              <el-button link type="warning" @click.stop="openUpgradeDialog(scope.row)">升级</el-button>
              <el-button link type="success" @click.stop="openResolveDialog(scope.row)">解除</el-button>
              <el-button link type="danger" @click.stop="openReturnDialog(scope.row)">退回</el-button>
            </template>
          </template>
        </el-table-column>
      </el-table>

      <pagination
        v-show="filteredList.length > 0"
        :total="filteredList.length"
        v-model:page="pagination.pageNum"
        v-model:limit="pagination.pageSize"
        @pagination="handlePageChange"
      />
    </el-card>

    <el-drawer v-model="detailVisible" title="预警详情" size="760px" append-to-body>
      <template v-if="detailData.basicInfo">
        <el-descriptions :column="2" border>
          <el-descriptions-item label="预警名称">{{ detailBasic.warningName || "-" }}</el-descriptions-item>
          <el-descriptions-item label="预警编号">{{ detailBasic.warningNo || "-" }}</el-descriptions-item>
          <el-descriptions-item label="预警专项">{{ detailBasic.warningSpecial || "-" }}</el-descriptions-item>
          <el-descriptions-item label="预警类型">{{ detailBasic.warningTypeText || "-" }}</el-descriptions-item>
          <el-descriptions-item label="预警级别">{{ detailBasic.warningLevelText || "-" }}</el-descriptions-item>
          <el-descriptions-item label="处置人">{{ detailBasic.handler || "-" }}</el-descriptions-item>
          <el-descriptions-item label="发布人">{{ detailBasic.publisher || "-" }}</el-descriptions-item>
          <el-descriptions-item label="权属单位">{{ detailBasic.ownershipUnit || "-" }}</el-descriptions-item>
          <el-descriptions-item label="报警位置" :span="2">{{ detailBasic.location || "-" }}</el-descriptions-item>
          <el-descriptions-item label="发布时间">{{ detailBasic.publishTime || "-" }}</el-descriptions-item>
          <el-descriptions-item label="经纬度">{{ detailBasic.longitude || "-" }} / {{ detailBasic.latitude || "-" }}</el-descriptions-item>
          <el-descriptions-item label="预警内容" :span="2">{{ detailBasic.warningContent || "-" }}</el-descriptions-item>
          <el-descriptions-item label="备注" :span="2">{{ detailBasic.remark || "-" }}</el-descriptions-item>
        </el-descriptions>

        <el-divider content-position="left">关联报警</el-divider>
        <el-table :data="detailData.alarmList || []" border size="small">
          <el-table-column label="报警编号" prop="warning_code" min-width="160" />
          <el-table-column label="报警类型" prop="warning_type" min-width="120" />
          <el-table-column label="设备编码" prop="device_code" min-width="160" />
          <el-table-column label="实际值" prop="actual_value" min-width="100" />
          <el-table-column label="报警时间" prop="alarm_time" min-width="180" />
        </el-table>

        <el-divider content-position="left">处置记录</el-divider>
        <el-timeline v-if="(detailData.disposalHistory || []).length">
          <el-timeline-item
            v-for="(item, index) in detailData.disposalHistory"
            :key="index"
            :timestamp="item.createTime || item.disposalTime || '-'"
          >
            {{ item.disposalContent || item.content || "-" }}
          </el-timeline-item>
        </el-timeline>
        <el-empty v-else description="暂无处置记录" />
      </template>
    </el-drawer>

    <!-- 预警升级对话框 -->
    <el-dialog v-model="upgradeDialog.visible" title="预警升级" width="500px" append-to-body>
      <el-form label-width="100px">
        <el-form-item label="预警名称">
          <el-input :model-value="upgradeDialog.row?.warningName || '-'" disabled />
        </el-form-item>
        <el-form-item label="当前级别">
          <el-tag :type="getLevelTagType(upgradeDialog.row?.warningLevel)">
            {{ upgradeDialog.row?.warningLevelText || "-" }}
          </el-tag>
        </el-form-item>
        <el-form-item label="新预警级别" required>
          <el-select v-model="upgradeDialog.newLevel" placeholder="请选择新级别" style="width: 100%">
            <el-option
              v-for="item in warningLevelOptions"
              :key="item.dictValue"
              :label="item.dictLabel"
              :value="item.dictValue"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="处置说明" required>
          <el-input
            v-model="upgradeDialog.disposalContent"
            type="textarea"
            :rows="4"
            maxlength="500"
            show-word-limit
            placeholder="请输入处置说明"
          />
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="upgradeDialog.visible = false">取 消</el-button>
          <el-button type="primary" :loading="actionLoading" @click="confirmUpgrade">确 定</el-button>
        </div>
      </template>
    </el-dialog>

    <!-- 预警解除对话框 -->
    <el-dialog v-model="resolveDialog.visible" title="解除预警" width="500px" append-to-body>
      <el-form label-width="100px">
        <el-form-item label="预警名称">
          <el-input :model-value="resolveDialog.row?.warningName || '-'" disabled />
        </el-form-item>
        <el-form-item label="处置说明" required>
          <el-input
            v-model="resolveDialog.disposalContent"
            type="textarea"
            :rows="4"
            maxlength="500"
            show-word-limit
            placeholder="请输入处置说明"
          />
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="resolveDialog.visible = false">取 消</el-button>
          <el-button type="primary" :loading="actionLoading" @click="confirmResolve">确 定</el-button>
        </div>
      </template>
    </el-dialog>

    <!-- 退回重办对话框 -->
    <el-dialog v-model="returnDialog.visible" title="退回重办" width="500px" append-to-body>
      <el-form label-width="100px">
        <el-form-item label="预警名称">
          <el-input :model-value="returnDialog.row?.warningName || '-'" disabled />
        </el-form-item>
        <el-form-item label="退回说明" required>
          <el-input
            v-model="returnDialog.disposalContent"
            type="textarea"
            :rows="4"
            maxlength="500"
            show-word-limit
            placeholder="请输入退回说明"
          />
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="returnDialog.visible = false">取 消</el-button>
          <el-button type="primary" :loading="actionLoading" @click="confirmReturn">确 定</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup>
import { computed, onMounted, reactive, ref } from "vue";
import useUserStore from "@/store/modules/user";
import { ElMessage, ElMessageBox } from "element-plus";
import { getAlertTypeDictionaryData, getTodoListData, getWarningDetailData, upgradeWarningData, resolveWarningData, returnWarningData } from "@/api/smxyjldczxt/yjxxfb/yjfb.js";

const userStore = useUserStore();
const loading = ref(false);
const activeTab = ref("TODO");
const todoList = ref([]);
const doneList = ref([]);
const warningTypeOptions = ref([]);
const warningLevelOptions = ref([]);
const warningStatusOptions = ref([]);
const detailVisible = ref(false);
const detailData = ref({});
const actionLoading = ref(false);

const upgradeDialog = reactive({
  visible: false,
  row: null,
  newLevel: "",
  disposalContent: ""
});

const resolveDialog = reactive({
  visible: false,
  row: null,
  disposalContent: ""
});

const returnDialog = reactive({
  visible: false,
  row: null,
  disposalContent: ""
});

const queryParams = reactive({
  warningName: "",
  warningNo: "",
  warningSpecial: "",
  warningType: "",
  warningLevel: "",
  handler: "",
  publisher: "",
  alarmCode: "",
  location: "",
  ownershipUnit: "",
  dateRange: []
});

const pagination = reactive({
  pageNum: 1,
  pageSize: 10
});

const warningTypeLabelMap = computed(() => {
  return warningTypeOptions.value.reduce((acc, item) => {
    acc[item.dictValue] = item.dictLabel;
    return acc;
  }, {});
});

const warningLevelLabelMap = computed(() => {
  return warningLevelOptions.value.reduce((acc, item) => {
    acc[item.dictValue] = item.dictLabel;
    return acc;
  }, {});
});

const warningStatusLabelMap = computed(() => {
  return warningStatusOptions.value.reduce((acc, item) => {
    acc[item.dictValue] = item.dictLabel;
    return acc;
  }, {});
});

const currentList = computed(() => (activeTab.value === "TODO" ? todoList.value : doneList.value));
const todoCount = computed(() => todoList.value.length);
const doneCount = computed(() => doneList.value.length);

const filteredList = computed(() => {
  return currentList.value.filter((item) => {
    const publishTime = item.publishTime || "";
    const [start, end] = queryParams.dateRange || [];
    if (queryParams.warningName && !String(item.warningName || "").includes(queryParams.warningName)) return false;
    if (queryParams.warningNo && !String(item.warningNo || "").includes(queryParams.warningNo)) return false;
    if (queryParams.warningSpecial && !String(item.warningSpecial || "").includes(queryParams.warningSpecial)) return false;
    if (queryParams.warningType && item.warningType !== queryParams.warningType) return false;
    if (queryParams.warningLevel && item.warningLevel !== queryParams.warningLevel) return false;
    if (queryParams.handler && !String(item.handler || "").includes(queryParams.handler)) return false;
    if (queryParams.publisher && !String(item.publisher || "").includes(queryParams.publisher)) return false;
    if (queryParams.location && !String(item.location || "").includes(queryParams.location)) return false;
    if (queryParams.ownershipUnit && !String(item.ownershipUnit || "").includes(queryParams.ownershipUnit)) return false;
    if (queryParams.alarmCode && !item.alarmCodeList.some((code) => String(code).includes(queryParams.alarmCode))) return false;
    if (start && publishTime && publishTime < start) return false;
    if (end && publishTime && publishTime > end) return false;
    return true;
  });
});

const pagedList = computed(() => {
  const start = (pagination.pageNum - 1) * pagination.pageSize;
  return filteredList.value.slice(start, start + pagination.pageSize);
});

const detailBasic = computed(() => {
  const basic = detailData.value.basicInfo || {};
  const warningType = basic.warningType || basic.warning_type || "";
  const warningLevel = basic.warningLevel || basic.warning_level || "";
  return {
    warningName: basic.warningName || basic.warning_name || "",
    warningNo: basic.warningNo || basic.warning_no || "",
    warningSpecial: basic.warningSpecial || basic.warning_special || "",
    warningTypeText: warningTypeLabelMap.value[warningType] || warningType || "-",
    warningLevelText: warningLevelLabelMap.value[warningLevel] || warningLevel || "-",
    handler: basic.handler || "",
    publisher: basic.publisher || "",
    ownershipUnit: basic.ownershipUnit || basic.ownership_unit || "",
    location: basic.location || "",
    publishTime: basic.publishTime || basic.publish_time || "",
    longitude: basic.longitude || "",
    latitude: basic.latitude || "",
    warningContent: basic.warningContent || basic.warning_content || "",
    remark: basic.remark || ""
  };
});

function getLevelTagType(level) {
  return {
    "1": "danger",
    "2": "warning",
    "3": "success",
    "4": "info"
  }[level] || "info";
}

async function ensureUserName() {
  if (userStore.name) {
    return userStore.name;
  }
  await userStore.getInfo();
  return userStore.name;
}

async function loadDicts() {
  const [typeRes, levelRes, statusRes] = await Promise.all([
    getAlertTypeDictionaryData({ dictType: "alert_type" }),
    getAlertTypeDictionaryData({ dictType: "alert_level" }),
    getAlertTypeDictionaryData({ dictType: "pre_alarm_status" })
  ]);
  warningTypeOptions.value = typeRes.rows || [];
  warningLevelOptions.value = levelRes.rows || [];
  warningStatusOptions.value = statusRes.rows || [];
}

async function enrichTodoRows(records) {
  const rows = await Promise.all(
    (records || []).map(async (item) => {
      const warningId = item.warningId || item.warning_id;
      const detailRes = await getWarningDetailData(warningId);
      const detail = detailRes.data || {};
      const basic = detail.basicInfo || {};
      const alarmList = detail.alarmList || [];
      const warningType = basic.warningType || basic.warning_type || item.warning_type || "";
      const warningLevel = basic.warningLevel || basic.warning_level || item.warning_level || "";
      return {
        todoId: item.todoId || item.todo_id,
        warningId,
        warningName: basic.warningName || basic.warning_name || item.warning_name || "",
        warningNo: basic.warningNo || basic.warning_no || "",
        warningSpecial: basic.warningSpecial || basic.warning_special || "",
        warningType,
        warningTypeText: warningTypeLabelMap.value[warningType] || warningType || "-",
        warningLevel,
        warningLevelText: warningLevelLabelMap.value[warningLevel] || warningLevel || "-",
        handler: basic.handler || item.handler || "",
        publisher: basic.publisher || item.publisher || "",
        location: basic.location || item.location || "",
        ownershipUnit: basic.ownershipUnit || basic.ownership_unit || item.ownership_unit || "",
        publishTime: basic.publishTime || basic.publish_time || item.publish_time || "",
        alarmCodeList: alarmList.map((alarm) => alarm.warning_code || alarm.warningCode || alarm.alarmId || alarm.alarm_id).filter(Boolean),
        detail
      };
    })
  );
  return rows;
}

async function loadTodoList(type) {
  const userName = await ensureUserName();
  const res = await getTodoListData({
    pageNum: 1,
    pageSize: 100,
    userName,
    todoType: type,
    warningName: queryParams.warningName || undefined
  });
  const records = res.data?.records || res.data || [];
  return enrichTodoRows(records);
}

async function loadCurrentTabData() {
  loading.value = true;
  try {
    if (activeTab.value === "TODO") {
      todoList.value = await loadTodoList("TODO");
    } else {
      doneList.value = await loadTodoList("DONE");
    }
    pagination.pageNum = 1;
    ElMessage.success("列表已刷新");
  } finally {
    loading.value = false;
  }
}

async function preloadCounts() {
  loading.value = true;
  try {
    const [todoRows, doneRows] = await Promise.all([loadTodoList("TODO"), loadTodoList("DONE")]);
    todoList.value = todoRows;
    doneList.value = doneRows;
  } finally {
    loading.value = false;
  }
}

function handleQuery() {
  pagination.pageNum = 1;
}

function resetQuery() {
  queryParams.warningName = "";
  queryParams.warningNo = "";
  queryParams.warningSpecial = "";
  queryParams.warningType = "";
  queryParams.warningLevel = "";
  queryParams.handler = "";
  queryParams.publisher = "";
  queryParams.alarmCode = "";
  queryParams.location = "";
  queryParams.ownershipUnit = "";
  queryParams.dateRange = [];
  pagination.pageNum = 1;
}

function handlePageChange() {
  // pagination component sync only
}

function handleTabChange() {
  pagination.pageNum = 1;
}

function handleViewDetail(row) {
  detailData.value = row.detail || {};
  detailVisible.value = true;
}

function openUpgradeDialog(row) {
  upgradeDialog.row = row;
  upgradeDialog.newLevel = "";
  upgradeDialog.disposalContent = "";
  upgradeDialog.visible = true;
}

function openResolveDialog(row) {
  resolveDialog.row = row;
  resolveDialog.disposalContent = "";
  resolveDialog.visible = true;
}

function openReturnDialog(row) {
  returnDialog.row = row;
  returnDialog.disposalContent = "";
  returnDialog.visible = true;
}

async function confirmUpgrade() {
  if (!upgradeDialog.newLevel) {
    ElMessage.warning("请选择新预警级别");
    return;
  }
  if (!upgradeDialog.disposalContent) {
    ElMessage.warning("请输入处置说明");
    return;
  }
  actionLoading.value = true;
  try {
    const res = await upgradeWarningData({
      warningId: upgradeDialog.row.warningId,
      newLevel: upgradeDialog.newLevel,
      disposalContent: upgradeDialog.disposalContent
    });
    if (res.code === 200) {
      ElMessage.success("升级成功");
      upgradeDialog.visible = false;
      await loadCurrentTabData();
    } else {
      ElMessage.error(res.msg || "升级失败");
    }
  } finally {
    actionLoading.value = false;
  }
}

async function confirmResolve() {
  if (!resolveDialog.disposalContent) {
    ElMessage.warning("请输入处置说明");
    return;
  }
  actionLoading.value = true;
  try {
    const res = await resolveWarningData({
      warningId: resolveDialog.row.warningId,
      disposalContent: resolveDialog.disposalContent
    });
    if (res.code === 200) {
      ElMessage.success("解除成功");
      resolveDialog.visible = false;
      await loadCurrentTabData();
    } else {
      ElMessage.error(res.msg || "解除失败");
    }
  } finally {
    actionLoading.value = false;
  }
}

async function confirmReturn() {
  if (!returnDialog.disposalContent) {
    ElMessage.warning("请输入退回说明");
    return;
  }
  actionLoading.value = true;
  try {
    const res = await returnWarningData({
      warningId: returnDialog.row.warningId,
      disposalContent: returnDialog.disposalContent
    });
    if (res.code === 200) {
      ElMessage.success("退回成功");
      returnDialog.visible = false;
      await loadCurrentTabData();
    } else {
      ElMessage.error(res.msg || "退回失败");
    }
  } finally {
    actionLoading.value = false;
  }
}

onMounted(async () => {
  await loadDicts();
  await preloadCounts();
});
</script>

<style scoped>
.todo-warning-page {
  background: #f5f7fb;
}

.page-card {
  border-radius: 16px;
  margin-bottom: 16px;
}

.header-card {
  background: linear-gradient(135deg, #eff6ff, #f8fbff);
  border: 1px solid #dbeafe;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: #1e3a8a;
}

.page-subtitle {
  margin-top: 8px;
  font-size: 13px;
  color: #64748b;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.summary-card {
  border: none;
  color: #fff;
}

.summary-card :deep(.el-card__body) {
  padding: 20px;
}

.summary-card.danger {
  background: linear-gradient(135deg, #dc2626, #f87171);
}

.summary-card.success {
  background: linear-gradient(135deg, #059669, #34d399);
}

.summary-card.primary {
  background: linear-gradient(135deg, #2563eb, #5b93ff);
}

.summary-label {
  font-size: 14px;
}

.summary-value {
  margin: 8px 0 10px;
  font-size: 30px;
  font-weight: 700;
}

.summary-desc {
  font-size: 12px;
  opacity: 0.9;
}

@media (max-width: 1200px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }
}
</style>
