/* BarryYJJ AI 简报 · 网站样式（form gate / viewer / admin 共用） */

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  margin: 0;
  background: #f7f8fa;
  color: #1f2933;
  line-height: 1.7;
  min-height: 100vh;
}

.page-frame {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 28px;
  position: relative;
  min-height: 100vh;
}

/* 右上角徽章 */
.corner-meta {
  position: absolute;
  top: 28px; right: 28px;
  text-align: right;
  font-size: 10.5px;
  color: #9aa5b1;
  line-height: 1.6;
  letter-spacing: 0.2px;
}
.corner-meta .brand {
  font-weight: 600;
  color: #5e6b78;
  font-size: 11px;
  margin-bottom: 2px;
}
@media (max-width: 640px) {
  .corner-meta { top: 14px; right: 12px; font-size: 9px; }
  .corner-meta .brand { font-size: 9.5px; }
}

/* ========== Gate (index.html) ========== */
.gate-card {
  max-width: 480px;
  margin: 80px auto 0;
  padding: 44px 36px 32px;
  background: white;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  border: 1px solid #eef2f7;
}
.hero { text-align: center; margin-bottom: 32px; }
.hero h1 {
  margin: 0 0 12px;
  font-size: 26px;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.3px;
}
.hero .subtitle {
  margin: 0; font-size: 14px;
  color: #5e6b78; line-height: 1.7;
}

.gate-form .form-hint {
  font-size: 12px;
  color: #9aa5b1;
  padding: 10px 14px;
  background: #f7fafc;
  border-radius: 6px;
  margin-bottom: 20px;
  text-align: center;
  border: 1px dashed #e2e8f0;
}
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 13px;
  color: #4a5568;
  font-weight: 500;
  margin-bottom: 6px;
}
.field .req { color: #e53e3e; font-weight: 600; }
.field input, .field textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fafbfc;
  color: #2d3748;
  transition: border-color 0.15s, background 0.15s;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: #1f6feb;
  background: white;
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.1);
}
.field textarea { resize: vertical; min-height: 60px; }

.submit-btn {
  display: block;
  width: 100%;
  padding: 13px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: white;
  background: linear-gradient(135deg, #1f6feb, #3b82f6);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 4px;
  transition: filter 0.15s, transform 0.05s;
}
.submit-btn:hover { filter: brightness(1.05); }
.submit-btn:active { transform: scale(0.99); }
.submit-btn:disabled {
  background: #cbd5e0;
  cursor: not-allowed;
  filter: none;
}

.err-msg {
  margin-top: 14px;
  padding: 10px 14px;
  background: #fff5f5;
  color: #c53030;
  border-radius: 6px;
  border: 1px solid #feb2b2;
  font-size: 13px;
}

.footer-note {
  text-align: center;
  font-size: 11px;
  color: #9aa5b1;
  margin: 28px 0 0;
  letter-spacing: 0.2px;
}

/* ========== Viewer (viewer.html) ========== */
.page-frame.viewer {
  max-width: 1024px;
}
.viewer-header {
  margin: 30px 0 22px;
  padding-bottom: 18px;
  border-bottom: 3px solid #1f6feb;
}
.viewer-header h1 {
  margin: 0 0 14px;
  font-size: 22px;
  font-weight: 600;
  color: #1a1a1a;
}
.viewer-header h1 .title-prefix {
  color: #1f6feb;
}
.brief-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.brief-controls label {
  font-size: 13px;
  color: #5e6b78;
  margin-right: -6px;
}
.ctrl-input {
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: white;
  color: #2d3748;
}
.period-toggle {
  display: flex;
  gap: 0;
  margin-left: auto;
}
.period-btn {
  padding: 7px 16px;
  font-size: 13px;
  font-family: inherit;
  background: white;
  color: #5e6b78;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.15s;
}
.period-btn:first-child { border-radius: 6px 0 0 6px; }
.period-btn:last-child { border-radius: 0 6px 6px 0; }
.period-btn + .period-btn { border-left: none; }
.period-btn.active {
  background: #1f6feb;
  color: white;
  border-color: #1f6feb;
}

.brief-wrap {
  background: white;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
#brief-frame {
  width: 100%;
  min-height: calc(100vh - 220px);
  border: none;
  display: block;
}

.empty-state {
  padding: 80px 40px;
  text-align: center;
  background: white;
  border-radius: 10px;
  border: 1px dashed #e2e8f0;
  color: #9aa5b1;
}

/* ========== Admin (admin.html) ==========
   Scoped to body.admin-page / .page-frame.admin only — must not leak into
   gate (index.html) or viewer (viewer.html), which share this stylesheet. */
body.admin-page {
  --admin-paper: #f6f2e9;
  --admin-paper-raised: #fffdf8;
  --admin-ink: #1c1a15;
  --admin-ink-soft: #4a453a;
  --admin-ink-faint: #6b6558;
  --admin-border: #e6dfcd;
  --admin-border-strong: #d7cead;
  --admin-accent: #1f6feb;
  --admin-accent-text: #1257c9;
  --admin-accent-soft: #e8f0fe;
  --admin-mono: ui-monospace, "SF Mono", Menlo, "Cascadia Mono", Consolas, monospace;
  background: var(--admin-paper);
  color: var(--admin-ink);
}

.page-frame.admin {
  max-width: 1180px;
}
.page-frame.admin .corner-meta {
  font-family: var(--admin-mono);
  color: var(--admin-ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.page-frame.admin .corner-meta .brand {
  color: var(--admin-ink-soft);
}

.page-frame.admin .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.admin-topbar {
  margin: 34px 0 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--admin-border-strong);
}
.admin-kicker {
  margin: 0 0 10px;
  font-family: var(--admin-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--admin-accent-text);
}
.admin-title {
  margin: 0 0 10px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--admin-ink);
}
.admin-desc {
  margin: 0;
  max-width: 560px;
  font-size: 14px;
  color: var(--admin-ink-soft);
}

/* Stats: hairline grid via 1px background gaps, no shadow */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--admin-border);
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 22px;
}
.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px;
  background: var(--admin-paper-raised);
}
.stat-label {
  font-family: var(--admin-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--admin-ink-faint);
}
.stat-value {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--admin-ink);
}
.stat-tile-accent .stat-value { color: var(--admin-accent-text); }
.stat-tile-accent .stat-label { color: var(--admin-accent-text); }

@media (max-width: 640px) {
  .admin-stats { grid-template-columns: repeat(2, 1fr); }

  .page-frame.admin {
    padding: 24px 16px 40px;
  }
  .page-frame.admin .corner-meta {
    position: static;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 28px;
    text-align: left;
  }
  .page-frame.admin .corner-meta .brand { margin-bottom: 0; }
  .admin-topbar { margin-top: 0; }
}

@media (max-width: 360px) {
  .admin-stats { grid-template-columns: 1fr; }
}

.admin-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}
.admin-search { flex: 1; }
.admin-search-input {
  width: 100%;
  min-height: 44px;
  padding: 11px 14px;
  font-size: 14px;
  font-family: inherit;
  background: var(--admin-paper-raised);
  color: var(--admin-ink);
  border: 1px solid var(--admin-border-strong);
  border-radius: 6px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.admin-search-input::placeholder { color: var(--admin-ink-faint); }
.admin-search-input:focus-visible {
  outline: 2px solid var(--admin-accent);
  outline-offset: 1px;
  border-color: var(--admin-accent);
}
.admin-refresh-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0 20px;
  font-family: var(--admin-mono);
  font-size: 13px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--admin-paper-raised);
  color: var(--admin-accent-text);
  border: 1px solid var(--admin-accent);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.admin-refresh-btn:hover { background: var(--admin-accent); color: #fff; }
.admin-refresh-btn:focus-visible {
  outline: 2px solid var(--admin-accent);
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .admin-toolbar { flex-wrap: wrap; }
  .admin-search { flex: 1 1 100%; }
  .admin-refresh-btn { flex: 1 1 100%; }
}

.admin-table-wrap {
  overflow-x: auto;
  background: var(--admin-paper-raised);
  border: 1px solid var(--admin-border-strong);
  border-radius: 6px;
}
.admin-table-wrap:has(.visitors-table[hidden]) { display: none; }
.admin-scroll-hint {
  display: none;
  margin: 0 0 8px;
  font-family: var(--admin-mono);
  font-size: 11px;
  color: var(--admin-ink-faint);
  text-align: right;
}
.visitors-table {
  width: 100%;
  min-width: 920px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.visitors-table th, .visitors-table td {
  padding: 12px 14px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--admin-border);
}
.visitors-table th:first-child,
.visitors-table td:first-child { width: 170px; }
.visitors-table th:nth-child(2),
.visitors-table td:nth-child(2) { width: 86px; }
.visitors-table th:nth-child(6),
.visitors-table td:nth-child(6) { width: 120px; }
.visitors-table th:last-child,
.visitors-table td:last-child { width: 112px; text-align: center; }
.visitors-table td:nth-child(5) { white-space: normal; min-width: 160px; }
.visitors-table th {
  font-family: var(--admin-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--admin-ink-faint);
  background: var(--admin-paper);
}
.visitors-table tbody tr:last-child td { border-bottom: none; }
.visitors-table tbody tr:hover { background: var(--admin-accent-soft); }
.visitors-table td.muted { color: var(--admin-ink-faint); font-size: 12px; }
.visitors-table .ts {
  font-family: var(--admin-mono);
  font-variant-numeric: tabular-nums;
  color: var(--admin-ink-soft);
}

.visit-cell { white-space: nowrap; }
.visit-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  min-width: 44px;
  padding: 4px 10px;
  background: var(--admin-accent-soft);
  color: var(--admin-accent-text);
  border: none;
  border-radius: 4px;
  font-family: var(--admin-mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.visit-toggle:hover { background: var(--admin-accent); color: #fff; }
.visit-toggle.open { background: var(--admin-accent); color: #fff; }
.visit-toggle:focus-visible {
  outline: 2px solid var(--admin-accent);
  outline-offset: 2px;
}
.visit-toggle .caret {
  display: inline-block;
  font-size: 10px;
}
.visit-zero {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 4px 10px;
  font-family: var(--admin-mono);
  font-size: 12px;
  color: var(--admin-ink-faint);
  background: var(--admin-paper);
  border: 1px solid var(--admin-border);
  border-radius: 4px;
}

.visit-detail-row td {
  background: var(--admin-paper);
  padding: 14px 16px !important;
  border-top: none !important;
  white-space: normal;
}
.visit-list {
  margin: 0;
  padding: 0 0 0 18px;
  font-family: var(--admin-mono);
  font-size: 12px;
  color: var(--admin-ink);
  line-height: 1.9;
}
.visit-detail-head {
  margin: 0 0 6px;
  font-family: var(--admin-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--admin-ink-faint);
}
.visit-list li::marker { color: var(--admin-border-strong); }
.visit-ts {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.auth-prompt {
  padding: 48px 36px;
  text-align: center;
  background: var(--admin-paper-raised);
  border: 1px solid var(--admin-border-strong);
  border-radius: 6px;
}
.auth-prompt-code {
  margin: 0 0 12px;
  font-family: var(--admin-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--admin-ink-faint);
}
.auth-prompt h3 {
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--admin-ink);
}
.auth-prompt p {
  margin: 0;
  font-size: 13px;
  color: var(--admin-ink-soft);
}
.auth-prompt code {
  font-family: var(--admin-mono);
  background: var(--admin-paper);
  border: 1px solid var(--admin-border);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--admin-accent-text);
}

.loading-state {
  padding: 40px;
  text-align: center;
  font-family: var(--admin-mono);
  color: var(--admin-ink-faint);
  font-size: 13px;
}

@media (max-width: 720px) {
  .admin-scroll-hint { display: block; }
  .admin-scroll-hint:has(+ .admin-table-wrap .visitors-table[hidden]) { display: none; }
  .admin-table-wrap {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-frame.admin *,
  .page-frame.admin *::before,
  .page-frame.admin *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}
