:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #fff5f6;
  --ink: #18181b;
  --muted: #6b7280;
  --line: #e8eaef;
  --line-strong: #d7dbe3;
  --red: #ff2442;
  --red-dark: #d91f38;
  --green: #00a870;
  --shadow: 0 12px 30px rgba(24, 24, 27, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Noto Sans SC", sans-serif;
  background:
    linear-gradient(180deg, rgba(255, 36, 66, 0.07), rgba(255, 36, 66, 0) 220px),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

.page-shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 52px;
}

.site-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: white;
  background: var(--red);
  font-family: "Manrope", sans-serif;
  font-weight: 800;
}

.admin-actions {
  display: none;
}

.workspace {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.intro-panel,
.tools-panel,
.toolbar,
.tool-card,
.category-card,
.dialog-form,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.intro-panel {
  position: sticky;
  top: 20px;
  padding: 22px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--red);
  font-family: "Manrope", sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Manrope", "Noto Sans SC", sans-serif;
  letter-spacing: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.15;
}

.intro-text {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.stat-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
}

.stat-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stat-card strong {
  font-family: "Manrope", sans-serif;
  font-size: 26px;
}

.quick-guide {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.quick-guide h2 {
  font-size: 18px;
}

.quick-guide ol {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.6;
}

.tools-panel {
  padding: 14px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 12px;
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: none;
}

.search-box {
  display: grid;
  gap: 8px;
}

.search-box label,
.dialog-form label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search-box input,
.search-box select,
.dialog-form input,
.dialog-form select,
.dialog-form textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: white;
  outline: none;
}

.dialog-form textarea {
  min-height: 96px;
  padding-top: 10px;
}

.search-box input:focus,
.search-box select:focus,
.dialog-form input:focus,
.dialog-form select:focus,
.dialog-form textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 36, 66, 0.1);
}

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

.category-grid {
  display: none;
}

.tool-card {
  position: relative;
  display: grid;
  gap: 14px;
  min-height: 360px;
  padding: 18px;
  overflow: hidden;
}

.tool-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--card-accent, var(--red));
}

.tool-card.is-featured,
.tool-card:first-child {
  border-color: rgba(255, 36, 66, 0.22);
  background: linear-gradient(180deg, #fff7f8, #ffffff 44%);
}

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

.tool-category {
  margin: 0 0 9px;
  color: var(--red);
  font-family: "Manrope", sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tool-card h3 {
  font-size: 23px;
  line-height: 1.25;
}

.tool-description {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.tool-actions,
.delete-category {
  display: none;
}

.tag-row,
.tool-meta,
.meta-chips,
.tool-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag-row {
  align-self: end;
  margin: 4px 0 0;
}

.tag,
.pricing-chip,
.version-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.tag {
  color: #4b5563;
  background: #f3f4f6;
}

.pricing-chip {
  color: var(--red-dark);
  background: var(--surface-soft);
}

.version-chip {
  color: #047857;
  background: #ecfdf5;
}

.tool-meta {
  align-self: end;
  justify-content: space-between;
  align-items: end;
}

.tool-links {
  margin-left: auto;
}

.doc-link,
.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.doc-link {
  color: var(--ink);
  border: 1px solid var(--line-strong);
  background: white;
}

.download-link {
  color: white;
  background: var(--red);
  box-shadow: 0 10px 20px rgba(255, 36, 66, 0.22);
}

.download-link::before {
  content: "↓";
  margin-right: 6px;
  font-size: 16px;
}

.doc-link::before {
  content: "i";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  border-radius: 50%;
  color: white;
  background: var(--red);
  font-family: "Manrope", sans-serif;
  font-size: 11px;
}

.doc-link:hover,
.download-link:hover,
.primary-btn:hover,
.secondary-btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}

.primary-btn,
.secondary-btn,
.icon-btn {
  cursor: pointer;
  border-radius: 999px;
  font-weight: 800;
}

.primary-btn,
.secondary-btn {
  min-height: 40px;
  padding: 0 14px;
}

.primary-btn {
  border: 0;
  color: white;
  background: var(--red);
}

.secondary-btn {
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: white;
}

dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(24, 24, 27, 0.42);
}

.dialog-form {
  display: grid;
  width: min(560px, calc(100vw - 24px));
  gap: 14px;
  padding: 20px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dialog-form label {
  display: grid;
  gap: 8px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-strong);
  background: white;
  font-size: 20px;
}

.empty-state {
  padding: 22px;
  color: var(--muted);
  box-shadow: none;
}

@media (max-width: 960px) {
  .workspace,
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .intro-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 18px, 1160px);
    padding-top: 14px;
  }

  .site-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 28px;
  }

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

  .tool-card {
    min-height: auto;
  }

  .tool-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .tool-links {
    width: 100%;
    margin-left: 0;
  }

  .doc-link,
  .download-link {
    flex: 1;
  }
}
