:root {
  --page: #f5f7fb;
  --surface: #ffffff;
  --surface-strong: #eef4ff;
  --ink: #1d2430;
  --muted: #657083;
  --line: #dce3ee;
  --blue: #1f6feb;
  --green: #1f8a5f;
  --amber: #b76e00;
  --shadow: 0 14px 36px rgba(30, 43, 65, 0.09);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(31, 111, 235, 0.08), transparent 280px),
    var(--page);
  color: var(--ink);
  font-family:
    "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(280px, 440px);
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
}

.brand-mark {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: var(--shadow);
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: 0;
}

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

.search {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 20px;
  height: 20px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.search input {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  outline: none;
  box-shadow: 0 8px 24px rgba(30, 43, 65, 0.06);
}

.search input:focus {
  border-color: rgba(31, 111, 235, 0.65);
  box-shadow: 0 0 0 4px rgba(31, 111, 235, 0.12);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.view-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.view-head[hidden],
.filters[hidden] {
  display: none;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.back-button:hover {
  border-color: rgba(31, 111, 235, 0.5);
  color: var(--blue);
}

.back-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.view-head h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: 0;
}

.view-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.filter-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.filter-button:hover {
  border-color: rgba(31, 111, 235, 0.5);
  color: var(--ink);
}

.filter-button.is-active {
  border-color: rgba(31, 111, 235, 0.7);
  background: var(--surface-strong);
  color: var(--blue);
  font-weight: 700;
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.link-card {
  display: grid;
  width: 100%;
  min-height: 154px;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(30, 43, 65, 0.06);
  color: inherit;
  text-align: left;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.link-card-button {
  cursor: pointer;
}

.multi-link-card {
  grid-template-rows: auto 1fr auto auto;
}

.link-card:hover {
  border-color: rgba(31, 111, 235, 0.58);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.link-card.is-highlight {
  border-color: rgba(31, 111, 235, 0.9);
  background: linear-gradient(180deg, #ffffff, #eef5ff);
  box-shadow: 0 16px 38px rgba(31, 111, 235, 0.18);
}

.link-card.is-highlight .card-title {
  color: var(--blue);
}

.link-card.is-highlight .card-action {
  background: #dceaff;
  color: var(--blue);
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.card-icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius);
  background: #e8f7f0;
  color: var(--green);
}

.card-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.card-action {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: var(--radius);
  background: #f3f6fb;
  color: var(--muted);
}

.card-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.link-card:hover .card-action {
  background: #e8f0ff;
  color: var(--blue);
}

.card-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: 0;
}

.card-desc {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.card-footer {
  display: flex;
  align-items: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  overflow: hidden;
  border-radius: 6px;
  background: #fff7e8;
  color: var(--amber);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.multi-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(31, 111, 235, 0.25);
  border-radius: var(--radius);
  background: #eef5ff;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

.multi-link:hover {
  border-color: rgba(31, 111, 235, 0.65);
  background: #dceaff;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  gap: 8px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-state strong {
  color: var(--ink);
}

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

@media (max-width: 720px) {
  .shell {
    width: min(100% - 24px, 1180px);
    padding-top: 18px;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .view-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
  }

  h1 {
    font-size: 24px;
  }

  .link-grid {
    grid-template-columns: 1fr;
  }
}
