:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #66756d;
  --panel: #fbfcf8;
  --line: #dfe5dc;
  --sidebar: #101814;
  --sidebar-2: #18251e;
  --accent: #d8ff5f;
  --accent-ink: #1a230f;
  --teal: #1e7568;
  --rust: #b8572c;
  --shadow: 0 18px 42px rgba(20, 32, 25, 0.14);
  --radius: 8px;
  --mono: "SFMono-Regular", "Cascadia Mono", "Menlo", monospace;
  --sans: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #e8eee6;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  background:
    linear-gradient(135deg, rgba(216, 255, 95, 0.14), transparent 34%),
    repeating-linear-gradient(90deg, rgba(23, 32, 27, 0.03) 0 1px, transparent 1px 64px),
    #e9eee6;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 22px;
  color: #eff7ee;
  background:
    linear-gradient(180deg, rgba(216, 255, 95, 0.1), transparent 38%),
    var(--sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-mark {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--accent-ink);
  font-weight: 800;
  background: var(--accent);
  border-radius: var(--radius);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

.brand-mark.has-image {
  background: #fff;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.subcategory-head h3,
.subcategory-head p,
.site-card h4,
.site-card p {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
  letter-spacing: 0;
}

.brand p {
  margin-top: 3px;
  color: rgba(239, 247, 238, 0.68);
  font-size: 12px;
}

.category-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: 22px 0;
  overflow: auto;
}

.category-button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 46px;
  padding: 6px 8px;
  color: rgba(239, 247, 238, 0.78);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.category-button:hover,
.category-button.active {
  color: #fff;
  background: var(--sidebar-2);
  border-color: rgba(216, 255, 95, 0.22);
}

.category-button.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.category-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 7px;
}

.category-name {
  min-width: 0;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer {
  display: grid;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.contact-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  color: var(--accent-ink);
  font-weight: 800;
  text-decoration: none;
  background: var(--accent);
  border: 1px solid rgba(26, 35, 15, 0.12);
  border-radius: var(--radius);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.14);
  transition:
    transform 140ms ease,
    box-shadow 140ms ease;
}

.contact-button:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 -2px 0 rgba(0, 0, 0, 0.14),
    0 12px 24px rgba(216, 255, 95, 0.16);
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.eyebrow {
  color: var(--teal);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar h2 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
  letter-spacing: 0;
}

.topbar .category-summary {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.toolbar {
  display: flex;
  flex: 0 1 620px;
  gap: 10px;
  justify-content: flex-end;
  min-width: 280px;
}

.search-box {
  display: flex;
  flex: 1;
  align-items: center;
  min-width: 220px;
  height: 46px;
  padding: 0 14px;
  background: rgba(251, 252, 248, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(20, 32, 25, 0.06);
}

.search-box span {
  color: var(--teal);
  font-size: 20px;
  line-height: 1;
}

.search-box input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 0 0 10px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.favorite-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  padding: 0 14px;
  color: #fff;
  font-weight: 800;
  background: var(--teal);
  border: 1px solid rgba(30, 117, 104, 0.24);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(20, 32, 25, 0.06);
  transition:
    transform 140ms ease,
    box-shadow 140ms ease;
}

.favorite-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(30, 117, 104, 0.16);
}

.subcategory-list {
  display: grid;
  gap: 20px;
  margin-top: 24px;
}

.subcategory-group {
  min-width: 0;
}

.subcategory-head {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  padding: 0 2px;
}

.subcategory-head h3 {
  font-size: 18px;
}

.subcategory-head span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
}

.site-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(292px, 1fr));
  gap: 14px;
  align-items: start;
}

.site-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(20, 32, 25, 0.08);
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.site-card:hover {
  border-color: rgba(30, 117, 104, 0.34);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.site-card-head {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
}

.site-favicon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #f7fff4;
  font-weight: 900;
  background: var(--teal);
  border-radius: var(--radius);
}

.site-card h4 {
  min-width: 0;
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-url {
  min-width: 0;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-card p {
  min-height: 42px;
  color: #3f4b44;
  font-size: 14px;
  line-height: 1.5;
}

.copy-fields {
  display: grid;
  gap: 7px;
}

.copy-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  background: #eef4ea;
  border: 1px solid #dbe5d7;
  border-radius: var(--radius);
}

.copy-value {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.copy-value span {
  display: inline;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.copy-value strong {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-button {
  min-width: 64px;
  min-height: 32px;
  padding: 0 10px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 800;
  background: #fff;
  border: 1px solid rgba(30, 117, 104, 0.24);
  border-radius: 7px;
}

.copy-button.copied {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: rgba(26, 35, 15, 0.12);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 25px;
}

.tag {
  max-width: 100%;
  padding: 4px 8px;
  overflow: hidden;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(30, 117, 104, 0.1);
  border-radius: 999px;
}

.site-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding-top: 2px;
}

.visit-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  background: var(--sidebar);
  border-radius: var(--radius);
}

.category-chip {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 330px;
  padding: 28px;
  text-align: center;
  background: rgba(251, 252, 248, 0.76);
  border: 1px dashed #c7d1c5;
  border-radius: var(--radius);
}

.empty-state h3,
.empty-state p {
  margin: 0;
}

.empty-state p {
  max-width: 420px;
  margin-top: 8px;
  color: var(--muted);
}

.empty-icon {
  color: var(--teal);
  font-size: 42px;
  font-weight: 900;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  color: #f8fff4;
  font-weight: 800;
  background: var(--sidebar);
  border: 1px solid rgba(216, 255, 95, 0.22);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

@media (max-width: 900px) {
  .shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    z-index: 10;
    height: auto;
    padding: 14px;
  }

  .brand {
    padding-bottom: 12px;
  }

  .category-nav {
    flex-direction: row;
    gap: 8px;
    padding: 12px 0;
    overflow-x: auto;
  }

  .category-button {
    flex: 0 0 auto;
    width: auto;
    min-width: 150px;
  }

  .sidebar-footer {
    padding-top: 12px;
  }

  .workspace {
    padding: 20px 14px;
  }

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

  .toolbar {
    flex: 1 1 auto;
    min-width: 0;
  }
}

@media (max-width: 560px) {
  .toolbar {
    flex-direction: column;
  }

  .search-box {
    min-width: 0;
  }

  .favorite-button {
    width: 100%;
  }

  .subcategory-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

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

  .copy-button {
    width: auto;
  }
}
