:root {
  --blue: #1769ff;
  --blue-dark: #0751d8;
  --bg: #f5f8ff;
  --card: #ffffff;
  --text: #15213a;
  --muted: #6b7894;
  --line: #dfe7f6;
  --danger: #e5484d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input {
  font: inherit;
}

.page {
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px 14px 28px;
}

.hero {
  padding: 10px 2px 12px;
}

.top-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.top-nav a {
  display: block;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  text-align: center;
  text-decoration: none;
  font-size: 14px;
}

.top-nav a.active {
  border-color: rgba(23, 105, 255, 0.35);
  color: var(--blue);
  font-weight: 700;
  background: #eef4ff;
}

.hero h1 {
  margin: 0 0 6px;
  font-size: 28px;
  line-height: 1.2;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.search-panel {
  display: grid;
  grid-template-columns: 1fr 86px;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 8px 0 12px;
  background: var(--bg);
}

.search-box {
  display: flex;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 6px 18px rgba(23, 105, 255, 0.08);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 13px 8px 13px 14px;
  border-radius: 8px;
  color: var(--text);
  background: transparent;
}

.search-box input::-webkit-search-cancel-button,
.search-box input::-webkit-search-decoration {
  display: none;
}

.icon-btn,
.modal-close {
  width: 38px;
  height: 38px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 24px;
}

.primary-btn,
.outline-btn,
.danger-btn,
.text-btn {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.primary-btn {
  color: #fff;
  background: var(--blue);
  font-weight: 700;
}

.primary-btn:disabled {
  opacity: 0.65;
}

.outline-btn {
  border: 1px solid var(--line);
  color: var(--blue);
  background: #fff;
}

.outline-btn.strong {
  border-color: rgba(23, 105, 255, 0.35);
  font-weight: 700;
}

.danger-btn {
  color: var(--danger);
  background: #fff1f1;
}

.text-btn {
  color: var(--blue);
  background: transparent;
  padding: 4px 0;
}

.chips-section {
  margin-top: 6px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-head h2 {
  margin: 10px 0 8px;
  font-size: 15px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid #cfe0ff;
  border-radius: 8px;
  padding: 7px 10px;
  color: #1554ca;
  background: #fff;
  font-size: 13px;
}

.chips.muted .chip {
  color: var(--muted);
  border-color: var(--line);
}

.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 0 8px;
}

.result-toolbar strong {
  display: block;
  margin-bottom: 3px;
}

.result-toolbar span {
  color: var(--muted);
  font-size: 12px;
}

.result-toolbar .outline-btn {
  flex: 0 0 auto;
  padding: 8px 10px;
  font-size: 12px;
}

.source-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
  color: var(--muted);
  font-size: 12px;
}

.stat-pill {
  padding: 4px 7px;
  border-radius: 6px;
  background: #eaf1ff;
}

.state {
  margin: 28px 0;
  padding: 28px 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.7);
}

.group-title {
  margin: 16px 0 8px;
  font-size: 16px;
}

.resource-card {
  margin-bottom: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

.resource-title {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.35;
}

.resource-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  padding: 3px 6px;
  border-radius: 5px;
  background: #eef4ff;
}

.password-row {
  margin: 0 0 9px;
  font-size: 13px;
}

.card-actions,
.modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.card-actions button,
.modal-actions button {
  min-height: 36px;
  padding: 8px;
  font-size: 13px;
}

.footer {
  margin-top: 28px;
  padding: 16px 4px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.modal[hidden],
.toast[hidden],
[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(7, 18, 45, 0.55);
}

.modal-card {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  max-height: 82vh;
  overflow: auto;
  padding: 16px;
  border-radius: 8px;
  background: #fff;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
}

.modal-card h2 {
  margin: 0 42px 12px 0;
  font-size: 18px;
  line-height: 1.35;
}

.detail-list {
  margin: 0 0 14px;
}

.detail-list div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid #edf2fb;
  font-size: 13px;
}

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
}

.break {
  word-break: break-all;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 30;
  transform: translateX(-50%);
  max-width: calc(100vw - 40px);
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: rgba(0, 0, 0, 0.78);
  font-size: 14px;
}

@media (min-width: 560px) {
  .page {
    padding-top: 28px;
  }

  .modal-card {
    left: 50%;
    right: auto;
    bottom: 40px;
    width: 520px;
    transform: translateX(-50%);
  }
}
