:root {
  --bg: #f5f7fa;
  --elev: #ffffff;
  --soft: #eef1f5;
  --line: #d7dde5;
  --line-soft: #e6ebf1;
  --text: #1f2933;
  --muted: #6b7484;
  --accent: #0b7fc4;
  --green: #1a7f37;
  --red: #cf222e;
  --orange: #9a6700;
  --blue: #0550ae;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
button { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* login */
.login-view {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, rgba(11,127,196,.08), transparent 50%), var(--bg);
}
.login-card {
  width: min(380px, calc(100vw - 40px));
  background: var(--elev); border: 1px solid var(--line);
  border-radius: 16px; padding: 30px 28px; text-align: center;
  box-shadow: 0 12px 32px rgba(15,30,45,.08);
}
.login-logo { font-size: 34px; }
.login-card h1 { margin: 10px 0 4px; font-size: 23px; }
.login-card p { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.login-card input {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 10px; outline: none; font-size: 15px; background: var(--bg);
}
.login-card input:focus { border-color: var(--accent); }
.login-card button {
  width: 100%; height: 42px; margin-top: 14px; border: 0; border-radius: 10px;
  background: var(--accent); color: #fff; font-weight: 700; cursor: pointer;
}
.login-error { color: var(--red); font-size: 12px; min-height: 18px; margin-top: 8px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 18px; background: var(--elev);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 800; font-size: 17px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-actions a, .topbar-actions button {
  color: var(--muted); text-decoration: none; background: none; border: 0;
  cursor: pointer; font-size: 13px; padding: 6px 10px; border-radius: 8px;
}
.topbar-actions a:hover, .topbar-actions button:hover { background: var(--soft); color: var(--text); }
.updated { color: var(--muted); font-size: 12px; }

.container { max-width: 1240px; margin: 0 auto; padding: 18px 18px 60px; }
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end;
  background: var(--elev); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; margin-bottom: 14px;
}
.filter-bar label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
.filter-bar label.wide { flex: 1 1 240px; }
.filter-bar select, .filter-bar input {
  height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--bg); color: var(--text); outline: none; min-width: 130px;
}
.filter-bar input[type="date"] { min-width: 148px; }
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--accent); }
.filter-actions { display: flex; align-items: center; gap: 8px; }
.filter-actions button, .result-head button {
  height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--elev); cursor: pointer;
}
.filter-actions button { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.filter-actions .ghost, .result-head .ghost { background: var(--elev); color: var(--text); }
.live { flex-direction: row !important; align-items: center; gap: 6px !important; white-space: nowrap; }

.result-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
  color: var(--muted); font-size: 12.5px;
}
#summary { flex: 1; }
#page-no { white-space: nowrap; }

.log-list { display: flex; flex-direction: column; gap: 6px; }
.log-row {
  display: grid; grid-template-columns: 150px 90px 90px minmax(0,1fr);
  gap: 12px; align-items: start;
  background: var(--elev); border: 1px solid var(--line-soft); border-radius: 10px;
  padding: 9px 12px;
}
.log-row:hover { border-color: var(--line); }
.log-time { font-family: var(--mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.log-source { font-family: var(--mono); font-size: 11.5px; color: var(--blue); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-level { font-size: 11px; text-align: center; border-radius: 20px; padding: 2px 0; align-self: center; }
.log-level.info { color: var(--green); background: rgba(26,127,55,.08); }
.log-level.warn { color: var(--orange); background: rgba(154,103,0,.1); }
.log-level.error { color: var(--red); background: rgba(207,34,46,.08); }
.log-level.debug { color: var(--muted); background: rgba(107,116,132,.1); }
.log-main { min-width: 0; }
.log-message { white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; }
.log-meta { margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.log-meta pre { margin: 4px 0 0; background: var(--bg); padding: 8px; border-radius: 8px; overflow-x: auto; font-size: 11px; white-space: pre-wrap; word-break: break-all; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #1f2933; color: #fff; padding: 9px 16px; border-radius: 10px; z-index: 30;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); font-size: 13px;
}

@media (max-width: 820px) {
  .log-row { grid-template-columns: 1fr; gap: 4px; }
  .log-level { justify-self: start; }
  .filter-actions { width: 100%; flex-wrap: wrap; }
}

/* ---------- 移动端不支持提示 ---------- */
.mobile-block {
  display: none;
}

@media (max-width: 820px) {
  .mobile-block {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 24px;
    text-align: center;
  }

  .mobile-card {
    max-width: 360px;
    background: var(--elev);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 30px 24px;
    box-shadow: 0 12px 32px rgba(15, 30, 45, 0.1);
  }

  .mobile-emoji {
    font-size: 40px;
    margin: 0 0 10px;
  }

  .mobile-card h2 {
    margin: 0 0 10px;
    font-size: 20px;
  }

  .mobile-card p:last-child {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.7;
  }
}
