:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef6f1;
  --text: #16202a;
  --muted: #627083;
  --line: #dde5ee;
  --green: #1c8b5f;
  --blue: #2563eb;
  --amber: #b7791f;
  --shadow: 0 12px 28px rgba(24, 34, 49, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(221, 229, 238, 0.88);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
}

.brand,
.topnav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-size: 18px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 900;
}

.topnav a {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
}

.topnav a:hover {
  background: #eef2f7;
  color: var(--text);
}

.shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 22px;
  width: min(1500px, calc(100% - 36px));
  margin: 22px auto 48px;
}

.sidebar {
  position: sticky;
  top: 86px;
  align-self: start;
  max-height: calc(100vh - 108px);
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.side-title {
  padding: 6px 10px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
}

.side-label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-icon {
  display: inline-grid;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 7px;
  background: #eef6f1;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.side-link em {
  flex: 0 0 auto;
  color: #8c98a8;
  font-style: normal;
  font-size: 12px;
}

.side-link:hover,
.side-link.active {
  background: var(--surface-2);
  color: var(--green);
}

.content {
  min-width: 0;
}

.search-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 10px;
}

.search-row input,
.admin-card input,
.admin-card select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 14px;
  outline: 0;
}

.search-row input:focus,
.admin-card input:focus,
.admin-card select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(28, 139, 95, 0.12);
}

.primary-btn,
.ghost-btn,
.search-actions button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.primary-btn {
  background: var(--green);
  color: #fff;
  font-weight: 700;
}

.primary-btn:hover {
  background: #15744e;
}

.ghost-btn,
.search-actions button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.ghost-btn {
  padding: 0 14px;
}

.ghost-btn:hover,
.search-actions button:hover {
  border-color: #bed0c5;
  color: var(--green);
}

.search-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.search-actions button {
  padding: 0 12px;
}

.stat {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}

.section-block {
  margin-top: 22px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.section-head h1 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.section-head a,
.section-head span {
  color: var(--muted);
  font-size: 13px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.tool-card {
  position: relative;
  min-width: 0;
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 7px 18px rgba(24, 34, 49, 0.05);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.tool-card:hover {
  transform: translateY(-2px);
  border-color: #bcd6c9;
  box-shadow: 0 13px 28px rgba(24, 34, 49, 0.1);
}

.tool-main {
  display: flex;
  gap: 12px;
  min-height: 90px;
  padding: 14px 14px 8px;
}

.tool-icon {
  display: grid;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.tool-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tool-icon b {
  color: var(--green);
}

.tool-copy {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
}

.tool-copy strong,
.tool-copy small,
.tool-copy em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-copy strong {
  font-size: 15px;
}

.tool-copy small {
  color: var(--muted);
  font-size: 12px;
}

.tool-copy em {
  margin-top: 4px;
  color: #8b99a8;
  font-style: normal;
  font-size: 12px;
}

.tool-category {
  display: inline-flex;
  max-width: calc(100% - 28px);
  margin: 0 14px 12px;
  padding: 3px 8px;
  overflow: hidden;
  border-radius: 8px;
  background: #f1f5f9;
  color: #617086;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 30px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  text-align: center;
}

.site-disclaimer {
  margin-top: 28px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}

.admin-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 24px auto 48px;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.admin-head h1,
.admin-card h2 {
  margin: 0;
}

.admin-head h1 {
  font-size: 24px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.admin-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.admin-card h2 {
  margin-bottom: 14px;
  font-size: 18px;
}

.admin-card label {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.admin-card .primary-btn {
  width: 100%;
}

.notice {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
}

.notice.success {
  background: #e9f8f0;
  color: #12633f;
}

.notice.error {
  background: #fff1f1;
  color: #a72a2a;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

td a {
  color: var(--blue);
}

@media (max-width: 1180px) {
  .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    display: flex;
    max-height: none;
    overflow-x: auto;
    gap: 8px;
  }

  .side-title {
    display: none;
  }

  .side-link {
    flex: 0 0 auto;
    min-width: 92px;
  }

  .cards,
  .admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 0 14px;
  }

  .brand span:last-child {
    max-width: 168px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topnav {
    gap: 4px;
  }

  .shell,
  .admin-shell {
    width: min(100% - 20px, 560px);
    margin-top: 12px;
  }

  .search-row,
  .cards,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .stat {
    width: 100%;
    margin-left: 0;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}
