/* 网站监控系统后台样式 */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #f3f5f9;
  color: #1f2937;
}

/* 布局 */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 20px 60px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.filters select {
  border: 1px solid #d1d5db; border-radius: 8px; padding: 8px 12px;
  font-size: 14px; background: #fff; margin-left: 8px; cursor: pointer;
}
.two-col {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* 卡片 */
.card {
  background: #fff; border-radius: 12px; padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 16px;
}
.card h3 { margin: 0 0 14px; font-size: 15px; }
.chart-card { padding-bottom: 12px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.legend-info { font-size: 12px; color: #6b7280; }

/* 指标卡 */
.cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px; margin-bottom: 18px;
}
.stat-card {
  background: #fff; border-radius: 12px; padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.stat-label { font-size: 12px; color: #6b7280; margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 700; color: #111827; }
.stat-value.online { color: #16a34a; }
.stat-sub { font-size: 12px; color: #9ca3af; margin-top: 6px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid #f1f3f7; white-space: nowrap; }
th { color: #6b7280; font-weight: 600; font-size: 12px; }
tbody tr:hover { background: #f8fafc; }
.mono { font-family: Consolas, Monaco, monospace; }
.url-cell { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: #9ca3af; }
.small { font-size: 12px; font-weight: 400; }

/* 表单与按钮 */
.inline-form { display: flex; gap: 10px; }
.inline-form input[type=text] {
  flex: 1; border: 1px solid #d1d5db; border-radius: 8px; padding: 9px 12px; font-size: 14px;
}
.btn {
  background: #2563eb; color: #fff; border: 0; border-radius: 8px;
  padding: 9px 20px; font-size: 14px; cursor: pointer;
}
.btn:hover { background: #1d4ed8; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-light { background: #eef2f7; color: #374151; }
.btn-light:hover { background: #e2e8f0; }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-danger:hover { background: #fecaca; }

/* 站点卡片 */
.site-card .site-head {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
  margin-bottom: 10px;
}
.site-head .muted { margin-left: 10px; }
.site-actions { display: flex; gap: 8px; }
.embed-code {
  width: 100%; font-family: Consolas, Monaco, monospace; font-size: 12px;
  border: 1px solid #e5e7eb; background: #f8fafc; border-radius: 8px;
  padding: 10px; color: #334155; resize: none; word-break: break-all;
}

/* 提示 */
.alert { border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; font-size: 14px; }
.alert.ok { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.alert.err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* 登录页 */
.login-body {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: linear-gradient(135deg, #eef2ff 0%, #f0fdf4 100%);
}
.login-card {
  background: #fff; border-radius: 14px; padding: 40px 36px; width: 360px;
  box-shadow: 0 10px 40px rgba(0,0,0,.1); text-align: center;
}
.login-card h1 { font-size: 19px; margin: 0 0 22px; }
.login-card input {
  width: 100%; border: 1px solid #d1d5db; border-radius: 8px;
  padding: 11px 14px; font-size: 15px; margin-bottom: 14px;
}
.login-card button {
  width: 100%; background: #2563eb; color: #fff; border: 0; border-radius: 8px;
  padding: 11px; font-size: 15px; cursor: pointer;
}
.login-card button:hover { background: #1d4ed8; }
.login-error { color: #dc2626; font-size: 13px; margin: 0 0 14px; }
.login-tip { font-size: 12px; color: #9ca3af; margin-top: 18px; }

/* 来源与终端条形图 */
.bars-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 28px; }
@media (max-width: 700px) { .bars-grid { grid-template-columns: 1fr; } }
.bar-title { font-size: 12px; color: #6b7280; margin-bottom: 9px; font-weight: 600; }
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.bar-label {
  width: 70px; flex: 0 0 70px; color: #374151;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar-track { flex: 1; height: 8px; background: #f1f3f7; border-radius: 6px; overflow: hidden; }
.bar-track i {
  display: block; height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, #93c5fd, #2563eb);
}
.bar-val { width: 48px; flex: 0 0 48px; text-align: right; color: #6b7280; }

/* 可用性状态标签 */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.pill-ok { background: #ecfdf5; color: #047857; }
.pill-down { background: #fef2f2; color: #b91c1c; }
.pill-idle { background: #f1f3f7; color: #6b7280; }

/* 站点地址表单 */
.url-form { margin-bottom: 12px; }

/* 明细搜索 */
.search-box { display: flex; gap: 8px; align-items: center; }
.search-box input[type=search] {
  width: 300px; border: 1px solid #d1d5db; border-radius: 8px; padding: 8px 12px; font-size: 13px;
}

/* 表单控件统一观感（密码 / 数字 / 下拉 / 搜索） */
.inline-form input[type=password],
.inline-form input[type=number],
.inline-form input[type=search],
.inline-form select {
  border: 1px solid #d1d5db; border-radius: 8px; padding: 9px 12px; font-size: 14px;
  background: #fff; color: #111827;
}
.inline-form input[type=password],
.inline-form input[type=number],
.inline-form input[type=search] { flex: 1; }
.input-num { max-width: 140px; flex: 0 0 140px !important; }

/* 表格行内展开操作 */
.row-actions summary { cursor: pointer; color: #2563eb; font-size: 13px; list-style: none; }
.row-actions summary::-webkit-details-marker { display: none; }
.row-actions[open] summary { margin-bottom: 8px; }
.row-actions .inline-form { margin: 6px 0; }

/* 账号信息表 */
table.kv th { width: 110px; padding: 7px 0; font-weight: 500; }
table.kv td { padding: 7px 0; font-size: 14px; white-space: normal; }
table.kv tr:hover { background: transparent; }

/* 两步验证密钥 */
.secret {
  display: inline-block; background: #0f172a; color: #e2e8f0;
  padding: 8px 12px; border-radius: 8px; font-size: 13px; letter-spacing: 1px;
}
.break-all { word-break: break-all; }

/* ===================== 左侧栏目布局 ===================== */
.layout { display: flex; min-height: 100vh; background: #f6f8fb; }

.sidebar {
  width: 218px; flex: 0 0 218px; background: #fff; border-right: 1px solid #e5e9f0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 30;
}
.side-brand {
  display: flex; align-items: center; gap: 9px; padding: 16px 18px 12px;
  font-weight: 700; font-size: 15px; color: #111827; text-decoration: none;
  border-bottom: 1px solid #f1f5f9;
}
.side-logo { color: #2563eb; font-size: 17px; }
.side-menu { flex: 1; padding: 6px 0 14px; }
.side-group-title {
  font-size: 11px; color: #9ca3af; padding: 13px 18px 5px; letter-spacing: 1px;
}
.side-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 18px;
  color: #3f4a5a; font-size: 13.5px; text-decoration: none;
  border-left: 3px solid transparent;
}
.side-item:hover { background: #f4f7fc; color: #2563eb; }
.side-item.active { background: #eef4ff; color: #2563eb; border-left-color: #2563eb; font-weight: 600; }
.side-icon { width: 15px; text-align: center; font-size: 12px; color: #a3aebd; }
.side-item.active .side-icon { color: #2563eb; }
.side-foot {
  border-top: 1px solid #f1f5f9; padding: 12px 18px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.side-user { font-size: 13px; color: #374151; }
.side-logout { font-size: 12px; color: #6b7280; text-decoration: none; }
.side-logout:hover { color: #dc2626; }

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main-head {
  display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 22px;
  background: #fff; border-bottom: 1px solid #e5e9f0; position: sticky; top: 0; z-index: 20;
}
.main-title { font-size: 16px; font-weight: 600; margin: 0; color: #111827; }
.main-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.main-wrap .container { max-width: 1280px; width: 100%; margin: 0 auto; padding: 20px 22px 60px; }
.menu-toggle { display: none; }
.side-mask { display: none; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh; transform: translateX(-100%);
    transition: transform .18s ease; box-shadow: 0 0 26px rgba(15, 23, 42, .18);
  }
  .sidebar.open { transform: none; }
  .menu-toggle {
    display: block; background: #fff; border: 1px solid #e5e9f0; border-radius: 6px;
    padding: 3px 9px; font-size: 16px; line-height: 1.4; cursor: pointer; color: #374151;
  }
  .side-mask.show { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 25; }
  .main-wrap .container { padding: 16px 14px 50px; }
  .main-head { padding: 0 14px; }
}

/* ===================== 条形列表 / 趋势 / 分页 ===================== */
.bar-list { display: flex; flex-direction: column; gap: 2px; }
.bar-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; }
.bar-label {
  width: 136px; flex: 0 0 136px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #4b5563;
}
.bar-track { flex: 1; height: 8px; background: #eef2f7; border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, #3b82f6, #60a5fa); border-radius: 4px; }
.bar-val { width: 78px; text-align: right; color: #111827; font-variant-numeric: tabular-nums; }

.trend-svg { width: 100%; height: auto; display: block; margin-top: 6px; }
.trend-legend { display: flex; gap: 16px; font-size: 12px; color: #6b7280; }
.trend-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 14px; }
.pager .disabled { opacity: .45; pointer-events: none; }

/* ===================== 页面内小部件 ===================== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 1000px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.mini-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.mini-card { background: #fff; border: 1px solid #e9eef5; border-radius: 12px; padding: 14px 16px; }
.mini-card .k { font-size: 12px; color: #6b7280; }
.mini-card .v { font-size: 22px; font-weight: 700; color: #111827; margin-top: 5px; font-variant-numeric: tabular-nums; }
.mini-card .s { font-size: 11px; color: #9ca3af; margin-top: 4px; }

.status-pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; }
.st-ok { background: #ecfdf5; color: #047857; }
.st-warn { background: #fffbeb; color: #b45309; }
.st-bad { background: #fef2f2; color: #b91c1c; }
.st-mute { background: #f3f4f6; color: #6b7280; }

.tag { display: inline-block; padding: 0 6px; border-radius: 4px; background: #eef2f7; color: #475569; font-size: 11px; margin-left: 4px; }
.tag-spider { background: #fef3c7; color: #92400e; }
.tag-err { background: #fee2e2; color: #b91c1c; }
.tag-slow { background: #ede9fe; color: #6d28d9; }

.toolbar-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.mono-ip { font-family: Consolas, Monaco, monospace; font-size: 12.5px; }
.truncate { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-16 { margin-bottom: 16px; }
