/* ============================================================
   FLAGG 数字助理 (Lumi) · 仪表盘样式
   与日报风格一致：蓝调渐变 + 玻璃卡片 + PingFang SC
   ============================================================ */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
               'Microsoft YaHei', Arial, sans-serif;
  background: linear-gradient(135deg, #e8f4fd 0%, #dceefb 25%, #f0f7fc 50%,
              #e3f0fa 75%, #eaf3fb 100%);
  color: #1a2a3a;
  font-size: 14px;
  line-height: 1.6;
  padding: 20px;
  max-width: 960px;
  margin: 0 auto;
  min-height: 100vh;
}

/* ── Header ── */
.header {
  text-align: center;
  padding: 24px 20px 20px;
  background: rgba(255,255,255,0.6);
  border-radius: 14px;
  margin-bottom: 20px;
  border: 1px solid rgba(255,255,255,0.8);
  box-shadow: 0 2px 12px rgba(0,60,120,0.05);
}
.header h1 {
  font-size: 24px; font-weight: 700; color: #1e5a8a;
}
.header h1 .subtitle {
  font-size: 14px; font-weight: 400; color: #5a7a94;
  display: block; margin-top: 2px;
}
.header .meta {
  font-size: 11px; color: #8a9fb0; margin-top: 5px;
}

/* ── Cards Row ── */
.cards-row {
  display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
}
.card {
  flex: 1; min-width: 130px;
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.9);
  border-radius: 12px; padding: 16px; text-align: center;
  box-shadow: 0 1px 8px rgba(0,60,120,0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,60,120,0.08);
}
.card.warn  { border-left: 3px solid #e6a817; }
.card.danger { border-left: 3px solid #d9444a; }
.card.good  { border-left: 3px solid #2e8b57; }
.card .number {
  font-size: 34px; font-weight: 800; color: #1e5a8a;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.card.warn .number   { color: #b8860b; }
.card.danger .number { color: #d9444a; }
.card.good .number   { color: #2e8b57; }
.card .label {
  font-size: 11px; color: #5a7a94; margin-top: 3px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.card .sub {
  font-size: 10px; color: #8a9fb0; display: block; margin-top: 2px;
}

/* ── Sections ── */
.section {
  background: rgba(255,255,255,0.55);
  border-radius: 12px;
  padding: 18px 20px; margin-bottom: 16px;
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: 0 1px 8px rgba(0,60,120,0.03);
}
.section h2 {
  font-size: 15px; font-weight: 700; color: #1e5a8a;
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(30,90,138,0.12);
  margin-bottom: 12px;
}
.section h2 .badge {
  display: inline-block;
  font-size: 11px; font-weight: 600; padding: 1px 8px;
  border-radius: 9px; margin-left: 6px;
}
.badge.red    { background: rgba(217,68,74,0.12); color: #d9444a; }
.badge.yellow { background: rgba(184,134,11,0.12); color: #b8860b; }
.badge.green  { background: rgba(46,139,87,0.12); color: #2e8b57; }
.badge.blue   { background: rgba(30,90,138,0.1);  color: #1e5a8a; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%; border-collapse: collapse; font-size: 12px;
  margin: 6px 0 12px;
}
th {
  background: rgba(30,90,138,0.06); color: #3a6a88;
  padding: 7px 8px; text-align: left; font-weight: 600;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.2px;
  border-bottom: 2px solid rgba(30,90,138,0.15);
  white-space: nowrap;
}
td {
  padding: 6px 8px; border-bottom: 1px solid rgba(30,90,138,0.06);
  vertical-align: top; font-size: 12px;
  word-break: break-word;
}
tr:hover { background: rgba(30,90,138,0.02); }
.num { text-align: right; font-variant-numeric: tabular-nums;
       font-family: 'SF Mono', 'Consolas', 'Monaco', monospace; }

/* ── Tags ── */
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 9px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.2px;
  white-space: nowrap;
}
.tag.danger { background: rgba(217,68,74,0.12); color: #d9444a; }
.tag.warn   { background: rgba(184,134,11,0.12); color: #b8860b; }
.tag.ok     { background: rgba(46,139,87,0.12); color: #2e8b57; }

/* ── Alert Items ── */
.alert-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; margin-bottom: 8px;
  border-radius: 8px;
  font-size: 13px;
}
.alert-item.danger {
  background: rgba(217,68,74,0.06); border-left: 3px solid #d9444a;
}
.alert-item.warn {
  background: rgba(184,134,11,0.06); border-left: 3px solid #e6a817;
}
.alert-item .icon { font-size: 18px; flex-shrink: 0; }
.alert-item .body { flex: 1; }
.alert-item .body .po { font-weight: 600; color: #1a2a3a; }
.alert-item .body .detail { font-size: 11px; color: #5a7a94; }
.alert-item .body .days { font-size: 11px; font-weight: 600; }

/* ── Empty State ── */
.empty {
  text-align: center; padding: 40px 20px; color: #8a9fb0;
}
.empty .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty p { font-size: 13px; }

/* ── Chat Widget ── */
.chat-section {
  background: rgba(255,255,255,0.7);
  border-radius: 12px; padding: 12px 16px;
  border: 1px solid rgba(255,255,255,0.9);
  box-shadow: 0 1px 8px rgba(0,60,120,0.04);
  display: flex; gap: 10px; align-items: center;
}
.chat-input {
  flex: 1; border: 1px solid rgba(30,90,138,0.15);
  border-radius: 8px; padding: 10px 14px; font-size: 13px;
  font-family: inherit; color: #1a2a3a;
  background: rgba(255,255,255,0.6);
  outline: none; transition: border-color 0.2s;
}
.chat-input:focus { border-color: #3a7ab5; }
.chat-btn {
  background: linear-gradient(135deg, #1e5a8a, #3a7ab5);
  color: white; border: none; border-radius: 8px;
  padding: 10px 20px; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: opacity 0.2s;
}
.chat-btn:hover { opacity: 0.9; }
.chat-btn:disabled { opacity: 0.5; cursor: default; }

/* ── Chat Response ── */
.chat-response {
  margin-top: 14px; display: none;
}
.chat-response.show { display: block; }
.chat-response .msg {
  background: rgba(255,255,255,0.7); border-radius: 10px;
  padding: 14px 18px; border: 1px solid rgba(255,255,255,0.9);
  font-size: 13px; white-space: pre-wrap; line-height: 1.7;
  box-shadow: 0 1px 6px rgba(0,60,120,0.03);
}

/* ── Quick Links ── */
.quick-links {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px;
}
.quick-link {
  font-size: 11px; color: #3a7ab5; cursor: pointer;
  background: rgba(30,90,138,0.06); padding: 4px 10px;
  border-radius: 6px; border: none;
  font-family: inherit; transition: background 0.15s;
}
.quick-link:hover { background: rgba(30,90,138,0.12); }

/* ── Responsive ── */
@media (max-width: 640px) {
  body { padding: 12px; }
  .cards-row { gap: 8px; }
  .card { min-width: 100px; padding: 12px 10px; }
  .card .number { font-size: 26px; }
  .header h1 { font-size: 20px; }
  .chat-section { flex-direction: column; }
  .chat-btn { width: 100%; }
}

/* ── Loading ── */
.loading { opacity: 0.5; pointer-events: none; }
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white; border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 6px; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
